@abtnode/blocklet-services 1.16.52-beta-20250930-134044-9b691563 → 1.16.52-beta-20251003-083412-fdfc4e36
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/libs/connect/session.js +33 -36
- package/api/routes/access-key.js +13 -1
- package/api/routes/user-session.js +1 -1
- package/api/routes/user.js +2 -2
- package/api/services/auth/connect/invite.js +1 -1
- package/api/services/auth/connect/issue-passport.js +1 -1
- package/api/services/auth/session.js +5 -3
- package/dist/assets/{AdapterDayjs-DJz1a4Qx.js → AdapterDayjs-CAaLcejt.js} +1 -1
- package/dist/assets/{Google-D6480ezX.js → Google-BMeng9mn.js} +1 -1
- package/dist/assets/{access-control-DBdY7ucY.js → access-control-BbcaXOFy.js} +1 -1
- package/dist/assets/{actions-DiS46mya.js → actions-DbBJOD0d.js} +1 -1
- package/dist/assets/{add-component-core-Cev7hXWc.js → add-component-core--Z5nF5rL.js} +7 -7
- package/dist/assets/add-resource-DRGO7kDY.js +1 -0
- package/dist/assets/{addon-EoDNqFad.js → addon-CnJnEleb.js} +2 -2
- package/dist/assets/{advanced-DKI68HjI.js → advanced-DlEH3ib_.js} +2 -2
- package/dist/assets/{aigne-CjC_i4GF.js → aigne-CnGxZFk3.js} +1 -1
- package/dist/assets/api-BUbloWod.js +1 -0
- package/dist/assets/{appearance-O0nUhNEQ.js → appearance-DKR3ZZ-t.js} +1 -1
- package/dist/assets/{ar-DrftSIv3.js → ar-7nBHeQPa.js} +1 -1
- package/dist/assets/{ar-DWsJvQhm.js → ar-DDKSNNIB.js} +1 -1
- package/dist/assets/{arrow-down.svg-KTkEGh4D.js → arrow-down.svg-B_TkYBj9.js} +1 -1
- package/dist/assets/{audit-logs-m94KXy26.js → audit-logs-CY22RcFd.js} +2 -2
- package/dist/assets/authorize-DoJw-6hl.js +1 -0
- package/dist/assets/{base-chart-Be8WpaNd.js → base-chart-BbbiwJIa.js} +1 -1
- package/dist/assets/base32-CgLd9kUN.js +1 -0
- package/dist/assets/bind-account-CKozG7iQ.js +1 -0
- package/dist/assets/branding-Dc9wDqPm.js +1 -0
- package/dist/assets/{branding-BMzor1hN.js → branding-DqgDW-Pg.js} +2 -2
- package/dist/assets/{branding-DZkv2-B6.js → branding-T8GaJvdM.js} +5 -5
- package/dist/assets/{bundle-avatar-ClP0s92u.js → bundle-avatar-BALJ_pZQ.js} +1 -1
- package/dist/assets/button-BG8yGG9e.js +1 -0
- package/dist/assets/{click-to-copy-DBNEocQx.js → click-to-copy-CVHuu877.js} +1 -1
- package/dist/assets/{cloneDeep-DC1IBdzb.js → cloneDeep-E2Pxqpbv.js} +1 -1
- package/dist/assets/{collapse-C7KroRZD.js → collapse-DhGi244c.js} +1 -1
- package/dist/assets/{complete-CACnLOf-.js → complete-Td6_SOPf.js} +4 -4
- package/dist/assets/{component-CmQX5aKr.js → component-tJC1J22-.js} +3 -3
- package/dist/assets/{config-BlfZIK3N.js → config-CiixR7JW.js} +1 -1
- package/dist/assets/{config-NAEGgfiM.js → config-CuaqTz1E.js} +2 -2
- package/dist/assets/{config-B7R4_aR5.js → config-DkBKIb7u.js} +4 -4
- package/dist/assets/{config-navigation-DcjynTKg.js → config-navigation-BFl1_q-j.js} +3 -3
- package/dist/assets/{config-space-CcdEKukD.js → config-space-B8dCR8jO.js} +1 -1
- package/dist/assets/confirm-BUTyrkJR.js +7 -0
- package/dist/assets/{connect-Gm3BGJOG.js → connect-C2T5mJpT.js} +1 -1
- package/dist/assets/{connect-D0Yxb636.js → connect-CwCzBgdq.js} +1 -1
- package/dist/assets/connect-to-C62UBG81.js +1 -0
- package/dist/assets/{content-layout-C5M6XN5d.js → content-layout-CaGd-JXO.js} +1 -1
- package/dist/assets/createClass-BuhPvJV8.js +1 -0
- package/dist/assets/{dashboard-CmUsG3tt.js → dashboard-B0Fy6SmC.js} +6 -6
- package/dist/assets/{de-rG0WLGYs.js → de-C5jW-Aco.js} +1 -1
- package/dist/assets/{de-CzR7Usym.js → de-Dn7PhTZq.js} +1 -1
- package/dist/assets/{delete-confirm-Dogr_ntZ.js → delete-confirm-zH2oZyqM.js} +1 -1
- package/dist/assets/{did-address-DtRDDQBD.js → did-address-CeTjTMC4.js} +1 -1
- package/dist/assets/domain-BmzmdNfA.js +9 -0
- package/dist/assets/domain-action-card-BM27YVmt.js +28 -0
- package/dist/assets/domains-CEkJn9DL.js +1 -0
- package/dist/assets/{email-fmVVdTOG.js → email-vdkECdsC.js} +3 -3
- package/dist/assets/{empty-spinner-CBrinxF5.js → empty-spinner-CkCqfxFX.js} +1 -1
- package/dist/assets/engine-CCa9THLZ.js +1 -0
- package/dist/assets/{es-BHI4ILsC.js → es-B_X5HHiA.js} +1 -1
- package/dist/assets/{es-6DKPq8Yn.js → es-DnE5Se03.js} +1 -1
- package/dist/assets/{exchange-passport-DlMqIBtT.js → exchange-passport-DdKgNabQ.js} +1 -1
- package/dist/assets/{form-Bii6E4NV.js → form-DD1zzF-R.js} +2 -2
- package/dist/assets/{form-text-input-TeuIo9S2.js → form-text-input-CqoNK3mi.js} +1 -1
- package/dist/assets/{form-wrapper-DZhsWXpc.js → form-wrapper-DNqXvSru.js} +1 -1
- package/dist/assets/{fr-BqKCXdV2.js → fr-BIAMVkwl.js} +1 -1
- package/dist/assets/{fr-CT3g9qN-.js → fr-BpXortYf.js} +1 -1
- package/dist/assets/{fuel-BaMJ9704.js → fuel-h75SX900.js} +1 -1
- package/dist/assets/gen-access-key-BZebBcUZ.js +1 -0
- package/dist/assets/gen-simple-access-key-Bq7DCyW7.js +1 -0
- package/dist/assets/get-safe-url-CeMtySPx.js +1 -0
- package/dist/assets/{hi-DlvVN0mm.js → hi-4-0lpKbp.js} +1 -1
- package/dist/assets/{home-C3u9ExRL.js → home-B3HQdfZf.js} +1 -1
- package/dist/assets/{id-YNynvxGd.js → id-Dw1-p0GY.js} +1 -1
- package/dist/assets/iframe-ASQIizLx.js +1 -0
- package/dist/assets/{index-VQg2UaAe.js → index-3xeMR-Qg.js} +1 -1
- package/dist/assets/{index-CGUzaOG1.js → index-6B51asLP.js} +9 -9
- package/dist/assets/{index-DhDY9QRj.js → index-6IwthDxj.js} +1 -1
- package/dist/assets/index-BIIL1VhU.js +1039 -0
- package/dist/assets/{index-cZALvweI.js → index-BNDipwdR.js} +3 -3
- package/dist/assets/{index-BhAogHJp.js → index-BVRSxJRS.js} +1 -1
- package/dist/assets/index-BYry2QZ3.js +29 -0
- package/dist/assets/{index-DJWOH9gC.js → index-BiLQGAIi.js} +1 -1
- package/dist/assets/{index-5sEksRZE.js → index-BjcHj49D.js} +1 -1
- package/dist/assets/{index-dIy0_-0B.js → index-BlTmYBsg.js} +5 -5
- package/dist/assets/{index-BC-hI70z.js → index-BluBXQJ4.js} +4 -4
- package/dist/assets/{index-BROakthZ.js → index-BtHqqZ50.js} +1 -1
- package/dist/assets/index-BzFZ1zhO.js +1 -0
- package/dist/assets/{index-BpIHv06W.js → index-C2DPoZpQ.js} +5 -5
- package/dist/assets/{index-Cs2FIJbg.js → index-CD_JYNBB.js} +12 -12
- package/dist/assets/{index-oMo0FAbH.js → index-CGXZRmKt.js} +5 -5
- package/dist/assets/{index-BVtCqyO7.js → index-CKsy2_Ph.js} +2 -2
- package/dist/assets/{index-40tvlREo.js → index-CZkVe8t1.js} +13 -13
- package/dist/assets/index-C_YGTMJ4.js +1 -0
- package/dist/assets/{index-26LcjK03.js → index-Chi1YHs4.js} +1 -1
- package/dist/assets/{index-Di2bKYQ8.js → index-CmjYsAgT.js} +1 -1
- package/dist/assets/index-CmsJ8Fn7.js +1 -0
- package/dist/assets/index-CzlhyS8_.js +62 -0
- package/dist/assets/index-DBJZdu-W.js +113 -0
- package/dist/assets/{index-CCNgWb6m.js → index-DbXxI_D0.js} +1 -1
- package/dist/assets/{index-DPbI7VX_.js → index-Dn4pwRtk.js} +1 -1
- package/dist/assets/{index-BLaILoF2.js → index-Dr9NaKfR.js} +1 -1
- package/dist/assets/index-DwQNuuxR.js +283 -0
- package/dist/assets/index-ImKSuLO2.js +55 -0
- package/dist/assets/{index-DIDKpIk_.js → index-KJrnzKIu.js} +1 -1
- package/dist/assets/index-ajyKTkxP.js +7 -0
- package/dist/assets/{invitation-BEg6pBgL.js → invitation-CMi0GWFt.js} +3 -3
- package/dist/assets/{invite-PSJCbkuS.js → invite-DpA2tJ_s.js} +1 -1
- package/dist/assets/{isURL-uDqs2WzZ.js → isURL-CSKc4kTl.js} +2 -2
- package/dist/assets/{issue-passport-DfPL_iUw.js → issue-passport-B0QyEUjC.js} +1 -1
- package/dist/assets/{item-BT44fN4f.js → item-DsH8hlQV.js} +1 -1
- package/dist/assets/{ja-DEmGhfzG.js → ja-C6gbn0J8.js} +1 -1
- package/dist/assets/{ko-Crmr1RC-.js → ko-DGXdpX64.js} +1 -1
- package/dist/assets/{ko-CfYoSPs0.js → ko-av2FKXII.js} +1 -1
- package/dist/assets/{landing-page-CiEaPNxq.js → landing-page-CAdZF71_.js} +1 -1
- package/dist/assets/{launch-result-message-CxGW5bAC.js → launch-result-message-B0--4ubW.js} +1 -1
- package/dist/assets/{layout-C3Si15N2.js → layout-CN4YohUY.js} +1 -1
- package/dist/assets/list-2lBZBVJD.js +103 -0
- package/dist/assets/list-Bf1rfvw3.js +2 -0
- package/dist/assets/{list-header-D3Jek4lG.js → list-header-DlrmpNef.js} +1 -1
- package/dist/assets/localization-D12SXxDi.js +1 -0
- package/dist/assets/{log-J00kI7L6.js → log-CKMWqM_9.js} +19 -19
- package/dist/assets/logger-CsgnUk8i.js +1 -0
- package/dist/assets/{login-oauth-callback-BAbCWNXl.js → login-oauth-callback-B4wL5LK5.js} +1 -1
- package/dist/assets/login-y-09uRl4.js +1 -0
- package/dist/assets/{logo-uploader-BMe29xQY.js → logo-uploader-CgW-ljTo.js} +2 -2
- package/dist/assets/{lost-passport-BrFPShnF.js → lost-passport-BiaJ8Qil.js} +2 -2
- package/dist/assets/{observability-DpWIYJKx.js → observability-3BjnzXRV.js} +1 -1
- package/dist/assets/{omit-BpknVl5C.js → omit-r-0RLWOV.js} +1 -1
- package/dist/assets/{open-window-BWuQbNLw.js → open-window-BAToG1Zw.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-DYA1LPYk.js → over-due-invoice-payment-D4EbV_XU.js} +1 -1
- package/dist/assets/{overview-BFfWkxz5.js → overview-C734Rasc.js} +2 -2
- package/dist/assets/{page-header-hQvIh9SJ.js → page-header-DP0csqkR.js} +1 -1
- package/dist/assets/passport-item-DTKCI96Q.js +1 -0
- package/dist/assets/{permission-mCHWpIY_.js → permission-DWlLl3B8.js} +1 -1
- package/dist/assets/{playground-D-q7ZMPl.js → playground-BEhnKrD-.js} +1 -1
- package/dist/assets/preferences-DTgCHjY9.js +1 -0
- package/dist/assets/profile-embed-4R2fOO01.js +1 -0
- package/dist/assets/{pt-DTd68aWZ.js → pt-C5SxM_jO.js} +1 -1
- package/dist/assets/{pt-DlPLN19J.js → pt-CIqefLTL.js} +1 -1
- package/dist/assets/publish-resource-CHMkx0I2.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CjbGIjxA.js → react-beautiful-dnd.esm-9QLg1KOC.js} +1 -1
- package/dist/assets/{react-stripe.esm-UJXznrFM.js → react-stripe.esm-DWiCVD55.js} +1 -1
- package/dist/assets/{required-BukCSojp.js → required-BUAaYcMZ.js} +1 -1
- package/dist/assets/{ru-BNhuVXCB.js → ru-B4h3WudR.js} +1 -1
- package/dist/assets/{ru-BHPYrefb.js → ru-BWd-_jpY.js} +1 -1
- package/dist/assets/runtime-CUzpUEb5.js +1 -0
- package/dist/assets/{sanitize-yJUw5BK9.js → sanitize-mRppk1lK.js} +1 -1
- package/dist/assets/sdk-CxjuM-ya.js +1 -0
- package/dist/assets/{section-CGjbjaFj.js → section-CCfmWVdK.js} +1 -1
- package/dist/assets/{security-BJOY2ThQ.js → security-D--MQBTg.js} +3 -3
- package/dist/assets/session-B_RHNjCZ.js +1 -0
- package/dist/assets/{setup-Betrrcxk.js → setup-BS5cDalg.js} +1 -1
- package/dist/assets/{shorten-label-BIRHi2FS.js → shorten-label-DAXPWCI6.js} +1 -1
- package/dist/assets/{simple-select-7X88QDSX.js → simple-select-BHPmFba3.js} +1 -1
- package/dist/assets/{spaces-MBu98S71.js → spaces-6iUrdnzs.js} +1 -1
- package/dist/assets/{start-BvExYMOr.js → start-ByPfhiAj.js} +1 -1
- package/dist/assets/{starting-progress-DrUauyTC.js → starting-progress-CxdsmebW.js} +1 -1
- package/dist/assets/status-DA0S9WgZ.js +1 -0
- package/dist/assets/{step-actions-CpLfyTzR.js → step-actions-3Nz2nPoP.js} +1 -1
- package/dist/assets/{studio-CBJGdxxo.js → studio-C6g9y1mS.js} +1 -1
- package/dist/assets/{switch-control-DNlNJjsm.js → switch-control-Bs2D4JNi.js} +1 -1
- package/dist/assets/{table-tips-C_tKxS1_.js → table-tips-B1dFVdej.js} +1 -1
- package/dist/assets/team-CcIOrTIk.js +146 -0
- package/dist/assets/{th-CSbI3a1U.js → th-BjttL5p9.js} +1 -1
- package/dist/assets/{th-Bk3GO_e5.js → th-CRUlNqtq.js} +1 -1
- package/dist/assets/traffic-KIPRLJPY.js +1 -0
- package/dist/assets/{transfer-CnRpT327.js → transfer-B90XYpQX.js} +1 -1
- package/dist/assets/{unsubscribe-SOswYB3-.js → unsubscribe-DBJXxz9h.js} +1 -1
- package/dist/assets/{use-app-logo-Czrt0i-p.js → use-app-logo-Cs4SrcDi.js} +1 -1
- package/dist/assets/{use-mobile-6sugw6dZ.js → use-mobile-BW9mTiYC.js} +1 -1
- package/dist/assets/{use-mobile-DdL6gIr_.js → use-mobile-B_fpUHD7.js} +1 -1
- package/dist/assets/{use-server-logo-Cb1mX_m3.js → use-server-logo-R848M-JH.js} +1 -1
- package/dist/assets/{use-window-close-DRT8NYsb.js → use-window-close-Dk0lXOqo.js} +1 -1
- package/dist/assets/{useAsync-CP1EfcG_.js → useAsync-DkQHu4t4.js} +1 -1
- package/dist/assets/{useAsync-BO3iirQz.js → useAsync-DoI7Qt9M.js} +1 -1
- package/dist/assets/{useAsyncRetry-b_Q7rsZ1.js → useAsyncRetry-DNTidBXG.js} +1 -1
- package/dist/assets/useLocalStorage-BzRs3x-K.js +1 -0
- package/dist/assets/user-center-bNIwz7Mp.js +126 -0
- package/dist/assets/{user-follower-BzN1JToB.js → user-follower-UoHvZnoE.js} +1 -1
- package/dist/assets/user-sessions-DqMaEduy.js +1 -0
- package/dist/assets/{util-CFOWM3Un.js → util-C8ahPkmT.js} +1 -1
- package/dist/assets/{util-Dr-F1wWu.js → util-CRzq0bMY.js} +1 -1
- package/dist/assets/{vendor-arcblock-DbQi15Va.js → vendor-arcblock-BhtOu00C.js} +138 -139
- package/dist/assets/{vendor-hooks-Bm2oaDgr.js → vendor-hooks-BtDnIwBH.js} +1 -1
- package/dist/assets/{vendor-mui-core-C_NjJRjl.js → vendor-mui-core-BIZOanxj.js} +1 -1
- package/dist/assets/{vendor-mui-x-B2kLzf_6.js → vendor-mui-x-DWX99wt-.js} +1 -1
- package/dist/assets/vendor-utils-CVwaKsP9.js +213 -0
- package/dist/assets/{vendor-ux-JmtAaYLa.js → vendor-ux-Cfhaj-oj.js} +12 -12
- package/dist/assets/{vi-xPRidQ_j.js → vi-5AzowaJ4.js} +1 -1
- package/dist/assets/{wait-connect-BJSNhW2P.js → wait-connect-E47qTAaT.js} +1 -1
- package/dist/assets/{wizard-CxdbMgRd.js → wizard-2kfr1LiF.js} +1 -1
- package/dist/assets/{wizard-components-BlDjNTl3.js → wizard-components-De0Ol72d.js} +3 -3
- package/dist/assets/wrap-locale-Ck3zJtU5.js +1 -0
- package/dist/assets/{zh-Blu7Gys0.js → zh-1ARDBzTp.js} +1 -1
- package/dist/assets/{zh-BCFTG394.js → zh-Du23hKEW.js} +1 -1
- package/dist/assets/{zh-tw-BLENKI0o.js → zh-tw-DAvBOrfW.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +38 -38
- package/dist/assets/add-resource-A4bZ0dTp.js +0 -1
- package/dist/assets/api-eF9RCcCm.js +0 -1
- package/dist/assets/authorize-BHa1jxY6.js +0 -1
- package/dist/assets/base32-d0IrDPx_.js +0 -1
- package/dist/assets/bind-account-DQGyQsBg.js +0 -1
- package/dist/assets/branding-BJoo_ZXQ.js +0 -1
- package/dist/assets/button-iJgy0AQY.js +0 -1
- package/dist/assets/confirm-tusB0uUh.js +0 -7
- package/dist/assets/connect-to-D3EWn_NY.js +0 -1
- package/dist/assets/createClass-C0KDHIFs.js +0 -1
- package/dist/assets/domain-3OQTdQwA.js +0 -9
- package/dist/assets/domain-action-card-mesh-ZO1.js +0 -28
- package/dist/assets/domains-D3oaqtHD.js +0 -1
- package/dist/assets/engine-BGPujcMC.js +0 -1
- package/dist/assets/gen-access-key-B97ypTb-.js +0 -1
- package/dist/assets/gen-simple-access-key-US636G5K.js +0 -1
- package/dist/assets/get-safe-url-CpIY2Nr0.js +0 -1
- package/dist/assets/hdkey-TGNLUqEt.js +0 -62
- package/dist/assets/iframe-ByrkdYaj.js +0 -1
- package/dist/assets/index-BPPTaU3u.js +0 -55
- package/dist/assets/index-Basg4QeI.js +0 -1
- package/dist/assets/index-BsmMnQ_k.js +0 -283
- package/dist/assets/index-CUu0DjUL.js +0 -30
- package/dist/assets/index-Clgc5RbF.js +0 -7
- package/dist/assets/index-D5BfPJgd.js +0 -1
- package/dist/assets/index-DOCDPBXj.js +0 -113
- package/dist/assets/index-DgDvwRqt.js +0 -1041
- package/dist/assets/index-HOEytilv.js +0 -1
- package/dist/assets/list-DLK8qdTn.js +0 -103
- package/dist/assets/list-iYXxqPI6.js +0 -4
- package/dist/assets/localization-BY1kjw33.js +0 -1
- package/dist/assets/logger-Brrx9tV7.js +0 -1
- package/dist/assets/login-Wg20R9T3.js +0 -1
- package/dist/assets/passport-item-CF_y0rsT.js +0 -1
- package/dist/assets/preferences-BmlOlGxi.js +0 -1
- package/dist/assets/profile-embed-BIIlF2uQ.js +0 -1
- package/dist/assets/publish-resource-3lgLri0K.js +0 -1
- package/dist/assets/runtime-BS-wC6gn.js +0 -1
- package/dist/assets/sdk-BLd-VTrL.js +0 -1
- package/dist/assets/session-CfoR5Wvh.js +0 -1
- package/dist/assets/slugify-bzSZ5XYw.js +0 -1
- package/dist/assets/status-DRtLD-z9.js +0 -1
- package/dist/assets/team-Dd8yHElY.js +0 -146
- package/dist/assets/toLower-BqRfvn1N.js +0 -1
- package/dist/assets/traffic-lCSWEOva.js +0 -1
- package/dist/assets/useLocalStorage-D6j--D5r.js +0 -1
- package/dist/assets/user-center-CUpoxNlx.js +0 -126
- package/dist/assets/user-sessions-Cem_kfLj.js +0 -1
- package/dist/assets/vendor-utils-Gk-1qvTR.js +0 -213
- package/dist/assets/wrap-locale-DOt3Fsgq.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr,a5 as ei,I as No,bU as Ao,S as Do,
|
|
1
|
+
import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr,a5 as ei,I as No,bU as Ao,S as Do,cc as va,dO as ya,aP as Mo,F as ba,z as Gn,bH as xa,bI as wa,bJ as Sa,bC as Ea,aX as Bo,V as ka,aO as Ta,cO as ja,cP as Oa,bA as Ca,bD as Ia,M as ti,am as Fo,aq as Ra,b1 as ut,b7 as Pa,dJ as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as Tn,Y as Na,bv as Wo,o as zo,aU as Aa,ar as Xt,c6 as Da,c5 as Ma,c1 as Ei,U as ki,ah as Ba,dL as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as Ti,aI as za,dG as Va}from"./vendor-mui-core-BIZOanxj.js";import{r as q,g as ni,u as Ka,i as Ga,p as Ha,e as Xa,a as Ut,d as Ya,f as In,j as Ja}from"./vendor-react-Dvs43sk9.js";import{r as ri,S as Qa,s as Ko,A as Za}from"./item-DsH8hlQV.js";import{n as bt,b as ii,f as Go,T as St,O as xt,a6 as el,r as tl,K as Hn,H as Xn,av as ji,l as Qt,o as Ho,$ as zn,v as Xo,e as nl,p as rl,I as Br,aY as il}from"./vendor-ux-Cfhaj-oj.js";import{Y as un,f as $t,c as ol,c7 as sl,b7 as al,bV as Yo,c8 as ll,c9 as cl,ca as ul,cb as dl,a3 as hl,W as Bt,bE as fl,v as Jo,aK as pl,cc as ml,G as gl,cd as vl,a7 as Yn,ce as Qo,bh as Zo,k as Jn,ag as Oi,cf as yl,an as bl,cg as xl,ch as wl,ci as Rn,cj as Ci,b8 as Sl}from"./index-BIIL1VhU.js";import{j as Ii,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-BhtOu00C.js";import{u as Ri}from"./launch-result-message-B0--4ubW.js";import{a as Fr}from"./page-header-DP0csqkR.js";import{e as yt,B as Ol,C as nn,J as Qn,D as Pi,R as es,Q as Cl,a7 as Il,A as Rl,o as or,V as Pl,al as Ll,am as _l,an as Nl,a as bn,S as Al,b as Dl}from"./vendor-utils-CVwaKsP9.js";import{f as $r}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-CCa9THLZ.js";import{u as Bl,C as Fl}from"./config-space-B8dCR8jO.js";import{R as Pn}from"./required-BUAaYcMZ.js";import{S as $l}from"./index-BiLQGAIi.js";import{a as ts,h as Ul,w as ql,f as Wl,b as zl,d as Vl,e as Kl,M as Gl}from"./index-3xeMR-Qg.js";import{k as jn,a as Hl,b as Xl,u as ns,g as Yl,o as Jl}from"./vendor-hooks-BtDnIwBH.js";import{g as Ql}from"./get-safe-url-CeMtySPx.js";import{r as rs,A as Zl}from"./config-DkBKIb7u.js";import{r as ec}from"./index-BPy8_fa2.js";import{r as tc}from"./cloneDeep-E2Pxqpbv.js";import{u as oi}from"./useLocalStorage-BzRs3x-K.js";import{v as Li}from"./index-DbXxI_D0.js";import{u as nc}from"./session-B_RHNjCZ.js";import{W as rc}from"./did-address-CeTjTMC4.js";import{a as _i}from"./api-BUbloWod.js";import{v as ic,e as oc}from"./util-C8ahPkmT.js";import{u as is}from"./use-mobile-BW9mTiYC.js";import{C as sc}from"./content-layout-CaGd-JXO.js";import{C as ac,D as lc,a as cc}from"./connect-to-C62UBG81.js";import{d as sr}from"./search-4YYphs0l.js";const Lf="blocklet-add-component-registry",_f="server-add-registry",Nf=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=un();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:F.bool,children:F.any.isRequired,onConfirm:F.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(uc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(bt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(jt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(ii,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:F.func.isRequired,nextDisabled:F.bool,launching:F.bool,description:F.any,texts:F.object};const uc=ot.div`
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -113,7 +113,7 @@ import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr
|
|
|
113
113
|
.wmde-markdown[data-color-mode='dark'] {
|
|
114
114
|
background: transparent;
|
|
115
115
|
}
|
|
116
|
-
`;ds.propTypes={blockletMeta:F.object.isRequired,locale:F.string.isRequired,handleDescEle:F.node};function Bc({...e}){return l.jsxs("div",{...e,style:{width:"100%"},children:[l.jsx("h3",{children:"End User License Agreement for Application"}),l.jsxs("p",{children:["Blocklet Server License Agreement ",
|
|
116
|
+
`;ds.propTypes={blockletMeta:F.object.isRequired,locale:F.string.isRequired,handleDescEle:F.node};function Bc({...e}){return l.jsxs("div",{...e,style:{width:"100%"},children:[l.jsx("h3",{children:"End User License Agreement for Application"}),l.jsxs("p",{children:["Blocklet Server License Agreement ",ol.COPYRIGHT_OWNER," version 2020-08-28"]}),l.jsx("p",{children:"BLOCKLET SERVER LICENSE AGREEMENT"}),l.jsx("p",{children:"暂无"})]})}function Fc(e){return`${e.bundleSource?.store||e.meta.homepage}/assets/${e.meta?.did}/${e.meta?.logo||"logo.png"}?v=${e.meta?.version}`}function hs({installRelated:e=!1,meta:t=null,show:r=!1,onClose:i,components:s,loading:n}){const{t:o}=St(),a=Yt(f=>f.breakpoints.down("md"));if(!r)return null;const d=!n&&s.length===0,h=!n&&s.length!==0,u=40;return l.jsxs(ii,{title:o("blocklet.component.relatedComponents",{name:t.title}),maxWidth:!1,fullWidth:!1,onClose:(f,j)=>{j!=="backdropClick"&&i(!1)},PaperProps:{style:a?{width:"100%",height:window.innerHeight}:{maxWidth:500,minWidth:300,width:"80%"}},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:[n&&l.jsx(te,{sx:{marginTop:4,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},children:l.jsx(te,{component:xt,icon:"line-md:loading-loop",sx:{color:"primary.main",fontSize:32}})}),d&&l.jsx(te,{sx:{textAlign:"center"},children:o("blocklet.component.noDependencies",{name:t.title})}),h&&l.jsx(te,{sx:{marginBottom:2},children:s.map(f=>{if(!f.meta)return null;const{required:j}=f;let m;return e||j?m=1:m=.5,l.jsxs(te,{sx:{opacity:m,padding:"10px 0px",paddingBottom:.5,marginTop:0,display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"flex-start"},children:[l.jsx("img",{style:{width:u,height:u,minWidth:u,minHeight:u},src:Fc(f),alt:f.meta.title}),l.jsxs(te,{sx:{display:"flex",flexDirection:"column",justifyContent:"start",alignItems:"start",flex:1,marginLeft:2},children:[l.jsxs(te,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",fontSize:"16px",fontWeight:"bold",cursor:"pointer",".link-icon":{opacity:0},":hover .link-icon":{opacity:1}},onClick:()=>{window.open(Ql(`${f.bundleSource?.store||f.meta.homepage}/blocklets/${f.meta.did}`,{allowDomains:null}),"_blank")},children:[f.meta.title,l.jsx(te,{sx:{display:j?"inline-block":"none",fontSize:"12px",fontWeight:"bold",marginLeft:1},children:o("blocklet.component.required")}),l.jsxs(te,{sx:{paddingLeft:1,fontSize:"13px",fontWeight:"400"},component:"span",children:[f.meta.version,l.jsx(te,{className:"link-icon",icon:"fluent:open-20-filled",component:xt,sx:{color:"primary.main",fontSize:16,transform:"translate(6px, 3px)",transition:"all 0.1s"}})]})]}),l.jsx(te,{sx:{marginTop:0,opacity:.7},children:f.meta.description})]})]},f.meta.did)})})]})}hs.propTypes={meta:F.object,show:F.bool,onClose:F.func.isRequired,installRelated:F.func,components:F.array.isRequired,loading:F.bool.isRequired};function $c(e){return e&&(e.registryUrl||e.homepage)&&e.did?`${e.registryUrl||e.homepage}/api/blocklets/${e?.did}/blocklet.json`:""}function Uc(e){const{api:t}=un(),[r]=Ka(),i=r.get("blocklet_meta_url")||$c(e),[s,n]=q.useState([]),[o,a]=q.useState(!1);return q.useEffect(()=>{!i||e?.inputUrl||(a(!0),t.getDynamicComponents({input:{url:i}}).then(d=>{n(d.components)}).finally(()=>{a(!1)}))},[i]),{components:s,loading:o}}function fs({installRelated:e=!0,onChangeInstallRelated:t=null,meta:r,onClickNext:i=null,handleDescEle:s=""}){const n=Ga(),{t:o,locale:a}=St(),[d,h]=q.useState(!1),{components:u,loading:f}=Uc(r),j=os(r),m=i||(()=>{n(`/launch-blocklet/install${window.location.search}`)}),E=()=>{h(!0)},S=()=>{h(!1)};return l.jsxs(qc,{children:[l.jsx("div",{className:"app-content",children:l.jsx("div",{className:"agreement",children:l.jsx("div",{className:"agreement-content",children:j?l.jsx(ds,{blockletMeta:{data:r},locale:a,handleDescEle:s}):l.jsx(te,{sx:{p:3},children:l.jsx(Ie,{children:o("launchBlocklet.dockerBlockletCantInstall")})})})})}),l.jsxs(te,{className:"agreement-bottom",sx:{"> .agreement-loading":{color:"primary.main"}},children:[f?l.jsx(xt,{className:"agreement-loading",icon:"line-md:loading-loop",style:{fontSize:42,transform:"scale(0.6)"}}):null,j&&t&&u?.length?l.jsxs(te,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},children:[l.jsx(Zr,{sx:{mr:.5},checked:e,onChange:O=>t(O.currentTarget.checked),control:l.jsx(ei,{}),label:l.jsx("span",{children:o("launchBlocklet.installRelatedComponents")})}),l.jsx(te,{sx:{"> button svg":{color:"primary.main"}},children:l.jsx(No,{size:"small",onClick:E,children:l.jsx(xt,{icon:"octicon:package-dependencies-16"})})})]}):null,l.jsx("div",{className:"button-container","data-cy":"agree-all",children:j?l.jsx(as,{onContinue:m,description:l.jsx(Bc,{}),texts:{listenName:o("launchBlocklet.license"),buttonNext:o("launchBlocklet.next")}}):null})]}),l.jsx(hs,{installRelated:e,meta:r,show:d,onClose:S,components:u,loading:f})]})}fs.propTypes={meta:F.object.isRequired,onClickNext:F.func,handleDescEle:F.node,installRelated:F.bool,onChangeInstallRelated:F.func};const qc=ot.div`
|
|
117
117
|
display: flex;
|
|
118
118
|
flex-direction: column;
|
|
119
119
|
align-items: center;
|
|
@@ -189,7 +189,7 @@ import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr
|
|
|
189
189
|
padding-bottom: 16px;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
`;var Tt={},_n={exports:{}},hr={exports:{}},Ui;function ps(){if(Ui)return hr.exports;Ui=1;var e=hr.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(i){return"file-"+r(i)}}},t={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:r};Object.keys(e).forEach(function(i){Object.keys(t).forEach(function(s){e[i][s]||(e[i][s]=t[s])}),e[i].protocols_re=RegExp("^("+e[i].protocols.map(function(s){return s.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function r(i){return i.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return hr.exports}var fr,qi;function Wc(){if(qi)return fr;qi=1;var e=ps(),t=Object.assign||function(s,n){if(n===null||typeof n!="object")return s;const o=Object.keys(n);let a=o.length;for(;a--;)s[o[a]]=n[o[a]];return s};fr=r;function r(i,s,n,o,a,d,h){var u=this;u.type=i,Object.keys(e[i]).forEach(function(f){u[f]=e[i][f]}),u.user=s,u.auth=n,u.project=o,u.committish=a,u.default=d,u.opts=h||{}}return r.prototype.hash=function(){return this.committish?"#"+this.committish:""},r.prototype._fill=function(i,s){if(i){var n=t({},s);n.path=n.path?n.path.replace(/^[/]+/g,""):"",s=t(t({},this.opts),s);var o=this;Object.keys(this).forEach(function(m){o[m]!=null&&n[m]==null&&(n[m]=o[m])});var a=n.auth,d=n.committish,h=n.fragment,u=n.path,f=n.project;Object.keys(n).forEach(function(m){var E=n[m];(m==="path"||m==="project")&&typeof E=="string"?n[m]=E.split("/").map(function(S){return encodeURIComponent(S)}).join("/"):m!=="domain"&&(n[m]=encodeURIComponent(E))}),n["auth@"]=a?a+"@":"",n["#fragment"]=h?"#"+this.hashformat(h):"",n.fragment=n.fragment?n.fragment:"",n["#path"]=u?"#"+this.hashformat(u):"",n["/path"]=n.path?"/"+n.path:"",n.projectPath=f.split("/").map(encodeURIComponent).join("/"),s.noCommittish?(n["#committish"]="",n["/tree/committish"]="",n["/committish"]="",n.committish=""):(n["#committish"]=d?"#"+d:"",n["/tree/committish"]=n.committish?"/"+n.treepath+"/"+n.committish:"",n["/committish"]=n.committish?"/"+n.committish:"",n.committish=n.committish||"master");var j=i;return Object.keys(n).forEach(function(m){j=j.replace(new RegExp("[{]"+m+"[}]","g"),n[m])}),s.noGitPlus?j.replace(/^git[+]/,""):j}},r.prototype.ssh=function(i){return this._fill(this.sshtemplate,i)},r.prototype.sshurl=function(i){return this._fill(this.sshurltemplate,i)},r.prototype.browse=function(i,s,n){return typeof i=="string"?(typeof s!="string"&&(n=s,s=null),this._fill(this.browsefiletemplate,t({fragment:s,path:i},n))):this._fill(this.browsetemplate,i)},r.prototype.docs=function(i){return this._fill(this.docstemplate,i)},r.prototype.bugs=function(i){return this._fill(this.bugstemplate,i)},r.prototype.https=function(i){return this._fill(this.httpstemplate,i)},r.prototype.git=function(i){return this._fill(this.gittemplate,i)},r.prototype.shortcut=function(i){return this._fill(this.shortcuttemplate,i)},r.prototype.path=function(i){return this._fill(this.pathtemplate,i)},r.prototype.tarball=function(i){var s=t({},i,{noCommittish:!1});return this._fill(this.tarballtemplate,s)},r.prototype.file=function(i,s){return this._fill(this.filetemplate,t({path:i},s))},r.prototype.getDefaultRepresentation=function(){return this.default},r.prototype.toString=function(i){return this.default&&typeof this[this.default]=="function"?this[this.default](i):this.sshurl(i)},fr}var pr,Wi;function zc(){return Wi||(Wi=1,pr=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),pr}var mr,zi;function Vc(){if(zi)return mr;zi=1,mr=e,e.Node=s,e.create=e;function e(n){var o=this;if(o instanceof e||(o=new e),o.tail=null,o.head=null,o.length=0,n&&typeof n.forEach=="function")n.forEach(function(h){o.push(h)});else if(arguments.length>0)for(var a=0,d=arguments.length;a<d;a++)o.push(arguments[a]);return o}e.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var o=n.next,a=n.prev;return o&&(o.prev=a),a&&(a.next=o),n===this.head&&(this.head=o),n===this.tail&&(this.tail=a),n.list.length--,n.next=null,n.prev=null,n.list=null,o},e.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var o=this.head;n.list=this,n.next=o,o&&(o.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},e.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var o=this.tail;n.list=this,n.prev=o,o&&(o.next=n),this.tail=n,this.head||(this.head=n),this.length++}},e.prototype.push=function(){for(var n=0,o=arguments.length;n<o;n++)r(this,arguments[n]);return this.length},e.prototype.unshift=function(){for(var n=0,o=arguments.length;n<o;n++)i(this,arguments[n]);return this.length},e.prototype.pop=function(){if(this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},e.prototype.shift=function(){if(this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},e.prototype.forEach=function(n,o){o=o||this;for(var a=this.head,d=0;a!==null;d++)n.call(o,a.value,d,this),a=a.next},e.prototype.forEachReverse=function(n,o){o=o||this;for(var a=this.tail,d=this.length-1;a!==null;d--)n.call(o,a.value,d,this),a=a.prev},e.prototype.get=function(n){for(var o=0,a=this.head;a!==null&&o<n;o++)a=a.next;if(o===n&&a!==null)return a.value},e.prototype.getReverse=function(n){for(var o=0,a=this.tail;a!==null&&o<n;o++)a=a.prev;if(o===n&&a!==null)return a.value},e.prototype.map=function(n,o){o=o||this;for(var a=new e,d=this.head;d!==null;)a.push(n.call(o,d.value,this)),d=d.next;return a},e.prototype.mapReverse=function(n,o){o=o||this;for(var a=new e,d=this.tail;d!==null;)a.push(n.call(o,d.value,this)),d=d.prev;return a},e.prototype.reduce=function(n,o){var a,d=this.head;if(arguments.length>1)a=o;else if(this.head)d=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;d!==null;h++)a=n(a,d.value,h),d=d.next;return a},e.prototype.reduceReverse=function(n,o){var a,d=this.tail;if(arguments.length>1)a=o;else if(this.tail)d=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;d!==null;h--)a=n(a,d.value,h),d=d.prev;return a},e.prototype.toArray=function(){for(var n=new Array(this.length),o=0,a=this.head;a!==null;o++)n[o]=a.value,a=a.next;return n},e.prototype.toArrayReverse=function(){for(var n=new Array(this.length),o=0,a=this.tail;a!==null;o++)n[o]=a.value,a=a.prev;return n},e.prototype.slice=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(;h!==null&&d<o;d++,h=h.next)a.push(h.value);return a},e.prototype.sliceReverse=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=this.length,h=this.tail;h!==null&&d>o;d--)h=h.prev;for(;h!==null&&d>n;d--,h=h.prev)a.push(h.value);return a},e.prototype.splice=function(n,o,...a){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(var u=[],d=0;h&&d<o;d++)u.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var d=0;d<a.length;d++)h=t(this,h,a[d]);return u},e.prototype.reverse=function(){for(var n=this.head,o=this.tail,a=n;a!==null;a=a.prev){var d=a.prev;a.prev=a.next,a.next=d}return this.head=o,this.tail=n,this};function t(n,o,a){var d=o===n.head?new s(a,null,o,n):new s(a,o,o.next,n);return d.next===null&&(n.tail=d),d.prev===null&&(n.head=d),n.length++,d}function r(n,o){n.tail=new s(o,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function i(n,o){n.head=new s(o,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function s(n,o,a,d){if(!(this instanceof s))return new s(n,o,a,d);this.list=d,this.value=n,o?(o.next=this,this.prev=o):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{zc()(e)}catch{}return mr}var gr,Vi;function Kc(){if(Vi)return gr;Vi=1;const e=Vc(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),s=Symbol("allowStale"),n=Symbol("maxAge"),o=Symbol("dispose"),a=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),u=Symbol("updateAgeOnGet"),f=()=>1;class j{constructor(c){if(typeof c=="number"&&(c={max:c}),c||(c={}),c.max&&(typeof c.max!="number"||c.max<0))throw new TypeError("max must be a non-negative number");this[t]=c.max||1/0;const w=c.length||f;if(this[i]=typeof w!="function"?f:w,this[s]=c.stale||!1,c.maxAge&&typeof c.maxAge!="number")throw new TypeError("maxAge must be a number");this[n]=c.maxAge||0,this[o]=c.dispose,this[a]=c.noDisposeOnSet||!1,this[u]=c.updateAgeOnGet||!1,this.reset()}set max(c){if(typeof c!="number"||c<0)throw new TypeError("max must be a non-negative number");this[t]=c||1/0,S(this)}get max(){return this[t]}set allowStale(c){this[s]=!!c}get allowStale(){return this[s]}set maxAge(c){if(typeof c!="number")throw new TypeError("maxAge must be a non-negative number");this[n]=c,S(this)}get maxAge(){return this[n]}set lengthCalculator(c){typeof c!="function"&&(c=f),c!==this[i]&&(this[i]=c,this[r]=0,this[d].forEach(w=>{w.length=this[i](w.value,w.key),this[r]+=w.length})),S(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[d].length}rforEach(c,w){w=w||this;for(let I=this[d].tail;I!==null;){const B=I.prev;_(this,c,I,w),I=B}}forEach(c,w){w=w||this;for(let I=this[d].head;I!==null;){const B=I.next;_(this,c,I,w),I=B}}keys(){return this[d].toArray().map(c=>c.key)}values(){return this[d].toArray().map(c=>c.value)}reset(){this[o]&&this[d]&&this[d].length&&this[d].forEach(c=>this[o](c.key,c.value)),this[h]=new Map,this[d]=new e,this[r]=0}dump(){return this[d].map(c=>E(this,c)?!1:{k:c.key,v:c.value,e:c.now+(c.maxAge||0)}).toArray().filter(c=>c)}dumpLru(){return this[d]}set(c,w,I){if(I=I||this[n],I&&typeof I!="number")throw new TypeError("maxAge must be a number");const B=I?Date.now():0,M=this[i](w,c);if(this[h].has(c)){if(M>this[t])return O(this,this[h].get(c)),!1;const z=this[h].get(c).value;return this[o]&&(this[a]||this[o](c,z.value)),z.now=B,z.maxAge=I,z.value=w,this[r]+=M-z.length,z.length=M,this.get(c),S(this),!0}const ne=new P(c,w,M,B,I);return ne.length>this[t]?(this[o]&&this[o](c,w),!1):(this[r]+=ne.length,this[d].unshift(ne),this[h].set(c,this[d].head),S(this),!0)}has(c){if(!this[h].has(c))return!1;const w=this[h].get(c).value;return!E(this,w)}get(c){return m(this,c,!0)}peek(c){return m(this,c,!1)}pop(){const c=this[d].tail;return c?(O(this,c),c.value):null}del(c){O(this,this[h].get(c))}load(c){this.reset();const w=Date.now();for(let I=c.length-1;I>=0;I--){const B=c[I],M=B.e||0;if(M===0)this.set(B.k,B.v);else{const ne=M-w;ne>0&&this.set(B.k,B.v,ne)}}}prune(){this[h].forEach((c,w)=>m(this,w,!1))}}const m=(D,c,w)=>{const I=D[h].get(c);if(I){const B=I.value;if(E(D,B)){if(O(D,I),!D[s])return}else w&&(D[u]&&(I.value.now=Date.now()),D[d].unshiftNode(I));return B.value}},E=(D,c)=>{if(!c||!c.maxAge&&!D[n])return!1;const w=Date.now()-c.now;return c.maxAge?w>c.maxAge:D[n]&&w>D[n]},S=D=>{if(D[r]>D[t])for(let c=D[d].tail;D[r]>D[t]&&c!==null;){const w=c.prev;O(D,c),c=w}},O=(D,c)=>{if(c){const w=c.value;D[o]&&D[o](w.key,w.value),D[r]-=w.length,D[h].delete(w.key),D[d].removeNode(c)}};class P{constructor(c,w,I,B,M){this.key=c,this.value=w,this.length=I,this.now=B,this.maxAge=M||0}}const _=(D,c,w,I)=>{let B=w.value;E(D,B)&&(O(D,w),D[s]||(B=void 0)),B&&c.call(I,B.value,B.key,D)};return gr=j,gr}var Ki;function Gc(){if(Ki)return _n.exports;Ki=1;var e=il,t=ps(),r=_n.exports=Wc(),i=Kc(),s=new i({max:1e3}),n={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function o(j){return n[j]||j.slice(0,-1)}var a={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};_n.exports.fromUrl=function(j,m){if(typeof j=="string"){var E=j+JSON.stringify(m||{});return s.has(E)||s.set(E,d(j,m)),s.get(E)}};function d(j,m){if(!(j==null||j==="")){var E=u(h(j)?"github:"+j:j),S=f(E),O=E.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),P=Object.keys(t).map(function(_){try{var D=t[_],c=null;S.auth&&a[S.protocol]&&(c=S.auth);var w=S.hash?decodeURIComponent(S.hash.substr(1)):null,I=null,B=null,M=null;if(O&&O[1]===_)I=O[2]&&decodeURIComponent(O[2]),B=decodeURIComponent(O[3].replace(/\.git$/,"")),M="shortcut";else{if(S.host&&S.host!==D.domain&&S.host.replace(/^www[.]/,"")!==D.domain||!D.protocols_re.test(S.protocol)||!S.path)return;var ne=D.pathmatch,Z=S.path.match(ne);if(!Z)return;Z[1]!==null&&Z[1]!==void 0&&(I=decodeURIComponent(Z[1].replace(/^:/,""))),B=decodeURIComponent(Z[2]),M=o(S.protocol)}return new r(_,I,c,B,w,M,m)}catch(z){if(!(z instanceof URIError))throw z}}).filter(function(_){return _});if(P.length===1)return P[0]}}function h(j){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(j)}function u(j){var m=e.parse(j);return m.protocol==="gist:"&&m.host&&!m.path?m.protocol+"/"+m.host:j}function f(j){var m=j.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!m){var E=e.parse(j);if(E.auth){const O=j.match(/[^@]+@[^:/]+/);if(O){var S=new e.URL(O[0]);E.auth=S.username||"",S.password&&(E.auth+=":"+S.password)}}return E}return{protocol:"git+ssh:",slashes:!0,auth:m[1],host:m[2],port:null,hostname:m[2],hash:m[4],search:null,query:null,pathname:"/"+m[3],path:"/"+m[3],href:"git+ssh://"+m[1]+"@"+m[2]+"/"+m[3]+(m[4]||"")}}return _n.exports}var Gt={},ie={},vr,Gi;function Hc(){return Gi||(Gi=1,vr={charsWide:["ᄀ-ᇹ"," -〿","ぁ-ゔ","゙-ゞ","ァ-ヾ","ㄱ-ㆎ","㆐-㆟","㈀-㈜","㈠-㉃","㉠-㊰","㋀-㍶","㍻-㏝","㏠-㏾","一-龥","가-힣","-","豈-鶴"],charsFullWidth:["︰-﹄","﹉-﹒","﹔-﹫","!-~","¢-₩"]}),vr}var yr,Hi;function Xc(){if(Hi)return yr;Hi=1;const{charsWide:e,charsFullWidth:t}=Hc(),r=new RegExp(`[${e.join("")}${t.join("")}]`,"g");return yr={default:s=>s.replace(r,"xx").length,charsRegex:r},yr}/*!
|
|
192
|
+
`;var Tt={},_n={exports:{}},hr={exports:{}},Ui;function ps(){if(Ui)return hr.exports;Ui=1;var e=hr.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(i){return"file-"+r(i)}}},t={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:r};Object.keys(e).forEach(function(i){Object.keys(t).forEach(function(s){e[i][s]||(e[i][s]=t[s])}),e[i].protocols_re=RegExp("^("+e[i].protocols.map(function(s){return s.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function r(i){return i.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return hr.exports}var fr,qi;function Wc(){if(qi)return fr;qi=1;var e=ps(),t=Object.assign||function(s,n){if(n===null||typeof n!="object")return s;const o=Object.keys(n);let a=o.length;for(;a--;)s[o[a]]=n[o[a]];return s};fr=r;function r(i,s,n,o,a,d,h){var u=this;u.type=i,Object.keys(e[i]).forEach(function(f){u[f]=e[i][f]}),u.user=s,u.auth=n,u.project=o,u.committish=a,u.default=d,u.opts=h||{}}return r.prototype.hash=function(){return this.committish?"#"+this.committish:""},r.prototype._fill=function(i,s){if(i){var n=t({},s);n.path=n.path?n.path.replace(/^[/]+/g,""):"",s=t(t({},this.opts),s);var o=this;Object.keys(this).forEach(function(m){o[m]!=null&&n[m]==null&&(n[m]=o[m])});var a=n.auth,d=n.committish,h=n.fragment,u=n.path,f=n.project;Object.keys(n).forEach(function(m){var E=n[m];(m==="path"||m==="project")&&typeof E=="string"?n[m]=E.split("/").map(function(S){return encodeURIComponent(S)}).join("/"):m!=="domain"&&(n[m]=encodeURIComponent(E))}),n["auth@"]=a?a+"@":"",n["#fragment"]=h?"#"+this.hashformat(h):"",n.fragment=n.fragment?n.fragment:"",n["#path"]=u?"#"+this.hashformat(u):"",n["/path"]=n.path?"/"+n.path:"",n.projectPath=f.split("/").map(encodeURIComponent).join("/"),s.noCommittish?(n["#committish"]="",n["/tree/committish"]="",n["/committish"]="",n.committish=""):(n["#committish"]=d?"#"+d:"",n["/tree/committish"]=n.committish?"/"+n.treepath+"/"+n.committish:"",n["/committish"]=n.committish?"/"+n.committish:"",n.committish=n.committish||"master");var j=i;return Object.keys(n).forEach(function(m){j=j.replace(new RegExp("[{]"+m+"[}]","g"),n[m])}),s.noGitPlus?j.replace(/^git[+]/,""):j}},r.prototype.ssh=function(i){return this._fill(this.sshtemplate,i)},r.prototype.sshurl=function(i){return this._fill(this.sshurltemplate,i)},r.prototype.browse=function(i,s,n){return typeof i=="string"?(typeof s!="string"&&(n=s,s=null),this._fill(this.browsefiletemplate,t({fragment:s,path:i},n))):this._fill(this.browsetemplate,i)},r.prototype.docs=function(i){return this._fill(this.docstemplate,i)},r.prototype.bugs=function(i){return this._fill(this.bugstemplate,i)},r.prototype.https=function(i){return this._fill(this.httpstemplate,i)},r.prototype.git=function(i){return this._fill(this.gittemplate,i)},r.prototype.shortcut=function(i){return this._fill(this.shortcuttemplate,i)},r.prototype.path=function(i){return this._fill(this.pathtemplate,i)},r.prototype.tarball=function(i){var s=t({},i,{noCommittish:!1});return this._fill(this.tarballtemplate,s)},r.prototype.file=function(i,s){return this._fill(this.filetemplate,t({path:i},s))},r.prototype.getDefaultRepresentation=function(){return this.default},r.prototype.toString=function(i){return this.default&&typeof this[this.default]=="function"?this[this.default](i):this.sshurl(i)},fr}var pr,Wi;function zc(){return Wi||(Wi=1,pr=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),pr}var mr,zi;function Vc(){if(zi)return mr;zi=1,mr=e,e.Node=s,e.create=e;function e(n){var o=this;if(o instanceof e||(o=new e),o.tail=null,o.head=null,o.length=0,n&&typeof n.forEach=="function")n.forEach(function(h){o.push(h)});else if(arguments.length>0)for(var a=0,d=arguments.length;a<d;a++)o.push(arguments[a]);return o}e.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var o=n.next,a=n.prev;return o&&(o.prev=a),a&&(a.next=o),n===this.head&&(this.head=o),n===this.tail&&(this.tail=a),n.list.length--,n.next=null,n.prev=null,n.list=null,o},e.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var o=this.head;n.list=this,n.next=o,o&&(o.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},e.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var o=this.tail;n.list=this,n.prev=o,o&&(o.next=n),this.tail=n,this.head||(this.head=n),this.length++}},e.prototype.push=function(){for(var n=0,o=arguments.length;n<o;n++)r(this,arguments[n]);return this.length},e.prototype.unshift=function(){for(var n=0,o=arguments.length;n<o;n++)i(this,arguments[n]);return this.length},e.prototype.pop=function(){if(this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},e.prototype.shift=function(){if(this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},e.prototype.forEach=function(n,o){o=o||this;for(var a=this.head,d=0;a!==null;d++)n.call(o,a.value,d,this),a=a.next},e.prototype.forEachReverse=function(n,o){o=o||this;for(var a=this.tail,d=this.length-1;a!==null;d--)n.call(o,a.value,d,this),a=a.prev},e.prototype.get=function(n){for(var o=0,a=this.head;a!==null&&o<n;o++)a=a.next;if(o===n&&a!==null)return a.value},e.prototype.getReverse=function(n){for(var o=0,a=this.tail;a!==null&&o<n;o++)a=a.prev;if(o===n&&a!==null)return a.value},e.prototype.map=function(n,o){o=o||this;for(var a=new e,d=this.head;d!==null;)a.push(n.call(o,d.value,this)),d=d.next;return a},e.prototype.mapReverse=function(n,o){o=o||this;for(var a=new e,d=this.tail;d!==null;)a.push(n.call(o,d.value,this)),d=d.prev;return a},e.prototype.reduce=function(n,o){var a,d=this.head;if(arguments.length>1)a=o;else if(this.head)d=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;d!==null;h++)a=n(a,d.value,h),d=d.next;return a},e.prototype.reduceReverse=function(n,o){var a,d=this.tail;if(arguments.length>1)a=o;else if(this.tail)d=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;d!==null;h--)a=n(a,d.value,h),d=d.prev;return a},e.prototype.toArray=function(){for(var n=new Array(this.length),o=0,a=this.head;a!==null;o++)n[o]=a.value,a=a.next;return n},e.prototype.toArrayReverse=function(){for(var n=new Array(this.length),o=0,a=this.tail;a!==null;o++)n[o]=a.value,a=a.prev;return n},e.prototype.slice=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(;h!==null&&d<o;d++,h=h.next)a.push(h.value);return a},e.prototype.sliceReverse=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=this.length,h=this.tail;h!==null&&d>o;d--)h=h.prev;for(;h!==null&&d>n;d--,h=h.prev)a.push(h.value);return a},e.prototype.splice=function(n,o,...a){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(var u=[],d=0;h&&d<o;d++)u.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var d=0;d<a.length;d++)h=t(this,h,a[d]);return u},e.prototype.reverse=function(){for(var n=this.head,o=this.tail,a=n;a!==null;a=a.prev){var d=a.prev;a.prev=a.next,a.next=d}return this.head=o,this.tail=n,this};function t(n,o,a){var d=o===n.head?new s(a,null,o,n):new s(a,o,o.next,n);return d.next===null&&(n.tail=d),d.prev===null&&(n.head=d),n.length++,d}function r(n,o){n.tail=new s(o,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function i(n,o){n.head=new s(o,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function s(n,o,a,d){if(!(this instanceof s))return new s(n,o,a,d);this.list=d,this.value=n,o?(o.next=this,this.prev=o):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{zc()(e)}catch{}return mr}var gr,Vi;function Kc(){if(Vi)return gr;Vi=1;const e=Vc(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),s=Symbol("allowStale"),n=Symbol("maxAge"),o=Symbol("dispose"),a=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),u=Symbol("updateAgeOnGet"),f=()=>1;class j{constructor(c){if(typeof c=="number"&&(c={max:c}),c||(c={}),c.max&&(typeof c.max!="number"||c.max<0))throw new TypeError("max must be a non-negative number");this[t]=c.max||1/0;const w=c.length||f;if(this[i]=typeof w!="function"?f:w,this[s]=c.stale||!1,c.maxAge&&typeof c.maxAge!="number")throw new TypeError("maxAge must be a number");this[n]=c.maxAge||0,this[o]=c.dispose,this[a]=c.noDisposeOnSet||!1,this[u]=c.updateAgeOnGet||!1,this.reset()}set max(c){if(typeof c!="number"||c<0)throw new TypeError("max must be a non-negative number");this[t]=c||1/0,S(this)}get max(){return this[t]}set allowStale(c){this[s]=!!c}get allowStale(){return this[s]}set maxAge(c){if(typeof c!="number")throw new TypeError("maxAge must be a non-negative number");this[n]=c,S(this)}get maxAge(){return this[n]}set lengthCalculator(c){typeof c!="function"&&(c=f),c!==this[i]&&(this[i]=c,this[r]=0,this[d].forEach(w=>{w.length=this[i](w.value,w.key),this[r]+=w.length})),S(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[d].length}rforEach(c,w){w=w||this;for(let I=this[d].tail;I!==null;){const B=I.prev;_(this,c,I,w),I=B}}forEach(c,w){w=w||this;for(let I=this[d].head;I!==null;){const B=I.next;_(this,c,I,w),I=B}}keys(){return this[d].toArray().map(c=>c.key)}values(){return this[d].toArray().map(c=>c.value)}reset(){this[o]&&this[d]&&this[d].length&&this[d].forEach(c=>this[o](c.key,c.value)),this[h]=new Map,this[d]=new e,this[r]=0}dump(){return this[d].map(c=>E(this,c)?!1:{k:c.key,v:c.value,e:c.now+(c.maxAge||0)}).toArray().filter(c=>c)}dumpLru(){return this[d]}set(c,w,I){if(I=I||this[n],I&&typeof I!="number")throw new TypeError("maxAge must be a number");const B=I?Date.now():0,M=this[i](w,c);if(this[h].has(c)){if(M>this[t])return O(this,this[h].get(c)),!1;const z=this[h].get(c).value;return this[o]&&(this[a]||this[o](c,z.value)),z.now=B,z.maxAge=I,z.value=w,this[r]+=M-z.length,z.length=M,this.get(c),S(this),!0}const ne=new P(c,w,M,B,I);return ne.length>this[t]?(this[o]&&this[o](c,w),!1):(this[r]+=ne.length,this[d].unshift(ne),this[h].set(c,this[d].head),S(this),!0)}has(c){if(!this[h].has(c))return!1;const w=this[h].get(c).value;return!E(this,w)}get(c){return m(this,c,!0)}peek(c){return m(this,c,!1)}pop(){const c=this[d].tail;return c?(O(this,c),c.value):null}del(c){O(this,this[h].get(c))}load(c){this.reset();const w=Date.now();for(let I=c.length-1;I>=0;I--){const B=c[I],M=B.e||0;if(M===0)this.set(B.k,B.v);else{const ne=M-w;ne>0&&this.set(B.k,B.v,ne)}}}prune(){this[h].forEach((c,w)=>m(this,w,!1))}}const m=(D,c,w)=>{const I=D[h].get(c);if(I){const B=I.value;if(E(D,B)){if(O(D,I),!D[s])return}else w&&(D[u]&&(I.value.now=Date.now()),D[d].unshiftNode(I));return B.value}},E=(D,c)=>{if(!c||!c.maxAge&&!D[n])return!1;const w=Date.now()-c.now;return c.maxAge?w>c.maxAge:D[n]&&w>D[n]},S=D=>{if(D[r]>D[t])for(let c=D[d].tail;D[r]>D[t]&&c!==null;){const w=c.prev;O(D,c),c=w}},O=(D,c)=>{if(c){const w=c.value;D[o]&&D[o](w.key,w.value),D[r]-=w.length,D[h].delete(w.key),D[d].removeNode(c)}};class P{constructor(c,w,I,B,M){this.key=c,this.value=w,this.length=I,this.now=B,this.maxAge=M||0}}const _=(D,c,w,I)=>{let B=w.value;E(D,B)&&(O(D,w),D[s]||(B=void 0)),B&&c.call(I,B.value,B.key,D)};return gr=j,gr}var Ki;function Gc(){if(Ki)return _n.exports;Ki=1;var e=sl,t=ps(),r=_n.exports=Wc(),i=Kc(),s=new i({max:1e3}),n={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function o(j){return n[j]||j.slice(0,-1)}var a={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};_n.exports.fromUrl=function(j,m){if(typeof j=="string"){var E=j+JSON.stringify(m||{});return s.has(E)||s.set(E,d(j,m)),s.get(E)}};function d(j,m){if(!(j==null||j==="")){var E=u(h(j)?"github:"+j:j),S=f(E),O=E.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),P=Object.keys(t).map(function(_){try{var D=t[_],c=null;S.auth&&a[S.protocol]&&(c=S.auth);var w=S.hash?decodeURIComponent(S.hash.substr(1)):null,I=null,B=null,M=null;if(O&&O[1]===_)I=O[2]&&decodeURIComponent(O[2]),B=decodeURIComponent(O[3].replace(/\.git$/,"")),M="shortcut";else{if(S.host&&S.host!==D.domain&&S.host.replace(/^www[.]/,"")!==D.domain||!D.protocols_re.test(S.protocol)||!S.path)return;var ne=D.pathmatch,Z=S.path.match(ne);if(!Z)return;Z[1]!==null&&Z[1]!==void 0&&(I=decodeURIComponent(Z[1].replace(/^:/,""))),B=decodeURIComponent(Z[2]),M=o(S.protocol)}return new r(_,I,c,B,w,M,m)}catch(z){if(!(z instanceof URIError))throw z}}).filter(function(_){return _});if(P.length===1)return P[0]}}function h(j){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(j)}function u(j){var m=e.parse(j);return m.protocol==="gist:"&&m.host&&!m.path?m.protocol+"/"+m.host:j}function f(j){var m=j.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!m){var E=e.parse(j);if(E.auth){const O=j.match(/[^@]+@[^:/]+/);if(O){var S=new e.URL(O[0]);E.auth=S.username||"",S.password&&(E.auth+=":"+S.password)}}return E}return{protocol:"git+ssh:",slashes:!0,auth:m[1],host:m[2],port:null,hostname:m[2],hash:m[4],search:null,query:null,pathname:"/"+m[3],path:"/"+m[3],href:"git+ssh://"+m[1]+"@"+m[2]+"/"+m[3]+(m[4]||"")}}return _n.exports}var Gt={},ie={},vr,Gi;function Hc(){return Gi||(Gi=1,vr={charsWide:["ᄀ-ᇹ"," -〿","ぁ-ゔ","゙-ゞ","ァ-ヾ","ㄱ-ㆎ","㆐-㆟","㈀-㈜","㈠-㉃","㉠-㊰","㋀-㍶","㍻-㏝","㏠-㏾","一-龥","가-힣","-","豈-鶴"],charsFullWidth:["︰-﹄","﹉-﹒","﹔-﹫","!-~","¢-₩"]}),vr}var yr,Hi;function Xc(){if(Hi)return yr;Hi=1;const{charsWide:e,charsFullWidth:t}=Hc(),r=new RegExp(`[${e.join("")}${t.join("")}]`,"g");return yr={default:s=>s.replace(r,"xx").length,charsRegex:r},yr}/*!
|
|
193
193
|
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
194
194
|
*
|
|
195
195
|
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
@@ -203,7 +203,7 @@ import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr
|
|
|
203
203
|
* is-var-name | ISC (c) Shinnosuke Watanabe
|
|
204
204
|
* https://github.com/shinnn/is-var-name
|
|
205
205
|
*/function eu(e){if(typeof e!="string"||e.trim()!==e)return!1;try{new Function(e,"var "+e)}catch{return!1}return!0}const tu=Object.freeze(Object.defineProperty({__proto__:null,default:eu},Symbol.toStringTag,{value:"Module"})),nu=Xa(tu);var Je={},Zi;function ru(){if(Zi)return Je;Zi=1;const e=ri();function t(z){return z&&typeof z=="object"&&"default"in z?z.default:z}const r=t(e),i={"-a":"--attach","-d":"--detach","-e":"--env","-h":"--hostname","-i":"--interactive","-it":"-it","-rm":"-rm","-m":"--memory","-p":"--publish","-P":"--publish-all","-l":"--label","-n":"--name","-q":"--quiet","-x":"--x-registry","-t":"--tty","-u":"--user","-v":"--volume","-w":"--workdir","-cgroupns":"--cgroupns","-cpus":"--cpus","-g":"--gpus","-ip6":"--ip6","--read-only":"--read-only","--add-host":"--add-host","--attach":"--attach","--blkio-weight":"--blkio-weight","--blkio-weight-device":"--blkio-weight-device","--cap-add":"--cap-add","--cap-drop":"--cap-drop","--cgroup-parent":"--cgroup-parent","--cidfile":"--cidfile","--cpu-period":"--cpu-period","--cpu-quota":"--cpu-quota","--cpu-rt-period":"--cpu-rt-period","--cpu-rt-runtime":"--cpu-rt-runtime","--cpu-shares":"--cpu-shares","--cpus":"--cpus","--cpuset-cpus":"--cpuset-cpus","--cpuset-mems":"--cpuset-mems","--detach":"--detach","--detach-keys":"--detach-keys","--device":"--device","--device-cgroup-rule":"--device-cgroup-rule","--device-read-bps":"--device-read-bps","--device-read-iops":"--device-read-iops","--device-write-bps":"--device-write-bps","--device-write-iops":"--device-write-iops","--disable-content-trust":"--disable-content-trust","--dns":"--dns","--dns-opt":"--dns-opt","--dns-search":"--dns-search","--domainname":"--domainname","--entrypoint":"--entrypoint","--env":"--env","--env-file":"--env-file","--expose":"--expose","--gpus":"--gpus","--group-add":"--group-add","--health-cmd":"--health-cmd","--health-interval":"--health-interval","--health-retries":"--health-retries","--health-start-period":"--health-start-period","--health-timeout":"--health-timeout","--help":"--help","--hostname":"--hostname","--init":"--init","--interactive":"--interactive","--ip":"--ip","--ip6":"--ip6","--ipc":"--ipc","--isolation":"--isolation","--kernel-memory":"--kernel-memory","--label":"--label","--label-file":"--label-file","--link":"--link","--link-local-ip":"--link-local-ip","--log-driver":"--log-driver","--log-opt":"--log-opt","--mac-address":"--mac-address","--memory":"--memory","--memory-reservation":"--memory-reservation","--memory-swap":"--memory-swap","--memory-swappiness":"--memory-swappiness","--mount":"--mount","--name":"--name","--network":"--network","--network-alias":"--network-alias","--no-healthcheck":"--no-healthcheck","--oom-kill-disable":"--oom-kill-disable","--oom-score-adj":"--oom-score-adj","--pid":"--pid","--pids-limit":"--pids-limit","--platform":"--platform","--privileged":"--privileged","--publish":"--publish","--publish-all":"--publish-all","--pull":"--pull","--restart":"--restart","--rm":"--rm","--runtime":"--runtime","--security-opt":"--security-opt","--shm-size":"--shm-size","--stop-signal":"--stop-signal","--stop-timeout":"--stop-timeout","--storage-opt":"--storage-opt","--sysctl":"--sysctl","--tmpfs":"--tmpfs","--tty":"--tty","--ulimit":"--ulimit","--user":"--user","--userns":"--userns","--uts":"--uts","--volume":"--volume","--volume-driver":"--volume-driver","--volumes-from":"--volumes-from","--workdir":"--workdir"},s={"--env":!0,"--publish":!0,"--volume":!0,"--attach":!0,"--quiet":!0,"--entrypoint":!0,"--workdir":!0,"--cidfile":!0,"--detach-keys":!0,"--disable-content-trust":!0,"--domainname":!0,"--expose":!0,"--ip":!0,"--link-local-ip":!0,"--platform":!0},n={"-rm":!0,"--name":!0,"--label":!0,"--network":!0,"--user":!0},o={"--volume":!0,"--publish":!0},a=new Set(["--publish","--volume"]),d=z=>{const[W]=z.split(":");return W?.startsWith("/")||W?.startsWith("./")||W?.startsWith("../")||W?.startsWith("~")||W?.startsWith("$BLOCKLET")};function h(z){return z.map(W=>{if(W.key!=="--volume"||W.value.startsWith("$BLOCKLET_APP_DIR/")||W.value.startsWith("$BLOCKLET_DATA_DIR/"))return W;const[H,...N]=W.value.split(":");if(!H||!d(W.value))return W;const X=H.startsWith("/")?`$BLOCKLET_DATA_DIR${H}`:`$BLOCKLET_DATA_DIR/${H}`;return{...W,value:[X,...N].join(":")}})}function u(z){let W=!0;return z.find(N=>N.key==="--publish"&&N.type==="web")?z.map(N=>{if(N.key==="--publish"){const X={...N,type:W?"docker":N.type};return W=N.type==="web",X}return N}):z.map(N=>{if(N.key==="--publish"){const X={...N,type:W?"web":"docker"};return W=!1,X}return N})}function f(z){if(!z)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(z=z.trim(),z.startsWith("$ docker run")&&(z=z.replace("$ docker run","docker run")),!z.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const H=z.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!H)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const N=[],X=[];let $=0,de="",Le="";const V=[];for(;$<H.length;){const ce=H[$];if(!ce){$++;continue}if(ce==="docker"||ce==="run"){$++;continue}if((ce==="-e"||ce==="--env")&&$+1<H.length){const $e=H[$+1]||"",[ve,...Ne]=$e.split("=");if(ve){const _e=Ne.join("=").replace(/^['"]|['"]$/g,"");X.push({key:ve,value:_e})}$+=2;continue}if(ce.startsWith("-")&&V.length===0){const $e=ce.indexOf("=");let ve=ce,Ne=null;$e!==-1&&(ve=ce.substring(0,$e),Ne=ce.substring($e+1).replace(/^['"]|['"]$/g,""));const _e=i[ve];if(!_e){$+=2;continue}if(_e==="--publish"){let Ge="";if(Ne)Ge=Ne,N.push({key:_e,value:Ge});else if($+1<H.length&&!(H[$+1]||"").startsWith("-")){Ge=(H[$+1]||"").replace(/^['"]|['"]$/g,""),N.push({key:_e,value:Ge}),$+=2;continue}else{N.push({key:_e,value:"true"}),$++;continue}$++;continue}if(Ne!==null){N.push({key:_e,value:Ne}),$++;continue}else if($+1<H.length&&!(H[$+1]||"").startsWith("-")){const Ge=(H[$+1]||"").replace(/^['"]|['"]$/g,"");N.push({key:_e,value:Ge}),$+=2;continue}else{N.push({key:_e,value:"true"}),$++;continue}}V.push(ce),$++}de=V[0]||"",Le=V.slice(1).join(" ");const ke=[];for(const ce of N)ce.name="",ce.path="",ce.prefix="",ce.protocol="",ce.proxyBehavior="service",ce.type="docker",!(a.has(ce.key)&&ce.value==="true")&&ke.push(ce);for(const ce of X)ce.custom="",ce.description="",ce.secure=!1,ce.shared=!1,ce.required=!1;return{dockerArgs:u(h(ke)),dockerEnvs:X,dockerImage:de,dockerCommand:Le}}function j({dockerArgs:z,dockerEnvs:W,dockerImage:H,dockerCommand:N}){if(z.length===0&&W.length===0&&!H)return"";const X=["docker run \\"],$=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const de of z){const{key:Le,value:V}=de;if($.has(Le))if(V==="true")X.push(` ${Le} \\`);else{const ke=/[\s"']/g.test(V)?`"${V}"`:V;X.push(` ${Le} ${ke} \\`)}else if(!X.some(ke=>ke.startsWith(` ${Le}`)))if(V==="true")X.push(` ${Le} \\`);else{const ke=/[\s"']/g.test(V)?`"${V}"`:V;X.push(` ${Le} ${ke} \\`)}}for(const de of W){const{key:Le,value:V}=de,ke=/["']/g.test(V)?V:`"${V}"`;X.push(` -e ${Le}=${ke} \\`)}return H&&X.push(` ${H} \\`),N&&X.push(` ${N} \\`),X[X.length-1]?.endsWith(" \\")&&(X[X.length-1]=(X[X.length-1]||"").slice(0,-2)),X.join(`
|
|
206
|
-
`)}const m={"--volume":z=>{const[W]=z.split(":");return W?d(z)&&!z.startsWith("$BLOCKLET_APP_DIR/")&&!z.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":z.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},E=z=>z.replace(/^[-]+/,"").replace(/-([a-z])/g,(N,X)=>X.toUpperCase()),S=z=>`--${z.replace(/([A-Z])/g,"-$1").toLowerCase()}`,O=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],P=["rm ","sudo "];function _(z){if(z==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(z))throw new Error("Docker CMD is invalid");const H=z.toLocaleLowerCase();if(P.some(X=>H.indexOf(X)!==-1))throw new Error("Docker CMD is invalid");if(O.some(X=>z.indexOf(X)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(z))throw new Error("Docker CMD is invalid")}const D=Array.from(new Set(Object.keys(s).map(E))),c=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),command:r.string().allow("").default("").optional().custom((z,W)=>{try{return _(z),z}catch(H){return W.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...D.reduce((z,W)=>{const H=m[S(W)];return c.includes(W)?(z[W]=r.array().items(r.string().trim()).optional(),H?z[W]=r.array().items(r.string().trim().custom((N,X)=>{const $=H(N);return $?X.message($):N})).optional():z[W]=r.array().items(r.string().trim()).optional(),z):(H?z[W]=r.string().trim().custom((N,X)=>{const $=H(N);return $?X.message($):N}).optional():z[W]=r.string().trim().optional(),z)},{})}).optional(),I=z=>{const W=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(W).required().validate(z)},B=(z,W,H)=>{const N={};H.forEach($=>{const de=E($.key);c.includes(de)?N[de]=[...N[de]||[],$.value]:N[de]=$.value});const{error:X}=I(z);if(X)return{error:X,value:N};try{_(z)}catch($){return{error:$,value:N}}return N.image=z,N.command=W||"",w.validate(N)};function M(z,W){const H=JSON.parse(JSON.stringify(W)),N=new Map;let X=1;const $=[];return H.forEach(de=>{if(de.key==="--publish"){const V=de.value.split(":");let ke="127.0.0.1",ce="",$e="";V.length===2?[ce,$e]=V:V.length===3?[ke,ce,$e]=V:V.length===1&&($e=V[0]||"");let ve=N.get(ce||"");if(ve||(ve=`$BLOCKLET_PORT_${X++}`,N.set(ce||"",ve)),!$.find(Ne=>Ne.port===ce)){const Ne=de.type||"docker",_e=`${z.replace(/\W/g,"-")}-${$.length+1}`;$.push({type:Ne,proxyBehavior:de.proxyBehavior||"",name:_e,path:`/${_e}`,port:ce||$e,containerPort:Number($e)||0,hostIP:ke,prefix:Ne==="docker"?`/${_e}`:de.prefix||"*"})}}}),$}function ne(z,W=!1){const H=[];if(!z)return H;for(const N of z){const X={name:N.key,default:N.value===`$${N.key}`?"":N.value,secure:N.secure!==void 0?N.secure:!1,shared:N.shared!==void 0?N.shared:!1,required:N.required!==void 0?N.required:!1,description:N.description||N.key};W||(X.custom=N.custom||""),H.push(X)}return H}function Z(z,W){const H=JSON.parse(JSON.stringify(z));return W.split(".").map(X=>{const $=X.match(/(.+)\[(.+?)\]/);return $?[$[1],$[2]]:X}).flat().filter(Boolean).reduce((X,$)=>{if(!X||!$)return;const de=$?.match(/(.+?)=(.+)/);if(Array.isArray(X)&&de){const[,V,ke]=de;return V&&ke&&(X=X.find(ce=>{const $e=Object.keys(ce).find(ve=>ve.toLowerCase()===V.toLowerCase());return $e&&ce[$e]===ke})),X}const Le=Object.keys(X).find(V=>V.toLowerCase()===$.toLowerCase());return Le?X[Le]:void 0},H)}return Je.addBlockletPrefixVolume=h,Je.allowDockerArgs=s,Je.autoSetDockerArgs=n,Je.dockerArgsToCamelCase=E,Je.dockerArgsValidator=m,Je.dockerBuildCommand=j,Je.dockerCamelCaseToDash=S,Je.dockerCmdValidator=_,Je.dockerParseCommand=f,Je.dockerParseEnvironments=ne,Je.dockerParsePublishPorts=M,Je.dockerSchema=w,Je.getObjByPath=Z,Je.isVolumePath=d,Je.multiValueArgs=c,Je.notAllowUseCustomDockerArgs=o,Je.parseDockerArgsToSchema=B,Je.whiteDockerArgs=i,Je}var Sr,eo;function iu(){if(eo)return Sr;eo=1;const e=ol(),t=sl(),r=Xn();return Sr=s=>{if((0,r.isValid)(s))return s;const n=(0,t.toHex)(Ol.from(typeof s=="string"?s.trim():s));return(0,r.fromPublicKey)(n,{role:e.types.RoleType.ROLE_ANY})},Sr}var Nt={},to;function ou(){if(to)return Nt;to=1;var e=Nt&&Nt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.didExtension=Nt.fileExtension=void 0;const t=e(rs),r=e(ec()),i=Xn(),s=o=>({type:"file",base:o.string(),validate(a,{error:d}){return a&&typeof a=="string"?{value:a}:{errors:d("file.empty",{file:a})}},messages:{"file.empty":'file "{{#file}}" must be non-empty string',"file.enoent":'file "{{#file}}" does not exist',"file.error.generic":'file could not be read. message: "{{#message}}"'},rules:{exists:{multi:!1,method({baseDir:a=null,canSkip:d=()=>!1}={}){return this.$_addRule({name:"exists",args:{baseDir:a,canSkip:d}})},args:[{name:"baseDir",assert:a=>t.default.existsSync(a),message:"baseDir must exist"},{name:"canSkip",assert:a=>typeof a=="function",message:"canSkip must be a function"}],validate(a,{error:d},{baseDir:h,canSkip:u}={}){if(typeof u=="function"&&u(h,a))return a;try{return t.default.statSync(r.default.join(h,a)),a}catch(f){switch(f.code){case"ENOENT":return d("file.enoent",{file:a})}return d("file.error.generic",{message:f.message})}}}}});Nt.fileExtension=s;const n=o=>({type:"DID",base:o.string(),validate(a,{error:d}){return!a||typeof a!="string"?{errors:d("did.empty",{did:a})}:(0,i.isValid)(a)===!1?{errors:d("did.invalid",{did:a})}:{value:a}},messages:{"did.empty":'did "{{#did}}" must be non-empty string',"did.invalid":'did "{{#did}}" is not valid'}});return Nt.didExtension=n,Nt.default={fileExtension:s,didExtension:n},Nt}var vn={},Er={exports:{}};const su=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"];var no;function au(){if(no)return Er.exports;no=1;var e=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),t=su,r=["node_modules","favicon.ico"],i=Er.exports=function(n){var o=[],a=[];if(n===null)return a.push("name cannot be null"),s(o,a);if(n===void 0)return a.push("name cannot be undefined"),s(o,a);if(typeof n!="string")return a.push("name must be a string"),s(o,a);if(n.length||a.push("name length must be greater than zero"),n.match(/^\./)&&a.push("name cannot start with a period"),n.match(/^_/)&&a.push("name cannot start with an underscore"),n.trim()!==n&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(f){n.toLowerCase()===f&&a.push(f+" is a blacklisted name")}),t.forEach(function(f){n.toLowerCase()===f&&o.push(f+" is a core module name")}),n.length>214&&o.push("name can no longer contain more than 214 characters"),n.toLowerCase()!==n&&o.push("name can no longer contain capital letters"),/[~'!()*]/.test(n.split("/").slice(-1)[0])&&o.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(n)!==n){var d=n.match(e);if(d){var h=d[1],u=d[2];if(encodeURIComponent(h)===h&&encodeURIComponent(u)===u)return s(o,a)}a.push("name can only contain URL-friendly characters")}return s(o,a)};i.scopedPackagePattern=e;var s=function(n,o){var a={validForNewPackages:o.length===0&&n.length===0,validForOldPackages:o.length===0,warnings:n,errors:o};return a.warnings.length||delete a.warnings,a.errors.length||delete a.errors,a};return Er.exports}var ro;function ms(){return ro||(ro=1,function(e){var t=vn&&vn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateName=e.validateNewDid=void 0;const r=Xn(),i=t(au()),s=32,n=a=>{if((0,r.toTypeInfo)(a).role!==r.types.RoleType.ROLE_BLOCKLET)throw new Error("Blocklet DID's type must be ROLE_BLOCKLET")};e.validateNewDid=n;const o=(a,{checkDid:d=!0}={})=>{if((0,r.isValid)(a))d&&(0,e.validateNewDid)(a);else{const{validForNewPackages:h,errors:u=[],warnings:f=[]}=(0,i.default)(a);if(!h)throw new Error(u[0]||f[0]);if(a.length>s)throw new Error("Blocklet name is too long")}};e.validateName=o,e.default={validateName:e.validateName,validateNewDid:e.validateNewDid}}(vn)),vn}var io;function gs(){if(io)return ie;io=1;var e=ie&&ie.__createBinding||(Object.create?function(K,le,Te,Pe){Pe===void 0&&(Pe=Te);var Se=Object.getOwnPropertyDescriptor(le,Te);(!Se||("get"in Se?!le.__esModule:Se.writable||Se.configurable))&&(Se={enumerable:!0,get:function(){return le[Te]}}),Object.defineProperty(K,Pe,Se)}:function(K,le,Te,Pe){Pe===void 0&&(Pe=Te),K[Pe]=le[Te]}),t=ie&&ie.__setModuleDefault||(Object.create?function(K,le){Object.defineProperty(K,"default",{enumerable:!0,value:le})}:function(K,le){K.default=le}),r=ie&&ie.__importStar||function(){var K=function(le){return K=Object.getOwnPropertyNames||function(Te){var Pe=[];for(var Se in Te)Object.prototype.hasOwnProperty.call(Te,Se)&&(Pe[Pe.length]=Se);return Pe},K(le)};return function(le){if(le&&le.__esModule)return le;var Te={};if(le!=null)for(var Pe=K(le),Se=0;Se<Pe.length;Se++)Pe[Se]!=="default"&&e(Te,le,Pe[Se]);return t(Te,le),Te}}(),i=ie&&ie.__importDefault||function(K){return K&&K.__esModule?K:{default:K}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.Joi=ie.eventsSchema=ie.installBlockletDescriptionSchema=ie.installBlockletTitleSchema=ie.resourceBundleSchema=ie.authConfigSchema=ie.cacheableSchema=ie.statsSchema=ie.titleSchema=ie.themeSchema=ie.signatureSchema=ie.serviceSchema=ie.scriptsSchema=ie.personSchema=ie.navigationSchema=ie.navigationItemSchema=ie.updateMountPointSchema=ie.mountPointSchema=ie.logoSchema=ie.interfaceSchema=ie.environmentNameSchema=ie.environmentSchema=ie.engineSchema=ie.endpointSchema=ie.distSchema=ie.descriptionSchema=ie.createBlockletSchema=ie.componentSchema=ie.blockletNameSchema=ie.blockletMetaSchema=void 0;const s=i(rs),n=i(ri()),o=i(Xc()),a=i(Jc()),d=Zc(),h=i(nu),u=al(),f=Xn(),j=ru(),m=Yo(),E=i(iu()),S=ou(),O=ms(),P=r(ll()),_=o.default.default,D="/.well-known",c=n.default.extend(d.semver).extend(d.semverRange).extend(S.fileExtension).extend(S.didExtension);ie.Joi=c;const w=(K,le)=>(0,P.checkLink)(K)?K:le.message(`Invalid navigation link: ${K}
|
|
206
|
+
`)}const m={"--volume":z=>{const[W]=z.split(":");return W?d(z)&&!z.startsWith("$BLOCKLET_APP_DIR/")&&!z.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":z.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},E=z=>z.replace(/^[-]+/,"").replace(/-([a-z])/g,(N,X)=>X.toUpperCase()),S=z=>`--${z.replace(/([A-Z])/g,"-$1").toLowerCase()}`,O=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],P=["rm ","sudo "];function _(z){if(z==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(z))throw new Error("Docker CMD is invalid");const H=z.toLocaleLowerCase();if(P.some(X=>H.indexOf(X)!==-1))throw new Error("Docker CMD is invalid");if(O.some(X=>z.indexOf(X)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(z))throw new Error("Docker CMD is invalid")}const D=Array.from(new Set(Object.keys(s).map(E))),c=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),command:r.string().allow("").default("").optional().custom((z,W)=>{try{return _(z),z}catch(H){return W.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...D.reduce((z,W)=>{const H=m[S(W)];return c.includes(W)?(z[W]=r.array().items(r.string().trim()).optional(),H?z[W]=r.array().items(r.string().trim().custom((N,X)=>{const $=H(N);return $?X.message($):N})).optional():z[W]=r.array().items(r.string().trim()).optional(),z):(H?z[W]=r.string().trim().custom((N,X)=>{const $=H(N);return $?X.message($):N}).optional():z[W]=r.string().trim().optional(),z)},{})}).optional(),I=z=>{const W=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(W).required().validate(z)},B=(z,W,H)=>{const N={};H.forEach($=>{const de=E($.key);c.includes(de)?N[de]=[...N[de]||[],$.value]:N[de]=$.value});const{error:X}=I(z);if(X)return{error:X,value:N};try{_(z)}catch($){return{error:$,value:N}}return N.image=z,N.command=W||"",w.validate(N)};function M(z,W){const H=JSON.parse(JSON.stringify(W)),N=new Map;let X=1;const $=[];return H.forEach(de=>{if(de.key==="--publish"){const V=de.value.split(":");let ke="127.0.0.1",ce="",$e="";V.length===2?[ce,$e]=V:V.length===3?[ke,ce,$e]=V:V.length===1&&($e=V[0]||"");let ve=N.get(ce||"");if(ve||(ve=`$BLOCKLET_PORT_${X++}`,N.set(ce||"",ve)),!$.find(Ne=>Ne.port===ce)){const Ne=de.type||"docker",_e=`${z.replace(/\W/g,"-")}-${$.length+1}`;$.push({type:Ne,proxyBehavior:de.proxyBehavior||"",name:_e,path:`/${_e}`,port:ce||$e,containerPort:Number($e)||0,hostIP:ke,prefix:Ne==="docker"?`/${_e}`:de.prefix||"*"})}}}),$}function ne(z,W=!1){const H=[];if(!z)return H;for(const N of z){const X={name:N.key,default:N.value===`$${N.key}`?"":N.value,secure:N.secure!==void 0?N.secure:!1,shared:N.shared!==void 0?N.shared:!1,required:N.required!==void 0?N.required:!1,description:N.description||N.key};W||(X.custom=N.custom||""),H.push(X)}return H}function Z(z,W){const H=JSON.parse(JSON.stringify(z));return W.split(".").map(X=>{const $=X.match(/(.+)\[(.+?)\]/);return $?[$[1],$[2]]:X}).flat().filter(Boolean).reduce((X,$)=>{if(!X||!$)return;const de=$?.match(/(.+?)=(.+)/);if(Array.isArray(X)&&de){const[,V,ke]=de;return V&&ke&&(X=X.find(ce=>{const $e=Object.keys(ce).find(ve=>ve.toLowerCase()===V.toLowerCase());return $e&&ce[$e]===ke})),X}const Le=Object.keys(X).find(V=>V.toLowerCase()===$.toLowerCase());return Le?X[Le]:void 0},H)}return Je.addBlockletPrefixVolume=h,Je.allowDockerArgs=s,Je.autoSetDockerArgs=n,Je.dockerArgsToCamelCase=E,Je.dockerArgsValidator=m,Je.dockerBuildCommand=j,Je.dockerCamelCaseToDash=S,Je.dockerCmdValidator=_,Je.dockerParseCommand=f,Je.dockerParseEnvironments=ne,Je.dockerParsePublishPorts=M,Je.dockerSchema=w,Je.getObjByPath=Z,Je.isVolumePath=d,Je.multiValueArgs=c,Je.notAllowUseCustomDockerArgs=o,Je.parseDockerArgsToSchema=B,Je.whiteDockerArgs=i,Je}var Sr,eo;function iu(){if(eo)return Sr;eo=1;const e=el(),t=tl(),r=Hn();return Sr=s=>{if((0,r.isValid)(s))return s;const n=(0,t.toHex)(Ol.from(typeof s=="string"?s.trim():s));return(0,r.fromPublicKey)(n,{role:e.types.RoleType.ROLE_ANY})},Sr}var Nt={},to;function ou(){if(to)return Nt;to=1;var e=Nt&&Nt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.didExtension=Nt.fileExtension=void 0;const t=e(rs),r=e(ec()),i=Hn(),s=o=>({type:"file",base:o.string(),validate(a,{error:d}){return a&&typeof a=="string"?{value:a}:{errors:d("file.empty",{file:a})}},messages:{"file.empty":'file "{{#file}}" must be non-empty string',"file.enoent":'file "{{#file}}" does not exist',"file.error.generic":'file could not be read. message: "{{#message}}"'},rules:{exists:{multi:!1,method({baseDir:a=null,canSkip:d=()=>!1}={}){return this.$_addRule({name:"exists",args:{baseDir:a,canSkip:d}})},args:[{name:"baseDir",assert:a=>t.default.existsSync(a),message:"baseDir must exist"},{name:"canSkip",assert:a=>typeof a=="function",message:"canSkip must be a function"}],validate(a,{error:d},{baseDir:h,canSkip:u}={}){if(typeof u=="function"&&u(h,a))return a;try{return t.default.statSync(r.default.join(h,a)),a}catch(f){switch(f.code){case"ENOENT":return d("file.enoent",{file:a})}return d("file.error.generic",{message:f.message})}}}}});Nt.fileExtension=s;const n=o=>({type:"DID",base:o.string(),validate(a,{error:d}){return!a||typeof a!="string"?{errors:d("did.empty",{did:a})}:(0,i.isValid)(a)===!1?{errors:d("did.invalid",{did:a})}:{value:a}},messages:{"did.empty":'did "{{#did}}" must be non-empty string',"did.invalid":'did "{{#did}}" is not valid'}});return Nt.didExtension=n,Nt.default={fileExtension:s,didExtension:n},Nt}var vn={},Er={exports:{}};const su=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"];var no;function au(){if(no)return Er.exports;no=1;var e=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),t=su,r=["node_modules","favicon.ico"],i=Er.exports=function(n){var o=[],a=[];if(n===null)return a.push("name cannot be null"),s(o,a);if(n===void 0)return a.push("name cannot be undefined"),s(o,a);if(typeof n!="string")return a.push("name must be a string"),s(o,a);if(n.length||a.push("name length must be greater than zero"),n.match(/^\./)&&a.push("name cannot start with a period"),n.match(/^_/)&&a.push("name cannot start with an underscore"),n.trim()!==n&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(f){n.toLowerCase()===f&&a.push(f+" is a blacklisted name")}),t.forEach(function(f){n.toLowerCase()===f&&o.push(f+" is a core module name")}),n.length>214&&o.push("name can no longer contain more than 214 characters"),n.toLowerCase()!==n&&o.push("name can no longer contain capital letters"),/[~'!()*]/.test(n.split("/").slice(-1)[0])&&o.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(n)!==n){var d=n.match(e);if(d){var h=d[1],u=d[2];if(encodeURIComponent(h)===h&&encodeURIComponent(u)===u)return s(o,a)}a.push("name can only contain URL-friendly characters")}return s(o,a)};i.scopedPackagePattern=e;var s=function(n,o){var a={validForNewPackages:o.length===0&&n.length===0,validForOldPackages:o.length===0,warnings:n,errors:o};return a.warnings.length||delete a.warnings,a.errors.length||delete a.errors,a};return Er.exports}var ro;function ms(){return ro||(ro=1,function(e){var t=vn&&vn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateName=e.validateNewDid=void 0;const r=Hn(),i=t(au()),s=32,n=a=>{if((0,r.toTypeInfo)(a).role!==r.types.RoleType.ROLE_BLOCKLET)throw new Error("Blocklet DID's type must be ROLE_BLOCKLET")};e.validateNewDid=n;const o=(a,{checkDid:d=!0}={})=>{if((0,r.isValid)(a))d&&(0,e.validateNewDid)(a);else{const{validForNewPackages:h,errors:u=[],warnings:f=[]}=(0,i.default)(a);if(!h)throw new Error(u[0]||f[0]);if(a.length>s)throw new Error("Blocklet name is too long")}};e.validateName=o,e.default={validateName:e.validateName,validateNewDid:e.validateNewDid}}(vn)),vn}var io;function gs(){if(io)return ie;io=1;var e=ie&&ie.__createBinding||(Object.create?function(K,le,Te,Pe){Pe===void 0&&(Pe=Te);var Se=Object.getOwnPropertyDescriptor(le,Te);(!Se||("get"in Se?!le.__esModule:Se.writable||Se.configurable))&&(Se={enumerable:!0,get:function(){return le[Te]}}),Object.defineProperty(K,Pe,Se)}:function(K,le,Te,Pe){Pe===void 0&&(Pe=Te),K[Pe]=le[Te]}),t=ie&&ie.__setModuleDefault||(Object.create?function(K,le){Object.defineProperty(K,"default",{enumerable:!0,value:le})}:function(K,le){K.default=le}),r=ie&&ie.__importStar||function(){var K=function(le){return K=Object.getOwnPropertyNames||function(Te){var Pe=[];for(var Se in Te)Object.prototype.hasOwnProperty.call(Te,Se)&&(Pe[Pe.length]=Se);return Pe},K(le)};return function(le){if(le&&le.__esModule)return le;var Te={};if(le!=null)for(var Pe=K(le),Se=0;Se<Pe.length;Se++)Pe[Se]!=="default"&&e(Te,le,Pe[Se]);return t(Te,le),Te}}(),i=ie&&ie.__importDefault||function(K){return K&&K.__esModule?K:{default:K}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.Joi=ie.eventsSchema=ie.installBlockletDescriptionSchema=ie.installBlockletTitleSchema=ie.resourceBundleSchema=ie.authConfigSchema=ie.cacheableSchema=ie.statsSchema=ie.titleSchema=ie.themeSchema=ie.signatureSchema=ie.serviceSchema=ie.scriptsSchema=ie.personSchema=ie.navigationSchema=ie.navigationItemSchema=ie.updateMountPointSchema=ie.mountPointSchema=ie.logoSchema=ie.interfaceSchema=ie.environmentNameSchema=ie.environmentSchema=ie.engineSchema=ie.endpointSchema=ie.distSchema=ie.descriptionSchema=ie.createBlockletSchema=ie.componentSchema=ie.blockletNameSchema=ie.blockletMetaSchema=void 0;const s=i(rs),n=i(ri()),o=i(Xc()),a=i(Jc()),d=Zc(),h=i(nu),u=al(),f=Hn(),j=ru(),m=Yo(),E=i(iu()),S=ou(),O=ms(),P=r(ll()),_=o.default.default,D="/.well-known",c=n.default.extend(d.semver).extend(d.semverRange).extend(S.fileExtension).extend(S.didExtension);ie.Joi=c;const w=(K,le)=>(0,P.checkLink)(K)?K:le.message(`Invalid navigation link: ${K}
|
|
207
207
|
|
|
208
208
|
A valid navigation link should be a relative url which start with '/' or a absolute url, such as:
|
|
209
209
|
- /en/home
|
|
@@ -217,7 +217,7 @@ A valid navigation id is should follow the rules of javascript variables, such a
|
|
|
217
217
|
- foo123
|
|
218
218
|
|
|
219
219
|
see detail in https://www.npmjs.com/package/is-var-name
|
|
220
|
-
`),B=c.string().trim().min(1).custom(K=>{if(_(K)>m.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${m.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return K}).meta({className:"TTitle"});ie.titleSchema=B;const M=c.string().trim().min(3).max(160).meta({className:"TDescription"});ie.descriptionSchema=M;const ne=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ie.installBlockletTitleSchema=ne;const Z=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ie.installBlockletDescriptionSchema=Z;const z=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((K,le)=>K.includes(u.WELLKNOWN_BLOCKLET_LOGO_PATH)?le.message(`logo url should not include ${u.WELLKNOWN_BLOCKLET_LOGO_PATH}`):K).meta({className:"TLogo"});ie.logoSchema=z;const W=c.string().trim().min(1),H=W.meta({className:"TMountPoint"}).custom((K,le)=>(0,P.isValidUrlPath)(K)?K:le.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ie.mountPointSchema=H;const N=W.meta({className:"TUpdateMountPoint"}).custom(K=>(0,P.default)(K));ie.updateMountPointSchema=N;const X=c.string().custom(K=>((0,O.validateName)(K),K)).meta({className:"TBlockletName"});ie.blockletNameSchema=X;const $=[],de=c.string().trim().min(1).max(50).required().custom((K,le)=>K.startsWith("BLOCKLET")&&!$.includes(K)?le.message("Env name can not start with BLOCKLET_"):K.startsWith("COMPONENT")?le.message("Env name can not start with COMPONENT_"):K.startsWith("ABTNODE")?le.message("Env name can not start with ABTNODE_"):/[^\w]/.test(K)?le.message('Env name can include only numbers or letters or "_"'):K).meta({className:"TEnvironmentName",unknownType:"any"});ie.environmentNameSchema=de;const Le=c.object({name:de.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(K=>K.secure?!1:void 0)}).custom((K,le)=>K.secure&&K.default?le.message(`Cannot declare default value for secure env ${K.name}`):K).meta({className:"TEnvironment",unknownType:"any"});ie.environmentSchema=Le;const V=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ie.scriptsSchema=V;const ke=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ie.serviceSchema=ke;const ce=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ie.endpointSchema=ce;const $e=c.string().trim().custom((K,le)=>{const Te=K.split("/").filter(Boolean);return Te.length===0?le.message("cacheable path must be a valid pathname that is not /"):`/${Te.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ie.cacheableSchema=$e;const ve=c.object({type:c.string().lowercase().valid(...m.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(m.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...m.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(m.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(m.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items($e).unique(),services:c.array().items(ke).unique("name"),endpoints:c.array().items(ce).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ie.interfaceSchema=ve;const Ne=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),_e=c.object({platform:c.string().valid(...m.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:Ne,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ie.engineSchema=_e;const Ge=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ie.personSchema=Ge;const tt=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ie.distSchema=tt;const pt=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ie.statsSchema=pt;const xe={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:B,description:M,mountPoint:H,name:X},he=(K,le)=>c.object(K).custom((Te,Pe)=>!le&&Te.source&&Te.source.name&&!Te.source.store?Pe.message(`missing 'store' in source of component ${Te.name}`):Te),ge=he(xe).meta({className:"TComponent",unknownType:"any"});ie.componentSchema=ge;const We=he(xe,!0),Ue=({checkStore:K}={})=>{const le=[ge,We];return c.array().items(K?le[0]:le[1]).optional().default([])},Ot=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ie.signatureSchema=Ot;const Be=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],Ct={id:c.string().custom(I),title:c.alternatives().try(c.string().min(1).max(m.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Be),c.string().min(1).max(m.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(m.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Be),c.string().min(1).max(m.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(w),c.object().min(1).pattern(c.string().valid(...Be),c.string().custom(w))),component:c.string().min(1),section:c.array().items(c.string().min(1)).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},It=c.object({...Ct,items:c.array().items(c.object({...Ct}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ie.navigationItemSchema=It;const Et=c.array().items(It).unique((K,le)=>K.id&&le.id?K.id===le.id:!1).meta({className:"TNavigation",unknownType:"any"});ie.navigationSchema=Et;const Rt=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ie.themeSchema=Rt;const Ye=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ie.authConfigSchema=Ye;const At=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),lt=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ie.resourceBundleSchema=lt;const st=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ie.eventsSchema=st;const ze={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:M.required(),group:c.string().valid(...m.BLOCKLET_GROUPS),main:c.string().trim(),title:B.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:Ge.optional(),contributors:c.array().items(Ge).optional(),maintainers:c.array().items(Ge).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(K=>{if(K.length===0)return K;const le=K.reduce((Te,Pe)=>Te+Pe.value,0);if(le!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${le}`);return K},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((K,le)=>K.length!==2?le.message("length of range should be 2"):K[0]<0?le.message("the first value should not less than 0 in range"):K[1]<=K[0]?le.message("the second value should greater than the first value in range"):K),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...m.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...m.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...m.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...m.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:m.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(ve).unique("name").custom((K,le)=>{if(K.filter(Se=>Se.type===m.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return le.message(`Only one ${m.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Pe=K.filter(Se=>Se.type===m.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const Se of Pe)if(!Se.prefix.startsWith(D))return le.message(`Wellknown path prefix must start with: ${D}`);return K}).default([]),environments:c.array().items(Le).default([]).optional().custom((K,le)=>{if(K&&K.length){const Te=K.filter((Pe,Se)=>K.findIndex(A=>A.name===Pe.name)!==Se);if(Te.length)return le.message(`find duplicate environment names ${Te.map(Pe=>Pe.name).join(", ")}`)}return K}),scripts:V,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(m.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(lt),types:c.array().items(At).max(10)}),engine:c.alternatives().try(_e,c.array().items(_e)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:tt.optional(),stats:pt.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(Ot).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:Ue(),navigation:Et,theme:Rt,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:st.optional()},He=c.object(ze).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ie.blockletMetaSchema=He;const gt=(K,{ensureFiles:le=!1,ensureDist:Te=!1,ensureComponentStore:Pe=!0,ensureName:Se=!1,skipValidateDidName:A=!1,...se}={})=>((!K||!s.default.existsSync(K))&&(le=!1),c.object({...ze,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:le?c.file().trim().exists({baseDir:K}).optional():c.string().trim().optional(),files:c.array().items(le?c.file().exists({baseDir:K,canSkip:(me,Ce)=>[m.BLOCKLET_ENTRY_FILE,m.BLOCKLET_BUNDLE_FILE].includes(Ce)||(0,a.default)(Ce)}):c.string().trim()).optional(),dist:Te?tt.required():tt.optional(),components:Ue({checkStore:Pe}),name:Se?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:j.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...se}).rename("children","components").custom((me,Ce)=>{const{did:p,name:x,docker:k}=me;if(k){const{image:U,dockerfile:ee,network:re}=k;if(!U&&!ee)return Ce.message("Image or dockerfile must be set");if(U&&ee)return Ce.message("Image and dockerfile cannot be set at the same time");if(re)return Ce.message("ExportPorts and network cannot be set at the same time");ee&&(me.files||(me.files=[]),me.files.push(ee))}let L;if((0,f.isValid)(p))try{return(0,O.validateNewDid)(p),me}catch(U){L=U}if(x){(0,O.validateName)(x,{checkDid:!A});const U=(0,E.default)(x);return U!==p?Ce.message(`The did of name "${x}" should be "${U}"`):me}return L?Ce.message(L.message):me}));return ie.createBlockletSchema=gt,ie.default={blockletNameSchema:X,componentSchema:ge,endpointSchema:ce,serviceSchema:ke,createBlockletSchema:gt,interfaceSchema:ve,environmentSchema:Le,environmentNameSchema:de,scriptsSchema:V,personSchema:Ge,distSchema:tt,titleSchema:B,descriptionSchema:M,logoSchema:z,navigationSchema:Et,themeSchema:Rt,mountPointSchema:H,updateMountPointSchema:N,authConfigSchema:Ye,resourceBundleSchema:lt,installBlockletTitleSchema:ne,installBlockletDescriptionSchema:Z,eventsSchema:st,Joi:c},ie}var ft={},oo;function lu(){if(oo)return ft;oo=1;var e=ft&&ft.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ft,"__esModule",{value:!0}),ft.setService=ft.findService=ft.getDefaultServiceConfig=ft.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ft.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:E,error:S}=j.validate(m);if(f&&S)throw new Error(`Invalid blocklet service config: ${S.details.map(O=>O.message).join(", ")}`);return E};ft.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ft.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ft.findService=d,ft.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ft}var so;function cu(){if(so)return Gt;so=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(E=>E.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var ao;function uu(){return ao||(ao=1,function(e){var t=Tt&&Tt.__createBinding||(Object.create?function(w,I,B,M){M===void 0&&(M=B);var ne=Object.getOwnPropertyDescriptor(I,B);(!ne||("get"in ne?!I.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return I[B]}}),Object.defineProperty(w,M,ne)}:function(w,I,B,M){M===void 0&&(M=B),w[M]=I[B]}),r=Tt&&Tt.__setModuleDefault||(Object.create?function(w,I){Object.defineProperty(w,"default",{enumerable:!0,value:I})}:function(w,I){w.default=I}),i=Tt&&Tt.__importStar||function(){var w=function(I){return w=Object.getOwnPropertyNames||function(B){var M=[];for(var ne in B)Object.prototype.hasOwnProperty.call(B,ne)&&(M[M.length]=ne);return M},w(I)};return function(I){if(I&&I.__esModule)return I;var B={};if(I!=null)for(var M=w(I),ne=0;ne<M.length;ne++)M[ne]!=="default"&&t(B,I,M[ne]);return r(B,I),B}}(),s=Tt&&Tt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,I)=>{w.description||(w.description=`Blocklet from ${I}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const I=o.fromUrl(w.repository.url);I&&(w.repository.url=I.getDefaultRepresentation()==="shortcut"?I.https():I.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(I=>!(!I||typeof I!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(I=>!(typeof I!="string"||!I)))};e.fixKeywords=m;const E=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(I=>!(typeof I!="string"||!I)))};e.fixTags=E;const S=(w,I)=>(w.author&&(w.author=I(w.author)),["maintainers","contributors"].forEach(B=>{Array.isArray(w[B])&&(w[B]=w[B].map(I))}),w),O=w=>{if(!w)return"";if(typeof w=="string")return w;const I=w.name||"",B=w.url||w.web,M=B?` (${B})`:"",ne=w.email||w.mail,Z=ne?` <${ne}>`:"";return I+Z+M};e.formatPerson=O;const P=w=>{if(typeof w!="string")return w;const I=w.match(/^([^(<]+)/),B=w.match(/\(([^)]+)\)/),M=w.match(/<([^>]+)>/),ne={};return I&&I[0].trim()&&(ne.name=I[0].trim()),M&&([,ne.email]=M),B&&([,ne.url]=B),ne};e.parsePerson=P;const _=w=>(S(w,O),S(w,P),w);e.fixPerson=_;const D=(w,I=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Z=>{Z.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Z.protocol="http")}),w;const M=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Z="web",name:z,path:W="/",protocol:H="http",port:N=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Z,name:z,path:W,prefix:M,port:N,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Z=>{w[Z]&&ne({name:Z,path:w[Z]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Z=>{ne({type:"service",name:Z.protocol,protocol:Z.protocol,port:{internal:`BLOCKLET_${Z.protocol}_PORT`.toUpperCase(),external:Z.port}})}),I&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=D;const c=w=>{const{did:I}=w;try{(0,h.validateNewDid)(I),w.name=I}catch{}return w};e.fixName=c,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:_,fixTags:E,fixName:c,formatPerson:O,parsePerson:P,fixInterfaces:D,fixService:d.fixAndValidateService}}(Tt)),Tt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:F.object.isRequired,locale:F.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=oi(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>Ut.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:F.func,children:F.node,value:F.string,helperText:F.string};function xs({onClick:e}){const{t}=St();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(xt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:F.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=un(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:E}=St(),S={dist:{}},{encryptKey:O}=hl(),[P,_]=q.useState(e),[D,c]=q.useState(e?1:0),[w,I]=q.useState(S),[B,M]=q.useState(!1),[ne,Z]=q.useState(""),[z]=oi("instant-blocklet-install",!1),[W,H]=q.useState({}),N=s==="component",X=N?!0:!e,{addUrlRecord:$}=ys(),de=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(We=>We.provider===Bt.LOGIN_PROVIDER.WALLET),[d.user]),Le=q.useMemo(()=>{let he=P.trim();return!he.startsWith("https://")&&!he.startsWith("http://")&&!he.startsWith("file://")&&(he=`file://${he}`),he},[P]),V=async()=>{I(S),j(null),u(!0);const he=Le;try{const ge=decodeURIComponent(he);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:We,inStore:Ue,registryUrl:Ot}=await o.getBlockletMetaFromUrl({input:{url:ge}});I(We),H({inStore:Ue,registryUrl:Ot,inputUrl:he}),$(he)}catch(ge){console.error(ge);const We=`Blocklet Install failed: ${$r(ge)}`;j(We),i(ge)}finally{u(!1)}},ke=()=>{if(N){r({meta:w,...W}),t();return}if(z){u(!0),M(!0);return}const he=nn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Qn(he,{blocklet_meta_url:decodeURIComponent(Le.trim()),from:"url"})},ce=()=>{u(!1),M(!1),r({meta:w,...W}),t()},$e=()=>{u(!1),M(!1)};q.useEffect(()=>{e&&V()},[e]);const ve=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(P.trim())}),[w,P]),Ne=q.useCallback(async()=>{if(de||z){Z("");return}const he=new URL(window.location.href);he.pathname=nn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),he.searchParams.set("_ek_",O),Object.keys(ve).forEach(We=>{he.searchParams.set(We,ve[We])});const{data:ge}=await a.get(he.href);ge.url?Z(ge.url):Z("")},[de,ve,a,O,z]);q.useEffect(()=>{Ne()},[Ne]);const _e=q.useMemo(()=>de&&ne?{...ve,nw:ne,skipMigrateAccount:!0}:ve,[ve,ne,de]),Ge=[{name:m("common.name"),value:$t.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:E}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],tt=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(jt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:Ge.map(he=>he.name===m("common.did")?l.jsx(Li,{valueComponent:"div",nameWidth:120,name:he.name,nameFormatter:()=>m("common.did"),children:he.value},he.name):l.jsx(Li,{valueComponent:"div",nameWidth:120,name:he.name,children:he.value},he.name))}):null,pt=Xl(async()=>{let he=w.title;d.user&&(he=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:he,blockletMetaUrl:decodeURIComponent(P.trim()),type:"store",storeUrl:W.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Hn.error($r(ge),{autoHideDuration:3e3})}}),mt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(Ie,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:P,helperText:m("blocklet.fromUrl.description"),onValueChange:he=>{j(null),_(he)},children:l.jsx(Gn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:P,onChange:he=>{j(null),_(he.target.value)},disabled:h,onKeyPress:he=>{he.key==="Enter"&&(he.preventDefault(),V(),c(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{V(),c(1)}},{label:m("blocklet.fromUrl.step1"),body:tt(),cancel:m(X?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{X?c(he=>he-1):t()},onConfirm:()=>{ke()}}],xe=mt[D];return l.jsxs(l.Fragment,{children:[l.jsxs(ii,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>xe.onCancel(),showCloseButton:D===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[xe.cancel&&l.jsx(bt,{onClick:he=>{he.stopPropagation(),j(null),xe.onCancel()},color:"inherit",children:xe.cancel||m("common.cancel")}),l.jsxs(bt,{onClick:he=>{he.stopPropagation(),xe.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!P||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&D===0&&l.jsx(jt,{size:16}),xe.confirm]})]}),children:[X&&l.jsx(xa,{alternativeLabel:!0,activeStep:D,children:mt.map(({label:he})=>l.jsx(wa,{children:l.jsx(Sa,{children:he})},he))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:xe.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&B&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!de&&!z?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:_e,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:$e,customItems:z?[]:[l.jsx(xs,{onClick:pt})]})]})}ws.propTypes={defaultUrl:F.string,onCancel:F.func.isRequired,onSuccess:F.func.isRequired,onError:F.func,mode:F.oneOf(["install","component"]),handleText:F.object};const fu={meta:F.object.isRequired,onCancel:F.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=St(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?ji.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?ji.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(bt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:F.oneOf(["both","purchase","verify"]).isRequired,onSelect:F.func.isRequired,onNext:F.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=St(),{info:o}=un(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=$t.getDisplayName({meta:e}),j=async(E,S)=>{const O=({downloadTokenList:D})=>{i({downloadTokenList:D})},P=D=>{Hn.error(D),t(D)};function _(D){return gl(()=>_i.get(D).then(async({data:c})=>{const w=c?.downloadTokenList;if(c.status==="succeed"){if(w&&w.length)await O({downloadTokenList:w});else return await P(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return c.status==="error"?(console.error("vc error: ",c),await P(c?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:D}=ml(d);await _(D)}else await O({downloadTokenList:E.downloadTokenList&&S(E.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const E=new URL(u);E.pathname="/api/did/verify-purchase-blocklet/token",E.searchParams.set("serverDid",o.did),E.searchParams.set("blockletDid",e?.did);try{_i.get(E.href).then(({data:S})=>{const O=`${S.url}`;h(O)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Pi.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Pi.create({baseURL:nn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:F.func,mode:F.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:F.oneOf(["both","verify","purchase"]).isRequired,ref:F.any};function pu({...e}){return l.jsx(bt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=St(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:F.object,onStartNow:F.func,children:F.any,disabled:F.bool};const mu=ot(te)`
|
|
220
|
+
`),B=c.string().trim().min(1).custom(K=>{if(_(K)>m.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${m.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return K}).meta({className:"TTitle"});ie.titleSchema=B;const M=c.string().trim().min(3).max(160).meta({className:"TDescription"});ie.descriptionSchema=M;const ne=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ie.installBlockletTitleSchema=ne;const Z=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ie.installBlockletDescriptionSchema=Z;const z=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((K,le)=>K.includes(u.WELLKNOWN_BLOCKLET_LOGO_PATH)?le.message(`logo url should not include ${u.WELLKNOWN_BLOCKLET_LOGO_PATH}`):K).meta({className:"TLogo"});ie.logoSchema=z;const W=c.string().trim().min(1),H=W.meta({className:"TMountPoint"}).custom((K,le)=>(0,P.isValidUrlPath)(K)?K:le.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ie.mountPointSchema=H;const N=W.meta({className:"TUpdateMountPoint"}).custom(K=>(0,P.default)(K));ie.updateMountPointSchema=N;const X=c.string().custom(K=>((0,O.validateName)(K),K)).meta({className:"TBlockletName"});ie.blockletNameSchema=X;const $=[],de=c.string().trim().min(1).max(50).required().custom((K,le)=>K.startsWith("BLOCKLET")&&!$.includes(K)?le.message("Env name can not start with BLOCKLET_"):K.startsWith("COMPONENT")?le.message("Env name can not start with COMPONENT_"):K.startsWith("ABTNODE")?le.message("Env name can not start with ABTNODE_"):/[^\w]/.test(K)?le.message('Env name can include only numbers or letters or "_"'):K).meta({className:"TEnvironmentName",unknownType:"any"});ie.environmentNameSchema=de;const Le=c.object({name:de.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(K=>K.secure?!1:void 0)}).custom((K,le)=>K.secure&&K.default?le.message(`Cannot declare default value for secure env ${K.name}`):K).meta({className:"TEnvironment",unknownType:"any"});ie.environmentSchema=Le;const V=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ie.scriptsSchema=V;const ke=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ie.serviceSchema=ke;const ce=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ie.endpointSchema=ce;const $e=c.string().trim().custom((K,le)=>{const Te=K.split("/").filter(Boolean);return Te.length===0?le.message("cacheable path must be a valid pathname that is not /"):`/${Te.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ie.cacheableSchema=$e;const ve=c.object({type:c.string().lowercase().valid(...m.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(m.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...m.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(m.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(m.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items($e).unique(),services:c.array().items(ke).unique("name"),endpoints:c.array().items(ce).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ie.interfaceSchema=ve;const Ne=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),_e=c.object({platform:c.string().valid(...m.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:Ne,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ie.engineSchema=_e;const Ge=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ie.personSchema=Ge;const tt=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ie.distSchema=tt;const pt=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ie.statsSchema=pt;const xe={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:X.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:B,description:M,mountPoint:H,name:X},he=(K,le)=>c.object(K).custom((Te,Pe)=>!le&&Te.source&&Te.source.name&&!Te.source.store?Pe.message(`missing 'store' in source of component ${Te.name}`):Te),ge=he(xe).meta({className:"TComponent",unknownType:"any"});ie.componentSchema=ge;const We=he(xe,!0),Ue=({checkStore:K}={})=>{const le=[ge,We];return c.array().items(K?le[0]:le[1]).optional().default([])},Ot=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ie.signatureSchema=Ot;const Be=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],Ct={id:c.string().custom(I),title:c.alternatives().try(c.string().min(1).max(m.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Be),c.string().min(1).max(m.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(m.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Be),c.string().min(1).max(m.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(w),c.object().min(1).pattern(c.string().valid(...Be),c.string().custom(w))),component:c.string().min(1),section:c.array().items(c.string().min(1)).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},It=c.object({...Ct,items:c.array().items(c.object({...Ct}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ie.navigationItemSchema=It;const Et=c.array().items(It).unique((K,le)=>K.id&&le.id?K.id===le.id:!1).meta({className:"TNavigation",unknownType:"any"});ie.navigationSchema=Et;const Rt=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ie.themeSchema=Rt;const Ye=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ie.authConfigSchema=Ye;const At=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),lt=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ie.resourceBundleSchema=lt;const st=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ie.eventsSchema=st;const ze={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:M.required(),group:c.string().valid(...m.BLOCKLET_GROUPS),main:c.string().trim(),title:B.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:Ge.optional(),contributors:c.array().items(Ge).optional(),maintainers:c.array().items(Ge).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(K=>{if(K.length===0)return K;const le=K.reduce((Te,Pe)=>Te+Pe.value,0);if(le!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${le}`);return K},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((K,le)=>K.length!==2?le.message("length of range should be 2"):K[0]<0?le.message("the first value should not less than 0 in range"):K[1]<=K[0]?le.message("the second value should greater than the first value in range"):K),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...m.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...m.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...m.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...m.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:m.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(ve).unique("name").custom((K,le)=>{if(K.filter(Se=>Se.type===m.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return le.message(`Only one ${m.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Pe=K.filter(Se=>Se.type===m.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const Se of Pe)if(!Se.prefix.startsWith(D))return le.message(`Wellknown path prefix must start with: ${D}`);return K}).default([]),environments:c.array().items(Le).default([]).optional().custom((K,le)=>{if(K&&K.length){const Te=K.filter((Pe,Se)=>K.findIndex(A=>A.name===Pe.name)!==Se);if(Te.length)return le.message(`find duplicate environment names ${Te.map(Pe=>Pe.name).join(", ")}`)}return K}),scripts:V,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(m.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(lt),types:c.array().items(At).max(10)}),engine:c.alternatives().try(_e,c.array().items(_e)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:tt.optional(),stats:pt.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(Ot).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:Ue(),navigation:Et,theme:Rt,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:st.optional()},He=c.object(ze).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ie.blockletMetaSchema=He;const gt=(K,{ensureFiles:le=!1,ensureDist:Te=!1,ensureComponentStore:Pe=!0,ensureName:Se=!1,skipValidateDidName:A=!1,...se}={})=>((!K||!s.default.existsSync(K))&&(le=!1),c.object({...ze,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:le?c.file().trim().exists({baseDir:K}).optional():c.string().trim().optional(),files:c.array().items(le?c.file().exists({baseDir:K,canSkip:(me,Ce)=>[m.BLOCKLET_ENTRY_FILE,m.BLOCKLET_BUNDLE_FILE].includes(Ce)||(0,a.default)(Ce)}):c.string().trim()).optional(),dist:Te?tt.required():tt.optional(),components:Ue({checkStore:Pe}),name:Se?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:j.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...se}).rename("children","components").custom((me,Ce)=>{const{did:p,name:x,docker:k}=me;if(k){const{image:U,dockerfile:ee,network:re}=k;if(!U&&!ee)return Ce.message("Image or dockerfile must be set");if(U&&ee)return Ce.message("Image and dockerfile cannot be set at the same time");if(re)return Ce.message("ExportPorts and network cannot be set at the same time");ee&&(me.files||(me.files=[]),me.files.push(ee))}let L;if((0,f.isValid)(p))try{return(0,O.validateNewDid)(p),me}catch(U){L=U}if(x){(0,O.validateName)(x,{checkDid:!A});const U=(0,E.default)(x);return U!==p?Ce.message(`The did of name "${x}" should be "${U}"`):me}return L?Ce.message(L.message):me}));return ie.createBlockletSchema=gt,ie.default={blockletNameSchema:X,componentSchema:ge,endpointSchema:ce,serviceSchema:ke,createBlockletSchema:gt,interfaceSchema:ve,environmentSchema:Le,environmentNameSchema:de,scriptsSchema:V,personSchema:Ge,distSchema:tt,titleSchema:B,descriptionSchema:M,logoSchema:z,navigationSchema:Et,themeSchema:Rt,mountPointSchema:H,updateMountPointSchema:N,authConfigSchema:Ye,resourceBundleSchema:lt,installBlockletTitleSchema:ne,installBlockletDescriptionSchema:Z,eventsSchema:st,Joi:c},ie}var ft={},oo;function lu(){if(oo)return ft;oo=1;var e=ft&&ft.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ft,"__esModule",{value:!0}),ft.setService=ft.findService=ft.getDefaultServiceConfig=ft.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ft.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:E,error:S}=j.validate(m);if(f&&S)throw new Error(`Invalid blocklet service config: ${S.details.map(O=>O.message).join(", ")}`);return E};ft.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ft.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ft.findService=d,ft.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ft}var so;function cu(){if(so)return Gt;so=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(E=>E.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var ao;function uu(){return ao||(ao=1,function(e){var t=Tt&&Tt.__createBinding||(Object.create?function(w,I,B,M){M===void 0&&(M=B);var ne=Object.getOwnPropertyDescriptor(I,B);(!ne||("get"in ne?!I.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return I[B]}}),Object.defineProperty(w,M,ne)}:function(w,I,B,M){M===void 0&&(M=B),w[M]=I[B]}),r=Tt&&Tt.__setModuleDefault||(Object.create?function(w,I){Object.defineProperty(w,"default",{enumerable:!0,value:I})}:function(w,I){w.default=I}),i=Tt&&Tt.__importStar||function(){var w=function(I){return w=Object.getOwnPropertyNames||function(B){var M=[];for(var ne in B)Object.prototype.hasOwnProperty.call(B,ne)&&(M[M.length]=ne);return M},w(I)};return function(I){if(I&&I.__esModule)return I;var B={};if(I!=null)for(var M=w(I),ne=0;ne<M.length;ne++)M[ne]!=="default"&&t(B,I,M[ne]);return r(B,I),B}}(),s=Tt&&Tt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,I)=>{w.description||(w.description=`Blocklet from ${I}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const I=o.fromUrl(w.repository.url);I&&(w.repository.url=I.getDefaultRepresentation()==="shortcut"?I.https():I.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(I=>!(!I||typeof I!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(I=>!(typeof I!="string"||!I)))};e.fixKeywords=m;const E=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(I=>!(typeof I!="string"||!I)))};e.fixTags=E;const S=(w,I)=>(w.author&&(w.author=I(w.author)),["maintainers","contributors"].forEach(B=>{Array.isArray(w[B])&&(w[B]=w[B].map(I))}),w),O=w=>{if(!w)return"";if(typeof w=="string")return w;const I=w.name||"",B=w.url||w.web,M=B?` (${B})`:"",ne=w.email||w.mail,Z=ne?` <${ne}>`:"";return I+Z+M};e.formatPerson=O;const P=w=>{if(typeof w!="string")return w;const I=w.match(/^([^(<]+)/),B=w.match(/\(([^)]+)\)/),M=w.match(/<([^>]+)>/),ne={};return I&&I[0].trim()&&(ne.name=I[0].trim()),M&&([,ne.email]=M),B&&([,ne.url]=B),ne};e.parsePerson=P;const _=w=>(S(w,O),S(w,P),w);e.fixPerson=_;const D=(w,I=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Z=>{Z.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Z.protocol="http")}),w;const M=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Z="web",name:z,path:W="/",protocol:H="http",port:N=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Z,name:z,path:W,prefix:M,port:N,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Z=>{w[Z]&&ne({name:Z,path:w[Z]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Z=>{ne({type:"service",name:Z.protocol,protocol:Z.protocol,port:{internal:`BLOCKLET_${Z.protocol}_PORT`.toUpperCase(),external:Z.port}})}),I&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=D;const c=w=>{const{did:I}=w;try{(0,h.validateNewDid)(I),w.name=I}catch{}return w};e.fixName=c,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:_,fixTags:E,fixName:c,formatPerson:O,parsePerson:P,fixInterfaces:D,fixService:d.fixAndValidateService}}(Tt)),Tt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:F.object.isRequired,locale:F.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=oi(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>Ut.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:F.func,children:F.node,value:F.string,helperText:F.string};function xs({onClick:e}){const{t}=St();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(xt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:F.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=un(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:E}=St(),S={dist:{}},{encryptKey:O}=hl(),[P,_]=q.useState(e),[D,c]=q.useState(e?1:0),[w,I]=q.useState(S),[B,M]=q.useState(!1),[ne,Z]=q.useState(""),[z]=oi("instant-blocklet-install",!1),[W,H]=q.useState({}),N=s==="component",X=N?!0:!e,{addUrlRecord:$}=ys(),de=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(We=>We.provider===Bt.LOGIN_PROVIDER.WALLET),[d.user]),Le=q.useMemo(()=>{let he=P.trim();return!he.startsWith("https://")&&!he.startsWith("http://")&&!he.startsWith("file://")&&(he=`file://${he}`),he},[P]),V=async()=>{I(S),j(null),u(!0);const he=Le;try{const ge=decodeURIComponent(he);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:We,inStore:Ue,registryUrl:Ot}=await o.getBlockletMetaFromUrl({input:{url:ge}});I(We),H({inStore:Ue,registryUrl:Ot,inputUrl:he}),$(he)}catch(ge){console.error(ge);const We=`Blocklet Install failed: ${$r(ge)}`;j(We),i(ge)}finally{u(!1)}},ke=()=>{if(N){r({meta:w,...W}),t();return}if(z){u(!0),M(!0);return}const he=nn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Qn(he,{blocklet_meta_url:decodeURIComponent(Le.trim()),from:"url"})},ce=()=>{u(!1),M(!1),r({meta:w,...W}),t()},$e=()=>{u(!1),M(!1)};q.useEffect(()=>{e&&V()},[e]);const ve=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(P.trim())}),[w,P]),Ne=q.useCallback(async()=>{if(de||z){Z("");return}const he=new URL(window.location.href);he.pathname=nn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),he.searchParams.set("_ek_",O),Object.keys(ve).forEach(We=>{he.searchParams.set(We,ve[We])});const{data:ge}=await a.get(he.href);ge.url?Z(ge.url):Z("")},[de,ve,a,O,z]);q.useEffect(()=>{Ne()},[Ne]);const _e=q.useMemo(()=>de&&ne?{...ve,nw:ne,skipMigrateAccount:!0}:ve,[ve,ne,de]),Ge=[{name:m("common.name"),value:$t.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:E}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],tt=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(jt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:Ge.map(he=>he.name===m("common.did")?l.jsx(Li,{valueComponent:"div",nameWidth:120,name:he.name,nameFormatter:()=>m("common.did"),children:he.value},he.name):l.jsx(Li,{valueComponent:"div",nameWidth:120,name:he.name,children:he.value},he.name))}):null,pt=Xl(async()=>{let he=w.title;d.user&&(he=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:he,blockletMetaUrl:decodeURIComponent(P.trim()),type:"store",storeUrl:W.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Xn.error($r(ge),{autoHideDuration:3e3})}}),mt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(Ie,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:P,helperText:m("blocklet.fromUrl.description"),onValueChange:he=>{j(null),_(he)},children:l.jsx(Gn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:P,onChange:he=>{j(null),_(he.target.value)},disabled:h,onKeyPress:he=>{he.key==="Enter"&&(he.preventDefault(),V(),c(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{V(),c(1)}},{label:m("blocklet.fromUrl.step1"),body:tt(),cancel:m(X?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{X?c(he=>he-1):t()},onConfirm:()=>{ke()}}],xe=mt[D];return l.jsxs(l.Fragment,{children:[l.jsxs(ii,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>xe.onCancel(),showCloseButton:D===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[xe.cancel&&l.jsx(bt,{onClick:he=>{he.stopPropagation(),j(null),xe.onCancel()},color:"inherit",children:xe.cancel||m("common.cancel")}),l.jsxs(bt,{onClick:he=>{he.stopPropagation(),xe.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!P||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&D===0&&l.jsx(jt,{size:16}),xe.confirm]})]}),children:[X&&l.jsx(xa,{alternativeLabel:!0,activeStep:D,children:mt.map(({label:he})=>l.jsx(wa,{children:l.jsx(Sa,{children:he})},he))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:xe.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&B&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!de&&!z?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:_e,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:$e,customItems:z?[]:[l.jsx(xs,{onClick:pt})]})]})}ws.propTypes={defaultUrl:F.string,onCancel:F.func.isRequired,onSuccess:F.func.isRequired,onError:F.func,mode:F.oneOf(["install","component"]),handleText:F.object};const fu={meta:F.object.isRequired,onCancel:F.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=St(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?ji.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?ji.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(bt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:F.oneOf(["both","purchase","verify"]).isRequired,onSelect:F.func.isRequired,onNext:F.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=St(),{info:o}=un(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=$t.getDisplayName({meta:e}),j=async(E,S)=>{const O=({downloadTokenList:D})=>{i({downloadTokenList:D})},P=D=>{Xn.error(D),t(D)};function _(D){return gl(()=>_i.get(D).then(async({data:c})=>{const w=c?.downloadTokenList;if(c.status==="succeed"){if(w&&w.length)await O({downloadTokenList:w});else return await P(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return c.status==="error"?(console.error("vc error: ",c),await P(c?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:D}=ml(d);await _(D)}else await O({downloadTokenList:E.downloadTokenList&&S(E.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const E=new URL(u);E.pathname="/api/did/verify-purchase-blocklet/token",E.searchParams.set("serverDid",o.did),E.searchParams.set("blockletDid",e?.did);try{_i.get(E.href).then(({data:S})=>{const O=`${S.url}`;h(O)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Pi.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Pi.create({baseURL:nn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:F.func,mode:F.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:F.oneOf(["both","verify","purchase"]).isRequired,ref:F.any};function pu({...e}){return l.jsx(bt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=St(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:F.object,onStartNow:F.func,children:F.any,disabled:F.bool};const mu=ot(te)`
|
|
221
221
|
width: 100%;
|
|
222
222
|
margin-top: auto;
|
|
223
223
|
padding-top: 24px;
|
|
@@ -550,7 +550,7 @@ see detail in https://www.npmjs.com/package/is-var-name
|
|
|
550
550
|
color: ${e=>e.theme.palette.grey[500]};
|
|
551
551
|
font-size: 16px;
|
|
552
552
|
cursor: pointer;
|
|
553
|
-
`;function Ch(){const{search:e,t,endpoint:r,locale:i,getCategoryLocale:s,developerName:n,showResourcesSwitch:o,layout:a,baseSearch:d,categoryOptions:h,compact:u}=dt(),{filters:f,handleSort:j,handlePrice:m,handleDeveloper:E,handleSwitchShowResources:S,cleanFilter:O,handleCategory:P}=e,_=Zs(t);return l.jsxs(ut,{className:"filter-bar",direction:{xs:"column",md:"row"},spacing:{xs:1,md:0},sx:{position:"sticky",top:0,zIndex:1e3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",gap:2,pt:{xs:2,md:0},px:0,pb:u?2:3,backgroundColor:"background.default"},children:[!u&&l.jsx(Ie,{variant:"h2",sx:{textTransform:"capitalize"},children:s(f.category)}),l.jsxs(ut,{direction:"row",sx:{flex:1,alignItems:"center",flexWrap:{xs:"wrap",md:"nowrap"},width:"100%",justifyContent:{xs:"flex-start",md:"flex-end"},gap:2},children:[a.showSearch?l.jsx(te,{sx:{flex:1,flexBasis:{xs:"100%",md:"auto"}},children:d?l.jsx(kh,{}):l.jsx(aa,{locale:i,endpoint:r,sx:{display:{md:"block",xs:"none"},flex:1,mr:1,width:"350px"},t,filters:e.filters,handleKeyword:e.handleKeyword,handleSearchSelect:e.handleSearchSelect})}):null,f.owner&&n&&l.jsx(ki,{label:t("blocklet.authorTag",{name:n}),size:"small",onDelete:()=>E("")}),f.resourceDid&&f.resourceBlocklet&&l.jsx(ki,{label:t("blocklet.resourceTag",{name:f.resourceBlocklet}),size:"small",onDelete:()=>O(["resourceDid","resourceBlocklet","showResources"])}),o?l.jsx(Co,{checked:f.showResources!=="false",onChange:D=>S(D?"true":"false"),label:t("common.showResources")}):null,l.jsx(Co,{checked:f.price==="free",onChange:D=>m(D?"free":""),label:t("blocklet.free")}),u&&l.jsx(te,{children:l.jsx(Jr,{value:f.category||h[0]?.value,options:h,placeholder:t("common.category"),onChange:D=>P(D)})}),l.jsx(Jr,{value:f.sortBy||_[0].value,options:_,placeholder:t("sort.sort"),onChange:D=>j(D)})]})]})}function Co({checked:e,onChange:t,label:r}){const i=qt();return l.jsx(Zr,{sx:{m:0,p:0},className:"check-button",control:l.jsx(ei,{checked:e,icon:l.jsx(Ft,{style:{padding:0,color:i.palette.text.secondary},icon:Md}),checkedIcon:l.jsx(Ft,{style:{padding:0,color:i.palette.primary.main},icon:Bd}),size:"large",sx:{p:0,mr:1},onChange:s=>t(s.target.checked)}),label:r})}function Fn({children:e}){return l.jsxs(te,{sx:{display:"flex",mt:2,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"text.hint"},children:[l.jsx(tl,{}),e]})}function Io(){const{t:e}=dt();return l.jsx(Ie,{style:{textAlign:"center"},variant:"subtitle2",children:e("blocklet.noResults")})}function Ar({filterTip:e=!1,keywordTip:t=!1}){const{t:r,locale:i}=dt(),s=()=>i==="zh"?"、":" , ";return l.jsxs(te,{sx:{mt:1,display:"flex"},children:[l.jsx(Ie,{style:{marginRight:"16px"},children:r("blocklet.emptyTip")}),e&&l.jsx(Ie,{children:r("blocklet.filterTip")}),e&&t&&s(),t&&l.jsx(Ie,{children:r("blocklet.keywordTip")})]})}function Dr({primaryStart:e,primaryEnd:t,filter:r}){return l.jsxs(Ie,{variant:"subtitle2",sx:{display:"flex",gap:.5,mx:.5},children:[l.jsx(Ie,{children:e}),l.jsx(Ie,{title:r,color:"primary",sx:{maxWidth:"30vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),l.jsxs(Ie,{children:[t," "]})]})}function Ih(){const{t:e,search:t,getCategoryLocale:r,selectedCategory:i}=dt(),{filters:s}=t,n=!!i||!!s.price;if(s.keyword&&n)return l.jsxs(Fn,{children:[l.jsx(Dr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Ar,{keywordTip:!0,filterTip:!0})]});if(s.keyword)return l.jsxs(Fn,{children:[l.jsx(Dr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Ar,{keywordTip:!0})]});if(n){const o=r(i);return l.jsxs(Fn,{children:[o?l.jsx(Dr,{primaryStart:e("blocklet.noCategoryResults1"),primaryEnd:e("blocklet.noCategoryResults2"),filter:o}):l.jsx(Io,{}),l.jsx(Ar,{filterTip:!0})]})}return l.jsx(Fn,{children:l.jsx(Io,{})})}const Rh=(e,t,r,i)=>Jl(async s=>{s||(r.currentPage=r.defaultCurrentPage);const{currentPage:n,pageSize:o}=r,a={...t,category:t.category==="All"?"":t.category,sortBy:kt[t.sortBy],page:n,pageSize:o};i(null);const{data:d={}}=await e.get(kt.blockletsPath,{params:a});return r.currentPage++,{page:n,pageSize:o,list:d?.dataList||[],total:d?.total||0}},{isNoMore:s=>s?s.page*s.pageSize>=s.total:!1,reloadDeps:[e,yl(t)],onError:i});function Ph(){const{storeApi:e,search:t,extraFilter:r,errors:i,updateDeveloperName:s}=dt(),{filters:n}=t,o=Yl({currentPage:kt.currentPage,pageSize:sh()?kt.mobilePageSize:kt.pageSize,defaultCurrentPage:kt.defaultCurrentPage}),[a,d]=q.useState(null),h=Rh(e,n,o,d),u=q.useMemo(()=>r?r(h.data?.list||[]):h.data?.list||[],[h.data,r]);return q.useEffect(()=>{const f=u.find(j=>j.owner.did===n.owner);s(f?.owner.fullName||f?.author.name||"")},[n.owner,u,s]),{blocklets:u,fetchBlockletsError:a,loadMore:h.loadMore,hasNextPage:!h.noMore,total:h.data?.total||0,loadings:{fetchBlockletsLoading:h.loading,loadingMore:h.loadingMore},errors:{...i,fetchBlockletsError:a}}}function Lh(){const{t:e,search:t,endpoint:r,blockletRender:i,serverVersion:s,minItemWidth:n,layout:o,baseSearch:a,compact:d}=dt(),{filters:h}=t,{blocklets:u,errors:f,loadMore:j,loadings:m,hasNextPage:E,total:S}=Ph(),[O]=Dd({loading:m.fetchBlockletsLoading||m.loadingMore,hasNextPage:E,onLoadMore:j});if(f.fetchBlockletsError){const c=new Error(`Failed to fetch blocklets from ${r}: ${ih(f.fetchBlockletsError)}`);return l.jsx(Jn,{error:c})}const P=a&&o.showSearch||!h.keyword;return l.jsxs(l.Fragment,{children:[P?l.jsx(Ch,{}):l.jsxs(l.Fragment,{children:[l.jsx(mi,{xs:l.jsx(oa,{}),md:null}),D()]}),_(),!m.fetchBlockletsLoading&&E&&l.jsx(te,{ref:O,sx:{height:70,minHeight:70,display:"flex",justifyContent:"center",py:2,overflow:"hidden"},children:m.loadingMore?l.jsx(jt,{}):null})]});function _(){return m.fetchBlockletsLoading?l.jsx(sa,{mt:15}):u.length?l.jsx(te,{className:"blocklet-list",sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:`repeat(auto-fill, minmax(${n}px, 1fr))`},p:"2px",rowGap:2,columnGap:d?0:2},children:u.map(c=>l.jsx(te,{"data-blocklet-did":c.did,sx:{minWidth:{xs:"100%",sm:n},maxWidth:"calc(100vw - 32px)"},children:i({blocklet:c,blocklets:u,serverVersion:s})},c.did))}):l.jsx(Ih,{})}function D(){return l.jsxs(ut,{direction:"row",className:"search-result-title",sx:{alignItems:"center",justifyContent:"space-between",mb:2,mt:{xs:2,md:0}},children:[l.jsx(Ie,{variant:"h3",title:h.keyword,sx:{maxWidth:"50vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e("blocklet.search",{keyword:h.keyword})}),l.jsx(Ie,{variant:"body1",sx:{color:"text.hint",fontSize:13},children:e("blocklet.resultCount",{count:S})})]})}}function _h(){const{t:e,selectedCategory:t,getCategoryLocale:r,locale:i,search:s}=dt(),{toggleOpen:n}=pi(),o=el().arcSphere,a=!!window.blocklet?.navigation?.some(d=>d.section==="bottomNavigation");return l.jsxs(te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsxs(Ie,{variant:"body1",sx:{display:{xs:"flex",md:"none"},alignItems:"center",gap:1,py:2,fontWeight:"fontWeightMedium"},children:[l.jsx(ia,{onClick:()=>n(!0),children:l.jsx(_a,{})}),r(t)||e("common.category")]}),o&&a&&l.jsx(aa,{locale:i,endpoint:window.blocklet?.prefix||"/",sx:{display:{md:"block",xs:"none"},mr:1,width:"350px"},t:e,filters:s.filters,handleKeyword:s.handleKeyword,handleSearchSelect:s.handleSearchSelect})]})}function Nh({menus:e=[],children:t=void 0}){const{search:r,layout:i,compact:s}=dt(),{filters:n}=r,o=q.useRef(null),a=n.category||n.keyword||n.price,d=e.find(h=>h.key===n.menu)?.key;return l.jsx(Qd,{children:l.jsxs(Xo,{FallbackComponent:Jn,children:[!s&&l.jsx(_h,{}),l.jsxs(te,{ref:o,className:"list-container",sx:{display:"flex",height:"100%",pt:{xs:0,md:s?0:5}},children:[l.jsx(gh,{menus:e}),l.jsxs(ut,{sx:[{height:"100%",position:"relative",flex:1},s?{overflowY:"auto",ml:-2,pr:1,pb:2}:{overflow:"visible"}],children:[d&&t?.(d),!d&&(i.showExplore&&!a?l.jsx(Eh,{}):l.jsx(Lh,{}))]})]})]})})}function Ah(e){const{menus:t,children:r,...i}=e,s=qt(),n=$o(Cl({},s,{typography:{h1:{fontSize:32,fontWeight:700,lineHeight:1.375,textAlign:"left"},h2:{fontSize:24,fontWeight:700,lineHeight:1.3333333,textAlign:"left"},h3:{fontSize:18,fontWeight:600,lineHeight:1.5,textAlign:"left"},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700}}));return l.jsx(Uo,{theme:n,children:l.jsx(dh,{...i,children:l.jsx(Nh,{menus:t,children:r})})})}const Dh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Mh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Bh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M22 12.54c-1.804-.345-2.701-1.08-3.523-2.94c-.487.696-1.102 1.568-.92 2.4c.028.238-.32 1-.557 1H3c0 5.208 3.164 7 6.196 7c4.124.022 7.828-1.376 9.854-5c1.146-.101 2.296-1.505 2.95-2.46z"/><path d="M5 10h3v3H5zm3 0h3v3H8zm3 0h3v3h-3zM8 7h3v3H8zm3 0h3v3h-3zm0-3h3v3h-3zM4.571 18c1.5 0 2.047-.074 2.958-.78M10 16v.01"/></g>'},Fh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},$h=(e,t)=>!t||!e?!0:Br.satisfies(Br.coerce(e),t);function la({children:e,serverVersion:t="",requirementVersion:r="",...i}){const{t:s}=St();return $h(t,r)?e:l.jsx(Fo,{title:s("store.tooltip.upgradeServer",{serverVersion:t,version:r}),arrow:!0,children:l.jsx(Ie,{children:l.jsx(Tn,{disabled:!0,variant:"outlined",...i,children:s("common.upgradeServer")})})})}la.propTypes={children:F.node.isRequired,serverVersion:F.string,requirementVersion:F.string};const Uh=(e,t)=>nn(t,`/blocklets/${e.did}`),Ro=({blocklet:e,attribute:t,value:r})=>e._formatted?e._formatted[t]:r,qh=e=>e.inStore&&$t.isFreeBlocklet(e)===!1;function ca({blocklet:e,blocklets:t=[],handleButtonClick:r=null,endpoint:i="",serverVersion:s=""}){const{t:n}=St();let o=nn(i,bl(e.did,e.logo||""));try{const O=new URL(o);O.searchParams.set("v",e.version||+new Date),o=O.href}catch{}const[a,d]=q.useState(!1),h=async()=>{try{d(!0),await r({meta:e,registryUrl:i,blocklets:t})}catch(O){Hn.error(O.message)}finally{d(!1)}},{blocklet:u}=Yn(),f=()=>(u?.children||[]).find(_=>_.meta.bundleDid===e.did).meta.version,m=(()=>{const O=(u?.children||[]).find(P=>P.meta.bundleDid===e.did);if(O){try{const P=O.meta.version,_=e.version;if(Br.gt(_,P))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),E=e.requirements?.server,S=[];return m==="upgrade"?S.push({key:"upgrade",icon:l.jsx(xt,{icon:Fh,color:"success.light",width:20,height:20},"version"),title:`${f()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:l.jsx(te,{sx:{fontWeight:"bold"},children:n("blocklet.component.upgradeAvailable")})}):m==="disable"?S.push({key:"disable",icon:l.jsx(xt,{icon:Dh,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:n("blocklet.component.installed")}):qh(e)&&S.push({key:"purchase",icon:l.jsx(xt,{icon:Mh,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:n("blocklet.component.needBuy")}),l.jsx(Wh,{title:Ro({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:Ro({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?o:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:m!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:m==="disable"?void 0:h,icons:e.docker?.image?[{key:"docker",icon:l.jsx(te,{sx:{display:"flex",color:"primary.main"},children:l.jsx(xt,{icon:Bh})}),title:n("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:n("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:l.jsx(la,{serverVersion:s,requirementVersion:E,size:"small",children:l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(bu,{children:l.jsx(bt,{size:"small",disabled:a,variant:"outlined",color:"primary",onClick:O=>{O.preventDefault(),O.stopPropagation();const P=Uh(e,i);P&&window.open(P,"_blank","noopener,noreferrer")},children:n("common.detail")},e.did)})})})})}ca.propTypes={blocklet:F.object.isRequired,blocklets:F.array,handleButtonClick:F.func,endpoint:F.string,serverVersion:F.string};function ua({handleButtonClick:e=null,handleSearchSelect:t=null,storeUrl:r,handleBlockletRender:i=null,extraFilter:s=void 0,serverVersion:n="",resourceType:o="",resourceDid:a="",showResourcesSwitch:d=!0,showCategory:h=!0,compact:u=!1,...f}){const j=qt(),{locale:m}=St(),[E,S]=q.useState(!1),[O,P]=q.useState({}),_=w=>{P(w)},D=r,c=q.useMemo(()=>$o(j,{palette:{background:{default:j.palette.background.paper}}}),[j]);return q.useEffect(()=>{P({showResources:!0,resourceType:o,resourceDid:a})},[D,o,a]),q.useEffect(()=>{S(!0),P({showResources:!0,resourceType:o,resourceDid:a})},[]),l.jsx(Uo,{theme:c,children:l.jsx(Xo,{FallbackComponent:Jn,resetKeys:[D],children:l.jsxs(te,{...f,sx:Ho({overflow:"auto",".title-bar + div":{height:"unset"}},f.sx),children:[E&&l.jsx(Ah,{showCategory:h,showResourcesSwitch:d,blockletRender:w=>{const I={...w,handleButtonClick:e,endpoint:D};return i({...w,defaultRender:l.jsx(ca,{...I})})},compact:u,minItemWidth:300,baseSearch:!0,endpoint:D,locale:m,onFilterChange:_,onSearchSelect:t,filters:O,extraFilter:s,serverVersion:n,fetchCategoryDelay:500}),l.jsx(te,{sx:{mt:2},children:" "})]})})})}ua.propTypes={storeUrl:F.string.isRequired,handleButtonClick:F.func,handleSearchSelect:F.func,handleBlockletRender:F.func,extraFilter:F.func,serverVersion:F.string,resourceType:F.string,resourceDid:F.string,showResourcesSwitch:F.bool,showCategory:F.bool,compact:F.bool};const Wh=ot(wu)`
|
|
553
|
+
`;function Ch(){const{search:e,t,endpoint:r,locale:i,getCategoryLocale:s,developerName:n,showResourcesSwitch:o,layout:a,baseSearch:d,categoryOptions:h,compact:u}=dt(),{filters:f,handleSort:j,handlePrice:m,handleDeveloper:E,handleSwitchShowResources:S,cleanFilter:O,handleCategory:P}=e,_=Zs(t);return l.jsxs(ut,{className:"filter-bar",direction:{xs:"column",md:"row"},spacing:{xs:1,md:0},sx:{position:"sticky",top:0,zIndex:1e3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",gap:2,pt:{xs:2,md:0},px:0,pb:u?2:3,backgroundColor:"background.default"},children:[!u&&l.jsx(Ie,{variant:"h2",sx:{textTransform:"capitalize"},children:s(f.category)}),l.jsxs(ut,{direction:"row",sx:{flex:1,alignItems:"center",flexWrap:{xs:"wrap",md:"nowrap"},width:"100%",justifyContent:{xs:"flex-start",md:"flex-end"},gap:2},children:[a.showSearch?l.jsx(te,{sx:{flex:1,flexBasis:{xs:"100%",md:"auto"}},children:d?l.jsx(kh,{}):l.jsx(aa,{locale:i,endpoint:r,sx:{display:{md:"block",xs:"none"},flex:1,mr:1,width:"350px"},t,filters:e.filters,handleKeyword:e.handleKeyword,handleSearchSelect:e.handleSearchSelect})}):null,f.owner&&n&&l.jsx(ki,{label:t("blocklet.authorTag",{name:n}),size:"small",onDelete:()=>E("")}),f.resourceDid&&f.resourceBlocklet&&l.jsx(ki,{label:t("blocklet.resourceTag",{name:f.resourceBlocklet}),size:"small",onDelete:()=>O(["resourceDid","resourceBlocklet","showResources"])}),o?l.jsx(Co,{checked:f.showResources!=="false",onChange:D=>S(D?"true":"false"),label:t("common.showResources")}):null,l.jsx(Co,{checked:f.price==="free",onChange:D=>m(D?"free":""),label:t("blocklet.free")}),u&&l.jsx(te,{children:l.jsx(Jr,{value:f.category||h[0]?.value,options:h,placeholder:t("common.category"),onChange:D=>P(D)})}),l.jsx(Jr,{value:f.sortBy||_[0].value,options:_,placeholder:t("sort.sort"),onChange:D=>j(D)})]})]})}function Co({checked:e,onChange:t,label:r}){const i=qt();return l.jsx(Zr,{sx:{m:0,p:0},className:"check-button",control:l.jsx(ei,{checked:e,icon:l.jsx(Ft,{style:{padding:0,color:i.palette.text.secondary},icon:Md}),checkedIcon:l.jsx(Ft,{style:{padding:0,color:i.palette.primary.main},icon:Bd}),size:"large",sx:{p:0,mr:1},onChange:s=>t(s.target.checked)}),label:r})}function Fn({children:e}){return l.jsxs(te,{sx:{display:"flex",mt:2,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"text.hint"},children:[l.jsx(rl,{}),e]})}function Io(){const{t:e}=dt();return l.jsx(Ie,{style:{textAlign:"center"},variant:"subtitle2",children:e("blocklet.noResults")})}function Ar({filterTip:e=!1,keywordTip:t=!1}){const{t:r,locale:i}=dt(),s=()=>i==="zh"?"、":" , ";return l.jsxs(te,{sx:{mt:1,display:"flex"},children:[l.jsx(Ie,{style:{marginRight:"16px"},children:r("blocklet.emptyTip")}),e&&l.jsx(Ie,{children:r("blocklet.filterTip")}),e&&t&&s(),t&&l.jsx(Ie,{children:r("blocklet.keywordTip")})]})}function Dr({primaryStart:e,primaryEnd:t,filter:r}){return l.jsxs(Ie,{variant:"subtitle2",sx:{display:"flex",gap:.5,mx:.5},children:[l.jsx(Ie,{children:e}),l.jsx(Ie,{title:r,color:"primary",sx:{maxWidth:"30vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),l.jsxs(Ie,{children:[t," "]})]})}function Ih(){const{t:e,search:t,getCategoryLocale:r,selectedCategory:i}=dt(),{filters:s}=t,n=!!i||!!s.price;if(s.keyword&&n)return l.jsxs(Fn,{children:[l.jsx(Dr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Ar,{keywordTip:!0,filterTip:!0})]});if(s.keyword)return l.jsxs(Fn,{children:[l.jsx(Dr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Ar,{keywordTip:!0})]});if(n){const o=r(i);return l.jsxs(Fn,{children:[o?l.jsx(Dr,{primaryStart:e("blocklet.noCategoryResults1"),primaryEnd:e("blocklet.noCategoryResults2"),filter:o}):l.jsx(Io,{}),l.jsx(Ar,{filterTip:!0})]})}return l.jsx(Fn,{children:l.jsx(Io,{})})}const Rh=(e,t,r,i)=>Jl(async s=>{s||(r.currentPage=r.defaultCurrentPage);const{currentPage:n,pageSize:o}=r,a={...t,category:t.category==="All"?"":t.category,sortBy:kt[t.sortBy],page:n,pageSize:o};i(null);const{data:d={}}=await e.get(kt.blockletsPath,{params:a});return r.currentPage++,{page:n,pageSize:o,list:d?.dataList||[],total:d?.total||0}},{isNoMore:s=>s?s.page*s.pageSize>=s.total:!1,reloadDeps:[e,yl(t)],onError:i});function Ph(){const{storeApi:e,search:t,extraFilter:r,errors:i,updateDeveloperName:s}=dt(),{filters:n}=t,o=Yl({currentPage:kt.currentPage,pageSize:sh()?kt.mobilePageSize:kt.pageSize,defaultCurrentPage:kt.defaultCurrentPage}),[a,d]=q.useState(null),h=Rh(e,n,o,d),u=q.useMemo(()=>r?r(h.data?.list||[]):h.data?.list||[],[h.data,r]);return q.useEffect(()=>{const f=u.find(j=>j.owner.did===n.owner);s(f?.owner.fullName||f?.author.name||"")},[n.owner,u,s]),{blocklets:u,fetchBlockletsError:a,loadMore:h.loadMore,hasNextPage:!h.noMore,total:h.data?.total||0,loadings:{fetchBlockletsLoading:h.loading,loadingMore:h.loadingMore},errors:{...i,fetchBlockletsError:a}}}function Lh(){const{t:e,search:t,endpoint:r,blockletRender:i,serverVersion:s,minItemWidth:n,layout:o,baseSearch:a,compact:d}=dt(),{filters:h}=t,{blocklets:u,errors:f,loadMore:j,loadings:m,hasNextPage:E,total:S}=Ph(),[O]=Dd({loading:m.fetchBlockletsLoading||m.loadingMore,hasNextPage:E,onLoadMore:j});if(f.fetchBlockletsError){const c=new Error(`Failed to fetch blocklets from ${r}: ${ih(f.fetchBlockletsError)}`);return l.jsx(Jn,{error:c})}const P=a&&o.showSearch||!h.keyword;return l.jsxs(l.Fragment,{children:[P?l.jsx(Ch,{}):l.jsxs(l.Fragment,{children:[l.jsx(mi,{xs:l.jsx(oa,{}),md:null}),D()]}),_(),!m.fetchBlockletsLoading&&E&&l.jsx(te,{ref:O,sx:{height:70,minHeight:70,display:"flex",justifyContent:"center",py:2,overflow:"hidden"},children:m.loadingMore?l.jsx(jt,{}):null})]});function _(){return m.fetchBlockletsLoading?l.jsx(sa,{mt:15}):u.length?l.jsx(te,{className:"blocklet-list",sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:`repeat(auto-fill, minmax(${n}px, 1fr))`},p:"2px",rowGap:2,columnGap:d?0:2},children:u.map(c=>l.jsx(te,{"data-blocklet-did":c.did,sx:{minWidth:{xs:"100%",sm:n},maxWidth:"calc(100vw - 32px)"},children:i({blocklet:c,blocklets:u,serverVersion:s})},c.did))}):l.jsx(Ih,{})}function D(){return l.jsxs(ut,{direction:"row",className:"search-result-title",sx:{alignItems:"center",justifyContent:"space-between",mb:2,mt:{xs:2,md:0}},children:[l.jsx(Ie,{variant:"h3",title:h.keyword,sx:{maxWidth:"50vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e("blocklet.search",{keyword:h.keyword})}),l.jsx(Ie,{variant:"body1",sx:{color:"text.hint",fontSize:13},children:e("blocklet.resultCount",{count:S})})]})}}function _h(){const{t:e,selectedCategory:t,getCategoryLocale:r,locale:i,search:s}=dt(),{toggleOpen:n}=pi(),o=nl().arcSphere,a=!!window.blocklet?.navigation?.some(d=>d.section==="bottomNavigation");return l.jsxs(te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsxs(Ie,{variant:"body1",sx:{display:{xs:"flex",md:"none"},alignItems:"center",gap:1,py:2,fontWeight:"fontWeightMedium"},children:[l.jsx(ia,{onClick:()=>n(!0),children:l.jsx(_a,{})}),r(t)||e("common.category")]}),o&&a&&l.jsx(aa,{locale:i,endpoint:window.blocklet?.prefix||"/",sx:{display:{md:"block",xs:"none"},mr:1,width:"350px"},t:e,filters:s.filters,handleKeyword:s.handleKeyword,handleSearchSelect:s.handleSearchSelect})]})}function Nh({menus:e=[],children:t=void 0}){const{search:r,layout:i,compact:s}=dt(),{filters:n}=r,o=q.useRef(null),a=n.category||n.keyword||n.price,d=e.find(h=>h.key===n.menu)?.key;return l.jsx(Qd,{children:l.jsxs(Xo,{FallbackComponent:Jn,children:[!s&&l.jsx(_h,{}),l.jsxs(te,{ref:o,className:"list-container",sx:{display:"flex",height:"100%",pt:{xs:0,md:s?0:5}},children:[l.jsx(gh,{menus:e}),l.jsxs(ut,{sx:[{height:"100%",position:"relative",flex:1},s?{overflowY:"auto",ml:-2,pr:1,pb:2}:{overflow:"visible"}],children:[d&&t?.(d),!d&&(i.showExplore&&!a?l.jsx(Eh,{}):l.jsx(Lh,{}))]})]})]})})}function Ah(e){const{menus:t,children:r,...i}=e,s=qt(),n=$o(Cl({},s,{typography:{h1:{fontSize:32,fontWeight:700,lineHeight:1.375,textAlign:"left"},h2:{fontSize:24,fontWeight:700,lineHeight:1.3333333,textAlign:"left"},h3:{fontSize:18,fontWeight:600,lineHeight:1.5,textAlign:"left"},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700}}));return l.jsx(Uo,{theme:n,children:l.jsx(dh,{...i,children:l.jsx(Nh,{menus:t,children:r})})})}const Dh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Mh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Bh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M22 12.54c-1.804-.345-2.701-1.08-3.523-2.94c-.487.696-1.102 1.568-.92 2.4c.028.238-.32 1-.557 1H3c0 5.208 3.164 7 6.196 7c4.124.022 7.828-1.376 9.854-5c1.146-.101 2.296-1.505 2.95-2.46z"/><path d="M5 10h3v3H5zm3 0h3v3H8zm3 0h3v3h-3zM8 7h3v3H8zm3 0h3v3h-3zm0-3h3v3h-3zM4.571 18c1.5 0 2.047-.074 2.958-.78M10 16v.01"/></g>'},Fh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},$h=(e,t)=>!t||!e?!0:Br.satisfies(Br.coerce(e),t);function la({children:e,serverVersion:t="",requirementVersion:r="",...i}){const{t:s}=St();return $h(t,r)?e:l.jsx(Fo,{title:s("store.tooltip.upgradeServer",{serverVersion:t,version:r}),arrow:!0,children:l.jsx(Ie,{children:l.jsx(Tn,{disabled:!0,variant:"outlined",...i,children:s("common.upgradeServer")})})})}la.propTypes={children:F.node.isRequired,serverVersion:F.string,requirementVersion:F.string};const Uh=(e,t)=>nn(t,`/blocklets/${e.did}`),Ro=({blocklet:e,attribute:t,value:r})=>e._formatted?e._formatted[t]:r,qh=e=>e.inStore&&$t.isFreeBlocklet(e)===!1;function ca({blocklet:e,blocklets:t=[],handleButtonClick:r=null,endpoint:i="",serverVersion:s=""}){const{t:n}=St();let o=nn(i,bl(e.did,e.logo||""));try{const O=new URL(o);O.searchParams.set("v",e.version||+new Date),o=O.href}catch{}const[a,d]=q.useState(!1),h=async()=>{try{d(!0),await r({meta:e,registryUrl:i,blocklets:t})}catch(O){Xn.error(O.message)}finally{d(!1)}},{blocklet:u}=Yn(),f=()=>(u?.children||[]).find(_=>_.meta.bundleDid===e.did).meta.version,m=(()=>{const O=(u?.children||[]).find(P=>P.meta.bundleDid===e.did);if(O){try{const P=O.meta.version,_=e.version;if(Br.gt(_,P))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),E=e.requirements?.server,S=[];return m==="upgrade"?S.push({key:"upgrade",icon:l.jsx(xt,{icon:Fh,color:"success.light",width:20,height:20},"version"),title:`${f()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:l.jsx(te,{sx:{fontWeight:"bold"},children:n("blocklet.component.upgradeAvailable")})}):m==="disable"?S.push({key:"disable",icon:l.jsx(xt,{icon:Dh,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:n("blocklet.component.installed")}):qh(e)&&S.push({key:"purchase",icon:l.jsx(xt,{icon:Mh,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:n("blocklet.component.needBuy")}),l.jsx(Wh,{title:Ro({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:Ro({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?o:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:m!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:m==="disable"?void 0:h,icons:e.docker?.image?[{key:"docker",icon:l.jsx(te,{sx:{display:"flex",color:"primary.main"},children:l.jsx(xt,{icon:Bh})}),title:n("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:n("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:l.jsx(la,{serverVersion:s,requirementVersion:E,size:"small",children:l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(bu,{children:l.jsx(bt,{size:"small",disabled:a,variant:"outlined",color:"primary",onClick:O=>{O.preventDefault(),O.stopPropagation();const P=Uh(e,i);P&&window.open(P,"_blank","noopener,noreferrer")},children:n("common.detail")},e.did)})})})})}ca.propTypes={blocklet:F.object.isRequired,blocklets:F.array,handleButtonClick:F.func,endpoint:F.string,serverVersion:F.string};function ua({handleButtonClick:e=null,handleSearchSelect:t=null,storeUrl:r,handleBlockletRender:i=null,extraFilter:s=void 0,serverVersion:n="",resourceType:o="",resourceDid:a="",showResourcesSwitch:d=!0,showCategory:h=!0,compact:u=!1,...f}){const j=qt(),{locale:m}=St(),[E,S]=q.useState(!1),[O,P]=q.useState({}),_=w=>{P(w)},D=r,c=q.useMemo(()=>$o(j,{palette:{background:{default:j.palette.background.paper}}}),[j]);return q.useEffect(()=>{P({showResources:!0,resourceType:o,resourceDid:a})},[D,o,a]),q.useEffect(()=>{S(!0),P({showResources:!0,resourceType:o,resourceDid:a})},[]),l.jsx(Uo,{theme:c,children:l.jsx(Xo,{FallbackComponent:Jn,resetKeys:[D],children:l.jsxs(te,{...f,sx:Ho({overflow:"auto",".title-bar + div":{height:"unset"}},f.sx),children:[E&&l.jsx(Ah,{showCategory:h,showResourcesSwitch:d,blockletRender:w=>{const I={...w,handleButtonClick:e,endpoint:D};return i({...w,defaultRender:l.jsx(ca,{...I})})},compact:u,minItemWidth:300,baseSearch:!0,endpoint:D,locale:m,onFilterChange:_,onSearchSelect:t,filters:O,extraFilter:s,serverVersion:n,fetchCategoryDelay:500}),l.jsx(te,{sx:{mt:2},children:" "})]})})})}ua.propTypes={storeUrl:F.string.isRequired,handleButtonClick:F.func,handleSearchSelect:F.func,handleBlockletRender:F.func,extraFilter:F.func,serverVersion:F.string,resourceType:F.string,resourceDid:F.string,showResourcesSwitch:F.bool,showCategory:F.bool,compact:F.bool};const Wh=ot(wu)`
|
|
554
554
|
.ms-highlight {
|
|
555
555
|
color: ${e=>e.theme.palette.primary.main};
|
|
556
556
|
}
|
|
@@ -695,7 +695,7 @@ see detail in https://www.npmjs.com/package/is-var-name
|
|
|
695
695
|
& .connect {
|
|
696
696
|
background: white;
|
|
697
697
|
}
|
|
698
|
-
`,Kh=(e,t)=>(e?.children||[]).find(r=>r.mountPoint===t)?.meta,Gh=e=>e.inStore&&$t.isFreeBlocklet(e)===!1,Hh=e=>[Bt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Bt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes(e?.capabilities?.didSpace),Mr=e=>e?.configs?.find(t=>t.key===Bt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null,Xh=e=>(e.environments||[]).some(t=>t.required),Lo=(e,t)=>e?.some(r=>r.required&&!t[r.key]),Yh=({params:e,blocklet:t,t:r})=>{const i=e.title||e.name;return i?(t?.children||[]).find(n=>n.meta.bundleDid===e.bundleDid)?r("blocklet.component.upgradeNext",{name:i}):r("blocklet.component.addNext",{name:i}):r("common.next")},_o=({componentDid:e,timeout:t=1e3,manual:r=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:r},"*")},t)};function Jh({onClose:e=()=>{},mode:t="normal",stores:r=[],resourceType:i="",resourceDid:s="",storageKey:n="",inDialog:o=!0,selectedMeta:a=null,storeUrl:d="",showResourcesSwitch:h=!0,showFromUrl:u=!0,enableRunBackground:f=!0,showCategory:j=!0,installFromUrlParams:m=null}){const{t:E,locale:S}=St(),[O,P]=q.useState(!1),[_,D]=q.useState(null),[c,w]=q.useState(""),[I,B]=q.useState(""),{api:M,ws:{useSubscription:ne},inService:Z,info:z}=un(),{blocklet:W,actions:{refreshBlocklet:H}}=Yn(),[N,X]=q.useState(null),[$,de]=q.useState(!1),Le={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1,isUpload:!1,upgradeDid:""},[V,ke]=q.useState(Le),[ce,$e]=q.useState(0),ve=q.useRef({}),Ne=q.useRef({}),_e=q.useRef({}),Ge=Yt(se=>se.breakpoints.down("md")),tt=Ja(),[pt,mt]=q.useState(!0),{meta:xe}=ve.current,he=os(xe),ge=q.useRef(!1),We=q.useRef(null),Ue=se=>ke(me=>({...me,...se}));q.useEffect(()=>{if(V.pathPrefix){const{errMsg:se}=st({...V,pathPrefix:V.pathPrefix,locale:S});w(se)}},[V.pathPrefix]),q.useEffect(()=>{ce===0&&ke(Le)},[ce]);const Ot=()=>{const se=Mr(W)??"";Ue({didSpaceEndpoint:se})},Be=()=>ve?.current?.meta?$t.getDisplayName(ve.current):"",Ct=()=>{P(!1),ke({}),ge.current=!1,ve.current={},e()},It=se=>{const me=Ce=>{Ue({installResultProps:{variant:"error",title:Be(),subTitle:se,footer:l.jsx(bt,{className:"bottom-button",disabled:Ce,"data-cy":"retry-install-component",onClick:async()=>{me(!0),await lt(ve.current.installInput)},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center"},children:[Ce&&l.jsx(jt,{size:16,style:{marginRight:8}}),E("common.retry")]})})}})};me()},Et=se=>me=>{(me?.meta?.did||me?.meta)===W?.meta?.did&&se(me)},Rt=()=>{_o({timeout:0,componentDid:tt.componentDid,manual:!0}),Ct(),setTimeout(()=>{const se=document.getElementsByClassName("dashboard-main")[0];se&&(se.scrollTop=se.scrollHeight)},200)};ne(Bt.BlockletEvents.componentInstalled,Et(()=>{Ue({installResultProps:{variant:"success",title:Be(),subTitle:E("blocklet.component.installSuccessTip")}}),_o({componentDid:tt.componentDid})}),[W?.meta?.did]),ne(Bt.BlockletEvents.statusChange,Et(()=>{const se=Mr(W);Ue(me=>({...me,didSpaceEndpoint:se}))}),[W?.meta?.did]),ne(Bt.BlockletEvents.downloadFailed,Et(()=>{ge.current=!1,It(E("blocklet.component.installComponentError"))}),[W?.meta?.did]),ne(Bt.BlockletEvents.installFailed,Et(()=>{ge.current=!1,It(E("blocklet.component.installComponentError"))}),[W?.meta?.did]);const Ye=[],At=se=>(W?.children||[]).find(me=>me.meta.did===se),lt=async se=>{ge.current=!0;const{pathPrefix:me,bundleDid:Ce,title:p,componentName:x="",componentDid:k=""}=V,L=ve.current?.meta||{},{configs:U=[],registryUrl:ee,inStore:re,inputUrl:Ee,dist:we}=L,nt=ve.current?.downloadTokenList,et=Ee||(re?Ci(ee,Ce,we):"");P(!0);const Ae={rootDid:W.meta.did,url:et,mountPoint:me?Rn(me):`/${Rn(L.title||L.name)}`,title:p,name:x,did:V.isUpload&&V.upgradeDid?V.upgradeDid:k,dist:{tarball:"",integrity:""},onlyRequired:!pt,...V.hasEnvironmentsStep&&U.length>0?{configs:U.map(Fe=>({...Fe,value:V.configsValue[Fe.key]||""}))}:{},...nt?{downloadTokenList:nt}:{},...se};try{if(await M.installComponent({input:Ae}),ee){const{teamDid:Fe,storeList:Ze}=Qo({fromBlocklet:Z,nodeInfo:z,blocklet:W}),{isNew:Dt,decoded:on}=Sl(ee,Ze);Dt&&await M.addBlockletStore({input:{teamDid:Fe,url:on}})}Ue({installResultProps:{}}),H({showError:!1,attachRuntimeInfo:!1})}catch(Fe){const Ze=$r(Fe);Hn.error(Ze),console.error("installComponent error: ",Fe),It(Ze)}finally{P(!1),ve.current.installInput=Ae}},st=se=>{const me=ic({params:{...se,did:se.bundleDid},blocklets:[W],blocklet:W,locale:S,isUpload:V.isUpload});let Ce=me;const p=Kh(W,V.pathPrefix);if(me==="overwrite"&&p&&p.did!==se.bundleDid?(Ue({upgradeDid:p.did}),Ce=""):(Ue({upgradeDid:""}),Ce=me),Ce){const x=At(se.bundleDid),k=oc({params:{...se,did:se.bundleDid},blocklet:W});if(x&&x.mountPoint===k)return{errMsg:""}}return{errMsg:Ce}},ze=async se=>{const{errMsg:me}=st({...V,locale:S});w(me),ce===Ye.length-2&&!ge.current&&await lt(se),Ne.current?.setActiveStepByIndex?.(Ce=>Ce+1)},He=()=>{Ne.current?.setActiveStepByIndex?.(se=>se-1)},gt=()=>{const{pathPrefix:se,bundleDid:me,title:Ce,componentName:p="",componentDid:x=""}=V,{meta:k={}}=ve.current||{},{registryUrl:L,inStore:U,inputUrl:ee,dist:re}=k,Ee=U?Ci(L,me,re):ee;X({meta:k,installOpts:{type:"component",rootDid:W.meta.did,mountPoint:se,url:Ee,title:Ce,name:p,did:x}})},K=se=>{de(!1),Ue({purchaseResultProps:{variant:"error",title:Be(),subTitle:se,style:{paddingTop:120},footer:l.jsx(bt,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{Ue({purchaseResultProps:{}})},children:E("common.retry")})}})},le=({downloadTokenList:se})=>{ve.current.downloadTokenList=se,de(!1),ze()},Te=({chooseParams:se=ve.current,componentDid:me,isInit:Ce=!1,isUpload:p=!1})=>{const{meta:x,registryUrl:k,inStore:L,inputUrl:U}=se,{did:ee,title:re,name:Ee}=x,we=(W.settings?.children||[]).filter(at=>at.status==="deleted"&&at.meta.bundleDid===ee),nt=me||"",et=x.environments?.map(at=>{const{name:hn,validation:Pt,...Wt}=at,sn={validation:Dl(Pt)?"":Pt};return{...Wt,key:hn,...sn}});ve.current={...se,meta:{...x,configs:et,registryUrl:k,inStore:L,inputUrl:U}};let Ae={};if(Ce){const at=[W],hn=et||[],Pt=[],Wt=es(Al([...hn,...Pt]),"key").filter(zt=>!!zt.key).sort((zt,Zt)=>zt.required&&!Zt.required?-1:Zt.required&&!zt.required?1:0),sn=$t.getSharedConfigObj(at[0],{configs:Wt}),an={},On=Wt.map(zt=>{const{default:Zt,key:en,...Vt}=zt;return an[en]=sn[en]||Zt,{...Vt,key:en,hidden:!!Bt.BLOCKLET_CONFIGURABLE_KEY[en]}});Ae={...Ae,configsList:On,configsValue:an,hasMissRequiredConfigs:Lo(On,an)}}const Fe=W.children.some(at=>at.mountPoint==="/"),Ze=we.find(at=>at.meta.bundleDid===ee),Dt=W.children.find(at=>at.meta.bundleDid===ee);Ae.title=re||"",Ze?Ae={...Ae,pathPrefix:Ze.mountPoint||"",componentName:Ze.meta.name,hasEnvironmentsStep:!1}:Dt?Ae={...Ae,pathPrefix:Dt.mountPoint||"",componentName:Dt.meta.name,hasEnvironmentsStep:!1}:Ae={...Ae,pathPrefix:Fe?`/${Rn(re)||Rn(Ee)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:ve.current.meta?.environments?.length>0};const on=Gh(ve.current.meta),dn=Hh(ve.current.meta),nr=Mr(W);Ue({bundleDid:ee,componentDid:nt,...Ae,hasRequiredEnvironments:Xh(ve.current.meta),requirePurchase:on,didSpaceIsRequiredSetup:dn,didSpaceEndpoint:nr,isUpload:p}),Ce&&on&>()},Pe=async()=>{if(!We.current.loading)try{P(!0),await We.current.onSubmit()&&ze()}catch(se){console.error("error",se)}finally{P(!1)}};q.useEffect(()=>{if(!a&&!m?.meta||ce!==0||!W)return;const{meta:se,inputUrl:me="",inStore:Ce=!0,registryUrl:p="",isUpload:x=!1}=m||{};Te({chooseParams:{blocklets:[a||se],meta:a||se,registryUrl:p||d||a.homepage,inStore:Ce,inputUrl:me},isInit:!0,isUpload:x}),Ue({showFromUrlDialog:!1}),ze()},[a,ce,W,m]),Ye.push({key:"selectComponent",name:E("blocklet.component.selectComponent"),body:l.jsxs(Ht,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[u&&V.showFromUrlDialog&&l.jsx(ws,{mode:"component",onCancel:()=>{Ue({showFromUrlDialog:!1})},onSuccess:({meta:se,inputUrl:me,inStore:Ce,registryUrl:p})=>{Te({chooseParams:{meta:se,inputUrl:me,inStore:Ce,registryUrl:p},isInit:!0}),Ue({showFromUrlDialog:!1}),ze()},handleText:{title:E("blocklet.component.addComponentTip.fromUrl"),confirm:E("blocklet.component.choose")}}),l.jsx(Os,{stores:r,extra:Ko.isInServerlessMode(z)?null:u?l.jsxs(bt,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{Ue({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[l.jsx(Va,{style:{fontSize:20,marginRight:4}}),E("blocklet.component.addComponentTip.fromUrl")]}):null,loading:O,onChange:()=>{ke({}),ve.current={}},storageKey:n,children:({currentRegistry:se})=>l.jsx(ua,{showResourcesSwitch:h,showCategory:j,serverVersion:z?.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:se.url,resourceType:i,resourceDid:s,handleButtonClick:me=>{Te({chooseParams:{...me,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:me,defaultRender:Ce})=>{const p=V?.bundleDid&&V?.bundleDid===me?.did;return l.jsxs(Zh,{children:[l.jsx(te,{className:p?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...p?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:Ce}),p&&l.jsx(te,{className:"check-container",children:l.jsx(Vo,{className:"check-icon"})})]})}})})]}),cancel:t==="embed"?void 0:E("common.cancel"),confirm:Yh({params:V,blocklet:W,t:E}),onCancel:Ct,onConfirm:()=>{ze()}}),Ye.push({key:"agreement",name:E("launchBlocklet.introduction"),body:l.jsxs(Ht,{component:"div",className:"agreement-wrapper",children:[l.jsx(Fr,{title:E("launchBlocklet.introduction"),subTitle:E("blocklet.component.addComponentTip.introduction")}),xe?l.jsx(fs,{meta:xe,onClickNext:ze,installRelated:pt,onChangeInstallRelated:mt,handleDescEle:l.jsx("p",{children:E("blocklet.component.addComponentTip.belowInformation")})}):null]}),cancel:a?void 0:E("common.pre"),disabled:!he,confirm:E(he?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:a?Ct:He,onConfirm:()=>{de(!1),ze()}}),xe&&V.requirePurchase&&Ye.push({key:"purchase",name:l.jsxs(l.Fragment,{children:[E("common.verifyNFT"),l.jsx(Pn,{})]}),body:l.jsxs(Ht,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(_e.current?.getCurrentStep?.()===2||$)&&l.jsx($n,{title:E("common.verifyNFT"),subTitle:E("blocklet.component.addComponentTip.verifyNFT")}),bn(V.purchaseResultProps)?N&&l.jsx(ks,{ref:_e,meta:N.meta,mode:V.componentDid?"verify":"both",onCancel:K,installOpts:N.installOpts,handlePaySuccess:le}):l.jsx("div",{className:"flex-align-center flex-justify-center",children:l.jsx(Ri,{...V.purchaseResultProps})})]}),disabled:_e.current?.getCurrentStep?.()===2||$,cancel:E("common.pre"),confirm:E("common.next"),onConfirm:()=>{typeof _e.current.onNext=="function"&&(_e.current.onNext(),de(!0))},onCancel:()=>{He()}}),$t.hasStartEngine(xe)&&Ml.hasMountPoint(xe)?Ye.push({key:"config",name:E("common.config"),error:c,body:l.jsxs(Ht,{component:"div",children:[l.jsx($n,{title:E("common.config"),subTitle:E("blocklet.component.addComponentTip.config")}),l.jsx(Gn,{label:E("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",fullWidth:!0,helperText:I||E("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:V.pathPrefix,onChange:se=>{const me=se.target.value;Ue({pathPrefix:me}),B(E("common.slugifyHint",{value:wl(me)}))},slotProps:{htmlInput:{"data-cy":"mount-point-input"}}}),!!c&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:c})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:()=>{ze()}}):xe&&(V.pathPrefix=xe.interfaces?.[0]?.path||`/${xe.did}`),xe&&xe?.requirements?.aigne&&Ye.push({key:"aigne",name:l.jsxs(Ie,{component:"div",title:E("setting.aigne.config"),sx:{whiteSpace:"break-spaces"},children:[E("setting.aigne.config")," ",l.jsx(Pn,{})]}),body:()=>l.jsxs(Ht,{component:"div",className:"aigne-config-wrapper",children:[l.jsx(Fr,{title:E("setting.aigne.config")}),l.jsx(te,{className:"form-container",sx:{"> div":{maxWidth:"unset",width:"100%"}},children:l.jsx(Zl,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,source:"setup",forceValidate:!0,ref:We})})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:()=>{We.current.loading||He()},onConfirm:Pe,loading:O||We.current?.loading,disabled:O||We.current?.loading}),xe&&V?.hasEnvironmentsStep&&Ye.push({key:"environment",name:l.jsxs(l.Fragment,{children:[E("common.environment")," ",V.hasRequiredEnvironments&&l.jsx(Pn,{})]}),disabled:!!_||V?.hasMissRequiredConfigs,body:()=>l.jsxs(Ht,{component:"div",style:{overflowY:"auto"},children:[l.jsx($n,{title:E("common.environment"),subTitle:E("blocklet.component.addComponentTip.environment")}),l.jsx($l,{style:{marginTop:-12,width:"100%"},schema:V.configsList,defaultValue:V.configsValue,onChange:(se,{action:me,currentItem:Ce,allValues:p})=>{me==="confirm"&&Ue({hasMissRequiredConfigs:Lo(V.configsList,p),configsValue:p}),me==="edit"?D(Ce):["cancel","confirm"].includes(me)&&D(null)}})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:ze}),xe&&V?.didSpaceIsRequiredSetup&&Ye.push({key:"didSpace",name:l.jsxs(l.Fragment,{children:[E("blocklet.component.didSpaceConfig")," ",V.didSpaceIsRequiredSetup==="required"&&l.jsx(Pn,{})]}),disabled:V?.didSpaceIsRequiredSetup&&!V.didSpaceEndpoint,body:()=>l.jsx(Fl,{children:l.jsxs(Ht,{component:"div",children:[l.jsx($n,{title:E("blocklet.component.didSpaceConfig"),subTitle:E("blocklet.component.didSpaceConfigTip")}),l.jsx(te,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:l.jsx(js,{blockletMeta:ve.current.meta,onNext:()=>{ze()},onEndpointUpdate:Ot})})]})}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:ze}),Ye.push({key:"install",name:At(xe?.did)?E("common.upgrade"):E("common.install"),disabled:f?!1:bn(V.installResultProps),loading:f?!1:bn(V.installResultProps),body:l.jsx(Ht,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:bn(V.installResultProps)?l.jsx(nl,{message:l.jsx(ef,{children:E(f?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):l.jsx("div",{style:{marginTop:120},children:l.jsx(Ri,{...V.installResultProps})})}),confirm:E("common.complete"),onConfirm:Rt});const Se=Ye[ce]||{},A=()=>O||Se.error||!V.bundleDid?!0:ce>1?!V.pathPrefix:!1;return W?l.jsxs(Qh,{sx:o?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[l.jsx(jl,{steps:Ye,mode:"memory",children:l.jsx(da,{ref:Ne,meta:xe,isMobile:Ge,onStepChange:se=>{$e(se)}})}),l.jsxs(te,{className:"action-bar",children:[Se.cancel&&l.jsx(bt,{onClick:se=>{se.stopPropagation(),Se.onCancel()},disabled:ce===Ye.length-2&&O,color:"inherit",children:Se.cancel||E("common.cancel")}),Se.confirm&&l.jsx(bt,{onClick:se=>{se.stopPropagation(),Se.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:O||(typeof Se.disabled=="boolean"?Se.disabled:A()),variant:"contained",autoFocus:!0,title:Se.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center",overflow:"hidden"},children:[(typeof Se.loading=="boolean"?Se.loading:O)&&l.jsx(jt,{style:{marginRight:8},size:16}),l.jsx(te,{component:"span",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Se.confirm})]})})]})]}):null}Jh.propTypes={onClose:F.func,mode:F.oneOf(["normal","embed"]),inDialog:F.bool,stores:F.arrayOf(F.string),storeUrl:F.string,resourceType:F.string,resourceDid:F.string,storageKey:F.string,selectedMeta:F.object,showResourcesSwitch:F.bool,showFromUrl:F.bool,enableRunBackground:F.bool,showCategory:F.bool,installFromUrlParams:F.object};const Qh=ot(te)`
|
|
698
|
+
`,Kh=(e,t)=>(e?.children||[]).find(r=>r.mountPoint===t)?.meta,Gh=e=>e.inStore&&$t.isFreeBlocklet(e)===!1,Hh=e=>[Bt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Bt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes(e?.capabilities?.didSpace),Mr=e=>e?.configs?.find(t=>t.key===Bt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null,Xh=e=>(e.environments||[]).some(t=>t.required),Lo=(e,t)=>e?.some(r=>r.required&&!t[r.key]),Yh=({params:e,blocklet:t,t:r})=>{const i=e.title||e.name;return i?(t?.children||[]).find(n=>n.meta.bundleDid===e.bundleDid)?r("blocklet.component.upgradeNext",{name:i}):r("blocklet.component.addNext",{name:i}):r("common.next")},_o=({componentDid:e,timeout:t=1e3,manual:r=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:r},"*")},t)};function Jh({onClose:e=()=>{},mode:t="normal",stores:r=[],resourceType:i="",resourceDid:s="",storageKey:n="",inDialog:o=!0,selectedMeta:a=null,storeUrl:d="",showResourcesSwitch:h=!0,showFromUrl:u=!0,enableRunBackground:f=!0,showCategory:j=!0,installFromUrlParams:m=null}){const{t:E,locale:S}=St(),[O,P]=q.useState(!1),[_,D]=q.useState(null),[c,w]=q.useState(""),[I,B]=q.useState(""),{api:M,ws:{useSubscription:ne},inService:Z,info:z}=un(),{blocklet:W,actions:{refreshBlocklet:H}}=Yn(),[N,X]=q.useState(null),[$,de]=q.useState(!1),Le={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1,isUpload:!1,upgradeDid:""},[V,ke]=q.useState(Le),[ce,$e]=q.useState(0),ve=q.useRef({}),Ne=q.useRef({}),_e=q.useRef({}),Ge=Yt(se=>se.breakpoints.down("md")),tt=Ja(),[pt,mt]=q.useState(!0),{meta:xe}=ve.current,he=os(xe),ge=q.useRef(!1),We=q.useRef(null),Ue=se=>ke(me=>({...me,...se}));q.useEffect(()=>{if(V.pathPrefix){const{errMsg:se}=st({...V,pathPrefix:V.pathPrefix,locale:S});w(se)}},[V.pathPrefix]),q.useEffect(()=>{ce===0&&ke(Le)},[ce]);const Ot=()=>{const se=Mr(W)??"";Ue({didSpaceEndpoint:se})},Be=()=>ve?.current?.meta?$t.getDisplayName(ve.current):"",Ct=()=>{P(!1),ke({}),ge.current=!1,ve.current={},e()},It=se=>{const me=Ce=>{Ue({installResultProps:{variant:"error",title:Be(),subTitle:se,footer:l.jsx(bt,{className:"bottom-button",disabled:Ce,"data-cy":"retry-install-component",onClick:async()=>{me(!0),await lt(ve.current.installInput)},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center"},children:[Ce&&l.jsx(jt,{size:16,style:{marginRight:8}}),E("common.retry")]})})}})};me()},Et=se=>me=>{(me?.meta?.did||me?.meta)===W?.meta?.did&&se(me)},Rt=()=>{_o({timeout:0,componentDid:tt.componentDid,manual:!0}),Ct(),setTimeout(()=>{const se=document.getElementsByClassName("dashboard-main")[0];se&&(se.scrollTop=se.scrollHeight)},200)};ne(Bt.BlockletEvents.componentInstalled,Et(()=>{Ue({installResultProps:{variant:"success",title:Be(),subTitle:E("blocklet.component.installSuccessTip")}}),_o({componentDid:tt.componentDid})}),[W?.meta?.did]),ne(Bt.BlockletEvents.statusChange,Et(()=>{const se=Mr(W);Ue(me=>({...me,didSpaceEndpoint:se}))}),[W?.meta?.did]),ne(Bt.BlockletEvents.downloadFailed,Et(()=>{ge.current=!1,It(E("blocklet.component.installComponentError"))}),[W?.meta?.did]),ne(Bt.BlockletEvents.installFailed,Et(()=>{ge.current=!1,It(E("blocklet.component.installComponentError"))}),[W?.meta?.did]);const Ye=[],At=se=>(W?.children||[]).find(me=>me.meta.did===se),lt=async se=>{ge.current=!0;const{pathPrefix:me,bundleDid:Ce,title:p,componentName:x="",componentDid:k=""}=V,L=ve.current?.meta||{},{configs:U=[],registryUrl:ee,inStore:re,inputUrl:Ee,dist:we}=L,nt=ve.current?.downloadTokenList,et=Ee||(re?Ci(ee,Ce,we):"");P(!0);const Ae={rootDid:W.meta.did,url:et,mountPoint:me?Rn(me):`/${Rn(L.title||L.name)}`,title:p,name:x,did:V.isUpload&&V.upgradeDid?V.upgradeDid:k,dist:{tarball:"",integrity:""},onlyRequired:!pt,...V.hasEnvironmentsStep&&U.length>0?{configs:U.map(Fe=>({...Fe,value:V.configsValue[Fe.key]||""}))}:{},...nt?{downloadTokenList:nt}:{},...se};try{if(await M.installComponent({input:Ae}),ee){const{teamDid:Fe,storeList:Ze}=Qo({fromBlocklet:Z,nodeInfo:z,blocklet:W}),{isNew:Dt,decoded:on}=Sl(ee,Ze);Dt&&await M.addBlockletStore({input:{teamDid:Fe,url:on}})}Ue({installResultProps:{}}),H({showError:!1,attachRuntimeInfo:!1})}catch(Fe){const Ze=$r(Fe);Xn.error(Ze),console.error("installComponent error: ",Fe),It(Ze)}finally{P(!1),ve.current.installInput=Ae}},st=se=>{const me=ic({params:{...se,did:se.bundleDid},blocklets:[W],blocklet:W,locale:S,isUpload:V.isUpload});let Ce=me;const p=Kh(W,V.pathPrefix);if(me==="overwrite"&&p&&p.did!==se.bundleDid?(Ue({upgradeDid:p.did}),Ce=""):(Ue({upgradeDid:""}),Ce=me),Ce){const x=At(se.bundleDid),k=oc({params:{...se,did:se.bundleDid},blocklet:W});if(x&&x.mountPoint===k)return{errMsg:""}}return{errMsg:Ce}},ze=async se=>{const{errMsg:me}=st({...V,locale:S});w(me),ce===Ye.length-2&&!ge.current&&await lt(se),Ne.current?.setActiveStepByIndex?.(Ce=>Ce+1)},He=()=>{Ne.current?.setActiveStepByIndex?.(se=>se-1)},gt=()=>{const{pathPrefix:se,bundleDid:me,title:Ce,componentName:p="",componentDid:x=""}=V,{meta:k={}}=ve.current||{},{registryUrl:L,inStore:U,inputUrl:ee,dist:re}=k,Ee=U?Ci(L,me,re):ee;X({meta:k,installOpts:{type:"component",rootDid:W.meta.did,mountPoint:se,url:Ee,title:Ce,name:p,did:x}})},K=se=>{de(!1),Ue({purchaseResultProps:{variant:"error",title:Be(),subTitle:se,style:{paddingTop:120},footer:l.jsx(bt,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{Ue({purchaseResultProps:{}})},children:E("common.retry")})}})},le=({downloadTokenList:se})=>{ve.current.downloadTokenList=se,de(!1),ze()},Te=({chooseParams:se=ve.current,componentDid:me,isInit:Ce=!1,isUpload:p=!1})=>{const{meta:x,registryUrl:k,inStore:L,inputUrl:U}=se,{did:ee,title:re,name:Ee}=x,we=(W.settings?.children||[]).filter(at=>at.status==="deleted"&&at.meta.bundleDid===ee),nt=me||"",et=x.environments?.map(at=>{const{name:hn,validation:Pt,...Wt}=at,sn={validation:Dl(Pt)?"":Pt};return{...Wt,key:hn,...sn}});ve.current={...se,meta:{...x,configs:et,registryUrl:k,inStore:L,inputUrl:U}};let Ae={};if(Ce){const at=[W],hn=et||[],Pt=[],Wt=es(Al([...hn,...Pt]),"key").filter(zt=>!!zt.key).sort((zt,Zt)=>zt.required&&!Zt.required?-1:Zt.required&&!zt.required?1:0),sn=$t.getSharedConfigObj(at[0],{configs:Wt}),an={},On=Wt.map(zt=>{const{default:Zt,key:en,...Vt}=zt;return an[en]=sn[en]||Zt,{...Vt,key:en,hidden:!!Bt.BLOCKLET_CONFIGURABLE_KEY[en]}});Ae={...Ae,configsList:On,configsValue:an,hasMissRequiredConfigs:Lo(On,an)}}const Fe=W.children.some(at=>at.mountPoint==="/"),Ze=we.find(at=>at.meta.bundleDid===ee),Dt=W.children.find(at=>at.meta.bundleDid===ee);Ae.title=re||"",Ze?Ae={...Ae,pathPrefix:Ze.mountPoint||"",componentName:Ze.meta.name,hasEnvironmentsStep:!1}:Dt?Ae={...Ae,pathPrefix:Dt.mountPoint||"",componentName:Dt.meta.name,hasEnvironmentsStep:!1}:Ae={...Ae,pathPrefix:Fe?`/${Rn(re)||Rn(Ee)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:ve.current.meta?.environments?.length>0};const on=Gh(ve.current.meta),dn=Hh(ve.current.meta),nr=Mr(W);Ue({bundleDid:ee,componentDid:nt,...Ae,hasRequiredEnvironments:Xh(ve.current.meta),requirePurchase:on,didSpaceIsRequiredSetup:dn,didSpaceEndpoint:nr,isUpload:p}),Ce&&on&>()},Pe=async()=>{if(!We.current.loading)try{P(!0),await We.current.onSubmit()&&ze()}catch(se){console.error("error",se)}finally{P(!1)}};q.useEffect(()=>{if(!a&&!m?.meta||ce!==0||!W)return;const{meta:se,inputUrl:me="",inStore:Ce=!0,registryUrl:p="",isUpload:x=!1}=m||{};Te({chooseParams:{blocklets:[a||se],meta:a||se,registryUrl:p||d||a.homepage,inStore:Ce,inputUrl:me},isInit:!0,isUpload:x}),Ue({showFromUrlDialog:!1}),ze()},[a,ce,W,m]),Ye.push({key:"selectComponent",name:E("blocklet.component.selectComponent"),body:l.jsxs(Ht,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[u&&V.showFromUrlDialog&&l.jsx(ws,{mode:"component",onCancel:()=>{Ue({showFromUrlDialog:!1})},onSuccess:({meta:se,inputUrl:me,inStore:Ce,registryUrl:p})=>{Te({chooseParams:{meta:se,inputUrl:me,inStore:Ce,registryUrl:p},isInit:!0}),Ue({showFromUrlDialog:!1}),ze()},handleText:{title:E("blocklet.component.addComponentTip.fromUrl"),confirm:E("blocklet.component.choose")}}),l.jsx(Os,{stores:r,extra:Ko.isInServerlessMode(z)?null:u?l.jsxs(bt,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{Ue({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[l.jsx(Va,{style:{fontSize:20,marginRight:4}}),E("blocklet.component.addComponentTip.fromUrl")]}):null,loading:O,onChange:()=>{ke({}),ve.current={}},storageKey:n,children:({currentRegistry:se})=>l.jsx(ua,{showResourcesSwitch:h,showCategory:j,serverVersion:z?.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:se.url,resourceType:i,resourceDid:s,handleButtonClick:me=>{Te({chooseParams:{...me,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:me,defaultRender:Ce})=>{const p=V?.bundleDid&&V?.bundleDid===me?.did;return l.jsxs(Zh,{children:[l.jsx(te,{className:p?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...p?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:Ce}),p&&l.jsx(te,{className:"check-container",children:l.jsx(Vo,{className:"check-icon"})})]})}})})]}),cancel:t==="embed"?void 0:E("common.cancel"),confirm:Yh({params:V,blocklet:W,t:E}),onCancel:Ct,onConfirm:()=>{ze()}}),Ye.push({key:"agreement",name:E("launchBlocklet.introduction"),body:l.jsxs(Ht,{component:"div",className:"agreement-wrapper",children:[l.jsx(Fr,{title:E("launchBlocklet.introduction"),subTitle:E("blocklet.component.addComponentTip.introduction")}),xe?l.jsx(fs,{meta:xe,onClickNext:ze,installRelated:pt,onChangeInstallRelated:mt,handleDescEle:l.jsx("p",{children:E("blocklet.component.addComponentTip.belowInformation")})}):null]}),cancel:a?void 0:E("common.pre"),disabled:!he,confirm:E(he?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:a?Ct:He,onConfirm:()=>{de(!1),ze()}}),xe&&V.requirePurchase&&Ye.push({key:"purchase",name:l.jsxs(l.Fragment,{children:[E("common.verifyNFT"),l.jsx(Pn,{})]}),body:l.jsxs(Ht,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(_e.current?.getCurrentStep?.()===2||$)&&l.jsx($n,{title:E("common.verifyNFT"),subTitle:E("blocklet.component.addComponentTip.verifyNFT")}),bn(V.purchaseResultProps)?N&&l.jsx(ks,{ref:_e,meta:N.meta,mode:V.componentDid?"verify":"both",onCancel:K,installOpts:N.installOpts,handlePaySuccess:le}):l.jsx("div",{className:"flex-align-center flex-justify-center",children:l.jsx(Ri,{...V.purchaseResultProps})})]}),disabled:_e.current?.getCurrentStep?.()===2||$,cancel:E("common.pre"),confirm:E("common.next"),onConfirm:()=>{typeof _e.current.onNext=="function"&&(_e.current.onNext(),de(!0))},onCancel:()=>{He()}}),$t.hasStartEngine(xe)&&Ml.hasMountPoint(xe)?Ye.push({key:"config",name:E("common.config"),error:c,body:l.jsxs(Ht,{component:"div",children:[l.jsx($n,{title:E("common.config"),subTitle:E("blocklet.component.addComponentTip.config")}),l.jsx(Gn,{label:E("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",fullWidth:!0,helperText:I||E("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:V.pathPrefix,onChange:se=>{const me=se.target.value;Ue({pathPrefix:me}),B(E("common.slugifyHint",{value:wl(me)}))},slotProps:{htmlInput:{"data-cy":"mount-point-input"}}}),!!c&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:c})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:()=>{ze()}}):xe&&(V.pathPrefix=xe.interfaces?.[0]?.path||`/${xe.did}`),xe&&xe?.requirements?.aigne&&Ye.push({key:"aigne",name:l.jsxs(Ie,{component:"div",title:E("setting.aigne.config"),sx:{whiteSpace:"break-spaces"},children:[E("setting.aigne.config")," ",l.jsx(Pn,{})]}),body:()=>l.jsxs(Ht,{component:"div",className:"aigne-config-wrapper",children:[l.jsx(Fr,{title:E("setting.aigne.config")}),l.jsx(te,{className:"form-container",sx:{"> div":{maxWidth:"unset",width:"100%"}},children:l.jsx(Zl,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,source:"setup",forceValidate:!0,ref:We})})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:()=>{We.current.loading||He()},onConfirm:Pe,loading:O||We.current?.loading,disabled:O||We.current?.loading}),xe&&V?.hasEnvironmentsStep&&Ye.push({key:"environment",name:l.jsxs(l.Fragment,{children:[E("common.environment")," ",V.hasRequiredEnvironments&&l.jsx(Pn,{})]}),disabled:!!_||V?.hasMissRequiredConfigs,body:()=>l.jsxs(Ht,{component:"div",style:{overflowY:"auto"},children:[l.jsx($n,{title:E("common.environment"),subTitle:E("blocklet.component.addComponentTip.environment")}),l.jsx($l,{style:{marginTop:-12,width:"100%"},schema:V.configsList,defaultValue:V.configsValue,onChange:(se,{action:me,currentItem:Ce,allValues:p})=>{me==="confirm"&&Ue({hasMissRequiredConfigs:Lo(V.configsList,p),configsValue:p}),me==="edit"?D(Ce):["cancel","confirm"].includes(me)&&D(null)}})]}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:ze}),xe&&V?.didSpaceIsRequiredSetup&&Ye.push({key:"didSpace",name:l.jsxs(l.Fragment,{children:[E("blocklet.component.didSpaceConfig")," ",V.didSpaceIsRequiredSetup==="required"&&l.jsx(Pn,{})]}),disabled:V?.didSpaceIsRequiredSetup&&!V.didSpaceEndpoint,body:()=>l.jsx(Fl,{children:l.jsxs(Ht,{component:"div",children:[l.jsx($n,{title:E("blocklet.component.didSpaceConfig"),subTitle:E("blocklet.component.didSpaceConfigTip")}),l.jsx(te,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:l.jsx(js,{blockletMeta:ve.current.meta,onNext:()=>{ze()},onEndpointUpdate:Ot})})]})}),cancel:E("common.pre"),confirm:E("common.next"),onCancel:He,onConfirm:ze}),Ye.push({key:"install",name:At(xe?.did)?E("common.upgrade"):E("common.install"),disabled:f?!1:bn(V.installResultProps),loading:f?!1:bn(V.installResultProps),body:l.jsx(Ht,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:bn(V.installResultProps)?l.jsx(il,{message:l.jsx(ef,{children:E(f?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):l.jsx("div",{style:{marginTop:120},children:l.jsx(Ri,{...V.installResultProps})})}),confirm:E("common.complete"),onConfirm:Rt});const Se=Ye[ce]||{},A=()=>O||Se.error||!V.bundleDid?!0:ce>1?!V.pathPrefix:!1;return W?l.jsxs(Qh,{sx:o?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[l.jsx(jl,{steps:Ye,mode:"memory",children:l.jsx(da,{ref:Ne,meta:xe,isMobile:Ge,onStepChange:se=>{$e(se)}})}),l.jsxs(te,{className:"action-bar",children:[Se.cancel&&l.jsx(bt,{onClick:se=>{se.stopPropagation(),Se.onCancel()},disabled:ce===Ye.length-2&&O,color:"inherit",children:Se.cancel||E("common.cancel")}),Se.confirm&&l.jsx(bt,{onClick:se=>{se.stopPropagation(),Se.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:O||(typeof Se.disabled=="boolean"?Se.disabled:A()),variant:"contained",autoFocus:!0,title:Se.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center",overflow:"hidden"},children:[(typeof Se.loading=="boolean"?Se.loading:O)&&l.jsx(jt,{style:{marginRight:8},size:16}),l.jsx(te,{component:"span",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Se.confirm})]})})]})]}):null}Jh.propTypes={onClose:F.func,mode:F.oneOf(["normal","embed"]),inDialog:F.bool,stores:F.arrayOf(F.string),storeUrl:F.string,resourceType:F.string,resourceDid:F.string,storageKey:F.string,selectedMeta:F.object,showResourcesSwitch:F.bool,showFromUrl:F.bool,enableRunBackground:F.bool,showCategory:F.bool,installFromUrlParams:F.object};const Qh=ot(te)`
|
|
699
699
|
.action-bar {
|
|
700
700
|
display: flex;
|
|
701
701
|
justify-content: flex-end;
|