pisper 0.5.2-linux-x64.0 → 0.5.2

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 (295) hide show
  1. package/README.en.md +224 -0
  2. package/README.md +78 -78
  3. package/bin/pisper.mjs +48 -0
  4. package/lib/install.mjs +392 -0
  5. package/lib/npm-platform.mjs +41 -0
  6. package/lib/npm-update.mjs +165 -0
  7. package/lib/platform.mjs +43 -0
  8. package/lib/postinstall.mjs +3 -0
  9. package/package.json +36 -14
  10. package/updater.pubkey +1 -0
  11. package/web/.vite/manifest.json +2326 -0
  12. package/web/assets/AnimatedContent-BiVNqD3m.js +1 -0
  13. package/web/assets/AnimatedList-D6P3Wwa6.js +1 -0
  14. package/web/assets/AppOverlays-DtsDAFVk.js +1 -0
  15. package/web/assets/AppSelect--dqy70Zh.js +1 -0
  16. package/web/assets/AssetsPage-CqikJ7bd.js +1 -0
  17. package/web/assets/ChannelsPage-4KQV1Uuw.js +1 -0
  18. package/web/assets/ChatHistoryPage-Soc6C0DX.js +1 -0
  19. package/web/assets/ChatPage-CKoD08Hs.js +8 -0
  20. package/web/assets/ClickSpark-BxLJ1PyT.js +1 -0
  21. package/web/assets/ConfigPage-DbeH-0Vq.js +1 -0
  22. package/web/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  23. package/web/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  24. package/web/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  25. package/web/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  26. package/web/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  27. package/web/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  28. package/web/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  29. package/web/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  30. package/web/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  31. package/web/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  32. package/web/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  33. package/web/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  34. package/web/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  35. package/web/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  36. package/web/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  37. package/web/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  38. package/web/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  39. package/web/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  40. package/web/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  41. package/web/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  42. package/web/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  43. package/web/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  44. package/web/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  45. package/web/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  46. package/web/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  47. package/web/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  48. package/web/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  49. package/web/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  50. package/web/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  51. package/web/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  52. package/web/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  53. package/web/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  54. package/web/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  55. package/web/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  56. package/web/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  57. package/web/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  58. package/web/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  59. package/web/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  60. package/web/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  61. package/web/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  62. package/web/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  63. package/web/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  64. package/web/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  65. package/web/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  66. package/web/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  67. package/web/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  68. package/web/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  69. package/web/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  70. package/web/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  71. package/web/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  72. package/web/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  73. package/web/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  74. package/web/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  75. package/web/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  76. package/web/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  77. package/web/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  78. package/web/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  79. package/web/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  80. package/web/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  81. package/web/assets/MarkdownMessage-CLXr6tR2.js +1 -0
  82. package/web/assets/MemoryPage-C65Ml0Kk.js +1 -0
  83. package/web/assets/PageHeader-wYQsaIzH.js +1 -0
  84. package/web/assets/PluginsPage-WDW-MP0Z.js +1 -0
  85. package/web/assets/PreviewPages-BaBPZCa-.js +1 -0
  86. package/web/assets/SchedulesPage-DD0E7pbR.js +1 -0
  87. package/web/assets/ShinyText-K2BPzduJ.js +1 -0
  88. package/web/assets/SkillsPage-BMIKSMzv.js +1 -0
  89. package/web/assets/StarOrbit-BlI6MhVr.js +1 -0
  90. package/web/assets/TerminalPanel-BXLOd4AI.js +18 -0
  91. package/web/assets/TerminalPanel-BrP-ENHg.css +1 -0
  92. package/web/assets/Threads-CS40baGh.js +1 -0
  93. package/web/assets/WelcomeEffects-Cqgskdga.js +1 -0
  94. package/web/assets/WorkflowsPage-CSuSRaeP.js +1 -0
  95. package/web/assets/alert-B7D8joCd.js +1 -0
  96. package/web/assets/andromeeda-vGVdxbeo.js +1 -0
  97. package/web/assets/angular-html-17rlCfBS.js +1 -0
  98. package/web/assets/angular-ts-it3MaXWH.js +1 -0
  99. package/web/assets/app-primitives-B_kzSTuJ.js +1 -0
  100. package/web/assets/astro-BEVDzCov.js +1 -0
  101. package/web/assets/aurora-x-CDeNXAV0.js +1 -0
  102. package/web/assets/ayu-dark-DluEY0Gj.js +1 -0
  103. package/web/assets/ayu-light-C3h-C4tm.js +1 -0
  104. package/web/assets/ayu-mirage-Bqwy1Gya.js +1 -0
  105. package/web/assets/badge-BNonIEif.js +1 -0
  106. package/web/assets/blade-B3yUZIOx.js +1 -0
  107. package/web/assets/brand-CFOXmGdd.js +1 -0
  108. package/web/assets/c-aGSZMVdM.js +1 -0
  109. package/web/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
  110. package/web/assets/catppuccin-latte-CtsyrtPq.js +1 -0
  111. package/web/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
  112. package/web/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
  113. package/web/assets/chevron-down-DybEa6xm.js +1 -0
  114. package/web/assets/circle-dot-BdcN0YM6.js +1 -0
  115. package/web/assets/code-block-2QN4kmKi.js +1 -0
  116. package/web/assets/coffee-ouOQ86EC.js +1 -0
  117. package/web/assets/copy-O4BLU533.js +1 -0
  118. package/web/assets/cpp-Bm3vm43L.js +1 -0
  119. package/web/assets/createLucideIcon-BEEvpXLl.js +1 -0
  120. package/web/assets/css-CWcS1xXm.js +1 -0
  121. package/web/assets/csv-Dx-8-gkx.js +1 -0
  122. package/web/assets/dark-plus-Cs2F2srj.js +1 -0
  123. package/web/assets/dist-24sBsNk3.js +1 -0
  124. package/web/assets/dist-B2WU7fS_.js +1 -0
  125. package/web/assets/dist-BkftCMO2.js +1 -0
  126. package/web/assets/dist-BmM8XOsV.js +1 -0
  127. package/web/assets/dracula-BHWKrbxM.js +1 -0
  128. package/web/assets/dracula-soft-5eyTD99u.js +1 -0
  129. package/web/assets/es2015-D3OlFTmJ.js +41 -0
  130. package/web/assets/everforest-dark-sB-x3p7T.js +1 -0
  131. package/web/assets/everforest-light-Df2xbC6M.js +1 -0
  132. package/web/assets/eye-BMzzoABY.js +1 -0
  133. package/web/assets/file-CvhJitS9.js +1 -0
  134. package/web/assets/file-code-corner-lCJOIDbw.js +1 -0
  135. package/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  136. package/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  137. package/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  138. package/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  139. package/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  140. package/web/assets/github-dark-C-LZuMrd.js +1 -0
  141. package/web/assets/github-dark-default-DXG-b-1a.js +1 -0
  142. package/web/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
  143. package/web/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
  144. package/web/assets/github-light-EUqPIrTm.js +1 -0
  145. package/web/assets/github-light-default-BXViO-2h.js +1 -0
  146. package/web/assets/github-light-high-contrast-B68TUdTA.js +1 -0
  147. package/web/assets/glsl-TOBAB6bO.js +1 -0
  148. package/web/assets/graphql-BEmIBNve.js +1 -0
  149. package/web/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
  150. package/web/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
  151. package/web/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
  152. package/web/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
  153. package/web/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
  154. package/web/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
  155. package/web/assets/haml-CDWtFtU9.js +1 -0
  156. package/web/assets/handlebars-BNtjo3pL.js +1 -0
  157. package/web/assets/horizon-CE9ld1lL.js +1 -0
  158. package/web/assets/horizon-bright-DSNQnXHK.js +1 -0
  159. package/web/assets/houston-CsvMBhTu.js +1 -0
  160. package/web/assets/html-BVyvp26C.js +1 -0
  161. package/web/assets/html-derivative-BseLpURQ.js +1 -0
  162. package/web/assets/http-CkCfSMV9.js +1 -0
  163. package/web/assets/hurl-syYMt6Rn.js +1 -0
  164. package/web/assets/image-M6XRBbhu.js +1 -0
  165. package/web/assets/imba-DsUTQ-LC.js +1 -0
  166. package/web/assets/index-DoRSkbHW.js +6 -0
  167. package/web/assets/index-DpxwLREi.css +2 -0
  168. package/web/assets/java-duG_UTKe.js +1 -0
  169. package/web/assets/javascript-DWVbOe4X.js +1 -0
  170. package/web/assets/jinja-Boj4niAz.js +1 -0
  171. package/web/assets/jison-CHwnC1Pv.js +1 -0
  172. package/web/assets/json-qhed-kSA.js +1 -0
  173. package/web/assets/json5-BR5RXkoi.js +1 -0
  174. package/web/assets/jsonc-CYpm1nAK.js +1 -0
  175. package/web/assets/jsonl-CmCQp5Yx.js +1 -0
  176. package/web/assets/jsx-fcCEM_-L.js +1 -0
  177. package/web/assets/julia-VoF7UKfw.js +1 -0
  178. package/web/assets/kanagawa-dragon-Bozd7klA.js +1 -0
  179. package/web/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
  180. package/web/assets/kanagawa-wave-BML5mF2J.js +1 -0
  181. package/web/assets/laserwave-C_8bwKvT.js +1 -0
  182. package/web/assets/less-DVTAwKKz.js +1 -0
  183. package/web/assets/light-plus-DVQuIRkW.js +1 -0
  184. package/web/assets/link-2-Dd2E7M_B.js +1 -0
  185. package/web/assets/markdown-BYOwaDjH.js +1 -0
  186. package/web/assets/marko-Cupn1xhw.js +1 -0
  187. package/web/assets/material-theme-Bm3Qr25_.js +1 -0
  188. package/web/assets/material-theme-darker-2IIEA8gg.js +1 -0
  189. package/web/assets/material-theme-lighter-uhdI0v04.js +1 -0
  190. package/web/assets/material-theme-ocean-CHQ94UKr.js +1 -0
  191. package/web/assets/material-theme-palenight-B5W6OYN7.js +1 -0
  192. package/web/assets/mdc-4FfK5iWR.js +1 -0
  193. package/web/assets/mdx-DQZ5AkYe.js +1 -0
  194. package/web/assets/message-circle-Bi-lz-6t.js +1 -0
  195. package/web/assets/min-dark-BSWPekZh.js +1 -0
  196. package/web/assets/min-light-DDpmG2fV.js +1 -0
  197. package/web/assets/monokai-B_bV9PQ9.js +1 -0
  198. package/web/assets/network-UhG-ym-z.js +1 -0
  199. package/web/assets/night-owl-DhmEMT88.js +1 -0
  200. package/web/assets/night-owl-light-eJ-hLW7d.js +1 -0
  201. package/web/assets/nord-Cb4Vim4T.js +1 -0
  202. package/web/assets/one-dark-pro-CLwyXe_n.js +1 -0
  203. package/web/assets/one-light-D7Lr4KcI.js +1 -0
  204. package/web/assets/panel-top-BnVDkV60.js +1 -0
  205. package/web/assets/paperclip-D7mny7G8.js +1 -0
  206. package/web/assets/pencil-DpO4AUNy.js +1 -0
  207. package/web/assets/php-CUREQQ7f.js +1 -0
  208. package/web/assets/pick-system-directory-DiLmN6UZ.js +1 -0
  209. package/web/assets/plastic-DQwYfKfQ.js +1 -0
  210. package/web/assets/play-3QiwbcM7.js +1 -0
  211. package/web/assets/plus-CI2ql0x4.js +1 -0
  212. package/web/assets/poimandres-DRFjx7u4.js +1 -0
  213. package/web/assets/postcss-BXeXVLqQ.js +1 -0
  214. package/web/assets/progress-Byd1ZX3L.js +6 -0
  215. package/web/assets/pug-CQyGKZpv.js +1 -0
  216. package/web/assets/python-gzcpVVnB.js +1 -0
  217. package/web/assets/r-C5FwQflr.js +1 -0
  218. package/web/assets/react-bits-BFnYwuxx.css +1 -0
  219. package/web/assets/red-DX1BQOs8.js +1 -0
  220. package/web/assets/regexp--aR2_iz7.js +1 -0
  221. package/web/assets/rolldown-runtime-B0Z9INg1.js +1 -0
  222. package/web/assets/rose-pine-aMsaMD1D.js +1 -0
  223. package/web/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
  224. package/web/assets/rose-pine-moon-DO-qXg-I.js +1 -0
  225. package/web/assets/sass-DXrisJhu.js +1 -0
  226. package/web/assets/save-D--1z1bw.js +1 -0
  227. package/web/assets/scss-Davl4E3T.js +1 -0
  228. package/web/assets/search-CVBbTPAG.js +1 -0
  229. package/web/assets/shellscript-CLZ0U2zV.js +1 -0
  230. package/web/assets/shield-check-mwXhKsZm.js +1 -0
  231. package/web/assets/slack-dark-DnToyrRv.js +1 -0
  232. package/web/assets/slack-ochin-B2OO5cIa.js +1 -0
  233. package/web/assets/smithy-Dgaz7aur.js +1 -0
  234. package/web/assets/snazzy-light-4G7pJPwS.js +1 -0
  235. package/web/assets/solarized-dark-UdsmMDCL.js +1 -0
  236. package/web/assets/solarized-light-C1IUL_tW.js +1 -0
  237. package/web/assets/sql-b92rrcVl.js +1 -0
  238. package/web/assets/square-C7qN58NE.js +1 -0
  239. package/web/assets/square-terminal-C9TjK-fA.js +1 -0
  240. package/web/assets/storage-BbqIMx9Y.js +1 -0
  241. package/web/assets/stylus-B6D30XZt.js +1 -0
  242. package/web/assets/svelte-BfstjgUc.js +1 -0
  243. package/web/assets/switch-CDwl5ZJs.js +1 -0
  244. package/web/assets/synthwave-84-nFMaYfgc.js +1 -0
  245. package/web/assets/tabs-Bz7CDa49.js +1 -0
  246. package/web/assets/terminal-ClxNGVIF.js +1 -0
  247. package/web/assets/terminal-W3Nzf7fR.js +2 -0
  248. package/web/assets/tokyo-night-oM2G3aXe.js +1 -0
  249. package/web/assets/trash-2-CATziWCd.js +1 -0
  250. package/web/assets/ts-tags-Cckpt1jI.js +1 -0
  251. package/web/assets/tsx-JMDX3aQ7.js +1 -0
  252. package/web/assets/typescript-BAz-bF8J.js +1 -0
  253. package/web/assets/use-i18n-CubNtfu7.js +1 -0
  254. package/web/assets/usePagePrimaryAction-Bw0OFTDZ.js +1 -0
  255. package/web/assets/utils-C8uzG5AZ.js +1 -0
  256. package/web/assets/vendor-dockview-D5adAaCg.css +1 -0
  257. package/web/assets/vendor-dockview-yY5mBM3U.js +1 -0
  258. package/web/assets/vendor-markdown-lQaMEIxc.js +130 -0
  259. package/web/assets/vendor-markdown-plugins-ERG5SnGL.js +263 -0
  260. package/web/assets/vendor-motion-XxgxfZSY.js +9 -0
  261. package/web/assets/vendor-react-CHuvPdJE.js +9 -0
  262. package/web/assets/vendor-router-Bw2aAdMs.js +4 -0
  263. package/web/assets/vendor-shiki-runtime-DFSfH2tH.js +153 -0
  264. package/web/assets/vendor-state-DE1O_s6m.js +1 -0
  265. package/web/assets/vendor-ui-DvrYggeS.js +1 -0
  266. package/web/assets/vendor-xyflow-CnjXtcyK.js +7 -0
  267. package/web/assets/vendor-xyflow-DLioOiRN.css +1 -0
  268. package/web/assets/vesper-DdrHHSXu.js +1 -0
  269. package/web/assets/vitesse-black-fwtXNY1n.js +1 -0
  270. package/web/assets/vitesse-dark-BZCL-v6S.js +1 -0
  271. package/web/assets/vitesse-light-VbXTXTou.js +1 -0
  272. package/web/assets/vue-3H7P6ncC.js +1 -0
  273. package/web/assets/vue-html-DZGW9MGR.js +1 -0
  274. package/web/assets/vue-vine-BECt67gq.js +1 -0
  275. package/web/assets/wasm-BnjxR4X6.js +1 -0
  276. package/web/assets/wasm-ByWQv1Qj.js +1 -0
  277. package/web/assets/wgsl-BsKzXJz4.js +1 -0
  278. package/web/assets/wit-DdvCle-K.js +1 -0
  279. package/web/assets/wrench-BaMct6KV.js +1 -0
  280. package/web/assets/xml-CNfvW5JP.js +1 -0
  281. package/web/assets/yaml-rwi0_p6S.js +1 -0
  282. package/web/assets/zap-Ch1TQ5QU.js +1 -0
  283. package/web/favicon.svg +25 -0
  284. package/web/icons.svg +24 -0
  285. package/web/index.html +57 -0
  286. package/web/memory-galaxy-background.webp +0 -0
  287. package/web/notification-sw.js +13 -0
  288. package/web/release-notes.json +5 -0
  289. package/web/tauri-pet.css +117 -0
  290. package/web/tauri-pet.html +16 -0
  291. package/web/tauri-pet.js +117 -0
  292. package/components/runtime/Pisper_Runtime_Node_0.5.2_linux_x86_64.tar.gz +0 -0
  293. package/components/runtime/Pisper_Runtime_Node_0.5.2_linux_x86_64.tar.gz.sig +0 -1
  294. package/components/tui/Pisper_TUI_Component_0.5.2_linux_x86_64.tar.gz +0 -0
  295. package/components/tui/Pisper_TUI_Component_0.5.2_linux_x86_64.tar.gz.sig +0 -1
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{i as r}from"./dist-BmM8XOsV.js";import{f as i,m as a,p as o,r as s,s as c,t as l,u}from"./use-i18n-CubNtfu7.js";import{i as d}from"./tabs-Bz7CDa49.js";import{t as f}from"./dist-BkftCMO2.js";import{i as p,n as m,r as h,t as g}from"./AppSelect--dqy70Zh.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as v}from"./storage-BbqIMx9Y.js";import{t as y}from"./createLucideIcon-BEEvpXLl.js";import{n as b,r as x,t as S}from"./MarkdownMessage-CLXr6tR2.js";import{t as C}from"./chevron-down-DybEa6xm.js";import{n as w,t as T}from"./network-UhG-ym-z.js";import{t as E}from"./plus-CI2ql0x4.js";import{t as D}from"./save-D--1z1bw.js";import{t as O}from"./search-CVBbTPAG.js";import{t as k}from"./shield-check-mwXhKsZm.js";import{t as ee}from"./square-terminal-C9TjK-fA.js";import{t as A}from"./terminal-ClxNGVIF.js";import{t as j}from"./trash-2-CATziWCd.js";import{t as M}from"./wrench-BaMct6KV.js";import{t as N}from"./zap-Ch1TQ5QU.js";import{G as te,J as P,X as ne,Y as re,Z as F,a as ie,b as I,ct as L,i as ae,it as oe,mt as se,n as ce,nt as R,ot as le,q as z,r as ue,rt as de,st as fe,t as pe}from"./index-DoRSkbHW.js";import{a as me,n as he,r as ge,t as _e}from"./app-primitives-B_kzSTuJ.js";import{t as ve}from"./usePagePrimaryAction-Bw0OFTDZ.js";import{n as ye}from"./brand-CFOXmGdd.js";var B=e(t(),1),V=n(),be=Object.defineProperty,H=(e,t)=>be(e,`name`,{value:t,configurable:!0}),xe=[`PageUp`,`PageDown`],Se=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Ce={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageDown`,`ArrowUp`,`ArrowLeft`]},U=`Slider`,[we,Te,Ee]=se(U),[De,Oe]=o(U,[Ee]),[ke,W]=De(U),Ae=B.forwardRef(H(function(e,t){let{name:n,min:a=0,max:o=100,step:s=1,orientation:c=`horizontal`,disabled:l=!1,minStepsBetweenThumbs:d=0,defaultValue:f=[a],value:p,onValueChange:m=H(()=>{},`onValueChange`),onValueCommit:g=H(()=>{},`onValueCommit`),inverted:_=!1,form:v,...y}=e,b=B.useRef(new Set),x=B.useRef(0),S=B.useRef(!1),C=c===`horizontal`?Ne:Pe,[w,T]=B.useState(null),E=r(t,T),[D=[],O]=u({prop:p,defaultProp:f,onChange:H(e=>{[...b.current][x.current]?.focus({preventScroll:!0,focusVisible:S.current}),S.current=!1,m(e)},`onChange`)}),k=B.useRef(D),ee=B.useRef(D);B.useEffect(()=>{let e=v?w?.ownerDocument.getElementById(v):w?.closest(`form`);if(e instanceof HTMLFormElement){let t=H(()=>O(ee.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[w,v,O]);function A(e){N(e,Qe(D,e))}H(A,`handleSlideStart`);function j(e){N(e,x.current)}H(j,`handleSlideMove`);function M(){String(D)!==String(k.current)&&g(D)}H(M,`handleSlideEnd`);function N(e,t,{commit:n}={commit:!1}){let r=rt(s),i=G(Math.round((e-a)/s)*s+a,r),c=h(i,[a,o]);O((e=[])=>{let r=Ye(e,c,t);if(tt(r,d*s)){x.current=r.indexOf(c);let t=String(r)!==String(e);return t&&n&&g(r),t?r:e}return e})}return H(N,`updateValues`),(0,V.jsx)(ke,{scope:e.__scopeSlider,name:n,disabled:l,min:a,max:o,valueIndexToChangeRef:x,thumbs:b.current,values:D,orientation:c,form:v,children:(0,V.jsx)(we.Provider,{scope:e.__scopeSlider,children:(0,V.jsx)(we.Slot,{scope:e.__scopeSlider,children:(0,V.jsx)(C,{"aria-disabled":l,"data-disabled":l?``:void 0,...y,ref:E,onPointerDown:i(y.onPointerDown,()=>{l||(k.current=D,S.current=!1)}),min:a,max:o,inverted:_,onSlideStart:l?void 0:A,onSlideMove:l?void 0:j,onSlideEnd:l?void 0:M,onHomeKeyDown:()=>{l||(S.current=!0,N(a,0,{commit:!0}))},onEndKeyDown:()=>{l||(S.current=!0,N(o,D.length-1,{commit:!0}))},onStepKeyDown:({event:e,direction:t})=>{if(!l){S.current=!0;let n=xe.includes(e.key)||e.shiftKey&&Se.includes(e.key)?10:1,r=x.current,i=D[r];N(it(i,{min:a,step:s,direction:t,multiplier:n}),r,{commit:!0})}}})})})})},`Slider`)),[je,Me]=De(U,{startEdge:`left`,endEdge:`right`,size:`width`,direction:1}),Ne=B.forwardRef(H(function(e,t){let{min:n,max:i,dir:a,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...f}=e,[p,m]=B.useState(null),h=r(t,m),g=B.useRef(void 0),_=d(a),v=_===`ltr`,y=v&&!o||!v&&o;function b(e){let t=g.current||p.getBoundingClientRect(),r=nt([0,t.width],y?[n,i]:[i,n]);return g.current=t,r(e-t.left)}return H(b,`getValueFromPointer`),(0,V.jsx)(je,{scope:e.__scopeSlider,startEdge:y?`left`:`right`,endEdge:y?`right`:`left`,direction:y?1:-1,size:`width`,children:(0,V.jsx)(Fe,{dir:_,"data-orientation":`horizontal`,...f,ref:h,style:{...f.style,"--radix-slider-thumb-transform":`translateX(-50%)`},onSlideStart:e=>{let t=b(e.clientX);s?.(t)},onSlideMove:e=>{let t=b(e.clientX);c?.(t)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:e=>{let t=Ce[y?`from-left`:`from-right`].includes(e.key);u?.({event:e,direction:t?-1:1})}})})},`SliderHorizontal`)),Pe=B.forwardRef(H(function(e,t){let{min:n,max:i,inverted:a,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=e,d=B.useRef(null),f=r(t,d),p=B.useRef(void 0),m=!a;function h(e){let t=p.current||d.current.getBoundingClientRect(),r=nt([0,t.height],m?[i,n]:[n,i]);return p.current=t,r(e-t.top)}return H(h,`getValueFromPointer`),(0,V.jsx)(je,{scope:e.__scopeSlider,startEdge:m?`bottom`:`top`,endEdge:m?`top`:`bottom`,size:`height`,direction:m?1:-1,children:(0,V.jsx)(Fe,{"data-orientation":`vertical`,...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":`translateY(50%)`},onSlideStart:e=>{let t=h(e.clientY);o?.(t)},onSlideMove:e=>{let t=h(e.clientY);s?.(t)},onSlideEnd:()=>{p.current=void 0,c?.()},onStepKeyDown:e=>{let t=Ce[m?`from-bottom`:`from-top`].includes(e.key);l?.({event:e,direction:t?-1:1})}})})},`SliderVertical`)),Fe=B.forwardRef(H(function(e,t){let{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:s,onHomeKeyDown:c,onEndKeyDown:l,onStepKeyDown:u,...d}=e,f=W(U,n);return(0,V.jsx)(a.span,{...d,ref:t,onKeyDown:i(e.onKeyDown,e=>{e.key===`Home`?(c(e),e.preventDefault()):e.key===`End`?(l(e),e.preventDefault()):xe.concat(Se).includes(e.key)&&(u(e),e.preventDefault())}),onPointerDown:i(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),f.thumbs.has(t)?t.focus({preventScroll:!0,focusVisible:!1}):r(e)}),onPointerMove:i(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&o(e)}),onPointerUp:i(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),s(e))})})},`SliderImpl`)),Ie=`SliderTrack`,Le=B.forwardRef(H(function(e,t){let{__scopeSlider:n,...r}=e,i=W(Ie,n);return(0,V.jsx)(a.span,{"data-disabled":i.disabled?``:void 0,"data-orientation":i.orientation,...r,ref:t})},`SliderTrack`)),Re=`SliderRange`,ze=B.forwardRef(H(function(e,t){let{__scopeSlider:n,...i}=e,o=W(Re,n),s=Me(Re,n),c=B.useRef(null),l=r(t,c),u=o.values.length,d=o.values.map(e=>Xe(e,o.min,o.max)),f=u>1?Math.min(...d):0,p=100-Math.max(...d);return(0,V.jsx)(a.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?``:void 0,...i,ref:l,style:{...e.style,[s.startEdge]:f+`%`,[s.endEdge]:p+`%`}})},`SliderRange`)),[Be,Ve]=De(`SliderThumb`),He=`SliderThumbProvider`;function Ue(e){let{__scopeSlider:t,name:n,children:r,internal_do_not_use_render:i}=e,a=W(He,t),o=Te(t),[s,c]=B.useState(null),l=B.useMemo(()=>s?o().findIndex(e=>e.ref.current===s):-1,[o,s]),u=f(s),d=!s||!!a.form||!!s.closest(`form`),p=a.values[l],m=n??(a.name?a.name+(a.values.length>1?`[]`:``):void 0),h=p===void 0?0:Xe(p,a.min,a.max);B.useEffect(()=>{if(s)return a.thumbs.add(s),()=>{a.thumbs.delete(s)}},[s,a.thumbs]);let g={value:p,name:m,form:a.form,isFormControl:d,index:l,thumb:s,onThumbChange:c,percent:h,size:u};return(0,V.jsx)(Be,{scope:t,...g,children:at(i)?i(g):r})}H(Ue,`SliderThumbProvider`);var We=`SliderThumbTrigger`,Ge=B.forwardRef(H(function(e,t){let{__scopeSlider:n,...o}=e,s=W(We,n),c=Me(We,n),{index:l,value:u,percent:d,size:f,onThumbChange:p}=Ve(We,n),m=r(t,p),h=Ze(l,s.values.length),g=f?.[c.size],_=g?$e(g,d,c.direction):0;return(0,V.jsx)(`span`,{style:{transform:`var(--radix-slider-thumb-transform)`,position:`absolute`,[c.startEdge]:`calc(${d}% + ${_}px)`},children:(0,V.jsx)(we.ItemSlot,{scope:n,children:(0,V.jsx)(a.span,{role:`slider`,"aria-label":e[`aria-label`]||h,"aria-valuemin":s.min,"aria-valuenow":u,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?``:void 0,tabIndex:s.disabled?void 0:0,...o,ref:m,style:u===void 0?{display:`none`}:e.style,onFocus:i(e.onFocus,()=>{s.valueIndexToChangeRef.current=l})})})})},`SliderThumbTrigger`)),Ke=B.forwardRef(H(function(e,t){let{__scopeSlider:n,name:r,...i}=e;return(0,V.jsx)(Ue,{__scopeSlider:n,name:r,internal_do_not_use_render:({index:e,isFormControl:r})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ge,{...i,ref:t,__scopeSlider:n}),r?(0,V.jsx)(Je,{__scopeSlider:n},e):null]})})},`SliderThumb`)),qe=`SliderBubbleInput`,Je=B.forwardRef(H(function({__scopeSlider:e,...t},n){let{value:i,name:o,form:s}=Ve(qe,e),c=B.useRef(null),l=r(c,n),u=p(i);return B.useEffect(()=>{let e=c.current;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(u!==i&&n){let t=new Event(`input`,{bubbles:!0});n.call(e,i),e.dispatchEvent(t)}},[u,i]),(0,V.jsx)(a.input,{style:{display:`none`},name:o,form:s,...t,ref:l,defaultValue:i})},`SliderBubbleInput`));function Ye(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}H(Ye,`getNextSortedValues`);function Xe(e,t,n){let r=100/(n-t)*(e-t);return h(r,[0,100])}H(Xe,`convertValueToPercentage`);function Ze(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}H(Ze,`getLabel`);function Qe(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}H(Qe,`getClosestValueIndex`);function $e(e,t,n){let r=e/2;return(r-nt([0,50],[0,r])(t)*n)*n}H($e,`getThumbInBoundsOffset`);function et(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}H(et,`getStepsBetweenValues`);function tt(e,t){if(t>0){let n=et(e);return Math.min(...n)>=t}return!0}H(tt,`hasMinStepsBetweenValues`);function nt(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}H(nt,`linearScale`);function rt(e){if(!Number.isFinite(e))return 0;let t=e.toString();if(t.includes(`e`)){let[e,n]=t.split(`e`),r=e.split(`.`)[1]||``,i=Number(n);return Math.max(0,r.length-i)}let n=t.split(`.`)[1];return n?n.length:0}H(rt,`getDecimalCount`);function G(e,t){let n=10**t;return Math.round(e*n)/n}H(G,`roundValue`);function it(e,{min:t,step:n,direction:r,multiplier:i}){let a=rt(n),o=(e-t)/n,s=Math.round(o),c=G(s*n+t,a)===G(e,a),l;return l=c?s+i*r:r>0?Math.ceil(o):Math.floor(o),G(l*n+t,a)}H(it,`getNextStepValue`);function at(e){return typeof e==`function`}H(at,`isFunction`);var ot=y(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),K=y(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),st=y(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),ct=y(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),lt=y(`handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),ut=y(`key-round`,[[`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`}]]),dt=y(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),ft=y(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),pt=y(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),mt=y(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),q=_e,J=he,Y=me;function X(e){return(0,V.jsx)(ge,{density:`compact`,...e})}function ht({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=B.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,V.jsxs)(Ae,{"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,className:_(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...a,children:[(0,V.jsx)(Le,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,V.jsx)(ze,{"data-slot":`slider-range`,className:`absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,V.jsx)(Ke,{"data-slot":`slider-thumb`,className:`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`},t))]})}function gt(e){window.dispatchEvent(new CustomEvent(`pisper:desktop-pet-changed`,{detail:e}))}function _t({notify:e}){let{t}=l(),n=window.pisperDesktop,r=(0,B.useMemo)(()=>n?.getPetStatus?{getStatus:()=>n.getPetStatus(),setEnabled:e=>n.setPetEnabled(e),setOpacity:e=>n.setPetOpacity(e),search:e=>n.searchPets(e),install:e=>n.installPet(e),select:e=>n.selectPet(e),openCatalog:()=>void n.openPetdex?.()}:{getStatus:()=>I(`/api/desktop-pet`),setEnabled:e=>I(`/api/desktop-pet/enabled`,{method:`POST`,body:{enabled:e}}),setOpacity:e=>I(`/api/desktop-pet/opacity`,{method:`POST`,body:{opacity:e}}),search:e=>I(`/api/desktop-pet/catalog?query=${encodeURIComponent(e)}`),install:e=>I(`/api/desktop-pet/install`,{method:`POST`,body:{slug:e}}),select:e=>I(`/api/desktop-pet/select`,{method:`POST`,body:{slug:e}}),openCatalog:()=>window.open(`https://petdex.dev`,`_blank`,`noopener,noreferrer`)},[n]),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(``),[c,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(``),[p,m]=(0,B.useState)(``),h=(0,B.useCallback)(async()=>{try{m(``),a(await r.getStatus())}catch(e){m(e instanceof Error?e.message:String(e))}},[r]),g=(0,B.useCallback)(async()=>{f(`search`);try{m(``),u(await r.search(o))}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}},[r,o]);(0,B.useEffect)(()=>{h(),r.search(``).then(u).catch(()=>{})},[r,h]);let _=async n=>{f(`toggle`);try{m(``);let i=await r.setEnabled(n);a(i),gt(i),e(t(n?`config:desktopPetSettings.petEnabled`:`config:desktopPetSettings.petDisabled`))}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}},v=async e=>{f(`opacity`);try{m(``);let t=await r.setOpacity(e);a(t),gt(t)}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}},y=async(n=o)=>{if(n.trim()){f(`install`);try{m(``);let i=await r.install(n);a(i),gt(i),e(t(`config:desktopPetSettings.petInstalled`,{name:i.selectedName||n}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}},b=async n=>{if(n!==i?.selectedSlug){f(`select:${n}`);try{m(``);let i=await r.select(n);a(i),gt(i),e(t(`config:desktopPetSettings.petSelected`,{name:i.selectedName||n}))}catch(e){m(e instanceof Error?e.message:String(e))}finally{f(``)}}};return(0,V.jsxs)(`div`,{className:`language-settings desktop-pet-settings`,children:[(0,V.jsxs)(q,{className:`language-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(K,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:t(`config:desktopPetSettings.title`)}),(0,V.jsx)(`p`,{children:t(`config:desktopPetSettings.description`)})]})]}),i?(0,V.jsxs)(`div`,{className:`notification-option mt-4`,children:[(0,V.jsx)(K,{size:18}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`strong`,{children:t(`config:desktopPetSettings.showOnDesktop`)}),(0,V.jsx)(`small`,{children:i.selectedName?t(`config:desktopPetSettings.currentPet`,{name:i.selectedName}):t(`config:desktopPetSettings.installBeforeEnabling`)})]}),(0,V.jsx)(Y,{tone:i.running?`green`:`gray`,children:i.running?t(`config:desktopPetSettings.running`):t(`config:desktopPetSettings.stopped`)}),(0,V.jsx)(X,{value:i.enabled,disabled:d===`toggle`||!i.installed.length,onChange:_,ariaLabel:t(`config:desktopPetSettings.showOnDesktop`)})]}):(0,V.jsxs)(`div`,{className:`permission-note language-settings-note`,children:[(0,V.jsx)(F,{className:`spin`,size:16}),(0,V.jsx)(`span`,{children:t(`config:desktopPetSettings.loading`)})]}),i&&(0,V.jsxs)(`div`,{className:`desktop-pet-opacity mt-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`strong`,{children:t(`config:desktopPetSettings.opacity`)}),(0,V.jsxs)(`span`,{children:[Math.round((i.opacity??1)*100),`%`]})]}),(0,V.jsx)(ht,{value:[Math.round((i.opacity??1)*100)],min:20,max:100,step:5,disabled:d===`opacity`,onValueCommit:([e])=>void v(e/100),"aria-label":t(`config:desktopPetSettings.opacity`)})]}),p&&(0,V.jsx)(`div`,{className:`attachment-error mt-3`,children:p})]}),(0,V.jsxs)(q,{className:`language-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(de,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:t(`config:desktopPetSettings.installTitle`)}),(0,V.jsx)(`p`,{children:t(`config:desktopPetSettings.installDescription`)})]})]}),(0,V.jsxs)(`div`,{className:`workspace-path-form desktop-pet-search mt-4`,children:[(0,V.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g()},placeholder:t(`config:desktopPetSettings.searchPlaceholder`),"aria-label":t(`config:desktopPetSettings.petSlug`)}),(0,V.jsxs)(`button`,{className:`button primary`,disabled:d===`search`,onClick:g,children:[d===`search`?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(O,{size:14}),t(`config:desktopPetSettings.search`)]})]}),c.length>0&&(0,V.jsx)(`div`,{className:`language-choice-grid mt-4`,children:c.map(e=>{let n=i?.installed.some(t=>t.slug===e.slug);return(0,V.jsxs)(`button`,{type:`button`,className:`language-choice`,disabled:d===`install`,onClick:()=>n?b(e.slug):y(e.slug),children:[(0,V.jsx)(`span`,{className:`language-choice-mark`,children:(0,V.jsx)(K,{size:16})}),(0,V.jsxs)(`span`,{className:`language-choice-copy`,children:[(0,V.jsx)(`strong`,{children:e.displayName}),(0,V.jsx)(`small`,{children:e.slug})]}),(0,V.jsx)(Y,{tone:n?`green`:`blue`,children:t(n?`config:desktopPetSettings.installed`:`config:desktopPetSettings.install`)})]},e.slug)})}),(0,V.jsx)(`div`,{className:`button-row`,children:(0,V.jsxs)(`button`,{className:`button secondary`,onClick:r.openCatalog,children:[(0,V.jsx)(R,{size:14}),t(`config:desktopPetSettings.browsePetdex`)]})})]}),i&&i.installed.length>0&&(0,V.jsxs)(q,{className:`language-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(K,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:t(`config:desktopPetSettings.installedTitle`)}),(0,V.jsx)(`p`,{children:t(`config:desktopPetSettings.installedDescription`)})]})]}),(0,V.jsx)(`div`,{className:`language-choice-grid mt-4`,role:`radiogroup`,children:i.installed.map(e=>{let t=e.slug===i.selectedSlug;return(0,V.jsxs)(`button`,{type:`button`,className:`language-choice ${t?`selected`:``}`,role:`radio`,"aria-checked":t,disabled:d===`select:${e.slug}`,onClick:()=>b(e.slug),children:[(0,V.jsx)(`span`,{className:`language-choice-mark`,children:(0,V.jsx)(K,{size:16})}),(0,V.jsxs)(`span`,{className:`language-choice-copy`,children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsx)(`small`,{children:e.slug})]}),(0,V.jsx)(Y,{tone:e.source===`pisper`?`blue`:`gray`,children:e.source===`pisper`?`Pisper`:`Petdex`})]},`${e.source}:${e.slug}`)})})]})]})}function vt(e,t){return t(e===`en-US`?`config:languageSettings.english`:`config:languageSettings.simplifiedChinese`)}function yt({notify:e}){let{language:t,setLanguage:n,t:r}=l(),i=pe(e=>e.density),a=pe(e=>e.setDensity),o=r=>{r!==t&&(n(r),e(c(r===`en-US`?`config:languageSettings.displayLanguageChangedToEnglish`:`config:languageSettings.displayLanguageChangedToSimplifiedChinese`,r)))},u=t=>{t!==i&&(a(t),e(r(`config:languageSettings.interfaceDensitySwitchedToDensity`,{density:r(t===`compact`?`config:languageSettings.compact`:`config:languageSettings.comfortable`)})))},d=[[`comfortable`,r(`config:languageSettings.comfortable`),r(`config:languageSettings.defaultSpacingAndSizing`),mt],[`compact`,r(`config:languageSettings.compact`),r(`config:languageSettings.fitMoreContentOnScreen`),ct]];return(0,V.jsxs)(`div`,{className:`language-settings`,children:[(0,V.jsxs)(q,{className:`language-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(dt,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:r(`config:languageSettings.displayLanguage`)}),(0,V.jsx)(`p`,{children:r(`config:languageSettings.chooseTheLanguageUsedByPisperChangesApplyImmediatelyAndAreSavedForYourNextVisit`)})]})]}),(0,V.jsx)(`div`,{className:`language-choice-grid`,role:`radiogroup`,"aria-label":r(`config:languageSettings.displayLanguage`),children:s.map(e=>{let n=e.value===t;return(0,V.jsxs)(`button`,{type:`button`,className:`language-choice ${n?`selected`:``}`,role:`radio`,"aria-checked":n,onClick:()=>o(e.value),children:[(0,V.jsx)(`span`,{className:`language-choice-mark ${e.value===`en-US`?`english`:``}`,children:e.shortName}),(0,V.jsxs)(`span`,{className:`language-choice-copy`,children:[(0,V.jsx)(`strong`,{children:vt(e.value,r)}),(0,V.jsx)(`small`,{children:e.value===`zh-CN`?r(`config:languageSettings.chineseInterface`):r(`config:languageSettings.englishInterface`)})]}),n&&(0,V.jsx)(`span`,{className:`language-choice-check`,children:(0,V.jsx)(m,{size:15})})]},e.value)})}),(0,V.jsxs)(`div`,{className:`permission-note language-settings-note`,children:[(0,V.jsx)(dt,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsxs)(`strong`,{children:[r(`config:languageSettings.currentLanguage`),` · `,vt(t,r)]}),(0,V.jsx)(`small`,{children:r(`config:languageSettings.thisSettingChangesInterfaceTextOnlyItDoesNotControlTheLanguageOfAgentResponses`)})]})]}),(0,V.jsx)(`small`,{className:`language-settings-storage`,children:r(`config:languageSettings.languagePreferenceIsStoredInThisBrowser`)})]}),(0,V.jsxs)(q,{className:`language-settings-card density-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(ct,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:r(`config:languageSettings.interfaceDensity`)}),(0,V.jsx)(`p`,{children:r(`config:languageSettings.adjustSpacingAndSizingCompactModeFitsMoreContentOnScreen`)})]})]}),(0,V.jsx)(`div`,{className:`language-choice-grid`,role:`radiogroup`,"aria-label":r(`config:languageSettings.interfaceDensity`),children:d.map(([e,t,n,r])=>{let a=e===i;return(0,V.jsxs)(`button`,{type:`button`,className:`language-choice ${a?`selected`:``}`,role:`radio`,"aria-checked":a,onClick:()=>u(e),children:[(0,V.jsx)(`span`,{className:`language-choice-mark`,children:(0,V.jsx)(r,{size:16})}),(0,V.jsxs)(`span`,{className:`language-choice-copy`,children:[(0,V.jsx)(`strong`,{children:t}),(0,V.jsx)(`small`,{children:n})]}),a&&(0,V.jsx)(`span`,{className:`language-choice-check`,children:(0,V.jsx)(m,{size:15})})]},e)})}),(0,V.jsxs)(`div`,{className:`permission-note language-settings-note`,children:[(0,V.jsx)(ct,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsxs)(`strong`,{children:[r(`config:languageSettings.currentDensity`),` ·`,` `,r(i===`compact`?`config:languageSettings.compact`:`config:languageSettings.comfortable`)]}),(0,V.jsx)(`small`,{children:r(`config:languageSettings.thisSettingOnlyAffectsTheInterfaceInThisBrowser`)})]})]})]})]})}var bt=[[`openai-responses`,`OpenAI Responses`],[`openai-completions`,`OpenAI Chat Completions`],[`anthropic-messages`,`Anthropic Messages`],[`google-generative-ai`,`Google Generative AI`]];function xt({provider:e,draft:t,toggling:n,apiKeyInputRef:r,onPatchDraft:i,onSelectProviderType:a,onToggleProvider:o,onDeleteProvider:s}){let{t:c}=l(),u=e.id===`openai-codex`,d=t.providerType===`visual`;return(0,V.jsxs)(q,{children:[(0,V.jsxs)(`div`,{className:`card-head`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:e.name}),(0,V.jsxs)(`p`,{children:[e.id,` · `,e.api,` ·`,` `,c(`config:configPage.authenticationAndEndpointsAreStoredIndependentlyForEachConnection`)]})]}),(0,V.jsxs)(`div`,{className:`provider-header-status`,children:[(0,V.jsx)(Y,{tone:e.enabled?e.configured?`green`:`amber`:`gray`,children:e.enabled?e.configured?c(`config:configPage.authenticationReady`):c(u?`config:configPage.codexCLILoginRequired`:`config:configPage.apiKeyRequired`):c(`config:configPage.disabled2`)}),(0,V.jsx)(X,{value:e.enabled,disabled:!e.configured||n===e.id,onChange:t=>o(e,t)}),e.custom&&(0,V.jsx)(`button`,{className:`icon-button danger`,title:c(`config:configPage.deleteProvider`),onClick:()=>s(e),children:(0,V.jsx)(j,{size:14})})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[c(`config:configPage.providerPurpose`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:t.providerType,onChange:e=>a(e.target.value),children:[(0,V.jsx)(`option`,{value:`chat`,children:c(`config:configPage.chatProvider`)}),(0,V.jsx)(`option`,{value:`visual`,children:c(`config:configPage.visualProvider`)})]}),(0,V.jsx)(C,{size:13})]}),(0,V.jsx)(`small`,{children:c(d?`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingChatModelsAreIgnored`:`config:configPage.usedForAgentChatAndMayAlsoIncludeVisualModels`)})]}),u?(0,V.jsxs)(`div`,{className:`oauth-provider-note`,children:[(0,V.jsx)(k,{size:17}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:e.configured?c(`config:configPage.chatGPTOAuthConnected`):c(`config:configPage.codexCLILoginRequired`)}),(0,V.jsx)(`small`,{children:e.configured?c(`config:configPage.openAICodexUsesChatGPTPlusProOAuthAndDoesNotAcceptARegularAPIKey`):c(`config:configPage.signInWithCodexCLIThenLoadItFromTheLocalProvidersSectionAbove`)})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(J,{title:c(`config:configPage.authentication`)}),(0,V.jsxs)(`label`,{className:`field-label`,children:[c(`config:configPage.apiProtocol`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:t.api,onChange:e=>i({api:e.target.value}),children:bt.map(([e,t])=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`API Key`,(0,V.jsxs)(`span`,{className:`input-wrap`,children:[(0,V.jsx)(`input`,{ref:r,type:`password`,name:`provider-api-key-${e.id}`,autoComplete:`new-password`,value:t.apiKey,onChange:e=>i({apiKey:e.currentTarget.value}),onInput:e=>{let n=e.currentTarget.value;t.apiKey!==n&&i({apiKey:n})},placeholder:e.configured?c(`config:configPage.configuredLeaveBlankToKeepTheExistingKey`):c(`config:configPage.enterTheProviderAPIKey`)}),(0,V.jsx)(ut,{size:14})]})]}),(0,V.jsx)(J,{title:c(`config:configPage.endpoint`)}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`Provider Base URL`,(0,V.jsx)(`input`,{value:t.baseUrl,onChange:e=>i({baseUrl:e.target.value}),placeholder:c(`config:configPage.defaultEndpointForModelsInThisConnection`)})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`Organization`,(0,V.jsx)(`input`,{value:t.organization,onChange:e=>i({organization:e.target.value}),placeholder:c(`config:configPage.optionalUsedOnlyForOpenAIOrganization`)})]})]})]})}var St={openai:fe,"openai-codex":fe,anthropic:le,google:P,deepseek:w,xai:N,openrouter:T,"kimi-coding":P,"zai-coding-cn":le};function Ct({providers:e,selectedProviderId:t,toggling:n,onAdd:r,onSelect:i,onToggle:a}){let{t:o}=l();return(0,V.jsxs)(q,{className:`selection-list`,children:[(0,V.jsxs)(`div`,{className:`provider-list-heading`,children:[(0,V.jsx)(J,{title:o(`config:configPage.providerConnections`)}),(0,V.jsx)(`button`,{className:`icon-button`,title:o(`config:configPage.addProvider`),onClick:r,children:(0,V.jsx)(E,{size:15})})]}),e.map(e=>{let r=St[e.id]||re;return(0,V.jsxs)(`div`,{className:`provider-list-item ${t===e.id?`active`:``} ${e.enabled?``:`disabled-provider`}`,children:[(0,V.jsxs)(`button`,{className:`provider-select-main`,onClick:()=>i(e),children:[(0,V.jsx)(`span`,{className:`list-icon`,children:(0,V.jsx)(r,{size:16})}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:e.name}),(0,V.jsxs)(`small`,{children:[e.id,` ·`,` `,o(`config:configPage.countModels`,{count:e.models.length})]})]})]}),(0,V.jsx)(`div`,{className:`provider-list-control`,children:(0,V.jsx)(X,{value:e.enabled,disabled:!e.configured||n===e.id,onChange:t=>a(e,t)})})]},e.id)})]})}function wt({provider:e,draft:t,onPatchDraft:n,onSelectModel:r,onOpenModelDialog:i}){let{t:a}=l(),o=t.providerType===`visual`,s=e.id===`openai-codex`,c=o?[]:e.models.filter(e=>e.kind===`chat`),u=e.models.filter(e=>e.kind!==`chat`),d=e.models.find(e=>e.id===t.model);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`model-config-heading`,children:[(0,V.jsx)(J,{title:a(`config:configPage.models`)}),!s&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`button`,{className:`button secondary tiny`,onClick:()=>i(`discover`),children:[(0,V.jsx)(F,{size:13}),a(`config:configPage.fetchModels`)]}),(0,V.jsxs)(`button`,{className:`button secondary tiny`,onClick:()=>i(`manual`),children:[(0,V.jsx)(E,{size:13}),a(`config:configPage.addModel`)]})]})]}),!o&&c.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[a(`config:configPage.defaultChatModel`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:t.model,onChange:e=>r(e.target.value),children:c.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,V.jsx)(C,{size:13})]})]}),!s&&(0,V.jsxs)(`label`,{className:`field-label`,children:[a(`config:configPage.modelBaseURL`),(0,V.jsx)(`input`,{value:t.modelBaseUrl,onChange:e=>n({modelBaseUrl:e.target.value}),placeholder:a(`config:configPage.optionalOverrideTheProviderBaseURLForThisModel`)})]}),(0,V.jsxs)(`div`,{className:`tag-field`,children:[(0,V.jsx)(Y,{children:t.provider}),(0,V.jsx)(Y,{children:d?.reasoning?a(`config:configPage.reasoningSupported`):a(`config:configPage.standardModel`)}),(0,V.jsx)(Y,{tone:`gray`,children:d?.contextWindow?`${Math.round(d.contextWindow/1e3)}K context`:a(`config:configPage.automaticContext`)}),d?.baseUrlOverride&&(0,V.jsx)(Y,{tone:`amber`,children:a(`config:configPage.customBaseURL`)})]})]}):o?(0,V.jsxs)(`div`,{className:`permission-note`,children:[(0,V.jsx)(P,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:a(`config:configPage.visualOnlyProvider`)}),(0,V.jsx)(`small`,{children:a(`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingAndExcludedFromAgentChatModelSelection`)})]})]}):(0,V.jsxs)(`div`,{className:`permission-note`,children:[(0,V.jsx)(z,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:a(`config:configPage.noChatModelAvailable`)}),(0,V.jsx)(`small`,{children:a(`config:configPage.fetchOrAddAChatModel`)})]})]}),u.length>0&&(0,V.jsxs)(`div`,{className:`visual-model-list`,children:[(0,V.jsx)(`span`,{children:a(`config:configPage.visualModels`)}),u.map(e=>(0,V.jsxs)(Y,{tone:`blue`,children:[e.name,` ·`,` `,e.kind===`video`?a(`config:configPage.videoGeneration`):a(`config:configPage.imageGenerationAndEditing`)]},e.id))]})]})}function Tt({onClose:e,onCreated:t}){let{t:n}=l(),[r,i]=(0,B.useState)({name:``,id:``,providerType:`chat`,api:`openai-responses`,baseUrl:``,apiKey:``,model:``,modelName:``,modelKind:`chat`,reasoning:!0,enabled:!0}),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),u=e=>i(t=>({...t,name:e,id:t.id||e.toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)})),d=e=>i(t=>({...t,providerType:e,modelKind:e===`visual`?t.modelKind===`image`||t.modelKind===`video`?t.modelKind:`image`:t.modelKind===`chat`?t.modelKind:`chat`}));return(0,V.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:t=>t.target===t.currentTarget&&e(),children:(0,V.jsxs)(`form`,{className:`modal provider-config-modal`,onSubmit:async e=>{e.preventDefault(),o(!0),c(``);try{t(await I(`/api/providers`,{method:`POST`,body:JSON.stringify(r)}))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},children:[(0,V.jsxs)(`div`,{className:`card-head`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:n(`config:configPage.addProviderConnection`)}),(0,V.jsx)(`p`,{children:n(`config:configPage.youCanCreateMultipleConnectionsUsingTheSameProtocolEachWithItsOwnKeyAndBaseURL`)})]}),(0,V.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":n(`config:configPage.closeDialog`),onClick:e,children:(0,V.jsx)(te,{size:17})})]}),(0,V.jsxs)(`div`,{className:`form-grid`,children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.displayName`),(0,V.jsx)(`input`,{value:r.name,onChange:e=>u(e.target.value),placeholder:n(`config:configPage.forExampleOpenAIOfficial`)})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`Provider ID`,(0,V.jsx)(`input`,{value:r.id,onChange:e=>i({...r,id:e.target.value}),placeholder:`openai-official`})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.providerPurpose`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:r.providerType,onChange:e=>d(e.target.value),children:[(0,V.jsx)(`option`,{value:`chat`,children:n(`config:configPage.chatProvider`)}),(0,V.jsx)(`option`,{value:`visual`,children:n(`config:configPage.visualProvider`)})]}),(0,V.jsx)(C,{size:13})]}),(0,V.jsx)(`small`,{children:r.providerType===`visual`?n(`config:configPage.usedOnlyForImageGenerationVideoGenerationAndImageEditingChatModelsAreIgnored`):n(`config:configPage.usedForAgentChatAndMayAlsoIncludeVisualModels`)})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.apiProtocol`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:r.api,onChange:e=>i({...r,api:e.target.value}),children:bt.map(([e,t])=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`Base URL`,(0,V.jsx)(`input`,{value:r.baseUrl,onChange:e=>i({...r,baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[`API Key`,(0,V.jsx)(`input`,{type:`password`,value:r.apiKey,onChange:e=>i({...r,apiKey:e.target.value}),placeholder:n(`config:configPage.enterTheAPIKeyForThisConnection`)})]}),(0,V.jsxs)(`div`,{className:`form-grid`,children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.initialModelID`),(0,V.jsx)(`input`,{value:r.model,onChange:e=>i({...r,model:e.target.value}),placeholder:r.providerType===`visual`?`gpt-image-2 or grok-imagine-video`:`gpt-5.4 or gpt-image-1`})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.modelName`),(0,V.jsx)(`input`,{value:r.modelName,onChange:e=>i({...r,modelName:e.target.value}),placeholder:n(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.modelType`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:r.modelKind,onChange:e=>i({...r,modelKind:e.target.value}),children:[r.providerType!==`visual`&&(0,V.jsx)(`option`,{value:`chat`,children:n(`config:configPage.chat`)}),(0,V.jsx)(`option`,{value:`image`,children:n(`config:configPage.imageGenerationAndEditing`)}),(0,V.jsx)(`option`,{value:`video`,children:n(`config:configPage.videoGeneration`)})]}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`div`,{className:`modal-toggle-row`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:n(`config:configPage.enableAfterCreation`)}),(0,V.jsx)(`small`,{children:n(`config:configPage.visualModelsAreSelectedByTheVisualGenerationToolAndDoNotAppearInTheChatModelList`)})]}),(0,V.jsx)(X,{value:r.enabled,onChange:e=>i({...r,enabled:e})})]}),s&&(0,V.jsxs)(`div`,{className:`config-error`,children:[(0,V.jsx)(z,{size:13}),s]}),(0,V.jsxs)(`div`,{className:`modal-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:e,children:n(`config:configPage.cancel`)}),(0,V.jsxs)(`button`,{className:`button primary`,disabled:a,children:[a?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(E,{size:14}),n(a?`config:configPage.creating`:`config:configPage.createConnection`)]})]})]})})}function Et({provider:e,connectionDraft:t,autoDiscover:n,onClose:r,onSynchronized:i,onCreated:a}){let{t:o}=l(),[s,c]=(0,B.useState)({id:``,name:``,api:e.api||`openai-responses`,baseUrl:``,kind:e.type===`visual`?`image`:`chat`,reasoning:!0}),[u,d]=(0,B.useState)(e.type===`visual`?`image`:`chat`),[f,p]=(0,B.useState)(t.api||e.api||`openai-responses`),[h,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),[b,x]=(0,B.useState)([]),[S,w]=(0,B.useState)([]),[T,D]=(0,B.useState)(``),[O,k]=(0,B.useState)(``),ee=(0,B.useRef)(i);(0,B.useEffect)(()=>{ee.current=i},[i]);let A=t.api,j=t.providerType,M=t.baseUrl,N=t.apiKey,P=t.organization,ne=(0,B.useCallback)(async()=>{y(!0),k(``);try{let t=await I(`/api/providers/${encodeURIComponent(e.id)}/models/discover`,{method:`POST`,body:JSON.stringify({providerType:j,api:A,baseUrl:M,apiKey:N,organization:P})});x(t.models||[]),w([]),t.config&&ee.current(t.config)}catch(e){k(e instanceof Error?e.message:String(e))}finally{y(!1)}},[A,N,M,P,j,e.id]);(0,B.useEffect)(()=>{n&&ne()},[n,ne]);let re=e=>{e.added||w(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},ie=async t=>{t.preventDefault(),_(!0),k(``);try{if(S.length){let t=b.filter(e=>S.includes(e.id)).map(e=>({id:e.id,name:e.name,kind:u,api:f,reasoning:u===`chat`}));a(await I(`/api/providers/${encodeURIComponent(e.id)}/models/batch`,{method:`POST`,body:JSON.stringify({models:t})}),S[0])}else a(await I(`/api/providers/${encodeURIComponent(e.id)}/models`,{method:`POST`,body:JSON.stringify(s)}),s.id)}catch(e){k(e instanceof Error?e.message:String(e))}finally{_(!1)}},L=T.trim().toLowerCase(),ae=b.filter(e=>!L||e.id.toLowerCase().includes(L)||e.name.toLowerCase().includes(L)),oe=S.length>0||s.id.trim();return(0,V.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:e=>e.target===e.currentTarget&&r(),children:(0,V.jsxs)(`form`,{className:`modal`,onSubmit:ie,children:[(0,V.jsxs)(`div`,{className:`card-head`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:o(`config:configPage.addModel`)}),(0,V.jsx)(`p`,{children:o(`config:configPage.fetchModelIDsFromProviderOrAddOneManually`,{provider:e.name})})]}),(0,V.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`config:configPage.closeDialog`),onClick:r,children:(0,V.jsx)(te,{size:17})})]}),(0,V.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,V.jsxs)(`label`,{className:`field-label min-w-0 flex-1`,children:[o(`config:configPage.remoteModelCatalog`),(0,V.jsx)(`input`,{value:T,onChange:e=>D(e.target.value),placeholder:o(`config:configPage.searchModelIDOrName`),disabled:!b.length})]}),(0,V.jsxs)(`button`,{type:`button`,className:`button secondary h-9 shrink-0`,disabled:v,onClick:ne,children:[v?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(F,{size:14}),v?o(`config:configPage.fetching`):b.length?o(`config:configPage.fetchAgain`):o(`config:configPage.fetchFromAPI`)]})]}),b.length>0&&(0,V.jsxs)(`div`,{className:`form-grid`,children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.modelType`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:u,onChange:e=>d(e.target.value),children:[e.type!==`visual`&&(0,V.jsx)(`option`,{value:`chat`,children:o(`config:configPage.chat`)}),(0,V.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,V.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.apiProtocol`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:f,onChange:e=>p(e.target.value),children:bt.map(([e,t])=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(C,{size:13})]})]})]}),b.length>0&&(0,V.jsxs)(`div`,{className:`max-h-64 space-y-1 overflow-y-auto rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--surface-subtle)] p-1`,role:`listbox`,"aria-multiselectable":`true`,children:[ae.map(e=>{let t=S.includes(e.id);return(0,V.jsxs)(`button`,{type:`button`,className:`flex min-h-10 w-full items-center gap-2 rounded-[var(--r-xs)] border px-2.5 py-1.5 text-left text-[13px] ${t?`border-[var(--control-selected-border)] bg-[var(--control-selected-bg)] text-[var(--control-selected-text)]`:`border-transparent bg-transparent text-[var(--text)] hover:bg-[var(--surface-hover)]`} ${e.added?`cursor-default opacity-55`:``}`,role:`option`,"aria-selected":t,disabled:e.added,onClick:()=>re(e),children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`strong`,{className:`block truncate`,children:e.id}),e.name!==e.id&&(0,V.jsx)(`small`,{className:`block truncate text-[12px] ${t?`text-inherit opacity-75`:`text-[var(--text-muted)]`}`,children:e.name})]}),e.added?(0,V.jsx)(Y,{tone:`gray`,children:o(`config:configPage.added`)}):t?(0,V.jsx)(m,{size:15}):null]},e.id)}),!ae.length&&(0,V.jsx)(`div`,{className:`px-3 py-6 text-center text-[13px] text-[var(--text-muted)]`,children:o(`config:configPage.noMatchingModels`)})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-[12px] text-[var(--text-muted)]`,children:[(0,V.jsx)(`span`,{className:`h-px flex-1 bg-[var(--stroke)]`}),(0,V.jsx)(`span`,{children:o(`config:configPage.addManually`)}),(0,V.jsx)(`span`,{className:`h-px flex-1 bg-[var(--stroke)]`})]}),(0,V.jsxs)(`div`,{className:`form-grid`,children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.modelID`),(0,V.jsx)(`input`,{value:s.id,onChange:e=>c({...s,id:e.target.value}),placeholder:`gpt-5.4-mini, gpt-image-1, or sora-2`})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.displayName`),(0,V.jsx)(`input`,{value:s.name,onChange:e=>c({...s,name:e.target.value}),placeholder:o(`config:configPage.leaveBlankToUseTheModelID`)})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.modelBaseURL`),(0,V.jsx)(`input`,{value:s.baseUrl,onChange:e=>c({...s,baseUrl:e.target.value}),placeholder:o(`config:configPage.optionalLeaveBlankToInheritTheProviderBaseURL`)})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.apiProtocol`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:s.api,onChange:e=>c({...s,api:e.target.value}),children:bt.map(([e,t])=>(0,V.jsx)(`option`,{value:e,children:t},e))}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:configPage.modelType`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:s.kind,onChange:e=>c({...s,kind:e.target.value}),children:[e.type!==`visual`&&(0,V.jsx)(`option`,{value:`chat`,children:o(`config:configPage.chat`)}),(0,V.jsx)(`option`,{value:`image`,children:o(`config:configPage.imageGenerationAndEditing`)}),(0,V.jsx)(`option`,{value:`video`,children:o(`config:configPage.videoGeneration`)})]}),(0,V.jsx)(C,{size:13})]})]}),s.kind!==`image`&&s.kind!==`video`&&(0,V.jsxs)(`div`,{className:`modal-toggle-row`,children:[(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:o(`config:configPage.reasoningModel`)}),(0,V.jsx)(`small`,{children:o(`config:configPage.enableReasoningEffortThinkingLevel`)})]}),(0,V.jsx)(X,{value:s.reasoning,onChange:e=>c({...s,reasoning:e})})]}),O&&(0,V.jsxs)(`div`,{className:`config-error`,children:[(0,V.jsx)(z,{size:13}),O]}),(0,V.jsxs)(`div`,{className:`modal-actions`,children:[(0,V.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:r,children:o(`config:configPage.cancel`)}),(0,V.jsxs)(`button`,{className:`button primary`,disabled:h||!oe,children:[h?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(E,{size:14}),h?o(`config:configPage.adding`):S.length?o(`config:configPage.addCountModels`,{count:S.length}):o(`config:configPage.addModel`)]})]})]})})}function Dt(e){return(e.providers||[]).some(e=>e.importable&&!e.imported&&!e.conflict)}function Ot(e,t){return!t&&!Dt(e)}function kt(e,t,n){let r=e.providers||[],i=e.errors||[],a=Dt(e),o=!!(n||i.length||r.some(e=>e.conflict||!e.imported&&!e.importable||e.warnings?.some(e=>e.code!==`login_auth_not_imported`)));return t||a||o}function At(e){return e.source===`codex-config`?`Codex config.toml`:e.source===`claude-config`?`Claude settings.json`:e.source===`codex-auth`?`Codex login`:`Claude login`}function jt(e,t){return e.authType===`environment`?t(`config:configPage.keyVariableName`,{name:e.authVariable}):e.authType===`bearer`||e.authType===`api_key`?t(`config:configPage.authenticationIncludedInConfiguration`):e.authType===`oauth`?t(`config:configPage.loginStateFileDetected`):e.authType===`external-login`?t(`config:configPage.authenticationRequired`):t(`config:configPage.noAuthenticationInConfiguration`)}function Mt(e,t){return t(e===`multiple_auth_values`?`config:configPage.multipleAuthenticationFieldsWereDetectedTheAuthorizationFieldTakesPrecedence`:e===`invalid_url`?`config:configPage.theProviderEndpointIsInvalid`:e===`unsupported_api`?`config:configPage.theAPIProtocolInThisConfigurationIsNotSupportedYet`:e===`invalid_env_name`?`config:configPage.theKeyEnvironmentVariableNameIsInvalid`:`config:configPage.someConfigurationFieldsCannotBeImported`)}function Nt({discovery:e,discovering:t,error:n,importing:r,onRefresh:i,onImport:a}){let{t:o}=l(),[s,c]=(0,B.useState)(null),u=e.providers||[],d=e.errors||[];if(!kt(e,t,n))return null;let f=s??Ot(e,t),p=()=>(c(null),i()),m=e=>(c(null),a(e)),h=e=>[`invalid_json`,`invalid_toml`].includes(e.code)?o(`config:configPage.invalidConfigurationFileFormat`):e.code===`unsupported_config`?o(`config:configPage.noImportableProviderConfigurationWasFound`):e.code===`invalid_login_state`?o(`config:configPage.incompleteLoginState`):e.code===`file_too_large`?o(`config:configPage.configurationFileIsTooLarge`):o(`config:configPage.unableToReadTheConfigurationFile`);return(0,V.jsxs)(q,{className:`provider-discovery-panel`,children:[(0,V.jsxs)(`div`,{className:`provider-discovery-head`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`provider-discovery-toggle`,"aria-expanded":!f,onClick:()=>c(!f),children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(re,{size:18})}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:o(`config:configPage.localProviderConfiguration`)}),(0,V.jsx)(`small`,{children:o(`config:configPage.readProviderEndpointModelAndAuthenticationFieldsFromCodexConfigTomlAndClaudeSettingsJson`)})]}),(0,V.jsx)(C,{size:15,className:`provider-discovery-caret ${f?``:`open`}`})]}),(0,V.jsxs)(`button`,{type:`button`,className:`button secondary tiny`,disabled:t||!!r,onClick:p,children:[t?(0,V.jsx)(F,{className:`spin`,size:13}):(0,V.jsx)(F,{size:13}),o(`config:configPage.rescan`)]})]}),!f&&(0,V.jsxs)(V.Fragment,{children:[t&&!u.length?(0,V.jsxs)(`div`,{className:`provider-discovery-empty`,children:[(0,V.jsx)(F,{className:`spin`,size:15}),o(`config:configPage.scanningProviderConfigurationFiles`)]}):u.length?(0,V.jsx)(`div`,{className:`provider-discovery-list`,children:u.map(e=>{let t=At(e),n=r===e.id,i=e.source.startsWith(`claude-`)?le:fe,a=e.kind===`authentication`?o(`config:configPage.officialProviderAuthenticationOnly`):e.models?.length?e.models.map(e=>e.id).join(`, `):o(`config:configPage.noModelSpecified`);return(0,V.jsxs)(`div`,{className:`provider-discovery-card ${e.imported?`configured`:``}`,children:[(0,V.jsx)(`span`,{className:`provider-discovery-icon source-${e.source}`,children:(0,V.jsx)(i,{size:17})}),(0,V.jsxs)(`span`,{className:`provider-discovery-copy`,children:[(0,V.jsxs)(`strong`,{children:[t,` · `,e.providerName]}),(0,V.jsxs)(`small`,{children:[e.api,` · `,a]}),(0,V.jsxs)(`small`,{children:[e.kind===`authentication`?o(`config:configPage.officialEndpointOnly`):e.baseUrl||o(`config:configPage.noBaseURLSpecified`),` `,`· `,jt(e,o),` · `,e.location]})]}),(0,V.jsx)(`span`,{className:`provider-discovery-actions`,children:e.imported?(0,V.jsx)(Y,{tone:`green`,children:o(`config:configPage.loaded`)}):e.conflict?(0,V.jsx)(Y,{tone:`amber`,children:o(`config:configPage.conflictDetected`)}):e.importable?(0,V.jsxs)(`button`,{type:`button`,className:`button primary tiny`,disabled:n||!!r,onClick:()=>m(e),children:[n?(0,V.jsx)(F,{className:`spin`,size:12}):(0,V.jsx)(de,{size:12}),n?o(`config:configPage.loading`):e.kind===`authentication`?o(`config:configPage.loadLoginState`):o(`config:configPage.loadConfiguration`)]}):(0,V.jsx)(Y,{tone:`gray`,children:o(`config:configPage.cannotLoad`)})})]},e.id)})}):(0,V.jsxs)(`div`,{className:`provider-discovery-empty`,children:[(0,V.jsx)(re,{size:15}),o(`config:configPage.noImportableCodexOrClaudeProviderConfigurationWasDetected`)]}),(n||d.length>0||u.some(e=>e.warnings?.some(e=>e.code!==`login_auth_not_imported`)))&&(0,V.jsxs)(`div`,{className:`provider-discovery-errors`,"aria-live":`polite`,children:[n&&(0,V.jsxs)(`span`,{children:[(0,V.jsx)(z,{size:13}),n]}),d.map((e,t)=>(0,V.jsxs)(`span`,{children:[(0,V.jsx)(z,{size:13}),At(e),` · `,h(e)]},`${e.source}-${e.code}-${t}`)),u.flatMap(e=>(e.warnings||[]).filter(e=>e.code!==`login_auth_not_imported`).map((t,n)=>(0,V.jsxs)(`span`,{children:[(0,V.jsx)(z,{size:13}),At(e),` · `,Mt(t.code,o)]},`${e.id}-${t.code}-${n}`)))]})]})]})}function Pt({draft:e,onPatchDraft:t}){let{t:n}=l();return(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.thinkingLevel`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsx)(g,{value:e.thinkingLevel,onChange:e=>t({thinkingLevel:e.target.value}),children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`].map(e=>(0,V.jsx)(`option`,{children:e},e))}),(0,V.jsx)(C,{size:13})]})]})}function Ft({draft:e,onPatchDraft:t}){let{t:n}=l();return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`label`,{className:`field-label`,children:[n(`config:configPage.availableTools`),(0,V.jsxs)(`span`,{className:`select-wrap`,children:[(0,V.jsxs)(g,{value:e.toolMode,onChange:e=>t({toolMode:e.target.value}),children:[(0,V.jsx)(`option`,{value:`read-only`,children:n(`config:configPage.readOnlyInspectionTools`)}),(0,V.jsx)(`option`,{value:`workspace`,children:n(`config:configPage.fileEditingTools`)}),(0,V.jsx)(`option`,{value:`full`,children:n(`config:configPage.fullToolAccess`)}),(0,V.jsx)(`option`,{value:`custom`,children:n(`config:configPage.customManageEachToolOnThePluginsPage`)})]}),(0,V.jsx)(C,{size:13})]})]}),(0,V.jsxs)(`div`,{className:`permission-note`,children:[(0,V.jsx)(k,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:n(`config:configPage.permissionsAreEnforcedByTheRuntime`)}),(0,V.jsx)(`small`,{children:n(`config:configPage.afterSavingExistingRuntimesAreReleasedAndNewChatsUseTheLatestPolicy`)})]})]})]})}function It(e){let{t}=l();return(0,V.jsxs)(q,{children:[(0,V.jsx)(J,{title:t(`config:configPage.agentRuntimePolicy`)}),(0,V.jsx)(Pt,{...e}),(0,V.jsx)(Ft,{...e})]})}function Lt({provider:e,visualOnly:t,codexOAuth:n,saving:r,dirty:i,error:a,hasModel:o,isDefault:s,onSave:c}){let{t:u}=l();return(0,V.jsxs)(q,{className:`usage-card`,"data-dirty":i||void 0,children:[(0,V.jsx)(J,{title:u(`config:configPage.runtimeStatus`)}),(0,V.jsxs)(`div`,{className:`usage-number`,children:[(0,V.jsx)(`span`,{children:`Engine`}),(0,V.jsxs)(`strong`,{children:[ye,` Runtime`]})]}),(0,V.jsxs)(`div`,{className:`usage-number`,children:[(0,V.jsx)(`span`,{children:`Provider`}),(0,V.jsx)(`strong`,{children:e.name})]}),(0,V.jsxs)(`div`,{className:`usage-number`,children:[(0,V.jsx)(`span`,{children:`Models`}),(0,V.jsx)(`strong`,{children:e.models.length})]}),(0,V.jsxs)(`div`,{className:`usage-number`,children:[(0,V.jsx)(`span`,{children:u(`config:configPage.status`)}),(0,V.jsx)(`strong`,{children:e.enabled?u(`config:configPage.enabled`):u(`config:configPage.disabled`)})]}),a&&(0,V.jsxs)(`div`,{className:`config-error`,children:[(0,V.jsx)(z,{size:13}),a]}),(0,V.jsxs)(`div`,{className:`button-row`,children:[(0,V.jsxs)(`button`,{className:`button primary wide`,disabled:r||!e.enabled||n&&!e.configured,onClick:()=>c(!1),children:[r?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(D,{size:14}),r?u(`config:configPage.saving`):n&&!e.configured?u(`config:configPage.loadAuthenticationToSave`):e.enabled?u(t?`config:configPage.saveVisualModelSettings`:`config:configPage.saveProviderSettings`):u(`config:configPage.enableToSave`)]}),!t&&o&&(0,V.jsxs)(`button`,{className:`button secondary wide`,disabled:r||s||!e.enabled||n&&!e.configured,onClick:()=>c(!0),children:[(0,V.jsx)(k,{size:14}),u(s?`config:configPage.currentDefaultProvider`:`config:configPage.setAsDefaultProvider`)]})]})]})}var Rt={config:null,draft:null,loading:!0,saving:!1,toggling:``,error:``,dirty:!1};function Z(e,t,n){let r=t?.models.filter(e=>e.kind===`chat`)||[],i=r.find(e=>e.id===n)||r.find(e=>e.id===t?.defaultModel)||r[0];return{provider:t?.id||`openai`,providerType:t?.type||`chat`,api:t?.api||`openai-responses`,model:i?.id||``,apiKey:``,baseUrl:t?.baseUrl||``,modelBaseUrl:i?.baseUrlOverride||``,organization:t?.organization||``,thinkingLevel:e.thinkingLevel||`medium`,toolMode:e.toolMode||`full`}}function zt(e,t){if(!t)return Z(e,e.providers.find(t=>t.id===e.provider)||e.providers[0],e.model);let n=e.providers.find(e=>e.id===t.provider)||e.providers.find(t=>t.id===e.provider)||e.providers[0],r=n?.models.filter(e=>e.kind===`chat`)||[],i=r.find(e=>e.id===t.model)||r[0];return{...t,provider:n?.id||t.provider,providerType:t.providerType||n?.type||`chat`,api:n&&n.id!==t.provider?n.api||`openai-responses`:t.api||n?.api||`openai-responses`,model:i?.id||``,modelBaseUrl:i?.baseUrlOverride||``}}function Bt(e,t,n,r){return{...Z(e,t,r),thinkingLevel:n?.thinkingLevel||e.thinkingLevel||`medium`,toolMode:n?.toolMode||e.toolMode||`full`}}function Vt(e,t){switch(t.type){case`load-succeeded`:{let n=t.config.providers.find(e=>e.id===t.config.provider)||t.config.providers[0];return{...e,config:t.config,draft:Z(t.config,n,t.config.model),loading:!1,error:``,dirty:!1}}case`refresh-succeeded`:return{...e,config:t.config,draft:zt(t.config,e.draft)};case`replace`:return{...e,config:t.config,draft:t.draft,loading:!1,error:``,dirty:t.dirty};case`patch-draft`:return e.draft?{...e,draft:{...e.draft,...t.patch},dirty:!0}:e;case`config-updated`:return{...e,config:t.config};case`set-loading`:return{...e,loading:t.value};case`set-saving`:return{...e,saving:t.value};case`set-toggling`:return{...e,toggling:t.value};case`set-error`:return{...e,error:t.value};case`save-succeeded`:{if(!e.draft)return{...e,config:t.config,dirty:!1};let n=t.config.providers.find(t=>t.id===e.draft?.provider)||t.config.providers[0];return{...e,config:t.config,draft:{...Z(t.config,n,e.draft.model),thinkingLevel:e.draft.thinkingLevel,toolMode:e.draft.toolMode},error:``,dirty:!1}}}}function Q(e){return e instanceof Error?e.message:String(e)}function Ht({notify:e,requestConfirm:t,t:n}){let[r,i]=(0,B.useReducer)(Vt,Rt),a=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=!0;return I(`/api/config`).then(t=>{if(e)return i({type:`load-succeeded`,config:t}),I(`/api/providers/models/refresh`,{method:`POST`,body:`{}`})}).then(t=>{!e||!t?.config||i({type:`refresh-succeeded`,config:t.config})}).catch(t=>{e&&(i({type:`set-error`,value:Q(t)}),i({type:`set-loading`,value:!1}))}),()=>{e=!1}},[]);let o=(0,B.useMemo)(()=>r.config&&r.draft?r.config.providers.find(e=>e.id===r.draft?.provider)||r.config.providers[0]:null,[r.config,r.draft]),s=(0,B.useCallback)(e=>{i({type:`patch-draft`,patch:e})},[]),c=(0,B.useCallback)(e=>{r.config&&i({type:`replace`,config:r.config,draft:Bt(r.config,e,r.draft),dirty:!0})},[r.config,r.draft]),l=(0,B.useCallback)(e=>{if(!o)return;let t=o.models.find(t=>t.id===e);s({model:e,modelBaseUrl:t?.baseUrlOverride||``})},[s,o]),u=(0,B.useCallback)(e=>{if(!r.draft||!o)return;let t=o.models.find(e=>e.kind===`chat`);s({providerType:e,model:e===`visual`?``:r.draft.model||t?.id||``,modelBaseUrl:e===`visual`?``:r.draft.modelBaseUrl||t?.baseUrlOverride||``})},[s,o,r.draft]),d=(0,B.useCallback)(async(t,r)=>{i({type:`set-toggling`,value:t.id}),i({type:`set-error`,value:``});try{let a=await I(`/api/providers/${encodeURIComponent(t.id)}/enabled`,{method:`PUT`,body:JSON.stringify({enabled:r})});i({type:`config-updated`,config:a}),e(n(`config:configPage.nameState`,{name:t.name,state:n(r?`config:configPage.enabled`:`config:configPage.disabled`)}))}catch(e){i({type:`set-error`,value:Q(e)})}finally{i({type:`set-toggling`,value:``})}},[e,n]),f=(0,B.useCallback)(async r=>{if(await t({title:n(`config:configPage.deleteProviderConnection`),message:n(`config:configPage.deleteNameItsModelSettingsAndAuthenticationDetailsWillAlsoBeRemoved`,{name:r.name}),confirmLabel:n(`config:configPage.delete`)})){i({type:`set-error`,value:``});try{let t=await I(`/api/providers/${encodeURIComponent(r.id)}`,{method:`DELETE`}),a=t.providers.find(e=>e.id===t.provider)||t.providers[0];i({type:`replace`,config:t,draft:Z(t,a,t.model),dirty:!1}),e(n(`config:configPage.providerConnectionDeleted`))}catch(e){i({type:`set-error`,value:Q(e)})}}},[e,t,n]),p=(0,B.useCallback)(async(t=!1)=>{let o=r.draft;if(o){i({type:`set-saving`,value:!0}),i({type:`set-error`,value:``});try{let r=a.current?.value||o.apiKey,s=await I(`/api/config`,{method:`PUT`,body:JSON.stringify({...o,apiKey:r,setAsDefault:t})});if(r.trim()&&!s.apiKeyUpdated)throw Error(n(`config:configPage.apiKeyCouldNotBeUpdatedPleaseRetry`));i({type:`save-succeeded`,config:s}),e((s.providers.find(e=>e.id===o.provider)||s.providers[0]).type===`visual`?n(`config:configPage.visualModelSettingsSaved`):t&&o.model?n(`config:configPage.agentSettingsSavedNewChatsWillUseThisModel`):n(`config:configPage.providerSettingsSaved`))}catch(e){i({type:`set-error`,value:Q(e)})}finally{i({type:`set-saving`,value:!1})}}},[e,r.draft,n]),m=(0,B.useCallback)(t=>{let a=t.config.providers.find(e=>e.id===t.providerId)||t.config.providers[0];if(t.kind===`authentication`){i({type:`refresh-succeeded`,config:t.config}),e(n(`config:configPage.nameLoginStateHasBeenLoadedIntoPisper`,{name:a.name}));return}i({type:`replace`,config:t.config,draft:Bt(t.config,a,r.draft,t.selectedModel),dirty:!0}),e(n(`config:configPage.nameConfigurationHasBeenLoadedIntoPisper`,{name:a.name}))},[e,r.draft,n]),h=(0,B.useCallback)(t=>{let r=t.providers.find(e=>e.id===t.createdProviderId);i({type:`replace`,config:t,draft:Z(t,r),dirty:!0}),e(n(`config:configPage.providerConnectionCreated`))},[e,n]),g=(0,B.useCallback)(e=>{i({type:`refresh-succeeded`,config:e})},[]),_=(0,B.useCallback)((t,a,o)=>{let s=t.providers.find(e=>e.id===a),c={...Z(t,s,o),providerType:r.draft?.providerType||s?.type||`chat`,thinkingLevel:r.draft?.thinkingLevel||t.thinkingLevel,toolMode:r.draft?.toolMode||t.toolMode};i({type:`replace`,config:t,draft:c,dirty:!0}),e(n(`config:configPage.countModelsAdded`,{count:t.addedModelIds?.length||1}))},[e,r.draft,n]);return{...r,selectedProvider:o,apiKeyInputRef:a,patchDraft:s,selectProvider:c,selectModel:l,selectProviderType:u,toggleProvider:d,deleteProvider:f,save:p,applyImportedProvider:m,applyCreatedProvider:h,applySynchronizedModels:g,applyCreatedModels:_}}function Ut({requestConfirm:e,onImported:t,t:n}){let[r,i]=(0,B.useState)({providers:[],errors:[]}),[a,o]=(0,B.useState)(!0),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``),p=(0,B.useCallback)(async()=>{o(!0),c(``);try{i(await I(`/api/providers/discovery`))}catch(e){c(Q(e))}finally{o(!1)}},[]);return(0,B.useEffect)(()=>{p()},[p]),{discovery:r,discovering:a,error:s,operationError:l,importing:d,refresh:p,importProvider:(0,B.useCallback)(async r=>{let a=r.source===`codex-config`?`Codex config.toml`:r.source===`claude-config`?`Claude settings.json`:r.source===`codex-auth`?`Codex login`:`Claude login`,o=r.kind===`authentication`;if(await e({title:n(o?`config:configPage.loadLoginState`:`config:configPage.loadProviderConfiguration`),message:n(o?`config:configPage.loadOfficialProviderLoginStateFromSource`:`config:configPage.loadThisProviderConfigurationFromSource`,{source:a}),confirmLabel:n(o?`config:configPage.loadLoginState`:`config:configPage.loadConfiguration`)})){f(r.id),u(``);try{let e=await I(`/api/providers/${encodeURIComponent(r.id)}/import`,{method:`POST`,body:`{}`});i(e.discovery),t(e)}catch(e){u(Q(e))}finally{f(``)}}},[t,e,n])}}function Wt({notify:e,registerPrimaryAction:t,requestConfirm:n}){let{t:r}=l(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),[c,u]=(0,B.useState)(`connection`),d=Ht({notify:e,requestConfirm:n,t:r}),f=Ut({requestConfirm:n,onImported:d.applyImportedProvider,t:r});if(ve(t,()=>a(!0)),!d.config||!d.draft||!d.selectedProvider)return(0,V.jsxs)(q,{className:`empty-state`,children:[(0,V.jsx)(F,{className:`spin`,size:24}),(0,V.jsx)(`h2`,{children:r(`config:configPage.loadingModelCatalog`)}),(0,V.jsx)(`p`,{children:r(`config:configPage.readingProvidersAndAuthenticationStatus`)}),d.error&&(0,V.jsx)(`div`,{className:`config-error`,children:d.error})]});let{config:p,draft:m,selectedProvider:h}=d,g=m.providerType===`visual`,_=h.id===`openai-codex`;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Nt,{discovery:f.discovery,discovering:f.discovering,error:f.error||f.operationError,importing:f.importing,onRefresh:f.refresh,onImport:f.importProvider}),(0,V.jsxs)(`div`,{className:`split-list-detail config-layout`,children:[(0,V.jsx)(Ct,{providers:p.providers,selectedProviderId:m.provider,toggling:d.toggling,onAdd:()=>a(!0),onSelect:d.selectProvider,onToggle:d.toggleProvider}),(0,V.jsxs)(`div`,{className:`detail-stack`,children:[(0,V.jsxs)(`div`,{className:`config-tabs`,children:[(0,V.jsx)(`button`,{type:`button`,className:c===`connection`?`active`:``,onClick:()=>u(`connection`),children:r(`config:configPage.connection`)}),(0,V.jsx)(`button`,{type:`button`,className:c===`models`?`active`:``,onClick:()=>u(`models`),children:r(`config:configPage.models`)}),(0,V.jsx)(`button`,{type:`button`,className:c===`policy`?`active`:``,onClick:()=>u(`policy`),children:r(`config:configPage.policy`)})]}),c===`connection`&&(0,V.jsx)(xt,{provider:h,draft:m,toggling:d.toggling,apiKeyInputRef:d.apiKeyInputRef,onPatchDraft:d.patchDraft,onSelectProviderType:d.selectProviderType,onToggleProvider:d.toggleProvider,onDeleteProvider:d.deleteProvider}),c===`models`&&(0,V.jsx)(q,{children:(0,V.jsx)(wt,{provider:h,draft:m,onPatchDraft:d.patchDraft,onSelectModel:d.selectModel,onOpenModelDialog:s})}),c===`policy`&&(0,V.jsxs)(`div`,{className:`config-bottom`,children:[(0,V.jsx)(It,{draft:m,onPatchDraft:d.patchDraft}),(0,V.jsx)(Lt,{provider:h,visualOnly:g,codexOAuth:_,saving:d.saving,dirty:d.dirty,error:d.error,hasModel:!!m.model,isDefault:(p.defaultProvider||p.provider)===h.id&&(p.defaultModel||p.model)===m.model,onSave:d.save})]})]})]}),i&&(0,V.jsx)(Tt,{onClose:()=>a(!1),onCreated:e=>{d.applyCreatedProvider(e),a(!1)}}),o&&(0,V.jsx)(Et,{provider:{...h,type:m.providerType},connectionDraft:{providerType:m.providerType,api:m.api||h.api,baseUrl:m.baseUrl,apiKey:m.apiKey,organization:m.organization},autoDiscover:o===`discover`,onClose:()=>s(``),onSynchronized:d.applySynchronizedModels,onCreated:(e,t)=>{d.applyCreatedModels(e,h.id,t),s(``)}})]})}var Gt={feishu:{tone:`blue`},weixin:{tone:`green`},browser:{tone:`blue`}};function Kt(e,t){return t(e===`feishu`?`config:notificationSettings.feishu`:e===`weixin`?`config:notificationSettings.weChat`:`config:notificationSettings.browserNotification`)}function qt(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompleted`):e===`chat.waiting`?n(`config:notificationSettings.chatWaiting`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompleted`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailed`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompleted`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailed`):t}function Jt(e,t,n){return e===`chat.completed`?n(`config:notificationSettings.chatCompletedDescription`):e===`chat.waiting`?n(`config:notificationSettings.chatWaitingDescription`):e===`schedule.completed`?n(`config:notificationSettings.scheduleCompletedDescription`):e===`schedule.failed`?n(`config:notificationSettings.scheduleFailedDescription`):e===`workflow.completed`?n(`config:notificationSettings.workflowCompletedDescription`):e===`workflow.failed`?n(`config:notificationSettings.workflowFailedDescription`):t}function Yt(e,t){let n={"chat.title":t(`config:notificationSettings.fixChannelNotification`),"chat.summary":t(`config:notificationSettings.implementationIsCompleteTestsAndBuildHavePassed`),"chat.tool":`bash`,"chat.reason":t(`config:notificationSettings.confirmationIsRequired`),"chat.model":`openai/gpt-5.4`,"task.name":t(`config:notificationSettings.dailyCodeReview`),"task.summary":t(`config:notificationSettings.found2IssuesToAddressTheReportHasBeenArchived`),"task.duration":t(`config:notificationSettings.message2Min18Sec`),"task.nextRun":t(`config:notificationSettings.tomorrow0900`),"task.error":t(`config:notificationSettings.testProcessTimedOut`),"workflow.name":t(`config:notificationSettings.preReleaseChecks`),"workflow.summary":t(`config:notificationSettings.testsBuildAndSecurityChecksHaveAllPassed`),"workflow.duration":t(`config:notificationSettings.message6Min42Sec`),"workflow.runId":`run_20260718_001`,"workflow.node":t(`config:notificationSettings.endToEndTests`),"workflow.error":t(`config:notificationSettings.browserFailedToStart`)};return String(e||``).replace(/\{\{\s*([\w.]+)\s*\}\}/g,(e,t)=>n[t]||`{{${t}}}`)}function Xt(){return typeof window<`u`&&window.pisperDesktop?.showNotification?window.pisperDesktop.getNotificationStatus?`checking`:`granted`:ce()}function Zt(e,t){return t(e===`system-disabled`||e===`app-disabled`?`config:notificationSettings.systemNotificationsAreOffAllowPisperToSendNotificationsInYourOperatingSystemSettings`:e===`unsupported`?`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`:`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`)}function $(e){return e instanceof Error?e.message:String(e)}function Qt({notify:e,onBrowserNotificationChange:t}){let{t:n}=l(),[r,i]=(0,B.useState)({browser:{enabled:!1},connections:{},scopes:[],templates:[]}),[a,o]=(0,B.useState)(!0),[s,c]=(0,B.useState)(``),u=!!window.pisperDesktop?.showNotification,[d,f]=(0,B.useState)(Xt),[p,m]=(0,B.useState)(!1),h=(0,B.useCallback)(async()=>{if(!u)return;let e=window.pisperDesktop?.getNotificationStatus;if(!e){f(`granted`);return}try{let t=await e(),n=t?.permission;f(n==="default"||n===`denied`||n===`granted`||n===`checking`||n===`unsupported`?n:t?.supported===!1?`unsupported`:`granted`)}catch{f(`unsupported`)}},[u]),g=(0,B.useCallback)(async()=>{try{c(``);let e=await I(`/api/settings/notifications`);i(e),t?.(e)}catch(e){c($(e))}finally{o(!1)}},[t]);(0,B.useEffect)(()=>{g()},[g]),(0,B.useEffect)(()=>{if(!u)return;h();let e=()=>{h()};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[u,h]);let _=async r=>{if(r){if(d===`unsupported`){e(n(`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`),`error`);return}if(u&&d!==`granted`){e(Zt(`system-disabled`,n),`error`);return}if(!u){let t=await ae();if(f(t),t!==`granted`){e(n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await ue()}catch(t){e($(t)||n(`config:notificationSettings.theBrowserBackgroundNotificationServiceCouldNotBeRegistered`),`error`);return}}}m(!0);try{let a=await I(`/api/settings/notifications/browser`,{method:`PATCH`,body:JSON.stringify({enabled:r})});i(a),t?.(a),e(n(r?`config:notificationSettings.notificationsEnabled`:`config:notificationSettings.notificationsDisabled`))}catch(t){e($(t),`error`)}finally{m(!1)}},v=(0,B.useCallback)(async(e,t,r=`pisper-browser-test`)=>{if(u){let r=window.pisperDesktop?.showNotification;if(!r)throw Error(n(`config:notificationSettings.systemNotificationsAreNotSupportedInThisEnvironment`));let i=await r({title:e,body:t});if(i&&typeof i==`object`&&i.shown===!1)throw f(i.permission??`denied`),Error(Zt(i.reason,n));return i}return ie({title:e,body:t,tag:r,url:window.location.href})},[u,n]),y=async()=>{if(d!==`granted`){e(d===`unsupported`?Zt(`unsupported`,n):u?Zt(`system-disabled`,n):n(`config:notificationSettings.notificationPermissionWasNotGrantedAllowNotificationsInTheBrowserSiteSettings`),`error`);return}try{await v(n(`config:notificationSettings.appNotificationTest`,{app:ye}),n(`config:notificationSettings.notificationsAreWorking`)),e(n(`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`),`info`)}catch(t){e($(t)||n(`config:notificationSettings.theOperatingSystemDidNotAcceptTheNotificationCheckYourSystemNotificationSettings`),`error`)}},b=async()=>{try{await window.pisperDesktop?.openNotificationSettings?.()||e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}catch{e(n(`config:notificationSettings.openNotificationPermissionsInYourOperatingSystemSettings`),`info`)}};if(a)return(0,V.jsxs)(q,{className:`empty-state`,children:[(0,V.jsx)(F,{className:`spin`,size:23}),(0,V.jsx)(`h2`,{children:n(`config:notificationSettings.loadingNotificationSettings`)})]});let x=n(d===`granted`?`config:notificationSettings.permissionGranted`:d===`denied`?u?`config:notificationSettings.systemNotificationsAreOff`:`config:notificationSettings.browserNotificationsAreBlocked`:d===`unsupported`?`config:notificationSettings.notSupported`:d===`checking`?`config:notificationSettings.checking`:`config:notificationSettings.waitingForPermission`),S=d===`granted`?`green`:d==="default"||d===`checking`?`amber`:`red`;return(0,V.jsxs)(`div`,{className:`notification-settings`,children:[s&&(0,V.jsxs)(`div`,{className:`config-error`,children:[(0,V.jsx)(z,{size:13}),s]}),(0,V.jsxs)(q,{className:`browser-notification-card`,children:[(0,V.jsxs)(`div`,{className:`notification-option`,children:[(0,V.jsx)(`span`,{className:`provider-icon ${r.browser.enabled?`blue`:``}`,children:r.browser.enabled?(0,V.jsx)(L,{size:18}):(0,V.jsx)(ot,{size:18})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`strong`,{children:n(`config:notificationSettings.notification`)}),(0,V.jsx)(`small`,{children:n(`config:notificationSettings.pisperUsesTheCurrentPlatformNotificationSystemWhenAnAgentCompletesOrFails`)})]}),(0,V.jsx)(Y,{tone:S,children:x}),(0,V.jsx)(X,{value:r.browser.enabled,disabled:p||d===`unsupported`||d===`checking`,onChange:_})]}),(0,V.jsxs)(`div`,{className:`permission-note`,children:[(0,V.jsx)(k,{size:15}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:n(u?`config:notificationSettings.controlledByOperatingSystemNotificationSettings`:`config:notificationSettings.controlledByBrowserSitePermissions`)}),(0,V.jsx)(`small`,{children:n(u?`config:notificationSettings.theDesktopAppUsesOperatingSystemNotificationsTurningThisOffDoesNotChangeTheOperatingSystemPermis`:`config:notificationSettings.theWebAppUsesBrowserSiteNotificationsTurningThisOffDoesNotChangeTheBrowserPermissionItself`)})]})]}),(0,V.jsxs)(`div`,{className:`button-row`,children:[u&&d===`denied`&&(0,V.jsxs)(`button`,{className:`button secondary`,onClick:b,children:[(0,V.jsx)(k,{size:14}),n(`config:notificationSettings.openSystemNotificationSettings`)]}),(0,V.jsxs)(`button`,{className:`button secondary`,disabled:!r.browser.enabled||d!==`granted`,onClick:y,children:[(0,V.jsx)(L,{size:14}),n(`config:notificationSettings.sendTestNotification`)]})]})]}),(0,V.jsx)($t,{data:r,setData:i,notify:e,permission:d,onBrowserTest:v,onSettingsChange:t})]})}function $t({data:e,setData:t,notify:n,permission:r,onBrowserTest:i,onSettingsChange:a}){let{t:o}=l(),[s,c]=(0,B.useState)(e.templates[0]?.id||``),[u,d]=(0,B.useState)(`feishu`),f=e.templates.find(e=>e.id===s)||e.templates[0],p=f?.channels?.[u],[m,h]=(0,B.useState)(p?.content||``),[g,_]=(0,B.useState)(!1),v=e.scopes.find(e=>e.platform===u),y=u===`browser`?e.browser.enabled&&r===`granted`:!!v,x=Gt;return(0,B.useEffect)(()=>{h(p?.content||``)},[s,u,p?.content]),f?(0,V.jsxs)(`div`,{className:`two-one-grid channel-template-layout`,children:[(0,V.jsxs)(q,{children:[(0,V.jsxs)(`div`,{className:`channel-section-head`,children:[(0,V.jsx)(J,{title:o(`config:notificationSettings.notificationTemplates`)}),(0,V.jsx)(`span`,{children:o(`config:notificationSettings.sharedByChatsScheduledTasksAndWorkflows`)})]}),e.templates.map(e=>(0,V.jsxs)(`button`,{className:`channel-template-row ${e.id===f.id?`selected`:``}`,onClick:()=>c(e.id),children:[(0,V.jsx)(`span`,{className:`route-icon`,children:(0,V.jsx)(b,{size:14})}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:qt(e.id,e.name,o)}),(0,V.jsx)(`small`,{children:Jt(e.id,e.description,o)})]}),(0,V.jsx)(Y,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`config:notificationSettings.enabled`):o(`config:notificationSettings.disabled`)})]},e.id))]}),(0,V.jsxs)(q,{className:`channel-template-editor`,children:[(0,V.jsxs)(`div`,{className:`card-head`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:qt(f.id,f.name,o)}),(0,V.jsx)(`p`,{children:Jt(f.id,f.description,o)})]}),(0,V.jsx)(X,{value:f.enabled,onChange:e=>t(t=>({...t,templates:t.templates.map(t=>t.id===f.id?{...t,enabled:e}:t)}))})]}),(0,V.jsx)(`div`,{className:`channel-template-platforms`,children:Object.entries(x).map(([t,n])=>{let r=t===`browser`?e.browser.enabled:e.connections?.[t];return(0,V.jsxs)(`button`,{className:u===t?`active`:``,onClick:()=>d(t),children:[Kt(t,o),(0,V.jsx)(Y,{tone:r?n.tone:`gray`,children:o(r?t===`browser`?`config:notificationSettings.enabled2`:`config:notificationSettings.connected`:t===`browser`?`config:notificationSettings.notEnabled`:`config:notificationSettings.notConnected`)})]},t)})}),(0,V.jsxs)(`label`,{className:`field-label`,children:[o(`config:notificationSettings.messageContent`),(0,V.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`channel-template-vars`,children:[(0,V.jsx)(`span`,{children:o(`config:notificationSettings.availableVariables`)}),f.variables.map(e=>(0,V.jsx)(`code`,{children:`{{${e}}}`},e))]}),(0,V.jsxs)(`div`,{className:`channel-template-preview`,children:[(0,V.jsx)(`small`,{children:o(`config:notificationSettings.preview`)}),(0,V.jsx)(`pre`,{children:Yt(m,o)})]}),(0,V.jsxs)(`div`,{className:`modal-actions`,children:[(0,V.jsxs)(`button`,{className:`button secondary`,disabled:g||!y,onClick:async()=>{_(!0);try{let e=await I(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}/test`,{method:`POST`,body:`{}`});u===`browser`&&await i?.(e.title||qt(f.id,f.name,o),e.body||e.preview||``,`pisper-template-${f.id}`),n(o(u===`browser`?`config:notificationSettings.theTestNotificationWasSentCheckYourSystemNotificationCenter`:`config:notificationSettings.testNotificationSentToCountChats`,{count:e.sent}))}catch(e){n($(e),`error`)}finally{_(!1)}},children:[(0,V.jsx)(b,{size:14}),o(`config:notificationSettings.sendTest`)]}),(0,V.jsxs)(`button`,{className:`button primary`,disabled:g||!m.trim(),onClick:async()=>{_(!0);try{let e=await I(`/api/settings/notifications/templates/${encodeURIComponent(f.id)}/${u}`,{method:`PUT`,body:JSON.stringify({enabled:f.enabled,content:m})});t(e),a?.(e),n(o(`config:notificationSettings.notificationTemplateSaved`))}catch(e){n($(e),`error`)}finally{_(!1)}},children:[g?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(D,{size:14}),o(`config:notificationSettings.saveTemplate`)]})]})]})]}):null}function en({notify:e}){let{t}=l(),n=window.pisperDesktop,[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``);(0,B.useEffect)(()=>{if(!n?.getCliStatus)return;let e=!0;return n.getCliStatus().then(t=>e&&i(t)).catch(t=>e&&c(t instanceof Error?t.message:String(t))),()=>{e=!1}},[n]);let u=!!(n?.getCliStatus&&n.installCli&&n.uninstallCli),d=async()=>{if(n?.installCli){o(`install`),c(``);try{let r=await n.installCli();i(r),e(t(`config:cliSettings.installedNotification`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(``)}}},f=async()=>{if(n?.uninstallCli){o(`uninstall`),c(``);try{let r=await n.uninstallCli();i(r),e(t(`config:cliSettings.uninstalledNotification`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(``)}}},p=u&&!r,m=u?p?t(`config:cliSettings.checking`):r?.supported?r.needsRepair?t(`config:cliSettings.needsRepair`):r.installed?t(`config:cliSettings.installed`):t(`config:cliSettings.notInstalled`):t(`config:cliSettings.unavailable`):t(`config:cliSettings.unavailable`);return(0,V.jsxs)(q,{className:`language-settings-card cli-settings-card`,children:[(0,V.jsxs)(`div`,{className:`language-settings-heading cli-settings-heading`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(A,{size:19})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{children:t(`config:cliSettings.title`)}),(0,V.jsx)(`p`,{children:t(`config:cliSettings.description`)})]}),(0,V.jsx)(Y,{tone:r?.installed&&!r.needsRepair?`green`:r?.needsRepair?`blue`:`gray`,children:m})]}),r&&(0,V.jsxs)(`div`,{className:`permission-note language-settings-note cli-settings-status`,children:[r.installed&&!r.needsRepair?(0,V.jsx)(oe,{size:16}):(0,V.jsx)(A,{size:16}),(0,V.jsxs)(`span`,{children:[(0,V.jsx)(`strong`,{children:r.installed?t(`config:cliSettings.commandReady`,{command:r.command}):t(`config:cliSettings.commandNotInstalled`,{command:r.command})}),(0,V.jsx)(`small`,{children:r.installPath}),r.installed&&(0,V.jsx)(`small`,{children:r.pathConfigured?t(`config:cliSettings.pathConfigured`):t(`config:cliSettings.pathNeedsRepair`)})]})]}),s&&(0,V.jsx)(`div`,{className:`config-error`,children:s}),u&&(0,V.jsxs)(`div`,{className:`button-row cli-settings-actions`,children:[r?.installed&&(0,V.jsxs)(`button`,{type:`button`,className:`button secondary`,disabled:!!a,onClick:()=>void f(),children:[a===`uninstall`?(0,V.jsx)(F,{className:`spin`,size:14}):(0,V.jsx)(j,{size:14}),t(`config:cliSettings.uninstall`)]}),(!r?.installed||r.needsRepair)&&(0,V.jsxs)(`button`,{type:`button`,className:`button primary`,disabled:!!a||p||r?.supported===!1,onClick:()=>void d(),children:[a===`install`?(0,V.jsx)(F,{className:`spin`,size:14}):r?.needsRepair?(0,V.jsx)(M,{size:14}):(0,V.jsx)(de,{size:14}),r?.needsRepair?t(`config:cliSettings.repair`):t(`config:cliSettings.install`)]})]}),u&&(0,V.jsx)(`small`,{className:`language-settings-storage`,children:t(`config:cliSettings.restartTerminal`)})]})}var tn=`0.5.1`,nn=9e5,rn=2592e6;function an(){try{let e=JSON.parse(localStorage.getItem(v.sponsorDismissals)||`{}`);return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&e[1]>Date.now()))}catch{return{}}}function on(e,t){return e.desktop?`${{win32:`Windows`,darwin:`macOS`,linux:`Linux`}[e.platform]||e.platform} · ${e.arch}`:t(`config:updateSettings.browserMode`)}function sn(e,t){let n=Number(e)||0;if(!n)return`0 B`;let r=[`B`,`KB`,`MB`,`GB`],i=Math.min(r.length-1,Math.floor(Math.log(n)/Math.log(1024)));return`${(n/1024**i).toLocaleString(t,{maximumFractionDigits:1})} ${r[i]}`}function cn({notify:e,update:t}){let{t:n,language:r}=l(),i=t?.info||{desktop:!1,packaged:!1,version:tn,platform:`browser`,arch:``},a=t?.status||{state:`idle`},o=!!i.desktop,[s,c]=(0,B.useState)({version:tn,date:``,notes:``}),[u,d]=(0,B.useState)([]),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(an);(0,B.useEffect)(()=>{let e=!0;return fetch(`/release-notes.json`,{cache:`no-store`}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&c(t)}).catch(()=>{}),()=>{e=!1}},[]),(0,B.useEffect)(()=>{let e=!0,t=(t=!1)=>I(`/api/sponsors/settings-updates?locale=${encodeURIComponent(r)}${t?`&refresh=1`:``}`).then(t=>{e&&d(Array.isArray(t.campaigns)?t.campaigns:[])}).catch(()=>{e&&!t&&d([])});t();let n=window.setInterval(()=>void t(!0),nn);return()=>{e=!1,window.clearInterval(n)}},[r]);let g=e=>{let t={...m,[e]:Date.now()+rn};h(t);try{localStorage.setItem(v.sponsorDismissals,JSON.stringify(t))}catch{}},_=async()=>{if(t){p(`check`);try{await t.check()}finally{p(``)}}},y=()=>t?.openReleases(),b=()=>t?.openUpdateLog?.(),C=async()=>{p(o?`install`:``);try{o?await t?.installComponents():await t?.download()}catch(t){e(t instanceof Error?t.message:String(t),`error`)}finally{p(``)}},w=()=>t?.install(),T=a.notes||(o?s.notes||n(`config:updateSettings.noReleaseNotesAreAvailableForThisVersion`):a.state===`current`?n(`config:updateSettings.theCurrentWebSourceIsSyncedWithBranch`,{branch:a.branch||`main`}):n(`config:updateSettings.commitsThatHaveNotBeenSyncedWillAppearHereAfterTheCheck`)),E=a.state===`available`,D=a.state===`error`&&a.canResume&&a.canDownload,O=a.state===`downloaded`,k=a.state===`checking`||f===`check`,A=a.state===`downloading`||f===`install`,j=k?`checking`:A?`downloading`:a.state,M=o?`v${i.version}`:`v${i.version}${a.currentCommit?` · ${a.currentCommit.slice(0,7)}`:``}`,N=o?`v${a.availableVersion||s.version||i.version}`:a.availableCommit?.slice(0,7)||a.currentCommit?.slice(0,7)||s.version||i.version,P=u.filter(e=>(m[e.id]||0)<=Date.now()),re=(0,B.useMemo)(()=>{let e=new Map(t.components.map(e=>[e.component,e]));return[`desktop`,`tui`,`runtime`].map(t=>e.get(t)||{component:t,state:`idle`,currentVersion:t===`desktop`?i.version:`--`,availableVersion:``,message:``,releaseUrl:``,notes:``,size:0,transferred:0,canInstall:!1,restartRequired:!1})},[i.version,t.components]),ie=(0,B.useMemo)(()=>({idle:[n(`config:updateSettings.notChecked`),`gray`],checking:[n(`config:updateSettings.checking`),`blue`],current:[n(`config:updateSettings.upToDate`),`green`],available:[n(o?`config:updateSettings.updateAvailable`:`config:updateSettings.sourceUpdatesAvailable`),`blue`],downloading:[n(`config:updateSettings.downloading`),`blue`],downloaded:[n(`config:updateSettings.readyToRestart`),`green`],installed:[n(`config:updateSettings.upToDate`),`green`],error:[n(D?`config:updateSettings.downloadPaused`:`config:updateSettings.checkFailed`),`red`]})[j]||[n(`config:updateSettings.notChecked`),`gray`],[o,j,D,n]);return(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[880px] flex-col gap-3`,children:[(0,V.jsxs)(q,{className:`p-5`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(pt,{size:19})}),(0,V.jsx)(`span`,{className:`min-w-0`,children:(0,V.jsx)(`strong`,{className:`block text-[16px]`,children:n(`config:updateSettings.pisperAppUpdates`)})})]}),(0,V.jsx)(Y,{tone:ie[1],children:ie[0]})]}),(0,V.jsxs)(`div`,{className:`mt-5 grid gap-2 sm:grid-cols-3`,children:[(0,V.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,V.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(o?`config:updateSettings.currentVersion`:`config:updateSettings.currentSource`)}),(0,V.jsx)(`strong`,{className:`mt-1 block font-mono text-[14px]`,children:M})]}),(0,V.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,V.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.platform`)}),(0,V.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:on(i,n)})]}),(0,V.jsxs)(`div`,{className:`rounded-[var(--r-sm)] bg-[var(--surface-muted)] p-3`,children:[(0,V.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.updateChannel`)}),(0,V.jsx)(`strong`,{className:`mt-1 block text-[14px]`,children:o?`Stable`:a.branch||`main`})]})]}),a.message&&(0,V.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-[var(--r-sm)] p-3 text-[13px] ${a.state===`error`?`bg-[var(--danger-soft)] text-[var(--danger)]`:`bg-[var(--accent-soft)] text-[var(--text)]`}`,children:[a.state===`error`?(0,V.jsx)(z,{className:`mt-0.5 shrink-0`,size:15}):(0,V.jsx)(ft,{className:`mt-0.5 shrink-0`,size:15}),(0,V.jsx)(`span`,{children:a.message})]}),D&&(0,V.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:n(`config:updateSettings.downloadedDataWasPreservedAndCanResumeFromTheInterruptionPoint`)}),A&&(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsxs)(`div`,{className:`flex justify-between text-[12px] text-[var(--text-muted)]`,children:[(0,V.jsx)(`span`,{children:n(`config:updateSettings.downloadProgress`)}),(0,V.jsxs)(`span`,{children:[Math.round(a.percent||0),`% · `,sn(a.transferred,r),` /`,` `,sn(a.total,r)]})]}),(0,V.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--progress-track)]`,children:(0,V.jsx)(`i`,{className:`block h-full bg-[var(--star)] transition-[width]`,style:{width:`${a.percent||0}%`}})})]}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,V.jsxs)(`button`,{className:`button primary`,disabled:k||A||!!f,onClick:O?w:E||D?C:_,children:[k||A?(0,V.jsx)(F,{className:`spin`,size:14}):O?(0,V.jsx)(ne,{size:14}):E||D?a.canDownload?(0,V.jsx)(de,{size:14}):(0,V.jsx)(R,{size:14}):(0,V.jsx)(F,{size:14}),k||A?n(A&&o?`config:updateSettings.installingUpdates`:`config:updateSettings.checking2`):O?n(`config:updateSettings.restartAndInstall`):D?n(`config:updateSettings.resumeDownload`):E?a.canDownload?n(o?`config:updateSettings.downloadAndInstallUpdates`:`config:updateSettings.downloadUpdate`):n(o?`config:updateSettings.viewRelease`:`config:updateSettings.viewSourceUpdates`):n(`config:updateSettings.checkForUpdates`)]}),(0,V.jsxs)(`button`,{className:`button secondary`,onClick:y,children:[(0,V.jsx)(R,{size:14}),o?`GitHub Releases`:`GitHub Compare`]}),o&&(0,V.jsxs)(`button`,{className:`button secondary`,onClick:b,children:[(0,V.jsx)(R,{size:14}),n(`config:updateSettings.viewUpdateDiagnosticLog`)]})]}),(0,V.jsxs)(`div`,{className:`mt-6 border-t border-[var(--border)] pt-5`,children:[(0,V.jsx)(J,{title:n(`config:updateSettings.appComponents`)}),(0,V.jsx)(`div`,{className:`mt-3 divide-y divide-[var(--border)]`,children:re.map(e=>{let t=e.component===`desktop`?ft:e.component===`tui`?ee:st,i=e.component===`desktop`?n(`config:updateSettings.desktopFrontend`):e.component===`tui`?n(`config:updateSettings.tuiClient`):n(`config:updateSettings.runtime`),a=e.state===`error`?`red`:e.state===`available`?`blue`:e.state===`installed`||e.state===`current`?`green`:`gray`,o=e.state===`checking`?n(`config:updateSettings.checking`):e.state===`downloading`?n(`config:updateSettings.downloading`):e.state===`available`?n(`config:updateSettings.updateAvailable`):e.state===`installed`?n(`config:updateSettings.installed`):e.state===`error`?n(`config:updateSettings.checkFailed`):e.state===`current`?n(`config:updateSettings.upToDate`):n(`config:updateSettings.notChecked`);return(0,V.jsxs)(`div`,{className:`grid min-h-[68px] items-center gap-3 py-3 sm:grid-cols-[minmax(0,1fr)_auto_auto]`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(t,{className:`shrink-0 text-[var(--text-muted)]`,size:17}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`strong`,{className:`block text-[14px]`,children:i}),e.message&&(0,V.jsx)(`small`,{className:`mt-0.5 block text-[12px] text-[var(--text-muted)]`,children:e.message})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[12px]`,children:[(0,V.jsxs)(`span`,{children:[`v`,e.currentVersion]}),e.availableVersion&&e.availableVersion!==e.currentVersion&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{size:12}),(0,V.jsxs)(`span`,{children:[`v`,e.availableVersion]})]}),e.size>0&&e.state===`available`&&(0,V.jsx)(`span`,{className:`font-sans text-[var(--text-muted)]`,children:sn(e.size,r)})]}),(0,V.jsx)(Y,{tone:a,children:o})]},e.component)})})]})]}),(0,V.jsx)(en,{notify:e}),(0,V.jsxs)(q,{className:`p-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(J,{title:n(o?E||D||O||A?`config:updateSettings.newVersionReleaseNotes`:`config:updateSettings.currentReleaseNotes`:E?`config:updateSettings.commitsToSync`:`config:updateSettings.currentSourceStatus`)}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] text-[var(--text-muted)]`,children:[(0,V.jsx)(oe,{size:13}),E||D||O||A?N:o?`v${s.version||i.version}`:a.currentCommit?.slice(0,7)||n(`config:updateSettings.notChecked`)]})]}),(a.releaseDate||o&&s.date)&&(0,V.jsx)(`small`,{className:`mt-2 block text-[12px] text-[var(--text-muted)]`,children:new Intl.DateTimeFormat(r,{dateStyle:`long`}).format(new Date(a.releaseDate||s.date))}),(0,V.jsx)(`div`,{className:`mt-4 rounded-[var(--r-sm)] border border-[var(--stroke-soft)] bg-[var(--surface-subtle)] p-4`,children:(0,V.jsx)(S,{children:T})})]}),P.length>0&&(0,V.jsxs)(q,{className:`p-5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,V.jsx)(`span`,{className:`language-settings-icon`,children:(0,V.jsx)(lt,{size:19})}),(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(J,{title:n(`config:updateSettings.sponsors`)}),(0,V.jsx)(`small`,{className:`mt-1 block text-[12px] leading-5 text-[var(--text-muted)]`,children:n(`config:updateSettings.sponsorsDescription`)})]})]}),(0,V.jsx)(`div`,{className:`mt-4 divide-y divide-[var(--stroke-soft)] border-y border-[var(--stroke-soft)]`,children:P.map(e=>(0,V.jsxs)(`div`,{className:`grid min-h-16 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 py-3`,children:[(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsxs)(`span`,{className:`mb-1 flex items-center gap-2`,children:[(0,V.jsx)(`strong`,{className:`truncate text-[14px]`,children:e.name}),(0,V.jsx)(Y,{tone:`gray`,children:n(`config:updateSettings.sponsored`)})]}),(0,V.jsx)(`small`,{className:`block text-[12px] leading-5 text-[var(--text-muted)]`,children:e.description})]}),(0,V.jsxs)(`a`,{className:`button secondary tiny`,href:e.href,target:`_blank`,rel:`noopener noreferrer sponsored`,children:[(0,V.jsx)(R,{size:13}),n(`config:updateSettings.visitSponsor`)]}),(0,V.jsx)(`button`,{type:`button`,className:`icon-button shrink-0`,"aria-label":n(`config:updateSettings.hideSponsor`),title:n(`config:updateSettings.hideSponsor`),onClick:()=>g(e.id),children:(0,V.jsx)(te,{size:15})})]},e.id))})]})]})}function ln({notify:e,registerPrimaryAction:t,section:n,onBrowserNotificationChange:r,requestConfirm:i,update:a}){let o;return o=n===`notifications`?(0,V.jsx)(Qt,{notify:e,onBrowserNotificationChange:r}):n===`interface`?(0,V.jsx)(yt,{notify:e}):n===`desktop-pet`?(0,V.jsx)(_t,{notify:e}):n===`updates`?(0,V.jsx)(cn,{notify:e,update:a}):(0,V.jsx)(Wt,{notify:e,registerPrimaryAction:t,requestConfirm:i}),o}export{ln as ConfigPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./use-i18n-CubNtfu7.js";import{n as i}from"./AppSelect--dqy70Zh.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./createLucideIcon-BEEvpXLl.js";import{t as s}from"./copy-O4BLU533.js";import{n as c,r as l,t as u}from"./vendor-markdown-plugins-ERG5SnGL.js";import{n as d,r as f,t as p}from"./vendor-markdown-lQaMEIxc.js";var m=o(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),h=o(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),g=e(t(),1),_=c({themes:[`github-dark`,`github-dark`]}),v={cjk:l,code:_,math:u},y=n(),b={a:E,code:j,img:D,strong:O,table:k},x=!1,S={linkMode:`text-only`};function C(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(C).join(``):(0,g.isValidElement)(e)?C(e.props.children):``}function w(e){return String(e||``).match(/language-([\w-]+)/)?.[1]||`text`}function T(e){if(navigator.clipboard?.writeText)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);return t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select(),document.execCommand(`copy`),t.remove(),Promise.resolve()}function E({children:e,node:t,className:n,href:r,...i}){let o=C(e).trim()?e:r;return r?(0,y.jsx)(`a`,{...i,className:a(`markdown-link`,n),href:r,target:`_blank`,rel:`noopener noreferrer`,children:o}):(0,y.jsx)(`span`,{className:a(`markdown-link`,n),children:o})}function D({node:e,...t}){return(0,y.jsx)(`img`,{loading:`lazy`,...t})}function O({node:e,...t}){return(0,y.jsx)(`strong`,{...t})}function k({node:e,...t}){return(0,y.jsx)(`table`,{...t})}function A({source:e}){let{t}=r(),[n,a]=(0,g.useState)(!1);return(0,y.jsxs)(`button`,{type:`button`,"data-streamdown":`code-block-copy-button`,onClick:async()=>{try{await T(e),a(!0),window.setTimeout(()=>a(!1),1800)}catch{a(!1)}},"aria-label":t(`common:markdownMessage.copyCode`),title:t(`common:markdownMessage.copyCode`),children:[n?(0,y.jsx)(i,{size:13}):(0,y.jsx)(s,{size:13}),t(n?`common:markdownMessage.copied`:`common:markdownMessage.copy`)]})}function j({children:e,className:t,node:n,...r}){let i=f();if(!Object.hasOwn(r,`data-block`))return(0,y.jsx)(`code`,{className:t||``,...r,children:e});let a=C(e).replace(/\n$/,``),o=w(t);return(0,y.jsx)(d,{code:a,isIncomplete:i,language:o,lineNumbers:!1,children:(0,y.jsx)(A,{source:a})})}function M({children:e,className:t,streaming:n=!1}){let r=String(e??``);return(0,y.jsx)(`div`,{className:a(`markdown-body`,n&&`markdown-streaming`,t),"aria-busy":n||void 0,children:(0,y.jsx)(p,{className:`markdown-content space-y-0`,components:b,controls:x,isAnimating:n,lineNumbers:!1,mode:`streaming`,plugins:v,remend:S,children:r})})}var N=(0,g.memo)(M);N.displayName=`MarkdownMessage`;export{h as n,m as r,N as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./use-i18n-CubNtfu7.js";import{n as i,t as a}from"./AppSelect--dqy70Zh.js";import{t as o}from"./createLucideIcon-BEEvpXLl.js";import{t as s}from"./chevron-down-DybEa6xm.js";import{t as c}from"./file-code-corner-lCJOIDbw.js";import{t as l}from"./pencil-DpO4AUNy.js";import{t as u}from"./plus-CI2ql0x4.js";import{t as d}from"./trash-2-CATziWCd.js";import{G as f,Z as p,at as m,b as h}from"./index-DoRSkbHW.js";import{n as g,t as _}from"./app-primitives-B_kzSTuJ.js";import{t as v}from"./StarOrbit-BlI6MhVr.js";import{t as ee}from"./usePagePrimaryAction-Bw0OFTDZ.js";var te=o(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),ne=o(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),y=e(t(),1),b=n(),x={width:600,height:420,cx:300,cy:206},S=24,C=Math.PI*(3-Math.sqrt(5)),w=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`];function T(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}var re={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`};function E(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function ie(e,t){let n=e.slice(0,S);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:x.cx,y:x.cy,twinkle:0}];let r=E(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=E(e.id),a=t*C+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:x.cx+Math.cos(a)*o*1.38,y:x.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function D(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function O(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function ae(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function k(e){return e instanceof Error?e.message:String(e)}function A({notify:e,query:t=``,registerPrimaryAction:n,requestConfirm:a}){let{t:o,language:s}=r(),[S,C]=(0,y.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[A,j]=(0,y.useState)(``),[M,N]=(0,y.useState)(``),[ce,P]=(0,y.useState)(!0),[F,I]=(0,y.useState)(``),[le,L]=(0,y.useState)(1),[R,z]=(0,y.useState)(null),[B,V]=(0,y.useState)(null),[ue,H]=(0,y.useState)(``),[U,W]=(0,y.useState)(``),G=(0,y.useRef)(null),K=(0,y.useRef)(0);ee(n,()=>z({spaceId:A||S.selectedSpaceId}));let de=e=>{let t=G.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(K.current),K.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},fe=()=>{cancelAnimationFrame(K.current),G.current?.style.setProperty(`--px`,`0`),G.current?.style.setProperty(`--py`,`0`)},q=(0,y.useCallback)(async(e=``)=>{P(!0),I(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),t.trim()&&n.set(`query`,t.trim());let r=await h(`/api/memory?${n}`);C(r),j(r.selectedSpaceId||``),N(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){I(k(e))}finally{P(!1)}},[t]);(0,y.useEffect)(()=>{q(A)},[q,A]);let J=S.nodes.find(e=>e.id===M)||null,Y=(0,y.useMemo)(()=>ie(S.nodes,A),[S.nodes,A]),X=(0,y.useMemo)(()=>new Map(Y.map(e=>[e.node.id,e])),[Y]),Z=(0,y.useMemo)(()=>{let e=new Set(Y.map(e=>e.node.id));return S.links.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[Y,S.links]),pe=new Set(S.links.flatMap(e=>e.sourceId===M?[e.targetId]:e.targetId===M?[e.sourceId]:[])),Q=ue||M,me=new Set(S.links.flatMap(e=>e.sourceId===Q?[e.targetId]:e.targetId===Q?[e.sourceId]:[])),he=S.nodes.filter(e=>e.type===`file`&&(pe.has(e.id)||e.id===M)),$=S.spaces.find(e=>e.id===A),ge=async t=>{if(await a({title:o(`memory:memoryPage.deleteMemory`),message:o(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:o(`memory:memoryPage.delete`)}))try{await h(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(o(`memory:memoryPage.memoryDeleted`)),await q(A)}catch(e){I(k(e))}},_e=async(t,n)=>{if(!U){W(t.id),I(``);try{await h(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(o(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await q(A)}catch(e){I(k(e))}finally{W(``)}}};return(0,b.jsxs)(`div`,{className:`memory-layout`,children:[(0,b.jsxs)(`div`,{className:`memory-left-stack`,children:[(0,b.jsxs)(_,{className:`wiki-panel`,children:[(0,b.jsxs)(`div`,{className:`card-head`,children:[(0,b.jsx)(g,{title:o(`memory:memoryPage.memorySpaces`)}),(0,b.jsx)(`button`,{className:`icon-button`,title:o(`memory:memoryPage.newMemorySpace`),onClick:()=>V({}),children:(0,b.jsx)(u,{size:13})})]}),S.spaces.map(e=>(0,b.jsxs)(`button`,{className:e.id===A?`active`:``,onClick:()=>{j(e.id),N(``)},children:[(0,b.jsx)(`span`,{children:O(e,o)}),(0,b.jsx)(`small`,{children:o(`memory:memoryPage.countMemories`,{count:e.nodeCount})}),(0,b.jsx)(m,{size:13})]},e.id)),$&&(0,b.jsxs)(`div`,{className:`memory-space-actions`,children:[(0,b.jsxs)(`button`,{onClick:()=>V($),children:[(0,b.jsx)(l,{size:12}),o(`memory:memoryPage.rename`)]}),$.kind!==`global`&&(0,b.jsxs)(`button`,{className:`danger`,onClick:async()=>{if($&&await a({title:o(`memory:memoryPage.deleteMemorySpace`),message:o(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:O($,o)}),confirmLabel:o(`memory:memoryPage.delete`)}))try{await h(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),j(``),N(``),e(o(`memory:memoryPage.memorySpaceDeleted`))}catch(e){I(k(e))}},children:[(0,b.jsx)(d,{size:12}),o(`memory:memoryPage.delete`)]})]})]}),(0,b.jsxs)(_,{className:`memory-legend-panel`,children:[(0,b.jsx)(g,{title:o(`memory:memoryPage.memoryMapTypes`)}),(0,b.jsx)(`div`,{className:`galaxy-legend`,children:w.map(e=>(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`i`,{className:`g-dot g-${e}`}),T(e,o)]},e))})]}),(0,b.jsxs)(_,{className:`memory-candidates-panel`,children:[(0,b.jsxs)(`div`,{className:`card-head`,children:[(0,b.jsx)(g,{title:`${o(`memory:memoryPage.memoryDrafts`)} · ${S.candidates?.length||0}`}),!!S.candidates?.length&&(0,b.jsxs)(`button`,{className:`button secondary tiny`,disabled:!!U,onClick:async()=>{if(!(U||!S.candidates?.length)){W(`__all__`),I(``);try{let t=await h(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(o(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await q(A)}catch(e){I(k(e))}finally{W(``)}}},children:[(0,b.jsx)(f,{size:12}),o(`memory:memoryPage.ignoreAll`)]})]}),(0,b.jsxs)(`div`,{className:`memory-candidate-list`,children:[(S.candidates||[]).map(e=>(0,b.jsxs)(`div`,{className:`memory-candidate`,children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsxs)(`small`,{children:[O(S.spaces.find(t=>t.id===e.spaceId),o),` · `,e.sourceType===`agent`?o(`memory:memoryPage.agentProposed`):o(`memory:memoryPage.conversationExtracted`),` · `,o(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),(0,b.jsx)(`span`,{children:e.content}),e.topicKey&&(0,b.jsxs)(`small`,{children:[o(`memory:memoryPage.topic`),`:`,e.topicKey]}),e.evidence&&(0,b.jsxs)(`small`,{children:[o(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,b.jsxs)(`small`,{children:[o(`memory:memoryPage.created`),`:`,D(e.createdAt,s),e.expiresAt?` · ${o(`memory:memoryPage.expires`)}:${D(e.expiresAt,s)}`:``]}),(0,b.jsxs)(`div`,{children:[(0,b.jsxs)(`button`,{disabled:!!U,title:o(`memory:memoryPage.confirm`),onClick:()=>_e(e,`accept`),children:[(0,b.jsx)(i,{size:12}),o(`memory:memoryPage.confirm`)]}),(0,b.jsxs)(`button`,{disabled:!!U,className:`danger`,title:o(`memory:memoryPage.ignore`),onClick:()=>_e(e,`reject`),children:[(0,b.jsx)(f,{size:12}),o(`memory:memoryPage.ignore`)]})]})]},e.id)),!S.candidates?.length&&(0,b.jsx)(`small`,{children:o(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]})]}),(0,b.jsxs)(_,{className:`graph-panel galaxy-panel`,onPointerMove:de,onPointerLeave:fe,children:[(0,b.jsxs)(`div`,{className:`graph-toolbar`,children:[(0,b.jsx)(`button`,{title:o(`memory:memoryPage.addMemory`),onClick:()=>z({spaceId:A}),children:(0,b.jsx)(u,{size:14})}),(0,b.jsx)(`button`,{title:o(`memory:memoryPage.zoomIn`),onClick:()=>L(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,b.jsx)(ne,{size:13})}),(0,b.jsx)(`button`,{title:o(`memory:memoryPage.zoomOut`),onClick:()=>L(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,b.jsx)(te,{size:13})}),(0,b.jsx)(`button`,{title:o(`memory:memoryPage.refresh`),onClick:()=>q(A),children:(0,b.jsx)(p,{className:ce?`spin`:``,size:13})})]}),(0,b.jsxs)(`div`,{className:`galaxy-stage ${Q?`has-focus`:``}`,ref:G,style:{transform:`scale(${le})`},children:[(0,b.jsx)(`i`,{className:`galaxy-spiral`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-core`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-aurora galaxy-aurora-one`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-aurora galaxy-aurora-two`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-aurora galaxy-aurora-three`,"aria-hidden":`true`}),(0,b.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,b.jsxs)(`g`,{className:`galaxy-orbits`,children:[(0,b.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,b.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,b.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,b.jsx)(`defs`,{children:Z.map((e,t)=>{let n=X.get(e.sourceId),r=X.get(e.targetId);return!n||!r?null:(0,b.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,b.jsx)(`stop`,{offset:`0`,stopColor:re[n.node.type]||`var(--galaxy-line-active)`}),(0,b.jsx)(`stop`,{offset:`1`,stopColor:re[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),Z.map((e,t)=>{let n=X.get(e.sourceId),r=X.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===Q||e.targetId===Q,a=ae(n,r,E(e.id));return(0,b.jsxs)(`g`,{children:[(0,b.jsx)(`path`,{className:`link-path ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,b.jsx)(`circle`,{className:`link-pulse`,r:`2.1`,children:(0,b.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,b.jsx)(`i`,{className:`galaxy-meteor`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-meteor meteor-two`,"aria-hidden":`true`}),(0,b.jsx)(`i`,{className:`galaxy-meteor meteor-three`,"aria-hidden":`true`}),Y.map(({node:e,x:t,y:n,twinkle:r},i)=>(0,b.jsxs)(`button`,{className:`galaxy-star star-${e.type} ${M===e.id?`active`:``} ${Q&&e.id!==Q&&!me.has(e.id)?`dimmed`:``}`,onClick:()=>N(e.id),onMouseEnter:()=>H(e.id),onMouseLeave:()=>H(``),style:{left:`${t/x.width*100}%`,top:`${n/x.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${i*55}ms`,"--depth":E(e.id)%100/100},title:e.content,children:[M===e.id&&(0,b.jsx)(`i`,{className:`orbit-ring`,"aria-hidden":`true`}),M===e.id&&(0,b.jsx)(`i`,{className:`dash-ring`,"aria-hidden":`true`}),(0,b.jsxs)(`svg`,{className:`star-core`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,b.jsx)(`path`,{className:`star-ray`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,b.jsx)(`path`,{className:`star-shape`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,b.jsx)(`circle`,{className:`star-heart`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,b.jsx)(`span`,{className:`star-label`,children:e.title})]},e.id))]}),!!Y.length&&(0,b.jsxs)(`span`,{className:`galaxy-count`,children:[`✦`,` `,o(`memory:memoryPage.visibleTotalMemories`,{visible:Y.length,total:S.nodes.length})]}),!ce&&!Y.length&&(0,b.jsxs)(`div`,{className:`memory-empty`,children:[(0,b.jsx)(v,{size:44}),(0,b.jsx)(`span`,{children:o(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]}),(0,b.jsxs)(`div`,{className:`detail-stack`,children:[(0,b.jsxs)(_,{children:[(0,b.jsx)(g,{title:o(`memory:memoryPage.selectedMemory`)}),J?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{children:J.title}),(0,b.jsx)(`p`,{className:`muted-copy`,children:J.content}),(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.memoryType`)}),(0,b.jsxs)(`strong`,{className:`type-with-dot`,children:[(0,b.jsx)(`i`,{className:`g-dot g-${J.type}`}),T(J.type,o)]})]}),(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.source`)}),(0,b.jsx)(`strong`,{children:J.sourceType===`conversation_confirmed`?o(`memory:memoryPage.userConfirmedConversationCandidate`):J.sourceType===`user_confirmed`?o(`memory:memoryPage.explicitUserRequest`):J.sourceType===`agent`?o(`memory:memoryPage.createdByAgent`):o(`memory:memoryPage.addedManually`)})]}),(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.authority`)}),(0,b.jsxs)(`strong`,{children:[J.authority??0,`/100`]})]}),J.evidence&&(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.evidence`)}),(0,b.jsx)(`strong`,{children:J.evidence})]}),(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.created`)}),(0,b.jsx)(`strong`,{children:D(J.createdAt,s)})]}),(0,b.jsxs)(`div`,{className:`key-value`,children:[(0,b.jsx)(`span`,{children:o(`memory:memoryPage.relatedMemories`)}),(0,b.jsx)(`strong`,{children:o(`memory:memoryPage.count`,{count:pe.size})})]}),(0,b.jsxs)(`div`,{className:`button-row`,children:[(0,b.jsxs)(`button`,{className:`button primary`,onClick:()=>z(J),children:[(0,b.jsx)(l,{size:14}),o(`memory:memoryPage.edit`)]}),(0,b.jsxs)(`button`,{className:`button danger`,onClick:()=>ge(J),children:[(0,b.jsx)(d,{size:14}),o(`memory:memoryPage.delete`)]})]})]}):(0,b.jsx)(`p`,{className:`muted-copy`,children:o(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)}),F&&(0,b.jsx)(`div`,{className:`config-error`,children:F})]}),(0,b.jsxs)(_,{children:[(0,b.jsx)(g,{title:o(`memory:memoryPage.relatedFiles`)}),he.map(e=>(0,b.jsxs)(`div`,{className:`file-row`,children:[(0,b.jsx)(c,{size:15}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`strong`,{children:e.title}),(0,b.jsx)(`small`,{children:e.sourcePath||e.cwd||o(`memory:memoryPage.localMemory`)})]}),(0,b.jsx)(`button`,{onClick:()=>N(e.id),children:o(`memory:memoryPage.view`)}),(0,b.jsx)(`button`,{onClick:()=>z(e),children:(0,b.jsx)(l,{size:13})}),(0,b.jsx)(`button`,{className:`danger`,onClick:()=>ge(e),children:(0,b.jsx)(d,{size:13})})]},e.id)),!he.length&&(0,b.jsx)(`p`,{className:`muted-copy`,children:o(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]}),R&&(0,b.jsx)(oe,{spaces:S.spaces,node:R.id?R:null,initialSpaceId:R.spaceId||A,onClose:()=>z(null),onSaved:async t=>{z(null),e(t),await q(A)}}),B&&(0,b.jsx)(se,{space:B.id?B:null,onClose:()=>V(null),onSaved:async(t,n)=>{V(null),j(t.id),e(n)}})]})}function oe({spaces:e,node:t,initialSpaceId:n,onClose:i,onSaved:o}){let{t:c}=r(),[u,d]=(0,y.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[m,g]=(0,y.useState)(!1),[_,v]=(0,y.useState)(``);return(0,b.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,b.jsxs)(`form`,{className:`modal`,onSubmit:async e=>{e.preventDefault(),g(!0),v(``);try{await h(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(u)}),await o(c(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){v(k(e))}finally{g(!1)}},children:[(0,b.jsxs)(`div`,{className:`card-head`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{children:c(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,b.jsx)(`p`,{children:c(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,b.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":c(`memory:memoryPage.closeDialog`),onClick:i,children:(0,b.jsx)(f,{size:17})})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.memorySpace`),(0,b.jsxs)(`span`,{className:`select-wrap`,children:[(0,b.jsx)(a,{value:u.spaceId,onChange:e=>d({...u,spaceId:e.target.value}),children:e.map(e=>(0,b.jsx)(`option`,{value:e.id,children:O(e,c)},e.id))}),(0,b.jsx)(s,{size:13})]})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.memoryTitle`),(0,b.jsx)(`input`,{value:u.title,onChange:e=>d({...u,title:e.target.value}),placeholder:c(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.memoryContent`),(0,b.jsx)(`textarea`,{value:u.content,onChange:e=>d({...u,content:e.target.value}),placeholder:c(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,b.jsxs)(`div`,{className:`form-grid`,children:[(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.memoryType`),(0,b.jsxs)(`span`,{className:`select-wrap`,children:[(0,b.jsx)(a,{value:u.type,onChange:e=>d({...u,type:e.target.value}),children:w.map(e=>(0,b.jsx)(`option`,{value:e,children:T(e,c)},e))}),(0,b.jsx)(s,{size:13})]})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.importance`),(0,b.jsxs)(`span`,{className:`select-wrap`,children:[(0,b.jsxs)(a,{value:u.importance,onChange:e=>d({...u,importance:Number(e.target.value)}),children:[(0,b.jsx)(`option`,{value:`0.3`,children:c(`memory:memoryPage.normal`)}),(0,b.jsx)(`option`,{value:`0.5`,children:c(`memory:memoryPage.common`)}),(0,b.jsx)(`option`,{value:`0.8`,children:c(`memory:memoryPage.important`)}),(0,b.jsx)(`option`,{value:`1`,children:c(`memory:memoryPage.strict`)})]}),(0,b.jsx)(s,{size:13})]})]})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[c(`memory:memoryPage.relatedFilePath`),(0,b.jsx)(`input`,{value:u.sourcePath,onChange:e=>d({...u,sourcePath:e.target.value}),placeholder:c(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),_&&(0,b.jsx)(`div`,{className:`config-error`,children:_}),(0,b.jsxs)(`div`,{className:`modal-actions`,children:[(0,b.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:i,children:c(`memory:memoryPage.cancel`)}),(0,b.jsxs)(`button`,{className:`button primary`,disabled:m||!u.spaceId||!u.title.trim()||!u.content.trim(),children:[m?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(l,{size:14}),c(m?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function se({space:e,onClose:t,onSaved:n}){let{t:i}=r(),[a,o]=(0,y.useState)(e?.name||``),[s,c]=(0,y.useState)(!1),[l,d]=(0,y.useState)(``);return(0,b.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:e=>e.target===e.currentTarget&&t(),children:(0,b.jsxs)(`form`,{className:`modal`,onSubmit:async t=>{t.preventDefault(),c(!0),d(``);try{await n(await h(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:a,kind:`custom`})}),i(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){d(k(e))}finally{c(!1)}},children:[(0,b.jsxs)(`div`,{className:`card-head`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`h2`,{children:i(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,b.jsx)(`p`,{children:i(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,b.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":i(`memory:memoryPage.closeDialog`),onClick:t,children:(0,b.jsx)(f,{size:17})})]}),(0,b.jsxs)(`label`,{className:`field-label`,children:[i(`memory:memoryPage.memorySpaceName`),(0,b.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:i(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,b.jsx)(`div`,{className:`config-error`,children:l}),(0,b.jsxs)(`div`,{className:`modal-actions`,children:[(0,b.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:t,children:i(`memory:memoryPage.cancel`)}),(0,b.jsxs)(`button`,{className:`button primary`,disabled:s||!a.trim(),children:[s?(0,b.jsx)(p,{className:`spin`,size:14}):(0,b.jsx)(u,{size:14}),i(s?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{A as MemoryPage};
@@ -0,0 +1 @@
1
+ import{t as e}from"./vendor-react-CHuvPdJE.js";import{t}from"./use-i18n-CubNtfu7.js";import{t as n}from"./createLucideIcon-BEEvpXLl.js";import{t as r}from"./link-2-Dd2E7M_B.js";import{t as i}from"./play-3QiwbcM7.js";import{t as a}from"./plus-CI2ql0x4.js";import{t as o}from"./save-D--1z1bw.js";import{t as s}from"./search-CVBbTPAG.js";import{t as c}from"./square-terminal-C9TjK-fA.js";import{t as l}from"./square-C7qN58NE.js";import{X as u,p as d}from"./index-DoRSkbHW.js";var f=n(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),p=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),m=n(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),h=n(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),g=e(),_={system:f,light:h,dark:m};function v({meta:e,page:n,query:f,setQuery:m,configSection:h,onMenu:v,onPrimary:y,theme:b,onCycleTheme:x,searchInputRef:S,workflowActions:C,desktopPlatform:w,terminalOpen:T,onToggleTerminal:E}){let{t:D}=t(),O={chatHistory:[D(`navigation:pageHeader.newChat`),a],assets:[D(`navigation:pageHeader.addLink`),r],channels:[D(`navigation:pageHeader.connectChannel`),a],schedules:[D(`navigation:pageHeader.newTask`),a],config:[D(`navigation:pageHeader.addProvider`),a],plugins:[D(`navigation:pageHeader.savePolicy`),o],memory:[D(`navigation:pageHeader.addMemory`),a],mcp:[D(`navigation:pageHeader.addService`),a],skills:[D(`navigation:pageHeader.installSkill`),a],workflows:[D(`navigation:pageHeader.newWorkflow`),a],workflowCreate:[D(`navigation:pageHeader.publish`),u]},k=n===`config`&&h!==`models`?null:O[n],A=_[b],j=D(b===`light`?`navigation:pageHeader.light`:b===`dark`?`navigation:pageHeader.dark`:`navigation:pageHeader.system`),M=!!w;return(0,g.jsxs)(`header`,{className:`page-header ${M?`[-webkit-app-region:drag]`:``} ${w===`darwin`?`pl-[74px]`:``}`,children:[(0,g.jsx)(d,{className:`mobile-menu ${M?`[-webkit-app-region:no-drag]`:``}`,onClick:v,children:(0,g.jsx)(p,{size:19})}),(0,g.jsxs)(`div`,{className:`title-block`,children:[(0,g.jsx)(`h1`,{children:e[0]}),(0,g.jsx)(`p`,{children:e[1]})]}),(0,g.jsxs)(`div`,{className:`header-actions ${M?`[-webkit-app-region:no-drag]`:``} ${w&&w!==`darwin`?`pr-[138px]`:``}`,children:[n===`workflowCreate`?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`button`,{className:`button secondary`,disabled:!C||C.busy||C.running,onClick:()=>C?.save(),children:[(0,g.jsx)(o,{size:15}),D(`navigation:pageHeader.saveDraft`)]}),(0,g.jsxs)(`button`,{className:`button dark`,disabled:!C||C.busy,onClick:()=>C?.run(),children:[C?.running?(0,g.jsx)(l,{size:15}):(0,g.jsx)(i,{size:15}),C?.running?D(`navigation:pageHeader.stop`):D(`navigation:pageHeader.testRun`)]})]}):n===`chat`?null:(0,g.jsxs)(`label`,{className:`search-box`,title:D(`navigation:pageHeader.search`),children:[(0,g.jsx)(s,{size:15}),(0,g.jsx)(`input`,{ref:S,value:f,onChange:e=>m(e.target.value),placeholder:n===`mcp`?D(`navigation:pageHeader.searchServicesOrTools`):n===`memory`?D(`navigation:pageHeader.searchMemoriesOrFiles`):D(`navigation:pageHeader.searchPage`,{page:e[0]})})]}),k&&(0,g.jsxs)(`button`,{className:`button primary`,title:D(`navigation:pageHeader.primaryActionShortcut`,{action:k[0]}),onClick:y,children:[(()=>{let e=k[1];return(0,g.jsx)(e,{size:15})})(),k[0]]}),M&&(0,g.jsx)(`button`,{className:`icon-button terminal-toggle ${T?`active`:``}`,title:D(`navigation:pageHeader.toggleTerminal`),"aria-label":D(`navigation:pageHeader.toggleTerminal`),"aria-pressed":T,onClick:E,children:(0,g.jsx)(c,{size:16})}),(0,g.jsx)(`button`,{className:`icon-button theme-toggle`,title:D(`navigation:pageHeader.themeThemeClickToSwitch`,{theme:j}),"aria-label":D(`navigation:pageHeader.themeThemeClickToSwitchThemes`,{theme:j}),onClick:x,children:(0,g.jsx)(A,{size:16})})]})]})}export{v as PageHeader};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./use-i18n-CubNtfu7.js";import{t as i}from"./AppSelect--dqy70Zh.js";import{t as a}from"./circle-dot-BdcN0YM6.js";import{n as o,t as s}from"./eye-BMzzoABY.js";import{t as c}from"./file-code-corner-lCJOIDbw.js";import{t as l}from"./image-M6XRBbhu.js";import{t as u}from"./pencil-DpO4AUNy.js";import{t as d}from"./search-CVBbTPAG.js";import{Q as f,Y as p,Z as m,b as h,q as g,tt as _,v}from"./index-DoRSkbHW.js";import{a as y,i as b,n as x,r as S,t as C}from"./app-primitives-B_kzSTuJ.js";import{t as w}from"./usePagePrimaryAction-Bw0OFTDZ.js";var T=e(t(),1);function E(e,t){return e?.id===`read`?t(`plugins:toolLabels.read`):e?.id===`ls`?t(`plugins:toolLabels.list`):e?.id===`grep`?t(`plugins:toolLabels.grep`):e?.id===`find`?t(`plugins:toolLabels.find`):e?.id===`edit`?t(`plugins:toolLabels.edit`):e?.id===`write`?t(`plugins:toolLabels.write`):e?.id===`bash`?t(`plugins:toolLabels.shell`):e?.id===`web_search`?t(`plugins:toolLabels.webSearch`):e?.id===`browser_automation`?t(`plugins:toolLabels.browserControl`):e?.id===`generate_visual`?t(`plugins:toolLabels.visualGeneration`):e?.id===`memory_search`?t(`plugins:toolLabels.memorySearch`):e?.id===`memory_remember`?t(`plugins:toolLabels.memoryRemember`):e?.id===`mcp_list`?t(`plugins:toolLabels.mcpList`):e?.id===`mcp_manage`?t(`plugins:toolLabels.mcpManage`):String(e?.name||e?.id||``)}function D(e,t){return e?.id===`read`?t(`plugins:toolLabels.readDescription`):e?.id===`ls`?t(`plugins:toolLabels.listDescription`):e?.id===`grep`?t(`plugins:toolLabels.grepDescription`):e?.id===`find`?t(`plugins:toolLabels.findDescription`):e?.id===`edit`?t(`plugins:toolLabels.editDescription`):e?.id===`write`?t(`plugins:toolLabels.writeDescription`):e?.id===`bash`?t(`plugins:toolLabels.shellDescription`):e?.id===`web_search`?t(`plugins:toolLabels.webSearchDescription`):e?.id===`browser_automation`?t(`plugins:toolLabels.browserControlDescription`):e?.id===`generate_visual`?t(`plugins:toolLabels.visualGenerationDescription`):e?.id===`memory_search`?t(`plugins:toolLabels.memorySearchDescription`):e?.id===`memory_remember`?t(`plugins:toolLabels.memoryRememberDescription`):e?.id===`mcp_list`?t(`plugins:toolLabels.mcpListDescription`):e?.id===`mcp_manage`?t(`plugins:toolLabels.mcpManageDescription`):String(e?.description||``)}function O(e,t){return e===`high`||e===`高风险`?t(`plugins:toolLabels.highRisk`):e===`medium`||e===`中风险`?t(`plugins:toolLabels.mediumRisk`):e===`low`||e===`低风险`?t(`plugins:toolLabels.lowRisk`):String(e||``)}function ee(e,t){return e===`filesystem`||e===`文件系统`?t(`plugins:toolLabels.fileSystem`):e===`search`||e===`搜索`?t(`plugins:toolLabels.search`):e===`terminal`||e===`终端`?t(`plugins:toolLabels.terminal`):e===`visual`||e===`视觉`?t(`plugins:toolLabels.visual`):e===`browser`||e===`浏览器`?t(`plugins:toolLabels.browser`):e===`memory`||e===`星忆`?t(`plugins:toolLabels.memory`):e===`mcp`||e===`MCP`?t(`plugins:toolLabels.mcp`):e===`collaboration`||e===`协作`?t(`plugins:toolLabels.collaboration`):String(e||``)}function te(e,t){return[`read`,`ls`,`grep`,`find`,`edit`,`write`].includes(String(e.id))?t(`plugins:toolLabels.currentChatWorkspace`):e.id===`bash`?t(`plugins:toolLabels.currentOsUser`):e.id===`web_search`?t(`plugins:toolLabels.bingPublicWebSearch`):e.id===`browser_automation`?t(`plugins:toolLabels.isolatedSessionBrowser`):e.id===`generate_visual`?t(`plugins:toolLabels.visualProviderAndWorkspace`):e.id===`memory_search`||e.id===`memory_remember`?t(`plugins:toolLabels.globalAndProjectMemory`):e.id===`mcp_list`||e.id===`mcp_manage`?t(`plugins:toolLabels.applicationMcpConfiguration`):String(e.scope||``)}function ne(e,t){return e.id===`read`?t(`plugins:toolLabels.readCapability`):e.id===`ls`?t(`plugins:toolLabels.listCapability`):e.id===`grep`?t(`plugins:toolLabels.grepCapability`):e.id===`find`?t(`plugins:toolLabels.findCapability`):e.id===`edit`?t(`plugins:toolLabels.editCapability`):e.id===`write`?t(`plugins:toolLabels.writeCapability`):e.id===`bash`?t(`plugins:toolLabels.shellCapability`):e.id===`web_search`?t(`plugins:toolLabels.webSearchCapability`):e.id===`browser_automation`?t(`plugins:toolLabels.browserControlCapability`):e.id===`generate_visual`?t(`plugins:toolLabels.visualGenerationCapability`):e.id===`memory_search`?t(`plugins:toolLabels.memorySearchCapability`):e.id===`memory_remember`?t(`plugins:toolLabels.memoryRememberCapability`):e.id===`mcp_list`?t(`plugins:toolLabels.mcpListCapability`):e.id===`mcp_manage`?t(`plugins:toolLabels.mcpManageCapability`):String(e.capability||``)}function k(e){return e===`high`||e===`高风险`}var A=n(),j=[`all`,`fileSystem`,`search`,`terminal`];function M(e,t){return t(e===`fileSystem`?`plugins:toolLabels.fileSystem`:e===`search`?`plugins:toolLabels.search`:e===`terminal`?`plugins:toolLabels.terminal`:`plugins:pluginsPage.all`)}var N={"read-only":[`read`,`grep`,`find`,`ls`,`web_search`,`browser_automation`,`memory_search`,`memory_remember`,`mcp_list`,`mcp_manage`],workspace:[`read`,`grep`,`find`,`ls`,`edit`,`write`,`web_search`,`browser_automation`,`memory_search`,`memory_remember`,`mcp_list`,`mcp_manage`],full:[`read`,`grep`,`find`,`ls`,`edit`,`write`,`bash`,`web_search`,`browser_automation`,`generate_visual`,`memory_search`,`memory_remember`,`mcp_list`,`mcp_manage`]},P={read:s,ls:_,grep:d,find:d,edit:u,write:c,bash:p,web_search:o,generate_visual:l};function F(e){return{enabled:e.filter(e=>e.enabled).length,total:e.length}}function I({query:e=``,notify:t,registerPrimaryAction:n,onStatusChange:s}){let{t:c,language:l}=r(),[u,d]=(0,T.useState)(null),[p,_]=(0,T.useState)([]),[I,L]=(0,T.useState)(`read`),[R,z]=(0,T.useState)(`all`),[B,V]=(0,T.useState)(`all`),[H,U]=(0,T.useState)(!1),[W,G]=(0,T.useState)(!1),[K,q]=(0,T.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[J,Y]=(0,T.useState)(``);(0,T.useEffect)(()=>{h(`/api/plugins`).then(e=>{d(e),_(e.tools),q(e.webSearch),L(e.tools[0]?.id||``),s(F(e.tools))}).catch(e=>Y(e instanceof Error?e.message:String(e)))},[s]);let X=u?p.some(e=>e.enabled!==u.tools.find(t=>t.id===e.id)?.enabled)||JSON.stringify(K)!==JSON.stringify(u.webSearch):!1,re=(0,T.useCallback)(async()=>{if(!H){if(!u||!X){u&&t(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}U(!0),Y(``);try{let e=await h(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:p.filter(e=>e.enabled).map(e=>e.id),webSearch:K})});d(e),_(e.tools),q(e.webSearch),s(F(e.tools)),t(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{U(!1)}}},[u,X,p,t,s,H,c,K]),ie=async()=>{G(!0),Y(``);try{let e=await h(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(K)});t(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:e.count}))}catch(e){let n=e instanceof Error?e.message:String(e);Y(n),t(n,`error`)}finally{G(!1)}};if(w(n,re),!u)return(0,A.jsxs)(C,{className:`empty-state`,children:[(0,A.jsx)(m,{className:`spin`,size:24}),(0,A.jsx)(`h2`,{children:c(`plugins:pluginsPage.loadingToolPlugins`)}),(0,A.jsx)(`p`,{children:c(`plugins:pluginsPage.readingTheAgentSRegisteredToolsAndPermissions`)}),J&&(0,A.jsxs)(`div`,{className:`config-error`,children:[(0,A.jsx)(g,{size:13}),J]})]});let Z=p.find(e=>e.id===I)||p[0]||{id:``,enabled:!1,risk:``,category:``,description:``},Q=p.filter(t=>{if(B===`highRisk`&&!k(t.risk)||B===`disabled`&&t.enabled)return!1;let n={fileSystem:[`filesystem`,`文件系统`],search:[`search`,`搜索`],terminal:[`terminal`,`终端`]};return n[R]&&!n[R]?.includes(t.category)?!1:`${E(t,c)} ${t.id} ${D(t,c)}`.toLowerCase().includes(e.toLowerCase())}),$=e=>{let t=N[e];_(e=>e.map(e=>({...e,enabled:t.includes(e.id)})))};return(0,A.jsxs)(`div`,{className:`plugins-page`,children:[(0,A.jsxs)(`div`,{className:`plugin-toolbar`,children:[(0,A.jsx)(b,{options:j.map(e=>M(e,c)),value:M(R,c),onChange:e=>z(j.find(t=>M(t,c)===e)||`all`)}),(0,A.jsxs)(`div`,{className:`plugin-presets`,children:[(0,A.jsx)(`span`,{children:c(`plugins:pluginsPage.presets`)}),(0,A.jsx)(`button`,{className:u.preset===`read-only`&&!X?`active`:``,onClick:()=>$(`read-only`),children:c(`plugins:pluginsPage.readOnly`)}),(0,A.jsx)(`button`,{className:u.preset===`workspace`&&!X?`active`:``,onClick:()=>$(`workspace`),children:c(`plugins:pluginsPage.workspace`)}),(0,A.jsx)(`button`,{className:u.preset===`full`&&!X?`active`:``,onClick:()=>$(`full`),children:c(`plugins:pluginsPage.full`)})]})]}),(0,A.jsxs)(`div`,{className:`two-one-grid plugin-layout`,children:[(0,A.jsxs)(C,{className:`plugin-list-panel`,children:[(0,A.jsxs)(`div`,{className:`card-head`,children:[(0,A.jsx)(x,{title:`${c(`plugins:pluginsPage.toolPlugins`)} · ${p.filter(e=>e.enabled).length}/${p.length}`}),(0,A.jsxs)(`div`,{className:`plugin-status-filters`,children:[(0,A.jsxs)(`button`,{type:`button`,className:B===`highRisk`?`active danger`:``,onClick:()=>V(e=>e===`highRisk`?`all`:`highRisk`),children:[(0,A.jsx)(g,{size:12}),c(`plugins:toolLabels.highRisk`),(0,A.jsx)(`strong`,{children:p.filter(e=>k(e.risk)).length})]}),(0,A.jsxs)(`button`,{type:`button`,className:B===`disabled`?`active`:``,onClick:()=>V(e=>e===`disabled`?`all`:`disabled`),children:[(0,A.jsx)(a,{size:12}),c(`plugins:pluginsPage.disabled`),(0,A.jsx)(`strong`,{children:p.filter(e=>!e.enabled).length})]}),X&&(0,A.jsx)(y,{tone:`amber`,children:c(`plugins:pluginsPage.unsaved`)})]})]}),Q.length?Q.map(e=>{let t=P[e.id]||f;return(0,A.jsxs)(`div`,{className:`plugin-row ${I===e.id?`selected`:``}`,children:[(0,A.jsxs)(`button`,{className:`plugin-select`,onClick:()=>L(e.id),children:[(0,A.jsx)(`span`,{className:`list-icon`,children:(0,A.jsx)(t,{size:15})}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`strong`,{children:[E(e,c),` `,(0,A.jsx)(y,{tone:e.risk===`high`||e.risk===`高风险`?`red`:e.risk===`medium`||e.risk===`中风险`?`amber`:`green`,children:O(e.risk,c)})]}),(0,A.jsx)(`small`,{children:D(e,c)})]})]}),(0,A.jsx)(S,{value:e.enabled,onChange:t=>_(n=>n.map(n=>n.id===e.id?{...n,enabled:t}:n))})]},e.id)}):(0,A.jsx)(`div`,{className:`plugin-empty`,children:c(`plugins:pluginsPage.noMatchingTools`)})]}),(0,A.jsxs)(`div`,{className:`detail-stack`,children:[(0,A.jsxs)(C,{children:[(0,A.jsxs)(`div`,{className:`card-head`,children:[(0,A.jsx)(x,{title:c(`plugins:pluginsPage.namePluginPolicy`,{name:E(Z,c)})}),(0,A.jsx)(y,{tone:Z.enabled?`green`:`gray`,children:Z.enabled?c(`plugins:pluginsPage.enabled2`):c(`plugins:pluginsPage.disabled`)})]}),(0,A.jsx)(`p`,{className:`muted-copy`,children:D(Z,c)}),Z.id===`web_search`&&(0,A.jsxs)(`div`,{className:`mb-3 grid gap-3 rounded-[10px] border border-[var(--stroke)] bg-[var(--surface-muted)] p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--stroke)] bg-[var(--solid)] p-3`,children:[(0,A.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-[var(--surface-muted)] text-[var(--text-soft)]`,children:(0,A.jsx)(o,{size:17})}),(0,A.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`text-[13px] text-[var(--text)]`,children:`Bing`}),(0,A.jsx)(`small`,{className:`text-[12px] text-[var(--text-muted)]`,children:c(`plugins:pluginsPage.noInstallationOrAPIKeyRequiredTheAgentCanUseItAfterSaving`)})]})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,A.jsxs)(`label`,{className:`grid gap-1.5 text-[12px] font-semibold text-[var(--text-soft)]`,children:[c(`plugins:pluginsPage.defaultLanguage`),(0,A.jsxs)(i,{className:`h-10 rounded-lg border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[13px] text-[var(--text)]`,value:K.language,onChange:e=>q(t=>({...t,language:e.target.value})),children:[(0,A.jsx)(`option`,{value:`auto`,children:c(`plugins:pluginsPage.auto`)}),(0,A.jsx)(`option`,{value:`zh-CN`,children:c(`plugins:pluginsPage.simplifiedChinese`)}),(0,A.jsx)(`option`,{value:`en-US`,children:c(`plugins:pluginsPage.english`)})]})]}),(0,A.jsxs)(`label`,{className:`grid gap-1.5 text-[12px] font-semibold text-[var(--text-soft)]`,children:[c(`plugins:pluginsPage.safeSearch`),(0,A.jsxs)(i,{className:`h-10 rounded-lg border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[13px] text-[var(--text)]`,value:K.safeSearch,onChange:e=>q(t=>({...t,safeSearch:Number(e.target.value)})),children:[(0,A.jsx)(`option`,{value:0,children:c(`plugins:pluginsPage.off`)}),(0,A.jsx)(`option`,{value:1,children:c(`plugins:pluginsPage.moderate`)}),(0,A.jsx)(`option`,{value:2,children:c(`plugins:pluginsPage.strict`)})]})]}),(0,A.jsxs)(`label`,{className:`grid gap-1.5 text-[12px] font-semibold text-[var(--text-soft)]`,children:[c(`plugins:pluginsPage.resultCount`),(0,A.jsx)(`input`,{type:`number`,min:`1`,max:`12`,className:`h-10 rounded-lg border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[13px] text-[var(--text)]`,value:K.maxResults,onChange:e=>q(t=>({...t,maxResults:Number(e.target.value)}))})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,A.jsx)(`span`,{className:`text-[12px] leading-5 text-[var(--text-muted)]`,children:c(`plugins:pluginsPage.queriesAreSentToBingDoNotIncludeSecretsOrPrivateData`)}),(0,A.jsxs)(`button`,{type:`button`,className:`button secondary shrink-0`,disabled:W,onClick:ie,children:[W?(0,A.jsx)(m,{className:`spin`,size:14}):(0,A.jsx)(o,{size:14}),c(W?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})]}),[[c(`plugins:pluginsPage.toolID`),Z.id],[c(`plugins:pluginsPage.source`),Z.source===`app`?c(`plugins:pluginsPage.pisperAppTools`):c(`plugins:pluginsPage.pisperBuiltInTools`)],[c(`plugins:pluginsPage.category`),ee(Z.category,c)],[c(`plugins:pluginsPage.riskLevel`),O(Z.risk,c)],[c(`plugins:pluginsPage.pathScope`),te(Z,c)],[c(`plugins:pluginsPage.capabilities`),ne(Z,c)]].map(e=>(0,A.jsxs)(`div`,{className:`key-value`,children:[(0,A.jsx)(`span`,{children:e[0]}),(0,A.jsx)(`strong`,{className:e[1]===c(`plugins:pluginsPage.highRisk`)?`danger`:``,children:e[1]})]},e[0])),(0,A.jsx)(`button`,{className:`button wide ${Z.enabled?`danger`:`primary`}`,onClick:()=>_(e=>e.map(e=>e.id===Z.id?{...e,enabled:!e.enabled}:e)),children:Z.enabled?c(`plugins:pluginsPage.disableThisTool`):c(`plugins:pluginsPage.enableThisTool`)}),(0,A.jsx)(`p`,{className:`muted-copy`,children:c(`plugins:pluginsPage.onTheNextAgentRequestAfterSaving`)})]}),(0,A.jsxs)(C,{children:[(0,A.jsx)(x,{title:c(`plugins:pluginsPage.recentChanges`)}),u.changes.length?u.changes.slice(0,6).map((e,t)=>(0,A.jsxs)(`div`,{className:`activity-row`,children:[(0,A.jsx)(a,{size:14}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`strong`,{children:[e.enabled?c(`plugins:pluginsPage.enabled`):c(`plugins:pluginsPage.disable`),` `,E({id:e.tool,name:e.name},c)]}),(0,A.jsx)(`small`,{children:v(e.timestamp,l)})]})]},`${e.timestamp}-${e.tool}-${t}`)):(0,A.jsx)(`div`,{className:`plugin-empty compact`,children:c(`plugins:pluginsPage.noPermissionChangesYet`)})]})]})]}),J&&(0,A.jsxs)(`div`,{className:`config-error floating-error`,children:[(0,A.jsx)(g,{size:13}),J]})]})}export{I as PluginsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./use-i18n-CubNtfu7.js";import{i,n as a,t as o}from"./switch-CDwl5ZJs.js";import{t as s}from"./utils-C8uzG5AZ.js";import{t as c}from"./circle-dot-BdcN0YM6.js";import{t as l}from"./trash-2-CATziWCd.js";import{t as u}from"./wrench-BaMct6KV.js";import{Y as d,Z as f,b as p,h as m,v as h}from"./index-DoRSkbHW.js";import{t as g}from"./badge-BNonIEif.js";import{t as _}from"./usePagePrimaryAction-Bw0OFTDZ.js";var v=e(t(),1),y=n(),b={green:`border-[var(--success-border)] bg-[var(--success-soft)] text-[var(--success-strong)]`,amber:`border-[var(--warning-border)] bg-[var(--warning-soft)] text-[var(--warning-strong)]`,gray:`border-[var(--stroke)] bg-[var(--surface-muted)] text-[var(--text-muted)]`,red:`border-[var(--danger-border)] bg-[var(--danger-soft)] text-[var(--danger)]`};function x({className:e,children:t}){return(0,y.jsx)(a,{size:`sm`,className:s(`workflow-card gap-0 p-3.5 py-3.5`,e),children:t})}function S({children:e}){return(0,y.jsx)(i,{className:`workflow-section-title`,children:e})}function C({value:e,label:t,note:n,tone:r}){return(0,y.jsxs)(a,{size:`sm`,className:s(`workflow-card metric gap-0 p-3 py-3`,r),children:[(0,y.jsx)(`small`,{children:t}),(0,y.jsx)(`strong`,{children:e}),(0,y.jsx)(`span`,{children:n})]})}function w({children:e,tone:t}){return(0,y.jsx)(g,{variant:`outline`,className:b[t],children:e})}function T(e,t){return e===`online`?[t(`workflows:previewPages.online`),`green`]:e===`connecting`?[t(`workflows:previewPages.connecting`),`amber`]:e===`unauthorized`?[t(`workflows:previewPages.unauthorized`),`gray`]:e===`disabled`?[t(`workflows:previewPages.disabled`),`gray`]:[t(`workflows:previewPages.offline`),`red`]}function E(e,t){return e===`high`||e===`高风险`?t(`workflows:previewPages.highRisk`):e===`medium`||e===`中风险`?t(`workflows:previewPages.mediumRisk`):e===`low`||e===`低风险`?t(`workflows:previewPages.lowRisk`):String(e||``)}function D(e,t){return e?e.auth===`headers`?t(`workflows:previewPages.countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`workflows:previewPages.configuredEnvironmentVariables`):e.auth===`local`?t(`workflows:previewPages.localProcess`):t(`workflows:previewPages.none`):`—`}function O({notify:e,query:t=``,registerPrimaryAction:n,requestText:i,requestConfirm:a}){let{t:s,language:g}=r(),[b,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[,N]=(0,v.useState)(``),P=(0,v.useCallback)(async(e=!0)=>{N(``);try{let t=await p(`/api/mcp?refresh=${e?`1`:`0`}`);return O(t),A(e=>t.services.some(t=>t.id===e)?e:t.services[0]?.id||``),t}catch(e){return N(e instanceof Error?e.message:String(e)),null}},[]);(0,v.useEffect)(()=>{P(!0);let e=window.setInterval(()=>{P(!1)},1e4);return()=>window.clearInterval(e)},[P]);let F=(0,v.useCallback)(async()=>{let t=await i?.({title:s(`workflows:previewPages.addMCPService`),message:s(`workflows:previewPages.enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:s(`workflows:previewPages.serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:s(`workflows:previewPages.continue`)});if(t?.trim()&&await a?.({title:s(`workflows:previewPages.connectMCPServer`),message:s(`workflows:previewPages.mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:s(`workflows:previewPages.connect`),tone:`danger`})!==!1){M(!0),N(``);try{let n=await p(`/api/mcp`,{method:`POST`,body:JSON.stringify({spec:t})});O(n),A(n.services.at(-1)?.id||n.services[0]?.id||``),e(s(`workflows:previewPages.mcpServerAdded`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);N(n),e(n,`error`)}finally{M(!1)}}},[e,a,i,s]);_(n,F);let I=b?.services||[],L=I.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(t.toLowerCase())),R=I.find(e=>e.id===k)||L[0]||I[0]||null,z=(b?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(t.toLowerCase())),B=(b?.calls||[]).filter(e=>!R||e.serviceId===R.id),V=b?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},H=async(e,t)=>{M(!0),N(``);try{O(await p(`/api/mcp/${encodeURIComponent(e.serviceId)}/tools/${encodeURIComponent(e.name)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}))}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}},U=async t=>{if(R){M(!0),N(``);try{O(await p(`/api/mcp/${encodeURIComponent(R.id)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})})),e(s(t?`workflows:previewPages.mcpServerEnabled`:`workflows:previewPages.mcpServerDisabled`),`success`)}catch(e){N(e instanceof Error?e.message:String(e))}finally{M(!1)}}},W=async()=>{if(R){M(!0),N(``);try{O(await p(`/api/mcp/${encodeURIComponent(R.id)}/test`,{method:`POST`,body:`{}`})),e(s(`workflows:previewPages.mcpConnectionTestPassed`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);N(n),e(n,`error`)}finally{M(!1)}}},G=async()=>{if(R&&await a?.({title:s(`workflows:previewPages.deleteMCPServer`),message:s(`workflows:previewPages.afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:s(`workflows:previewPages.delete`),tone:`danger`})!==!1){M(!0),N(``);try{await p(`/api/mcp/${encodeURIComponent(R.id)}`,{method:`DELETE`});let t=await P(!1);A(t?.services[0]?.id||``),e(s(`workflows:previewPages.mcpServerDeleted`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);N(n),e(n,`error`)}finally{M(!1)}}};return(0,y.jsx)(`div`,{className:`preview-page`,children:(0,y.jsxs)(`div`,{className:`mcp-layout`,children:[(0,y.jsxs)(x,{className:`selection-list`,children:[(0,y.jsx)(S,{children:s(`workflows:previewPages.services`)}),L.length?L.map(e=>{let[t,n]=T(e.status,s),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,y.jsxs)(`button`,{className:`service-row ${R?.id===e.id?`active`:``}`,onClick:()=>A(e.id),children:[(0,y.jsx)(`span`,{className:`list-icon`,children:(0,y.jsx)(d,{size:15})}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:e.name}),(0,y.jsx)(`small`,{title:r,children:r})]}),(0,y.jsx)(w,{tone:n,children:t})]},e.id)}):(0,y.jsx)(`div`,{className:`channel-route-empty compact`,children:s(`workflows:previewPages.noServerConfigured`)})]}),(0,y.jsxs)(`div`,{className:`mcp-center`,children:[(0,y.jsxs)(`div`,{className:`metric-grid`,children:[(0,y.jsx)(C,{value:String(V.onlineServices),label:s(`workflows:previewPages.onlineServices`),note:s(`workflows:previewPages.countServicesTotal`,{count:V.totalServices}),tone:`blue`}),(0,y.jsx)(C,{value:String(V.availableTools),label:s(`workflows:previewPages.availableTools`),note:s(`workflows:previewPages.countRestrictedTools`,{count:V.restrictedTools}),tone:`green`}),(0,y.jsx)(C,{value:`${V.errorRate}%`,label:s(`workflows:previewPages.errorRate`),note:`24h`,tone:`amber`})]}),(0,y.jsxs)(x,{className:`mcp-tools-panel`,children:[(0,y.jsxs)(S,{children:[s(`workflows:previewPages.toolCapabilities`),` · `,z.length]}),z.length?z.map(e=>(0,y.jsxs)(`div`,{className:`tool-row`,children:[(0,y.jsx)(`span`,{className:`list-icon`,children:(0,y.jsx)(u,{size:15})}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:e.name}),(0,y.jsxs)(`small`,{children:[e.serviceName,` · `,e.description]})]}),(0,y.jsx)(w,{tone:e.risk===`high`||e.risk===`高风险`?`red`:e.risk===`medium`||e.risk===`中风险`?`amber`:`green`,children:E(e.risk,s)}),(0,y.jsx)(o,{checked:!!e.enabled,disabled:j||!e.serviceEnabled,"aria-label":s(`workflows:previewPages.toggleToolName`,{name:e.name}),onCheckedChange:t=>void H(e,t)})]},e.piName)):(0,y.jsx)(`div`,{className:`channel-route-empty compact`,children:s(`workflows:previewPages.noToolsAvailable`)})]})]}),(0,y.jsxs)(`div`,{className:`detail-stack`,children:[(0,y.jsxs)(x,{children:[(0,y.jsx)(S,{children:s(`workflows:previewPages.currentService`)}),(0,y.jsx)(`h2`,{children:R?.name||s(`workflows:previewPages.noServerConfigured`)}),(0,y.jsx)(`p`,{className:`muted-copy`,children:R?.error||s(R?`workflows:previewPages.thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`:`workflows:previewPages.useTheButtonInTheUpperRightToAddAStreamableHTTPOrStdioMCPServer`)}),[[s(`workflows:previewPages.transport`),R?.transport===`stdio`?`stdio`:R?.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`],...R?.transport===`stdio`?[[s(`workflows:previewPages.executable`),R.command||`—`],[s(`workflows:previewPages.workingDirectory`),R.workingDirectory||`—`]]:[[s(`workflows:previewPages.serverAddress`),R?.endpoint||`—`]],[s(`workflows:previewPages.latency`),R?.latencyMs==null?`—`:`${R.latencyMs} ms`],[s(`workflows:previewPages.lastPing`),R?.lastPingAt?h(R.lastPingAt,g):`—`],[s(`workflows:previewPages.authentication`),D(R,s)]].map(e=>(0,y.jsxs)(`div`,{className:`key-value`,children:[(0,y.jsx)(`span`,{children:e[0]}),(0,y.jsx)(`strong`,{title:e[1],children:e[1]})]},e[0])),(0,y.jsxs)(`div`,{className:`toggle-line`,children:[(0,y.jsx)(`span`,{children:s(`workflows:previewPages.serverEnabled`)}),(0,y.jsx)(o,{checked:!!R?.enabled,disabled:!R||j,"aria-label":s(`workflows:previewPages.toggleMCPServer`),onCheckedChange:e=>void U(e)})]}),(0,y.jsxs)(`div`,{className:`button-row`,children:[(0,y.jsxs)(m,{size:`sm`,variant:`secondary`,disabled:!R?.enabled||j,onClick:W,children:[(0,y.jsx)(f,{className:j?`spin`:``,"data-icon":`inline-start`}),s(`workflows:previewPages.testConnection`)]}),(0,y.jsxs)(m,{size:`sm`,variant:`destructive`,disabled:!R||j,onClick:G,children:[(0,y.jsx)(l,{"data-icon":`inline-start`}),s(`workflows:previewPages.delete`)]})]})]}),(0,y.jsxs)(x,{className:`mcp-calls-panel`,children:[(0,y.jsx)(S,{children:s(`workflows:previewPages.recentCalls`)}),B.length?B.slice(0,8).map(e=>(0,y.jsxs)(`div`,{className:`activity-row`,children:[(0,y.jsx)(c,{size:14}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`strong`,{children:e.toolName}),(0,y.jsxs)(`small`,{children:[h(e.timestamp,g),` ·`,` `,e.status===`ok`?`OK`:e.error||`Error`,` ·`,` `,e.durationMs,` ms`]})]})]},e.id)):(0,y.jsx)(`div`,{className:`channel-route-empty compact`,children:s(`workflows:previewPages.noRecentCalls`)})]})]})]})})}export{O as McpPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,t as n}from"./vendor-react-CHuvPdJE.js";import{t as r}from"./use-i18n-CubNtfu7.js";import{t as i}from"./AppSelect--dqy70Zh.js";import{n as a,r as o,t as s}from"./pick-system-directory-DiLmN6UZ.js";import{t as c}from"./chevron-down-DybEa6xm.js";import{t as l}from"./message-circle-Bi-lz-6t.js";import{t as u}from"./play-3QiwbcM7.js";import{t as d}from"./plus-CI2ql0x4.js";import{t as f}from"./trash-2-CATziWCd.js";import{G as p,Z as m,b as h,ct as g,it as _,q as v,st as y,tt as b,v as x}from"./index-DoRSkbHW.js";import{a as S,n as C,r as w,t as T}from"./app-primitives-B_kzSTuJ.js";import{t as E}from"./StarOrbit-BlI6MhVr.js";import{t as D}from"./usePagePrimaryAction-Bw0OFTDZ.js";var O=e(t(),1),k=n(),A={browser:{name:`通知`,Icon:g},feishu:{name:`飞书`,Icon:y},weixin:{name:`微信`,Icon:l}},j={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},ee={minutes:`分钟`,hours:`小时`,days:`天`},te=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],M=[`full-access`,`read-only`];function N(e,t){return t(e===`full-access`?`schedules:schedulesPage.fullAccessHelp`:`schedules:schedulesPage.readOnlyHelp`)}function P(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function F(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function I(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:`schedules:schedulesPage.browserNotification`)}function L({value:e,onChange:t}){let{t:n}=r();return(0,k.jsxs)(`label`,{className:`field-label`,children:[n(`schedules:schedulesPage.executionMode`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:M.map(e=>(0,k.jsx)(`option`,{value:e,children:n(e===`full-access`?`schedules:schedulesPage.fullAccess`:`schedules:schedulesPage.readOnly`)},e))}),(0,k.jsx)(c,{size:13})]}),(0,k.jsx)(`small`,{children:N(e,n)})]})}function R(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function z(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function B({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:l}=r(),u=o.find(e=>e.id===n);return(0,k.jsxs)(`div`,{className:`schedule-target-fields`,children:[(0,k.jsxs)(`label`,{className:`field-label`,children:[l(`schedules:schedulesPage.executionTarget`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:R(r)}:{targetType:t})},children:[(0,k.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,k.jsx)(`option`,{value:`workflow`,children:l(`schedules:schedulesPage.workflow`)})]}),(0,k.jsx)(c,{size:13})]})]}),e===`prompt`?(0,k.jsxs)(`label`,{className:`field-label`,children:[`Prompt`,(0,k.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:l(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`label`,{className:`field-label`,children:[l(`schedules:schedulesPage.workflow`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:R(t)})},children:[(0,k.jsx)(`option`,{value:``,children:l(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,k.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,k.jsx)(c,{size:13})]}),(0,k.jsx)(`small`,{children:u?.description||(o.length?l(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):l(`schedules:schedulesPage.noPublishedWorkflows`))})]}),u?.inputs.length?(0,k.jsxs)(`div`,{className:`schedule-workflow-inputs-section`,children:[(0,k.jsxs)(`div`,{className:`schedule-workflow-inputs-heading`,children:[(0,k.jsx)(`strong`,{children:l(`schedules:schedulesPage.workflowInputs`)}),(0,k.jsx)(`small`,{children:l(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,k.jsx)(`div`,{className:`schedule-workflow-inputs`,children:u.inputs.map(e=>(0,k.jsxs)(`label`,{className:`field-label`,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,k.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,k.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,k.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function V({value:e,onChange:t}){let{t:n}=r(),[i,c]=(0,O.useState)(``),[l,u]=(0,O.useState)(!1),d=async()=>{if(c(``),!s()){u(!0);return}try{let n=await a(e);n&&t(n)}catch(e){c(e instanceof Error?e.message:String(e))}};return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`label`,{className:`field-label`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,k.jsxs)(`span`,{className:`schedule-workspace-input`,children:[(0,k.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,k.jsxs)(`button`,{type:`button`,className:`button secondary`,onClick:()=>void d(),children:[(0,k.jsx)(b,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,k.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,k.jsxs)(`div`,{className:`config-error`,children:[(0,k.jsx)(v,{size:13}),i]}),(0,k.jsx)(o,{open:l,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:u,onSelect:e=>t(e)})]})}function H(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function U(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function W({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:s}=r(),[l,d]=(0,O.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1}},workflows:[],defaultCwd:``}),[p,g]=(0,O.useState)(``),[y,b]=(0,O.useState)(null),[M,N]=(0,O.useState)(!0),[R,W]=(0,O.useState)(!1),[K,q]=(0,O.useState)(``),[J,Y]=(0,O.useState)(!1);D(t,()=>Y(!0));let X=(0,O.useCallback)(async()=>{try{let e=await h(`/api/schedules`);d(e),g(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){q(e instanceof Error?e.message:String(e))}finally{N(!1)}},[]);(0,O.useEffect)(()=>{X()},[X]),(0,O.useEffect)(()=>{let e=window.setInterval(X,l.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[l.tasks,X]);let Z=l.tasks.find(e=>e.id===p),Q=l.workflows||[];(0,O.useEffect)(()=>{b(e=>Z?e?.id===Z.id?e:H(Z):null)},[Z]);let re=(0,O.useMemo)(()=>l.runs.filter(e=>e.taskId===p).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[l.runs,p]),$=e=>b(t=>t&&{...t,...e}),ie=e=>{y&&$({notifications:y.notifications.includes(e)?y.notifications.filter(t=>t!==e):[...y.notifications,e]})};return M?(0,k.jsxs)(T,{className:`empty-state`,children:[(0,k.jsx)(m,{className:`spin`,size:23}),(0,k.jsx)(`h2`,{children:o(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,k.jsxs)(k.Fragment,{children:[K&&(0,k.jsxs)(`div`,{className:`config-error`,children:[(0,k.jsx)(v,{size:13}),K]}),(0,k.jsxs)(`div`,{className:`split-list-detail schedule-layout`,children:[(0,k.jsxs)(T,{className:`selection-list`,children:[(0,k.jsx)(C,{title:o(`schedules:schedulesPage.taskQueue`)}),l.tasks.length?l.tasks.map(e=>(0,k.jsx)(`div`,{className:`schedule-list-item ${p===e.id?`active`:``}`,children:(0,k.jsxs)(`button`,{onClick:()=>g(e.id),children:[(0,k.jsxs)(`span`,{children:[(0,k.jsxs)(`div`,{className:`schedule-item-head`,children:[(0,k.jsx)(`strong`,{children:e.name}),(0,k.jsx)(S,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`schedules:schedulesPage.enabled`):o(`schedules:schedulesPage.pause`)})]}),(0,k.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,k.jsx)(`em`,{children:U(e,s)})]})},e.id)):(0,k.jsxs)(`div`,{className:`channel-route-empty`,children:[(0,k.jsx)(E,{size:38}),(0,k.jsx)(`strong`,{children:o(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,k.jsx)(`span`,{children:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),Z&&y?(0,k.jsxs)(`div`,{className:`detail-stack`,children:[(0,k.jsxs)(T,{children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h2`,{children:y.name}),(0,k.jsxs)(`div`,{className:`schedule-head-actions`,children:[(0,k.jsx)(w,{value:y.enabled,onChange:e=>$({enabled:e})}),(0,k.jsxs)(`button`,{className:`button dark`,disabled:R||Z.lastStatus===`running`,onClick:async()=>{if(Z){W(!0),q(``);try{await h(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){q(e instanceof Error?e.message:String(e))}finally{W(!1)}}},children:[Z.lastStatus===`running`?(0,k.jsx)(m,{className:`spin`,size:14}):(0,k.jsx)(u,{size:14}),Z.lastStatus===`running`?o(`schedules:schedulesPage.running`):o(`schedules:schedulesPage.runNow`)]}),(0,k.jsx)(`button`,{className:`icon-button danger`,title:o(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await h(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){q(e instanceof Error?e.message:String(e))}},children:(0,k.jsx)(f,{size:14})})]})]}),(0,k.jsx)(B,{targetType:y.targetType,prompt:y.prompt,workflowId:y.workflowId,workflowInputs:y.workflowInputs,workflows:Q,onChange:$}),y.targetType===`prompt`&&(0,k.jsx)(V,{value:y.cwd,onChange:e=>$({cwd:e})}),(0,k.jsxs)(`div`,{className:`form-grid three`,children:[(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.frequency`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsx)(i,{value:y.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(j).map(e=>(0,k.jsx)(`option`,{value:e,children:P(e,o)},e))}),(0,k.jsx)(c,{size:13})]})]}),y.frequency===`interval`?(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.runInterval`),(0,k.jsxs)(`span`,{className:`schedule-interval-input`,children:[(0,k.jsx)(`input`,{type:`number`,min:`1`,value:y.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,k.jsx)(i,{value:y.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(ee).map(e=>(0,k.jsx)(`option`,{value:e,children:F(e,o)},e))})]})]}):(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.time`),(0,k.jsx)(`input`,{type:`time`,value:y.time,onChange:e=>$({time:e.target.value})})]}),(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.timeZone`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsx)(i,{value:y.timezone,onChange:e=>$({timezone:e.target.value}),children:te.map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(c,{size:13})]})]}),y.targetType===`prompt`&&(0,k.jsx)(L,{value:y.executionMode,onChange:e=>$({executionMode:e})})]}),(0,k.jsxs)(`div`,{className:`schedule-notification-section`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`strong`,{children:o(`schedules:schedulesPage.notificationChannels`)}),(0,k.jsx)(`button`,{type:`button`,className:`text-button`,onClick:n,children:o(`schedules:schedulesPage.editTemplates`)})]}),(0,k.jsx)(`p`,{children:o(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,k.jsx)(`div`,{className:`schedule-notification-targets`,children:Object.entries(A).map(([e,t])=>{let n=t.Icon,r=y.notifications.includes(e);return(0,k.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>ie(e),children:[(0,k.jsx)(n,{size:15}),(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`strong`,{children:I(e,o)}),(0,k.jsx)(`small`,{children:l.notificationTargets[e].enabled?o(`schedules:schedulesPage.configured`):o(`schedules:schedulesPage.notConfigured`)})]}),(0,k.jsx)(_,{size:15})]},e)})}),(0,k.jsx)(`div`,{className:`schedule-notify-mode`,children:(0,k.jsx)(`button`,{type:`button`,className:`schedule-notification-chip ${y.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:y.notifyOn===`failure`?`always`:`failure`}),children:y.notifyOn===`failure`?o(`schedules:schedulesPage.failuresOnly`):o(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,k.jsxs)(`div`,{className:`form-footer`,children:[(0,k.jsx)(`span`,{children:Z.lastRunAt?o(`schedules:schedulesPage.lastRunTime`,{time:x(Z.lastRunAt,s)}):o(`schedules:schedulesPage.nextRunTime`,{time:U(Z,s)})}),(0,k.jsxs)(`button`,{className:`button dark`,disabled:R||!z(y.targetType,y.prompt,y.workflowId,y.workflowInputs,Q),onClick:async()=>{if(!(!Z||!y)){W(!0),q(``);try{let t=await h(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(y)});d(t.state),b(H(t.task)),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){q(e instanceof Error?e.message:String(e))}finally{W(!1)}}},children:[R?(0,k.jsx)(m,{className:`spin`,size:14}):null,o(R?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,k.jsxs)(T,{children:[(0,k.jsx)(C,{title:o(`schedules:schedulesPage.recentRuns`)}),re.length?re.map(e=>(0,k.jsxs)(`div`,{className:`schedule-run-row ${e.status}`,children:[e.status===`running`?(0,k.jsx)(m,{className:`spin`,size:15}):e.status===`completed`?(0,k.jsx)(_,{size:15}):(0,k.jsx)(v,{size:15}),(0,k.jsxs)(`span`,{children:[(0,k.jsx)(`strong`,{children:e.status===`running`?o(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||o(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?o(`schedules:schedulesPage.taskInterrupted`):e.error||o(`schedules:schedulesPage.taskFailed`)}),(0,k.jsxs)(`small`,{children:[x(e.startedAt,s),` ·`,` `,e.trigger===`manual`?o(`schedules:schedulesPage.manualRun`):o(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${o(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,k.jsx)(`em`,{children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,k.jsxs)(`div`,{className:`channel-route-empty compact`,children:[(0,k.jsx)(E,{size:32}),(0,k.jsx)(`strong`,{children:o(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,k.jsx)(ne,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onCreated:t=>{d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]}),J&&(0,k.jsx)(G,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onClose:()=>Y(!1),onCreated:t=>{Y(!1),d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]})}function ne({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,l]=(0,O.useState)(``),[u,f]=(0,O.useState)(`prompt`),[p,g]=(0,O.useState)(``),[_,y]=(0,O.useState)(``),[b,x]=(0,O.useState)({}),[S,C]=(0,O.useState)(n||``),[w,E]=(0,O.useState)(`daily`),[D,A]=(0,O.useState)(`09:00`),[M,N]=(0,O.useState)(`Asia/Hong_Kong`),[I,R]=(0,O.useState)(1),[H,U]=(0,O.useState)(`hours`),[W,ne]=(0,O.useState)(`full-access`),[G,K]=(0,O.useState)(!1),[q,J]=(0,O.useState)(``);return(0,k.jsxs)(T,{children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,k.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.taskName`),(0,k.jsx)(`input`,{value:s,onChange:e=>l(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,k.jsx)(B,{targetType:u,prompt:p,workflowId:_,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&f(e.targetType),e.prompt!==void 0&&g(e.prompt),e.workflowId!==void 0&&y(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),u===`prompt`&&(0,k.jsx)(V,{value:S,onChange:C}),(0,k.jsxs)(`div`,{className:`form-grid three`,children:[(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.frequency`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsx)(i,{value:w,onChange:e=>E(e.target.value),children:Object.keys(j).map(e=>(0,k.jsx)(`option`,{value:e,children:P(e,o)},e))}),(0,k.jsx)(c,{size:13})]})]}),w===`interval`?(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.runInterval`),(0,k.jsxs)(`span`,{className:`schedule-interval-input`,children:[(0,k.jsx)(`input`,{type:`number`,min:`1`,value:I,onChange:e=>R(Number(e.target.value))}),(0,k.jsx)(i,{value:H,onChange:e=>U(e.target.value),children:Object.keys(ee).map(e=>(0,k.jsx)(`option`,{value:e,children:F(e,o)},e))})]})]}):(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.time`),(0,k.jsx)(`input`,{type:`time`,value:D,onChange:e=>A(e.target.value)})]}),(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.timeZone`),(0,k.jsxs)(`span`,{className:`select-wrap`,children:[(0,k.jsx)(i,{value:M,onChange:e=>N(e.target.value),children:te.map(e=>(0,k.jsx)(`option`,{value:e,children:e},e))}),(0,k.jsx)(c,{size:13})]})]}),u===`prompt`&&(0,k.jsx)(L,{value:W,onChange:ne})]}),q&&(0,k.jsxs)(`div`,{className:`config-error`,children:[(0,k.jsx)(v,{size:13}),q]}),(0,k.jsxs)(`div`,{className:`form-footer`,children:[(0,k.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,k.jsxs)(`button`,{className:`button dark`,disabled:G||!s.trim()||!z(u,p,_,b,t),onClick:async()=>{K(!0),J(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await h(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:u,prompt:p,workflowId:_,workflowInputs:b,cwd:S,enabled:!0,frequency:w,time:D,timezone:M,intervalValue:I,intervalUnit:H,executionMode:W,notifications:t,notifyOn:`always`})}))}catch(e){J(e instanceof Error?e.message:String(e))}finally{K(!1)}},children:[G?(0,k.jsx)(m,{className:`spin`,size:14}):(0,k.jsx)(d,{size:14}),o(G?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function G({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,O.useState)(``),[l,u]=(0,O.useState)(`prompt`),[f,g]=(0,O.useState)(``),[_,y]=(0,O.useState)(``),[b,x]=(0,O.useState)({}),[S,C]=(0,O.useState)(n||``),[w,T]=(0,O.useState)(`full-access`),[E,D]=(0,O.useState)(!1),[A,j]=(0,O.useState)(``);return(0,k.jsx)(`div`,{className:`modal-backdrop`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,k.jsxs)(`form`,{className:`modal`,onSubmit:async t=>{t.preventDefault(),D(!0),j(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await h(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:f,workflowId:_,workflowInputs:b,cwd:S,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{D(!1)}},children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,k.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,k.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,k.jsx)(p,{size:17})})]}),(0,k.jsxs)(`label`,{className:`field-label`,children:[o(`schedules:schedulesPage.taskName`),(0,k.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,k.jsx)(B,{targetType:l,prompt:f,workflowId:_,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&g(e.prompt),e.workflowId!==void 0&&y(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),l===`prompt`&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(V,{value:S,onChange:C}),(0,k.jsx)(L,{value:w,onChange:T})]}),A&&(0,k.jsxs)(`div`,{className:`config-error`,children:[(0,k.jsx)(v,{size:13}),A]}),(0,k.jsxs)(`div`,{className:`modal-actions`,children:[(0,k.jsx)(`button`,{type:`button`,className:`button secondary`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,k.jsxs)(`button`,{className:`button primary`,disabled:E||!s.trim()||!z(l,f,_,b,t),children:[E?(0,k.jsx)(m,{className:`spin`,size:14}):(0,k.jsx)(d,{size:14}),o(E?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{W as SchedulesPage};
@@ -0,0 +1 @@
1
+ import{t as e}from"./vendor-react-CHuvPdJE.js";import{t}from"./utils-C8uzG5AZ.js";/* empty css */var n=e();function r({className:e,children:r,...i}){return(0,n.jsx)(`span`,{className:t(`rb-shiny-text`,e),...i,children:r})}export{r as ShinyText};