limixbot 0.3.22 → 0.3.24

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 (128) hide show
  1. package/dist/assets/{ActivityPanel-ChjWicVw.js → ActivityPanel-BjjmX49M.js} +1 -1
  2. package/dist/assets/App-BWtQhGWp.js +242 -0
  3. package/dist/assets/{AppEventEditor-NdlNZYiU.js → AppEventEditor-Bq1-MGxi.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-DKIuZdV6.js → BotSettingsDialog-CVlvG4Rb.js} +4 -4
  5. package/dist/assets/{BrowserPanel-DjEwiL31.js → BrowserPanel-CPLcno_m.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-1DLRt4N9.js → BrowserProfilesManager-D9JsCp1k.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-C0DMYGOm.js → CloudAddDialog-DcmN7A5a.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-Dk8NcRrf.js → ComputerFilesPane-Bjx6TGmM.js} +1 -1
  9. package/dist/assets/{ComputerPanel-DoVcLtW7.js → ComputerPanel-C9Xx4Ifs.js} +2 -2
  10. package/dist/assets/{DataPanel-C0Fx7K2G.js → DataPanel-IfpQCi3b.js} +1 -1
  11. package/dist/assets/{DesktopViewer-DTBmRKHz.js → DesktopViewer-RjjUUlrQ.js} +1 -1
  12. package/dist/assets/{FilesView-D5s67U7H.js → FilesView-D_0GwHAN.js} +1 -1
  13. package/dist/assets/{GrokMoveDialog-itIjM39_.js → GrokMoveDialog-CUie-0en.js} +1 -1
  14. package/dist/assets/{InspectorPanel-NMTlN3H-.js → InspectorPanel-BuFL6wWf.js} +1 -1
  15. package/dist/assets/{KeyboardShortcutsModal-O3skmvQm.js → KeyboardShortcutsModal-uOhXagTA.js} +1 -1
  16. package/dist/assets/{LiveDesktop-CO9mKNtY.js → LiveDesktop-BwpZa-Ri.js} +1 -1
  17. package/dist/assets/{LocalVmWorkspace-BLrh4g6E.js → LocalVmWorkspace-CousHKOb.js} +1 -1
  18. package/dist/assets/{MacLocalControl-DyhXTfbp.js → MacLocalControl-BKDzplO2.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-CyJn1rQP.js → MarkdownFilePreview-CCwc1Tek.js} +1 -1
  20. package/dist/assets/{MenuMotion-CobYpP7L.js → MenuMotion-CSgaJLc2.js} +1 -1
  21. package/dist/assets/NewBotDialog-BtvoCpqN.js +1 -0
  22. package/dist/assets/{PhoneAppDialog-D_CgApJp.js → PhoneAppDialog-C1hIwyT8.js} +1 -1
  23. package/dist/assets/{PlacesRail-CUntVv3u.js → PlacesRail-PP97GpM6.js} +1 -1
  24. package/dist/assets/{PluginsPanel-C2bbrSB3.js → PluginsPanel-DpUEC1zc.js} +1 -1
  25. package/dist/assets/{ProIntroduction-8BVPIU2J.js → ProIntroduction-C-7uexIW.js} +1 -1
  26. package/dist/assets/{RemoteAgentSettingsPanel-JMsDeyDs.js → RemoteAgentSettingsPanel-DtofJtgF.js} +1 -1
  27. package/dist/assets/{RoomPanel-BcFX5BFK.js → RoomPanel-CHbgQ0xd.js} +1 -1
  28. package/dist/assets/{RoutinesPage-BZhG-dR9.js → RoutinesPage-ZdFTYQc-.js} +2 -2
  29. package/dist/assets/SettingsModal-Cdz3bEYZ.js +15 -0
  30. package/dist/assets/{ShareTeamDialog-Cf4VzjYH.js → ShareTeamDialog-CNu6Kwet.js} +1 -1
  31. package/dist/assets/{SignedInSites-31u9pN2b.js → SignedInSites-CyWcDbLW.js} +1 -1
  32. package/dist/assets/TeamLibraryPanel-DMhdlaSH.js +1 -0
  33. package/dist/assets/{TeamMapPage-BrrWMFul.js → TeamMapPage-C2PnNdil.js} +1 -1
  34. package/dist/assets/{TriggersPage-GuMhNUuU.js → TriggersPage-B_br6xBZ.js} +1 -1
  35. package/dist/assets/{VisibilitySection-C6eVm1Hd.js → VisibilitySection-DH0WrBCn.js} +1 -1
  36. package/dist/assets/{WebhookTrigger-BGm39FBT.js → WebhookTrigger-BASBoMb_.js} +1 -1
  37. package/dist/assets/{WorksOnGrid-9NWPGzbE.js → WorksOnGrid-CboITAAs.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-DEyDkr0Q.js → abnfDiagram-YUKMZFIV-CJ69o_vp.js} +1 -1
  39. package/dist/assets/{activity-CbpNb0MQ.js → activity-BdRjGS2C.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-CGTtcA9N.js → architectureDiagram-47P4ROYG-BH57AmKC.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-DT9DFOL_.js → blockDiagram-E7TT5TSB-D3ebMs_o.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-DpERK75F.js → c4Diagram-CRA5TL53-6TrdcGZR.js} +1 -1
  43. package/dist/assets/{calendar-days-DE6WL-x2.js → calendar-days-DiMBTH2e.js} +1 -1
  44. package/dist/assets/channel-k2J2GMwv.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-wHwpVFi3.js → chunk-2Q5K7J3B-BemwHdji.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-CfqwqtdU.js → chunk-5VM5RSS4-CQZbLBld.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-BRxQFxT-.js → chunk-7TKQ45FW-Dy6EXFTX.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-Ca3w_5Wz.js → chunk-AW2ZBBNX-BbKGGyK8.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-CO8Syt2Z.js → chunk-FVRAUYC3-DHqUalc2.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-Cnx9DnWv.js → chunk-HTAEGDNF-B66Vjlwq.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-DefKEriK.js → chunk-JWPE2WC7-DrtdT6L3.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-B6WWWz_R.js → chunk-KQW6MTUR-t7RW8fFT.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-BFU1-B3X.js → chunk-XXDRQBXY-CntyS42N.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-BePCpZI3.js → classDiagram-v2-K4WV4PDN-KlNCgeTt.js} +1 -1
  55. package/dist/assets/{coins-D1fhjgas.js → coins-BHKpT34i.js} +1 -1
  56. package/dist/assets/{core-GxNVTB-X.js → core-DEy6KDLR.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-D8emtvin.js → cose-bilkent-JH36ORCC-C_cXoOGT.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-DUEsfFVq.js → cynefin-EF2NZ3EQ-DGuwW5zt.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-duonepNA.js → cynefinDiagram-3GCD6N5R-qMzxXkVk.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-D4NywFNB.js → dagre-W4DXFKR2-Q-osY3Yi.js} +1 -1
  61. package/dist/assets/{diagram-2UJZ2QOL-cjiJTdiH.js → diagram-2UJZ2QOL-DyVJSBOF.js} +1 -1
  62. package/dist/assets/{diagram-OVF4WLC6-D6M8A9DS.js → diagram-OVF4WLC6-C5qBFdpm.js} +1 -1
  63. package/dist/assets/{diagram-PFPMY2P6-CVAzAz2N.js → diagram-PFPMY2P6-C1PW3U2P.js} +1 -1
  64. package/dist/assets/{diagram-UMYRVEAY-DLvfYJwO.js → diagram-UMYRVEAY-D2pa0Mzi.js} +1 -1
  65. package/dist/assets/{diagram-YEKJPTXX-D8qCH--0.js → diagram-YEKJPTXX-BIzOA1li.js} +1 -1
  66. package/dist/assets/{diagram-ZIFT7M5P-s55SHvTR.js → diagram-ZIFT7M5P-B1UL3O8m.js} +1 -1
  67. package/dist/assets/{ebnfDiagram-VR2GEFS7-B93cNJNn.js → ebnfDiagram-VR2GEFS7-Cxu-kU8s.js} +1 -1
  68. package/dist/assets/{elk-IJKZMXRS-BsJqO8aU.js → elk-IJKZMXRS-DJS39Bm9.js} +1 -1
  69. package/dist/assets/{erDiagram-O2IAPWRE-BXF1G3Js.js → erDiagram-O2IAPWRE-Cb31BS5L.js} +1 -1
  70. package/dist/assets/{file-up-Cg2kYQkd.js → file-up-DWGlVRGP.js} +1 -1
  71. package/dist/assets/{flowDiagram-OXPTDLAJ-BKjjYwz9.js → flowDiagram-OXPTDLAJ-BaPTzS6m.js} +1 -1
  72. package/dist/assets/{ganttDiagram-R7TSEDQI-DhtZJtPm.js → ganttDiagram-R7TSEDQI-B_Lr-26i.js} +1 -1
  73. package/dist/assets/{gitGraphDiagram-XJZIOB7I-BfRlcF5z.js → gitGraphDiagram-XJZIOB7I-UHyDFX6a.js} +1 -1
  74. package/dist/assets/{import-name-B8g_Hj2F.js → import-name-Cxwtm5XO.js} +1 -1
  75. package/dist/assets/{index-B8LCAG4-.js → index-BME9PdWM.js} +1 -1
  76. package/dist/assets/{index-LBC94myy.js → index-BSrb6nsc.js} +2 -2
  77. package/dist/assets/{infoDiagram-5W2HQ5XZ-CywmYwco.js → infoDiagram-5W2HQ5XZ-B7ovBJYA.js} +1 -1
  78. package/dist/assets/{ishikawaDiagram-K3B6WC7H-DpXXqau5.js → ishikawaDiagram-K3B6WC7H-BYS-TlrF.js} +1 -1
  79. package/dist/assets/{journeyDiagram-COXZFDF6-D1uMWGbz.js → journeyDiagram-COXZFDF6-jJxKYEtT.js} +1 -1
  80. package/dist/assets/{kanban-definition-P3RFRI5V-Bz0zjqQs.js → kanban-definition-P3RFRI5V-DyiFYaIK.js} +1 -1
  81. package/dist/assets/{mcp-servers-C_F4MXjY.js → mcp-servers-DXFuhTlS.js} +1 -1
  82. package/dist/assets/{mermaid.core-Dnv6mcJ4.js → mermaid.core-D3YJgsiB.js} +4 -4
  83. package/dist/assets/{mindmap-definition-LZFPQGKD-CFEkTgom.js → mindmap-definition-LZFPQGKD-DnbWodUY.js} +1 -1
  84. package/dist/assets/{minimize-o-OFVasg.js → minimize-Af1aU3Tz.js} +1 -1
  85. package/dist/assets/{monitor-7oLB-7rZ.js → monitor-DuYHWIyw.js} +1 -1
  86. package/dist/assets/{new-bot-CFOYR98I.js → new-bot-TwOnvVO1.js} +1 -1
  87. package/dist/assets/{org-library-TYYMsAm5.js → org-library-BLD6YHcM.js} +1 -1
  88. package/dist/assets/{package-format-CrrPupM8.js → package-format-72bbOy2w.js} +1 -1
  89. package/dist/assets/{pegDiagram-BGZESJAR-DKt4SMwc.js → pegDiagram-BGZESJAR-CcOuP6zx.js} +1 -1
  90. package/dist/assets/{pieDiagram-CAPJLFHJ-B9taKUge.js → pieDiagram-CAPJLFHJ-DhCU7Sfy.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-GDMTTRAM-DQjB7Jbz.js → quadrantDiagram-GDMTTRAM-7OziX26h.js} +1 -1
  92. package/dist/assets/{rail-BBdJiVR1.js → rail-DI2iZJYt.js} +1 -1
  93. package/dist/assets/{railroadDiagram-SM67HX2B-DQOivC56.js → railroadDiagram-SM67HX2B-rg44R4U2.js} +1 -1
  94. package/dist/assets/{remote-desktop-panel-BmwpQiDu.js → remote-desktop-panel-BPKKvcHT.js} +1 -1
  95. package/dist/assets/{requirementDiagram-X7JNWC4A-BLgwXDEl.js → requirementDiagram-X7JNWC4A-DFNvg72O.js} +1 -1
  96. package/dist/assets/{sankeyDiagram-UM26HJRW-g2GlJNjj.js → sankeyDiagram-UM26HJRW-CUOrQF2i.js} +1 -1
  97. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-_08U7Ixl.js → sequenceDiagram-ZO4K6R2Y-4HKsH1wt.js} +1 -1
  98. package/dist/assets/{sizeCapture-INFHLROL-DZPfU3_U.js → sizeCapture-INFHLROL-BEXQDTx-.js} +1 -1
  99. package/dist/assets/{stateDiagram-v2-TBUQTH76-PXBjCkxd.js → stateDiagram-v2-TBUQTH76-BYBLUqiy.js} +1 -1
  100. package/dist/assets/{styles-BHtUK2qB.js → styles-C2_XZv1s.js} +1 -1
  101. package/dist/assets/styles-Di_mG4l3.css +1 -0
  102. package/dist/assets/{swimlanes-N4OXWK64-q1MhehBF.js → swimlanes-N4OXWK64-D-bp8wWN.js} +1 -1
  103. package/dist/assets/swimlanesDiagram-K3J5GTZL-DTQBdgKt.js +8 -0
  104. package/dist/assets/{team-share-xt--eeM_.js → team-share-Dpu1nJNz.js} +1 -1
  105. package/dist/assets/{timeline-definition-YOQAKGHF-UBKh0GG-.js → timeline-definition-YOQAKGHF-CtLFkcud.js} +1 -1
  106. package/dist/assets/{usecaseDiagram-VIAY4XPW-CccLioTT.js → usecaseDiagram-VIAY4XPW-AWOhUKvG.js} +1 -1
  107. package/dist/assets/{vennDiagram-BLWOH2XV-3Q39wQgE.js → vennDiagram-BLWOH2XV-C_OYDBvp.js} +1 -1
  108. package/dist/assets/{vi-CVDyZGky.js → vi-P4zxF4j0.js} +1 -1
  109. package/dist/assets/{wardleyDiagram-YMQ3BMBF-DtgEYK7j.js → wardleyDiagram-YMQ3BMBF-CdxMh8tE.js} +1 -1
  110. package/dist/assets/{xychartDiagram-TAQBALBS-DLTmsflK.js → xychartDiagram-TAQBALBS-BL2spC5z.js} +1 -1
  111. package/dist/index.html +3 -3
  112. package/dist/rail.html +5 -5
  113. package/dist-server/index.js +1591 -1578
  114. package/dist-server/package.json +1 -1
  115. package/dist-server/server/index.js +1 -1
  116. package/dist-server/server/initial-greeting.js +4 -0
  117. package/dist-server/server/limix-bot-library.js +178 -0
  118. package/dist-server/server/limix-skill-hub.js +6 -8
  119. package/dist-server/server/routes/bot-skills.js +6 -0
  120. package/dist-server/server/routes/teams.js +1 -1
  121. package/package.json +1 -1
  122. package/dist/assets/App-D-SXyZXT.js +0 -242
  123. package/dist/assets/NewBotDialog-coMM5O6x.js +0 -1
  124. package/dist/assets/SettingsModal-CWtO0RWS.js +0 -11
  125. package/dist/assets/TeamLibraryPanel-Bzvx_MlH.js +0 -1
  126. package/dist/assets/channel-CETDvzTH.js +0 -1
  127. package/dist/assets/styles-B9SGxFnK.css +0 -1
  128. package/dist/assets/swimlanesDiagram-K3J5GTZL-pLYSpGVX.js +0 -8
@@ -1 +0,0 @@
1
- import{t as s,r as o,d as Ae,j as e,X as ve,f as Te,a as Q,ac as ye,ad as Le,h as De,k as Oe,ae as Me,af as Ue,ag as Fe,b as ze,ah as Ie,ai as Ke,aj as _e,ak as $e,p as le,z as He}from"./styles-BHtUK2qB.js";import{n as C,K as Ve,u as k,bL as ee,bM as qe,bN as y,S as R,bO as Je,bP as we,bQ as te,bR as We,bS as Ye,bT as Xe,bU as Ze,bV as oe,bW as ce,bX as Ge,bY as Qe,bZ as et,b_ as je,D as M,b$ as tt,c0 as st,e as ke,c1 as nt,c2 as de,c3 as at,c4 as it,c5 as rt,c6 as lt,c7 as ot,c8 as ct,c9 as dt,ca as ut,cb as pt,cc as xt,cd as mt,ce as gt,cf as ue,cg as ht,ch as ft,ci as bt,cj as vt,ck as Se,cl as Ne,cm as yt,cn as wt,co as jt,cp as kt,cq as St,cr as pe,T as Ce,cs as Nt}from"./App-D-SXyZXT.js";import{B as xe,E as Ct,s as Et,r as me,p as Bt,c as Rt,a as Pt}from"./new-bot-CFOYR98I.js";import{o as At}from"./index-LBC94myy.js";import{I as Tt,S as Lt,a as Dt,A as Ot,M as Mt,P as Ut,V as Ft,v as zt,i as ge}from"./VisibilitySection-C6eVm1Hd.js";import{R as It}from"./RoutinesPage-BZhG-dR9.js";import{r as Kt,L as X,R as _t,U as $t,V as Ht,P as Vt}from"./PlacesRail-CUntVv3u.js";import{p as qt,d as Jt,e as Wt,f as Yt}from"./team-share-xt--eeM_.js";import{B as Xt}from"./BrowserProfilesManager-1DLRt4N9.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(l=>l.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function Gt(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 Qt(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 es(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 ts(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function he(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 fe({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")]],l=[...n,...t.skipped.map(d=>Jt(d,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(([d,c])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:d}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:c,children:c})]},d))}),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(d=>e.jsx("li",{children:Wt(d,t.document)},d))})]}),l.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:l.map((d,c)=>e.jsx("li",{children:d},`${d}-${c}`))})]})]})}function ss({onClose:t}){const n=o.useRef(null),[a,i]=o.useState(""),[r,l]=o.useState(""),[d,c]=o.useState(""),[p,m]=o.useState(""),[w,P]=o.useState(!0),[A,g]=o.useState(!0),[h,v]=o.useState(null),[b,T]=o.useState(null),[f,L]=o.useState(!1),[I,$]=o.useState(null),[U,K]=o.useState(""),_=o.useRef(0);o.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(D=>D||E.profile.name.trim());const S=await qt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||v({dataUrl:S.avatars.defaults,skipped:S.skipped.map(D=>`${s("teamShare.field.picture")} — ${Ae(`teamShare.skip.${D.reason}`,D.reason)}`)})}).catch(()=>{u||v({skipped:[]})}),()=>{u=!0}},[]);const q=u=>({name:a,description:r,release:d,notes:p,includeNotes:w,dryRun:u,...A&&h?.dataUrl?{picture:h.dataUrl}:{}});o.useEffect(()=>{if(!h)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(he({...q(!0),release:void 0}))}).then(S=>{u===_.current&&(T(S),K(""),c(D=>D||S.document.package.release))}).catch(S=>{u===_.current&&(T(null),K(S instanceof Error?S.message:String(S)))})},250);return()=>window.clearTimeout(E)},[h,w,A]);const F=async()=>{if(!f){L(!0),K("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(he(q(!1)))});Yt(u.filename,u.document),$(u)}catch(u){K(u instanceof Error?u.message:String(u))}finally{L(!1)}}};o.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const H=A?h?.skipped??[]:[],z="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Kt.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>{u.target===u.currentTarget&&!f&&t()},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 S=E[0],D=E[E.length-1];u.shiftKey&&document.activeElement===S?(u.preventDefault(),D.focus()):!u.shiftKey&&document.activeElement===D&&(u.preventDefault(),S.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(ve,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:I?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Te,{size:16,className:"text-success"}),s("teamShare.saved",{filename:I.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(fe,{preview:I,localSkips:H})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(fe,{preview:b,localSkips:H}):!U&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(X,{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:A,onChange:u=>g(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:w,onChange:u=>P(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:z})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:d,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>c(u.target.value),className:z})]})]}),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=>l(u.target.value),className:z})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:p,maxLength:4e3,rows:2,disabled:f,onChange:u=>m(u.target.value),className:z})]})]})}),U&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:U}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:I?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:()=>{F()},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(X,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function se(){const{dispatch:t}=k(),[n,a]=o.useState(!1),[i,r]=o.useState("");return{saving:n,error:i,save:async d=>{if(!n){a(!0),r("");try{const c=await C("/api/config",{method:"PATCH",body:JSON.stringify(d)});t({type:"configStatus",config:c})}catch(c){r(c instanceof Error?c.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Bs(){const{state:t}=k(),n=ee(t.config),a=qe(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:l,error:d,save:c}=se();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"):Je(t.config),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:l||!n&&!a&&!i,onClick:()=>{c({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Rs(){const{state:t}=k(),n=we(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:l}=se();return a===void 0||n!==!0||!ee(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:()=>{l({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ns(){const{state:t}=k(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=se();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 as(){const{state:t,dispatch:n}=k(),a=te(t.config),i=We(t.config),r=Ye(t.config),l=Xe(t.config),d=Ze(t.bots,t.instances),[c,p]=o.useState(String(l)),[m,w]=o.useState(!1),[P,A]=o.useState(!1),[g,h]=o.useState(""),v=o.useRef(!1);o.useEffect(()=>{m||p(String(l))},[l,m]);const b=async f=>{if(v.current)return!1;v.current=!0,A(!0),h("");try{const L=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:L}),!0}catch(L){return h(L instanceof Error?L.message:s("settings.experimental.error")),!1}finally{v.current=!1,A(!1)}},T=async()=>{if(!m)return;const f=Ge(c);if(f===null){h(s("settings.experimental.skillReviewStepsRange",{min:ce,max:oe}));return}await b({skillReviewSteps:f})&&w(!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:P||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(is,{engines:d}),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:P,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 ${g?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ce,max:oe,step:1,inputMode:"numeric",value:c,disabled:P,"aria-invalid":!!g,onChange:f=>{p(f.target.value),w(!0),h("")},onBlur:()=>{T()},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,g?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:g}):null]})}function is({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 rs=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function ls(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState("");if(!Qe(t.config))return null;const d=te(t.config),c=et(t.config),p=async m=>{if(!(a||m===c)){i(!0),l("");try{const w=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:m}})});n({type:"configStatus",config:w})}catch(w){l(w instanceof Error?w.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(d?"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:rs.map(m=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===m.value,disabled:a||!d,onClick:()=>{p(m.value)},className:Q("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",c===m.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(m.label)},m.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function os(){return e.jsxs(e.Fragment,{children:[e.jsx(as,{}),e.jsx(ls,{})]})}function Ps({title:t=s("settings.updates.title")}){const n=gt(),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:le(),version:n.version??""}):s("settings.updates.ready",{app:le(),version:n.version??""}):n.status==="installing"?ue(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:ue(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 Ee(){const{state:t,dispatch:n}=k(),a=t.config?.newBots?.effort??"",[i,r]=o.useState(!1),[l,d]=o.useState("");return{current:a,saving:i,error:l,save:async p=>{if(!i){r(!0),d("");try{const m=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:vt(p)?p:null}})});n({type:"configStatus",config:m})}catch(m){d(m instanceof Error?m.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Be({effort:t,className:n}){return e.jsxs(M,{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")}),ht.map(a=>e.jsx("option",{value:a,children:ft(a)},a))]})}function As(){const t=Ee();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(Be,{effort:t,className:"w-full max-w-[240px]"})})}function cs({onEdit:t,onShare:n}){const a=Ee();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(Be,{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 ds(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),l(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:_t().onboarding,hintsSeen:bt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(d=>{n({type:"configStatus",config:d}),n({type:"toggleTour",open:!0})}).catch(()=>l(!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 Ts(){const{dispatch:t}=k();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(ds,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Ls({simple:t=!1}){const{state:n}=k(),a=De(Oe(),n.config?.language);return e.jsx(y,{title:s("settings.language.title"),subtitle:Fe()?s("settings.language.subtitleComplete"):t?ze()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(M,{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=>Ue(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),Me.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Ds({simple:t=!1}){const n=ke();return e.jsx(y,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:de("mod-enter")}),children:e.jsx(M,{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=>at(it(a.target.value)),children:nt.map(a=>e.jsx("option",{value:a,children:de(a)},a))})})}function Os({simple:t=!1}){const n=rt(),a=lt(ke());return e.jsx(y,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(M,{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=>ot(ct(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 Ms({simple:t=!1}){const n=tt();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:()=>st(!n)})})}function Us({simple:t=!1}){const n=ye();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:()=>Le(!n)})})}function Fs(){const t=Ie();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:()=>Ke(!t)})})}function zs(){const t=dt();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:()=>ut(!t)})})}function Is(){const t=_e();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:()=>$e(!t)})})}function Ks(){const t=pt();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:()=>xt(!t)})})}function _s(){const{state:t,dispatch:n}=k(),a=mt(t.config),[i,r]=o.useState(!1),[l,d]=o.useState(""),c=async()=>{if(!i){r(!0),d("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:p})}catch(p){d(p instanceof Error?p.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:l?e.jsx("p",{role:"alert",className:"text-danger",children:l}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{c()},className:"disabled:cursor-wait disabled:opacity-50"})})}function $s(){const{state:t,dispatch:n}=k(),a=te(t.config),[i,r]=o.useState(!1),[l,d]=o.useState(""),c=async p=>{if(!i){r(!0),d("");try{const m=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:p}})});n({type:"configStatus",config:m})}catch(m){d(m instanceof Error?m.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(je,{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:()=>{c(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),l?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:l}):null,e.jsx(os,{}),e.jsx(ns,{})]})}function Hs(){const{state:t}=k(),n=t.config?.browserProfiles??[];return!ee(t.config)&&n.length===0?null:e.jsx(je,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(Xt,{})})}const be=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],us={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 Re(t){return e.jsx($t,{modal:!0,children:e.jsx(ps,{...t})})}function ps({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i}){const r=Ht(),l=k(),[,d]=o.useState(0),[c,p]=o.useState(()=>new xe(Ct,()=>d(x=>x+1))),[m,w]=o.useState("Identity"),[P,A]=o.useState(!1),[g,h]=o.useState(!1),v=g||l.state.botCreationPending,b=o.useRef(!1),T=o.useRef(!0),[f,L]=o.useState(""),[I,$]=o.useState(null),[U,K]=o.useState("everyone"),[_,q]=o.useState(""),F=Se(),H=l.state.config?.team?.name,[z,u]=o.useState(null),E=we(),S=He(),D=ye()?be:be.filter(x=>x!=="Model"),ne=!t&&typeof window<"u"&&!window.ogb&&E===!0,J=o.useRef(null),V=o.useRef(n);V.current=n,o.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=Et(B,!t),N=t||!i?void 0:Ne(i),O=new xe(N?yt(j,N):j,()=>d(Y=>Y+1));N&&(O.role=N.id),p(O),A(!0)}).catch(B=>{x||L(String(B))}),()=>{x=!0}},[t,i]),o.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]),o.useEffect(()=>()=>c.dispose(),[c]),o.useEffect(()=>{v&&J.current?.focus()},[v]),o.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!r())return;const N=J.current;if(!N||j.target instanceof Node&&!N.contains(j.target))return;const O=N.querySelector('[role="dialog"], [role="alertdialog"]');if(O&&O.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),V.current()),j.key!=="Tab"))return;const Y=[...N.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(re=>re.getClientRects().length&&!re.closest("[hidden],fieldset:disabled")),Z=Y[0],G=Y.at(-1);if(!Z||!G){j.preventDefault(),N.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===N)?(j.preventDefault(),G.focus()):!j.shiftKey&&(document.activeElement===G||document.activeElement===N)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[r]);const ae=async()=>{if(!P||b.current||l.state.botCreationPending)return;if(!t&&c.bot.approvalMode==="auto"&&c.bot.computer==="local"&&!c.consent.acknowledgeLocalAuto){$("local");return}const x=ne?zt(U,_):null;if(x&&!x.ok){L(s("botSettings.visibility.needPeople"));return}b.current=!0,h(!0),L(""),l.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Bt(c)})});else{const{bot:B,warnings:j,paused:N}=await Rt(c,void 0,void 0,void 0,x?.ok?x.visibility:void 0,F?me(z,c.bot.section,l.state.bots,F)??void 0:void 0);Pt(l.dispatch,B,j,{showThreads:S,source:c.preset?"preset":c.role?"template":"blank",role:c.role,paused:N});try{await a?.(B)}catch(O){l.dispatch({type:"error",message:O instanceof Error?O.message:String(O)})}}b.current=!1,T.current&&V.current()}catch(B){T.current&&L(B instanceof Error?B.message:String(B))}finally{b.current=!1,l.dispatch({type:"botCreationPending",on:!1}),T.current&&h(!1)}},W=c.bot,Pe={...l,state:{...l.state,bots:[W,...l.state.bots],routines:c.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>W,dispatch:x=>{x.type==="updateBot"&&x.botId===c.id?c.patch(x.patch):x.type==="setModel"&&x.botId===c.id?(c.setModel(x.selection),x.resetApprovalToAsk&&c.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||l.dispatch(x)}},ie=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&&l.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":ie,"aria-busy":v,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:ie}),e.jsx("button",{type:"button",onClick:()=>V.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(ve,{size:18,className:"pointer-events-none"})})]}),F&&!t&&H&&e.jsx(xs,{team:H}),ne&&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(M,{size:"sm",value:U,disabled:v,onChange:x=>K(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")})]})]}),U==="people"&&e.jsx("input",{value:_,disabled:v,onChange:x=>q(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:D.map(x=>e.jsx("button",{type:"button",onClick:()=>w(x),"aria-current":m===x?"page":void 0,className:Q("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",m===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(us[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!P&&!f&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(X,{size:16,className:"animate-spin"}),s("newBot.loading")]}),P&&e.jsx("fieldset",{disabled:v,className:"min-w-0",children:e.jsx(wt,{value:Pe,children:e.jsx(jt.Provider,{value:{request:c.request,draft:!0,uploadAvatar:c.uploadAvatar},children:e.jsx(ms,{active:m,draft:c,defaultsMode:t,owner:F&&!t?{value:me(z,W.section,l.state.bots,F),choose:u}:void 0})})})})]})]}),f&&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:f}),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:()=>V.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:!P||v||!t&&!W.name.trim(),onClick:()=>{ae()},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:[v&&e.jsx(X,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(kt,{open:I==="local",onCancel:()=>$(null),onConfirm:()=>{c.consent.acknowledgeLocalAuto=!0,$(null),ae()}})]})})}function xs({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:()=>{At(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function ms({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:l}=k(),d=Se(),c=St(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(gs,{draft:n,defaultsMode:a}),e.jsx(Tt,{bot:r,patch:c.patch,activeState:c.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(M,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:p=>n.patch({section:p.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...l.sections??[],...l.bots.map(p=>p.section??"")])].filter(Boolean).map(p=>e.jsx("option",{children:p},p))]})]}),i&&d&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(M,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:p=>i.choose(p.target.value),children:d.people.map(p=>e.jsx("option",{value:p.email,children:p.you?s("owner.you",{name:p.name}):p.name},p.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Lt,{bot:r,patch:c.patch}):t==="Skills"?e.jsx(Dt,{bot:r}):t==="Memory"?e.jsx(hs,{draft:n}):t==="Routines"?e.jsx(fs,{draft:n}):t==="Access"?e.jsx(Ot,{bot:r,derived:c}):t==="Model"?e.jsx(Mt,{bot:r}):t==="Permissions"?e.jsx(Ut,{bot:r,derived:c}):e.jsx(Ft,{bot:r,derived:c})}function gs({draft:t,defaultsMode:n}){const[a,i]=o.useState([]),[r,l]=o.useState(0),[d,c]=o.useState(""),p=o.useRef(!1);o.useEffect(()=>{if(n)return;let g=!1;return C("/api/bot-presets").then(h=>{g||i(h.presets)}).catch(()=>{g||i([])}),()=>{g=!0}},[n,r]);const m=t.preset?a.find(g=>g.id===t.preset.id):void 0,w=async g=>{c("");const h=g.startsWith("preset:")?a.find(b=>b.id===g.slice(7)):void 0;if(!h){t.choosePreset(void 0);const b=pe.find(f=>f.id===g);t.chooseRole(b?.id);const T=b&&Ne(b.id)?.look;b&&t.patch({...Nt(b),...T});return}t.patch(Gt(h)),t.choosePreset(ts(h));const v=Qt(h);try{v?(t.patch({avatarUrl:await t.uploadAvatar(v),avatarCrop:h.bot.appearance.avatar.crop}),p.current=!0):p.current&&(t.patch({avatarUrl:""}),p.current=!1)}catch(b){c(b instanceof Error?b.message:String(b))}},P=async g=>{c("");try{await C(`/api/bot-presets/${encodeURIComponent(g.id)}`,{method:"DELETE"}),t.preset?.id===g.id&&t.choosePreset(void 0),l(h=>h+1)}catch(h){c(h instanceof Error?h.message:String(h))}},A=pe.map(g=>e.jsx("option",{value:g.id,children:g.title},g.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(M,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:g=>{w(g.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Zt(a).map(g=>e.jsx("optgroup",{label:g.label,children:g.presets.map(h=>e.jsx("option",{value:`preset:${h.id}`,children:h.name},h.id))},g.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:A}):A]})]}),m&&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:[es(m).map((g,h)=>e.jsx("p",{className:"break-words",children:g},h)),m.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{P(m)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),d&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:d})]})}function hs({draft:t}){const[n,a]=o.useState("MEMORY.md"),[i,r]=o.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(M,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:l=>a(l.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(l=>e.jsx("option",{children:l},l))}),e.jsx("textarea",{className:Q(ge,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:l=>t.setMemory(n,l.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:ge,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:l=>r(l.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 l=`memory/${i}.md`;l in t.template.memory||t.setMemory(l,""),a(l),r("")},children:e.jsx(Vt,{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(Ce,{size:16})})]})]})}function fs({draft:t}){const[n,a]=o.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(Ce,{size:15})})]},i.id)),n&&e.jsx(It,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function bs({simple:t=!1}){const[n,a]=o.useState(!1),[i,r]=o.useState(!1),l=e.jsxs(e.Fragment,{children:[n&&e.jsx(Re,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(ss,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(cs,{onEdit:()=>a(!0),onShare:()=>r(!0)}),l]});const d=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")})]}),l]});return e.jsx(y,{title:s("newBot.defaults"),children:d})}const Vs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:bs,NewBotDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Us as A,Bs as B,Ms as C,bs as D,$s as E,Os as F,Ls as L,As as N,zs as P,Ts as R,Rs as S,_s as T,Ps as U,Hs as a,Ds as b,Fs as c,Ks as d,Is as e,Vs as f};