@abtnode/blocklet-services 1.16.29-beta-1fedbcdd → 1.16.29-beta-8671c2cf
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/index.js +18 -4
- package/api/libs/env.js +2 -0
- package/api/services/static.js +5 -6
- package/dist/assets/{Add-Dg3DoX9d.js → Add-60rBtlwH.js} +1 -1
- package/dist/assets/{AddBox-C17jvdJl.js → AddBox-CUyclsPI.js} +1 -1
- package/dist/assets/{Alert-BKFuUvWk.js → Alert-Dhh7-6nK.js} +1 -1
- package/dist/assets/{ArrowDropDown-CGo5r4f4.js → ArrowDropDown-BNV-LEJY.js} +1 -1
- package/dist/assets/{Avatar-edXR98OC.js → Avatar-h8wR7d_A.js} +1 -1
- package/dist/assets/{ButtonGroup-B-trlU8_.js → ButtonGroup-B4uVvxaZ.js} +1 -1
- package/dist/assets/{CheckCircle-B9xPPxo3.js → CheckCircle-aeS12BJS.js} +1 -1
- package/dist/assets/{ChevronRight-C1KMBilZ.js → ChevronRight-Dud6PvHA.js} +1 -1
- package/dist/assets/{Close-BdY5kwmO.js → Close-DRVq9VnQ.js} +1 -1
- package/dist/assets/{CloseOutlined-CsaZ3Bhr.js → CloseOutlined-CochHuEv.js} +1 -1
- package/dist/assets/{Delete-CCqIi_Sn.js → Delete-CHi1TEYw.js} +1 -1
- package/dist/assets/{DeleteOutline-1-_Aj4ZS.js → DeleteOutline-t8Ot9Neo.js} +1 -1
- package/dist/assets/{Done-0Y69u3C8.js → Done-DWkP1WFQ.js} +1 -1
- package/dist/assets/{Download-PkPWvb17.js → Download-kwmTHSeG.js} +1 -1
- package/dist/assets/{Edit-BD3srxBB.js → Edit-ClB2c1Il.js} +1 -1
- package/dist/assets/{EditIcon-DrXWvR9n.js → EditIcon-DqRkWVcO.js} +1 -1
- package/dist/assets/{Error-DLe_WPUY.js → Error-DLnmS5PC.js} +1 -1
- package/dist/assets/{ExpandMore-DBRGZIcO.js → ExpandMore-BwMP_oJp.js} +1 -1
- package/dist/assets/{FilterList-CloD2WPY.js → FilterList-Sw6V_BFE.js} +1 -1
- package/dist/assets/{FormControl-Bimse2fR.js → FormControl-Bj9m6Ky6.js} +1 -1
- package/dist/assets/{FormControlLabel-DyDuxrZO.js → FormControlLabel-CgvUWkK9.js} +1 -1
- package/dist/assets/{FormGroup-B-B4SKep.js → FormGroup-CXl-BCMa.js} +1 -1
- package/dist/assets/{Google-CY6AY4mw.js → Google-Czdrg6I1.js} +1 -1
- package/dist/assets/{Hidden-BEdcEMkg.js → Hidden-DKCAPCvm.js} +1 -1
- package/dist/assets/{InfoOutlined-eJsNowz0.js → InfoOutlined-DwXK-MY9.js} +1 -1
- package/dist/assets/{InputAdornment-BzNkHkX2.js → InputAdornment-OYihjP7I.js} +1 -1
- package/dist/assets/{InputLabel-BYgiFQQ4.js → InputLabel-BagfasxK.js} +1 -1
- package/dist/assets/{LastPage-nU32AGod.js → LastPage-CBxP_j_N.js} +1 -1
- package/dist/assets/{Launch-CVtW962B.js → Launch-Zj7GhUol.js} +1 -1
- package/dist/assets/{LaunchOutlined-BJHsiaNO.js → LaunchOutlined-Oopuuwpn.js} +1 -1
- package/dist/assets/{Link-B7BIUmNC.js → Link-D50TqbCb.js} +1 -1
- package/dist/assets/{ListItemText-DEJDVS_t.js → ListItemText-CgUXuIoQ.js} +1 -1
- package/dist/assets/{LoadingButton-BXi8UPz1.js → LoadingButton-B0mv4XBH.js} +1 -1
- package/dist/assets/{LockIcon-BU7rJFlH.js → LockIcon-D0XoSE77.js} +1 -1
- package/dist/assets/{Loop-Dnr7WDDT.js → Loop-50FN3SVw.js} +1 -1
- package/dist/assets/{MoreVert-bOSoaHD9.js → MoreVert-BLPSSads.js} +1 -1
- package/dist/assets/{OpenInNew-CeiuaOcw.js → OpenInNew-BRil9151.js} +1 -1
- package/dist/assets/{Pagination-BYXcUJ0Y.js → Pagination-DPVyGNmc.js} +1 -1
- package/dist/assets/PlayArrow-CLLaompO.js +1 -0
- package/dist/assets/{QuestionMarkCircle-Bdv9sXqB.js → QuestionMarkCircle-D7S_ON5-.js} +1 -1
- package/dist/assets/{RadioGroup-BCw6Zfps.js → RadioGroup-BgVCjBOi.js} +1 -1
- package/dist/assets/{Search-Csb9vzNF.js → Search-C1JUCvCm.js} +1 -1
- package/dist/assets/{Select-DZHh0qcc.js → Select-J8ZyKV8c.js} +1 -1
- package/dist/assets/{ServerLogo-hhsJxrSy.js → ServerLogo-DlyDSvLw.js} +1 -1
- package/dist/assets/{Skeleton-CBS6UJ1y.js → Skeleton-C3BslqJo.js} +1 -1
- package/dist/assets/{Slider-Bn8CJzD_.js → Slider-Deg5eJK2.js} +1 -1
- package/dist/assets/{Stepper-YvlwhWMT.js → Stepper-C5Qc9JlG.js} +1 -1
- package/dist/assets/{TextField-C2EqusxQ.js → TextField-DGuOk8Jo.js} +1 -1
- package/dist/assets/{Toolbar-1na38RU0.js → Toolbar-DvnQ2GBJ.js} +1 -1
- package/dist/assets/{ViewList-DZhVIX3B.js → ViewList-DKU1N-qQ.js} +1 -1
- package/dist/assets/{access-control-oToCiriT.js → access-control-CJO3oy4_.js} +1 -1
- package/dist/assets/{actions-BsNpmFMX.js → actions-UVbm_OAA.js} +1 -1
- package/dist/assets/add-component-core-Zuy-U8Aw.js +979 -0
- package/dist/assets/add-resource-8-YESOOf.js +1 -0
- package/dist/assets/{addon-DduZXSOs.js → addon-CsUpFxZz.js} +1 -1
- package/dist/assets/{analytics-B3plQH2m.js → analytics-C2qBVRBb.js} +1 -1
- package/dist/assets/api-CsbnORRv.js +1 -0
- package/dist/assets/{audit-logs-Ck0tujOU.js → audit-logs-GaYC7o3K.js} +1 -1
- package/dist/assets/{blocklet-storage-eoLG9vUP.js → blocklet-storage-Dx4dNl3l.js} +1 -1
- package/dist/assets/{button-CRCGL4Id.js → button-CXg62_LQ.js} +1 -1
- package/dist/assets/{click-to-copy-B3viLuly.js → click-to-copy-Dc-4Zksk.js} +1 -1
- package/dist/assets/{complete-tyxHAm7X.js → complete-JiT9HR1h.js} +4 -4
- package/dist/assets/{component-BN-TcZly.js → component-BRgY6TG8.js} +27 -27
- package/dist/assets/{config-Dwya1hng.js → config-A8D0fCVx.js} +1 -1
- package/dist/assets/{config-bboKX4PL.js → config-CNLcBQI8.js} +2 -2
- package/dist/assets/{config-navigation-BUvcDr-d.js → config-navigation-CM277qjE.js} +2 -2
- package/dist/assets/{confirm-BeQH2PW_.js → confirm-Di4zO38P.js} +1 -1
- package/dist/assets/{connect-qbbg7j6s.js → connect-B54ZMIAB.js} +1 -1
- package/dist/assets/{connect-CsteDupB.js → connect-DLMOWyQQ.js} +1 -1
- package/dist/assets/{connect-to-WCwN_o6a.js → connect-to-Bi58ltJe.js} +1 -1
- package/dist/assets/{content-layout-BiBqpOIx.js → content-layout-CWYTbMkw.js} +1 -1
- package/dist/assets/{dashboard-BESqV0lJ.js → dashboard-BQgHOFpP.js} +3 -3
- package/dist/assets/{did-address-BLs9qjOH.js → did-address-DGJgCJX7.js} +1 -1
- package/dist/assets/{domain-CZTJ6x7C.js → domain-BL9Y5Fmr.js} +1 -1
- package/dist/assets/{domain-list-yMmkUCiY.js → domain-list-B26GwFVT.js} +2 -2
- package/dist/assets/exchange-passport-54fLstFj.js +1 -0
- package/dist/assets/{fallback-Cki9LbOT.js → fallback-C4LY5aiy.js} +1 -1
- package/dist/assets/{format-error-BW7oqKtM.js → format-error-DHGHvGmt.js} +1 -1
- package/dist/assets/fuel-D6aqQTdC.js +32 -0
- package/dist/assets/{fullpage-BnC_qi6s.js → fullpage-fpkgcp5k.js} +1 -1
- package/dist/assets/{home-VW-_y_8Y.js → home-CqEjIIgK.js} +1 -1
- package/dist/assets/{iframe-BRjbQULJ.js → iframe-GIIe4mI2.js} +1 -1
- package/dist/assets/{index-RXo2Xo1d.js → index-9K4Ffj3f.js} +1 -1
- package/dist/assets/{index-C6vkhDVz.js → index-B0QwohYu.js} +1 -1
- package/dist/assets/{index-C--nJJiQ.js → index-B0U8n96b.js} +1 -1
- package/dist/assets/{index-Cx_jKiM6.js → index-BO8oXE5c.js} +1 -1
- package/dist/assets/{index-C-wak9uz.js → index-Bcpl03K9.js} +1 -1
- package/dist/assets/{index-D2l2mL0e.js → index-BgN3duc5.js} +1 -1
- package/dist/assets/index-C-WkN8o4.js +1 -0
- package/dist/assets/{index-izdM8tLU.js → index-C3QTgpss.js} +1 -1
- package/dist/assets/{index-C6FVTOmg.js → index-CBpzxtag.js} +1 -1
- package/dist/assets/{index-rOCWxcf-.js → index-CMYU9sF-.js} +1 -1
- package/dist/assets/{index-D76ppsWe.js → index-CNhfiQMA.js} +43 -43
- package/dist/assets/{index-4aHMCCMH.js → index-COSMlk0o.js} +1 -1
- package/dist/assets/{index-BisCsEXx.js → index-CSLozVRf.js} +1 -1
- package/dist/assets/{index-vgfQK3J_.js → index-CXipeKYY.js} +1 -1
- package/dist/assets/{index-BZ_V6MTf.js → index-CbRg1LnS.js} +4 -4
- package/dist/assets/{index-t-A94JfS.js → index-Cj5SR3hb.js} +1 -1
- package/dist/assets/{index-CB3E1NbM.js → index-Cj7kmdBr.js} +1 -1
- package/dist/assets/{index-EUCEjnDW.js → index-CoULP9PE.js} +1 -1
- package/dist/assets/index-CqYFEfqf.js +4 -0
- package/dist/assets/{index-C4-vb4tY.js → index-CroaSsU_.js} +1 -1
- package/dist/assets/{index-DPgaGICn.js → index-CvzoB5ls.js} +1 -1
- package/dist/assets/{index-BbITgIqZ.js → index-CwFqHBGy.js} +1 -1
- package/dist/assets/{index-D9rzOuU2.js → index-D2WYviaE.js} +1 -1
- package/dist/assets/{index-ylwMh6tu.js → index-DJR5CVa4.js} +165 -165
- package/dist/assets/{index-ZcMyyZfi.js → index-DO4-NtZj.js} +1 -1
- package/dist/assets/{index-BBHPANaX.js → index-DOZ-C63g.js} +1 -1
- package/dist/assets/{index-DaKubzJ8.js → index-DYV-tuIp.js} +1 -1
- package/dist/assets/{index-D8o-H0QH.js → index-Dat6BFDH.js} +5 -5
- package/dist/assets/{index-C1CvBHUy.js → index-DciAO9oE.js} +6 -6
- package/dist/assets/index-DnufPwg3.js +1 -0
- package/dist/assets/{index-Bk0-omMC.js → index-Drz8hrYD.js} +7 -7
- package/dist/assets/index-MZfoHglB.js +1 -0
- package/dist/assets/{index-B97Tcj5g.js → index-_ZBuoNXR.js} +1 -1
- package/dist/assets/{index-BmSBAMPa.js → index-qzKq3GJD.js} +2 -2
- package/dist/assets/{index.es-BdoZt3gl.js → index.es-ChtG11fU.js} +1 -1
- package/dist/assets/{index.esm-BZdq_xYs.js → index.esm-oLBtwQZw.js} +1 -1
- package/dist/assets/{info-outline-rounded-B7pckXfF.js → info-outline-rounded-CH_C1I72.js} +1 -1
- package/dist/assets/{invitation-Dkv3jgdr.js → invitation-DF2qCSp5.js} +4 -4
- package/dist/assets/invite-Bv8q_ohP.js +10 -0
- package/dist/assets/issue-passport-CnHCDIGH.js +1 -0
- package/dist/assets/{item-CCNOnvVg.js → item-B_se0NvW.js} +1 -1
- package/dist/assets/{jss-plugin-props-sort.esm-CHeIoYvY.js → jss-plugin-props-sort.esm-BkSyoa7O.js} +1 -1
- package/dist/assets/{launch-result-message-DP7zyXX0.js → launch-result-message-8Yuyu6Hr.js} +1 -1
- package/dist/assets/{layout-CjjE8stJ.js → layout-CaPdudir.js} +1 -1
- package/dist/assets/{list-header-aqH-97l-.js → list-header-DQOpC9A-.js} +1 -1
- package/dist/assets/localization-BVfC98CB.js +1 -0
- package/dist/assets/{log-Bskl-_PT.js → log-HdxMX6-v.js} +1 -1
- package/dist/assets/{login-WFpgiNQn.js → login-C6yZWWGs.js} +1 -1
- package/dist/assets/{login-oauth-callback-CwLD7UGz.js → login-oauth-callback-Cqo_UmC4.js} +1 -1
- package/dist/assets/logo-uploader-CgPzyk_r.js +122 -0
- package/dist/assets/{lost-passport-B39d4lzc.js → lost-passport-BNJ3WJnN.js} +3 -3
- package/dist/assets/{lottie-DTAkt9rG.js → lottie-BTk5O2IF.js} +1 -1
- package/dist/assets/{notifications-rIQeNRyH.js → notifications-DueXEsjx.js} +1 -1
- package/dist/assets/{open-window-DKgXXbA_.js → open-window-vDWvg1xr.js} +1 -1
- package/dist/assets/{overview-DhaBkhW5.js → overview-CJkqJytX.js} +2 -2
- package/dist/assets/{page-header-b-7Z5M1p.js → page-header-CUgdZfsb.js} +1 -1
- package/dist/assets/{permission-CjXdPWLm.js → permission-Dgs3r85S.js} +1 -1
- package/dist/assets/{preferences-DFFLelLq.js → preferences-BWZJYPkk.js} +1 -1
- package/dist/assets/publish-resource-XMNzxCEt.js +1 -0
- package/dist/assets/{react-hphslfgR.js → react-BCD8bUpK.js} +27 -27
- package/dist/assets/{redux-D2MFeV97.js → redux-CnkebLO4.js} +1 -1
- package/dist/assets/{resource-dialog-CYsYDVd4.js → resource-dialog-rqe2ttsR.js} +2 -2
- package/dist/assets/{selector-CyKqMls1.js → selector-CwAgVP_D.js} +1 -1
- package/dist/assets/session-CongtYH1.js +1 -0
- package/dist/assets/{setup-Cvqq22Cb.js → setup-Byn6pS0i.js} +3 -3
- package/dist/assets/{shorten-label-B181R4sg.js → shorten-label-C645yKBx.js} +1 -1
- package/dist/assets/{slicedToArray-sFUDNoi3.js → slicedToArray-DEerhsll.js} +2 -2
- package/dist/assets/{spaces-C-O11DZB.js → spaces-D6JFwoI2.js} +1 -1
- package/dist/assets/{start-sbA77GB8.js → start-CmNrVceN.js} +2 -2
- package/dist/assets/{step-actions-C_aJ5g2U.js → step-actions-ClHv7c-P.js} +1 -1
- package/dist/assets/{studio-0-zx3Gfg.js → studio-5mHagehB.js} +1 -1
- package/dist/assets/{switch-control-LFie4T6d.js → switch-control-mx0I3w1B.js} +1 -1
- package/dist/assets/{toUpper-DwJS99Kw.js → toUpper-B4oOz6Sg.js} +1 -1
- package/dist/assets/{transfer-DemzpgEv.js → transfer-BAjsyqta.js} +2 -2
- package/dist/assets/{uniqBy-CurK-eE8.js → uniqBy-CBH0-Yv6.js} +1 -1
- package/dist/assets/unsubscribe-BiAIax0x.js +1 -0
- package/dist/assets/{url-join-CYx28Lgt.js → url-join-BNTtCa6U.js} +1 -1
- package/dist/assets/{use-blocklet-info-for-connect-did-spaces-BVTgf2Uo.js → use-blocklet-info-for-connect-did-spaces-DdFyNLYt.js} +1 -1
- package/dist/assets/{use-mobile-UW34SxaH.js → use-mobile-DGq-RGY3.js} +1 -1
- package/dist/assets/{useAsync-kH9wVwIf.js → useAsync-D1IhVRQ1.js} +1 -1
- package/dist/assets/{useFormControl-Bc6GRxco.js → useFormControl-gr78OXkZ.js} +1 -1
- package/dist/assets/{useLocalStorage-kWHhpCBz.js → useLocalStorage-BsJKwzJs.js} +1 -1
- package/dist/assets/{useSetState-7SNjdxq8.js → useSetState-Io8i3iXO.js} +1 -1
- package/dist/assets/{useSlot-BMo33AcK.js → useSlot-CYRDfUDU.js} +1 -1
- package/dist/assets/{user-center-BtPuulHQ.js → user-center-Bc7hRs-N.js} +1 -1
- package/dist/assets/{util-BKi99Ui9.js → util-BiGYgt2_.js} +1 -1
- package/dist/assets/{wrap-locale-BGOpNp8r.js → wrap-locale-D2O4BAi1.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +24 -24
- package/dist/assets/PlayArrow-D22-pmdQ.js +0 -1
- package/dist/assets/add-component-core-D_rRE8CK.js +0 -952
- package/dist/assets/add-resource-DFAzvQTL.js +0 -1
- package/dist/assets/api-D4UteNRP.js +0 -1
- package/dist/assets/exchange-passport-BAKKCu43.js +0 -1
- package/dist/assets/fuel-DprFmFw0.js +0 -32
- package/dist/assets/index-CpCiL9fl.js +0 -4
- package/dist/assets/index-D9dlgRXn.js +0 -1
- package/dist/assets/index-iUyg8ocp.js +0 -1
- package/dist/assets/invite-CiL7XQ0_.js +0 -10
- package/dist/assets/issue-passport-x1Sz90ds.js +0 -1
- package/dist/assets/localization-CgQBvb94.js +0 -1
- package/dist/assets/logo-uploader-By8vYJcc.js +0 -122
- package/dist/assets/publish-resource-DG_q9nHi.js +0 -1
- package/dist/assets/session-BKSBv0mj.js +0 -1
- package/dist/assets/unsubscribe-BRq8BRma.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b4 as a}from"./index-
|
|
1
|
+
import{b4 as a}from"./index-DJR5CVa4.js";var e=i,s=/^(?:\w+:)?\/\/(\S+)$/,l=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,n=/^[^\s\.]+\.\S{2,}$/;function i(t){if(typeof t!="string")return!1;var o=t.match(s);if(!o)return!1;var r=o[1];return r?!!(l.test(r)||n.test(r)):!1}const c=a(e);export{c as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as o,r as x,j as e,B as u,bf as K,by as B,
|
|
1
|
+
import{P as o,r as x,j as e,B as u,bf as K,by as B,fb as W,a7 as v,az as R,m as M,dj as $,Z as A}from"./index-DJR5CVa4.js";import{d as G}from"./EditIcon-DqRkWVcO.js";import{d as H}from"./Done-DWkP1WFQ.js";import{C as U}from"./Google-Czdrg6I1.js";import{T as Y}from"./TextField-DGuOk8Jo.js";import{R as Z,F as J,L as Q}from"./logo-uploader-CgPzyk_r.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function V({editing:n,value:r,onChange:s}){const[a,l]=x.useState(!1),c=x.useRef(),d=x.useRef(r);x.useEffect(()=>{let p=null;return n&&(p=setTimeout(()=>{l(!0)},50)),()=>{clearTimeout(p)}},[n]);const g=p=>{d.current=p,s(p)},y=()=>{l(!1),s(d.current)},b=e.jsx(u,{className:"form-item-input slot",px:1,children:e.jsxs(u,{display:"flex",alignItems:"center",children:[r,r!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:r,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),i=e.jsxs(u,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:y,children:[e.jsx(u,{display:"flex",alignItems:"center",onClick:()=>l(!0),children:e.jsx("div",{ref:c,style:{flexShrink:0,marginLeft:"8px",backgroundColor:r,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:r==="auto"?"default":"pointer"}})}),e.jsx(K,{open:a,anchorEl:c.current,onClose:()=>l(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(U,{color:r,onChange:p=>g(p.hex)})})]});return n?i:b}V.propTypes=S;function _({editing:n,description:r,value:s,onChange:a,componentProps:l,...c}){const{placeholder:d}=l,g=x.useRef(s),y=i=>{i.key==="Enter"&&a(g.current,"confirm")},b=i=>{g.current=i,a(i)};return n?e.jsx(Y,{style:{flex:1},fullWidth:!0,value:s,onChange:i=>{i.persist(),b(i.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:r||d,onKeyDown:y,...c}):e.jsx(u,{px:1,className:"form-item-input slot",children:s})}_.propTypes=S;_.defaultProps={componentProps:{}};function F({editing:n,value:r,onChange:s,componentProps:a,...l}){const{blocklet:c}=a,d=r==="auto"?B.getPassportColorFromDid(c.appDid):r;return e.jsxs(u,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:W({title:"Owner",issuer:v.getDisplayName(c),issuerDid:c.appDid,ownerName:"Your Name",ownerDid:c.appDid,preferredColor:r||"auto"})}}),e.jsx(V,{...l,editing:n,value:n?d:r,onChange:s,componentProps:a})]})}F.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};F.defaultProps={};const X={input:_,color:V,passport:F,uploader:n=>e.jsx(Q,{...n.componentProps})};function ee(n,{editing:r=!1}){const{componentType:s="input",render:a,renderFormItem:l}=n;return r&&l?l:!r&&a?a:X[s==null?void 0:s.toLowerCase()]}function D({schema:n,loading:r,value:s,defaultValue:a,onChange:l,style:c,disabled:d}){const g=Object.prototype.toString.call(s)==="[object Object]",[y,b]=x.useState(null),[i,p]=x.useState(g?s:a),P=x.useRef();function I(t,m,h){const{key:f,secure:C}=t,k=i[f]!==m,j={...i,[f]:m};k&&p(j),l({[f]:m},{allValues:j,action:h,currentItem:t}),h==="confirm"&&C&&p({...i,[f]:"__encrypted__"}),["confirm","cancel"].includes(h)?N(null):N(t)}function N(t){if(t){P.current=i[t.key],b(t);return}P.current=null,b(null)}function E(t,{editing:m=!1}){const{key:h}=t,f=g?s[h]:i[h];return f==="__encrypted__"?m?"":"******":f}return e.jsx(re,{className:"form",style:c,children:n==null?void 0:n.map(t=>{const{key:m,description:h,required:f,solo:C=!1,hidden:T=!1,componentProps:k={}}=t;if(T)return null;const j=!!(y&&m===y.key),w=E(t,{editing:j}),z=ee(t,{editing:j}),q={inputProps:{"data-cy":"schema-form-item-component"},key:m,description:h,editing:j,value:w,onChange:(L,O="change")=>I(t,L,O),componentProps:k};return e.jsxs(u,{className:"form-item",children:[!C&&e.jsxs(u,{className:"form-item-label",style:{color:f&&!w?"#ff0000":"#333"},children:[h,f&&e.jsx(Z,{})]}),e.jsxs(u,{className:"form-item-body",children:[e.jsx(u,{className:"form-item-input",sx:{textAlign:C?"center":"left"},children:e.jsx(z,{...q})}),!C&&e.jsx(u,{className:"form-item-action",children:j?e.jsxs(e.Fragment,{children:[e.jsx(R,{"data-cy":"schema-form-item-confirm",onClick:()=>{I(t,w,"confirm")},disabled:d||r,size:"large",children:r?e.jsx(M,{size:24}):e.jsx(H,{})}),e.jsx(R,{"data-cy":"schema-form-item-cancel",onClick:()=>{I(t,P.current,"cancel")},disabled:d||r,size:"large",children:e.jsx($,{})})]}):e.jsx(R,{"data-cy":"schema-form-item-edit",onClick:()=>{I(t,i[m],"edit")},disabled:d||y,size:"large",children:e.jsx(G,{})})})]})]},m)})})}D.propTypes={schema:o.array.isRequired,loading:o.bool,onChange:o.func.isRequired,value:o.object,defaultValue:o.object,style:o.object,disabled:o.bool};D.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const re=A(J)``;export{D as S};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__fileDeps=["assets/react-
|
|
2
|
-
import{ao as Q0,j as o,aD as le,cK as p0,aG as H,fl as q1,aF as ve,aB as Be,aC as Ee,T as Q,r as R,aK as Ae,aH as h0,aI as Oe,aJ as He,cQ as Y0,fm as Ze,X as Le,Y as Pe,B as z,l as Ke,P as f,$ as $e,E as K,e as u1,u as te,aM as Re,aV as Te,bv as e1,a1 as Xe,L as ue,bI as f0,a as xe,az as ae,I as Z0,q as $,Z as ce,dR as e2,a9 as je,c as pe,F as t2,bT as p1,ce as x0,cG as o2,cO as _e,cP as m0,bh as l2,d3 as r2,cJ as qe,bC as Je,c1 as Ue,f7 as s2,a7 as U1,b as ie,bk as n2,dy as i2,ae as v0,bl as a2,ck as c2,aQ as W1,aP as d2,a2 as g0,fn as G1,eY as Se,bi as u2,cW as p2,ap as h2,h as f2,ay as x2,al as m2,am as o1}from"./index-ylwMh6tu.js";import{d as h1}from"./Add-Dg3DoX9d.js";import{d as v2}from"./AddBox-C17jvdJl.js";import{d as b0}from"./Delete-CCqIi_Sn.js";import{d as g2}from"./Error-DLe_WPUY.js";import{D as f1}from"./index-C6FVTOmg.js";import{T as j0,b as b2}from"./index-BisCsEXx.js";import{C as x1}from"./confirm-BeQH2PW_.js";import{u as t1}from"./session-BKSBv0mj.js";import{W as K1}from"./did-address-BLs9qjOH.js";import{B as m1,d as j2}from"./ChevronRight-C1KMBilZ.js";import{S as me}from"./shorten-label-B181R4sg.js";import{A as w0}from"./Avatar-edXR98OC.js";import{d as w2}from"./Download-PkPWvb17.js";import{d as R2}from"./QuestionMarkCircle-Bdv9sXqB.js";import{b as C2,c as X1,T as y2}from"./index-C--nJJiQ.js";import{_ as ke}from"./useSetState-7SNjdxq8.js";import{c as v1}from"./index-BBHPANaX.js";import{C as i1,F as a1,S as z2}from"./FormControlLabel-DyDuxrZO.js";import{A as R0}from"./Alert-BKFuUvWk.js";import{p as Qe}from"./index-HqFqdQ4r.js";import"./api-D4UteNRP.js";import{i as k2}from"./index-ZcMyyZfi.js";import{d as S2}from"./ExpandMore-DBRGZIcO.js";import{d as M2}from"./OpenInNew-CeiuaOcw.js";import{d as I2}from"./DeleteOutline-1-_Aj4ZS.js";import{d as L2}from"./ArrowDropDown-CGo5r4f4.js";import{f as Ie}from"./format-error-BW7oqKtM.js";import{c as P2,A as C0,u as T2,S as N2,U as V2}from"./item-CCNOnvVg.js";import{B as D2}from"./ButtonGroup-B-trlU8_.js";import{T as Me}from"./TextField-C2EqusxQ.js";import{I as g1}from"./InputAdornment-BzNkHkX2.js";import{C as _2}from"./click-to-copy-B3viLuly.js";import{d as B2}from"./Launch-CVtW962B.js";import{L as E2}from"./MoreVert-bOSoaHD9.js";import{a as A2}from"./ListItemText-DEJDVS_t.js";import{M as O2}from"./index-RXo2Xo1d.js";import{r as H2}from"./index-DPgaGICn.js";import{d as $2}from"./Done-0Y69u3C8.js";import{c as y0,d as z0,b as F2,S as q2,a as U2}from"./Stepper-YvlwhWMT.js";import{R as W2,a as J1}from"./RadioGroup-BCw6Zfps.js";import"./FilterList-CloD2WPY.js";import"./toPropertyKey-hKuLU48H.js";import"./FormControl-Bimse2fR.js";import"./useFormControl-Bc6GRxco.js";import"./FormGroup-B-B4SKep.js";import"./InputLabel-BYgiFQQ4.js";import"./Select-DZHh0qcc.js";import"./LastPage-nU32AGod.js";import"./Toolbar-1na38RU0.js";import"./index-D2l2mL0e.js";import"./redux-D2MFeV97.js";import"./Search-Csb9vzNF.js";import"./index-C-wak9uz.js";import"./Link-B7BIUmNC.js";import"./useSlot-BMo33AcK.js";import"./jss-plugin-props-sort.esm-CHeIoYvY.js";const G2=Q0(o.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),K2=["slots","slotProps"],X2=le(p0)(({theme:e})=>H({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`},e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":H({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":H({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:q1(e.palette.grey[200],.12)}:{backgroundColor:q1(e.palette.grey[600],.12)})})),J2=le(G2)({width:24,height:16});function Q2(e){const{slots:t={},slotProps:l={}}=e,s=ve(e,K2),n=e;return o.jsx("li",{children:o.jsx(X2,H({focusRipple:!0},s,{ownerState:n,children:o.jsx(J2,H({as:t.CollapsedIcon,ownerState:n},l.collapsedIcon))}))})}function Y2(e){return Ee("MuiBreadcrumbs",e)}const Z2=Be("MuiBreadcrumbs",["root","ol","li","separator"]),et=Z2,tt=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],ot=e=>{const{classes:t}=e;return He({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},Y2,t)},lt=le(Q,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,t)=>[{[`& .${et.li}`]:t.li},t.root]})({}),rt=le("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,t)=>t.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),st=le("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,t)=>t.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function nt(e,t,l,s){return e.reduce((n,d,i)=>(i<e.length-1?n=n.concat(d,o.jsx(st,{"aria-hidden":!0,className:t,ownerState:s,children:l},`separator-${i}`)):n.push(d),n),[])}const it=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiBreadcrumbs"}),{children:n,className:d,component:i="nav",slots:c={},slotProps:u={},expandText:h="Show path",itemsAfterCollapse:x=1,itemsBeforeCollapse:g=1,maxItems:y=8,separator:p="/"}=s,a=ve(s,tt),[m,w]=R.useState(!1),v=H({},s,{component:i,expanded:m,expandText:h,itemsAfterCollapse:x,itemsBeforeCollapse:g,maxItems:y,separator:p}),C=ot(v),k=h0({elementType:c.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:v}),N=R.useRef(null),T=S=>{const F=()=>{w(!0);const V=N.current.querySelector("a[href],button,[tabindex]");V&&V.focus()};return g+x>=S.length?S:[...S.slice(0,g),o.jsx(Q2,{"aria-label":h,slots:{CollapsedIcon:c.CollapsedIcon},slotProps:{collapsedIcon:k},onClick:F},"ellipsis"),...S.slice(S.length-x,S.length)]},L=R.Children.toArray(n).filter(S=>R.isValidElement(S)).map((S,F)=>o.jsx("li",{className:C.li,children:S},`child-${F}`));return o.jsx(lt,H({ref:l,component:i,color:"text.secondary",className:Oe(C.root,d),ownerState:v},a,{children:o.jsx(rt,{className:C.ol,ref:N,ownerState:v,children:nt(m||y&&L.length<=y?L:T(L),C.separator,p,v)})}))}),k0=it;function at(e){return Ee("MuiStepButton",e)}const ct=Be("MuiStepButton",["root","horizontal","vertical","touchRipple"]),Q1=ct,dt=["children","className","icon","optional"],ut=e=>{const{classes:t,orientation:l}=e;return He({root:["root",l],touchRipple:["touchRipple"]},at,t)},pt=le(p0,{name:"MuiStepButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[{[`& .${Q1.touchRipple}`]:t.touchRipple},t.root,t[l.orientation]]}})(({ownerState:e})=>H({width:"100%",padding:"24px 16px",margin:"-24px -16px",boxSizing:"content-box"},e.orientation==="vertical"&&{justifyContent:"flex-start",padding:"8px",margin:"-8px"},{[`& .${Q1.touchRipple}`]:{color:"rgba(0, 0, 0, 0.3)"}})),ht=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiStepButton"}),{children:n,className:d,icon:i,optional:c}=s,u=ve(s,dt),{disabled:h,active:x}=R.useContext(y0),{orientation:g}=R.useContext(z0),y=H({},s,{orientation:g}),p=ut(y),a={icon:i,optional:c},m=Y0(n,["StepLabel"])?R.cloneElement(n,a):o.jsx(F2,H({},a,{children:n}));return o.jsx(pt,H({focusRipple:!0,disabled:h,TouchRippleProps:{className:p.touchRipple},className:Oe(p.root,d),ref:l,ownerState:y,"aria-current":x?"step":void 0},u,{children:m}))}),ft=ht;function xt(e){return Ee("MuiStepContent",e)}Be("MuiStepContent",["root","last","transition"]);const mt=["children","className","TransitionComponent","transitionDuration","TransitionProps"],vt=e=>{const{classes:t,last:l}=e;return He({root:["root",l&&"last"],transition:["transition"]},xt,t)},gt=le("div",{name:"MuiStepContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[t.root,l.last&&t.last]}})(({ownerState:e,theme:t})=>H({marginLeft:12,paddingLeft:20,paddingRight:8,borderLeft:t.vars?`1px solid ${t.vars.palette.StepContent.border}`:`1px solid ${t.palette.mode==="light"?t.palette.grey[400]:t.palette.grey[600]}`},e.last&&{borderLeft:"none"})),bt=le(Ze,{name:"MuiStepContent",slot:"Transition",overridesResolver:(e,t)=>t.transition})({}),jt=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiStepContent"}),{children:n,className:d,TransitionComponent:i=Ze,transitionDuration:c="auto",TransitionProps:u}=s,h=ve(s,mt);R.useContext(z0);const{active:x,last:g,expanded:y}=R.useContext(y0),p=H({},s,{last:g}),a=vt(p);let m=c;return c==="auto"&&!i.muiSupportAuto&&(m=void 0),o.jsx(gt,H({className:Oe(a.root,d),ref:l,ownerState:p},h,{children:o.jsx(bt,H({as:i,in:x||y,className:a.transition,ownerState:p,timeout:m,unmountOnExit:!0},u,{children:n}))}))}),wt=jt;var b1={},Rt=Pe;Object.defineProperty(b1,"__esModule",{value:!0});var S0=b1.default=void 0,Ct=Rt(Le()),yt=o;S0=b1.default=(0,Ct.default)((0,yt.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var j1={},zt=Pe;Object.defineProperty(j1,"__esModule",{value:!0});var M0=j1.default=void 0,kt=zt(Le()),St=o;M0=j1.default=(0,kt.default)((0,St.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Ce({size:e,...t}){return o.jsx(z,{display:"flex",mt:4,...t,children:o.jsx(Ke,{size:e})})}Ce.propTypes={size:f.number};Ce.defaultProps={size:24};function w1({did:e,projectId:t,title:l,logo:s,describe:n}){const i=`${`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${t}/logo/upload`}/${s}`,[c,u]=R.useState(!1),h=$e(x=>x.breakpoints.down("md"));return o.jsxs(z,{sx:{display:"flex",flexDirection:"row",color:c?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[o.jsx(w0,{sx:{borderRadius:1},src:i}),o.jsxs(z,{children:[o.jsx(me,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:l||"/"}),o.jsx(me,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||c?"primary.main":"grey.700"},children:n||"/"})]})]})}w1.propTypes={projectId:f.string.isRequired,did:f.string.isRequired,title:f.string.isRequired,logo:f.string.isRequired,describe:f.string.isRequired};function R1({initUrl:e}){const t=u1(),l=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:s,locale:n}=te(),{api:d}=Re(),{api:i}=t1(),[c,u]=R.useState(!0),{blocklet:h}=Te(),[x,g]=R.useState(null),[y,p]=R.useState(!1),a=$e(M=>M.breakpoints.down("xl")),{componentDid:m=""}=e1(),[w,v]=R.useState(null),C=()=>{d.getProjects({input:{did:h.meta.did,componentDid:m,tenantScope:l}}).then(M=>{const P=(M==null?void 0:M.projects)||[];u(!1),v(P)}).catch(M=>{u(!1),$.error(M.message)})},k=()=>{t(`${K.UNOWNED_DID}/create/none`,{replace:!0})},N=M=>{g(M)},T=()=>{u(!1),p(!0)},L=()=>{p(!1),g(null)},S=M=>{$.error(M.message),p(!1),g(null)},F=M=>{if(!(M!=null&&M.deleted)){$.error("Delete project failed");return}C(),p(!1),g(null)};if(R.useEffect(()=>{C()},[]),!w&&c)return o.jsx(z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:o.jsx(Ce,{})});if(!w)return null;if(!w.length)return o.jsxs(z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[o.jsx(z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:s("blocklet.publish.blockletEmptyTip")}),o.jsx(z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:s("blocklet.publish.createBlockletTip")}),o.jsx(Xe,{onClick:k,variant:"contained",children:s("blocklet.publish.createBlocklet")})]});const V=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:M=>{const P=w[M];return o.jsx(ue,{to:`${P.id}`,children:o.jsx(w1,{did:h.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:M=>M?o.jsx(j0,{type:"success",children:M}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:M=>M?o.jsx(K1,{size:14,compact:!0,responsive:!1,did:M}):null}},a||m?null:{label:s("common.createdBy"),name:"createdBy",options:{customBodyRender:M=>M?o.jsx(K1,{onClick:()=>{t(`/.well-known/service/admin/members?did=${M}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:M}):null}},a||m?null:{label:s("common.scope"),name:"componentDid",options:{customBodyRender:M=>{const P=(h.children||[]).find(O=>O.meta.did===M);return P?o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(m1,{size:14,blocklet:P,ancestors:[h]}),o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},M):""}}},a||l?null:{label:s("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:M=>o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:o.jsx(me,{children:M})})}},{label:s("common.updatedAt"),name:"updatedAt",options:{customBodyRender:M=>o.jsx(f0,{value:Number(M),locale:n})}},{label:s("common.actions"),name:"actions",options:{customBodyRenderLite:M=>{const P=w[M];return o.jsxs(z,{display:"flex",children:[o.jsx(ue,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:o.jsx(xe,{title:s("blocklet.publish.createRelease"),placement:"top",children:o.jsx(ae,{color:"primary","aria-label":"create",children:o.jsx(v2,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&o.jsx(xe,{title:s("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:o.jsx(ae,{color:"secondary","aria-label":"create",children:o.jsx(ue,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:o.jsx(S0,{sx:{fontSize:18}})})})}),o.jsx(xe,{title:s("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:o.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>N(P),children:o.jsx(b0,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),I=y?o.jsx(Z0,{open:!0,popup:!0,onClose:L,action:"check-has-project-id",locale:n,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:F,onError:S,extraParams:{projectId:x.id,did:h.meta.did,name:x.blockletTitle},messages:{title:s("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:s("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:s("blocklet.publish.deleteProject.confirm"),success:s("blocklet.publish.deleteProject.success")}}):null;return o.jsxs(Mt,{children:[o.jsxs(z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[o.jsxs(z,{display:"flex",flexDirection:"row",alignItems:"center",children:[o.jsx(z,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("common.blockletStudio")}),o.jsx(xe,{title:s("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:o.jsx(M0,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),o.jsxs(Xe,{onClick:k,variant:"contained",children:[o.jsx(h1,{style:{fontSize:"1.3em",marginRight:4}}),s("blocklet.publish.createBlocklet")]})]}),o.jsx(z,{mt:3}),o.jsx(f1,{className:"main-table",locale:n,data:w,columns:V,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&o.jsx(x1,{title:`${s("common.delete")} ${x.blockletTitle}`,description:s("blocklet.publish.deleteProject.description"),confirm:s("common.confirm"),onConfirm:T,onCancel:()=>g(null),children:o.jsx(z,{sx:{marginTop:2},children:[s("blocklet.publish.deleteProject.tip1"),s("blocklet.publish.deleteProject.tip2"),s("blocklet.publish.deleteProject.tip3")].map(M=>o.jsxs(z,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[o.jsx(g2,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),o.jsx(Q,{component:"span",variant:"inherit",color:"text.secondary",children:M})]}))})}),I]})}R1.propTypes={initUrl:f.object};R1.defaultProps={initUrl:null};const Mt=ce(z)`
|
|
1
|
+
const __vite__fileDeps=["assets/react-BCD8bUpK.js","assets/index-DJR5CVa4.js","assets/index-CCovGSMB.css","assets/index-C-WkN8o4.js","assets/preact.module-B1z5cdvs.js","assets/index-COSMlk0o.js","assets/index-DOZ-C63g.js","assets/toUpper-B4oOz6Sg.js","assets/fallback-C4LY5aiy.js","assets/index-DciAO9oE.js","assets/Toolbar-DvnQ2GBJ.js","assets/Hidden-DKCAPCvm.js","assets/index-qzKq3GJD.js","assets/MoreVert-BLPSSads.js","assets/Avatar-h8wR7d_A.js","assets/useSlot-CYRDfUDU.js","assets/selector-CwAgVP_D.js","assets/ExpandMore-BwMP_oJp.js","assets/index-B0U8n96b.js","assets/index-Bcpl03K9.js","assets/info-outline-rounded-CH_C1I72.js","assets/index-CoULP9PE.js","assets/FormControlLabel-CgvUWkK9.js","assets/useFormControl-gr78OXkZ.js","assets/index-CMYU9sF-.js","assets/index-CBpzxtag.js","assets/FilterList-Sw6V_BFE.js","assets/toPropertyKey-hKuLU48H.js","assets/FormControl-Bj9m6Ky6.js","assets/FormGroup-CXl-BCMa.js","assets/InputLabel-BagfasxK.js","assets/ListItemText-CgUXuIoQ.js","assets/Select-J8ZyKV8c.js","assets/TextField-DGuOk8Jo.js","assets/LastPage-CBxP_j_N.js","assets/index-BgN3duc5.js","assets/redux-CnkebLO4.js","assets/Search-C1JUCvCm.js","assets/Delete-CHi1TEYw.js","assets/index-MZfoHglB.js","assets/url-join-BNTtCa6U.js","assets/uniqBy-CBH0-Yv6.js","assets/react-BW7E7-P9.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
|
|
2
|
+
import{ao as Q0,j as o,aD as le,cK as p0,aG as H,fq as q1,aF as ve,aB as Be,aC as Ee,T as Q,r as R,aK as Ae,aH as h0,aI as Oe,aJ as He,cQ as Y0,fr as Ze,X as Le,Y as Pe,B as z,m as Ke,P as f,$ as $e,F as K,e as u1,u as te,aM as Re,aV as Te,bv as e1,a1 as Xe,L as ue,bI as f0,a as xe,az as ae,J as Z0,s as $,Z as ce,dR as e2,a9 as je,c as pe,G as t2,bT as p1,ce as x0,cG as o2,cO as _e,cP as m0,bh as l2,d3 as r2,cJ as qe,bC as Je,c1 as Ue,fd as s2,a7 as U1,b as ie,bk as n2,dy as i2,ae as v0,bl as a2,ck as c2,aQ as W1,aP as d2,a2 as g0,fs as G1,f2 as Se,bi as u2,cW as p2,ap as h2,k as f2,ay as x2,al as m2,am as o1}from"./index-DJR5CVa4.js";import{d as h1}from"./Add-60rBtlwH.js";import{d as v2}from"./AddBox-CUyclsPI.js";import{d as b0}from"./Delete-CHi1TEYw.js";import{d as g2}from"./Error-DLnmS5PC.js";import{D as f1}from"./index-CBpzxtag.js";import{T as j0,b as b2}from"./index-CSLozVRf.js";import{C as x1}from"./confirm-Di4zO38P.js";import{u as t1}from"./session-CongtYH1.js";import{W as K1}from"./did-address-DGJgCJX7.js";import{B as m1,d as j2}from"./ChevronRight-Dud6PvHA.js";import{S as me}from"./shorten-label-C645yKBx.js";import{A as w0}from"./Avatar-h8wR7d_A.js";import{d as w2}from"./Download-kwmTHSeG.js";import{d as R2}from"./QuestionMarkCircle-D7S_ON5-.js";import{b as C2,c as X1,T as y2}from"./index-B0U8n96b.js";import{_ as ke}from"./useSetState-Io8i3iXO.js";import{c as v1}from"./index-DOZ-C63g.js";import{C as i1,F as a1,S as z2}from"./FormControlLabel-CgvUWkK9.js";import{A as R0}from"./Alert-Dhh7-6nK.js";import{p as Qe}from"./index-HqFqdQ4r.js";import"./api-CsbnORRv.js";import{i as k2}from"./index-DO4-NtZj.js";import{d as S2}from"./ExpandMore-BwMP_oJp.js";import{d as M2}from"./OpenInNew-BRil9151.js";import{d as I2}from"./DeleteOutline-t8Ot9Neo.js";import{d as L2}from"./ArrowDropDown-BNV-LEJY.js";import{f as Ie}from"./format-error-DHGHvGmt.js";import{c as P2,A as C0,u as T2,S as N2,U as V2}from"./item-B_se0NvW.js";import{B as D2}from"./ButtonGroup-B4uVvxaZ.js";import{T as Me}from"./TextField-DGuOk8Jo.js";import{I as g1}from"./InputAdornment-OYihjP7I.js";import{C as _2}from"./click-to-copy-Dc-4Zksk.js";import{d as B2}from"./Launch-Zj7GhUol.js";import{L as E2}from"./MoreVert-BLPSSads.js";import{a as A2}from"./ListItemText-CgUXuIoQ.js";import{M as O2}from"./index-9K4Ffj3f.js";import{r as H2}from"./index-CvzoB5ls.js";import{d as $2}from"./Done-DWkP1WFQ.js";import{c as y0,d as z0,b as F2,S as q2,a as U2}from"./Stepper-C5Qc9JlG.js";import{R as W2,a as J1}from"./RadioGroup-BgVCjBOi.js";import"./FilterList-Sw6V_BFE.js";import"./toPropertyKey-hKuLU48H.js";import"./FormControl-Bj9m6Ky6.js";import"./useFormControl-gr78OXkZ.js";import"./FormGroup-CXl-BCMa.js";import"./InputLabel-BagfasxK.js";import"./Select-J8ZyKV8c.js";import"./LastPage-CBxP_j_N.js";import"./Toolbar-DvnQ2GBJ.js";import"./index-BgN3duc5.js";import"./redux-CnkebLO4.js";import"./Search-C1JUCvCm.js";import"./index-Bcpl03K9.js";import"./Link-D50TqbCb.js";import"./useSlot-CYRDfUDU.js";import"./jss-plugin-props-sort.esm-BkSyoa7O.js";const G2=Q0(o.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}),"MoreHoriz"),K2=["slots","slotProps"],X2=le(p0)(({theme:e})=>H({display:"flex",marginLeft:`calc(${e.spacing(1)} * 0.5)`,marginRight:`calc(${e.spacing(1)} * 0.5)`},e.palette.mode==="light"?{backgroundColor:e.palette.grey[100],color:e.palette.grey[700]}:{backgroundColor:e.palette.grey[700],color:e.palette.grey[100]},{borderRadius:2,"&:hover, &:focus":H({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":H({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:q1(e.palette.grey[200],.12)}:{backgroundColor:q1(e.palette.grey[600],.12)})})),J2=le(G2)({width:24,height:16});function Q2(e){const{slots:t={},slotProps:l={}}=e,s=ve(e,K2),n=e;return o.jsx("li",{children:o.jsx(X2,H({focusRipple:!0},s,{ownerState:n,children:o.jsx(J2,H({as:t.CollapsedIcon,ownerState:n},l.collapsedIcon))}))})}function Y2(e){return Ee("MuiBreadcrumbs",e)}const Z2=Be("MuiBreadcrumbs",["root","ol","li","separator"]),et=Z2,tt=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],ot=e=>{const{classes:t}=e;return He({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},Y2,t)},lt=le(Q,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,t)=>[{[`& .${et.li}`]:t.li},t.root]})({}),rt=le("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,t)=>t.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),st=le("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,t)=>t.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function nt(e,t,l,s){return e.reduce((n,d,i)=>(i<e.length-1?n=n.concat(d,o.jsx(st,{"aria-hidden":!0,className:t,ownerState:s,children:l},`separator-${i}`)):n.push(d),n),[])}const it=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiBreadcrumbs"}),{children:n,className:d,component:i="nav",slots:c={},slotProps:u={},expandText:h="Show path",itemsAfterCollapse:x=1,itemsBeforeCollapse:g=1,maxItems:y=8,separator:p="/"}=s,a=ve(s,tt),[m,w]=R.useState(!1),v=H({},s,{component:i,expanded:m,expandText:h,itemsAfterCollapse:x,itemsBeforeCollapse:g,maxItems:y,separator:p}),C=ot(v),k=h0({elementType:c.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:v}),N=R.useRef(null),T=S=>{const F=()=>{w(!0);const V=N.current.querySelector("a[href],button,[tabindex]");V&&V.focus()};return g+x>=S.length?S:[...S.slice(0,g),o.jsx(Q2,{"aria-label":h,slots:{CollapsedIcon:c.CollapsedIcon},slotProps:{collapsedIcon:k},onClick:F},"ellipsis"),...S.slice(S.length-x,S.length)]},L=R.Children.toArray(n).filter(S=>R.isValidElement(S)).map((S,F)=>o.jsx("li",{className:C.li,children:S},`child-${F}`));return o.jsx(lt,H({ref:l,component:i,color:"text.secondary",className:Oe(C.root,d),ownerState:v},a,{children:o.jsx(rt,{className:C.ol,ref:N,ownerState:v,children:nt(m||y&&L.length<=y?L:T(L),C.separator,p,v)})}))}),k0=it;function at(e){return Ee("MuiStepButton",e)}const ct=Be("MuiStepButton",["root","horizontal","vertical","touchRipple"]),Q1=ct,dt=["children","className","icon","optional"],ut=e=>{const{classes:t,orientation:l}=e;return He({root:["root",l],touchRipple:["touchRipple"]},at,t)},pt=le(p0,{name:"MuiStepButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[{[`& .${Q1.touchRipple}`]:t.touchRipple},t.root,t[l.orientation]]}})(({ownerState:e})=>H({width:"100%",padding:"24px 16px",margin:"-24px -16px",boxSizing:"content-box"},e.orientation==="vertical"&&{justifyContent:"flex-start",padding:"8px",margin:"-8px"},{[`& .${Q1.touchRipple}`]:{color:"rgba(0, 0, 0, 0.3)"}})),ht=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiStepButton"}),{children:n,className:d,icon:i,optional:c}=s,u=ve(s,dt),{disabled:h,active:x}=R.useContext(y0),{orientation:g}=R.useContext(z0),y=H({},s,{orientation:g}),p=ut(y),a={icon:i,optional:c},m=Y0(n,["StepLabel"])?R.cloneElement(n,a):o.jsx(F2,H({},a,{children:n}));return o.jsx(pt,H({focusRipple:!0,disabled:h,TouchRippleProps:{className:p.touchRipple},className:Oe(p.root,d),ref:l,ownerState:y,"aria-current":x?"step":void 0},u,{children:m}))}),ft=ht;function xt(e){return Ee("MuiStepContent",e)}Be("MuiStepContent",["root","last","transition"]);const mt=["children","className","TransitionComponent","transitionDuration","TransitionProps"],vt=e=>{const{classes:t,last:l}=e;return He({root:["root",l&&"last"],transition:["transition"]},xt,t)},gt=le("div",{name:"MuiStepContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[t.root,l.last&&t.last]}})(({ownerState:e,theme:t})=>H({marginLeft:12,paddingLeft:20,paddingRight:8,borderLeft:t.vars?`1px solid ${t.vars.palette.StepContent.border}`:`1px solid ${t.palette.mode==="light"?t.palette.grey[400]:t.palette.grey[600]}`},e.last&&{borderLeft:"none"})),bt=le(Ze,{name:"MuiStepContent",slot:"Transition",overridesResolver:(e,t)=>t.transition})({}),jt=R.forwardRef(function(t,l){const s=Ae({props:t,name:"MuiStepContent"}),{children:n,className:d,TransitionComponent:i=Ze,transitionDuration:c="auto",TransitionProps:u}=s,h=ve(s,mt);R.useContext(z0);const{active:x,last:g,expanded:y}=R.useContext(y0),p=H({},s,{last:g}),a=vt(p);let m=c;return c==="auto"&&!i.muiSupportAuto&&(m=void 0),o.jsx(gt,H({className:Oe(a.root,d),ref:l,ownerState:p},h,{children:o.jsx(bt,H({as:i,in:x||y,className:a.transition,ownerState:p,timeout:m,unmountOnExit:!0},u,{children:n}))}))}),wt=jt;var b1={},Rt=Pe;Object.defineProperty(b1,"__esModule",{value:!0});var S0=b1.default=void 0,Ct=Rt(Le()),yt=o;S0=b1.default=(0,Ct.default)((0,yt.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var j1={},zt=Pe;Object.defineProperty(j1,"__esModule",{value:!0});var M0=j1.default=void 0,kt=zt(Le()),St=o;M0=j1.default=(0,kt.default)((0,St.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Ce({size:e,...t}){return o.jsx(z,{display:"flex",mt:4,...t,children:o.jsx(Ke,{size:e})})}Ce.propTypes={size:f.number};Ce.defaultProps={size:24};function w1({did:e,projectId:t,title:l,logo:s,describe:n}){const i=`${`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${t}/logo/upload`}/${s}`,[c,u]=R.useState(!1),h=$e(x=>x.breakpoints.down("md"));return o.jsxs(z,{sx:{display:"flex",flexDirection:"row",color:c?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[o.jsx(w0,{sx:{borderRadius:1},src:i}),o.jsxs(z,{children:[o.jsx(me,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:h?"primary.main":""},children:l||"/"}),o.jsx(me,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:h||c?"primary.main":"grey.700"},children:n||"/"})]})]})}w1.propTypes={projectId:f.string.isRequired,did:f.string.isRequired,title:f.string.isRequired,logo:f.string.isRequired,describe:f.string.isRequired};function R1({initUrl:e}){const t=u1(),l=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:s,locale:n}=te(),{api:d}=Re(),{api:i}=t1(),[c,u]=R.useState(!0),{blocklet:h}=Te(),[x,g]=R.useState(null),[y,p]=R.useState(!1),a=$e(M=>M.breakpoints.down("xl")),{componentDid:m=""}=e1(),[w,v]=R.useState(null),C=()=>{d.getProjects({input:{did:h.meta.did,componentDid:m,tenantScope:l}}).then(M=>{const P=(M==null?void 0:M.projects)||[];u(!1),v(P)}).catch(M=>{u(!1),$.error(M.message)})},k=()=>{t(`${K.UNOWNED_DID}/create/none`,{replace:!0})},N=M=>{g(M)},T=()=>{u(!1),p(!0)},L=()=>{p(!1),g(null)},S=M=>{$.error(M.message),p(!1),g(null)},F=M=>{if(!(M!=null&&M.deleted)){$.error("Delete project failed");return}C(),p(!1),g(null)};if(R.useEffect(()=>{C()},[]),!w&&c)return o.jsx(z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:o.jsx(Ce,{})});if(!w)return null;if(!w.length)return o.jsxs(z,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[o.jsx(z,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:s("blocklet.publish.blockletEmptyTip")}),o.jsx(z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:s("blocklet.publish.createBlockletTip")}),o.jsx(Xe,{onClick:k,variant:"contained",children:s("blocklet.publish.createBlocklet")})]});const V=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:M=>{const P=w[M];return o.jsx(ue,{to:`${P.id}`,children:o.jsx(w1,{did:h.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:M=>M?o.jsx(j0,{type:"success",children:M}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:M=>M?o.jsx(K1,{size:14,compact:!0,responsive:!1,did:M}):null}},a||m?null:{label:s("common.createdBy"),name:"createdBy",options:{customBodyRender:M=>M?o.jsx(K1,{onClick:()=>{t(`/.well-known/service/admin/members?did=${M}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:M}):null}},a||m?null:{label:s("common.scope"),name:"componentDid",options:{customBodyRender:M=>{const P=(h.children||[]).find(O=>O.meta.did===M);return P?o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(m1,{size:14,blocklet:P,ancestors:[h]}),o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},M):""}}},a||l?null:{label:s("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:M=>o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:o.jsx(me,{children:M})})}},{label:s("common.updatedAt"),name:"updatedAt",options:{customBodyRender:M=>o.jsx(f0,{value:Number(M),locale:n})}},{label:s("common.actions"),name:"actions",options:{customBodyRenderLite:M=>{const P=w[M];return o.jsxs(z,{display:"flex",children:[o.jsx(ue,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:o.jsx(xe,{title:s("blocklet.publish.createRelease"),placement:"top",children:o.jsx(ae,{color:"primary","aria-label":"create",children:o.jsx(v2,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&o.jsx(xe,{title:s("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:o.jsx(ae,{color:"secondary","aria-label":"create",children:o.jsx(ue,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:o.jsx(S0,{sx:{fontSize:18}})})})}),o.jsx(xe,{title:s("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:o.jsx(ae,{color:"primary","aria-label":"delete",onClick:()=>N(P),children:o.jsx(b0,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),I=y?o.jsx(Z0,{open:!0,popup:!0,onClose:L,action:"check-has-project-id",locale:n,checkFn:i.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:F,onError:S,extraParams:{projectId:x.id,did:h.meta.did,name:x.blockletTitle},messages:{title:s("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:s("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:s("blocklet.publish.deleteProject.confirm"),success:s("blocklet.publish.deleteProject.success")}}):null;return o.jsxs(Mt,{children:[o.jsxs(z,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[o.jsxs(z,{display:"flex",flexDirection:"row",alignItems:"center",children:[o.jsx(z,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("common.blockletStudio")}),o.jsx(xe,{title:s("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:o.jsx(M0,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),o.jsxs(Xe,{onClick:k,variant:"contained",children:[o.jsx(h1,{style:{fontSize:"1.3em",marginRight:4}}),s("blocklet.publish.createBlocklet")]})]}),o.jsx(z,{mt:3}),o.jsx(f1,{className:"main-table",locale:n,data:w,columns:V,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&o.jsx(x1,{title:`${s("common.delete")} ${x.blockletTitle}`,description:s("blocklet.publish.deleteProject.description"),confirm:s("common.confirm"),onConfirm:T,onCancel:()=>g(null),children:o.jsx(z,{sx:{marginTop:2},children:[s("blocklet.publish.deleteProject.tip1"),s("blocklet.publish.deleteProject.tip2"),s("blocklet.publish.deleteProject.tip3")].map(M=>o.jsxs(z,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[o.jsx(g2,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),o.jsx(Q,{component:"span",variant:"inherit",color:"text.secondary",children:M})]}))})}),I]})}R1.propTypes={initUrl:f.object};R1.defaultProps={initUrl:null};const Mt=ce(z)`
|
|
3
3
|
.main-table > div:first-child {
|
|
4
4
|
display: none;
|
|
5
5
|
}
|
|
@@ -133,7 +133,7 @@ import{ao as Q0,j as o,aD as le,cK as p0,aG as H,fl as q1,aF as ve,aB as Be,aC a
|
|
|
133
133
|
background: #fff;
|
|
134
134
|
z-index: 10;
|
|
135
135
|
}
|
|
136
|
-
`,B0=({fromBlocklet:e,nodeInfo:t,blocklet:l,userDid:s})=>{var i,c;const n=e?(i=l==null?void 0:l.meta)==null?void 0:i.did:t==null?void 0:t.did;let d=e?((c=l==null?void 0:l.settings)==null?void 0:c.storeList)||[]:(t==null?void 0:t.blockletRegistryList)||[];return d=d.filter(u=>u.protected||!u.scope||u.scope==="studio"||u.scope===s),{teamDid:n,storeList:d}};function N1({blocklet:e,store:t,onChangeStore:l,onClick:s,disabled:n,loading:d,componentDid:i}){var P,O,B;const{t:c}=te(),{session:u}=t1(),{api:h,info:x,inService:g}=Re(),y=Te(),[p,a]=R.useState(!1),m=R.useRef(null),[w,v]=R.useState(!1),[C,k]=R.useState(null),N=E=>{l(E),a(!1)},T=()=>{a(!0)},L=E=>{m.current&&m.current.contains(E.target)||a(!1)},S=()=>{v(!0)},F=()=>{v(!1)},V=async()=>{var E;if(C)try{await h.deleteBlockletStore({input:{teamDid:e.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await((E=y==null?void 0:y.actions)==null?void 0:E.refreshBlocklet())}catch(W){$.error(`Remove Blocklet Store Error: ${Ie(W)}`)}finally{k(null)}},{storeList:I}=B0({fromBlocklet:g,blocklet:e,nodeInfo:x,componentDid:i,userDid:(P=u==null?void 0:u.user)==null?void 0:P.did}),M=(O=e==null?void 0:e.meta)==null?void 0:O.did;return o.jsxs(o.Fragment,{children:[o.jsxs(D2,{disabled:n,ref:m,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[o.jsxs(ie,{onClick:s,children:[d&&o.jsx(Ke,{size:14,sx:{mr:.5}}),`${c("common.connect")} ${(t==null?void 0:t.name)||""}`]}),o.jsx(ie,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:o.jsx(L2,{})})]}),o.jsx(n2,{sx:{zIndex:10},open:p,anchorEl:m.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:E})=>o.jsx(i2,{...E,style:{transformOrigin:"center top"},children:o.jsx(v0,{children:o.jsx(a2,{onClickAway:L,children:o.jsxs(c2,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto"},children:[I.map(W=>{var X;return o.jsxs(W1,{selected:W.id===t.id,sx:{height:56},onClick:()=>N(W),children:[o.jsxs(z,{children:[o.jsx(me,{sx:{fontSize:"16px"},maxLength:24,children:W.name}),o.jsx(me,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:W.url})]}),P2({store:W,userDid:(X=u==null?void 0:u.user)==null?void 0:X.did})&&o.jsx(ae,{sx:{ml:1},onClick:G=>{G.preventDefault(),G.stopPropagation(),k(W)},children:o.jsx(Je,{icon:"ic:outline-delete"})})]},W.url)}),o.jsx(d2,{}),o.jsxs(W1,{onClick:S,children:[o.jsx(h1,{font:!0}),o.jsx(Q,{variant:"inherit",children:c("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&o.jsx(C0,{hiddenChildren:!0,open:!0,onClose:F,teamDid:M,storeList:I,scope:"studio",onAdd:(B=y==null?void 0:y.actions)==null?void 0:B.refreshBlocklet}),C&&o.jsx(x1,{displayError:!0,title:`${c("common.delete")} ${C.name}`,description:c("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:c("common.confirm"),onConfirm:V,onCancel:()=>k(null)})]})}N1.propTypes={store:f.object,blocklet:f.object,onChangeStore:f.func.isRequired,onClick:f.func.isRequired,loading:f.bool.isRequired,disabled:f.bool.isRequired,componentDid:f.string.isRequired,projectType:f.string.isRequired,getData:f.func.isRequired};N1.defaultProps={store:null,blocklet:null};const s1={};async function E0(e,{interval:t=1e3,maxDuration:l=120*1e3,intervalFirst:s=4e3,timerKey:n=""}){s1[n]&&clearTimeout(s1[n]),await new Promise(c=>setTimeout(c,s));const d=Date.now(),i=async(c,u)=>{try{const h=await e();c(h)}catch(h){Date.now()-d>l?u(h):n?s1[n]=setTimeout(()=>i(c,u),t):setTimeout(()=>i(c,u),t)}};return new Promise(i)}function Ol(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Hl(e,{did:t,projectId:l,messageId:s}){return E0(async()=>{var d;const n=await e.getProject({input:{did:t,projectId:l,messageId:s}});if(!((d=n==null?void 0:n.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return n.project.blockletDid},{timerKey:"connect-studio"})}function $l(e,{did:t,projectId:l,storeId:s}){return E0(async()=>{var i,c;const n=await e.getProject({input:{did:t,projectId:l,messageId:""}});if(!((c=(i=n==null?void 0:n.project)==null?void 0:i.connectedStores)!=null&&c.length))throw new Error("Connected store not found");if(!n.project.connectedStores.find(u=>u.storeId===s))throw new Error("Connected store not found")},{timerKey:`connect-store-${s}`})}const r0="lastWantToConnectStoreId";function Fl(e){var c,u;const[t,l]=R.useState(null),{session:s}=t1(),n=R.useCallback(h=>{l(h),localStorage.setItem(r0,h==null?void 0:h.id)},[l]),d=R.useMemo(()=>{var g,y;const h=localStorage.getItem(r0),x=h?(((g=e==null?void 0:e.settings)==null?void 0:g.storeList)||[]).find(p=>p.id===h):null;return x||(((y=e==null?void 0:e.settings)==null?void 0:y.storeList)||[]).find(p=>{var a;return!(p.id!==K.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==((a=s==null?void 0:s.user)==null?void 0:a.did))})},[(c=e==null?void 0:e.settings)==null?void 0:c.storeList,(u=s==null?void 0:s.user)==null?void 0:u.did]);return[t||d,n]}const s0=[".webp",".jpg",".jpeg",".png",".gif",".svg"],n0=1024*1024*10,i0=R.lazy(()=>g0(()=>import("./react-hphslfgR.js").then(e=>e.r),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])).then(e=>({default:e.Uploader})));function A0({projectId:e,readOnly:t,loading:l,blocklet:s,params:n,setParams:d,paramsErrTip:i,setParamsErrTip:c,setLoading:u,initUrl:h,initLogoUrl:x,setInitLogoUrl:g,componentDid:y}){const{t:p}=te(),{api:a}=Re(),m=u1(),w=R.useRef(null),v=R.useRef(null),[C,k]=Fl(s),N=T2({messageType:"connect-store-message",onOpen:()=>u(!0),onClose:()=>u(!1)}),T=async P=>{const O=setTimeout(()=>{u(!1)},2e4),B=await Hl(a,P);u(!1),clearTimeout(O),window.parent.postMessage({event:"studioDialog.connected",componentDid:y},"*"),m(window.location.pathname.replace(`${K.UNOWNED_DID}/create`,`${B}/create`),{replace:!0})},L=()=>{if(!n.blockletTitle){$.error(p("blocklet.publish.errorTip.noTitle"));return}if(!C){$.error("No store found");return}const P=Ol();N(async(O,B)=>{var E,W,X;try{const G=await a.connectByStudio({input:{did:(E=s==null?void 0:s.meta)==null?void 0:E.did,blockletTitle:n==null?void 0:n.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((W=n==null?void 0:n.blockletComponents)==null?void 0:W.length)>0?"pack":"resource",componentDid:y,messageId:P,tenantScope:(h==null?void 0:h.searchParams.get("tenantScope"))||""}});if(!(G!=null&&G.url)){$.error("failed to connect to store");return}B(G.url),T({did:(X=s==null?void 0:s.meta)==null?void 0:X.did,projectId:"",messageId:P})}catch(G){const oe=Ie(G);$.error(oe),u(!1)}})},S=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${s.meta.did}/${e}/logo/upload`,F=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${s.meta.did}/${e}/screenshot/upload`,V=n!=null&&n.blockletLogo?`${S}/${n.blockletLogo}`:`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,I=((n==null?void 0:n.blockletScreenshots)||[]).filter(Boolean).map(P=>`${F}/${P}`),M=()=>t?!1:!e||e===K.UNOWNED_DID?($.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0;return o.jsxs(ql,{children:[o.jsx(z,{display:"flex",className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Me,{disabled:l||t,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:n.blockletTitle||"",onChange:P=>{c({blockletTitle:""}),d({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),o.jsx(Me,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===K.UNOWNED_DID&&o.jsx(g1,{position:"end",children:o.jsx(N1,{blocklet:s,store:C,componentDid:y,onChangeStore:k,disabled:!n.blockletTitle||t||l,loading:l,onClick:L})})},error:!!i.projectId,helperText:i.projectId||"",value:e===K.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),o.jsx(Me,{disabled:l||t,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:t},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:n.blockletDescription||"",onChange:P=>{c({blockletDescription:""}),d({blockletDescription:P.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}})]})}),o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsxs(z,{sx:{flex:1},children:[o.jsxs(z,{display:"flex",children:[o.jsx(Q,{variant:"subtitle1",sx:{mr:2},children:p("common.logo")}),o.jsx(z,{sx:{flex:1,cursor:t?"default":"pointer"},children:o.jsx(w0,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:x||V,onClick:()=>{M()&&w.current.open()}})})]}),o.jsxs(z,{display:"flex",mt:3,children:[o.jsx(Q,{variant:"subtitle1",sx:{mr:2},children:p("common.screenshot")}),o.jsxs(z,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[I.map((P,O)=>o.jsxs(z,{className:"screenshot",children:[o.jsx("img",{alt:"screenshot",src:P}),!t&&o.jsx(ae,{className:"action",onClick:()=>{d(B=>{const E=[...B.blockletScreenshots];return E.splice(O,1),{...B,blockletScreenshots:E}})},children:o.jsx(I2,{})})]},P)),I.length<5&&o.jsx(z,{sx:{width:200,height:140,background:"#eee",cursor:t?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{M()&&v.current.open()},children:"+"})]})]})]})}),o.jsxs(R.Suspense,{fallback:o.jsx(Ce,{}),children:[o.jsx(i0,{ref:w,popup:!0,onUploadFinish:P=>{d({blockletLogo:P.data.filename}),g(""),w.current.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:s0,maxFileSize:n0,maxNumberOfFiles:1}}},"uploader-logo"),o.jsx(i0,{ref:v,popup:!0,onUploadFinish:P=>{d(O=>{var E;const B=O.blockletScreenshots||[];return B.push((E=P.data)==null?void 0:E.filename),{...O,blockletScreenshots:B}}),v.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:F,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:s0,maxFileSize:n0,maxNumberOfFiles:5-I.length}}},"uploader-screenshot")]})]})}A0.propTypes={projectId:f.string.isRequired,readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,loading:f.bool.isRequired,blocklet:f.object.isRequired,setLoading:f.func.isRequired,initUrl:f.object.isRequired,componentDid:f.isRequired,initLogoUrl:f.string.isRequired,setInitLogoUrl:f.func.isRequired};const ql=ce.div`
|
|
136
|
+
`,B0=({fromBlocklet:e,nodeInfo:t,blocklet:l,userDid:s})=>{var i,c;const n=e?(i=l==null?void 0:l.meta)==null?void 0:i.did:t==null?void 0:t.did;let d=e?((c=l==null?void 0:l.settings)==null?void 0:c.storeList)||[]:(t==null?void 0:t.blockletRegistryList)||[];return d=d.filter(u=>u.protected||!u.scope||u.scope==="studio"||u.scope===s),{teamDid:n,storeList:d}};function N1({blocklet:e,store:t,onChangeStore:l,onClick:s,disabled:n,loading:d,componentDid:i}){var P,O,B;const{t:c}=te(),{session:u}=t1(),{api:h,info:x,inService:g}=Re(),y=Te(),[p,a]=R.useState(!1),m=R.useRef(null),[w,v]=R.useState(!1),[C,k]=R.useState(null),N=E=>{l(E),a(!1)},T=()=>{a(!0)},L=E=>{m.current&&m.current.contains(E.target)||a(!1)},S=()=>{v(!0)},F=()=>{v(!1)},V=async()=>{var E;if(C)try{await h.deleteBlockletStore({input:{teamDid:e.meta.did,url:C.url,projectId:"",scope:C.scope||"studio"}}),await((E=y==null?void 0:y.actions)==null?void 0:E.refreshBlocklet())}catch(W){$.error(`Remove Blocklet Store Error: ${Ie(W)}`)}finally{k(null)}},{storeList:I}=B0({fromBlocklet:g,blocklet:e,nodeInfo:x,componentDid:i,userDid:(P=u==null?void 0:u.user)==null?void 0:P.did}),M=(O=e==null?void 0:e.meta)==null?void 0:O.did;return o.jsxs(o.Fragment,{children:[o.jsxs(D2,{disabled:n,ref:m,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[o.jsxs(ie,{onClick:s,children:[d&&o.jsx(Ke,{size:14,sx:{mr:.5}}),`${c("common.connect")} ${(t==null?void 0:t.name)||""}`]}),o.jsx(ie,{size:"small","aria-controls":p?"split-button-menu":void 0,"aria-expanded":p?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:T,children:o.jsx(L2,{})})]}),o.jsx(n2,{sx:{zIndex:10},open:p,anchorEl:m.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:E})=>o.jsx(i2,{...E,style:{transformOrigin:"center top"},children:o.jsx(v0,{children:o.jsx(a2,{onClickAway:L,children:o.jsxs(c2,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto"},children:[I.map(W=>{var X;return o.jsxs(W1,{selected:W.id===t.id,sx:{height:56},onClick:()=>N(W),children:[o.jsxs(z,{children:[o.jsx(me,{sx:{fontSize:"16px"},maxLength:24,children:W.name}),o.jsx(me,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:W.url})]}),P2({store:W,userDid:(X=u==null?void 0:u.user)==null?void 0:X.did})&&o.jsx(ae,{sx:{ml:1},onClick:G=>{G.preventDefault(),G.stopPropagation(),k(W)},children:o.jsx(Je,{icon:"ic:outline-delete"})})]},W.url)}),o.jsx(d2,{}),o.jsxs(W1,{onClick:S,children:[o.jsx(h1,{font:!0}),o.jsx(Q,{variant:"inherit",children:c("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&o.jsx(C0,{hiddenChildren:!0,open:!0,onClose:F,teamDid:M,storeList:I,scope:"studio",onAdd:(B=y==null?void 0:y.actions)==null?void 0:B.refreshBlocklet}),C&&o.jsx(x1,{displayError:!0,title:`${c("common.delete")} ${C.name}`,description:c("blocklet.publish.deleteStoreTip",{name:C.name}),confirm:c("common.confirm"),onConfirm:V,onCancel:()=>k(null)})]})}N1.propTypes={store:f.object,blocklet:f.object,onChangeStore:f.func.isRequired,onClick:f.func.isRequired,loading:f.bool.isRequired,disabled:f.bool.isRequired,componentDid:f.string.isRequired,projectType:f.string.isRequired,getData:f.func.isRequired};N1.defaultProps={store:null,blocklet:null};const s1={};async function E0(e,{interval:t=1e3,maxDuration:l=120*1e3,intervalFirst:s=4e3,timerKey:n=""}){s1[n]&&clearTimeout(s1[n]),await new Promise(c=>setTimeout(c,s));const d=Date.now(),i=async(c,u)=>{try{const h=await e();c(h)}catch(h){Date.now()-d>l?u(h):n?s1[n]=setTimeout(()=>i(c,u),t):setTimeout(()=>i(c,u),t)}};return new Promise(i)}function Ol(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Hl(e,{did:t,projectId:l,messageId:s}){return E0(async()=>{var d;const n=await e.getProject({input:{did:t,projectId:l,messageId:s}});if(!((d=n==null?void 0:n.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return n.project.blockletDid},{timerKey:"connect-studio"})}function $l(e,{did:t,projectId:l,storeId:s}){return E0(async()=>{var i,c;const n=await e.getProject({input:{did:t,projectId:l,messageId:""}});if(!((c=(i=n==null?void 0:n.project)==null?void 0:i.connectedStores)!=null&&c.length))throw new Error("Connected store not found");if(!n.project.connectedStores.find(u=>u.storeId===s))throw new Error("Connected store not found")},{timerKey:`connect-store-${s}`})}const r0="lastWantToConnectStoreId";function Fl(e){var c,u;const[t,l]=R.useState(null),{session:s}=t1(),n=R.useCallback(h=>{l(h),localStorage.setItem(r0,h==null?void 0:h.id)},[l]),d=R.useMemo(()=>{var g,y;const h=localStorage.getItem(r0),x=h?(((g=e==null?void 0:e.settings)==null?void 0:g.storeList)||[]).find(p=>p.id===h):null;return x||(((y=e==null?void 0:e.settings)==null?void 0:y.storeList)||[]).find(p=>{var a;return!(p.id!==K.BLOCKLET_STORE.id||p.scope&&p.scope!=="studio"&&p.scope!==((a=s==null?void 0:s.user)==null?void 0:a.did))})},[(c=e==null?void 0:e.settings)==null?void 0:c.storeList,(u=s==null?void 0:s.user)==null?void 0:u.did]);return[t||d,n]}const s0=[".webp",".jpg",".jpeg",".png",".gif",".svg"],n0=1024*1024*10,i0=R.lazy(()=>g0(()=>import("./react-BCD8bUpK.js").then(e=>e.r),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])).then(e=>({default:e.Uploader})));function A0({projectId:e,readOnly:t,loading:l,blocklet:s,params:n,setParams:d,paramsErrTip:i,setParamsErrTip:c,setLoading:u,initUrl:h,initLogoUrl:x,setInitLogoUrl:g,componentDid:y}){const{t:p}=te(),{api:a}=Re(),m=u1(),w=R.useRef(null),v=R.useRef(null),[C,k]=Fl(s),N=T2({messageType:"connect-store-message",onOpen:()=>u(!0),onClose:()=>u(!1)}),T=async P=>{const O=setTimeout(()=>{u(!1)},2e4),B=await Hl(a,P);u(!1),clearTimeout(O),window.parent.postMessage({event:"studioDialog.connected",componentDid:y},"*"),m(window.location.pathname.replace(`${K.UNOWNED_DID}/create`,`${B}/create`),{replace:!0})},L=()=>{if(!n.blockletTitle){$.error(p("blocklet.publish.errorTip.noTitle"));return}if(!C){$.error("No store found");return}const P=Ol();N(async(O,B)=>{var E,W,X;try{const G=await a.connectByStudio({input:{did:(E=s==null?void 0:s.meta)==null?void 0:E.did,blockletTitle:n==null?void 0:n.blockletTitle,storeUrl:C.url,storeId:C.id,storeName:C.name,type:((W=n==null?void 0:n.blockletComponents)==null?void 0:W.length)>0?"pack":"resource",componentDid:y,messageId:P,tenantScope:(h==null?void 0:h.searchParams.get("tenantScope"))||""}});if(!(G!=null&&G.url)){$.error("failed to connect to store");return}B(G.url),T({did:(X=s==null?void 0:s.meta)==null?void 0:X.did,projectId:"",messageId:P})}catch(G){const oe=Ie(G);$.error(oe),u(!1)}})},S=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${s.meta.did}/${e}/logo/upload`,F=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${s.meta.did}/${e}/screenshot/upload`,V=n!=null&&n.blockletLogo?`${S}/${n.blockletLogo}`:`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,I=((n==null?void 0:n.blockletScreenshots)||[]).filter(Boolean).map(P=>`${F}/${P}`),M=()=>t?!1:!e||e===K.UNOWNED_DID?($.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0;return o.jsxs(ql,{children:[o.jsx(z,{display:"flex",className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Me,{disabled:l||t,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:n.blockletTitle||"",onChange:P=>{c({blockletTitle:""}),d({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),o.jsx(Me,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===K.UNOWNED_DID&&o.jsx(g1,{position:"end",children:o.jsx(N1,{blocklet:s,store:C,componentDid:y,onChangeStore:k,disabled:!n.blockletTitle||t||l,loading:l,onClick:L})})},error:!!i.projectId,helperText:i.projectId||"",value:e===K.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),o.jsx(Me,{disabled:l||t,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:t},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:n.blockletDescription||"",onChange:P=>{c({blockletDescription:""}),d({blockletDescription:P.target.value})},error:!!i.blockletDescription,helperText:i.blockletDescription||"",sx:{mt:3}})]})}),o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsxs(z,{sx:{flex:1},children:[o.jsxs(z,{display:"flex",children:[o.jsx(Q,{variant:"subtitle1",sx:{mr:2},children:p("common.logo")}),o.jsx(z,{sx:{flex:1,cursor:t?"default":"pointer"},children:o.jsx(w0,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:x||V,onClick:()=>{M()&&w.current.open()}})})]}),o.jsxs(z,{display:"flex",mt:3,children:[o.jsx(Q,{variant:"subtitle1",sx:{mr:2},children:p("common.screenshot")}),o.jsxs(z,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap"},children:[I.map((P,O)=>o.jsxs(z,{className:"screenshot",children:[o.jsx("img",{alt:"screenshot",src:P}),!t&&o.jsx(ae,{className:"action",onClick:()=>{d(B=>{const E=[...B.blockletScreenshots];return E.splice(O,1),{...B,blockletScreenshots:E}})},children:o.jsx(I2,{})})]},P)),I.length<5&&o.jsx(z,{sx:{width:200,height:140,background:"#eee",cursor:t?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{M()&&v.current.open()},children:"+"})]})]})]})}),o.jsxs(R.Suspense,{fallback:o.jsx(Ce,{}),children:[o.jsx(i0,{ref:w,popup:!0,onUploadFinish:P=>{d({blockletLogo:P.data.filename}),g(""),w.current.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:S,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:s0,maxFileSize:n0,maxNumberOfFiles:1}}},"uploader-logo"),o.jsx(i0,{ref:v,popup:!0,onUploadFinish:P=>{d(O=>{var E;const B=O.blockletScreenshots||[];return B.push((E=P.data)==null?void 0:E.filename),{...O,blockletScreenshots:B}}),v.current.close()},plugins:["ImageEditor"],apiPathProps:{uploader:F,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:s0,maxFileSize:n0,maxNumberOfFiles:5-I.length}}},"uploader-screenshot")]})]})}A0.propTypes={projectId:f.string.isRequired,readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,loading:f.bool.isRequired,blocklet:f.object.isRequired,setLoading:f.func.isRequired,initUrl:f.object.isRequired,componentDid:f.isRequired,initLogoUrl:f.string.isRequired,setInitLogoUrl:f.func.isRequired};const ql=ce.div`
|
|
137
137
|
margin-top: 24px;
|
|
138
138
|
.screenshot {
|
|
139
139
|
margin-bottom: 16px;
|
|
@@ -164,7 +164,7 @@ import{ao as Q0,j as o,aD as le,cK as p0,aG as H,fl as q1,aF as ve,aB as Be,aC a
|
|
|
164
164
|
width: 100%; /* 图像宽度填充容器 */
|
|
165
165
|
height: auto; /* 图像高度自适应 */
|
|
166
166
|
}
|
|
167
|
-
`;var V1={},Ul=Pe;Object.defineProperty(V1,"__esModule",{value:!0});var O0=V1.default=void 0,Wl=Ul(Le()),Gl=o;O0=V1.default=(0,Wl.default)((0,Gl.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Kl=(e,t,l,s)=>{const n=[...e],d=((t==null?void 0:t.children)||[]).reduce((i,c)=>(i[c.meta.did]=!0,i),{});return Object.keys(l).forEach(i=>{if(!d[i])return;let c=!1;s||n.forEach(u=>{u.did===i&&(u.included=!0,u.required=!0,c=!0)}),c||n.push({did:i,included:!0,required:!0})}),n},Xl=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const t=e.split("/").pop().split("?")[0],s=await(await fetch(e)).blob();return new File([s],t,{type:s.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Jl(e,t){let l=0;for(;l<e.size;)yield e.slice(l,l+t),l+=t}const Ql=async({did:e,projectId:t,uploadType:l="logo",imageUrl:s})=>{const n=await Xl(s);new FormData().append("file",n);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(n.name),name:encodeURIComponent(n.name),type:n.type},u=(await G1.post(pe(K.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",e,t,l,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":n.size,"X-Uploader-File-Ext":n.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(y=>`${y} ${btoa(i[y])}`).join(",")}})).headers.location,h=2*1024*1024;let x=0,g="";for(const y of Jl(n,h)){const p=await G1.patch(pe(K.WELLKNOWN_SERVICE_PATH_PREFIX,u),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=y.size,g=p.data.filename}return g},H0=({params:e,hasSelectedResources:t,projectId:l,status:s,t:n})=>{const d=[];return e.blockletTitle||d.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),(!l||l===K.UNOWNED_DID)&&d.push({param:"projectId",message:n("blocklet.publish.errorTip.noDid")}),!e.uploadedResource&&!t&&d.push({param:"blockletResource",message:n("blocklet.publish.errorTip.noResource")}),e.blockletVersion?Se.valid(e.blockletVersion)||d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.inValidVersion")}):d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),s===je.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||d.push({param:"blockletDescription",message:n("blocklet.publish.errorTip.noDescription")}),e.note||d.push({param:"note",message:n("blocklet.publish.errorTip.noNote")})),d.length?d:null},Yl=({params:e,hasSelectedResources:t,step:l,t:s,projectId:n})=>{if(l===0){if(!e.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!n||n===K.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(l===2&&!e.uploadedResource&&!t)return s("blocklet.publish.errorTip.noResource");if(l>=4){if(!e.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!Se.valid(e.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!e.note)return s("blocklet.publish.errorTip.noNote")}return""};function D1({blocklet:e,releaseId:t,connectedStores:l,projectId:s,releaseType:n,publishedStoreIds:d,onPublish:i,onDelete:c,projectType:u,componentDid:h,onOpenConnectStore:x,behavior:g,onSelectConnectStore:y}){var k,N;const{t:p}=te(),{actions:{refreshBlocklet:a}}=Te(),{session:m}=t1(),{storeList:w}=B0({fromBlocklet:!0,blocklet:e,componentDid:h,userDid:(k=m==null?void 0:m.user)==null?void 0:k.did}),v=R.useMemo(()=>l!=null&&l.length?l==null?void 0:l.reduce((T,L)=>(T[L.storeId]=L,T),{}):{},[l]),C=(N=e==null?void 0:e.meta)==null?void 0:N.did;return o.jsxs(o.Fragment,{children:[g==="connect"&&!!(w!=null&&w.length)&&o.jsx(R0,{severity:"info",style:{width:"100%"},children:o.jsxs(z,{color:b2[400],component:"a",href:u==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[p(u==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),o.jsx(B2,{sx:{marginLeft:1}})]})}),o.jsx(u2,{children:w==null?void 0:w.map(T=>o.jsx(E2,{"data-cy":"store-switch",children:o.jsx(A2,{children:o.jsx(N2,{behavior:g,onSelectConnectStore:y,releaseId:t,projectId:s,releaseType:n,kind:"publish",teamDid:C,store:T,published:(d==null?void 0:d.indexOf(T.id))>-1,connectedStore:v[T.id],onPublish:i,onDelete:c,scope:T.scope||"studio",onOpenConnectStore:x})})},T.url))}),o.jsx(C0,{teamDid:C,storeList:w,scope:"studio",onAdd:a})]})}D1.propTypes={blocklet:f.object.isRequired,projectId:f.string.isRequired,releaseId:f.string.isRequired,releaseType:f.string.isRequired,onPublish:f.func,onDelete:f.func,publishedStoreIds:f.arrayOf(f.string),connectedStores:f.arrayOf(f.object).isRequired,projectType:f.string,componentDid:f.string,onOpenConnectStore:f.func,onSelectConnectStore:f.func,behavior:f.string};D1.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};var u0;const n1=(u0=window.env)==null?void 0:u0.serverEndpoint;function $0({projectId:e,params:t,setParamsErrTip:l,initUrl:s,setParams:n,mode:d,loading:i,blocklet:c,release:u,isPublished:h,releaseId:x,getData:g,getRelease:y,componentDid:p,resourceRelateComponents:a,disabledSelectComponents:m,saveSelectedEventsRef:w,hasSelectedResources:v,initLogoUrl:C,setLoading:k,releaseUsedLast:N,setReleaseUsedLast:T,projectType:L}){var se;const{t:S,locale:F}=te(),{api:V}=Re(),I=u1(),[M,P]=R.useState(!1),[O,B]=R.useState(),E=$e(q=>q.breakpoints.down("md")),W=((se=t==null?void 0:t.blockletComponents)==null?void 0:se.length)>0?"pack":"resource",X=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:p},"*"),y()},G=async q=>{var he,Y,ne;const J=H0({params:t,hasSelectedResources:v,projectId:e,status:q,t:S});if(J){$.error(J.map(A=>A.message).join("; ")),l(J.reduce((A,ee)=>({...A,[ee.param]:ee.message}),{}));return}const U={...t};if(U.blockletComponents=Kl(U.blockletComponents,c,a,m),U.blockletVersion=Se.valid(U.blockletVersion),!U.blockletVersion){$.error("Invalid Blocklet Version"),l({blockletVersion:"Invalid Blocklet Version"});return}if(C)try{const A=await Ql({did:c.meta.did,projectId:e,imageUrl:C});U.blockletLogo=A,n({blockletLogo:A})}catch(A){$.error(A.message);return}if(t.resourceFromSelect){U.uploadedResource="";try{const A=Object.keys(w.current);await Qe(A.map(ee=>()=>{const Ve=w.current[ee];return Bl({api:V,locale:F,projectId:e,releaseId:N?"":x,appDid:c.meta.did,component:Ve.component,resources:Ve.resources,initUrl:s})}),{concurrency:2})}catch(A){$.error(((ne=(Y=(he=A==null?void 0:A.response)==null?void 0:he.data)==null?void 0:Y.error)==null?void 0:ne.message)||A.message),l({blockletResource:"Invalid save the resource"});return}}else U.blockletComponents=[];U.blockletTitle=(U.blockletTitle||"").trim(),U.blockletDescription=(U.blockletDescription||"").trim(),U.blockletIntroduction=(U.blockletIntroduction||"").trim(),U.note=(U.note||"").trim(),U.blockletComponents=((U==null?void 0:U.blockletComponents)||[]).filter(A=>A.included).map(A=>p1(A,["did","required"])).map(JSON.stringify);try{await V.createRelease({input:{...U,did:c.meta.did,projectId:e,releaseId:N?"":x,status:q}}),q==="draft"?$.success(S("blocklet.publish.saveDraftSuccess")):(T(!1),$.success(S("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:p},"*")),l({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(A){const ee=Ie(A);$.error(ee),(/resource/.test(ee)||/zip/.test(ee))&&l({blockletResource:ee})}const de=await V.getProject({input:{did:c.meta.did,projectId:e}}),Z=de.project.lastReleaseId;await Qe(de.project.connectedStores.map(A=>async()=>{try{const ee=await V.publishToStore({input:{did:c.meta.did,storeId:A.storeId,storeName:A.storeName,projectId:e,releaseId:Z,type:W}});$.success(o.jsx(V2,{storeName:A.storeName,storeUrl:A.storeUrl,developerDid:A.developerDid,published:ee.url==="published"}),{duration:1e4})}catch(ee){$.error(Ie(ee))}}),{concurrency:4}),X==null||X(),I(`../${e}/view/${Z}`,{replace:!0})},oe=q=>(k(!0),G(q).finally(()=>{k(!1)})),ye=async q=>{await $l(V,q),g()};let re=null;if(h&&n1){const q=pe(n1,`/api/project/${c.meta.did}/${e}/${x}/release/blocklet.json`);if(L==="pack"){const J=new URL(n1);J.pathname=pe(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",q),re=E?o.jsx(ae,{component:"a",href:J.href,target:"_blank",rel:"noreferrer",color:"primary",sx:{mr:1},onClick:()=>B(q),children:o.jsx(Je,{icon:"ic:baseline-install-desktop"})}):o.jsx(ie,{href:J.href,target:"_blank",rel:"noreferrer",variant:"outlined",sx:{mr:1},onClick:()=>B(q),children:S("common.install")})}else re=o.jsxs(o.Fragment,{children:[E?o.jsx(ae,{disabled:i,color:"primary",sx:{mr:1},onClick:()=>B(q),children:o.jsx(Je,{icon:"ic:baseline-install-desktop"})}):o.jsx(ie,{disabled:i,variant:"outlined",sx:{mr:1},onClick:()=>B(q),children:S("blocklet.publish.copyInstallUrl")}),o.jsx(p2,{fullWidth:!0,maxWidth:"sm",open:O,onClose:()=>B(""),children:o.jsxs(z,{sx:{py:5,px:4,wordBreak:"break-all"},children:[o.jsx(Q,{variant:"h6",sx:{mb:2},children:S("blocklet.publish.installResourceTip")}),o.jsx(_2,{children:O}),o.jsxs(Q,{sx:{mt:2},children:[S("blocklet.publish.installResourceTip2"),o.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:S("blocklet.publish.installResourceHelp")})]})]})})]})}return o.jsxs(o.Fragment,{children:[o.jsx(Zl,{className:"sticky-header",children:o.jsxs(z,{display:"flex",alignItems:"center",flexDirection:"row",children:[o.jsxs(k0,{className:"breadcrumbs","aria-label":"breadcrumb",children:[o.jsx(ue,{to:"../",children:S("common.blockletStudio")}),e===K.UNOWNED_DID?o.jsx(Q,{color:"text.primary",children:o.jsx(me,{maxLength:E?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}):o.jsx(ue,{to:`../${e}`,children:o.jsx(me,{maxLength:E?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}),o.jsx(Q,{color:"text.primary",children:d==="create"?S("common.create"):(t==null?void 0:t.blockletVersion)||S("common.edit")})]}),o.jsx(z,{flex:"1"}),!h&&o.jsxs(ie,{variant:"contained",disabled:i,style:{marginRight:12},onClick:()=>oe(je.PROJECT.RELEASE_STATUS.published),children:[i&&o.jsx(Ke,{size:14,sx:{mr:.5},color:"inherit"}),S("blocklet.publish.createRelease")]}),h&&o.jsxs(o.Fragment,{children:[re,E?null:o.jsx(ie,{component:"a",disabled:i,href:pe(`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${c.meta.did}/${e}/${x}/download/${(u.files||[])[0]}`),variant:"outlined",sx:{mr:1},children:S("common.download")}),o.jsxs(ie,{disabled:i,variant:"contained",onClick:()=>P(!0),children:[i?o.jsx(Ke,{size:14,sx:{mr:1},color:"inherit"}):o.jsx(O0,{sx:{fontSize:"1.3em",mr:1}}),S(E?"common.upload":"blocklet.publish.connectOrUpload")]})]})]})}),o.jsx(h2,{title:S("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:M,onClose:()=>P(!1),children:o.jsx(D1,{projectType:L,blocklet:c,releaseType:W,projectId:e,releaseId:x,componentDid:p,onPublish:X,onOpenConnectStore:ye,onDelete:g,connectedStores:t.connectedStores||[],publishedStoreIds:u==null?void 0:u.publishedStoreIds})})]})}$0.propTypes={projectId:f.string.isRequired,params:f.object.isRequired,mode:f.string.isRequired,loading:f.bool.isRequired,blocklet:f.object.isRequired,release:f.object.isRequired,isPublished:f.bool.isRequired,releaseId:f.string.isRequired,getData:f.func.isRequired,getRelease:f.func.isRequired,componentDid:f.string.isRequired,resourceRelateComponents:f.object.isRequired,disabledSelectComponents:f.bool.isRequired,saveSelectedEventsRef:f.object.isRequired,hasSelectedResources:f.bool.isRequired,initLogoUrl:f.string.isRequired,setLoading:f.func.isRequired,releaseUsedLast:f.bool.isRequired,setReleaseUsedLast:f.func.isRequired,projectType:f.string.isRequired,setParamsErrTip:f.func.isRequired,setParams:f.func.isRequired,initUrl:f.object.isRequired};const Zl=ce.div`
|
|
167
|
+
`;var V1={},Ul=Pe;Object.defineProperty(V1,"__esModule",{value:!0});var O0=V1.default=void 0,Wl=Ul(Le()),Gl=o;O0=V1.default=(0,Wl.default)((0,Gl.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Kl=(e,t,l,s)=>{const n=e?[...e]:[],d=((t==null?void 0:t.children)||[]).reduce((i,c)=>(i[c.meta.did]=!0,i),{});return Object.keys(l).forEach(i=>{if(!d[i])return;let c=!1;s||n.forEach(u=>{u.did===i&&(u.included=!0,u.required=!0,c=!0)}),c||n.push({did:i,included:!0,required:!0})}),n},Xl=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const t=e.split("/").pop().split("?")[0],s=await(await fetch(e)).blob();return new File([s],t,{type:s.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Jl(e,t){let l=0;for(;l<e.size;)yield e.slice(l,l+t),l+=t}const Ql=async({did:e,projectId:t,uploadType:l="logo",imageUrl:s})=>{const n=await Xl(s);new FormData().append("file",n);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(n.name),name:encodeURIComponent(n.name),type:n.type},u=(await G1.post(pe(K.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",e,t,l,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":n.size,"X-Uploader-File-Ext":n.name.split(".").pop(),"Upload-Metadata":Object.keys(i).map(y=>`${y} ${btoa(i[y])}`).join(",")}})).headers.location,h=2*1024*1024;let x=0,g="";for(const y of Jl(n,h)){const p=await G1.patch(pe(K.WELLKNOWN_SERVICE_PATH_PREFIX,u),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=y.size,g=p.data.filename}return g},H0=({params:e,hasSelectedResources:t,projectId:l,status:s,t:n})=>{const d=[];return e.blockletTitle||d.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),(!l||l===K.UNOWNED_DID)&&d.push({param:"projectId",message:n("blocklet.publish.errorTip.noDid")}),!e.uploadedResource&&!t&&d.push({param:"blockletResource",message:n("blocklet.publish.errorTip.noResource")}),e.blockletVersion?Se.valid(e.blockletVersion)||d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.inValidVersion")}):d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),s===je.PROJECT.RELEASE_STATUS.published&&(e.blockletDescription||d.push({param:"blockletDescription",message:n("blocklet.publish.errorTip.noDescription")}),e.note||d.push({param:"note",message:n("blocklet.publish.errorTip.noNote")})),d.length?d:null},Yl=({params:e,hasSelectedResources:t,step:l,t:s,projectId:n})=>{if(l===0){if(!e.blockletTitle)return s("blocklet.publish.errorTip.noTitle");if(!n||n===K.UNOWNED_DID)return s("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return s("blocklet.publish.errorTip.noDescription")}if(l===2&&!e.uploadedResource&&!t)return s("blocklet.publish.errorTip.noResource");if(l>=4){if(!e.blockletVersion)return s("blocklet.publish.errorTip.noVersion");if(!Se.valid(e.blockletVersion))return s("blocklet.publish.errorTip.inValidVersion");if(!e.note)return s("blocklet.publish.errorTip.noNote")}return""};function D1({blocklet:e,releaseId:t,connectedStores:l,projectId:s,releaseType:n,publishedStoreIds:d,onPublish:i,onDelete:c,projectType:u,componentDid:h,onOpenConnectStore:x,behavior:g,onSelectConnectStore:y}){var k,N;const{t:p}=te(),{actions:{refreshBlocklet:a}}=Te(),{session:m}=t1(),{storeList:w}=B0({fromBlocklet:!0,blocklet:e,componentDid:h,userDid:(k=m==null?void 0:m.user)==null?void 0:k.did}),v=R.useMemo(()=>l!=null&&l.length?l==null?void 0:l.reduce((T,L)=>(T[L.storeId]=L,T),{}):{},[l]),C=(N=e==null?void 0:e.meta)==null?void 0:N.did;return o.jsxs(o.Fragment,{children:[g==="connect"&&!!(w!=null&&w.length)&&o.jsx(R0,{severity:"info",style:{width:"100%"},children:o.jsxs(z,{color:b2[400],component:"a",href:u==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[p(u==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),o.jsx(B2,{sx:{marginLeft:1}})]})}),o.jsx(u2,{children:w==null?void 0:w.map(T=>o.jsx(E2,{"data-cy":"store-switch",children:o.jsx(A2,{children:o.jsx(N2,{behavior:g,onSelectConnectStore:y,releaseId:t,projectId:s,releaseType:n,kind:"publish",teamDid:C,store:T,published:(d==null?void 0:d.indexOf(T.id))>-1,connectedStore:v[T.id],onPublish:i,onDelete:c,scope:T.scope||"studio",onOpenConnectStore:x})})},T.url))}),o.jsx(C0,{teamDid:C,storeList:w,scope:"studio",onAdd:a})]})}D1.propTypes={blocklet:f.object.isRequired,projectId:f.string.isRequired,releaseId:f.string.isRequired,releaseType:f.string.isRequired,onPublish:f.func,onDelete:f.func,publishedStoreIds:f.arrayOf(f.string),connectedStores:f.arrayOf(f.object).isRequired,projectType:f.string,componentDid:f.string,onOpenConnectStore:f.func,onSelectConnectStore:f.func,behavior:f.string};D1.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};var u0;const n1=(u0=window.env)==null?void 0:u0.serverEndpoint;function $0({projectId:e,params:t,setParamsErrTip:l,initUrl:s,setParams:n,mode:d,loading:i,blocklet:c,release:u,isPublished:h,releaseId:x,getData:g,getRelease:y,componentDid:p,resourceRelateComponents:a,disabledSelectComponents:m,saveSelectedEventsRef:w,hasSelectedResources:v,initLogoUrl:C,setLoading:k,releaseUsedLast:N,setReleaseUsedLast:T,projectType:L}){var se;const{t:S,locale:F}=te(),{api:V}=Re(),I=u1(),[M,P]=R.useState(!1),[O,B]=R.useState(),E=$e(q=>q.breakpoints.down("md")),W=((se=t==null?void 0:t.blockletComponents)==null?void 0:se.length)>0?"pack":"resource",X=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:p},"*"),y()},G=async q=>{var he,Y,ne;const J=H0({params:t,hasSelectedResources:v,projectId:e,status:q,t:S});if(J){$.error(J.map(A=>A.message).join("; ")),l(J.reduce((A,ee)=>({...A,[ee.param]:ee.message}),{}));return}const U={...t};if(U.blockletComponents=Kl(U.blockletComponents,c,a,m),U.blockletVersion=Se.valid(U.blockletVersion),!U.blockletVersion){$.error("Invalid Blocklet Version"),l({blockletVersion:"Invalid Blocklet Version"});return}if(C)try{const A=await Ql({did:c.meta.did,projectId:e,imageUrl:C});U.blockletLogo=A,n({blockletLogo:A})}catch(A){$.error(A.message);return}if(t.resourceFromSelect){U.uploadedResource="";try{const A=Object.keys(w.current);await Qe(A.map(ee=>()=>{const Ve=w.current[ee];return Bl({api:V,locale:F,projectId:e,releaseId:N?"":x,appDid:c.meta.did,component:Ve.component,resources:Ve.resources,initUrl:s})}),{concurrency:2})}catch(A){$.error(((ne=(Y=(he=A==null?void 0:A.response)==null?void 0:he.data)==null?void 0:Y.error)==null?void 0:ne.message)||A.message),l({blockletResource:"Invalid save the resource"});return}}else U.blockletComponents=[];U.blockletTitle=(U.blockletTitle||"").trim(),U.blockletDescription=(U.blockletDescription||"").trim(),U.blockletIntroduction=(U.blockletIntroduction||"").trim(),U.note=(U.note||"").trim(),U.blockletComponents=((U==null?void 0:U.blockletComponents)||[]).filter(A=>A.included).map(A=>p1(A,["did","required"])).map(JSON.stringify);try{await V.createRelease({input:{...U,did:c.meta.did,projectId:e,releaseId:N?"":x,status:q}}),q==="draft"?$.success(S("blocklet.publish.saveDraftSuccess")):(T(!1),$.success(S("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:p},"*")),l({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(A){const ee=Ie(A);$.error(ee),(/resource/.test(ee)||/zip/.test(ee))&&l({blockletResource:ee})}const de=await V.getProject({input:{did:c.meta.did,projectId:e}}),Z=de.project.lastReleaseId;await Qe(de.project.connectedStores.map(A=>async()=>{try{const ee=await V.publishToStore({input:{did:c.meta.did,storeId:A.storeId,storeName:A.storeName,projectId:e,releaseId:Z,type:W}});$.success(o.jsx(V2,{storeName:A.storeName,storeUrl:A.storeUrl,developerDid:A.developerDid,published:ee.url==="published"}),{duration:1e4})}catch(ee){$.error(Ie(ee))}}),{concurrency:4}),X==null||X(),I(`../${e}/view/${Z}`,{replace:!0})},oe=q=>(k(!0),G(q).finally(()=>{k(!1)})),ye=async q=>{await $l(V,q),g()};let re=null;if(h&&n1){const q=pe(n1,`/api/project/${c.meta.did}/${e}/${x}/release/blocklet.json`);if(L==="pack"){const J=new URL(n1);J.pathname=pe(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",q),re=E?o.jsx(ae,{component:"a",href:J.href,target:"_blank",rel:"noreferrer",color:"primary",sx:{mr:1},onClick:()=>B(q),children:o.jsx(Je,{icon:"ic:baseline-install-desktop"})}):o.jsx(ie,{href:J.href,target:"_blank",rel:"noreferrer",variant:"outlined",sx:{mr:1},onClick:()=>B(q),children:S("common.install")})}else re=o.jsxs(o.Fragment,{children:[E?o.jsx(ae,{disabled:i,color:"primary",sx:{mr:1},onClick:()=>B(q),children:o.jsx(Je,{icon:"ic:baseline-install-desktop"})}):o.jsx(ie,{disabled:i,variant:"outlined",sx:{mr:1},onClick:()=>B(q),children:S("blocklet.publish.copyInstallUrl")}),o.jsx(p2,{fullWidth:!0,maxWidth:"sm",open:O,onClose:()=>B(""),children:o.jsxs(z,{sx:{py:5,px:4,wordBreak:"break-all"},children:[o.jsx(Q,{variant:"h6",sx:{mb:2},children:S("blocklet.publish.installResourceTip")}),o.jsx(_2,{children:O}),o.jsxs(Q,{sx:{mt:2},children:[S("blocklet.publish.installResourceTip2"),o.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:S("blocklet.publish.installResourceHelp")})]})]})})]})}return o.jsxs(o.Fragment,{children:[o.jsx(Zl,{className:"sticky-header",children:o.jsxs(z,{display:"flex",alignItems:"center",flexDirection:"row",children:[o.jsxs(k0,{className:"breadcrumbs","aria-label":"breadcrumb",children:[o.jsx(ue,{to:"../",children:S("common.blockletStudio")}),e===K.UNOWNED_DID?o.jsx(Q,{color:"text.primary",children:o.jsx(me,{maxLength:E?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}):o.jsx(ue,{to:`../${e}`,children:o.jsx(me,{maxLength:E?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}),o.jsx(Q,{color:"text.primary",children:d==="create"?S("common.create"):(t==null?void 0:t.blockletVersion)||S("common.edit")})]}),o.jsx(z,{flex:"1"}),!h&&o.jsxs(ie,{variant:"contained",disabled:i,style:{marginRight:12},onClick:()=>oe(je.PROJECT.RELEASE_STATUS.published),children:[i&&o.jsx(Ke,{size:14,sx:{mr:.5},color:"inherit"}),S("blocklet.publish.createRelease")]}),h&&o.jsxs(o.Fragment,{children:[re,E?null:o.jsx(ie,{component:"a",disabled:i,href:pe(`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${c.meta.did}/${e}/${x}/download/${(u.files||[])[0]}`),variant:"outlined",sx:{mr:1},children:S("common.download")}),o.jsxs(ie,{disabled:i,variant:"contained",onClick:()=>P(!0),children:[i?o.jsx(Ke,{size:14,sx:{mr:1},color:"inherit"}):o.jsx(O0,{sx:{fontSize:"1.3em",mr:1}}),S(E?"common.upload":"blocklet.publish.connectOrUpload")]})]})]})}),o.jsx(h2,{title:S("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:M,onClose:()=>P(!1),children:o.jsx(D1,{projectType:L,blocklet:c,releaseType:W,projectId:e,releaseId:x,componentDid:p,onPublish:X,onOpenConnectStore:ye,onDelete:g,connectedStores:t.connectedStores||[],publishedStoreIds:u==null?void 0:u.publishedStoreIds})})]})}$0.propTypes={projectId:f.string.isRequired,params:f.object.isRequired,mode:f.string.isRequired,loading:f.bool.isRequired,blocklet:f.object.isRequired,release:f.object.isRequired,isPublished:f.bool.isRequired,releaseId:f.string.isRequired,getData:f.func.isRequired,getRelease:f.func.isRequired,componentDid:f.string.isRequired,resourceRelateComponents:f.object.isRequired,disabledSelectComponents:f.bool.isRequired,saveSelectedEventsRef:f.object.isRequired,hasSelectedResources:f.bool.isRequired,initLogoUrl:f.string.isRequired,setLoading:f.func.isRequired,releaseUsedLast:f.bool.isRequired,setReleaseUsedLast:f.func.isRequired,projectType:f.string.isRequired,setParamsErrTip:f.func.isRequired,setParams:f.func.isRequired,initUrl:f.object.isRequired};const Zl=ce.div`
|
|
168
168
|
.sticky-header {
|
|
169
169
|
margin-top: -12px;
|
|
170
170
|
padding: 12px 0;
|
|
@@ -178,7 +178,7 @@ import{ao as Q0,j as o,aD as le,cK as p0,aG as H,fl as q1,aF as ve,aB as Be,aC a
|
|
|
178
178
|
padding-bottom: 12px;
|
|
179
179
|
border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
|
|
180
180
|
}
|
|
181
|
-
`;function F0({text:e}){return e?o.jsx(O2,{wrapperElement:{"data-color-mode":"light"},source:e,rehypePlugins:[[H2,{target:"_blank"}]]}):o.jsx(we,{Icon:Fe})}F0.propTypes={text:f.string.isRequired};function q0({params:e,setParams:t,paramsErrTip:l,loading:s,setParamsErrTip:n,readOnly:d}){var x;const{t:i}=te(),[c,u]=R.useState(d?"preview":"write"),h=(g,y)=>{u(y)};return o.jsxs(z,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[o.jsxs(z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[o.jsx(Q,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),o.jsxs(C2,{value:c,onChange:h,"aria-label":"wrapped label tabs example",children:[o.jsx(X1,{value:"write",label:"Write"}),o.jsx(X1,{value:"preview",label:"Preview"})]})]}),o.jsx(z,{display:c==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:o.jsx(Me,{disabled:s||d,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:o.jsxs(g1,{position:"end",children:[((x=e==null?void 0:e.blockletIntroduction)==null?void 0:x.length)||0," / ",je.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{n({blockletIntroduction:""}),t({blockletIntroduction:g.target.value.slice(0,je.PROJECT.MAX_INTRO_LENGTH)})},error:!!l.blockletIntroduction,helperText:l.blockletIntroduction||""})}),o.jsx(z,{display:c==="preview"?"block":"none",mt:3,children:o.jsx(F0,{text:e.blockletIntroduction||""})})]})}q0.propTypes={params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,readOnly:f.bool.isRequired,loading:f.bool.isRequired};var _1={},e3=Pe;Object.defineProperty(_1,"__esModule",{value:!0});var U0=_1.default=void 0,t3=e3(Le()),a0=o;U0=_1.default=(0,t3.default)([(0,a0.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,a0.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function B1({step:e,ok:t,active:l,error:s}){let n="grey.500",d=e+1;return t&&(d=o.jsx($2,{sx:{fontSize:18,margin:0},color:"white"})),s||!t&&l>e?(n="error.main",d=o.jsx(U0,{sx:{fontSize:18,margin:0},color:"white"})):l>=e&&(n="primary.main"),o.jsx(z,{width:24,height:24,bgcolor:n,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:d})}B1.propTypes={step:f.number,ok:f.bool,active:f.number,error:f.string};B1.defaultProps={step:0,ok:!1,active:0,error:""};function W0({steps:e,activeStep:t,setActiveStep:l,hasSelectedResources:s,params:n,loading:d,paramsErrTip:i,viewMode:c,projectId:u}){const{t:h}=te(),x=()=>{l(a=>a+1)},g=()=>{l(a=>a-1)},y=a=>a===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription):a===2?i==null?void 0:i.blockletResource:a>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=c||H0({hasSelectedResources:s,params:n,projectId:u,t:h})===null;return o.jsxs(z,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[o.jsx(q2,{activeStep:t,orientation:"vertical",children:e.map((a,m)=>{const w={},v=d||!Yl({hasSelectedResources:s,params:n,projectId:u,step:m,t:h}),C=d?"":y(m);return C&&(w.optional=o.jsx(Q,{variant:"caption",color:"error",children:C}),w.error=!0),o.jsxs(U2,{children:[o.jsx(ft,{icon:o.jsx(B1,{error:C,active:p?99:t,step:m,ok:v}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>l(m),...w,children:o.jsx(Q,{fontSize:"14px",fontWeight:"500",color:C||!v&&t>m?"error.main":"inherit",children:a.label})}),o.jsxs(wt,{children:[o.jsx(Q,{fontSize:12,children:a.description}),!p&&o.jsx(z,{sx:{mb:2},children:o.jsxs("div",{children:[m<e.length-1&&o.jsx(ie,{variant:"contained",onClick:x,sx:{mt:1,mr:1},disabled:C||!v,children:h("common.continue")}),m>0&&o.jsx(ie,{disabled:m===0,onClick:g,sx:{mt:1,mr:1},children:h("common.back")})]})})]})]},a.label)})}),t>=e.length-1&&o.jsx(v0,{square:!0,elevation:0,sx:{p:3},children:o.jsx(Q,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}W0.propTypes={steps:f.array.isRequired,activeStep:f.number.isRequired,setActiveStep:f.func.isRequired,params:f.object.isRequired,viewMode:f.string.isRequired,loading:f.bool.isRequired,projectId:f.string.isRequired,hasSelectedResources:f.bool.isRequired,paramsErrTip:f.shape({projectId:f.string,blockletVersion:f.string,blockletTitle:f.string,blockletDescription:f.string,note:f.string,blockletResource:f.string}).isRequired};const o3=[".zip",".gz"],l3=1024*1024*100,r3=R.lazy(()=>g0(()=>import("./react-hphslfgR.js").then(e=>e.r),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41])).then(e=>({default:e.Uploader})));function E1({app:e,projectId:t,readOnly:l,params:s,setParams:n,setParamsErrTip:d,error:i}){const{t:c}=te(),u=R.useRef(null),h=()=>l?!1:!t||t===K.UNOWNED_DID?($.error(c("blocklet.publish.errorTip.noFirstDid")),!1):!0,x=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${t}/resource/upload`;return o.jsxs(z,{sx:{mt:3},children:[o.jsx(Q,{gutterBottom:!0,children:c("blocklet.publish.resourceUpload")}),o.jsxs(z2,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:l?"default":"pointer"},children:[!!s.uploadedResource&&o.jsx(Q,{component:"a",href:`${x}/params.uploadedResource`,children:s.uploadedResource}),!l&&o.jsx(ie,{variant:"outlined",size:"small",onClick:()=>{var g;h()&&((g=u.current)==null||g.open())},children:s.uploadedResource?c("common.change"):c("common.upload")})]}),o.jsx(R.Suspense,{fallback:o.jsx(Ce,{}),children:o.jsx(r3,{ref:u,popup:!0,onUploadFinish:g=>{var y;n({uploadedResource:g.data.filename}),d({blockletResource:""}),(y=u.current)==null||y.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:x,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:o3,maxFileSize:l3,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&o.jsx(z,{color:"error.main",mt:1,fontSize:14,children:i})]})}E1.propTypes={app:f.object.isRequired,projectId:f.string.isRequired,readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,error:f.string.isRequired,setParamsErrTip:f.func.isRequired};E1.defaultProps={};function Ye({readOnly:e,params:t,setParams:l,paramsErrTip:s,setParamsErrTip:n,loading:d}){var c;const{t:i}=te();return o.jsx(z,{display:"flex",mt:3,className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Me,{required:!0,disabled:d||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:t.blockletVersion||"",onChange:u=>{n({blockletVersion:""}),l({blockletVersion:u.target.value})},error:!!s.blockletVersion,helperText:s.blockletVersion||""}),o.jsx(Me,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:o.jsxs(g1,{position:"end",children:[((c=t==null?void 0:t.note)==null?void 0:c.length)||0," / ",je.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:t.note||"",onChange:u=>{n({note:""}),l({note:u.target.value.slice(0,je.PROJECT.MAX_NOTE_LENGTH)})},error:!!s.note,helperText:s.note||"",sx:{mt:3}})]})})}Ye.propTypes={readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,loading:f.bool.isRequired};Ye.defaultProps={};const s3=({tabs:e,blocklet:t,ancestors:l=[]})=>{const s=t.meta.did;e.push({label:o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(m1,{size:24,blocklet:t,ancestors:l}),o.jsx(z,{ml:"4px",className:"text",children:o.jsx(z,{children:t.meta.title})})]},s),value:s})},c0=(e,t)=>{const l=p1(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","connectedStores","blockletComponents","lastReleaseId","uploadedResource","note"]);return l.blockletComponents?l.blockletComponents=l.blockletComponents.map(s=>({...s,included:!0})):l.blockletComponents=(t.children||[]).map(s=>({did:s.meta.did,included:!1,required:!1})),l.resourceFromSelect=!l.uploadedResource,l},n3={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},d0={branding:0,introduction:1,resources:2,blocklets:3,version:4};function A1({initUrl:e,...t}){var F1;const{projectId:l,mode:s,releaseId:n,componentDid:d=""}=e1(),{t:i}=te(),{blocklet:c}=Te(),[u,h]=ke({blockletScreenshots:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",resourceFromSelect:!0}),[x,g]=ke({}),[y,p]=R.useState(!1),[a,m]=ke(null),{api:w}=Re(),v=$e(D=>D.breakpoints.down("md")),[C,k]=R.useState({}),[N,T]=R.useState(!1),L=R.useRef({}),[S,F]=ke({}),[V,I]=R.useState(""),[M,P]=ke({}),O=e==null?void 0:e.searchParams.get("dependentComponentsMode"),B=O==="readonly",E=R.useMemo(()=>{const D={};return Object.keys(M).forEach(_=>{const be=M[_];be&&be.forEach(J0=>{D[J0]=!0})}),D},[M]),W=R.useCallback(D=>{B&&h({blockletComponents:[]}),P(D)},[B,P,h]),X=R.useCallback((...D)=>{F(...D),g({blockletResource:""})},[]),G=n==="none"?(u==null?void 0:u.lastReleaseId)||"":n,[oe,ye]=R.useState(s==="new-release"?4:0);R.useEffect(()=>{l&&g({projectId:""})},[l,g]);const re=R.useMemo(()=>{var D;return(D=u==null?void 0:u.blockletComponents)!=null&&D.some(_=>_.included)||Object.keys(E).length||u!=null&&u.uploadedResource?"pack":"resource"},[u==null?void 0:u.blockletComponents,u==null?void 0:u.uploadedResource,E]),se=[],q=((c==null?void 0:c.children)||[]).filter(D=>{var _;return(_=D.meta.resource)==null?void 0:_.exportApi}).filter(D=>!d||D.meta.did===d);q.forEach(D=>{s3({tabs:se,blocklet:D,t:i,ancestors:[c]})});const[J,U]=R.useState((F1=se[0])==null?void 0:F1.value),de=!N&&(a==null?void 0:a.status)==="published",Z=de,he=f2(()=>{if(!e)return;I(e.searchParams.get("logo")),h(_=>{var be;return{..._,blockletTitle:(_==null?void 0:_.blockletTitle)||e.searchParams.get("title"),blockletDescription:(_==null?void 0:_.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(_==null?void 0:_.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(be=_==null?void 0:_.blockletComponents)!=null&&be.length?_==null?void 0:_.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(_==null?void 0:_.note)||e.searchParams.get("note")||"No note"}});const D=e.searchParams.get("resources");try{const _=JSON.parse(D);k(_)}catch{}}),Y=async()=>{if(G)try{const D=await w.getRelease({input:{did:c.meta.did,projectId:l,releaseId:G}});if(p(!1),!D.release){$.error("Release not found");return}s!=="view"&&(D.release.note=""),h(_=>c0({..._,...D.release,blockletVersion:s==="create"||s==="new-release"?Se.inc(D.release.blockletVersion,"patch"):D.release.blockletVersion},c)),m(D.release)}catch(D){p(!1),$.error(Ie(D))}},ne=async()=>{if(l===K.UNOWNED_DID){h({blockletVersion:"1.0.0",blockletTitle:""});return}if(!l){$.error(i("blocklet.publish.errorTip.noDid"));return}try{const D=await w.getProject({input:{did:c.meta.did,projectId:l}});p(!1);const _=D.project||{};_.blockletVersion?(s==="create"||s==="new-release")&&Se.valid(_.blockletVersion)&&(_.blockletVersion=Se.inc(_.blockletVersion,"patch")):_.blockletVersion="1.0.0";const be=c0(_,c);h(be),_.lastReleaseId||he()}catch(D){p(!1),$.error(Ie(D))}},A=R.useCallback(async()=>{if(s==="view"){if(!G){$.error("Empty release id");return}await ne(),await Y();return}await ne(),G&&(T(!0),await Y())},[s,G]),ee=D=>{h({blockletComponents:D})};R.useEffect(()=>{A()},[A]),R.useEffect(()=>{l===K.UNOWNED_DID&&(s==="create"||s==="new-release")&&e&&he()},[l,e,s,he]);const Ve=R.useMemo(()=>!!Object.keys(S).find(D=>!!S[D].length),[S]);if(!u&&y)return o.jsx(Ce,{});if(!u)return null;const O1=q.find(D=>D.meta.did===J);if(q.every(D=>D.status!=="running")&&(q!=null&&q.length))return o.jsx(we,{children:i("blocklet.publish.allComponentsNotRunning")});const K0=D=>{U(D)},H1=e==null?void 0:e.searchParams.get("resourcesTitle"),$1=e==null?void 0:e.searchParams.get("componentsTitle"),ze=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:H1||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:$1||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],X0=ze[oe]||ze[ze.length-1],ge=n3[oe];return o.jsxs(i3,{...t,children:[o.jsx($0,{blocklet:c,release:a,getData:A,getRelease:Y,mode:s,params:u,setParams:h,setParamsErrTip:g,readOnly:Z,isPublished:de,loading:y,setLoading:p,initLogoUrl:V,releaseId:G,projectId:l,projectType:re,resourceComponents:q,resourceComponentsMap:M,resourceRelateComponents:E,resourceItem:O1,saveSelectedEventsRef:L,hasSelectedResources:Ve,releaseUsedLast:N,setReleaseUsedLast:T,setRelease:m}),o.jsxs(z,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[o.jsx(z,{pt:3}),o.jsxs(z,{sx:{gap:3},display:"flex",flexDirection:v?"column":"row",children:[!v&&o.jsx(W0,{steps:ze,viewMode:s==="view",params:u,hasSelectedResources:Ve||u.uploadedResource,paramsErrTip:x,activeStep:oe,setActiveStep:ye,projectId:l,resourcesUrlTitle:H1,componentsUrlTitle:$1}),o.jsxs(z,{flex:"1",maxWidth:"720px",children:[!v&&ge!=="introduction"&&o.jsxs(Q,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[X0.label,ge==="branding"&&o.jsx(xe,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:o.jsx(z,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:o.jsx(R2,{})})})]}),(v||ge==="branding")&&o.jsx(z,{flexDirection:"column",children:o.jsx(A0,{projectId:l,setParams:h,setParamsErrTip:g,params:u,componentDid:d,blocklet:c,initUrl:e,loading:y,setLoading:p,paramsErrTip:x,readOnly:Z,initLogoUrl:V,setInitLogoUrl:I})}),v&&o.jsx(z,{flexDirection:"column",children:o.jsx(Ye,{loading:y,params:u,paramsErrTip:x,setParams:h,setParamsErrTip:g,readOnly:Z})}),(v||ge==="introduction")&&o.jsx(z,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:o.jsx(q0,{loading:y,readOnly:Z,params:u,setParams:h,paramsErrTip:x,setParamsErrTip:g})}),v&&o.jsx(Q,{variant:"h6",fontWeight:"bold",mt:5,children:ze[d0.resources].label}),o.jsx(z,{display:v||ge==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsxs(z,{sx:{flex:1},children:[o.jsxs(W2,{onChange:()=>h({resourceFromSelect:!u.resourceFromSelect}),children:[o.jsx(a1,{value:"select",disabled:Z,control:o.jsx(J1,{size:"small",checked:u.resourceFromSelect}),label:i("blocklet.publish.resourceSelect")}),o.jsx(a1,{value:"select",disabled:Z,control:o.jsx(J1,{size:"small",checked:!u.resourceFromSelect}),label:i("blocklet.publish.resourceUpload")})]}),u.resourceFromSelect&&o.jsxs(o.Fragment,{children:[!d&&o.jsx(y2,{tabs:se,current:J,onChange:K0,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),o.jsx(T1,{loading:y,initialResources:C,saveSelectedEventsRef:L,selectedResourceIds:S,setSelectedResourceIds:X,setResourceComponentsMap:W,error:x.blockletResource,app:c,readOnly:Z,component:O1,componentDid:d,initUrl:e,params:u,setParams:h,projectId:l===K.UNOWNED_DID?"":l,releaseUsedLast:N,release:{...a,id:G}})]}),!u.resourceFromSelect&&o.jsx(E1,{app:c,readOnly:Z,projectId:l===K.UNOWNED_DID?"":l,params:u,error:x.blockletResource,setParams:h,setParamsErrTip:g})]})})}),v&&o.jsx(Q,{variant:"h6",fontWeight:"bold",mt:5,children:ze[d0.blocklets].label}),(v||ge==="blocklets")&&o.jsx(z,{flexDirection:"column",children:o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsx(z,{sx:{flex:1},children:o.jsx(z1,{projectType:re,disabled:y||Z,app:c,value:(u==null?void 0:u.blockletComponents)||[],onChange:ee,resourceRelateComponents:E,dependentComponentsMode:O})})})}),!v&&ge==="version"&&o.jsx(z,{flexDirection:"column",children:o.jsx(Ye,{loading:y,params:u,paramsErrTip:x,setParams:h,setParamsErrTip:g,readOnly:Z})})]})]})]})]})}A1.propTypes={initUrl:f.object};A1.defaultProps={initUrl:null};const i3=ce.div`
|
|
181
|
+
`;function F0({text:e}){return e?o.jsx(O2,{wrapperElement:{"data-color-mode":"light"},source:e,rehypePlugins:[[H2,{target:"_blank"}]]}):o.jsx(we,{Icon:Fe})}F0.propTypes={text:f.string.isRequired};function q0({params:e,setParams:t,paramsErrTip:l,loading:s,setParamsErrTip:n,readOnly:d}){var x;const{t:i}=te(),[c,u]=R.useState(d?"preview":"write"),h=(g,y)=>{u(y)};return o.jsxs(z,{sx:{border:"1px solid #fff",width:"100%",borderRadius:2},children:[o.jsxs(z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[o.jsx(Q,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),o.jsxs(C2,{value:c,onChange:h,"aria-label":"wrapped label tabs example",children:[o.jsx(X1,{value:"write",label:"Write"}),o.jsx(X1,{value:"preview",label:"Preview"})]})]}),o.jsx(z,{display:c==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:o.jsx(Me,{disabled:s||d,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:o.jsxs(g1,{position:"end",children:[((x=e==null?void 0:e.blockletIntroduction)==null?void 0:x.length)||0," / ",je.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:g=>{n({blockletIntroduction:""}),t({blockletIntroduction:g.target.value.slice(0,je.PROJECT.MAX_INTRO_LENGTH)})},error:!!l.blockletIntroduction,helperText:l.blockletIntroduction||""})}),o.jsx(z,{display:c==="preview"?"block":"none",mt:3,children:o.jsx(F0,{text:e.blockletIntroduction||""})})]})}q0.propTypes={params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,readOnly:f.bool.isRequired,loading:f.bool.isRequired};var _1={},e3=Pe;Object.defineProperty(_1,"__esModule",{value:!0});var U0=_1.default=void 0,t3=e3(Le()),a0=o;U0=_1.default=(0,t3.default)([(0,a0.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,a0.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function B1({step:e,ok:t,active:l,error:s}){let n="grey.500",d=e+1;return t&&(d=o.jsx($2,{sx:{fontSize:18,margin:0},color:"white"})),s||!t&&l>e?(n="error.main",d=o.jsx(U0,{sx:{fontSize:18,margin:0},color:"white"})):l>=e&&(n="primary.main"),o.jsx(z,{width:24,height:24,bgcolor:n,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:d})}B1.propTypes={step:f.number,ok:f.bool,active:f.number,error:f.string};B1.defaultProps={step:0,ok:!1,active:0,error:""};function W0({steps:e,activeStep:t,setActiveStep:l,hasSelectedResources:s,params:n,loading:d,paramsErrTip:i,viewMode:c,projectId:u}){const{t:h}=te(),x=()=>{l(a=>a+1)},g=()=>{l(a=>a-1)},y=a=>a===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription):a===2?i==null?void 0:i.blockletResource:a>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=c||H0({hasSelectedResources:s,params:n,projectId:u,t:h})===null;return o.jsxs(z,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[o.jsx(q2,{activeStep:t,orientation:"vertical",children:e.map((a,m)=>{const w={},v=d||!Yl({hasSelectedResources:s,params:n,projectId:u,step:m,t:h}),C=d?"":y(m);return C&&(w.optional=o.jsx(Q,{variant:"caption",color:"error",children:C}),w.error=!0),o.jsxs(U2,{children:[o.jsx(ft,{icon:o.jsx(B1,{error:C,active:p?99:t,step:m,ok:v}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>l(m),...w,children:o.jsx(Q,{fontSize:"14px",fontWeight:"500",color:C||!v&&t>m?"error.main":"inherit",children:a.label})}),o.jsxs(wt,{children:[o.jsx(Q,{fontSize:12,children:a.description}),!p&&o.jsx(z,{sx:{mb:2},children:o.jsxs("div",{children:[m<e.length-1&&o.jsx(ie,{variant:"contained",onClick:x,sx:{mt:1,mr:1},disabled:C||!v,children:h("common.continue")}),m>0&&o.jsx(ie,{disabled:m===0,onClick:g,sx:{mt:1,mr:1},children:h("common.back")})]})})]})]},a.label)})}),t>=e.length-1&&o.jsx(v0,{square:!0,elevation:0,sx:{p:3},children:o.jsx(Q,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}W0.propTypes={steps:f.array.isRequired,activeStep:f.number.isRequired,setActiveStep:f.func.isRequired,params:f.object.isRequired,viewMode:f.string.isRequired,loading:f.bool.isRequired,projectId:f.string.isRequired,hasSelectedResources:f.bool.isRequired,paramsErrTip:f.shape({projectId:f.string,blockletVersion:f.string,blockletTitle:f.string,blockletDescription:f.string,note:f.string,blockletResource:f.string}).isRequired};const o3=[".zip",".gz"],l3=1024*1024*100,r3=R.lazy(()=>g0(()=>import("./react-BCD8bUpK.js").then(e=>e.r),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])).then(e=>({default:e.Uploader})));function E1({app:e,projectId:t,readOnly:l,params:s,setParams:n,setParamsErrTip:d,error:i}){const{t:c}=te(),u=R.useRef(null),h=()=>l?!1:!t||t===K.UNOWNED_DID?($.error(c("blocklet.publish.errorTip.noFirstDid")),!1):!0,x=`${K.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${t}/resource/upload`;return o.jsxs(z,{sx:{mt:3},children:[o.jsx(Q,{gutterBottom:!0,children:c("blocklet.publish.resourceUpload")}),o.jsxs(z2,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:l?"default":"pointer"},children:[!!s.uploadedResource&&o.jsx(Q,{component:"a",href:`${x}/params.uploadedResource`,children:s.uploadedResource}),!l&&o.jsx(ie,{variant:"outlined",size:"small",onClick:()=>{var g;h()&&((g=u.current)==null||g.open())},children:s.uploadedResource?c("common.change"):c("common.upload")})]}),o.jsx(R.Suspense,{fallback:o.jsx(Ce,{}),children:o.jsx(r3,{ref:u,popup:!0,onUploadFinish:g=>{var y;n({uploadedResource:g.data.filename}),d({blockletResource:""}),(y=u.current)==null||y.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:x,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:o3,maxFileSize:l3,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&o.jsx(z,{color:"error.main",mt:1,fontSize:14,children:i})]})}E1.propTypes={app:f.object.isRequired,projectId:f.string.isRequired,readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,error:f.string.isRequired,setParamsErrTip:f.func.isRequired};E1.defaultProps={};function Ye({readOnly:e,params:t,setParams:l,paramsErrTip:s,setParamsErrTip:n,loading:d}){var c;const{t:i}=te();return o.jsx(z,{display:"flex",mt:3,className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Me,{required:!0,disabled:d||e,label:`Blocklet ${i("common.version")}`,placeholder:`Blocklet ${i("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:e},autoComplete:"off",variant:"outlined",fullWidth:!0,value:t.blockletVersion||"",onChange:u=>{n({blockletVersion:""}),l({blockletVersion:u.target.value})},error:!!s.blockletVersion,helperText:s.blockletVersion||""}),o.jsx(Me,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:o.jsxs(g1,{position:"end",children:[((c=t==null?void 0:t.note)==null?void 0:c.length)||0," / ",je.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:t.note||"",onChange:u=>{n({note:""}),l({note:u.target.value.slice(0,je.PROJECT.MAX_NOTE_LENGTH)})},error:!!s.note,helperText:s.note||"",sx:{mt:3}})]})})}Ye.propTypes={readOnly:f.bool.isRequired,params:f.object.isRequired,setParams:f.func.isRequired,paramsErrTip:f.object.isRequired,setParamsErrTip:f.func.isRequired,loading:f.bool.isRequired};Ye.defaultProps={};const s3=({tabs:e,blocklet:t,ancestors:l=[]})=>{const s=t.meta.did;e.push({label:o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(m1,{size:24,blocklet:t,ancestors:l}),o.jsx(z,{ml:"4px",className:"text",children:o.jsx(z,{children:t.meta.title})})]},s),value:s})},c0=(e,t)=>{const l=p1(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","connectedStores","blockletComponents","lastReleaseId","uploadedResource","note"]);return l.blockletComponents?l.blockletComponents=l.blockletComponents.map(s=>({...s,included:!0})):l.blockletComponents=(t.children||[]).map(s=>({did:s.meta.did,included:!1,required:!1})),l.resourceFromSelect=!l.uploadedResource,l},n3={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},d0={branding:0,introduction:1,resources:2,blocklets:3,version:4};function A1({initUrl:e,...t}){var F1;const{projectId:l,mode:s,releaseId:n,componentDid:d=""}=e1(),{t:i}=te(),{blocklet:c}=Te(),[u,h]=ke({blockletScreenshots:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",resourceFromSelect:!0}),[x,g]=ke({}),[y,p]=R.useState(!1),[a,m]=ke(null),{api:w}=Re(),v=$e(D=>D.breakpoints.down("md")),[C,k]=R.useState({}),[N,T]=R.useState(!1),L=R.useRef({}),[S,F]=ke({}),[V,I]=R.useState(""),[M,P]=ke({}),O=e==null?void 0:e.searchParams.get("dependentComponentsMode"),B=O==="readonly",E=R.useMemo(()=>{const D={};return Object.keys(M).forEach(_=>{const be=M[_];be&&be.forEach(J0=>{D[J0]=!0})}),D},[M]),W=R.useCallback(D=>{B&&h({blockletComponents:[]}),P(D)},[B,P,h]),X=R.useCallback((...D)=>{F(...D),g({blockletResource:""})},[]),G=n==="none"?(u==null?void 0:u.lastReleaseId)||"":n,[oe,ye]=R.useState(s==="new-release"?4:0);R.useEffect(()=>{l&&g({projectId:""})},[l,g]);const re=R.useMemo(()=>{var D;return(D=u==null?void 0:u.blockletComponents)!=null&&D.some(_=>_.included)||Object.keys(E).length||u!=null&&u.uploadedResource?"pack":"resource"},[u==null?void 0:u.blockletComponents,u==null?void 0:u.uploadedResource,E]),se=[],q=((c==null?void 0:c.children)||[]).filter(D=>{var _;return(_=D.meta.resource)==null?void 0:_.exportApi}).filter(D=>!d||D.meta.did===d);q.forEach(D=>{s3({tabs:se,blocklet:D,t:i,ancestors:[c]})});const[J,U]=R.useState((F1=se[0])==null?void 0:F1.value),de=!N&&(a==null?void 0:a.status)==="published",Z=de,he=f2(()=>{if(!e)return;I(e.searchParams.get("logo")),h(_=>{var be;return{..._,blockletTitle:(_==null?void 0:_.blockletTitle)||e.searchParams.get("title"),blockletDescription:(_==null?void 0:_.blockletDescription)||e.searchParams.get("description"),blockletIntroduction:(_==null?void 0:_.blockletIntroduction)||e.searchParams.get("introduction")||e.searchParams.get("description"),blockletComponents:(be=_==null?void 0:_.blockletComponents)!=null&&be.length?_==null?void 0:_.blockletComponents:JSON.parse(e.searchParams.get("components")||"[]"),note:(_==null?void 0:_.note)||e.searchParams.get("note")||"No note"}});const D=e.searchParams.get("resources");try{const _=JSON.parse(D);k(_)}catch{}}),Y=async()=>{if(G)try{const D=await w.getRelease({input:{did:c.meta.did,projectId:l,releaseId:G}});if(p(!1),!D.release){$.error("Release not found");return}s!=="view"&&(D.release.note=""),h(_=>c0({..._,...D.release,blockletVersion:s==="create"||s==="new-release"?Se.inc(D.release.blockletVersion,"patch"):D.release.blockletVersion},c)),m(D.release)}catch(D){p(!1),$.error(Ie(D))}},ne=async()=>{if(l===K.UNOWNED_DID){h({blockletVersion:"1.0.0",blockletTitle:""});return}if(!l){$.error(i("blocklet.publish.errorTip.noDid"));return}try{const D=await w.getProject({input:{did:c.meta.did,projectId:l}});p(!1);const _=D.project||{};_.blockletVersion?(s==="create"||s==="new-release")&&Se.valid(_.blockletVersion)&&(_.blockletVersion=Se.inc(_.blockletVersion,"patch")):_.blockletVersion="1.0.0";const be=c0(_,c);h(be),_.lastReleaseId||he()}catch(D){p(!1),$.error(Ie(D))}},A=R.useCallback(async()=>{if(s==="view"){if(!G){$.error("Empty release id");return}await ne(),await Y();return}await ne(),G&&(T(!0),await Y())},[s,G]),ee=D=>{h({blockletComponents:D})};R.useEffect(()=>{A()},[A]),R.useEffect(()=>{l===K.UNOWNED_DID&&(s==="create"||s==="new-release")&&e&&he()},[l,e,s,he]);const Ve=R.useMemo(()=>!!Object.keys(S).find(D=>!!S[D].length),[S]);if(!u&&y)return o.jsx(Ce,{});if(!u)return null;const O1=q.find(D=>D.meta.did===J);if(q.every(D=>D.status!=="running")&&(q!=null&&q.length))return o.jsx(we,{children:i("blocklet.publish.allComponentsNotRunning")});const K0=D=>{U(D)},H1=e==null?void 0:e.searchParams.get("resourcesTitle"),$1=e==null?void 0:e.searchParams.get("componentsTitle"),ze=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:H1||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:$1||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],X0=ze[oe]||ze[ze.length-1],ge=n3[oe];return o.jsxs(i3,{...t,children:[o.jsx($0,{blocklet:c,release:a,getData:A,getRelease:Y,mode:s,params:u,setParams:h,setParamsErrTip:g,readOnly:Z,isPublished:de,loading:y,setLoading:p,initLogoUrl:V,releaseId:G,projectId:l,projectType:re,resourceComponents:q,resourceComponentsMap:M,resourceRelateComponents:E,resourceItem:O1,saveSelectedEventsRef:L,hasSelectedResources:Ve,releaseUsedLast:N,setReleaseUsedLast:T,setRelease:m}),o.jsxs(z,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[o.jsx(z,{pt:3}),o.jsxs(z,{sx:{gap:3},display:"flex",flexDirection:v?"column":"row",children:[!v&&o.jsx(W0,{steps:ze,viewMode:s==="view",params:u,hasSelectedResources:Ve||u.uploadedResource,paramsErrTip:x,activeStep:oe,setActiveStep:ye,projectId:l,resourcesUrlTitle:H1,componentsUrlTitle:$1}),o.jsxs(z,{flex:"1",maxWidth:"720px",children:[!v&&ge!=="introduction"&&o.jsxs(Q,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[X0.label,ge==="branding"&&o.jsx(xe,{title:i("blocklet.publish.brandingHelp"),placement:"right",children:o.jsx(z,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:o.jsx(R2,{})})})]}),(v||ge==="branding")&&o.jsx(z,{flexDirection:"column",children:o.jsx(A0,{projectId:l,setParams:h,setParamsErrTip:g,params:u,componentDid:d,blocklet:c,initUrl:e,loading:y,setLoading:p,paramsErrTip:x,readOnly:Z,initLogoUrl:V,setInitLogoUrl:I})}),v&&o.jsx(z,{flexDirection:"column",children:o.jsx(Ye,{loading:y,params:u,paramsErrTip:x,setParams:h,setParamsErrTip:g,readOnly:Z})}),(v||ge==="introduction")&&o.jsx(z,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:o.jsx(q0,{loading:y,readOnly:Z,params:u,setParams:h,paramsErrTip:x,setParamsErrTip:g})}),v&&o.jsx(Q,{variant:"h6",fontWeight:"bold",mt:5,children:ze[d0.resources].label}),o.jsx(z,{display:v||ge==="resources"?"flex":"none",sx:{maxWidth:720},flexDirection:"column",children:o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsxs(z,{sx:{flex:1},children:[o.jsxs(W2,{onChange:()=>h({resourceFromSelect:!u.resourceFromSelect}),children:[o.jsx(a1,{value:"select",disabled:Z,control:o.jsx(J1,{size:"small",checked:u.resourceFromSelect}),label:i("blocklet.publish.resourceSelect")}),o.jsx(a1,{value:"select",disabled:Z,control:o.jsx(J1,{size:"small",checked:!u.resourceFromSelect}),label:i("blocklet.publish.resourceUpload")})]}),u.resourceFromSelect&&o.jsxs(o.Fragment,{children:[!d&&o.jsx(y2,{tabs:se,current:J,onChange:K0,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),o.jsx(T1,{loading:y,initialResources:C,saveSelectedEventsRef:L,selectedResourceIds:S,setSelectedResourceIds:X,setResourceComponentsMap:W,error:x.blockletResource,app:c,readOnly:Z,component:O1,componentDid:d,initUrl:e,params:u,setParams:h,projectId:l===K.UNOWNED_DID?"":l,releaseUsedLast:N,release:{...a,id:G}})]}),!u.resourceFromSelect&&o.jsx(E1,{app:c,readOnly:Z,projectId:l===K.UNOWNED_DID?"":l,params:u,error:x.blockletResource,setParams:h,setParamsErrTip:g})]})})}),v&&o.jsx(Q,{variant:"h6",fontWeight:"bold",mt:5,children:ze[d0.blocklets].label}),(v||ge==="blocklets")&&o.jsx(z,{flexDirection:"column",children:o.jsx(z,{display:"flex",mt:3,className:"section full-width",children:o.jsx(z,{sx:{flex:1},children:o.jsx(z1,{projectType:re,disabled:y||Z,app:c,value:(u==null?void 0:u.blockletComponents)||[],onChange:ee,resourceRelateComponents:E,dependentComponentsMode:O})})})}),!v&&ge==="version"&&o.jsx(z,{flexDirection:"column",children:o.jsx(Ye,{loading:y,params:u,paramsErrTip:x,setParams:h,setParamsErrTip:g,readOnly:Z})})]})]})]})]})}A1.propTypes={initUrl:f.object};A1.defaultProps={initUrl:null};const i3=ce.div`
|
|
182
182
|
.section {
|
|
183
183
|
&.full-width {
|
|
184
184
|
max-width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as re,j as n,aI as R,aJ as Me,de as no,d0 as ro,bh as ee,cN as to,df as ao,V as so,dg as io,dh as lo,
|
|
1
|
+
import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as re,j as n,aI as R,aJ as Me,de as no,d0 as ro,bh as ee,cN as to,df as ao,V as so,dg as io,dh as lo,_ as co,c2 as po,ao as se,P as r,X as ie,Y as le,br as y,ac as uo,ay as de,L as K,T as D,b as ho,az as Re,B as C,bs as xo,G as q,di as Ie,H as Te,$ as mo,O as Be,h as te,dj as fo,k as X,dk as go,dl as bo}from"./index-DJR5CVa4.js";import{T as vo}from"./Toolbar-DvnQ2GBJ.js";import{H as Le}from"./Hidden-DKCAPCvm.js";const ae={50:"#e0f2f1",100:"#b2dfdb",200:"#80cbc4",300:"#4db6ac",400:"#26a69a",500:"#009688",600:"#00897b",700:"#00796b",800:"#00695c",900:"#004d40",A100:"#a7ffeb",A200:"#64ffda",A400:"#1de9b6",A700:"#00bfa5"};function yo(e){return Pe("MuiAppBar",e)}ze("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const jo=["className","color","enableColorOnDark","position"],wo=e=>{const{color:o,position:t,classes:a}=e,l={root:["root",`color${_(o)}`,`position${_(t)}`]};return Me(l,yo,a)},J=(e,o)=>e?`${e==null?void 0:e.replace(")","")}, ${o})`:o,ko=Z(Ne,{name:"MuiAppBar",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:t}=e;return[o.root,o[`position${_(t.position)}`],o[`color${_(t.color)}`]]}})(({theme:e,ownerState:o})=>{const t=e.palette.mode==="light"?e.palette.grey[100]:e.palette.grey[900];return $({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0},o.position==="fixed"&&{position:"fixed",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}},o.position==="absolute"&&{position:"absolute",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0},o.position==="sticky"&&{position:"sticky",zIndex:(e.vars||e).zIndex.appBar,top:0,left:"auto",right:0},o.position==="static"&&{position:"static"},o.position==="relative"&&{position:"relative"},!e.vars&&$({},o.color==="default"&&{backgroundColor:t,color:e.palette.getContrastText(t)},o.color&&o.color!=="default"&&o.color!=="inherit"&&o.color!=="transparent"&&{backgroundColor:e.palette[o.color].main,color:e.palette[o.color].contrastText},o.color==="inherit"&&{color:"inherit"},e.palette.mode==="dark"&&!o.enableColorOnDark&&{backgroundColor:null,color:null},o.color==="transparent"&&$({backgroundColor:"transparent",color:"inherit"},e.palette.mode==="dark"&&{backgroundImage:"none"})),e.vars&&$({},o.color==="default"&&{"--AppBar-background":o.enableColorOnDark?e.vars.palette.AppBar.defaultBg:J(e.vars.palette.AppBar.darkBg,e.vars.palette.AppBar.defaultBg),"--AppBar-color":o.enableColorOnDark?e.vars.palette.text.primary:J(e.vars.palette.AppBar.darkColor,e.vars.palette.text.primary)},o.color&&!o.color.match(/^(default|inherit|transparent)$/)&&{"--AppBar-background":o.enableColorOnDark?e.vars.palette[o.color].main:J(e.vars.palette.AppBar.darkBg,e.vars.palette[o.color].main),"--AppBar-color":o.enableColorOnDark?e.vars.palette[o.color].contrastText:J(e.vars.palette.AppBar.darkColor,e.vars.palette[o.color].contrastText)},{backgroundColor:"var(--AppBar-background)",color:o.color==="inherit"?"inherit":"var(--AppBar-color)"},o.color==="transparent"&&{backgroundImage:"none",backgroundColor:"transparent",color:"inherit"}))}),$o=p.forwardRef(function(o,t){const a=Ce({props:o,name:"MuiAppBar"}),{className:l,color:c="primary",enableColorOnDark:d=!1,position:i="fixed"}=a,u=re(a,jo),s=$({},a,{color:c,position:i,enableColorOnDark:d}),x=wo(s);return n.jsx(ko,$({square:!0,component:"header",ownerState:s,elevation:4,className:R(x.root,l,i==="fixed"&&"mui-fixed"),ref:t},u))}),Po=$o;function zo(e){return Pe("MuiDrawer",e)}ze("MuiDrawer",["root","docked","paper","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const No=["BackdropProps"],Co=["anchor","BackdropProps","children","className","elevation","hideBackdrop","ModalProps","onClose","open","PaperProps","SlideProps","TransitionComponent","transitionDuration","variant"],Ae=(e,o)=>{const{ownerState:t}=e;return[o.root,(t.variant==="permanent"||t.variant==="persistent")&&o.docked,o.modal]},Mo=e=>{const{classes:o,anchor:t,variant:a}=e,l={root:["root"],docked:[(a==="permanent"||a==="persistent")&&"docked"],modal:["modal"],paper:["paper",`paperAnchor${_(t)}`,a!=="temporary"&&`paperAnchorDocked${_(t)}`]};return Me(l,zo,o)},Ro=Z(no,{name:"MuiDrawer",slot:"Root",overridesResolver:Ae})(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer})),ke=Z("div",{shouldForwardProp:ro,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:Ae})({flex:"0 0 auto"}),Io=Z(Ne,{name:"MuiDrawer",slot:"Paper",overridesResolver:(e,o)=>{const{ownerState:t}=e;return[o.paper,o[`paperAnchor${_(t.anchor)}`],t.variant!=="temporary"&&o[`paperAnchorDocked${_(t.anchor)}`]]}})(({theme:e,ownerState:o})=>$({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0},o.anchor==="left"&&{left:0},o.anchor==="top"&&{top:0,left:0,right:0,height:"auto",maxHeight:"100%"},o.anchor==="right"&&{right:0},o.anchor==="bottom"&&{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"},o.anchor==="left"&&o.variant!=="temporary"&&{borderRight:`1px solid ${(e.vars||e).palette.divider}`},o.anchor==="top"&&o.variant!=="temporary"&&{borderBottom:`1px solid ${(e.vars||e).palette.divider}`},o.anchor==="right"&&o.variant!=="temporary"&&{borderLeft:`1px solid ${(e.vars||e).palette.divider}`},o.anchor==="bottom"&&o.variant!=="temporary"&&{borderTop:`1px solid ${(e.vars||e).palette.divider}`})),De={left:"right",right:"left",top:"down",bottom:"up"};function To(e){return["left","right"].indexOf(e)!==-1}function Bo({direction:e},o){return e==="rtl"&&To(o)?De[o]:o}const Lo=p.forwardRef(function(o,t){const a=Ce({props:o,name:"MuiDrawer"}),l=ee(),c=to(),d={enter:l.transitions.duration.enteringScreen,exit:l.transitions.duration.leavingScreen},{anchor:i="left",BackdropProps:u,children:s,className:x,elevation:m=16,hideBackdrop:j=!1,ModalProps:{BackdropProps:w}={},onClose:P,open:b=!1,PaperProps:f={},SlideProps:z,TransitionComponent:M=ao,transitionDuration:L=d,variant:I="temporary"}=a,N=re(a.ModalProps,No),g=re(a,Co),k=p.useRef(!1);p.useEffect(()=>{k.current=!0},[]);const A=Bo({direction:c?"rtl":"ltr"},i),F=$({},a,{anchor:i,elevation:m,open:b,variant:I},g),T=Mo(F),h=n.jsx(Io,$({elevation:I==="temporary"?m:0,square:!0},f,{className:R(T.paper,f.className),ownerState:F,children:s}));if(I==="permanent")return n.jsx(ke,$({className:R(T.root,T.docked,x),ownerState:F,ref:t},g,{children:h}));const v=n.jsx(M,$({in:b,direction:De[A],timeout:L,appear:k.current},z,{children:h}));return I==="persistent"?n.jsx(ke,$({className:R(T.root,T.docked,x),ownerState:F,ref:t},g,{children:v})):n.jsx(Ro,$({BackdropProps:$({},u,w,{transitionDuration:L}),className:R(T.root,T.modal,x),open:b,ownerState:F,onClose:P,hideBackdrop:j,ref:t},g,N,{children:v}))}),_e=Lo;function Ao(e,o){var t,a=so(e),l=(t=o==null?void 0:o.wait)!==null&&t!==void 0?t:1e3,c=p.useMemo(function(){return io(function(){for(var d=[],i=0;i<arguments.length;i++)d[i]=arguments[i];return a.current.apply(a,lo([],co(d),!1))},l,o)},[]);return po(function(){c.cancel()}),{run:c,cancel:c.cancel,flush:c.flush}}const Do=se(n.jsx("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),_o=se(n.jsx("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu"),Fo=se(n.jsx("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"MoreHoriz"),Fe=p.createContext(),Oo=e=>{const o=p.useContext(Fe);return p.useLayoutEffect(()=>{e&&o.configure(e)},[]),o};function Oe({children:e,...o}){const[t,a]=p.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),l=()=>{a(d=>({...d,inFullPage:!d.inFullPage}))},c=p.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:l,configure:d=>a(i=>({...i,...d}))}),[t]);return n.jsx(Fe.Provider,{value:c,...o,children:e})}Oe.propTypes={children:r.node.isRequired};var ce={},Wo=le;Object.defineProperty(ce,"__esModule",{value:!0});var We=ce.default=void 0,Ho=Wo(ie()),Vo=n;We=ce.default=(0,Ho.default)((0,Vo.jsx)("path",{d:"M21 11V3h-8l3.29 3.29-10 10L3 13v8h8l-3.29-3.29 10-10z"}),"OpenInFull");var pe={},Eo=le;Object.defineProperty(pe,"__esModule",{value:!0});var He=pe.default=void 0,qo=Eo(ie()),Uo=n;He=pe.default=(0,qo.default)((0,Uo.jsx)("path",{d:"M22 3.41 16.71 8.7 20 12h-8V4l3.29 3.29L20.59 2zM3.41 22l5.29-5.29L12 20v-8H4l3.29 3.29L2 20.59z"}),"CloseFullscreen");function ue({name:e,size:o,alt:t,color:a,style:l,prefix:c,showBadge:d,...i}){const u=`${c}/${e}-${a.replace(/^#/,"")}.png`;return n.jsxs(So,{style:{width:o,height:o},children:[n.jsx(uo,{width:o,height:o,alt:t||e,src:u,style:Object.assign({width:o},l),...i}),d&&n.jsx("i",{className:"badge-point"})]})}ue.propTypes={name:r.string.isRequired,size:r.number,color:r.string,alt:r.string,style:r.object,prefix:r.string,showBadge:r.bool};ue.defaultProps={size:36,color:"#000000",alt:"",style:{},prefix:"/images",showBadge:!1};const So=y("div")`
|
|
2
2
|
position: relative;
|
|
3
3
|
.badge-point {
|
|
4
4
|
position: absolute;
|
|
@@ -142,7 +142,7 @@ import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as
|
|
|
142
142
|
display: block;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
`;function fe({children:e,brand:o,brandAddon:t,description:a,addons:l,onToggleMenu:c,homeUrl:d,logo:i,...u}){return n.jsx(Zo,{position:"sticky",className:"header",...u,children:n.jsxs(vo,{disableGutters:!1,className:"header-toolbar",children:[n.jsx(Re,{color:"inherit","aria-label":"open drawer",edge:"start",className:"header-menu","aira-label":"header menu button",onClick:c,children:n.jsx(me,{})}),n.jsxs(K,{to:d,className:"header-link",children:[n.jsx(Le,{mdDown:!0,children:n.jsx("div",{className:"header-logo",children:i||n.jsx(U,{showText:!1})})}),n.jsxs("div",{className:"header-title",children:[n.jsxs(D,{component:"h2",noWrap:!0,className:"header-title__primary",children:[o,t]}),n.jsx(D,{component:"p",noWrap:!0,className:"header-title__secondary",children:a})]})]}),n.jsx(C,{flexGrow:1}),!!e&&n.jsx("div",{className:"header-children",children:e}),n.jsx("div",{className:"header-addons",children:l})]})})}fe.propTypes={onToggleMenu:r.func.isRequired,brand:r.string.isRequired,brandAddon:r.object,description:r.any.isRequired,children:r.any,addons:r.any,homeUrl:r.string,logo:r.any};fe.defaultProps={children:null,addons:null,brandAddon:null,homeUrl:"/",logo:null};function
|
|
145
|
+
`;function fe({children:e,brand:o,brandAddon:t,description:a,addons:l,onToggleMenu:c,homeUrl:d,logo:i,...u}){return n.jsx(Zo,{position:"sticky",className:"header",...u,children:n.jsxs(vo,{disableGutters:!1,className:"header-toolbar",children:[n.jsx(Re,{color:"inherit","aria-label":"open drawer",edge:"start",className:"header-menu","aira-label":"header menu button",onClick:c,children:n.jsx(me,{})}),n.jsxs(K,{to:d,className:"header-link",children:[n.jsx(Le,{mdDown:!0,children:n.jsx("div",{className:"header-logo",children:i||n.jsx(U,{showText:!1})})}),n.jsxs("div",{className:"header-title",children:[n.jsxs(D,{component:"h2",noWrap:!0,className:"header-title__primary",children:[o,t]}),n.jsx(D,{component:"p",noWrap:!0,className:"header-title__secondary",children:a})]})]}),n.jsx(C,{flexGrow:1}),!!e&&n.jsx("div",{className:"header-children",children:e}),n.jsx("div",{className:"header-addons",children:l})]})})}fe.propTypes={onToggleMenu:r.func.isRequired,brand:r.string.isRequired,brandAddon:r.object,description:r.any.isRequired,children:r.any,addons:r.any,homeUrl:r.string,logo:r.any};fe.defaultProps={children:null,addons:null,brandAddon:null,homeUrl:"/",logo:null};function H(e){var m;const o=xo(e,H,["dark","style"]),{className:t,copyStart:a,style:l,brand:c,dark:d,addon:i}=o,u=`${new Date().getFullYear()}`,s=`${a}`,x=u===s?u:`${s}-${u}`;return n.jsxs(en,{className:t,style:l,dark:d,children:[n.jsx(q,{maxWidth:!1,children:n.jsxs(D,{component:"div",className:"footer",children:[n.jsxs(D,{component:"p",className:"footer-item",children:[n.jsxs("span",{className:"footer-copy",children:["Copyright © ",x," "]}),n.jsx("span",{className:"footer-brand",children:c})]}),i&&n.jsx(D,{component:"div",className:"footer-item",sx:{order:{xs:"-1",md:"initial"},ml:{xs:0,md:"auto"},width:{xs:"100%",md:"auto"}},children:i}),n.jsxs(D,{component:"p",className:"footer-item",style:{justifyContent:"flex-end",flexShrink:0},children:["Powered by",n.jsx(U,{mode:d?"light":"dark",layout:"horizontal",className:"logo-container"})]})]})}),n.jsx(C,{position:"absolute",right:16,bottom:0,fontSize:12,sx:{color:"transparent","::selection":{background:"#000",color:"#fff"}},children:(m=window==null?void 0:window.blocklet)==null?void 0:m.version})]})}H.propTypes={dark:r.bool,className:r.string,copyStart:r.oneOfType([r.string,r.number]),brand:r.string,style:r.object,addon:r.node};H.defaultProps={dark:!1,brand:"ArcBlock",copyStart:"2017",className:"",style:{},addon:null};const en=y("div",{shouldForwardProp:e=>e!=="dark"})`
|
|
146
146
|
position: relative;
|
|
147
147
|
margin-top: 64px;
|
|
148
148
|
padding: 24px 0 32px;
|
|
@@ -230,7 +230,7 @@ import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as
|
|
|
230
230
|
box-shadow: 2px 16px 10px 0 rgba(0, 0, 0, ${e=>e.theme.mode==="light"?.05:.5});
|
|
231
231
|
border: 0;
|
|
232
232
|
}
|
|
233
|
-
`;function ge({children:e,title:o,brand:t,description:a,brandAddon:l,headerAddon:c,images:d,links:i,prefix:u,fullWidth:s,contentLayout:x,className:m,homeUrl:j,logo:w,...P}){const f=Ie(document.body),z=(f==null?void 0:f.width)||0,[M,L]=p.useState(z>=960?"permanent":"temporary"),[I,N]=p.useState(M==="permanent");p.useEffect(()=>{const A=z>=960?"permanent":"temporary";L(A),N(A!=="temporary")},[z]);const g=()=>{N(!I)},k=s||x==="row";return n.jsxs(on,{className:`dashboard ${m}`,...P,children:[n.jsx(Te,{title:`${o}-${t}`}),n.jsx(fe,{className:"dashboard__header",onToggleMenu:g,brand:t,brandAddon:l,description:a,addons:c,homeUrl:j,logo:w}),n.jsxs(C,{display:"flex",className:"dashboard__body",children:[n.jsx(_e,{variant:M,className:"drawer",classes:{paper:"drawerPaper"},open:I,onClose:g,ModalProps:{disablePortal:!0,keepMounted:!0},children:n.jsx(he,{className:"dashboard__sidebar",images:d,links:i,prefix:u,logo:w})}),n.jsxs(C,{className:"dashboard__main",children:[n.jsx(q,{maxWidth:k?!1:"lg",className:"dashboard__content",children:e}),n.jsx(
|
|
233
|
+
`;function ge({children:e,title:o,brand:t,description:a,brandAddon:l,headerAddon:c,images:d,links:i,prefix:u,fullWidth:s,contentLayout:x,className:m,homeUrl:j,logo:w,...P}){const f=Ie(document.body),z=(f==null?void 0:f.width)||0,[M,L]=p.useState(z>=960?"permanent":"temporary"),[I,N]=p.useState(M==="permanent");p.useEffect(()=>{const A=z>=960?"permanent":"temporary";L(A),N(A!=="temporary")},[z]);const g=()=>{N(!I)},k=s||x==="row";return n.jsxs(on,{className:`dashboard ${m}`,...P,children:[n.jsx(Te,{title:`${o}-${t}`}),n.jsx(fe,{className:"dashboard__header",onToggleMenu:g,brand:t,brandAddon:l,description:a,addons:c,homeUrl:j,logo:w}),n.jsxs(C,{display:"flex",className:"dashboard__body",children:[n.jsx(_e,{variant:M,className:"drawer",classes:{paper:"drawerPaper"},open:I,onClose:g,ModalProps:{disablePortal:!0,keepMounted:!0},children:n.jsx(he,{className:"dashboard__sidebar",images:d,links:i,prefix:u,logo:w})}),n.jsxs(C,{className:"dashboard__main",children:[n.jsx(q,{maxWidth:k?!1:"lg",className:"dashboard__content",children:e}),n.jsx(H,{})]})]})]})}ge.propTypes={children:r.any.isRequired,title:r.string,brand:r.string.isRequired,links:r.array.isRequired,images:r.object.isRequired,brandAddon:r.object,description:r.any.isRequired,headerAddon:r.any,prefix:r.string,contentLayout:r.oneOf(["row","column"]),fullWidth:r.bool,className:r.string,homeUrl:r.string,logo:r.any};ge.defaultProps={title:"Home",contentLayout:"column",headerAddon:null,brandAddon:null,prefix:"/images",fullWidth:!1,className:"",homeUrl:"/",logo:null};function Se({height:e,...o}){return n.jsx(nn,{height:e,...o})}Se.propTypes={height:r.oneOfType([r.number,r.string]).isRequired};const nn=y(C)`
|
|
234
234
|
overflow: hidden;
|
|
235
235
|
&:before {
|
|
236
236
|
content: '';
|
|
@@ -536,7 +536,7 @@ import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as
|
|
|
536
536
|
.navmenu-sub--opened > .navmenu-sub-container {
|
|
537
537
|
display: block;
|
|
538
538
|
}
|
|
539
|
-
`,ve=p.createContext();function Ye(e){return e?p.Children.toArray(e).filter(o=>o.type===G||o.type===
|
|
539
|
+
`,ve=p.createContext();function Ye(e){return e?p.Children.toArray(e).filter(o=>o.type===G||o.type===W):null}function Xe(e){return p.useRef(e||`navmenu-item-id-${Math.random().toString(36).slice(2)}`).current}function S({items:e,mode:o,children:t,activeId:a,textColor:l,activeTextColor:c,bgColor:d,onSelected:i,...u}){var T;if(t=Ye(t),!(e!=null&&e.length)&&!(t!=null&&t.length))throw new Error("One of 'items' or 'children' is required by NavMenu component.");const s=Be({activeId:a,openedIds:[],hiddenItemCount:0}),x=X(h=>{s.activeId=h,i==null||i(h)}),m=X(h=>{s.openedIds.push(h)}),j=X(h=>{s.openedIds=s.openedIds.filter(v=>v!==h)}),w=te(()=>({...s,mode:o,activate:x,open:m,close:j}),[s.activeId,s.hiddenItemCount,s.openedIds,o,x,m,j]),P=p.useRef(),b=p.useRef([]),f=p.useRef(),z=s.hiddenItemCount===((T=b.current)==null?void 0:T.length),M=z?{marginLeft:"0px"}:void 0,L=te(()=>z?n.jsx(_o,{}):n.jsx(Fo,{}),[z]),I=h=>p.Children.map(h,(v,O)=>p.cloneElement(v,{ref:B=>{b.current[O]=B}})),N=Ie(P.current),{run:g}=Ao(X(()=>{let h=0,v=0,O=!1;const B=(N==null?void 0:N.width)||0,ne=f.current?f.current.offsetWidth+parseFloat(window.getComputedStyle(f.current).marginLeft):0;b.current.forEach((E,eo)=>{if(E){E.style.display="flex";const oo=eo>0?parseFloat(window.getComputedStyle(E).marginLeft):0,we=E.offsetWidth+oo;B-ne>=h+we&&!O?h+=we:(E.style.display="none",O=!0,v++)}}),v!==s.hiddenItemCount&&(s.hiddenItemCount=v)}),{wait:100});p.useLayoutEffect(()=>{o==="horizontal"&&g()},[N==null?void 0:N.width,o]),p.useEffect(()=>{if(o==="horizontal")return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[o,e]),p.useEffect(()=>{a!=null&&(s.activeId=a)},[a]);const k=R("navmenu",`navmenu--${o}`,u.className),A=(h,v,O=!1)=>h!=null&&h.children?n.jsx(W,{id:h.id,icon:h.icon,label:h.label,ref:O?B=>{b.current[v]=B}:void 0,children:h.children.map((B,ne)=>A(B,ne,!1))},h.id):n.jsx(G,{id:h.id,icon:h.icon,label:h.label,active:h.active,ref:O?B=>{b.current[v]=B}:void 0},h.id),je=e?e==null?void 0:e.slice(-s.hiddenItemCount).map((h,v)=>A(h,v)):t==null?void 0:t.slice(-s.hiddenItemCount),F=o==="inline"?ln:sn;return n.jsx(ve.Provider,{value:w,children:n.jsx(F,{...u,className:k,$textColor:l,$activeTextColor:c,$bgColor:d,children:n.jsxs("ul",{className:"navmenu-root",ref:P,children:[e?e.map((h,v)=>A(h,v,!0)):I(t),s.hiddenItemCount>0&&n.jsx(W,{expandIcon:!1,icon:L,label:"",ref:f,style:M,children:je})]})})})}S.propTypes={items:r.array,mode:r.oneOf(["horizontal","vertical","inline"]),children:r.array,activeId:r.string,textColor:r.string,activeTextColor:r.string,bgColor:r.string,onSelected:r.func};S.defaultProps={items:null,mode:"horizontal",children:null,activeId:null,textColor:"#9397a1",activeTextColor:"#25292f",bgColor:"#fff",onSelected:null};const G=p.forwardRef(({id:e,icon:o,label:t,active:a,onClick:l,...c},d)=>{const i=Xe(e),{activeId:u,activate:s}=p.useContext(ve),x=R("navmenu-item",{"navmenu-item--active":u===i},c.className);p.useEffect(()=>{a&&s(i)},[a]);const m=()=>{l==null||l(),s(i)};return n.jsxs("li",{...c,className:x,onClick:m,ref:d,children:[o&&n.jsx("span",{className:"navmenu-item-icon",children:o}),n.jsx("span",{className:"navmenu-item-label",children:t})]})});G.propTypes={id:r.string,icon:r.element,label:r.node,active:r.bool,onClick:r.func};G.defaultProps={id:null,icon:null,label:"",active:!1,onClick:null};const W=p.forwardRef(({id:e,icon:o,label:t,children:a,expandIcon:l,...c},d)=>{const i=Xe(e),{openedIds:u,open:s,close:x,mode:m}=p.useContext(ve),j=u.includes(i),w=R("navmenu-sub",{"navmenu-sub--opened":j},c.className),P=m==="inline",b=P?{onClick:()=>{u.includes(i)?x(i):s(i)}}:{onMouseEnter:()=>s(i),onMouseLeave:()=>x(i)},f=P?{onClick:z=>z.stopPropagation()}:{};return n.jsxs("li",{...c,className:w,...b,ref:d,children:[o&&n.jsx("span",{className:"navmenu-sub-icon",children:o}),n.jsx("span",{className:"navmenu-sub-label",children:t}),l&&n.jsx("span",{className:"navmenu-sub-expand-icon",children:(l==null?void 0:l({isOpen:j}))||l}),n.jsx("div",{className:"navmenu-sub-container",...f,children:n.jsx("ul",{className:"navmenu-sub-list",children:Ye(a)})})]})});W.propTypes={id:r.string,icon:r.element,label:r.node.isRequired,children:r.array.isRequired,expandIcon:r.oneOfType([r.node,r.func])};W.defaultProps={id:null,icon:null,expandIcon:({isOpen:e})=>n.jsx(Do,{style:{transform:`rotate(${e?180:0}deg)`}})};S.Item=G;S.Sub=W;function oe({children:e,routerLinkComponent:o,to:t,external:a,...l}){return a?n.jsx("a",{href:t,...l,children:e}):n.jsx(o,{to:t,...l,children:e})}oe.propTypes={children:r.any.isRequired,routerLinkComponent:r.elementType.isRequired,external:r.bool,to:r.oneOfType([r.string,r.object]).isRequired};oe.defaultProps={external:!1};function Je(e){return n.jsx(oe,{routerLinkComponent:K,...e})}function ye({className:e,...o}){const t=o.external&&typeof e=="function"?e({}):e;return n.jsx(oe,{routerLinkComponent:go,className:t,...o})}ye.propTypes={className:r.oneOfType([r.string,r.func])};ye.defaultProps={className:""};function Ke(e,o){var u;if((u=e.children)!=null&&u.length)return dn(e,o);const{url:t,icon:a,title:l,showBadge:c,external:d,active:i}=e;return n.jsx("li",{className:"layout-sidebar-item",children:n.jsxs(ye,{external:d,to:t,className:({isActive:s})=>R("layout-sidebar-link",{"layout-sidebar-link--active":d?i:s}),children:[a&&n.jsx("span",{className:`layout-sidebar-icon ${c?"layout-sidebar-badge":""}`,children:a}),n.jsx(D,{component:"span",className:"layout-sidebar-link-text",children:l})]})},`${t}-${o}`)}function dn(e,o){return n.jsxs("li",{className:"layout-sidebar-group",children:[n.jsx("span",{className:"layout-sidebar-group-title",children:e.title}),n.jsx("ul",{children:e.children.map(Ke)})]},`group-${e.title}-${o}`)}function Q({links:e,addons:o,dense:t,...a}){return n.jsxs(pn,{...a,className:R({"layout-sidebar-dense":t}),children:[n.jsx("ul",{children:e.map(Ke)}),n.jsx("div",{style:{flex:1}}),o]})}Q.propTypes={links:r.array.isRequired,addons:r.any,dense:r.bool};Q.defaultProps={addons:null,dense:!1};const cn="linear-gradient(32deg, rgba(144, 255, 230, 0.1), rgba(144, 255, 230, 0))",pn=y("div")`
|
|
540
540
|
display: flex;
|
|
541
541
|
flex-direction: column;
|
|
542
542
|
ul {
|
|
@@ -661,7 +661,7 @@ import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as
|
|
|
661
661
|
margin-top: 16px;
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
|
-
`;function un({closeMenu:e,...o}){const t=de();return p.useEffect(()=>{e()},[t]),n.jsx(S,{...o})}function Qe(e,o){return e.map(t=>{var a;return(a=t.children)!=null&&a.length?{...t,label:t.title,children:Qe(t.children,o)}:{...t,label:n.jsx(Je,{to:t.url,external:t.external,children:t.title}),active:t.external?t.active:!!bo({path:t.url,end:!1},o.pathname)}})}function Y({children:e,title:o,headerProps:t,links:a=[],fullWidth:l,dense:c,footerProps:d,...i}){const u=ee(),{inFullPage:s,showToggleButton:x,headerVisible:m,footerVisible:j,sidebarVisible:w,toggleFullPage:P}=
|
|
664
|
+
`;function un({closeMenu:e,...o}){const t=de();return p.useEffect(()=>{e()},[t]),n.jsx(S,{...o})}function Qe(e,o){return e.map(t=>{var a;return(a=t.children)!=null&&a.length?{...t,label:t.title,children:Qe(t.children,o)}:{...t,label:n.jsx(Je,{to:t.url,external:t.external,children:t.title}),active:t.external?t.active:!!bo({path:t.url,end:!1},o.pathname)}})}function Y({children:e,title:o,headerProps:t,links:a=[],fullWidth:l,dense:c,footerProps:d,...i}){const u=ee(),{inFullPage:s,showToggleButton:x,headerVisible:m,footerVisible:j,sidebarVisible:w,toggleFullPage:P}=Oo(),b=de(),f=p.useMemo(()=>Qe(a,b),[b,a]),z=f.some(g=>{var k;return!!((k=g.children)!=null&&k.length)}),M=c==="auto"?f.length>=8||z:c,L=R("dashboard",{"dashboard-dense":M},i.className),N={homeLink:g=>{var k;return n.jsx(Je,{to:((k=window.blocklet)==null?void 0:k.prefix)||"/",children:g})},...t};return n.jsxs(hn,{...i,className:L,children:[n.jsx(Te,{title:o},o),m&&n.jsx(xn,{...N,className:"dashboard-header",children:a!=null&&a.length?({isMobile:g,closeMenu:k})=>g?n.jsx(un,{mode:"inline",items:f,closeMenu:k,bgColor:"transparent",activeTextColor:u.palette.primary.main}):null:null}),n.jsxs(C,{display:"flex",className:"dashboard-body",children:[n.jsx(Le,{mdDown:!0,children:!!(a!=null&&a.length)&&w&&n.jsx(C,{className:"dashboard-sidebar",children:M?n.jsx(Q,{links:a,dense:M}):n.jsx(C,{className:"dashboard-sidebar-container",children:n.jsx(Q,{links:a,dense:M})})})}),n.jsxs(C,{className:"dashboard-main",children:[x&&n.jsx(C,{sx:{position:"absolute",top:4,right:4,display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,color:"#fff",bgcolor:"rgba(158,158,158, 0.6);",borderRadius:1,cursor:"pointer"},onClick:P,children:s?n.jsx(He,{style:{fontSize:18}}):n.jsx(We,{style:{fontSize:18}})}),n.jsx(q,{className:"dashboard-content",...l&&{maxWidth:!1},children:e}),j&&n.jsx(H,{...d})]})]})]})}Y.propTypes={children:r.any.isRequired,title:r.string,links:r.array.isRequired,headerProps:r.object,fullWidth:r.bool,sidebarWidth:r.number,dense:r.oneOf([!0,!1,"auto"])};Y.defaultProps={title:"Home",headerProps:{},fullWidth:!1,sidebarWidth:120,dense:"auto"};const hn=y("div",{shouldForwardProp:e=>e!=="sidebarWidth"})`
|
|
665
665
|
&.dashboard {
|
|
666
666
|
display: flex;
|
|
667
667
|
flex-direction: column;
|
|
@@ -718,4 +718,4 @@ import{aC as Pe,aB as ze,aD as Z,ae as Ne,aE as _,aG as $,r as p,aK as Ce,aF as
|
|
|
718
718
|
.header-container {
|
|
719
719
|
max-width: 100%;
|
|
720
720
|
}
|
|
721
|
-
`;function Ze({legacy:e,...o}){return e?n.jsx(ge,{...o}):n.jsx(
|
|
721
|
+
`;function Ze({legacy:e,...o}){return e?n.jsx(ge,{...o}):n.jsx(Oe,{children:n.jsx(Y,{...o})})}Ze.propTypes={...Y.propTypes,legacy:r.bool,footerProps:r.shape(H.propTypes)};Ze.defaultProps={...Y.defaultProps,legacy:!0};export{Ze as D,S as N,be as R,Oo as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{P as s,r as b,bA as W,u as C,j as d,aA as B,f as F,z as $}from"./index-DJR5CVa4.js";import{S as q}from"./index-qzKq3GJD.js";import{D as V}from"./index-DciAO9oE.js";import{L as _}from"./selector-CwAgVP_D.js";const G=s.shape({appLogo:s.node,appName:s.string,theme:s.shape({background:s.string}),enableConnect:s.bool,enableLocale:s.bool,navigation:s.arrayOf(s.shape({title:s.oneOfType([s.string,s.object]),link:s.oneOfType([s.string,s.object]),icon:s.string,items:s.arrayOf(s.shape({title:s.oneOfType([s.string,s.object]),link:s.oneOfType([s.string,s.object])}))}))}),D=s.shape({showText:s.bool,showRole:s.bool,switchDid:s.bool,switchProfile:s.bool,switchPassport:s.bool,disableLogout:s.bool,onLogin:s.func,onLogout:s.func,onSwitchDid:s.func,onSwitchProfile:s.func,onSwitchPassport:s.func,menu:s.array,menuRender:s.func,dark:s.bool,size:s.number}),A=(r,o,t="children")=>r.map(n=>Array.isArray(n[t])?o({...n,[t]:A(n[t],o,t)}):o(n)),J=(r,o="children")=>{const t=[];return A(r,n=>t.push(n),o),t},S=(r,o,t="children")=>r.map(n=>({...n})).filter(n=>{const e=n[t];if(Array.isArray(e)){const c=S(e,o,t);n[t]=c!=null&&c.length?c:void 0}const a={filteredChildren:n[t],isLeaf:!(e!=null&&e.length)};return o(n,a)}),Q=r=>/^https?:\/\//.test(r),ie=r=>/^[\w-]+:[\w-]+$/.test(r),X=r=>{if(!r||!(r!=null&&r.startsWith("/")))return!1;const o=e=>e.endsWith("/")?e:`${e}/`,t=o(window.location.pathname),n=o(new URL(r,window.location.origin).pathname);return t.startsWith(n)},Y=(r=[])=>{const o=r.map((n,e)=>({path:n,index:e})).filter(n=>X(n.path));return o!=null&&o.length?o.slice(1).reduce((n,e)=>n.path.length>=e.path.length?n:e,o[0]).index:-1};var k,E;const N=((k=window==null?void 0:window.blocklet)==null?void 0:k.groupPrefix)||((E=window==null?void 0:window.blocklet)==null?void 0:E.prefix)||"/",Z=r=>{const o={...r},t=r==null?void 0:r.background;return typeof t=="string"?o.background={header:t,footer:t,default:t}:t&&typeof t=="object"&&(o.background={header:t.header||t.default,footer:t.footer||t.default,default:t.default}),o},I=(r,o="en")=>{if(!(r!=null&&r.length))return r;const t=(e,a)=>typeof e=="string"?e:typeof e=="object"?e[a]||(e==null?void 0:e.en)||(e==null?void 0:e.zh):e,n=(e,a)=>{if(typeof e=="string"){if(Q(e)){const h=new URL(e);return h.searchParams.set("locale",a),h.href}const c=new URL(e,window.location.origin);return c.searchParams.set("locale",a),c.pathname+c.search}return typeof e=="object"?e[a]||(e==null?void 0:e.en)||(e==null?void 0:e.zh):e};return A(r,e=>{var a;return{...e,title:t(e.title,o),link:(a=e.items)!=null&&a.length?e.link:n(e.link,o),_rawLink:e.link}},"items")},K=r=>A(r,o=>o.role?{...o,role:Array.isArray(o.role)?o.role:[o.role]}:o,"items"),ee=r=>{if(!(r!=null&&r.length))return null;const o=K(r),t={header:[],footer:[],social:[],bottom:[],dashboard:[],sessionManager:[],userCenter:[]};return o.forEach(n=>{var e;n.section?Array.isArray(n.section)?n.section.forEach(a=>{var c;(c=t[a])==null||c.push(n)}):typeof n.section=="string"&&((e=t[n.section])==null||e.push(n)):t.header.push(n)}),t},oe=r=>{if(!r)return null;const o={...r};return o.theme=Z(o.theme),o.navigation=ee(re(o.navigation)),o},re=(r=[])=>S(r,(o,t)=>{var n;return!!o.link||((n=t.filteredChildren)==null?void 0:n.length)},"items"),U=(r,o)=>S(r,(t,n)=>{var a;const e=!t.role||o&&t.role.includes(o);return n.isLeaf?e:e&&((a=n.filteredChildren)==null?void 0:a.length)},"items");function M({formattedBlocklet:r,addons:o,sessionManagerProps:t}){var L,l,m,j;const n=b.useContext(W),{locale:e}=C()||{},{enableConnect:a=!0,enableLocale:c=!0}=r,h=!!((L=n==null?void 0:n.session)!=null&&L.user);let i=I((l=r==null?void 0:r.navigation)==null?void 0:l.sessionManager,e)||[];i=U(i,(j=(m=n==null?void 0:n.session)==null?void 0:m.user)==null?void 0:j.role);const w=(()=>{if(o&&typeof o!="function")return Array.isArray(o)?o:[o];let g=[];if(c&&e&&g.push(d.jsx(_,{showText:!1},"locale-selector")),a&&n){const x=[];h&&(i?i.slice(0,5):[]).forEach(y=>{x.push({label:y.title,icon:y.icon?d.jsx("iconify-icon",{icon:y.icon,height:24,style:{marginRight:8}}):null,component:"a",href:y.link,key:y.link})}),g.push(d.jsx(q,{session:n.session,locale:e},"session-blocklet")),g.push(d.jsx(B,{session:n.session,locale:e,menu:x,showRole:!0,...t},"session-user"))}return typeof o=="function"&&(g=o(g)||[]),g})();return b.createElement(d.Fragment,null,...Array.isArray(w)?w:[w])}M.propTypes={formattedBlocklet:s.object.isRequired,addons:s.oneOfType([s.func,s.node]),sessionManagerProps:D};M.defaultProps={addons:null,sessionManagerProps:{showRole:!0}};const se=()=>{const r=F();b.useEffect(()=>{r.wallet&&$.call("arcHideTopBar","{}")},[r])};function H({meta:r,fallbackUrl:o,invalidPathFallback:t,headerAddons:n,sessionManagerProps:e,links:a,...c}){var z;se();const h=b.useContext(W),i=(z=h==null?void 0:h.session)==null?void 0:z.user,R=i==null?void 0:i.role,{locale:w}=C()||{},p=b.useMemo(()=>{const u=Object.assign({},window.blocklet,r);try{return oe(u)}catch(P){return console.error("Failed to format blocklet info",P,u),u}},[r]),{localizedNav:L,flattened:l,matchedIndex:m}=b.useMemo(()=>{var O;let u=I((O=p==null?void 0:p.navigation)==null?void 0:O.dashboard,w)||[];u=U(u,R),u=A(u,f=>({title:f.title,url:f.link,icon:f.icon?d.jsx("iconify-icon",{height:"100%",width:"100%",icon:f.icon}):null,external:!0,children:f.items}),"items");const P=J(u).filter(f=>!!f.url),T=Y(P.map(f=>f.url));return T!==-1&&(P[T].active=!0),{localizedNav:u,flattened:P,matchedIndex:T}},[p,w,R]),j=typeof a=="function"?a(L):[...L,...a];if(b.useLayoutEffect(()=>{i&&!(l!=null&&l.length)&&o&&(window.location.href=o)},[o]),b.useLayoutEffect(()=>{i&&(l!=null&&l.length)&&m===-1&&t&&t()},[t,l,m]),!p.appName)return null;const{appLogo:g,appLogoRect:x,appName:v}=p,y=d.jsx(M,{formattedBlocklet:p,addons:n,sessionManagerProps:e});return d.jsx(V,{title:v,fullWidth:!0,sidebarWidth:128,legacy:!1,links:j,...c,headerProps:{homeLink:N,logo:d.jsx("img",{src:x||g,alt:"logo"}),addons:y,...c.headerProps}})}H.propTypes={meta:G,fallbackUrl:s.string,invalidPathFallback:s.func,headerAddons:s.oneOfType([s.func,s.node]),sessionManagerProps:D,links:s.oneOfType([s.array,s.func])};H.defaultProps={meta:{},fallbackUrl:N,invalidPathFallback:null,headerAddons:void 0,sessionManagerProps:{showRole:!0,onLogout:()=>{window.location.href=N}},links:[]};export{G as B,H as D,M as H,ie as a,J as b,Y as c,oe as f,I as g,Q as i,A as m,N as p,se as u};
|