@abtnode/blocklet-services 1.16.43-beta-20250427-232837-e671de06 → 1.16.43-beta-20250430-124448-4edc5502

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 (303) hide show
  1. package/api/emails/_components/layout.js +2 -2
  2. package/api/emails/_libs/style.js +8 -3
  3. package/api/emails/_templates/kyc-code-verify.js +43 -0
  4. package/api/emails/_templates/new-user-session.js +2 -6
  5. package/api/emails/_templates/notification.js +2 -6
  6. package/api/emails/_templates/verify-code-body.js +4 -1
  7. package/api/emails/_templates/verify-code.js +2 -6
  8. package/api/index.js +31 -2
  9. package/api/libs/connect/session.js +4 -2
  10. package/api/libs/email.js +16 -0
  11. package/api/middlewares/ensure-blocklet.js +1 -1
  12. package/api/routes/blocklet.js +26 -17
  13. package/api/routes/ocap.js +1 -1
  14. package/api/routes/user-session.js +4 -2
  15. package/api/routes/user.js +1 -1
  16. package/api/services/auth/session.js +15 -10
  17. package/api/services/kyc/index.js +5 -11
  18. package/dist/assets/{AdapterDayjs-BUGplkxR.js → AdapterDayjs-BWhMsmQP.js} +1 -1
  19. package/dist/assets/{ArrowDropDown-B0sLkJoY.js → ArrowDropDown-DUCtp8oo.js} +1 -1
  20. package/dist/assets/{CheckCircle-BNrN9mgy.js → CheckCircle-yKW43XdV.js} +1 -1
  21. package/dist/assets/{ChevronLeft-Dq00IS01.js → ChevronLeft-6AvuBihM.js} +1 -1
  22. package/dist/assets/{ChevronRight-ZTqWK-Ga.js → ChevronRight-BsdsjNxw.js} +1 -1
  23. package/dist/assets/{Community-DZCTPNMP.js → Community-DathqRsd.js} +1 -1
  24. package/dist/assets/{DeleteOutline-C2sY6hfm.js → DeleteOutline-D_I07sPe.js} +1 -1
  25. package/dist/assets/{Done-JLiLhELm.js → Done-DLTvHdZB.js} +1 -1
  26. package/dist/assets/{Download-Ch4RfGRW.js → Download-DKz_gZX5.js} +1 -1
  27. package/dist/assets/{Edit-CY6fFHQM.js → Edit-odNPT5GK.js} +1 -1
  28. package/dist/assets/{EditIcon-Bi2cR-_u.js → EditIcon-DWRQ3fi6.js} +1 -1
  29. package/dist/assets/{Email-Dz2Eyqu0.js → Email-B0n6rLUZ.js} +1 -1
  30. package/dist/assets/{Error-CSFUqG0m.js → Error-js7ePZ5o.js} +1 -1
  31. package/dist/assets/{ExpandLess-BiMmSOBl.js → ExpandLess-TUium4RQ.js} +1 -1
  32. package/dist/assets/{Google-GOp5YvmZ.js → Google-C7d25Q5r.js} +1 -1
  33. package/dist/assets/{Holiday-Lc6woG1j.js → Holiday-BkY6LMfd.js} +1 -1
  34. package/dist/assets/{InfoOutlined-CQB5qKm-.js → InfoOutlined-BjII93aR.js} +1 -1
  35. package/dist/assets/{Launch-fxgQvk19.js → Launch-ryL3I8d9.js} +1 -1
  36. package/dist/assets/{LaunchOutlined-BV4_W1pb.js → LaunchOutlined-D21Xchdf.js} +1 -1
  37. package/dist/assets/{Location-B8EOY3d0.js → Location-BQhEvGNL.js} +1 -1
  38. package/dist/assets/{LockIcon-fuTfhB_G.js → LockIcon-Bd69pSJI.js} +1 -1
  39. package/dist/assets/{Meeting-Epdyx36z.js → Meeting-BW-_XtSL.js} +1 -1
  40. package/dist/assets/{MoreHoriz-CX_pwfPT.js → MoreHoriz-DHyMdwpT.js} +1 -1
  41. package/dist/assets/{OffSick-VYgugWxu.js → OffSick-9I8vBA8l.js} +1 -1
  42. package/dist/assets/{Phone-KP65huHK.js → Phone-CKzC4712.js} +1 -1
  43. package/dist/assets/{PlayArrow-DFH1Psjx.js → PlayArrow-zDVVYX6u.js} +1 -1
  44. package/dist/assets/{QuestionMarkCircle-p6m3avKp.js → QuestionMarkCircle-DpFFQWud.js} +1 -1
  45. package/dist/assets/{ServerLogo-Bssx1Eou.js → ServerLogo-AfxVBRdi.js} +1 -1
  46. package/dist/assets/{Timezone-Ce4E1Xey.js → Timezone-C3hiNX6j.js} +1 -1
  47. package/dist/assets/{TuneOutlined-Dy2qPFGI.js → TuneOutlined-Bv7cSbWT.js} +1 -1
  48. package/dist/assets/{ViewList-e3CoNi3K.js → ViewList-Ca1IEB31.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-CXFJ6pz8.js → WorkingRemotely-CHzRY2CT.js} +1 -1
  50. package/dist/assets/access-control-CwSjARsN.js +14 -0
  51. package/dist/assets/{actions-DA-6s_nQ.js → actions-BW0Vx00_.js} +1 -1
  52. package/dist/assets/{add-component-core-DG9mQFsr.js → add-component-core-DXp_ntZ3.js} +43 -37
  53. package/dist/assets/add-resource-CmPIp37F.js +1 -0
  54. package/dist/assets/{addon-Bcc-Xwbf.js → addon-FArG2oUy.js} +1 -1
  55. package/dist/assets/{advanced-DTe2fs5L.js → advanced-mJXTlRFz.js} +2 -2
  56. package/dist/assets/api-Bf1onQOz.js +1 -0
  57. package/dist/assets/appearance-D9WrcbPF.js +1 -0
  58. package/dist/assets/ar-BRKjvO8p.js +1 -0
  59. package/dist/assets/ar-Duy7ZH--.js +7 -0
  60. package/dist/assets/audit-logs-CVUuBgdy.js +35 -0
  61. package/dist/assets/{authorize-DUyL7MEU.js → authorize-Bk0sIDAH.js} +1 -1
  62. package/dist/assets/{base32-p9VcJrwv.js → base32-C_EKY5vU.js} +1 -1
  63. package/dist/assets/{branding-_VO2ZZ3t.js → branding-BoSHL25b.js} +2 -2
  64. package/dist/assets/branding-Cywl-fod.js +54 -0
  65. package/dist/assets/bundle-avatar-BXQsJw7m.js +1 -0
  66. package/dist/assets/button-h00yLUET.js +1 -0
  67. package/dist/assets/{click-to-copy-BGyXQL2i.js → click-to-copy-0s0a7Ak5.js} +1 -1
  68. package/dist/assets/cloneDeep-WT_kDeVd.js +1 -0
  69. package/dist/assets/complete--raviZZ4.js +45 -0
  70. package/dist/assets/{component-5gjaNHCg.js → component-C3maTG8x.js} +82 -75
  71. package/dist/assets/config-Die5cVWR.js +32 -0
  72. package/dist/assets/{config-Bh19ZUJ-.js → config-e3P85n7z.js} +1 -1
  73. package/dist/assets/{config-navigation-Dvjz9nAh.js → config-navigation-DhvlW96p.js} +6 -6
  74. package/dist/assets/config-space-CHI2AzS5.js +1 -0
  75. package/dist/assets/{confirm-DqvNmeoz.js → confirm-BqrhdaU7.js} +2 -2
  76. package/dist/assets/connect-DGOqnhoS.js +5 -0
  77. package/dist/assets/connect-cpTXz6hq.js +1 -0
  78. package/dist/assets/connect-to-C1xSYa-8.js +1 -0
  79. package/dist/assets/{content-layout-BPaAeaMQ.js → content-layout-C3Yd4mK9.js} +1 -1
  80. package/dist/assets/dashboard-CvJ8cVy-.js +280 -0
  81. package/dist/assets/de-D3cg0t9f.js +1 -0
  82. package/dist/assets/de-jJ-wrtW1.js +7 -0
  83. package/dist/assets/{delete-confirm-_BzUlhv2.js → delete-confirm-CmXluMcs.js} +1 -1
  84. package/dist/assets/did-address-C6ni99I7.js +1 -0
  85. package/dist/assets/{domain-ag7_Ivc1.js → domain-B7m2mZGp.js} +1 -1
  86. package/dist/assets/domain-action-card-DIGUxqW7.js +24 -0
  87. package/dist/assets/domains-DV-Gl3-a.js +1 -0
  88. package/dist/assets/{dot-BE1YP292.js → dot-WAAJ-O65.js} +2 -2
  89. package/dist/assets/{email-DKpgximx.js → email-CxndZMem.js} +2 -2
  90. package/dist/assets/{empty-spinner-DmDm8XzF.js → empty-spinner-BYUFR95o.js} +1 -1
  91. package/dist/assets/es-CoGP0eAj.js +7 -0
  92. package/dist/assets/es-DPjqApVE.js +1 -0
  93. package/dist/assets/exchange-passport-JjK-mItt.js +1 -0
  94. package/dist/assets/fr-Dscs9WsP.js +1 -0
  95. package/dist/assets/fr-yctlgsrj.js +7 -0
  96. package/dist/assets/{fuel-CcBzY6Bt.js → fuel-bktBZZhG.js} +1 -1
  97. package/dist/assets/{gen-access-key-DxKwgiGT.js → gen-access-key-CPCwDcVa.js} +1 -1
  98. package/dist/assets/get-safe-url-C-CJKtkC.js +1 -0
  99. package/dist/assets/get-safe-url-cyoeQ7Mw.js +1 -0
  100. package/dist/assets/hi-B8D3j6bs.js +1 -0
  101. package/dist/assets/hi-Dh_pGPBD.js +5 -0
  102. package/dist/assets/{home-Bi8fA3jh.js → home-BclSkhw2.js} +1 -1
  103. package/dist/assets/{id-BderyGO5.js → id-DWMMQI0G.js} +1 -1
  104. package/dist/assets/id-cicarMJv.js +7 -0
  105. package/dist/assets/{iframe-DZ181i8X.js → iframe-DZlnwo40.js} +1 -1
  106. package/dist/assets/{index-CYeIiQ6Q.js → index--MMFwLMX.js} +1 -1
  107. package/dist/assets/index-17ov_POl.js +345 -0
  108. package/dist/assets/index-BAstW3VS.js +137 -0
  109. package/dist/assets/{index-BT0GBmWF.js → index-BUHlfcy3.js} +1 -1
  110. package/dist/assets/{index-DyxFC42L.js → index-Bdi900W2.js} +3 -3
  111. package/dist/assets/index-BhX4Vx5B.js +192 -0
  112. package/dist/assets/{index-SDdS_qt8.js → index-Bt7GP-dU.js} +1 -1
  113. package/dist/assets/index-BugTfB-J.js +288 -0
  114. package/dist/assets/index-C-rU1lEd.js +10 -0
  115. package/dist/assets/index-C0x4zVBW.js +55 -0
  116. package/dist/assets/index-C4pzdyRW.js +1 -0
  117. package/dist/assets/index-C8EYAWok.js +113 -0
  118. package/dist/assets/index-CLD6I2fv.js +6 -0
  119. package/dist/assets/{index-CHbpkZwO.js → index-CMFOn8T3.js} +1 -1
  120. package/dist/assets/index-COTyGW2s.js +4 -0
  121. package/dist/assets/index-CiIQJxvH.js +1 -0
  122. package/dist/assets/index-CksPySYI.js +701 -0
  123. package/dist/assets/{index-DKhrYmrN.js → index-DIe9psLc.js} +1 -1
  124. package/dist/assets/{index-n0Q-fETi.js → index-DJeuTVoT.js} +7 -7
  125. package/dist/assets/{index-YbJjfDTR.js → index-DODYa3Im.js} +1 -1
  126. package/dist/assets/{index-B1ljmpu4.css → index-DOq-_YXu.css} +1 -1
  127. package/dist/assets/{index-CGBZONPv.js → index-D_z5kVUS.js} +1 -1
  128. package/dist/assets/{index-Dl4W1N74.js → index-DdLPuFP7.js} +1 -1
  129. package/dist/assets/index-DxR1P6Lh.js +241 -0
  130. package/dist/assets/index-htPha6tP.js +11 -0
  131. package/dist/assets/{invitation-BrAZQXQL.js → invitation-sucipANy.js} +8 -8
  132. package/dist/assets/invite-Bkpf8YcY.js +1 -0
  133. package/dist/assets/{issue-passport-Dd_yyO08.js → issue-passport-Dm4XKvqR.js} +1 -1
  134. package/dist/assets/item-CCsztPdL.js +2 -0
  135. package/dist/assets/ja-3LoBq68U.js +1 -0
  136. package/dist/assets/ja-Bm56AvcM.js +7 -0
  137. package/dist/assets/ko-B0ZZ2RWO.js +7 -0
  138. package/dist/assets/ko-B2dxwXDl.js +1 -0
  139. package/dist/assets/landing-page-BJMRDSCP.js +1 -0
  140. package/dist/assets/{launch-result-message-C9huWJUf.js → launch-result-message-B_fS-f90.js} +1 -1
  141. package/dist/assets/{layout-Cw-hwCHs.js → layout-DV03YuuA.js} +1 -1
  142. package/dist/assets/list-BgP6u-5j.js +236 -0
  143. package/dist/assets/list-header-8k1_C0K0.js +1 -0
  144. package/dist/assets/localization-CTzQFuMS.js +1 -0
  145. package/dist/assets/{log-Chqr_or_.js → log-B4LRFTNR.js} +1 -1
  146. package/dist/assets/{logger-zix81YaM.js → logger-8RyN9oiF.js} +1 -1
  147. package/dist/assets/login-B6TE3gqj.js +1 -0
  148. package/dist/assets/login-oauth-callback-CPP0UVME.js +1 -0
  149. package/dist/assets/logo-uploader-DMxsEq63.js +133 -0
  150. package/dist/assets/{lost-passport-Do1Pl0xI.js → lost-passport-ekwdQ24A.js} +2 -2
  151. package/dist/assets/lottie-error-CMOXHtBH.js +1 -0
  152. package/dist/assets/lottie-loading-o-GBrhM9.js +1 -0
  153. package/dist/assets/lottie-welcome-C9B95FIi.js +1 -0
  154. package/dist/assets/omit-DNeUY6_X.js +1 -0
  155. package/dist/assets/{open-window-D8MZhu_7.js → open-window-BjXpEOv2.js} +1 -1
  156. package/dist/assets/{overview-DLA9wj6a.js → overview-CJRHh92f.js} +2 -2
  157. package/dist/assets/{page-header-CWY8mxlT.js → page-header-MKUHlyAT.js} +1 -1
  158. package/dist/assets/{passport-item-CWtlyIE_.js → passport-item-jrknj0MQ.js} +1 -1
  159. package/dist/assets/{permission-BGM09622.js → permission-PNXSTeNL.js} +1 -1
  160. package/dist/assets/preferences-9BJlt30G.js +1 -0
  161. package/dist/assets/profile-embed-CIWdUuC6.js +1 -0
  162. package/dist/assets/pt-6Xqu-_a4.js +5 -0
  163. package/dist/assets/pt-eei1_Z4R.js +1 -0
  164. package/dist/assets/publish-resource-BQg2Vwb0.js +1 -0
  165. package/dist/assets/{react-beautiful-dnd.esm-ByydTUk4.js → react-beautiful-dnd.esm-C1Wt0pHO.js} +1 -1
  166. package/dist/assets/relative-time-cijkMMnc.js +1 -0
  167. package/dist/assets/ru-ZKgT6XdU.js +1 -0
  168. package/dist/assets/ru-y0N1jyVB.js +5 -0
  169. package/dist/assets/runtime-71FSw-R0.js +1 -0
  170. package/dist/assets/sdk-BXECCi1q.js +1 -0
  171. package/dist/assets/{security-BhkfG23R.js → security-Y5seZEn6.js} +4 -4
  172. package/dist/assets/session-DLQ0rbYE.js +1 -0
  173. package/dist/assets/setup-4hj9RPfM.js +30 -0
  174. package/dist/assets/{shorten-label-DFzv9EKX.js → shorten-label-SbKUBkvs.js} +1 -1
  175. package/dist/assets/{simple-select-DlrdVbaI.js → simple-select-CLc0Q9sm.js} +1 -1
  176. package/dist/assets/{slicedToArray-CPl5_eGD.js → slicedToArray-C0YDCVwK.js} +2 -2
  177. package/dist/assets/{spaces-WkJCApHO.js → spaces-CP1iyRKS.js} +1 -1
  178. package/dist/assets/start-Bt5Vo3K8.js +187 -0
  179. package/dist/assets/starting-progress-yIv14mT6.js +40 -0
  180. package/dist/assets/{status-CygZ0LuY.js → status-BKlS-OSq.js} +1 -1
  181. package/dist/assets/{step-actions-D_1PFeFs.js → step-actions-DMwF4axn.js} +1 -1
  182. package/dist/assets/{studio-Byjzwg8q.js → studio-BR3c6nt5.js} +1 -1
  183. package/dist/assets/{switch-control-5fEOPVKs.js → switch-control-yJOWKqcv.js} +1 -1
  184. package/dist/assets/th-CG5eLRZo.js +1 -0
  185. package/dist/assets/th-CJa7646q.js +5 -0
  186. package/dist/assets/{traffic-T11hxc--.js → traffic-BzRbyLJ-.js} +1 -1
  187. package/dist/assets/{transfer-ROpxn9LD.js → transfer-Ds9NQ12A.js} +1 -1
  188. package/dist/assets/unsubscribe-hfXD8-ea.js +1 -0
  189. package/dist/assets/use-blocklet-logo-BOYeM9RY.js +1 -0
  190. package/dist/assets/{use-mobile-C_flBrm-.js → use-mobile-BKvZ6hcv.js} +1 -1
  191. package/dist/assets/{use-mobile-DlKplWTG.js → use-mobile-BNUwcWCH.js} +1 -1
  192. package/dist/assets/{useAsync-CGW40D2-.js → useAsync-GjVghrwi.js} +1 -1
  193. package/dist/assets/{useLocalStorage-DldnaMbZ.js → useLocalStorage-CXDkfohf.js} +1 -1
  194. package/dist/assets/user-center-CBh-mxjZ.js +76 -0
  195. package/dist/assets/util-D-LnEy9h.js +1 -0
  196. package/dist/assets/{util-Bjy-tP7q.js → util-DJFgW-07.js} +1 -1
  197. package/dist/assets/{vendor-arcblock-ScFEr-lj.js → vendor-arcblock-Dkhgjlzn.js} +100 -97
  198. package/dist/assets/vendor-hooks-DXGUREV9.js +7 -0
  199. package/dist/assets/vendor-mui-core-B6POpIBB.js +266 -0
  200. package/dist/assets/{vendor-mui-x-B0hsmEJ3.js → vendor-mui-x-CATHW1QL.js} +1 -1
  201. package/dist/assets/{vendor-utils-BNHJB5U7.js → vendor-utils-CjMBJT5V.js} +17 -17
  202. package/dist/assets/vendor-ux-did-connect-D4-ZeZHm.js +2292 -0
  203. package/dist/assets/vi-CoZs3B42.js +1 -0
  204. package/dist/assets/vi-Rc5fwdQU.js +5 -0
  205. package/dist/assets/wrap-locale-Dob_mf2V.js +1 -0
  206. package/dist/assets/zh-CgkeS2I3.js +1 -0
  207. package/dist/assets/{zh-BYRCoK6F.js → zh-J32RyrWT.js} +2 -2
  208. package/dist/assets/zh-tw-BSUxp5LQ.js +7 -0
  209. package/dist/assets/zh-tw-CuakNRcW.js +1 -0
  210. package/dist/index.html +7 -7
  211. package/dist/service-worker.js +2 -2
  212. package/dist/share/shared-bridge.html +85 -0
  213. package/package.json +46 -46
  214. package/dist/assets/access-control-B20P1UrY.js +0 -14
  215. package/dist/assets/add-resource-BoS5YkVy.js +0 -1
  216. package/dist/assets/api-BrU7j0QA.js +0 -1
  217. package/dist/assets/appearance-DYi32tlk.js +0 -1
  218. package/dist/assets/ar-CmhpkjwX.js +0 -1
  219. package/dist/assets/ar-DupP3pla.js +0 -7
  220. package/dist/assets/audit-logs-CydL26ZC.js +0 -35
  221. package/dist/assets/branding-CAMtNLMU.js +0 -54
  222. package/dist/assets/bundle-avatar-D0t7RLGx.js +0 -1
  223. package/dist/assets/button-BeZibzB9.js +0 -1
  224. package/dist/assets/cloneDeep-SfcdeqEN.js +0 -1
  225. package/dist/assets/complete-BzCBoyhn.js +0 -45
  226. package/dist/assets/config-1xq1_d84.js +0 -32
  227. package/dist/assets/config-space-CYg-72ab.js +0 -1
  228. package/dist/assets/connect-Bbc2y5nS.js +0 -1
  229. package/dist/assets/connect-DM2xKEWk.js +0 -5
  230. package/dist/assets/connect-to-Ck5O2M1K.js +0 -1
  231. package/dist/assets/dashboard-8QXGSoVu.js +0 -280
  232. package/dist/assets/de-Doy9B4I7.js +0 -1
  233. package/dist/assets/de-TcDcBkI0.js +0 -7
  234. package/dist/assets/did-address-DUThaBlf.js +0 -1
  235. package/dist/assets/domain-action-card-D3w6jyPR.js +0 -24
  236. package/dist/assets/domains-BDxEOJh6.js +0 -1
  237. package/dist/assets/es-CDD0y3ur.js +0 -7
  238. package/dist/assets/es-CruF8tDk.js +0 -1
  239. package/dist/assets/exchange-passport-Izkf8qpM.js +0 -1
  240. package/dist/assets/fr-Bajh_D8H.js +0 -1
  241. package/dist/assets/fr-zYSSKlBw.js +0 -7
  242. package/dist/assets/get-safe-url-Bq9SFfX6.js +0 -1
  243. package/dist/assets/get-safe-url-DBsPGn--.js +0 -1
  244. package/dist/assets/hi-BsP-0YrU.js +0 -5
  245. package/dist/assets/hi-DOsApYK0.js +0 -1
  246. package/dist/assets/id-CY2FWdMB.js +0 -7
  247. package/dist/assets/index-B2yOcqTl.js +0 -192
  248. package/dist/assets/index-BGgGfqEc.js +0 -346
  249. package/dist/assets/index-B_vrglsK.js +0 -10
  250. package/dist/assets/index-BnmeT4Bk.js +0 -113
  251. package/dist/assets/index-C8QMe2NL.js +0 -138
  252. package/dist/assets/index-Cjjg2_Xp.js +0 -11
  253. package/dist/assets/index-DNG6b9sp.js +0 -224
  254. package/dist/assets/index-DO3_1y-L.js +0 -708
  255. package/dist/assets/index-DO4cSlUf.js +0 -290
  256. package/dist/assets/index-DcBUShKK.js +0 -1
  257. package/dist/assets/index-DuH8q5ir.js +0 -1
  258. package/dist/assets/index-EnQ254k3.js +0 -6
  259. package/dist/assets/index-bb90BUf4.js +0 -55
  260. package/dist/assets/index-mDKG4SiY.js +0 -1
  261. package/dist/assets/index-slEV_y-C.js +0 -4
  262. package/dist/assets/invite-Cbz8B2uW.js +0 -1
  263. package/dist/assets/item-nK3D7WH5.js +0 -2
  264. package/dist/assets/ja-99RIjwwl.js +0 -1
  265. package/dist/assets/ja-BLPXqHM4.js +0 -7
  266. package/dist/assets/ko-8oFi6wHH.js +0 -1
  267. package/dist/assets/ko-Cxgk34co.js +0 -7
  268. package/dist/assets/landing-page-BMM_oJb1.js +0 -1
  269. package/dist/assets/list-Dmtz4mRb.js +0 -235
  270. package/dist/assets/list-header-CgF1S4js.js +0 -1
  271. package/dist/assets/localization-DATb3Y_j.js +0 -1
  272. package/dist/assets/login-DjB23H9M.js +0 -1
  273. package/dist/assets/login-oauth-callback-ILeP59KT.js +0 -1
  274. package/dist/assets/logo-uploader-CJrdpVcQ.js +0 -133
  275. package/dist/assets/omit-bLid3PKQ.js +0 -1
  276. package/dist/assets/preferences-DYdbb0kG.js +0 -1
  277. package/dist/assets/profile-embed-CeEMHxEc.js +0 -1
  278. package/dist/assets/pt-BINIHul4.js +0 -5
  279. package/dist/assets/pt-ChXuTrrd.js +0 -1
  280. package/dist/assets/publish-resource-BEc_A5mC.js +0 -1
  281. package/dist/assets/relative-time-Djw-K4Zu.js +0 -1
  282. package/dist/assets/ru-BifF7u-P.js +0 -5
  283. package/dist/assets/ru-IkTTTY0K.js +0 -1
  284. package/dist/assets/runtime-DXl0lfXF.js +0 -1
  285. package/dist/assets/sdk-CTe6rL6c.js +0 -1
  286. package/dist/assets/session-VIMbdc9j.js +0 -1
  287. package/dist/assets/setup-BmYxTt6Z.js +0 -25
  288. package/dist/assets/start-CVexuuAk.js +0 -187
  289. package/dist/assets/th-CBxM23U5.js +0 -5
  290. package/dist/assets/th-OF8xr--T.js +0 -1
  291. package/dist/assets/unsubscribe-Cd3XOnSp.js +0 -1
  292. package/dist/assets/use-app-logo-B8Kl9EZt.js +0 -1
  293. package/dist/assets/user-center-CzyCbtWm.js +0 -77
  294. package/dist/assets/util-Dw9Eiuko.js +0 -1
  295. package/dist/assets/vendor-hooks-DftG_2gV.js +0 -7
  296. package/dist/assets/vendor-mui-core-CQ38ohp2.js +0 -266
  297. package/dist/assets/vendor-ux-did-connect-BdkhddhO.js +0 -2265
  298. package/dist/assets/vi-DCBJBc4G.js +0 -1
  299. package/dist/assets/vi-DY_Y13jR.js +0 -5
  300. package/dist/assets/wrap-locale-DMTYAE64.js +0 -1
  301. package/dist/assets/zh-BRAYg0sY.js +0 -1
  302. package/dist/assets/zh-tw-BG0rlH8p.js +0 -7
  303. package/dist/assets/zh-tw-D5-DkgwC.js +0 -1
@@ -0,0 +1,241 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bdi900W2.js","assets/vendor-ux-did-connect-D4-ZeZHm.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-CjMBJT5V.js","assets/vendor-mui-core-B6POpIBB.js","assets/vendor-hooks-DXGUREV9.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-Dkhgjlzn.js","assets/index-DODYa3Im.js","assets/index-CksPySYI.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as x,f as Tt,l as ct,L as ke,g as Mn,u as Un,i as Vn,j as jt}from"./vendor-react-DEoibe3W.js";import{a9 as Ce,j as e,v as Be,aa as c,be as $t,H as s,ad as je,I as ce,T as E,s as Fn,c7 as Oo,D as at,ah as ye,au as Hn,bS as Ke,ak as dt,bt as et,bx as tt,y as K,ab as Re,P as Wo,G as Bo,w as Pt,a7 as Mo,M as Uo,q as fe,X as Gn,aj as Vo,t as Fo,bV as Jn,N as Je,z as Ho,O as ne,al as ve,at as Go,L as Jo,A as _t,b6 as Xo,bK as Yo,by as Xn,e as Qo,aq as Yn,b$ as Qn,af as Zn,U as Zo,W as ot,bF as Kn,bG as es,c8 as ts,c9 as os,bo as wt,bp as ns,br as ss,bv as rs,bw as kt}from"./vendor-mui-core-B6POpIBB.js";import{z as ge,C as Se,af as ls,a7 as is,f as yo,ag as vo,ab as cs}from"./index-CksPySYI.js";import{r as De,n as Y,u as Q,bw as Ko,k as as,a as qe,ba as en,$ as tn,b7 as on,as as ds,bx as us,ab as qt,a2 as B,a7 as ps,I as ae,by as hs,bd as fs,b as We,aq as ut,b8 as ms,av as nn}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{O as pt,c as he,q as bs,T as xs,_ as sn,V as _e,p as gs}from"./vendor-arcblock-Dkhgjlzn.js";import{d as js}from"./Error-js7ePZ5o.js";import{C as ht}from"./confirm-BqrhdaU7.js";import{u as Ue}from"./session-DLQ0rbYE.js";import{W as Ct}from"./did-address-C6ni99I7.js";import{E as Xe}from"./empty-spinner-BYUFR95o.js";import{B as Et}from"./bundle-avatar-BXQsJw7m.js";import{S as we}from"./shorten-label-SbKUBkvs.js";import{L as Lt}from"./list-header-8k1_C0K0.js";import{_ as ks,A as de,p as Nt,E as rn}from"./vendor-utils-CjMBJT5V.js";import{d as ys}from"./Download-DKz_gZX5.js";import{C as ln}from"./click-to-copy-0s0a7Ak5.js";import{Q as vs}from"./QuestionMarkCircle-DpFFQWud.js";import{u as Rs}from"./vendor-hooks-DXGUREV9.js";import{_ as Pe}from"./useSetState-CWq0AVWn.js";import{c as At}from"./index-DVQCgvFb.js";import{E as zt}from"./index-DIe9psLc.js";import"./api-Bf1onQOz.js";import{d as ws}from"./ChevronRight-BsdsjNxw.js";import{T as Cs,a as Ss}from"./vendor-mui-x-CATHW1QL.js";import{d as nt}from"./DeleteOutline-D_I07sPe.js";import{D as Ro,C as wo,P as Co}from"./react-beautiful-dnd.esm-C1Wt0pHO.js";import{c as Ds,A as cn,u as an,S as Is,a as Ts,b as $s,e as Ps,U as _s,f as yt,g as dn,n as qs,h as Es,i as So,k as Ls,l as Ns}from"./item-CCsztPdL.js";import{d as As}from"./ArrowDropDown-DUCtp8oo.js";import{f as xe}from"./format-error-BrmqJs5a.js";import{d as un}from"./Launch-ryL3I8d9.js";import{d as pn}from"./Done-DLTvHdZB.js";import{D as zs}from"./delete-confirm-CmXluMcs.js";import{g as hn}from"./get-safe-url-cyoeQ7Mw.js";import{M as Os}from"./index-CMFOn8T3.js";import{r as Ws}from"./index-Bt7GP-dU.js";import"./lottie-web-jYmAQWuC.js";import"./raf-schd.esm-B3j6BePR.js";var Ot={},Bs=Ce;Object.defineProperty(Ot,"__esModule",{value:!0});var fn=Ot.default=void 0,Ms=Bs(De()),Us=e;fn=Ot.default=(0,Ms.default)((0,Us.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddBox");var Wt={},Vs=Ce;Object.defineProperty(Wt,"__esModule",{value:!0});var mn=Wt.default=void 0,Fs=Vs(De()),Hs=e;mn=Wt.default=(0,Fs.default)((0,Hs.jsx)("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H15v-8h5V8zm-1 7V3.5L18.5 9zm4 12.66V16h5.66v2h-2.24l2.95 2.95-1.41 1.41L19 19.41v2.24h-2z"}),"FileOpen");var Bt={},Gs=Ce;Object.defineProperty(Bt,"__esModule",{value:!0});var bn=Bt.default=void 0,Js=Gs(De()),Xs=e;bn=Bt.default=(0,Js.default)((0,Xs.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");function Mt({did:t,projectId:o,title:n,logo:l,describe:i}){const r=`${`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t}/${o}/logo/upload`}/${l}`,[u,a]=x.useState(!1),f=Be(b=>b.breakpoints.down("md"));return e.jsxs(c,{sx:{display:"flex",flexDirection:"row",color:u?"primary.main":"grey.900",gap:1},onPointerEnter:()=>a(!0),onPointerLeave:()=>a(!1),children:[e.jsx($t,{sx:{borderRadius:1},src:r}),e.jsxs(c,{children:[e.jsx(we,{hiddenTip:!0,maxLength:"24",sx:{fontSize:"14px",fontWeight:"500",color:f?"primary.main":""},children:n||"/"}),e.jsx(we,{hiddenTip:!0,maxLength:"58",sx:{fontSize:"12px",color:f||u?"primary.main":"grey.700"},children:i||"/"})]})]})}Mt.propTypes={projectId:s.string.isRequired,did:s.string.isRequired,title:s.string.isRequired,logo:s.string.isRequired,describe:s.string.isRequired};function Ut({initUrl:t}){const o=Tt(),n=(t==null?void 0:t.searchParams.get("tenantScope"))||"",{t:l,locale:i}=Q(),{api:d}=ge(),{api:r}=Ue(),[u,a]=x.useState(!0),{blocklet:f}=Se(),[b,j]=x.useState(null),[y,h]=x.useState(!1),p=Be(S=>S.breakpoints.down("xl")),v=Be(S=>S.breakpoints.down("md")),{componentDid:w=""}=ct(),[m,k]=x.useState(null),C=`publish-${f.meta.did}`,T=Ko(C),[$,I]=x.useState({searchText:T.searchText||"",pageSize:T.rowsPerPage||10,page:1}),L=()=>{d.getProjects({input:{did:f.meta.did,componentDid:w,tenantScope:n}}).then(S=>{const A=(S==null?void 0:S.projects)||[];a(!1),k(A)}).catch(S=>{a(!1),B.error(S.message)})},z=()=>{o(`${Y.UNOWNED_DID}/create/none`,{replace:!0})},q=S=>{j(S)},Z=()=>{a(!1),h(!0)},U=()=>{h(!1),j(null)},R=S=>{B.error(S.message),h(!1),j(null)},g=S=>{if(!(S!=null&&S.deleted)){B.error("Delete project failed");return}L(),h(!1),j(null)};x.useEffect(()=>{L()},[]);const D=x.useMemo(()=>{var A;if(!$.searchText)return m;let S=(A=$.searchText)==null?void 0:A.trim();return S?(S=as.toAddress(S).toLocaleLowerCase(),m.filter(H=>H.blockletTitle.toLowerCase().includes(S)||H.blockletDid.toLowerCase().includes(S))):m},[m,$.searchText]);if(!m&&u)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!m)return null;if(!m.length)return e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:l("blocklet.publish.blockletEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:l("blocklet.publish.createBlockletTip")}),e.jsx(qe,{onClick:z,variant:"contained",children:l("blocklet.publish.createBlocklet")})]});const M=[{label:"Blocklet",name:"blockletTitle",minWidth:160,options:{customBodyRenderLite:S=>{const A=m[S];return e.jsx(ke,{to:`${A.id}`,children:e.jsx(Mt,{did:f.meta.did,projectId:A.id,logo:A.blockletLogo,title:A.blockletTitle,describe:A.blockletDescription})})}}},{label:"Version",name:"blockletVersion",options:{searchable:!1,customBodyRender:S=>S?e.jsx(en,{type:"success",children:S}):""}},{label:"DID",name:"blockletDid",options:{customBodyRender:S=>S?e.jsx(Ct,{size:14,compact:!0,responsive:!1,did:S}):null}},p||w?null:{label:l("common.createdBy"),name:"createdBy",options:{customBodyRender:S=>S?e.jsx(Ct,{onClick:()=>{o(`/.well-known/service/admin/members?did=${S}`)},style:{cursor:"pointer"},size:14,compact:!0,copyable:!1,showQrcode:!1,responsive:!1,did:S}):null}},p||w?null:{label:l("common.scope"),name:"componentDid",options:{customBodyRender:S=>{const A=(f.children||[]).find(H=>H.meta.did===S);return A?e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:14,blocklet:A,ancestors:[f]}),e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:A.meta.title})]},S):""}}},p||n?null:{label:l("blocklet.publish.tenantScope"),name:"tenantScope",options:{customBodyRender:S=>e.jsx(c,{ml:.5,sx:{ml:.5,color:"text.primary",fontSize:14},children:e.jsx(we,{children:S})})}},{label:l("common.updatedAt"),name:"updatedAt",options:{searchable:!1,customBodyRender:S=>e.jsx(tn,{value:Number(S),locale:i})}},{label:l("common.actions"),name:"actions",options:{searchable:!1,customBodyRenderLite:S=>{const A=m[S];return e.jsxs(c,{display:"flex",children:[e.jsx(ke,{to:`${A.id}/new-release/${A.lastReleaseId}`,children:e.jsx(je,{title:l("blocklet.publish.createRelease"),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"create",children:e.jsx(fn,{style:{fontSize:18}})})})}),!!A.lastReleaseId&&e.jsx(je,{title:l("blocklet.publish.viewLastRelease",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx(ke,{style:{display:"flex"},to:`${A.id}/view/${A.lastReleaseId}`,children:e.jsx(mn,{sx:{fontSize:18}})})})}),e.jsx(je,{title:l("blocklet.publish.delete",{name:A.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>q(A),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}].filter(Boolean),O=({page:S,rowsPerPage:A,searchText:H})=>{$.pageSize!==A?I(J=>({...J,searchText:"",pageSize:A,page:1})):$.page!==S+1?I(J=>({...J,searchText:"",page:S+1})):$.searchText!==H&&I(J=>({...J,searchText:H,page:1}))},G=y?e.jsx(ds,{open:!0,popup:!0,onClose:U,action:"check-has-project-id",locale:i,checkFn:r.get,saveConnect:!1,forceConnected:!1,checkTimeout:5*60*1e3,onSuccess:g,onError:R,extraParams:{projectId:b.id,did:f.meta.did,name:b.blockletTitle},messages:{title:l("blocklet.publish.deleteProject.title",{name:b.blockletTitle}),scan:l("blocklet.publish.deleteProject.scan",{name:b.blockletTitle}),confirm:l("blocklet.publish.deleteProject.confirm"),success:l("blocklet.publish.deleteProject.success")}}):null;return e.jsxs(Ys,{children:[e.jsx(Lt,{sx:{mb:2},left:e.jsxs(c,{display:"flex",flexDirection:"row",alignItems:"center",children:[e.jsx(c,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:l("common.blockletStudio")}),e.jsx(je,{title:l("blocklet.publish.createBlockletTip"),arrow:!0,placement:"right",children:e.jsx(bn,{sx:{opacity:.6,fontSize:"1.1em",ml:1}})})]}),actions:e.jsxs(e.Fragment,{children:[e.jsx(us,{options:{searchPlaceholder:l("blocklet.list.searchPlaceholder"),searchDebounceTime:600,searchAlwaysOpen:v},search:$.searchText,searchText:$.searchText,searchTextUpdate:S=>I(A=>({...A,searchText:S})),searchClose:()=>I(S=>({...S,searchText:""})),onSearchOpen:()=>{}}),e.jsxs(qe,{onClick:z,variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),l("blocklet.publish.createBlocklet")]})]})}),e.jsx(qt,{className:"main-table",locale:i,data:D,columns:M,options:{search:!1,sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,searchAlwaysOpen:!0,rowsPerPageOptions:[10,20,50,100]},durable:C,onChange:O}),b&&e.jsx(ht,{title:`${l("common.delete")} ${b.blockletTitle}`,description:l("blocklet.publish.deleteProject.description"),confirm:l("common.confirm"),onConfirm:Z,onCancel:()=>j(null),children:e.jsx(c,{sx:{marginTop:2},children:[l("blocklet.publish.deleteProject.tip1"),l("blocklet.publish.deleteProject.tip2"),l("blocklet.publish.deleteProject.tip3")].map(S=>e.jsxs(c,{sx:{display:"flex",marginTop:1,flexDirection:"row",alignItems:"flex-start"},children:[e.jsx(js,{color:"warning",sx:{marginRight:1,fontSize:20,marginTop:"2px"}}),e.jsx(E,{component:"span",variant:"inherit",color:"text.secondary",children:S})]}))})}),G]})}const Ys=Fn(c)`
3
+ ${({theme:t})=>t.breakpoints.down("md")} {
4
+ .MuiTableRow-root {
5
+ border-color: ${({theme:t})=>t.palette.divider};
6
+ }
7
+ }
8
+ `;Ut.propTypes={initUrl:s.object};Ut.defaultProps={initUrl:null};var Vt={},Qs=Ce;Object.defineProperty(Vt,"__esModule",{value:!0});var xn=Vt.default=void 0,Zs=Qs(De()),Do=e;xn=Vt.default=(0,Zs.default)([(0,Do.jsx)("path",{d:"M20 17H4V5h8V3H4c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h4v2h8v-2h4c1.1 0 2-.9 2-2v-3h-2z"},"0"),(0,Do.jsx)("path",{d:"m17 14 5-5-1.41-1.41L18 10.17V3h-2v7.17l-2.59-2.58L12 9z"},"1")],"InstallDesktop");const Ks=(t,o)=>{if(!t)return"";try{return o?JSON.parse(t)[o]:JSON.parse(t)}catch{}return t},gn=Ks;function er(){var R;const{t,locale:o}=Q(),{projectId:n}=ct(),{api:l}=ge(),[i,d]=x.useState(!0),{blocklet:r}=Se(),u=Be(g=>g.breakpoints.down("md")),[a,f]=x.useState(null),[b,j]=x.useState(null),[y,h]=x.useState(null),p=(R=window.env)==null?void 0:R.serverEndpoint,v=`releases-${r.meta.did}-${n}`,w=Ko(v),[m,k]=x.useState({searchText:w.searchText||"",pageSize:w.rowsPerPage||10,page:1}),C=()=>{l.getReleases({input:{did:r.meta.did,projectId:n}}).then(g=>{const D=(g==null?void 0:g.releases)||[];d(!1),f(D)}).catch(g=>{d(!1),B.error(g.message)})},T=()=>{l.doBatchQuery({getProject:{input:{did:r.meta.did,projectId:n}},getReleases:{input:{did:r.meta.did,projectId:n}}}).then(g=>{j(g.getProject.project||{}),f(g.getReleases.releases||[]),d(!1)}).catch(g=>{d(!1),B.error(g.message)})};x.useEffect(()=>{T()},[]);const[$,I]=x.useState(""),L=()=>{d(!1);const g=y.id;l.deleteRelease({input:{did:r.meta.did,projectId:n,releaseId:g}}).then(()=>{d(!1),C(),B.success(t("common.removeSuccess")),h(null)}).catch(D=>{d(!1),B.error(D.message)})},z=g=>{h(g)};if(!a&&i)return e.jsx(c,{sx:{display:"flex",justifyContent:"center",alignItems:"center",marginTop:"40px"},children:e.jsx(Xe,{})});if(!a)return null;const q=e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"..",children:t("common.blockletStudio")}),e.jsx(E,{color:"text.primary",children:e.jsx(we,{maxLength:u?6:30,children:b.blockletTitle})})]});if(!a.length)return e.jsxs(e.Fragment,{children:[q,e.jsxs(c,{display:"flex",flexDirection:"column",alignItems:"center",pt:10,children:[e.jsx(c,{sx:{fontSize:20,fontWeight:"bold",mb:3},children:t("blocklet.publish.releaseEmptyTip")}),e.jsx(c,{sx:{fontSize:14,color:"text.secondary",mb:3},children:t("blocklet.publish.createReleaseTip")}),e.jsx(ke,{to:"create/none",children:e.jsx(qe,{variant:"contained",children:t("blocklet.publish.createRelease")})})]})]});const Z=[{label:t("common.version"),name:"blockletVersion",minWidth:160,options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(ke,{to:`view/${D.id}`,children:e.jsx(Mt,{did:r.meta.did,projectId:b.id,logo:D.blockletLogo,title:D.blockletVersion,describe:D.blockletTitle})})}}},{label:t("blocklet.publish.releaseNote"),name:"note",options:{customBodyRenderLite:g=>{const D=a[g];return e.jsx(E,{className:"note",children:gn(D.note,"note")})}}},{label:t("common.status"),name:"status",options:{customBodyRender:g=>e.jsx(en,{type:g==="published"?"success":"warning",children:g==="published"?"Released":ks(g)})}},{label:t("common.lastPublishedAt"),name:"updatedAt",options:{customBodyRenderLite:g=>{const D=a[g];return D.status!==he.PROJECT.RELEASE_STATUS.published?"":e.jsx(tn,{value:Number(D.updatedAt),locale:o})}}},{label:t("common.actions"),name:"actions",options:{customBodyRenderLite:g=>{var A;const D=a[g];let M="",O="";const G=D.status==="published";if(G){const H=de(p,`/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/release/blocklet.json`),J=new URL(p);J.pathname=de(J.pathname,"/launch-blocklet/agreement"),J.searchParams.set("blocklet_meta_url",H),M=J.href,O=de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${r.meta.did}/${b.id}/${b.lastReleaseId}/download/${(b.lastReleaseFiles||[])[0]}`)}const S=(A=b.blockletComponents)!=null&&A.some(H=>H.included)||D.uploadedResource?"pack":"resource";return e.jsxs(c,{display:"flex",alignItems:"center",children:[G&&S==="pack"&&e.jsx(je,{title:t("blocklet.publish.install",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"secondary","aria-label":"create",children:e.jsx("a",{style:{display:"flex"},href:M,target:"_blank",rel:"noreferrer",children:e.jsx(xn,{sx:{fontSize:18}})})})}),G&&e.jsx(je,{title:t("blocklet.publish.download",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"download",children:e.jsx("a",{style:{display:"flex"},href:O,children:e.jsx(ys,{sx:{fontSize:18}})})})}),e.jsx(je,{title:t("blocklet.publish.delete",{name:b.blockletTitle}),placement:"top",children:e.jsx(ce,{color:"primary","aria-label":"delete",onClick:()=>z(D),children:e.jsx(on,{sx:{fontSize:18}})})})]})}}}],U=({page:g,rowsPerPage:D,searchText:M})=>{m.pageSize!==D?k(O=>({...O,searchText:"",pageSize:D,page:1})):m.page!==g+1?k(O=>({...O,searchText:"",page:g+1})):m.searchText!==M&&k(O=>({...O,searchText:M,page:1}))};return e.jsxs(tr,{children:[e.jsx(Lt,{sx:{mb:2},left:q,actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{variant:"outlined",onClick:()=>{const g=de(p,`/api/project/${r.meta.did}/${n}/blocklet.json`);I(g)},children:t("blocklet.publish.copyInstallUrl")}),e.jsx(ke,{to:"new-release/none",children:e.jsxs(qe,{variant:"contained",children:[e.jsx(pt,{style:{fontSize:"1.3em",marginRight:4}}),t("blocklet.publish.createRelease")]})})]})}),e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:$,onClose:()=>I(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:t("blocklet.publish.installResourceTip")}),e.jsx(ln,{children:$}),e.jsxs(E,{sx:{mt:2},children:[t("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:t("blocklet.publish.installResourceHelp")})]})]})}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:o,data:a,columns:Z,durable:v,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1},onChange:U}),y&&e.jsx(ht,{title:t(`${t("common.delete")} ${y.blockletVersion}`),description:t("blocklet.publish.deleteReleaseTip"),confirm:t("common.confirm"),onConfirm:L,onCancel:()=>h(null)})]})}const tr=ye(c)`
9
+ .main-table > div:first-child {
10
+ display: none;
11
+ }
12
+ .note {
13
+ word-break: break-all;
14
+ white-space: pre-line;
15
+ }
16
+ ${({theme:t})=>t.breakpoints.down("md")} {
17
+ .MuiTableRow-root {
18
+ border-color: ${({theme:t})=>t.palette.divider};
19
+ }
20
+ }
21
+ `;var Ft={},or=Ce;Object.defineProperty(Ft,"__esModule",{value:!0});var jn=Ft.default=void 0,nr=or(De()),sr=e;jn=Ft.default=(0,nr.default)((0,sr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"DoDisturbAlt");function Me({children:t,Icon:o}){return e.jsxs(Hn,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"10px",margin:"10px 0px"},children:[e.jsx(c,{sx:{opacity:.3,fontSize:32},children:e.jsx(o,{})}),e.jsx(c,{sx:{mb:2,opacity:.7,fontSize:"small",color:"action"},children:t})]})}Me.propTypes={children:s.node.isRequired,Icon:s.elementType};Me.defaultProps={Icon:jn};function Ht({value:t,app:o,onChange:n,onChangeBlockletResourceType:l,disabled:i,resourceRelateComponents:d,projectType:r,dependentComponentsMode:u,blockletResourceType:a}){const{t:f,locale:b}=Q(),j=u==="readonly",y=x.useMemo(()=>{const C=t.reduce((T,$)=>(T[$.did]=$.included,T),{});return(o.children||[]).filter(T=>j?d[T.meta.did]||C[T.meta.did]:!0)},[o.children,t,d,j]),h=x.useMemo(()=>y.map(C=>t.find($=>$.did===C.meta.did)||{did:C.meta.did}),[y,t]),p=h.reduce((C,T)=>(C[T.did]=Nt(T,["required","included"]),C),{}),v=C=>{const T=h.map($=>{if($.did===C){const I=!$.included;return{...$,included:I,required:I}}return $});n(T)},w=C=>{const T=h.map($=>$.did===C?{...$,required:!$.required}:$);n(T)},m=C=>{l(C.target.checked?"resource":"")},k=[{label:f("common.name"),name:"meta.title",width:200,options:{customBodyRenderLite:C=>{var I;const T=y[C],$=(I=p[T.meta.did])==null?void 0:I.included;return e.jsxs(c,{display:"flex",alignItems:"center",children:[e.jsx(Et,{size:24,blocklet:T,ancestors:[o]}),e.jsx(c,{ml:"4px",className:At("text",{excluded:!$}),children:e.jsx(c,{children:T.meta.title})})]})}}},{label:f("blocklet.publish.componentIncluded"),width:100,options:{customBodyRenderLite:C=>{var L;const T=y[C],$=d[T.meta.did],I=!!((L=p[T.meta.did])!=null&&L.included);return e.jsx(Ke,{size:"small",checked:$||I,onClick:()=>v(T.meta.did),disabled:j||$||i})}}},{label:f("blocklet.publish.componentForceRequired"),width:100,options:{customBodyRenderLite:C=>{var z,q;const T=y[C],$=d[T.meta.did],I=!!((z=p[T.meta.did])!=null&&z.included),L=!!((q=p[T.meta.did])!=null&&q.required);return e.jsx(Ke,{size:"small",checked:$||L&&I,onClick:()=>w(T.meta.did),disabled:j||$||i||!I})}}}];return e.jsx(rr,{children:y!=null&&y.length?e.jsxs(e.Fragment,{children:[e.jsxs(dt,{severity:"info",style:{width:"100%"},children:[e.jsx(c,{display:"flex",alignItems:"center",rel:"noreferrer",ml:"13px",children:f(r==="pack"?"blocklet.publish.packTip":"blocklet.publish.resourceTip")}),e.jsxs(c,{component:"label",style:{cursor:"pointer"},children:[e.jsx(Ke,{size:"small",style:{marginLeft:"0px"},disabled:i,checked:a==="resource",onChange:m}),f("blocklet.publish.forceResourceBlocklet")]})]}),e.jsx(qt,{className:"main-table",verticalKeyWidth:100,locale:b,data:y,columns:k,options:{sort:!1,download:!1,filter:!1,print:!1,search:!1,rowsPerPage:50}})]}):e.jsx(Me,{Icon:zt,children:f("blocklet.publish.blockletEmptyTip")})})}Ht.propTypes={app:s.object.isRequired,value:s.arrayOf(s.shape({did:s.string.isRequired,required:s.bool,included:s.bool})),onChange:s.func,onChangeBlockletResourceType:s.func,disabled:s.bool,dependentComponentsMode:s.string,resourceRelateComponents:s.object,blockletResourceType:s.string,projectType:s.string.isRequired};Ht.defaultProps={value:[],onChange:()=>{},onChangeBlockletResourceType:()=>{},disabled:!1,dependentComponentsMode:"auto",blockletResourceType:"",resourceRelateComponents:{}};const rr=ye(c)`
22
+ .main-table {
23
+ .text.excluded {
24
+ color: #999;
25
+ }
26
+ width: 400px;
27
+ ${({theme:t})=>t.breakpoints.down("md")} {
28
+ width: 100%;
29
+ }
30
+ > div:first-child {
31
+ display: none;
32
+ }
33
+ .MuiTableCell-head {
34
+ padding-top: 0;
35
+ padding-bottom: 0;
36
+ }
37
+ .MuiTableCell-body {
38
+ padding-top: 6px;
39
+ padding-bottom: 6px;
40
+ }
41
+ .datatable-footer {
42
+ display: none;
43
+ }
44
+ ${({theme:t})=>t.breakpoints.down("md")} {
45
+ .MuiTableRow-root {
46
+ border-color: ${({theme:t})=>t.palette.divider};
47
+ }
48
+ }
49
+ }
50
+ `;var lr=(t,o=1,n)=>{if(n={indent:" ",includeEmptyLines:!1,...n},typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof o!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof o}\``);if(typeof n.indent!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof n.indent}\``);if(o===0)return t;const l=n.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return t.replace(l,n.indent.repeat(o))};const Io=ls,To=/\s+at.*(?:\(|\s)(.*)\)?/,ir=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,cr=typeof Io.homedir>"u"?"":Io.homedir();var ar=(t,o)=>(o=Object.assign({pretty:!1},o),t.replace(/\\/g,"/").split(`
51
+ `).filter(n=>{const l=n.match(To);if(l===null||!l[1])return!0;const i=l[1];return i.includes(".app/Contents/Resources/electron.asar")||i.includes(".app/Contents/Resources/default_app.asar")?!1:!ir.test(i)}).filter(n=>n.trim()!=="").map(n=>o.pretty?n.replace(To,(l,i)=>l.replace(i,i.replace(cr,"~"))):n).join(`
52
+ `));const dr=lr,ur=ar,pr=t=>t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");let hr=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);o=[...o].map(l=>l instanceof Error?l:l!==null&&typeof l=="object"?Object.assign(new Error(l.message),l):new Error(l));let n=o.map(l=>typeof l.stack=="string"?pr(ur(l.stack)):String(l)).join(`
53
+ `);n=`
54
+ `+dr(n,4),super(n),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:o})}*[Symbol.iterator](){for(const o of this._errors)yield o}};var fr=hr;const mr=fr;var br=async(t,o,{concurrency:n=1/0,stopOnError:l=!0}={})=>new Promise((i,d)=>{if(typeof o!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(n)||n===1/0)&&n>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${n}\` (${typeof n})`);const r=[],u=[],a=t[Symbol.iterator]();let f=!1,b=!1,j=0,y=0;const h=()=>{if(f)return;const p=a.next(),v=y;if(y++,p.done){b=!0,j===0&&(!l&&u.length!==0?d(new mr(u)):i(r));return}j++,(async()=>{try{const w=await p.value;r[v]=await o(w,v),j--,h()}catch(w){l?(f=!0,d(w)):(u.push(w),j--,h())}})()};for(let p=0;p<n&&(h(),!b);p++);});const xr=br;var gr=(t,o)=>xr(t,n=>n(),o);const st=Mn(gr);function jr(t,o){const n=new Set(o||[]),l=[];function i(d){n.has(d==null?void 0:d.id)&&l.push(d==null?void 0:d.id),d!=null&&d.children&&d.children.forEach(i)}return(t||[]).forEach(i),l}function Gt({src:t,alt:o,...n}){const[l,i]=x.useState(!1),d=x.useRef(null);return x.useEffect(()=>{if(!("IntersectionObserver"in window))return i(!0),()=>{};const r=new IntersectionObserver(u=>{u.forEach(a=>{a.isIntersecting&&(i(!0),r.disconnect())})},{threshold:.1});return d.current&&r.observe(d.current),()=>{r.disconnect()}},[]),e.jsx("img",{ref:d,src:l?t:void 0,alt:o,...n})}Gt.propTypes={src:s.string.isRequired,alt:s.string};Gt.defaultProps={alt:""};function Jt({data:t,lazy:o,...n}){return!t||!t.length?null:e.jsx(kr,{...n,children:t.map(l=>e.jsx("a",{href:l.url,target:"_blank",rel:"noreferrer",children:o?e.jsx(Gt,{src:l.url,alt:l.alt||""}):e.jsx("img",{src:l.url,alt:l.alt||""})},l.url))})}Jt.propTypes={data:s.arrayOf(s.shape({url:s.string,alt:s.string})),lazy:s.bool};Jt.defaultProps={data:[],lazy:!1};const kr=ye(c)`
55
+ display: flex;
56
+ justify-content: flex-start;
57
+ flex-wrap: wrap;
58
+ margin-bottom: -12px;
59
+ a {
60
+ display: flex;
61
+ }
62
+ img {
63
+ height: 128px;
64
+ cursor: pointer;
65
+ margin-right: 12px;
66
+ margin-bottom: 12px;
67
+ }
68
+ `,vt=(t,o)=>{const n=[...t];for(;n.length>0;){const l=n.shift();if(l.id===o)return l;l.children&&n.push(...l.children)}return[]};function Xt({icon:t}){return t?ps(t)?e.jsx("img",{className:"resource-icon",src:t,alt:"icon"}):e.jsx(ae,{className:"resource-icon",icon:t}):null}Xt.propTypes={icon:s.string};Xt.defaultProps={icon:""};function Yt({disabled:t,data:o,onChange:n,value:l}){const i=l;function d(h,p=[]){return p.push(h.id),h.children&&h.children.forEach(v=>d(v,p)),p}const r=h=>d(vt(o,h)),u=(h,p=[])=>{const v=vt(o,h);return v.parent?(p.push(v.parent),u(v.parent,p)):p};function a(h,p){const v=r(h.id),w=v.indexOf(h.id);return v.splice(w,1),v.every(m=>i.concat(p).includes(m))}const f=(h,p)=>{h.stopPropagation();const v=r(p),w=u(p);if(i.includes(p)){const m=i.filter(k=>!v.concat(w).includes(k));n(m)}else{const m=v;for(let k=0;k<w.length;++k)a(vt(o,w[k]),m)&&m.push(w[k]);n([...i].concat(m))}},b=h=>{h.stopPropagation()},j=o.some(h=>{var p;return((p=h.children)==null?void 0:p.length)>0}),y=h=>{var k;const p=i.indexOf(h.id)!==-1,v=Array.isArray(h.children),w=r(h.id),m=v&&!p&&i.some(C=>w.includes(C));return e.jsx(Cs,{nodeId:h.id,label:e.jsx(et,{onClick:b,control:e.jsx(Ke,{size:"small",checked:p,indeterminate:m,tabIndex:-1,disableRipple:!0,onClick:C=>f(C,h.id),disabled:h.disabled||t}),label:e.jsxs(c,{className:"content",children:[e.jsxs(c,{display:"flex",alignItems:"center",children:[h.icon&&e.jsx(Xt,{icon:h.icon}),e.jsx(c,{className:"name",children:h.name}),h.url&&e.jsx("a",{href:h.url,target:"_blank",rel:"noreferrer",className:"link",children:e.jsx(xs,{className:"link-icon"})})]}),!!h.description&&e.jsx(c,{className:"description",children:h.description}),!!((k=h.images)!=null&&k.length)&&e.jsx(Jt,{className:"images",data:h.images,lazy:!0})]})}),children:v?h.children.map(y):null},h.id)};return e.jsx(yr,{className:At(!j&&"no-children"),multiSelect:!0,defaultCollapseIcon:e.jsx(bs,{}),defaultExpandIcon:e.jsx(ws,{}),selected:i,children:o.map(h=>y(h))})}Yt.propTypes={data:s.array,value:s.array,onChange:s.func,disabled:s.bool};Yt.defaultProps={data:[],value:[],onChange:()=>{},disabled:!1};const yr=ye(Ss)`
69
+ &.no-children {
70
+ .MuiTreeItem-content {
71
+ padding: 0;
72
+ .MuiTreeItem-iconContainer {
73
+ display: none;
74
+ }
75
+ .MuiTreeItem-label {
76
+ padding-left: 0;
77
+ }
78
+ }
79
+ }
80
+ .MuiTreeItem-content {
81
+ align-items: flex-start;
82
+ .MuiTreeItem-iconContainer {
83
+ transform: translateY(10px);
84
+ }
85
+ &.Mui-selected {
86
+ background-color: transparent;
87
+ }
88
+ }
89
+ .MuiTreeItem-label {
90
+ cursor: default;
91
+ }
92
+ .MuiFormControlLabel-root {
93
+ align-items: flex-start;
94
+ }
95
+ .content {
96
+ padding-top: 6px;
97
+ }
98
+ .name {
99
+ font-size: 16px;
100
+ font-weight: 700;
101
+ }
102
+ .resource-icon {
103
+ margin-right: 2px;
104
+ font-size: 16px;
105
+ }
106
+ img.resource-icon {
107
+ width: 1rem;
108
+ height: 1rem;
109
+ }
110
+ .link {
111
+ margin-left: 8px;
112
+ font-size: 16px;
113
+ color: ${({theme:t})=>t.palette.primary.main};
114
+ display: flex;
115
+ }
116
+ .link-icon {
117
+ font-size: inherit;
118
+ }
119
+ .description {
120
+ font-size: 14px;
121
+ color: ${({theme:t})=>t.palette.text.secondary};
122
+ }
123
+ `,$o={},vr=(t,o,{key:n,cacheTime:l=1e3*3}={})=>{const i=n+JSON.stringify({params:o}),d=$o[i];if(d&&d.timestamp>Date.now()-l)return d.promise;const r=t(...o);return $o[i]={promise:r,timestamp:Date.now()},r},kn=vr,yn=(t,o)=>(t.forEach(n=>{o&&(n.parent=o),(n.children||[]).forEach(l=>{l.parent=n.id,yn(l.children||[],l.id)})}),t),vn=(t,o,n,l,i)=>{const{exportApi:d="/"}=(t==null?void 0:t.meta.resource)||{},r=new URL(de("http://127.0.0.1",t==null?void 0:t.mountPoint,d||"/").replace(/\/+/g,"/"));return r.searchParams.set("projectId",o),r.searchParams.set("releaseId",n),r.searchParams.set("local",l),i&&r.searchParams.set("resourcesParams",i.searchParams.get("resourcesParams")),`${r.pathname}${r.search}`},Rr=async({api:t,appDid:o,component:n,projectId:l,releaseId:i,locale:d,initUrl:r,resources:u})=>{let a;if(r&&r.searchParams.get("resourcesParams"))try{a=JSON.parse(r.searchParams.get("resourcesParams"))}catch(f){B.error(f.message);return}await rn.post(vn(n,l,i,d,r),{resources:u,projectId:l,releaseId:i,locale:d,...a?{resourcesParams:a}:{}},{headers:{"x-csrf-token":hs()},timeout:10*60*1e3}),await t.updateSelectedResources({input:{did:o,projectId:l,releaseId:i,componentDid:n.meta.did,resources:u}})},wr=(t,o)=>{if(!t)return{};const n=o.reduce((i,d)=>(i[d]=!0,i),{}),l=(i,d)=>(i.forEach(r=>{var u;n[r.id]&&((u=r.dependentComponents)!=null&&u.length)&&r.dependentComponents.forEach(a=>{d[a]=!0}),r.children&&l(r.children,d)}),d);return l(t,{})};function Qt({app:t,component:o,projectId:n,release:l,loading:i,error:d,saveSelectedEventsRef:r,readOnly:u,componentDid:a,initialResources:f={},setResourceComponentsMap:b,selectedResourceIds:j,setSelectedResourceIds:y,showTree:h,initUrl:p}){var U;const{t:v,locale:w}=Q(),{api:m}=ge(),[k,C]=Pe({}),T=x.useRef({}),$=x.useRef(!1),I=l.id;T.current.projectId=n,T.current.releaseId=I;const L=(R,g,D)=>{if(!g)return;const M=wr(g,D);b==null||b({[R]:Object.keys(M)})},z=R=>{r.current[o.meta.did]={resources:R,component:o},y({[o.meta.did]:R}),L(o.meta.did,k[o.meta.did],R)},q=x.useCallback(async R=>{var g;try{const D=await kn(rn.get,[vn(R,n,I,w,p),{timeout:6e4}],{key:"getResources"});return yn(((g=D==null?void 0:D.data)==null?void 0:g.resources)||[])}catch{return[]}},[n,I,w,p]);x.useEffect(()=>{k[o==null?void 0:o.meta.did]||q(o).then(R=>{C({[o==null?void 0:o.meta.did]:R})}).catch(R=>{B.error(R.message)})},[o,C,k,q]),x.useEffect(()=>{I&&n&&!$.current&&st(t.children.map(R=>async()=>{var g,D;if(!(a&&a!==R.meta.did)&&!(!(R!=null&&R.mountPoint)||!is.hasStartEngine(R==null?void 0:R.meta)||!((D=(g=R==null?void 0:R.meta)==null?void 0:g.resource)!=null&&D.exportApi)))try{const M=await q(R);C({[R==null?void 0:R.meta.did]:M});const O=await m.getSelectedResources({input:{did:t.meta.did,projectId:n,releaseId:I,componentDid:R.meta.did}}),G=(O==null?void 0:O.resources)||[];G!=null&&G.length&&(y({[R.meta.did]:jr(M,G)}),L(R.meta.did,M,G),u||(r.current[R==null?void 0:R.meta.did]={resources:G,component:R}))}catch(M){B.error(M.message)}}),{concurrency:2}).then(()=>{$.current=!0})},[I,n,u,w,p,C]),x.useEffect(()=>{f&&Object.keys(f).length&&st(t.children.map(async R=>{const g=f[R.meta.did];if(g!=null&&g.length){const D=await q(R);y({[R.meta.did]:g}),L(R.meta.did,D,g),u||(r.current[R==null?void 0:R.meta.did]={resources:g,component:R})}}))},[t,f,u]);let Z=null;return(!o||!((U=k[o.meta.did])!=null&&U.length))&&(Z=e.jsx(Me,{Icon:zt,children:v("blocklet.publish.resourceEmptyTip",{name:yo.getDisplayName(o)})})),(o==null?void 0:o.status)!=="running"&&(Z=e.jsx(Me,{children:v("blocklet.publish.componentNotRunning",{name:yo.getDisplayName(o)})})),e.jsxs(e.Fragment,{children:[e.jsx(Cr,{className:At(d&&"error"),children:h&&e.jsx(c,{pb:2,width:"100%",children:Z||e.jsx(Yt,{data:k[o.meta.did]||[],value:j[o.meta.did]||[],onChange:z,disabled:i||u})})}),!!d&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:d})]})}Qt.propTypes={component:s.object.isRequired,app:s.object.isRequired,projectId:s.string.isRequired,error:s.string,saveSelectedEventsRef:s.object.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired,release:s.shape({id:s.string.isRequired,status:s.string}),initialResources:s.object,initUrl:s.object,setResourceComponentsMap:s.func,componentDid:s.string,selectedResourceIds:s.array.isRequired,setSelectedResourceIds:s.func.isRequired,showTree:s.bool.isRequired};Qt.defaultProps={error:"",release:{id:""},initUrl:null,initialResources:{},setResourceComponentsMap:()=>{},componentDid:""};const Cr=ye(c)`
124
+ border: 1px solid;
125
+ border-color: ${({theme:t})=>t.palette.divider};
126
+ max-height: 600px;
127
+ width: 100%;
128
+ &.error {
129
+ border-color: ${({theme:t})=>t.palette.error.main};
130
+ }
131
+ border-radius: 4px;
132
+ padding: 16px;
133
+ padding-bottom: 0px;
134
+ overflow-y: auto;
135
+ .footer {
136
+ border-top: 1px solid #ddd;
137
+ display: flex;
138
+ padding: 12px 0;
139
+ margin-top: 12px;
140
+ position: sticky;
141
+ bottom: 0;
142
+ background: #fff;
143
+ z-index: 10;
144
+ }
145
+ `;var Zt={},Sr=Ce;Object.defineProperty(Zt,"__esModule",{value:!0});var St=Zt.default=void 0,Dr=Sr(De()),Ir=e;St=Zt.default=(0,Dr.default)((0,Ir.jsx)("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator");const Po="lastWantToConnectStoreId";function Tr(t){var u,a;const[o,n]=x.useState(null),{session:l}=Ue(),i=x.useCallback(f=>{n(f),localStorage.setItem(Po,f==null?void 0:f.id)},[n]),d=x.useMemo(()=>{var y,h,p,v;const f=localStorage.getItem(Po),b=f?(((y=t==null?void 0:t.settings)==null?void 0:y.storeList)||[]).find(w=>w.id===f):null;if(b)return b;let j=(((h=t==null?void 0:t.settings)==null?void 0:h.storeList)||[]).find(w=>{var m;return!(w.id!==Y.BLOCKLET_STORE.id||w.scope&&w.scope!=="studio"&&w.scope!==((m=l==null?void 0:l.user)==null?void 0:m.did))});return j||(j=(v=(p=t==null?void 0:t.settings)==null?void 0:p.storeList)==null?void 0:v[0]),j},[(u=t==null?void 0:t.settings)==null?void 0:u.storeList,(a=l==null?void 0:l.user)==null?void 0:a.did]);return[o||d||{},i]}const Rt={};async function Kt(t,{interval:o=1e3,maxDuration:n=120*1e3,intervalFirst:l=4e3,timerKey:i=""}){Rt[i]&&clearTimeout(Rt[i]),await new Promise(u=>setTimeout(u,l));const d=Date.now(),r=async(u,a)=>{try{const f=await t();u(f)}catch(f){Date.now()-d>n?a(f):i?Rt[i]=setTimeout(()=>r(u,a),o):setTimeout(()=>r(u,a),o)}};return new Promise(r)}function $r(){return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)+`${Date.now()}`.slice(-6)}function Pr(t,{did:o,projectId:n,messageId:l}){return Kt(async()=>{var d;const i=await t.getProject({input:{did:o,projectId:n,messageId:l}});if(!((d=i==null?void 0:i.project)!=null&&d.blockletDid))throw new Error("Connected store not found");return i.project.blockletDid},{timerKey:"connect-studio"})}function _r(t,{did:o,projectId:n,storeId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedStores)!=null&&u.length))throw new Error("Connected store not found");if(!i.project.connectedStores.find(a=>a.storeId===l))throw new Error("Connected store not found")},{timerKey:`connect-store-${l}`})}function qr(t,{did:o,projectId:n,endpointId:l}){return Kt(async()=>{var r,u;const i=await t.getProject({input:{did:o,projectId:n,messageId:""}});if(!((u=(r=i==null?void 0:i.project)==null?void 0:r.connectedEndpoints)!=null&&u.length))throw new Error("Connected endpoint not found");if(!i.project.connectedEndpoints.find(a=>a.endpointId===l))throw new Error("Connected endpoint not found")},{timerKey:`connect-store-${l}`})}const Er=({fromBlocklet:t,nodeInfo:o,blocklet:n,userDid:l})=>{var r,u;const i=t?(r=n==null?void 0:n.meta)==null?void 0:r.did:o==null?void 0:o.did;let d=t?((u=n==null?void 0:n.settings)==null?void 0:u.storeList)||[]:(o==null?void 0:o.blockletRegistryList)||[];return Array.isArray(d)||(d=[]),d=d.filter(a=>a.protected||!a.scope||a.scope==="studio"||a.scope===l),{teamDid:i,storeList:d}},eo=Er;function to({blocklet:t,store:o={},onChangeStore:n,onClick:l,disabled:i,loading:d,componentDid:r}){var R,g,D;const{t:u}=Q(),{session:a}=Ue(),{api:f,info:b,inService:j}=ge(),y=Se(),[h,p]=x.useState(!1),v=x.useRef(null),[w,m]=x.useState(!1),[k,C]=x.useState(null),T=M=>{n(M),p(!1)},$=()=>{p(!h)},I=M=>{v.current&&v.current.contains(M.target)||p(!1)},L=()=>{m(!0)},z=()=>{m(!1)},q=async()=>{var M;if(k)try{await f.deleteBlockletStore({input:{teamDid:t.meta.did,url:k.url,projectId:"",scope:k.scope||"studio"}}),await((M=y==null?void 0:y.actions)==null?void 0:M.refreshBlocklet())}catch(O){B.error(`Remove Blocklet Store Error: ${xe(O)}`)}finally{C(null)}},{storeList:Z}=eo({fromBlocklet:j,blocklet:t,nodeInfo:b,componentDid:r,userDid:(R=a==null?void 0:a.user)==null?void 0:R.did}),U=(g=t==null?void 0:t.meta)==null?void 0:g.did;return e.jsxs(e.Fragment,{children:[e.jsxs(tt,{disabled:i,ref:v,variant:"contained",color:"primary","aria-label":"Button group with connect store",children:[e.jsxs(K,{onClick:l,children:[d&&e.jsx(Re,{size:14,sx:{mr:.5}}),`${u("common.connect")} ${o.name||""}`]}),e.jsx(K,{size:"small","aria-controls":h?"split-button-menu":void 0,"aria-expanded":h?"true":void 0,"aria-label":"select merge strategy","aria-haspopup":"menu",onClick:$,children:e.jsx(As,{})})]}),e.jsx(Wo,{sx:{zIndex:10},open:h,anchorEl:v.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:M})=>e.jsx(Bo,{...M,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:I,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[Z==null?void 0:Z.map(O=>{var G;return e.jsxs(fe,{selected:O.id===(o==null?void 0:o.id),sx:{height:56},onClick:()=>T(O),children:[e.jsxs(c,{children:[e.jsx(we,{sx:{fontSize:"16px"},maxLength:24,children:O.name}),e.jsx(we,{sx:{fontSize:"13px",opacity:.6},maxLength:30,children:O.url})]}),Ds({store:O,userDid:(G=a==null?void 0:a.user)==null?void 0:G.did})&&e.jsx(ce,{sx:{ml:1},onClick:S=>{S.preventDefault(),S.stopPropagation(),C(O)},children:e.jsx(ae,{icon:"ic:outline-delete"})})]},O.url)}),e.jsx(Gn,{}),e.jsxs(fe,{onClick:L,children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:u("store.blockletRegistry.addRegistry")})]})]})})})})}),w&&e.jsx(cn,{hiddenChildren:!0,open:!0,onClose:z,teamDid:U,storeList:Z,scope:"studio",onAdd:(D=y==null?void 0:y.actions)==null?void 0:D.refreshBlocklet}),k&&e.jsx(ht,{displayError:!0,title:`${u("common.delete")} ${k.name}`,description:u("blocklet.publish.deleteStoreTip",{name:k.name}),confirm:u("common.confirm"),onConfirm:q,onCancel:()=>C(null)})]})}to.propTypes={store:s.object,blocklet:s.object,onChangeStore:s.func.isRequired,onClick:s.func.isRequired,loading:s.bool.isRequired,disabled:s.bool.isRequired,componentDid:s.string.isRequired,projectType:s.string.isRequired,getData:s.func.isRequired};to.defaultProps={store:null,blocklet:null};const Lr=(t,o,n)=>{const l=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/logo/upload`,i=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${o.meta.did}/${n}/screenshot/upload`,d=t!=null&&t.blockletLogo?`${l}/${t.blockletLogo}`:`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`,r=((t==null?void 0:t.blockletScreenshots)||[]).filter(Boolean).map(u=>`${i}/${u}`);return{logoUrl:d,screenshotUrls:r,uploadLogoPrefix:l,uploadScreenshotPrefix:i}},Rn=Lr,Nr=t=>{const o=t.includes("youtube.com")||t.includes("youtu.be"),n=t.includes("vimeo.com");return o||n};function ft({url:t,style:o,controls:n,modestbranding:l}){var u;const{t:i}=Q(),d=t.includes("youtube.com")||t.includes("youtu.be"),r=t.includes("vimeo.com");if(d){const a=((u=t.split("v=")[1])==null?void 0:u.split("&")[0])||t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:(o==null?void 0:o.pointerEvents)||"auto"},children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${a}?modestbranding=${l}&controls=${n}&rel=0`,title:"YouTube video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}if(r){const a=t.split("/").pop();return e.jsx("div",{style:{position:"relative",width:"100%",paddingTop:"56.25%",pointerEvents:o.pointerEvents||"auto"},children:e.jsx("iframe",{src:`https://player.vimeo.com/video/${a}`,title:"Vimeo video player",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})})}return e.jsx(c,{style:{position:"relative",width:"100%",paddingTop:"56.25%"},children:e.jsxs(c,{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",border:"none",backgroundColor:"rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...o},allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,children:[e.jsx(ae,{icon:"carbon:video-off",style:{fontSize:40,marginBottom:"10px",opacity:.5}}),e.jsx(E,{variant:"body1",sx:{opacity:.5},children:i("studio.videoDialogNoSrc")})]})})}ft.propTypes={url:s.string.isRequired,style:s.object,controls:s.number,modestbranding:s.number};ft.defaultProps={style:{},controls:1,modestbranding:1};function wn({setParams:t,onClose:o,params:n}){const{t:l}=Q(),[i,d]=x.useState(""),r=i&&n.blockletVideos.includes(i),u=Nr(i),a=()=>{t(f=>{const b=[...f.blockletVideos];return b.push(i),{...f,blockletVideos:b}}),o()};return e.jsxs(at,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Vo,{children:l("studio.videoDialogTitle")}),e.jsxs(Fo,{children:[e.jsx(Jn,{fullWidth:!0,value:i,onChange:f=>d(f.target.value),placeholder:l("studio.videoInputLabel"),endAdornment:i?e.jsx(Je,{position:"end",children:e.jsx(ce,{onClick:()=>d(""),children:e.jsx(fs,{})})}):null,error:r}),r&&e.jsx(E,{variant:"body2",color:"error",children:l("studio.duplicateVideo")}),e.jsx(ft,{url:i,style:{marginTop:"20px",borderRadius:"4px"}})]}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:()=>o(),children:l("studio.cancel")}),e.jsx(K,{disabled:!u||r,onClick:a,children:l("studio.confirm")})]})]})}wn.propTypes={onClose:s.func.isRequired,params:s.object.isRequired,setParams:s.func.isRequired};function Dt({errors:t,storeList:o,...n}){const{t:l}=Q();return e.jsxs(c,{...n,color:"warning.main",fontSize:"14px",sx:{border:"1px solid rgba(214, 164, 64, 0.34)",borderRadius:"4px",py:2,px:1.5,position:"relative"},children:[e.jsx(E,{variant:"caption",sx:{fontWeight:"bold",position:"absolute",top:-10,left:12,backgroundColor:"white",px:1,width:"fit-content"},children:l("blocklet.publish.storeRule.warning")}),t&&Object.entries(t).map(([i,d])=>{const r=Object.values(d),u=o.find(a=>a.url===i);return r.length>0&&e.jsxs(c,{children:[e.jsx(je,{title:i,children:e.jsx(c,{component:"span",sx:{cursor:"pointer"},children:u.name})}),r.map(a=>e.jsx(c,{component:"li",ml:2,breakWords:!0,children:a},a))]},i)})]})}Dt.propTypes={errors:s.object.isRequired,storeList:s.array.isRequired};const _o=x.lazy(()=>sn(()=>import("./index-Bdi900W2.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function Cn({projectId:t,readOnly:o,loading:n,blocklet:l,params:i,setParams:d,paramsErrTip:r,setParamsErrTip:u,warning:a,setLoading:f,initUrl:b,initLogoUrl:j,setInitLogoUrl:y,componentDid:h}){const{t:p,locale:v}=Q(),{api:w}=ge(),m=Tt(),k=x.useRef(null),C=x.useRef(null),[T,$]=Tr(l),[I,L]=x.useState(!1),z=an({messageType:"connect-store-message",onOpen:()=>f(!0),onClose:()=>f(!1)}),q=async _=>{const V=setTimeout(()=>{f(!1)},2e4),X=await Pr(w,_);f(!1),clearTimeout(V),window.parent.postMessage({event:"studioDialog.connected",componentDid:h},"*"),m(window.location.pathname.replace(`${Y.UNOWNED_DID}/create`,`${X}/create`),{replace:!0})},Z=()=>{if(!i.blockletTitle){B.error(p("blocklet.publish.errorTip.noTitle"));return}if(!(T!=null&&T.url)){B.error(p("blocklet.publish.noStoreSelected"));return}const _=$r();z(async(V,X)=>{var te,oe,ie;try{const ee=await w.connectByStudio({input:{did:(te=l==null?void 0:l.meta)==null?void 0:te.did,blockletTitle:i==null?void 0:i.blockletTitle,storeUrl:T.url,storeId:T.id,storeName:T.name,type:((oe=i==null?void 0:i.blockletComponents)==null?void 0:oe.length)>0?"pack":"resource",componentDid:h,messageId:_,tenantScope:(b==null?void 0:b.searchParams.get("tenantScope"))||""}});if(!(ee!=null&&ee.url)){B.error("failed to connect to store");return}X(ee.url),q({did:(ie=l==null?void 0:l.meta)==null?void 0:ie.did,projectId:"",messageId:_})}catch(ee){const ue=xe(ee);B.error(ue),f(!1)}})},{logoUrl:U,screenshotUrls:R,uploadLogoPrefix:g,uploadScreenshotPrefix:D}=Rn(i,l,t),{logoErrors:M,screenshotErrors:O,storeList:G,hasLogoWarning:S,hasScreenshotWarning:A}=a,H=()=>o?!1:!t||t===Y.UNOWNED_DID?(B.error(p("blocklet.publish.errorTip.noFirstDid")),!1):!0,J=_=>{if(!_.destination)return;const V=Array.from(i.blockletScreenshots),[X]=V.splice(_.source.index,1);V.splice(_.destination.index,0,X),d(te=>({...te,blockletScreenshots:V}))},Ie=_=>{if(!_.destination)return;const V=Array.from(i.blockletVideos),[X]=V.splice(_.source.index,1);V.splice(_.destination.index,0,X),d(te=>({...te,blockletVideos:V}))};return e.jsxs(Ar,{children:[e.jsx(c,{display:"flex",className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.title")}`,placeholder:`Blocklet ${p("common.title")}`,InputProps:{"data-cy":"blocklet-title",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,required:!0,value:i.blockletTitle||"",onChange:_=>{u({blockletTitle:""}),d({blockletTitle:_.target.value})},error:!!r.blockletTitle,helperText:r.blockletTitle||""}),e.jsx(ne,{required:!0,label:"Blocklet DID",fullWidth:!0,readonly:!0,disabled:!0,autoComplete:"off",variant:"outlined",InputProps:{"data-cy":"export-blocklet-did",endAdornment:t===Y.UNOWNED_DID&&e.jsx(Je,{position:"end",children:e.jsx(to,{blocklet:l,store:T,componentDid:h,onChangeStore:$,disabled:!i.blockletTitle||o||n,loading:n,onClick:Z})})},error:!!r.projectId,helperText:r.projectId||"",value:t===Y.UNOWNED_DID?"":`did:abt:${t}`,sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.description")}`,placeholder:`Blocklet ${p("common.description")}`,InputProps:{"data-cy":"blocklet-description",readOnly:o},required:!0,autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletDescription||"",onChange:_=>{u({blockletDescription:""}),d({blockletDescription:_.target.value})},error:!!r.blockletDescription,helperText:r.blockletDescription||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.homepageTip")}`,placeholder:`Blocklet ${p("common.homepageTip")}`,InputProps:{"data-cy":"blocklet-homepage",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletHomepage||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)?u({blockletHomepage:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletHomepage:""}),d({blockletHomepage:_.target.value})},error:!!r.blockletHomepage,helperText:r.blockletHomepage||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.community")}`,placeholder:`Blocklet ${p("common.community")}`,InputProps:{"data-cy":"blocklet-community",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletCommunity||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)?u({blockletCommunity:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletCommunity:""}),d({blockletCommunity:_.target.value})},error:!!r.blockletCommunity,helperText:r.blockletCommunity||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.support")}`,placeholder:`Blocklet ${p("common.support")}`,InputProps:{"data-cy":"blocklet-support",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletSupport||"",onChange:_=>{_.target.value&&!/^(http|https):\/\//.test(_.target.value)&&!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(_.target.value)?u({blockletSupport:p("blocklet.publish.errorTip.invalidUrlOrEmail")}):u({blockletSupport:""}),d({blockletSupport:_.target.value})},error:!!r.blockletSupport,helperText:r.blockletSupport||"",sx:{mt:3}}),e.jsx(ne,{disabled:n||o,label:`Blocklet ${p("common.repository")}`,placeholder:`Blocklet ${p("common.repository")}`,InputProps:{"data-cy":"blocklet-repository",readOnly:o},autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.blockletRepository||"",onChange:_=>{_.target.value&&!/^(git|https|svn)/.test(_.target.value)?u({blockletRepository:p("blocklet.publish.errorTip.invalidUrl")}):u({blockletRepository:""}),d({blockletRepository:_.target.value})},error:!!r.blockletRepository,helperText:r.blockletRepository||"",sx:{mt:3}})]})}),e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{flex:1,overflow:"hidden",children:[e.jsxs(c,{display:"flex",flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.logo")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.type"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"png, jpg, webp, svg"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"256x256"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<500Kb"})]})})]})]}),e.jsx(c,{sx:{flex:1,cursor:o?"default":"pointer",display:"flex",alignItems:"flex-end"},children:e.jsx($t,{variant:"square",sx:{width:80,height:80},alt:"Blocklet Logo",src:j||U,onClick:()=>{var _;H()&&((_=k.current)==null||_.open())}})})]}),S&&e.jsx(Dt,{errors:M,storeList:G,mt:3}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("common.screenshot")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{sx:{border:"none"},variant:"outlined",size:"small",children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.ratio"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"16 / 9"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~5"})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.size"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"<5MB"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:J,children:e.jsx(wo,{droppableId:"screenshots",direction:"horizontal",isDropDisabled:o,children:(_,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"grey.100":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:_.innerRef,..._.droppableProps,children:[R.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:X}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletScreenshots];return ue.splice(te,1),{...ee,blockletScreenshots:ue}})},children:e.jsx(nt,{})})]})},X)),_.placeholder,R.length<5&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{var X;H()&&((X=C.current)==null||X.open())},children:"+"})]})})})]}),A&&e.jsx(Dt,{errors:O,storeList:G}),e.jsxs(c,{display:"flex",mt:3,flexDirection:"row",flexWrap:"wrap",children:[e.jsxs(ve,{direction:"column",spacing:1,sx:{mr:2,width:"160px"},children:[e.jsx(E,{variant:"subtitle1",sx:{fontWeight:"bold"},children:p("studio.video")}),e.jsxs(ve,{direction:"column",alignItems:"flex-start",spacing:1,sx:{opacity:.8,fontSize:"12px"},children:[e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.videoType"),":"," "]}),e.jsxs(c,{component:"span",sx:{color:"secondary.main"},children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})]})}),e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.count"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:"1~3"})]})}),!o&&e.jsx(c,{children:e.jsxs(c,{component:"span",children:[e.jsxs(c,{component:"span",sx:{color:"text.secondary"},children:[p("studio.order"),":"," "]}),e.jsx(c,{component:"span",sx:{color:"secondary.main"},children:p("studio.orderTip")})]})})]})]}),e.jsx(Ro,{onDragEnd:o?void 0:Ie,children:e.jsx(wo,{droppableId:"videos",direction:"horizontal",isDropDisabled:o,children:(_,V)=>e.jsxs(c,{display:"flex",alignItems:"center",sx:{flex:1,flexWrap:"wrap",minHeight:160,background:V.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:V.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:_.innerRef,..._.droppableProps,children:[i.blockletVideos.map((X,te)=>e.jsx(Co,{draggableId:X,index:te,isDragDisabled:o,children:(oe,ie)=>e.jsxs(c,{ref:oe.innerRef,...oe.draggableProps,className:"screenshot",sx:{transform:ie.isDragging?"scale(1.05)":"none",boxShadow:ie.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx(ft,{url:X,style:{pointerEvents:ie.isDragging?"none":"auto"}}),!o&&e.jsx(ce,{...oe.dragHandleProps,className:"action",style:{right:40,zIndex:10,color:"#fff"},children:e.jsx(St,{})}),!o&&e.jsx(ce,{className:"action",onClick:()=>{d(ee=>{const ue=[...ee.blockletVideos];return ue.splice(te,1),{...ee,blockletVideos:ue}})},children:e.jsx(nt,{})})]})},X)),_.placeholder,i.blockletVideos.length<3&&e.jsx(c,{sx:{width:240,height:135,background:"#eee",cursor:o?"default":"pointer",color:"#999",mb:2},display:"flex",justifyContent:"center",alignItems:"center",fontSize:40,onClick:()=>{H()&&L(!0)},children:"+"})]})})})]})]})}),e.jsxs(x.Suspense,{fallback:e.jsx(Xe,{}),children:[e.jsx(_o,{ref:k,locale:v,popup:!0,onUploadFinish:_=>{var V;d({blockletLogo:_.data.filename}),y(""),(V=k.current)==null||V.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:g,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),I&&e.jsx(wn,{onClose:()=>L(!1),params:i,setParams:d}),e.jsx(_o,{ref:C,locale:v,popup:!0,onUploadFinish:_=>{var V;d(X=>{var oe;const te=X.blockletScreenshots||[];return te.push((oe=_.data)==null?void 0:oe.filename),{...X,blockletScreenshots:te}}),(V=C.current)==null||V.close()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:D,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","image/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-R.length}},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})]})}Cn.propTypes={projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,setLoading:s.func.isRequired,initUrl:s.object.isRequired,componentDid:s.isRequired,initLogoUrl:s.string.isRequired,setInitLogoUrl:s.func.isRequired};const Ar=ye.div`
146
+ margin-top: 24px;
147
+ .screenshot {
148
+ margin-bottom: 16px;
149
+ max-width: 240px;
150
+ max-height: 135px;
151
+ width: 240px;
152
+ height: 135px;
153
+ overflow: hidden;
154
+ display: flex;
155
+ align-items: center;
156
+ justify-content: center;
157
+ background-color: #eee;
158
+ margin-right: 16px;
159
+ position: relative;
160
+ .action {
161
+ visibility: hidden;
162
+ position: absolute;
163
+ width: 42px;
164
+ height: 42px;
165
+ right: 6px;
166
+ top: 6px;
167
+ border-radius: 4px;
168
+ background-color: rgba(0, 0, 0, 1);
169
+ color: rgba(255, 255, 255, 1);
170
+ }
171
+ &:hover .action {
172
+ visibility: visible;
173
+ }
174
+ }
175
+ .screenshot img {
176
+ width: 100%; /* 图像宽度填充容器 */
177
+ height: auto; /* 图像高度自适应 */
178
+ }
179
+ `;var oo={},zr=Ce;Object.defineProperty(oo,"__esModule",{value:!0});var Sn=oo.default=void 0,Or=zr(De()),Wr=e;Sn=oo.default=(0,Or.default)((0,Wr.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l4.65-4.65c.2-.2.51-.2.71 0L17 13z"}),"CloudUploadRounded");const Br=(t,o,n,l)=>{const i=t?[...t]:[],d=((o==null?void 0:o.children)||[]).reduce((r,u)=>(r[u.meta.did]=!0,r),{});return Object.keys(n).forEach(r=>{if(!d[r])return;let u=!1;l||i.forEach(a=>{a.did===r&&(a.included=!0,a.required=!0,u=!0)}),u||i.push({did:r,included:!0,required:!0})}),i},Mr=async t=>{if(typeof t!="string")throw new Error("URL must be a string");try{const o=t.split("/").pop().split("?")[0],l=await(await fetch(t)).blob();return new File([l],o,{type:l.type})}catch{throw new Error("Failed to convert Logo URL to file")}};function*Ur(t,o){let n=0;for(;n<t.size;)yield t.slice(n,n+o),n+=o}const Vr=async({did:t,projectId:o,uploadType:n="logo",imageUrl:l})=>{const i=await Mr(l);new FormData().append("file",i);const r={uploaderId:"Uploader",relativePath:encodeURIComponent(i.name),name:encodeURIComponent(i.name),type:i.type},a=(await vo.post(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/project",t,o,n,"upload"),null,{headers:{"Tus-Resumable":"1.0.0","Upload-Length":i.size,"X-Uploader-File-Ext":i.name.split(".").pop(),"Upload-Metadata":Object.keys(r).map(y=>`${y} ${btoa(r[y])}`).join(",")}})).headers.location,f=2*1024*1024;let b=0,j="";for(const y of Ur(i,f)){const h=await vo.patch(de(Y.WELLKNOWN_SERVICE_PATH_PREFIX,a),y,{headers:{"Tus-Resumable":"1.0.0","Upload-Offset":b,"Content-Type":"application/offset+octet-stream"}});b+=y.size,j=h.data.filename}return j},Dn=({params:t,projectId:o,status:n,t:l})=>{const i=[];return t.blockletTitle||i.push({param:"blockletTitle",message:l("blocklet.publish.errorTip.noTitle")}),(!o||o===Y.UNOWNED_DID)&&i.push({param:"projectId",message:l("blocklet.publish.errorTip.noDid")}),t.blockletVersion?We.valid(t.blockletVersion)||i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.inValidVersion")}):i.push({param:"blockletVersion",message:l("blocklet.publish.errorTip.noVersion")}),n===he.PROJECT.RELEASE_STATUS.published&&(t.blockletDescription||i.push({param:"blockletDescription",message:l("blocklet.publish.errorTip.noDescription")}),t.note||i.push({param:"note",message:l("blocklet.publish.errorTip.noNote")})),i.length?i:null},Fr=({params:t,step:o,t:n,projectId:l})=>{if(o===0){if(!t.blockletTitle)return n("blocklet.publish.errorTip.noTitle");if(!l||l===Y.UNOWNED_DID)return n("blocklet.publish.errorTip.noDid");if(!t.blockletDescription)return n("blocklet.publish.errorTip.noDescription")}if(o>=4){if(!t.blockletVersion)return n("blocklet.publish.errorTip.noVersion");if(!We.valid(t.blockletVersion))return n("blocklet.publish.errorTip.inValidVersion");if(!t.note)return n("blocklet.publish.errorTip.noNote")}return""};function no({blocklet:t,releaseId:o,connectedStores:n,projectId:l,releaseType:i,publishedStoreIds:d,onPublish:r,onDelete:u,warning:a,projectType:f,componentDid:b,onOpenConnectStore:j,behavior:y,onSelectConnectStore:h}){var $,I;const{t:p}=Q(),{actions:{refreshBlocklet:v}}=Se(),{session:w}=Ue(),{storeList:m}=eo({fromBlocklet:!0,blocklet:t,componentDid:b,userDid:($=w==null?void 0:w.user)==null?void 0:$.did}),k=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((L,z)=>(L[z.storeId]=z,L),{}):{},[n]),C=(I=t==null?void 0:t.meta)==null?void 0:I.did,T={};return Object.entries((a==null?void 0:a.logoErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=q)}),Object.entries((a==null?void 0:a.screenshotErrors)||{}).forEach(([L,z])=>{const q=Object.values(z);q.length>0&&(T[L]=T[L]?[...T[L],...q]:q)}),e.jsxs(e.Fragment,{children:[y==="connect"&&!!(m!=null&&m.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsxs(c,{color:Go[400],component:"a",href:f==="pack"?"https://www.arcblock.io/docs/blocklet-developer/en/5PXToZve-5IXAN1bc8rkpxAc":"https://www.arcblock.io/docs/blocklet-developer/en/hB5VWLfg9VnbWsL1JGLuLUfW",target:"_blank",display:"flex",alignItems:"center",rel:"noreferrer",children:[p(f==="pack"?"blocklet.publish.whyCantSeeInStore":"blocklet.publish.whyCantSeeResourceBlockletInStore"),e.jsx(un,{sx:{marginLeft:1}})]})}),e.jsx(Jo,{children:m==null?void 0:m.map(L=>e.jsx(_t,{"data-cy":"store-switch",children:e.jsx(Xo,{children:e.jsx(Is,{behavior:y,onSelectConnectStore:h,releaseId:o,projectId:l,releaseType:i,kind:"publish",teamDid:C,warningList:T[L.url],store:L,published:(d==null?void 0:d.indexOf(L.id))>-1,connectedStore:k[L.id],onPublish:r,onDelete:u,scope:L.scope||"studio",onOpenConnectStore:j})})},L.url))}),e.jsx(cn,{teamDid:C,storeList:m,scope:"studio",onAdd:v})]})}no.propTypes={blocklet:s.object.isRequired,projectId:s.string.isRequired,releaseId:s.string.isRequired,releaseType:s.string.isRequired,onPublish:s.func,onDelete:s.func,publishedStoreIds:s.arrayOf(s.string),connectedStores:s.arrayOf(s.object).isRequired,projectType:s.string,componentDid:s.string,warning:s.object,onOpenConnectStore:s.func,onSelectConnectStore:s.func,behavior:s.string};no.defaultProps={projectType:"",componentDid:"",publishedStoreIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectStore:()=>{},onSelectConnectStore:()=>{},behavior:"connect"};const Hr=Yo(t=>({addMenuItemRoot:{marginTop:"8px",justifyContent:"center",color:t.palette.primary.main,lineHeight:"3.2"}}));function so({disabled:t,endpointList:o,teamDid:n,onAdd:l,hiddenChildren:i,open:d,onClose:r}){const{api:u}=ge(),[a,f]=x.useState(!1),[b,j]=x.useState(!0),[y,h]=x.useState(!1),[p,v]=x.useState(""),[w,m]=x.useState(""),{t:k}=Q(),C=Hr(),T=()=>{v(""),h(!1),r()},$=async()=>{f(!0);try{const{decoded:I}=cs(p,o);await u.addUploadEndpoint({input:{teamDid:n,url:I}}),l(I),T()}catch(I){const L=`${k("blocklet.publish.endpoint.addFailed")} ${xe(I)}`;m(L)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[!i&&e.jsxs(_t,{button:!0,disabled:t,className:C.addMenuItemRoot,onClick:()=>{h(!0)},children:[e.jsx(pt,{font:!0}),e.jsx(E,{variant:"inherit",children:k("blocklet.publish.endpoint.addEndpoint")})]}),e.jsxs(ut,{title:k("blocklet.publish.endpoint.addEndpoint"),fullWidth:!0,maxWidth:"md",open:d||y,onClose:T,PaperProps:{style:{minHeight:"auto"}},actions:e.jsxs(e.Fragment,{children:[e.jsx(qe,{onClick:I=>{I.stopPropagation(),T()},color:"inherit",children:k("common.cancel")}),e.jsxs(qe,{onClick:I=>{I.stopPropagation(),$()},color:"primary","data-cy":"install-blocklet-next-step",disabled:a||!p||b,variant:"contained",autoFocus:!0,children:[a&&e.jsx(Re,{size:16}),k("common.confirm")]})]}),children:[e.jsx("div",{style:{paddingTop:12,overflowY:"hidden"},children:e.jsx(Xn,{component:"div",children:e.jsx(E,{component:"div",children:e.jsx(ne,{label:k("blocklet.publish.endpoint.addEndpoint"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"add-blocklet-endpoint-url",fullWidth:!0,value:p,onChange:I=>{m(null);let L=!1;I.target.value.trim()||(L=!0),I.target.value.trim()||m(k("blocklet.publish.endpoint.urlEmpty")),v(I.target.value),j(L)},disabled:a,onKeyPress:I=>{I.key==="Enter"&&(I.preventDefault(),I.target.value.trim()?$():m(k("blocklet.publish.endpoint.urlEmpty")))}})})})}),!!w&&e.jsx(dt,{severity:"error",style:{width:"100%"},children:w})]})]})}so.propTypes={teamDid:s.string.isRequired,disabled:s.bool,endpointList:s.array,onAdd:s.func,hiddenChildren:s.bool,open:s.bool,onClose:s.func};so.defaultProps={disabled:!1,endpointList:[],onAdd:()=>{},hiddenChildren:!1,open:!1,onClose:()=>{}};function ro({endpoint:t,teamDid:o,onDelete:n,projectId:l="",children:i}){const{api:d}=ge(),{t:r}=Q(),u=Qo(),a=Se(),[f,b]=x.useState(!1),[j,y]=x.useState(null),h=()=>{b(!1),y(null)},p=async()=>{var m;try{b(!0),await d.deleteUploadEndpoint({input:{teamDid:o,did:t.id,projectId:l}}),await((m=a==null?void 0:a.actions)==null?void 0:m.refreshBlocklet()),n==null||n()}catch(k){B.error(`${r("blocklet.publish.endpoint.deleteFailed")}: ${xe(k)}`)}finally{b(!1),y(null)}},v={keyName:t.url,title:r("blocklet.publish.endpoint.deleteEndpoint"),description:r("blocklet.publish.endpoint.deleteDesc",{name:`<b>${t.url}</b>`,color:u.palette.error.main}),confirmPlaceholder:r("blocklet.publish.endpoint.confirmDesc",{name:t.url}),confirm:r("common.delConfirm"),cancel:r("common.cancel"),onConfirm:p,onCancel:h},w=m=>{t.protected||(m.stopPropagation(),y(v))};return e.jsxs(e.Fragment,{children:[i?e.jsx(c,{component:"span",onClick:w,children:i}):e.jsx(K,{"data-cy":"endpoint-action-delete",color:"primary",disabled:f,onClick:w,size:"small",children:e.jsx(nt,{sx:{zoom:.95}})}),j?e.jsx(zs,{keyName:j.keyName,title:j.title,description:j.description,confirmPlaceholder:j.confirmPlaceholder,confirm:j.confirm,cancel:j.cancel,params:j.params,onConfirm:j.onConfirm,onCancel:j.onCancel}):null]})}ro.propTypes={endpoint:s.object.isRequired,teamDid:s.string.isRequired,onDelete:s.func,projectId:s.string,children:s.node};ro.defaultProps={onDelete:"",projectId:"",children:null};function lo({connectedEndpoint:t,onDisconnect:o,onDelete:n,endpoint:l,teamDid:i,projectId:d}){const[r,u]=x.useState(null),a=!!r,{t:f}=Q(),[b,j]=x.useState(!1),y=m=>{m.stopPropagation(),window.open(hn(`${de(l.url)}`,{allowDomains:null}))},h=m=>{u(m.currentTarget)},p=()=>{u(null)},v=()=>{j(!1),o()},w=[{label:f("blocklet.publish.endpoint.visitEndpoint"),action:y,icon:un},{label:f("common.disconnect"),action:()=>{p(),j(!0)},icon:Ts,hidden:!t}];return e.jsxs(e.Fragment,{children:[e.jsx(K,{ref:r,color:"primary",onClick:h,size:"small",children:e.jsx(ms,{sx:{zoom:.95}})}),e.jsxs(Yn,{anchorEl:r,open:a,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[w.map(m=>m.hidden?null:e.jsxs(fe,{dense:!0,onClick:m.action,disabled:m.disabled,children:[m.icon&&e.jsx(m.icon,{color:"action",sx:{marginRight:1}}),e.jsx(c,{color:"action",children:m.label})]},m.label)),e.jsx(ro,{endpoint:l,teamDid:i,onDelete:n,projectId:d,children:e.jsxs(fe,{dense:!0,disabled:l.protected,children:[e.jsx(nt,{sx:{color:l.protected?"action":"error.main",marginRight:1}}),e.jsx(c,{color:l.protected?"action":"error.main",children:f("common.delete")})]})})]}),b&&e.jsx(ht,{displayError:!0,title:`${f("common.disconnect")} ${l.appName}`,description:f("blocklet.publish.endpoint.disconnectEndpointTip",{url:l.url}),confirm:f("common.confirm"),onConfirm:v,onCancel:()=>j(!1)})]})}lo.propTypes={connectedEndpoint:s.object.isRequired,onDisconnect:s.func,onDelete:s.func,endpoint:s.object.isRequired,teamDid:s.string.isRequired,projectId:s.string};lo.defaultProps={projectId:"",onDelete:()=>{},onDisconnect:()=>{}};function rt({developerUrl:t,developerDid:o,sx:n,...l}){return e.jsx($t,{sx:{width:24,height:24,...n},src:de(new URL(t).origin,`/.well-known/service/user/avatar/${o}?imageFilter=resize&w=120&h=120`),...l})}rt.propTypes={developerDid:s.string.isRequired,developerUrl:s.string.isRequired,sx:s.object};rt.defaultProps={sx:{}};function io({endpoint:t,published:o}){const{t:n}=Q(),l=()=>{window.open(hn(`${de(t.url)}`,{allowDomains:null}))};return e.jsxs(c,{children:[e.jsx(E,{variant:"subtitle2",children:n(o?"blocklet.publish.endpoint.publishToEndpointSuccess":"blocklet.publish.endpoint.uploadToEndpointSuccess",{name:t.appName})}),e.jsx(K,{size:"small",sx:{mt:1},onClick:l,variant:"contained",color:"success",children:n("common.visitTarget",{name:t.appName})})]})}io.propTypes={endpoint:s.object.isRequired,published:s.bool.isRequired};io.defaultProps={};const Gr=Yo(()=>({buttonText:{textTransform:"none !important"},iconRoot:{minWidth:24},box:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",overflow:"hidden",width:"100%"},menuName:{flexShrink:1,display:"flex",flexDirection:"column",overflow:"hidden",flex:1},actions:{flex:1,display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},title:{fontSize:16,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},url:{fontSize:14,opacity:.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},buttonLine:{height:"100%",width:"1px",backgroundColor:"#e0e0e0"}})),qo=Qn(({className:t,...o})=>e.jsx(je,{...o,classes:{popper:t}}))(({theme:t})=>({[`& .${Zn.tooltip}`]:{backgroundColor:"#fff",color:"rgba(0, 0, 0, 0.87)",borderRadius:8,padding:t.spacing(2),fontSize:t.typography.pxToRem(12),border:"1px solid rgba(0,0,0,0.08)",boxShadow:"0px 4px 8px rgba(0, 0, 0, 0.05)"}}));function co({teamDid:t,projectId:o,releaseId:n,endpoint:l,warningList:i,onDelete:d,published:r,onPublish:u,connectedEndpoint:a,onOpenConnectEndpoint:f}){const b=Gr(),{t:j}=Q(),{api:y}=ge(),[h,p]=x.useState(!1),v=an({messageType:"connect-endpoint-message",onOpen:()=>p(!0),onClose:()=>p(!1)}),w=!!a,m=()=>{v(async(I,L)=>{try{const z=await y.connectToEndpoint({input:{did:t,endpointId:l.id,projectId:o}});if(!(z!=null&&z.url)){B.error("failed to connect to endpoint");return}L(z.url),await f({did:t,projectId:o,endpointId:l.id}),p(!1)}catch(z){const q=xe(z);B.error(q),p(!1)}})},k=async()=>{try{await y.disconnectFromEndpoint({input:{did:t,endpointId:l.id,projectId:o}}),d()}catch(I){B.error(xe(I))}},C=()=>{p(!0),y.publishToEndpoint({input:{did:t,endpointId:l.id,projectId:o,releaseId:n}}).then(()=>{B.success(e.jsx(io,{endpoint:l,published:!0}),{duration:1e4}),u==null||u(null)}).catch(I=>{B.error(xe(I)),u==null||u(I)}).finally(()=>{p(!1)})};x.useEffect(()=>{w&&p(!1)},[w]);const T=i.length>0,$=e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130,height:"100%"},disabled:T,onClick:C,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx($s,{sx:{marginRight:1,fontSize:20}}),j("common.upload")]});return e.jsxs(c,{className:b.box,children:[e.jsxs(c,{className:b.menuName,children:[e.jsx(c,{sx:{display:"flex",flexDirection:"row"},children:e.jsx(E,{component:"span",className:b.title,variant:"subtitle1",children:l.appName})}),e.jsx(E,{className:b.url,component:"span",variant:"inherit",children:`${l.url}`})]}),e.jsxs(c,{className:b.actions,children:[a&&e.jsx(qo,{placement:"top",title:e.jsxs(c,{children:[e.jsx(E,{component:"span",variant:"caption",sx:{opacity:.7},children:j("blocklet.publish.developerInfo")}),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:1,mt:1},children:[e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{width:42,height:42}}),e.jsxs(c,{sx:{flex:1},children:[e.jsx(E,{component:"span",variant:"subtitle1",children:a.developerName}),e.jsx(Ct,{size:14,copyable:!0,compact:!0,responsive:!1,did:a.developerDid})]})]})]}),children:e.jsx(c,{children:e.jsx(rt,{developerUrl:l.url,developerDid:a.developerDid,sx:{marginRight:1,cursor:"help"}})})}),e.jsxs(tt,{disabled:h,variant:"outlined",sx:{height:38},size:"small",children:[!w&&e.jsxs(K,{sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},onClick:m,children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(Ps,{sx:{marginRight:1}}),j("common.connect")]}),w&&r&&e.jsxs(K,{disabled:!0,sx:{paddingLeft:2,paddingRight:2,fontSize:15,width:130},children:[h?e.jsx(Re,{sx:{marginRight:1},size:16}):e.jsx(pn,{sx:{marginRight:1}}),j("common.uploaded")]}),w&&!r&&(T?e.jsx(qo,{title:e.jsxs(c,{children:[e.jsx(c,{sx:{color:"error.main",mb:.5},children:j("blocklet.publish.storeRule.warning")}),i.map((I,L)=>e.jsxs(c,{sx:{color:"error.main"},children:[L+1,". ",I]},I))]}),children:e.jsx("div",{children:$})}):$),e.jsx(lo,{projectId:o,endpoint:l,teamDid:t,connectedEndpoint:a,onDisconnect:k,onDelete:d})]})]})]})}co.propTypes={teamDid:s.string.isRequired,published:s.bool,connectedEndpoint:s.shape({endpointId:s.string,accessKeyId:s.string,accessKeySecret:s.string,createdBy:s.string,developerDid:s.string,developerName:s.string,developerEmail:s.string}),warningList:s.array,projectId:s.string,releaseId:s.string,endpoint:s.shape({id:s.string.isRequired,appName:s.string,url:s.string.isRequired,endpoint:s.string.isRequired,protected:s.bool,connected:s.bool}).isRequired,onDelete:s.func,onOpenConnectEndpoint:s.func,onPublish:s.func};co.defaultProps={published:!1,connectedEndpoint:null,projectId:"",warningList:[],releaseId:"",onDelete:()=>{},onOpenConnectEndpoint:()=>{},onPublish:()=>{}};function ao({releaseId:t,blocklet:o,connectedEndpoints:n,projectId:l,publishedEndpointIds:i,onPublish:d,onDelete:r,warning:u,onOpenConnectEndpoint:a}){var w,m;const{actions:{refreshBlocklet:f}}=Se(),{session:b}=Ue(),{t:j}=Q(),y=(((w=o==null?void 0:o.settings)==null?void 0:w.endpointList)||[]).filter(k=>{var C;return k.scope===((C=b==null?void 0:b.user)==null?void 0:C.did)}),h=x.useMemo(()=>n!=null&&n.length?n==null?void 0:n.reduce((k,C)=>(k[C.endpointId]=C,k),{}):{},[n]),p=(m=o==null?void 0:o.meta)==null?void 0:m.did,v={};return Object.entries((u==null?void 0:u.logoErrors)||{}).forEach(([k,C])=>{const T=Object.values(C);T.length>0&&(v[k]=T)}),Object.entries((u==null?void 0:u.screenshotErrors)||{}).forEach(([k,C])=>{const T=Object.values(C);T.length>0&&(v[k]=v[k]?[...v[k],...T]:T)}),e.jsxs(e.Fragment,{children:[!!(y!=null&&y.length)&&e.jsx(dt,{severity:"info",style:{width:"100%"},children:e.jsx(c,{color:Go[400],children:j("blocklet.publish.endpoint.uploadToEndpoint")})}),e.jsx(Jo,{sx:{flex:1},children:y==null?void 0:y.map(k=>e.jsx(_t,{"data-cy":"endpoint-switch",children:e.jsx(Xo,{children:e.jsx(co,{releaseId:t,projectId:l,teamDid:p,warningList:v[k.url],endpoint:k,published:(i==null?void 0:i.indexOf(k.id))>-1,connectedEndpoint:h[k.id],onPublish:d,onDelete:r,onOpenConnectEndpoint:a})})},k.url))}),e.jsx(so,{teamDid:p,endpointList:y,onAdd:f})]})}ao.propTypes={releaseId:s.string.isRequired,blocklet:s.object.isRequired,projectId:s.string.isRequired,warning:s.object,onPublish:s.func,onOpenConnectEndpoint:s.func,onDelete:s.func,connectedEndpoints:s.arrayOf(s.object).isRequired,publishedEndpointIds:s.arrayOf(s.string)};ao.defaultProps={publishedEndpointIds:[],onPublish:()=>{},onDelete:()=>{},warning:{},onOpenConnectEndpoint:()=>{}};function In({did:t,params:o,setParams:n,projectId:l,open:i,onClose:d}){const{t:r}=Q(),[u,a]=x.useState(!1),{api:f}=ge(),[b,j]=x.useState(!1),[y,h]=x.useState(!1),p=()=>{j(o.autoUpload),h(o.possibleSameStore),a(!1),d(!1)},v=async()=>{a(!0);try{await f.updateProject({input:{did:t,projectId:l,blockletTitle:o.blockletTitle||"",blockletDescription:o.blockletDescription||"",blockletIntroduction:o.blockletIntroduction||"",autoUpload:!!b,possibleSameStore:!!y}}),n({autoUpload:b,possibleSameStore:y}),d(!1)}catch(m){B.error(m.message)}a(!1)};x.useEffect(()=>{j(o.autoUpload),h(o.possibleSameStore)},[o]);const w=!!(l&&l!==Y.UNOWNED_DID);return e.jsx(ut,{title:r("blocklet.publish.projectSettings"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:i,onClose:p,actions:e.jsxs(e.Fragment,{children:[e.jsx(K,{onClick:m=>{m.stopPropagation(),d()},color:"inherit",children:r("common.cancel")}),w&&e.jsxs(K,{onClick:m=>{m.stopPropagation(),v()},color:"primary","data-cy":"install-blocklet-next-step",disabled:u,variant:"contained",autoFocus:!0,children:[u&&e.jsx(Re,{size:16}),r("common.confirm")]})]}),children:w?e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:upload",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.autoUploadTip")}),e.jsx(_e,{checked:b,onChange:(m,k)=>j(k)})]}),e.jsxs(c,{component:"label",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"fluent-mdl2:merge-duplicate",sx:{fontSize:24,mr:2}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.possibleSameStoreTip")}),e.jsx(_e,{checked:y,onChange:(m,k)=>h(k)})]})]}):e.jsxs(c,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[e.jsx(c,{component:ae,icon:"ph:empty",sx:{fontSize:40,mb:3,opacity:.6}}),e.jsx(E,{variant:"body1",sx:{flex:1},children:r("blocklet.publish.needProjectId")})]})})}In.propTypes={did:s.string.isRequired,params:s.object.isRequired,open:s.bool.isRequired,onClose:s.func.isRequired,setParams:s.func.isRequired,projectId:s.string.isRequired};function Tn({downloadUrl:t,installUrl:o,handleSetTip:n,isPack:l,disabled:i}){const{t:d}=Q(),[r,u]=x.useState(!1),a=x.useRef(null),f=()=>{u(!r)},b=j=>{a.current&&a.current.contains(j.target)||u(!1)};return e.jsxs(e.Fragment,{children:[e.jsx(K,{disabled:i,ref:a,onClick:f,children:e.jsx(c,{component:ae,sx:{fontSize:18},icon:"bxs:download"})}),e.jsx(Wo,{sx:{zIndex:10},open:r,anchorEl:a.current,placement:"bottom-end",role:void 0,transition:!0,disablePortal:!0,children:({TransitionProps:j})=>e.jsx(Bo,{...j,style:{transformOrigin:"center top"},children:e.jsx(Pt,{children:e.jsx(Mo,{onClickAway:b,children:e.jsxs(Uo,{id:"split-button-menu",autoFocusItem:!0,sx:{maxHeight:300,overflowY:"auto",zIndex:10},children:[l&&e.jsx(c,{component:"a",href:o,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ic:round-install-desktop"}),e.jsx(E,{variant:"inherit",children:d("blocklet.publish.installToThisServer")})]})}),e.jsxs(fe,{onClick:n,children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"iconamoon:copy"}),e.jsx(E,{variant:"inherit",children:d("blocklet.publish.copyInstallUrl")})]}),e.jsx(c,{component:"a",href:t,target:"_blank",rel:"noreferrer",sx:{textDecoration:"none"},children:e.jsxs(fe,{sx:{color:"#333"},children:[e.jsx(c,{component:ae,sx:{mr:1},icon:"ph:download"}),e.jsx(E,{variant:"inherit",children:d("common.download")})]})})]})})})})})]})}Tn.propTypes={disabled:s.bool.isRequired,isPack:s.bool.isRequired,downloadUrl:s.string.isRequired,installUrl:s.string.isRequired,handleSetTip:s.func.isRequired};var zo;const Eo=(zo=window.env)==null?void 0:zo.serverEndpoint;function $n({projectId:t,params:o,setParamsErrTip:n,initUrl:l,setParams:i,mode:d,loading:r,blocklet:u,release:a,isPublished:f,releaseId:b,getData:j,getRelease:y,paramsErrTip:h,warning:p,componentDid:v,resourceRelateComponents:w,disabledSelectComponents:m,saveSelectedEventsRef:k,hasSelectedResources:C,initLogoUrl:T,setLoading:$,releaseUsedLast:I,setReleaseUsedLast:L,projectType:z}){var Ee;const{t:q,locale:Z}=Q(),U=[{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.store")}),value:"store"},{label:e.jsx(c,{textAlign:"center",width:"100%",children:q("blocklet.publish.endpoint.tab")}),value:"endpoint"}],[R,g]=x.useState(U[0].value),{api:D}=ge(),M=Tt(),[O,G]=x.useState(!1),[S,A]=x.useState(!1),[H,J]=x.useState(),Ie=Be(se=>se.breakpoints.down("md")),_=x.useMemo(()=>{var se;return o!=null&&o.blockletResourceType?o==null?void 0:o.blockletResourceType:((se=o==null?void 0:o.blockletComponents)==null?void 0:se.length)>0?(o==null?void 0:o.blockletComponents.find(W=>W.included))?"resource":"pack":"resource"},[o==null?void 0:o.blockletComponents,o==null?void 0:o.blockletResourceType]),V=()=>{window.parent.postMessage({event:"studioDialog.uploaded",componentDid:v},"*"),y()},X=async se=>{var Ae,Fe,ze,Qe;if(h!=null&&h.blockletHomepage||h!=null&&h.blockletSupport||h!=null&&h.blockletCommunity){B.error((h==null?void 0:h.blockletHomepage)||(h==null?void 0:h.blockletSupport)||(h==null?void 0:h.blockletCommunity));return}const Le=Dn({params:o,hasSelectedResources:C,projectId:t,status:se,t:q});if(Le){B.error(Le.map(F=>F.message).join("; ")),n(Le.reduce((F,re)=>({...F,[re.param]:re.message}),{}));return}const W={...o};if(W.blockletComponents=Br(W.blockletComponents,u,w,m),W.blockletVersion=We.valid(W.blockletVersion),!W.blockletVersion){B.error("Invalid Blocklet Version"),n({blockletVersion:"Invalid Blocklet Version"});return}if(T)try{const F=await Vr({did:u.meta.did,projectId:t,imageUrl:T});W.blockletLogo=F,i({blockletLogo:F})}catch(F){B.error(F.message);return}if(o.resourceFromSelect){W.uploadedResource="";try{const F=Object.keys(k.current);await st(F.map(re=>()=>{const He=k.current[re];return Rr({api:D,locale:Z,projectId:t,releaseId:I?"":b,appDid:u.meta.did,component:He.component,resources:He.resources,initUrl:l})}),{concurrency:2})}catch(F){B.error(((ze=(Fe=(Ae=F==null?void 0:F.response)==null?void 0:Ae.data)==null?void 0:Fe.error)==null?void 0:ze.message)||F.message),n({blockletResource:"Invalid save the resource"});return}}else(Qe=o.blockletDocker)!=null&&Qe.dockerImage||(W.blockletComponents=[]);W.blockletTitle=(W.blockletTitle||"").trim(),W.blockletDescription=(W.blockletDescription||"").trim(),W.blockletSupport=(W.blockletSupport||"").trim(),W.blockletHomepage=(W.blockletHomepage||"").trim(),W.blockletCommunity=(W.blockletCommunity||"").trim(),W.blockletRepository=(W.blockletRepository||"").trim(),W.blockletIntroduction=(W.blockletIntroduction||"").trim(),W.note=(W.note||"").trim(),W.blockletComponents=((W==null?void 0:W.blockletComponents)||[]).filter(F=>F.included).map(F=>Nt(F,["did","required"])).map(JSON.stringify),W.contentType!=="docker"&&(W.blockletDocker={dockerImage:"",dockerCommand:"",dockerArgs:[],dockerEnvs:[]}),W.blockletDocker.dockerImage=W.blockletDocker.dockerImage||"",W.blockletDocker.dockerArgs.length>0&&W.blockletDocker.dockerArgs.forEach(F=>{F.proxyBehavior=F.proxyBehavior||"service"});try{await D.createRelease({input:{...W,note:JSON.stringify({note:W.note}),did:u.meta.did,projectId:t,releaseId:I?"":b,status:se}}),se==="draft"?B.success(q("blocklet.publish.saveDraftSuccess")):(L(!1),B.success(q("blocklet.publish.createReleaseSuccess")),window.parent.postMessage({event:"studioDialog.released",componentDid:v},"*")),n({blockletResource:"",blockletTitle:"",blockletDescription:"",blockletVersion:"",blockletLogo:"",projectId:"",blockletIntroduction:"",note:""})}catch(F){const re=xe(F);B.error(re),(/resource/.test(re)||/zip/.test(re))&&n({blockletResource:re});return}const le=await D.getProject({input:{did:u.meta.did,projectId:t}}),Ne=le.project.lastReleaseId;o.autoUpload&&await st(le.project.connectedStores.map(F=>async()=>{try{const re=await D.publishToStore({input:{did:u.meta.did,storeId:F.storeId,storeName:F.storeName,projectId:t,releaseId:Ne,type:_}});B.success(e.jsx(_s,{storeName:F.storeName,storeUrl:F.storeUrl,developerDid:F.developerDid,did:u.meta.did,published:re.url==="published"}),{duration:1e4})}catch(re){B.error(xe(re))}}),{concurrency:4}),V==null||V(),M(`../${t}/view/${Ne}`,{replace:!0})},te=se=>($(!0),X(se).finally(()=>{$(!1)})),oe=async se=>{await _r(D,se),j()},ie=async se=>{await qr(D,se),j()},ee=()=>{A(!0)},ue=de(Eo,`/api/project/${u.meta.did}/${t}/${b}/release/blocklet.json`),pe=new URL(Eo);pe.pathname=de(pe.pathname,"/launch-blocklet/agreement"),pe.searchParams.set("blocklet_meta_url",ue);const Ye=pe.href,Ve=()=>J(ue);return e.jsxs(e.Fragment,{children:[e.jsx(Jr,{className:"sticky-header",children:e.jsx(Lt,{left:e.jsxs(Oo,{className:"breadcrumbs","aria-label":"breadcrumb",children:[e.jsx(ke,{to:"../",children:q("common.blockletStudio")}),t===Y.UNOWNED_DID?e.jsx(E,{color:"text.primary",children:e.jsx(we,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}):e.jsx(ke,{to:`../${t}`,children:e.jsx(we,{maxLength:Ie?6:30,children:(o==null?void 0:o.blockletTitle)||"Blocklet"})}),e.jsx(E,{color:"text.primary",children:d==="create"?q("common.create"):(o==null?void 0:o.blockletVersion)||q("common.edit")})]}),actions:e.jsxs(e.Fragment,{children:[!f&&e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{variant:"contained",onClick:()=>te(he.PROJECT.RELEASE_STATUS.published),children:[r&&e.jsx(Re,{size:14,sx:{mr:.5},color:"inherit"}),q("blocklet.publish.createRelease")]}),e.jsx(K,{variant:"contained",onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx(at,{fullWidth:!0,maxWidth:"sm",open:H,onClose:()=>J(""),children:e.jsxs(c,{sx:{py:5,px:4,wordBreak:"break-all"},children:[e.jsx(E,{variant:"h6",sx:{mb:2},children:q("blocklet.publish.installResourceTip")}),e.jsx(ln,{children:H}),e.jsxs(E,{sx:{mt:2},children:[q("blocklet.publish.installResourceTip2"),e.jsx("a",{style:{marginLeft:4},href:"https://www.arcblock.io/docs/blocklet-developer/how-to-use-install-url",target:"_blank",rel:"noreferrer",children:q("blocklet.publish.installResourceHelp")})]})]})}),e.jsxs(tt,{disabled:r,variant:"contained",children:[e.jsxs(K,{onClick:()=>G(!0),children:[r?e.jsx(Re,{size:14,sx:{mr:1},color:"inherit"}):e.jsx(Sn,{sx:{fontSize:"1.3em",mr:1}}),q(Ie?"common.upload":"blocklet.publish.connectOrUpload")]}),e.jsx(Tn,{isPack:_==="pack",downloadUrl:de(`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${u.meta.did}/${t}/${b}/download/${(a.files||[])[0]}`),installUrl:Ye,handleSetTip:Ve}),e.jsx(K,{onClick:ee,children:e.jsx(ae,{icon:"mage:settings-fill",fontSize:"16px"})})]})]})]})})}),e.jsx(ut,{title:q("blocklet.publish.connectOrUpload"),disableEscapeKeyDown:!0,disablePortal:!1,fullWidth:!0,open:O,onClose:()=>G(!1),children:e.jsxs(c,{children:[e.jsx(c,{mt:-2,mb:2,children:e.jsx(nn,{tabs:U,current:R,onChange:g})}),R==="store"&&e.jsx(no,{projectType:z,blocklet:u,releaseType:_,projectId:t,releaseId:b,componentDid:v,warning:p,onPublish:V,onOpenConnectStore:oe,onDelete:j,connectedStores:o.connectedStores||[],publishedStoreIds:a==null?void 0:a.publishedStoreIds}),R==="endpoint"&&e.jsx(ve,{minHeight:400,children:e.jsx(ao,{blocklet:u,releaseType:_,projectId:t,releaseId:b,warning:p,publishedEndpointIds:[],connectedEndpoints:o.connectedEndpoints||[],onPublish:V,onOpenConnectEndpoint:ie,onDelete:j})})]})}),e.jsx(In,{did:(Ee=u==null?void 0:u.meta)==null?void 0:Ee.did,params:o,projectId:t,open:S,setParams:i,onClose:()=>A(!1)})]})}$n.propTypes={projectId:s.string.isRequired,params:s.object.isRequired,mode:s.string.isRequired,loading:s.bool.isRequired,blocklet:s.object.isRequired,release:s.object.isRequired,isPublished:s.bool.isRequired,releaseId:s.string.isRequired,getData:s.func.isRequired,getRelease:s.func.isRequired,componentDid:s.string.isRequired,resourceRelateComponents:s.object.isRequired,disabledSelectComponents:s.bool.isRequired,saveSelectedEventsRef:s.object.isRequired,hasSelectedResources:s.bool.isRequired,initLogoUrl:s.string.isRequired,setLoading:s.func.isRequired,releaseUsedLast:s.bool.isRequired,setReleaseUsedLast:s.func.isRequired,projectType:s.string.isRequired,setParamsErrTip:s.func.isRequired,warning:s.object.isRequired,setParams:s.func.isRequired,initUrl:s.object.isRequired,paramsErrTip:s.object.isRequired};const Jr=ye.div`
180
+ .sticky-header {
181
+ margin-top: -12px;
182
+ padding: 12px 0;
183
+ position: sticky;
184
+ top: 0;
185
+ z-index: 99;
186
+ display: flex;
187
+ align-items: center;
188
+ justify-content: space-between;
189
+ background-color: #fff;
190
+ padding-bottom: 12px;
191
+ border-bottom: ${({theme:t})=>`1px solid ${t.palette.divider}`};
192
+ }
193
+ `;function Pn({text:t}){const{palette:o}=Qo();return t?e.jsx(Os,{style:{backgroundColor:o.background.default,color:o.text.primary},wrapperElement:{"data-color-mode":"light"},source:gs.sanitize(t),rehypePlugins:[[Ws,{target:"_blank"}]]}):e.jsx(Me,{Icon:zt})}Pn.propTypes={text:s.string.isRequired};function _n({params:t,setParams:o,paramsErrTip:n,loading:l,setParamsErrTip:i,readOnly:d}){var b;const{t:r}=Q(),[u,a]=x.useState(d?"preview":"write"),f=(j,y)=>{a(y)};return e.jsxs(c,{sx:{border:"1px solid transparent",borderRadius:2},children:[e.jsxs(c,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(E,{variant:"h6",fontWeight:"bold",sx:{},children:r("common.introduction")}),e.jsxs(Zo,{value:u,onChange:f,"aria-label":"wrapped label tabs example",children:[e.jsx(ot,{value:"write",label:"Write"}),e.jsx(ot,{value:"preview",label:"Preview"})]})]}),e.jsx(c,{display:u==="write"?"block":"none",sx:{width:"100%",marginTop:3},children:e.jsx(ne,{disabled:l||d,sx:{border:"none"},placeholder:`Blocklet ${r("common.introduction")}`,InputProps:{"data-cy":"export-blocklet-introduction",readOnly:d,endAdornment:e.jsxs(Je,{position:"end",children:[((b=t==null?void 0:t.blockletIntroduction)==null?void 0:b.length)||0," / ",he.PROJECT.MAX_INTRO_LENGTH]})},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,minRows:4,value:t.blockletIntroduction||"",onChange:j=>{i({blockletIntroduction:""}),o({blockletIntroduction:j.target.value.slice(0,he.PROJECT.MAX_INTRO_LENGTH)})},error:!!n.blockletIntroduction,helperText:n.blockletIntroduction||""})}),e.jsx(c,{display:u==="preview"?"block":"none",mt:3,children:e.jsx(Pn,{text:t.blockletIntroduction||""})})]})}_n.propTypes={params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,readOnly:s.bool.isRequired,loading:s.bool.isRequired};var uo={},Xr=Ce;Object.defineProperty(uo,"__esModule",{value:!0});var It=uo.default=void 0,Yr=Xr(De()),Lo=e;It=uo.default=(0,Yr.default)([(0,Lo.jsx)("circle",{cx:"12",cy:"19",r:"2"},"0"),(0,Lo.jsx)("path",{d:"M10 3h4v12h-4z"},"1")],"PriorityHigh");function po({step:t,ok:o,active:n,error:l,warning:i}){let d="grey.500",r=t+1;return o&&(r=e.jsx(pn,{sx:{fontSize:18,margin:0},color:"white"})),l||!o&&n>t?(d="error.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):i?(d="warning.main",r=e.jsx(It,{sx:{fontSize:18,margin:0},color:"white"})):n>=t&&(d="primary.main"),e.jsx(c,{width:24,height:24,bgcolor:d,borderRadius:"100%",color:"white",display:"flex",justifyContent:"center",fontWeight:"bold",fontSize:14,alignItems:"center",children:r})}po.propTypes={step:s.number,ok:s.bool,active:s.number,error:s.string,warning:s.bool};po.defaultProps={step:0,ok:!1,active:0,error:"",warning:!1};function qn({steps:t,activeStep:o,setActiveStep:n,hasSelectedResources:l,params:i,loading:d,paramsErrTip:r,warning:u,viewMode:a,projectId:f}){const{t:b}=Q(),j=()=>{n(v=>v+1)},y=()=>{n(v=>v-1)},h=v=>v===0?(r==null?void 0:r.blockletTitle)||(r==null?void 0:r.projectId)||(r==null?void 0:r.blockletDescription)||(r==null?void 0:r.blockletHomepage)||(r==null?void 0:r.blockletSupport)||(r==null?void 0:r.blockletCommunity)||(r==null?void 0:r.blockletRepository):v===2?(r==null?void 0:r.blockletResource)||(r==null?void 0:r.blockletDocker)||(r==null?void 0:r.dockerImageName):v>=4?(r==null?void 0:r.blockletVersion)||(r==null?void 0:r.note):"",p=a||Dn({hasSelectedResources:l,params:i,projectId:f,t:b})===null;return e.jsxs(c,{sx:{width:300,maxWidth:300,minWidth:300,padding:2,border:"1px solid",borderColor:"divider",borderRadius:1},children:[e.jsx(Kn,{activeStep:o,orientation:"vertical",children:t.map((v,w)=>{const m={},k=d||!Fr({hasSelectedResources:l,params:i,projectId:f,step:w,t:b}),C=d?"":h(w);return C&&(m.optional=e.jsx(E,{variant:"caption",color:"error",sx:{wordBreak:"break-word"},children:C}),m.error=!0),e.jsxs(es,{children:[e.jsx(ts,{icon:e.jsx(po,{error:C,warning:w===0?u.hasWarning:!1,active:p?99:o,step:w,ok:k}),sx:{cursor:"pointer",color:C?"error.main":"inherit"},disabled:!1,onClick:()=>n(w),...m,children:e.jsx(E,{fontSize:"14px",fontWeight:"500",color:C||!k&&o>w?"error.main":"inherit",children:v.label})}),e.jsxs(os,{children:[e.jsx(E,{fontSize:12,children:v.description}),!p&&e.jsx(c,{sx:{mb:2},children:e.jsxs("div",{children:[w<t.length-1&&e.jsx(K,{variant:"contained",onClick:j,sx:{mt:1,mr:1},disabled:C||!k,children:b("common.continue")}),w>0&&e.jsx(K,{disabled:w===0,onClick:y,sx:{mt:1,mr:1},children:b("common.back")})]})})]})]},v.label)})}),o>=t.length-1&&e.jsx(Pt,{square:!0,elevation:0,sx:{p:3},children:e.jsx(E,{fontSize:12,sx:{opacity:.5},children:"Click right top button to release"})})]})}qn.propTypes={steps:s.array.isRequired,activeStep:s.number.isRequired,setActiveStep:s.func.isRequired,params:s.object.isRequired,viewMode:s.string.isRequired,loading:s.bool.isRequired,projectId:s.string.isRequired,hasSelectedResources:s.bool.isRequired,warning:s.object.isRequired,paramsErrTip:s.shape({projectId:s.string,blockletVersion:s.string,blockletTitle:s.string,blockletDescription:s.string,note:s.string,blockletResource:s.string,blockletHomepage:s.string,blockletSupport:s.string,blockletCommunity:s.string,blockletRepository:s.string,blockletDocker:s.object,dockerImageName:s.string}).isRequired};const Qr=[".zip",".gz"],Zr=1024*1024*100,Kr=x.lazy(()=>sn(()=>import("./index-Bdi900W2.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader})));function ho({app:t,projectId:o,readOnly:n,params:l,setParams:i,setParamsErrTip:d,error:r}){const{t:u,locale:a}=Q(),f=x.useRef(null),b=()=>n?!1:!o||o===Y.UNOWNED_DID?(B.error(u("blocklet.publish.errorTip.noFirstDid")),!1):!0,j=`${Y.WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${t.meta.did}/${o}/resource/upload`;return e.jsxs(c,{sx:{mt:3},children:[e.jsx(E,{gutterBottom:!0,children:u("blocklet.publish.resourceUpload")}),e.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,sx:{flex:1,cursor:n?"default":"pointer"},children:[!!l.uploadedResource&&e.jsx(E,{component:"a",href:`${j}/params.uploadedResource`,children:l.uploadedResource}),!n&&e.jsx(K,{variant:"outlined",size:"small",onClick:()=>{var y;b()&&((y=f.current)==null||y.open())},children:l.uploadedResource?u("common.change"):u("common.upload")})]}),e.jsx(x.Suspense,{fallback:e.jsx(Xe,{}),children:e.jsx(Kr,{ref:f,locale:a,popup:!0,onUploadFinish:y=>{var h;i({uploadedResource:y.data.filename}),d({blockletResource:""}),(h=f.current)==null||h.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:j,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:Qr,maxFileSize:Zr,maxNumberOfFiles:1}}},"uploader-resource")}),!!r&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:r})]})}ho.propTypes={app:s.object.isRequired,projectId:s.string.isRequired,readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired};ho.defaultProps={};function lt({readOnly:t,params:o,setParams:n,paramsErrTip:l,setParamsErrTip:i,loading:d}){var u;const{t:r}=Q();return e.jsx(c,{display:"flex",mt:3,className:"section",children:e.jsxs(c,{sx:{flex:1},children:[e.jsx(ne,{required:!0,disabled:d||t,label:`Blocklet ${r("common.version")}`,placeholder:`Blocklet ${r("common.version")}`,InputProps:{"data-cy":"blocklet-version",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,value:o.blockletVersion||"",onChange:a=>{i({blockletVersion:""}),n({blockletVersion:a.target.value})},error:!!l.blockletVersion,helperText:l.blockletVersion||""}),e.jsx(ne,{label:r("blocklet.publish.releaseNote"),autoComplete:"off",disabled:d||t,variant:"outlined",InputProps:{"data-cy":"release-note",readOnly:t,endAdornment:e.jsxs(Je,{position:"end",children:[((u=o==null?void 0:o.note)==null?void 0:u.length)||0," / ",he.PROJECT.MAX_NOTE_LENGTH]})},fullWidth:!0,multiline:!0,minRows:4,required:!0,value:o.note||"",onChange:a=>{i({note:""}),n({note:a.target.value.slice(0,he.PROJECT.MAX_NOTE_LENGTH)})},error:!!l.note,helperText:l.note||"",sx:{mt:3}})]})})}lt.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,paramsErrTip:s.object.isRequired,setParamsErrTip:s.func.isRequired,loading:s.bool.isRequired};lt.defaultProps={};function En(t){for(const o in t)typeof t[o]=="string"?t[o]=t[o].replace(/\\\\/g,"\\"):typeof t[o]=="object"&&t[o]!==null&&En(t[o]);return t}function it({index:t,item:o,dockerParams:n,setDockerParams:l,dataKey:i,t:d,readOnly:r}){const u=(o==null?void 0:o.value)||"",[a,f]=x.useState(!1),b=()=>{var U;(U=n[i])==null||U.splice(t,1),l({...n,[i]:[...n[i]]})},j=(U,R)=>{var g;(g=n[i])!=null&&g[t]&&(R?(n[i][t].custom=n[i][t].value,n[i][t].value=`$${yt(o.key)}`):(n[i][t].value=n[i][t].custom||"",n[i][t].custom="")),l({...n,[i]:[...n[i]]})},y=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],secure:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},h=(U,R)=>{n[i][t]={...n[i][t],shared:R},l({...n,[i]:[...n[i]]})},p=(U,R)=>{var D;const g=((D=n[i][t])==null?void 0:D.value)||"";n[i][t]={...n[i][t],required:R,value:R&&g===he.BLOCKLET_AUTOMATIC_ENV_VALUE?"":g},l({...n,[i]:[...n[i]]})},v=(U,R)=>{n[i][t]={...n[i][t],value:R?he.BLOCKLET_AUTOMATIC_ENV_VALUE:"",secure:!1,required:!1},l({...n,[i]:[...n[i]]})},w=U=>{n[i][t]={...n[i][t],description:U.target.value},l({...n,[i]:[...n[i]]})},m=U=>{const R=U.target.value==="web"?"web":"docker";R==="web"&&n.dockerArgs.forEach(M=>{M.type="docker"});const D=`/${n.dockerImage.replace(/\W/g,"-")}-${t}`;n.dockerArgs[t]={...n.dockerArgs[t],type:R,path:R==="docker"?D:"/",protocol:"http",prefix:R==="docker"?D:"/",name:"publicUrl",port:"BLOCKLET_PORT"},l({...n,dockerArgs:[...n.dockerArgs]})},k=U=>{n.dockerArgs[t]={...n.dockerArgs[t],proxyBehavior:U.target.value==="direct"?"direct":"service"},l({...n,dockerArgs:[...n.dockerArgs]})},C=U=>{const R=U.target.value;n[i][t]={...n[i][t],prefix:R,path:R==="*"?"/":R},l({...n,[i]:[...n[i]]})},T=U=>{var R;(R=n[i])!=null&&R[t]&&(n[i][t].value=U.target.value),l({...n,[i]:[...n[i]]})},$=u===`$${yt(o.key)}`||o.custom,I=i==="dockerArgs"&&!dn[o.key],L=qs[o.key],z=i==="dockerEnvs",q=o.key==="--publish";let Z=o.key;return q&&o.type==="web"?Z="--publish (Web)":z&&(Z=`--env ${o.key}`),e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{width:250},children:e.jsx(E,{sx:{textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:Z})}),e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,flex:1},children:[e.jsx(ne,{disabled:r||$||I||o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,placeholder:"",value:$?`$${yt(o.key)}`:u,sx:{flex:1},InputProps:{endAdornment:e.jsxs(Je,{position:"end",sx:{zoom:.9},children:[(!(L||I)||z||q)&&e.jsx(ce,{onClick:()=>f(!0),children:e.jsx(ae,{icon:"icon-park-outline:setting-config"})}),!r&&e.jsx(ce,{onClick:b,color:I?"error":"default",children:e.jsx(ae,{icon:"ic:round-delete"})})]})},error:I,onChange:T}),I&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.noAllowTheArg")}),o.key==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:d("blocklet.publish.docker.publishTips")}),o.key==="--volume"&&Es[o.key](u)&&e.jsx(E,{variant:"caption",color:"error",children:d("blocklet.publish.docker.volumeTips")})]}),a&&e.jsx(ut,{open:!0,fullWidth:!0,maxWidth:"sm",PaperProps:{style:{minHeight:0}},title:d(z?"blocklet.publish.docker.modifyEnv":"blocklet.publish.docker.modifyParam"),onClose:()=>f(!1),children:e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:1,paddingBottom:2},children:[L||I||z?null:e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.needCustomInput")}),e.jsx(_e,{disabled:r,checked:$,onChange:j,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.shared")}),e.jsx(_e,{disabled:r,checked:o.shared,onChange:h,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.required")}),e.jsx(_e,{disabled:r,checked:o.required,onChange:p,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.secure")}),e.jsx(_e,{disabled:r,checked:o.secure,onChange:y,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{children:d("blocklet.publish.docker.autoGenerated")}),e.jsx(_e,{disabled:r,checked:o.value===he.BLOCKLET_AUTOMATIC_ENV_VALUE,onChange:v,sx:{zoom:.9}})]}),z&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.description")}),e.jsx(ne,{disabled:r,value:o.description,onChange:w,sx:{flex:1},label:d("blocklet.publish.docker.description")})]}),q&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.portType")}),e.jsxs(wt,{value:o.type||"docker",onChange:m,children:[e.jsx(fe,{value:"docker",children:"Docker"}),e.jsx(fe,{value:"web",children:"Web"})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.proxyBehavior")}),e.jsxs(wt,{value:o.proxyBehavior||"service",onChange:k,children:[e.jsx(fe,{value:"service",children:d("blocklet.publish.docker.serviceProxy")}),e.jsx(fe,{value:"direct",children:d("blocklet.publish.docker.directProxy")})]})]}),q&&o.type==="web"&&e.jsxs(c,{sx:{mt:1,width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(E,{sx:{flex:1},children:d("blocklet.publish.docker.prefix")}),e.jsx(ne,{disabled:r,value:o.prefix,onChange:C,sx:{flex:1},label:d("blocklet.publish.docker.prefix")})]})]})})]})}it.propTypes={dockerParams:s.object.isRequired,setDockerParams:s.func.isRequired,dataKey:s.string.isRequired,item:s.object.isRequired,t:s.func.isRequired,readOnly:s.bool.isRequired,index:s.number.isRequired};it.defaultProps={};const el=`
194
+ docker run --name postgrest
195
+ -p 3000:3000
196
+ -e PGRST_DB_URI="postgres://username:password@host:port/database"
197
+ -e PGRST_DB_SCHEMA="public"
198
+ -e PGRST_DB_ANON_ROLE="anon"
199
+ postgrest/postgrest
200
+ `.trim();function fo({readOnly:t,paramsErrTip:o,setParamsErrTip:n,error:l,params:i,setParams:d}){const{t:r}=Q(),[u,a]=x.useState("dockerParams"),[f,b]=x.useState(""),[j,y]=x.useState(!1),[h,p]=x.useState("--volume"),[v,w]=x.useState(""),[m,k]=x.useState(So(f)),C=m.dockerArgs||[],T=m.dockerEnvs||[],$=m.dockerImage||"",I=m.dockerCommand||"",L=g=>{const{value:D}=g.target;b(D)};x.useEffect(()=>{i.blockletDocker&&i.blockletDocker.dockerImage&&!$&&k(i.blockletDocker)},[i,$,k]);const z=g=>{const D=So(g.target.value);k(M=>{let O,G=!1;return D.dockerArgs.forEach(S=>{const A=M.dockerArgs.find(H=>H.key===S.key);A&&(Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)}),S.proxyBehavior=S.proxyBehavior||"server",S.type==="web"&&(S.path="/",S.protocol="http",S.prefix="/",S.name="publicUrl",S.port="BLOCKLET_PORT",G=!0),!O&&S.key==="--publish"&&(O=S))}),!G&&O&&(O.type="web",O.path="/",O.protocol="http",O.prefix="/",O.name="publicUrl",O.port="BLOCKLET_PORT"),D.dockerEnvs.forEach(S=>{const A=M.dockerEnvs.find(H=>H.key===S.key);A&&Object.entries(A).forEach(([H,J])=>{J!=null&&H!=="value"&&(S[H]=J)})}),D})},q=()=>{if(y(!1),h==="--env"){k({...m,dockerEnvs:[...T,{key:v,value:"",custom:"",secure:!1,shared:!1,required:!1,description:v}]}),w("");return}k({...m,dockerArgs:[...C,{key:h,value:"",type:"docker",name:"",path:"",prefix:"",protocol:""}]})},Z=()=>{y(!1),w("")},U=g=>{const{value:D}=g.target;k({...m,dockerImage:D}),D.indexOf(" ")>-1?n({...o,dockerImageName:r("blocklet.publish.docker.dockerImageNameError")}):n({...o,dockerImageName:""})},R=g=>{const{value:D}=g.target;k({...m,dockerCommand:D});try{Ns(D),n({...o,dockerCMD:""})}catch{n({...o,dockerCMD:r("blocklet.publish.docker.dockerCMDError")})}};return x.useEffect(()=>{u==="dockerCommand"&&b(Ls(m))},[m,u]),x.useEffect(()=>{d(g=>({...g,blockletDocker:{dockerImage:m.dockerImage,dockerCommand:m.dockerCommand,dockerArgs:m.dockerArgs,dockerEnvs:m.dockerEnvs}}))},[m,d]),e.jsxs(c,{sx:{mt:3},children:[e.jsxs(c,{sx:{width:"100%",display:"flex",flexDirection:"column",gap:2},children:[e.jsx(c,{sx:{borderBottom:1,borderColor:"divider",mb:2},children:e.jsxs(Zo,{value:u,onChange:(g,D)=>a(D),children:[e.jsx(ot,{value:"dockerParams",label:r("blocklet.publish.docker.dockerParams")}),e.jsx(ot,{value:"dockerCommand",label:r("blocklet.publish.docker.dockerCommand")})]})}),u==="dockerCommand"&&e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.pleaseInputDockerCommand"),placeholder:el,InputProps:{"data-cy":"blocklet-docker-command",readOnly:t},autoComplete:"off",variant:"outlined",fullWidth:!0,multiline:!0,spellCheck:!1,minRows:10,value:f,onChange:L,onBlur:z}),u==="dockerParams"&&e.jsxs(c,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(ne,{disabled:t,label:r("blocklet.publish.docker.dockerImageName"),placeholder:"Example: docker.io/postgrest/postgrest:latest",value:$,sx:{flex:1},color:o.dockerImageName?"error":"primary",error:!!o.dockerImageName,helperText:o.dockerImageName||"",onChange:U}),e.jsx(ne,{disabled:t,label:`Docker CMD (${r("common.optional")})`,placeholder:"Docker CMD",value:I,sx:{flex:1},color:o.dockerCMD?"error":"primary",error:!!o.dockerCMD,helperText:o.dockerCMD||"",onChange:R}),e.jsx(c,{sx:{height:4}}),C.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerArgs",t:r,readOnly:t},`${g.key}-${D}`)),T.map((g,D)=>e.jsx(it,{index:D,item:g,dockerParams:m,setDockerParams:k,dataKey:"dockerEnvs",t:r,readOnly:t},`${g.key}-${D}`)),!t&&e.jsxs(c,{sx:{display:"flex",flexDirection:"row",gap:2,alignItems:"center"},children:[e.jsx(c,{sx:{flex:1}}),e.jsx(K,{onClick:()=>y(!0),children:r("blocklet.publish.docker.addItem")})]})]})]}),!!l&&e.jsx(c,{color:"error.main",mt:1,fontSize:14,children:l}),j&&e.jsxs(at,{fullWidth:!0,open:!0,children:[e.jsx(Vo,{children:r("blocklet.publish.docker.addItem")}),e.jsx(Fo,{children:e.jsxs(ns,{sx:{mt:1,width:"100%",minWidth:480,maxWidth:"100%"},children:[e.jsx(wt,{labelId:"demo-simple-select-helper-label",id:"demo-simple-select-helper",value:h,sx:{width:"100%"},onChange:g=>p(g.target.value),children:Object.keys(dn).map(g=>e.jsx(fe,{value:g,children:g}))}),h==="--publish"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.publishTips")}),h==="--volume"&&e.jsx(E,{variant:"caption",color:"text.secondary",children:r("blocklet.publish.docker.volumeTips")}),h==="--env"&&e.jsxs(c,{sx:{mt:3,width:"100%"},children:[e.jsx(ne,{value:v,onChange:g=>w(g.target.value),sx:{width:"100%"},label:r("blocklet.publish.docker.envKey")}),e.jsx(ss,{children:r("blocklet.publish.docker.dockerArgValue")})]})]})}),e.jsxs(Ho,{children:[e.jsx(K,{onClick:Z,children:r("common.cancel")}),e.jsx(K,{onClick:q,children:r("common.confirm")})]})]})]})}fo.propTypes={readOnly:s.bool.isRequired,params:s.object.isRequired,setParams:s.func.isRequired,error:s.string.isRequired,setParamsErrTip:s.func.isRequired,paramsErrTip:s.func.isRequired};fo.defaultProps={};const tl=({tabs:t,blocklet:o,ancestors:n=[]})=>{const l=o.meta.did;t.push({label:e.jsxs(c,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(Et,{size:24,blocklet:o,ancestors:n}),e.jsx(c,{ml:"4px",className:"text",children:e.jsx(c,{children:o.meta.title})})]},l),value:l})},No=(t,o)=>{const n=Nt(t,["blockletVersion","blockletTitle","blockletDescription","blockletLogo","blockletIntroduction","blockletVideos","blockletScreenshots","blockletResourceType","blockletSupport","blockletHomepage","blockletCommunity","blockletRepository","blockletDocker","contentType","connectedStores","blockletComponents","lastReleaseId","uploadedResource","autoUpload","possibleSameStore","note","connectedEndpoints"]);return n.blockletComponents?n.blockletComponents=n.blockletComponents.map(l=>({...l,included:!0})):n.blockletComponents=(o.children||[]).map(l=>({did:l.meta.did,included:!1,required:!1})),n},ol={0:"branding",1:"introduction",2:"resources",3:"blocklets",4:"version"},Ao={branding:0,introduction:1,resources:2,blocklets:3,version:4};function mo({initUrl:t,...o}){var bo,xo;const{projectId:n,mode:l,releaseId:i,componentDid:d=""}=ct(),{t:r}=Q(),{blocklet:u}=Se(),[a,f]=Pe({blockletScreenshots:[],blockletVideos:[],publishedStoreIds:[],connectedStores:[],uploadedResource:"",contentType:"blocklet",blockletResourceType:"",blockletSupport:"",blockletCommunity:"",blockletHomepage:"",blockletRepository:"",blockletDocker:{dockerImage:"",dockerArgs:[],dockerEnvs:[]}}),[b,j]=Pe({}),[y,h]=Pe({}),[p,v]=x.useState(!1),[w,m]=Pe(null),{api:k}=ge(),C=Be(P=>P.breakpoints.down("md")),[T,$]=x.useState({}),[I,L]=x.useState(!1),z=x.useRef({}),[q,Z]=Pe({}),[U,R]=x.useState(""),[g,D]=Pe({}),M=t==null?void 0:t.searchParams.get("dependentComponentsMode"),O=M==="readonly",{session:G}=Ue(),{storeList:S}=eo({fromBlocklet:!0,blocklet:u,componentDid:d,userDid:(bo=G==null?void 0:G.user)==null?void 0:bo.did}),[A,H]=x.useState([]);x.useEffect(()=>{Array.isArray(S)&&S.length>0&&Promise.all(S.map(async P=>({...(await(await fetch(`${P.url}/__blocklet__.js?type=json`)).json()).preferences,storeInfo:P}))).then(P=>{H(P)})},[S.length]),x.useEffect(()=>{const P={},N={},{logoUrl:me,screenshotUrls:Te}=Rn(a,u,n);Promise.all(A.map(async be=>{const{maxImageCount:Oe,minImageCount:mt,logoImageType:$e,imageMinHeight:go,imageMinWidth:jo}=be,Ze=Array.isArray($e)?$e:$e.split(",");P[be.storeInfo.url]||(P[be.storeInfo.url]={}),N[be.storeInfo.url]||(N[be.storeInfo.url]={});const bt=N[be.storeInfo.url],An=P[be.storeInfo.url];Number(Oe)<=Te.length&&(bt.maxImageCount=r("blocklet.publish.storeRule.maxImageCount",{max:Oe,count:Te.length,unit:Oe>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")})),Number(be.minImageCount)>Te.length&&(bt.minImageCount=r("blocklet.publish.storeRule.minImageCount",{min:mt,count:Te.length,unit:mt>1?r("blocklet.publish.storeRule.screenshots"):r("blocklet.publish.storeRule.screenshot")}));const ko=me?me.split(".").pop():"";ko&&!(Ze.includes("jpg")?[...Ze,"jpeg"]:Ze).includes(ko)&&(An.logoFormat=r("blocklet.publish.storeRule.logoFormat",{format:Ze.join(",")})),await Promise.all(Te.map((zn,xt)=>{const gt=new Image;return gt.src=zn,new Promise(On=>{gt.onload=()=>{const{width:Wn,height:Bn}=gt;if(Wn<Number(jo)||Bn<Number(go)){let Ge="";switch(xt+1){case 1:Ge=r("blocklet.publish.storeRule.first");break;case 2:Ge=r("blocklet.publish.storeRule.second");break;case 3:Ge=r("blocklet.publish.storeRule.third");break;default:Ge=`${xt+1}`;break}bt[`imageSize-${xt+1}`]=r("blocklet.publish.storeRule.minImageSize",{width:jo,height:go,name:Ge})}On()}})}))})).then(()=>{const be=Object.values(P).some($e=>Object.values($e).length>0),Oe=Object.values(N).some($e=>Object.values($e).length>0);h({logoErrors:P,screenshotErrors:N,storeList:S,hasWarning:be||Oe,hasLogoWarning:be,hasScreenshotWarning:Oe})})},[a,u.did,n,A,r]);const J=x.useMemo(()=>{const P={};return Object.keys(g).forEach(N=>{const me=g[N];me&&me.forEach(Te=>{P[Te]=!0})}),P},[g]),Ie=x.useCallback(P=>{O&&f({blockletComponents:[]}),D(P)},[O,D,f]),_=x.useCallback((...P)=>{Z(...P),j({blockletResource:"",blockletDocker:""})},[]),V=i==="none"?(a==null?void 0:a.lastReleaseId)||"":i,[X,te]=x.useState(l==="new-release"?4:0),oe=t==null?void 0:t.searchParams.get("resourcesTitle"),ie=t==null?void 0:t.searchParams.get("componentsTitle"),ee=[{label:r("blocklet.publish.branding"),description:r("blocklet.publish.steps.branding")},{label:r("common.introduction"),description:r("blocklet.publish.steps.introduction")},{label:oe||r("blocklet.publish.resourceTitle"),description:r("blocklet.publish.steps.resources")},{label:ie||r("common.components"),description:r("blocklet.publish.steps.blocklets")},{label:r("blocklet.publish.versionTitle"),description:r("blocklet.publish.steps.version")}],ue=ee[X]||ee[ee.length-1],pe=ol[X];x.useEffect(()=>{n&&j({projectId:""})},[n,j]);const Ye=x.useMemo(()=>{var P;return(a==null?void 0:a.blockletResourceType)==="resource"?"resource":(P=a==null?void 0:a.blockletComponents)!=null&&P.some(N=>N.included)||Object.keys(J).length||a!=null&&a.uploadedResource?"pack":"resource"},[a==null?void 0:a.blockletComponents,a==null?void 0:a.uploadedResource,J,a==null?void 0:a.blockletResourceType]),Ve=[],Ee=((u==null?void 0:u.children)||[]).filter(P=>{var N;return(N=P.meta.resource)==null?void 0:N.exportApi}).filter(P=>!d||P.meta.did===d);Ee.forEach(P=>{tl({tabs:Ve,blocklet:P,t:r,ancestors:[u]})});const[se,Le]=x.useState((xo=Ve[0])==null?void 0:xo.value),W=!I&&(w==null?void 0:w.status)==="published",le=W,Ne=Rs(()=>{if(!t)return;R(t.searchParams.get("logo")),f(N=>{var me;return{...N,blockletTitle:(N==null?void 0:N.blockletTitle)||t.searchParams.get("title"),blockletDescription:(N==null?void 0:N.blockletDescription)||t.searchParams.get("description"),blockletIntroduction:(N==null?void 0:N.blockletIntroduction)||t.searchParams.get("introduction")||t.searchParams.get("description"),blockletComponents:(me=N==null?void 0:N.blockletComponents)!=null&&me.length?N==null?void 0:N.blockletComponents:JSON.parse(t.searchParams.get("components")||"[]"),note:(N==null?void 0:N.note)||t.searchParams.get("note")||"No note"}});const P=t.searchParams.get("resources");try{const N=JSON.parse(P);$(N)}catch{}}),Ae=async()=>{if(V)try{const P=await k.getRelease({input:{did:u.meta.did,projectId:n,releaseId:V}});if(v(!1),!P.release){B.error("Release not found");return}P.release.note=gn(P.release.note,"note"),P.release=En(P.release),l!=="view"&&(P.release.note=""),f(N=>No({...N,...P.release,blockletVersion:l==="create"||l==="new-release"?We.inc(P.release.blockletVersion,"patch"):P.release.blockletVersion},u)),m(P.release)}catch(P){v(!1),B.error(xe(P))}},Fe=async()=>{if(n===Y.UNOWNED_DID){f({blockletVersion:"0.0.1",blockletTitle:""});return}if(!n){B.error(r("blocklet.publish.errorTip.noDid"));return}try{const N=(await kn(k.getProject,[{input:{did:u.meta.did,projectId:n}}],{key:"getProject"})).project||{};N.blockletVersion?(l==="create"||l==="new-release")&&We.valid(N.blockletVersion)&&(N.blockletVersion=We.inc(N.blockletVersion,"patch")):N.blockletVersion="0.0.1";const me=No(N,u);f(me),N.lastReleaseId||Ne()}catch(P){B.error(xe(P))}},ze=x.useCallback(async()=>{v(!0);try{if(l==="view"){if(!V){B.error("Empty release id");return}await Fe(),await Ae();return}await Fe(),V&&(L(!0),await Ae())}finally{v(!1)}},[l,V]),Qe=P=>{f({blockletComponents:P})},F=P=>{f({blockletResourceType:P})};x.useEffect(()=>{ze()},[ze]),x.useEffect(()=>{n===Y.UNOWNED_DID&&(l==="create"||l==="new-release")&&t&&Ne()},[n,t,l,Ne]),x.useEffect(()=>{a.contentType==="docker"?f({resourceFromSelect:!1}):a.contentType==="blocklet"?f({resourceFromSelect:!0}):a.contentType==="upload"&&f({resourceFromSelect:!1})},[a.contentType,f]);const re=x.useMemo(()=>!!Object.keys(q).find(P=>!!q[P].length),[q]);if(!a&&p)return e.jsx(Xe,{});if(!a)return null;const He=Ee.find(P=>P.meta.did===se),Nn=P=>{Le(P)};return e.jsxs(nl,{...o,children:[e.jsx($n,{blocklet:u,release:w,getData:ze,getRelease:Ae,mode:l,params:a,setParams:f,setParamsErrTip:j,warning:y,readOnly:le,isPublished:W,loading:p,setLoading:v,initLogoUrl:U,releaseId:V,projectId:n,projectType:Ye,resourceComponents:Ee,resourceComponentsMap:g,resourceRelateComponents:J,resourceItem:He,saveSelectedEventsRef:z,hasSelectedResources:re,releaseUsedLast:I,setReleaseUsedLast:L,setRelease:m,paramsErrTip:b}),e.jsxs(c,{display:"flex",flexDirection:"column",sx:{width:"100%"},children:[e.jsx(c,{pt:3}),e.jsxs(c,{sx:{gap:3},display:"flex",flexDirection:C?"column":"row",children:[!C&&e.jsx(qn,{steps:ee,loading:p,viewMode:l==="view",params:a,hasSelectedResources:re||a.uploadedResource,paramsErrTip:b,warning:y,activeStep:X,setActiveStep:te,projectId:n,resourcesUrlTitle:oe,componentsUrlTitle:ie}),e.jsxs(c,{flex:"1",maxWidth:"720px",children:[!C&&pe!=="introduction"&&e.jsxs(E,{variant:"h6",fontWeight:"bold",display:"flex",flexDirection:"row",alignItems:"center",children:[ue.label,pe==="branding"&&e.jsx(je,{title:r("blocklet.publish.brandingHelp"),placement:"right",children:e.jsx(c,{component:"a",target:"_blank",href:"https://www.arcblock.io/docs/blocklet-store/en/blocklet-detail-page",sx:{paddingTop:1,marginLeft:1},style:{color:"gray"},children:e.jsx(vs,{})})})]}),(C||pe==="branding")&&e.jsx(c,{flexDirection:"column",children:e.jsx(Cn,{projectId:n,setParams:f,setParamsErrTip:j,warning:y,params:a,componentDid:d,blocklet:u,initUrl:t,loading:p,setLoading:v,paramsErrTip:b,readOnly:le,initLogoUrl:U,setInitLogoUrl:R})}),C&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})}),(C||pe==="introduction")&&e.jsx(c,{display:"flex",flexDirection:"column",sx:{mt:C?5:0,width:"100%"},children:e.jsx(_n,{loading:p,readOnly:le,params:a,setParams:f,paramsErrTip:b,setParamsErrTip:j})}),C&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.resources].label}),e.jsx(c,{sx:{maxWidth:720},display:C||pe==="resources"?"flex":"none",flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsxs(c,{sx:{flex:1},children:[e.jsxs(rs,{onChange:P=>f({contentType:P.target.value}),children:[e.jsx(et,{value:"blocklet",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="blocklet"}),label:r("blocklet.publish.resourceSelect")}),e.jsx(et,{value:"upload",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="upload"}),label:r("blocklet.publish.resourceUpload")}),e.jsx(et,{value:"docker",disabled:le,control:e.jsx(kt,{size:"small",checked:a.contentType==="docker"}),label:r("blocklet.publish.resourceDocker")})]}),e.jsxs(c,{display:a.contentType==="blocklet"?"block":"none",children:[!d&&e.jsx(nn,{tabs:Ve,current:se,onChange:Nn,sx:{ml:-2,mt:2,maxWidth:C?window.innerWidth-24:"100%"}}),e.jsx(Qt,{loading:p,initialResources:T,saveSelectedEventsRef:z,selectedResourceIds:q,setSelectedResourceIds:_,setResourceComponentsMap:Ie,error:b.blockletResource,app:u,readOnly:le,component:He,componentDid:d,initUrl:t,params:a,showTree:a.contentType==="blocklet",setParams:f,projectId:n===Y.UNOWNED_DID?"":n,releaseUsedLast:I,release:{...w,id:V}})]}),a.contentType==="upload"&&e.jsx(ho,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j}),a.contentType==="docker"&&e.jsx(fo,{app:u,readOnly:le,projectId:n===Y.UNOWNED_DID?"":n,params:a,error:b.blockletResource,setParams:f,setParamsErrTip:j,paramsErrTip:b})]})})}),C&&e.jsx(E,{variant:"h6",fontWeight:"bold",mt:5,children:ee[Ao.blocklets].label}),(C||pe==="blocklets")&&e.jsx(c,{flexDirection:"column",children:e.jsx(c,{display:"flex",mt:3,className:"section full-width",children:e.jsx(c,{sx:{flex:1},children:e.jsx(Ht,{projectType:Ye,disabled:p||le,app:u,value:(a==null?void 0:a.blockletComponents)||[],blockletResourceType:(a==null?void 0:a.blockletResourceType)||"",onChange:Qe,onChangeBlockletResourceType:F,resourceRelateComponents:J,dependentComponentsMode:M})})})}),!C&&pe==="version"&&e.jsx(c,{flexDirection:"column",children:e.jsx(lt,{loading:p,params:a,paramsErrTip:b,setParams:f,setParamsErrTip:j,readOnly:le})})]})]})]})]})}mo.propTypes={initUrl:s.object};mo.defaultProps={initUrl:null};const nl=ye.div`
201
+ .section {
202
+ &.full-width {
203
+ max-width: 100%;
204
+ }
205
+ .MuiTypography-h3 {
206
+ font-size: 1.1rem;
207
+ font-weight: 700;
208
+ }
209
+ .left {
210
+ flex-shrink: 0;
211
+ width: 140px;
212
+ }
213
+ .MuiTabs-indicator {
214
+ display: none;
215
+ }
216
+ .MuiTypography-subtitle1 {
217
+ width: 120px;
218
+ font-weight: 700;
219
+ font-size: 1rem;
220
+ ${({theme:t})=>t.breakpoints.down("sm")} {
221
+ width: 80px;
222
+ }
223
+ }
224
+ }
225
+ .MuiButtonBase-root {
226
+ a {
227
+ color: inherit;
228
+ }
229
+ }
230
+ .MuiInputBase-multiline .MuiInputAdornment-positionEnd {
231
+ align-self: flex-end;
232
+ .MuiTypography-root {
233
+ font-size: 0.8rem;
234
+ }
235
+ font-size: 0.8rem;
236
+ }
237
+ `;function Ln({padding:t,initUrl:o}){const{blocklet:n}=Se(),l=Un(),{componentDid:i}=ct();if(x.useEffect(()=>{if(i&&window.parent){const r=`${l.pathname}${l.search}`;window.parent.postMessage({event:"popstate",page:"publish",componentDid:i,path:r},"*")}},[i,l]),!n)return null;const d={};return t&&(d.padding=t),e.jsx(sl,{style:d,children:e.jsxs(Vn,{children:[e.jsx(jt,{path:"/",element:e.jsx(Ut,{initUrl:o})}),e.jsx(jt,{path:"/:projectId",element:e.jsx(er,{})}),e.jsx(jt,{path:"/:projectId/:mode/:releaseId",element:e.jsx(mo,{initUrl:o})})]})})}Ln.propTypes={padding:s.oneOfType([s.string,s.number]),initUrl:s.object};Ln.defaultProps={padding:"",initUrl:null};const sl=ye(c)`
238
+ a {
239
+ color: ${({theme:t})=>t.palette.primary.main};
240
+ }
241
+ `;export{Ln as default};
@@ -0,0 +1,11 @@
1
+ import{r as u}from"./vendor-react-DEoibe3W.js";import{a9 as $,j as r,H as o,aa as b,b4 as B,O as K,s as D,c2 as W,c3 as X,c4 as G,c5 as H,I as z,ab as Q,ah as U}from"./vendor-mui-core-B6POpIBB.js";import{r as Y,b5 as J,aQ as Z,d as ee}from"./vendor-ux-did-connect-D4-ZeZHm.js";import{d as re}from"./Done-DLTvHdZB.js";import{C as te}from"./Google-C7d25Q5r.js";import{ac as ne,f as oe}from"./index-CksPySYI.js";import{R as se,F as ie,L as ae}from"./logo-uploader-DMxsEq63.js";var E={},le=$;Object.defineProperty(E,"__esModule",{value:!0});var V=E.default=void 0,ce=le(Y()),de=r;V=E.default=(0,ce.default)((0,de.jsx)("path",{d:"M6.23 20.23 8 22l10-10L8 2 6.23 3.77 14.46 12z"}),"ArrowForwardIosSharp");const T={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function N({editing:e,value:s,onChange:i}){const[a,d]=u.useState(!1),p=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return e&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[e]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},g=r.jsx(b,{className:"form-item-input slot",px:1,children:r.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&r.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),f=r.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[r.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:r.jsx("div",{ref:p,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),r.jsx(B,{open:a,anchorEl:p.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:r.jsx(te,{color:s,onChange:l=>x(l.hex)})})]});return e?f:g}N.propTypes=T;function O({editing:e,description:s,value:i,onChange:a,componentProps:d,...p}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(J),g=l=>{l.key==="Enter"&&a(x.current,"confirm")},f=l=>{x.current=l,a(l)};return e?r.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),f(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:g,...p}):r.jsx(b,{px:1,className:"form-item-input slot",children:i||r.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}O.propTypes=T;O.defaultProps={componentProps:{}};function A({editing:e,value:s,onChange:i,componentProps:a,...d}){const{blocklet:p}=a,m=s==="auto"?Z.getPassportColorFromDid(p.appDid):s;return r.jsxs(b,{display:"flex",alignItems:"center",children:[r.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:ne({title:"Owner",issuer:oe.getDisplayName(p),issuerDid:p.appDid,ownerName:"Your Name",ownerDid:p.appDid,preferredColor:s||"auto"})}}),r.jsx(N,{...d,editing:e,value:e?m:s,onChange:i,componentProps:a})]})}A.propTypes={...T,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};A.defaultProps={};const ue=D(e=>r.jsx(W,{disableGutters:!0,elevation:0,square:!0,...e}))(({theme:e})=>({border:`1px solid ${e.palette.divider}`,"&:not(:last-child)":{borderBottom:0},"&::before":{display:"none"}})),pe=D(e=>r.jsx(X,{expandIcon:r.jsx(V,{sx:{fontSize:"0.9rem"}}),...e}))(({theme:e})=>({backgroundColor:e.palette.mode==="dark"?"rgba(255, 255, 255, .05)":"rgba(0, 0, 0, .03)",flexDirection:"row-reverse","& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(90deg)"},"& .MuiAccordionSummary-content":{marginLeft:e.spacing(1)}})),fe=D(G)(({theme:e})=>({padding:e.spacing(2),borderTop:"1px solid rgba(0, 0, 0, .125)"})),me=H`
2
+ 0%, 100% {
3
+ transform: scale(1) translateX(0);
4
+ }
5
+ 50% {
6
+ transform: scale(1.05) translateX(-3px);
7
+ }
8
+ 25%, 75% {
9
+ transform: scale(1.1) translateX(3px);
10
+ }
11
+ `,xe={input:O,color:N,passport:A,uploader:e=>r.jsx(ae,{...e.componentProps})};function ge(e,{editing:s=!1}){const{componentType:i="input",render:a,renderFormItem:d}=e;return s&&d?d:!s&&a?a:xe[i==null?void 0:i.toLowerCase()]}F.propTypes={item:o.object.isRequired,findEditingItem:o.func.isRequired,getItemValue:o.func.isRequired,onFormItemChange:o.func.isRequired,onFocusOut:o.func.isRequired,disabled:o.bool,loading:o.bool,onCancel:o.func,formValues:o.object.isRequired};F.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function F({item:e,findEditingItem:s,getItemValue:i,onFormItemChange:a,onFocusOut:d,disabled:p,loading:m,onCancel:x,formValues:j}){var h;const{key:g,description:f,required:l,solo:S=!1,hidden:y=!1,componentProps:k={},skipButtonDisabled:w=!1}=e;if(y)return null;const I=s(g),{editing:R,shaking:q}=I??{},P=i(e,{editing:R}),n=ge(e,{editing:R}),t={inputProps:{"data-cy":"schema-form-item-component"},key:g,description:f,editing:R,value:P,onChange:(c,_="change")=>a(e,c,_),componentProps:k,skipButtonDisabled:w,onBlur:()=>d(e)};return e.componentType==="collapse"&&((h=e.children)==null?void 0:h.length)>0?r.jsxs(ue,{children:[r.jsx(pe,{expandIcon:r.jsx(V,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),r.jsx(fe,{children:e.children.map(c=>r.jsx(F,{item:c,findEditingItem:s,getItemValue:i,onFormItemChange:a,onFocusOut:d,formValues:j,disabled:p,loading:m,onCancel:x},c.key))})]}):r.jsxs(b,{className:"form-item",children:[!S&&r.jsxs(b,{className:"form-item-label",sx:{color:l&&!P?"error.main":"text.secondary"},children:[f,l&&r.jsx(se,{})]}),r.jsxs(b,{className:"form-item-body",children:[r.jsx(b,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:S?"center":"left"},style:{cursor:"text"},onClick:()=>{p||I!=null&&I.edited||w||a(e,j[g],"edit")},children:r.jsx(n,{...t})}),!S&&r.jsx(b,{className:"form-item-action",style:{marginLeft:0},children:R?r.jsxs(r.Fragment,{children:[I.edited?r.jsx(z,{"data-cy":"schema-form-item-confirm",onClick:()=>{a(e,P,"confirm")},disabled:p||m,sx:{animation:q?`${me} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:m?r.jsx(Q,{size:24}):r.jsx(re,{})}):null,r.jsx(z,{"data-cy":"schema-form-item-cancel",onClick:()=>x(e),style:{paddingLeft:I.edited?4:8},disabled:p||m,size:"large",children:r.jsx(ee,{})})]}):null})]})]},g)}function v({schema:e,loading:s,value:i,defaultValue:a,onChange:d,style:p,disabled:m}){const x=Object.prototype.toString.call(i)==="[object Object]",[j,g]=u.useState([]),[f,l]=u.useState(x?i:a),S=u.useMemo(()=>e.length===1,[e]),y=u.useCallback(n=>j.find(t=>t.key===n),[j]);u.useEffect(()=>{var n;S&&((n=e[0])!=null&&n.required)&&g([{key:e[0].key,editing:!0,initialValue:a[e[0].key]}])},[e,S,a]);const k=u.useCallback(n=>{g(t=>t.find(c=>c.key===n.key)?t.map(c=>c.key===n.key?n:{...c}):[n].concat(t))},[]),w=u.useCallback((n,t,h)=>{const{key:c,secure:_}=n,C=y(c)??{...n};C.editing=!0;const M=f[c]!==t;C.edited=t&&C.initialValue!==t,C.initialValue=a[c];const L={...f,[c]:t};M&&l(L),d({[c]:t},{allValues:L,action:h,currentItem:n}),h==="confirm"&&_&&l({...f,[c]:"__encrypted__"}),h==="confirm"&&(C.initialValue=f[c]),["confirm","cancel"].includes(h)&&(C.editing=!1,C.edited=!1),k(C)},[a,f,d,k,y]),I=u.useCallback((n,{editing:t=!1})=>{const{key:h}=n,c=x?i[h]:f[h];return c==="__encrypted__"?t?"":"******":c},[x,i,f]),R=u.useCallback(n=>{const t=y(n.key);t&&w(n,t.initialValue,"cancel")},[y,w]),q=u.useCallback(n=>{const t=y(n.key);!t||!t.edited||(t.shaking=!0,k(t),setTimeout(()=>{t.shaking=!1,k(t)},500))},[y,k]),P=u.useCallback(n=>{const t=y(n.key);!t||!t.edited?R(n):q(n)},[y,q,R]);return r.jsx(ye,{className:"form",style:p,children:e==null?void 0:e.map(n=>{const{hidden:t=!1}=n;return t?null:r.jsx(F,{item:n,findEditingItem:y,getItemValue:I,onFormItemChange:w,onFocusOut:P,formValues:f,disabled:m,loading:s,onCancel:R})})})}v.propTypes={schema:o.array.isRequired,loading:o.bool,onChange:o.func.isRequired,value:o.object,defaultValue:o.object,style:o.object,disabled:o.bool};v.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const ye=U(ie)``;export{v as S};