@abtnode/webapp 1.16.43-beta-20250507-131727-e3e5be46 → 1.16.43-beta-20250509-094134-34c76f98

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 (204) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-DN3WVSzh.js → AdapterDayjs-Dd7kIQDg.js} +6 -6
  4. package/dist/assets/{Add-B5o3lKZ4.js → Add-DyqE7ma4.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-RVN4Mn-W.js → ArrowDropDown-srvJwv_s.js} +1 -1
  6. package/dist/assets/{Autocomplete-DHpI8PP1.js → Autocomplete-DgD7oXbC.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-BO8goWHs.js → Breadcrumbs-BjBCOm__.js} +1 -1
  8. package/dist/assets/{ButtonGroup-DP9Um2zw.js → ButtonGroup-CETfqQqG.js} +1 -1
  9. package/dist/assets/{CSSTransition-Ce16mrqT.js → CSSTransition-8GXDrEVI.js} +1 -1
  10. package/dist/assets/{CallMerge-D9pdEpQ4.js → CallMerge-D1kGN-Yl.js} +1 -1
  11. package/dist/assets/{CardContent-CV6vnW6h.js → CardContent-BsBNKLwR.js} +1 -1
  12. package/dist/assets/{ChevronLeft-CVA4N8rQ.js → ChevronLeft-CQJA5jUj.js} +1 -1
  13. package/dist/assets/{ChevronRight-sZUpX7tH.js → ChevronRight-B3ioYqvf.js} +1 -1
  14. package/dist/assets/{Clear-C7odY-6_.js → Clear-C23RMA8O.js} +1 -1
  15. package/dist/assets/{Close-w8eKEJW7.js → Close-CMKp87zW.js} +1 -1
  16. package/dist/assets/{Community-CIu-cG23.js → Community-B9PcA7bL.js} +1 -1
  17. package/dist/assets/{Delete-DSB9GjVg.js → Delete-DemQysCs.js} +1 -1
  18. package/dist/assets/{Delete-DpNbJCJA.js → Delete-X-iZLu8W.js} +1 -1
  19. package/dist/assets/{DeleteOutline-B4zcgGCZ.js → DeleteOutline-CBtSJ3uj.js} +1 -1
  20. package/dist/assets/{Done-CasEZEMQ.js → Done-LO8W9lyO.js} +1 -1
  21. package/dist/assets/{Edit-D9oke1qz.js → Edit-qCwSqHzK.js} +1 -1
  22. package/dist/assets/{ErrorOutline-cX4XY61i.js → ErrorOutline-CpLJ4ot-.js} +1 -1
  23. package/dist/assets/{HelpOutline-B-3RVeU3.js → HelpOutline-B7KAkB_W.js} +1 -1
  24. package/dist/assets/{Holiday-CWWiyhee.js → Holiday-DLF993Gr.js} +1 -1
  25. package/dist/assets/{Launch-9QmeNFGh.js → Launch-CbHu_JiN.js} +1 -1
  26. package/dist/assets/{Link-V0zXa94b.js → Link-BJsvTgLA.js} +1 -1
  27. package/dist/assets/{ListItemButton-Drq6UK1v.js → ListItemButton-DU8Ok_s-.js} +1 -1
  28. package/dist/assets/{ListSubheader-r9QVg4z3.js → ListSubheader-C2HVg1lq.js} +1 -1
  29. package/dist/assets/{LoadingButton-CwgQEhJX.js → LoadingButton-JtnEy6x-.js} +1 -1
  30. package/dist/assets/{LockIcon-AR8ebEzv.js → LockIcon-BeIxsnPz.js} +1 -1
  31. package/dist/assets/{Meeting-CF-WhmPM.js → Meeting-BL7WF2AJ.js} +1 -1
  32. package/dist/assets/{MoreHoriz-DuOMe2bn.js → MoreHoriz-_l-lUoyq.js} +1 -1
  33. package/dist/assets/{MoreVert-UFPlWjze.js → MoreVert-T7jlVzCd.js} +1 -1
  34. package/dist/assets/{OffSick-CSP2kO-5.js → OffSick-D6JEPSYU.js} +1 -1
  35. package/dist/assets/{OpenInNew-6pTIeS0r.js → OpenInNew-Bh0ZyNdY.js} +1 -1
  36. package/dist/assets/{Public-Cm3uAF1d.js → Public-BieGltlg.js} +1 -1
  37. package/dist/assets/{Refresh-DsQW01Ya.js → Refresh-CtWiwbL8.js} +1 -1
  38. package/dist/assets/{SchemaReference.es-BPpguI5D.js → SchemaReference.es-CN84fzHD.js} +1 -1
  39. package/dist/assets/{Search-DnEqCvoa.js → Search-CzTpAOa9.js} +1 -1
  40. package/dist/assets/{Slider-DRcvOlgL.js → Slider-DNt5jJD4.js} +1 -1
  41. package/dist/assets/{Stepper-DfLckKIy.js → Stepper-EVvxFm-l.js} +1 -1
  42. package/dist/assets/{TableRow-BMSWmGPk.js → TableRow-Cr41eTmp.js} +1 -1
  43. package/dist/assets/{TableSearch-Dobasaj8.js → TableSearch-DBDA-JAl.js} +1 -1
  44. package/dist/assets/{ToggleButtonGroup-CfjCj__G.js → ToggleButtonGroup-CmondxKP.js} +1 -1
  45. package/dist/assets/{Verified-oP4ZelZh.js → Verified-BrGKKjLS.js} +1 -1
  46. package/dist/assets/{VerifiedUser-CzEMJOGM.js → VerifiedUser-T9tFwB9U.js} +1 -1
  47. package/dist/assets/{ViewColumn-BIPD356c.js → ViewColumn-CQJvMaMH.js} +1 -1
  48. package/dist/assets/{ViewList-BYQ2Wo2N.js → ViewList-BSeqocMD.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-B8U5I0AD.js → WorkingRemotely-DSoKGD6u.js} +1 -1
  50. package/dist/assets/{_createAggregator-BzC5cfxy.js → _createAggregator-CJSDSMg6.js} +1 -1
  51. package/dist/assets/{actions-C1blhdkh.js → actions-Bv3_VVES.js} +1 -1
  52. package/dist/assets/{actions-CIvfyQ4N.js → actions-R0k2zQ3B.js} +1 -1
  53. package/dist/assets/{agreement-BKAba3Bu.js → agreement--xEd5J2_.js} +1 -1
  54. package/dist/assets/api-DG7in6iX.js +1 -0
  55. package/dist/assets/{appearance-BT6nflvn.js → appearance-By8P7pS8.js} +1 -1
  56. package/dist/assets/{audit-logs-CxO1RKPM.js → audit-logs-axk4FVuN.js} +2 -2
  57. package/dist/assets/{blocklet-DgGtZNCB.js → blocklet-n2QLVVft.js} +1 -1
  58. package/dist/assets/{brace-fold.es-D7zHyRiF.js → brace-fold.es-CpmacDXy.js} +1 -1
  59. package/dist/assets/{chain-CMNZiwbz.js → chain-B3UsKW7l.js} +1 -1
  60. package/dist/assets/click-to-copy-BBx903lR.js +1 -0
  61. package/dist/assets/cloneDeep-DdAFYsMv.js +1 -0
  62. package/dist/assets/{closebrackets.es-BY2R-PDl.js → closebrackets.es-BPM7qcyy.js} +1 -1
  63. package/dist/assets/{codemirror.es-Bj7wxben.js → codemirror.es-rKm7-8so.js} +1 -1
  64. package/dist/assets/{comment.es-9NAetJeX.js → comment.es-cEEILSJL.js} +1 -1
  65. package/dist/assets/{config-navigation-BeyhoAYd.js → config-navigation-RVGkWDYS.js} +3 -3
  66. package/dist/assets/{connect-to-B2UoY2JL.js → connect-to-Cu2hr8Uh.js} +1 -1
  67. package/dist/assets/{delete-confirm-B0FL8Sx7.js → delete-confirm-C6MdS5sY.js} +1 -1
  68. package/dist/assets/{detail-Lgl7Opc1.js → detail-C1bo_0g-.js} +3 -3
  69. package/dist/assets/{dialog.es-CV929pYp.js → dialog.es-B1IFC9u6.js} +1 -1
  70. package/dist/assets/domains-2uhvPnPP.js +24 -0
  71. package/dist/assets/{download-IW0OxyHF.js → download-CNUneSlg.js} +1 -1
  72. package/dist/assets/emotion-react.browser.esm-Dyrm_eeQ.js +1 -0
  73. package/dist/assets/{foldgutter.es-D3SAnwjU.js → foldgutter.es-C2vuNFxa.js} +1 -1
  74. package/dist/assets/{get-safe-url-BQ9e1d8R.js → get-safe-url-Bs5i5FpE.js} +1 -1
  75. package/dist/assets/{get-safe-url-fVLOWjDv.js → get-safe-url-DfM7C7Hf.js} +1 -1
  76. package/dist/assets/getValidReactChildren-q1n8NmWG.js +1 -0
  77. package/dist/assets/{hint.es-xqBNEZOH.js → hint.es-DNy1bW-g.js} +1 -1
  78. package/dist/assets/{hint.es2-jX0Ikd_H.js → hint.es2-i7xguvxM.js} +1 -1
  79. package/dist/assets/{iframe-B52MZmUp.js → iframe-DWi9MO_j.js} +1 -1
  80. package/dist/assets/{index-yrfr0MWP.js → index-2OI_OVBD.js} +1 -1
  81. package/dist/assets/{index-DHqdVKlk.js → index-2rbYz989.js} +1 -1
  82. package/dist/assets/{index-CUdgGjYV.js → index-64gxJuGR.js} +1 -1
  83. package/dist/assets/{index-BFMlUu0x.js → index-9yi2bmN6.js} +1 -1
  84. package/dist/assets/{index-KdOmwCM0.js → index-AJgIDgSg.js} +51 -51
  85. package/dist/assets/index-B2GgL3-R.js +1 -0
  86. package/dist/assets/index-B2n80jby.js +1 -0
  87. package/dist/assets/{index-Bahrm-G8.js → index-BCr5STuV.js} +18 -18
  88. package/dist/assets/{index-B930dkB6.js → index-BFERjMXy.js} +1 -1
  89. package/dist/assets/{index-BEgDyH2G.js → index-BHiZELzY.js} +1 -1
  90. package/dist/assets/{index-Da_gY2p2.js → index-BLYEw0YZ.js} +1 -1
  91. package/dist/assets/{index-Btu7Neya.js → index-BLslsStt.js} +1 -1
  92. package/dist/assets/{index-BsoiXoFC.js → index-BMxCOuow.js} +1 -1
  93. package/dist/assets/{index-B8d6BDWi.js → index-BZL4w7FF.js} +1 -1
  94. package/dist/assets/{index-iW0yPyzE.js → index-BZOISQEj.js} +2 -2
  95. package/dist/assets/{index-n3NnSt8H.js → index-BdSP5x7V.js} +4 -4
  96. package/dist/assets/{index-Bpzwsd3f.js → index-BdlWUpNp.js} +6 -6
  97. package/dist/assets/{index-BcWvyuw8.js → index-BgnDgaOb.js} +1 -1
  98. package/dist/assets/{index-C8FhJ0rj.js → index-Bl_QpGg2.js} +1 -1
  99. package/dist/assets/{index-CiH2SOFi.js → index-BtW4iaLk.js} +3 -3
  100. package/dist/assets/{index-DPJjuq8y.js → index-C94nEH1q.js} +1 -1
  101. package/dist/assets/{index-CNElardu.js → index-CAL8SdA5.js} +1 -1
  102. package/dist/assets/{index-trVfBCte.js → index-CB14HOGE.js} +2 -2
  103. package/dist/assets/{index-BfvhxdN7.js → index-CEIvGGC0.js} +11 -11
  104. package/dist/assets/{index-Dzpr3qS7.js → index-CEvL1Y2e.js} +1 -1
  105. package/dist/assets/{index-BK_iEF6w.js → index-CUwFRYPb.js} +3 -3
  106. package/dist/assets/{index-DX8DEJlQ.js → index-CXdXz1YC.js} +1 -1
  107. package/dist/assets/{index-hmtP3oKe.js → index-CZQq2WZl.js} +1 -1
  108. package/dist/assets/{index-D6sUi9RT.js → index-CeEXyjqX.js} +1 -1
  109. package/dist/assets/{index-BerfqWKB.js → index-CotXQiFR.js} +1 -1
  110. package/dist/assets/{index-qxurOC9U.js → index-Cwlwz42P.js} +2 -2
  111. package/dist/assets/{index-DLm8Ub_j.js → index-Cy-HGAg5.js} +1 -1
  112. package/dist/assets/{index-BhA9P09u.js → index-D1Twij0A.js} +1 -1
  113. package/dist/assets/{index-DA7j-cev.js → index-D1Uv4Kgs.js} +1 -1
  114. package/dist/assets/{index-R7x7W7GB.js → index-D2LXsBcO.js} +5 -5
  115. package/dist/assets/{index-D6UMpm4p.js → index-D2TTRLM_.js} +1 -1
  116. package/dist/assets/{index-CZGd5QCZ.js → index-D69xZWqq.js} +8 -8
  117. package/dist/assets/{index-CFslc24J.js → index-DARRrmly.js} +2 -2
  118. package/dist/assets/{index-DydT7-LV.js → index-D_gKXPug.js} +1 -1
  119. package/dist/assets/{index-D_1_RyLT.js → index-DgyX9Ig4.js} +1 -1
  120. package/dist/assets/{index-D-wNDvqE.js → index-DiB0uZqA.js} +3 -3
  121. package/dist/assets/{index-DdLMocGE.js → index-DkSWwzPL.js} +1 -1
  122. package/dist/assets/{index-BNMAXWQI.js → index-Dtjsi5-M.js} +1 -1
  123. package/dist/assets/{index-DRmGM_hP.js → index-IJaA2JHH.js} +1 -1
  124. package/dist/assets/{index-CCAZAiY9.js → index-O5b_bdsU.js} +1 -1
  125. package/dist/assets/{index-Ce_kCGci.js → index-_Gn7XUOL.js} +1 -1
  126. package/dist/assets/{index-DATTQ5am.js → index-knEewVFB.js} +1 -1
  127. package/dist/assets/index-kof4JnLV.js +11 -0
  128. package/dist/assets/{index.esm-BZeAlIeN.js → index.esm-Bx7839pK.js} +1 -1
  129. package/dist/assets/{info-addon.es-C0ND8uqw.js → info-addon.es-B4Pyoy0-.js} +1 -1
  130. package/dist/assets/{info.es-B-kYc798.js → info.es-CtjlX5Wt.js} +1 -1
  131. package/dist/assets/{install-from-url-CV2FomzA.js → install-from-url-C2-00KT9.js} +1 -1
  132. package/dist/assets/{invitation-DH_bKwmI.js → invitation-D6T6DvBj.js} +6 -6
  133. package/dist/assets/is-path-prefix-equal-DPt6K58Y.js +1 -0
  134. package/dist/assets/{item-D5qxr3Lk.js → item-CeGXgGDh.js} +6 -6
  135. package/dist/assets/{javascript.es-CInOpinR.js → javascript.es-CBOLLNJA.js} +1 -1
  136. package/dist/assets/{jump-to-line.es-GaOpyMuN.js → jump-to-line.es-o70pn1AS.js} +1 -1
  137. package/dist/assets/{jump.es-4QMqZ0U2.js → jump.es-uAkOc1x-.js} +1 -1
  138. package/dist/assets/{lint.es-d-xQpru4.js → lint.es-Bq_aFvHE.js} +1 -1
  139. package/dist/assets/{lint.es2-r0w3QthM.js → lint.es2-QDUQ_yvH.js} +1 -1
  140. package/dist/assets/{lint.es3-Duz7LKWy.js → lint.es3-C8hQyDQ6.js} +1 -1
  141. package/dist/assets/{list-header-Dq6Hm5vy.js → list-header-CahJudHO.js} +1 -1
  142. package/dist/assets/{log-CTDXV8ap.js → log-B63Vehap.js} +1 -1
  143. package/dist/assets/{lottie-react.esm-Gf3LaMG1.js → lottie-react.esm-Dyp1pX0s.js} +1 -1
  144. package/dist/assets/{matchbrackets.es-ub9hnhHy.js → matchbrackets.es-DvsHeRkL.js} +1 -1
  145. package/dist/assets/{memory-Co7ZVOfU.js → memory-CB6HwuFd.js} +1 -1
  146. package/dist/assets/{mode.es-CK82ywlP.js → mode.es-BlitFOAg.js} +1 -1
  147. package/dist/assets/{mode.es2-gzITWIBC.js → mode.es2-D9kTW4A1.js} +1 -1
  148. package/dist/assets/{mode.es3-CrkiMbzK.js → mode.es3-C7GVv5Sh.js} +1 -1
  149. package/dist/assets/omit-lJaiB6eZ.js +1 -0
  150. package/dist/assets/{onlineParser.es-C1qjwyf6.js → onlineParser.es-B9GLO6bL.js} +1 -1
  151. package/dist/assets/{overview-WpAQD63O.js → overview-DMesSg9s.js} +2 -2
  152. package/dist/assets/payment-kit-DYSjmihw.png +0 -0
  153. package/dist/assets/{permission-DR4c0ARF.js → permission-bQJb4Wfm.js} +1 -1
  154. package/dist/assets/{preference-BJr6poQJ.js → preference-CQ9_K03t.js} +3 -3
  155. package/dist/assets/{raf-schd.esm-CKlBxZ4m.js → raf-schd.esm-xwaPYuT8.js} +1 -1
  156. package/dist/assets/refType-Dp49VYzY.js +1 -0
  157. package/dist/assets/{resource-dialog-CnEGcfR6.js → resource-dialog-CrF5TTZz.js} +30 -30
  158. package/dist/assets/{runtime-DiZdSvdg.js → runtime-ccgDKRXv.js} +1 -1
  159. package/dist/assets/{schema-CV3xzp1r.js → schema-BAt_zCax.js} +6 -6
  160. package/dist/assets/sdk-BmRwENgz.js +1 -0
  161. package/dist/assets/{search.es-DKqLEqET.js → search.es-BewIGLjB.js} +1 -1
  162. package/dist/assets/{searchcursor.es-BWMpJtYl.js → searchcursor.es-BWP24T39.js} +1 -1
  163. package/dist/assets/{service-B4aFqW1U.js → service-C6dR44t5.js} +1 -1
  164. package/dist/assets/{shorten-label-B1taCLSu.js → shorten-label-C5x3QBkr.js} +1 -1
  165. package/dist/assets/{show-hint.es-C1eZks_O.js → show-hint.es-DR7gTDpy.js} +1 -1
  166. package/dist/assets/{simple-select-BwOhhEqT.js → simple-select-Dk5PYcqy.js} +1 -1
  167. package/dist/assets/{spaces-BHOuJMC0.js → spaces-Qg7EXTlR.js} +1 -1
  168. package/dist/assets/{status-BVDByjVR.js → status-C6NwHG6t.js} +1 -1
  169. package/dist/assets/{status-CLTF7DgB.js → status-Dk-wVme-.js} +1 -1
  170. package/dist/assets/{sublime.es-J7__ylqM.js → sublime.es-Bpk1OuZ2.js} +1 -1
  171. package/dist/assets/{switch-control-k82I7Ndl.js → switch-control-BzAUWBUn.js} +1 -1
  172. package/dist/assets/{table-icons-C8h2igEk.js → table-icons-D5Z-kbr9.js} +36 -36
  173. package/dist/assets/{team-DTa9igye.js → team-CKxs_BXU.js} +1 -1
  174. package/dist/assets/{toLower-CV1JKc77.js → toLower-DoLsoIUi.js} +1 -1
  175. package/dist/assets/toUpper-Bsu2hQC1.js +1 -0
  176. package/dist/assets/{traffic-BZMRS6o_.js → traffic-CmwKqX64.js} +2 -2
  177. package/dist/assets/{url-evaluation-BMmqZ9Xm.js → url-evaluation-CyY2eIYi.js} +1 -1
  178. package/dist/assets/{url-join-3G2iekWy.js → url-join-D3UI4kOJ.js} +1 -1
  179. package/dist/assets/{use-mobile-C-Ki3d1-.js → use-mobile-BO6wzlhh.js} +1 -1
  180. package/dist/assets/{use-mobile-4pPVTaiA.js → use-mobile-DzTdFIlX.js} +1 -1
  181. package/dist/assets/{useAsync-W0rAsXlK.js → useAsync-Ch7FfDvD.js} +1 -1
  182. package/dist/assets/{useLocalStorage-DqX-zdwD.js → useLocalStorage-DErQTCC8.js} +1 -1
  183. package/dist/assets/{useThemeProps-BT_RONtx.js → useThemeProps-DI7JqlIy.js} +1 -1
  184. package/dist/assets/{util-CR3vtO32.js → util-CiEXZkzA.js} +1 -1
  185. package/dist/assets/{wait-container-D3DtxHI5.js → wait-container-DFgs_ycx.js} +1 -1
  186. package/dist/assets/{withStyles-DQtqSL4M.js → withStyles-D9pc_Gr2.js} +1 -1
  187. package/dist/assets/wrap-locale-Cw7rRT3-.js +1 -0
  188. package/dist/index.html +1 -1
  189. package/dist/service-worker.js +1 -1
  190. package/package.json +1 -1
  191. package/dist/assets/api-BhAwS4V8.js +0 -1
  192. package/dist/assets/click-to-copy-mgHOJgOu.js +0 -1
  193. package/dist/assets/cloneDeep-C8Xz4lYT.js +0 -1
  194. package/dist/assets/domains-BnwU8REn.js +0 -24
  195. package/dist/assets/emotion-react.browser.esm-DwA9twTe.js +0 -1
  196. package/dist/assets/getValidReactChildren-BybUhg_p.js +0 -1
  197. package/dist/assets/index-B3-cD9IV.js +0 -1
  198. package/dist/assets/index-DNHgOX2L.js +0 -1
  199. package/dist/assets/index-DjPLbVUc.js +0 -11
  200. package/dist/assets/is-path-prefix-equal-Cl2q8kGU.js +0 -1
  201. package/dist/assets/omit-BE_Bff1I.js +0 -1
  202. package/dist/assets/refType-BFp6Mdcn.js +0 -1
  203. package/dist/assets/toUpper-CIse071F.js +0 -1
  204. package/dist/assets/wrap-locale-DB1j-LK3.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0 as ke,kZ as Qo,bb as Xo,j as t,c7 as ht,c8 as Jt,b$ as Jo,bZ as es,f2 as ts,hL as ns,k_ as os,aQ as Ct,aR as vt,m as W,bs as Z,N as y,aC as Ce,P as a,z as L,an as bt,f as be,bH as Fe,b as Y,J as B,Y as zt,bG as Xe,v as H,n as $,Z as ae,k$ as ss,a6 as X,a_ as vo,k as ne,D as jt,b6 as rs,gM as is,gN as as,d_ as ls,C as pe,fN as cs,x as ds,aA as eo,a4 as Rt,w as us,l0 as ps,l1 as ms,B as le,l2 as fs,$ as hs,a0 as gs,l3 as bo,bt as jo,V as ye,dB as xs,dO as ys,aE as Cs,aF as vs,aG as bs,aI as Q,aT as js,cO as Rs,F as Ro,bp as Ss,a1 as ws,O as dt,aH as So,b2 as en,l4 as Ts,b3 as ve,aD as to,cM as Es,k1 as ks,E as N,ag as ze,aP as wo,bY as tn,cC as Ps,L as St,l5 as _s,bd as Is,y as To,aZ as Vt,T as Ds,aX as Qe,ay as Mt,W as Ns,bI as Eo,gL as Us,cw as Ls,aL as Bs,bA as Os,aW as As,ek as $s,fX as no,l6 as oo,hb as so,X as ro,G as ut,cL as Ms,hc as qs,bX as Gs,k2 as Ws}from"./index-KdOmwCM0.js";import{d as Fs}from"./Add-B5o3lKZ4.js";import{E as zs}from"./index-D6UMpm4p.js";import{c as Vs,e as Ys,f as Ks,u as nn,a as Hs}from"./actions-CIvfyQ4N.js";import{S as Zs}from"./switch-control-k82I7Ndl.js";import{u as me}from"./blocklet-DgGtZNCB.js";import{P as Yt,w as wt}from"./permission-DR4c0ARF.js";import{d as ko}from"./Edit-D9oke1qz.js";import{T as Qs,M as Xs,t as Js}from"./table-icons-C8h2igEk.js";import{C as io}from"./click-to-copy-mgHOJgOu.js";import{d as on}from"./Link-V0zXa94b.js";import{c as er,C as tr,b as nr,s as Po,e as or,z as sr,d as _o,a as rr,A as ir,B as ar,f as lr,S as cr}from"./item-D5qxr3Lk.js";import{u as dr,a as ur,P as Io,L as ao,A as pr,S as mr}from"./index-DRmGM_hP.js";import{u as fr,C as hr,D as gr,a as xr,b as yr}from"./connect-to-B2UoY2JL.js";import{C as Cr,u as vr,A as br}from"./agreement-BKAba3Bu.js";import{R as ft,F as jr,L as Rr,d as Sr,B as wr}from"./preference-BJr6poQJ.js";import{d as Tr}from"./Done-CasEZEMQ.js";import{C as Er,L as kr}from"./LockIcon-AR8ebEzv.js";import{I as Pr,a as _r,f as Ir,B as Dr}from"./install-from-url-CV2FomzA.js";import{a as lo}from"./api-BhAwS4V8.js";import{v as Do,e as Nr,a as gt}from"./util-CR3vtO32.js";import{u as No}from"./use-mobile-4pPVTaiA.js";import{d as Ur}from"./ArrowDropDown-RVN4Mn-W.js";import{_ as Lr}from"./useLocalStorage-DqX-zdwD.js";import{d as Tt}from"./Delete-DpNbJCJA.js";import{d as Uo}from"./Launch-9QmeNFGh.js";import{D as Br}from"./delete-confirm-B0FL8Sx7.js";import{W as Je,R as Or,a as co}from"./url-evaluation-BMmqZ9Xm.js";import{B as Lo}from"./status-BVDByjVR.js";import{A as Bo}from"./actions-C1blhdkh.js";import{I as qt}from"./index-yrfr0MWP.js";import{t as Ar}from"./toUpper-CIse071F.js";import{a as $r}from"./index-DA7j-cev.js";import{a as Mr}from"./team-DTa9igye.js";import"./MoreVert-UFPlWjze.js";import"./get-safe-url-fVLOWjDv.js";import"./ButtonGroup-DP9Um2zw.js";import"./getValidReactChildren-BybUhg_p.js";import"./raf-schd.esm-CKlBxZ4m.js";import"./index-Btu7Neya.js";import"./ViewColumn-BIPD356c.js";import"./CSSTransition-Ce16mrqT.js";import"./index-DPJjuq8y.js";import"./Clear-C7odY-6_.js";import"./ChevronRight-sZUpX7tH.js";import"./ChevronLeft-CVA4N8rQ.js";import"./Search-DnEqCvoa.js";import"./index-C8FhJ0rj.js";import"./Autocomplete-DHpI8PP1.js";import"./ListSubheader-r9QVg4z3.js";import"./Verified-oP4ZelZh.js";import"./VerifiedUser-CzEMJOGM.js";import"./DeleteOutline-B4zcgGCZ.js";import"./url-join-3G2iekWy.js";import"./Close-w8eKEJW7.js";import"./index-CFslc24J.js";import"./OpenInNew-6pTIeS0r.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-B-3RVeU3.js";import"./index-D6sUi9RT.js";import"./spaces-BHOuJMC0.js";import"./index-BNMAXWQI.js";import"./index-DHqdVKlk.js";import"./iframe-B52MZmUp.js";import"./cloneDeep-C8Xz4lYT.js";import"./schema-CV3xzp1r.js";import"./index-DX8DEJlQ.js";import"./ListItemButton-Drq6UK1v.js";import"./Stepper-DfLckKIy.js";import"./is-path-prefix-equal-Cl2q8kGU.js";import"./MoreHoriz-DuOMe2bn.js";const Oo=m.createContext({});function qr(e){return Zt("MuiAccordion",e)}const pt=Ht("MuiAccordion",["root","rounded","expanded","disabled","gutters","region"]),Gr=["children","className","defaultExpanded","disabled","disableGutters","expanded","onChange","square","slots","slotProps","TransitionComponent","TransitionProps"],Wr=e=>{const{classes:n,square:o,expanded:i,disabled:s,disableGutters:r}=e;return Jt({root:["root",!o&&"rounded",i&&"expanded",s&&"disabled",!r&&"gutters"],region:["region"]},qr,n)},Fr=Pe(Ho,{name:"MuiAccordion",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:o}=e;return[{[`& .${pt.region}`]:n.region},n.root,!o.square&&n.rounded,!o.disableGutters&&n.gutters]}})(({theme:e})=>{const n={duration:e.transitions.duration.shortest};return{position:"relative",transition:e.transitions.create(["margin"],n),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create(["opacity","background-color"],n)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${pt.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${pt.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}},({theme:e})=>({variants:[{props:n=>!n.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:n=>!n.disableGutters,style:{[`&.${pt.expanded}`]:{margin:"16px 0"}}}]})),zr=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordion"}),{children:s,className:r,defaultExpanded:h=!1,disabled:c=!1,disableGutters:u=!1,expanded:x,onChange:g,square:l=!1,slots:b={},slotProps:d={},TransitionComponent:k,TransitionProps:S}=i,R=Xt(i,Gr),[E,C]=Zo({controlled:x,default:h,name:"Accordion",state:"expanded"}),f=m.useCallback(oe=>{C(!E),g&&g(oe,!E)},[E,g,C]),[p,...j]=m.Children.toArray(s),w=m.useMemo(()=>({expanded:E,disabled:c,disableGutters:u,toggle:f}),[E,c,u,f]),v=ke({},i,{square:l,disabled:c,disableGutters:u,expanded:E}),U=Wr(v),O=ke({transition:k},b),K=ke({transition:S},d),[I,J]=Qo("transition",{elementType:Xo,externalForwardedProps:{slots:O,slotProps:K},ownerState:v});return t.jsxs(Fr,ke({className:ht(U.root,r),ref:o,ownerState:v,square:l},R,{children:[t.jsx(Oo.Provider,{value:w,children:p}),t.jsx(I,ke({in:E,timeout:"auto"},J,{children:t.jsx("div",{"aria-labelledby":p.props.id,id:p.props["aria-controls"],role:"region",className:U.region,children:j})}))]}))});function Vr(e){return Zt("MuiAccordionDetails",e)}Ht("MuiAccordionDetails",["root"]);const Yr=["className"],Kr=e=>{const{classes:n}=e;return Jt({root:["root"]},Vr,n)},Hr=Pe("div",{name:"MuiAccordionDetails",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>({padding:e.spacing(1,2,2)})),Zr=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordionDetails"}),{className:s}=i,r=Xt(i,Yr),h=i,c=Kr(h);return t.jsx(Hr,ke({className:ht(c.root,s),ref:o,ownerState:h},r))});function Qr(e){return Zt("MuiAccordionSummary",e)}const We=Ht("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","contentGutters","content","expandIconWrapper"]),Xr=["children","className","expandIcon","focusVisibleClassName","onClick"],Jr=e=>{const{classes:n,expanded:o,disabled:i,disableGutters:s}=e;return Jt({root:["root",o&&"expanded",i&&"disabled",!s&&"gutters"],focusVisible:["focusVisible"],content:["content",o&&"expanded",!s&&"contentGutters"],expandIconWrapper:["expandIconWrapper",o&&"expanded"]},Qr,n)},ei=Pe(Jo,{name:"MuiAccordionSummary",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>{const n={duration:e.transitions.duration.shortest};return{display:"flex",minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create(["min-height","background-color"],n),[`&.${We.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${We.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${We.disabled})`]:{cursor:"pointer"},variants:[{props:o=>!o.disableGutters,style:{[`&.${We.expanded}`]:{minHeight:64}}}]}}),ti=Pe("div",{name:"MuiAccordionSummary",slot:"Content",overridesResolver:(e,n)=>n.content})(({theme:e})=>({display:"flex",flexGrow:1,margin:"12px 0",variants:[{props:n=>!n.disableGutters,style:{transition:e.transitions.create(["margin"],{duration:e.transitions.duration.shortest}),[`&.${We.expanded}`]:{margin:"20px 0"}}}]})),ni=Pe("div",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper",overridesResolver:(e,n)=>n.expandIconWrapper})(({theme:e})=>({display:"flex",color:(e.vars||e).palette.action.active,transform:"rotate(0deg)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shortest}),[`&.${We.expanded}`]:{transform:"rotate(180deg)"}})),oi=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordionSummary"}),{children:s,className:r,expandIcon:h,focusVisibleClassName:c,onClick:u}=i,x=Xt(i,Xr),{disabled:g=!1,disableGutters:l,expanded:b,toggle:d}=m.useContext(Oo),k=E=>{d&&d(E),u&&u(E)},S=ke({},i,{expanded:b,disabled:g,disableGutters:l}),R=Jr(S);return t.jsxs(ei,ke({focusRipple:!1,disableRipple:!0,disabled:g,component:"div","aria-expanded":b,className:ht(R.root,r),focusVisibleClassName:ht(R.focusVisible,c),onClick:k,ref:o,ownerState:S},x,{children:[t.jsx(ti,{className:R.content,ownerState:S,children:s}),h&&t.jsx(ni,{className:R.expandIconWrapper,ownerState:S,children:h})]}))}),si=es(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");function uo(e,n){var o={};return n=ts(n),ns(e,function(i,s,r){os(o,s,n(i,s,r))}),o}var sn={},ri=vt;Object.defineProperty(sn,"__esModule",{value:!0});var Ao=sn.default=void 0,ii=ri(Ct()),ai=t;Ao=sn.default=(0,ii.default)((0,ai.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");var rn={},li=vt;Object.defineProperty(rn,"__esModule",{value:!0});var an=rn.default=void 0,ci=li(Ct()),di=t;an=rn.default=(0,ci.default)((0,di.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function ln({children:e,...n}){var x;const{t:o}=W(),{api:i}=Z(),{blocklet:s}=me(),r=(x=s==null?void 0:s.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await i.updateAutoCheckUpdate({input:{did:s.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(r!=null&&r.enabled);await h({enabled:g}),L.success(o(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},u=!!(r!=null&&r.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:o("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Zs,{checked:u,onChange:c,name:"enableWelcomePage",style:{...n.style,zoom:.8}})})})]})}ln.propTypes={children:a.any};ln.defaultProps={children:null};function po(e){function n({sx:o,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...o}})}return n}const ui={...uo(Js,po),...uo(Vs,po)},pi=(e,n)=>{let{description:o}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(o?o=`${o} (${n("blocklet.config.sharedToAllComponents")})`:o=n("blocklet.config.sharedToAllComponents")),o&&t.jsx("div",{style:{marginLeft:12},children:o})},Gt=(e,n,o=[])=>!(o!=null&&o.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!n.meta.environments.find(i=>i.name===e.key)&&n.children.every(i=>!i.meta.environments.find(s=>s.name===e.key))?!0:e.custom,mo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Wt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function cn({blocklet:e,ancestors:n}){const o=Z(),{palette:i}=bt(),{inService:s}=o,{t:r}=m.useContext(be),h=[...n.map(f=>f.meta.did),e.meta.did],c=()=>L.success(r("blocklet.config.changedTip")),u=f=>Gt(f,e,n);if(Fe(e.status)||e.status==="unknown"&&Fe(e.status))return null;const x=f=>new Promise(async(p,j)=>{if(!f.key.trim()||!f.value.trim()){L.error(r("blocklet.config.environment.keyValueRequired")),j();return}if(mo(f.key)===!1){L.error(r("blocklet.config.environment.invalidKey")),j();return}f.custom=Wt(f.key);try{const w=await o.api.configBlocklet({input:{did:h,configs:[f]}});c(w.blocklet),p()}catch(w){L.error(ae(w)),j()}}),g=(f,p)=>new Promise(async(j,w)=>{if(f.required&&(!f.key.trim()||!f.value.trim())){L.error(r("blocklet.config.environment.keyValueRequired")),w();return}if(mo(f.key)===!1){L.error(r("blocklet.config.environment.invalidKey")),w();return}if(f.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const U=ss(f);if(U){L.error(U),w();return}}const v=[{...f,value:f.secure&&f.value==="__encrypted__"?"":f.value}];if(f.key!==p.key){if(!Gt(f,e,n)){L.error("Only key of custom env can be changed"),w();return}v.push({key:p.key,custom:Wt(f.key)})}try{const U=await o.api.configBlocklet({input:{did:h,configs:v}});c(U.blocklet),j()}catch(U){L.error(ae(U)),w()}}),l=f=>new Promise(async(p,j)=>{if(f.required){L.error(r("blocklet.config.environment.deleteForbidden")),j();return}if(!Gt(f,e,n)){L.error("Only key of custom env can be changed"),j();return}try{const w=await o.api.configBlocklet({input:{did:h,configs:[{key:f.key,custom:Wt(f.key)}]}});c(w.blocklet),p()}catch(w){L.error(ae(w)),j()}}),b=(e.configs||[]).filter(f=>!Y.BLOCKLET_CONFIGURABLE_KEY[f.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(f.key)),d=B.getSharedConfigObj(n[0],e),k=B.getComponentMissingConfigs(e,n[0]),S=b.map(f=>({...f,value:Object.values(Y.CHAIN_PROP_MAP).includes(f.key)&&Object.keys(d).includes(f.key)?d[f.key]:d[f.key]||f.value})),R=S.some(f=>f.key&&f.key.startsWith("BWA_")),E={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:u},C=()=>[{title:r("common.key"),field:"key",initialEditValue:"",width:"30%",render:f=>t.jsx(io,{value:f.value,style:{color:f.required&&!f.value?i.error.main:i.text.primary,fontWeight:f.required?"bold":"normal"},children:f.key}),editComponent:f=>{const{value:p,rowData:j,onChange:w}=f;return t.jsx(fo,{children:t.jsx(H,{fullWidth:!0,size:"small",disabled:u(j)===!1,value:p,onChange:v=>w(v.target.value),variant:"outlined",label:"Key",placeholder:r("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:r("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:f=>f.value?f.secure?"******":t.jsx(io,{unstyled:!0,value:f.value,style:{wordBreak:"break-all"},children:f.value}):null,editComponent:f=>{const{value:p,rowData:j,onChange:w}=f;return t.jsxs(fo,{children:[t.jsx(H,{fullWidth:!0,size:"small",value:p==="__encrypted__"?"":p,onChange:v=>w(v.target.value),variant:"outlined",label:r("common.value"),placeholder:r("blocklet.config.environment.value"),margin:"dense"}),pi(j,r)]})}}];return t.jsxs(mi,{children:[!!k.length&&t.jsx(zt,{severity:"error",style:{marginTop:24},children:r("blocklet.config.missingRequired")}),R&&t.jsx(zt,{severity:"info",children:r("blocklet.config.environment.tip")}),t.jsx(Yt,{permission:s?"":"mutate_blocklets",role:s?Xe:[],children:f=>t.jsx(Qs,{className:"config-table",children:t.jsx(Xs,{title:t.jsx(y,{fontWeight:"bold",children:r("common.environments")}),columns:C(),icons:ui,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:r("common.actions")},body:{emptyDataSourceMessage:r("common.noData")}},data:S,editable:f?E:{}})})})]})}cn.propTypes={blocklet:a.object.isRequired,ancestors:a.array};cn.defaultProps={ancestors:[]};const mi=$.div`
1
+ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e5 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0 as ke,k_ as Qo,bb as Xo,j as t,c7 as ht,c8 as Jt,b$ as Jo,bZ as es,f1 as ts,hM as ns,k$ as os,aQ as Ct,aR as vt,m as W,bs as Z,N as y,aC as Ce,P as a,z as L,an as bt,f as be,bH as Fe,b as Y,J as B,Y as zt,bG as Xe,v as H,n as $,Z as ae,l0 as ss,a6 as X,a_ as vo,k as ne,D as jt,b6 as rs,gL as is,gM as as,dZ as ls,C as pe,fM as cs,x as ds,aA as eo,a4 as Rt,w as us,l1 as ps,l2 as ms,B as le,l3 as fs,$ as hs,a0 as gs,l4 as bo,bt as jo,V as ye,dA as xs,dN as ys,aE as Cs,aF as vs,aG as bs,aI as Q,aT as js,cO as Rs,F as Ro,bp as Ss,a1 as ws,O as dt,aH as So,b2 as en,l5 as Ts,b3 as ve,aD as to,cM as Es,k2 as ks,E as N,ag as ze,aP as wo,bY as tn,cC as Ps,L as St,l6 as Is,bd as _s,y as To,aZ as Vt,T as Ds,aX as Qe,ay as Mt,W as Ns,bI as Eo,gK as Us,cw as Ls,aL as Bs,bA as Os,aW as As,ej as $s,fW as no,l7 as oo,hb as so,X as ro,G as ut,cL as Ms,hc as qs,bX as Gs,k3 as Ws}from"./index-AJgIDgSg.js";import{d as Fs}from"./Add-DyqE7ma4.js";import{E as zs}from"./index-D2TTRLM_.js";import{c as Vs,e as Ys,f as Ks,u as nn,a as Hs}from"./actions-R0k2zQ3B.js";import{S as Zs}from"./switch-control-BzAUWBUn.js";import{u as me}from"./blocklet-n2QLVVft.js";import{P as Yt,w as wt}from"./permission-bQJb4Wfm.js";import{d as ko}from"./Edit-qCwSqHzK.js";import{T as Qs,M as Xs,t as Js}from"./table-icons-D5Z-kbr9.js";import{C as io}from"./click-to-copy-BBx903lR.js";import{d as on}from"./Link-BJsvTgLA.js";import{c as er,C as tr,b as nr,s as Po,e as or,z as sr,d as Io,a as rr,A as ir,B as ar,f as lr,S as cr}from"./item-CeGXgGDh.js";import{u as dr,a as ur,P as _o,L as ao,A as pr,S as mr}from"./index-IJaA2JHH.js";import{u as fr,C as hr,D as gr,a as xr,b as yr}from"./connect-to-Cu2hr8Uh.js";import{C as Cr,u as vr,A as br}from"./agreement--xEd5J2_.js";import{R as ft,F as jr,L as Rr,d as Sr,B as wr}from"./preference-CQ9_K03t.js";import{d as Tr}from"./Done-LO8W9lyO.js";import{C as Er,L as kr}from"./LockIcon-BeIxsnPz.js";import{I as Pr,a as Ir,f as _r,B as Dr}from"./install-from-url-C2-00KT9.js";import{a as lo}from"./api-DG7in6iX.js";import{v as Do,e as Nr,a as gt}from"./util-CiEXZkzA.js";import{u as No}from"./use-mobile-DzTdFIlX.js";import{d as Ur}from"./ArrowDropDown-srvJwv_s.js";import{_ as Lr}from"./useLocalStorage-DErQTCC8.js";import{d as Tt}from"./Delete-X-iZLu8W.js";import{d as Uo}from"./Launch-CbHu_JiN.js";import{D as Br}from"./delete-confirm-C6MdS5sY.js";import{W as Je,R as Or,a as co}from"./url-evaluation-CyY2eIYi.js";import{B as Lo}from"./status-C6NwHG6t.js";import{A as Bo}from"./actions-Bv3_VVES.js";import{I as qt}from"./index-2OI_OVBD.js";import{t as Ar}from"./toUpper-Bsu2hQC1.js";import{a as $r}from"./index-D1Uv4Kgs.js";import{a as Mr}from"./team-CKxs_BXU.js";import"./MoreVert-T7jlVzCd.js";import"./get-safe-url-DfM7C7Hf.js";import"./ButtonGroup-CETfqQqG.js";import"./getValidReactChildren-q1n8NmWG.js";import"./raf-schd.esm-xwaPYuT8.js";import"./index-BLslsStt.js";import"./ViewColumn-CQJvMaMH.js";import"./CSSTransition-8GXDrEVI.js";import"./index-C94nEH1q.js";import"./Clear-C23RMA8O.js";import"./ChevronRight-B3ioYqvf.js";import"./ChevronLeft-CQJA5jUj.js";import"./Search-CzTpAOa9.js";import"./index-Bl_QpGg2.js";import"./Autocomplete-DgD7oXbC.js";import"./ListSubheader-C2HVg1lq.js";import"./Verified-BrGKKjLS.js";import"./VerifiedUser-T9tFwB9U.js";import"./DeleteOutline-CBtSJ3uj.js";import"./url-join-D3UI4kOJ.js";import"./Close-CMKp87zW.js";import"./index-DARRrmly.js";import"./OpenInNew-Bh0ZyNdY.js";import"./index-BJHGOv7L.js";import"./index-BojVbZw0.js";import"./HelpOutline-B7KAkB_W.js";import"./index-CeEXyjqX.js";import"./spaces-Qg7EXTlR.js";import"./index-Dtjsi5-M.js";import"./index-2rbYz989.js";import"./iframe-DWi9MO_j.js";import"./cloneDeep-DdAFYsMv.js";import"./schema-BAt_zCax.js";import"./index-CXdXz1YC.js";import"./ListItemButton-DU8Ok_s-.js";import"./Stepper-EVvxFm-l.js";import"./is-path-prefix-equal-DPt6K58Y.js";import"./MoreHoriz-_l-lUoyq.js";const Oo=m.createContext({});function qr(e){return Zt("MuiAccordion",e)}const pt=Ht("MuiAccordion",["root","rounded","expanded","disabled","gutters","region"]),Gr=["children","className","defaultExpanded","disabled","disableGutters","expanded","onChange","square","slots","slotProps","TransitionComponent","TransitionProps"],Wr=e=>{const{classes:n,square:o,expanded:i,disabled:s,disableGutters:r}=e;return Jt({root:["root",!o&&"rounded",i&&"expanded",s&&"disabled",!r&&"gutters"],region:["region"]},qr,n)},Fr=Pe(Ho,{name:"MuiAccordion",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:o}=e;return[{[`& .${pt.region}`]:n.region},n.root,!o.square&&n.rounded,!o.disableGutters&&n.gutters]}})(({theme:e})=>{const n={duration:e.transitions.duration.shortest};return{position:"relative",transition:e.transitions.create(["margin"],n),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create(["opacity","background-color"],n)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${pt.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${pt.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}},({theme:e})=>({variants:[{props:n=>!n.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:n=>!n.disableGutters,style:{[`&.${pt.expanded}`]:{margin:"16px 0"}}}]})),zr=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordion"}),{children:s,className:r,defaultExpanded:h=!1,disabled:c=!1,disableGutters:u=!1,expanded:x,onChange:g,square:l=!1,slots:b={},slotProps:d={},TransitionComponent:k,TransitionProps:S}=i,R=Xt(i,Gr),[E,C]=Zo({controlled:x,default:h,name:"Accordion",state:"expanded"}),f=m.useCallback(oe=>{C(!E),g&&g(oe,!E)},[E,g,C]),[p,...j]=m.Children.toArray(s),w=m.useMemo(()=>({expanded:E,disabled:c,disableGutters:u,toggle:f}),[E,c,u,f]),v=ke({},i,{square:l,disabled:c,disableGutters:u,expanded:E}),U=Wr(v),O=ke({transition:k},b),K=ke({transition:S},d),[_,J]=Qo("transition",{elementType:Xo,externalForwardedProps:{slots:O,slotProps:K},ownerState:v});return t.jsxs(Fr,ke({className:ht(U.root,r),ref:o,ownerState:v,square:l},R,{children:[t.jsx(Oo.Provider,{value:w,children:p}),t.jsx(_,ke({in:E,timeout:"auto"},J,{children:t.jsx("div",{"aria-labelledby":p.props.id,id:p.props["aria-controls"],role:"region",className:U.region,children:j})}))]}))});function Vr(e){return Zt("MuiAccordionDetails",e)}Ht("MuiAccordionDetails",["root"]);const Yr=["className"],Kr=e=>{const{classes:n}=e;return Jt({root:["root"]},Vr,n)},Hr=Pe("div",{name:"MuiAccordionDetails",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>({padding:e.spacing(1,2,2)})),Zr=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordionDetails"}),{className:s}=i,r=Xt(i,Yr),h=i,c=Kr(h);return t.jsx(Hr,ke({className:ht(c.root,s),ref:o,ownerState:h},r))});function Qr(e){return Zt("MuiAccordionSummary",e)}const We=Ht("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","contentGutters","content","expandIconWrapper"]),Xr=["children","className","expandIcon","focusVisibleClassName","onClick"],Jr=e=>{const{classes:n,expanded:o,disabled:i,disableGutters:s}=e;return Jt({root:["root",o&&"expanded",i&&"disabled",!s&&"gutters"],focusVisible:["focusVisible"],content:["content",o&&"expanded",!s&&"contentGutters"],expandIconWrapper:["expandIconWrapper",o&&"expanded"]},Qr,n)},ei=Pe(Jo,{name:"MuiAccordionSummary",slot:"Root",overridesResolver:(e,n)=>n.root})(({theme:e})=>{const n={duration:e.transitions.duration.shortest};return{display:"flex",minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create(["min-height","background-color"],n),[`&.${We.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${We.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${We.disabled})`]:{cursor:"pointer"},variants:[{props:o=>!o.disableGutters,style:{[`&.${We.expanded}`]:{minHeight:64}}}]}}),ti=Pe("div",{name:"MuiAccordionSummary",slot:"Content",overridesResolver:(e,n)=>n.content})(({theme:e})=>({display:"flex",flexGrow:1,margin:"12px 0",variants:[{props:n=>!n.disableGutters,style:{transition:e.transitions.create(["margin"],{duration:e.transitions.duration.shortest}),[`&.${We.expanded}`]:{margin:"20px 0"}}}]})),ni=Pe("div",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper",overridesResolver:(e,n)=>n.expandIconWrapper})(({theme:e})=>({display:"flex",color:(e.vars||e).palette.action.active,transform:"rotate(0deg)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shortest}),[`&.${We.expanded}`]:{transform:"rotate(180deg)"}})),oi=m.forwardRef(function(n,o){const i=Qt({props:n,name:"MuiAccordionSummary"}),{children:s,className:r,expandIcon:h,focusVisibleClassName:c,onClick:u}=i,x=Xt(i,Xr),{disabled:g=!1,disableGutters:l,expanded:b,toggle:d}=m.useContext(Oo),k=E=>{d&&d(E),u&&u(E)},S=ke({},i,{expanded:b,disabled:g,disableGutters:l}),R=Jr(S);return t.jsxs(ei,ke({focusRipple:!1,disableRipple:!0,disabled:g,component:"div","aria-expanded":b,className:ht(R.root,r),focusVisibleClassName:ht(R.focusVisible,c),onClick:k,ref:o,ownerState:S},x,{children:[t.jsx(ti,{className:R.content,ownerState:S,children:s}),h&&t.jsx(ni,{className:R.expandIconWrapper,ownerState:S,children:h})]}))}),si=es(t.jsx("path",{d:"M14.17 5 19 9.83V19H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59M7 15h10v2H7zm0-4h10v2H7zm0-4h7v2H7z"}),"TextSnippetOutlined");function uo(e,n){var o={};return n=ts(n),ns(e,function(i,s,r){os(o,s,n(i,s,r))}),o}var sn={},ri=vt;Object.defineProperty(sn,"__esModule",{value:!0});var Ao=sn.default=void 0,ii=ri(Ct()),ai=t;Ao=sn.default=(0,ii.default)((0,ai.jsx)("path",{d:"M21 10.12h-6.78l2.74-2.82c-2.73-2.7-7.15-2.8-9.88-.1-2.73 2.71-2.73 7.08 0 9.79s7.15 2.71 9.88 0C18.32 15.65 19 14.08 19 12.1h2c0 1.98-.88 4.55-2.64 6.29-3.51 3.48-9.21 3.48-12.72 0-3.5-3.47-3.53-9.11-.02-12.58s9.14-3.47 12.65 0L21 3zM12.5 8v4.25l3.5 2.08-.72 1.21L11 13V8z"}),"Update");var rn={},li=vt;Object.defineProperty(rn,"__esModule",{value:!0});var an=rn.default=void 0,ci=li(Ct()),di=t;an=rn.default=(0,ci.default)((0,di.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined");function ln({children:e,...n}){var x;const{t:o}=W(),{api:i}=Z(),{blocklet:s}=me(),r=(x=s==null?void 0:s.settings)==null?void 0:x.autoCheckUpdate,h=async g=>{await i.updateAutoCheckUpdate({input:{did:s.meta.did,autoCheckUpdate:g}})},c=async()=>{try{const g=!(r!=null&&r.enabled);await h({enabled:g}),L.success(o(g?"storage.spaces.autoCheckUpdate.enabled":"storage.spaces.autoCheckUpdate.disabled"))}catch(g){L.error(g.message)}},u=!!(r!=null&&r.enabled);return t.jsxs(y,{display:"flex",flexDirection:"row",alignItems:"center",children:[e,t.jsx(Ce,{title:o("storage.spaces.autoCheckUpdate.title"),arrow:!0,placement:"right",children:t.jsx("div",{children:t.jsx(Zs,{checked:u,onChange:c,name:"enableWelcomePage",style:{...n.style,zoom:.8}})})})]})}ln.propTypes={children:a.any};ln.defaultProps={children:null};function po(e){function n({sx:o,...i}){return t.jsx(e,{...i,sx:{color:"text.primary",...o}})}return n}const ui={...uo(Js,po),...uo(Vs,po)},pi=(e,n)=>{let{description:o}=e;return(Object.values(Y.CHAIN_PROP_MAP).includes(e.key)||B.isEnvShareable(e))&&(o?o=`${o} (${n("blocklet.config.sharedToAllComponents")})`:o=n("blocklet.config.sharedToAllComponents")),o&&t.jsx("div",{style:{marginLeft:12},children:o})},Gt=(e,n,o=[])=>!(o!=null&&o.length)&&!e.custom&&!["CHAIN_ID","CHAIN_HOST"].includes(e.key)&&!n.meta.environments.find(i=>i.name===e.key)&&n.children.every(i=>!i.meta.environments.find(s=>s.name===e.key))?!0:e.custom,mo=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)?!0:!(e.startsWith("BLOCKLET_")||e.startsWith("COMPONENT_")),Wt=e=>[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(e)===!1;function cn({blocklet:e,ancestors:n}){const o=Z(),{palette:i}=bt(),{inService:s}=o,{t:r}=m.useContext(be),h=[...n.map(f=>f.meta.did),e.meta.did],c=()=>L.success(r("blocklet.config.changedTip")),u=f=>Gt(f,e,n);if(Fe(e.status)||e.status==="unknown"&&Fe(e.status))return null;const x=f=>new Promise(async(p,j)=>{if(!f.key.trim()||!f.value.trim()){L.error(r("blocklet.config.environment.keyValueRequired")),j();return}if(mo(f.key)===!1){L.error(r("blocklet.config.environment.invalidKey")),j();return}f.custom=Wt(f.key);try{const w=await o.api.configBlocklet({input:{did:h,configs:[f]}});c(w.blocklet),p()}catch(w){L.error(ae(w)),j()}}),g=(f,p)=>new Promise(async(j,w)=>{if(f.required&&(!f.key.trim()||!f.value.trim())){L.error(r("blocklet.config.environment.keyValueRequired")),w();return}if(mo(f.key)===!1){L.error(r("blocklet.config.environment.invalidKey")),w();return}if(f.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const U=ss(f);if(U){L.error(U),w();return}}const v=[{...f,value:f.secure&&f.value==="__encrypted__"?"":f.value}];if(f.key!==p.key){if(!Gt(f,e,n)){L.error("Only key of custom env can be changed"),w();return}v.push({key:p.key,custom:Wt(f.key)})}try{const U=await o.api.configBlocklet({input:{did:h,configs:v}});c(U.blocklet),j()}catch(U){L.error(ae(U)),w()}}),l=f=>new Promise(async(p,j)=>{if(f.required){L.error(r("blocklet.config.environment.deleteForbidden")),j();return}if(!Gt(f,e,n)){L.error("Only key of custom env can be changed"),j();return}try{const w=await o.api.configBlocklet({input:{did:h,configs:[{key:f.key,custom:Wt(f.key)}]}});c(w.blocklet),p()}catch(w){L.error(ae(w)),j()}}),b=(e.configs||[]).filter(f=>!Y.BLOCKLET_CONFIGURABLE_KEY[f.key]||[Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE].includes(f.key)),d=B.getSharedConfigObj(n[0],e),k=B.getComponentMissingConfigs(e,n[0]),S=b.map(f=>({...f,value:Object.values(Y.CHAIN_PROP_MAP).includes(f.key)&&Object.keys(d).includes(f.key)?d[f.key]:d[f.key]||f.value})),R=S.some(f=>f.key&&f.key.startsWith("BWA_")),E={onRowAdd:x,onRowUpdate:g,onRowDelete:l,isDeletable:u},C=()=>[{title:r("common.key"),field:"key",initialEditValue:"",width:"30%",render:f=>t.jsx(io,{value:f.value,style:{color:f.required&&!f.value?i.error.main:i.text.primary,fontWeight:f.required?"bold":"normal"},children:f.key}),editComponent:f=>{const{value:p,rowData:j,onChange:w}=f;return t.jsx(fo,{children:t.jsx(H,{fullWidth:!0,size:"small",disabled:u(j)===!1,value:p,onChange:v=>w(v.target.value),variant:"outlined",label:"Key",placeholder:r("blocklet.config.environment.key"),margin:"dense",autoFocus:!0})})}},{title:r("common.value"),field:"value",initialEditValue:"",width:"calc((100% - (96px + 30%)) / 1)",render:f=>f.value?f.secure?"******":t.jsx(io,{unstyled:!0,value:f.value,style:{wordBreak:"break-all"},children:f.value}):null,editComponent:f=>{const{value:p,rowData:j,onChange:w}=f;return t.jsxs(fo,{children:[t.jsx(H,{fullWidth:!0,size:"small",value:p==="__encrypted__"?"":p,onChange:v=>w(v.target.value),variant:"outlined",label:r("common.value"),placeholder:r("blocklet.config.environment.value"),margin:"dense"}),pi(j,r)]})}}];return t.jsxs(mi,{children:[!!k.length&&t.jsx(zt,{severity:"error",style:{marginTop:24},children:r("blocklet.config.missingRequired")}),R&&t.jsx(zt,{severity:"info",children:r("blocklet.config.environment.tip")}),t.jsx(Yt,{permission:s?"":"mutate_blocklets",role:s?Xe:[],children:f=>t.jsx(Qs,{className:"config-table",children:t.jsx(Xs,{title:t.jsx(y,{fontWeight:"bold",children:r("common.environments")}),columns:C(),icons:ui,options:{emptyRowsWhenPaging:!1,actionsColumnIndex:-1,tableLayout:"auto",maxBodyHeight:"100%",paging:!1,search:!1,actionsCellStyle:{padding:"0",textAlign:"right",width:"80px"}},localization:{header:{actions:r("common.actions")},body:{emptyDataSourceMessage:r("common.noData")}},data:S,editable:f?E:{}})})})]})}cn.propTypes={blocklet:a.object.isRequired,ancestors:a.array};cn.defaultProps={ancestors:[]};const mi=$.div`
2
2
  .config-table {
3
3
  margin-bottom: 24px;
4
4
  position: relative;
@@ -75,7 +75,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
75
75
  25%, 75% {
76
76
  transform: scale(1.1) translateX(3px);
77
77
  }
78
- `,ji={input:fn,color:mn,passport:hn,uploader:e=>t.jsx(Rr,{...e.componentProps})};function Ri(e,{editing:n=!1}){const{componentType:o="input",render:i,renderFormItem:s}=e;return n&&s?s:!n&&i?i:ji[o==null?void 0:o.toLowerCase()]}kt.propTypes={item:a.object.isRequired,findEditingItem:a.func.isRequired,getItemValue:a.func.isRequired,onFormItemChange:a.func.isRequired,onFocusOut:a.func.isRequired,disabled:a.bool,loading:a.bool,onCancel:a.func,formValues:a.object.isRequired};kt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function kt({item:e,findEditingItem:n,getItemValue:o,onFormItemChange:i,onFocusOut:s,disabled:r,loading:h,onCancel:c,formValues:u}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:k={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=n(x),{editing:E,shaking:C}=R??{},f=o(e,{editing:E}),p=Ri(e,{editing:E}),j={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:E,value:f,onChange:(v,U="change")=>i(e,v,U),componentProps:k,skipButtonDisabled:S,onBlur:()=>s(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(yi,{children:[t.jsx(Ci,{expandIcon:t.jsx(un,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(vi,{children:e.children.map(v=>t.jsx(kt,{item:v,findEditingItem:n,getItemValue:o,onFormItemChange:i,onFocusOut:s,formValues:u,disabled:r,loading:h,onCancel:c},v.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!f?"error.main":"text.secondary"},children:[g,l&&t.jsx(ft,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{r||R!=null&&R.edited||S||i(e,u[x],"edit")},children:t.jsx(p,{...j})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:E?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(X,{"data-cy":"schema-form-item-confirm",onClick:()=>{i(e,f,"confirm")},disabled:r||h,sx:{animation:C?`${bi} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(pe,{size:24}):t.jsx(Tr,{})}):null,t.jsx(X,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:r||h,size:"large",children:t.jsx(cs,{})})]}):null})]})]},x)}function gn({schema:e,loading:n,value:o,defaultValue:i,onChange:s,style:r,disabled:h}){const c=Object.prototype.toString.call(o)==="[object Object]",[u,x]=m.useState([]),[g,l]=m.useState(c?o:i),b=m.useMemo(()=>e.length===1,[e]),d=m.useCallback(p=>u.find(j=>j.key===p),[u]);m.useEffect(()=>{var p;b&&((p=e[0])!=null&&p.required)&&x([{key:e[0].key,editing:!0,initialValue:i[e[0].key]}])},[e,b,i]);const k=m.useCallback(p=>{x(j=>j.find(v=>v.key===p.key)?j.map(v=>v.key===p.key?p:{...v}):[p].concat(j))},[]),S=m.useCallback((p,j,w)=>{const{key:v,secure:U}=p,O=d(v)??{...p};O.editing=!0;const I=g[v]!==j;O.edited=j&&O.initialValue!==j,O.initialValue=i[v];const J={...g,[v]:j};I&&l(J),s({[v]:j},{allValues:J,action:w,currentItem:p}),w==="confirm"&&U&&l({...g,[v]:"__encrypted__"}),w==="confirm"&&(O.initialValue=g[v]),["confirm","cancel"].includes(w)&&(O.editing=!1,O.edited=!1),k(O)},[i,g,s,k,d]),R=m.useCallback((p,{editing:j=!1})=>{const{key:w}=p,v=c?o[w]:g[w];return v==="__encrypted__"?j?"":"******":v},[c,o,g]),E=m.useCallback(p=>{const j=d(p.key);j&&S(p,j.initialValue,"cancel")},[d,S]),C=m.useCallback(p=>{const j=d(p.key);!j||!j.edited||(j.shaking=!0,k(j),setTimeout(()=>{j.shaking=!1,k(j)},500))},[d,k]),f=m.useCallback(p=>{const j=d(p.key);!j||!j.edited?E(p):C(p)},[d,C,E]);return t.jsx(Si,{className:"form",style:r,children:e==null?void 0:e.map(p=>{const{hidden:j=!1}=p;return j?null:t.jsx(kt,{item:p,findEditingItem:d,getItemValue:R,onFormItemChange:S,onFocusOut:f,formValues:g,disabled:h,loading:n,onCancel:E})})})}gn.propTypes={schema:a.array.isRequired,loading:a.bool,onChange:a.func.isRequired,value:a.object,defaultValue:a.object,style:a.object,disabled:a.bool};gn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Si=$(jr)``;function xn({meta:e,onCancel:n,mode:o,handlePaySuccess:i}){const{t:s,locale:r}=W(),{info:h}=Z(),c=ds(h),[u,x]=m.useState(null),g=new URL(e==null?void 0:e.registryUrl).origin,l=B.getDisplayName({meta:e}),b=async(k,S)=>{const R=({downloadTokenList:f})=>{i({downloadTokenList:f})},E=f=>{L.error(f),n(f)};function C(f){return ms(()=>lo.get(f).then(async({data:p})=>{const j=p==null?void 0:p.downloadTokenList;if(p.status==="succeed"){if(j&&j.length)await R({downloadTokenList:j});else return await E(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return p.status==="error"?(console.error("vc error: ",p),await E(p==null?void 0:p.error),!0):!1}),{interval:1e3})}if(o==="purchase"&&u){const{statusUrl:f}=ps(u);await C(f)}else await R({downloadTokenList:k.downloadTokenList&&S(k.downloadTokenList)})};if(m.useEffect(()=>{if(o==="purchase"){const k=new URL(g);k.pathname="/api/did/verify-purchase-blocklet/token",k.searchParams.set("serverDid",h.did),k.searchParams.set("blockletDid",e==null?void 0:e.did);try{lo.get(k.href).then(({data:S})=>{const R=`${S.url}`;x(R)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{x(null)}},[o]),o==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:eo.create({baseURL:g}).get,extraParams:{serverDid:h.did,blockletDid:e==null?void 0:e.did},messages:{title:s("store.purchase.verify.auth.title",{name:l}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:eo.create({baseURL:Rt(g,"/store")}).get,extraParams:{factory:e.nftFactory,nw:u},messages:{title:s("store.purchase.auth.title",{name:l}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:s("store.purchase.auth.success")}),t.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return t.jsx(us,{open:!0,locale:r,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:b,cancelWhenScanned:n,onClose:n,checkTimeout:60*5e3,webWalletUrl:c,disableClose:!0,showDownload:!1,...d[o]})}xn.propTypes={...er,handlePaySuccess:a.func,mode:a.oneOf(["verify","purchase"]).isRequired};xn.defaultProps={handlePaySuccess:()=>{}};const yn=m.forwardRef(({mode:e,...n},o)=>{const[i,s]=m.useState(e!=="both"?e:"verify"),[r,h]=m.useState(e!=="both"?2:1),c=x=>{x!==i&&s(x)},u=()=>{i&&r!==2&&h(2)};return m.useImperativeHandle(o,()=>({onNext:u,getCurrentStep:()=>r})),r===1?t.jsx("div",{style:{maxWidth:520},children:t.jsx(tr,{action:i,onNext:null,onSelect:c})}):t.jsx(xn,{...n,mode:i})});yn.propTypes={mode:a.oneOf(["both","verify","purchase"]).isRequired,ref:a.any};yn.defaultProps={ref:{}};const wi=yn;function Ti({...e}){return t.jsx(le,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Cn({blocklet:e,onStartNow:n,children:o,disabled:i}){const{t:s}=W(),r=No();return!e||fs(e.meta)?t.jsx(Ei,{children:o}):t.jsxs(ki,{isMobile:r,children:[t.jsx(Ti,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>n(),children:s("setup.startNow")}),t.jsx(y,{display:"flex",alignItems:"center",children:o})]})}Cn.propTypes={blocklet:a.object,onStartNow:a.func,children:a.any,disabled:a.bool};Cn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const Ei=$(y)`
78
+ `,ji={input:fn,color:mn,passport:hn,uploader:e=>t.jsx(Rr,{...e.componentProps})};function Ri(e,{editing:n=!1}){const{componentType:o="input",render:i,renderFormItem:s}=e;return n&&s?s:!n&&i?i:ji[o==null?void 0:o.toLowerCase()]}kt.propTypes={item:a.object.isRequired,findEditingItem:a.func.isRequired,getItemValue:a.func.isRequired,onFormItemChange:a.func.isRequired,onFocusOut:a.func.isRequired,disabled:a.bool,loading:a.bool,onCancel:a.func,formValues:a.object.isRequired};kt.defaultProps={disabled:!1,loading:!1,onCancel:()=>{}};function kt({item:e,findEditingItem:n,getItemValue:o,onFormItemChange:i,onFocusOut:s,disabled:r,loading:h,onCancel:c,formValues:u}){var w;const{key:x,description:g,required:l,solo:b=!1,hidden:d=!1,componentProps:k={},skipButtonDisabled:S=!1}=e;if(d)return null;const R=n(x),{editing:E,shaking:C}=R??{},f=o(e,{editing:E}),p=Ri(e,{editing:E}),j={inputProps:{"data-cy":"schema-form-item-component"},key:x,description:g,editing:E,value:f,onChange:(v,U="change")=>i(e,v,U),componentProps:k,skipButtonDisabled:S,onBlur:()=>s(e)};return e.componentType==="collapse"&&((w=e.children)==null?void 0:w.length)>0?t.jsxs(yi,{children:[t.jsx(Ci,{expandIcon:t.jsx(un,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:e.description}),t.jsx(vi,{children:e.children.map(v=>t.jsx(kt,{item:v,findEditingItem:n,getItemValue:o,onFormItemChange:i,onFocusOut:s,formValues:u,disabled:r,loading:h,onCancel:c},v.key))})]}):t.jsxs(y,{className:"form-item",children:[!b&&t.jsxs(y,{className:"form-item-label",sx:{color:l&&!f?"error.main":"text.secondary"},children:[g,l&&t.jsx(ft,{})]}),t.jsxs(y,{className:"form-item-body",children:[t.jsx(y,{className:"form-item-input","data-cy":"schema-form-item-edit",sx:{textAlign:b?"center":"left"},style:{cursor:"text"},onClick:()=>{r||R!=null&&R.edited||S||i(e,u[x],"edit")},children:t.jsx(p,{...j})}),!b&&t.jsx(y,{className:"form-item-action",style:{marginLeft:0},children:E?t.jsxs(t.Fragment,{children:[R.edited?t.jsx(X,{"data-cy":"schema-form-item-confirm",onClick:()=>{i(e,f,"confirm")},disabled:r||h,sx:{animation:C?`${bi} 0.5s linear`:"none"},style:{paddingRight:4},size:"large",children:h?t.jsx(pe,{size:24}):t.jsx(Tr,{})}):null,t.jsx(X,{"data-cy":"schema-form-item-cancel",onClick:()=>c(e),style:{paddingLeft:R.edited?4:8},disabled:r||h,size:"large",children:t.jsx(cs,{})})]}):null})]})]},x)}function gn({schema:e,loading:n,value:o,defaultValue:i,onChange:s,style:r,disabled:h}){const c=Object.prototype.toString.call(o)==="[object Object]",[u,x]=m.useState([]),[g,l]=m.useState(c?o:i),b=m.useMemo(()=>e.length===1,[e]),d=m.useCallback(p=>u.find(j=>j.key===p),[u]);m.useEffect(()=>{var p;b&&((p=e[0])!=null&&p.required)&&x([{key:e[0].key,editing:!0,initialValue:i[e[0].key]}])},[e,b,i]);const k=m.useCallback(p=>{x(j=>j.find(v=>v.key===p.key)?j.map(v=>v.key===p.key?p:{...v}):[p].concat(j))},[]),S=m.useCallback((p,j,w)=>{const{key:v,secure:U}=p,O=d(v)??{...p};O.editing=!0;const _=g[v]!==j;O.edited=j&&O.initialValue!==j,O.initialValue=i[v];const J={...g,[v]:j};_&&l(J),s({[v]:j},{allValues:J,action:w,currentItem:p}),w==="confirm"&&U&&l({...g,[v]:"__encrypted__"}),w==="confirm"&&(O.initialValue=g[v]),["confirm","cancel"].includes(w)&&(O.editing=!1,O.edited=!1),k(O)},[i,g,s,k,d]),R=m.useCallback((p,{editing:j=!1})=>{const{key:w}=p,v=c?o[w]:g[w];return v==="__encrypted__"?j?"":"******":v},[c,o,g]),E=m.useCallback(p=>{const j=d(p.key);j&&S(p,j.initialValue,"cancel")},[d,S]),C=m.useCallback(p=>{const j=d(p.key);!j||!j.edited||(j.shaking=!0,k(j),setTimeout(()=>{j.shaking=!1,k(j)},500))},[d,k]),f=m.useCallback(p=>{const j=d(p.key);!j||!j.edited?E(p):C(p)},[d,C,E]);return t.jsx(Si,{className:"form",style:r,children:e==null?void 0:e.map(p=>{const{hidden:j=!1}=p;return j?null:t.jsx(kt,{item:p,findEditingItem:d,getItemValue:R,onFormItemChange:S,onFocusOut:f,formValues:g,disabled:h,loading:n,onCancel:E})})})}gn.propTypes={schema:a.array.isRequired,loading:a.bool,onChange:a.func.isRequired,value:a.object,defaultValue:a.object,style:a.object,disabled:a.bool};gn.defaultProps={loading:!1,value:void 0,defaultValue:{},style:{},disabled:!1};const Si=$(jr)``;function xn({meta:e,onCancel:n,mode:o,handlePaySuccess:i}){const{t:s,locale:r}=W(),{info:h}=Z(),c=ds(h),[u,x]=m.useState(null),g=new URL(e==null?void 0:e.registryUrl).origin,l=B.getDisplayName({meta:e}),b=async(k,S)=>{const R=({downloadTokenList:f})=>{i({downloadTokenList:f})},E=f=>{L.error(f),n(f)};function C(f){return ms(()=>lo.get(f).then(async({data:p})=>{const j=p==null?void 0:p.downloadTokenList;if(p.status==="succeed"){if(j&&j.length)await R({downloadTokenList:j});else return await E(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return p.status==="error"?(console.error("vc error: ",p),await E(p==null?void 0:p.error),!0):!1}),{interval:1e3})}if(o==="purchase"&&u){const{statusUrl:f}=ps(u);await C(f)}else await R({downloadTokenList:k.downloadTokenList&&S(k.downloadTokenList)})};if(m.useEffect(()=>{if(o==="purchase"){const k=new URL(g);k.pathname="/api/did/verify-purchase-blocklet/token",k.searchParams.set("serverDid",h.did),k.searchParams.set("blockletDid",e==null?void 0:e.did);try{lo.get(k.href).then(({data:S})=>{const R=`${S.url}`;x(R)})}catch(S){console.error("get next workflow url error: ",S)}}return()=>{x(null)}},[o]),o==="purchase"&&!u)return"";const d={verify:{action:"verify-purchase-blocklet",checkFn:eo.create({baseURL:g}).get,extraParams:{serverDid:h.did,blockletDid:e==null?void 0:e.did},messages:{title:s("store.purchase.verify.auth.title",{name:l}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:eo.create({baseURL:Rt(g,"/store")}).get,extraParams:{factory:e.nftFactory,nw:u},messages:{title:s("store.purchase.auth.title",{name:l}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:s("store.purchase.auth.success")}),t.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return t.jsx(us,{open:!0,locale:r,popup:!1,saveConnect:!1,className:"connect",baseUrl:g,onSuccess:b,cancelWhenScanned:n,onClose:n,checkTimeout:60*5e3,webWalletUrl:c,disableClose:!0,showDownload:!1,...d[o]})}xn.propTypes={...er,handlePaySuccess:a.func,mode:a.oneOf(["verify","purchase"]).isRequired};xn.defaultProps={handlePaySuccess:()=>{}};const yn=m.forwardRef(({mode:e,...n},o)=>{const[i,s]=m.useState(e!=="both"?e:"verify"),[r,h]=m.useState(e!=="both"?2:1),c=x=>{x!==i&&s(x)},u=()=>{i&&r!==2&&h(2)};return m.useImperativeHandle(o,()=>({onNext:u,getCurrentStep:()=>r})),r===1?t.jsx("div",{style:{maxWidth:520},children:t.jsx(tr,{action:i,onNext:null,onSelect:c})}):t.jsx(xn,{...n,mode:i})});yn.propTypes={mode:a.oneOf(["both","verify","purchase"]).isRequired,ref:a.any};yn.defaultProps={ref:{}};const wi=yn;function Ti({...e}){return t.jsx(le,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Cn({blocklet:e,onStartNow:n,children:o,disabled:i}){const{t:s}=W(),r=No();return!e||fs(e.meta)?t.jsx(Ei,{children:o}):t.jsxs(ki,{isMobile:r,children:[t.jsx(Ti,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>n(),children:s("setup.startNow")}),t.jsx(y,{display:"flex",alignItems:"center",children:o})]})}Cn.propTypes={blocklet:a.object,onStartNow:a.func,children:a.any,disabled:a.bool};Cn.defaultProps={blocklet:null,onStartNow:()=>{},children:null,disabled:!1};const Ei=$(y)`
79
79
  width: 100%;
80
80
  margin-top: auto;
81
81
  padding-top: 24px;
@@ -125,7 +125,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
125
125
  overflow-y: auto;
126
126
  padding-bottom: 32px;
127
127
  overflow-x: hidden;
128
- `;function bn({onChange:e,loading:n,children:o,extra:i,stores:s,storageKey:r}){const{t:h}=W(),{info:c,inService:u}=Z(),{blocklet:x}=me(),[g,l]=m.useState(!1),b=m.useRef(null),[d,k]=m.useState(),[S,R]=Lr(r||"tmp"),[E,C]=r?[S,R]:[d,k],{storeList:f,teamDid:p}=bo({fromBlocklet:u,blocklet:x,nodeInfo:c}),j=jo([...s.map(v=>({...v,protected:!0})),...f],"url"),w=E&&j.find(v=>E===v.url)||j[0];return t.jsxs(t.Fragment,{children:[t.jsxs(_i,{children:[t.jsx(le,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(Ur,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(ne,{color:"primary",children:w.name})}),t.jsx(ne,{color:"primary",children:i})]}),t.jsxs(H,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:v=>{const U=v.target.value;C(U.url),e(U)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:v=>v==null?void 0:v.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[j==null?void 0:j.map(v=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:v,"data-cy":v.url,children:t.jsx(nr,{teamDid:p,store:v,onDelete:()=>{var U;E===v.url&&C((U=j[0])==null?void 0:U.url)}})},v.url)),!Po.isInServerlessMode(c)&&t.jsx(or,{disabled:n,storeList:j,teamDid:p,onAdd:v=>{C(v)}})]}),o({currentRegistry:w})]})}bn.propTypes={onChange:a.func,loading:a.bool,children:a.any.isRequired,extra:a.node,storageKey:a.string,stores:a.arrayOf(a.shape({name:a.string.isRequired,url:a.string.isRequired}))};bn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const _i=$.div`
128
+ `;function bn({onChange:e,loading:n,children:o,extra:i,stores:s,storageKey:r}){const{t:h}=W(),{info:c,inService:u}=Z(),{blocklet:x}=me(),[g,l]=m.useState(!1),b=m.useRef(null),[d,k]=m.useState(),[S,R]=Lr(r||"tmp"),[E,C]=r?[S,R]:[d,k],{storeList:f,teamDid:p}=bo({fromBlocklet:u,blocklet:x,nodeInfo:c}),j=jo([...s.map(v=>({...v,protected:!0})),...f],"url"),w=E&&j.find(v=>E===v.url)||j[0];return t.jsxs(t.Fragment,{children:[t.jsxs(Ii,{children:[t.jsx(le,{ref:b,color:"primary","data-cy":"add-component-select-store",endIcon:t.jsx(Ur,{color:"primary"}),onClick:()=>{l(!0)},style:{padding:"0 2px"},children:t.jsx(ne,{color:"primary",children:w.name})}),t.jsx(ne,{color:"primary",children:i})]}),t.jsxs(H,{id:"mui-registry-select",select:!0,autoComplete:"off",variant:"outlined",name:"did",helperText:h("blocklet.component.selectRegistryTip"),"data-cy":"component-registry-select",fullWidth:!0,value:w,autoFocus:!0,onChange:v=>{const U=v.target.value;C(U.url),e(U)},SelectProps:{open:g,MenuProps:{anchorEl:b.current},renderValue:v=>v==null?void 0:v.name,onClose:()=>{l(!1)}},style:{display:"none"},margin:"normal",children:[j==null?void 0:j.map(v=>t.jsx(ye,{sx:{width:"400px",maxWidth:"90vw"},value:v,"data-cy":v.url,children:t.jsx(nr,{teamDid:p,store:v,onDelete:()=>{var U;E===v.url&&C((U=j[0])==null?void 0:U.url)}})},v.url)),!Po.isInServerlessMode(c)&&t.jsx(or,{disabled:n,storeList:j,teamDid:p,onAdd:v=>{C(v)}})]}),o({currentRegistry:w})]})}bn.propTypes={onChange:a.func,loading:a.bool,children:a.any.isRequired,extra:a.node,storageKey:a.string,stores:a.arrayOf(a.shape({name:a.string.isRequired,url:a.string.isRequired}))};bn.defaultProps={onChange:()=>{},loading:!1,extra:"",stores:[],storageKey:""};const Ii=$.div`
129
129
  display: flex;
130
130
  justify-content: space-between;
131
131
  align-items: center;
@@ -136,7 +136,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
136
136
  color: ${e=>e.theme.palette.text.primary};
137
137
  // font-weight: bold;
138
138
  }
139
- `,Ii={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Di={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Ni={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Ui=(e,n)=>Rt(n,`/blocklets/${e.did}`),ho=({blocklet:e,attribute:n,value:o})=>e._formatted?e._formatted[n]:o,Li=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function jn({blocklet:e,blocklets:n,handleButtonClick:o,endpoint:i,serverVersion:s}){var R,E;const{t:r}=W();let h=Rt(i,bs(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,u]=m.useState(!1),x=async()=>{try{u(!0),await o({meta:e,registryUrl:i,blocklets:n})}catch(C){L.error(C.message)}finally{u(!1)}},{blocklet:g}=me(),l=()=>((g==null?void 0:g.children)||[]).find(p=>p.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(f=>f.meta.bundleDid===e.did);if(C){try{const f=C.meta.version,p=e.version;if(js.gt(p,f))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),k=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Ni,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:r("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:Ii,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:r("blocklet.component.installed")}):Li(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Di,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:r("blocklet.component.needBuy")}),t.jsx(Bi,{title:ho({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:ho({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(E=e.docker)!=null&&E.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:_o})}),title:r("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:r("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(rr,{serverVersion:s,requirementVersion:k,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(ir,{children:t.jsx(le,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const f=Ui(e,i);f&&window.open(f,"_blank","noopener,noreferrer")},children:r("common.detail")},e.did)})})})})}jn.propTypes={blocklet:a.object.isRequired,blocklets:a.array,handleButtonClick:a.func,endpoint:a.string,serverVersion:a.string};jn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function Rn({handleButtonClick:e,handleSearchSelect:n,storeUrl:o,handleBlockletRender:i,extraFilter:s,serverVersion:r,resourceType:h,resourceDid:c,showResourcesSwitch:u,showCategory:x,compact:g,...l}){const b=bt(),{locale:d}=W(),[k,S]=m.useState(!1),[R,E]=m.useState({}),C=j=>{E(j)},f=o,p=m.useMemo(()=>xs(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return m.useEffect(()=>{E({showResources:!0,resourceType:h,resourceDid:c})},[f,h,c]),m.useEffect(()=>{S(!0),E({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(ys,{theme:p,children:t.jsx(Cs,{FallbackComponent:vs,resetKeys:[f],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[k&&t.jsx(sr,{showCategory:x,showResourcesSwitch:u,blockletRender:j=>{const w={...j,handleButtonClick:e,endpoint:f};return i({...j,defaultRender:t.jsx(jn,{...w})})},compact:g,minItemWidth:300,baseSearch:!0,endpoint:f,locale:d,onFilterChange:C,onSearchSelect:n,filters:R,extraFilter:s,serverVersion:r,fetchCategoryDelay:500}),t.jsx(y,{sx:{mt:2},children:" "})]})})})}Rn.propTypes={storeUrl:a.string.isRequired,handleButtonClick:a.func,handleSearchSelect:a.func,handleBlockletRender:a.func,extraFilter:a.func,serverVersion:a.string,resourceType:a.string,resourceDid:a.string,showResourcesSwitch:a.bool,showCategory:a.bool,compact:a.bool};Rn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0,compact:!1};const Bi=$(ar)`
139
+ `,_i={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Di={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Ni={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Ui=(e,n)=>Rt(n,`/blocklets/${e.did}`),ho=({blocklet:e,attribute:n,value:o})=>e._formatted?e._formatted[n]:o,Li=e=>e.inStore&&B.isFreeBlocklet(e)===!1;function jn({blocklet:e,blocklets:n,handleButtonClick:o,endpoint:i,serverVersion:s}){var R,E;const{t:r}=W();let h=Rt(i,bs(e.did,e.logo||""));try{const C=new URL(h);C.searchParams.set("v",e.version||+new Date),h=C.href}catch{}const[c,u]=m.useState(!1),x=async()=>{try{u(!0),await o({meta:e,registryUrl:i,blocklets:n})}catch(C){L.error(C.message)}finally{u(!1)}},{blocklet:g}=me(),l=()=>((g==null?void 0:g.children)||[]).find(p=>p.meta.bundleDid===e.did).meta.version,d=(()=>{const C=((g==null?void 0:g.children)||[]).find(f=>f.meta.bundleDid===e.did);if(C){try{const f=C.meta.version,p=e.version;if(js.gt(p,f))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),k=(R=e.requirements)==null?void 0:R.server,S=[];return d==="upgrade"?S.push({key:"upgrade",icon:t.jsx(Q,{icon:Ni,color:"success.light",width:20,height:20},"version"),title:`${l()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:t.jsx(y,{sx:{fontWeight:"bold"},children:r("blocklet.component.upgradeAvailable")})}):d==="disable"?S.push({key:"disable",icon:t.jsx(Q,{icon:_i,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:r("blocklet.component.installed")}):Li(e)&&S.push({key:"purchase",icon:t.jsx(Q,{icon:Di,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:r("blocklet.component.needBuy")}),t.jsx(Bi,{title:ho({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:ho({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?h:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:d!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:d==="disable"?void 0:x,icons:(E=e.docker)!=null&&E.image?[{key:"docker",icon:t.jsx(y,{display:"flex",color:"primary.main",children:t.jsx(Q,{icon:Io})}),title:r("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:r("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:S,button:t.jsx(rr,{serverVersion:s,requirementVersion:k,size:"small",children:t.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.jsx(ir,{children:t.jsx(le,{size:"small",disabled:c,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const f=Ui(e,i);f&&window.open(f,"_blank","noopener,noreferrer")},children:r("common.detail")},e.did)})})})})}jn.propTypes={blocklet:a.object.isRequired,blocklets:a.array,handleButtonClick:a.func,endpoint:a.string,serverVersion:a.string};jn.defaultProps={handleButtonClick:null,endpoint:"",blocklets:[],serverVersion:""};function Rn({handleButtonClick:e,handleSearchSelect:n,storeUrl:o,handleBlockletRender:i,extraFilter:s,serverVersion:r,resourceType:h,resourceDid:c,showResourcesSwitch:u,showCategory:x,compact:g,...l}){const b=bt(),{locale:d}=W(),[k,S]=m.useState(!1),[R,E]=m.useState({}),C=j=>{E(j)},f=o,p=m.useMemo(()=>xs(b,{palette:{background:{default:b.palette.background.paper}}}),[b]);return m.useEffect(()=>{E({showResources:!0,resourceType:h,resourceDid:c})},[f,h,c]),m.useEffect(()=>{S(!0),E({showResources:!0,resourceType:h,resourceDid:c})},[]),t.jsx(ys,{theme:p,children:t.jsx(Cs,{FallbackComponent:vs,resetKeys:[f],children:t.jsxs(y,{...l,sx:[{overflow:"auto",".title-bar + div":{height:"unset"}},Array.isArray(l.sx)?l.sx:[l.sx]],children:[k&&t.jsx(sr,{showCategory:x,showResourcesSwitch:u,blockletRender:j=>{const w={...j,handleButtonClick:e,endpoint:f};return i({...j,defaultRender:t.jsx(jn,{...w})})},compact:g,minItemWidth:300,baseSearch:!0,endpoint:f,locale:d,onFilterChange:C,onSearchSelect:n,filters:R,extraFilter:s,serverVersion:r,fetchCategoryDelay:500}),t.jsx(y,{sx:{mt:2},children:" "})]})})})}Rn.propTypes={storeUrl:a.string.isRequired,handleButtonClick:a.func,handleSearchSelect:a.func,handleBlockletRender:a.func,extraFilter:a.func,serverVersion:a.string,resourceType:a.string,resourceDid:a.string,showResourcesSwitch:a.bool,showCategory:a.bool,compact:a.bool};Rn.defaultProps={handleButtonClick:null,handleSearchSelect:null,handleBlockletRender:null,extraFilter:void 0,serverVersion:"",resourceType:"",resourceDid:"",showResourcesSwitch:!0,showCategory:!0,compact:!1};const Bi=$(ar)`
140
140
  .ms-highlight {
141
141
  color: ${e=>e.theme.palette.primary.main};
142
142
  }
@@ -281,7 +281,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
281
281
  & .connect {
282
282
  background: white;
283
283
  }
284
- `,$i=Sn,Mi=e=>e.inStore&&B.isFreeBlocklet(e)===!1,qi=e=>{var n;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)},Ft=e=>{var n,o;return((o=(n=e==null?void 0:e.configs)==null?void 0:n.find(i=>i.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:o.value)||null},Gi=e=>(e.environments||[]).some(n=>n.required),xo=(e,n)=>e==null?void 0:e.some(o=>o.required&&!n[o.key]),Wi=({params:e,blocklet:n,t:o})=>{const i=e.title||e.name;return i?((n==null?void 0:n.children)||[]).find(r=>r.meta.bundleDid===e.bundleDid)?o("blocklet.component.upgradeNext",{name:i}):o("blocklet.component.addNext",{name:i}):o("common.next")},yo=({componentDid:e,timeout:n=1e3,manual:o=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:o},"*")},n)};function wn({onClose:e,mode:n,stores:o,resourceType:i,resourceDid:s,storageKey:r,inDialog:h,selectedMeta:c,storeUrl:u,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var Gn,Wn,Fn,zn,nt,Vn,ot,Yn,Kn,Hn;const{t:d,locale:k}=W(),[S,R]=m.useState(!1),[E,C]=m.useState(null),[f,p]=m.useState(""),[j,w]=m.useState(""),{api:v,ws:{useSubscription:U},inService:O,info:K}=Z(),{blocklet:I,actions:{refreshBlocklet:J}}=me(),[oe,ee]=m.useState(null),[_e,we]=m.useState(!1),Te={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[_,fe]=m.useState(Te),[G,he]=m.useState(0),M=m.useRef({}),Ie=m.useRef({}),ce=m.useRef({}),De=Ro(P=>P.breakpoints.down("md")),T=Ss(),[V,de]=m.useState(!0),{meta:F}=M.current,te=vr(F),je=m.useRef(!1),z=P=>fe(D=>({...D,...P}));m.useEffect(()=>{if(_.pathPrefix){const{errMsg:P}=qn({..._,pathPrefix:_.pathPrefix,locale:k});p(P)}},[_.pathPrefix]),m.useEffect(()=>{G===0&&fe(Te)},[G]);const Ne=()=>{const P=Ft(I)??"";z({didSpaceEndpoint:P})},Re=()=>{var P;return(P=M==null?void 0:M.current)!=null&&P.meta?B.getDisplayName(M.current):""},Ve=()=>{R(!1),fe({}),je.current=!1,M.current={},e()},Oe=P=>{const D=A=>{z({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(le,{className:"bottom-button",disabled:A,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Mn(M.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[A&&t.jsx(pe,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},tt=P=>D=>{var A,q;(((A=D==null?void 0:D.meta)==null?void 0:A.did)||(D==null?void 0:D.meta))===((q=I==null?void 0:I.meta)==null?void 0:q.did)&&P(D)},Wo=()=>{yo({timeout:0,componentDid:T.componentDid,manual:!0}),Ve(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};U(Y.BlockletEvents.componentInstalled,tt(()=>{z({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),yo({componentDid:T.componentDid})}),[(Gn=I==null?void 0:I.meta)==null?void 0:Gn.did]),U(Y.BlockletEvents.statusChange,tt(()=>{const P=Ft(I);z(D=>({...D,didSpaceEndpoint:P}))}),[(Wn=I==null?void 0:I.meta)==null?void 0:Wn.did]),U(Y.BlockletEvents.downloadFailed,tt(()=>{je.current=!1,Oe(d("blocklet.component.installComponentError"))}),[(Fn=I==null?void 0:I.meta)==null?void 0:Fn.did]),U(Y.BlockletEvents.installFailed,tt(()=>{je.current=!1,Oe(d("blocklet.component.installComponentError"))}),[(zn=I==null?void 0:I.meta)==null?void 0:zn.did]);const ue=[],$n=P=>((I==null?void 0:I.children)||[]).find(D=>D.meta.did===P),Mn=async P=>{var $e,Me;je.current=!0;const{pathPrefix:D,bundleDid:A,title:q,componentName:Ue="",componentDid:Ae=""}=_,Le=(($e=M.current)==null?void 0:$e.meta)||{},{configs:Se=[],registryUrl:Ee,inStore:Ke,inputUrl:He,dist:Lt}=Le,Ze=(Me=M.current)==null?void 0:Me.downloadTokenList,re=He||(Ke?to(Ee,A,Lt):"");R(!0);const st={rootDid:I.meta.did,url:re,mountPoint:D?ve(D):`/${ve(Le.title||Le.name)}`,title:q,name:Ue,did:Ae,dist:{tarball:"",integrity:""},onlyRequired:!V,..._.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:_.configsValue[xe.key]||""}))}:{},...Ze?{downloadTokenList:Ze}:{},...P};try{if(await v.installComponent({input:st}),Ee){const{teamDid:xe,storeList:qe}=bo({fromBlocklet:O,nodeInfo:K,blocklet:I}),{isNew:Bt,decoded:rt}=Es(Ee,qe);Bt&&await v.addBlockletStore({input:{teamDid:xe,url:rt}})}z({installResultProps:{}}),J({showError:!1,attachRuntimeInfo:!1})}catch(xe){const qe=ae(xe);L.error(qe),console.error("installComponent error: ",xe),Oe(qe)}finally{R(!1),M.current.installInput=st}},qn=P=>{const D=Do({params:{...P,did:P.bundleDid},blocklets:[I],blocklet:I,locale:k});if(D){const A=$n(P.bundleDid),q=Nr({params:{...P,did:P.bundleDid},blocklet:I});if(A&&A.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var A,q;const{errMsg:D}=qn({..._,locale:k});p(D),G===ue.length-2&&!je.current&&await Mn(P),(q=(A=Ie.current)==null?void 0:A.setActiveStepByIndex)==null||q.call(A,Ue=>Ue+1)},Ye=()=>{var P,D;(D=(P=Ie.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,A=>A-1)},Fo=()=>{const{pathPrefix:P,bundleDid:D,title:A,componentName:q="",componentDid:Ue=""}=_,{meta:Ae={}}=M.current||{},{registryUrl:Le,inStore:Se,inputUrl:Ee,dist:Ke}=Ae,He=Se?to(Le,D,Ke):Ee;ee({meta:Ae,installOpts:{type:"component",rootDid:I.meta.did,mountPoint:P,url:He,title:A,name:q,did:Ue}})},zo=P=>{we(!1),z({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(le,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{z({purchaseResultProps:{}})},children:d("common.retry")})}})},Vo=({downloadTokenList:P})=>{M.current.downloadTokenList=P,we(!1),ge()},Ut=({chooseParams:P=M.current,componentDid:D,isInit:A=!1})=>{var rt,Zn,Qn,Xn;const{meta:q,registryUrl:Ue,inStore:Ae,inputUrl:Le}=P,{did:Se,title:Ee,name:Ke}=q,He=(((rt=I.settings)==null?void 0:rt.children)||[]).filter(ie=>ie.status==="deleted"&&ie.meta.bundleDid===Se),Lt=D||"",Ze=(Zn=q.environments)==null?void 0:Zn.map(ie=>{const{name:Ot,validation:it,...at}=ie,At={validation:ks(it)?"":it};return{...at,key:Ot,...At}});M.current={...P,meta:{...q,configs:Ze,registryUrl:Ue,inStore:Ae,inputUrl:Le}};let re={};if(A){const ie=[I],Ot=Ze||[],it=[],at=jo(Ts([...Ot,...it]),"key").filter(Ge=>!!Ge.key).sort((Ge,lt)=>Ge.required&&!lt.required?-1:lt.required&&!Ge.required?1:0),At=B.getSharedConfigObj(ie[0],{configs:at}),$t={},Jn=at.map(Ge=>{const{default:lt,key:ct,...Ko}=Ge;return $t[ct]=At[ct]||lt,{...Ko,key:ct,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[ct]}});re={...re,configsList:Jn,configsValue:$t,hasMissRequiredConfigs:xo(Jn,$t)}}const st=I.children.some(ie=>ie.mountPoint==="/"),$e=He.find(ie=>ie.meta.bundleDid===Se),Me=I.children.find(ie=>ie.meta.bundleDid===Se);re.title=Ee||"",$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:Me?re={...re,pathPrefix:Me.mountPoint||"",componentName:Me.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:st?`/${ve(Ee)||ve(Ke)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((Xn=(Qn=M.current.meta)==null?void 0:Qn.environments)==null?void 0:Xn.length)>0};const xe=Mi(M.current.meta),qe=qi(M.current.meta),Bt=Ft(I);z({bundleDid:Se,componentDid:Lt,...re,hasRequiredEnvironments:Gi(M.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:qe,didSpaceEndpoint:Bt}),A&&xe&&Fo()};m.useEffect(()=>{!c||G!==0||!I||(Ut({chooseParams:{blocklets:[c],meta:c,registryUrl:u||c.homepage,inStore:!0},isInit:!0}),z({showFromUrlDialog:!1}),ge())},[c,G,I]),ue.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Be,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&_.showFromUrlDialog&&t.jsx(Pr,{mode:"component",onCancel:()=>{z({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:A,registryUrl:q})=>{Ut({chooseParams:{meta:P,inputUrl:D,inStore:A,registryUrl:q},isInit:!0}),z({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(bn,{stores:o,extra:Po.isInServerlessMode(K)?null:g?t.jsxs(le,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{z({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(on,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),M.current={}},storageKey:r,children:({currentRegistry:P})=>t.jsx(Rn,{showResourcesSwitch:x,showCategory:b,serverVersion:K==null?void 0:K.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:i,resourceDid:s,handleButtonClick:D=>{Ut({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:A})=>{const q=(_==null?void 0:_.bundleDid)&&(_==null?void 0:_.bundleDid)===(D==null?void 0:D.did);return t.jsxs(zi,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:A}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ws,{className:"check-icon"})})]})}})})]}),cancel:n==="embed"?void 0:d("common.cancel"),confirm:Wi({params:_,blocklet:I,t:d}),onCancel:Ve,onConfirm:()=>{ge()}}),ue.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Be,{component:"div",className:"agreement-wrapper",children:[t.jsx(Io,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(br,{meta:F,onClickNext:ge,installRelated:V,onChangeInstallRelated:de,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!te,confirm:d(te?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ve:Ye,onConfirm:()=>{we(!1),ge()}}),F&&_.requirePurchase&&ue.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(ft,{})]}),body:t.jsxs(Be,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Vn=(nt=ce.current)==null?void 0:nt.getCurrentStep)==null?void 0:Vn.call(nt))===2||_e)&&t.jsx(mt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),dt(_.purchaseResultProps)?oe&&t.jsx(wi,{ref:ce,meta:oe.meta,mode:_.componentDid?"verify":"both",onCancel:zo,installOpts:oe.installOpts,handlePaySuccess:Vo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(ao,{..._.purchaseResultProps})})]}),disabled:((Yn=(ot=ce.current)==null?void 0:ot.getCurrentStep)==null?void 0:Yn.call(ot))===2||_e,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof ce.current.onNext=="function"&&(ce.current.onNext(),we(!0))},onCancel:()=>{Ye()}}),B.hasStartEngine(F)&&So.hasMountPoint(F)?ue.push({key:"config",name:d("common.config"),error:f,body:t.jsxs(Be,{component:"div",children:[t.jsx(mt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(H,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:j||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:_.pathPrefix,onChange:P=>{const D=P.target.value;z({pathPrefix:D}),w(d("common.slugifyHint",{value:en(D)}))}}),!!f&&t.jsx(zt,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:()=>{ge()}}):F&&(_.pathPrefix=((Hn=(Kn=F.interfaces)==null?void 0:Kn[0])==null?void 0:Hn.path)||`/${F.did}`),F&&(_!=null&&_.hasEnvironmentsStep)&&ue.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",_.hasRequiredEnvironments&&t.jsx(ft,{})]}),disabled:!!E||(_==null?void 0:_.hasMissRequiredConfigs),body:()=>t.jsxs(Be,{component:"div",style:{overflowY:"auto"},children:[t.jsx(mt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(gn,{style:{marginTop:-12,width:"100%"},schema:_.configsList,defaultValue:_.configsValue,onChange:(P,{action:D,currentItem:A,allValues:q})=>{D==="confirm"&&z({hasMissRequiredConfigs:xo(_.configsList,q),configsValue:q}),D==="edit"?C(A):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:ge}),F&&(_!=null&&_.didSpaceIsRequiredSetup)&&ue.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",_.didSpaceIsRequiredSetup==="required"&&t.jsx(ft,{})]}),disabled:(_==null?void 0:_.didSpaceIsRequiredSetup)&&!_.didSpaceEndpoint,body:()=>t.jsx(yr,{children:t.jsxs(Be,{component:"div",children:[t.jsx(mt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(vn,{blockletMeta:M.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ne})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:ge}),ue.push({key:"install",name:$n(F==null?void 0:F.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:dt(_.installResultProps),loading:l?!1:dt(_.installResultProps),body:t.jsx(Be,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:dt(_.installResultProps)?t.jsx(pr,{message:t.jsx(Vi,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(ao,{..._.installResultProps})})}),confirm:d("common.complete"),onConfirm:Wo});const se=ue[G]||{},Yo=()=>S||se.error||!_.bundleDid?!0:G>1?!_.pathPrefix:!1;return I?t.jsxs(Fi,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(mr,{steps:ue,mode:"memory",children:t.jsx($i,{ref:Ie,meta:F,isMobile:De,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[se.cancel&&t.jsx(le,{onClick:P=>{P.stopPropagation(),se.onCancel()},disabled:G===ue.length-2&&S,color:"inherit",children:se.cancel||d("common.cancel")}),se.confirm&&t.jsx(le,{onClick:P=>{P.stopPropagation(),se.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof se.disabled=="boolean"?se.disabled:Yo()),variant:"contained",autoFocus:!0,title:se.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof se.loading=="boolean"?se.loading:S)&&t.jsx(pe,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se.confirm})]})})]})]}):null}wn.propTypes={onClose:a.func,mode:a.oneOf(["normal","embed"]),inDialog:a.bool,stores:a.arrayOf(a.string),storeUrl:a.string,resourceType:a.string,resourceDid:a.string,storageKey:a.string,selectedMeta:a.object,showResourcesSwitch:a.bool,showFromUrl:a.bool,enableRunBackground:a.bool,showCategory:a.bool};wn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const Fi=$(y)`
284
+ `,$i=Sn,Mi=e=>e.inStore&&B.isFreeBlocklet(e)===!1,qi=e=>{var n;return[Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Y.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)},Ft=e=>{var n,o;return((o=(n=e==null?void 0:e.configs)==null?void 0:n.find(i=>i.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT))==null?void 0:o.value)||null},Gi=e=>(e.environments||[]).some(n=>n.required),xo=(e,n)=>e==null?void 0:e.some(o=>o.required&&!n[o.key]),Wi=({params:e,blocklet:n,t:o})=>{const i=e.title||e.name;return i?((n==null?void 0:n.children)||[]).find(r=>r.meta.bundleDid===e.bundleDid)?o("blocklet.component.upgradeNext",{name:i}):o("blocklet.component.addNext",{name:i}):o("common.next")},yo=({componentDid:e,timeout:n=1e3,manual:o=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:o},"*")},n)};function wn({onClose:e,mode:n,stores:o,resourceType:i,resourceDid:s,storageKey:r,inDialog:h,selectedMeta:c,storeUrl:u,showResourcesSwitch:x,showFromUrl:g,enableRunBackground:l,showCategory:b}){var Gn,Wn,Fn,zn,nt,Vn,ot,Yn,Kn,Hn;const{t:d,locale:k}=W(),[S,R]=m.useState(!1),[E,C]=m.useState(null),[f,p]=m.useState(""),[j,w]=m.useState(""),{api:v,ws:{useSubscription:U},inService:O,info:K}=Z(),{blocklet:_,actions:{refreshBlocklet:J}}=me(),[oe,ee]=m.useState(null),[Ie,we]=m.useState(!1),Te={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1},[I,fe]=m.useState(Te),[G,he]=m.useState(0),M=m.useRef({}),_e=m.useRef({}),ce=m.useRef({}),De=Ro(P=>P.breakpoints.down("md")),T=Ss(),[V,de]=m.useState(!0),{meta:F}=M.current,te=vr(F),je=m.useRef(!1),z=P=>fe(D=>({...D,...P}));m.useEffect(()=>{if(I.pathPrefix){const{errMsg:P}=qn({...I,pathPrefix:I.pathPrefix,locale:k});p(P)}},[I.pathPrefix]),m.useEffect(()=>{G===0&&fe(Te)},[G]);const Ne=()=>{const P=Ft(_)??"";z({didSpaceEndpoint:P})},Re=()=>{var P;return(P=M==null?void 0:M.current)!=null&&P.meta?B.getDisplayName(M.current):""},Ve=()=>{R(!1),fe({}),je.current=!1,M.current={},e()},Oe=P=>{const D=A=>{z({installResultProps:{variant:"error",title:Re(),subTitle:P,footer:t.jsx(le,{className:"bottom-button",disabled:A,"data-cy":"retry-install-component",onClick:async()=>{D(!0),await Mn(M.current.installInput)},children:t.jsxs(y,{display:"flex",alignItems:"center",children:[A&&t.jsx(pe,{size:16,style:{marginRight:8}}),d("common.retry")]})})}})};D()},tt=P=>D=>{var A,q;(((A=D==null?void 0:D.meta)==null?void 0:A.did)||(D==null?void 0:D.meta))===((q=_==null?void 0:_.meta)==null?void 0:q.did)&&P(D)},Wo=()=>{yo({timeout:0,componentDid:T.componentDid,manual:!0}),Ve(),setTimeout(()=>{const P=document.getElementsByClassName("dashboard-main")[0];P&&(P.scrollTop=P.scrollHeight)},200)};U(Y.BlockletEvents.componentInstalled,tt(()=>{z({installResultProps:{variant:"success",title:Re(),subTitle:d("blocklet.component.installSuccessTip")}}),yo({componentDid:T.componentDid})}),[(Gn=_==null?void 0:_.meta)==null?void 0:Gn.did]),U(Y.BlockletEvents.statusChange,tt(()=>{const P=Ft(_);z(D=>({...D,didSpaceEndpoint:P}))}),[(Wn=_==null?void 0:_.meta)==null?void 0:Wn.did]),U(Y.BlockletEvents.downloadFailed,tt(()=>{je.current=!1,Oe(d("blocklet.component.installComponentError"))}),[(Fn=_==null?void 0:_.meta)==null?void 0:Fn.did]),U(Y.BlockletEvents.installFailed,tt(()=>{je.current=!1,Oe(d("blocklet.component.installComponentError"))}),[(zn=_==null?void 0:_.meta)==null?void 0:zn.did]);const ue=[],$n=P=>((_==null?void 0:_.children)||[]).find(D=>D.meta.did===P),Mn=async P=>{var $e,Me;je.current=!0;const{pathPrefix:D,bundleDid:A,title:q,componentName:Ue="",componentDid:Ae=""}=I,Le=(($e=M.current)==null?void 0:$e.meta)||{},{configs:Se=[],registryUrl:Ee,inStore:Ke,inputUrl:He,dist:Lt}=Le,Ze=(Me=M.current)==null?void 0:Me.downloadTokenList,re=He||(Ke?to(Ee,A,Lt):"");R(!0);const st={rootDid:_.meta.did,url:re,mountPoint:D?ve(D):`/${ve(Le.title||Le.name)}`,title:q,name:Ue,did:Ae,dist:{tarball:"",integrity:""},onlyRequired:!V,...I.hasEnvironmentsStep&&Se.length>0?{configs:Se.map(xe=>({...xe,value:I.configsValue[xe.key]||""}))}:{},...Ze?{downloadTokenList:Ze}:{},...P};try{if(await v.installComponent({input:st}),Ee){const{teamDid:xe,storeList:qe}=bo({fromBlocklet:O,nodeInfo:K,blocklet:_}),{isNew:Bt,decoded:rt}=Es(Ee,qe);Bt&&await v.addBlockletStore({input:{teamDid:xe,url:rt}})}z({installResultProps:{}}),J({showError:!1,attachRuntimeInfo:!1})}catch(xe){const qe=ae(xe);L.error(qe),console.error("installComponent error: ",xe),Oe(qe)}finally{R(!1),M.current.installInput=st}},qn=P=>{const D=Do({params:{...P,did:P.bundleDid},blocklets:[_],blocklet:_,locale:k});if(D){const A=$n(P.bundleDid),q=Nr({params:{...P,did:P.bundleDid},blocklet:_});if(A&&A.mountPoint===q)return{errMsg:""}}return{errMsg:D}},ge=async P=>{var A,q;const{errMsg:D}=qn({...I,locale:k});p(D),G===ue.length-2&&!je.current&&await Mn(P),(q=(A=_e.current)==null?void 0:A.setActiveStepByIndex)==null||q.call(A,Ue=>Ue+1)},Ye=()=>{var P,D;(D=(P=_e.current)==null?void 0:P.setActiveStepByIndex)==null||D.call(P,A=>A-1)},Fo=()=>{const{pathPrefix:P,bundleDid:D,title:A,componentName:q="",componentDid:Ue=""}=I,{meta:Ae={}}=M.current||{},{registryUrl:Le,inStore:Se,inputUrl:Ee,dist:Ke}=Ae,He=Se?to(Le,D,Ke):Ee;ee({meta:Ae,installOpts:{type:"component",rootDid:_.meta.did,mountPoint:P,url:He,title:A,name:q,did:Ue}})},zo=P=>{we(!1),z({purchaseResultProps:{variant:"error",title:Re(),subTitle:P,style:{paddingTop:120},footer:t.jsx(le,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{z({purchaseResultProps:{}})},children:d("common.retry")})}})},Vo=({downloadTokenList:P})=>{M.current.downloadTokenList=P,we(!1),ge()},Ut=({chooseParams:P=M.current,componentDid:D,isInit:A=!1})=>{var rt,Zn,Qn,Xn;const{meta:q,registryUrl:Ue,inStore:Ae,inputUrl:Le}=P,{did:Se,title:Ee,name:Ke}=q,He=(((rt=_.settings)==null?void 0:rt.children)||[]).filter(ie=>ie.status==="deleted"&&ie.meta.bundleDid===Se),Lt=D||"",Ze=(Zn=q.environments)==null?void 0:Zn.map(ie=>{const{name:Ot,validation:it,...at}=ie,At={validation:ks(it)?"":it};return{...at,key:Ot,...At}});M.current={...P,meta:{...q,configs:Ze,registryUrl:Ue,inStore:Ae,inputUrl:Le}};let re={};if(A){const ie=[_],Ot=Ze||[],it=[],at=jo(Ts([...Ot,...it]),"key").filter(Ge=>!!Ge.key).sort((Ge,lt)=>Ge.required&&!lt.required?-1:lt.required&&!Ge.required?1:0),At=B.getSharedConfigObj(ie[0],{configs:at}),$t={},Jn=at.map(Ge=>{const{default:lt,key:ct,...Ko}=Ge;return $t[ct]=At[ct]||lt,{...Ko,key:ct,hidden:!!Y.BLOCKLET_CONFIGURABLE_KEY[ct]}});re={...re,configsList:Jn,configsValue:$t,hasMissRequiredConfigs:xo(Jn,$t)}}const st=_.children.some(ie=>ie.mountPoint==="/"),$e=He.find(ie=>ie.meta.bundleDid===Se),Me=_.children.find(ie=>ie.meta.bundleDid===Se);re.title=Ee||"",$e?re={...re,pathPrefix:$e.mountPoint||"",componentName:$e.meta.name,hasEnvironmentsStep:!1}:Me?re={...re,pathPrefix:Me.mountPoint||"",componentName:Me.meta.name,hasEnvironmentsStep:!1}:re={...re,pathPrefix:st?`/${ve(Ee)||ve(Ke)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:((Xn=(Qn=M.current.meta)==null?void 0:Qn.environments)==null?void 0:Xn.length)>0};const xe=Mi(M.current.meta),qe=qi(M.current.meta),Bt=Ft(_);z({bundleDid:Se,componentDid:Lt,...re,hasRequiredEnvironments:Gi(M.current.meta),requirePurchase:xe,didSpaceIsRequiredSetup:qe,didSpaceEndpoint:Bt}),A&&xe&&Fo()};m.useEffect(()=>{!c||G!==0||!_||(Ut({chooseParams:{blocklets:[c],meta:c,registryUrl:u||c.homepage,inStore:!0},isInit:!0}),z({showFromUrlDialog:!1}),ge())},[c,G,_]),ue.push({key:"selectComponent",name:d("blocklet.component.selectComponent"),body:t.jsxs(Be,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[g&&I.showFromUrlDialog&&t.jsx(Pr,{mode:"component",onCancel:()=>{z({showFromUrlDialog:!1})},onSuccess:({meta:P,inputUrl:D,inStore:A,registryUrl:q})=>{Ut({chooseParams:{meta:P,inputUrl:D,inStore:A,registryUrl:q},isInit:!0}),z({showFromUrlDialog:!1}),ge()},handleText:{title:d("blocklet.component.addComponentTip.fromUrl"),confirm:d("blocklet.component.choose")}}),t.jsx(bn,{stores:o,extra:Po.isInServerlessMode(K)?null:g?t.jsxs(le,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{z({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[t.jsx(on,{style:{fontSize:20,marginRight:4}}),d("blocklet.component.addComponentTip.fromUrl")]}):null,loading:S,onChange:()=>{fe({}),M.current={}},storageKey:r,children:({currentRegistry:P})=>t.jsx(Rn,{showResourcesSwitch:x,showCategory:b,serverVersion:K==null?void 0:K.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:P.url,resourceType:i,resourceDid:s,handleButtonClick:D=>{Ut({chooseParams:{...D,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:D,defaultRender:A})=>{const q=(I==null?void 0:I.bundleDid)&&(I==null?void 0:I.bundleDid)===(D==null?void 0:D.did);return t.jsxs(zi,{children:[t.jsx(y,{className:q?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...q?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:A}),q&&t.jsx(y,{className:"check-container",children:t.jsx(ws,{className:"check-icon"})})]})}})})]}),cancel:n==="embed"?void 0:d("common.cancel"),confirm:Wi({params:I,blocklet:_,t:d}),onCancel:Ve,onConfirm:()=>{ge()}}),ue.push({key:"agreement",name:d("launchBlocklet.introduction"),body:t.jsxs(Be,{component:"div",className:"agreement-wrapper",children:[t.jsx(_o,{title:d("launchBlocklet.introduction"),subTitle:d("blocklet.component.addComponentTip.introduction")}),t.jsx(br,{meta:F,onClickNext:ge,installRelated:V,onChangeInstallRelated:de,handleDescEle:t.jsx("p",{children:d("blocklet.component.addComponentTip.belowInformation")})})]}),cancel:c?void 0:d("common.pre"),disabled:!te,confirm:d(te?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:c?Ve:Ye,onConfirm:()=>{we(!1),ge()}}),F&&I.requirePurchase&&ue.push({key:"purchase",name:t.jsxs(t.Fragment,{children:[d("common.verifyNFT"),t.jsx(ft,{})]}),body:t.jsxs(Be,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(((Vn=(nt=ce.current)==null?void 0:nt.getCurrentStep)==null?void 0:Vn.call(nt))===2||Ie)&&t.jsx(mt,{title:d("common.verifyNFT"),subTitle:d("blocklet.component.addComponentTip.verifyNFT")}),dt(I.purchaseResultProps)?oe&&t.jsx(wi,{ref:ce,meta:oe.meta,mode:I.componentDid?"verify":"both",onCancel:zo,installOpts:oe.installOpts,handlePaySuccess:Vo}):t.jsx("div",{className:"flex-align-center flex-justify-center",children:t.jsx(ao,{...I.purchaseResultProps})})]}),disabled:((Yn=(ot=ce.current)==null?void 0:ot.getCurrentStep)==null?void 0:Yn.call(ot))===2||Ie,cancel:d("common.pre"),confirm:d("common.next"),onConfirm:()=>{typeof ce.current.onNext=="function"&&(ce.current.onNext(),we(!0))},onCancel:()=>{Ye()}}),B.hasStartEngine(F)&&So.hasMountPoint(F)?ue.push({key:"config",name:d("common.config"),error:f,body:t.jsxs(Be,{component:"div",children:[t.jsx(mt,{title:d("common.config"),subTitle:d("blocklet.component.addComponentTip.config")}),t.jsx(H,{label:d("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"mount-point-input"},fullWidth:!0,helperText:j||d("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:I.pathPrefix,onChange:P=>{const D=P.target.value;z({pathPrefix:D}),w(d("common.slugifyHint",{value:en(D)}))}}),!!f&&t.jsx(zt,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:()=>{ge()}}):F&&(I.pathPrefix=((Hn=(Kn=F.interfaces)==null?void 0:Kn[0])==null?void 0:Hn.path)||`/${F.did}`),F&&(I!=null&&I.hasEnvironmentsStep)&&ue.push({key:"environment",name:t.jsxs(t.Fragment,{children:[d("common.environment")," ",I.hasRequiredEnvironments&&t.jsx(ft,{})]}),disabled:!!E||(I==null?void 0:I.hasMissRequiredConfigs),body:()=>t.jsxs(Be,{component:"div",style:{overflowY:"auto"},children:[t.jsx(mt,{title:d("common.environment"),subTitle:d("blocklet.component.addComponentTip.environment")}),t.jsx(gn,{style:{marginTop:-12,width:"100%"},schema:I.configsList,defaultValue:I.configsValue,onChange:(P,{action:D,currentItem:A,allValues:q})=>{D==="confirm"&&z({hasMissRequiredConfigs:xo(I.configsList,q),configsValue:q}),D==="edit"?C(A):["cancel","confirm"].includes(D)&&C(null)}})]}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:ge}),F&&(I!=null&&I.didSpaceIsRequiredSetup)&&ue.push({key:"didSpace",name:t.jsxs(t.Fragment,{children:[d("blocklet.component.didSpaceConfig")," ",I.didSpaceIsRequiredSetup==="required"&&t.jsx(ft,{})]}),disabled:(I==null?void 0:I.didSpaceIsRequiredSetup)&&!I.didSpaceEndpoint,body:()=>t.jsx(yr,{children:t.jsxs(Be,{component:"div",children:[t.jsx(mt,{title:d("blocklet.component.didSpaceConfig"),subTitle:d("blocklet.component.didSpaceConfigTip")}),t.jsx(y,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:t.jsx(vn,{blockletMeta:M.current.meta,onNext:()=>{ge()},onEndpointUpdate:Ne})})]})}),cancel:d("common.pre"),confirm:d("common.next"),onCancel:Ye,onConfirm:ge}),ue.push({key:"install",name:$n(F==null?void 0:F.did)?d("common.upgrade"):d("common.install"),disabled:l?!1:dt(I.installResultProps),loading:l?!1:dt(I.installResultProps),body:t.jsx(Be,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:dt(I.installResultProps)?t.jsx(pr,{message:t.jsx(Vi,{children:d(l?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):t.jsx("div",{style:{marginTop:120},children:t.jsx(ao,{...I.installResultProps})})}),confirm:d("common.complete"),onConfirm:Wo});const se=ue[G]||{},Yo=()=>S||se.error||!I.bundleDid?!0:G>1?!I.pathPrefix:!1;return _?t.jsxs(Fi,{sx:h?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[t.jsx(mr,{steps:ue,mode:"memory",children:t.jsx($i,{ref:_e,meta:F,isMobile:De,onStepChange:P=>{he(P)}})}),t.jsxs(y,{className:"action-bar",children:[se.cancel&&t.jsx(le,{onClick:P=>{P.stopPropagation(),se.onCancel()},disabled:G===ue.length-2&&S,color:"inherit",children:se.cancel||d("common.cancel")}),se.confirm&&t.jsx(le,{onClick:P=>{P.stopPropagation(),se.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:S||(typeof se.disabled=="boolean"?se.disabled:Yo()),variant:"contained",autoFocus:!0,title:se.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:t.jsxs(y,{display:"flex",alignItems:"center",overflow:"hidden",children:[(typeof se.loading=="boolean"?se.loading:S)&&t.jsx(pe,{style:{marginRight:8},size:16}),t.jsx(y,{component:"span",flex:1,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se.confirm})]})})]})]}):null}wn.propTypes={onClose:a.func,mode:a.oneOf(["normal","embed"]),inDialog:a.bool,stores:a.arrayOf(a.string),storeUrl:a.string,resourceType:a.string,resourceDid:a.string,storageKey:a.string,selectedMeta:a.object,showResourcesSwitch:a.bool,showFromUrl:a.bool,enableRunBackground:a.bool,showCategory:a.bool};wn.defaultProps={onClose:()=>{},mode:"normal",stores:[],storeUrl:"",resourceType:"",resourceDid:"",storageKey:"",inDialog:!0,selectedMeta:null,showResourcesSwitch:!0,showFromUrl:!0,enableRunBackground:!0,showCategory:!0};const Fi=$(y)`
285
285
  .action-bar {
286
286
  display: flex;
287
287
  justify-content: flex-end;
@@ -297,7 +297,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
297
297
  `,Be=$(ne)`
298
298
  width: 100%;
299
299
  height: 100%;
300
- `,mt=$(Io)`
300
+ `,mt=$(_o)`
301
301
  margin-bottom: 24px;
302
302
  `,zi=$.div`
303
303
  position: relative;
@@ -358,7 +358,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
358
358
  .MuiDialogContent-root {
359
359
  background-color: ${({theme:e})=>e.palette.background.paper};
360
360
  }
361
- `;function Tn({blocklet:e,children:n}){const{t:o}=W(),[i,s]=m.useState(!1),r=h=>{h.stopPropagation(),s(!0)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({open:r}):t.jsxs(ye,{onClick:r,className:"component-action","data-cy":"action-add-component",children:[t.jsx(on,{style:{fontSize:18,marginRight:5}}),o("blocklet.component.add")]}),t.jsx(Pt,{showDialog:i,setShowDialog:s,blocklet:e})]})}Tn.propTypes={children:a.any,blocklet:a.object.isRequired};Tn.defaultProps={children:null};const Ki=e=>e.children.filter(n=>n.meta.interfaces.find(o=>o.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function _t({params:e,setParams:n,setError:o,serviceTypes:i}){const{t:s}=W(),{blocklet:r}=me(),h=r.meta.did,c=Ki(r),[u,x]=m.useState([]),g={301:s("common.redirectPermanently"),302:s("common.redirectTemporary"),307:s("common.redirectTemporary"),308:s("common.redirectPermanently")};return m.useEffect(()=>{if(e.type===N.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(k=>k.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(k=>({value:k,label:`${k} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(k=>k.value===e.pageGroup)===!1&&n({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(H,{select:!0,label:s("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{o(""),n({...e,type:l.target.value,did:l.target.value===N.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:i.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===N.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(H,{select:!0,label:s("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>n({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(H,{label:s("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:s("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{n({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?o(""):o(s("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===N.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(H,{select:!0,label:s("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{n({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),u.length?t.jsx(H,{select:!0,label:s("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:s("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{n({...e,pageGroup:l.target.value})},SelectProps:{},children:u.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(H,{label:s("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:s("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();n({...e,url:l.target.value,__disableConfirm:!b}),o(b?"":s("router.validation.rewriteUrlRequired"))}},"url"),e.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(H,{select:!0,label:s("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>n({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:N.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(H,{label:s("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:s("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();n({...e,responseBody:l.target.value,__disableConfirm:!b}),o(b?"":s("router.rule.add.responseBodyRequired"))}},"response-body")]]})}_t.propTypes={params:a.object,serviceTypes:a.array,setParams:a.func,setError:a.func};_t.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:N.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:N.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:N.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:N.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:N.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function En({children:e,hiddenChildren:n,open:o,onClose:i}){const{t:s}=W(),{api:r}=Z(),{blocklet:h}=me(),[c,u]=m.useState(!1),[x,g]=m.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{i==null||i(),u(!1),g(!1)},k=async C=>{try{const f=await gt(C,s);if(f)throw f;u(!0);const p={from:{pathPrefix:ve(C.pathPrefix)},to:{type:C.type}};C.type===N.ROUTING_RULE_TYPES.REDIRECT&&(p.to.url=C.url.trim(),p.to.redirectCode=C.redirectCode),C.type===N.ROUTING_RULE_TYPES.COMPONENT&&(p.to.did=l,p.to.componentId=C.componentId,p.to.pageGroup=C.pageGroup),C.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(p.to.url=ve(C.url)),C.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(p.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await r.addRoutingRule({input:{id:b,rule:p,teamDid:l}}),i==null||i()}catch(f){L.error(f.message)}finally{u(!1),g(!1)}},S={title:s("router.rule.add.title"),description:(C,f,p)=>{const j=w=>{if(p(null),gt(w,s)){f({...w,__disableConfirm:!0});return}f({...w})};return t.jsxs(ne,{component:"div",children:[t.jsx(H,{label:s("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||s("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let v=!1;const U=Do({params:{...C,pathPrefix:w.target.value},blocklets:[h]});p(U),C.type===N.ROUTING_RULE_TYPES.BLOCKLET&&U&&(v=!0),C.type===N.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(v=!0),C.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(v=!0),C.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(v=!0),w.target.value.trim()||(v=!0,p(s("router.validation.pathPrefixRequired"))),v||p("");const O=s("common.slugifyHint",{value:en(w.target.value)});f({...C,pathPrefix:w.target.value,pathPrefixHint:O,__disableConfirm:v})}}),t.jsx(_t,{params:C,setParams:j,setError:p})]})},confirm:s("router.rule.add.confirm"),cancel:s("common.cancel"),params:{did:"",pathPrefix:"",type:N.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:k,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let E=null;return n||(E=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(pe,{size:16}):t.jsx(on,{style:{fontSize:18,marginRight:5}}),s("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[E,(o||x)&&t.jsx(ze,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}En.propTypes={children:a.any,onClose:a.func,hiddenChildren:a.bool,open:a.bool};En.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function et({depth:e,className:n}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:n,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}et.propTypes={depth:a.number,className:a.string};et.defaultProps={depth:1,className:""};function kn({id:e,from:n,children:o}){const{t:i}=W(),{api:s}=Z(),{blocklet:r}=me(),[h,c]=m.useState(!1),[u,x]=m.useState(null),g=r.meta.did,l=r.site.id,b=n.pathPrefix,d=()=>{c(!1),x(null)},k=async()=>{c(!0);try{await s.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(E){L.error(E.message)}finally{x(null),c(!1)}},S={keyName:b,title:i("router.rule.delete.title"),description:i("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:i("router.rule.delete.confirm_desc",{name:b}),confirm:i("common.delConfirm"),cancel:i("router.rule.delete.cancel"),onConfirm:k,onCancel:d},R=E=>{E.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(pe,{size:16}):t.jsx(Tt,{style:{fontSize:18,marginRight:5}}),i("router.rule.delete.title")]}),u&&t.jsx(Br,{keyName:u.keyName,title:u.title,description:u.description,confirmPlaceholder:u.confirmPlaceholder,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}kn.propTypes={id:a.string.isRequired,from:a.object.isRequired,children:a.any};kn.defaultProps={children:null};function Pn({id:e,from:n,to:o,children:i}){var C,f;const{t:s}=W(),{api:r}=Z(),{blocklet:h}=me(),[c,u]=m.useState(!1),[x,g]=m.useState(null),l=h.meta.did,b=h.site.id,d=n.pathPrefix,k=()=>{u(!1),g(null)},S=async p=>{try{const j=await gt(p,s);if(j)throw j;u(!0);const w={id:e,from:{pathPrefix:ve(p.pathPrefix)},to:{type:p.type}};p.type===N.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=p.url,w.to.redirectCode=p.redirectCode),p.type===N.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=p.componentId,w.to.pageGroup=p.pageGroup),p.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=ve(p.url)),p.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:p.responseType,body:p.responseBody}),await r.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(j){L.error(j.message)}finally{u(!1),g(null)}},R={title:s("router.rule.update.title"),description:(p,j,w)=>{const v=U=>{if(gt(U,s)){j({...U,__disableConfirm:!0});return}j({...U})};return t.jsxs(ne,{component:"div",children:[t.jsx(H,{label:s("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:p.helperText||s("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:p.pathPrefix,onChange:U=>{let O=!1;p.type===N.ROUTING_RULE_TYPES.REDIRECT&&!p.url&&(O=!0),p.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!p.url&&(O=!0),p.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!p.responseType||!p.responseBody)&&(O=!0),U.target.value.trim()||(O=!0,w(s("router.validation.pathPrefixRequired"))),O||w("");const K=s("common.slugifyHint",{value:en(U.target.value)});j({...p,pathPrefix:U.target.value,helperText:K,__disableConfirm:O})}}),t.jsx(_t,{params:p,setParams:v,setError:w})]})},confirm:s("router.rule.update.confirm"),cancel:s("router.rule.update.cancel"),color:"primary",params:{did:o.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:o.type||N.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:o.redirectCode||302,componentId:o.componentId||"",pageGroup:o.pageGroup||"",url:o.url||"",responseType:((C=o.response)==null?void 0:C.contentType)||"",responseBody:(((f=o.response)==null?void 0:f.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:k},E=p=>{p.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof i=="function"?i({loading:c,open:E}):t.jsxs(ye,{onClick:E,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(pe,{size:16}):t.jsx(ko,{style:{fontSize:18,marginRight:5}}),s("router.rule.update.title")]}),x&&t.jsx(ze,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}Pn.propTypes={id:a.string.isRequired,from:a.object.isRequired,to:a.object.isRequired,children:a.any};Pn.defaultProps={children:null};function _n(e){const{locale:n}=W(),{blocklet:o,recommendedDomain:i}=me(),s=wo(i,e.from.pathPrefix,tn(o,n));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:s,rel:"noopener noreferrer",title:s,children:t.jsx(X,{size:"small",children:t.jsx(Uo,{})})}),t.jsx(Pn,{...e,children:({open:r})=>t.jsx(X,{size:"small",onClick:r,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Sr,{})})}),t.jsx(kn,{...e,children:({open:r})=>t.jsx(X,{size:"small",onClick:r,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Tt,{})})})]})}_n.propTypes={isProtected:a.bool};_n.defaultProps={isProtected:!1};function $o({group:e,...n}){return e?t.jsx(Je,{type:"reverse",...n,children:e}):null}$o.propTypes={group:a.string.isRequired};function xt({domain:e,isHttps:n,toUrl:o}){const i=n?"https":"http";let s=o;return Is(s)||(s=`${i}://${e}${o}`),t.jsx(St,{href:s,target:"_blank",style:{fontSize:14},underline:"hover",children:o},s)}xt.propTypes={domain:a.string.isRequired,toUrl:a.string.isRequired,isHttps:a.bool};xt.defaultProps={isHttps:!1};function It({hasPermission:e}){const{t:n,locale:o}=W(),i=bt(),{blocklet:s,recommendedDomain:r}=me();return s.site.rules.filter(c=>c.to.type!==N.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let u=null,x=null;c.to.type===N.ROUTING_RULE_TYPES.NONE?u="404":c.to.type===N.ROUTING_RULE_TYPES.REDIRECT?u=c.to.redirectCode:c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE?u="R":c.to.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE?u=t.jsx(si,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&(x=s.children.find(b=>b.meta.did===c.to.componentId),u="C");const g=c.isProtected?t.jsx(Ce,{title:n("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(X,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(kr,{style:{fill:i.palette.text.disabled}})})})}):t.jsx(_n,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof u=="object"?u:t.jsx(Ps,{children:u}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"#222",fontSize:16},children:[c.to.type===N.ROUTING_RULE_TYPES.NONE&&n("common.page404"),c.to.type===N.ROUTING_RULE_TYPES.REDIRECT&&n("common.redirect"),c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&n("common.rewrite"),c.to.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=N.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===N.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(xt,{domain:r,toUrl:c.to.url}),c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(xt,{domain:r,toUrl:c.to.url}),c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&t.jsx($o,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(St,{href:wo(r,c.from.pathPrefix,tn(s,o)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:_s(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(et,{},"divider")]})}It.propTypes={hasPermission:a.bool};It.defaultProps={hasPermission:!1};const Hi=wt(It,"mutate_blocklets"),Zi=wt(It,"",Xe);function Qi(e){const{inService:n}=Z();return n?t.jsx(Zi,{...e}):t.jsx(Hi,{...e})}function Xi(e,n){const o=m.useRef(n);m.useEffect(()=>{const i=s=>o.current(s.detail);return window.addEventListener(e,i),()=>window.removeEventListener(e,i)},[e])}function Ji(e){const n=To(),{t:o}=W(),i=()=>{const s=new URLSearchParams(window.location.search);s.get("checkUpdate")&&(s.delete("checkUpdate"),n(s.toString()),e(),L.success(o("notification.checkingForUpdates")))};m.useEffect(i,[]),Xi("checkUpdate",i)}function ea({blocklet:e,scrollToComponent:n}={blocklet:null,scrollToComponent:!1}){const o=To(),{t:i}=W(),s=m.useRef(null),r=m.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){s.current=c,h.delete("install-component"),o(h.toString());const u=e.optionalComponents.find(g=>g.meta.did===c);if(!u)return L.success(i("notification.installComponentError",{did:c})),null;const{meta:x}=u;if(n){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,o,i,n]);return m.useEffect(()=>{var h;s.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),r}function Dt({open:e,onClose:n,blocklet:o,ancestors:i}){var x;const{t:s}=W(),r=[...(i||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=o==null?void 0:o.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=s("preferencesFor",{name:B.getDisplayName(o,!0)}),c=m.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(Fe(o.status)||o.status==="unknown"&&Fe(o.status))return null;const u=()=>{n==null||n()};return t.jsx(ta,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:u,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(vo,{gap:1,children:[t.jsx(ne,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:s("description.preferences",{name:B.getDisplayName(o,!0)})}),t.jsx(wr,{id:r,styles:c})]})})}Dt.propTypes={blocklet:a.object.isRequired,ancestors:a.array,open:a.bool,onClose:a.func};Dt.defaultProps={ancestors:[],open:!1,onClose:null};const ta=$(jt)`
361
+ `;function Tn({blocklet:e,children:n}){const{t:o}=W(),[i,s]=m.useState(!1),r=h=>{h.stopPropagation(),s(!0)};return t.jsxs(t.Fragment,{children:[typeof n=="function"?n({open:r}):t.jsxs(ye,{onClick:r,className:"component-action","data-cy":"action-add-component",children:[t.jsx(on,{style:{fontSize:18,marginRight:5}}),o("blocklet.component.add")]}),t.jsx(Pt,{showDialog:i,setShowDialog:s,blocklet:e})]})}Tn.propTypes={children:a.any,blocklet:a.object.isRequired};Tn.defaultProps={children:null};const Ki=e=>e.children.filter(n=>n.meta.interfaces.find(o=>o.type===Y.BLOCKLET_INTERFACE_TYPE_WEB));function It({params:e,setParams:n,setError:o,serviceTypes:i}){const{t:s}=W(),{blocklet:r}=me(),h=r.meta.did,c=Ki(r),[u,x]=m.useState([]),g={301:s("common.redirectPermanently"),302:s("common.redirectTemporary"),307:s("common.redirectTemporary"),308:s("common.redirectPermanently")};return m.useEffect(()=>{if(e.type===N.ROUTING_RULE_TYPES.COMPONENT&&e.componentId){const l=c.find(k=>k.meta.did===e.componentId),b=B.findWebInterface(l.meta),d=(Array.isArray(b==null?void 0:b.pageGroups)?b.pageGroups:[]).map(k=>({value:k,label:`${k} pages`}));d.length&&d.unshift({value:"",label:"All pages"}),x(d),e.pageGroup&&d.find(k=>k.value===e.pageGroup)===!1&&n({...e,pageGroups:""})}},[e.componentId,e.type]),t.jsxs(t.Fragment,{children:[t.jsx(H,{select:!0,label:s("router.domain.add.type"),autoComplete:"off",variant:"outlined",name:"type","data-cy":"domain-add-type",fullWidth:!0,value:e.type,onChange:l=>{o(""),n({...e,type:l.target.value,did:l.target.value===N.ROUTING_RULE_TYPES.BLOCKLET?h:"",__disableConfirm:!1})},style:{marginBottom:32},SelectProps:{},children:i.map(({name:l,value:b})=>t.jsx(ye,{value:b,children:l},b))}),e.type===N.ROUTING_RULE_TYPES.REDIRECT&&[t.jsx(H,{select:!0,label:s("router.domain.add.redirect"),autoComplete:"off",variant:"outlined",name:"type",fullWidth:!0,value:e.redirectCode,onChange:l=>n({...e,redirectCode:l.target.value}),style:{marginBottom:32},SelectProps:{},children:Object.keys(g).map(l=>t.jsx(ye,{value:l,children:`${g[l]} - ${l}`},l))},"redirectCode"),t.jsx(H,{label:s("common.redirectUrl"),autoComplete:"off",variant:"outlined",name:"url",inputProps:{"data-cy":"redirect-url-input"},fullWidth:!0,value:e.url,helperText:s("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{n({...e,url:l.target.value,__disableConfirm:!l.target.value.trim()}),l.target.value.trim()?o(""):o(s("router.validation.redirectUrlRequired"))}},"redirectUrl")],e.type===N.ROUTING_RULE_TYPES.COMPONENT&&[t.jsx(H,{select:!0,label:s("router.domain.add.component"),autoComplete:"off",variant:"outlined","data-cy":"select-component-input",name:"componentId",fullWidth:!0,value:e.componentId,onChange:l=>{n({...e,componentId:l.target.value})},style:{marginBottom:32},SelectProps:{},children:c.map(l=>t.jsx(ye,{value:l.meta.did,selected:l.meta.did===e.componentId,children:B.getDisplayName(l,!0)},l.meta.did))},"componentId"),u.length?t.jsx(H,{select:!0,label:s("router.domain.add.pageGroup"),autoComplete:"off",variant:"outlined",name:"pageGroup","data-cy":"route-group-input",fullWidth:!0,value:e.pageGroup,helperText:s("router.domain.add.pageGroupTip"),style:{marginBottom:32},onChange:l=>{n({...e,pageGroup:l.target.value})},SelectProps:{},children:u.map(l=>t.jsx(ye,{value:l.value,selected:l.value===e.pageGroup,children:l.label},l.label))},"pageGroup"):null].filter(Boolean),e.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(H,{label:s("common.rewriteUrl"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"rewrite-url-input",fullWidth:!0,value:e.url,helperText:s("router.urlHelperText"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();n({...e,url:l.target.value,__disableConfirm:!b}),o(b?"":s("router.validation.rewriteUrlRequired"))}},"url"),e.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&[t.jsx(H,{select:!0,label:s("router.rule.add.responseType"),autoComplete:"off",variant:"outlined",name:"responseType",fullWidth:!0,value:e.responseType,onChange:l=>n({...e,responseType:l.target.value}),style:{marginBottom:32},SelectProps:{},children:N.ROUTING_RESPONSE_TYPES.map(l=>t.jsx(ye,{value:l.value,children:l.text},l.value))},"responseType"),t.jsx(H,{label:s("router.rule.add.responseBody"),autoComplete:"off",variant:"outlined",name:"responseBody","data-cy":"response-body-input",fullWidth:!0,multiline:!0,minRows:3,value:e.responseBody,helperText:s("router.rule.add.responseBodyTip"),style:{marginBottom:32},onChange:l=>{const b=l.target.value.trim();n({...e,responseBody:l.target.value,__disableConfirm:!b}),o(b?"":s("router.rule.add.responseBodyRequired"))}},"response-body")]]})}It.propTypes={params:a.object,serviceTypes:a.array,setParams:a.func,setError:a.func};It.defaultProps={params:{},serviceTypes:[{name:"Redirect",value:N.ROUTING_RULE_TYPES.REDIRECT},{name:"Default - User will see the 404 page",value:N.ROUTING_RULE_TYPES.NONE},{name:"Rewrite - Route traffic without redirect",value:N.ROUTING_RULE_TYPES.GENERAL_REWRITE},{name:"Response - Response with provided content",value:N.ROUTING_RULE_TYPES.DIRECT_RESPONSE},{name:"Component - Pass traffic to blocklet component",value:N.ROUTING_RULE_TYPES.COMPONENT}],setParams:()=>{},setError:()=>{}};function En({children:e,hiddenChildren:n,open:o,onClose:i}){const{t:s}=W(),{api:r}=Z(),{blocklet:h}=me(),[c,u]=m.useState(!1),[x,g]=m.useState(!1),l=h.meta.did,b=h.site.id,d=()=>{i==null||i(),u(!1),g(!1)},k=async C=>{try{const f=await gt(C,s);if(f)throw f;u(!0);const p={from:{pathPrefix:ve(C.pathPrefix)},to:{type:C.type}};C.type===N.ROUTING_RULE_TYPES.REDIRECT&&(p.to.url=C.url.trim(),p.to.redirectCode=C.redirectCode),C.type===N.ROUTING_RULE_TYPES.COMPONENT&&(p.to.did=l,p.to.componentId=C.componentId,p.to.pageGroup=C.pageGroup),C.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(p.to.url=ve(C.url)),C.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(p.to.response={status:200,contentType:C.responseType,body:C.responseBody}),await r.addRoutingRule({input:{id:b,rule:p,teamDid:l}}),i==null||i()}catch(f){L.error(f.message)}finally{u(!1),g(!1)}},S={title:s("router.rule.add.title"),description:(C,f,p)=>{const j=w=>{if(p(null),gt(w,s)){f({...w,__disableConfirm:!0});return}f({...w})};return t.jsxs(ne,{component:"div",children:[t.jsx(H,{label:s("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:C.pathPrefixHint||s("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:C.pathPrefix,onChange:w=>{let v=!1;const U=Do({params:{...C,pathPrefix:w.target.value},blocklets:[h]});p(U),C.type===N.ROUTING_RULE_TYPES.BLOCKLET&&U&&(v=!0),C.type===N.ROUTING_RULE_TYPES.REDIRECT&&!C.url&&(v=!0),C.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!C.url&&(v=!0),C.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!C.responseType||!C.responseBody)&&(v=!0),w.target.value.trim()||(v=!0,p(s("router.validation.pathPrefixRequired"))),v||p("");const O=s("common.slugifyHint",{value:en(w.target.value)});f({...C,pathPrefix:w.target.value,pathPrefixHint:O,__disableConfirm:v})}}),t.jsx(It,{params:C,setParams:j,setError:p})]})},confirm:s("router.rule.add.confirm"),cancel:s("common.cancel"),params:{did:"",pathPrefix:"",type:N.ROUTING_RULE_TYPES.REDIRECT,componentId:"",pageGroup:"",redirectCode:302,responseType:"text/plain",responseBody:"",__disableConfirm:!0},onConfirm:k,onCancel:d},R=C=>{C.stopPropagation(),g(!0)};let E=null;return n||(E=typeof e=="function"?e({open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-add-rule",children:[c?t.jsx(pe,{size:16}):t.jsx(on,{style:{fontSize:18,marginRight:5}}),s("router.rule.add.title")]})),t.jsxs(t.Fragment,{children:[E,(o||x)&&t.jsx(ze,{title:S.title,description:S.description,confirm:S.confirm,cancel:S.cancel,params:S.params,onConfirm:S.onConfirm,onCancel:S.onCancel,color:"primary"})]})}En.propTypes={children:a.any,onClose:a.func,hiddenChildren:a.bool,open:a.bool};En.defaultProps={children:null,open:!1,onClose:null,hiddenChildren:!1};function et({depth:e,className:n}){return t.jsx(y,{ml:Math.max((e-1)*2,0),className:n,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}et.propTypes={depth:a.number,className:a.string};et.defaultProps={depth:1,className:""};function kn({id:e,from:n,children:o}){const{t:i}=W(),{api:s}=Z(),{blocklet:r}=me(),[h,c]=m.useState(!1),[u,x]=m.useState(null),g=r.meta.did,l=r.site.id,b=n.pathPrefix,d=()=>{c(!1),x(null)},k=async()=>{c(!0);try{await s.deleteRoutingRule({input:{id:l,ruleId:e,teamDid:g}})}catch(E){L.error(E.message)}finally{x(null),c(!1)}},S={keyName:b,title:i("router.rule.delete.title"),description:i("router.rule.delete.description",{name:`<b>${b}</b>`}),confirmPlaceholder:i("router.rule.delete.confirm_desc",{name:b}),confirm:i("common.delConfirm"),cancel:i("router.rule.delete.cancel"),onConfirm:k,onCancel:d},R=E=>{E.stopPropagation(),x(S)};return t.jsxs(t.Fragment,{children:[typeof o=="function"?o({loading:h,open:R}):t.jsxs(ye,{onClick:R,className:"rule-action","data-cy":"action-delete-rule",children:[h?t.jsx(pe,{size:16}):t.jsx(Tt,{style:{fontSize:18,marginRight:5}}),i("router.rule.delete.title")]}),u&&t.jsx(Br,{keyName:u.keyName,title:u.title,description:u.description,confirmPlaceholder:u.confirmPlaceholder,confirm:u.confirm,cancel:u.cancel,params:u.params,onConfirm:u.onConfirm,onCancel:u.onCancel})]})}kn.propTypes={id:a.string.isRequired,from:a.object.isRequired,children:a.any};kn.defaultProps={children:null};function Pn({id:e,from:n,to:o,children:i}){var C,f;const{t:s}=W(),{api:r}=Z(),{blocklet:h}=me(),[c,u]=m.useState(!1),[x,g]=m.useState(null),l=h.meta.did,b=h.site.id,d=n.pathPrefix,k=()=>{u(!1),g(null)},S=async p=>{try{const j=await gt(p,s);if(j)throw j;u(!0);const w={id:e,from:{pathPrefix:ve(p.pathPrefix)},to:{type:p.type}};p.type===N.ROUTING_RULE_TYPES.REDIRECT&&(w.to.url=p.url,w.to.redirectCode=p.redirectCode),p.type===N.ROUTING_RULE_TYPES.COMPONENT&&(w.to.did=l,w.to.componentId=p.componentId,w.to.pageGroup=p.pageGroup),p.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&(w.to.url=ve(p.url)),p.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(w.to.response={status:200,contentType:p.responseType,body:p.responseBody}),await r.updateRoutingRule({input:{id:b,rule:w,teamDid:l}})}catch(j){L.error(j.message)}finally{u(!1),g(null)}},R={title:s("router.rule.update.title"),description:(p,j,w)=>{const v=U=>{if(gt(U,s)){j({...U,__disableConfirm:!0});return}j({...U})};return t.jsxs(ne,{component:"div",children:[t.jsx(H,{label:s("router.rule.add.pathPrefix"),autoComplete:"off",variant:"outlined",name:"pathPrefix",inputProps:{"data-cy":"path-prefix-input"},fullWidth:!0,autoFocus:!0,helperText:p.helperText||s("router.rule.add.pathPrefixTip"),style:{marginBottom:32},margin:"dense",value:p.pathPrefix,onChange:U=>{let O=!1;p.type===N.ROUTING_RULE_TYPES.REDIRECT&&!p.url&&(O=!0),p.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&!p.url&&(O=!0),p.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&(!p.responseType||!p.responseBody)&&(O=!0),U.target.value.trim()||(O=!0,w(s("router.validation.pathPrefixRequired"))),O||w("");const K=s("common.slugifyHint",{value:en(U.target.value)});j({...p,pathPrefix:U.target.value,helperText:K,__disableConfirm:O})}}),t.jsx(It,{params:p,setParams:v,setError:w})]})},confirm:s("router.rule.update.confirm"),cancel:s("router.rule.update.cancel"),color:"primary",params:{did:o.did||"",pathPrefix:d==="/"?d:d.replace(/^\/+/,"").replace(/\/+$/,""),type:o.type||N.ROUTING_RULE_TYPES.BLOCKLET,redirectCode:o.redirectCode||302,componentId:o.componentId||"",pageGroup:o.pageGroup||"",url:o.url||"",responseType:((C=o.response)==null?void 0:C.contentType)||"",responseBody:(((f=o.response)==null?void 0:f.body)||"").replace(/\\"/g,'"'),__disableConfirm:!1},onConfirm:S,onCancel:k},E=p=>{p.stopPropagation(),g(R)};return t.jsxs(t.Fragment,{children:[typeof i=="function"?i({loading:c,open:E}):t.jsxs(ye,{onClick:E,className:"rule-action","data-cy":"action-update-rule",children:[c?t.jsx(pe,{size:16}):t.jsx(ko,{style:{fontSize:18,marginRight:5}}),s("router.rule.update.title")]}),x&&t.jsx(ze,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}Pn.propTypes={id:a.string.isRequired,from:a.object.isRequired,to:a.object.isRequired,children:a.any};Pn.defaultProps={children:null};function In(e){const{locale:n}=W(),{blocklet:o,recommendedDomain:i}=me(),s=wo(i,e.from.pathPrefix,tn(o,n));return t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:s,rel:"noopener noreferrer",title:s,children:t.jsx(X,{size:"small",children:t.jsx(Uo,{})})}),t.jsx(Pn,{...e,children:({open:r})=>t.jsx(X,{size:"small",onClick:r,disabled:e.isProtected,"data-cy":"action-update-rule",children:t.jsx(Sr,{})})}),t.jsx(kn,{...e,children:({open:r})=>t.jsx(X,{size:"small",onClick:r,disabled:e.isProtected,"data-cy":"action-delete-rule",children:t.jsx(Tt,{})})})]})}In.propTypes={isProtected:a.bool};In.defaultProps={isProtected:!1};function $o({group:e,...n}){return e?t.jsx(Je,{type:"reverse",...n,children:e}):null}$o.propTypes={group:a.string.isRequired};function xt({domain:e,isHttps:n,toUrl:o}){const i=n?"https":"http";let s=o;return _s(s)||(s=`${i}://${e}${o}`),t.jsx(St,{href:s,target:"_blank",style:{fontSize:14},underline:"hover",children:o},s)}xt.propTypes={domain:a.string.isRequired,toUrl:a.string.isRequired,isHttps:a.bool};xt.defaultProps={isHttps:!1};function _t({hasPermission:e}){const{t:n,locale:o}=W(),i=bt(),{blocklet:s,recommendedDomain:r}=me();return s.site.rules.filter(c=>c.to.type!==N.ROUTING_RULE_TYPES.BLOCKLET).map(c=>{var l;let u=null,x=null;c.to.type===N.ROUTING_RULE_TYPES.NONE?u="404":c.to.type===N.ROUTING_RULE_TYPES.REDIRECT?u=c.to.redirectCode:c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE?u="R":c.to.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE?u=t.jsx(si,{sx:{color:"text.secondary",fontSize:"45px"}}):c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&(x=s.children.find(b=>b.meta.did===c.to.componentId),u="C");const g=c.isProtected?t.jsx(Ce,{title:n("blocklet.router.urlLockTooltip"),placement:"top",children:t.jsx("span",{children:t.jsx(X,{disabled:!0,size:"small",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0,margin:"12px 0"},children:t.jsx(kr,{style:{fill:i.palette.text.disabled}})})})}):t.jsx(In,{...c});return[t.jsxs(y,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[t.jsxs(y,{width:{xs:300,md:400},display:"flex",alignItems:"center",children:[t.jsx(y,{className:"component-item__indent",width:28}),typeof u=="object"?u:t.jsx(Ps,{children:u}),t.jsxs(y,{sx:{ml:2,flex:1,wordBreak:"break-word"},children:[t.jsxs(y,{style:{color:"#222",fontSize:16},children:[c.to.type===N.ROUTING_RULE_TYPES.NONE&&n("common.page404"),c.to.type===N.ROUTING_RULE_TYPES.REDIRECT&&n("common.redirect"),c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&n("common.rewrite"),c.to.type===N.ROUTING_RULE_TYPES.DIRECT_RESPONSE&&((l=N.ROUTING_RESPONSE_TYPES.find(b=>b.value===c.to.response.contentType))==null?void 0:l.text),c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&B.getDisplayName(x,!0)]}),t.jsxs(y,{display:"flex",alignItems:"center",children:[c.to.type===N.ROUTING_RULE_TYPES.REDIRECT&&t.jsx(xt,{domain:r,toUrl:c.to.url}),c.to.type===N.ROUTING_RULE_TYPES.GENERAL_REWRITE&&t.jsx(xt,{domain:r,toUrl:c.to.url}),c.to.type===N.ROUTING_RULE_TYPES.COMPONENT&&t.jsx($o,{group:c.to.pageGroup})]})]})]}),t.jsx(y,{px:2,sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:t.jsx(St,{href:wo(r,c.from.pathPrefix,tn(s,o)),target:"_blank",style:{fontSize:16,color:"inherit"},underline:"hover",children:Is(c.from.pathPrefix,"/")||"/"})},c.from.pathPrefix),t.jsx(y,{children:e&&t.jsx("div",{style:{textAlign:"right"},children:g})},"actions")]},"rule"),t.jsx(et,{},"divider")]})}_t.propTypes={hasPermission:a.bool};_t.defaultProps={hasPermission:!1};const Hi=wt(_t,"mutate_blocklets"),Zi=wt(_t,"",Xe);function Qi(e){const{inService:n}=Z();return n?t.jsx(Zi,{...e}):t.jsx(Hi,{...e})}function Xi(e,n){const o=m.useRef(n);m.useEffect(()=>{const i=s=>o.current(s.detail);return window.addEventListener(e,i),()=>window.removeEventListener(e,i)},[e])}function Ji(e){const n=To(),{t:o}=W(),i=()=>{const s=new URLSearchParams(window.location.search);s.get("checkUpdate")&&(s.delete("checkUpdate"),n(s.toString()),e(),L.success(o("notification.checkingForUpdates")))};m.useEffect(i,[]),Xi("checkUpdate",i)}function ea({blocklet:e,scrollToComponent:n}={blocklet:null,scrollToComponent:!1}){const o=To(),{t:i}=W(),s=m.useRef(null),r=m.useMemo(()=>{if(!e||!e.optionalComponents)return null;const h=new URLSearchParams(window.location.search),c=h.get("install-component");if(c){s.current=c,h.delete("install-component"),o(h.toString());const u=e.optionalComponents.find(g=>g.meta.did===c);if(!u)return L.success(i("notification.installComponentError",{did:c})),null;const{meta:x}=u;if(n){const g=document.getElementById(`optional-component-${c}`),l=document.querySelector(".dashboard-main");if(g){const b=g.getBoundingClientRect(),d=l.getBoundingClientRect();l.scrollTo({top:b.top-d.top+l.scrollTop,behavior:"smooth"})}}return x}return null},[e,o,i,n]);return m.useEffect(()=>{var h;s.current&&window.opener&&window.opener.postMessage({blocklet:e,kind:"component-installer"},(h=window.blocklet)==null?void 0:h.appUrl)},[e]),r}function Dt({open:e,onClose:n,blocklet:o,ancestors:i}){var x;const{t:s}=W(),r=[...(i||[]).map(g=>{var l;return((l=g==null?void 0:g.meta)==null?void 0:l.did)||""}),((x=o==null?void 0:o.meta)==null?void 0:x.did)||""].filter(Boolean).join("/"),h=s("preferencesFor",{name:B.getDisplayName(o,!0)}),c=m.useMemo(()=>({position:"relative",minHeight:"50vh",height:"100%",overflow:"hidden",border:0}),[]);if(Fe(o.status)||o.status==="unknown"&&Fe(o.status))return null;const u=()=>{n==null||n()};return t.jsx(ta,{open:e,fullWidth:!0,maxWidth:"md",title:h,onClose:u,PaperProps:{style:{minHeight:"500px"}},children:t.jsxs(vo,{gap:1,children:[t.jsx(ne,{sx:{fontSize:12,color:"text.secondary",mb:.5},children:s("description.preferences",{name:B.getDisplayName(o,!0)})}),t.jsx(wr,{id:r,styles:c})]})})}Dt.propTypes={blocklet:a.object.isRequired,ancestors:a.array,open:a.bool,onClose:a.func};Dt.defaultProps={ancestors:[],open:!1,onClose:null};const ta=$(jt)`
362
362
  .MuiDialogContent-root {
363
363
  padding-top: 0;
364
364
  padding-bottom: 24px;
@@ -371,7 +371,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
371
371
  .ux-dialog_closeButton {
372
372
  margin: 0;
373
373
  }
374
- `;function In({component:e,remove:n,disabled:o,tip:i,showConfirm:s,hideBtn:r,onCancel:h}){const{t:c}=m.useContext(be),[u,x]=m.useState(!1),[g,l]=m.useState(null),b=async E=>{x(!0),await n(E.component,E.removeType),x(!1),l(null)},d=o||u,k=()=>{l({title:`${c("common.delete")} ${e.meta.title||e.meta.name}`,description:(E,C)=>t.jsxs(ne,{component:"div",children:[t.jsx(ne,{gutterBottom:!0,children:c("blocklet.action.removeComponentDescription")}),t.jsxs(Or,{name:"removeType",value:E.removeType,onChange:f=>C({...E,removeType:f.target.value}),children:[t.jsx(Vt,{value:"keepData",control:t.jsx(co,{}),label:c("blocklet.action.removeComponentKeepData")}),t.jsx(Vt,{value:"complete",control:t.jsx(co,{}),label:c("blocklet.action.removeComponentComplete")})]})]}),confirm:c("common.confirm"),cancel:c("common.cancel"),params:{component:e,removeType:"keepData"},onConfirm:b,onCancel:()=>{l(null),h()}})};m.useEffect(()=>{s?k():(x(!1),l(null))},[s]);const S=t.jsx(na,{size:"small",disabled:d,onClick:()=>k,"data-cy":"delete-component-btn",children:t.jsx(Tt,{disabled:d})}),R=t.jsx(Ce,{title:i||c("common.delete"),children:t.jsx("span",{children:S})});return t.jsxs(t.Fragment,{children:[!r&&R,g&&t.jsx(ze,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}In.propTypes={component:a.object.isRequired,remove:a.func,onCancel:a.func,disabled:a.bool,showConfirm:a.bool,hideBtn:a.bool,tip:a.string};In.defaultProps={remove:async()=>{},disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:()=>{},tip:""};const na=$(X)`
374
+ `;function _n({component:e,remove:n,disabled:o,tip:i,showConfirm:s,hideBtn:r,onCancel:h}){const{t:c}=m.useContext(be),[u,x]=m.useState(!1),[g,l]=m.useState(null),b=async E=>{x(!0),await n(E.component,E.removeType),x(!1),l(null)},d=o||u,k=()=>{l({title:`${c("common.delete")} ${e.meta.title||e.meta.name}`,description:(E,C)=>t.jsxs(ne,{component:"div",children:[t.jsx(ne,{gutterBottom:!0,children:c("blocklet.action.removeComponentDescription")}),t.jsxs(Or,{name:"removeType",value:E.removeType,onChange:f=>C({...E,removeType:f.target.value}),children:[t.jsx(Vt,{value:"keepData",control:t.jsx(co,{}),label:c("blocklet.action.removeComponentKeepData")}),t.jsx(Vt,{value:"complete",control:t.jsx(co,{}),label:c("blocklet.action.removeComponentComplete")})]})]}),confirm:c("common.confirm"),cancel:c("common.cancel"),params:{component:e,removeType:"keepData"},onConfirm:b,onCancel:()=>{l(null),h()}})};m.useEffect(()=>{s?k():(x(!1),l(null))},[s]);const S=t.jsx(na,{size:"small",disabled:d,onClick:()=>k,"data-cy":"delete-component-btn",children:t.jsx(Tt,{disabled:d})}),R=t.jsx(Ce,{title:i||c("common.delete"),children:t.jsx("span",{children:S})});return t.jsxs(t.Fragment,{children:[!r&&R,g&&t.jsx(ze,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}_n.propTypes={component:a.object.isRequired,remove:a.func,onCancel:a.func,disabled:a.bool,showConfirm:a.bool,hideBtn:a.bool,tip:a.string};_n.defaultProps={remove:async()=>{},disabled:!1,showConfirm:!1,hideBtn:!1,onCancel:()=>{},tip:""};const na=$(X)`
375
375
  &.Mui-disabled {
376
376
  opacity: 0.5;
377
377
  }
@@ -379,7 +379,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
379
379
  &.Mui-disabled {
380
380
  opacity: 0.5;
381
381
  }
382
- `;function Nn({sourceInfo:e,blocklet:n}){var s;const{t:o}=m.useContext(be);let{source:i}=e;return i==="registry"&&(i="Blocklet Store"),t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(Ds,{type:"success",children:Ar(i)},"source"),e.source==="registry"&&t.jsx(St,{href:Rt(e.deployedFrom,"blocklets",((s=n==null?void 0:n.meta)==null?void 0:s.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:o("blocklet.overview.viewInStore")})]})}Nn.propTypes={sourceInfo:a.shape({source:a.string,deployedFrom:a.string}),blocklet:a.object};Nn.defaultProps={sourceInfo:{},blocklet:{}};var Un={},sa=vt;Object.defineProperty(Un,"__esModule",{value:!0});var Mo=Un.default=void 0,ra=sa(Ct()),ia=t;Mo=Un.default=(0,ra.default)((0,ia.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Nt({blocklet:e,checkUpgrade:n,hasPermission:o,...i}){const{api:s}=Z(),{t:r}=m.useContext(be),[h,c]=m.useState(!1),[u,x]=m.useState(""),[g,l]=m.useState(null),[b,d]=m.useState(null);m.useEffect(()=>{l(null),n&&(e.mode,Y.BLOCKLET_MODES.DEVELOPMENT)},[e,n]);const k=()=>{c(!1),d(null)},S=async()=>{c(!0);try{const E={did:e.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Qe(2e3),await s.upgradeBlocklet({input:E})}catch(E){L.error(`Blocklet upgrade failed: ${ae(E)}`)}finally{c(!1),d(null)}},R={title:`${r("common.upgrade")} ${r("common.blocklet")} ${B.getDisplayName(e)}`,description:r("blocklet.action.upgradeDescription"),confirm:r("blocklet.action.confirmUpgrade"),cancel:r("common.cancel"),onConfirm:S,onCancel:k};return o&&g&&!B.isInProgress(e.status)?t.jsxs(t.Fragment,{children:[t.jsx(Je,{...i,children:e.meta.version}),t.jsx(Ce,{title:r("common.updateAvailable",{version:g.version}),children:t.jsx(X,{size:"small",style:{marginLeft:8},disabled:h,onClick:()=>d(R),children:h?t.jsx(pe,{size:16}):t.jsx(Mo,{style:{fontSize:16,color:"red"}})})}),!!u&&t.jsx(L,{variant:"error",message:u,onClose:()=>x("")}),b&&t.jsx(ze,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):t.jsx(Je,{...i,children:e.meta.version})}Nt.propTypes={blocklet:a.object.isRequired,checkUpgrade:a.bool,hasPermission:a.bool};Nt.defaultProps={checkUpgrade:!1,hasPermission:!1};const aa=wt(Nt,"mutate_blocklets"),la=wt(Nt,"",Xe);function ca(e){const{inService:n}=Z();return n?t.jsx(la,{...e}):t.jsx(aa,{...e})}const da=e=>{var n;return!((n=e==null?void 0:e.meta)!=null&&n.group)},ua=(e,n)=>e?[{name:n("common.name"),value:e.displayName},{name:n("common.description"),value:e.description},{name:n("common.version"),value:t.jsx(Je,{children:e.version})}]:[],pa=e=>{const{source:n,deployedFrom:o,bundleSource:i}=e;if(n)return{source:n,deployedFrom:o};if(!i)return{source:"upload",deployedFrom:o};if(i.url){const s=o||Array.isArray(i.url)?i.url[0]:i.url;return{source:"url",deployedFrom:s,link:s}}if(i.store){const s=o||Array.isArray(i.store)?i.store[0]:i.store;return{source:"registry",deployedFrom:s,link:s}}return{}},ma=(e,n)=>{const o=e.split("/").slice(1);let i=n,s=0;const r=[];for(;i&&s<o.length;){const h=i.children.find(c=>c.meta.did===o[s]);i=h,s++,h&&r.push(h.meta.title)}return r.join(" / ")};function Ln({blocklet:e,depth:n,componentInfo:o,app:i,onClose:s}){var d,k;const{t:r,locale:h}=m.useContext(be),{deletingBlocklets:c}=nn();let{status:u}=e;n===1&&c.includes(e.meta.did)&&(u="deleting");const x=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),g=S=>S.map(R=>R.name===r("common.did")||R.name===r("blocklet.appId")?t.jsx(qt,{valueComponent:"div",nameWidth:120,name:R.name,nameFormatter:()=>R.name,children:R.value},R.name):t.jsx(qt,{valueComponent:"div",nameWidth:120,name:R.name,children:R.link?t.jsx(St,{href:R.link,target:"_blank",className:"page-link",underline:"hover",children:R.value}):R.value},R.name)),l=o?pa(o):{},b=o?[{name:r("common.name"),value:B.getDisplayName(o,!0)},{name:r("common.version"),value:t.jsx(ca,{blocklet:o,checkUpgrade:!1})},{name:r("common.status"),value:t.jsx(Lo,{isResource:da(e),status:u,source:o.source,progress:e.progress})},e.status==="running"?{name:r("blocklet.startedAt"),value:Mt(e.startedAt,h)}:null,e.status!=="running"?{name:r("blocklet.stoppedAt"),value:Mt(e.stoppedAt,h)}:null,e.installedAt?{name:r("blocklet.installedAt"),value:Mt(e.installedAt,h)}:null,B.hasStartEngine(e.meta)?{name:r("common.mountPoint"),value:x}:null,o.meta.group?{name:r("common.group"),value:t.jsx(Je,{type:"success",children:o.meta.group})}:null,{name:r("blocklet.overview.source"),value:t.jsx(Nn,{sourceInfo:l,blocklet:e})},{name:r("blocklet.overview.deployedFrom"),value:l.deployedFrom||"-",link:l.link??""},{name:r("common.did"),value:t.jsx(Ns,{did:o.meta.did,showQrcode:!0})},{name:r("common.author"),value:o.meta.owner?t.jsx(_r,{owner:o.meta.owner,locale:h}):Ir.formatPerson(o.meta.author)},{name:r("common.engine"),value:ua(o.engine,r).map(({name:S,value:R})=>t.jsx(qt,{style:{marginBottom:4},nameWidth:120,name:S,children:R},S))},(d=e.dependents)!=null&&d.length?{name:r("common.dependents"),value:t.jsx(y,{children:e.dependents.map(S=>t.jsx(y,{children:`${ma(S.id,i)} ${S.required?`(${r("common.required")})`:""}`},S.id))})}:null,(k=e.meta.resources)!=null&&k.length?{name:r("common.resource"),value:e.meta.resources.join(", ")}:null].filter(Boolean):[];return o?t.jsx(jt,{open:!0,title:r("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{s(null)},children:t.jsx(y,{paddingBottom:1.5,children:g(b)},"dialog-wrapper")},"base-info-dialog"):null}Ln.propTypes={blocklet:a.object.isRequired,depth:a.number,app:a.object,componentInfo:a.object,onClose:a.func.isRequired};Ln.defaultProps={depth:0,app:null,componentInfo:null};$(Eo)`
382
+ `;function Nn({sourceInfo:e,blocklet:n}){var s;const{t:o}=m.useContext(be);let{source:i}=e;return i==="registry"&&(i="Blocklet Store"),t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(Ds,{type:"success",children:Ar(i)},"source"),e.source==="registry"&&t.jsx(St,{href:Rt(e.deployedFrom,"blocklets",((s=n==null?void 0:n.meta)==null?void 0:s.bundleDid)||""),target:"_blank",className:"page-link",underline:"hover",style:{display:"flex",alignItems:"center",marginLeft:8},children:o("blocklet.overview.viewInStore")})]})}Nn.propTypes={sourceInfo:a.shape({source:a.string,deployedFrom:a.string}),blocklet:a.object};Nn.defaultProps={sourceInfo:{},blocklet:{}};var Un={},sa=vt;Object.defineProperty(Un,"__esModule",{value:!0});var Mo=Un.default=void 0,ra=sa(Ct()),ia=t;Mo=Un.default=(0,ra.default)((0,ia.jsx)("path",{d:"m4 12 1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8z"}),"ArrowUpward");function Nt({blocklet:e,checkUpgrade:n,hasPermission:o,...i}){const{api:s}=Z(),{t:r}=m.useContext(be),[h,c]=m.useState(!1),[u,x]=m.useState(""),[g,l]=m.useState(null),[b,d]=m.useState(null);m.useEffect(()=>{l(null),n&&(e.mode,Y.BLOCKLET_MODES.DEVELOPMENT)},[e,n]);const k=()=>{c(!1),d(null)},S=async()=>{c(!0);try{const E={did:e.meta.did,version:g.version,storeUrl:g.registryUrl||""};await Qe(2e3),await s.upgradeBlocklet({input:E})}catch(E){L.error(`Blocklet upgrade failed: ${ae(E)}`)}finally{c(!1),d(null)}},R={title:`${r("common.upgrade")} ${r("common.blocklet")} ${B.getDisplayName(e)}`,description:r("blocklet.action.upgradeDescription"),confirm:r("blocklet.action.confirmUpgrade"),cancel:r("common.cancel"),onConfirm:S,onCancel:k};return o&&g&&!B.isInProgress(e.status)?t.jsxs(t.Fragment,{children:[t.jsx(Je,{...i,children:e.meta.version}),t.jsx(Ce,{title:r("common.updateAvailable",{version:g.version}),children:t.jsx(X,{size:"small",style:{marginLeft:8},disabled:h,onClick:()=>d(R),children:h?t.jsx(pe,{size:16}):t.jsx(Mo,{style:{fontSize:16,color:"red"}})})}),!!u&&t.jsx(L,{variant:"error",message:u,onClose:()=>x("")}),b&&t.jsx(ze,{title:b.title,description:b.description,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})]}):t.jsx(Je,{...i,children:e.meta.version})}Nt.propTypes={blocklet:a.object.isRequired,checkUpgrade:a.bool,hasPermission:a.bool};Nt.defaultProps={checkUpgrade:!1,hasPermission:!1};const aa=wt(Nt,"mutate_blocklets"),la=wt(Nt,"",Xe);function ca(e){const{inService:n}=Z();return n?t.jsx(la,{...e}):t.jsx(aa,{...e})}const da=e=>{var n;return!((n=e==null?void 0:e.meta)!=null&&n.group)},ua=(e,n)=>e?[{name:n("common.name"),value:e.displayName},{name:n("common.description"),value:e.description},{name:n("common.version"),value:t.jsx(Je,{children:e.version})}]:[],pa=e=>{const{source:n,deployedFrom:o,bundleSource:i}=e;if(n)return{source:n,deployedFrom:o};if(!i)return{source:"upload",deployedFrom:o};if(i.url){const s=o||Array.isArray(i.url)?i.url[0]:i.url;return{source:"url",deployedFrom:s,link:s}}if(i.store){const s=o||Array.isArray(i.store)?i.store[0]:i.store;return{source:"registry",deployedFrom:s,link:s}}return{}},ma=(e,n)=>{const o=e.split("/").slice(1);let i=n,s=0;const r=[];for(;i&&s<o.length;){const h=i.children.find(c=>c.meta.did===o[s]);i=h,s++,h&&r.push(h.meta.title)}return r.join(" / ")};function Ln({blocklet:e,depth:n,componentInfo:o,app:i,onClose:s}){var d,k;const{t:r,locale:h}=m.useContext(be),{deletingBlocklets:c}=nn();let{status:u}=e;n===1&&c.includes(e.meta.did)&&(u="deleting");const x=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),g=S=>S.map(R=>R.name===r("common.did")||R.name===r("blocklet.appId")?t.jsx(qt,{valueComponent:"div",nameWidth:120,name:R.name,nameFormatter:()=>R.name,children:R.value},R.name):t.jsx(qt,{valueComponent:"div",nameWidth:120,name:R.name,children:R.link?t.jsx(St,{href:R.link,target:"_blank",className:"page-link",underline:"hover",children:R.value}):R.value},R.name)),l=o?pa(o):{},b=o?[{name:r("common.name"),value:B.getDisplayName(o,!0)},{name:r("common.version"),value:t.jsx(ca,{blocklet:o,checkUpgrade:!1})},{name:r("common.status"),value:t.jsx(Lo,{isResource:da(e),status:u,source:o.source,progress:e.progress})},e.status==="running"?{name:r("blocklet.startedAt"),value:Mt(e.startedAt,h)}:null,e.status!=="running"?{name:r("blocklet.stoppedAt"),value:Mt(e.stoppedAt,h)}:null,e.installedAt?{name:r("blocklet.installedAt"),value:Mt(e.installedAt,h)}:null,B.hasStartEngine(e.meta)?{name:r("common.mountPoint"),value:x}:null,o.meta.group?{name:r("common.group"),value:t.jsx(Je,{type:"success",children:o.meta.group})}:null,{name:r("blocklet.overview.source"),value:t.jsx(Nn,{sourceInfo:l,blocklet:e})},{name:r("blocklet.overview.deployedFrom"),value:l.deployedFrom||"-",link:l.link??""},{name:r("common.did"),value:t.jsx(Ns,{did:o.meta.did,showQrcode:!0})},{name:r("common.author"),value:o.meta.owner?t.jsx(Ir,{owner:o.meta.owner,locale:h}):_r.formatPerson(o.meta.author)},{name:r("common.engine"),value:ua(o.engine,r).map(({name:S,value:R})=>t.jsx(qt,{style:{marginBottom:4},nameWidth:120,name:S,children:R},S))},(d=e.dependents)!=null&&d.length?{name:r("common.dependents"),value:t.jsx(y,{children:e.dependents.map(S=>t.jsx(y,{children:`${ma(S.id,i)} ${S.required?`(${r("common.required")})`:""}`},S.id))})}:null,(k=e.meta.resources)!=null&&k.length?{name:r("common.resource"),value:e.meta.resources.join(", ")}:null].filter(Boolean):[];return o?t.jsx(jt,{open:!0,title:r("common.componentBasicInfo"),showCloseButton:!0,fullWidth:!0,maxWidth:"md",onClose:()=>{s(null)},children:t.jsx(y,{paddingBottom:1.5,children:g(b)},"dialog-wrapper")},"base-info-dialog"):null}Ln.propTypes={blocklet:a.object.isRequired,depth:a.number,app:a.object,componentInfo:a.object,onClose:a.func.isRequired};Ln.defaultProps={depth:0,app:null,componentInfo:null};$(Eo)`
383
383
  .BaseBadge-badge {
384
384
  top: ${e=>e.top*8||6}px;
385
385
  right: ${e=>e.right*8||6}px;
@@ -401,7 +401,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
401
401
  margin-left: 4px;
402
402
  transform: translateY(-1px);
403
403
  }
404
- `;function qo({blocklet:e,ancestors:n,mountPoint:o,href:i}){const[s,r]=m.useState(!1),[h,c]=m.useState(!1),[u,x]=m.useState(!1),[g,l]=m.useState(o),{api:b}=Z(),d=!n.length,k=d?e.meta.did:n.map(v=>v.meta.did)[0],{t:S}=W(),{confirmApi:R,confirmHolder:E}=Us();m.useEffect(()=>{c(!1),r(!1),x(!1)},[o]);const C=()=>{r(!1),c(!1),l(o)},f=async()=>{x(!0),r(!1);try{const v={rootDid:k,mountPoint:ve(g)};d||(v.did=e.meta.did),await b.updateComponentMountPoint({input:v})}catch(v){throw v.message=ae(v),L.error(v.message),v}finally{C()}},p=Ls(()=>{R.open({title:S("common.noticeTitle"),content:t.jsxs(y,{sx:{color:"#9397A1","& > li":{listStyle:"disc",ml:1.5}},children:[t.jsx(ne,{sx:{mb:1.5},children:S("blocklet.mountPoint.description1")}),t.jsx(ne,{component:"li",children:S("blocklet.mountPoint.case1")}),t.jsx(ne,{component:"li",children:S("blocklet.mountPoint.case2")}),t.jsx(ne,{sx:{mt:1.5},children:S("blocklet.mountPoint.description2")})]}),confirmButtonText:S("common.confirm"),cancelButtonText:S("common.cancel"),async onConfirm(v){await f(),v()},confirmButtonProps:{"data-cy":"edit-mount-point-confirm"}})}),j=v=>{v==null||v.preventDefault(),ve(g)!==o?p():c(!1)},w=h?t.jsxs(y,{sx:{ml:1},children:[t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),"data-cy":"edit-mount-point-submit",onClick:j,children:t.jsx(y,{component:Q,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onClick:C,children:t.jsx(y,{component:Q,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onClick:()=>c(!0),children:t.jsx(y,{component:Q,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:s?1:0,color:"primary.main",transition:"0.3s opacity"}})});return t.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[E,h?t.jsx("form",{onSubmit:j,children:t.jsx(H,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:v=>l(v.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:o})}):t.jsx(y,{component:"a",target:"_blank",href:i,rel:"noopener noreferrer",title:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:t.jsx(y,{maxWidth:400,sx:{color:"primary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:Bs(o)})}),u?t.jsx(pe,{size:20,sx:{ml:1}}):w]},o)}qo.propTypes={mountPoint:a.string.isRequired,href:a.string.isRequired,blocklet:a.object.isRequired,ancestors:a.array.isRequired};const fa=e=>{var n;return!((n=e==null?void 0:e.meta)!=null&&n.group)},Co=(e,n)=>{const o=e.split("/").slice(1);let i=n,s=0;const r=[];for(;i&&s<o.length;){const h=i.children.find(c=>c.meta.did===o[s]);i=h,s++,h&&r.push(h.meta.title)}return r.join(" / ")};function yt({blocklet:e,ancestors:n,depth:o,onRemove:i,onStart:s,onStop:r,onRestart:h,getComponentUrl:c,app:u}){var Te,_,fe;const{t:x}=m.useContext(be),[g,l]=m.useState(),[b,d]=m.useState(!1),[k,S]=m.useState(!1),[R,E]=m.useState(null),{info:C}=Z(),[f,p]=m.useState(!1),[j,w]=m.useState(!1),{deletingBlocklets:v}=nn();let{status:U}=e;o===1&&v.includes(e.meta.did)&&(U="deleting");const O=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),K=c(O),I=B.isInProgress(u.status),J=B.isInProgress(e.status);let oe="";if(I||J||o===1&&v.includes(e.meta.did))oe=x("blocklet.component.tip.stopBlocklet");else if((Te=e.dependents)!=null&&Te.length){const G=e.dependents.filter(he=>he.required);if(G.length){const he=G.map(M=>Co(M.id,u));oe=x("blocklet.component.tip.requiredBy",{name:he.join(", ")})}}const ee=async(...G)=>{S(!0);try{await i(...G)}catch{}S(!1),d(!1)},{usingDocker:_e,usingIsolation:we}=m.useMemo(()=>{var ce,De;if(!e.meta.group||e.meta.group==="static")return{usingDocker:!1,usingIsolation:!1};const G=!!(C!=null&&C.enableDocker)||((ce=window.blocklet)==null?void 0:ce.enableDocker),he=[...u.configs,...e.configs].find(T=>T.key==="SKIP_DOCKER"&&T.value),M=[...u.configs,...e.configs].find(T=>T.key==="USE_DOCKER"&&T.value),Ie=[...u.configs,...e.configs].find(T=>T.key==="SKIP_DOCKER_NETWORK"&&T.value);return{usingDocker:G?!he:!!M,usingIsolation:G&&!Ie&&((C==null?void 0:C.enableDockerNetwork)||((De=window.blocklet)==null?void 0:De.enableDockerNetwork))}},[e.configs,C==null?void 0:C.enableDocker,C==null?void 0:C.enableDockerNetwork,u.configs,e.meta.group]);return t.jsxs(t.Fragment,{children:[t.jsxs(Bn,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[t.jsxs(y,{pl:2,width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[t.jsx(Os,{blocklet:e,ancestors:n}),t.jsxs(y,{ml:"16px",sx:{minWidth:0},children:[t.jsxs(y,{className:"component-header",onClick:()=>l(e),children:[t.jsx(y,{className:"component-name",children:B.getDisplayName(e,!0)}),t.jsx(y,{className:"component-version",children:(_=e==null?void 0:e.meta)==null?void 0:_.version})]}),t.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[U!=="unknown"&&t.jsx(Lo,{style:{marginLeft:4},status:U,source:e.source,progress:e.progress}),t.jsx(Dr,{style:{marginLeft:4},mode:e.mode||""}),e.mode!=="development"&&_e&&t.jsx(Ce,{title:x("blocklet.usingDocker"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:_o})})}),e.mode!=="development"&&we&&t.jsx(Ce,{title:x("blocklet.usingIsolation"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"streamline:network"})})}),!!((fe=e.dependents)!=null&&fe.length)&&t.jsx(Ce,{title:[`${x("common.dependents")}: `,e.dependents.map(G=>t.jsx(y,{pl:1,children:`${Co(G.id,u)} ${G.required?`(${x("common.required")})`:""}`},G.id))],children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"octicon:package-dependents-16"})})})]})]})]},e),So.hasMountPoint(e.meta)&&t.jsx(qo,{blocklet:e,ancestors:n,mountPoint:O,href:K},O),t.jsx("div",{style:{flex:1}}),t.jsxs(y,{display:"flex",alignItems:"center",children:[B.hasStartEngine(e.meta)&&t.jsx(Ce,{title:x("common.visit"),children:t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:K,rel:"noopener noreferrer",children:t.jsx(X,{size:"small",children:t.jsx(Uo,{})})})}),t.jsx(Dn,{blocklet:u,component:e,onStart:s,onStop:r,disabled:!["starting","stopping"].includes(u.status)&&B.isInProgress(u.status)}),t.jsx(X,{onClick:()=>w(!0),disabled:I||J,children:t.jsx(an,{fontSize:"small"})}),t.jsx(Kt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,n[0]).length,children:t.jsx(Bo,{"data-cy":"component-actions",actions:[B.hasStartEngine(e.meta)||fa(e)?{icon:t.jsx(As,{}),text:x("common.detail"),onClick:()=>{l(e)}}:null,{icon:t.jsx(Hs,{}),text:x("common.restart"),onClick:()=>{E({title:`${x("common.restart")} ${e.meta.title}`,description:x("blocklet.action.restartDescription"),confirm:x("blocklet.action.confirmRestart"),cancel:x("common.cancel"),onConfirm:async()=>{S(!0),await h(e),S(!1),E(null)},onCancel:()=>E(null)})},disabled:k||I||J||e.status!=="running"},{icon:t.jsx(Tt,{}),text:x("common.delete"),onClick:()=>{d(!0)},disabled:I||J||!!oe,tip:oe},{separator:!0},{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{p(!0)},text:t.jsx(Kt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,n[0]).length,children:t.jsx(y,{sx:{width:"100%"},children:x("common.environments")})}),disabled:I||J}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),t.jsx(et,{},"line"),t.jsx(Ln,{componentInfo:g,onClose:l,blocklet:e,app:u,depth:o}),t.jsx(In,{blocklet:u,component:e,remove:ee,onCancel:()=>d(!1),hideBtn:!0,showConfirm:b},"delete-component"),R&&t.jsx(ze,{title:R.title,description:R.description,confirm:R.confirm,cancel:R.cancel,params:R.params,onConfirm:R.onConfirm,onCancel:R.onCancel},"confirm-setting"),f&&t.jsx(Et,{open:!0,hiddenChildren:!0,onClose:()=>p(!1),blocklet:e,ancestors:n}),j&&t.jsx(Dt,{open:!0,onClose:()=>w(!1),blocklet:e,ancestors:n})]})}yt.propTypes={blocklet:a.object.isRequired,ancestors:a.array,depth:a.number,onRemove:a.func,onStart:a.func,onStop:a.func,onRestart:a.func,getComponentUrl:a.func,app:a.object};yt.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const Kt=$(Eo)`
404
+ `;function qo({blocklet:e,ancestors:n,mountPoint:o,href:i}){const[s,r]=m.useState(!1),[h,c]=m.useState(!1),[u,x]=m.useState(!1),[g,l]=m.useState(o),{api:b}=Z(),d=!n.length,k=d?e.meta.did:n.map(v=>v.meta.did)[0],{t:S}=W(),{confirmApi:R,confirmHolder:E}=Us();m.useEffect(()=>{c(!1),r(!1),x(!1)},[o]);const C=()=>{r(!1),c(!1),l(o)},f=async()=>{x(!0),r(!1);try{const v={rootDid:k,mountPoint:ve(g)};d||(v.did=e.meta.did),await b.updateComponentMountPoint({input:v})}catch(v){throw v.message=ae(v),L.error(v.message),v}finally{C()}},p=Ls(()=>{R.open({title:S("common.noticeTitle"),content:t.jsxs(y,{sx:{color:"#9397A1","& > li":{listStyle:"disc",ml:1.5}},children:[t.jsx(ne,{sx:{mb:1.5},children:S("blocklet.mountPoint.description1")}),t.jsx(ne,{component:"li",children:S("blocklet.mountPoint.case1")}),t.jsx(ne,{component:"li",children:S("blocklet.mountPoint.case2")}),t.jsx(ne,{sx:{mt:1.5},children:S("blocklet.mountPoint.description2")})]}),confirmButtonText:S("common.confirm"),cancelButtonText:S("common.cancel"),async onConfirm(v){await f(),v()},confirmButtonProps:{"data-cy":"edit-mount-point-confirm"}})}),j=v=>{v==null||v.preventDefault(),ve(g)!==o?p():c(!1)},w=h?t.jsxs(y,{sx:{ml:1},children:[t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),"data-cy":"edit-mount-point-submit",onClick:j,children:t.jsx(y,{component:Q,icon:"material-symbols:done",sx:{color:"primary.main",transition:"0.3s opacity"}})}),t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onClick:C,children:t.jsx(y,{component:Q,icon:"iconoir:cancel",sx:{color:"primary.main",transition:"0.3s opacity"}})})]}):t.jsx(X,{size:"medium",onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onClick:()=>c(!0),children:t.jsx(y,{component:Q,"data-cy":"edit-mount-point",icon:"lets-icons:edit-light",sx:{opacity:s?1:0,color:"primary.main",transition:"0.3s opacity"}})});return t.jsxs(y,{sx:{display:{xs:"none",md:"flex"}},alignItems:"center",flexGrow:"1",children:[E,h?t.jsx("form",{onSubmit:j,children:t.jsx(H,{style:{flex:1},fullWidth:!0,"data-cy":"edit-mount-point-input",value:g,onChange:v=>l(v.target.value),autoFocus:!0,size:"small",variant:"outlined",placeholder:o})}):t.jsx(y,{component:"a",target:"_blank",href:i,rel:"noopener noreferrer",title:i,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:t.jsx(y,{maxWidth:400,sx:{color:"primary.main",fontSize:16,px:2},overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",children:Bs(o)})}),u?t.jsx(pe,{size:20,sx:{ml:1}}):w]},o)}qo.propTypes={mountPoint:a.string.isRequired,href:a.string.isRequired,blocklet:a.object.isRequired,ancestors:a.array.isRequired};const fa=e=>{var n;return!((n=e==null?void 0:e.meta)!=null&&n.group)},Co=(e,n)=>{const o=e.split("/").slice(1);let i=n,s=0;const r=[];for(;i&&s<o.length;){const h=i.children.find(c=>c.meta.did===o[s]);i=h,s++,h&&r.push(h.meta.title)}return r.join(" / ")};function yt({blocklet:e,ancestors:n,depth:o,onRemove:i,onStart:s,onStop:r,onRestart:h,getComponentUrl:c,app:u}){var Te,I,fe;const{t:x}=m.useContext(be),[g,l]=m.useState(),[b,d]=m.useState(!1),[k,S]=m.useState(!1),[R,E]=m.useState(null),{info:C}=Z(),[f,p]=m.useState(!1),[j,w]=m.useState(!1),{deletingBlocklets:v}=nn();let{status:U}=e;o===1&&v.includes(e.meta.did)&&(U="deleting");const O=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),K=c(O),_=B.isInProgress(u.status),J=B.isInProgress(e.status);let oe="";if(_||J||o===1&&v.includes(e.meta.did))oe=x("blocklet.component.tip.stopBlocklet");else if((Te=e.dependents)!=null&&Te.length){const G=e.dependents.filter(he=>he.required);if(G.length){const he=G.map(M=>Co(M.id,u));oe=x("blocklet.component.tip.requiredBy",{name:he.join(", ")})}}const ee=async(...G)=>{S(!0);try{await i(...G)}catch{}S(!1),d(!1)},{usingDocker:Ie,usingIsolation:we}=m.useMemo(()=>{var ce,De;if(!e.meta.group||e.meta.group==="static")return{usingDocker:!1,usingIsolation:!1};const G=!!(C!=null&&C.enableDocker)||((ce=window.blocklet)==null?void 0:ce.enableDocker),he=[...u.configs,...e.configs].find(T=>T.key==="SKIP_DOCKER"&&T.value),M=[...u.configs,...e.configs].find(T=>T.key==="USE_DOCKER"&&T.value),_e=[...u.configs,...e.configs].find(T=>T.key==="SKIP_DOCKER_NETWORK"&&T.value);return{usingDocker:G?!he:!!M,usingIsolation:G&&!_e&&((C==null?void 0:C.enableDockerNetwork)||((De=window.blocklet)==null?void 0:De.enableDockerNetwork))}},[e.configs,C==null?void 0:C.enableDocker,C==null?void 0:C.enableDockerNetwork,u.configs,e.meta.group]);return t.jsxs(t.Fragment,{children:[t.jsxs(Bn,{display:"flex",py:2,className:"component-item",justifyContent:"flex-start",alignItems:"center",children:[t.jsxs(y,{pl:2,width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[t.jsx(Os,{blocklet:e,ancestors:n}),t.jsxs(y,{ml:"16px",sx:{minWidth:0},children:[t.jsxs(y,{className:"component-header",onClick:()=>l(e),children:[t.jsx(y,{className:"component-name",children:B.getDisplayName(e,!0)}),t.jsx(y,{className:"component-version",children:(I=e==null?void 0:e.meta)==null?void 0:I.version})]}),t.jsxs(y,{display:"flex",alignItems:"center",sx:{mt:"2px",ml:-.5},children:[U!=="unknown"&&t.jsx(Lo,{style:{marginLeft:4},status:U,source:e.source,progress:e.progress}),t.jsx(Dr,{style:{marginLeft:4},mode:e.mode||""}),e.mode!=="development"&&Ie&&t.jsx(Ce,{title:x("blocklet.usingDocker"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:Io})})}),e.mode!=="development"&&we&&t.jsx(Ce,{title:x("blocklet.usingIsolation"),children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"streamline:network"})})}),!!((fe=e.dependents)!=null&&fe.length)&&t.jsx(Ce,{title:[`${x("common.dependents")}: `,e.dependents.map(G=>t.jsx(y,{pl:1,children:`${Co(G.id,u)} ${G.required?`(${x("common.required")})`:""}`},G.id))],children:t.jsx(y,{display:"flex",color:"primary.main",ml:1,children:t.jsx(Q,{icon:"octicon:package-dependents-16"})})})]})]})]},e),So.hasMountPoint(e.meta)&&t.jsx(qo,{blocklet:e,ancestors:n,mountPoint:O,href:K},O),t.jsx("div",{style:{flex:1}}),t.jsxs(y,{display:"flex",alignItems:"center",children:[B.hasStartEngine(e.meta)&&t.jsx(Ce,{title:x("common.visit"),children:t.jsx(y,{component:"a",sx:{display:{xs:"flex",md:"none"}},target:"_blank",href:K,rel:"noopener noreferrer",children:t.jsx(X,{size:"small",children:t.jsx(Uo,{})})})}),t.jsx(Dn,{blocklet:u,component:e,onStart:s,onStop:r,disabled:!["starting","stopping"].includes(u.status)&&B.isInProgress(u.status)}),t.jsx(X,{onClick:()=>w(!0),disabled:_||J,children:t.jsx(an,{fontSize:"small"})}),t.jsx(Kt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,n[0]).length,children:t.jsx(Bo,{"data-cy":"component-actions",actions:[B.hasStartEngine(e.meta)||fa(e)?{icon:t.jsx(As,{}),text:x("common.detail"),onClick:()=>{l(e)}}:null,{icon:t.jsx(Hs,{}),text:x("common.restart"),onClick:()=>{E({title:`${x("common.restart")} ${e.meta.title}`,description:x("blocklet.action.restartDescription"),confirm:x("blocklet.action.confirmRestart"),cancel:x("common.cancel"),onConfirm:async()=>{S(!0),await h(e),S(!1),E(null)},onCancel:()=>E(null)})},disabled:k||_||J||e.status!=="running"},{icon:t.jsx(Tt,{}),text:x("common.delete"),onClick:()=>{d(!0)},disabled:_||J||!!oe,tip:oe},{separator:!0},{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{p(!0)},text:t.jsx(Kt,{color:"error",badgeContent:"",variant:"dot",invisible:!B.getComponentMissingConfigs(e,n[0]).length,children:t.jsx(y,{sx:{width:"100%"},children:x("common.environments")})}),disabled:_||J}].filter(Boolean)})})]},"actions")]},"group-not-gateway-box"),t.jsx(et,{},"line"),t.jsx(Ln,{componentInfo:g,onClose:l,blocklet:e,app:u,depth:o}),t.jsx(_n,{blocklet:u,component:e,remove:ee,onCancel:()=>d(!1),hideBtn:!0,showConfirm:b},"delete-component"),R&&t.jsx(ze,{title:R.title,description:R.description,confirm:R.confirm,cancel:R.cancel,params:R.params,onConfirm:R.onConfirm,onCancel:R.onCancel},"confirm-setting"),f&&t.jsx(Et,{open:!0,hiddenChildren:!0,onClose:()=>p(!1),blocklet:e,ancestors:n}),j&&t.jsx(Dt,{open:!0,onClose:()=>w(!1),blocklet:e,ancestors:n})]})}yt.propTypes={blocklet:a.object.isRequired,ancestors:a.array,depth:a.number,onRemove:a.func,onStart:a.func,onStop:a.func,onRestart:a.func,getComponentUrl:a.func,app:a.object};yt.defaultProps={ancestors:[],depth:0,onRemove:()=>{},onStart:()=>{},onStop:()=>{},onRestart:()=>{},getComponentUrl:()=>window.location.origin,app:null};const Kt=$(Eo)`
405
405
  .BaseBadge-badge {
406
406
  top: ${e=>e.top*8||6}px;
407
407
  right: ${e=>e.right*8||6}px;
@@ -480,7 +480,7 @@ import{r as m,c3 as Ht,c4 as Zt,b_ as Pe,e6 as Ho,c5 as Qt,c2 as Xt,ck as Zo,c0
480
480
  margin-left: 4px;
481
481
  transform: translateY(-1px);
482
482
  }
483
- `;function An({blocklet:e,onUpdate:n,getComponentUrl:o,...i}){var De;const{t:s}=m.useContext(be),{api:r,inService:h,info:c}=Z(),{addDeletingDid:u,removeDeletingDid:x,matchDeletingDid:g}=nn(),[l,b]=m.useState(!1),[d,k]=m.useState(null),[S,R]=m.useState(null),[E,C]=m.useState(!1),[f,p]=m.useState(!1),[j,w]=m.useState(!1),[v,U]=m.useState(!1),[O,K]=m.useState(null),I=e&&e.structVersion!==N.APP_STRUCT_VERSION,[J,oe]=m.useState(!1),ee=[...e.children];e.meta.group!=="gateway"&&ee.unshift(e),g(ee.map(T=>T.meta.did));const _e=async()=>{if(!l){b(!0);try{const{updateId:T,updateList:V}=(await r.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!T){L.info(s("blocklet.component.noUpdate"));return}const de=[];B.forEachChildSync(e,(te,{id:je,ancestors:z})=>{const Ne=V.find(Re=>Re.id===je);if(Ne){const Re=z.slice(1).concat(te).map(Oe=>Oe.meta.title||Oe.meta.name).join(" / "),Ve=(z[1]||te).meta.did;de.push({groupId:Ve,name:Re,version:te.meta.version,newVersion:Ne.meta.version})}});const F={};de.forEach(te=>{F[te.groupId]?te.disabled=!0:F[te.groupId]=!0}),k({params:{updateId:T},list:de,checks:F,hasChecks:!0})}catch(T){b(!1),L.error(ae(T))}}},we=async()=>{if(!l)try{b(!0);const T=Object.keys(d.checks).filter(de=>d.checks[de]),V={updateId:d.params.updateId,rootDid:e.meta.did,selectedComponents:T};await r.upgradeComponents({input:V}),b(!1),k(null),oe(null)}catch(T){b(!1),L.error(ae(T))}},Te=async(T,V)=>{u(T.meta.did);try{await r.deleteComponent({input:{did:T.meta.did,keepData:V==="keepData",rootDid:e.meta.did}}),await Qe(800)}catch(de){L.error(ae(de)),x(T.meta.did)}},_=async T=>{try{await r.startBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},fe=async T=>{try{await r.stopBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},G=async T=>{try{await r.restartBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},he=(T,V)=>{const{checked:de}=T.target;k(F=>{const te=Object.entries(F.checks).reduce((z,[Ne,Re])=>(z[Ne]=V===Ne||V==="all"?de:Re,z),{}),je=Object.values(te).includes(!0);return{...F,checks:te,hasChecks:je}})},M=m.useMemo(()=>d==null?void 0:d.list.filter(T=>!T.disabled).every(T=>d.checks[T.groupId]),[d]);Ji(_e);const Ie=ea({blocklet:e,scrollToComponent:!0}),ce=O||Ie;return t.jsxs(ga,{component:"div",...i,children:[t.jsxs(xa,{display:"flex",children:[t.jsxs(ya,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[ee!=null&&ee.length?`${s("common.components")} (${ee.length})`:`${s("common.components")}`,!I&&t.jsx(Yt,{permission:h?"":"mutate_blocklets",role:h?Xe:[],children:t.jsx(ln,{children:t.jsx(Kt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!J,children:t.jsxs(le,{disabled:l||B.isInProgress(e.status),onClick:()=>{_e()},"data-cy":"check-for-updates",children:[t.jsx(y,{ml:.5,mr:.5,display:"flex",children:l?t.jsx(pe,{size:16}):t.jsx(Ao,{style:{fontSize:"1em"}})}),s("blocklet.component.checkUpdateTitle")]})})})})]}),t.jsx(Yt,{permission:h?"":"mutate_blocklets",role:h?Xe:[],children:t.jsxs(y,{display:"flex",alignItems:"center",children:[!I&&t.jsx(Tn,{blocklet:e,serverVersion:c.version,children:({open:T})=>t.jsxs(le,{disabled:l||B.isInProgress(e.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:T,children:[t.jsx(Fs,{style:{fontSize:"1.3em",marginRight:4}}),s("blocklet.component.add")]})}),t.jsx(Bo,{"data-cy":"component-actions",actions:[{icon:t.jsx(Q,{icon:"fluent:link-20-filled"}),onClick:()=>p(!0),text:s("router.rule.add.title"),disabled:l||B.isInProgress(e.status)},...I?[]:[{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{w(!0)},text:s("common.environments")},{icon:t.jsx(an,{}),onClick:()=>{U(!0)},text:s("common.preferences")}]].filter(Boolean)})]})})]}),ee!=null&&ee.length?t.jsxs(t.Fragment,{children:[t.jsxs(y,{mt:2,children:[e.meta.group!=="gateway"&&t.jsx(yt,{blocklet:e,app:e,onRemove:Te,onStart:_,onStop:fe,onRestart:G,getComponentUrl:o},`0-${e.meta.did}`),e.children.map(T=>t.jsx(yt,{depth:1,blocklet:T,ancestors:[e],app:e,onRemove:Te,onStart:_,onStop:fe,onRestart:G,getComponentUrl:o},`1-${T.meta.did}`))]},`top-blocklet-${e.meta.did}`),(De=e.optionalComponents)==null?void 0:De.map(T=>t.jsx(Bn,{children:t.jsx(On,{setInstallComponentMeta:K,...T})},T.meta.did))]}):t.jsx(y,{mt:8,children:t.jsx(zs,{children:s("blocklet.component.noComponent")})}),!!e.site.rules.length&&t.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:t.jsx(Qi,{})}),!!d&&t.jsx(no,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(oo,{children:s("blocklet.component.updateTitle")}),t.jsxs(y,{component:so,py:4,children:[d.list.filter(T=>!T.disabled).length>1&&t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(ro,{checked:M,onChange:T=>he(T,"all")}),t.jsx(y,{children:s(M?"common.unselectAll":"common.selectAll")})]}),d.list.map(T=>t.jsxs(y,{display:"flex",alignItems:"center",mb:1,children:[t.jsx(ro,{checked:d.checks[T.groupId],onChange:V=>he(V,T.groupId),style:{marginLeft:T.disabled?16:0,alignSelf:"flex-start"},defaultChecked:!0,disabled:T.disabled}),t.jsxs(y,{flexGrow:1,children:[t.jsx(y,{pt:1,xs:8,children:T.name}),T.version&&t.jsxs(ut,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[t.jsx(ut,{item:!0,xs:3,children:T.version}),t.jsx(ut,{item:!0,xs:1,children:t.jsx(Ms,{style:{fontSize:"0.9em"}})}),t.jsx(ut,{item:!0,xs:3,children:t.jsx(y,{color:"secondary.main",children:T.newVersion})})]})]},`${T.name}-${T.newVersion}`)]},T.name))]}),t.jsxs(qs,{style:{padding:"8px 24px 24px"},children:[t.jsx(le,{onClick:()=>{k(null)},children:s("common.cancel")}),t.jsxs(le,{onClick:T=>{T.stopPropagation(),we()},color:"primary",disabled:l||!d.hasChecks,variant:"contained",autoFocus:!0,children:[l&&t.jsx(pe,{size:16}),s("common.update")]})]})]})}),!!S&&t.jsx(no,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(oo,{children:s("common.configuration")}),t.jsx(so,{children:t.jsx(y,{py:2,children:t.jsx(Vt,{control:t.jsx($r,{checked:E,onChange:T=>C(!!T.target.checked)}),label:s("blocklet.component.showContainer")})})})]})}),t.jsx(Pt,{selectedMeta:ce,blocklet:e,showDialog:!!ce,setShowDialog:()=>K(null)}),f&&t.jsx(En,{hiddenChildren:!0,open:!0,onClose:()=>p(!1)}),j&&t.jsx(Et,{open:!0,onClose:()=>w(!1),hiddenChildren:!0,blocklet:e,ancestors:[]}),v&&t.jsx(Dt,{open:!0,onClose:()=>U(!1),blocklet:e,ancestors:[]})]})}An.propTypes={blocklet:a.object.isRequired,onUpdate:a.func,getComponentUrl:a.func};An.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const ga=$.div`
483
+ `;function An({blocklet:e,onUpdate:n,getComponentUrl:o,...i}){var De;const{t:s}=m.useContext(be),{api:r,inService:h,info:c}=Z(),{addDeletingDid:u,removeDeletingDid:x,matchDeletingDid:g}=nn(),[l,b]=m.useState(!1),[d,k]=m.useState(null),[S,R]=m.useState(null),[E,C]=m.useState(!1),[f,p]=m.useState(!1),[j,w]=m.useState(!1),[v,U]=m.useState(!1),[O,K]=m.useState(null),_=e&&e.structVersion!==N.APP_STRUCT_VERSION,[J,oe]=m.useState(!1),ee=[...e.children];e.meta.group!=="gateway"&&ee.unshift(e),g(ee.map(T=>T.meta.did));const Ie=async()=>{if(!l){b(!0);try{const{updateId:T,updateList:V}=(await r.checkComponentsForUpdates({input:{did:e.meta.did}})).preUpdateInfo||{};if(b(!1),!T){L.info(s("blocklet.component.noUpdate"));return}const de=[];B.forEachChildSync(e,(te,{id:je,ancestors:z})=>{const Ne=V.find(Re=>Re.id===je);if(Ne){const Re=z.slice(1).concat(te).map(Oe=>Oe.meta.title||Oe.meta.name).join(" / "),Ve=(z[1]||te).meta.did;de.push({groupId:Ve,name:Re,version:te.meta.version,newVersion:Ne.meta.version})}});const F={};de.forEach(te=>{F[te.groupId]?te.disabled=!0:F[te.groupId]=!0}),k({params:{updateId:T},list:de,checks:F,hasChecks:!0})}catch(T){b(!1),L.error(ae(T))}}},we=async()=>{if(!l)try{b(!0);const T=Object.keys(d.checks).filter(de=>d.checks[de]),V={updateId:d.params.updateId,rootDid:e.meta.did,selectedComponents:T};await r.upgradeComponents({input:V}),b(!1),k(null),oe(null)}catch(T){b(!1),L.error(ae(T))}},Te=async(T,V)=>{u(T.meta.did);try{await r.deleteComponent({input:{did:T.meta.did,keepData:V==="keepData",rootDid:e.meta.did}}),await Qe(800)}catch(de){L.error(ae(de)),x(T.meta.did)}},I=async T=>{try{await r.startBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},fe=async T=>{try{await r.stopBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},G=async T=>{try{await r.restartBlocklet({input:{did:e.meta.did,componentDids:[T.meta.did]}}),await Qe(800)}catch(V){L.error(ae(V))}},he=(T,V)=>{const{checked:de}=T.target;k(F=>{const te=Object.entries(F.checks).reduce((z,[Ne,Re])=>(z[Ne]=V===Ne||V==="all"?de:Re,z),{}),je=Object.values(te).includes(!0);return{...F,checks:te,hasChecks:je}})},M=m.useMemo(()=>d==null?void 0:d.list.filter(T=>!T.disabled).every(T=>d.checks[T.groupId]),[d]);Ji(Ie);const _e=ea({blocklet:e,scrollToComponent:!0}),ce=O||_e;return t.jsxs(ga,{component:"div",...i,children:[t.jsxs(xa,{display:"flex",children:[t.jsxs(ya,{flexDirection:"row",className:"title",display:"flex",alignItems:"center",children:[ee!=null&&ee.length?`${s("common.components")} (${ee.length})`:`${s("common.components")}`,!_&&t.jsx(Yt,{permission:h?"":"mutate_blocklets",role:h?Xe:[],children:t.jsx(ln,{children:t.jsx(Kt,{top:1.2,right:.4,color:"error",badgeContent:"",variant:"dot",invisible:!J,children:t.jsxs(le,{disabled:l||B.isInProgress(e.status),onClick:()=>{Ie()},"data-cy":"check-for-updates",children:[t.jsx(y,{ml:.5,mr:.5,display:"flex",children:l?t.jsx(pe,{size:16}):t.jsx(Ao,{style:{fontSize:"1em"}})}),s("blocklet.component.checkUpdateTitle")]})})})})]}),t.jsx(Yt,{permission:h?"":"mutate_blocklets",role:h?Xe:[],children:t.jsxs(y,{display:"flex",alignItems:"center",children:[!_&&t.jsx(Tn,{blocklet:e,serverVersion:c.version,children:({open:T})=>t.jsxs(le,{disabled:l||B.isInProgress(e.status),variant:"text",color:"primary","data-cy":"add-component",className:"sm-hide-icon",onClick:T,children:[t.jsx(Fs,{style:{fontSize:"1.3em",marginRight:4}}),s("blocklet.component.add")]})}),t.jsx(Bo,{"data-cy":"component-actions",actions:[{icon:t.jsx(Q,{icon:"fluent:link-20-filled"}),onClick:()=>p(!0),text:s("router.rule.add.title"),disabled:l||B.isInProgress(e.status)},..._?[]:[{icon:t.jsx(Q,{icon:"mdi:variable"}),onClick:()=>{w(!0)},text:s("common.environments")},{icon:t.jsx(an,{}),onClick:()=>{U(!0)},text:s("common.preferences")}]].filter(Boolean)})]})})]}),ee!=null&&ee.length?t.jsxs(t.Fragment,{children:[t.jsxs(y,{mt:2,children:[e.meta.group!=="gateway"&&t.jsx(yt,{blocklet:e,app:e,onRemove:Te,onStart:I,onStop:fe,onRestart:G,getComponentUrl:o},`0-${e.meta.did}`),e.children.map(T=>t.jsx(yt,{depth:1,blocklet:T,ancestors:[e],app:e,onRemove:Te,onStart:I,onStop:fe,onRestart:G,getComponentUrl:o},`1-${T.meta.did}`))]},`top-blocklet-${e.meta.did}`),(De=e.optionalComponents)==null?void 0:De.map(T=>t.jsx(Bn,{children:t.jsx(On,{setInstallComponentMeta:K,...T})},T.meta.did))]}):t.jsx(y,{mt:8,children:t.jsx(zs,{children:s("blocklet.component.noComponent")})}),!!e.site.rules.length&&t.jsx(y,{sx:{mt:0,".component-item__indent":{pl:2,width:0}},children:t.jsx(Qi,{})}),!!d&&t.jsx(no,{open:!0,fullWidth:!0,children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(oo,{children:s("blocklet.component.updateTitle")}),t.jsxs(y,{component:so,py:4,children:[d.list.filter(T=>!T.disabled).length>1&&t.jsxs(y,{display:"flex",alignItems:"center",children:[t.jsx(ro,{checked:M,onChange:T=>he(T,"all")}),t.jsx(y,{children:s(M?"common.unselectAll":"common.selectAll")})]}),d.list.map(T=>t.jsxs(y,{display:"flex",alignItems:"center",mb:1,children:[t.jsx(ro,{checked:d.checks[T.groupId],onChange:V=>he(V,T.groupId),style:{marginLeft:T.disabled?16:0,alignSelf:"flex-start"},defaultChecked:!0,disabled:T.disabled}),t.jsxs(y,{flexGrow:1,children:[t.jsx(y,{pt:1,xs:8,children:T.name}),T.version&&t.jsxs(ut,{fontSize:"h6.fontSize",container:!0,spacing:2,alignItems:"center",children:[t.jsx(ut,{item:!0,xs:3,children:T.version}),t.jsx(ut,{item:!0,xs:1,children:t.jsx(Ms,{style:{fontSize:"0.9em"}})}),t.jsx(ut,{item:!0,xs:3,children:t.jsx(y,{color:"secondary.main",children:T.newVersion})})]})]},`${T.name}-${T.newVersion}`)]},T.name))]}),t.jsxs(qs,{style:{padding:"8px 24px 24px"},children:[t.jsx(le,{onClick:()=>{k(null)},children:s("common.cancel")}),t.jsxs(le,{onClick:T=>{T.stopPropagation(),we()},color:"primary",disabled:l||!d.hasChecks,variant:"contained",autoFocus:!0,children:[l&&t.jsx(pe,{size:16}),s("common.update")]})]})]})}),!!S&&t.jsx(no,{open:!0,fullWidth:!0,onClose:()=>R(!1),children:t.jsxs(y,{paddingY:1.5,children:[t.jsx(oo,{children:s("common.configuration")}),t.jsx(so,{children:t.jsx(y,{py:2,children:t.jsx(Vt,{control:t.jsx($r,{checked:E,onChange:T=>C(!!T.target.checked)}),label:s("blocklet.component.showContainer")})})})]})}),t.jsx(Pt,{selectedMeta:ce,blocklet:e,showDialog:!!ce,setShowDialog:()=>K(null)}),f&&t.jsx(En,{hiddenChildren:!0,open:!0,onClose:()=>p(!1)}),j&&t.jsx(Et,{open:!0,onClose:()=>w(!1),hiddenChildren:!0,blocklet:e,ancestors:[]}),v&&t.jsx(Dt,{open:!0,onClose:()=>U(!1),blocklet:e,ancestors:[]})]})}An.propTypes={blocklet:a.object.isRequired,onUpdate:a.func,getComponentUrl:a.func};An.defaultProps={onUpdate:()=>{},getComponentUrl:()=>window.location.origin};const ga=$.div`
484
484
  .title {
485
485
  font-size: 1.2rem;
486
486
  font-weight: bold;
@@ -1 +1 @@
1
- import{r as E,m as W,y as j,j as e,$ as I,C as T,cH as k,N as L,w as N,z as h,E as S,u as U,x as v,ar as R,ah as b}from"./index-KdOmwCM0.js";import{w as _}from"./wrap-locale-DB1j-LK3.js";import{g as y}from"./get-safe-url-fVLOWjDv.js";function B({SessionContext:n,webWalletUrl:a,onSuccess:r}){var u,g;const{api:o,session:t}=E.useContext(n),{t:s,locale:m}=W(),f=j(),{searchParams:l}=new URL(window.location.href),d=l.get("redirect"),w=async(c,C)=>{r(c,C),await t.refresh(),h.success(s("exchangePassport.success")),setTimeout(()=>{if(d){const i=decodeURIComponent(d);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?f(i,{replace:!0}):window.location.href=y(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=c=>{h.error(c.message)},p={},x=l.get("componentId");return x&&(p.componentId=x),t.loading?e.jsx(I,{children:e.jsx(T,{})}):e.jsx(k,{did:((u=window==null?void 0:window.blocklet)==null?void 0:u.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(L,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(N,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:w,onError:P,locale:m,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:p,extraContent:null,hideCloseButton:!0})})})}const D=_(B);function A(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&b(t(o.sessionToken))};return e.jsx(D,{SessionContext:R,webWalletUrl:a,onSuccess:r})}export{A as default};
1
+ import{r as E,m as W,y as j,j as e,$ as I,C as T,cH as k,N as L,w as N,z as h,E as S,u as U,x as v,ar as R,ah as b}from"./index-AJgIDgSg.js";import{w as _}from"./wrap-locale-Cw7rRT3-.js";import{g as y}from"./get-safe-url-DfM7C7Hf.js";function B({SessionContext:n,webWalletUrl:a,onSuccess:r}){var u,g;const{api:o,session:t}=E.useContext(n),{t:s,locale:m}=W(),f=j(),{searchParams:l}=new URL(window.location.href),d=l.get("redirect"),w=async(c,C)=>{r(c,C),await t.refresh(),h.success(s("exchangePassport.success")),setTimeout(()=>{if(d){const i=decodeURIComponent(d);i.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?f(i,{replace:!0}):window.location.href=y(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=c=>{h.error(c.message)},p={},x=l.get("componentId");return x&&(p.componentId=x),t.loading?e.jsx(I,{children:e.jsx(T,{})}):e.jsx(k,{did:((u=window==null?void 0:window.blocklet)==null?void 0:u.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(L,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(N,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:w,onError:P,locale:m,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:p,extraContent:null,hideCloseButton:!0})})})}const D=_(B);function A(){const{info:n}=U(),a=v(n),r=(o,t)=>{o.sessionToken&&b(t(o.sessionToken))};return e.jsx(D,{SessionContext:R,webWalletUrl:a,onSuccess:r})}export{A as default};