@abtnode/blocklet-services 1.16.30-beta-00e8bdd1 → 1.16.30-beta-958ae719

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.
Files changed (190) hide show
  1. package/api/libs/connect/session.js +6 -2
  2. package/api/routes/federated.js +3 -14
  3. package/api/routes/user.js +7 -6
  4. package/api/services/auth/connect/setup.js +2 -2
  5. package/dist/assets/{Add-BN237Fn5.js → Add-CG0lOPyd.js} +1 -1
  6. package/dist/assets/{AddBox-3LaPVxwU.js → AddBox-Cwjttlhg.js} +1 -1
  7. package/dist/assets/{Alert-D6ASJuaD.js → Alert-g4kHOcZt.js} +1 -1
  8. package/dist/assets/{ArrowDropDown-BHT7uJ-_.js → ArrowDropDown-BTiX8PXn.js} +1 -1
  9. package/dist/assets/Avatar-CR4hwIIm.js +1 -0
  10. package/dist/assets/{ButtonGroup-BJxGB-mf.js → ButtonGroup-CgY-ppCE.js} +1 -1
  11. package/dist/assets/{CheckCircle-CczUamTZ.js → CheckCircle-Vqx7zt5L.js} +1 -1
  12. package/dist/assets/{ChevronRight-Cg14uJfK.js → ChevronRight-DyDbYWH3.js} +1 -1
  13. package/dist/assets/{Close-x7Tkk0S3.js → Close-CtwY6QYr.js} +1 -1
  14. package/dist/assets/{CloseOutlined-QOb8qkQe.js → CloseOutlined-ZLLhO9hq.js} +1 -1
  15. package/dist/assets/{Delete-C6X9S_ep.js → Delete-CRjviPIR.js} +1 -1
  16. package/dist/assets/{DeleteOutline-DPoIruJ5.js → DeleteOutline-C5wDmNvo.js} +1 -1
  17. package/dist/assets/{Done-CoG4jV3h.js → Done-Cl6BxREa.js} +1 -1
  18. package/dist/assets/{Download-CgS76hkn.js → Download-BzWUtZG0.js} +1 -1
  19. package/dist/assets/{Edit-CuIVEZdJ.js → Edit-CnHAWZqz.js} +1 -1
  20. package/dist/assets/{EditIcon-Ca6HYpZk.js → EditIcon-DC9F3tcA.js} +1 -1
  21. package/dist/assets/{Error-DPYTfE3e.js → Error-pSlqmXD8.js} +1 -1
  22. package/dist/assets/{ExpandMore-D04IjVlX.js → ExpandMore-DjWcUZ_t.js} +1 -1
  23. package/dist/assets/{FilterList-DUOw_RoL.js → FilterList-DclE2l4O.js} +4 -4
  24. package/dist/assets/{FormControl-Bh9aSU12.js → FormControl-CTJIBsW8.js} +1 -1
  25. package/dist/assets/{FormControlLabel-BpMix3qK.js → FormControlLabel-xqZ79iQ8.js} +1 -1
  26. package/dist/assets/FormGroup-B7SNePwe.js +1 -0
  27. package/dist/assets/{Google-DIEocVvQ.js → Google-C2r6grDK.js} +4 -4
  28. package/dist/assets/{Hidden-BLcFQ9WU.js → Hidden-CVIT9GQJ.js} +1 -1
  29. package/dist/assets/{InfoOutlined-C5vT7BTM.js → InfoOutlined-BNiOudlP.js} +1 -1
  30. package/dist/assets/{InputAdornment-4EnHL3SV.js → InputAdornment-BtP5WuDE.js} +1 -1
  31. package/dist/assets/{InputLabel-BY35PBOn.js → InputLabel-o8Jz2Es-.js} +1 -1
  32. package/dist/assets/{LastPage-DSqwop6h.js → LastPage-DOrkqqL0.js} +1 -1
  33. package/dist/assets/{Launch-BYwPKhG2.js → Launch-CPwTTy1C.js} +1 -1
  34. package/dist/assets/{LaunchOutlined-DkrAS-ts.js → LaunchOutlined-DGyXSGnN.js} +1 -1
  35. package/dist/assets/{Link-CHkL2_F8.js → Link-CyjzJAjs.js} +1 -1
  36. package/dist/assets/{ListItemText-TxfvzIQH.js → ListItemText-CRfaCcXD.js} +1 -1
  37. package/dist/assets/{LoadingButton-_EYRn4Wx.js → LoadingButton-D0rQ4RAj.js} +1 -1
  38. package/dist/assets/{LockIcon-Bz8VQwMT.js → LockIcon-DRPStlvR.js} +1 -1
  39. package/dist/assets/{Loop-D0mtfhOu.js → Loop-BgnXgwOk.js} +1 -1
  40. package/dist/assets/{MoreVert-xcNzKdjG.js → MoreVert-Dw6DD_Y2.js} +1 -1
  41. package/dist/assets/{OpenInNew-DLQ33Rpf.js → OpenInNew-DbfI3Lh3.js} +1 -1
  42. package/dist/assets/{Pagination-IIYxtOn3.js → Pagination-DC7XW3JJ.js} +1 -1
  43. package/dist/assets/{PlayArrow-BdFq1DDL.js → PlayArrow-D4Qo296a.js} +1 -1
  44. package/dist/assets/{QuestionMarkCircle-BfRCnC--.js → QuestionMarkCircle-DM_KgJxi.js} +1 -1
  45. package/dist/assets/{RadioGroup-sdHfzBzc.js → RadioGroup-4mE-Sstp.js} +1 -1
  46. package/dist/assets/{Search-Dg-t_NHQ.js → Search-5XN6Shqj.js} +1 -1
  47. package/dist/assets/{Select-0bmPPjw1.js → Select-B7YRgule.js} +1 -1
  48. package/dist/assets/{ServerLogo-CXDpSA8g.js → ServerLogo-BUr8k8lJ.js} +1 -1
  49. package/dist/assets/{Skeleton-DuHnu_TW.js → Skeleton-BLQuUW4t.js} +4 -4
  50. package/dist/assets/{Slider-DaijA7CN.js → Slider-DtDM_Fj3.js} +1 -1
  51. package/dist/assets/{Stepper-QmSO1CtE.js → Stepper-ipc5scPk.js} +1 -1
  52. package/dist/assets/{TextField-BBIigLRk.js → TextField-endZMNmB.js} +1 -1
  53. package/dist/assets/{Toolbar-DT4-YRKk.js → Toolbar-DX1aq1wO.js} +1 -1
  54. package/dist/assets/{ViewList-BU2uRr73.js → ViewList-CasIbr2G.js} +1 -1
  55. package/dist/assets/{access-control-C4ERDDDO.js → access-control-DkNCBsPA.js} +2 -2
  56. package/dist/assets/{actions-Ds_jVVND.js → actions-9fivoUdA.js} +1 -1
  57. package/dist/assets/{add-component-core-CCOhSWQB.js → add-component-core-wL-COQaV.js} +1 -1
  58. package/dist/assets/add-resource-Df_RDVa7.js +1 -0
  59. package/dist/assets/{addon-BcSb2Zzp.js → addon-Cv3tGV2W.js} +1 -1
  60. package/dist/assets/{analytics-Ce187M51.js → analytics-rvn5F6QD.js} +1 -1
  61. package/dist/assets/api-BNgzqvJ7.js +1 -0
  62. package/dist/assets/{audit-logs-LoED-8gk.js → audit-logs-2O7BG2mg.js} +1 -1
  63. package/dist/assets/{button-Dfb9hD8n.js → button-CEyyV78a.js} +1 -1
  64. package/dist/assets/{click-to-copy-D62iwIju.js → click-to-copy-D1J7QI3P.js} +1 -1
  65. package/dist/assets/{complete-CRtPvgDa.js → complete-jHArngON.js} +1 -1
  66. package/dist/assets/{component-BS6BClYg.js → component-DPFryr0O.js} +1 -1
  67. package/dist/assets/{config-2JcKGcTt.js → config-itS8qGTV.js} +1 -1
  68. package/dist/assets/{config-DRlEBb7g.js → config-jPzmOFAo.js} +1 -1
  69. package/dist/assets/{config-navigation-BecqFtHY.js → config-navigation-1vegbn3x.js} +1 -1
  70. package/dist/assets/confirm-6IBLCQWG.js +7 -0
  71. package/dist/assets/{connect-BSc706Qe.js → connect-Io-Sd2o8.js} +1 -1
  72. package/dist/assets/{connect-to-B7lXTaqa.js → connect-to-B7cIbJqa.js} +2 -2
  73. package/dist/assets/{connect-CmVMyWtw.js → connect-yhMAMNNa.js} +1 -1
  74. package/dist/assets/{content-layout-fifpb2hF.js → content-layout-C1Pp8q6y.js} +1 -1
  75. package/dist/assets/{dashboard-zGeemO7s.js → dashboard-wzf1gV3S.js} +3 -3
  76. package/dist/assets/{did-address-CuLpyDcV.js → did-address-DbLRcPW2.js} +1 -1
  77. package/dist/assets/{domain-Eb-kKi8N.js → domain-Ciwj74aJ.js} +1 -1
  78. package/dist/assets/{domain-list-B2eOAUf9.js → domain-list-m_UrIGIZ.js} +2 -2
  79. package/dist/assets/{exchange-passport-D5yUNMgm.js → exchange-passport-BO-a9dn2.js} +1 -1
  80. package/dist/assets/{fallback-DnwN40Eu.js → fallback-DfrimSeM.js} +1 -1
  81. package/dist/assets/{format-error-eqRBGF1p.js → format-error-BhfIHXu5.js} +2 -2
  82. package/dist/assets/{fuel-DL8WMBx8.js → fuel-CG6ojqAM.js} +1 -1
  83. package/dist/assets/{fullpage-4QhjDOeH.js → fullpage-56S9hblE.js} +1 -1
  84. package/dist/assets/{home-BWibX2vn.js → home-Cky9w9lt.js} +1 -1
  85. package/dist/assets/{iframe-BmoLkGVE.js → iframe-C8eAx0ue.js} +1 -1
  86. package/dist/assets/{index-DpuZJtBf.js → index-07q3psNE.js} +3 -3
  87. package/dist/assets/{index-DuOVToRf.js → index-BOI9Etqy.js} +1 -1
  88. package/dist/assets/{index-UZz8l3in.js → index-BV6891pg.js} +8 -8
  89. package/dist/assets/{index-Dbbnbznm.js → index-BX4EYBTI.js} +1 -1
  90. package/dist/assets/{index-BEHMH1Pr.js → index-BXLC5YsG.js} +1 -1
  91. package/dist/assets/{index-dIqjPoOB.js → index-BfYPk2Ns.js} +5 -5
  92. package/dist/assets/{index-DIJWsYQq.js → index-BmnLIYuM.js} +1 -1
  93. package/dist/assets/{index-CKBTEFra.js → index-Bybdue8D.js} +1 -1
  94. package/dist/assets/{index-CuX6Kr95.js → index-C1bE9VVH.js} +1 -1
  95. package/dist/assets/{index-Bhy-Ufb6.js → index-CBjzOjOd.js} +1 -1
  96. package/dist/assets/{index-BN8ZIYdG.js → index-CKcMAUDG.js} +1 -1
  97. package/dist/assets/{index-CoBC9oVU.js → index-CNFT0-Ni.js} +2 -2
  98. package/dist/assets/{index-CTW4nb9G.js → index-CWIS84zj.js} +1 -1
  99. package/dist/assets/{index-QDFDl478.js → index-CkRJpRBQ.js} +28 -28
  100. package/dist/assets/{index-CCgZIcqf.js → index-CmxSwDI6.js} +1 -1
  101. package/dist/assets/{index-AiTSrLp-.js → index-CrLI5hsM.js} +1 -1
  102. package/dist/assets/{index-CekjYFHx.js → index-CsBSc17R.js} +1 -1
  103. package/dist/assets/{index-BykkL-cr.js → index-CurAG5ra.js} +1 -1
  104. package/dist/assets/{index-FHIuVSDt.js → index-CyJ9Y2Pj.js} +1 -1
  105. package/dist/assets/{index-Bg9DIh8M.js → index-D5aNUG7R.js} +1 -1
  106. package/dist/assets/{index-BLek-3-t.js → index-DDlZxdHs.js} +4 -4
  107. package/dist/assets/{index-CJ9qEL1_.js → index-DHlnMGYf.js} +1 -1
  108. package/dist/assets/{index-Bp8EriMk.js → index-DT-emwXk.js} +1 -1
  109. package/dist/assets/{index-Cxiv-wGv.js → index-DZJL1WDO.js} +1 -1
  110. package/dist/assets/{index-C7BxfHre.js → index-DateZnmM.js} +1 -1
  111. package/dist/assets/index-Dmbbtwcx.js +1290 -0
  112. package/dist/assets/{index-iEN5H5Ls.js → index-GW-nVnu4.js} +1 -1
  113. package/dist/assets/{index-D0sxPxR3.js → index-JnaF5h1j.js} +1 -1
  114. package/dist/assets/{index-DkVlOvts.js → index-L5tSQmgu.js} +1 -1
  115. package/dist/assets/index-VVvFogSs.js +4 -0
  116. package/dist/assets/{index-DdoI0wbz.js → index-dy4QInQY.js} +1 -1
  117. package/dist/assets/{index-BU0saRrz.js → index-hRsyLKnV.js} +4 -4
  118. package/dist/assets/{index.es-BJiRNQw2.js → index.es-CD9lf3-y.js} +1 -1
  119. package/dist/assets/{index.esm-DCtFyquI.js → index.esm-CpwI0AL8.js} +1 -1
  120. package/dist/assets/{invitation-CWO1OGzi.js → invitation-Crk_xWho.js} +1 -1
  121. package/dist/assets/{invite-BybXZqJ_.js → invite-CAtT4wk7.js} +1 -1
  122. package/dist/assets/{issue-passport-_8jsDZ5J.js → issue-passport-BrZORR7a.js} +1 -1
  123. package/dist/assets/{item-_msBYiLo.js → item-BDrWi6Cq.js} +1 -1
  124. package/dist/assets/{jss-plugin-props-sort.esm-CuwRRnMZ.js → jss-plugin-props-sort.esm-CxybFEV3.js} +4 -4
  125. package/dist/assets/{launch-result-message-nnQ4Z0fd.js → launch-result-message-DBJzH0h9.js} +1 -1
  126. package/dist/assets/{layout-0mxgsXb8.js → layout-DtKhmT8b.js} +1 -1
  127. package/dist/assets/{list-header-CbhWtFvh.js → list-header-Cu1hbnbK.js} +1 -1
  128. package/dist/assets/localization-CVbsHC7x.js +1 -0
  129. package/dist/assets/{log-ydyp6rKH.js → log-DJmTBua7.js} +8 -8
  130. package/dist/assets/{login-CgXrWK_2.js → login-Q7ywRtFl.js} +1 -1
  131. package/dist/assets/{login-oauth-callback-B-Y4WGSI.js → login-oauth-callback-ByuyyozV.js} +1 -1
  132. package/dist/assets/{logo-uploader-B0LO5vvb.js → logo-uploader-CckDhLFg.js} +3 -3
  133. package/dist/assets/{lost-passport-BhsqypQO.js → lost-passport-n3NQrqmC.js} +3 -3
  134. package/dist/assets/{lottie-DadbWVpc.js → lottie-DCFmlsXD.js} +1 -1
  135. package/dist/assets/notifications-B0WHkfOF.js +62 -0
  136. package/dist/assets/{open-window-CrkLeex9.js → open-window-pAT9qa3y.js} +1 -1
  137. package/dist/assets/{overview-Y5W0VfGN.js → overview-DJSRJCyQ.js} +1 -1
  138. package/dist/assets/{page-header-CSU48K3Q.js → page-header-ChIMB2y3.js} +1 -1
  139. package/dist/assets/{permission-BNHM2xAP.js → permission-BEB8Rrlb.js} +1 -1
  140. package/dist/assets/{preferences-Ccc7r_v8.js → preferences-BU9WNieK.js} +1 -1
  141. package/dist/assets/publish-resource-B4Cy2eZf.js +1 -0
  142. package/dist/assets/{react-Z_lC3NCb.js → react-iG64dalH.js} +3 -3
  143. package/dist/assets/{redux-Nz09j_eP.js → redux-CSBj6943.js} +1 -1
  144. package/dist/assets/{resource-dialog-TfZOe9lD.js → resource-dialog-BGVNvpOa.js} +3 -3
  145. package/dist/assets/sdk-D8S3f1Cw.js +1 -0
  146. package/dist/assets/{selector-Bbx9AGcC.js → selector-B2CAnybg.js} +1 -1
  147. package/dist/assets/session-CUH6PcMg.js +1 -0
  148. package/dist/assets/setup-CirnA0Ka.js +19 -0
  149. package/dist/assets/{shorten-label-BlugIeNc.js → shorten-label-C5kLk3Aq.js} +1 -1
  150. package/dist/assets/{slicedToArray-BDmAXaQb.js → slicedToArray-CCyaOd9K.js} +2 -2
  151. package/dist/assets/{spaces-0FuTU5il.js → spaces-pVN9ClcY.js} +1 -1
  152. package/dist/assets/{start-BF5svAaM.js → start-iEd5-B9Q.js} +1 -1
  153. package/dist/assets/{step-actions-RI-mCX0p.js → step-actions-iUTFNQ9f.js} +2 -2
  154. package/dist/assets/{studio-Bjf7gAq8.js → studio-DkxabEpU.js} +1 -1
  155. package/dist/assets/{switch-control-C1_R7-zR.js → switch-control-DB62K84_.js} +1 -1
  156. package/dist/assets/{toUpper-uyyCk01r.js → toUpper-DvPEhWeW.js} +1 -1
  157. package/dist/assets/{transfer-DkniK5Ag.js → transfer-DV6QHiEb.js} +1 -1
  158. package/dist/assets/{uniqBy-nqPJ5tkT.js → uniqBy-CkxUwg8y.js} +1 -1
  159. package/dist/assets/{unsubscribe-BAK1nb4o.js → unsubscribe-CD6qdfbQ.js} +1 -1
  160. package/dist/assets/{url-join-xP4FWyyN.js → url-join-BXgiL0Wq.js} +1 -1
  161. package/dist/assets/{use-blocklet-info-for-connect-did-spaces-ChbGnu2B.js → use-blocklet-info-for-connect-did-spaces-N1tQaruo.js} +1 -1
  162. package/dist/assets/{use-mobile-BOCpywmu.js → use-mobile-CQDS3X6b.js} +1 -1
  163. package/dist/assets/{useAsync-D7PX5RWx.js → useAsync-CHkkpEZ8.js} +1 -1
  164. package/dist/assets/{useFormControl-B5XnXwzO.js → useFormControl-ThWDsTIL.js} +1 -1
  165. package/dist/assets/{useLocalStorage-t8zs4VAz.js → useLocalStorage-ObVD0Nh9.js} +1 -1
  166. package/dist/assets/{useSetState-Br77TPgt.js → useSetState-B70PB8qU.js} +1 -1
  167. package/dist/assets/{useSlot-CeeEaDXE.js → useSlot-BhbSJM-8.js} +1 -1
  168. package/dist/assets/{useSlotProps-CSBBXTuv.js → useSlotProps-D0ZQmbeH.js} +1 -1
  169. package/dist/assets/{useThemeProps-Bp8oreMA.js → useThemeProps-B8VNQkzV.js} +1 -1
  170. package/dist/assets/{user-center-CvySLBqs.js → user-center-1nVYLWmw.js} +1 -1
  171. package/dist/assets/{user-sessions-B1MeydkJ.js → user-sessions-DzP40a_O.js} +1 -1
  172. package/dist/assets/{util-BWib46eW.js → util-ZqhH60bn.js} +1 -1
  173. package/dist/assets/{wrap-locale-WOY0-059.js → wrap-locale-BKjycvsN.js} +1 -1
  174. package/dist/assets/{zh-CIqkKG4c.js → zh-BxFByN8K.js} +1 -1
  175. package/dist/index.html +1 -1
  176. package/dist/service-worker.js +1 -1
  177. package/package.json +25 -25
  178. package/dist/assets/Avatar-CaF_-TIa.js +0 -1
  179. package/dist/assets/FormGroup-BfB-iN7c.js +0 -1
  180. package/dist/assets/add-resource-Do98YBVD.js +0 -1
  181. package/dist/assets/api-CWevC1Kw.js +0 -1
  182. package/dist/assets/confirm-DK53kjF4.js +0 -7
  183. package/dist/assets/index-CQ5dtdkj.js +0 -1290
  184. package/dist/assets/index-QU1KoDg_.js +0 -4
  185. package/dist/assets/localization-Ck45g-8d.js +0 -1
  186. package/dist/assets/notifications-DuPGt4pQ.js +0 -62
  187. package/dist/assets/publish-resource-BfHdYGQt.js +0 -1
  188. package/dist/assets/sdk-DtesNhKW.js +0 -1
  189. package/dist/assets/session-CPBKqm92.js +0 -1
  190. package/dist/assets/setup-ClQU62xP.js +0 -14
@@ -1,5 +1,5 @@
1
- const __vite__fileDeps=["assets/react-Z_lC3NCb.js","assets/index-CQ5dtdkj.js","assets/index-CCovGSMB.css","assets/index-Dbbnbznm.js","assets/preact.module-B1z5cdvs.js","assets/index-Bp8EriMk.js","assets/index-CuX6Kr95.js","assets/toUpper-uyyCk01r.js","assets/index-BLek-3-t.js","assets/fallback-DnwN40Eu.js","assets/index-UZz8l3in.js","assets/Toolbar-DT4-YRKk.js","assets/Hidden-BLcFQ9WU.js","assets/index-DkVlOvts.js","assets/MoreVert-xcNzKdjG.js","assets/selector-Bbx9AGcC.js","assets/ExpandMore-D04IjVlX.js","assets/Avatar-CaF_-TIa.js","assets/useSlot-CeeEaDXE.js","assets/resource-dialog-TfZOe9lD.js","assets/use-mobile-BOCpywmu.js","assets/OpenInNew-DLQ33Rpf.js","assets/CloseOutlined-QOb8qkQe.js","assets/Link-CHkL2_F8.js","assets/index-BykkL-cr.js","assets/index-Bg9DIh8M.js","assets/index-DuOVToRf.js","assets/FormControlLabel-BpMix3qK.js","assets/useFormControl-B5XnXwzO.js","assets/index-Cxiv-wGv.js","assets/FilterList-DUOw_RoL.js","assets/useThemeProps-Bp8oreMA.js","assets/toPropertyKey-hKuLU48H.js","assets/FormControl-Bh9aSU12.js","assets/FormGroup-BfB-iN7c.js","assets/InputLabel-BY35PBOn.js","assets/ListItemText-TxfvzIQH.js","assets/Select-0bmPPjw1.js","assets/TextField-BBIigLRk.js","assets/LastPage-DSqwop6h.js","assets/index-BEHMH1Pr.js","assets/redux-Nz09j_eP.js","assets/Search-Dg-t_NHQ.js","assets/Delete-C6X9S_ep.js","assets/index-DdoI0wbz.js","assets/url-join-xP4FWyyN.js","assets/uniqBy-nqPJ5tkT.js","assets/react-BW7E7-P9.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
2
- import{ao as o2,j as o,aC as se,cF as m0,aG as O,fo as G1,aF as be,aA as $e,aB as Fe,T as J,r as C,aE as x1,aH as l2,aI as Ue,aJ as qe,cL as s2,fp as o1,X as Te,Y as Ne,B as z,m as Oe,P as h,$ as We,F as X,e as m1,u as le,aL as je,aU as Ve,bu as l1,a1 as Ze,L as ue,bH as v0,a as ve,ay as ie,J as r2,s as $,Z as ae,ds as n2,a9 as Ce,c as he,G as i2,bS as v1,cd as g0,cA as a2,cJ as He,cK as b0,bg as c2,c_ as d2,cE as Xe,bB as pe,c0 as Je,fa as u2,a7 as K1,b as oe,bj as p2,du as h2,ae as j0,bk as f2,ck as x2,aP as X1,aO as m2,a2 as w0,fq as J1,e$ as Ie,bh as v2,ap as R0,cR as g2,k as b2,ax as j2,al as w2,am as r1}from"./index-CQ5dtdkj.js";import{d as g1}from"./Add-BN237Fn5.js";import{d as R2}from"./AddBox-3LaPVxwU.js";import{d as C0}from"./Delete-C6X9S_ep.js";import{d as C2}from"./Error-DPYTfE3e.js";import{D as b1}from"./index-Cxiv-wGv.js";import{T as y0,b as y2}from"./index-BN8ZIYdG.js";import{C as j1}from"./confirm-DK53kjF4.js";import{u as s1}from"./session-CPBKqm92.js";import{W as Q1}from"./did-address-CuLpyDcV.js";import{B as w1,d as z2}from"./ChevronRight-Cg14uJfK.js";import{S as ge}from"./shorten-label-BlugIeNc.js";import{A as z0}from"./Avatar-CaF_-TIa.js";import{d as S2}from"./Download-CgS76hkn.js";import{d as k2}from"./QuestionMarkCircle-BfRCnC--.js";import{b as M2,c as Y1,T as I2}from"./index-BykkL-cr.js";import{_ as Me}from"./useSetState-Br77TPgt.js";import{c as R1}from"./index-CuX6Kr95.js";import{C as d1,F as u1,S as L2}from"./FormControlLabel-BpMix3qK.js";import{A as S0}from"./Alert-D6ASJuaD.js";import{p as e1}from"./index-HqFqdQ4r.js";import"./api-CWevC1Kw.js";import{i as P2}from"./index-CKBTEFra.js";import{d as T2}from"./ExpandMore-D04IjVlX.js";import{d as N2}from"./OpenInNew-DLQ33Rpf.js";import{u as k0}from"./useThemeProps-Bp8oreMA.js";import{u as V2}from"./useSlotProps-CSBBXTuv.js";import{d as D2}from"./DeleteOutline-DPoIruJ5.js";import{c as _2,A as M0,u as B2,S as E2,U as A2}from"./item-_msBYiLo.js";import{d as O2}from"./ArrowDropDown-BHT7uJ-_.js";import{f as Pe}from"./format-error-eqRBGF1p.js";import{B as p1}from"./ButtonGroup-BJxGB-mf.js";import{T as Le}from"./TextField-BBIigLRk.js";import{M as C1}from"./InputAdornment-4EnHL3SV.js";import{C as H2}from"./click-to-copy-D62iwIju.js";import{d as $2}from"./Launch-BYwPKhG2.js";import{L as F2}from"./MoreVert-xcNzKdjG.js";import{a as U2}from"./ListItemText-TxfvzIQH.js";import{S as Z1}from"./index-DuOVToRf.js";import{M as q2}from"./index-FHIuVSDt.js";import{r as W2}from"./index-DIJWsYQq.js";import{d as G2}from"./Done-CoG4jV3h.js";import{c as I0,d as L0,b as K2,S as X2,a as J2}from"./Stepper-QmSO1CtE.js";import{R as Q2,a as e0}from"./RadioGroup-sdHfzBzc.js";import"./FilterList-DUOw_RoL.js";import"./toPropertyKey-hKuLU48H.js";import"./FormControl-Bh9aSU12.js";import"./useFormControl-B5XnXwzO.js";import"./FormGroup-BfB-iN7c.js";import"./InputLabel-BY35PBOn.js";import"./Select-0bmPPjw1.js";import"./LastPage-DSqwop6h.js";import"./Toolbar-DT4-YRKk.js";import"./index-BEHMH1Pr.js";import"./redux-Nz09j_eP.js";import"./Search-Dg-t_NHQ.js";import"./index-Bg9DIh8M.js";import"./Link-CHkL2_F8.js";import"./useSlot-CeeEaDXE.js";import"./jss-plugin-props-sort.esm-CuwRRnMZ.js";const Y2=o2(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"),Z2=["slots","slotProps"],et=se(m0)(({theme:e})=>O({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":O({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":O({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:G1(e.palette.grey[200],.12)}:{backgroundColor:G1(e.palette.grey[600],.12)})})),tt=se(Y2)({width:24,height:16});function ot(e){const{slots:t={},slotProps:l={}}=e,r=be(e,Z2),n=e;return o.jsx("li",{children:o.jsx(et,O({focusRipple:!0},r,{ownerState:n,children:o.jsx(tt,O({as:t.CollapsedIcon,ownerState:n},l.collapsedIcon))}))})}function lt(e){return Fe("MuiBreadcrumbs",e)}const st=$e("MuiBreadcrumbs",["root","ol","li","separator"]),rt=st,nt=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],it=e=>{const{classes:t}=e;return qe({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},lt,t)},at=se(J,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,t)=>[{[`& .${rt.li}`]:t.li},t.root]})({}),ct=se("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,t)=>t.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),dt=se("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,t)=>t.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,t,l,r){return e.reduce((n,d,i)=>(i<e.length-1?n=n.concat(d,o.jsx(dt,{"aria-hidden":!0,className:t,ownerState:r,children:l},`separator-${i}`)):n.push(d),n),[])}const pt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiBreadcrumbs"}),{children:n,className:d,component:i="nav",slots:a={},slotProps:u={},expandText:f="Show path",itemsAfterCollapse:x=1,itemsBeforeCollapse:b=1,maxItems:y=8,separator:p="/"}=r,c=be(r,nt),[m,g]=C.useState(!1),v=O({},r,{component:i,expanded:m,expandText:f,itemsAfterCollapse:x,itemsBeforeCollapse:b,maxItems:y,separator:p}),R=it(v),S=l2({elementType:a.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:v}),N=C.useRef(null),T=k=>{const U=()=>{g(!0);const V=N.current.querySelector("a[href],button,[tabindex]");V&&V.focus()};return b+x>=k.length?k:[...k.slice(0,b),o.jsx(ot,{"aria-label":f,slots:{CollapsedIcon:a.CollapsedIcon},slotProps:{collapsedIcon:S},onClick:U},"ellipsis"),...k.slice(k.length-x,k.length)]},L=C.Children.toArray(n).filter(k=>C.isValidElement(k)).map((k,U)=>o.jsx("li",{className:R.li,children:k},`child-${U}`));return o.jsx(at,O({ref:l,component:i,color:"text.secondary",className:Ue(R.root,d),ownerState:v},c,{children:o.jsx(ct,{className:R.ol,ref:N,ownerState:v,children:ut(m||y&&L.length<=y?L:T(L),R.separator,p,v)})}))}),P0=pt;function ht(e){return Fe("MuiStepButton",e)}const ft=$e("MuiStepButton",["root","horizontal","vertical","touchRipple"]),t0=ft,xt=["children","className","icon","optional"],mt=e=>{const{classes:t,orientation:l}=e;return qe({root:["root",l],touchRipple:["touchRipple"]},ht,t)},vt=se(m0,{name:"MuiStepButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[{[`& .${t0.touchRipple}`]:t.touchRipple},t.root,t[l.orientation]]}})(({ownerState:e})=>O({width:"100%",padding:"24px 16px",margin:"-24px -16px",boxSizing:"content-box"},e.orientation==="vertical"&&{justifyContent:"flex-start",padding:"8px",margin:"-8px"},{[`& .${t0.touchRipple}`]:{color:"rgba(0, 0, 0, 0.3)"}})),gt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiStepButton"}),{children:n,className:d,icon:i,optional:a}=r,u=be(r,xt),{disabled:f,active:x}=C.useContext(I0),{orientation:b}=C.useContext(L0),y=O({},r,{orientation:b}),p=mt(y),c={icon:i,optional:a},m=s2(n,["StepLabel"])?C.cloneElement(n,c):o.jsx(K2,O({},c,{children:n}));return o.jsx(vt,O({focusRipple:!0,disabled:f,TouchRippleProps:{className:p.touchRipple},className:Ue(p.root,d),ref:l,ownerState:y,"aria-current":x?"step":void 0},u,{children:m}))}),bt=gt;function jt(e){return Fe("MuiStepContent",e)}$e("MuiStepContent",["root","last","transition"]);const wt=["children","className","TransitionComponent","transitionDuration","TransitionProps"],Rt=e=>{const{classes:t,last:l}=e;return qe({root:["root",l&&"last"],transition:["transition"]},jt,t)},Ct=se("div",{name:"MuiStepContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[t.root,l.last&&t.last]}})(({ownerState:e,theme:t})=>O({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"})),yt=se(o1,{name:"MuiStepContent",slot:"Transition",overridesResolver:(e,t)=>t.transition})({}),zt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiStepContent"}),{children:n,className:d,TransitionComponent:i=o1,transitionDuration:a="auto",TransitionProps:u}=r,f=be(r,wt);C.useContext(L0);const{active:x,last:b,expanded:y}=C.useContext(I0),p=O({},r,{last:b}),c=Rt(p);let m=a;return a==="auto"&&!i.muiSupportAuto&&(m=void 0),o.jsx(Ct,O({className:Ue(c.root,d),ref:l,ownerState:p},f,{children:o.jsx(yt,O({as:i,in:x||y,className:c.transition,ownerState:p,timeout:m,unmountOnExit:!0},u,{children:n}))}))}),St=zt;var y1={},kt=Ne;Object.defineProperty(y1,"__esModule",{value:!0});var T0=y1.default=void 0,Mt=kt(Te()),It=o;T0=y1.default=(0,Mt.default)((0,It.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 z1={},Lt=Ne;Object.defineProperty(z1,"__esModule",{value:!0});var N0=z1.default=void 0,Pt=Lt(Te()),Tt=o;N0=z1.default=(0,Pt.default)((0,Tt.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 ze({size:e,...t}){return o.jsx(z,{display:"flex",mt:4,...t,children:o.jsx(Oe,{size:e})})}ze.propTypes={size:h.number};ze.defaultProps={size:24};function S1({did:e,projectId:t,title:l,logo:r,describe:n}){const i=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${t}/logo/upload`}/${r}`,[a,u]=C.useState(!1),f=We(x=>x.breakpoints.down("md"));return o.jsxs(z,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[o.jsx(z0,{sx:{borderRadius:1},src:i}),o.jsxs(z,{children:[o.jsx(ge,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:l||"/"}),o.jsx(ge,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:n||"/"})]})]})}S1.propTypes={projectId:h.string.isRequired,did:h.string.isRequired,title:h.string.isRequired,logo:h.string.isRequired,describe:h.string.isRequired};function k1({initUrl:e}){const t=m1(),l=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:n}=le(),{api:d}=je(),{api:i}=s1(),[a,u]=C.useState(!0),{blocklet:f}=Ve(),[x,b]=C.useState(null),[y,p]=C.useState(!1),c=We(M=>M.breakpoints.down("xl")),{componentDid:m=""}=l1(),[g,v]=C.useState(null),R=()=>{d.getProjects({input:{did:f.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)})},S=()=>{t(`${X.UNOWNED_DID}/create/none`,{replace:!0})},N=M=>{b(M)},T=()=>{u(!1),p(!0)},L=()=>{p(!1),b(null)},k=M=>{$.error(M.message),p(!1),b(null)},U=M=>{if(!(M!=null&&M.deleted)){$.error("Delete project failed");return}R(),p(!1),b(null)};if(C.useEffect(()=>{R()},[]),!g&&a)return o.jsx(z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:o.jsx(ze,{})});if(!g)return null;if(!g.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:r("blocklet.publish.blockletEmptyTip")}),o.jsx(z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),o.jsx(Ze,{onClick:S,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const V=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:M=>{const P=g[M];return o.jsx(ue,{to:`${P.id}`,children:o.jsx(S1,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:M=>M?o.jsx(y0,{type:"success",children:M}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:M=>M?o.jsx(Q1,{size:14,compact:!0,responsive:!1,did:M}):null}},c||m?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:M=>M?o.jsx(Q1,{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}},c||m?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:M=>{const P=(f.children||[]).find(E=>E.meta.did===M);return P?o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(w1,{size:14,blocklet:P,ancestors:[f]}),o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},M):""}}},c||l?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:M=>o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:o.jsx(ge,{children:M})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{customBodyRender:M=>o.jsx(v0,{value:Number(M),locale:n})}},{label:r("common.actions"),name:"actions",options:{customBodyRenderLite:M=>{const P=g[M];return o.jsxs(z,{display:"flex",children:[o.jsx(ue,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:o.jsx(ve,{title:r("blocklet.publish.createRelease"),placement:"top",children:o.jsx(ie,{color:"primary","aria-label":"create",children:o.jsx(R2,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&o.jsx(ve,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:o.jsx(ie,{color:"secondary","aria-label":"create",children:o.jsx(ue,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:o.jsx(T0,{sx:{fontSize:18}})})})}),o.jsx(ve,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:o.jsx(ie,{color:"primary","aria-label":"delete",onClick:()=>N(P),children:o.jsx(C0,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),I=y?o.jsx(r2,{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:U,onError:k,extraParams:{projectId:x.id,did:f.meta.did,name:x.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return o.jsxs(Nt,{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:r("common.blockletStudio")}),o.jsx(ve,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:o.jsx(N0,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),o.jsxs(Ze,{onClick:S,variant:"contained",children:[o.jsx(g1,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),o.jsx(z,{mt:3}),o.jsx(b1,{className:"main-table",locale:n,data:g,columns:V,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&o.jsx(j1,{title:`${r("common.delete")} ${x.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:T,onCancel:()=>b(null),children:o.jsx(z,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(M=>o.jsxs(z,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[o.jsx(C2,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),o.jsx(J,{component:"span",variant:"inherit",color:"text.secondary",children:M})]}))})}),I]})}k1.propTypes={initUrl:h.object};k1.defaultProps={initUrl:null};const Nt=ae(z)`
1
+ const __vite__fileDeps=["assets/react-iG64dalH.js","assets/index-Dmbbtwcx.js","assets/index-CCovGSMB.css","assets/index-BX4EYBTI.js","assets/preact.module-B1z5cdvs.js","assets/index-DT-emwXk.js","assets/index-C1bE9VVH.js","assets/toUpper-DvPEhWeW.js","assets/index-DDlZxdHs.js","assets/fallback-DfrimSeM.js","assets/index-BV6891pg.js","assets/Toolbar-DX1aq1wO.js","assets/Hidden-CVIT9GQJ.js","assets/index-L5tSQmgu.js","assets/MoreVert-Dw6DD_Y2.js","assets/selector-B2CAnybg.js","assets/ExpandMore-DjWcUZ_t.js","assets/Avatar-CR4hwIIm.js","assets/useSlot-BhbSJM-8.js","assets/resource-dialog-BGVNvpOa.js","assets/OpenInNew-DbfI3Lh3.js","assets/CloseOutlined-ZLLhO9hq.js","assets/use-mobile-CQDS3X6b.js","assets/Link-CyjzJAjs.js","assets/index-CurAG5ra.js","assets/index-D5aNUG7R.js","assets/index-BOI9Etqy.js","assets/FormControlLabel-xqZ79iQ8.js","assets/useFormControl-ThWDsTIL.js","assets/index-DZJL1WDO.js","assets/FilterList-DclE2l4O.js","assets/useThemeProps-B8VNQkzV.js","assets/toPropertyKey-hKuLU48H.js","assets/FormControl-CTJIBsW8.js","assets/FormGroup-B7SNePwe.js","assets/InputLabel-o8Jz2Es-.js","assets/ListItemText-CRfaCcXD.js","assets/Select-B7YRgule.js","assets/TextField-endZMNmB.js","assets/LastPage-DOrkqqL0.js","assets/index-BXLC5YsG.js","assets/redux-CSBj6943.js","assets/Search-5XN6Shqj.js","assets/Delete-CRjviPIR.js","assets/index-dy4QInQY.js","assets/url-join-BXgiL0Wq.js","assets/uniqBy-CkxUwg8y.js","assets/react-BW7E7-P9.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
2
+ import{ap as o2,j as o,aD as se,cF as m0,aH as O,fo as G1,aG as be,aB as $e,aC as Fe,T as J,r as C,aF as x1,aI as l2,aJ as Ue,aK as qe,cL as s2,fp as o1,X as Te,Y as Ne,B as z,m as Oe,P as h,$ as We,F as X,e as m1,u as le,aM as je,aV as Ve,bu as l1,a1 as Ze,L as ue,bH as v0,a as ve,az as ie,J as r2,s as $,Z as ae,ds as n2,a9 as Ce,c as he,G as i2,bS as v1,cd as g0,cA as a2,cJ as He,cK as b0,af as c2,c_ as d2,cE as Xe,bB as pe,c0 as Je,fa as u2,a7 as K1,b as oe,bj as p2,du as h2,ae as j0,bk as f2,ck as x2,aQ as X1,aP as m2,a2 as w0,fq as J1,e$ as Ie,bh as v2,aq as R0,cR as g2,k as b2,ay as j2,am as w2,an as r1}from"./index-Dmbbtwcx.js";import{d as g1}from"./Add-CG0lOPyd.js";import{d as R2}from"./AddBox-Cwjttlhg.js";import{d as C0}from"./Delete-CRjviPIR.js";import{d as C2}from"./Error-pSlqmXD8.js";import{D as b1}from"./index-DZJL1WDO.js";import{T as y0,b as y2}from"./index-CKcMAUDG.js";import{C as j1}from"./confirm-6IBLCQWG.js";import{u as s1}from"./session-CUH6PcMg.js";import{W as Q1}from"./did-address-DbLRcPW2.js";import{B as w1,d as z2}from"./ChevronRight-DyDbYWH3.js";import{S as ge}from"./shorten-label-C5kLk3Aq.js";import{A as z0}from"./Avatar-CR4hwIIm.js";import{d as S2}from"./Download-BzWUtZG0.js";import{d as k2}from"./QuestionMarkCircle-DM_KgJxi.js";import{b as M2,c as Y1,T as I2}from"./index-CurAG5ra.js";import{_ as Me}from"./useSetState-B70PB8qU.js";import{c as R1}from"./index-C1bE9VVH.js";import{C as d1,F as u1,S as L2}from"./FormControlLabel-xqZ79iQ8.js";import{A as S0}from"./Alert-g4kHOcZt.js";import{p as e1}from"./index-HqFqdQ4r.js";import"./api-BNgzqvJ7.js";import{i as P2}from"./index-Bybdue8D.js";import{d as T2}from"./ExpandMore-DjWcUZ_t.js";import{d as N2}from"./OpenInNew-DbfI3Lh3.js";import{u as k0}from"./useThemeProps-B8VNQkzV.js";import{u as V2}from"./useSlotProps-D0ZQmbeH.js";import{d as D2}from"./DeleteOutline-C5wDmNvo.js";import{c as _2,A as M0,u as B2,S as E2,U as A2}from"./item-BDrWi6Cq.js";import{d as O2}from"./ArrowDropDown-BTiX8PXn.js";import{f as Pe}from"./format-error-BhfIHXu5.js";import{B as p1}from"./ButtonGroup-CgY-ppCE.js";import{T as Le}from"./TextField-endZMNmB.js";import{M as C1}from"./InputAdornment-BtP5WuDE.js";import{C as H2}from"./click-to-copy-D1J7QI3P.js";import{d as $2}from"./Launch-CPwTTy1C.js";import{L as F2}from"./MoreVert-Dw6DD_Y2.js";import{a as U2}from"./ListItemText-CRfaCcXD.js";import{S as Z1}from"./index-BOI9Etqy.js";import{M as q2}from"./index-CyJ9Y2Pj.js";import{r as W2}from"./index-BmnLIYuM.js";import{d as G2}from"./Done-Cl6BxREa.js";import{c as I0,d as L0,b as K2,S as X2,a as J2}from"./Stepper-ipc5scPk.js";import{R as Q2,a as e0}from"./RadioGroup-4mE-Sstp.js";import"./FilterList-DclE2l4O.js";import"./toPropertyKey-hKuLU48H.js";import"./FormControl-CTJIBsW8.js";import"./useFormControl-ThWDsTIL.js";import"./FormGroup-B7SNePwe.js";import"./InputLabel-o8Jz2Es-.js";import"./Select-B7YRgule.js";import"./LastPage-DOrkqqL0.js";import"./Toolbar-DX1aq1wO.js";import"./index-BXLC5YsG.js";import"./redux-CSBj6943.js";import"./Search-5XN6Shqj.js";import"./index-D5aNUG7R.js";import"./Link-CyjzJAjs.js";import"./useSlot-BhbSJM-8.js";import"./jss-plugin-props-sort.esm-CxybFEV3.js";const Y2=o2(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"),Z2=["slots","slotProps"],et=se(m0)(({theme:e})=>O({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":O({},e.palette.mode==="light"?{backgroundColor:e.palette.grey[200]}:{backgroundColor:e.palette.grey[600]}),"&:active":O({boxShadow:e.shadows[0]},e.palette.mode==="light"?{backgroundColor:G1(e.palette.grey[200],.12)}:{backgroundColor:G1(e.palette.grey[600],.12)})})),tt=se(Y2)({width:24,height:16});function ot(e){const{slots:t={},slotProps:l={}}=e,r=be(e,Z2),n=e;return o.jsx("li",{children:o.jsx(et,O({focusRipple:!0},r,{ownerState:n,children:o.jsx(tt,O({as:t.CollapsedIcon,ownerState:n},l.collapsedIcon))}))})}function lt(e){return Fe("MuiBreadcrumbs",e)}const st=$e("MuiBreadcrumbs",["root","ol","li","separator"]),rt=st,nt=["children","className","component","slots","slotProps","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"],it=e=>{const{classes:t}=e;return qe({root:["root"],li:["li"],ol:["ol"],separator:["separator"]},lt,t)},at=se(J,{name:"MuiBreadcrumbs",slot:"Root",overridesResolver:(e,t)=>[{[`& .${rt.li}`]:t.li},t.root]})({}),ct=se("ol",{name:"MuiBreadcrumbs",slot:"Ol",overridesResolver:(e,t)=>t.ol})({display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"}),dt=se("li",{name:"MuiBreadcrumbs",slot:"Separator",overridesResolver:(e,t)=>t.separator})({display:"flex",userSelect:"none",marginLeft:8,marginRight:8});function ut(e,t,l,r){return e.reduce((n,d,i)=>(i<e.length-1?n=n.concat(d,o.jsx(dt,{"aria-hidden":!0,className:t,ownerState:r,children:l},`separator-${i}`)):n.push(d),n),[])}const pt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiBreadcrumbs"}),{children:n,className:d,component:i="nav",slots:a={},slotProps:u={},expandText:f="Show path",itemsAfterCollapse:x=1,itemsBeforeCollapse:b=1,maxItems:y=8,separator:p="/"}=r,c=be(r,nt),[m,g]=C.useState(!1),v=O({},r,{component:i,expanded:m,expandText:f,itemsAfterCollapse:x,itemsBeforeCollapse:b,maxItems:y,separator:p}),R=it(v),S=l2({elementType:a.CollapsedIcon,externalSlotProps:u.collapsedIcon,ownerState:v}),N=C.useRef(null),T=k=>{const U=()=>{g(!0);const V=N.current.querySelector("a[href],button,[tabindex]");V&&V.focus()};return b+x>=k.length?k:[...k.slice(0,b),o.jsx(ot,{"aria-label":f,slots:{CollapsedIcon:a.CollapsedIcon},slotProps:{collapsedIcon:S},onClick:U},"ellipsis"),...k.slice(k.length-x,k.length)]},L=C.Children.toArray(n).filter(k=>C.isValidElement(k)).map((k,U)=>o.jsx("li",{className:R.li,children:k},`child-${U}`));return o.jsx(at,O({ref:l,component:i,color:"text.secondary",className:Ue(R.root,d),ownerState:v},c,{children:o.jsx(ct,{className:R.ol,ref:N,ownerState:v,children:ut(m||y&&L.length<=y?L:T(L),R.separator,p,v)})}))}),P0=pt;function ht(e){return Fe("MuiStepButton",e)}const ft=$e("MuiStepButton",["root","horizontal","vertical","touchRipple"]),t0=ft,xt=["children","className","icon","optional"],mt=e=>{const{classes:t,orientation:l}=e;return qe({root:["root",l],touchRipple:["touchRipple"]},ht,t)},vt=se(m0,{name:"MuiStepButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[{[`& .${t0.touchRipple}`]:t.touchRipple},t.root,t[l.orientation]]}})(({ownerState:e})=>O({width:"100%",padding:"24px 16px",margin:"-24px -16px",boxSizing:"content-box"},e.orientation==="vertical"&&{justifyContent:"flex-start",padding:"8px",margin:"-8px"},{[`& .${t0.touchRipple}`]:{color:"rgba(0, 0, 0, 0.3)"}})),gt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiStepButton"}),{children:n,className:d,icon:i,optional:a}=r,u=be(r,xt),{disabled:f,active:x}=C.useContext(I0),{orientation:b}=C.useContext(L0),y=O({},r,{orientation:b}),p=mt(y),c={icon:i,optional:a},m=s2(n,["StepLabel"])?C.cloneElement(n,c):o.jsx(K2,O({},c,{children:n}));return o.jsx(vt,O({focusRipple:!0,disabled:f,TouchRippleProps:{className:p.touchRipple},className:Ue(p.root,d),ref:l,ownerState:y,"aria-current":x?"step":void 0},u,{children:m}))}),bt=gt;function jt(e){return Fe("MuiStepContent",e)}$e("MuiStepContent",["root","last","transition"]);const wt=["children","className","TransitionComponent","transitionDuration","TransitionProps"],Rt=e=>{const{classes:t,last:l}=e;return qe({root:["root",l&&"last"],transition:["transition"]},jt,t)},Ct=se("div",{name:"MuiStepContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:l}=e;return[t.root,l.last&&t.last]}})(({ownerState:e,theme:t})=>O({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"})),yt=se(o1,{name:"MuiStepContent",slot:"Transition",overridesResolver:(e,t)=>t.transition})({}),zt=C.forwardRef(function(t,l){const r=x1({props:t,name:"MuiStepContent"}),{children:n,className:d,TransitionComponent:i=o1,transitionDuration:a="auto",TransitionProps:u}=r,f=be(r,wt);C.useContext(L0);const{active:x,last:b,expanded:y}=C.useContext(I0),p=O({},r,{last:b}),c=Rt(p);let m=a;return a==="auto"&&!i.muiSupportAuto&&(m=void 0),o.jsx(Ct,O({className:Ue(c.root,d),ref:l,ownerState:p},f,{children:o.jsx(yt,O({as:i,in:x||y,className:c.transition,ownerState:p,timeout:m,unmountOnExit:!0},u,{children:n}))}))}),St=zt;var y1={},kt=Ne;Object.defineProperty(y1,"__esModule",{value:!0});var T0=y1.default=void 0,Mt=kt(Te()),It=o;T0=y1.default=(0,Mt.default)((0,It.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 z1={},Lt=Ne;Object.defineProperty(z1,"__esModule",{value:!0});var N0=z1.default=void 0,Pt=Lt(Te()),Tt=o;N0=z1.default=(0,Pt.default)((0,Tt.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 ze({size:e,...t}){return o.jsx(z,{display:"flex",mt:4,...t,children:o.jsx(Oe,{size:e})})}ze.propTypes={size:h.number};ze.defaultProps={size:24};function S1({did:e,projectId:t,title:l,logo:r,describe:n}){const i=`${`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e}/${t}/logo/upload`}/${r}`,[a,u]=C.useState(!1),f=We(x=>x.breakpoints.down("md"));return o.jsxs(z,{sx:{display:"flex",flexDirection:"row",color:a?"primary.main":"grey.900",gap:1},onPointerEnter:()=>u(!0),onPointerLeave:()=>u(!1),children:[o.jsx(z0,{sx:{borderRadius:1},src:i}),o.jsxs(z,{children:[o.jsx(ge,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:l||"/"}),o.jsx(ge,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||a?"primary.main":"grey.700"},children:n||"/"})]})]})}S1.propTypes={projectId:h.string.isRequired,did:h.string.isRequired,title:h.string.isRequired,logo:h.string.isRequired,describe:h.string.isRequired};function k1({initUrl:e}){const t=m1(),l=(e==null?void 0:e.searchParams.get("tenantScope"))||"",{t:r,locale:n}=le(),{api:d}=je(),{api:i}=s1(),[a,u]=C.useState(!0),{blocklet:f}=Ve(),[x,b]=C.useState(null),[y,p]=C.useState(!1),c=We(M=>M.breakpoints.down("xl")),{componentDid:m=""}=l1(),[g,v]=C.useState(null),R=()=>{d.getProjects({input:{did:f.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)})},S=()=>{t(`${X.UNOWNED_DID}/create/none`,{replace:!0})},N=M=>{b(M)},T=()=>{u(!1),p(!0)},L=()=>{p(!1),b(null)},k=M=>{$.error(M.message),p(!1),b(null)},U=M=>{if(!(M!=null&&M.deleted)){$.error("Delete project failed");return}R(),p(!1),b(null)};if(C.useEffect(()=>{R()},[]),!g&&a)return o.jsx(z,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:o.jsx(ze,{})});if(!g)return null;if(!g.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:r("blocklet.publish.blockletEmptyTip")}),o.jsx(z,{sx:{fontSize:14,color:"text.secondary",mb:3},children:r("blocklet.publish.createBlockletTip")}),o.jsx(Ze,{onClick:S,variant:"contained",children:r("blocklet.publish.createBlocklet")})]});const V=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:M=>{const P=g[M];return o.jsx(ue,{to:`${P.id}`,children:o.jsx(S1,{did:f.meta.did,projectId:P.id,logo:P.blockletLogo,title:P.blockletTitle,describe:P.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{customBodyRender:M=>M?o.jsx(y0,{type:"success",children:M}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:M=>M?o.jsx(Q1,{size:14,compact:!0,responsive:!1,did:M}):null}},c||m?null:{label:r("common.createdBy"),name:"createdBy",options:{customBodyRender:M=>M?o.jsx(Q1,{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}},c||m?null:{label:r("common.scope"),name:"componentDid",options:{customBodyRender:M=>{const P=(f.children||[]).find(E=>E.meta.did===M);return P?o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(w1,{size:14,blocklet:P,ancestors:[f]}),o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:P.meta.title})]},M):""}}},c||l?null:{label:r("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:M=>o.jsx(z,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:o.jsx(ge,{children:M})})}},{label:r("common.updatedAt"),name:"updatedAt",options:{customBodyRender:M=>o.jsx(v0,{value:Number(M),locale:n})}},{label:r("common.actions"),name:"actions",options:{customBodyRenderLite:M=>{const P=g[M];return o.jsxs(z,{display:"flex",children:[o.jsx(ue,{to:`${P.id}/new-release/${P.lastReleaseId}`,children:o.jsx(ve,{title:r("blocklet.publish.createRelease"),placement:"top",children:o.jsx(ie,{color:"primary","aria-label":"create",children:o.jsx(R2,{style:{fontSize:18}})})})}),!!P.lastReleaseId&&o.jsx(ve,{title:r("blocklet.publish.viewLastRelease",{name:P.blockletTitle}),placement:"top",children:o.jsx(ie,{color:"secondary","aria-label":"create",children:o.jsx(ue,{style:{display:"flex"},to:`${P.id}/view/${P.lastReleaseId}`,children:o.jsx(T0,{sx:{fontSize:18}})})})}),o.jsx(ve,{title:r("blocklet.publish.delete",{name:P.blockletTitle}),placement:"top",children:o.jsx(ie,{color:"primary","aria-label":"delete",onClick:()=>N(P),children:o.jsx(C0,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),I=y?o.jsx(r2,{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:U,onError:k,extraParams:{projectId:x.id,did:f.meta.did,name:x.blockletTitle},messages:{title:r("blocklet.publish.deleteProject.title",{name:x.blockletTitle}),scan:r("blocklet.publish.deleteProject.scan",{name:x.blockletTitle}),confirm:r("blocklet.publish.deleteProject.confirm"),success:r("blocklet.publish.deleteProject.success")}}):null;return o.jsxs(Nt,{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:r("common.blockletStudio")}),o.jsx(ve,{title:r("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:o.jsx(N0,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),o.jsxs(Ze,{onClick:S,variant:"contained",children:[o.jsx(g1,{style:{fontSize:"1.3em",marginRight:4}}),r("blocklet.publish.createBlocklet")]})]}),o.jsx(z,{mt:3}),o.jsx(b1,{className:"main-table",locale:n,data:g,columns:V,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1}}),x&&o.jsx(j1,{title:`${r("common.delete")} ${x.blockletTitle}`,description:r("blocklet.publish.deleteProject.description"),confirm:r("common.confirm"),onConfirm:T,onCancel:()=>b(null),children:o.jsx(z,{sx:{marginTop:2},children:[r("blocklet.publish.deleteProject.tip1"),r("blocklet.publish.deleteProject.tip2"),r("blocklet.publish.deleteProject.tip3")].map(M=>o.jsxs(z,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[o.jsx(C2,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),o.jsx(J,{component:"span",variant:"inherit",color:"text.secondary",children:M})]}))})}),I]})}k1.propTypes={initUrl:h.object};k1.defaultProps={initUrl:null};const Nt=ae(z)`
3
3
  .main-table > div:first-child {
4
4
  display: none;
5
5
  }
@@ -133,7 +133,7 @@ import{ao as o2,j as o,aC as se,cF as m0,aG as O,fo as G1,aF as be,aA as $e,aB a
133
133
  background: #fff;
134
134
  z-index: 10;
135
135
  }
136
- `,a0="lastWantToConnectStoreId";function ql(e){var a,u;const[t,l]=C.useState(null),{session:r}=s1(),n=C.useCallback(f=>{l(f),localStorage.setItem(a0,f==null?void 0:f.id)},[l]),d=C.useMemo(()=>{var y,p,c,m;const f=localStorage.getItem(a0),x=f?(((y=e==null?void 0:e.settings)==null?void 0:y.storeList)||[]).find(g=>g.id===f):null;if(x)return x;let b=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(g=>{var v;return!(g.id!==X.BLOCKLET_STORE.id||g.scope&&g.scope!=="studio"&&g.scope!==((v=r==null?void 0:r.user)==null?void 0:v.did))});return b||(b=(m=(c=e==null?void 0:e.settings)==null?void 0:c.storeList)==null?void 0:m[0]),b},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(u=r==null?void 0:r.user)==null?void 0:u.did]);return[t||d||{},n]}const a1={};async function $0(e,{interval:t=1e3,maxDuration:l=120*1e3,intervalFirst:r=4e3,timerKey:n=""}){a1[n]&&clearTimeout(a1[n]),await new Promise(a=>setTimeout(a,r));const d=Date.now(),i=async(a,u)=>{try{const f=await e();a(f)}catch(f){Date.now()-d>l?u(f):n?a1[n]=setTimeout(()=>i(a,u),t):setTimeout(()=>i(a,u),t)}};return new Promise(i)}function Wl(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Gl(e,{did:t,projectId:l,messageId:r}){return $0(async()=>{var d;const n=await e.getProject({input:{did:t,projectId:l,messageId:r}});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 Kl(e,{did:t,projectId:l,storeId:r}){return $0(async()=>{var i,a;const n=await e.getProject({input:{did:t,projectId:l,messageId:""}});if(!((a=(i=n==null?void 0:n.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!n.project.connectedStores.find(u=>u.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const F0=({fromBlocklet:e,nodeInfo:t,blocklet:l,userDid:r})=>{var i,a;const n=e?(i=l==null?void 0:l.meta)==null?void 0:i.did:t==null?void 0:t.did;let d=e?((a=l==null?void 0:l.settings)==null?void 0:a.storeList)||[]:(t==null?void 0:t.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(u=>u.protected||!u.scope||u.scope==="studio"||u.scope===r),{teamDid:n,storeList:d}};function E1({blocklet:e,store:t={},onChangeStore:l,onClick:r,disabled:n,loading:d,componentDid:i}){var P,E,A;const{t:a}=le(),{session:u}=s1(),{api:f,info:x,inService:b}=je(),y=Ve(),[p,c]=C.useState(!1),m=C.useRef(null),[g,v]=C.useState(!1),[R,S]=C.useState(null),N=H=>{l(H),c(!1)},T=()=>{c(!0)},L=H=>{m.current&&m.current.contains(H.target)||c(!1)},k=()=>{v(!0)},U=()=>{v(!1)},V=async()=>{var H;if(R)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:R.url,projectId:"",scope:R.scope||"studio"}}),await((H=y==null?void 0:y.actions)==null?void 0:H.refreshBlocklet())}catch(q){$.error(`Remove Blocklet Store Error: ${Pe(q)}`)}finally{S(null)}},{storeList:I}=F0({fromBlocklet:b,blocklet:e,nodeInfo:x,componentDid:i,userDid:(P=u==null?void 0:u.user)==null?void 0:P.did}),M=(E=e==null?void 0:e.meta)==null?void 0:E.did;return o.jsxs(o.Fragment,{children:[o.jsxs(p1,{disabled:n,ref:m,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[o.jsxs(oe,{onClick:r,children:[d&&o.jsx(Oe,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${t.name||""}`]}),o.jsx(oe,{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(O2,{})})]}),o.jsx(p2,{sx:{zIndex:10},open:p,anchorEl:m.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:H})=>o.jsx(h2,{...H,style:{transformOrigin:"center top"},children:o.jsx(j0,{children:o.jsx(f2,{onClickAway:L,children:o.jsxs(x2,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[I==null?void 0:I.map(q=>{var K;return o.jsxs(X1,{selected:q.id===(t==null?void 0:t.id),sx:{height:56},onClick:()=>N(q),children:[o.jsxs(z,{children:[o.jsx(ge,{sx:{fontSize:"16px"},maxLength:24,children:q.name}),o.jsx(ge,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:q.url})]}),_2({store:q,userDid:(K=u==null?void 0:u.user)==null?void 0:K.did})&&o.jsx(ie,{sx:{ml:1},onClick:G=>{G.preventDefault(),G.stopPropagation(),S(q)},children:o.jsx(pe,{icon:"ic:outline-delete"})})]},q.url)}),o.jsx(m2,{}),o.jsxs(X1,{onClick:k,children:[o.jsx(g1,{font:!0}),o.jsx(J,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),g&&o.jsx(M0,{hiddenChildren:!0,open:!0,onClose:U,teamDid:M,storeList:I,scope:"studio",onAdd:(A=y==null?void 0:y.actions)==null?void 0:A.refreshBlocklet}),R&&o.jsx(j1,{displayError:!0,title:`${a("common.delete")} ${R.name}`,description:a("blocklet.publish.deleteStoreTip",{name:R.name}),confirm:a("common.confirm"),onConfirm:V,onCancel:()=>S(null)})]})}E1.propTypes={store:h.object,blocklet:h.object,onChangeStore:h.func.isRequired,onClick:h.func.isRequired,loading:h.bool.isRequired,disabled:h.bool.isRequired,componentDid:h.string.isRequired,projectType:h.string.isRequired,getData:h.func.isRequired};E1.defaultProps={store:null,blocklet:null};const c0=[".webp",".jpg",".jpeg",".png",".gif",".svg"],d0=1024*1024*10,u0=C.lazy(()=>w0(()=>import("./react-Z_lC3NCb.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,43,44,45,46,47])).then(e=>({default:e.Uploader})));function U0({projectId:e,readOnly:t,loading:l,blocklet:r,params:n,setParams:d,paramsErrTip:i,setParamsErrTip:a,setLoading:u,initUrl:f,initLogoUrl:x,setInitLogoUrl:b,componentDid:y}){const{t:p}=le(),{api:c}=je(),m=m1(),g=C.useRef(null),v=C.useRef(null),[R,S]=ql(r),N=B2({messageType:"connect-store-message",onOpen:()=>u(!0),onClose:()=>u(!1)}),T=async P=>{const E=setTimeout(()=>{u(!1)},2e4),A=await Gl(c,P);u(!1),clearTimeout(E),window.parent.postMessage({event:"studioDialog.connected",componentDid:y},"*"),m(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${A}/create`),{replace:!0})},L=()=>{if(!n.blockletTitle){$.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){$.error(p("blocklet.publish.noStoreSelected"));return}const P=Wl();N(async(E,A)=>{var H,q,K;try{const G=await c.connectByStudio({input:{did:(H=r==null?void 0:r.meta)==null?void 0:H.did,blockletTitle:n==null?void 0:n.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((q=n==null?void 0:n.blockletComponents)==null?void 0:q.length)>0?"pack":"resource",componentDid:y,messageId:P,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(G!=null&&G.url)){$.error("failed to connect to store");return}A(G.url),T({did:(K=r==null?void 0:r.meta)==null?void 0:K.did,projectId:"",messageId:P})}catch(G){const Y=Pe(G);$.error(Y),u(!1)}})},k=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,U=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,V=n!=null&&n.blockletLogo?`${k}/${n.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,I=((n==null?void 0:n.blockletScreenshots)||[]).filter(Boolean).map(P=>`${U}/${P}`),M=()=>t?!1:!e||e===X.UNOWNED_DID?($.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0;return o.jsxs(Xl,{children:[o.jsx(z,{display:"flex",className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Le,{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=>{a({blockletTitle:""}),d({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),o.jsx(Le,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===X.UNOWNED_DID&&o.jsx(C1,{position:"end",children:o.jsx(E1,{blocklet:r,store:R,componentDid:y,onChangeStore:S,disabled:!n.blockletTitle||t||l,loading:l,onClick:L})})},error:!!i.projectId,helperText:i.projectId||"",value:e===X.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),o.jsx(Le,{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=>{a({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(J,{variant:"subtitle1",sx:{mr:2},children:p("common.logo")}),o.jsx(z,{sx:{flex:1,cursor:t?"default":"pointer"},children:o.jsx(z0,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:x||V,onClick:()=>{M()&&g.current.open()}})})]}),o.jsxs(z,{display:"flex",mt:3,children:[o.jsx(J,{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,E)=>o.jsxs(z,{className:"screenshot",children:[o.jsx("img",{alt:"screenshot",src:P}),!t&&o.jsx(ie,{className:"action",onClick:()=>{d(A=>{const H=[...A.blockletScreenshots];return H.splice(E,1),{...A,blockletScreenshots:H}})},children:o.jsx(D2,{})})]},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(C.Suspense,{fallback:o.jsx(ze,{}),children:[o.jsx(u0,{ref:g,popup:!0,onUploadFinish:P=>{d({blockletLogo:P.data.filename}),b(""),g.current.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:k,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:c0,maxFileSize:d0,maxNumberOfFiles:1}}},"uploader-logo"),o.jsx(u0,{ref:v,popup:!0,onUploadFinish:P=>{d(E=>{var H;const A=E.blockletScreenshots||[];return A.push((H=P.data)==null?void 0:H.filename),{...E,blockletScreenshots:A}}),v.current.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:U,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:c0,maxFileSize:d0,maxNumberOfFiles:5-I.length}}},"uploader-screenshot")]})]})}U0.propTypes={projectId:h.string.isRequired,readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,loading:h.bool.isRequired,blocklet:h.object.isRequired,setLoading:h.func.isRequired,initUrl:h.object.isRequired,componentDid:h.isRequired,initLogoUrl:h.string.isRequired,setInitLogoUrl:h.func.isRequired};const Xl=ae.div`
136
+ `,a0="lastWantToConnectStoreId";function ql(e){var a,u;const[t,l]=C.useState(null),{session:r}=s1(),n=C.useCallback(f=>{l(f),localStorage.setItem(a0,f==null?void 0:f.id)},[l]),d=C.useMemo(()=>{var y,p,c,m;const f=localStorage.getItem(a0),x=f?(((y=e==null?void 0:e.settings)==null?void 0:y.storeList)||[]).find(g=>g.id===f):null;if(x)return x;let b=(((p=e==null?void 0:e.settings)==null?void 0:p.storeList)||[]).find(g=>{var v;return!(g.id!==X.BLOCKLET_STORE.id||g.scope&&g.scope!=="studio"&&g.scope!==((v=r==null?void 0:r.user)==null?void 0:v.did))});return b||(b=(m=(c=e==null?void 0:e.settings)==null?void 0:c.storeList)==null?void 0:m[0]),b},[(a=e==null?void 0:e.settings)==null?void 0:a.storeList,(u=r==null?void 0:r.user)==null?void 0:u.did]);return[t||d||{},n]}const a1={};async function $0(e,{interval:t=1e3,maxDuration:l=120*1e3,intervalFirst:r=4e3,timerKey:n=""}){a1[n]&&clearTimeout(a1[n]),await new Promise(a=>setTimeout(a,r));const d=Date.now(),i=async(a,u)=>{try{const f=await e();a(f)}catch(f){Date.now()-d>l?u(f):n?a1[n]=setTimeout(()=>i(a,u),t):setTimeout(()=>i(a,u),t)}};return new Promise(i)}function Wl(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Gl(e,{did:t,projectId:l,messageId:r}){return $0(async()=>{var d;const n=await e.getProject({input:{did:t,projectId:l,messageId:r}});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 Kl(e,{did:t,projectId:l,storeId:r}){return $0(async()=>{var i,a;const n=await e.getProject({input:{did:t,projectId:l,messageId:""}});if(!((a=(i=n==null?void 0:n.project)==null?void 0:i.connectedStores)!=null&&a.length))throw new Error("Connected store not found");if(!n.project.connectedStores.find(u=>u.storeId===r))throw new Error("Connected store not found")},{timerKey:`connect-store-${r}`})}const F0=({fromBlocklet:e,nodeInfo:t,blocklet:l,userDid:r})=>{var i,a;const n=e?(i=l==null?void 0:l.meta)==null?void 0:i.did:t==null?void 0:t.did;let d=e?((a=l==null?void 0:l.settings)==null?void 0:a.storeList)||[]:(t==null?void 0:t.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(u=>u.protected||!u.scope||u.scope==="studio"||u.scope===r),{teamDid:n,storeList:d}};function E1({blocklet:e,store:t={},onChangeStore:l,onClick:r,disabled:n,loading:d,componentDid:i}){var P,E,A;const{t:a}=le(),{session:u}=s1(),{api:f,info:x,inService:b}=je(),y=Ve(),[p,c]=C.useState(!1),m=C.useRef(null),[g,v]=C.useState(!1),[R,S]=C.useState(null),N=H=>{l(H),c(!1)},T=()=>{c(!0)},L=H=>{m.current&&m.current.contains(H.target)||c(!1)},k=()=>{v(!0)},U=()=>{v(!1)},V=async()=>{var H;if(R)try{await f.deleteBlockletStore({input:{teamDid:e.meta.did,url:R.url,projectId:"",scope:R.scope||"studio"}}),await((H=y==null?void 0:y.actions)==null?void 0:H.refreshBlocklet())}catch(q){$.error(`Remove Blocklet Store Error: ${Pe(q)}`)}finally{S(null)}},{storeList:I}=F0({fromBlocklet:b,blocklet:e,nodeInfo:x,componentDid:i,userDid:(P=u==null?void 0:u.user)==null?void 0:P.did}),M=(E=e==null?void 0:e.meta)==null?void 0:E.did;return o.jsxs(o.Fragment,{children:[o.jsxs(p1,{disabled:n,ref:m,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[o.jsxs(oe,{onClick:r,children:[d&&o.jsx(Oe,{size:14,sx:{mr:.5}}),`${a("common.connect")} ${t.name||""}`]}),o.jsx(oe,{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(O2,{})})]}),o.jsx(p2,{sx:{zIndex:10},open:p,anchorEl:m.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:H})=>o.jsx(h2,{...H,style:{transformOrigin:"center top"},children:o.jsx(j0,{children:o.jsx(f2,{onClickAway:L,children:o.jsxs(x2,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[I==null?void 0:I.map(q=>{var K;return o.jsxs(X1,{selected:q.id===(t==null?void 0:t.id),sx:{height:56},onClick:()=>N(q),children:[o.jsxs(z,{children:[o.jsx(ge,{sx:{fontSize:"16px"},maxLength:24,children:q.name}),o.jsx(ge,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:q.url})]}),_2({store:q,userDid:(K=u==null?void 0:u.user)==null?void 0:K.did})&&o.jsx(ie,{sx:{ml:1},onClick:G=>{G.preventDefault(),G.stopPropagation(),S(q)},children:o.jsx(pe,{icon:"ic:outline-delete"})})]},q.url)}),o.jsx(m2,{}),o.jsxs(X1,{onClick:k,children:[o.jsx(g1,{font:!0}),o.jsx(J,{variant:"inherit",children:a("store.blockletRegistry.addRegistry")})]})]})})})})}),g&&o.jsx(M0,{hiddenChildren:!0,open:!0,onClose:U,teamDid:M,storeList:I,scope:"studio",onAdd:(A=y==null?void 0:y.actions)==null?void 0:A.refreshBlocklet}),R&&o.jsx(j1,{displayError:!0,title:`${a("common.delete")} ${R.name}`,description:a("blocklet.publish.deleteStoreTip",{name:R.name}),confirm:a("common.confirm"),onConfirm:V,onCancel:()=>S(null)})]})}E1.propTypes={store:h.object,blocklet:h.object,onChangeStore:h.func.isRequired,onClick:h.func.isRequired,loading:h.bool.isRequired,disabled:h.bool.isRequired,componentDid:h.string.isRequired,projectType:h.string.isRequired,getData:h.func.isRequired};E1.defaultProps={store:null,blocklet:null};const c0=[".webp",".jpg",".jpeg",".png",".gif",".svg"],d0=1024*1024*10,u0=C.lazy(()=>w0(()=>import("./react-iG64dalH.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,43,44,45,46,47])).then(e=>({default:e.Uploader})));function U0({projectId:e,readOnly:t,loading:l,blocklet:r,params:n,setParams:d,paramsErrTip:i,setParamsErrTip:a,setLoading:u,initUrl:f,initLogoUrl:x,setInitLogoUrl:b,componentDid:y}){const{t:p}=le(),{api:c}=je(),m=m1(),g=C.useRef(null),v=C.useRef(null),[R,S]=ql(r),N=B2({messageType:"connect-store-message",onOpen:()=>u(!0),onClose:()=>u(!1)}),T=async P=>{const E=setTimeout(()=>{u(!1)},2e4),A=await Gl(c,P);u(!1),clearTimeout(E),window.parent.postMessage({event:"studioDialog.connected",componentDid:y},"*"),m(window.location.pathname.replace(`${X.UNOWNED_DID}/create`,`${A}/create`),{replace:!0})},L=()=>{if(!n.blockletTitle){$.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(R!=null&&R.url)){$.error(p("blocklet.publish.noStoreSelected"));return}const P=Wl();N(async(E,A)=>{var H,q,K;try{const G=await c.connectByStudio({input:{did:(H=r==null?void 0:r.meta)==null?void 0:H.did,blockletTitle:n==null?void 0:n.blockletTitle,storeUrl:R.url,storeId:R.id,storeName:R.name,type:((q=n==null?void 0:n.blockletComponents)==null?void 0:q.length)>0?"pack":"resource",componentDid:y,messageId:P,tenantScope:(f==null?void 0:f.searchParams.get("tenantScope"))||""}});if(!(G!=null&&G.url)){$.error("failed to connect to store");return}A(G.url),T({did:(K=r==null?void 0:r.meta)==null?void 0:K.did,projectId:"",messageId:P})}catch(G){const Y=Pe(G);$.error(Y),u(!1)}})},k=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/logo/upload`,U=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${e}/screenshot/upload`,V=n!=null&&n.blockletLogo?`${k}/${n.blockletLogo}`:`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,I=((n==null?void 0:n.blockletScreenshots)||[]).filter(Boolean).map(P=>`${U}/${P}`),M=()=>t?!1:!e||e===X.UNOWNED_DID?($.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0;return o.jsxs(Xl,{children:[o.jsx(z,{display:"flex",className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Le,{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=>{a({blockletTitle:""}),d({blockletTitle:P.target.value})},error:!!i.blockletTitle,helperText:i.blockletTitle||""}),o.jsx(Le,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:e===X.UNOWNED_DID&&o.jsx(C1,{position:"end",children:o.jsx(E1,{blocklet:r,store:R,componentDid:y,onChangeStore:S,disabled:!n.blockletTitle||t||l,loading:l,onClick:L})})},error:!!i.projectId,helperText:i.projectId||"",value:e===X.UNOWNED_DID?"":`did:abt:${e}`,sx:{mt:3}}),o.jsx(Le,{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=>{a({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(J,{variant:"subtitle1",sx:{mr:2},children:p("common.logo")}),o.jsx(z,{sx:{flex:1,cursor:t?"default":"pointer"},children:o.jsx(z0,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:x||V,onClick:()=>{M()&&g.current.open()}})})]}),o.jsxs(z,{display:"flex",mt:3,children:[o.jsx(J,{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,E)=>o.jsxs(z,{className:"screenshot",children:[o.jsx("img",{alt:"screenshot",src:P}),!t&&o.jsx(ie,{className:"action",onClick:()=>{d(A=>{const H=[...A.blockletScreenshots];return H.splice(E,1),{...A,blockletScreenshots:H}})},children:o.jsx(D2,{})})]},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(C.Suspense,{fallback:o.jsx(ze,{}),children:[o.jsx(u0,{ref:g,popup:!0,onUploadFinish:P=>{d({blockletLogo:P.data.filename}),b(""),g.current.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:k,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:c0,maxFileSize:d0,maxNumberOfFiles:1}}},"uploader-logo"),o.jsx(u0,{ref:v,popup:!0,onUploadFinish:P=>{d(E=>{var H;const A=E.blockletScreenshots||[];return A.push((H=P.data)==null?void 0:H.filename),{...E,blockletScreenshots:A}}),v.current.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:U,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:c0,maxFileSize:d0,maxNumberOfFiles:5-I.length}}},"uploader-screenshot")]})]})}U0.propTypes={projectId:h.string.isRequired,readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,loading:h.bool.isRequired,blocklet:h.object.isRequired,setLoading:h.func.isRequired,initUrl:h.object.isRequired,componentDid:h.isRequired,initLogoUrl:h.string.isRequired,setInitLogoUrl:h.func.isRequired};const Xl=ae.div`
137
137
  margin-top: 24px;
138
138
  .screenshot {
139
139
  margin-bottom: 16px;
@@ -164,7 +164,7 @@ import{ao as o2,j as o,aC as se,cF as m0,aG as O,fo as G1,aF as be,aA as $e,aB a
164
164
  width: 100%; /* 图像宽度填充容器 */
165
165
  height: auto; /* 图像高度自适应 */
166
166
  }
167
- `;var A1={},Jl=Ne;Object.defineProperty(A1,"__esModule",{value:!0});var q0=A1.default=void 0,Ql=Jl(Te()),Yl=o;q0=A1.default=(0,Ql.default)((0,Yl.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 Zl=(e,t,l,r)=>{const n=e?[...e]:[],d=((t==null?void 0:t.children)||[]).reduce((i,a)=>(i[a.meta.did]=!0,i),{});return Object.keys(l).forEach(i=>{if(!d[i])return;let a=!1;r||n.forEach(u=>{u.did===i&&(u.included=!0,u.required=!0,a=!0)}),a||n.push({did:i,included:!0,required:!0})}),n},e3=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const t=e.split("/").pop().split("?")[0],r=await(await fetch(e)).blob();return new File([r],t,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*t3(e,t){let l=0;for(;l<e.size;)yield e.slice(l,l+t),l+=t}const o3=async({did:e,projectId:t,uploadType:l="logo",imageUrl:r})=>{const n=await e3(r);new FormData().append("file",n);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(n.name),name:encodeURIComponent(n.name),type:n.type},u=(await J1.post(he(X.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,f=2*1024*1024;let x=0,b="";for(const y of t3(n,f)){const p=await J1.patch(he(X.WELLKNOWN_SERVICE_PATH_PREFIX,u),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=y.size,b=p.data.filename}return b},W0=({params:e,hasSelectedResources:t,projectId:l,status:r,t:n})=>{const d=[];return e.blockletTitle||d.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),(!l||l===X.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?Ie.valid(e.blockletVersion)||d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.inValidVersion")}):d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),r===Ce.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},l3=({params:e,hasSelectedResources:t,step:l,t:r,projectId:n})=>{if(l===0){if(!e.blockletTitle)return r("blocklet.publish.errorTip.noTitle");if(!n||n===X.UNOWNED_DID)return r("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return r("blocklet.publish.errorTip.noDescription")}if(l===2&&!e.uploadedResource&&!t)return r("blocklet.publish.errorTip.noResource");if(l>=4){if(!e.blockletVersion)return r("blocklet.publish.errorTip.noVersion");if(!Ie.valid(e.blockletVersion))return r("blocklet.publish.errorTip.inValidVersion");if(!e.note)return r("blocklet.publish.errorTip.noNote")}return""};function O1({blocklet:e,releaseId:t,connectedStores:l,projectId:r,releaseType:n,publishedStoreIds:d,onPublish:i,onDelete:a,projectType:u,componentDid:f,onOpenConnectStore:x,behavior:b,onSelectConnectStore:y}){var S,N;const{t:p}=le(),{actions:{refreshBlocklet:c}}=Ve(),{session:m}=s1(),{storeList:g}=F0({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(S=m==null?void 0:m.user)==null?void 0:S.did}),v=C.useMemo(()=>l!=null&&l.length?l==null?void 0:l.reduce((T,L)=>(T[L.storeId]=L,T),{}):{},[l]),R=(N=e==null?void 0:e.meta)==null?void 0:N.did;return o.jsxs(o.Fragment,{children:[b==="connect"&&!!(g!=null&&g.length)&&o.jsx(S0,{severity:"info",style:{width:"100%"},children:o.jsxs(z,{color:y2[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($2,{sx:{marginLeft:1}})]})}),o.jsx(v2,{children:g==null?void 0:g.map(T=>o.jsx(F2,{"data-cy":"store-switch",children:o.jsx(U2,{children:o.jsx(E2,{behavior:b,onSelectConnectStore:y,releaseId:t,projectId:r,releaseType:n,kind:"publish",teamDid:R,store:T,published:(d==null?void 0:d.indexOf(T.id))>-1,connectedStore:v[T.id],onPublish:i,onDelete:a,scope:T.scope||"studio",onOpenConnectStore:x})})},T.url))}),o.jsx(M0,{teamDid:R,storeList:g,scope:"studio",onAdd:c})]})}O1.propTypes={blocklet:h.object.isRequired,projectId:h.string.isRequired,releaseId:h.string.isRequired,releaseType:h.string.isRequired,onPublish:h.func,onDelete:h.func,publishedStoreIds:h.arrayOf(h.string),connectedStores:h.arrayOf(h.object).isRequired,projectType:h.string,componentDid:h.string,onOpenConnectStore:h.func,onSelectConnectStore:h.func,behavior:h.string};O1.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function G0({did:e,params:t,setParams:l,projectId:r,open:n,onClose:d}){const{t:i}=le(),[a,u]=C.useState(!1),{api:f}=je(),[x,b]=C.useState(!1),[y,p]=C.useState(!1),c=()=>{b(t.autoUpload),p(t.possibleSameStore),u(!1),d(!1)},m=async()=>{u(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:t.blockletTitle,blockletDescription:t.blockletDescription,blockletIntroduction:t.blockletIntroduction,autoUpload:!!x,possibleSameStore:!!y}}),l({autoUpload:x,possibleSameStore:y}),d(!1)}catch(v){$.error(v.message)}u(!1)};C.useEffect(()=>{b(t.autoUpload),p(t.possibleSameStore)},[t]);const g=!!(r&&r!==X.UNOWNED_DID);return o.jsx(R0,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:n,onClose:c,actions:o.jsxs(o.Fragment,{children:[o.jsx(oe,{onClick:v=>{v.stopPropagation(),d()},color:"inherit",children:i("common.cancel")}),g&&o.jsxs(oe,{onClick:v=>{v.stopPropagation(),m()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&o.jsx(Oe,{size:16}),i("common.confirm")]})]}),children:g?o.jsxs(z,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[o.jsxs(z,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"ph:upload",sx:{fontSize:24,mr:2}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),o.jsx(Z1,{checked:x,onChange:(v,R)=>b(R)})]}),o.jsxs(z,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),o.jsx(Z1,{checked:y,onChange:(v,R)=>p(R)})]})]}):o.jsxs(z,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}G0.propTypes={did:h.string.isRequired,params:h.object.isRequired,open:h.bool.isRequired,onClose:h.func.isRequired,setParams:h.func.isRequired,projectId:h.string.isRequired};var x0;const c1=(x0=window.env)==null?void 0:x0.serverEndpoint;function K0({projectId:e,params:t,setParamsErrTip:l,initUrl:r,setParams:n,mode:d,loading:i,blocklet:a,release:u,isPublished:f,releaseId:x,getData:b,getRelease:y,componentDid:p,resourceRelateComponents:c,disabledSelectComponents:m,saveSelectedEventsRef:g,hasSelectedResources:v,initLogoUrl:R,setLoading:S,releaseUsedLast:N,setReleaseUsedLast:T,projectType:L}){var xe,de;const{t:k,locale:U}=le(),{api:V}=je(),I=m1(),[M,P]=C.useState(!1),[E,A]=C.useState(!1),[H,q]=C.useState(),K=We(F=>F.breakpoints.down("md")),G=((xe=t==null?void 0:t.blockletComponents)==null?void 0:xe.length)>0?"pack":"resource",Y=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:p},"*"),y()},Se=async F=>{var Ke,_e,Be;const Z=W0({params:t,hasSelectedResources:v,projectId:e,status:F,t:k});if(Z){$.error(Z.map(W=>W.message).join("; ")),l(Z.reduce((W,ee)=>({...W,[ee.param]:ee.message}),{}));return}const B={...t};if(B.blockletComponents=Zl(B.blockletComponents,a,c,m),B.blockletVersion=Ie.valid(B.blockletVersion),!B.blockletVersion){$.error("Invalid Blocklet Version"),l({blockletVersion:"Invalid Blocklet Version"});return}if(R)try{const W=await o3({did:a.meta.did,projectId:e,imageUrl:R});B.blockletLogo=W,n({blockletLogo:W})}catch(W){$.error(W.message);return}if(t.resourceFromSelect){B.uploadedResource="";try{const W=Object.keys(g.current);await e1(W.map(ee=>()=>{const Ee=g.current[ee];return $l({api:V,locale:U,projectId:e,releaseId:N?"":x,appDid:a.meta.did,component:Ee.component,resources:Ee.resources,initUrl:r})}),{concurrency:2})}catch(W){$.error(((Be=(_e=(Ke=W==null?void 0:W.response)==null?void 0:Ke.data)==null?void 0:_e.error)==null?void 0:Be.message)||W.message),l({blockletResource:"Invalid save the resource"});return}}else B.blockletComponents=[];B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(W=>W.included).map(W=>v1(W,["did","required"])).map(JSON.stringify);try{await V.createRelease({input:{...B,did:a.meta.did,projectId:e,releaseId:N?"":x,status:F}}),F==="draft"?$.success(k("blocklet.publish.saveDraftSuccess")):(T(!1),$.success(k("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:p},"*")),l({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(W){const ee=Pe(W);$.error(ee),(/resource/.test(ee)||/zip/.test(ee))&&l({blockletResource:ee})}const re=await V.getProject({input:{did:a.meta.did,projectId:e}}),ne=re.project.lastReleaseId;t.autoUpload&&await e1(re.project.connectedStores.map(W=>async()=>{try{const ee=await V.publishToStore({input:{did:a.meta.did,storeId:W.storeId,storeName:W.storeName,projectId:e,releaseId:ne,type:G}});$.success(o.jsx(A2,{storeName:W.storeName,storeUrl:W.storeUrl,developerDid:W.developerDid,published:ee.url==="published"}),{duration:1e4})}catch(ee){$.error(Pe(ee))}}),{concurrency:4}),Y==null||Y(),I(`../${e}/view/${ne}`,{replace:!0})},fe=F=>(S(!0),Se(F).finally(()=>{S(!1)})),ce=async F=>{await Kl(V,F),b()},te=()=>{A(!0)};let Q=null;if(f&&c1){const F=he(c1,`/api/project/${a.meta.did}/${e}/${x}/release/blocklet.json`);if(L==="pack"){const Z=new URL(c1);Z.pathname=he(Z.pathname,"/launch-blocklet/agreement"),Z.searchParams.set("blocklet_meta_url",F),Q=K?o.jsx(ie,{component:"a",disabled:i,href:Z.href,target:"_blank",rel:"noreferrer",color:"primary",sx:{mr:1},onClick:()=>q(F),children:o.jsx(pe,{icon:"ic:baseline-install-desktop"})}):o.jsx(oe,{href:Z.href,disabled:i,target:"_blank",rel:"noreferrer",variant:"outlined",sx:{mr:1},onClick:()=>q(F),children:k("common.install")})}else Q=o.jsxs(o.Fragment,{children:[K?o.jsx(ie,{disabled:i,color:"primary",sx:{mr:1},onClick:()=>q(F),children:o.jsx(pe,{icon:"ic:baseline-install-desktop"})}):o.jsx(oe,{disabled:i,variant:"outlined",sx:{mr:1},onClick:()=>q(F),children:k("blocklet.publish.copyInstallUrl")}),o.jsx(g2,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>q(""),children:o.jsxs(z,{sx:{py:5,px:4,wordBreak:"break-all"},children:[o.jsx(J,{variant:"h6",sx:{mb:2},children:k("blocklet.publish.installResourceTip")}),o.jsx(H2,{children:H}),o.jsxs(J,{sx:{mt:2},children:[k("blocklet.publish.installResourceTip2"),o.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:k("blocklet.publish.installResourceHelp")})]})]})})]})}return o.jsxs(o.Fragment,{children:[o.jsx(s3,{className:"sticky-header",children:o.jsxs(z,{display:"flex",alignItems:"center",flexDirection:"row",children:[o.jsxs(P0,{className:"breadcrumbs","aria-label":"breadcrumb",children:[o.jsx(ue,{to:"../",children:k("common.blockletStudio")}),e===X.UNOWNED_DID?o.jsx(J,{color:"text.primary",children:o.jsx(ge,{maxLength:K?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}):o.jsx(ue,{to:`../${e}`,children:o.jsx(ge,{maxLength:K?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}),o.jsx(J,{color:"text.primary",children:d==="create"?k("common.create"):(t==null?void 0:t.blockletVersion)||k("common.edit")})]}),o.jsx(z,{flex:"1"}),!f&&o.jsxs(p1,{disabled:i,variant:"contained",children:[o.jsxs(oe,{variant:"contained",onClick:()=>fe(Ce.PROJECT.RELEASE_STATUS.published),children:[i&&o.jsx(Oe,{size:14,sx:{mr:.5},color:"inherit"}),k("blocklet.publish.createRelease")]}),o.jsx(oe,{variant:"contained",onClick:te,children:o.jsx(pe,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&o.jsxs(o.Fragment,{children:[Q,K?null:o.jsx(oe,{component:"a",disabled:i,href:he(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${x}/download/${(u.files||[])[0]}`),variant:"outlined",sx:{mr:1},children:k("common.download")}),o.jsxs(p1,{disabled:i,variant:"contained",children:[o.jsxs(oe,{variant:"contained",onClick:()=>P(!0),children:[i?o.jsx(Oe,{size:14,sx:{mr:1},color:"inherit"}):o.jsx(q0,{sx:{fontSize:"1.3em",mr:1}}),k(K?"common.upload":"blocklet.publish.connectOrUpload")]}),o.jsx(oe,{variant:"contained",onClick:te,children:o.jsx(pe,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),o.jsx(R0,{title:k("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:M,onClose:()=>P(!1),children:o.jsx(O1,{projectType:L,blocklet:a,releaseType:G,projectId:e,releaseId:x,componentDid:p,onPublish:Y,onOpenConnectStore:ce,onDelete:b,connectedStores:t.connectedStores||[],publishedStoreIds:u==null?void 0:u.publishedStoreIds})}),o.jsx(G0,{did:(de=a==null?void 0:a.meta)==null?void 0:de.did,params:t,projectId:e,open:E,setParams:n,onClose:()=>A(!1)})]})}K0.propTypes={projectId:h.string.isRequired,params:h.object.isRequired,mode:h.string.isRequired,loading:h.bool.isRequired,blocklet:h.object.isRequired,release:h.object.isRequired,isPublished:h.bool.isRequired,releaseId:h.string.isRequired,getData:h.func.isRequired,getRelease:h.func.isRequired,componentDid:h.string.isRequired,resourceRelateComponents:h.object.isRequired,disabledSelectComponents:h.bool.isRequired,saveSelectedEventsRef:h.object.isRequired,hasSelectedResources:h.bool.isRequired,initLogoUrl:h.string.isRequired,setLoading:h.func.isRequired,releaseUsedLast:h.bool.isRequired,setReleaseUsedLast:h.func.isRequired,projectType:h.string.isRequired,setParamsErrTip:h.func.isRequired,setParams:h.func.isRequired,initUrl:h.object.isRequired};const s3=ae.div`
167
+ `;var A1={},Jl=Ne;Object.defineProperty(A1,"__esModule",{value:!0});var q0=A1.default=void 0,Ql=Jl(Te()),Yl=o;q0=A1.default=(0,Ql.default)((0,Yl.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 Zl=(e,t,l,r)=>{const n=e?[...e]:[],d=((t==null?void 0:t.children)||[]).reduce((i,a)=>(i[a.meta.did]=!0,i),{});return Object.keys(l).forEach(i=>{if(!d[i])return;let a=!1;r||n.forEach(u=>{u.did===i&&(u.included=!0,u.required=!0,a=!0)}),a||n.push({did:i,included:!0,required:!0})}),n},e3=async e=>{if(typeof e!="string")throw new Error("URL must be a string");try{const t=e.split("/").pop().split("?")[0],r=await(await fetch(e)).blob();return new File([r],t,{type:r.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*t3(e,t){let l=0;for(;l<e.size;)yield e.slice(l,l+t),l+=t}const o3=async({did:e,projectId:t,uploadType:l="logo",imageUrl:r})=>{const n=await e3(r);new FormData().append("file",n);const i={uploaderId:"Uploader",relativePath:encodeURIComponent(n.name),name:encodeURIComponent(n.name),type:n.type},u=(await J1.post(he(X.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,f=2*1024*1024;let x=0,b="";for(const y of t3(n,f)){const p=await J1.patch(he(X.WELLKNOWN_SERVICE_PATH_PREFIX,u),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":x,"Content-Type":"application/offset+octet-stream"}});x+=y.size,b=p.data.filename}return b},W0=({params:e,hasSelectedResources:t,projectId:l,status:r,t:n})=>{const d=[];return e.blockletTitle||d.push({param:"blockletTitle",message:n("blocklet.publish.errorTip.noTitle")}),(!l||l===X.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?Ie.valid(e.blockletVersion)||d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.inValidVersion")}):d.push({param:"blockletVersion",message:n("blocklet.publish.errorTip.noVersion")}),r===Ce.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},l3=({params:e,hasSelectedResources:t,step:l,t:r,projectId:n})=>{if(l===0){if(!e.blockletTitle)return r("blocklet.publish.errorTip.noTitle");if(!n||n===X.UNOWNED_DID)return r("blocklet.publish.errorTip.noDid");if(!e.blockletDescription)return r("blocklet.publish.errorTip.noDescription")}if(l===2&&!e.uploadedResource&&!t)return r("blocklet.publish.errorTip.noResource");if(l>=4){if(!e.blockletVersion)return r("blocklet.publish.errorTip.noVersion");if(!Ie.valid(e.blockletVersion))return r("blocklet.publish.errorTip.inValidVersion");if(!e.note)return r("blocklet.publish.errorTip.noNote")}return""};function O1({blocklet:e,releaseId:t,connectedStores:l,projectId:r,releaseType:n,publishedStoreIds:d,onPublish:i,onDelete:a,projectType:u,componentDid:f,onOpenConnectStore:x,behavior:b,onSelectConnectStore:y}){var S,N;const{t:p}=le(),{actions:{refreshBlocklet:c}}=Ve(),{session:m}=s1(),{storeList:g}=F0({fromBlocklet:!0,blocklet:e,componentDid:f,userDid:(S=m==null?void 0:m.user)==null?void 0:S.did}),v=C.useMemo(()=>l!=null&&l.length?l==null?void 0:l.reduce((T,L)=>(T[L.storeId]=L,T),{}):{},[l]),R=(N=e==null?void 0:e.meta)==null?void 0:N.did;return o.jsxs(o.Fragment,{children:[b==="connect"&&!!(g!=null&&g.length)&&o.jsx(S0,{severity:"info",style:{width:"100%"},children:o.jsxs(z,{color:y2[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($2,{sx:{marginLeft:1}})]})}),o.jsx(v2,{children:g==null?void 0:g.map(T=>o.jsx(F2,{"data-cy":"store-switch",children:o.jsx(U2,{children:o.jsx(E2,{behavior:b,onSelectConnectStore:y,releaseId:t,projectId:r,releaseType:n,kind:"publish",teamDid:R,store:T,published:(d==null?void 0:d.indexOf(T.id))>-1,connectedStore:v[T.id],onPublish:i,onDelete:a,scope:T.scope||"studio",onOpenConnectStore:x})})},T.url))}),o.jsx(M0,{teamDid:R,storeList:g,scope:"studio",onAdd:c})]})}O1.propTypes={blocklet:h.object.isRequired,projectId:h.string.isRequired,releaseId:h.string.isRequired,releaseType:h.string.isRequired,onPublish:h.func,onDelete:h.func,publishedStoreIds:h.arrayOf(h.string),connectedStores:h.arrayOf(h.object).isRequired,projectType:h.string,componentDid:h.string,onOpenConnectStore:h.func,onSelectConnectStore:h.func,behavior:h.string};O1.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};function G0({did:e,params:t,setParams:l,projectId:r,open:n,onClose:d}){const{t:i}=le(),[a,u]=C.useState(!1),{api:f}=je(),[x,b]=C.useState(!1),[y,p]=C.useState(!1),c=()=>{b(t.autoUpload),p(t.possibleSameStore),u(!1),d(!1)},m=async()=>{u(!0);try{await f.updateProject({input:{did:e,projectId:r,blockletTitle:t.blockletTitle||"",blockletDescription:t.blockletDescription||"",blockletIntroduction:t.blockletIntroduction||"",autoUpload:!!x,possibleSameStore:!!y}}),l({autoUpload:x,possibleSameStore:y}),d(!1)}catch(v){$.error(v.message)}u(!1)};C.useEffect(()=>{b(t.autoUpload),p(t.possibleSameStore)},[t]);const g=!!(r&&r!==X.UNOWNED_DID);return o.jsx(R0,{title:i("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:n,onClose:c,actions:o.jsxs(o.Fragment,{children:[o.jsx(oe,{onClick:v=>{v.stopPropagation(),d()},color:"inherit",children:i("common.cancel")}),g&&o.jsxs(oe,{onClick:v=>{v.stopPropagation(),m()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a,variant:"contained",autoFocus:!0,children:[a&&o.jsx(Oe,{size:16}),i("common.confirm")]})]}),children:g?o.jsxs(z,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[o.jsxs(z,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"ph:upload",sx:{fontSize:24,mr:2}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.autoUploadTip")}),o.jsx(Z1,{checked:x,onChange:(v,R)=>b(R)})]}),o.jsxs(z,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.possibleSameStoreTip")}),o.jsx(Z1,{checked:y,onChange:(v,R)=>p(R)})]})]}):o.jsxs(z,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[o.jsx(z,{component:pe,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),o.jsx(J,{variant:"body1",sx:{flex:1},children:i("blocklet.publish.needProjectId")})]})})}G0.propTypes={did:h.string.isRequired,params:h.object.isRequired,open:h.bool.isRequired,onClose:h.func.isRequired,setParams:h.func.isRequired,projectId:h.string.isRequired};var x0;const c1=(x0=window.env)==null?void 0:x0.serverEndpoint;function K0({projectId:e,params:t,setParamsErrTip:l,initUrl:r,setParams:n,mode:d,loading:i,blocklet:a,release:u,isPublished:f,releaseId:x,getData:b,getRelease:y,componentDid:p,resourceRelateComponents:c,disabledSelectComponents:m,saveSelectedEventsRef:g,hasSelectedResources:v,initLogoUrl:R,setLoading:S,releaseUsedLast:N,setReleaseUsedLast:T,projectType:L}){var xe,de;const{t:k,locale:U}=le(),{api:V}=je(),I=m1(),[M,P]=C.useState(!1),[E,A]=C.useState(!1),[H,q]=C.useState(),K=We(F=>F.breakpoints.down("md")),G=((xe=t==null?void 0:t.blockletComponents)==null?void 0:xe.length)>0?"pack":"resource",Y=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:p},"*"),y()},Se=async F=>{var Ke,_e,Be;const Z=W0({params:t,hasSelectedResources:v,projectId:e,status:F,t:k});if(Z){$.error(Z.map(W=>W.message).join("; ")),l(Z.reduce((W,ee)=>({...W,[ee.param]:ee.message}),{}));return}const B={...t};if(B.blockletComponents=Zl(B.blockletComponents,a,c,m),B.blockletVersion=Ie.valid(B.blockletVersion),!B.blockletVersion){$.error("Invalid Blocklet Version"),l({blockletVersion:"Invalid Blocklet Version"});return}if(R)try{const W=await o3({did:a.meta.did,projectId:e,imageUrl:R});B.blockletLogo=W,n({blockletLogo:W})}catch(W){$.error(W.message);return}if(t.resourceFromSelect){B.uploadedResource="";try{const W=Object.keys(g.current);await e1(W.map(ee=>()=>{const Ee=g.current[ee];return $l({api:V,locale:U,projectId:e,releaseId:N?"":x,appDid:a.meta.did,component:Ee.component,resources:Ee.resources,initUrl:r})}),{concurrency:2})}catch(W){$.error(((Be=(_e=(Ke=W==null?void 0:W.response)==null?void 0:Ke.data)==null?void 0:_e.error)==null?void 0:Be.message)||W.message),l({blockletResource:"Invalid save the resource"});return}}else B.blockletComponents=[];B.blockletTitle=(B.blockletTitle||"").trim(),B.blockletDescription=(B.blockletDescription||"").trim(),B.blockletIntroduction=(B.blockletIntroduction||"").trim(),B.note=(B.note||"").trim(),B.blockletComponents=((B==null?void 0:B.blockletComponents)||[]).filter(W=>W.included).map(W=>v1(W,["did","required"])).map(JSON.stringify);try{await V.createRelease({input:{...B,did:a.meta.did,projectId:e,releaseId:N?"":x,status:F}}),F==="draft"?$.success(k("blocklet.publish.saveDraftSuccess")):(T(!1),$.success(k("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:p},"*")),l({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(W){const ee=Pe(W);$.error(ee),(/resource/.test(ee)||/zip/.test(ee))&&l({blockletResource:ee})}const re=await V.getProject({input:{did:a.meta.did,projectId:e}}),ne=re.project.lastReleaseId;t.autoUpload&&await e1(re.project.connectedStores.map(W=>async()=>{try{const ee=await V.publishToStore({input:{did:a.meta.did,storeId:W.storeId,storeName:W.storeName,projectId:e,releaseId:ne,type:G}});$.success(o.jsx(A2,{storeName:W.storeName,storeUrl:W.storeUrl,developerDid:W.developerDid,published:ee.url==="published"}),{duration:1e4})}catch(ee){$.error(Pe(ee))}}),{concurrency:4}),Y==null||Y(),I(`../${e}/view/${ne}`,{replace:!0})},fe=F=>(S(!0),Se(F).finally(()=>{S(!1)})),ce=async F=>{await Kl(V,F),b()},te=()=>{A(!0)};let Q=null;if(f&&c1){const F=he(c1,`/api/project/${a.meta.did}/${e}/${x}/release/blocklet.json`);if(L==="pack"){const Z=new URL(c1);Z.pathname=he(Z.pathname,"/launch-blocklet/agreement"),Z.searchParams.set("blocklet_meta_url",F),Q=K?o.jsx(ie,{component:"a",disabled:i,href:Z.href,target:"_blank",rel:"noreferrer",color:"primary",sx:{mr:1},onClick:()=>q(F),children:o.jsx(pe,{icon:"ic:baseline-install-desktop"})}):o.jsx(oe,{href:Z.href,disabled:i,target:"_blank",rel:"noreferrer",variant:"outlined",sx:{mr:1},onClick:()=>q(F),children:k("common.install")})}else Q=o.jsxs(o.Fragment,{children:[K?o.jsx(ie,{disabled:i,color:"primary",sx:{mr:1},onClick:()=>q(F),children:o.jsx(pe,{icon:"ic:baseline-install-desktop"})}):o.jsx(oe,{disabled:i,variant:"outlined",sx:{mr:1},onClick:()=>q(F),children:k("blocklet.publish.copyInstallUrl")}),o.jsx(g2,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>q(""),children:o.jsxs(z,{sx:{py:5,px:4,wordBreak:"break-all"},children:[o.jsx(J,{variant:"h6",sx:{mb:2},children:k("blocklet.publish.installResourceTip")}),o.jsx(H2,{children:H}),o.jsxs(J,{sx:{mt:2},children:[k("blocklet.publish.installResourceTip2"),o.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/R3weqCy7WPI8ggudt0C2alWv",target:"_blank",rel:"noreferrer",children:k("blocklet.publish.installResourceHelp")})]})]})})]})}return o.jsxs(o.Fragment,{children:[o.jsx(s3,{className:"sticky-header",children:o.jsxs(z,{display:"flex",alignItems:"center",flexDirection:"row",children:[o.jsxs(P0,{className:"breadcrumbs","aria-label":"breadcrumb",children:[o.jsx(ue,{to:"../",children:k("common.blockletStudio")}),e===X.UNOWNED_DID?o.jsx(J,{color:"text.primary",children:o.jsx(ge,{maxLength:K?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}):o.jsx(ue,{to:`../${e}`,children:o.jsx(ge,{maxLength:K?6:30,children:(t==null?void 0:t.blockletTitle)||"Blocklet"})}),o.jsx(J,{color:"text.primary",children:d==="create"?k("common.create"):(t==null?void 0:t.blockletVersion)||k("common.edit")})]}),o.jsx(z,{flex:"1"}),!f&&o.jsxs(p1,{disabled:i,variant:"contained",children:[o.jsxs(oe,{variant:"contained",onClick:()=>fe(Ce.PROJECT.RELEASE_STATUS.published),children:[i&&o.jsx(Oe,{size:14,sx:{mr:.5},color:"inherit"}),k("blocklet.publish.createRelease")]}),o.jsx(oe,{variant:"contained",onClick:te,children:o.jsx(pe,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&o.jsxs(o.Fragment,{children:[Q,K?null:o.jsx(oe,{component:"a",disabled:i,href:he(`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${a.meta.did}/${e}/${x}/download/${(u.files||[])[0]}`),variant:"outlined",sx:{mr:1},children:k("common.download")}),o.jsxs(p1,{disabled:i,variant:"contained",children:[o.jsxs(oe,{variant:"contained",onClick:()=>P(!0),children:[i?o.jsx(Oe,{size:14,sx:{mr:1},color:"inherit"}):o.jsx(q0,{sx:{fontSize:"1.3em",mr:1}}),k(K?"common.upload":"blocklet.publish.connectOrUpload")]}),o.jsx(oe,{variant:"contained",onClick:te,children:o.jsx(pe,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})}),o.jsx(R0,{title:k("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:M,onClose:()=>P(!1),children:o.jsx(O1,{projectType:L,blocklet:a,releaseType:G,projectId:e,releaseId:x,componentDid:p,onPublish:Y,onOpenConnectStore:ce,onDelete:b,connectedStores:t.connectedStores||[],publishedStoreIds:u==null?void 0:u.publishedStoreIds})}),o.jsx(G0,{did:(de=a==null?void 0:a.meta)==null?void 0:de.did,params:t,projectId:e,open:E,setParams:n,onClose:()=>A(!1)})]})}K0.propTypes={projectId:h.string.isRequired,params:h.object.isRequired,mode:h.string.isRequired,loading:h.bool.isRequired,blocklet:h.object.isRequired,release:h.object.isRequired,isPublished:h.bool.isRequired,releaseId:h.string.isRequired,getData:h.func.isRequired,getRelease:h.func.isRequired,componentDid:h.string.isRequired,resourceRelateComponents:h.object.isRequired,disabledSelectComponents:h.bool.isRequired,saveSelectedEventsRef:h.object.isRequired,hasSelectedResources:h.bool.isRequired,initLogoUrl:h.string.isRequired,setLoading:h.func.isRequired,releaseUsedLast:h.bool.isRequired,setReleaseUsedLast:h.func.isRequired,projectType:h.string.isRequired,setParamsErrTip:h.func.isRequired,setParams:h.func.isRequired,initUrl:h.object.isRequired};const s3=ae.div`
168
168
  .sticky-header {
169
169
  margin-top: -12px;
170
170
  padding: 12px 0;
@@ -178,7 +178,7 @@ import{ao as o2,j as o,aC as se,cF as m0,aG as O,fo as G1,aF as be,aA as $e,aB a
178
178
  padding-bottom: 12px;
179
179
  border-bottom: ${({theme:e})=>`1px solid ${e.palette.divider}`};
180
180
  }
181
- `;function X0({text:e}){return e?o.jsx(q2,{wrapperElement:{"data-color-mode":"light"},source:e,rehypePlugins:[[W2,{target:"_blank"}]]}):o.jsx(ye,{Icon:Ge})}X0.propTypes={text:h.string.isRequired};function J0({params:e,setParams:t,paramsErrTip:l,loading:r,setParamsErrTip:n,readOnly:d}){var x;const{t:i}=le(),[a,u]=C.useState(d?"preview":"write"),f=(b,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(J,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),o.jsxs(M2,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[o.jsx(Y1,{value:"write",label:"Write"}),o.jsx(Y1,{value:"preview",label:"Preview"})]})]}),o.jsx(z,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:o.jsx(Le,{disabled:r||d,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:o.jsxs(C1,{position:"end",children:[((x=e==null?void 0:e.blockletIntroduction)==null?void 0:x.length)||0," / ",Ce.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:b=>{n({blockletIntroduction:""}),t({blockletIntroduction:b.target.value.slice(0,Ce.PROJECT.MAX_INTRO_LENGTH)})},error:!!l.blockletIntroduction,helperText:l.blockletIntroduction||""})}),o.jsx(z,{display:a==="preview"?"block":"none",mt:3,children:o.jsx(X0,{text:e.blockletIntroduction||""})})]})}J0.propTypes={params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,readOnly:h.bool.isRequired,loading:h.bool.isRequired};var H1={},r3=Ne;Object.defineProperty(H1,"__esModule",{value:!0});var Q0=H1.default=void 0,n3=r3(Te()),p0=o;Q0=H1.default=(0,n3.default)([(0,p0.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,p0.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function $1({step:e,ok:t,active:l,error:r}){let n="grey.500",d=e+1;return t&&(d=o.jsx(G2,{sx:{fontSize:18,margin:0},color:"white"})),r||!t&&l>e?(n="error.main",d=o.jsx(Q0,{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})}$1.propTypes={step:h.number,ok:h.bool,active:h.number,error:h.string};$1.defaultProps={step:0,ok:!1,active:0,error:""};function Y0({steps:e,activeStep:t,setActiveStep:l,hasSelectedResources:r,params:n,loading:d,paramsErrTip:i,viewMode:a,projectId:u}){const{t:f}=le(),x=()=>{l(c=>c+1)},b=()=>{l(c=>c-1)},y=c=>c===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription):c===2?i==null?void 0:i.blockletResource:c>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||W0({hasSelectedResources:r,params:n,projectId:u,t:f})===null;return o.jsxs(z,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[o.jsx(X2,{activeStep:t,orientation:"vertical",children:e.map((c,m)=>{const g={},v=d||!l3({hasSelectedResources:r,params:n,projectId:u,step:m,t:f}),R=d?"":y(m);return R&&(g.optional=o.jsx(J,{variant:"caption",color:"error",children:R}),g.error=!0),o.jsxs(J2,{children:[o.jsx(bt,{icon:o.jsx($1,{error:R,active:p?99:t,step:m,ok:v}),sx:{cursor:"pointer",color:R?"error.main":"inherit"},disabled:!1,onClick:()=>l(m),...g,children:o.jsx(J,{fontSize:"14px",fontWeight:"500",color:R||!v&&t>m?"error.main":"inherit",children:c.label})}),o.jsxs(St,{children:[o.jsx(J,{fontSize:12,children:c.description}),!p&&o.jsx(z,{sx:{mb:2},children:o.jsxs("div",{children:[m<e.length-1&&o.jsx(oe,{variant:"contained",onClick:x,sx:{mt:1,mr:1},disabled:R||!v,children:f("common.continue")}),m>0&&o.jsx(oe,{disabled:m===0,onClick:b,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},c.label)})}),t>=e.length-1&&o.jsx(j0,{square:!0,elevation:0,sx:{p:3},children:o.jsx(J,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Y0.propTypes={steps:h.array.isRequired,activeStep:h.number.isRequired,setActiveStep:h.func.isRequired,params:h.object.isRequired,viewMode:h.string.isRequired,loading:h.bool.isRequired,projectId:h.string.isRequired,hasSelectedResources:h.bool.isRequired,paramsErrTip:h.shape({projectId:h.string,blockletVersion:h.string,blockletTitle:h.string,blockletDescription:h.string,note:h.string,blockletResource:h.string}).isRequired};const i3=[".zip",".gz"],a3=1024*1024*100,c3=C.lazy(()=>w0(()=>import("./react-Z_lC3NCb.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,43,44,45,46,47])).then(e=>({default:e.Uploader})));function F1({app:e,projectId:t,readOnly:l,params:r,setParams:n,setParamsErrTip:d,error:i}){const{t:a}=le(),u=C.useRef(null),f=()=>l?!1:!t||t===X.UNOWNED_DID?($.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,x=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${t}/resource/upload`;return o.jsxs(z,{sx:{mt:3},children:[o.jsx(J,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),o.jsxs(L2,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:l?"default":"pointer"},children:[!!r.uploadedResource&&o.jsx(J,{component:"a",href:`${x}/params.uploadedResource`,children:r.uploadedResource}),!l&&o.jsx(oe,{variant:"outlined",size:"small",onClick:()=>{var b;f()&&((b=u.current)==null||b.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),o.jsx(C.Suspense,{fallback:o.jsx(ze,{}),children:o.jsx(c3,{ref:u,popup:!0,onUploadFinish:b=>{var y;n({uploadedResource:b.data.filename}),d({blockletResource:""}),(y=u.current)==null||y.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:x,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:i3,maxFileSize:a3,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&o.jsx(z,{color:"error.main",mt:1,fontSize:14,children:i})]})}F1.propTypes={app:h.object.isRequired,projectId:h.string.isRequired,readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,error:h.string.isRequired,setParamsErrTip:h.func.isRequired};F1.defaultProps={};function t1({readOnly:e,params:t,setParams:l,paramsErrTip:r,setParamsErrTip:n,loading:d}){var a;const{t:i}=le();return o.jsx(z,{display:"flex",mt:3,className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Le,{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:!!r.blockletVersion,helperText:r.blockletVersion||""}),o.jsx(Le,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:o.jsxs(C1,{position:"end",children:[((a=t==null?void 0:t.note)==null?void 0:a.length)||0," / ",Ce.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,Ce.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}t1.propTypes={readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,loading:h.bool.isRequired};t1.defaultProps={};const d3=({tabs:e,blocklet:t,ancestors:l=[]})=>{const r=t.meta.did;e.push({label:o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(w1,{size:24,blocklet:t,ancestors:l}),o.jsx(z,{ml:"4px",className:"text",children:o.jsx(z,{children:t.meta.title})})]},r),value:r})},h0=(e,t)=>{const l=v1(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return l.blockletComponents?l.blockletComponents=l.blockletComponents.map(r=>({...r,included:!0})):l.blockletComponents=(t.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),l.resourceFromSelect=!l.uploadedResource,l},u3={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},f0={branding:0,introduction:1,resources:2,blocklets:3,version:4};function U1({initUrl:e,...t}){var W1;const{projectId:l,mode:r,releaseId:n,componentDid:d=""}=l1(),{t:i}=le(),{blocklet:a}=Ve(),[u,f]=Me({blockletScreenshots:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",resourceFromSelect:!0}),[x,b]=Me({}),[y,p]=C.useState(!1),[c,m]=Me(null),{api:g}=je(),v=We(D=>D.breakpoints.down("md")),[R,S]=C.useState({}),[N,T]=C.useState(!1),L=C.useRef({}),[k,U]=Me({}),[V,I]=C.useState(""),[M,P]=Me({}),E=e==null?void 0:e.searchParams.get("dependentComponentsMode"),A=E==="readonly",H=C.useMemo(()=>{const D={};return Object.keys(M).forEach(_=>{const Re=M[_];Re&&Re.forEach(t2=>{D[t2]=!0})}),D},[M]),q=C.useCallback(D=>{A&&f({blockletComponents:[]}),P(D)},[A,P,f]),K=C.useCallback((...D)=>{U(...D),b({blockletResource:""})},[]),G=n==="none"?(u==null?void 0:u.lastReleaseId)||"":n,[Y,Se]=C.useState(r==="new-release"?4:0);C.useEffect(()=>{l&&b({projectId:""})},[l,b]);const fe=C.useMemo(()=>{var D;return(D=u==null?void 0:u.blockletComponents)!=null&&D.some(_=>_.included)||Object.keys(H).length||u!=null&&u.uploadedResource?"pack":"resource"},[u==null?void 0:u.blockletComponents,u==null?void 0:u.uploadedResource,H]),ce=[],te=((a==null?void 0:a.children)||[]).filter(D=>{var _;return(_=D.meta.resource)==null?void 0:_.exportApi}).filter(D=>!d||D.meta.did===d);te.forEach(D=>{d3({tabs:ce,blocklet:D,t:i,ancestors:[a]})});const[Q,xe]=C.useState((W1=ce[0])==null?void 0:W1.value),de=!N&&(c==null?void 0:c.status)==="published",F=de,Z=b2(()=>{if(!e)return;I(e.searchParams.get("logo")),f(_=>{var Re;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:(Re=_==null?void 0:_.blockletComponents)!=null&&Re.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);S(_)}catch{}}),B=async()=>{if(G)try{const D=await g.getRelease({input:{did:a.meta.did,projectId:l,releaseId:G}});if(p(!1),!D.release){$.error("Release not found");return}r!=="view"&&(D.release.note=""),f(_=>h0({..._,...D.release,blockletVersion:r==="create"||r==="new-release"?Ie.inc(D.release.blockletVersion,"patch"):D.release.blockletVersion},a)),m(D.release)}catch(D){p(!1),$.error(Pe(D))}},re=async()=>{if(l===X.UNOWNED_DID){f({blockletVersion:"1.0.0",blockletTitle:""});return}if(!l){$.error(i("blocklet.publish.errorTip.noDid"));return}try{const D=await g.getProject({input:{did:a.meta.did,projectId:l}});p(!1);const _=D.project||{};_.blockletVersion?(r==="create"||r==="new-release")&&Ie.valid(_.blockletVersion)&&(_.blockletVersion=Ie.inc(_.blockletVersion,"patch")):_.blockletVersion="1.0.0";const Re=h0(_,a);f(Re),_.lastReleaseId||Z()}catch(D){p(!1),$.error(Pe(D))}},ne=C.useCallback(async()=>{if(r==="view"){if(!G){$.error("Empty release id");return}await re(),await B();return}await re(),G&&(T(!0),await B())},[r,G]),Ke=D=>{f({blockletComponents:D})};C.useEffect(()=>{ne()},[ne]),C.useEffect(()=>{l===X.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Z()},[l,e,r,Z]);const _e=C.useMemo(()=>!!Object.keys(k).find(D=>!!k[D].length),[k]);if(!u&&y)return o.jsx(ze,{});if(!u)return null;const Be=te.find(D=>D.meta.did===Q);if(te.every(D=>D.status!=="running")&&(te!=null&&te.length))return o.jsx(ye,{children:i("blocklet.publish.allComponentsNotRunning")});const ee=D=>{xe(D)},Ee=e==null?void 0:e.searchParams.get("resourcesTitle"),q1=e==null?void 0:e.searchParams.get("componentsTitle"),ke=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:Ee||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:q1||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],e2=ke[Y]||ke[ke.length-1],we=u3[Y];return o.jsxs(p3,{...t,children:[o.jsx(K0,{blocklet:a,release:c,getData:ne,getRelease:B,mode:r,params:u,setParams:f,setParamsErrTip:b,readOnly:F,isPublished:de,loading:y,setLoading:p,initLogoUrl:V,releaseId:G,projectId:l,projectType:fe,resourceComponents:te,resourceComponentsMap:M,resourceRelateComponents:H,resourceItem:Be,saveSelectedEventsRef:L,hasSelectedResources:_e,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(Y0,{steps:ke,viewMode:r==="view",params:u,hasSelectedResources:_e||u.uploadedResource,paramsErrTip:x,activeStep:Y,setActiveStep:Se,projectId:l,resourcesUrlTitle:Ee,componentsUrlTitle:q1}),o.jsxs(z,{flex:"1",maxWidth:"720px",children:[!v&&we!=="introduction"&&o.jsxs(J,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[e2.label,we==="branding"&&o.jsx(ve,{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(k2,{})})})]}),(v||we==="branding")&&o.jsx(z,{flexDirection:"column",children:o.jsx(U0,{projectId:l,setParams:f,setParamsErrTip:b,params:u,componentDid:d,blocklet:a,initUrl:e,loading:y,setLoading:p,paramsErrTip:x,readOnly:F,initLogoUrl:V,setInitLogoUrl:I})}),v&&o.jsx(z,{flexDirection:"column",children:o.jsx(t1,{loading:y,params:u,paramsErrTip:x,setParams:f,setParamsErrTip:b,readOnly:F})}),(v||we==="introduction")&&o.jsx(z,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:o.jsx(J0,{loading:y,readOnly:F,params:u,setParams:f,paramsErrTip:x,setParamsErrTip:b})}),v&&o.jsx(J,{variant:"h6",fontWeight:"bold",mt:5,children:ke[f0.resources].label}),o.jsx(z,{display:v||we==="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(Q2,{onChange:()=>f({resourceFromSelect:!u.resourceFromSelect}),children:[o.jsx(u1,{value:"select",disabled:F,control:o.jsx(e0,{size:"small",checked:u.resourceFromSelect}),label:i("blocklet.publish.resourceSelect")}),o.jsx(u1,{value:"select",disabled:F,control:o.jsx(e0,{size:"small",checked:!u.resourceFromSelect}),label:i("blocklet.publish.resourceUpload")})]}),u.resourceFromSelect&&o.jsxs(o.Fragment,{children:[!d&&o.jsx(I2,{tabs:ce,current:Q,onChange:ee,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),o.jsx(B1,{loading:y,initialResources:R,saveSelectedEventsRef:L,selectedResourceIds:k,setSelectedResourceIds:K,setResourceComponentsMap:q,error:x.blockletResource,app:a,readOnly:F,component:Be,componentDid:d,initUrl:e,params:u,setParams:f,projectId:l===X.UNOWNED_DID?"":l,releaseUsedLast:N,release:{...c,id:G}})]}),!u.resourceFromSelect&&o.jsx(F1,{app:a,readOnly:F,projectId:l===X.UNOWNED_DID?"":l,params:u,error:x.blockletResource,setParams:f,setParamsErrTip:b})]})})}),v&&o.jsx(J,{variant:"h6",fontWeight:"bold",mt:5,children:ke[f0.blocklets].label}),(v||we==="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(L1,{projectType:fe,disabled:y||F,app:a,value:(u==null?void 0:u.blockletComponents)||[],onChange:Ke,resourceRelateComponents:H,dependentComponentsMode:E})})})}),!v&&we==="version"&&o.jsx(z,{flexDirection:"column",children:o.jsx(t1,{loading:y,params:u,paramsErrTip:x,setParams:f,setParamsErrTip:b,readOnly:F})})]})]})]})]})}U1.propTypes={initUrl:h.object};U1.defaultProps={initUrl:null};const p3=ae.div`
181
+ `;function X0({text:e}){return e?o.jsx(q2,{wrapperElement:{"data-color-mode":"light"},source:e,rehypePlugins:[[W2,{target:"_blank"}]]}):o.jsx(ye,{Icon:Ge})}X0.propTypes={text:h.string.isRequired};function J0({params:e,setParams:t,paramsErrTip:l,loading:r,setParamsErrTip:n,readOnly:d}){var x;const{t:i}=le(),[a,u]=C.useState(d?"preview":"write"),f=(b,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(J,{variant:"h6",fontWeight:"bold",sx:{},children:i("common.introduction")}),o.jsxs(M2,{value:a,onChange:f,"aria-label":"wrapped label tabs example",children:[o.jsx(Y1,{value:"write",label:"Write"}),o.jsx(Y1,{value:"preview",label:"Preview"})]})]}),o.jsx(z,{display:a==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:o.jsx(Le,{disabled:r||d,sx:{border:"none"},placeholder:`Blocklet ${i("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:o.jsxs(C1,{position:"end",children:[((x=e==null?void 0:e.blockletIntroduction)==null?void 0:x.length)||0," / ",Ce.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:e.blockletIntroduction||"",onChange:b=>{n({blockletIntroduction:""}),t({blockletIntroduction:b.target.value.slice(0,Ce.PROJECT.MAX_INTRO_LENGTH)})},error:!!l.blockletIntroduction,helperText:l.blockletIntroduction||""})}),o.jsx(z,{display:a==="preview"?"block":"none",mt:3,children:o.jsx(X0,{text:e.blockletIntroduction||""})})]})}J0.propTypes={params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,readOnly:h.bool.isRequired,loading:h.bool.isRequired};var H1={},r3=Ne;Object.defineProperty(H1,"__esModule",{value:!0});var Q0=H1.default=void 0,n3=r3(Te()),p0=o;Q0=H1.default=(0,n3.default)([(0,p0.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,p0.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function $1({step:e,ok:t,active:l,error:r}){let n="grey.500",d=e+1;return t&&(d=o.jsx(G2,{sx:{fontSize:18,margin:0},color:"white"})),r||!t&&l>e?(n="error.main",d=o.jsx(Q0,{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})}$1.propTypes={step:h.number,ok:h.bool,active:h.number,error:h.string};$1.defaultProps={step:0,ok:!1,active:0,error:""};function Y0({steps:e,activeStep:t,setActiveStep:l,hasSelectedResources:r,params:n,loading:d,paramsErrTip:i,viewMode:a,projectId:u}){const{t:f}=le(),x=()=>{l(c=>c+1)},b=()=>{l(c=>c-1)},y=c=>c===0?(i==null?void 0:i.blockletTitle)||(i==null?void 0:i.projectId)||(i==null?void 0:i.blockletDescription):c===2?i==null?void 0:i.blockletResource:c>=4?(i==null?void 0:i.blockletVersion)||(i==null?void 0:i.note):"",p=a||W0({hasSelectedResources:r,params:n,projectId:u,t:f})===null;return o.jsxs(z,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid #ccc",borderRadius:2},children:[o.jsx(X2,{activeStep:t,orientation:"vertical",children:e.map((c,m)=>{const g={},v=d||!l3({hasSelectedResources:r,params:n,projectId:u,step:m,t:f}),R=d?"":y(m);return R&&(g.optional=o.jsx(J,{variant:"caption",color:"error",children:R}),g.error=!0),o.jsxs(J2,{children:[o.jsx(bt,{icon:o.jsx($1,{error:R,active:p?99:t,step:m,ok:v}),sx:{cursor:"pointer",color:R?"error.main":"inherit"},disabled:!1,onClick:()=>l(m),...g,children:o.jsx(J,{fontSize:"14px",fontWeight:"500",color:R||!v&&t>m?"error.main":"inherit",children:c.label})}),o.jsxs(St,{children:[o.jsx(J,{fontSize:12,children:c.description}),!p&&o.jsx(z,{sx:{mb:2},children:o.jsxs("div",{children:[m<e.length-1&&o.jsx(oe,{variant:"contained",onClick:x,sx:{mt:1,mr:1},disabled:R||!v,children:f("common.continue")}),m>0&&o.jsx(oe,{disabled:m===0,onClick:b,sx:{mt:1,mr:1},children:f("common.back")})]})})]})]},c.label)})}),t>=e.length-1&&o.jsx(j0,{square:!0,elevation:0,sx:{p:3},children:o.jsx(J,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}Y0.propTypes={steps:h.array.isRequired,activeStep:h.number.isRequired,setActiveStep:h.func.isRequired,params:h.object.isRequired,viewMode:h.string.isRequired,loading:h.bool.isRequired,projectId:h.string.isRequired,hasSelectedResources:h.bool.isRequired,paramsErrTip:h.shape({projectId:h.string,blockletVersion:h.string,blockletTitle:h.string,blockletDescription:h.string,note:h.string,blockletResource:h.string}).isRequired};const i3=[".zip",".gz"],a3=1024*1024*100,c3=C.lazy(()=>w0(()=>import("./react-iG64dalH.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,43,44,45,46,47])).then(e=>({default:e.Uploader})));function F1({app:e,projectId:t,readOnly:l,params:r,setParams:n,setParamsErrTip:d,error:i}){const{t:a}=le(),u=C.useRef(null),f=()=>l?!1:!t||t===X.UNOWNED_DID?($.error(a("blocklet.publish.errorTip.noFirstDid")),!1):!0,x=`${X.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${e.meta.did}/${t}/resource/upload`;return o.jsxs(z,{sx:{mt:3},children:[o.jsx(J,{gutterBottom:!0,children:a("blocklet.publish.resourceUpload")}),o.jsxs(L2,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:l?"default":"pointer"},children:[!!r.uploadedResource&&o.jsx(J,{component:"a",href:`${x}/params.uploadedResource`,children:r.uploadedResource}),!l&&o.jsx(oe,{variant:"outlined",size:"small",onClick:()=>{var b;f()&&((b=u.current)==null||b.open())},children:r.uploadedResource?a("common.change"):a("common.upload")})]}),o.jsx(C.Suspense,{fallback:o.jsx(ze,{}),children:o.jsx(c3,{ref:u,popup:!0,onUploadFinish:b=>{var y;n({uploadedResource:b.data.filename}),d({blockletResource:""}),(y=u.current)==null||y.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:x,disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileExts:i3,maxFileSize:a3,maxNumberOfFiles:1}}},"uploader-resource")}),!!i&&o.jsx(z,{color:"error.main",mt:1,fontSize:14,children:i})]})}F1.propTypes={app:h.object.isRequired,projectId:h.string.isRequired,readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,error:h.string.isRequired,setParamsErrTip:h.func.isRequired};F1.defaultProps={};function t1({readOnly:e,params:t,setParams:l,paramsErrTip:r,setParamsErrTip:n,loading:d}){var a;const{t:i}=le();return o.jsx(z,{display:"flex",mt:3,className:"section",children:o.jsxs(z,{sx:{flex:1},children:[o.jsx(Le,{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:!!r.blockletVersion,helperText:r.blockletVersion||""}),o.jsx(Le,{label:i("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||e,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:e,endAdornment:o.jsxs(C1,{position:"end",children:[((a=t==null?void 0:t.note)==null?void 0:a.length)||0," / ",Ce.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,Ce.PROJECT.MAX_NOTE_LENGTH)})},error:!!r.note,helperText:r.note||"",sx:{mt:3}})]})})}t1.propTypes={readOnly:h.bool.isRequired,params:h.object.isRequired,setParams:h.func.isRequired,paramsErrTip:h.object.isRequired,setParamsErrTip:h.func.isRequired,loading:h.bool.isRequired};t1.defaultProps={};const d3=({tabs:e,blocklet:t,ancestors:l=[]})=>{const r=t.meta.did;e.push({label:o.jsxs(z,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[o.jsx(w1,{size:24,blocklet:t,ancestors:l}),o.jsx(z,{ml:"4px",className:"text",children:o.jsx(z,{children:t.meta.title})})]},r),value:r})},h0=(e,t)=>{const l=v1(e,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletScreenshots","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note"]);return l.blockletComponents?l.blockletComponents=l.blockletComponents.map(r=>({...r,included:!0})):l.blockletComponents=(t.children||[]).map(r=>({did:r.meta.did,included:!1,required:!1})),l.resourceFromSelect=!l.uploadedResource,l},u3={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},f0={branding:0,introduction:1,resources:2,blocklets:3,version:4};function U1({initUrl:e,...t}){var W1;const{projectId:l,mode:r,releaseId:n,componentDid:d=""}=l1(),{t:i}=le(),{blocklet:a}=Ve(),[u,f]=Me({blockletScreenshots:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",resourceFromSelect:!0}),[x,b]=Me({}),[y,p]=C.useState(!1),[c,m]=Me(null),{api:g}=je(),v=We(D=>D.breakpoints.down("md")),[R,S]=C.useState({}),[N,T]=C.useState(!1),L=C.useRef({}),[k,U]=Me({}),[V,I]=C.useState(""),[M,P]=Me({}),E=e==null?void 0:e.searchParams.get("dependentComponentsMode"),A=E==="readonly",H=C.useMemo(()=>{const D={};return Object.keys(M).forEach(_=>{const Re=M[_];Re&&Re.forEach(t2=>{D[t2]=!0})}),D},[M]),q=C.useCallback(D=>{A&&f({blockletComponents:[]}),P(D)},[A,P,f]),K=C.useCallback((...D)=>{U(...D),b({blockletResource:""})},[]),G=n==="none"?(u==null?void 0:u.lastReleaseId)||"":n,[Y,Se]=C.useState(r==="new-release"?4:0);C.useEffect(()=>{l&&b({projectId:""})},[l,b]);const fe=C.useMemo(()=>{var D;return(D=u==null?void 0:u.blockletComponents)!=null&&D.some(_=>_.included)||Object.keys(H).length||u!=null&&u.uploadedResource?"pack":"resource"},[u==null?void 0:u.blockletComponents,u==null?void 0:u.uploadedResource,H]),ce=[],te=((a==null?void 0:a.children)||[]).filter(D=>{var _;return(_=D.meta.resource)==null?void 0:_.exportApi}).filter(D=>!d||D.meta.did===d);te.forEach(D=>{d3({tabs:ce,blocklet:D,t:i,ancestors:[a]})});const[Q,xe]=C.useState((W1=ce[0])==null?void 0:W1.value),de=!N&&(c==null?void 0:c.status)==="published",F=de,Z=b2(()=>{if(!e)return;I(e.searchParams.get("logo")),f(_=>{var Re;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:(Re=_==null?void 0:_.blockletComponents)!=null&&Re.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);S(_)}catch{}}),B=async()=>{if(G)try{const D=await g.getRelease({input:{did:a.meta.did,projectId:l,releaseId:G}});if(p(!1),!D.release){$.error("Release not found");return}r!=="view"&&(D.release.note=""),f(_=>h0({..._,...D.release,blockletVersion:r==="create"||r==="new-release"?Ie.inc(D.release.blockletVersion,"patch"):D.release.blockletVersion},a)),m(D.release)}catch(D){p(!1),$.error(Pe(D))}},re=async()=>{if(l===X.UNOWNED_DID){f({blockletVersion:"1.0.0",blockletTitle:""});return}if(!l){$.error(i("blocklet.publish.errorTip.noDid"));return}try{const D=await g.getProject({input:{did:a.meta.did,projectId:l}});p(!1);const _=D.project||{};_.blockletVersion?(r==="create"||r==="new-release")&&Ie.valid(_.blockletVersion)&&(_.blockletVersion=Ie.inc(_.blockletVersion,"patch")):_.blockletVersion="1.0.0";const Re=h0(_,a);f(Re),_.lastReleaseId||Z()}catch(D){p(!1),$.error(Pe(D))}},ne=C.useCallback(async()=>{if(r==="view"){if(!G){$.error("Empty release id");return}await re(),await B();return}await re(),G&&(T(!0),await B())},[r,G]),Ke=D=>{f({blockletComponents:D})};C.useEffect(()=>{ne()},[ne]),C.useEffect(()=>{l===X.UNOWNED_DID&&(r==="create"||r==="new-release")&&e&&Z()},[l,e,r,Z]);const _e=C.useMemo(()=>!!Object.keys(k).find(D=>!!k[D].length),[k]);if(!u&&y)return o.jsx(ze,{});if(!u)return null;const Be=te.find(D=>D.meta.did===Q);if(te.every(D=>D.status!=="running")&&(te!=null&&te.length))return o.jsx(ye,{children:i("blocklet.publish.allComponentsNotRunning")});const ee=D=>{xe(D)},Ee=e==null?void 0:e.searchParams.get("resourcesTitle"),q1=e==null?void 0:e.searchParams.get("componentsTitle"),ke=[{label:i("blocklet.publish.branding"),description:i("blocklet.publish.steps.branding")},{label:i("common.introduction"),description:i("blocklet.publish.steps.introduction")},{label:Ee||i("blocklet.publish.resourceTitle"),description:i("blocklet.publish.steps.resources")},{label:q1||i("common.components"),description:i("blocklet.publish.steps.blocklets")},{label:i("blocklet.publish.versionTitle"),description:i("blocklet.publish.steps.version")}],e2=ke[Y]||ke[ke.length-1],we=u3[Y];return o.jsxs(p3,{...t,children:[o.jsx(K0,{blocklet:a,release:c,getData:ne,getRelease:B,mode:r,params:u,setParams:f,setParamsErrTip:b,readOnly:F,isPublished:de,loading:y,setLoading:p,initLogoUrl:V,releaseId:G,projectId:l,projectType:fe,resourceComponents:te,resourceComponentsMap:M,resourceRelateComponents:H,resourceItem:Be,saveSelectedEventsRef:L,hasSelectedResources:_e,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(Y0,{steps:ke,viewMode:r==="view",params:u,hasSelectedResources:_e||u.uploadedResource,paramsErrTip:x,activeStep:Y,setActiveStep:Se,projectId:l,resourcesUrlTitle:Ee,componentsUrlTitle:q1}),o.jsxs(z,{flex:"1",maxWidth:"720px",children:[!v&&we!=="introduction"&&o.jsxs(J,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[e2.label,we==="branding"&&o.jsx(ve,{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(k2,{})})})]}),(v||we==="branding")&&o.jsx(z,{flexDirection:"column",children:o.jsx(U0,{projectId:l,setParams:f,setParamsErrTip:b,params:u,componentDid:d,blocklet:a,initUrl:e,loading:y,setLoading:p,paramsErrTip:x,readOnly:F,initLogoUrl:V,setInitLogoUrl:I})}),v&&o.jsx(z,{flexDirection:"column",children:o.jsx(t1,{loading:y,params:u,paramsErrTip:x,setParams:f,setParamsErrTip:b,readOnly:F})}),(v||we==="introduction")&&o.jsx(z,{display:"flex",flexDirection:"column",sx:{mt:v?5:0,width:"100%"},children:o.jsx(J0,{loading:y,readOnly:F,params:u,setParams:f,paramsErrTip:x,setParamsErrTip:b})}),v&&o.jsx(J,{variant:"h6",fontWeight:"bold",mt:5,children:ke[f0.resources].label}),o.jsx(z,{display:v||we==="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(Q2,{onChange:()=>f({resourceFromSelect:!u.resourceFromSelect}),children:[o.jsx(u1,{value:"select",disabled:F,control:o.jsx(e0,{size:"small",checked:u.resourceFromSelect}),label:i("blocklet.publish.resourceSelect")}),o.jsx(u1,{value:"select",disabled:F,control:o.jsx(e0,{size:"small",checked:!u.resourceFromSelect}),label:i("blocklet.publish.resourceUpload")})]}),u.resourceFromSelect&&o.jsxs(o.Fragment,{children:[!d&&o.jsx(I2,{tabs:ce,current:Q,onChange:ee,sx:{ml:-2,mt:2,maxWidth:v?window.innerWidth-24:"100%"}}),o.jsx(B1,{loading:y,initialResources:R,saveSelectedEventsRef:L,selectedResourceIds:k,setSelectedResourceIds:K,setResourceComponentsMap:q,error:x.blockletResource,app:a,readOnly:F,component:Be,componentDid:d,initUrl:e,params:u,setParams:f,projectId:l===X.UNOWNED_DID?"":l,releaseUsedLast:N,release:{...c,id:G}})]}),!u.resourceFromSelect&&o.jsx(F1,{app:a,readOnly:F,projectId:l===X.UNOWNED_DID?"":l,params:u,error:x.blockletResource,setParams:f,setParamsErrTip:b})]})})}),v&&o.jsx(J,{variant:"h6",fontWeight:"bold",mt:5,children:ke[f0.blocklets].label}),(v||we==="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(L1,{projectType:fe,disabled:y||F,app:a,value:(u==null?void 0:u.blockletComponents)||[],onChange:Ke,resourceRelateComponents:H,dependentComponentsMode:E})})})}),!v&&we==="version"&&o.jsx(z,{flexDirection:"column",children:o.jsx(t1,{loading:y,params:u,paramsErrTip:x,setParams:f,setParamsErrTip:b,readOnly:F})})]})]})]})]})}U1.propTypes={initUrl:h.object};U1.defaultProps={initUrl:null};const p3=ae.div`
182
182
  .section {
183
183
  &.full-width {
184
184
  max-width: 100%;
@@ -1 +1 @@
1
- import{d as A,v as R,p as w,e as p}from"./index-FHIuVSDt.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
1
+ import{d as A,v as R,p as w,e as p}from"./index-CyJ9Y2Pj.js";const O=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,x=/^[a-zA-Z]:\\/;function N(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return x.test(e)?!1:O.test(e)}const _=["http","https"],z=["nofollow"],L={};function T(e){const r=e||L,g=r.protocols||_,u=A(r.test);return function(h){R(h,"element",function(t,y,E){if(t.tagName==="a"&&typeof t.properties.href=="string"&&u(t,y,E)){const o=t.properties.href;if(N(o)?g.includes(o.slice(0,o.indexOf(":"))):o.startsWith("//")){const n=s(r.content,t),c=n&&!Array.isArray(n)?[n]:n,i=s(r.rel,t)||z,a=typeof i=="string"?w(i):i,f=s(r.target,t),l=s(r.properties,t);if(l&&Object.assign(t.properties,p(l)),a.length>0&&(t.properties.rel=[...a]),f&&(t.properties.target=f),c){const m=s(r.contentProperties,t)||{};t.children.push({type:"element",tagName:"span",properties:p(m),children:p(c)})}}}})}}function s(e,r){return typeof e=="function"?e(r):e}export{T as r};
@@ -1 +1 @@
1
- import{b3 as a}from"./index-CQ5dtdkj.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
+ import{b4 as a}from"./index-Dmbbtwcx.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,4 +1,4 @@
1
- import{b3 as l}from"./index-CQ5dtdkj.js";var c={exports:{}};/*!
1
+ import{b4 as l}from"./index-Dmbbtwcx.js";var c={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
@@ -1,4 +1,4 @@
1
- import{j as r,T as i,P as e,ds as f,fb as c,bq as u}from"./index-CQ5dtdkj.js";function l({name:t,nameFormatter:o,layout:a,children:n,valueComponent:s,nameWidth:m,...p}){return r.jsxs(d,{layout:a,width:m,...p,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:o(t)}),n&&r.jsx(i,{color:"textPrimary",component:s,className:"info-row__value",children:n})]})}l.propTypes={name:e.any.isRequired,layout:e.oneOf(["horizontal","vertical"]),children:e.any,nameFormatter:e.func,valueComponent:e.string,nameWidth:e.number};l.defaultProps={children:null,nameWidth:90,nameFormatter:t=>{const o=t.split(" ").map(a=>f(c(a))).join(" ");return typeof t=="string"?o:t},valueComponent:"div",layout:"horizontal"};const d=u("div")`
1
+ import{j as r,T as i,P as e,ds as f,fb as c,bq as u}from"./index-Dmbbtwcx.js";function l({name:t,nameFormatter:o,layout:a,children:n,valueComponent:s,nameWidth:m,...p}){return r.jsxs(d,{layout:a,width:m,...p,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:o(t)}),n&&r.jsx(i,{color:"textPrimary",component:s,className:"info-row__value",children:n})]})}l.propTypes={name:e.any.isRequired,layout:e.oneOf(["horizontal","vertical"]),children:e.any,nameFormatter:e.func,valueComponent:e.string,nameWidth:e.number};l.defaultProps={children:null,nameWidth:90,nameFormatter:t=>{const o=t.split(" ").map(a=>f(c(a))).join(" ");return typeof t=="string"?o:t},valueComponent:"div",layout:"horizontal"};const d=u("div")`
2
2
  display: flex;
3
3
  flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
4
4
  justify-content: flex-start;
@@ -1,4 +1,4 @@
1
- import{bp as e,P as o,r as b,j as p,bq as u,br as h,bg as x,T as w}from"./index-CQ5dtdkj.js";const T={50:"#eceff1",100:"#cfd8dc",200:"#b0bec5",300:"#90a4ae",400:"#78909c",500:"#607d8b",600:"#546e7a",700:"#455a64",800:"#37474f",900:"#263238",A100:"#cfd8dc",A200:"#b0bec5",A400:"#78909c",A700:"#455a64"},O=T,a={error:{color:e.common.white,backgroundColor:e.error.main},warning:{color:e.common.white,backgroundColor:e.warning.main},success:{color:e.common.white,backgroundColor:e.success.main},primary:{color:e.common.white,backgroundColor:e.primary.main},reverse:{color:"#fff",backgroundColor:"#222"}};function s(n){const t=h(n,s,["style"]),{type:r,content:l,children:m,style:d,className:y,forwardedRef:f,...g}=t,{palette:c}=x(),i=Object.assign({},a[r]||a.primary,d);return c[r]&&Object.assign(i,{color:c[r].contrastText||e.common.white,backgroundColor:c[r].main}),p.jsx(k,{ref:f,component:"span",className:y,style:i,...g,children:l||m})}s.propTypes={children:o.any.isRequired,type:o.oneOf(Object.keys(a)),content:o.string,className:o.string,style:o.oneOfType([o.object,o.string])};s.defaultProps={type:"primary",content:"",className:"",style:{}};const j=b.forwardRef((n,t)=>p.jsx(s,{...n,forwardedRef:t})),P=j,k=u(w)`
1
+ import{bp as e,P as o,r as b,j as p,bq as u,br as h,af as x,T as w}from"./index-Dmbbtwcx.js";const T={50:"#eceff1",100:"#cfd8dc",200:"#b0bec5",300:"#90a4ae",400:"#78909c",500:"#607d8b",600:"#546e7a",700:"#455a64",800:"#37474f",900:"#263238",A100:"#cfd8dc",A200:"#b0bec5",A400:"#78909c",A700:"#455a64"},O=T,a={error:{color:e.common.white,backgroundColor:e.error.main},warning:{color:e.common.white,backgroundColor:e.warning.main},success:{color:e.common.white,backgroundColor:e.success.main},primary:{color:e.common.white,backgroundColor:e.primary.main},reverse:{color:"#fff",backgroundColor:"#222"}};function s(n){const t=h(n,s,["style"]),{type:r,content:l,children:m,style:d,className:f,forwardedRef:y,...g}=t,{palette:c}=x(),i=Object.assign({},a[r]||a.primary,d);return c[r]&&Object.assign(i,{color:c[r].contrastText||e.common.white,backgroundColor:c[r].main}),p.jsx(k,{ref:y,component:"span",className:f,style:i,...g,children:l||m})}s.propTypes={children:o.any.isRequired,type:o.oneOf(Object.keys(a)),content:o.string,className:o.string,style:o.oneOfType([o.object,o.string])};s.defaultProps={type:"primary",content:"",className:"",style:{}};const j=b.forwardRef((n,t)=>p.jsx(s,{...n,forwardedRef:t})),P=j,k=u(w)`
2
2
  && {
3
3
  display: inline-flex;
4
4
  justify-content: center;