nextclaw 0.48.2 → 0.48.3

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 (199) hide show
  1. package/dist/cli/app/index.js +1 -1
  2. package/dist/{nextclaw-cli-app-C1L77sjJ.js → nextclaw-cli-app-BJSCnCIN.js} +1 -2
  3. package/dist/{nextclaw-cli-app-C1L77sjJ.js.map → nextclaw-cli-app-BJSCnCIN.js.map} +1 -1
  4. package/package.json +13 -13
  5. package/resources/USAGE.md +1 -5
  6. package/ui-dist/.vite/manifest.json +517 -517
  7. package/ui-dist/.vite/manifest.json.gz +0 -0
  8. package/ui-dist/assets/{account-panel-BxMlLXYH.js → account-panel-BRTSwNvA.js} +1 -1
  9. package/ui-dist/assets/account-panel-BRTSwNvA.js.gz +0 -0
  10. package/ui-dist/assets/{api-Utt-xzrT.js → api-BnUzdltV.js} +5 -5
  11. package/ui-dist/assets/api-BnUzdltV.js.gz +0 -0
  12. package/ui-dist/assets/{app-data-DYXDL6X2.js → app-data-Bjh_zM45.js} +1 -1
  13. package/ui-dist/assets/app-data-Bjh_zM45.js.gz +0 -0
  14. package/ui-dist/assets/app-presenter-provider-CBt-lyr_.js +109 -0
  15. package/ui-dist/assets/app-presenter-provider-CBt-lyr_.js.gz +0 -0
  16. package/ui-dist/assets/{appearance-settings-page-BfYznAK5.js → appearance-settings-page-BrOYSgG0.js} +1 -1
  17. package/ui-dist/assets/appearance-settings-page-BrOYSgG0.js.gz +0 -0
  18. package/ui-dist/assets/{book-open-DDW_3XpM.js → book-open-xqEj1OLE.js} +1 -1
  19. package/ui-dist/assets/{boxes-DwJeuK_h.js → boxes-D6uPnkGo.js} +1 -1
  20. package/ui-dist/assets/{card-IevY2nm-.js → card-CS8su2Zh.js} +1 -1
  21. package/ui-dist/assets/card-CS8su2Zh.js.gz +0 -0
  22. package/ui-dist/assets/{channels-list-page-DitnqbMR.js → channels-list-page-BE0TxB3B.js} +1 -1
  23. package/ui-dist/assets/channels-list-page-BE0TxB3B.js.gz +0 -0
  24. package/ui-dist/assets/{chevron-down-An7Km-t4.js → chevron-down-BL-yMYcX.js} +1 -1
  25. package/ui-dist/assets/{circle-alert-CDXqELuo.js → circle-alert-lSa3LRvS.js} +1 -1
  26. package/ui-dist/assets/{circle-dashed-CapXEpiV.js → circle-dashed-CU3yApvP.js} +1 -1
  27. package/ui-dist/assets/{client-B0krol7A.js → client-BtGBwLTs.js} +1 -1
  28. package/ui-dist/assets/{config-split-page-BtnkqWVp.js → config-split-page-BxDwwAGa.js} +1 -1
  29. package/ui-dist/assets/config-split-page-BxDwwAGa.js.gz +0 -0
  30. package/ui-dist/assets/{confirm-dialog-DFt4jpN7.js → confirm-dialog-S5JxZcS1.js} +1 -1
  31. package/ui-dist/assets/confirm-dialog-S5JxZcS1.js.gz +0 -0
  32. package/ui-dist/assets/{createLucideIcon-BTHK0Ot9.js → createLucideIcon-BNKf0_kc.js} +1 -1
  33. package/ui-dist/assets/{desktop-capabilities-page-CCf14WId.js → desktop-capabilities-page-BwHxJpbl.js} +1 -1
  34. package/ui-dist/assets/desktop-capabilities-page-BwHxJpbl.js.gz +0 -0
  35. package/ui-dist/assets/{desktop-update-config-DVoVgfFi.js → desktop-update-config-Bfg7OdJ2.js} +1 -1
  36. package/ui-dist/assets/desktop-update-config-Bfg7OdJ2.js.gz +0 -0
  37. package/ui-dist/assets/{dialog-BFN_1DBH.js → dialog-Xe73hpQz.js} +1 -1
  38. package/ui-dist/assets/dialog-Xe73hpQz.js.gz +0 -0
  39. package/ui-dist/assets/{dist-Bc9hOVNN.js → dist-BiIcnf9j.js} +1 -1
  40. package/ui-dist/assets/dist-BiIcnf9j.js.gz +0 -0
  41. package/ui-dist/assets/{dist-CEhIDAnr.js → dist-C5I0v8Qn.js} +1 -1
  42. package/ui-dist/assets/dist-C5I0v8Qn.js.gz +0 -0
  43. package/ui-dist/assets/{dist-hkVPP1th.js → dist-czPa8xFO.js} +1 -1
  44. package/ui-dist/assets/dist-czPa8xFO.js.gz +0 -0
  45. package/ui-dist/assets/doc-browser-BgRP0Wni.js +1 -0
  46. package/ui-dist/assets/{doc-browser-BNUxmwD6.js → doc-browser-C8eqJLi_.js} +1 -1
  47. package/ui-dist/assets/doc-browser-C8eqJLi_.js.gz +0 -0
  48. package/ui-dist/assets/{doc-browser-context-C4yQrKrH.js → doc-browser-context-BPCDFcC-.js} +1 -1
  49. package/ui-dist/assets/doc-browser-context-BPCDFcC-.js.gz +0 -0
  50. package/ui-dist/assets/{ellipsis-BRI6ROeu.js → ellipsis-C5YXdOUx.js} +1 -1
  51. package/ui-dist/assets/{es2015-MOCbM0Eu.js → es2015-cuwbYI-l.js} +1 -1
  52. package/ui-dist/assets/es2015-cuwbYI-l.js.gz +0 -0
  53. package/ui-dist/assets/{extensions-DxUBMtHW.js → extensions-DgKQRebe.js} +1 -1
  54. package/ui-dist/assets/extensions-DgKQRebe.js.gz +0 -0
  55. package/ui-dist/assets/{eye-cnynUDGt.js → eye-C84inPcV.js} +1 -1
  56. package/ui-dist/assets/{form-actions-gQ0JEUwB.js → form-actions-AIdXOoCL.js} +1 -1
  57. package/ui-dist/assets/{i18n-B9yXA8KO.js → i18n-CKvm9zyk.js} +2 -2
  58. package/ui-dist/assets/i18n-CKvm9zyk.js.gz +0 -0
  59. package/ui-dist/assets/{i18n-provider-BYBJua91.js → i18n-provider-CPV43pMX.js} +1 -1
  60. package/ui-dist/assets/loader-circle-K1BDdHR5.js +1 -0
  61. package/ui-dist/assets/login-page-ClcrvN04.js +1 -0
  62. package/ui-dist/assets/{login-page-CqrHhzaN.js → login-page-DeDQjVxv.js} +1 -1
  63. package/ui-dist/assets/login-page-DeDQjVxv.js.gz +0 -0
  64. package/ui-dist/assets/{logo-badge-Cr03YceJ.js → logo-badge-C-5-zim6.js} +1 -1
  65. package/ui-dist/assets/logo-badge-C-5-zim6.js.gz +0 -0
  66. package/ui-dist/assets/main-DGqlaAaI.css +1 -0
  67. package/ui-dist/assets/main-DGqlaAaI.css.gz +0 -0
  68. package/ui-dist/assets/main-i18n-catalog.config-CpNF5aVc.js +1 -0
  69. package/ui-dist/assets/main-i18n-catalog.config-CpNF5aVc.js.gz +0 -0
  70. package/ui-dist/assets/main-nMVfHb5K.js +2 -0
  71. package/ui-dist/assets/main-nMVfHb5K.js.gz +0 -0
  72. package/ui-dist/assets/{mcp-marketplace-page-CifiVgFD.js → mcp-marketplace-page-CWjJGp_D.js} +1 -1
  73. package/ui-dist/assets/mcp-marketplace-page-CWjJGp_D.js.gz +0 -0
  74. package/ui-dist/assets/mcp-marketplace-page-fvu2NcXT.js +1 -0
  75. package/ui-dist/assets/{model-config-page-C6jVNbSj.js → model-config-page-Dv_zE7HN.js} +1 -1
  76. package/ui-dist/assets/model-config-page-Dv_zE7HN.js.gz +0 -0
  77. package/ui-dist/assets/{navigation-link-kbCLRSr_.js → navigation-link-BAQjgx2F.js} +1 -1
  78. package/ui-dist/assets/navigation-link-BAQjgx2F.js.gz +0 -0
  79. package/ui-dist/assets/panel-app-i18n-catalog.config-BzxE3tZb.js +1 -0
  80. package/ui-dist/assets/{panelStandalone-DMBnYyTw.js → panelStandalone-CFRBHV94.js} +2 -2
  81. package/ui-dist/assets/panelStandalone-CFRBHV94.js.gz +0 -0
  82. package/ui-dist/assets/plus-LA8-jpxP.js +1 -0
  83. package/ui-dist/assets/{popover-XVDgjxcl.js → popover-NkrFlWHp.js} +1 -1
  84. package/ui-dist/assets/popover-NkrFlWHp.js.gz +0 -0
  85. package/ui-dist/assets/{privacy-settings-page-BN27MBVA.js → privacy-settings-page-D6uc9f-A.js} +1 -1
  86. package/ui-dist/assets/privacy-settings-page-D6uc9f-A.js.gz +0 -0
  87. package/ui-dist/assets/projects-BD1rG75R.js +1 -0
  88. package/ui-dist/assets/projects-BD1rG75R.js.gz +0 -0
  89. package/ui-dist/assets/{provider-scoped-model-input-BGZMCThn.js → provider-scoped-model-input-DUa_9uwg.js} +1 -1
  90. package/ui-dist/assets/provider-scoped-model-input-DUa_9uwg.js.gz +0 -0
  91. package/ui-dist/assets/{providers-config-page-D5aBwbOD.js → providers-config-page-DAiqxlF_.js} +1 -1
  92. package/ui-dist/assets/providers-config-page-DAiqxlF_.js.gz +0 -0
  93. package/ui-dist/assets/{puzzle-D5Dhacmb.js → puzzle-D6gulz7u.js} +1 -1
  94. package/ui-dist/assets/{pwa-ClQK56Qe.js → pwa-C_Zte1xe.js} +1 -1
  95. package/ui-dist/assets/pwa-C_Zte1xe.js.gz +0 -0
  96. package/ui-dist/assets/{refresh-cw-Bw5BY7vp.js → refresh-cw-h9Xq3LY3.js} +1 -1
  97. package/ui-dist/assets/remote-BO0QP7ua.js +1 -0
  98. package/ui-dist/assets/{rotate-cw-BksCLAeE.js → rotate-cw-B6xm41Wn.js} +1 -1
  99. package/ui-dist/assets/runtime-config-page-w1UAkGF_.js +1 -0
  100. package/ui-dist/assets/runtime-config-page-w1UAkGF_.js.gz +0 -0
  101. package/ui-dist/assets/{save-CVi8VWzb.js → save-fff_WpY2.js} +1 -1
  102. package/ui-dist/assets/{search-DN-f7IIC.js → search-CUe41wjm.js} +1 -1
  103. package/ui-dist/assets/{search-config-page-BmuZTVxs.js → search-config-page-3xbhRlW2.js} +1 -1
  104. package/ui-dist/assets/search-config-page-3xbhRlW2.js.gz +0 -0
  105. package/ui-dist/assets/{secrets-config-page-NPHpg9sb.js → secrets-config-page-Dn8_rdOj.js} +1 -1
  106. package/ui-dist/assets/secrets-config-page-Dn8_rdOj.js.gz +0 -0
  107. package/ui-dist/assets/security-config-Y1nEGM3A.js +1 -0
  108. package/ui-dist/assets/{select-CmDTqk2C.js → select-CG5YWnwe.js} +1 -1
  109. package/ui-dist/assets/select-CG5YWnwe.js.gz +0 -0
  110. package/ui-dist/assets/{service-apps-panel-BYGJ9_pO.js → service-apps-panel-CGc04aMn.js} +1 -1
  111. package/ui-dist/assets/service-apps-panel-CGc04aMn.js.gz +0 -0
  112. package/ui-dist/assets/{settings-2-B62YtZon.js → settings-2-CE3ELQyk.js} +1 -1
  113. package/ui-dist/assets/skeleton-BL9h32W7.js +1 -0
  114. package/ui-dist/assets/{tabs-Bk_mG7ql.js → tabs-BuE0qKMh.js} +1 -1
  115. package/ui-dist/assets/tabs-BuE0qKMh.js.gz +0 -0
  116. package/ui-dist/assets/{tag-chip-DgqKlI5D.js → tag-chip-BDzpHEli.js} +1 -1
  117. package/ui-dist/assets/{theme-provider-CeBY2pyu.js → theme-provider-B6FinATQ.js} +1 -1
  118. package/ui-dist/assets/theme-provider-B6FinATQ.js.gz +0 -0
  119. package/ui-dist/assets/{tooltip-CgGbBdYf.js → tooltip-DYcuWhuP.js} +1 -1
  120. package/ui-dist/assets/tooltip-DYcuWhuP.js.gz +0 -0
  121. package/ui-dist/assets/{trash-2-CVOev8yc.js → trash-2-BPPYt2NV.js} +1 -1
  122. package/ui-dist/assets/{use-config-b2DN67gs.js → use-config-BPUM2lbo.js} +1 -1
  123. package/ui-dist/assets/use-config-BPUM2lbo.js.gz +0 -0
  124. package/ui-dist/assets/{use-desktop-capabilities-B3tLU1yl.js → use-desktop-capabilities-BDjArQP3.js} +1 -1
  125. package/ui-dist/assets/use-desktop-capabilities-BDjArQP3.js.gz +0 -0
  126. package/ui-dist/assets/{use-panel-app-scroll-restoration-BekzoX6z.js → use-panel-app-scroll-restoration-DsV1IJx-.js} +1 -1
  127. package/ui-dist/assets/use-panel-app-scroll-restoration-DsV1IJx-.js.gz +0 -0
  128. package/ui-dist/assets/{use-viewport-layout-CUA3jQsA.js → use-viewport-layout-BS18drMT.js} +1 -1
  129. package/ui-dist/assets/use-viewport-layout-BS18drMT.js.gz +0 -0
  130. package/ui-dist/assets/{utils-UBHTdG5Q.js → utils-CBZPzC_b.js} +1 -1
  131. package/ui-dist/assets/{utils-UBHTdG5Q.js.gz → utils-CBZPzC_b.js.gz} +0 -0
  132. package/ui-dist/assets/x-DdXOqLnX.js +1 -0
  133. package/ui-dist/index.html +50 -50
  134. package/ui-dist/index.html.gz +0 -0
  135. package/ui-dist/panel-standalone.html +15 -15
  136. package/ui-dist/panel-standalone.html.gz +0 -0
  137. package/ui-dist/assets/account-panel-BxMlLXYH.js.gz +0 -0
  138. package/ui-dist/assets/api-Utt-xzrT.js.gz +0 -0
  139. package/ui-dist/assets/app-data-DYXDL6X2.js.gz +0 -0
  140. package/ui-dist/assets/app-presenter-provider-CLsFiXvV.js +0 -109
  141. package/ui-dist/assets/app-presenter-provider-CLsFiXvV.js.gz +0 -0
  142. package/ui-dist/assets/appearance-settings-page-BfYznAK5.js.gz +0 -0
  143. package/ui-dist/assets/card-IevY2nm-.js.gz +0 -0
  144. package/ui-dist/assets/channels-list-page-DitnqbMR.js.gz +0 -0
  145. package/ui-dist/assets/config-split-page-BtnkqWVp.js.gz +0 -0
  146. package/ui-dist/assets/confirm-dialog-DFt4jpN7.js.gz +0 -0
  147. package/ui-dist/assets/desktop-capabilities-page-CCf14WId.js.gz +0 -0
  148. package/ui-dist/assets/desktop-update-config-DVoVgfFi.js.gz +0 -0
  149. package/ui-dist/assets/dialog-BFN_1DBH.js.gz +0 -0
  150. package/ui-dist/assets/dist-Bc9hOVNN.js.gz +0 -0
  151. package/ui-dist/assets/dist-CEhIDAnr.js.gz +0 -0
  152. package/ui-dist/assets/dist-hkVPP1th.js.gz +0 -0
  153. package/ui-dist/assets/doc-browser-BNUxmwD6.js.gz +0 -0
  154. package/ui-dist/assets/doc-browser-context-C4yQrKrH.js.gz +0 -0
  155. package/ui-dist/assets/doc-browser-w4eGZXLu.js +0 -1
  156. package/ui-dist/assets/es2015-MOCbM0Eu.js.gz +0 -0
  157. package/ui-dist/assets/extensions-DxUBMtHW.js.gz +0 -0
  158. package/ui-dist/assets/i18n-B9yXA8KO.js.gz +0 -0
  159. package/ui-dist/assets/loader-circle-rWr5Yo0E.js +0 -1
  160. package/ui-dist/assets/login-page-CfMSkOsg.js +0 -1
  161. package/ui-dist/assets/login-page-CqrHhzaN.js.gz +0 -0
  162. package/ui-dist/assets/logo-badge-Cr03YceJ.js.gz +0 -0
  163. package/ui-dist/assets/main-8cVkMfgE.css +0 -1
  164. package/ui-dist/assets/main-8cVkMfgE.css.gz +0 -0
  165. package/ui-dist/assets/main-Bys58GxY.js +0 -2
  166. package/ui-dist/assets/main-Bys58GxY.js.gz +0 -0
  167. package/ui-dist/assets/main-i18n-catalog.config-BSq9yiUQ.js +0 -1
  168. package/ui-dist/assets/main-i18n-catalog.config-BSq9yiUQ.js.gz +0 -0
  169. package/ui-dist/assets/mcp-marketplace-page-CifiVgFD.js.gz +0 -0
  170. package/ui-dist/assets/mcp-marketplace-page-DX5VE3mU.js +0 -1
  171. package/ui-dist/assets/model-config-page-C6jVNbSj.js.gz +0 -0
  172. package/ui-dist/assets/navigation-link-kbCLRSr_.js.gz +0 -0
  173. package/ui-dist/assets/panel-app-i18n-catalog.config-C2St67SP.js +0 -1
  174. package/ui-dist/assets/panelStandalone-DMBnYyTw.js.gz +0 -0
  175. package/ui-dist/assets/plus-BHnKwuPq.js +0 -1
  176. package/ui-dist/assets/popover-XVDgjxcl.js.gz +0 -0
  177. package/ui-dist/assets/privacy-settings-page-BN27MBVA.js.gz +0 -0
  178. package/ui-dist/assets/projects-DV3UuJMS.js +0 -1
  179. package/ui-dist/assets/projects-DV3UuJMS.js.gz +0 -0
  180. package/ui-dist/assets/provider-scoped-model-input-BGZMCThn.js.gz +0 -0
  181. package/ui-dist/assets/providers-config-page-D5aBwbOD.js.gz +0 -0
  182. package/ui-dist/assets/pwa-ClQK56Qe.js.gz +0 -0
  183. package/ui-dist/assets/remote-Bl005fzu.js +0 -1
  184. package/ui-dist/assets/runtime-config-page-CmktQcMW.js +0 -1
  185. package/ui-dist/assets/runtime-config-page-CmktQcMW.js.gz +0 -0
  186. package/ui-dist/assets/search-config-page-BmuZTVxs.js.gz +0 -0
  187. package/ui-dist/assets/secrets-config-page-NPHpg9sb.js.gz +0 -0
  188. package/ui-dist/assets/security-config-Djptuyf2.js +0 -1
  189. package/ui-dist/assets/select-CmDTqk2C.js.gz +0 -0
  190. package/ui-dist/assets/service-apps-panel-BYGJ9_pO.js.gz +0 -0
  191. package/ui-dist/assets/skeleton-Eh64l4T2.js +0 -1
  192. package/ui-dist/assets/tabs-Bk_mG7ql.js.gz +0 -0
  193. package/ui-dist/assets/theme-provider-CeBY2pyu.js.gz +0 -0
  194. package/ui-dist/assets/tooltip-CgGbBdYf.js.gz +0 -0
  195. package/ui-dist/assets/use-config-b2DN67gs.js.gz +0 -0
  196. package/ui-dist/assets/use-desktop-capabilities-B3tLU1yl.js.gz +0 -0
  197. package/ui-dist/assets/use-panel-app-scroll-restoration-BekzoX6z.js.gz +0 -0
  198. package/ui-dist/assets/use-viewport-layout-CUA3jQsA.js.gz +0 -0
  199. package/ui-dist/assets/x-C0iaOsRW.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-UBHTdG5Q.js";import{Lt as i,Yt as a,bn as o,jn as s,yn as c}from"./api-Utt-xzrT.js";import{s as l}from"./i18n-B9yXA8KO.js";import{t as u}from"./createLucideIcon-BTHK0Ot9.js";import{d,f,g as p,h as m,i as h,o as g,p as _,r as v,s as y,u as b}from"./app-data-DYXDL6X2.js";import{t as x}from"./boxes-DwJeuK_h.js";import{t as S}from"./chevron-down-An7Km-t4.js";import{t as C}from"./circle-dashed-CapXEpiV.js";import{i as w,n as T,r as E,t as D,u as O}from"./tooltip-CgGbBdYf.js";import{t as k}from"./loader-circle-rWr5Yo0E.js";import{t as A}from"./refresh-cw-Bw5BY7vp.js";import{t as j}from"./trash-2-CVOev8yc.js";import{a as M,i as N,n as P,o as F,r as I,t as L}from"./dialog-BFN_1DBH.js";import{i as R,r as z,t as B}from"./popover-XVDgjxcl.js";var V=u(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),H=u(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),U=u(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ee=u(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),W=e(n(),1),G=t();function te({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:i,deletePending:o,open:s,purgeData:c,onDelete:u,onOpenChange:d,onPurgeDataChange:f}){let p=(0,W.useRef)(null);(0,W.useEffect)(()=>{i&&p.current?.focus()},[i]);let m=()=>d(!1);return(0,G.jsx)(L,{open:s,onOpenChange:e=>!o&&d(e),children:(0,G.jsxs)(P,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>o&&e.preventDefault(),onInteractOutside:e=>o&&e.preventDefault(),children:[(0,G.jsxs)(M,{children:[(0,G.jsx)(F,{children:l(`serviceAppsDeleteConfirmTitle`)}),(0,G.jsxs)(I,{children:[l(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,G.jsx)(g,{checked:!c,description:l(`serviceAppsKeepDataDescription`),label:l(`appPackagesKeepData`),onClick:()=>f(!1)}),(0,G.jsx)(g,{checked:c,destructive:!0,disabled:!n||r,description:l(`serviceAppsDeleteDataDescription`),label:l(`appPackagesDeleteData`),onClick:()=>f(!0)})]}),n?(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(h,{storage:n.storage,usage:n.usage})}):(0,G.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:l(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),i?(0,G.jsx)(`p`,{ref:p,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:i instanceof Error?i.message:l(`appPackagesActionFailed`)}):null,(0,G.jsxs)(N,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,G.jsx)(a,{autoFocus:!0,type:`button`,variant:`outline`,disabled:o,onClick:m,children:l(`cancel`)}),(0,G.jsxs)(a,{type:`button`,variant:c?`destructive`:`default`,disabled:o||c&&!n,onClick:()=>u(e,c,m),children:[o?(0,G.jsx)(k,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l(c?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function ne({action:e,grants:t,agents:n,grantAgentPending:r,onGrantAgent:i,onRevoke:a}){let[o,s]=(0,W.useState)(!1),c=new Set(t.flatMap(e=>e.caller.surface===`agent`?[e.caller.agentId]:[])),u=n.filter(e=>!c.has(e.id));return(0,G.jsxs)(`div`,{className:`py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,G.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,G.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:l(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk}),(0,G.jsxs)(B,{open:o,onOpenChange:s,children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,disabled:r||u.length===0,className:`ml-1 rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-40`,title:l(`serviceAppsGrantToAgent`),"aria-label":l(`serviceAppsGrantToAgent`),children:(0,G.jsx)(U,{className:`h-3.5 w-3.5`})})}),(0,G.jsxs)(z,{align:`end`,className:`w-56 rounded-xl p-1.5`,children:[(0,G.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] font-medium text-muted-foreground`,children:l(`serviceAppsGrantToAgent`)}),u.map(t=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{i(e.id,t.id),s(!1)},className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,G.jsx)(p,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t.displayName?.trim()||t.id})]},t.id))]})]})]})]}),t.map(e=>(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(f,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[l(`serviceAppsGrantedTo`),` `,K(e)]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:l(`serviceAppsRevokeGrant`),"aria-label":l(`serviceAppsRevokeGrant`),children:(0,G.jsx)(j,{className:`h-3 w-3`})})]},`${e.caller.surface}:${K(e)}:${e.actionId}`))]})}function K(e){return e.caller.surface===`panel-app`?e.caller.appId:e.caller.agentId}function q({app:e,actions:t,actionsOpen:n,grants:i,agents:a,deletePending:o,deleteError:s,dataEntry:c,dataLoading:u,isDiscovering:d,onActionsOpenChange:f,onDiscover:p,onManagePackage:m,onDelete:h,onResetDelete:g,onRestart:v,onRevoke:y,onGrantAgent:b,grantAgentPending:C}){let[A,M]=(0,W.useState)(!1),[N,P]=(0,W.useState)(!1),[F,I]=(0,W.useState)(!1),[L,V]=(0,W.useState)(!1),U=e.status!==`starting`&&e.status!==`stopped`,K=e.status===`running`||e.status===`failed`,q=e.sourceKind===`package`?e.packageId:void 0,J=ie(e),X=()=>{M(!1),V(!1),g(),P(!0)};return(0,G.jsx)(E,{delayDuration:250,children:(0,G.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-muted/25`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,G.jsx)(_,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,G.jsx)(re,{status:e.status})]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,G.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[U?(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,disabled:d,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":l(`serviceAppsDiscoverActions`),onClick:()=>p(e.id),children:[d?(0,G.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{children:l(`serviceAppsConnect`)})]})}),(0,G.jsx)(T,{side:`bottom`,className:`max-w-56 text-xs`,children:l(`serviceAppsDiscoverActionsHint`)})]}):null,(0,G.jsxs)(B,{open:A,onOpenChange:M,children:[(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(R,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":l(`serviceAppsMoreActions`),disabled:o,children:(0,G.jsx)(O,{className:`h-3.5 w-3.5`})})})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:l(`serviceAppsMoreActions`)})]}),(0,G.jsxs)(z,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,G.jsx)(Y,{disabled:!K,icon:ee,label:l(`serviceAppsDisconnectRuntime`),onClick:()=>{M(!1),v(e.id)}}),q?(0,G.jsx)(Y,{icon:x,label:l(`serviceAppsManagePackage`),onClick:()=>{M(!1),m(q)}}):(0,G.jsx)(Y,{destructive:!0,disabled:o,icon:j,label:l(`serviceAppsDelete`),onClick:X})]})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,G.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!n),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":n,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{children:l(`serviceAppsActionsSection`)}),(0,G.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),(0,G.jsx)(S,{className:r(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,n&&`rotate-180`)})]}),J.length>0?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":F,children:[(0,G.jsx)(`span`,{children:l(`serviceAppsDetails`)}),(0,G.jsx)(S,{className:r(`h-3.5 w-3.5 transition-transform`,F&&`rotate-180`)})]}):null]}),n?(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:t.length===0?(0,G.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:l(`serviceAppsActionsEmpty`)}):(0,G.jsx)(`div`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,G.jsx)(ne,{action:e,grants:i.filter(t=>t.actionId===e.id),agents:a,grantAgentPending:C,onGrantAgent:b,onRevoke:y},e.id))})}):null,F?(0,G.jsx)(ae,{rows:J}):null]}),e.sourceKind===`package`?null:(0,G.jsx)(te,{appId:e.id,appTitle:e.title,dataEntry:c,dataLoading:u,deleteError:s,deletePending:o,open:N,purgeData:L,onDelete:h,onOpenChange:P,onPurgeDataChange:V})]})})}function re({status:e}){let t=J(e),n=t.icon;return(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`span`,{className:r(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,G.jsx)(n,{className:r(`h-3 w-3`,t.iconClassName)}),(0,G.jsx)(`span`,{children:t.label})]})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function J(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:m,label:l(`serviceAppsStatus_running`),tooltip:l(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:k,iconClassName:`animate-spin`,label:l(`serviceAppsStatus_starting`),tooltip:l(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:d,label:l(`serviceAppsStatus_failed`),tooltip:l(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:V,label:l(`serviceAppsStatus_stopped`),tooltip:l(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:C,label:l(`serviceAppsStatus_idle`),tooltip:l(`serviceAppsStatusHint_idle`)}}}function Y({destructive:e=!1,disabled:t=!1,icon:n,label:i,onClick:a}){return(0,G.jsxs)(`button`,{type:`button`,className:r(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:a,children:[(0,G.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{children:i})]})}function ie(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:l(`serviceAppsCommand`),value:t},{label:l(`serviceAppsCwd`),value:e.cwd},{label:l(`serviceAppsManifest`),value:e.manifestPath},{label:l(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:l(`serviceAppsLastReady`),value:e.lastReadyAt},{label:l(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function ae({rows:e}){return(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,G.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,G.jsx)(X,{label:e.label,value:e.value},e.label))})})}function X({label:e,value:t}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}var Z=[`service-apps`],Q=[`service-actions`],$=[`service-action-grants`],oe=[`app-data`];function se(){return o({queryKey:Z,queryFn:()=>i.serviceApps.listServiceApps()})}function ce(){return o({queryKey:Q,queryFn:()=>i.serviceApps.listServiceActions()})}function le(){return o({queryKey:$,queryFn:()=>i.serviceApps.listServiceActionGrants()})}function ue(){let e=s();return c({mutationFn:e=>i.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q})])}})}function de(){let e=s();return c({mutationFn:e=>i.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$}),e.invalidateQueries({queryKey:oe})])}})}function fe(){let e=s();return c({mutationFn:e=>i.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:Z})}})}function pe(){let e=s();return c({mutationFn:e=>i.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function me(){let e=s();return c({mutationFn:e=>i.serviceApps.grantAgentServiceActions(e.agentId,e.actionIds),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function he({onManagePackage:e}){let t=se(),n=v(),r=ce(),i=le(),a=y(),o=de(),s=ue(),c=fe(),u=pe(),d=me(),[f,p]=(0,W.useState)({}),[m,h]=(0,W.useState)({}),g=()=>{t.refetch(),r.refetch(),i.refetch(),n.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:l(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,G.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:l(`serviceAppsLoadFailed`)})}let b=t.data?.entries??[],x=t.data?.diagnostics??[],S=r.data?.actions??[],C=i.data?.grants??[],O=e=>{c.mutateAsync(e).then(t=>{p(n=>({...n,[e]:t.actions})),h(t=>({...t,[e]:!0}))})},k=(n.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,G.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,G.jsx)(E,{delayDuration:250,children:(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":l(`serviceAppsRefresh`),onClick:g,children:(0,G.jsx)(A,{className:`h-3.5 w-3.5`})})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:l(`serviceAppsRefresh`)})]})})}),x.length>0?(0,G.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:l(`serviceAppsLoadFailed`)}),(0,G.jsx)(`ul`,{className:`mt-1 space-y-1`,children:x.map(e=>(0,G.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,b.length===0?(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,G.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,G.jsx)(_,{className:`h-5 w-5`})}),(0,G.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:l(`serviceAppsEmptyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l(`serviceAppsEmptyDescription`)})]})}):(0,G.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,G.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:b.map(t=>(0,G.jsx)(q,{app:t,actions:f[t.id]??S.filter(e=>e.appId===t.id),actionsOpen:!!m[t.id],grants:C,agents:a.data?.agents??[],deletePending:o.isPending,deleteError:o.error,dataEntry:k.find(e=>e.appId===t.id),dataLoading:n.isLoading,isDiscovering:c.isPending,onActionsOpenChange:e=>h(n=>({...n,[t.id]:e})),onDiscover:O,onManagePackage:e,onDelete:(e,t,n)=>void o.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:o.reset,onRestart:e=>void s.mutate(e),onRevoke:e=>void u.mutate({actionId:e.actionId,caller:e.caller}),onGrantAgent:(e,t)=>void d.mutate({actionIds:[e],agentId:t}),grantAgentPending:d.isPending},t.id))})})]})}export{he as ServiceAppsPanel};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{Lt as i,Yt as a,bn as o,jn as s,yn as c}from"./api-BnUzdltV.js";import{s as l}from"./i18n-CKvm9zyk.js";import{t as u}from"./createLucideIcon-BNKf0_kc.js";import{d,f,g as p,h as m,i as h,o as g,p as _,r as v,s as y,u as b}from"./app-data-Bjh_zM45.js";import{t as x}from"./boxes-D6uPnkGo.js";import{t as S}from"./chevron-down-BL-yMYcX.js";import{t as C}from"./circle-dashed-CU3yApvP.js";import{i as w,n as T,r as E,t as D,u as O}from"./tooltip-DYcuWhuP.js";import{t as k}from"./loader-circle-K1BDdHR5.js";import{t as A}from"./refresh-cw-h9Xq3LY3.js";import{t as j}from"./trash-2-BPPYt2NV.js";import{a as M,i as N,n as P,o as F,r as I,t as L}from"./dialog-Xe73hpQz.js";import{i as R,r as z,t as B}from"./popover-NkrFlWHp.js";var V=u(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),H=u(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),U=u(`ShieldPlus`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9 12h6`,key:`1c52cq`}],[`path`,{d:`M12 9v6`,key:`199k2o`}]]),ee=u(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),W=e(n(),1),G=t();function te({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:i,deletePending:o,open:s,purgeData:c,onDelete:u,onOpenChange:d,onPurgeDataChange:f}){let p=(0,W.useRef)(null);(0,W.useEffect)(()=>{i&&p.current?.focus()},[i]);let m=()=>d(!1);return(0,G.jsx)(L,{open:s,onOpenChange:e=>!o&&d(e),children:(0,G.jsxs)(P,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>o&&e.preventDefault(),onInteractOutside:e=>o&&e.preventDefault(),children:[(0,G.jsxs)(M,{children:[(0,G.jsx)(F,{children:l(`serviceAppsDeleteConfirmTitle`)}),(0,G.jsxs)(I,{children:[l(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,G.jsx)(g,{checked:!c,description:l(`serviceAppsKeepDataDescription`),label:l(`appPackagesKeepData`),onClick:()=>f(!1)}),(0,G.jsx)(g,{checked:c,destructive:!0,disabled:!n||r,description:l(`serviceAppsDeleteDataDescription`),label:l(`appPackagesDeleteData`),onClick:()=>f(!0)})]}),n?(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(h,{storage:n.storage,usage:n.usage})}):(0,G.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:l(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),i?(0,G.jsx)(`p`,{ref:p,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:i instanceof Error?i.message:l(`appPackagesActionFailed`)}):null,(0,G.jsxs)(N,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,G.jsx)(a,{autoFocus:!0,type:`button`,variant:`outline`,disabled:o,onClick:m,children:l(`cancel`)}),(0,G.jsxs)(a,{type:`button`,variant:c?`destructive`:`default`,disabled:o||c&&!n,onClick:()=>u(e,c,m),children:[o?(0,G.jsx)(k,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l(c?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function ne({action:e,grants:t,agents:n,grantAgentPending:r,onGrantAgent:i,onRevoke:a}){let[o,s]=(0,W.useState)(!1),c=new Set(t.flatMap(e=>e.caller.surface===`agent`?[e.caller.agentId]:[])),u=n.filter(e=>!c.has(e.id));return(0,G.jsxs)(`div`,{className:`py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,G.jsx)(b,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,G.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:l(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk}),(0,G.jsxs)(B,{open:o,onOpenChange:s,children:[(0,G.jsx)(R,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,disabled:r||u.length===0,className:`ml-1 rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-40`,title:l(`serviceAppsGrantToAgent`),"aria-label":l(`serviceAppsGrantToAgent`),children:(0,G.jsx)(U,{className:`h-3.5 w-3.5`})})}),(0,G.jsxs)(z,{align:`end`,className:`w-56 rounded-xl p-1.5`,children:[(0,G.jsx)(`div`,{className:`px-2 py-1.5 text-[11px] font-medium text-muted-foreground`,children:l(`serviceAppsGrantToAgent`)}),u.map(t=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{i(e.id,t.id),s(!1)},className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,G.jsx)(p,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t.displayName?.trim()||t.id})]},t.id))]})]})]})]}),t.map(e=>(0,G.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(f,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[l(`serviceAppsGrantedTo`),` `,K(e)]})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:l(`serviceAppsRevokeGrant`),"aria-label":l(`serviceAppsRevokeGrant`),children:(0,G.jsx)(j,{className:`h-3 w-3`})})]},`${e.caller.surface}:${K(e)}:${e.actionId}`))]})}function K(e){return e.caller.surface===`panel-app`?e.caller.appId:e.caller.agentId}function q({app:e,actions:t,actionsOpen:n,grants:i,agents:a,deletePending:o,deleteError:s,dataEntry:c,dataLoading:u,isDiscovering:d,onActionsOpenChange:f,onDiscover:p,onManagePackage:m,onDelete:h,onResetDelete:g,onRestart:v,onRevoke:y,onGrantAgent:b,grantAgentPending:C}){let[A,M]=(0,W.useState)(!1),[N,P]=(0,W.useState)(!1),[F,I]=(0,W.useState)(!1),[L,V]=(0,W.useState)(!1),U=e.status!==`starting`&&e.status!==`stopped`,K=e.status===`running`||e.status===`failed`,q=e.sourceKind===`package`?e.packageId:void 0,J=ie(e),X=()=>{M(!1),V(!1),g(),P(!0)};return(0,G.jsx)(E,{delayDuration:250,children:(0,G.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-muted/25`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,G.jsx)(_,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,G.jsx)(re,{status:e.status})]}),e.description?(0,G.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,G.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[U?(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,disabled:d,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":l(`serviceAppsDiscoverActions`),onClick:()=>p(e.id),children:[d?(0,G.jsx)(k,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(H,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{children:l(`serviceAppsConnect`)})]})}),(0,G.jsx)(T,{side:`bottom`,className:`max-w-56 text-xs`,children:l(`serviceAppsDiscoverActionsHint`)})]}):null,(0,G.jsxs)(B,{open:A,onOpenChange:M,children:[(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(R,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":l(`serviceAppsMoreActions`),disabled:o,children:(0,G.jsx)(O,{className:`h-3.5 w-3.5`})})})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:l(`serviceAppsMoreActions`)})]}),(0,G.jsxs)(z,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,G.jsx)(Y,{disabled:!K,icon:ee,label:l(`serviceAppsDisconnectRuntime`),onClick:()=>{M(!1),v(e.id)}}),q?(0,G.jsx)(Y,{icon:x,label:l(`serviceAppsManagePackage`),onClick:()=>{M(!1),m(q)}}):(0,G.jsx)(Y,{destructive:!0,disabled:o,icon:j,label:l(`serviceAppsDelete`),onClick:X})]})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,G.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(!n),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":n,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{children:l(`serviceAppsActionsSection`)}),(0,G.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),(0,G.jsx)(S,{className:r(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,n&&`rotate-180`)})]}),J.length>0?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":F,children:[(0,G.jsx)(`span`,{children:l(`serviceAppsDetails`)}),(0,G.jsx)(S,{className:r(`h-3.5 w-3.5 transition-transform`,F&&`rotate-180`)})]}):null]}),n?(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:t.length===0?(0,G.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:l(`serviceAppsActionsEmpty`)}):(0,G.jsx)(`div`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,G.jsx)(ne,{action:e,grants:i.filter(t=>t.actionId===e.id),agents:a,grantAgentPending:C,onGrantAgent:b,onRevoke:y},e.id))})}):null,F?(0,G.jsx)(ae,{rows:J}):null]}),e.sourceKind===`package`?null:(0,G.jsx)(te,{appId:e.id,appTitle:e.title,dataEntry:c,dataLoading:u,deleteError:s,deletePending:o,open:N,purgeData:L,onDelete:h,onOpenChange:P,onPurgeDataChange:V})]})})}function re({status:e}){let t=J(e),n=t.icon;return(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsxs)(`span`,{className:r(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,G.jsx)(n,{className:r(`h-3 w-3`,t.iconClassName)}),(0,G.jsx)(`span`,{children:t.label})]})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function J(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:m,label:l(`serviceAppsStatus_running`),tooltip:l(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:k,iconClassName:`animate-spin`,label:l(`serviceAppsStatus_starting`),tooltip:l(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:d,label:l(`serviceAppsStatus_failed`),tooltip:l(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:V,label:l(`serviceAppsStatus_stopped`),tooltip:l(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:C,label:l(`serviceAppsStatus_idle`),tooltip:l(`serviceAppsStatusHint_idle`)}}}function Y({destructive:e=!1,disabled:t=!1,icon:n,label:i,onClick:a}){return(0,G.jsxs)(`button`,{type:`button`,className:r(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:a,children:[(0,G.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{children:i})]})}function ie(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:l(`serviceAppsCommand`),value:t},{label:l(`serviceAppsCwd`),value:e.cwd},{label:l(`serviceAppsManifest`),value:e.manifestPath},{label:l(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:l(`serviceAppsLastReady`),value:e.lastReadyAt},{label:l(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function ae({rows:e}){return(0,G.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,G.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,G.jsx)(X,{label:e.label,value:e.value},e.label))})})}function X({label:e,value:t}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}var Z=[`service-apps`],Q=[`service-actions`],$=[`service-action-grants`],oe=[`app-data`];function se(){return o({queryKey:Z,queryFn:()=>i.serviceApps.listServiceApps()})}function ce(){return o({queryKey:Q,queryFn:()=>i.serviceApps.listServiceActions()})}function le(){return o({queryKey:$,queryFn:()=>i.serviceApps.listServiceActionGrants()})}function ue(){let e=s();return c({mutationFn:e=>i.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q})])}})}function de(){let e=s();return c({mutationFn:e=>i.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Z}),e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$}),e.invalidateQueries({queryKey:oe})])}})}function fe(){let e=s();return c({mutationFn:e=>i.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:Z})}})}function pe(){let e=s();return c({mutationFn:e=>i.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function me(){let e=s();return c({mutationFn:e=>i.serviceApps.grantAgentServiceActions(e.agentId,e.actionIds),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:Q}),e.invalidateQueries({queryKey:$})])}})}function he({onManagePackage:e}){let t=se(),n=v(),r=ce(),i=le(),a=y(),o=de(),s=ue(),c=fe(),u=pe(),d=me(),[f,p]=(0,W.useState)({}),[m,h]=(0,W.useState)({}),g=()=>{t.refetch(),r.refetch(),i.refetch(),n.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,G.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:l(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,G.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:l(`serviceAppsLoadFailed`)})}let b=t.data?.entries??[],x=t.data?.diagnostics??[],S=r.data?.actions??[],C=i.data?.grants??[],O=e=>{c.mutateAsync(e).then(t=>{p(n=>({...n,[e]:t.actions})),h(t=>({...t,[e]:!0}))})},k=(n.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,G.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,G.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,G.jsx)(E,{delayDuration:250,children:(0,G.jsxs)(D,{children:[(0,G.jsx)(w,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":l(`serviceAppsRefresh`),onClick:g,children:(0,G.jsx)(A,{className:`h-3.5 w-3.5`})})}),(0,G.jsx)(T,{side:`bottom`,className:`text-xs`,children:l(`serviceAppsRefresh`)})]})})}),x.length>0?(0,G.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,G.jsx)(`div`,{className:`font-medium`,children:l(`serviceAppsLoadFailed`)}),(0,G.jsx)(`ul`,{className:`mt-1 space-y-1`,children:x.map(e=>(0,G.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,b.length===0?(0,G.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,G.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,G.jsx)(_,{className:`h-5 w-5`})}),(0,G.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:l(`serviceAppsEmptyTitle`)}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:l(`serviceAppsEmptyDescription`)})]})}):(0,G.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,G.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:b.map(t=>(0,G.jsx)(q,{app:t,actions:f[t.id]??S.filter(e=>e.appId===t.id),actionsOpen:!!m[t.id],grants:C,agents:a.data?.agents??[],deletePending:o.isPending,deleteError:o.error,dataEntry:k.find(e=>e.appId===t.id),dataLoading:n.isLoading,isDiscovering:c.isPending,onActionsOpenChange:e=>h(n=>({...n,[t.id]:e})),onDiscover:O,onManagePackage:e,onDelete:(e,t,n)=>void o.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:o.reset,onRestart:e=>void s.mutate(e),onRevoke:e=>void u.mutate({actionId:e.actionId,caller:e.caller}),onGrantAgent:(e,t)=>void d.mutate({actionIds:[e],agentId:t}),grantAgentPending:d.isPending},t.id))})})]})}export{he as ServiceAppsPanel};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-BTHK0Ot9.js";var t=e(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-BNKf0_kc.js";var t=e(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{A as e,t}from"./utils-CBZPzC_b.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`animate-pulse rounded-md bg-slate-200`,e),...r})}export{r as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-UBHTdG5Q.js";import{t as i}from"./createLucideIcon-BTHK0Ot9.js";var a=i(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),o=i(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),s=i(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),c={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function l(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function u(e){return l(c,e)}var d=e(n(),1),f=t(),p=d.createContext(null);function m({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,f.jsx)(p.Provider,{value:{value:t,onValueChange:n},children:r})}function h({children:e,className:t}){return(0,f.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:r(`inline-flex h-9 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,t),children:e})}function g({value:e,children:t,className:n}){let i=d.useContext(p);if(!i)throw Error(`TabsTrigger must be used within Tabs`);let a=i.value===e;return(0,f.jsx)(`button`,{type:`button`,onClick:()=>i.onValueChange(e),role:`tab`,"aria-selected":a,tabIndex:a?0:-1,"data-state":a?`active`:`inactive`,className:r(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,a?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,n),children:t})}function _({value:e,children:t,className:n}){let i=d.useContext(p);if(!i)throw Error(`TabsContent must be used within Tabs`);return i.value===e?(0,f.jsx)(`div`,{className:r(`mt-2 animate-fade-in`,n),children:t}):null}export{u as a,a as c,g as i,_ as n,s as o,h as r,o as s,m as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{t as i}from"./createLucideIcon-BNKf0_kc.js";var a=i(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),o=i(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),s=i(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),c={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function l(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function u(e){return l(c,e)}var d=e(n(),1),f=t(),p=d.createContext(null);function m({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,f.jsx)(p.Provider,{value:{value:t,onValueChange:n},children:r})}function h({children:e,className:t}){return(0,f.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:r(`inline-flex h-9 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,t),children:e})}function g({value:e,children:t,className:n}){let i=d.useContext(p);if(!i)throw Error(`TabsTrigger must be used within Tabs`);let a=i.value===e;return(0,f.jsx)(`button`,{type:`button`,onClick:()=>i.onValueChange(e),role:`tab`,"aria-selected":a,tabIndex:a?0:-1,"data-state":a?`active`:`inactive`,className:r(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,a?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,n),children:t})}function _({value:e,children:t,className:n}){let i=d.useContext(p);if(!i)throw Error(`TabsContent must be used within Tabs`);return i.value===e?(0,f.jsx)(`div`,{className:r(`mt-2 animate-fade-in`,n),children:t}):null}export{u as a,a as c,g as i,_ as n,s as o,h as r,o as s,m as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-UBHTdG5Q.js";import{Zt as i}from"./api-Utt-xzrT.js";var a=e(n(),1),o=t(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:e,tone:t,...n},i)=>(0,o.jsx)(`span`,{ref:i,className:r(s({tone:t}),e),...n}));c.displayName=`TagChip`;export{c as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{Zt as i}from"./api-BnUzdltV.js";var a=e(n(),1),o=t(),s=i(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,{variants:{tone:{subtle:`border-gray-200 bg-gray-50 text-gray-600`,neutral:`border-gray-200 bg-white text-gray-600`,success:`border-emerald-200 bg-emerald-50 text-emerald-700`,warning:`border-amber-200 bg-amber-50 text-amber-800`,danger:`border-rose-200 bg-rose-50 text-rose-600`,info:`border-primary/20 bg-primary/10 text-primary`}},defaultVariants:{tone:`subtle`}}),c=a.forwardRef(({className:e,tone:t,...n},i)=>(0,o.jsx)(`span`,{ref:i,className:r(s({tone:t}),e),...n}));c.displayName=`TagChip`;export{c as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,i as r}from"./utils-UBHTdG5Q.js";import{Lt as i,Yt as a,bn as o,hn as s,jn as c,vn as l,yn as u}from"./api-Utt-xzrT.js";import{s as d}from"./i18n-B9yXA8KO.js";import{t as f}from"./createLucideIcon-BTHK0Ot9.js";import{t as ee}from"./boxes-DwJeuK_h.js";import{a as p,i as te,n as ne,o as re,r as ie,t as m}from"./dialog-BFN_1DBH.js";import{t as h}from"./use-panel-app-scroll-restoration-BekzoX6z.js";var g=f(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),_=f(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),v=[`panel-apps`],y=[`panel-app`];function b(e,t){return e.id===t||e.appId===t}function x(e,t,n){return e&&{...e,entries:e.entries.map(e=>b(e,t)?n(e):e)}}function S(e,t){return x(e,t.id,()=>t)}function C(e,t){let n=e?.entries.reduce((e,t)=>Math.max(e,t.mainSidebarOrder??-1),-1)??-1;return x(e,t.id,e=>({...e,...typeof t.preferences.favorite==`boolean`?{favorite:t.preferences.favorite}:{},...typeof t.preferences.mainSidebar==`boolean`?t.preferences.mainSidebar?{mainSidebar:!0,mainSidebarOrder:e.mainSidebar?e.mainSidebarOrder:n+1}:{mainSidebar:!1,mainSidebarOrder:void 0}:{}}))}function ae(e={}){return o({queryKey:v,queryFn:()=>i.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function w(e,t={}){return o({queryKey:[...y,e],queryFn:()=>i.panelApps.getPanelApp(e),enabled:!!e&&(t.enabled??!0),staleTime:5e3})}function T(){let e=c();return u({mutationFn:({id:e,preferences:t})=>i.panelApps.updatePanelAppPreferences(e,t),onMutate:async t=>{await e.cancelQueries({queryKey:v});let n=e.getQueryData(v)?.entries.find(e=>b(e,t.id));return e.setQueryData(v,e=>C(e,t)),{previousEntry:n}},onSuccess:t=>{e.setQueryData(v,e=>S(e,t)),e.setQueryData([...y,t.appId],t)},onError:(t,n,r)=>{let i=r?.previousEntry;i&&e.setQueryData(v,e=>x(e,n.id,()=>i));let a=t instanceof Error?t.message:String(t);l.error(`${d(`panelAppsPreferenceUpdateFailed`)}: ${a}`)}})}function E(){let e=c();return u({mutationFn:e=>i.panelApps.recordPanelAppOpened(e),onSuccess:t=>{e.setQueryData(v,e=>S(e,t)),e.setQueryData([...y,t.appId],t)}})}function D(){let e=c();return u({mutationFn:e=>i.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:v}),e.invalidateQueries({queryKey:y})}})}function O(){let e=c();return u({mutationFn:e=>i.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:v}),e.invalidateQueries({queryKey:y})}})}var k=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await i.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await i.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);case`verification.list`:return await i.serviceApps.listVerificationRecords({acceptanceId:t.payload?.acceptanceId,appId:t.payload?.appId,limit:t.payload?.limit,bridgeSessionToken:e.token});case`acceptance.status`:return await i.serviceApps.getPortableRuntimeAcceptanceStatus({appId:t.payload?.appId,locale:t.payload?.locale,bridgeSessionToken:e.token});case`acceptance.export`:return await i.serviceApps.exportPortableRuntimeAcceptance({appId:t.payload?.appId,locale:t.payload?.locale,bridgeSessionToken:e.token});default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await i.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof s)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await i.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await i.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof s)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await i.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await i.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof s)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await i.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new s({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await i.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new s({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let a=await i.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),o=a.grants.find(e=>e.actionId===t)??a.grants[0];if(!o)throw Error(`No permission grant returned for ${t}.`);return o},this.listGrantCandidateActions=async(e,t)=>{let n=await i.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let a=n.actions.filter(e=>e.grantState===`not-granted`),o=[...a.filter(e=>e.id===t),...a.filter(e=>e.id!==t)];return o.length>0?o:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof s?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`acceptance.export`||t.method===`acceptance.status`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`||t.method===`verification.list`)}}};function oe(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var A=r((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:oe(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}})),se=class{constructor(){this.requestAuthorization=async e=>await A.getState().requestAuthorization(e)}},j=class{constructor(){this.serviceActionAuthorizationManager=new se,this.panelAppBridgeManager=new k(this.serviceActionAuthorizationManager)}},M=e(n(),1),N=t(),P=globalThis,F=P.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__??(0,M.createContext)(null);P.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__=F;function I({children:e,presenter:t}){let n=(0,M.useMemo)(()=>t??new j,[t]);return(0,N.jsx)(F.Provider,{value:n,children:e})}function L(){let e=(0,M.useContext)(F);if(!e)throw Error(`usePanelAppHostPresenter must be used inside PanelAppHostProvider`);return e}function R(){let e=L(),{isPending:t,mutateAsync:n}=D(),r=(0,M.useRef)(new Map);return{ensurePanelAppClientGrant:(0,M.useCallback)(async t=>{if(!t.clientDeclared||t.clientGranted)return!0;let i=r.current.get(t.appId);if(i)return await i;let a=(async()=>await e.serviceActionAuthorizationManager.requestAuthorization({panelAppId:t.appId,actions:[{actionId:`nextclaw.client`,actionTitle:d(`panelAppsClientGrantTitle`),actionDescription:d(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await n(t.appId),!0):!1)();r.current.set(t.appId,a);try{return await a}finally{r.current.delete(t.appId)}},[n,e]),isPending:t}}function z(e){let t=c(),n=(0,M.useId)(),{ensurePanelAppClientGrant:r}=R(),a=!!(e?.clientDeclared&&!e.clientGranted),s=o({queryKey:[`panel-app-client-grant`,e?.appId??`none`,e?.clientGranted??!1],queryFn:async()=>await r(e),enabled:a,gcTime:0,retry:!1,staleTime:1/0}),l=e?a?s.isError?`error`:s.isPending?`checking`:s.data?`allowed`:`denied`:`allowed`:`idle`;return o({queryKey:[`panel-app-open`,n,e?.appId??`none`],queryFn:async()=>{let n=await i.panelApps.recordPanelAppOpened(e.id);return t.setQueryData(v,e=>S(e,n)),t.setQueryData([...y,n.appId],n),n},enabled:!!(e&&l===`allowed`),retry:!1,staleTime:1/0}),{retryClientGrant:s.refetch,state:l}}var B=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function V(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function H({appId:e,restorationScope:t,unavailableAction:n}){let r=L(),i=w(e),a=(0,M.useRef)(null),o=(0,M.useMemo)(()=>i.data,[i.data]),s=z(o),c=h({currentUrl:o?.contentPath??null,iframeRef:a,isEnabled:!!o,restorationKey:o?`panel-app:${t}:${o.appId}`:null});return(0,M.useEffect)(()=>{let e=e=>{r.panelAppBridgeManager.handleIframeMessage({event:e,iframe:a.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[r]),i.isLoading?(0,N.jsx)(U,{message:d(`panelAppsLoading`)}):i.isError?(0,N.jsx)(U,{message:i.error instanceof Error?i.error.message:d(`panelAppsLoadFailed`),actionLabel:d(`panelAppsTryAgain`),onAction:()=>void i.refetch()}):o?s.state===`checking`||s.state===`idle`?(0,N.jsx)(U,{message:d(`panelAppsCheckingPermission`)}):s.state===`denied`||s.state===`error`?(0,N.jsx)(U,{message:s.state===`denied`?d(`panelAppsPermissionDenied`):d(`panelAppsPermissionFailed`),actionLabel:d(`panelAppsTryAgain`),onAction:()=>void s.retryClientGrant()}):(0,N.jsx)(`div`,{className:`h-full min-h-0 bg-background`,children:(0,N.jsx)(`iframe`,{ref:a,src:o.contentPath,title:o.title,sandbox:B,className:`block h-full w-full border-0 bg-background`,onLoad:c,onPointerOver:e=>V(e.currentTarget)},o.appId)}):(0,N.jsx)(U,{message:d(`panelAppsMainUnavailable`),actionLabel:n?.label,onAction:n?.onAction})}function U({actionLabel:e,message:t,onAction:n}){return(0,N.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background px-6 text-center`,children:(0,N.jsxs)(`div`,{className:`max-w-sm`,children:[(0,N.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:n?(0,N.jsx)(g,{className:`h-5 w-5`}):(0,N.jsx)(ee,{className:`h-5 w-5`})}),(0,N.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t}),e&&n?(0,N.jsx)(`button`,{type:`button`,className:`mt-4 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:n,children:e}):null]})})}function W({appId:e}){let t=w(e),n=(0,M.useMemo)(()=>t.data,[t.data]);return(0,M.useEffect)(()=>{let e=document.title;return document.title=`${n?.title??d(`panelAppsTitle`)} · NextClaw`,()=>{document.title=e}},[n?.title]),(0,N.jsx)(`main`,{className:`h-dvh min-h-0 w-full overflow-hidden bg-background`,children:(0,N.jsx)(H,{appId:e,restorationScope:`standalone`})})}function G(){let e=A(e=>e.pending),t=A(e=>e.resolveAuthorization);return(0,N.jsx)(m,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,N.jsxs)(ne,{className:`[&>:last-child]:hidden`,children:[(0,N.jsxs)(p,{children:[(0,N.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,N.jsx)(_,{className:`h-4 w-4 text-amber-600`}),d(`serviceActionAuthorizationTitle`)]}),(0,N.jsx)(ie,{children:d(`serviceActionAuthorizationDescription`)})]}),e?(0,N.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,N.jsx)(K,{label:d(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:d(`serviceActionAuthorizationActions`)}),(0,N.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,N.jsx)(ce,{action:e},e.actionId))})]}),e.inputPreview?(0,N.jsx)(K,{label:d(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,N.jsxs)(te,{className:`gap-2 sm:gap-0`,children:[(0,N.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:d(`serviceActionAuthorizationReject`)}),(0,N.jsx)(a,{type:`button`,onClick:()=>t(!0),children:d(`serviceActionAuthorizationAllow`)})]})]})})}function ce({action:e}){return(0,N.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,N.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,N.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,N.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function K({label:e,value:t}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var q=`nextclaw.ui.theme`,J=`work`,Y=[{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`island`,labelKey:`themeIsland`,appearance:`light`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],le=Y.map(({value:e})=>e),ue=Y.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function X(e){return typeof e==`string`?le.includes(e)?e:e===`leaf`?`warm`:null:null}function Z(e){return Y.find(t=>t.value===e)?.appearance??`light`}var Q=new class{constructor(){this.activeTheme=J,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return J;try{let e=X(window.localStorage.getItem(q));if(e)return e}catch{}return J},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=Z(e);document.documentElement.setAttribute(`data-theme`,e),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(q,e)}catch{}}}};function de(){return Q.initializeTheme()}function fe(){return Q.getTheme()}function pe(e){Q.setTheme(e)}function me(e){return Q.subscribeThemeChange(e)}var $=(0,M.createContext)(null);function he({children:e}){let[t,n]=(0,M.useState)(()=>de());(0,M.useEffect)(()=>me(e=>{n(e)}),[]);let r=(0,M.useCallback)(e=>{pe(e),n(fe())},[]),i=(0,M.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,N.jsx)($.Provider,{value:i,children:e})}function ge(){let e=(0,M.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{ae as _,Z as a,_ as b,W as c,V as d,R as f,D as g,O as h,ue as i,H as l,j as m,ge as n,X as o,I as p,J as r,G as s,he as t,B as u,E as v,g as x,T as y};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,i as r}from"./utils-CBZPzC_b.js";import{Lt as i,Yt as a,bn as o,hn as s,jn as c,vn as l,yn as u}from"./api-BnUzdltV.js";import{s as d}from"./i18n-CKvm9zyk.js";import{t as f}from"./createLucideIcon-BNKf0_kc.js";import{t as ee}from"./boxes-D6uPnkGo.js";import{a as p,i as te,n as ne,o as re,r as ie,t as m}from"./dialog-Xe73hpQz.js";import{t as h}from"./use-panel-app-scroll-restoration-DsV1IJx-.js";var g=f(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),_=f(`ShieldAlert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),v=[`panel-apps`],y=[`panel-app`];function b(e,t){return e.id===t||e.appId===t}function x(e,t,n){return e&&{...e,entries:e.entries.map(e=>b(e,t)?n(e):e)}}function S(e,t){return x(e,t.id,()=>t)}function C(e,t){let n=e?.entries.reduce((e,t)=>Math.max(e,t.mainSidebarOrder??-1),-1)??-1;return x(e,t.id,e=>({...e,...typeof t.preferences.favorite==`boolean`?{favorite:t.preferences.favorite}:{},...typeof t.preferences.mainSidebar==`boolean`?t.preferences.mainSidebar?{mainSidebar:!0,mainSidebarOrder:e.mainSidebar?e.mainSidebarOrder:n+1}:{mainSidebar:!1,mainSidebarOrder:void 0}:{}}))}function ae(e={}){return o({queryKey:v,queryFn:()=>i.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function w(e,t={}){return o({queryKey:[...y,e],queryFn:()=>i.panelApps.getPanelApp(e),enabled:!!e&&(t.enabled??!0),staleTime:5e3})}function T(){let e=c();return u({mutationFn:({id:e,preferences:t})=>i.panelApps.updatePanelAppPreferences(e,t),onMutate:async t=>{await e.cancelQueries({queryKey:v});let n=e.getQueryData(v)?.entries.find(e=>b(e,t.id));return e.setQueryData(v,e=>C(e,t)),{previousEntry:n}},onSuccess:t=>{e.setQueryData(v,e=>S(e,t)),e.setQueryData([...y,t.appId],t)},onError:(t,n,r)=>{let i=r?.previousEntry;i&&e.setQueryData(v,e=>x(e,n.id,()=>i));let a=t instanceof Error?t.message:String(t);l.error(`${d(`panelAppsPreferenceUpdateFailed`)}: ${a}`)}})}function E(){let e=c();return u({mutationFn:e=>i.panelApps.recordPanelAppOpened(e),onSuccess:t=>{e.setQueryData(v,e=>S(e,t)),e.setQueryData([...y,t.appId],t)}})}function D(){let e=c();return u({mutationFn:e=>i.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:v}),e.invalidateQueries({queryKey:y})}})}function O(){let e=c();return u({mutationFn:e=>i.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:v}),e.invalidateQueries({queryKey:y})}})}var k=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await i.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await i.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);case`verification.list`:return await i.serviceApps.listVerificationRecords({acceptanceId:t.payload?.acceptanceId,appId:t.payload?.appId,limit:t.payload?.limit,bridgeSessionToken:e.token});case`acceptance.status`:return await i.serviceApps.getPortableRuntimeAcceptanceStatus({appId:t.payload?.appId,locale:t.payload?.locale,bridgeSessionToken:e.token});case`acceptance.export`:return await i.serviceApps.exportPortableRuntimeAcceptance({appId:t.payload?.appId,locale:t.payload?.locale,bridgeSessionToken:e.token});default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await i.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof s)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await i.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await i.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof s)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await i.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await i.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof s)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await i.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new s({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await i.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new s({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let a=await i.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),o=a.grants.find(e=>e.actionId===t)??a.grants[0];if(!o)throw Error(`No permission grant returned for ${t}.`);return o},this.listGrantCandidateActions=async(e,t)=>{let n=await i.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let a=n.actions.filter(e=>e.grantState===`not-granted`),o=[...a.filter(e=>e.id===t),...a.filter(e=>e.id!==t)];return o.length>0?o:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof s?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`acceptance.export`||t.method===`acceptance.status`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`||t.method===`verification.list`)}}};function oe(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var A=r((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:oe(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}})),se=class{constructor(){this.requestAuthorization=async e=>await A.getState().requestAuthorization(e)}},j=class{constructor(){this.serviceActionAuthorizationManager=new se,this.panelAppBridgeManager=new k(this.serviceActionAuthorizationManager)}},M=e(n(),1),N=t(),P=globalThis,F=P.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__??(0,M.createContext)(null);P.__NEXTCLAW_PANEL_APP_HOST_CONTEXT__=F;function I({children:e,presenter:t}){let n=(0,M.useMemo)(()=>t??new j,[t]);return(0,N.jsx)(F.Provider,{value:n,children:e})}function L(){let e=(0,M.useContext)(F);if(!e)throw Error(`usePanelAppHostPresenter must be used inside PanelAppHostProvider`);return e}function R(){let e=L(),{isPending:t,mutateAsync:n}=D(),r=(0,M.useRef)(new Map);return{ensurePanelAppClientGrant:(0,M.useCallback)(async t=>{if(!t.clientDeclared||t.clientGranted)return!0;let i=r.current.get(t.appId);if(i)return await i;let a=(async()=>await e.serviceActionAuthorizationManager.requestAuthorization({panelAppId:t.appId,actions:[{actionId:`nextclaw.client`,actionTitle:d(`panelAppsClientGrantTitle`),actionDescription:d(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await n(t.appId),!0):!1)();r.current.set(t.appId,a);try{return await a}finally{r.current.delete(t.appId)}},[n,e]),isPending:t}}function z(e){let t=c(),n=(0,M.useId)(),{ensurePanelAppClientGrant:r}=R(),a=!!(e?.clientDeclared&&!e.clientGranted),s=o({queryKey:[`panel-app-client-grant`,e?.appId??`none`,e?.clientGranted??!1],queryFn:async()=>await r(e),enabled:a,gcTime:0,retry:!1,staleTime:1/0}),l=e?a?s.isError?`error`:s.isPending?`checking`:s.data?`allowed`:`denied`:`allowed`:`idle`;return o({queryKey:[`panel-app-open`,n,e?.appId??`none`],queryFn:async()=>{let n=await i.panelApps.recordPanelAppOpened(e.id);return t.setQueryData(v,e=>S(e,n)),t.setQueryData([...y,n.appId],n),n},enabled:!!(e&&l===`allowed`),retry:!1,staleTime:1/0}),{retryClientGrant:s.refetch,state:l}}var B=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function V(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function H({appId:e,restorationScope:t,unavailableAction:n}){let r=L(),i=w(e),a=(0,M.useRef)(null),o=(0,M.useMemo)(()=>i.data,[i.data]),s=z(o),c=h({currentUrl:o?.contentPath??null,iframeRef:a,isEnabled:!!o,restorationKey:o?`panel-app:${t}:${o.appId}`:null});return(0,M.useEffect)(()=>{let e=e=>{r.panelAppBridgeManager.handleIframeMessage({event:e,iframe:a.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[r]),i.isLoading?(0,N.jsx)(U,{message:d(`panelAppsLoading`)}):i.isError?(0,N.jsx)(U,{message:i.error instanceof Error?i.error.message:d(`panelAppsLoadFailed`),actionLabel:d(`panelAppsTryAgain`),onAction:()=>void i.refetch()}):o?s.state===`checking`||s.state===`idle`?(0,N.jsx)(U,{message:d(`panelAppsCheckingPermission`)}):s.state===`denied`||s.state===`error`?(0,N.jsx)(U,{message:s.state===`denied`?d(`panelAppsPermissionDenied`):d(`panelAppsPermissionFailed`),actionLabel:d(`panelAppsTryAgain`),onAction:()=>void s.retryClientGrant()}):(0,N.jsx)(`div`,{className:`h-full min-h-0 bg-background`,children:(0,N.jsx)(`iframe`,{ref:a,src:o.contentPath,title:o.title,sandbox:B,className:`block h-full w-full border-0 bg-background`,onLoad:c,onPointerOver:e=>V(e.currentTarget)},o.appId)}):(0,N.jsx)(U,{message:d(`panelAppsMainUnavailable`),actionLabel:n?.label,onAction:n?.onAction})}function U({actionLabel:e,message:t,onAction:n}){return(0,N.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background px-6 text-center`,children:(0,N.jsxs)(`div`,{className:`max-w-sm`,children:[(0,N.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:n?(0,N.jsx)(g,{className:`h-5 w-5`}):(0,N.jsx)(ee,{className:`h-5 w-5`})}),(0,N.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t}),e&&n?(0,N.jsx)(`button`,{type:`button`,className:`mt-4 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:n,children:e}):null]})})}function W({appId:e}){let t=w(e),n=(0,M.useMemo)(()=>t.data,[t.data]);return(0,M.useEffect)(()=>{let e=document.title;return document.title=`${n?.title??d(`panelAppsTitle`)} · NextClaw`,()=>{document.title=e}},[n?.title]),(0,N.jsx)(`main`,{className:`h-dvh min-h-0 w-full overflow-hidden bg-background`,children:(0,N.jsx)(H,{appId:e,restorationScope:`standalone`})})}function G(){let e=A(e=>e.pending),t=A(e=>e.resolveAuthorization);return(0,N.jsx)(m,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,N.jsxs)(ne,{className:`[&>:last-child]:hidden`,children:[(0,N.jsxs)(p,{children:[(0,N.jsxs)(re,{className:`flex items-center gap-2`,children:[(0,N.jsx)(_,{className:`h-4 w-4 text-amber-600`}),d(`serviceActionAuthorizationTitle`)]}),(0,N.jsx)(ie,{children:d(`serviceActionAuthorizationDescription`)})]}),e?(0,N.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,N.jsx)(K,{label:d(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:d(`serviceActionAuthorizationActions`)}),(0,N.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,N.jsx)(ce,{action:e},e.actionId))})]}),e.inputPreview?(0,N.jsx)(K,{label:d(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,N.jsxs)(te,{className:`gap-2 sm:gap-0`,children:[(0,N.jsx)(a,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:d(`serviceActionAuthorizationReject`)}),(0,N.jsx)(a,{type:`button`,onClick:()=>t(!0),children:d(`serviceActionAuthorizationAllow`)})]})]})})}function ce({action:e}){return(0,N.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,N.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,N.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,N.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function K({label:e,value:t}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,N.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,N.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var q=`nextclaw.ui.theme`,J=`work`,Y=[{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`island`,labelKey:`themeIsland`,appearance:`light`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],le=Y.map(({value:e})=>e),ue=Y.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function X(e){return typeof e==`string`?le.includes(e)?e:e===`leaf`?`warm`:null:null}function Z(e){return Y.find(t=>t.value===e)?.appearance??`light`}var Q=new class{constructor(){this.activeTheme=J,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return J;try{let e=X(window.localStorage.getItem(q));if(e)return e}catch{}return J},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=Z(e);document.documentElement.setAttribute(`data-theme`,e),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(q,e)}catch{}}}};function de(){return Q.initializeTheme()}function fe(){return Q.getTheme()}function pe(e){Q.setTheme(e)}function me(e){return Q.subscribeThemeChange(e)}var $=(0,M.createContext)(null);function he({children:e}){let[t,n]=(0,M.useState)(()=>de());(0,M.useEffect)(()=>me(e=>{n(e)}),[]);let r=(0,M.useCallback)(e=>{pe(e),n(fe())},[]),i=(0,M.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,N.jsx)($.Provider,{value:i,children:e})}function ge(){let e=(0,M.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{ae as _,Z as a,_ as b,W as c,V as d,R as f,D as g,O as h,ue as i,H as l,j as m,ge as n,X as o,I as p,J as r,G as s,he as t,B as u,E as v,g as x,T as y};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-UBHTdG5Q.js";import{t as i}from"./createLucideIcon-BTHK0Ot9.js";import{a,d as o,f as s,l as c,n as l,p as u,r as d,s as f,t as p}from"./dist-Bc9hOVNN.js";import{a as m,i as h,o as g,r as _,s as v,t as y}from"./dist-CEhIDAnr.js";import{t as b}from"./dist-hkVPP1th.js";var x=i(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),S=e(n(),1),C=t(),[w,T]=o(`Tooltip`,[v]),E=v(),D=`TooltipProvider`,O=700,k=`tooltip.open`,[ee,A]=w(D),j=e=>{let{__scopeTooltip:t,delayDuration:n=O,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=S.useRef(!0),s=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(ee,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:S.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};j.displayName=D;var M=`Tooltip`,[N,P]=w(M),F=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=A(M,e.__scopeTooltip),l=E(t),[u,f]=S.useState(null),m=d(),h=S.useRef(0),_=o??c.disableHoverableContent,v=s??c.delayDuration,y=S.useRef(!1),[b,x]=p({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(k))):c.onClose(),a?.(e)},caller:M}),w=S.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),T=S.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,x(!0)},[x]),D=S.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),O=S.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,x(!0),h.current=0},v)},[v,x]);return S.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,C.jsx)(g,{...l,children:(0,C.jsx)(N,{scope:t,contentId:m,open:b,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:S.useCallback(()=>{c.isOpenDelayedRef.current?O():T()},[c.isOpenDelayedRef,O,T]),onTriggerLeave:S.useCallback(()=>{_?D():(window.clearTimeout(h.current),h.current=0)},[D,_]),onOpen:T,onClose:D,disableHoverableContent:_,children:n})})};F.displayName=M;var I=`TooltipTrigger`,L=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=P(I,n),a=A(I,n),o=E(n),c=s(t,S.useRef(null),i.onTriggerChange),l=S.useRef(!1),d=S.useRef(!1),p=S.useCallback(()=>l.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,C.jsx)(_,{asChild:!0,...o,children:(0,C.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:u(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:u(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:u(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:u(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:u(e.onBlur,i.onClose),onClick:u(e.onClick,i.onClose)})})});L.displayName=I;var R=`TooltipPortal`,[z,B]=w(R,{forceMount:void 0}),V=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=P(R,t);return(0,C.jsx)(z,{scope:t,forceMount:n,children:(0,C.jsx)(b,{present:n||a.open,children:(0,C.jsx)(l,{asChild:!0,container:i,children:r})})})};V.displayName=R;var H=`TooltipContent`,U=S.forwardRef((e,t)=>{let n=B(H,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=P(H,e.__scopeTooltip);return(0,C.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(G,{side:i,...a,ref:t}):(0,C.jsx)(W,{side:i,...a,ref:t})})}),W=S.forwardRef((e,t)=>{let n=P(H,e.__scopeTooltip),r=A(H,e.__scopeTooltip),i=S.useRef(null),a=s(t,i),[o,c]=S.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=oe(r,ae(r,n.getBoundingClientRect())),a=se(t.getBoundingClientRect());c(le([...i,...a])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!ce(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,C.jsx)(G,{...e,ref:a})}),[te,ne]=w(M,{isInside:!1}),re=c(`TooltipContent`),G=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=P(H,n),u=E(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(k,d),()=>document.removeEventListener(k,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,C.jsx)(a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,C.jsxs)(m,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(re,{children:r}),(0,C.jsx)(te,{scope:n,isInside:!0,children:(0,C.jsx)(y,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});U.displayName=H;var K=`TooltipArrow`,ie=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=E(n);return ne(K,n).isInside?null:(0,C.jsx)(h,{...i,...r,ref:t})});ie.displayName=K;function ae(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function oe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function se(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ce(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function le(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ue(t)}function ue(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var q=j,J=F,Y=L,X=V,Z=U,de=q,fe=J,Q=S.forwardRef(({onFocus:e,...t},n)=>(0,C.jsx)(Y,{ref:n,onFocus:t=>{e?.(t),!t.defaultPrevented&&!t.currentTarget.matches(`:focus-visible`)&&t.preventDefault()},...t}));Q.displayName=Y.displayName;var $=S.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,C.jsx)(X,{children:(0,C.jsx)(Z,{ref:i,"data-theme-overlay":`tooltip`,sideOffset:t,className:r(`z-[var(--z-tooltip,10150)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));$.displayName=Z.displayName;export{Z as a,J as c,Q as i,Y as l,$ as n,X as o,de as r,q as s,fe as t,x as u};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{A as t,M as n,t as r}from"./utils-CBZPzC_b.js";import{t as i}from"./createLucideIcon-BNKf0_kc.js";import{a,d as o,f as s,l as c,n as l,p as u,r as d,s as f,t as p}from"./dist-BiIcnf9j.js";import{a as m,i as h,o as g,r as _,s as v,t as y}from"./dist-C5I0v8Qn.js";import{t as b}from"./dist-czPa8xFO.js";var x=i(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),S=e(n(),1),C=t(),[w,T]=o(`Tooltip`,[v]),E=v(),D=`TooltipProvider`,O=700,k=`tooltip.open`,[ee,A]=w(D),j=e=>{let{__scopeTooltip:t,delayDuration:n=O,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=S.useRef(!0),s=S.useRef(!1),c=S.useRef(0);return S.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,C.jsx)(ee,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:S.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:S.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:S.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};j.displayName=D;var M=`Tooltip`,[N,P]=w(M),F=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=A(M,e.__scopeTooltip),l=E(t),[u,f]=S.useState(null),m=d(),h=S.useRef(0),_=o??c.disableHoverableContent,v=s??c.delayDuration,y=S.useRef(!1),[b,x]=p({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(k))):c.onClose(),a?.(e)},caller:M}),w=S.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),T=S.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,x(!0)},[x]),D=S.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),O=S.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,x(!0),h.current=0},v)},[v,x]);return S.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,C.jsx)(g,{...l,children:(0,C.jsx)(N,{scope:t,contentId:m,open:b,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:S.useCallback(()=>{c.isOpenDelayedRef.current?O():T()},[c.isOpenDelayedRef,O,T]),onTriggerLeave:S.useCallback(()=>{_?D():(window.clearTimeout(h.current),h.current=0)},[D,_]),onOpen:T,onClose:D,disableHoverableContent:_,children:n})})};F.displayName=M;var I=`TooltipTrigger`,L=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=P(I,n),a=A(I,n),o=E(n),c=s(t,S.useRef(null),i.onTriggerChange),l=S.useRef(!1),d=S.useRef(!1),p=S.useCallback(()=>l.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,C.jsx)(_,{asChild:!0,...o,children:(0,C.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:u(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:u(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:u(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:u(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:u(e.onBlur,i.onClose),onClick:u(e.onClick,i.onClose)})})});L.displayName=I;var R=`TooltipPortal`,[z,B]=w(R,{forceMount:void 0}),V=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=P(R,t);return(0,C.jsx)(z,{scope:t,forceMount:n,children:(0,C.jsx)(b,{present:n||a.open,children:(0,C.jsx)(l,{asChild:!0,container:i,children:r})})})};V.displayName=R;var H=`TooltipContent`,U=S.forwardRef((e,t)=>{let n=B(H,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=P(H,e.__scopeTooltip);return(0,C.jsx)(b,{present:r||o.open,children:o.disableHoverableContent?(0,C.jsx)(G,{side:i,...a,ref:t}):(0,C.jsx)(W,{side:i,...a,ref:t})})}),W=S.forwardRef((e,t)=>{let n=P(H,e.__scopeTooltip),r=A(H,e.__scopeTooltip),i=S.useRef(null),a=s(t,i),[o,c]=S.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=S.useCallback(()=>{c(null),f(!1)},[f]),m=S.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=oe(r,ae(r,n.getBoundingClientRect())),a=se(t.getBoundingClientRect());c(le([...i,...a])),f(!0)},[f]);return S.useEffect(()=>()=>p(),[p]),S.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),S.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!ce(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,C.jsx)(G,{...e,ref:a})}),[te,ne]=w(M,{isInside:!1}),re=c(`TooltipContent`),G=S.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=P(H,n),u=E(n),{onClose:d}=l;return S.useEffect(()=>(document.addEventListener(k,d),()=>document.removeEventListener(k,d)),[d]),S.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,C.jsx)(a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,C.jsxs)(m,{"data-state":l.stateAttribute,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,C.jsx)(re,{children:r}),(0,C.jsx)(te,{scope:n,isInside:!0,children:(0,C.jsx)(y,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});U.displayName=H;var K=`TooltipArrow`,ie=S.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=E(n);return ne(K,n).isInside?null:(0,C.jsx)(h,{...i,...r,ref:t})});ie.displayName=K;function ae(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function oe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function se(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ce(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function le(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ue(t)}function ue(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var q=j,J=F,Y=L,X=V,Z=U,de=q,fe=J,Q=S.forwardRef(({onFocus:e,...t},n)=>(0,C.jsx)(Y,{ref:n,onFocus:t=>{e?.(t),!t.defaultPrevented&&!t.currentTarget.matches(`:focus-visible`)&&t.preventDefault()},...t}));Q.displayName=Y.displayName;var $=S.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,C.jsx)(X,{children:(0,C.jsx)(Z,{ref:i,"data-theme-overlay":`tooltip`,sideOffset:t,className:r(`z-[var(--z-tooltip,10150)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));$.displayName=Z.displayName;export{Z as a,J as c,Q as i,Y as l,$ as n,X as o,de as r,q as s,fe as t,x as u};
@@ -1 +1 @@
1
- import{t as e}from"./createLucideIcon-BTHK0Ot9.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
1
+ import{t as e}from"./createLucideIcon-BNKf0_kc.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
@@ -1 +1 @@
1
- import{At as e,Ct as t,Dt as n,Et as r,Ot as i,St as a,Tt as o,_t as s,at as c,bn as l,dt as u,gt as d,ht as f,jn as p,kt as m,lt as h,mt as g,ot as _,rt as v,st as y,ut as b,vn as x,vt as S,wt as C,yn as w,yt as T}from"./api-Utt-xzrT.js";import{s as E}from"./i18n-B9yXA8KO.js";function D(){return l({queryKey:[`config`],queryFn:h,staleTime:3e4,refetchOnWindowFocus:!0})}function O(){return l({queryKey:[`config-meta`],queryFn:b,staleTime:1/0})}function k(){return l({queryKey:[`product-analytics-status`],queryFn:g,staleTime:15e3,refetchOnWindowFocus:!0})}function A(){return l({queryKey:[`providers`],queryFn:s,staleTime:3e4,refetchOnWindowFocus:!0})}function j(){return l({queryKey:[`provider-templates`],queryFn:d,staleTime:1/0})}function M(e={}){return l({queryKey:[`provider-model-catalog`],queryFn:f,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function N(){return l({queryKey:[`config-schema`],queryFn:u,staleTime:1/0})}function P(){let e=p();return w({mutationFn:o,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function F(){let e=p();return w({mutationFn:({data:e})=>r(e),onSuccess:t=>{e.setQueryData([`config`],e=>e&&{...e,productAnalytics:t}),e.invalidateQueries({queryKey:[`product-analytics-status`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(`${E(`configSaveFailed`)}: ${e.message}`)}})}function I(){let e=p();return w({mutationFn:({data:e})=>m(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function L(){let e=p();return w({mutationFn:({provider:e,data:t})=>n(e,t),onSuccess:(t,n)=>{e.setQueryData([`providers`],e=>e&&{providers:{...e.providers,[n.provider]:t}}),e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function R(){let e=p();return w({mutationFn:({data:e})=>v(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function z(){let e=p();return w({mutationFn:({provider:e})=>c(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function B(){return w({mutationFn:({provider:e,data:n})=>t(e,n)})}function V(){return w({mutationFn:({provider:e,data:t})=>_(e,t)})}function H(){return w({mutationFn:({provider:e,data:t})=>a(e,t)})}function U(){return w({mutationFn:({provider:e,data:t})=>T(e,t)})}function W(){return w({mutationFn:({provider:e})=>S(e)})}function G(){let e=p();return w({mutationFn:({channel:e,data:t})=>C(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),x.success(E(`configSavedApplying`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function K(){let e=p();return w({mutationFn:({data:e})=>i(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function q(){let t=p();return w({mutationFn:({data:t})=>e(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function J(){return w({mutationFn:({actionId:e,data:t})=>y(e,t),onError:e=>{x.error(E(`error`)+`: `+e.message)}})}export{q as S,P as _,z as a,K as b,W as c,M as d,j as f,G as g,B as h,R as i,U as l,H as m,O as n,V as o,A as p,N as r,J as s,D as t,k as u,F as v,I as x,L as y};
1
+ import{At as e,Ct as t,Dt as n,Et as r,Ot as i,St as a,Tt as o,_t as s,at as c,bn as l,dt as u,gt as d,ht as f,jn as p,kt as m,lt as h,mt as g,ot as _,rt as v,st as y,ut as b,vn as x,vt as S,wt as C,yn as w,yt as T}from"./api-BnUzdltV.js";import{s as E}from"./i18n-CKvm9zyk.js";function D(){return l({queryKey:[`config`],queryFn:h,staleTime:3e4,refetchOnWindowFocus:!0})}function O(){return l({queryKey:[`config-meta`],queryFn:b,staleTime:1/0})}function k(){return l({queryKey:[`product-analytics-status`],queryFn:g,staleTime:15e3,refetchOnWindowFocus:!0})}function A(){return l({queryKey:[`providers`],queryFn:s,staleTime:3e4,refetchOnWindowFocus:!0})}function j(){return l({queryKey:[`provider-templates`],queryFn:d,staleTime:1/0})}function M(e={}){return l({queryKey:[`provider-model-catalog`],queryFn:f,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function N(){return l({queryKey:[`config-schema`],queryFn:u,staleTime:1/0})}function P(){let e=p();return w({mutationFn:o,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function F(){let e=p();return w({mutationFn:({data:e})=>r(e),onSuccess:t=>{e.setQueryData([`config`],e=>e&&{...e,productAnalytics:t}),e.invalidateQueries({queryKey:[`product-analytics-status`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(`${E(`configSaveFailed`)}: ${e.message}`)}})}function I(){let e=p();return w({mutationFn:({data:e})=>m(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function L(){let e=p();return w({mutationFn:({provider:e,data:t})=>n(e,t),onSuccess:(t,n)=>{e.setQueryData([`providers`],e=>e&&{providers:{...e.providers,[n.provider]:t}}),e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function R(){let e=p();return w({mutationFn:({data:e})=>v(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function z(){let e=p();return w({mutationFn:({provider:e})=>c(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSaved`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function B(){return w({mutationFn:({provider:e,data:n})=>t(e,n)})}function V(){return w({mutationFn:({provider:e,data:t})=>_(e,t)})}function H(){return w({mutationFn:({provider:e,data:t})=>a(e,t)})}function U(){return w({mutationFn:({provider:e,data:t})=>T(e,t)})}function W(){return w({mutationFn:({provider:e})=>S(e)})}function G(){let e=p();return w({mutationFn:({channel:e,data:t})=>C(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),x.success(E(`configSavedApplying`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function K(){let e=p();return w({mutationFn:({data:e})=>i(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function q(){let t=p();return w({mutationFn:({data:t})=>e(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),x.success(E(`configSavedApplied`))},onError:e=>{x.error(E(`configSaveFailed`)+`: `+e.message)}})}function J(){return w({mutationFn:({actionId:e,data:t})=>y(e,t),onError:e=>{x.error(E(`error`)+`: `+e.message)}})}export{q as S,P as _,z as a,K as b,W as c,M as d,j as f,G as g,B as h,R as i,U as l,H as m,O as n,V as o,A as p,N as r,J as s,D as t,k as u,F as v,I as x,L as y};
@@ -1 +1 @@
1
- import{Lt as e,bn as t,jn as n,yn as r}from"./api-Utt-xzrT.js";var i=[`feature-controls`];function a(){return t({queryKey:i,queryFn:e.featureControls.get})}var o=new class{constructor(){this.getStatus=async()=>await e.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await e.capabilityAccess.listDesktopGrants(),this.grantAccess=async t=>await e.capabilityAccess.grantDesktopAccess(t),this.requestSystemPermission=async()=>await e.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await e.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async t=>await e.capabilityAccess.revokeDesktopAccess(t)}},s=[`desktop-capability`,`status`],c=[`desktop-capability`,`grants`];function l(){return t({queryKey:s,queryFn:o.getStatus})}function u(){return d(a().data)}function d(e){return e?.desktopAutomation.available===!0}function f(){return t({queryKey:c,queryFn:o.listGrants})}function p(){let e=n();return r({mutationFn:o.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:s})}})}function m(){return r({mutationFn:o.openSystemSettings})}function h(){let e=n();return r({mutationFn:async e=>await o.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:c})}})}export{p as a,m as i,f as n,h as o,l as r,o as s,u as t};
1
+ import{Lt as e,bn as t,jn as n,yn as r}from"./api-BnUzdltV.js";var i=[`feature-controls`];function a(){return t({queryKey:i,queryFn:e.featureControls.get})}var o=new class{constructor(){this.getStatus=async()=>await e.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await e.capabilityAccess.listDesktopGrants(),this.grantAccess=async t=>await e.capabilityAccess.grantDesktopAccess(t),this.requestSystemPermission=async()=>await e.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await e.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async t=>await e.capabilityAccess.revokeDesktopAccess(t)}},s=[`desktop-capability`,`status`],c=[`desktop-capability`,`grants`];function l(){return t({queryKey:s,queryFn:o.getStatus})}function u(){return d(a().data)}function d(e){return e?.desktopAutomation.available===!0}function f(){return t({queryKey:c,queryFn:o.listGrants})}function p(){let e=n();return r({mutationFn:o.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:s})}})}function m(){return r({mutationFn:o.openSystemSettings})}function h(){let e=n();return r({mutationFn:async e=>await o.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:c})}})}export{p as a,m as i,f as n,h as o,l as r,o as s,u as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{M as t,s as n}from"./utils-UBHTdG5Q.js";function r(e){return e.index>0&&e.entries.length>0}function i(e){return e.index>=0&&e.index<e.entries.length-1}function a(e,t,n=Object.is){let r=c(e),i=e.entries[r];if(i&&n(i,t))return{entries:e.entries,index:r};let a=[...e.entries.slice(0,r+1),t];return{entries:a,index:a.length-1}}function o(e,t){let n=c(e),r=t===`back`?n-1:n+1,i=e.entries[r];return i?{history:{entries:e.entries,index:r},entry:i}:null}function s(e,t,n){let r=c(e),i=e.entries.filter(t);if(i.length===0)return n===void 0?{entries:[],index:0}:{entries:[n],index:0};let a=e.entries.slice(0,r+1).filter(t);return{entries:i,index:Math.min(Math.max(0,a.length-1),i.length-1)}}function c(e){return e.entries.length===0?0:Number.isInteger(e.index)?Math.min(Math.max(0,e.index),e.entries.length-1):e.entries.length-1}var l=200;function u(e){return Number.isFinite(e)?Math.max(0,e):0}function d(e){return e.trim()||null}var f=new class{constructor(e=l){this.capacity=e,this.positions=new Map}save(e,t){let n=d(e);if(n)for(this.positions.delete(n),this.positions.set(n,{x:u(t.x),y:u(t.y),...t.payload===void 0?{}:{payload:t.payload}});this.positions.size>this.capacity;){let e=this.positions.keys().next().value;if(!e)return;this.positions.delete(e)}}read(e){let t=d(e);if(!t)return null;let n=this.positions.get(t);return n?{...n}:null}delete(e){let t=d(e);t&&this.positions.delete(t)}clear(){this.positions.clear()}},p=e(t(),1);function m(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`document`?!0:t.kind===`element`&&Array.isArray(t.path)&&t.path.length>0&&t.path.length<=30&&t.path.every(e=>typeof e?.index==`number`&&Number.isInteger(e.index)&&e.index>=0&&e.index<=1e3&&typeof e.tagName==`string`&&e.tagName.length>0&&e.tagName.length<=32)}function h(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.currentUrl==`string`&&m(t.target)}function g(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===n.scrollMessageType&&t.version===n.version&&m(t.target)&&typeof t.x==`number`&&Number.isFinite(t.x)&&t.x>=0&&typeof t.y==`number`&&Number.isFinite(t.y)&&t.y>=0}function _({currentUrl:e,iframeRef:t,isEnabled:r,restorationKey:i}){return(0,p.useEffect)(()=>{if(!e||!r||!i)return;let n=n=>{n.source!==t.current?.contentWindow||!g(n.data)||f.save(i,{x:n.data.x,y:n.data.y,payload:{currentUrl:e,target:n.data.target}})};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)},[e,t,r,i]),(0,p.useCallback)(()=>{if(!e||!r||!i)return;let a=f.read(i);!a||!h(a.payload)||a.payload.currentUrl!==e||t.current?.contentWindow?.postMessage({type:n.restoreScrollMessageType,version:n.version,target:a.payload.target,x:a.x,y:a.y},`*`)},[e,t,r,i])}export{s as a,i,f as n,a as o,r,o as s,_ as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{M as t,s as n}from"./utils-CBZPzC_b.js";function r(e){return e.index>0&&e.entries.length>0}function i(e){return e.index>=0&&e.index<e.entries.length-1}function a(e,t,n=Object.is){let r=c(e),i=e.entries[r];if(i&&n(i,t))return{entries:e.entries,index:r};let a=[...e.entries.slice(0,r+1),t];return{entries:a,index:a.length-1}}function o(e,t){let n=c(e),r=t===`back`?n-1:n+1,i=e.entries[r];return i?{history:{entries:e.entries,index:r},entry:i}:null}function s(e,t,n){let r=c(e),i=e.entries.filter(t);if(i.length===0)return n===void 0?{entries:[],index:0}:{entries:[n],index:0};let a=e.entries.slice(0,r+1).filter(t);return{entries:i,index:Math.min(Math.max(0,a.length-1),i.length-1)}}function c(e){return e.entries.length===0?0:Number.isInteger(e.index)?Math.min(Math.max(0,e.index),e.entries.length-1):e.entries.length-1}var l=200;function u(e){return Number.isFinite(e)?Math.max(0,e):0}function d(e){return e.trim()||null}var f=new class{constructor(e=l){this.capacity=e,this.positions=new Map}save(e,t){let n=d(e);if(n)for(this.positions.delete(n),this.positions.set(n,{x:u(t.x),y:u(t.y),...t.payload===void 0?{}:{payload:t.payload}});this.positions.size>this.capacity;){let e=this.positions.keys().next().value;if(!e)return;this.positions.delete(e)}}read(e){let t=d(e);if(!t)return null;let n=this.positions.get(t);return n?{...n}:null}delete(e){let t=d(e);t&&this.positions.delete(t)}clear(){this.positions.clear()}},p=e(t(),1);function m(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`document`?!0:t.kind===`element`&&Array.isArray(t.path)&&t.path.length>0&&t.path.length<=30&&t.path.every(e=>typeof e?.index==`number`&&Number.isInteger(e.index)&&e.index>=0&&e.index<=1e3&&typeof e.tagName==`string`&&e.tagName.length>0&&e.tagName.length<=32)}function h(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.currentUrl==`string`&&m(t.target)}function g(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.type===n.scrollMessageType&&t.version===n.version&&m(t.target)&&typeof t.x==`number`&&Number.isFinite(t.x)&&t.x>=0&&typeof t.y==`number`&&Number.isFinite(t.y)&&t.y>=0}function _({currentUrl:e,iframeRef:t,isEnabled:r,restorationKey:i}){return(0,p.useEffect)(()=>{if(!e||!r||!i)return;let n=n=>{n.source!==t.current?.contentWindow||!g(n.data)||f.save(i,{x:n.data.x,y:n.data.y,payload:{currentUrl:e,target:n.data.target}})};return window.addEventListener(`message`,n),()=>window.removeEventListener(`message`,n)},[e,t,r,i]),(0,p.useCallback)(()=>{if(!e||!r||!i)return;let a=f.read(i);!a||!h(a.payload)||a.payload.currentUrl!==e||t.current?.contentWindow?.postMessage({type:n.restoreScrollMessageType,version:n.version,target:a.payload.target,x:a.x,y:a.y},`*`)},[e,t,r,i])}export{s as a,i,f as n,a as o,r,o as s,_ as t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DF37yw5_.js";import{M as t,i as n}from"./utils-UBHTdG5Q.js";import{t as r}from"./createLucideIcon-BTHK0Ot9.js";import{n as i,t as a}from"./middleware-0o3JF3tS.js";var o=r(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),s=`nextclaw.app.viewport-layout`,c=1;function l(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function u(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:l(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function d(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var f=n()(i(()=>u(),{name:s,version:c,storage:a(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=d(e,`isSidebarCollapsed`),r=d(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),p=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>f.getState(),this.setSidebarCollapsed=e=>{f.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{f.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{f.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{f.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),f.setState(u())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;f.setState({width:e,mode:l(e)})}}},m=e(t(),1);function h(){return(0,m.useEffect)(()=>p.attach(),[]),{isMobile:f(e=>e.mode)===`mobile`}}export{o as i,p as n,f as r,h as t};
1
+ import{i as e}from"./chunk-DF37yw5_.js";import{M as t,i as n}from"./utils-CBZPzC_b.js";import{t as r}from"./createLucideIcon-BNKf0_kc.js";import{n as i,t as a}from"./middleware-0o3JF3tS.js";var o=r(`KeyRound`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),s=`nextclaw.app.viewport-layout`,c=1;function l(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function u(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:l(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function d(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var f=n()(i(()=>u(),{name:s,version:c,storage:a(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=d(e,`isSidebarCollapsed`),r=d(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),p=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>f.getState(),this.setSidebarCollapsed=e=>{f.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{f.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{f.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{f.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),f.setState(u())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;f.setState({width:e,mode:l(e)})}}},m=e(t(),1);function h(){return(0,m.useEffect)(()=>p.attach(),[]),{isMobile:f(e=>e.mode)===`mobile`}}export{o as i,p as n,f as r,h as t};