limixbot 0.3.101 → 0.3.103

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 (203) hide show
  1. package/dist/assets/{ActivityPanel-DZZgXWgd.js → ActivityPanel-DdSZ8OXc.js} +1 -1
  2. package/dist/assets/{App-D24ELMyP.js → App-ftB4PetT.js} +123 -122
  3. package/dist/assets/{AppEventEditor-BFkEZazQ.js → AppEventEditor-B7KR7gbZ.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-BNDFheN0.js → BotSettingsDialog-BntQ38tC.js} +4 -4
  5. package/dist/assets/{BrowserPanel-BVvlCdxG.js → BrowserPanel-B8zEv2yz.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-CQVN08cF.js → BrowserProfilesManager-eHlKAUFP.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-BqehN1pz.js → CloudAddDialog-u5oxANAD.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-C8Xj3lsj.js → ComputerFilesPane-CyG5dv52.js} +1 -1
  9. package/dist/assets/{ComputerPanel-BfyIIg7u.js → ComputerPanel-BUjqykLD.js} +2 -2
  10. package/dist/assets/{DataPanel-CkOWtMCr.js → DataPanel-DWJbbJNX.js} +1 -1
  11. package/dist/assets/{DesktopViewer-PXMs_Z3h.js → DesktopViewer-CfXOdLV9.js} +1 -1
  12. package/dist/assets/{GrokMoveDialog-B3PuFwiJ.js → GrokMoveDialog-Cj5HG8AL.js} +1 -1
  13. package/dist/assets/{InspectorPanel-BCiZLdqU.js → InspectorPanel-CaOmVE1M.js} +1 -1
  14. package/dist/assets/{KeyboardShortcutsModal-ffycwWVV.js → KeyboardShortcutsModal-kspIwkDg.js} +1 -1
  15. package/dist/assets/{LimixResizeHandles-CtazDkY7.js → LimixResizeHandles-SzYhwKNE.js} +1 -1
  16. package/dist/assets/{LiveDesktop-CJWerWq1.js → LiveDesktop-D3CJ56hW.js} +1 -1
  17. package/dist/assets/{LocalVmWorkspace-CrdC3MmK.js → LocalVmWorkspace-DEAykEFC.js} +1 -1
  18. package/dist/assets/{MacLocalControl-Bcdg_u2n.js → MacLocalControl-C1f-JAvN.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-C-XNLE3e.js → MarkdownFilePreview-BkZMg8ux.js} +1 -1
  20. package/dist/assets/{MenuMotion-BclWiAVe.js → MenuMotion-y3_mgPH0.js} +1 -1
  21. package/dist/assets/{NewBotDialog-CI3c7n9d.js → NewBotDialog-DUlssZFn.js} +1 -1
  22. package/dist/assets/{PhoneAppDialog-CR-LtOHi.js → PhoneAppDialog-jl-A35lD.js} +1 -1
  23. package/dist/assets/{PlacesRail-DyYA64do.js → PlacesRail-Be4MJsKP.js} +1 -1
  24. package/dist/assets/{PluginsPanel-79V2kP_5.js → PluginsPanel-9DDdusDH.js} +1 -1
  25. package/dist/assets/{ProIntroduction-BgEaTCd1.js → ProIntroduction-DRl6O52f.js} +1 -1
  26. package/dist/assets/{RemoteAgentSettingsPanel-CpJDLN6F.js → RemoteAgentSettingsPanel-DNUP5pZq.js} +1 -1
  27. package/dist/assets/{RoomPanel-ByAT8CqS.js → RoomPanel-DAvyN5bX.js} +1 -1
  28. package/dist/assets/{RoutinesPage-CA1__NjC.js → RoutinesPage-ByrijqT9.js} +2 -2
  29. package/dist/assets/{SettingsModal-DAymc03s.js → SettingsModal-DhldX0LY.js} +1 -1
  30. package/dist/assets/{ShareTeamDialog-Dr7BcuEX.js → ShareTeamDialog-hRc_SYb6.js} +1 -1
  31. package/dist/assets/{SignedInSites-C-DP_jaP.js → SignedInSites-BxJ2YKXx.js} +1 -1
  32. package/dist/assets/TeamLibraryPanel-CC_SkTIo.js +3 -0
  33. package/dist/assets/{TeamMapPage-DZlNjWAA.js → TeamMapPage-DAfSlcPu.js} +1 -1
  34. package/dist/assets/{TriggersPage-CF1DnXkj.js → TriggersPage-Bipd1gYY.js} +1 -1
  35. package/dist/assets/{VisibilitySection-DnGXDssr.js → VisibilitySection-DbJ_5rwD.js} +1 -1
  36. package/dist/assets/{WebhookTrigger-CyF3M1mk.js → WebhookTrigger-aLhrK-YU.js} +1 -1
  37. package/dist/assets/{WorksOnGrid-D195VW8K.js → WorksOnGrid-u1rPeHHO.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-CKc5IYc4.js → abnfDiagram-YUKMZFIV-ChcWlNpY.js} +1 -1
  39. package/dist/assets/{activity-CwaOixB9.js → activity-SfzB9gft.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-BzQ3blap.js → architectureDiagram-47P4ROYG-DVoUFfCS.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-Cg5etqDi.js → blockDiagram-E7TT5TSB-DqPV7RMZ.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-ChJTr_PL.js → c4Diagram-CRA5TL53-BGmVwlFz.js} +1 -1
  43. package/dist/assets/{calendar-days-DYBafFRo.js → calendar-days-D3-4I6P4.js} +1 -1
  44. package/dist/assets/channel-BeYKH3lV.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-DwRap1YG.js → chunk-2Q5K7J3B-B1ypkJ8E.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-BO6BTUz7.js → chunk-5VM5RSS4-CcV9LLDc.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-B2VKEfok.js → chunk-7TKQ45FW-BIxUGZLZ.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-C7vsX4VD.js → chunk-AW2ZBBNX-BeDhUW76.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-CIjSXjvq.js → chunk-FVRAUYC3-ChrQXxWu.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-CCWLt9W1.js → chunk-HTAEGDNF-CoqYrJ09.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-CYUijN37.js → chunk-JWPE2WC7-x_G8N4UY.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-D0cFTyVc.js → chunk-KQW6MTUR-BNgvE0Zx.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-CE20wx8I.js → chunk-XXDRQBXY-B6XLUBJo.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-QBcA1FUG.js → classDiagram-v2-K4WV4PDN-DBiYaY2I.js} +1 -1
  55. package/dist/assets/{coins-CQDndxZe.js → coins-DkeI1D3d.js} +1 -1
  56. package/dist/assets/{core-D0gGNfT3.js → core-Bc6arvu2.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-CPygoF45.js → cose-bilkent-JH36ORCC-DcXcgm4G.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-DjRSXXUK.js → cynefin-EF2NZ3EQ-D4661Ow3.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-C4D5WdA1.js → cynefinDiagram-3GCD6N5R-D9JCrRjr.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-CwHowYoX.js → dagre-W4DXFKR2-D7uDOym_.js} +1 -1
  61. package/dist/assets/de-CrO5MppH.js +8 -0
  62. package/dist/assets/{diagram-2UJZ2QOL-IOgxIe2m.js → diagram-2UJZ2QOL-C1DYfm72.js} +1 -1
  63. package/dist/assets/{diagram-OVF4WLC6-6M2t3aC-.js → diagram-OVF4WLC6-C-nti_Wz.js} +1 -1
  64. package/dist/assets/{diagram-PFPMY2P6-C3MDtWX5.js → diagram-PFPMY2P6-B9JKIvnW.js} +1 -1
  65. package/dist/assets/{diagram-UMYRVEAY-CpXR83ix.js → diagram-UMYRVEAY-B3XBHAVr.js} +1 -1
  66. package/dist/assets/{diagram-YEKJPTXX-DF58kzII.js → diagram-YEKJPTXX-R_DeJtDT.js} +1 -1
  67. package/dist/assets/{diagram-ZIFT7M5P-BTWYDC1S.js → diagram-ZIFT7M5P-ClA3xuGy.js} +1 -1
  68. package/dist/assets/{ebnfDiagram-VR2GEFS7-DWMxXTtf.js → ebnfDiagram-VR2GEFS7-D3DyL10J.js} +1 -1
  69. package/dist/assets/{elk-IJKZMXRS-ZDF01LK0.js → elk-IJKZMXRS-NoFnL8PW.js} +1 -1
  70. package/dist/assets/{erDiagram-O2IAPWRE-DKeRGnUv.js → erDiagram-O2IAPWRE-BPyOLz1a.js} +1 -1
  71. package/dist/assets/es-bnXYOspp.js +6 -0
  72. package/dist/assets/{file-up-Cr20e4wl.js → file-up-BV8p1OPd.js} +1 -1
  73. package/dist/assets/{flowDiagram-OXPTDLAJ-BTJVRu9A.js → flowDiagram-OXPTDLAJ-CdHiMknj.js} +1 -1
  74. package/dist/assets/fr-Drpg1nRS.js +8 -0
  75. package/dist/assets/{ganttDiagram-R7TSEDQI-BrBIiPkW.js → ganttDiagram-R7TSEDQI-B3qyDG4d.js} +1 -1
  76. package/dist/assets/{gitGraphDiagram-XJZIOB7I-xBYIjsc8.js → gitGraphDiagram-XJZIOB7I-CN5_yp8t.js} +1 -1
  77. package/dist/assets/hi-hKAbiCLa.js +1 -0
  78. package/dist/assets/{import-name-CdyBVR45.js → import-name-baZlXmGk.js} +1 -1
  79. package/dist/assets/{index-DwYETevf.js → index-BZfn5_k5.js} +3 -3
  80. package/dist/assets/{index-ShhUWigV.js → index-CyrxXrGh.js} +1 -1
  81. package/dist/assets/{infoDiagram-5W2HQ5XZ-B-FCUMEX.js → infoDiagram-5W2HQ5XZ-C1awaPUj.js} +1 -1
  82. package/dist/assets/{ishikawaDiagram-K3B6WC7H-DxhcI9nM.js → ishikawaDiagram-K3B6WC7H-DcG1GTWM.js} +1 -1
  83. package/dist/assets/it-D6cE_lzY.js +13 -0
  84. package/dist/assets/ja-5lJcngPy.js +13 -0
  85. package/dist/assets/{journeyDiagram-COXZFDF6-DSwqQn-4.js → journeyDiagram-COXZFDF6-B-T-4Ss2.js} +1 -1
  86. package/dist/assets/{kanban-definition-P3RFRI5V-Bidc1dLu.js → kanban-definition-P3RFRI5V-DhgMKb1S.js} +1 -1
  87. package/dist/assets/ko-IP18hNxI.js +13 -0
  88. package/dist/assets/{mcp-servers-scq4KvN-.js → mcp-servers-BFkC95ER.js} +1 -1
  89. package/dist/assets/{mermaid.core-1-GuV68k.js → mermaid.core-C0Ni5l0v.js} +4 -4
  90. package/dist/assets/{mindmap-definition-LZFPQGKD-BtlXbTTm.js → mindmap-definition-LZFPQGKD-CljImffi.js} +1 -1
  91. package/dist/assets/{minimize-CoPseS7J.js → minimize-CkQHJV84.js} +1 -1
  92. package/dist/assets/{monitor-B9eyPPw6.js → monitor-D_UAFHyW.js} +1 -1
  93. package/dist/assets/new-bot-peJFipB7.js +2 -0
  94. package/dist/assets/{org-library-CyWov7QW.js → org-library-Br6VR8QD.js} +1 -1
  95. package/dist/assets/{package-format-Dx-xCjWb.js → package-format-CPaz8LNO.js} +1 -1
  96. package/dist/assets/{pegDiagram-BGZESJAR-uFZWnUng.js → pegDiagram-BGZESJAR-CgnU1Ac1.js} +1 -1
  97. package/dist/assets/{pieDiagram-CAPJLFHJ-B2Itft-D.js → pieDiagram-CAPJLFHJ-BJmtZCJF.js} +1 -1
  98. package/dist/assets/pl-s3VOXZNa.js +13 -0
  99. package/dist/assets/pt-br-WeqOetEr.js +13 -0
  100. package/dist/assets/{quadrantDiagram-GDMTTRAM-Btivs4tR.js → quadrantDiagram-GDMTTRAM-Dqg3HXnH.js} +1 -1
  101. package/dist/assets/{rail-ar9TQRSE.js → rail-Bi4B37ED.js} +1 -1
  102. package/dist/assets/{railroadDiagram-SM67HX2B-92CU8YQH.js → railroadDiagram-SM67HX2B-Dh4hx5Fo.js} +1 -1
  103. package/dist/assets/{remote-desktop-panel-BrVUx9qj.js → remote-desktop-panel-DRsUOxPA.js} +1 -1
  104. package/dist/assets/{requirementDiagram-X7JNWC4A-5izSc7xN.js → requirementDiagram-X7JNWC4A-DoDrImJb.js} +1 -1
  105. package/dist/assets/ru-xPDlIHlb.js +13 -0
  106. package/dist/assets/{sankeyDiagram-UM26HJRW-DPnrZSB2.js → sankeyDiagram-UM26HJRW-4kxKCZbK.js} +1 -1
  107. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Bda0M6Hv.js → sequenceDiagram-ZO4K6R2Y-Dfn3sj5H.js} +1 -1
  108. package/dist/assets/{sizeCapture-INFHLROL-DKRN8tPD.js → sizeCapture-INFHLROL-e4etpscL.js} +1 -1
  109. package/dist/assets/{stateDiagram-v2-TBUQTH76-D6MqFrrx.js → stateDiagram-v2-TBUQTH76-CiH2EjAT.js} +1 -1
  110. package/dist/assets/{styles-DOwrpvZY.js → styles-BC55IU1j.js} +2 -2
  111. package/dist/assets/{swimlanes-N4OXWK64-D_pFpyCW.js → swimlanes-N4OXWK64-elz4HcrR.js} +1 -1
  112. package/dist/assets/swimlanesDiagram-K3J5GTZL-C2oR937G.js +8 -0
  113. package/dist/assets/{team-share-CS8lXIGF.js → team-share-CVGnlnZg.js} +1 -1
  114. package/dist/assets/{timeline-definition-YOQAKGHF-CsXwhMm7.js → timeline-definition-YOQAKGHF-CBvNtqBT.js} +1 -1
  115. package/dist/assets/tr-D52N3H-s.js +6 -0
  116. package/dist/assets/uk-BgibvZRE.js +1 -0
  117. package/dist/assets/{usecaseDiagram-VIAY4XPW-XU2vytSZ.js → usecaseDiagram-VIAY4XPW-Cqnlu-5K.js} +1 -1
  118. package/dist/assets/{vennDiagram-BLWOH2XV-beqZKO-E.js → vennDiagram-BLWOH2XV-B1DVqqPC.js} +1 -1
  119. package/dist/assets/vi-Dtr5uxBT.js +15 -0
  120. package/dist/assets/{wardleyDiagram-YMQ3BMBF-Ci5sPNvX.js → wardleyDiagram-YMQ3BMBF-CQPngjvL.js} +1 -1
  121. package/dist/assets/{xychartDiagram-TAQBALBS-BCJ2N2BY.js → xychartDiagram-TAQBALBS-Djna4qxy.js} +1 -1
  122. package/dist/assets/zh-Cr6ncAKb.js +13 -0
  123. package/dist/assets/zh-tw-BhYWJRt3.js +13 -0
  124. package/dist/index.html +2 -2
  125. package/dist/rail.html +4 -4
  126. package/dist-server/index.js +90 -82
  127. package/dist-server/package.json +1 -1
  128. package/dist-server/server/bot-channels/engine.js +51 -22
  129. package/dist-server/server/industry-care.js +4 -3
  130. package/dist-server/server/industry-teams.js +3 -3
  131. package/dist-server/server/limix-skill-store.js +7 -1
  132. package/dist-server/server/package-import.js +1 -1
  133. package/dist-server/server/routes/bots-create.js +12 -1
  134. package/dist-server/shared/industry-templates.js +4 -0
  135. package/dist-server/shared/ready-bots.js +15 -0
  136. package/package.json +1 -1
  137. package/skills/industry-auto-repair/SKILL.md +32 -0
  138. package/skills/industry-auto-repair/assets/hybrid-policy.json +10 -0
  139. package/skills/industry-auto-repair/manifest.json +18 -0
  140. package/skills/industry-auto-repair/references/vi.md +17 -0
  141. package/skills/industry-beauty-spa/SKILL.md +32 -0
  142. package/skills/industry-beauty-spa/assets/hybrid-policy.json +10 -0
  143. package/skills/industry-beauty-spa/manifest.json +18 -0
  144. package/skills/industry-beauty-spa/references/vi.md +17 -0
  145. package/skills/industry-education/SKILL.md +32 -0
  146. package/skills/industry-education/assets/hybrid-policy.json +10 -0
  147. package/skills/industry-education/manifest.json +18 -0
  148. package/skills/industry-education/references/vi.md +17 -0
  149. package/skills/industry-food-beverage/SKILL.md +32 -0
  150. package/skills/industry-food-beverage/assets/hybrid-policy.json +10 -0
  151. package/skills/industry-food-beverage/manifest.json +18 -0
  152. package/skills/industry-food-beverage/references/vi.md +17 -0
  153. package/skills/industry-home-services/SKILL.md +32 -0
  154. package/skills/industry-home-services/assets/hybrid-policy.json +10 -0
  155. package/skills/industry-home-services/manifest.json +18 -0
  156. package/skills/industry-home-services/references/vi.md +17 -0
  157. package/skills/industry-hospitality-travel/SKILL.md +32 -0
  158. package/skills/industry-hospitality-travel/assets/hybrid-policy.json +10 -0
  159. package/skills/industry-hospitality-travel/manifest.json +18 -0
  160. package/skills/industry-hospitality-travel/references/vi.md +17 -0
  161. package/skills/industry-logistics/SKILL.md +32 -0
  162. package/skills/industry-logistics/assets/hybrid-policy.json +10 -0
  163. package/skills/industry-logistics/manifest.json +18 -0
  164. package/skills/industry-logistics/references/vi.md +17 -0
  165. package/skills/industry-real-estate/SKILL.md +32 -0
  166. package/skills/industry-real-estate/assets/hybrid-policy.json +10 -0
  167. package/skills/industry-real-estate/manifest.json +18 -0
  168. package/skills/industry-real-estate/references/vi.md +17 -0
  169. package/skills/industry-retail-ecommerce/SKILL.md +32 -0
  170. package/skills/industry-retail-ecommerce/assets/hybrid-policy.json +10 -0
  171. package/skills/industry-retail-ecommerce/manifest.json +18 -0
  172. package/skills/industry-retail-ecommerce/references/vi.md +17 -0
  173. package/skills/industry-wholesale-distribution/SKILL.md +32 -0
  174. package/skills/industry-wholesale-distribution/assets/hybrid-policy.json +10 -0
  175. package/skills/industry-wholesale-distribution/manifest.json +18 -0
  176. package/skills/industry-wholesale-distribution/references/vi.md +17 -0
  177. package/skills/video-workflow/SKILL.md +26 -0
  178. package/skills/video-workflow/assets/hybrid-policy.json +10 -0
  179. package/skills/video-workflow/assets/starter/build.svrun +5 -0
  180. package/skills/video-workflow/assets/starter/main.svml +24 -0
  181. package/skills/video-workflow/assets/starter/package.json +1 -0
  182. package/skills/video-workflow/assets/starter/style.svs +4 -0
  183. package/skills/video-workflow/manifest.json +19 -0
  184. package/skills/video-workflow/references/vi.md +13 -0
  185. package/dist/assets/TeamLibraryPanel-CI8JZtpN.js +0 -3
  186. package/dist/assets/channel-DI8VRWh8.js +0 -1
  187. package/dist/assets/de-XojPh3_p.js +0 -8
  188. package/dist/assets/es-C0MD2HR1.js +0 -6
  189. package/dist/assets/fr-hktiWwtw.js +0 -8
  190. package/dist/assets/hi-D_Yu59YK.js +0 -1
  191. package/dist/assets/it-zbTil6cI.js +0 -13
  192. package/dist/assets/ja-CtqaLHju.js +0 -13
  193. package/dist/assets/ko-DrT-vz1y.js +0 -13
  194. package/dist/assets/new-bot-CNLntcgn.js +0 -2
  195. package/dist/assets/pl-BaR1MZm6.js +0 -13
  196. package/dist/assets/pt-br-mFy7aZD6.js +0 -13
  197. package/dist/assets/ru-BJ0ARJtn.js +0 -13
  198. package/dist/assets/swimlanesDiagram-K3J5GTZL-D6oFbwqj.js +0 -8
  199. package/dist/assets/tr-DnXBUn9-.js +0 -6
  200. package/dist/assets/uk-RZHdJ2pL.js +0 -1
  201. package/dist/assets/vi-Bx9YsUag.js +0 -15
  202. package/dist/assets/zh-DMiI3Rx1.js +0 -13
  203. package/dist/assets/zh-tw-DoGBLWPr.js +0 -13
@@ -1 +1 @@
1
- import{t as s,r as l,b as Le,j as e,X as ye,d as De,a as ee,ah as we,ai as Oe,q as Me,v as Ue,aj as Fe,ak as ze,al as Ie,l as je,am as Ke,an as _e,ao as $e,ap as He,aq as qe,p as oe,G as Je}from"./styles-DOwrpvZY.js";import{j as C,E as Ve,u as S,bx as te,by as We,a2 as y,S as R,bz as Ye,bA as ke,bB as se,bC as Ge,bD as Xe,bE as Ze,bF as Qe,bG as ce,bH as de,bI as et,bJ as tt,bK as st,bL as Se,w as U,bM as nt,bN as at,b as Ne,bO as ue,bP as it,bQ as rt,bR as lt,bS as ot,bT as ct,bU as dt,bV as ut,bW as pt,bX as xt,bY as mt,bZ as gt,b_ as ht,b$ as pe,c0 as ft,c1 as bt,c2 as vt,c3 as yt,c4 as Ce,c5 as Q,c6 as wt,c7 as jt,c8 as kt,c9 as St,ca as Nt,cb as xe,T as Ee,cc as Ct}from"./App-D24ELMyP.js";import{B as me,E as Et,s as Bt,r as ge,p as Rt,c as Pt,a as At}from"./new-bot-CNLntcgn.js";import{o as Tt}from"./index-DwYETevf.js";import{I as Lt,S as Dt,a as Ot,A as Mt,M as Ut,P as Ft,V as zt,v as It,i as he}from"./VisibilitySection-DnGXDssr.js";import{R as Kt}from"./RoutinesPage-CA1__NjC.js";import{r as _t,L as W,M as $t,N as Ht,O as qt,P as Jt}from"./PlacesRail-DyYA64do.js";import{p as Vt,d as Wt,e as Yt,f as Gt}from"./team-share-CS8lXIGF.js";import{B as Xt}from"./BrowserProfilesManager-CQVN08cF.js";function Zt(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function Qt(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function es(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function ts(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function ss(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function fe(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function be({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Wt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ve,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Yt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function ns({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[v,D]=l.useState(!0),[w,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[O,Y]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Vt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${Le(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:v,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(fe({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,v,w]);const G=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(fe($(!1)))});Gt(u.filename,u.document),Y(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return _t.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(ye,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:O?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(De,{size:16,className:"text-success"}),s("teamShare.saved",{filename:O.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(be,{preview:O,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(be,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>m(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:v,onChange:u=>D(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:O?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{G()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(W,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ne(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Rs(){const{state:t}=S(),n=te(t.config),a=We(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ne();return e.jsx(y,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Ye(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ps(){const{state:t}=S(),n=ke(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ne();return a===void 0||n!==!0||!te(t.config)?null:e.jsx(y,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function as(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ne();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function is(){const{state:t,dispatch:n}=S(),a=se(t.config),i=Ge(t.config),r=Xe(t.config),d=Ze(t.config),c=Qe(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,v]=l.useState(!1),[D,w]=l.useState(!1),[m,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=et(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:de,max:ce}));return}await b({skillReviewSteps:f})&&v(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:D||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(rs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:D,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${m?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:de,max:ce,step:1,inputMode:"numeric",value:p,disabled:D,"aria-invalid":!!m,onChange:f=>{o(f.target.value),v(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):null]})}function rs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ls=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function os(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!tt(t.config))return null;const c=se(t.config),p=st(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const v=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:v})}catch(v){d(v instanceof Error?v.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ls.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:ee("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function cs(){return e.jsxs(e.Fragment,{children:[e.jsx(is,{}),e.jsx(os,{})]})}function As({title:t=s("settings.updates.title")}){const n=ht(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:oe(),version:n.version??""}):s("settings.updates.ready",{app:oe(),version:n.version??""}):n.status==="installing"?pe(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:pe(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(y,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Be(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:yt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Re({effort:t,className:n}){return e.jsxs(U,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),ft.map(a=>e.jsx("option",{value:a,children:bt(a)},a))]})}function Ts(){const t=Be();return e.jsx(y,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Re,{effort:t,className:"w-full max-w-[240px]"})})}function ds({onEdit:t,onShare:n}){const a=Be();return e.jsx(y,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:$t().onboarding,hintsSeen:vt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ls(){const{dispatch:t}=S();return e.jsx(y,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(us,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Ds({simple:t=!1}){const{state:n}=S(),a=Me(Ue(),n.config?.language);return e.jsx(y,{title:s("settings.language.title"),subtitle:Ie()?s("settings.language.subtitleComplete"):t?je()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>ze(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),Fe.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Os({simple:t=!1}){const n=Ne();return e.jsx(y,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:ue("mod-enter")}),children:e.jsx(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>it(rt(a.target.value)),children:Ke.map(a=>e.jsx("option",{value:a,children:ue(a)},a))})})}function Ms({simple:t=!1}){const n=lt(),a=ot(Ne());return e.jsx(y,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>ct(dt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Us({simple:t=!1}){const n=nt();return e.jsx(y,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>at(!n)})})}function Fs({simple:t=!1}){const n=we();return e.jsx(y,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Oe(!n)})})}function zs(){const t=_e();return e.jsx(y,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>$e(!t)})})}function Is(){const t=ut();return e.jsx(y,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>pt(!t)})})}function Ks(){const t=He();return e.jsx(y,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>qe(!t)})})}function _s(){const t=xt();return e.jsx(y,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>mt(!t)})})}function $s(){const{state:t,dispatch:n}=S(),a=gt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(y,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function Hs(){const{state:t,dispatch:n}=S(),a=se(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Se,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(cs,{}),e.jsx(as,{})]})}function qs(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!te(t.config)&&n.length===0?null:e.jsx(Se,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(Xt,{})})}const ve=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],ps={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Pe(t){return e.jsx(Ht,{modal:!0,children:e.jsx(xs,{...t})})}function xs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=qt(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new me(Et,()=>p(x=>x+1))),[v,D]=l.useState("Identity"),[w,m]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,O]=l.useState(""),[Y,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,G]=l.useState(""),z=Ce(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=ke(),L=Je(),Ae=we()?ve:ve.filter(x=>x!=="Model"),ae=!t&&typeof window<"u"&&!window.ogb&&N===!0,q=l.useRef(null),H=l.useRef(n);H.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=Bt(B,!t),k=t?void 0:r??(i?Q(i):void 0),M=new me(k?wt(j,k,je()):j,()=>p(V=>V+1));k&&Q(k.id)&&(M.role=k.id),h(M),m(!0)}).catch(B=>{x||O(String(B))}),()=>{x=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&q.current?.focus()},[b]),l.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;q.current?.focus();const B=j=>{if(!d())return;const k=q.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const M=k.querySelector('[role="dialog"], [role="alertdialog"]');if(M&&M.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),H.current()),j.key!=="Tab"))return;const V=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(le=>le.getClientRects().length&&!le.closest("[hidden],fieldset:disabled")),X=V[0],Z=V.at(-1);if(!X||!Z){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===X||document.activeElement===k)?(j.preventDefault(),Z.focus()):!j.shiftKey&&(document.activeElement===Z||document.activeElement===k)&&(j.preventDefault(),X.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[d]);const ie=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const x=ae?It(F,$):null;if(x&&!x.ok){O(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),O(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Rt(o)})});else{const{bot:B,warnings:j,paused:k}=await Pt(o,void 0,void 0,void 0,x?.ok?x.visibility:void 0,z?ge(u,o.bot.section,c.state.bots,z)??void 0:void 0);At(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(M){c.dispatch({type:"error",message:M instanceof Error?M.message:String(M)})}}A.current=!1,f.current&&H.current()}catch(B){f.current&&O(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},J=o.bot,Te={...c,state:{...c.state,bots:[J,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>J,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},re=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:q,role:"dialog","aria-modal":"true","aria-label":re,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:re}),e.jsx("button",{type:"button",onClick:()=>H.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(ye,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(ms,{team:K}),ae&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(U,{size:"sm",value:F,disabled:b,onChange:x=>_(x.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:x=>G(x.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Ae.map(x=>e.jsx("button",{type:"button",onClick:()=>D(x),"aria-current":v===x?"page":void 0,className:ee("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",v===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(ps[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(jt,{value:Te,children:e.jsx(kt.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(gs,{active:v,draft:o,defaultsMode:t,owner:z&&!t?{value:ge(u,J.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>H.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!J.name.trim(),onClick:()=>{ie()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(W,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(St,{open:Y==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),ie()}})]})})}function ms({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Tt(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function gs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ce(),p=Nt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(hs,{draft:n,defaultsMode:a}),e.jsx(Lt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(U,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(U,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Dt,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ot,{bot:r}):t==="Memory"?e.jsx(fs,{draft:n}):t==="Routines"?e.jsx(bs,{draft:n}):t==="Access"?e.jsx(Mt,{bot:r,derived:p}):t==="Model"?e.jsx(Ut,{bot:r}):t==="Permissions"?e.jsx(Ft,{bot:r,derived:p}):e.jsx(zt,{bot:r,derived:p})}function hs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,v=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=xe.find(f=>f.id===m);t.chooseRole(b?.id);const A=b&&Q(b.id)?.look;b&&t.patch({...Ct(b),...A});return}t.patch(Qt(g)),t.choosePreset(ss(g));const P=es(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},D=async m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=xe.map(m=>e.jsx("option",{value:m.id,children:m.title},m.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(U,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:m=>{v(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Zt(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[ts(h).map((m,g)=>e.jsx("p",{className:"break-words",children:m},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{D(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function fs({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(U,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:ee(he,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:he,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Jt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Ee,{size:16})})]})]})}function bs({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Ee,{size:15})})]},i.id)),n&&e.jsx(Kt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function vs({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Pe,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(ns,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(ds,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(y,{title:s("newBot.defaults"),children:c})}const Js=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:vs,NewBotDialog:Pe},Symbol.toStringTag,{value:"Module"}));export{Fs as A,Rs as B,Us as C,vs as D,Hs as E,Ms as F,Ds as L,Ts as N,Is as P,Ls as R,Ps as S,$s as T,As as U,qs as a,Os as b,zs as c,_s as d,Ks as e,Js as f};
1
+ import{t as s,r as l,b as Le,j as e,X as ye,d as De,a as ee,ah as we,ai as Oe,q as Me,v as Ue,aj as Fe,ak as ze,al as Ie,l as je,am as Ke,an as _e,ao as $e,ap as qe,aq as He,p as oe,G as Je}from"./styles-BC55IU1j.js";import{j as C,E as Ve,u as S,bV as te,bW as We,a2 as y,S as R,bX as Ye,bY as ke,bZ as se,b_ as Xe,b$ as Ge,c0 as Ze,c1 as Qe,c2 as ce,c3 as de,c4 as et,c5 as tt,c6 as st,c7 as Se,w as U,c8 as nt,c9 as at,b as Ne,ca as ue,cb as it,cc as rt,cd as lt,ce as ot,cf as ct,cg as dt,ch as ut,ci as pt,cj as xt,ck as mt,cl as gt,cm as ht,cn as pe,co as ft,cp as bt,cq as vt,cr as yt,cs as Ce,bM as Q,ct as wt,cu as jt,cv as kt,cw as St,cx as Nt,cy as xe,T as Ee,cz as Ct}from"./App-ftB4PetT.js";import{B as me,E as Et,s as Bt,r as ge,p as Rt,c as Pt,a as At}from"./new-bot-peJFipB7.js";import{o as Tt}from"./index-BZfn5_k5.js";import{I as Lt,S as Dt,a as Ot,A as Mt,M as Ut,P as Ft,V as zt,v as It,i as he}from"./VisibilitySection-DbJ_5rwD.js";import{R as Kt}from"./RoutinesPage-ByrijqT9.js";import{r as _t,L as W,Q as $t,R as qt,U as Ht,P as Jt}from"./PlacesRail-Be4MJsKP.js";import{p as Vt,d as Wt,e as Yt,f as Xt}from"./team-share-CVGnlnZg.js";import{B as Gt}from"./BrowserProfilesManager-eHlKAUFP.js";function Zt(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(d=>d.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function Qt(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function es(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function ts(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function ss(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function fe(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function be({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],d=[...n,...t.skipped.map(c=>Wt(c,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([c,p])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:c}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:p,children:p})]},c))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ve,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(c=>e.jsx("li",{children:Yt(c,t.document)},c))})]}),d.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:d.map((c,p)=>e.jsx("li",{children:c},`${c}-${p}`))})]})]})}function ns({onClose:t}){const n=l.useRef(null),[a,i]=l.useState(""),[r,d]=l.useState(""),[c,p]=l.useState(""),[o,h]=l.useState(""),[v,D]=l.useState(!0),[w,m]=l.useState(!0),[g,P]=l.useState(null),[b,A]=l.useState(null),[f,T]=l.useState(!1),[O,Y]=l.useState(null),[I,F]=l.useState(""),_=l.useRef(0);l.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(L=>L||E.profile.name.trim());const N=await Vt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||P({dataUrl:N.avatars.defaults,skipped:N.skipped.map(L=>`${s("teamShare.field.picture")} — ${Le(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||P({skipped:[]})}),()=>{u=!0}},[]);const $=u=>({name:a,description:r,release:c,notes:o,includeNotes:v,dryRun:u,...w&&g?.dataUrl?{picture:g.dataUrl}:{}});l.useEffect(()=>{if(!g)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(fe({...$(!0),release:void 0}))}).then(N=>{u===_.current&&(A(N),F(""),p(L=>L||N.document.package.release))}).catch(N=>{u===_.current&&(A(null),F(N instanceof Error?N.message:String(N)))})},250);return()=>window.clearTimeout(E)},[g,v,w]);const X=async()=>{if(!f){T(!0),F("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(fe($(!1)))});Xt(u.filename,u.document),Y(u)}catch(u){F(u instanceof Error?u.message:String(u))}finally{T(!1)}}};l.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const z=w?g?.skipped??[]:[],K="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return _t.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>u.stopPropagation(),children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const N=E[0],L=E[E.length-1];u.shiftKey&&document.activeElement===N?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),N.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(ye,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:O?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(De,{size:16,className:"text-success"}),s("teamShare.saved",{filename:O.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(be,{preview:O,localSkips:z})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(be,{preview:b,localSkips:z}):!I&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>m(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:v,onChange:u=>D(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:K})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:c,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>p(u.target.value),className:K})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>d(u.target.value),className:K})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:o,maxLength:4e3,rows:2,disabled:f,onChange:u=>h(u.target.value),className:K})]})]})}),I&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:I}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:O?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{X()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(W,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function ne(){const{dispatch:t}=S(),[n,a]=l.useState(!1),[i,r]=l.useState("");return{saving:n,error:i,save:async c=>{if(!n){a(!0),r("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify(c)});t({type:"configStatus",config:p})}catch(p){r(p instanceof Error?p.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Rs(){const{state:t}=S(),n=te(t.config),a=We(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:d,error:c,save:p}=ne();return e.jsx(y,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Ye(t.config),message:c?e.jsx("p",{role:"alert",className:"text-danger",children:c}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:d||!n&&!a&&!i,onClick:()=>{p({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Ps(){const{state:t}=S(),n=ke(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:d}=ne();return a===void 0||n!==!0||!te(t.config)?null:e.jsx(y,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{d({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function as(){const{state:t}=S(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=ne();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function is(){const{state:t,dispatch:n}=S(),a=se(t.config),i=Xe(t.config),r=Ge(t.config),d=Ze(t.config),c=Qe(t.bots,t.instances),[p,o]=l.useState(String(d)),[h,v]=l.useState(!1),[D,w]=l.useState(!1),[m,g]=l.useState(""),P=l.useRef(!1);l.useEffect(()=>{h||o(String(d))},[d,h]);const b=async f=>{if(P.current)return!1;P.current=!0,w(!0),g("");try{const T=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:T}),!0}catch(T){return g(T instanceof Error?T.message:s("settings.experimental.error")),!1}finally{P.current=!1,w(!1)}},A=async()=>{if(!h)return;const f=et(p);if(f===null){g(s("settings.experimental.skillReviewStepsRange",{min:de,max:ce}));return}await b({skillReviewSteps:f})&&v(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:D||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(rs,{engines:c}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:D,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${m?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:de,max:ce,step:1,inputMode:"numeric",value:p,disabled:D,"aria-invalid":!!m,onChange:f=>{o(f.target.value),v(!0),g("")},onBlur:()=>{A()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,m?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:m}):null]})}function rs({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const ls=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function os(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState("");if(!tt(t.config))return null;const c=se(t.config),p=st(t.config),o=async h=>{if(!(a||h===p)){i(!0),d("");try{const v=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:h}})});n({type:"configStatus",config:v})}catch(v){d(v instanceof Error?v.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(c?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:ls.map(h=>e.jsx("button",{type:"button",role:"radio","aria-checked":p===h.value,disabled:a||!c,onClick:()=>{o(h.value)},className:ee("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",p===h.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(h.label)},h.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function cs(){return e.jsxs(e.Fragment,{children:[e.jsx(is,{}),e.jsx(os,{})]})}function As({title:t=s("settings.updates.title")}){const n=ht(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:oe(),version:n.version??""}):s("settings.updates.ready",{app:oe(),version:n.version??""}):n.status==="installing"?pe(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:pe(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(y,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Be(){const{state:t,dispatch:n}=S(),a=t.config?.newBots?.effort??"",[i,r]=l.useState(!1),[d,c]=l.useState("");return{current:a,saving:i,error:d,save:async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:yt(o)?o:null}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Re({effort:t,className:n}){return e.jsxs(U,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),ft.map(a=>e.jsx("option",{value:a,children:bt(a)},a))]})}function Ts(){const t=Be();return e.jsx(y,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Re,{effort:t,className:"w-full max-w-[240px]"})})}function ds({onEdit:t,onShare:n}){const a=Be();return e.jsx(y,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function us(){const{state:t,dispatch:n}=S(),[a,i]=l.useState(!1),[r,d]=l.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),d(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:$t().onboarding,hintsSeen:vt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(c=>{n({type:"configStatus",config:c}),n({type:"toggleTour",open:!0})}).catch(()=>d(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ls(){const{dispatch:t}=S();return e.jsx(y,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(us,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Ds({simple:t=!1}){const{state:n}=S(),a=Me(Ue(),n.config?.language);return e.jsx(y,{title:s("settings.language.title"),subtitle:Ie()?s("settings.language.subtitleComplete"):t?je()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>ze(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),Fe.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Os({simple:t=!1}){const n=Ne();return e.jsx(y,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:ue("mod-enter")}),children:e.jsx(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>it(rt(a.target.value)),children:Ke.map(a=>e.jsx("option",{value:a,children:ue(a)},a))})})}function Ms({simple:t=!1}){const n=lt(),a=ot(Ne());return e.jsx(y,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(U,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>ct(dt(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Us({simple:t=!1}){const n=nt();return e.jsx(y,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>at(!n)})})}function Fs({simple:t=!1}){const n=we();return e.jsx(y,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Oe(!n)})})}function zs(){const t=_e();return e.jsx(y,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>$e(!t)})})}function Is(){const t=ut();return e.jsx(y,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>pt(!t)})})}function Ks(){const t=qe();return e.jsx(y,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>He(!t)})})}function _s(){const t=xt();return e.jsx(y,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>mt(!t)})})}function $s(){const{state:t,dispatch:n}=S(),a=gt(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async()=>{if(!i){r(!0),c("");try{const o=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:o})}catch(o){c(o instanceof Error?o.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(y,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{p()},className:"disabled:cursor-wait disabled:opacity-50"})})}function qs(){const{state:t,dispatch:n}=S(),a=se(t.config),[i,r]=l.useState(!1),[d,c]=l.useState(""),p=async o=>{if(!i){r(!0),c("");try{const h=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:o}})});n({type:"configStatus",config:h})}catch(h){c(h instanceof Error?h.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(Se,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{p(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),d?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:d}):null,e.jsx(cs,{}),e.jsx(as,{})]})}function Hs(){const{state:t}=S(),n=t.config?.browserProfiles??[];return!te(t.config)&&n.length===0?null:e.jsx(Se,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(Gt,{})})}const ve=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],ps={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Pe(t){return e.jsx(qt,{modal:!0,children:e.jsx(xs,{...t})})}function xs({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i,readyBotData:r}){const d=Ht(),c=S(),[,p]=l.useState(0),[o,h]=l.useState(()=>new me(Et,()=>p(x=>x+1))),[v,D]=l.useState("Identity"),[w,m]=l.useState(!1),[g,P]=l.useState(!1),b=g||c.state.botCreationPending,A=l.useRef(!1),f=l.useRef(!0),[T,O]=l.useState(""),[Y,I]=l.useState(null),[F,_]=l.useState("everyone"),[$,X]=l.useState(""),z=Ce(),K=c.state.config?.team?.name,[u,E]=l.useState(null),N=ke(),L=Je(),Ae=we()?ve:ve.filter(x=>x!=="Model"),ae=!t&&typeof window<"u"&&!window.ogb&&N===!0,H=l.useRef(null),q=l.useRef(n);q.current=n,l.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=Bt(B,!t),k=t?void 0:r??(i?Q(i):void 0),M=new me(k?wt(j,k,je()):j,()=>p(V=>V+1));k&&Q(k.id)&&(M.role=k.id),h(M),m(!0)}).catch(B=>{x||O(String(B))}),()=>{x=!0}},[t,i,r]),l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),l.useEffect(()=>()=>o.dispose(),[o]),l.useEffect(()=>{b&&H.current?.focus()},[b]),l.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;H.current?.focus();const B=j=>{if(!d())return;const k=H.current;if(!k||j.target instanceof Node&&!k.contains(j.target))return;const M=k.querySelector('[role="dialog"], [role="alertdialog"]');if(M&&M.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),q.current()),j.key!=="Tab"))return;const V=[...k.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(le=>le.getClientRects().length&&!le.closest("[hidden],fieldset:disabled")),G=V[0],Z=V.at(-1);if(!G||!Z){j.preventDefault(),k.focus();return}j.shiftKey&&(document.activeElement===G||document.activeElement===k)?(j.preventDefault(),Z.focus()):!j.shiftKey&&(document.activeElement===Z||document.activeElement===k)&&(j.preventDefault(),G.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[d]);const ie=async()=>{if(!w||A.current||c.state.botCreationPending)return;if(!t&&o.bot.approvalMode==="auto"&&o.bot.computer==="local"&&!o.consent.acknowledgeLocalAuto){I("local");return}const x=ae?It(F,$):null;if(x&&!x.ok){O(s("botSettings.visibility.needPeople"));return}A.current=!0,P(!0),O(""),c.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Rt(o)})});else{const{bot:B,warnings:j,paused:k}=await Pt(o,void 0,void 0,void 0,x?.ok?x.visibility:void 0,z?ge(u,o.bot.section,c.state.bots,z)??void 0:void 0);At(c.dispatch,B,j,{showThreads:L,source:o.preset?"preset":o.role?"template":"blank",role:o.role,paused:k});try{await a?.(B)}catch(M){c.dispatch({type:"error",message:M instanceof Error?M.message:String(M)})}}A.current=!1,f.current&&q.current()}catch(B){f.current&&O(B instanceof Error?B.message:String(B))}finally{A.current=!1,c.dispatch({type:"botCreationPending",on:!1}),f.current&&P(!1)}},J=o.bot,Te={...c,state:{...c.state,bots:[J,...c.state.bots],routines:o.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>J,dispatch:x=>{x.type==="updateBot"&&x.botId===o.id?o.patch(x.patch):x.type==="setModel"&&x.botId===o.id?(o.setModel(x.selection),x.resetApprovalToAsk&&o.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||c.dispatch(x)}},re=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&c.state.appSettingsOpen,children:e.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-label":re,"aria-busy":b,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:re}),e.jsx("button",{type:"button",onClick:()=>q.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(ye,{size:18,className:"pointer-events-none"})})]}),z&&!t&&K&&e.jsx(ms,{team:K}),ae&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(U,{size:"sm",value:F,disabled:b,onChange:x=>_(x.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),F==="people"&&e.jsx("input",{value:$,disabled:b,onChange:x=>X(x.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:Ae.map(x=>e.jsx("button",{type:"button",onClick:()=>D(x),"aria-current":v===x?"page":void 0,className:ee("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",v===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(ps[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!w&&!T&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(W,{size:16,className:"animate-spin"}),s("newBot.loading")]}),w&&e.jsx("fieldset",{disabled:b,className:"min-w-0",children:e.jsx(jt,{value:Te,children:e.jsx(kt.Provider,{value:{request:o.request,draft:!0,uploadAvatar:o.uploadAvatar},children:e.jsx(gs,{active:v,draft:o,defaultsMode:t,owner:z&&!t?{value:ge(u,J.section,c.state.bots,z),choose:E}:void 0})})})})]})]}),T&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:T}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>q.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!w||b||!t&&!J.name.trim(),onClick:()=>{ie()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[b&&e.jsx(W,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(St,{open:Y==="local",onCancel:()=>I(null),onConfirm:()=>{o.consent.acknowledgeLocalAuto=!0,I(null),ie()}})]})})}function ms({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{Tt(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function gs({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:d}=S(),c=Ce(),p=Nt(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(hs,{draft:n,defaultsMode:a}),e.jsx(Lt,{bot:r,patch:p.patch,activeState:p.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(U,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:o=>n.patch({section:o.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...d.sections??[],...d.bots.map(o=>o.section??"")])].filter(Boolean).map(o=>e.jsx("option",{children:o},o))]})]}),i&&c&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(U,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:o=>i.choose(o.target.value),children:c.people.map(o=>e.jsx("option",{value:o.email,children:o.you?s("owner.you",{name:o.name}):o.name},o.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Dt,{bot:r,patch:p.patch}):t==="Skills"?e.jsx(Ot,{bot:r}):t==="Memory"?e.jsx(fs,{draft:n}):t==="Routines"?e.jsx(bs,{draft:n}):t==="Access"?e.jsx(Mt,{bot:r,derived:p}):t==="Model"?e.jsx(Ut,{bot:r}):t==="Permissions"?e.jsx(Ft,{bot:r,derived:p}):e.jsx(zt,{bot:r,derived:p})}function hs({draft:t,defaultsMode:n}){const[a,i]=l.useState([]),[r,d]=l.useState(0),[c,p]=l.useState(""),o=l.useRef(!1);l.useEffect(()=>{if(n)return;let m=!1;return C("/api/bot-presets").then(g=>{m||i(g.presets)}).catch(()=>{m||i([])}),()=>{m=!0}},[n,r]);const h=t.preset?a.find(m=>m.id===t.preset.id):void 0,v=async m=>{p("");const g=m.startsWith("preset:")?a.find(b=>b.id===m.slice(7)):void 0;if(!g){t.choosePreset(void 0);const b=xe.find(f=>f.id===m);t.chooseRole(b?.id);const A=b&&Q(b.id)?.look;b&&t.patch({...Ct(b),...A});return}t.patch(Qt(g)),t.choosePreset(ss(g));const P=es(g);try{P?(t.patch({avatarUrl:await t.uploadAvatar(P),avatarCrop:g.bot.appearance.avatar.crop}),o.current=!0):o.current&&(t.patch({avatarUrl:""}),o.current=!1)}catch(b){p(b instanceof Error?b.message:String(b))}},D=async m=>{p("");try{await C(`/api/bot-presets/${encodeURIComponent(m.id)}`,{method:"DELETE"}),t.preset?.id===m.id&&t.choosePreset(void 0),d(g=>g+1)}catch(g){p(g instanceof Error?g.message:String(g))}},w=xe.map(m=>e.jsx("option",{value:m.id,children:m.title},m.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(U,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:m=>{v(m.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Zt(a).map(m=>e.jsx("optgroup",{label:m.label,children:m.presets.map(g=>e.jsx("option",{value:`preset:${g.id}`,children:g.name},g.id))},m.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:w}):w]})]}),h&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[ts(h).map((m,g)=>e.jsx("p",{className:"break-words",children:m},g)),h.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{D(h)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),c&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:c})]})}function fs({draft:t}){const[n,a]=l.useState("MEMORY.md"),[i,r]=l.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(U,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:d=>a(d.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(d=>e.jsx("option",{children:d},d))}),e.jsx("textarea",{className:ee(he,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:d=>t.setMemory(n,d.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:he,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:d=>r(d.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const d=`memory/${i}.md`;d in t.template.memory||t.setMemory(d,""),a(d),r("")},children:e.jsx(Jt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Ee,{size:16})})]})]})}function bs({draft:t}){const[n,a]=l.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Ee,{size:15})})]},i.id)),n&&e.jsx(Kt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function vs({simple:t=!1}){const[n,a]=l.useState(!1),[i,r]=l.useState(!1),d=e.jsxs(e.Fragment,{children:[n&&e.jsx(Pe,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(ns,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(ds,{onEdit:()=>a(!0),onShare:()=>r(!0)}),d]});const c=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),d]});return e.jsx(y,{title:s("newBot.defaults"),children:c})}const Js=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:vs,NewBotDialog:Pe},Symbol.toStringTag,{value:"Module"}));export{Fs as A,Rs as B,Us as C,vs as D,qs as E,Ms as F,Ds as L,Ts as N,Is as P,Ls as R,Ps as S,$s as T,As as U,Hs as a,Os as b,zs as c,_s as d,Ks as e,Js as f};
@@ -1 +1 @@
1
- import{r as d,j as t,t as n}from"./styles-DOwrpvZY.js";import{r as c}from"./PlacesRail-DyYA64do.js";import{y as x,z as p,Q as m,D as u}from"./App-D24ELMyP.js";import"./monitor-B9eyPPw6.js";import"./index-DwYETevf.js";import"./MenuMotion-BclWiAVe.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};
1
+ import{r as d,j as t,t as n}from"./styles-BC55IU1j.js";import{r as c}from"./PlacesRail-Be4MJsKP.js";import{y as x,z as p,Q as m,D as u}from"./App-ftB4PetT.js";import"./monitor-D_UAFHyW.js";import"./index-BZfn5_k5.js";import"./MenuMotion-y3_mgPH0.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:x},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:p}];function v({open:r,onClose:o,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=l=>{l.key==="Escape"&&(l.preventDefault(),o())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,o]),!r)return null;const s=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.stopPropagation(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:n("phoneApp.title")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.subtitle")}),t.jsx("ul",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:f.map(e=>t.jsxs("li",{"data-phone-app":e.id,className:"flex flex-col items-center gap-3 rounded-xl bg-card p-4 text-center",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n(e.nameKey)}),t.jsx("div",{className:"rounded-md bg-white p-2",children:t.jsx(m,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{u(e.url)},className:"text-[13px] text-accent hover:underline",children:n(e.actionKey)})]},e.id))}),i.length?t.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[t.jsx("p",{className:"text-[13px] leading-relaxed text-ink-secondary",children:n("phoneApp.next")}),i.map((e,l)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{o(),e.onSelect()},className:l===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:n("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))]}):null,t.jsx("button",{ref:a,type:"button",onClick:o,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:n("common.close")})]})});return typeof document>"u"?s:c.createPortal(s,document.body)}export{f as PHONE_APPS,v as PhoneAppDialog};