limixbot 0.2.4 → 0.2.6

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 (129) hide show
  1. package/dist/app-icon-192.png +0 -0
  2. package/dist/app-icon-512.png +0 -0
  3. package/dist/app-icon.svg +1 -4
  4. package/dist/apple-touch-icon.png +0 -0
  5. package/dist/assets/{ActivityPanel-Yt1JPJtx.js → ActivityPanel--I8ZbzPP.js} +1 -1
  6. package/dist/assets/{App-CVCxQPpR.js → App-BV7lfvAV.js} +112 -112
  7. package/dist/assets/{AppEventEditor-C0O8Bn2f.js → AppEventEditor-8B4LbsP2.js} +1 -1
  8. package/dist/assets/{BotSettingsDialog-tUYy15lC.js → BotSettingsDialog-3inJTZDU.js} +4 -4
  9. package/dist/assets/{BrowserPanel-C5enR5R1.js → BrowserPanel-DCL1ihdL.js} +1 -1
  10. package/dist/assets/{BrowserProfilesManager-CSo4X7HO.js → BrowserProfilesManager-BsJcpUXn.js} +1 -1
  11. package/dist/assets/CloudAddDialog-ByLX1_cO.js +1 -0
  12. package/dist/assets/{ComputerFilesPane-DyhJMTEu.js → ComputerFilesPane-DfBb3jpl.js} +1 -1
  13. package/dist/assets/{ComputerPanel-DQydmwiD.js → ComputerPanel-I4wmIpih.js} +2 -2
  14. package/dist/assets/{DataPanel-DrjKXaiE.js → DataPanel-CtUMgjeI.js} +1 -1
  15. package/dist/assets/{DesktopViewer-CYiF8QbG.js → DesktopViewer-D-mh4Mvc.js} +1 -1
  16. package/dist/assets/{FilesView-DHmDJZVD.js → FilesView-JI5NRvg4.js} +1 -1
  17. package/dist/assets/{GrokMoveDialog-BU8ItDTb.js → GrokMoveDialog-9lKJlUqW.js} +3 -3
  18. package/dist/assets/{InspectorPanel-DgSqJslV.js → InspectorPanel-DYjIHQn_.js} +1 -1
  19. package/dist/assets/{KeyboardShortcutsModal-D7Y75zbh.js → KeyboardShortcutsModal-F6vm4Ee4.js} +1 -1
  20. package/dist/assets/{LiveDesktop-DIFFdwoj.js → LiveDesktop-CI9S1x-U.js} +1 -1
  21. package/dist/assets/{LocalVmWorkspace-cE5VrI75.js → LocalVmWorkspace-BVs4kGG8.js} +1 -1
  22. package/dist/assets/{MacLocalControl-CR1xsN8C.js → MacLocalControl-Dnpb-1A_.js} +1 -1
  23. package/dist/assets/{MarkdownFilePreview-C9-_VWg5.js → MarkdownFilePreview-gVi-3dXl.js} +1 -1
  24. package/dist/assets/{MenuMotion-Dh3Gi4kY.js → MenuMotion-DQYRi6n6.js} +1 -1
  25. package/dist/assets/{NewBotDialog-0aO27qTW.js → NewBotDialog-KtFHQMb_.js} +1 -1
  26. package/dist/assets/{PhoneAppDialog-CJeGAXQD.js → PhoneAppDialog-Dnn_AW4P.js} +1 -1
  27. package/dist/assets/PlacesRail-Bpjyw4Vm.js +57 -0
  28. package/dist/assets/{PluginsPanel-CxXhbzxv.js → PluginsPanel-D5f_fUBQ.js} +1 -1
  29. package/dist/assets/ProIntroduction-BPNgfh6z.js +1 -0
  30. package/dist/assets/{RemoteAgentSettingsPanel-Bmhtewtp.js → RemoteAgentSettingsPanel-3RAtLnAr.js} +1 -1
  31. package/dist/assets/{RoomPanel-8hijlQPG.js → RoomPanel-xMkLuBHe.js} +1 -1
  32. package/dist/assets/{RoutinesPage-BmR16t7O.js → RoutinesPage-M0vKACB8.js} +2 -2
  33. package/dist/assets/SettingsModal-Dcmk7Ghv.js +11 -0
  34. package/dist/assets/{ShareTeamDialog-COcdYImw.js → ShareTeamDialog-CeEhxIZd.js} +1 -1
  35. package/dist/assets/{SignedInSites--xtkgjnC.js → SignedInSites-BldnQjjC.js} +1 -1
  36. package/dist/assets/{TeamLibraryPanel-DOVg7avu.js → TeamLibraryPanel-BY_Ycbbf.js} +1 -1
  37. package/dist/assets/{TeamMapPage-r1iwHXYM.js → TeamMapPage-Da5W5s-4.js} +1 -1
  38. package/dist/assets/{TriggersPage-DkPipM4n.js → TriggersPage-D1EMwLwJ.js} +1 -1
  39. package/dist/assets/{VisibilitySection-UlGM_8Ri.js → VisibilitySection-Bg_6NbUb.js} +1 -1
  40. package/dist/assets/{WebhookTrigger-sfrkU37A.js → WebhookTrigger-DsKXQ3Cd.js} +1 -1
  41. package/dist/assets/{WorksOnGrid-Cx__gmQD.js → WorksOnGrid-CfkpIePV.js} +1 -1
  42. package/dist/assets/{abnfDiagram-YUKMZFIV-zKm62LaA.js → abnfDiagram-YUKMZFIV-Ckoz_CzF.js} +1 -1
  43. package/dist/assets/{activity-CPkAJarW.js → activity-CQ1e-FGE.js} +1 -1
  44. package/dist/assets/{architectureDiagram-47P4ROYG-BtuTxvNC.js → architectureDiagram-47P4ROYG-CgPs1VuD.js} +1 -1
  45. package/dist/assets/{blockDiagram-E7TT5TSB-BRCjM53y.js → blockDiagram-E7TT5TSB-Cmb2ImyI.js} +1 -1
  46. package/dist/assets/{c4Diagram-CRA5TL53-C9p73qnX.js → c4Diagram-CRA5TL53-FdJmz2JG.js} +1 -1
  47. package/dist/assets/{calendar-days-DdkRWrHv.js → calendar-days-BUipnvhW.js} +1 -1
  48. package/dist/assets/channel-BzoyEHOy.js +1 -0
  49. package/dist/assets/{chunk-2Q5K7J3B-BVttC6OI.js → chunk-2Q5K7J3B-BzwXKae0.js} +1 -1
  50. package/dist/assets/{chunk-5VM5RSS4-BNqqqnGl.js → chunk-5VM5RSS4-BYWM6mWC.js} +1 -1
  51. package/dist/assets/{chunk-7TKQ45FW-CLkkCMma.js → chunk-7TKQ45FW-BIriaw9d.js} +1 -1
  52. package/dist/assets/{chunk-AW2ZBBNX-ByE3NFnK.js → chunk-AW2ZBBNX-6yQL8NET.js} +1 -1
  53. package/dist/assets/{chunk-FVRAUYC3-D1NFW9zf.js → chunk-FVRAUYC3-B4pej_b0.js} +2 -2
  54. package/dist/assets/{chunk-HTAEGDNF-y9-VGZh8.js → chunk-HTAEGDNF-CyK4QAOD.js} +1 -1
  55. package/dist/assets/{chunk-JWPE2WC7-BOYZL91l.js → chunk-JWPE2WC7-DRvsvO9Z.js} +1 -1
  56. package/dist/assets/{chunk-KQW6MTUR-DRtZ-jux.js → chunk-KQW6MTUR-FEwgYelx.js} +1 -1
  57. package/dist/assets/{chunk-XXDRQBXY-DCH3w3v6.js → chunk-XXDRQBXY-BYleWq1o.js} +1 -1
  58. package/dist/assets/{classDiagram-v2-K4WV4PDN-BziSQpNK.js → classDiagram-v2-K4WV4PDN-BNjClALP.js} +1 -1
  59. package/dist/assets/{coins-BvYP8U4w.js → coins-CxF7VbZf.js} +1 -1
  60. package/dist/assets/{core-DgU9fIH7.js → core-C8K-KBYk.js} +1 -1
  61. package/dist/assets/{cose-bilkent-JH36ORCC-BzC7KDhz.js → cose-bilkent-JH36ORCC-DmY2f5QM.js} +1 -1
  62. package/dist/assets/{cynefin-EF2NZ3EQ-DallfvKE.js → cynefin-EF2NZ3EQ-D4pCl3aZ.js} +1 -1
  63. package/dist/assets/{cynefinDiagram-3GCD6N5R-BlzPquFR.js → cynefinDiagram-3GCD6N5R-jS7kDRoE.js} +1 -1
  64. package/dist/assets/{dagre-W4DXFKR2-XlgF2qP1.js → dagre-W4DXFKR2-Dd5ELGuw.js} +1 -1
  65. package/dist/assets/{diagram-2UJZ2QOL-D6-7kEyN.js → diagram-2UJZ2QOL-B-tizYMz.js} +1 -1
  66. package/dist/assets/{diagram-OVF4WLC6-BuvgW3fs.js → diagram-OVF4WLC6-D3xpMTHl.js} +1 -1
  67. package/dist/assets/{diagram-PFPMY2P6-Cxw7BxsQ.js → diagram-PFPMY2P6-DUf0EYR1.js} +1 -1
  68. package/dist/assets/{diagram-UMYRVEAY-DbaTO7xG.js → diagram-UMYRVEAY-CfhFy4fo.js} +1 -1
  69. package/dist/assets/{diagram-YEKJPTXX-ssS2jDd9.js → diagram-YEKJPTXX-pKD2IJJ7.js} +1 -1
  70. package/dist/assets/{diagram-ZIFT7M5P-MSG2hmJt.js → diagram-ZIFT7M5P-BxunPXAX.js} +1 -1
  71. package/dist/assets/{ebnfDiagram-VR2GEFS7-D3iLv4Vh.js → ebnfDiagram-VR2GEFS7-DPyW7BZH.js} +1 -1
  72. package/dist/assets/{elk-IJKZMXRS-CN_29WGs.js → elk-IJKZMXRS-XJxkJxok.js} +1 -1
  73. package/dist/assets/{erDiagram-O2IAPWRE-Bcl7Id7T.js → erDiagram-O2IAPWRE-CUES7W0a.js} +1 -1
  74. package/dist/assets/{file-up-CCEcdqcW.js → file-up-BDUXq-vg.js} +1 -1
  75. package/dist/assets/{flowDiagram-OXPTDLAJ-n2WLJBHk.js → flowDiagram-OXPTDLAJ-B5acRFQe.js} +1 -1
  76. package/dist/assets/{ganttDiagram-R7TSEDQI-BXBxYc2Z.js → ganttDiagram-R7TSEDQI-CQp0rp67.js} +1 -1
  77. package/dist/assets/{gitGraphDiagram-XJZIOB7I-B3rVvw07.js → gitGraphDiagram-XJZIOB7I-Chl_xMxf.js} +1 -1
  78. package/dist/assets/{import-name-QCV3NxTT.js → import-name-fDjyR5kx.js} +1 -1
  79. package/dist/assets/{index-DMDRA73w.js → index-3mZteHSQ.js} +1 -1
  80. package/dist/assets/index-BUpSDhKQ.js +2 -0
  81. package/dist/assets/{index-DxGSNARA.js → index-CZgKLcUm.js} +1 -1
  82. package/dist/assets/{infoDiagram-5W2HQ5XZ-BxRrhDe0.js → infoDiagram-5W2HQ5XZ-DDJYDjQ5.js} +1 -1
  83. package/dist/assets/{ishikawaDiagram-K3B6WC7H-ZOdsAPxi.js → ishikawaDiagram-K3B6WC7H-Bxd_dhZZ.js} +1 -1
  84. package/dist/assets/{journeyDiagram-COXZFDF6-axLKau4X.js → journeyDiagram-COXZFDF6-BYF-sQSD.js} +1 -1
  85. package/dist/assets/{kanban-definition-P3RFRI5V-DTVUrJqt.js → kanban-definition-P3RFRI5V-B0wBqOFH.js} +1 -1
  86. package/dist/assets/{mcp-servers-kshb3G8M.js → mcp-servers-xsYOIrTE.js} +1 -1
  87. package/dist/assets/{mermaid.core-D8G0v7ax.js → mermaid.core-C6PKoMQA.js} +4 -4
  88. package/dist/assets/{mindmap-definition-LZFPQGKD-eR6Dlm_o.js → mindmap-definition-LZFPQGKD-BlN8ZHNR.js} +1 -1
  89. package/dist/assets/{minimize-DsfIgSIh.js → minimize-BPbapdk9.js} +1 -1
  90. package/dist/assets/{monitor-CJJehAYK.js → monitor-Xr0SgoUO.js} +1 -1
  91. package/dist/assets/{new-bot-BxtfLvSH.js → new-bot-DZ8WGB0A.js} +2 -2
  92. package/dist/assets/{org-library-j54w6Ia7.js → org-library-jgASeM26.js} +1 -1
  93. package/dist/assets/{package-format-CMWKE_F6.js → package-format-HQ4GXg3u.js} +1 -1
  94. package/dist/assets/{pegDiagram-BGZESJAR-BabDseNJ.js → pegDiagram-BGZESJAR-Dts1Xq7B.js} +1 -1
  95. package/dist/assets/{pieDiagram-CAPJLFHJ-BKvqDvl1.js → pieDiagram-CAPJLFHJ-D6BLN9z8.js} +1 -1
  96. package/dist/assets/{quadrantDiagram-GDMTTRAM-B04ZbGZP.js → quadrantDiagram-GDMTTRAM-BNXscncZ.js} +1 -1
  97. package/dist/assets/rail-KIYXnvmP.js +1 -0
  98. package/dist/assets/{railroadDiagram-SM67HX2B-DcJknZtN.js → railroadDiagram-SM67HX2B-BcriwGaw.js} +1 -1
  99. package/dist/assets/{remote-desktop-panel-CqR9sYPm.js → remote-desktop-panel-D-AMCL3e.js} +1 -1
  100. package/dist/assets/{requirementDiagram-X7JNWC4A-CkeImvIM.js → requirementDiagram-X7JNWC4A-DFVmx-Hz.js} +1 -1
  101. package/dist/assets/{sankeyDiagram-UM26HJRW-DYxARQh9.js → sankeyDiagram-UM26HJRW-fySjdOut.js} +1 -1
  102. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-DWd9rdXx.js → sequenceDiagram-ZO4K6R2Y-CXrhKe3C.js} +1 -1
  103. package/dist/assets/{sizeCapture-INFHLROL-CjzuzZLP.js → sizeCapture-INFHLROL-D7uoCaYO.js} +1 -1
  104. package/dist/assets/{stateDiagram-v2-TBUQTH76-CLmc94Ln.js → stateDiagram-v2-TBUQTH76-BcNwr-uw.js} +1 -1
  105. package/dist/assets/{styles-NM37uvmJ.js → styles-DSEcltf1.js} +3 -3
  106. package/dist/assets/{swimlanes-N4OXWK64-Dmc-N6gk.js → swimlanes-N4OXWK64-BXzCyVrs.js} +1 -1
  107. package/dist/assets/swimlanesDiagram-K3J5GTZL-kYQoltjc.js +8 -0
  108. package/dist/assets/{team-share-CfzFiDJl.js → team-share-BrQ2rI3n.js} +1 -1
  109. package/dist/assets/{timeline-definition-YOQAKGHF-B4YfX3Wn.js → timeline-definition-YOQAKGHF-BdAlbPSb.js} +1 -1
  110. package/dist/assets/{usecaseDiagram-VIAY4XPW-tkKvR-PW.js → usecaseDiagram-VIAY4XPW-CIBiINMq.js} +1 -1
  111. package/dist/assets/{vennDiagram-BLWOH2XV-CWEUMDKu.js → vennDiagram-BLWOH2XV-Ctrb2l50.js} +1 -1
  112. package/dist/assets/{wardleyDiagram-YMQ3BMBF-DRcqmHpZ.js → wardleyDiagram-YMQ3BMBF-kLbK1beS.js} +1 -1
  113. package/dist/assets/{xychartDiagram-TAQBALBS-B-YwOKwp.js → xychartDiagram-TAQBALBS-C5baNmCt.js} +1 -1
  114. package/dist/index.html +2 -2
  115. package/dist/rail.html +4 -4
  116. package/dist-server/package.json +1 -1
  117. package/dist-server/shared/mascot-bodies.js +4 -4
  118. package/package.json +1 -1
  119. package/dist/assets/CloudAddDialog-DsTSypGV.js +0 -1
  120. package/dist/assets/PlacesRail-BI7EZKaw.js +0 -57
  121. package/dist/assets/ProIntroduction-CQDF5fEs.js +0 -1
  122. package/dist/assets/SettingsModal-BJCVgscC.js +0 -11
  123. package/dist/assets/channel-BEZp93ad.js +0 -1
  124. package/dist/assets/cursor-128-D_P4sIyM.webp +0 -0
  125. package/dist/assets/cursor-192-TWSdnzcT.webp +0 -0
  126. package/dist/assets/cursor-256-Mw4jC-Z3.webp +0 -0
  127. package/dist/assets/index-DeIGTf2I.js +0 -2
  128. package/dist/assets/rail-COJ1VklA.js +0 -1
  129. package/dist/assets/swimlanesDiagram-K3J5GTZL-DHOLnd-u.js +0 -8
@@ -1 +1 @@
1
- import{t as s,r as o,d as Te,j as e,X as ve,f as Ae,a as G,am as ye,an as Le,v as De,w as Oe,ao as Me,ap as Ue,aq as Fe,b as ze,ar as Ie,as as Ke,at as _e,au as $e,p as le,J as Je}from"./styles-NM37uvmJ.js";import{n as B,E as He,u as k,bJ as ee,bK as qe,a3 as w,S as T,bL as Ve,bM as we,bN as te,bO as We,bP as Ye,bQ as Xe,bR as oe,bS as ce,bT as Qe,bU as Ze,bV as Ge,bW as je,D as O,bX as et,bY as tt,e as Se,bZ as st,b_ as de,b$ as nt,c0 as at,c1 as it,c2 as rt,c3 as lt,c4 as ot,c5 as ct,c6 as dt,c7 as ut,c8 as pt,c9 as mt,ca as xt,cb as ue,cc as gt,cd as ht,ce as ft,cf as bt,cg as ke,ch as Ne,ci as vt,cj as yt,ck as wt,cl as jt,cm as St,cn as pe,T as Ce,co as kt}from"./App-CVCxQPpR.js";import{B as me,E as Nt,s as Ct,r as xe,p as Et,c as Bt,a as Rt}from"./new-bot-BxtfLvSH.js";import{o as Pt}from"./index-DeIGTf2I.js";import{I as Tt,S as At,a as Lt,A as Dt,M as Ot,P as Mt,V as Ut,v as Ft,i as ge}from"./VisibilitySection-UlGM_8Ri.js";import{R as zt}from"./RoutinesPage-BmR16t7O.js";import{r as It,L as X,Q as Kt,R as _t,U as $t,P as Jt}from"./PlacesRail-BI7EZKaw.js";import{p as Ht,d as qt,e as Vt,f as Wt}from"./team-share-CfzFiDJl.js";import{B as Yt}from"./BrowserProfilesManager-CSo4X7HO.js";function Xt(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 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 Zt(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 Gt(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 es(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=>qt(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(He,{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:Vt(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 ts({onClose:t}){const n=o.useRef(null),[a,i]=o.useState(""),[r,l]=o.useState(""),[d,c]=o.useState(""),[p,g]=o.useState(""),[j,A]=o.useState(!0),[N,x]=o.useState(!0),[h,y]=o.useState(null),[b,v]=o.useState(null),[f,M]=o.useState(!1),[I,$]=o.useState(null),[U,K]=o.useState(""),_=o.useRef(0);o.useEffect(()=>{let u=!1;return B("/api/bot-defaults").then(async({defaults:R})=>{!u&&R.profile.name?.trim()&&i(L=>L||R.profile.name.trim());const C=await Ht([{id:"defaults",avatarUrl:R.profile.avatarUrl,avatarCrop:R.profile.avatarCrop}]);u||y({dataUrl:C.avatars.defaults,skipped:C.skipped.map(L=>`${s("teamShare.field.picture")} — ${Te(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||y({skipped:[]})}),()=>{u=!0}},[]);const q=u=>({name:a,description:r,release:d,notes:p,includeNotes:j,dryRun:u,...N&&h?.dataUrl?{picture:h.dataUrl}:{}});o.useEffect(()=>{if(!h)return;const u=++_.current,R=window.setTimeout(()=>{B("/api/teams/export",{method:"POST",body:JSON.stringify(he({...q(!0),release:void 0}))}).then(C=>{u===_.current&&(v(C),K(""),c(L=>L||C.document.package.release))}).catch(C=>{u===_.current&&(v(null),K(C instanceof Error?C.message:String(C)))})},250);return()=>window.clearTimeout(R)},[h,j,N]);const F=async()=>{if(!f){M(!0),K("");try{const u=await B("/api/teams/export",{method:"POST",body:JSON.stringify(he(q(!1)))});Wt(u.filename,u.document),$(u)}catch(u){K(u instanceof Error?u.message:String(u))}finally{M(!1)}}};o.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const J=N?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 It.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 R=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!R?.length)return;const C=R[0],L=R[R.length-1];u.shiftKey&&document.activeElement===C?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),C.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(Ae,{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:J})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(fe,{preview:b,localSkips:J}):!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:N,onChange:u=>x(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:j,onChange:u=>A(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=>g(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 B("/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 Es(){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(w,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Ve(t.config),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(T,{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 Bs(){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(w,{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(T,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{l({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ss(){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(T,{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 ns(){const{state:t,dispatch:n}=k(),a=te(t.config),i=We(t.config),r=Ye(t.config),l=Xe(t.bots,t.instances),[d,c]=o.useState(String(r)),[p,g]=o.useState(!1),[j,A]=o.useState(!1),[N,x]=o.useState(""),h=o.useRef(!1);o.useEffect(()=>{p||c(String(r))},[r,p]);const y=async v=>{if(h.current)return!1;h.current=!0,A(!0),x("");try{const f=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:v})});return n({type:"configStatus",config:f}),!0}catch(f){return x(f instanceof Error?f.message:s("settings.experimental.error")),!1}finally{h.current=!1,A(!1)}},b=async()=>{if(!p)return;const v=Qe(d);if(v===null){x(s("settings.experimental.skillReviewStepsRange",{min:ce,max:oe}));return}await y({skillReviewSteps:v})&&g(!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(T,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:j||!a,onClick:()=>{y({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(as,{engines:l}),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 ${N?"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:d,disabled:j,"aria-invalid":!!N,onChange:v=>{c(v.target.value),g(!0),x("")},onBlur:()=>{b()},onKeyDown:v=>{v.key==="Enter"&&v.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,N?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:N}):null]})}function as({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 is=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function rs(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState("");if(!Ze(t.config))return null;const d=te(t.config),c=Ge(t.config),p=async g=>{if(!(a||g===c)){i(!0),l("");try{const j=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:g}})});n({type:"configStatus",config:j})}catch(j){l(j instanceof Error?j.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:is.map(g=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===g.value,disabled:a||!d,onClick:()=>{p(g.value)},className:G("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",c===g.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(g.label)},g.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ls(){return e.jsxs(e.Fragment,{children:[e.jsx(ns,{}),e.jsx(rs,{})]})}function Rs({title:t=s("settings.updates.title")}){const n=xt(),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(w,{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 g=await B("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:bt(p)?p:null}})});n({type:"configStatus",config:g})}catch(g){d(g instanceof Error?g.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Be({effort:t,className:n}){return e.jsxs(O,{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")}),gt.map(a=>e.jsx("option",{value:a,children:ht(a)},a))]})}function Ps(){const t=Ee();return e.jsx(w,{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 os({onEdit:t,onShare:n}){const a=Ee();return e.jsx(w,{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 cs(){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),B("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Kt().onboarding,hintsSeen:ft(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(w,{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(cs,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function As({simple:t=!1}){const{state:n}=k(),a=De(Oe(),n.config?.language);return e.jsx(w,{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(O,{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 Ls({simple:t=!1}){const n=Se();return e.jsx(w,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:de("mod-enter")}),children:e.jsx(O,{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=>nt(at(a.target.value)),children:st.map(a=>e.jsx("option",{value:a,children:de(a)},a))})})}function Ds({simple:t=!1}){const n=it(),a=rt(Se());return e.jsx(w,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(O,{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=>lt(ot(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 Os({simple:t=!1}){const n=et();return e.jsx(w,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(T,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>tt(!n)})})}function Ms({simple:t=!1}){const n=ye();return e.jsx(w,{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(T,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Le(!n)})})}function Us(){const t=Ie();return e.jsx(w,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>Ke(!t)})})}function Fs(){const t=ct();return e.jsx(w,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>dt(!t)})})}function zs(){const t=_e();return e.jsx(w,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>$e(!t)})})}function Is(){const t=ut();return e.jsx(w,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>pt(!t)})})}function Ks(){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 B("/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(w,{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(T,{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 g=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:p}})});n({type:"configStatus",config:g})}catch(g){d(g instanceof Error?g.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(T,{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(ls,{}),e.jsx(ss,{})]})}function $s(){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(Yt,{})})}const be=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],ds={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(us,{...t})})}function us({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i}){const r=$t(),l=k(),[,d]=o.useState(0),[c,p]=o.useState(()=>new me(Nt,()=>d(m=>m+1))),[g,j]=o.useState("Identity"),[A,N]=o.useState(!1),[x,h]=o.useState(!1),y=x||l.state.botCreationPending,b=o.useRef(!1),v=o.useRef(!0),[f,M]=o.useState(""),[I,$]=o.useState(null),[U,K]=o.useState("everyone"),[_,q]=o.useState(""),F=ke(),J=l.state.config?.team?.name,[z,u]=o.useState(null),R=we(),C=Je(),L=ye()?be:be.filter(m=>m!=="Model"),ne=!t&&typeof window<"u"&&!window.ogb&&R===!0,V=o.useRef(null),H=o.useRef(n);H.current=n,o.useEffect(()=>{let m=!1;return B("/api/bot-defaults").then(P=>{if(m)return;const S=Ct(P,!t),E=t||!i?void 0:Ne(i),D=new me(E?vt(S,E):S,()=>d(Y=>Y+1));E&&(D.role=E.id),p(D),N(!0)}).catch(P=>{m||M(String(P))}),()=>{m=!0}},[t,i]),o.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),o.useEffect(()=>()=>c.dispose(),[c]),o.useEffect(()=>{y&&V.current?.focus()},[y]),o.useEffect(()=>{const m=document.activeElement instanceof HTMLElement?document.activeElement:null;V.current?.focus();const P=S=>{if(!r())return;const E=V.current;if(!E||S.target instanceof Node&&!E.contains(S.target))return;const D=E.querySelector('[role="dialog"], [role="alertdialog"]');if(D&&D.getClientRects().length||(S.key==="Escape"&&(S.preventDefault(),H.current()),S.key!=="Tab"))return;const Y=[...E.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")),Q=Y[0],Z=Y.at(-1);if(!Q||!Z){S.preventDefault(),E.focus();return}S.shiftKey&&(document.activeElement===Q||document.activeElement===E)?(S.preventDefault(),Z.focus()):!S.shiftKey&&(document.activeElement===Z||document.activeElement===E)&&(S.preventDefault(),Q.focus())};return window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P),m?.isConnected&&m.focus()}},[r]);const ae=async()=>{if(!A||b.current||l.state.botCreationPending)return;if(!t&&c.bot.approvalMode==="auto"&&c.bot.computer==="local"&&!c.consent.acknowledgeLocalAuto){$("local");return}const m=ne?Ft(U,_):null;if(m&&!m.ok){M(s("botSettings.visibility.needPeople"));return}b.current=!0,h(!0),M(""),l.dispatch({type:"botCreationPending",on:!0});try{if(t)await B("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Et(c)})});else{const{bot:P,warnings:S,paused:E}=await Bt(c,void 0,void 0,void 0,m?.ok?m.visibility:void 0,F?xe(z,c.bot.section,l.state.bots,F)??void 0:void 0);Rt(l.dispatch,P,S,{showThreads:C,source:c.preset?"preset":c.role?"template":"blank",role:c.role,paused:E});try{await a?.(P)}catch(D){l.dispatch({type:"error",message:D instanceof Error?D.message:String(D)})}}b.current=!1,v.current&&H.current()}catch(P){v.current&&M(P instanceof Error?P.message:String(P))}finally{b.current=!1,l.dispatch({type:"botCreationPending",on:!1}),v.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:m=>{m.type==="updateBot"&&m.botId===c.id?c.patch(m.patch):m.type==="setModel"&&m.botId===c.id?(c.setModel(m.selection),m.resetApprovalToAsk&&c.patch({approvalMode:"ask"})):m.type==="routinePatched"||m.type==="toggleSettings"||l.dispatch(m)}},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:V,role:"dialog","aria-modal":"true","aria-label":ie,"aria-busy":y,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:()=>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(ve,{size:18,className:"pointer-events-none"})})]}),F&&!t&&J&&e.jsx(ps,{team:J}),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(O,{size:"sm",value:U,disabled:y,onChange:m=>K(m.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:y,onChange:m=>q(m.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:L.map(m=>e.jsx("button",{type:"button",onClick:()=>j(m),"aria-current":g===m?"page":void 0,className:G("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",g===m?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(ds[m])},m))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!A&&!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")]}),A&&e.jsx("fieldset",{disabled:y,className:"min-w-0",children:e.jsx(yt,{value:Pe,children:e.jsx(wt.Provider,{value:{request:c.request,draft:!0,uploadAvatar:c.uploadAvatar},children:e.jsx(ms,{active:g,draft:c,defaultsMode:t,owner:F&&!t?{value:xe(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:()=>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:!A||y||!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:[y&&e.jsx(X,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(jt,{open:I==="local",onCancel:()=>$(null),onConfirm:()=>{c.consent.acknowledgeLocalAuto=!0,$(null),ae()}})]})})}function ps({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:()=>{Pt(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=ke(),c=St(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(xs,{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(O,{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(O,{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(At,{bot:r,patch:c.patch}):t==="Skills"?e.jsx(Lt,{bot:r}):t==="Memory"?e.jsx(gs,{draft:n}):t==="Routines"?e.jsx(hs,{draft:n}):t==="Access"?e.jsx(Dt,{bot:r,derived:c}):t==="Model"?e.jsx(Ot,{bot:r}):t==="Permissions"?e.jsx(Mt,{bot:r,derived:c}):e.jsx(Ut,{bot:r,derived:c})}function xs({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 x=!1;return B("/api/bot-presets").then(h=>{x||i(h.presets)}).catch(()=>{x||i([])}),()=>{x=!0}},[n,r]);const g=t.preset?a.find(x=>x.id===t.preset.id):void 0,j=async x=>{c("");const h=x.startsWith("preset:")?a.find(b=>b.id===x.slice(7)):void 0;if(!h){t.choosePreset(void 0);const b=pe.find(f=>f.id===x);t.chooseRole(b?.id);const v=b&&Ne(b.id)?.look;b&&t.patch({...kt(b),...v});return}t.patch(Qt(h)),t.choosePreset(es(h));const y=Zt(h);try{y?(t.patch({avatarUrl:await t.uploadAvatar(y),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))}},A=async x=>{c("");try{await B(`/api/bot-presets/${encodeURIComponent(x.id)}`,{method:"DELETE"}),t.preset?.id===x.id&&t.choosePreset(void 0),l(h=>h+1)}catch(h){c(h instanceof Error?h.message:String(h))}},N=pe.map(x=>e.jsx("option",{value:x.id,children:x.title},x.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(O,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:x=>{j(x.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Xt(a).map(x=>e.jsx("optgroup",{label:x.label,children:x.presets.map(h=>e.jsx("option",{value:`preset:${h.id}`,children:h.name},h.id))},x.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:N}):N]})]}),g&&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:[Gt(g).map((x,h)=>e.jsx("p",{className:"break-words",children:x},h)),g.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{A(g)},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 gs({draft:t}){const[n,a]=o.useState("MEMORY.md"),[i,r]=o.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(O,{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:G(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(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(Ce,{size:16})})]})]})}function hs({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(zt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function fs({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(ts,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(os,{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(w,{title:s("newBot.defaults"),children:d})}const Js=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:fs,NewBotDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Ms as A,Es as B,Os as C,fs as D,_s as E,Ds as F,As as L,Ps as N,Fs as P,Ts as R,Bs as S,Ks as T,Rs as U,$s as a,Ls as b,Us as c,Is as d,zs as e,Js as f};
1
+ import{t as s,r as o,d as Te,j as e,X as ve,f as Ae,a as G,ah as ye,ai as Le,h as De,k as Oe,aj as Me,ak as Ue,al as Fe,b as ze,am as Ie,an as Ke,ao as _e,ap as $e,p as le,B as He}from"./styles-DSEcltf1.js";import{n as B,E as Je,u as k,bH as ee,bI as Ve,bJ as w,S as T,bK as We,bL as we,bM as te,bN as Ye,bO as qe,bP as Xe,bQ as oe,bR as ce,bS as Qe,bT as Ze,bU as Ge,bV as je,D as O,bW as et,bX as tt,e as Se,bY as st,bZ as de,b_ as nt,b$ as at,c0 as it,c1 as rt,c2 as lt,c3 as ot,c4 as ct,c5 as dt,c6 as ut,c7 as pt,c8 as mt,c9 as xt,ca as ue,cb as gt,cc as ht,cd as ft,ce as bt,cf as ke,cg as Ne,ch as vt,ci as yt,cj as wt,ck as jt,cl as St,cm as pe,T as Ce,cn as kt}from"./App-BV7lfvAV.js";import{B as me,E as Nt,s as Ct,r as xe,p as Et,c as Bt,a as Rt}from"./new-bot-DZ8WGB0A.js";import{o as Pt}from"./index-BUpSDhKQ.js";import{I as Tt,S as At,a as Lt,A as Dt,M as Ot,P as Mt,V as Ut,v as Ft,i as ge}from"./VisibilitySection-Bg_6NbUb.js";import{R as zt}from"./RoutinesPage-M0vKACB8.js";import{r as It,L as X,Q as Kt,R as _t,U as $t,P as Ht}from"./PlacesRail-Bpjyw4Vm.js";import{p as Jt,d as Vt,e as Wt,f as Yt}from"./team-share-BrQ2rI3n.js";import{B as qt}from"./BrowserProfilesManager-BsJcpUXn.js";function Xt(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 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 Zt(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 Gt(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 es(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=>Vt(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(Je,{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 ts({onClose:t}){const n=o.useRef(null),[a,i]=o.useState(""),[r,l]=o.useState(""),[d,c]=o.useState(""),[p,g]=o.useState(""),[j,A]=o.useState(!0),[N,x]=o.useState(!0),[h,y]=o.useState(null),[b,v]=o.useState(null),[f,M]=o.useState(!1),[I,$]=o.useState(null),[U,K]=o.useState(""),_=o.useRef(0);o.useEffect(()=>{let u=!1;return B("/api/bot-defaults").then(async({defaults:R})=>{!u&&R.profile.name?.trim()&&i(L=>L||R.profile.name.trim());const C=await Jt([{id:"defaults",avatarUrl:R.profile.avatarUrl,avatarCrop:R.profile.avatarCrop}]);u||y({dataUrl:C.avatars.defaults,skipped:C.skipped.map(L=>`${s("teamShare.field.picture")} — ${Te(`teamShare.skip.${L.reason}`,L.reason)}`)})}).catch(()=>{u||y({skipped:[]})}),()=>{u=!0}},[]);const V=u=>({name:a,description:r,release:d,notes:p,includeNotes:j,dryRun:u,...N&&h?.dataUrl?{picture:h.dataUrl}:{}});o.useEffect(()=>{if(!h)return;const u=++_.current,R=window.setTimeout(()=>{B("/api/teams/export",{method:"POST",body:JSON.stringify(he({...V(!0),release:void 0}))}).then(C=>{u===_.current&&(v(C),K(""),c(L=>L||C.document.package.release))}).catch(C=>{u===_.current&&(v(null),K(C instanceof Error?C.message:String(C)))})},250);return()=>window.clearTimeout(R)},[h,j,N]);const F=async()=>{if(!f){M(!0),K("");try{const u=await B("/api/teams/export",{method:"POST",body:JSON.stringify(he(V(!1)))});Yt(u.filename,u.document),$(u)}catch(u){K(u instanceof Error?u.message:String(u))}finally{M(!1)}}};o.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const H=N?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 It.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 R=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!R?.length)return;const C=R[0],L=R[R.length-1];u.shiftKey&&document.activeElement===C?(u.preventDefault(),L.focus()):!u.shiftKey&&document.activeElement===L&&(u.preventDefault(),C.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(Ae,{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:N,onChange:u=>x(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:j,onChange:u=>A(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=>g(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 B("/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 Es(){const{state:t}=k(),n=ee(t.config),a=Ve(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(w,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):We(t.config),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(T,{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 Bs(){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(w,{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(T,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{l({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ss(){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(T,{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 ns(){const{state:t,dispatch:n}=k(),a=te(t.config),i=Ye(t.config),r=qe(t.config),l=Xe(t.bots,t.instances),[d,c]=o.useState(String(r)),[p,g]=o.useState(!1),[j,A]=o.useState(!1),[N,x]=o.useState(""),h=o.useRef(!1);o.useEffect(()=>{p||c(String(r))},[r,p]);const y=async v=>{if(h.current)return!1;h.current=!0,A(!0),x("");try{const f=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:v})});return n({type:"configStatus",config:f}),!0}catch(f){return x(f instanceof Error?f.message:s("settings.experimental.error")),!1}finally{h.current=!1,A(!1)}},b=async()=>{if(!p)return;const v=Qe(d);if(v===null){x(s("settings.experimental.skillReviewStepsRange",{min:ce,max:oe}));return}await y({skillReviewSteps:v})&&g(!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(T,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:j||!a,onClick:()=>{y({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(as,{engines:l}),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 ${N?"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:d,disabled:j,"aria-invalid":!!N,onChange:v=>{c(v.target.value),g(!0),x("")},onBlur:()=>{b()},onKeyDown:v=>{v.key==="Enter"&&v.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,N?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:N}):null]})}function as({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 is=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function rs(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState("");if(!Ze(t.config))return null;const d=te(t.config),c=Ge(t.config),p=async g=>{if(!(a||g===c)){i(!0),l("");try{const j=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:g}})});n({type:"configStatus",config:j})}catch(j){l(j instanceof Error?j.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:is.map(g=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===g.value,disabled:a||!d,onClick:()=>{p(g.value)},className:G("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",c===g.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(g.label)},g.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function ls(){return e.jsxs(e.Fragment,{children:[e.jsx(ns,{}),e.jsx(rs,{})]})}function Rs({title:t=s("settings.updates.title")}){const n=xt(),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(w,{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 g=await B("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:bt(p)?p:null}})});n({type:"configStatus",config:g})}catch(g){d(g instanceof Error?g.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Be({effort:t,className:n}){return e.jsxs(O,{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")}),gt.map(a=>e.jsx("option",{value:a,children:ht(a)},a))]})}function Ps(){const t=Ee();return e.jsx(w,{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 os({onEdit:t,onShare:n}){const a=Ee();return e.jsx(w,{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 cs(){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),B("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:Kt().onboarding,hintsSeen:ft(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(w,{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(cs,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function As({simple:t=!1}){const{state:n}=k(),a=De(Oe(),n.config?.language);return e.jsx(w,{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(O,{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 Ls({simple:t=!1}){const n=Se();return e.jsx(w,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:de("mod-enter")}),children:e.jsx(O,{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=>nt(at(a.target.value)),children:st.map(a=>e.jsx("option",{value:a,children:de(a)},a))})})}function Ds({simple:t=!1}){const n=it(),a=rt(Se());return e.jsx(w,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(O,{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=>lt(ot(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 Os({simple:t=!1}){const n=et();return e.jsx(w,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(T,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>tt(!n)})})}function Ms({simple:t=!1}){const n=ye();return e.jsx(w,{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(T,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Le(!n)})})}function Us(){const t=Ie();return e.jsx(w,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>Ke(!t)})})}function Fs(){const t=ct();return e.jsx(w,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>dt(!t)})})}function zs(){const t=_e();return e.jsx(w,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>$e(!t)})})}function Is(){const t=ut();return e.jsx(w,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(T,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>pt(!t)})})}function Ks(){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 B("/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(w,{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(T,{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 g=await B("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:p}})});n({type:"configStatus",config:g})}catch(g){d(g instanceof Error?g.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(T,{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(ls,{}),e.jsx(ss,{})]})}function $s(){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(qt,{})})}const be=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],ds={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(us,{...t})})}function us({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i}){const r=$t(),l=k(),[,d]=o.useState(0),[c,p]=o.useState(()=>new me(Nt,()=>d(m=>m+1))),[g,j]=o.useState("Identity"),[A,N]=o.useState(!1),[x,h]=o.useState(!1),y=x||l.state.botCreationPending,b=o.useRef(!1),v=o.useRef(!0),[f,M]=o.useState(""),[I,$]=o.useState(null),[U,K]=o.useState("everyone"),[_,V]=o.useState(""),F=ke(),H=l.state.config?.team?.name,[z,u]=o.useState(null),R=we(),C=He(),L=ye()?be:be.filter(m=>m!=="Model"),ne=!t&&typeof window<"u"&&!window.ogb&&R===!0,W=o.useRef(null),J=o.useRef(n);J.current=n,o.useEffect(()=>{let m=!1;return B("/api/bot-defaults").then(P=>{if(m)return;const S=Ct(P,!t),E=t||!i?void 0:Ne(i),D=new me(E?vt(S,E):S,()=>d(q=>q+1));E&&(D.role=E.id),p(D),N(!0)}).catch(P=>{m||M(String(P))}),()=>{m=!0}},[t,i]),o.useEffect(()=>(v.current=!0,()=>{v.current=!1}),[]),o.useEffect(()=>()=>c.dispose(),[c]),o.useEffect(()=>{y&&W.current?.focus()},[y]),o.useEffect(()=>{const m=document.activeElement instanceof HTMLElement?document.activeElement:null;W.current?.focus();const P=S=>{if(!r())return;const E=W.current;if(!E||S.target instanceof Node&&!E.contains(S.target))return;const D=E.querySelector('[role="dialog"], [role="alertdialog"]');if(D&&D.getClientRects().length||(S.key==="Escape"&&(S.preventDefault(),J.current()),S.key!=="Tab"))return;const q=[...E.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")),Q=q[0],Z=q.at(-1);if(!Q||!Z){S.preventDefault(),E.focus();return}S.shiftKey&&(document.activeElement===Q||document.activeElement===E)?(S.preventDefault(),Z.focus()):!S.shiftKey&&(document.activeElement===Z||document.activeElement===E)&&(S.preventDefault(),Q.focus())};return window.addEventListener("keydown",P),()=>{window.removeEventListener("keydown",P),m?.isConnected&&m.focus()}},[r]);const ae=async()=>{if(!A||b.current||l.state.botCreationPending)return;if(!t&&c.bot.approvalMode==="auto"&&c.bot.computer==="local"&&!c.consent.acknowledgeLocalAuto){$("local");return}const m=ne?Ft(U,_):null;if(m&&!m.ok){M(s("botSettings.visibility.needPeople"));return}b.current=!0,h(!0),M(""),l.dispatch({type:"botCreationPending",on:!0});try{if(t)await B("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Et(c)})});else{const{bot:P,warnings:S,paused:E}=await Bt(c,void 0,void 0,void 0,m?.ok?m.visibility:void 0,F?xe(z,c.bot.section,l.state.bots,F)??void 0:void 0);Rt(l.dispatch,P,S,{showThreads:C,source:c.preset?"preset":c.role?"template":"blank",role:c.role,paused:E});try{await a?.(P)}catch(D){l.dispatch({type:"error",message:D instanceof Error?D.message:String(D)})}}b.current=!1,v.current&&J.current()}catch(P){v.current&&M(P instanceof Error?P.message:String(P))}finally{b.current=!1,l.dispatch({type:"botCreationPending",on:!1}),v.current&&h(!1)}},Y=c.bot,Pe={...l,state:{...l.state,bots:[Y,...l.state.bots],routines:c.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>Y,dispatch:m=>{m.type==="updateBot"&&m.botId===c.id?c.patch(m.patch):m.type==="setModel"&&m.botId===c.id?(c.setModel(m.selection),m.resetApprovalToAsk&&c.patch({approvalMode:"ask"})):m.type==="routinePatched"||m.type==="toggleSettings"||l.dispatch(m)}},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:W,role:"dialog","aria-modal":"true","aria-label":ie,"aria-busy":y,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:()=>J.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(ps,{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(O,{size:"sm",value:U,disabled:y,onChange:m=>K(m.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:y,onChange:m=>V(m.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:L.map(m=>e.jsx("button",{type:"button",onClick:()=>j(m),"aria-current":g===m?"page":void 0,className:G("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",g===m?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(ds[m])},m))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!A&&!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")]}),A&&e.jsx("fieldset",{disabled:y,className:"min-w-0",children:e.jsx(yt,{value:Pe,children:e.jsx(wt.Provider,{value:{request:c.request,draft:!0,uploadAvatar:c.uploadAvatar},children:e.jsx(ms,{active:g,draft:c,defaultsMode:t,owner:F&&!t?{value:xe(z,Y.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:()=>J.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:!A||y||!t&&!Y.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:[y&&e.jsx(X,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(jt,{open:I==="local",onCancel:()=>$(null),onConfirm:()=>{c.consent.acknowledgeLocalAuto=!0,$(null),ae()}})]})})}function ps({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:()=>{Pt(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=ke(),c=St(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(xs,{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(O,{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(O,{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(At,{bot:r,patch:c.patch}):t==="Skills"?e.jsx(Lt,{bot:r}):t==="Memory"?e.jsx(gs,{draft:n}):t==="Routines"?e.jsx(hs,{draft:n}):t==="Access"?e.jsx(Dt,{bot:r,derived:c}):t==="Model"?e.jsx(Ot,{bot:r}):t==="Permissions"?e.jsx(Mt,{bot:r,derived:c}):e.jsx(Ut,{bot:r,derived:c})}function xs({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 x=!1;return B("/api/bot-presets").then(h=>{x||i(h.presets)}).catch(()=>{x||i([])}),()=>{x=!0}},[n,r]);const g=t.preset?a.find(x=>x.id===t.preset.id):void 0,j=async x=>{c("");const h=x.startsWith("preset:")?a.find(b=>b.id===x.slice(7)):void 0;if(!h){t.choosePreset(void 0);const b=pe.find(f=>f.id===x);t.chooseRole(b?.id);const v=b&&Ne(b.id)?.look;b&&t.patch({...kt(b),...v});return}t.patch(Qt(h)),t.choosePreset(es(h));const y=Zt(h);try{y?(t.patch({avatarUrl:await t.uploadAvatar(y),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))}},A=async x=>{c("");try{await B(`/api/bot-presets/${encodeURIComponent(x.id)}`,{method:"DELETE"}),t.preset?.id===x.id&&t.choosePreset(void 0),l(h=>h+1)}catch(h){c(h instanceof Error?h.message:String(h))}},N=pe.map(x=>e.jsx("option",{value:x.id,children:x.title},x.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(O,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:x=>{j(x.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Xt(a).map(x=>e.jsx("optgroup",{label:x.label,children:x.presets.map(h=>e.jsx("option",{value:`preset:${h.id}`,children:h.name},h.id))},x.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:N}):N]})]}),g&&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:[Gt(g).map((x,h)=>e.jsx("p",{className:"break-words",children:x},h)),g.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{A(g)},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 gs({draft:t}){const[n,a]=o.useState("MEMORY.md"),[i,r]=o.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(O,{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:G(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(Ht,{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 hs({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(zt,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function fs({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(ts,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(os,{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(w,{title:s("newBot.defaults"),children:d})}const Hs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:fs,NewBotDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Ms as A,Es as B,Os as C,fs as D,_s as E,Ds as F,As as L,Ps as N,Fs as P,Ts as R,Bs as S,Ks as T,Rs as U,$s as a,Ls as b,Us as c,Is as d,zs as e,Hs as f};
@@ -1 +1 @@
1
- import{r as d,j as t,t as n,I as c,A as x,o as p}from"./styles-NM37uvmJ.js";import{r as m}from"./PlacesRail-BI7EZKaw.js";import{Q as u}from"./index-DMDRA73w.js";import"./monitor-CJJehAYK.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:c},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:x}];function j({open:r,onClose:l,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=o=>{o.key==="Escape"&&(o.preventDefault(),l())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l]),!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.target===e.currentTarget&&l(),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(u,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{p(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,o)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{l(),e.onSelect()},className:o===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:l,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:m.createPortal(s,document.body)}export{f as PHONE_APPS,j as PhoneAppDialog};
1
+ import{r as d,j as t,t as n,I as c,A as x,o as p}from"./styles-DSEcltf1.js";import{r as m}from"./PlacesRail-Bpjyw4Vm.js";import{Q as u}from"./index-3mZteHSQ.js";import"./monitor-Xr0SgoUO.js";const f=[{id:"ios",nameKey:"phoneApp.ios",actionKey:"phoneApp.iosAction",url:c},{id:"android",nameKey:"phoneApp.android",actionKey:"phoneApp.androidAction",url:x}];function j({open:r,onClose:l,connect:i=[]}){const a=d.useRef(null);if(d.useEffect(()=>{if(!r)return;a.current?.focus();const e=o=>{o.key==="Escape"&&(o.preventDefault(),l())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[r,l]),!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.target===e.currentTarget&&l(),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(u,{value:e.url,size:132,level:"M",bgColor:"#ffffff",fgColor:"#111111",title:n(e.actionKey)})}),t.jsx("button",{type:"button",onClick:()=>{p(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,o)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{l(),e.onSelect()},className:o===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:l,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:m.createPortal(s,document.body)}export{f as PHONE_APPS,j as PhoneAppDialog};