@bivy/bivy 0.20.4-staging.1 → 0.20.4-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/package.json +1 -1
  2. package/web/assets/{AutomationsView-5CyD4WHA.js → AutomationsView-CF3Yde7g.js} +1 -1
  3. package/web/assets/{ChangesCard-CZDQXY3_.js → ChangesCard-ChUvrnBi.js} +1 -1
  4. package/web/assets/{LibraryView-BabDCCxl.js → LibraryView-BqtDKX0H.js} +1 -1
  5. package/web/assets/{ProviderConnect-BMGu8n3l.js → ProviderConnect-BlYYhfdq.js} +1 -1
  6. package/web/assets/{Settings-DVYwTtAw.js → Settings-Bsv6N5oX.js} +3 -3
  7. package/web/assets/{Sheet-D3E-yLpV.js → Sheet-BcTCzY9r.js} +1 -1
  8. package/web/assets/{Terminal-D2VvlU_f.js → Terminal-dczoFzd6.js} +1 -1
  9. package/web/assets/{VoiceSettings-CO99U2gC.js → VoiceSettings-BBN0TRwk.js} +1 -1
  10. package/web/assets/{abnfDiagram-VCTEODGH-58czRktH.js → abnfDiagram-VCTEODGH-CvfQu37S.js} +1 -1
  11. package/web/assets/architecture-7GRP2DOG-OH85T1yc.js +1 -0
  12. package/web/assets/{architectureDiagram-5GKGNRK7-BWGzVeg6.js → architectureDiagram-5GKGNRK7-B5tDXVlv.js} +1 -1
  13. package/web/assets/{blockDiagram-I7D4REHJ-BlhvNxpF.js → blockDiagram-I7D4REHJ-xAPGSDJ4.js} +1 -1
  14. package/web/assets/{c4Diagram-7LVT6UL2-PtEfTh8C.js → c4Diagram-7LVT6UL2-eJaT7akB.js} +1 -1
  15. package/web/assets/channel-Bp_C9x8I.js +1 -0
  16. package/web/assets/{chunk-4HAMMTFA-DKQ2fTfS.js → chunk-4HAMMTFA-COnO_bSA.js} +1 -1
  17. package/web/assets/{chunk-75Z2AOVW-CBiM8whK.js → chunk-75Z2AOVW-CRSwYgGa.js} +1 -1
  18. package/web/assets/{chunk-DU6HZSFF-gkVFtNv3.js → chunk-DU6HZSFF-DEWchgqz.js} +1 -1
  19. package/web/assets/{chunk-F27PBJKO-B2v_Jfh2.js → chunk-F27PBJKO-o-kQvDMG.js} +1 -1
  20. package/web/assets/{chunk-GMAD6QVW-BGo9-evi.js → chunk-GMAD6QVW-DJhWvb-f.js} +1 -1
  21. package/web/assets/{chunk-GVQU2GXP-BhO1Y9S4.js → chunk-GVQU2GXP-BhL-vgyG.js} +1 -1
  22. package/web/assets/{chunk-IMKFNOWR-C1BI16Td.js → chunk-IMKFNOWR-CtRgI4Rd.js} +1 -1
  23. package/web/assets/{chunk-L3NEJ4N5-D4ipigW0.js → chunk-L3NEJ4N5-Dv5wmhCC.js} +1 -1
  24. package/web/assets/{chunk-OSK3NFVY-CdX1j1jL.js → chunk-OSK3NFVY-BpkFVV5j.js} +1 -1
  25. package/web/assets/{chunk-P2QGCYS3-Dc8Lqq9r.js → chunk-P2QGCYS3-BZp2Gxlg.js} +1 -1
  26. package/web/assets/{chunk-POPQ4Y6H-DcKUMoFo.js → chunk-POPQ4Y6H-BymdnjqO.js} +1 -1
  27. package/web/assets/{chunk-PWAF6VOD-B81feuuM.js → chunk-PWAF6VOD-B6-tqDJ_.js} +1 -1
  28. package/web/assets/{chunk-SHT3W25Y-CL_smcM0.js → chunk-SHT3W25Y-DJNRgkri.js} +1 -1
  29. package/web/assets/{chunk-SVP7TREG-NxzQDJme.js → chunk-SVP7TREG-C4KhIsre.js} +1 -1
  30. package/web/assets/{chunk-TICWLB2K-CYSGhyvS.js → chunk-TICWLB2K-BkR4MokH.js} +1 -1
  31. package/web/assets/classDiagram-ZZMXUADV-DzmF27dI.js +1 -0
  32. package/web/assets/classDiagram-v2-VYDZK3BY-DzmF27dI.js +1 -0
  33. package/web/assets/{cynefin-OW5HDTMX-Sr5XAnFh.js → cynefin-OW5HDTMX-Cx0OANPS.js} +1 -1
  34. package/web/assets/{cynefinDiagram-5FMLGOSQ-DQnbkXBc.js → cynefinDiagram-5FMLGOSQ-3cqmGzjr.js} +1 -1
  35. package/web/assets/{dagre-GXQ25YYZ-huuSCkw7.js → dagre-GXQ25YYZ-Cf0HouX5.js} +1 -1
  36. package/web/assets/{diagram-S7CK7UJ4-Dg6Wp3n7.js → diagram-S7CK7UJ4-CxJf3pta.js} +1 -1
  37. package/web/assets/{diagram-UQ7AKVKN-BoDpARiy.js → diagram-UQ7AKVKN-BkJG0Xun.js} +1 -1
  38. package/web/assets/{diagram-VSXAHHWV-CulXaqAT.js → diagram-VSXAHHWV-DRudDhg4.js} +1 -1
  39. package/web/assets/{diagram-VX7I27RA-B6wO58o4.js → diagram-VX7I27RA-DdHda5wF.js} +1 -1
  40. package/web/assets/{diagram-Z3DM3KII-DXEo16cH.js → diagram-Z3DM3KII-DaKysBj7.js} +1 -1
  41. package/web/assets/{ebnfDiagram-PWID7BFC-DueWpWcR.js → ebnfDiagram-PWID7BFC-87xjrwDD.js} +1 -1
  42. package/web/assets/{erDiagram-RLTQ6QDP-CyxThy0N.js → erDiagram-RLTQ6QDP-BEs13f6g.js} +1 -1
  43. package/web/assets/eventmodeling-NTZA5JFV-Dqur4OgF.js +1 -0
  44. package/web/assets/flowDiagram-HODETNUW-Dk2afkpt.js +1 -0
  45. package/web/assets/{ganttDiagram-EL5Y4UJY-BCMPpg5n.js → ganttDiagram-EL5Y4UJY-CP6jitUy.js} +1 -1
  46. package/web/assets/{gitGraph-4MIJSDKK-C_bO2eDd.js → gitGraph-4MIJSDKK-oawlk7I3.js} +1 -1
  47. package/web/assets/{gitGraphDiagram-WWUBYQGX-BgETiJwF.js → gitGraphDiagram-WWUBYQGX-3nkYxqZA.js} +1 -1
  48. package/web/assets/{index-ChfKY4uR.js → index-zpUyyQNO.js} +2 -2
  49. package/web/assets/{info-A6RAGUB7-DTId4RKm.js → info-A6RAGUB7-D0Ip46Kv.js} +1 -1
  50. package/web/assets/{infoDiagram-27XIBGKW-B1Ffrn3H.js → infoDiagram-27XIBGKW-DBo13HEu.js} +1 -1
  51. package/web/assets/{ishikawaDiagram-5VMMS53U-Cqq9C3YZ.js → ishikawaDiagram-5VMMS53U-BCmcQfim.js} +1 -1
  52. package/web/assets/{journeyDiagram-3NMN7TZE-DrgJ6JLU.js → journeyDiagram-3NMN7TZE-DpzLakrl.js} +1 -1
  53. package/web/assets/{kanban-definition-UXKFOSKX-CLa0xmu9.js → kanban-definition-UXKFOSKX-BxOQN_ez.js} +1 -1
  54. package/web/assets/{line-B8FnzKzV.js → line-D-_jYPsL.js} +1 -1
  55. package/web/assets/{mermaid-parser.core-CpQYZmiE.js → mermaid-parser.core-BtiNyzFG.js} +3 -3
  56. package/web/assets/{mermaid.core-BmN60RVS.js → mermaid.core-_waZYNe5.js} +4 -4
  57. package/web/assets/{mindmap-definition-YA3MSWOX-DhSTTdmm.js → mindmap-definition-YA3MSWOX-ab_FtlLX.js} +1 -1
  58. package/web/assets/{mount-BpiVD2yE.js → mount-DDNxGSlT.js} +6 -6
  59. package/web/assets/{packet-AYTQ26CC-Dj5TMG0U.js → packet-AYTQ26CC-BeMhObKl.js} +1 -1
  60. package/web/assets/{pegDiagram-XKGWAZYB-CllHVxaz.js → pegDiagram-XKGWAZYB-BJbYYKpL.js} +1 -1
  61. package/web/assets/{pie-WAS4IAKB-CSB7-rmE.js → pie-WAS4IAKB-Ct9lp4qC.js} +1 -1
  62. package/web/assets/{pieDiagram-E7YTZNPT-BtFPbtlw.js → pieDiagram-E7YTZNPT-D4mOcFkJ.js} +1 -1
  63. package/web/assets/{quadrantDiagram-AXDQQJYC-BNz8Gdzp.js → quadrantDiagram-AXDQQJYC-ByXS4ybb.js} +1 -1
  64. package/web/assets/{radar-RG4KPBEZ-lKV43YN8.js → radar-RG4KPBEZ-BdNCDjZQ.js} +1 -1
  65. package/web/assets/{railroad-74A4TZTK-BXkNhSuC.js → railroad-74A4TZTK-BSzEEUjB.js} +1 -1
  66. package/web/assets/railroad-abnf-HS5TGJTU-DIiHf8ri.js +1 -0
  67. package/web/assets/railroad-ebnf-LZEXJU2U-4H3Oumru.js +1 -0
  68. package/web/assets/railroad-peg-WCYAUIDC-CDGFsoOg.js +1 -0
  69. package/web/assets/{railroadDiagram-O6MQD6OU-Xl__lazm.js → railroadDiagram-O6MQD6OU-DV77PsZ7.js} +1 -1
  70. package/web/assets/{requirementDiagram-BXWQKSXE-BEomoUnA.js → requirementDiagram-BXWQKSXE-B-LXjzYe.js} +1 -1
  71. package/web/assets/{sankeyDiagram-P5KCCOFB-CAuXBDdf.js → sankeyDiagram-P5KCCOFB-5p_xNGOA.js} +1 -1
  72. package/web/assets/{sequenceDiagram-WJ2MYXX4-Cqm2dC--.js → sequenceDiagram-WJ2MYXX4-CGZy-41j.js} +1 -1
  73. package/web/assets/{settingsRoute-feG1oAp7.js → settingsRoute-DqRzXcAY.js} +1 -1
  74. package/web/assets/{stateDiagram-D77RDMKH-DbfQ5pza.js → stateDiagram-D77RDMKH-B7NoPezN.js} +1 -1
  75. package/web/assets/stateDiagram-v2-MP3YSRHH-Bb8mTi-E.js +1 -0
  76. package/web/assets/{swimlanes-42K2YHIH-C2aijhjX.js → swimlanes-42K2YHIH-XkAKS_yJ.js} +1 -1
  77. package/web/assets/swimlanesDiagram-VR7AAH4N-B-HNasrk.js +8 -0
  78. package/web/assets/{timeline-definition-24CTP7MA-YhSYtzgw.js → timeline-definition-24CTP7MA-BvzBU07D.js} +1 -1
  79. package/web/assets/{treeView-Q6P3EWNA-BRECfw52.js → treeView-Q6P3EWNA-DeNVZP1c.js} +1 -1
  80. package/web/assets/{treemap-WGGIJYW6-DSuRejEi.js → treemap-WGGIJYW6-DlqnSUtC.js} +1 -1
  81. package/web/assets/{useStore-BvVbjZ1v.js → useStore-IOxPOH3e.js} +1 -1
  82. package/web/assets/{vennDiagram-4TSXK5OY-BCh5ozN7.js → vennDiagram-4TSXK5OY-xbQt0_gL.js} +1 -1
  83. package/web/assets/{wardley-WFR3VGLG-C7oRAAg7.js → wardley-WFR3VGLG-Bv4lsZ4K.js} +1 -1
  84. package/web/assets/{wardleyDiagram-VM6X3IG4-3EUAQHjw.js → wardleyDiagram-VM6X3IG4-Cau3ldDa.js} +1 -1
  85. package/web/assets/{xychartDiagram-S5SC5T6Z-DW0fNqkf.js → xychartDiagram-S5SC5T6Z-DkwMFs87.js} +1 -1
  86. package/web/index.html +1 -1
  87. package/web/sw.js +1 -1
  88. package/web/assets/architecture-7GRP2DOG-CvRr8wCj.js +0 -1
  89. package/web/assets/channel-DWH-zfuY.js +0 -1
  90. package/web/assets/classDiagram-ZZMXUADV-Boji1OT5.js +0 -1
  91. package/web/assets/classDiagram-v2-VYDZK3BY-Boji1OT5.js +0 -1
  92. package/web/assets/eventmodeling-NTZA5JFV-COlU-JkN.js +0 -1
  93. package/web/assets/flowDiagram-HODETNUW-Cojih8hz.js +0 -1
  94. package/web/assets/railroad-abnf-HS5TGJTU-DXdJbPWI.js +0 -1
  95. package/web/assets/railroad-ebnf-LZEXJU2U-BTfyiEJ-.js +0 -1
  96. package/web/assets/railroad-peg-WCYAUIDC-B9OPHmVr.js +0 -1
  97. package/web/assets/stateDiagram-v2-MP3YSRHH-Bieq-GTM.js +0 -1
  98. package/web/assets/swimlanesDiagram-VR7AAH4N-Cbg1BR74.js +0 -8
@@ -1,9 +1,9 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/VoiceSettings-CO99U2gC.js","assets/useStore-BvVbjZ1v.js","assets/rolldown-runtime-hePW80VL.js","assets/index-ChfKY4uR.js","assets/index-DPD-O0uT.css","assets/jsx-runtime-NZYk81nU.js","assets/mount-BpiVD2yE.js","assets/Sheet-D3E-yLpV.js","assets/ChangesCard-CZDQXY3_.js","assets/StatusDot-dpbztK53.js","assets/settingsRoute-feG1oAp7.js","assets/ProviderConnect-BMGu8n3l.js","assets/mount-BjlUftih.css"])))=>i.map(i=>d[i]);
2
- import{D as e,F as t,I as n,M as r,R as i,T as a,V as o,_ as s,b as c,g as l,h as u,j as d,t as f,y as p}from"./index-ChfKY4uR.js";import{B as m,G as h,H as g,K as _,Nt as v,S as y,St as b,U as x,V as S,W as C,b as w,i as T,n as E,q as D,r as O,t as k,x as A}from"./useStore-BvVbjZ1v.js";import{A as j,O as M,a as ee,f as N,g as te,h as P,i as ne,k as re,l as ie,n as F,t as I}from"./Sheet-D3E-yLpV.js";import{t as L}from"./jsx-runtime-NZYk81nU.js";import{r as R,t as z}from"./ProviderConnect-BMGu8n3l.js";import{S as B,a as V,b as ae,i as H,o as U,s as oe,w as W,y as se}from"./mount-BpiVD2yE.js";function G(e){switch(e){case`available`:return`Available`;case`unavailable`:return`Not available`;case`unknown`:return`Unknown`}}var K=e=>String(e??``).trim().toLowerCase(),q=e=>String(e??``).trim().toLowerCase()||`default`;function ce(e,t){let n=K(e);if(!n)throw Error(`Credential provider is required`);return`credential:v1:${encodeURIComponent(n)}:${encodeURIComponent(q(t))}`}var le=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:void 0};function ue(e){let t=K(e.provider);if(!t||e.configured!==!0&&!e.key)return;let n=q(e.label),r=le(e.updatedAt);return{id:ce(t,n),provider:t,label:n,kind:`api_key`,origins:[`browser`],availability:{account:e.scope!==`device`,device:!0,nodes:[]},...r==null?{}:{updatedAt:r}}}function de(e,t){let n=K(e.provider),r=String(t??``).trim();if(!n||!r)return;let i=q(e.label);return{id:ce(n,i),provider:n,label:i,kind:e.kind,origins:[`node`],availability:{account:e.sync===`account`,device:!1,nodes:[r]},...e.expiresAt==null?{}:{expiresAt:e.expiresAt},...e.unattended?{unattended:!0}:{},testable:e.testable,...e.lastVerifiedAt==null?{}:{lastVerifiedAt:e.lastVerifiedAt},...e.lastVerifiedOk==null?{}:{lastVerifiedOk:e.lastVerifiedOk}}}function fe(...e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.id);t.set(e.id,n?{...n,...e,origins:[...new Set([...n.origins,...e.origins])].sort(),availability:{account:n.availability.account||e.availability.account,device:n.availability.device||e.availability.device,nodes:[...new Set([...n.availability.nodes,...e.availability.nodes])].sort()}}:{...e,origins:[...new Set(e.origins)].sort(),availability:{...e.availability,nodes:[...new Set(e.availability.nodes)].sort()}})}return[...t.values()].sort((e,t)=>e.id.localeCompare(t.id))}var pe=e=>fe(e.map(ue).filter(e=>!!e)),me=(e,t)=>fe(e.map(e=>de(e,t)).filter(e=>!!e)),he={quick:`Quick`,standard:`Standard`,large:`Large`,memory:`Memory optimized`,gpu:`GPU`};function ge(e){if(e.accelerator)return`gpu`;let t=e.memoryMiB??0,n=e.vcpus??0;return t>=65536?`memory`:t>=32768||n>=8?`large`:t>=8192&&n>=4?`standard`:`quick`}function _e(e){return he[ge(e)]}var ve=j(),J=v(),Y=L();function ye(e){if(!e)return``;let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]||e}function be(e){if(!e)return``;let t=Date.now()-e;return t<6e4?`just now`:t<36e5?`${Math.max(1,Math.round(t/6e4))}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}var X=`__all__`;function Z({onDone:e}){let{connection:{nodes:t,currentNodeId:n}}=k(),[r,i]=(0,J.useState)(n??``),[a,o]=(0,J.useState)(X),[s,c]=(0,J.useState)(X),[l,u]=(0,J.useState)([]),[d,f]=(0,J.useState)(`loading`),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null);(0,J.useEffect)(()=>{let e=!1;async function t(){f(`loading`),m(``);try{r&&r!==n&&await T.connectToNode(r);let t=await T.discoverNativeSessions();e||(u(t),f(`ready`))}catch(t){e||(f(`error`),m(t instanceof Error?t.message:String(t)))}}return t(),()=>{e=!0}},[r]);let x=(0,J.useMemo)(()=>[...new Set(l.map(e=>e.agentName))].sort(),[l]),S=(0,J.useMemo)(()=>[...new Set(l.map(e=>ye(e.cwd)).filter(Boolean))].sort(),[l]),C=(0,J.useMemo)(()=>l.filter(e=>a===X||e.agentName===a).filter(e=>s===X||ye(e.cwd)===s).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[l,a,s]);async function w(t,n=!1){g(t.ref),v(``);try{e(await T.importNativeSession(t.runtimeId,t.ref,{acceptDisclosure:n}))}catch(e){if(e instanceof O){b({session:t,text:e.disclosure});return}v(e instanceof Error?e.message:String(e))}finally{g(null)}}let D=(0,J.useMemo)(()=>{let e=[...t];return n&&!e.some(e=>e.id===n)&&e.unshift({id:n,name:`This machine`,online:!0}),e},[t,n]);if(y){let{session:e,text:t}=y;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Confirm seeded import`}),(0,Y.jsx)(`div`,{className:`import-session-hint`,children:e.title||`Untitled session`}),(0,Y.jsx)(`div`,{className:`import-session-hint`,children:t})]}),(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`button`,{className:`btn fork-submit`,disabled:h===e.ref,onClick:()=>b(null),children:`Cancel`}),(0,Y.jsx)(`button`,{className:`btn primary fork-submit`,disabled:h===e.ref,onClick:()=>{b(null),w(e,!0)},children:h===e.ref?`Importing…`:`Import anyway`})]})]})}return(0,Y.jsxs)(Y.Fragment,{children:[D.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Machine`}),(0,Y.jsx)(`div`,{className:`picker-list`,children:D.map(e=>(0,Y.jsx)(I,{active:e.id===r,title:e.name||e.id,meta:e.id===n?`current`:e.online?`online`:`offline`,onClick:()=>i(e.id)},e.id))})]}),x.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Provider`}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[(0,Y.jsx)(I,{active:a===X,title:`All providers`,onClick:()=>o(X)}),x.map(e=>(0,Y.jsx)(I,{active:a===e,title:e,onClick:()=>o(e)},e))]})]}),S.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Repository`}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[(0,Y.jsx)(I,{active:s===X,title:`All repositories`,onClick:()=>c(X)}),S.map(e=>(0,Y.jsx)(I,{active:s===e,title:e,onClick:()=>c(e)},e))]})]}),(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Sessions (newest first)`}),d===`loading`&&(0,Y.jsx)(`div`,{className:`import-session-hint`,children:`Looking for sessions this machine can see…`}),d===`error`&&(0,Y.jsx)(`div`,{className:`fork-error`,role:`alert`,children:p}),d===`ready`&&C.length===0&&(0,Y.jsx)(`div`,{className:`import-session-hint`,children:l.length===0?`No importable sessions found — Bivy already manages everything this machine can see, or no supported provider (Claude Code, Codex) has a session here.`:`No sessions match these filters.`}),(0,Y.jsx)(`div`,{className:`picker-list`,children:C.map(e=>(0,Y.jsx)(I,{title:e.title||`Untitled session`,meta:`${e.agentName} · ${ye(e.cwd)||e.cwd||`unknown directory`} · ${be(e.updatedAt)}`,right:e.plan.mode===`follow-only`?(0,Y.jsxs)(`span`,{className:`import-session-follow`,children:[(0,Y.jsx)(E,{title:e.plan.disclosure,children:`Live elsewhere`}),e.resumeCommand&&(0,Y.jsx)(`code`,{className:`import-session-resume-cmd`,title:`Run this in a terminal to follow the live session`,children:e.resumeCommand})]}):(0,Y.jsx)(`button`,{className:`btn sm primary import-session-action`,disabled:h===e.ref,onClick:()=>w(e),children:h===e.ref?`Importing…`:e.plan.mode===`seeded`?`Import…`:`Adopt`})},`${e.runtimeId}:${e.ref}`))}),_&&(0,Y.jsx)(`div`,{className:`fork-error`,role:`alert`,children:_})]})]})}function xe({state:e}){return(0,Y.jsx)(E,{tone:e===`available`?`ok`:e===`unknown`?`warn`:void 0,children:G(e)})}function Se({agent:e}){return(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[e.supportTier&&(0,Y.jsx)(`span`,{className:`muted small`,children:e.supportTier}),(0,Y.jsx)(E,{tone:e.installed?`ok`:void 0,children:e.installed?`Installed`:`Not installed`})]})]})}function Ce({online:e}){let{settings:{capabilities:t}}=k(),[n,r]=(0,J.useState)(!1),i=()=>{e&&(r(!0),T.requestCapabilities())};(0,J.useEffect)(()=>{e&&i()},[e]),(0,J.useEffect)(()=>{t&&r(!1)},[t]);let a=t?[...t.agents.maintained,...t.agents.custom]:[],o=a.filter(e=>e.installed).length;return(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`Capabilities`}),(0,Y.jsx)(`button`,{className:`btn`,disabled:!e||n,onClick:i,children:n?`Refreshing…`:`Refresh`})]}),!e&&(0,Y.jsx)(`p`,{className:`muted small`,children:`Connect this machine to see what it unlocks for agents.`}),e&&!t&&(0,Y.jsx)(`p`,{className:`muted small`,children:n?`Loading capabilities…`:`No capability data yet.`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Operating system`}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[t.os.platform,` `,t.os.arch,` · `,t.os.release]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Docker`}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[t.docker.detail&&(0,Y.jsx)(`span`,{className:`muted small`,children:t.docker.detail}),(0,Y.jsx)(xe,{state:t.docker.state})]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`GPU`}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[t.gpu.detail&&(0,Y.jsx)(`span`,{className:`muted small`,children:t.gpu.detail}),(0,Y.jsx)(xe,{state:t.gpu.state})]})]}),(0,Y.jsxs)(`h4`,{className:`settings-subhead`,children:[`Agents (`,o,`/`,a.length,` installed)`]}),a.length===0&&(0,Y.jsx)(`p`,{className:`muted small`,children:`No agents known to this machine.`}),t.agents.maintained.map(e=>(0,Y.jsx)(Se,{agent:e},e.id)),t.agents.custom.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`muted small`,children:`Custom`}),t.agents.custom.map(e=>(0,Y.jsx)(Se,{agent:e},e.id))]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Model providers configured`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.providers.configured.length?t.providers.configured.join(`, `):`None`})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Local model endpoints`}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[t.providers.localEndpoints.count,` configured`,t.providers.localEndpoints.count>0?` (${t.providers.localEndpoints.withModels} with models)`:``]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Plugins`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.plugins.length===0?`None installed`:`${t.plugins.filter(e=>e.valid).length}/${t.plugins.length} valid`})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Workspaces configured`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.workspaces.count})]}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Updated `,new Date(t.generatedAt).toLocaleTimeString(),`.`]})]})]})}function we({value:e,onChange:t,options:n,ariaLabel:r}){return(0,Y.jsx)(`div`,{className:`segmented-cards`,role:`radiogroup`,"aria-label":r,children:n.map(n=>(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n.id,className:`selectable`,onClick:()=>t(n.id),children:[n.icon&&(0,Y.jsx)(`span`,{className:`segmented-icon`,children:n.icon}),(0,Y.jsx)(`span`,{className:`segmented-label`,children:n.label})]},n.id))})}var Te=.8;function Ee(e,t=i,r=new Date){if(!e||t.accountExtension===`hidden`)return{};let a=e=>t.accountExtension===`visible`||n(e,t)===e,s={},c=e.summary?.trim();c&&a(c)&&(s.summary=c);let l=e.meter;if(l&&typeof l.label==`string`&&l.label.trim()&&Number.isFinite(l.used)&&Number.isFinite(l.limit)&&l.limit>0&&a(l.label)){let n=Math.max(0,Math.min(l.used,l.limit)),i=n>=l.limit?`reached`:n/l.limit>=Te?`near`:`ok`;s.meter={label:l.label.trim(),used:n,limit:l.limit,state:i};let a=l.freesAt?new Date(l.freesAt):null;i!==`ok`&&a&&a>r&&(s.meter.freesNote=`A slot frees up ${Oe(a,r)}`);let c=e.actions?.find(e=>e.kind===`primary`);i!==`ok`&&c&&o(t)&&(s.action={id:c.id,label:c.label})}return s}var De=864e5;function Oe(e,t,n){let r=Math.ceil((e.getTime()-t.getTime())/6e4);if(r<60)return`in ${Math.max(1,r)} min`;let i=e.toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`}),a=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o=Math.round((a(e)-a(t))/De);return o===0?`today at ${i}`:o===1?`tomorrow at ${i}`:`${e.toLocaleDateString(n,o<6?{weekday:`short`}:{weekday:`short`,day:`numeric`,month:`short`})} at ${i}`}function ke(e,t=i){let n=e?.offer;if(!n||!o(t)||typeof n.title!=`string`||!n.title.trim())return;let r=e.actions?.find(e=>e.id===n.action);if(!r)return;let a=e=>typeof e==`string`&&e.trim()?e.trim():void 0;return{title:n.title.trim(),price:a(n.price),description:a(n.description),points:Array.isArray(n.points)?n.points.map(a).filter(e=>!!e):[],action:{id:r.id,label:r.label}}}function Ae(e,t){let n=t?.meter?.label?.trim().toLowerCase();return n?e.filter(e=>e.label.trim().toLowerCase()!==n):[...e]}var je={claude:`Claude`,codex:`Codex`,grok:`Grok`},Me={ready:`Ready to import`,conflict:`Already saved — use another name to keep both`,missing:`No credential file found`,unreadable:`Credential file could not be read`,unsupported:`Login format not supported`},Ne={imported:`Imported`,conflict:`Skipped — credential already exists`,changed:`Login changed — scan again`};function Pe({state:e,onBack:t}){let{currentNodeId:n,nodes:r,status:i}=e.connection,[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(`node`),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),y=(0,J.useRef)(0),b=()=>{y.current++,u(null),f([]),m(null),v(null),g(null)};(0,J.useEffect)(()=>(b(),()=>{y.current+=1}),[n,i]);let x=r.find(e=>e.id===n)?.name||n||`Connected machine`,S=async()=>{let e=++y.current;g(`scan`),v(null),m(null),u(null);try{let t=await T.previewNativeCredentials(n,a);if(y.current!==e)return;u(t),f(t.items.filter(e=>e.status===`ready`).map(e=>e.agent))}catch(t){y.current===e&&v(t instanceof Error?t.message:`Scan failed.`)}finally{y.current===e&&g(null)}},C=async()=>{if(!l)return;let e=++y.current;g(`import`),v(null);try{let t=await T.importNativeCredentials(n,l.previewId,d,s);if(y.current!==e)return;m(t),u(null),f([]),T.listCredentialRecords(),T.listProviders()}catch(t){y.current===e&&(v(t instanceof Error?t.message:`Import failed. Scan again before retrying.`),u(null))}finally{y.current===e&&g(null)}};return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{autoFocus:T.direct||!r.length,className:`btn link`,disabled:h===`import`,onClick:t,children:`‹ Credentials`}),(0,Y.jsx)(`h3`,{children:`Import from machine`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Bring existing Claude, Codex, or Grok sign-ins into Bivy. Saved credentials are never replaced.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-machine`,children:`Source machine`}),(0,Y.jsxs)(`select`,{autoFocus:!T.direct&&r.length>0,id:`native-import-machine`,className:`picker-search`,value:n??``,disabled:T.direct||!!h||!r.length,onChange:e=>{b(),T.switchNode(e.target.value)},children:[!r.some(e=>e.id===n)&&(0,Y.jsx)(`option`,{value:n??``,children:i===`online`?x:`Choose an online machine`}),r.filter(e=>!T.direct||e.id===n).map(e=>(0,Y.jsxs)(`option`,{value:e.id,disabled:!e.online&&e.id!==n,children:[e.name||e.id,e.online?``:` — offline`]},e.id))]}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[T.direct?`Direct connection: imports run on this machine only.`:`Selecting a machine also connects Settings to it.`,` Only logins readable by the Bivy daemon’s OS user can be found.`]}),i!==`online`&&(0,Y.jsx)(`p`,{className:`banner inline`,role:`status`,children:i===`connecting`?`Connecting to machine…`:`Connect an online machine to scan its logins.`}),(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`Keep a second login`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-label`,children:`Credential name (optional)`}),(0,Y.jsx)(`input`,{id:`native-import-label`,className:`picker-search`,maxLength:100,placeholder:`Default — or Work to keep a second login`,disabled:!!h,value:a,onChange:e=>{o(e.target.value),b()}})]}),(0,Y.jsx)(`button`,{className:`btn`,disabled:i!==`online`||!!h,onClick:()=>void S(),children:h===`scan`?`Scanning…`:l||p?`Scan again`:`Scan for logins`}),h&&(0,Y.jsx)(`p`,{className:`muted`,role:`status`,children:h===`scan`?`Reading login files on the selected machine…`:`Importing selected logins…`}),l&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`h4`,{className:`settings-subhead`,children:[`Logins on `,x]}),(0,Y.jsx)(`div`,{className:`picker-list`,children:l.items.map(e=>(0,Y.jsxs)(`label`,{className:`picker-item`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:je[e.agent]}),(0,Y.jsxs)(`small`,{children:[e.provider?`${e.provider} · ${e.kind===`oauth`?`Subscription sign-in`:`API key`} · `:``,Me[e.status]]})]}),(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":`Import ${je[e.agent]}`,disabled:e.status!==`ready`||!!h,checked:d.includes(e.agent),onChange:t=>f(n=>t.target.checked?[...n,e.agent]:n.filter(t=>t!==e.agent))})]},e.agent))}),!l.items.some(e=>e.status===`ready`)&&(0,Y.jsx)(`p`,{role:`status`,className:`muted`,children:`No new logins to import. Sign in on this machine, or use another credential name if already saved.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-scope`,children:`Available on`}),(0,Y.jsxs)(`select`,{id:`native-import-scope`,className:`picker-search`,value:s,disabled:!!h,onChange:e=>c(e.target.value),children:[(0,Y.jsx)(`option`,{value:`node`,children:`Only the source machine`}),(0,Y.jsx)(`option`,{value:`account`,children:`All my machines — end-to-end encrypted`})]}),(0,Y.jsx)(`p`,{className:`muted`,children:s===`account`?`Importing grants account sync, not unattended cloud access. Other machines receive credentials when connected.`:`Imported logins stay in this machine’s encrypted vault. You can enable account sync later.`}),(0,Y.jsx)(`button`,{className:`btn primary block`,disabled:!d.length||!!h||i!==`online`,onClick:()=>void C(),children:h===`import`?`Importing…`:`Import ${d.length||`selected`} login${d.length===1?``:`s`}`})]}),p&&(0,Y.jsxs)(`div`,{className:`banner inline`,role:`status`,children:[p.items.map(e=>(0,Y.jsxs)(`p`,{children:[je[e.agent],`: `,Ne[e.status]]},e.agent)),p.warning&&(0,Y.jsx)(`p`,{children:p.warning}),p.items.some(e=>e.status===`imported`)&&(0,Y.jsxs)(`p`,{children:[s===`account`?`Saved and eligible for account sync; delivery to other machines is not yet confirmed.`:`Saved only on ${x}.`,a.trim()&&` Select the named credential in model accounts to use it.`]})]}),_&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:_}),(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`What can be imported?`}),(0,Y.jsx)(`p`,{className:`muted`,children:`File-based logins only; OS-keychain-only logins are not supported. Tokens never appear in this preview. Native logins are left untouched.`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Access is not verified. Subscription sign-ins work only with compatible Bivy-managed runtimes. Concurrent OAuth refresh by native CLIs or other machines may require signing in again.`})]})]})}var Fe=b.map(e=>({id:e.id,name:e.name,oauth:e.authMethods.some(e=>e.kind===`oauth`),apiKey:e.authMethods.some(e=>e.kind===`api_key`),reference:e.authMethods.some(e=>e.kind===`reference`),help:e.authMethods.find(e=>e.kind===`api_key`)?.helpUrl})),Q=(e,t)=>`${e}\u0000${t||`default`}`,Ie=e=>e.label==="default"?e.providerName:`${e.providerName} — ${e.label}`,Le=e=>e===`oauth`?`Subscription sign-in`:e===`reference`?`Password-manager reference`:e===`environment`?`Environment`:`API key`,Re=e=>e===`account`?`All my machines`:e===`node`?`Only this machine`:`Only this device`;function ze({state:e,initialProvider:t=null}){let n=e.connection.status,r=e.connection.currentNodeId,i=e.connection.nodes,a=e.catalogs.providers,o=e.catalogs.repos,s=e.settings.credentialRecords,c=e.settings.credentialPresets,l=e.settings.localModels,u=e.presentation.oauth,[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(()=>t?`add`:`list`),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(``),[b,x]=(0,J.useState)(()=>t??``),[S,C]=(0,J.useState)(`api_key`),[w,D]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(``),[te,P]=(0,J.useState)(`openai-completions`),[ne,re]=(0,J.useState)(``),[ie,F]=(0,J.useState)(!1),[I,L]=(0,J.useState)(null),[R,B]=(0,J.useState)(`account`),[V,ae]=(0,J.useState)(e.draft.repo??``),[H,U]=(0,J.useState)(!1),[oe,W]=(0,J.useState)(null),[se,G]=(0,J.useState)(null),[K,q]=(0,J.useState)(null),[ce,le]=(0,J.useState)(()=>T.getOAuthBrowserRecovery()),ue=(0,J.useRef)(null),de=(0,J.useRef)(p);(0,J.useEffect)(()=>{de.current===`import`&&p===`list`&&ue.current?.focus(),de.current=p},[p]);let he=()=>T.listEphemeralModelKeys().then(f).catch(()=>f([])),ge=()=>{T.listProviders(),T.listCredentialRecords(),T.getCredentialPresets(),he()};(0,J.useEffect)(()=>{T.listProviders(),T.listCredentialRecords(),T.getCredentialPresets(),T.listLocalModels(),T.listRepos(),T.listEphemeralModelKeys().then(f).catch(()=>f([]))},[r]);let _e=(0,J.useRef)(null),ve=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(u){_e.current={provider:u.provider||b,label:w.trim().toLowerCase()||`default`};return}if(!_e.current)return;let e=_e.current;_e.current=null,ve.current=Q(e.provider,e.label),W(`Sign-in complete.`),ge()},[u]);let ye=(0,J.useMemo)(()=>{let e=new Map(Fe.map(e=>[e.id,e]));for(let t of a)e.set(t.id,{...e.get(t.id),id:t.id,name:t.name||t.id,oauth:t.oauth});for(let t of s)e.has(t.provider)||e.set(t.provider,{id:t.provider,name:t.provider});for(let t of d)e.has(t.provider)||e.set(t.provider,{id:t.provider,name:t.provider});for(let t of l)e.set(t.id,{id:t.id,name:t.name||t.id});return[...e.values()].sort((e,t)=>e.name.localeCompare(t.name))},[a,s,d,l]),be=e=>ye.find(t=>t.id===e)?.name||e,X=(0,J.useMemo)(()=>{let e=new Map,t=fe(pe(d),me(s,r||`current-node`));for(let n of t){let t=s.find(e=>e.provider===n.provider&&e.label===n.label),r=d.find(e=>e.provider===n.provider&&e.label===n.label);e.set(Q(n.provider,n.label),{provider:n.provider,providerName:be(n.provider),label:n.label,kind:n.kind,availability:n.availability.account?`account`:r?.scope===`device`?`device`:`node`,...t?{record:t}:{},...r?{device:r}:{}})}for(let t of a)t.configured&&![...e.values()].some(e=>e.provider===t.id)&&e.set(Q(t.id,`default`),{provider:t.id,providerName:t.name||t.id,label:`default`,kind:t.kind===`oauth`?`oauth`:`environment`,availability:`node`,ambient:!0});for(let t of l)e.has(Q(t.id,`default`))||e.set(Q(t.id,`default`),{provider:t.id,providerName:t.name||t.id,label:`default`,kind:`api_key`,availability:t.scope===`machine`?`node`:`account`});return[...e.values()].sort((e,t)=>e.providerName.localeCompare(t.providerName)||e.label.localeCompare(t.label))},[s,a,r,d,ye,l]),Z=h?X.find(e=>Q(e.provider,e.label)===h):void 0;(0,J.useEffect)(()=>{ve.current&&X.some(e=>Q(e.provider,e.label)===ve.current)&&(g(ve.current),ve.current=null,m(`detail`))},[X]);let xe=(0,J.useMemo)(()=>new Map(X.map(e=>[e.provider,X.filter(t=>t.provider===e.provider).length])),[X]),Se=(e=``)=>{x(e),C(`api_key`),D(``),k(``),j(``),N(``),P(`openai-completions`),re(``),F(!1),L(null),B(`account`),G(null),W(null)},Ce=async()=>{let e=b.trim().toLowerCase(),t=w.trim().toLowerCase()||`default`;if(!e)return;let r=!ie&&(Fe.some(t=>t.id===e)||a.some(t=>t.id===e)&&!l.some(t=>t.id===e)||X.some(t=>t.provider===e&&!l.some(t=>t.id===e)));if(!r||S===`oauth`||O.trim()){U(!0),G(null),W(null);try{if(!r){if(n!==`online`)throw Error(`Connect a machine to configure a custom model endpoint.`);if(!M.trim())throw Error(`A custom provider needs a base URL.`);let t=await T.saveLocalModel({providerId:e,name:A.trim()||e,baseUrl:M.trim(),api:te,...O.trim()?{apiKey:O.trim()}:{},models:ne.split(/[,\n]/).map(e=>e.trim()).filter(Boolean).map(e=>({id:e,name:e}))});T.listLocalModels(),ge(),W(`Custom provider saved.`),g(Q(t,`default`)),m(`detail`);return}if(S===`oauth`){if(n!==`online`)throw Error(`An online machine is needed to complete subscription sign-in.`);d.some(n=>n.provider===e&&n.label===t)&&await T.removeEphemeralModelKey(e,t),T.startOauth(e,t);return}if(S===`api_key`){let r=s.find(n=>n.provider===e&&n.label===t),i=d.find(n=>n.provider===e&&n.label===t);if(R===`device`&&r&&n!==`online`)throw Error(`Connect a machine to remove its existing copy before making this credential device-only.`);if(R===`account`||R===`device`?await T.setEphemeralModelKey(e,O.trim(),R===`device`?`device`:`account`,t):i&&await T.removeEphemeralModelKey(e,t),R===`device`)r&&await T.removeCredential(e,t);else if(n!==`online`){if(R===`node`)throw Error(`Connect to the machine where this key should be stored.`)}else await T.setCredential(e,t,{key:O.trim(),sync:R===`node`?`node`:`account`})}else{if(n!==`online`)throw Error(`Connect a machine to add a password-manager reference.`);d.some(n=>n.provider===e&&n.label===t)&&await T.removeEphemeralModelKey(e,t),await T.setCredential(e,t,{ref:O.trim(),sync:R===`account`?`account`:`node`})}W(`Credential saved.`),k(``),ge(),g(Q(e,t)),m(`detail`)}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}}},we=async(e,t,n,r)=>{U(!0),G(null);try{await T.setPresetMapping(e,t,n),W(r),T.getCredentialPresets()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}},Te=async e=>{U(!0),G(null);try{l.some(t=>t.id===e.provider)&&T.removeLocalModel(e.provider),e.device&&await T.removeEphemeralModelKey(e.provider,e.label),e.record&&await T.removeCredential(e.provider,e.label),q(null),m(`list`),g(null),ge()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(p===`import`)return(0,Y.jsx)(Pe,{state:e,onBack:()=>{m(`list`),ge()}});if(p===`add`){let e=ye.find(e=>e.id===b)??(b?{id:b,name:b}:void 0);if(!e){let e=ye.filter(e=>`${e.name} ${e.id}`.toLowerCase().includes(_.toLowerCase()));return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>m(`list`),children:`‹ Credentials`}),(0,Y.jsx)(`h3`,{children:`Add model access`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Connect a hosted provider or point Bivy at a model server you control.`}),(0,Y.jsxs)(`button`,{className:`custom-provider-card`,onClick:()=>{let e=_.trim().toLowerCase()||`local`;Se(e),x(e),F(!0)},children:[(0,Y.jsx)(`span`,{className:`custom-provider-card-icon`,"aria-hidden":!0,children:`+`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:`Local server or custom endpoint`}),(0,Y.jsx)(`small`,{children:`Ollama, LM Studio, vLLM, Azure, or another compatible API`})]}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`›`})]}),(0,Y.jsx)(`div`,{className:`vault-picker-label`,children:`Hosted providers`}),(0,Y.jsx)(`input`,{autoFocus:!0,className:`picker-search`,placeholder:`Search providers…`,value:_,onChange:e=>v(e.target.value)}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[e.map(e=>(0,Y.jsxs)(`button`,{className:`picker-item`,onClick:()=>{Se(e.id),x(e.id),e.apiKey===!1&&e.oauth&&C(`oauth`)},children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:e.name}),(0,Y.jsx)(`small`,{children:e.id})]}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`›`})]},e.id)),e.length===0&&(0,Y.jsx)(`div`,{className:`picker-empty`,children:`No hosted providers match. Add it as a custom endpoint above.`})]})]})}let t=ie||l.some(t=>t.id===e.id)||!Fe.some(t=>t.id===e.id)&&!a.some(t=>t.id===e.id)&&!X.some(t=>t.provider===e.id),n=Z?.provider===e.id,r=n||X.some(t=>t.provider===e.id),i=(0,Y.jsxs)(Y.Fragment,{children:[r&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:`field-label`,htmlFor:`credential-name`,children:[`Name `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`})]}),(0,Y.jsx)(`input`,{id:`credential-name`,className:`picker-search`,placeholder:`e.g. Work — leave empty for the default`,value:w,onChange:e=>D(e.target.value)})]}),S!==`oauth`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`credential-availability`,children:`Available on`}),(0,Y.jsxs)(`select`,{id:`credential-availability`,className:`picker-search`,value:R,onChange:e=>B(e.target.value),children:[(0,Y.jsx)(`option`,{value:`account`,children:`All my machines — end-to-end encrypted`}),(0,Y.jsx)(`option`,{value:`node`,children:`Only this machine`}),S===`api_key`&&(0,Y.jsx)(`option`,{value:`device`,children:`Only this device`})]})]})]});return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>x(``),children:`‹ Providers`}),(0,Y.jsx)(`h3`,{children:t?`Custom provider`:e.name}),u?.provider===e.id?(0,Y.jsx)(z,{}):(0,Y.jsxs)(Y.Fragment,{children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Use a local model server or any OpenAI-, Anthropic-, or Azure-compatible endpoint.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-name`,children:`Display name`}),(0,Y.jsx)(`input`,{id:`custom-provider-name`,className:`picker-search`,placeholder:`My local models`,value:A,onChange:e=>j(e.target.value)}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-id`,children:`Provider ID`}),(0,Y.jsx)(`input`,{id:`custom-provider-id`,className:`picker-search`,value:b,disabled:n,onChange:e=>x(e.target.value.toLowerCase())}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-endpoint`,children:`Endpoint`}),(0,Y.jsx)(`input`,{id:`custom-provider-endpoint`,className:`picker-search`,placeholder:`https://api.example.com/v1`,value:M,onChange:e=>N(e.target.value)}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-api`,children:`API compatibility`}),(0,Y.jsxs)(`select`,{id:`custom-provider-api`,className:`picker-search`,value:te,onChange:e=>P(e.target.value),children:[(0,Y.jsx)(`option`,{value:`openai-completions`,children:`OpenAI-compatible`}),(0,Y.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,Y.jsx)(`option`,{value:`azure-openai-responses`,children:`Azure OpenAI`}),(0,Y.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]}),(0,Y.jsxs)(`label`,{className:`field-label`,htmlFor:`custom-provider-key`,children:[`API key `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`})]}),(0,Y.jsx)(`input`,{id:`custom-provider-key`,className:`picker-search`,type:`password`,placeholder:`Leave blank for local servers without authentication`,value:O,onChange:e=>k(e.target.value)}),(0,Y.jsx)(`div`,{className:`row-actions`,children:(0,Y.jsx)(`button`,{className:`btn`,disabled:H||!M.trim(),onClick:async()=>{U(!0),G(null),L(null);try{let e=await T.verifyLocalModel(M.trim(),O.trim()||void 0);L(e),e.status===`ready`&&re(e.models.map(e=>e.id).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/VoiceSettings-BBN0TRwk.js","assets/useStore-IOxPOH3e.js","assets/rolldown-runtime-hePW80VL.js","assets/index-zpUyyQNO.js","assets/index-DPD-O0uT.css","assets/jsx-runtime-NZYk81nU.js","assets/mount-DDNxGSlT.js","assets/Sheet-BcTCzY9r.js","assets/ChangesCard-ChUvrnBi.js","assets/StatusDot-dpbztK53.js","assets/settingsRoute-DqRzXcAY.js","assets/ProviderConnect-BlYYhfdq.js","assets/mount-BjlUftih.css"])))=>i.map(i=>d[i]);
2
+ import{D as e,F as t,I as n,M as r,R as i,T as a,V as o,_ as s,b as c,g as l,h as u,j as d,t as f,y as p}from"./index-zpUyyQNO.js";import{B as m,G as h,H as g,K as _,Nt as v,S as y,St as b,U as x,V as S,W as C,b as w,i as T,n as E,q as D,r as O,t as k,x as A}from"./useStore-IOxPOH3e.js";import{A as j,O as M,a as ee,f as N,g as te,h as P,i as ne,k as re,l as ie,n as F,t as I}from"./Sheet-BcTCzY9r.js";import{t as L}from"./jsx-runtime-NZYk81nU.js";import{r as R,t as z}from"./ProviderConnect-BlYYhfdq.js";import{S as B,a as V,b as ae,i as H,o as U,s as oe,w as W,y as se}from"./mount-DDNxGSlT.js";function G(e){switch(e){case`available`:return`Available`;case`unavailable`:return`Not available`;case`unknown`:return`Unknown`}}var K=e=>String(e??``).trim().toLowerCase(),q=e=>String(e??``).trim().toLowerCase()||`default`;function ce(e,t){let n=K(e);if(!n)throw Error(`Credential provider is required`);return`credential:v1:${encodeURIComponent(n)}:${encodeURIComponent(q(t))}`}var le=e=>{if(typeof e==`number`)return Number.isFinite(e)?e:void 0;let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:void 0};function ue(e){let t=K(e.provider);if(!t||e.configured!==!0&&!e.key)return;let n=q(e.label),r=le(e.updatedAt);return{id:ce(t,n),provider:t,label:n,kind:`api_key`,origins:[`browser`],availability:{account:e.scope!==`device`,device:!0,nodes:[]},...r==null?{}:{updatedAt:r}}}function de(e,t){let n=K(e.provider),r=String(t??``).trim();if(!n||!r)return;let i=q(e.label);return{id:ce(n,i),provider:n,label:i,kind:e.kind,origins:[`node`],availability:{account:e.sync===`account`,device:!1,nodes:[r]},...e.expiresAt==null?{}:{expiresAt:e.expiresAt},...e.unattended?{unattended:!0}:{},testable:e.testable,...e.lastVerifiedAt==null?{}:{lastVerifiedAt:e.lastVerifiedAt},...e.lastVerifiedOk==null?{}:{lastVerifiedOk:e.lastVerifiedOk}}}function fe(...e){let t=new Map;for(let n of e)for(let e of n){let n=t.get(e.id);t.set(e.id,n?{...n,...e,origins:[...new Set([...n.origins,...e.origins])].sort(),availability:{account:n.availability.account||e.availability.account,device:n.availability.device||e.availability.device,nodes:[...new Set([...n.availability.nodes,...e.availability.nodes])].sort()}}:{...e,origins:[...new Set(e.origins)].sort(),availability:{...e.availability,nodes:[...new Set(e.availability.nodes)].sort()}})}return[...t.values()].sort((e,t)=>e.id.localeCompare(t.id))}var pe=e=>fe(e.map(ue).filter(e=>!!e)),me=(e,t)=>fe(e.map(e=>de(e,t)).filter(e=>!!e)),he={quick:`Quick`,standard:`Standard`,large:`Large`,memory:`Memory optimized`,gpu:`GPU`};function ge(e){if(e.accelerator)return`gpu`;let t=e.memoryMiB??0,n=e.vcpus??0;return t>=65536?`memory`:t>=32768||n>=8?`large`:t>=8192&&n>=4?`standard`:`quick`}function _e(e){return he[ge(e)]}var ve=j(),J=v(),Y=L();function ye(e){if(!e)return``;let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]||e}function be(e){if(!e)return``;let t=Date.now()-e;return t<6e4?`just now`:t<36e5?`${Math.max(1,Math.round(t/6e4))}m ago`:t<864e5?`${Math.round(t/36e5)}h ago`:`${Math.round(t/864e5)}d ago`}var X=`__all__`;function Z({onDone:e}){let{connection:{nodes:t,currentNodeId:n}}=k(),[r,i]=(0,J.useState)(n??``),[a,o]=(0,J.useState)(X),[s,c]=(0,J.useState)(X),[l,u]=(0,J.useState)([]),[d,f]=(0,J.useState)(`loading`),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null);(0,J.useEffect)(()=>{let e=!1;async function t(){f(`loading`),m(``);try{r&&r!==n&&await T.connectToNode(r);let t=await T.discoverNativeSessions();e||(u(t),f(`ready`))}catch(t){e||(f(`error`),m(t instanceof Error?t.message:String(t)))}}return t(),()=>{e=!0}},[r]);let x=(0,J.useMemo)(()=>[...new Set(l.map(e=>e.agentName))].sort(),[l]),S=(0,J.useMemo)(()=>[...new Set(l.map(e=>ye(e.cwd)).filter(Boolean))].sort(),[l]),C=(0,J.useMemo)(()=>l.filter(e=>a===X||e.agentName===a).filter(e=>s===X||ye(e.cwd)===s).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)),[l,a,s]);async function w(t,n=!1){g(t.ref),v(``);try{e(await T.importNativeSession(t.runtimeId,t.ref,{acceptDisclosure:n}))}catch(e){if(e instanceof O){b({session:t,text:e.disclosure});return}v(e instanceof Error?e.message:String(e))}finally{g(null)}}let D=(0,J.useMemo)(()=>{let e=[...t];return n&&!e.some(e=>e.id===n)&&e.unshift({id:n,name:`This machine`,online:!0}),e},[t,n]);if(y){let{session:e,text:t}=y;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Confirm seeded import`}),(0,Y.jsx)(`div`,{className:`import-session-hint`,children:e.title||`Untitled session`}),(0,Y.jsx)(`div`,{className:`import-session-hint`,children:t})]}),(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`button`,{className:`btn fork-submit`,disabled:h===e.ref,onClick:()=>b(null),children:`Cancel`}),(0,Y.jsx)(`button`,{className:`btn primary fork-submit`,disabled:h===e.ref,onClick:()=>{b(null),w(e,!0)},children:h===e.ref?`Importing…`:`Import anyway`})]})]})}return(0,Y.jsxs)(Y.Fragment,{children:[D.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Machine`}),(0,Y.jsx)(`div`,{className:`picker-list`,children:D.map(e=>(0,Y.jsx)(I,{active:e.id===r,title:e.name||e.id,meta:e.id===n?`current`:e.online?`online`:`offline`,onClick:()=>i(e.id)},e.id))})]}),x.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Provider`}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[(0,Y.jsx)(I,{active:a===X,title:`All providers`,onClick:()=>o(X)}),x.map(e=>(0,Y.jsx)(I,{active:a===e,title:e,onClick:()=>o(e)},e))]})]}),S.length>1&&(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Repository`}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[(0,Y.jsx)(I,{active:s===X,title:`All repositories`,onClick:()=>c(X)}),S.map(e=>(0,Y.jsx)(I,{active:s===e,title:e,onClick:()=>c(e)},e))]})]}),(0,Y.jsxs)(`div`,{className:`picker-section`,children:[(0,Y.jsx)(`div`,{className:`picker-section-label`,children:`Sessions (newest first)`}),d===`loading`&&(0,Y.jsx)(`div`,{className:`import-session-hint`,children:`Looking for sessions this machine can see…`}),d===`error`&&(0,Y.jsx)(`div`,{className:`fork-error`,role:`alert`,children:p}),d===`ready`&&C.length===0&&(0,Y.jsx)(`div`,{className:`import-session-hint`,children:l.length===0?`No importable sessions found — Bivy already manages everything this machine can see, or no supported provider (Claude Code, Codex) has a session here.`:`No sessions match these filters.`}),(0,Y.jsx)(`div`,{className:`picker-list`,children:C.map(e=>(0,Y.jsx)(I,{title:e.title||`Untitled session`,meta:`${e.agentName} · ${ye(e.cwd)||e.cwd||`unknown directory`} · ${be(e.updatedAt)}`,right:e.plan.mode===`follow-only`?(0,Y.jsxs)(`span`,{className:`import-session-follow`,children:[(0,Y.jsx)(E,{title:e.plan.disclosure,children:`Live elsewhere`}),e.resumeCommand&&(0,Y.jsx)(`code`,{className:`import-session-resume-cmd`,title:`Run this in a terminal to follow the live session`,children:e.resumeCommand})]}):(0,Y.jsx)(`button`,{className:`btn sm primary import-session-action`,disabled:h===e.ref,onClick:()=>w(e),children:h===e.ref?`Importing…`:e.plan.mode===`seeded`?`Import…`:`Adopt`})},`${e.runtimeId}:${e.ref}`))}),_&&(0,Y.jsx)(`div`,{className:`fork-error`,role:`alert`,children:_})]})]})}function xe({state:e}){return(0,Y.jsx)(E,{tone:e===`available`?`ok`:e===`unknown`?`warn`:void 0,children:G(e)})}function Se({agent:e}){return(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[e.supportTier&&(0,Y.jsx)(`span`,{className:`muted small`,children:e.supportTier}),(0,Y.jsx)(E,{tone:e.installed?`ok`:void 0,children:e.installed?`Installed`:`Not installed`})]})]})}function Ce({online:e}){let{settings:{capabilities:t}}=k(),[n,r]=(0,J.useState)(!1),i=()=>{e&&(r(!0),T.requestCapabilities())};(0,J.useEffect)(()=>{e&&i()},[e]),(0,J.useEffect)(()=>{t&&r(!1)},[t]);let a=t?[...t.agents.maintained,...t.agents.custom]:[],o=a.filter(e=>e.installed).length;return(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`Capabilities`}),(0,Y.jsx)(`button`,{className:`btn`,disabled:!e||n,onClick:i,children:n?`Refreshing…`:`Refresh`})]}),!e&&(0,Y.jsx)(`p`,{className:`muted small`,children:`Connect this machine to see what it unlocks for agents.`}),e&&!t&&(0,Y.jsx)(`p`,{className:`muted small`,children:n?`Loading capabilities…`:`No capability data yet.`}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Operating system`}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[t.os.platform,` `,t.os.arch,` · `,t.os.release]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Docker`}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[t.docker.detail&&(0,Y.jsx)(`span`,{className:`muted small`,children:t.docker.detail}),(0,Y.jsx)(xe,{state:t.docker.state})]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`GPU`}),(0,Y.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[t.gpu.detail&&(0,Y.jsx)(`span`,{className:`muted small`,children:t.gpu.detail}),(0,Y.jsx)(xe,{state:t.gpu.state})]})]}),(0,Y.jsxs)(`h4`,{className:`settings-subhead`,children:[`Agents (`,o,`/`,a.length,` installed)`]}),a.length===0&&(0,Y.jsx)(`p`,{className:`muted small`,children:`No agents known to this machine.`}),t.agents.maintained.map(e=>(0,Y.jsx)(Se,{agent:e},e.id)),t.agents.custom.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`muted small`,children:`Custom`}),t.agents.custom.map(e=>(0,Y.jsx)(Se,{agent:e},e.id))]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Model providers configured`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.providers.configured.length?t.providers.configured.join(`, `):`None`})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Local model endpoints`}),(0,Y.jsxs)(`span`,{className:`muted small`,children:[t.providers.localEndpoints.count,` configured`,t.providers.localEndpoints.count>0?` (${t.providers.localEndpoints.withModels} with models)`:``]})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Plugins`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.plugins.length===0?`None installed`:`${t.plugins.filter(e=>e.valid).length}/${t.plugins.length} valid`})]}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsx)(`span`,{children:`Workspaces configured`}),(0,Y.jsx)(`span`,{className:`muted small`,children:t.workspaces.count})]}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Updated `,new Date(t.generatedAt).toLocaleTimeString(),`.`]})]})]})}function we({value:e,onChange:t,options:n,ariaLabel:r}){return(0,Y.jsx)(`div`,{className:`segmented-cards`,role:`radiogroup`,"aria-label":r,children:n.map(n=>(0,Y.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n.id,className:`selectable`,onClick:()=>t(n.id),children:[n.icon&&(0,Y.jsx)(`span`,{className:`segmented-icon`,children:n.icon}),(0,Y.jsx)(`span`,{className:`segmented-label`,children:n.label})]},n.id))})}var Te=.8;function Ee(e,t=i,r=new Date){if(!e||t.accountExtension===`hidden`)return{};let a=e=>t.accountExtension===`visible`||n(e,t)===e,s={},c=e.summary?.trim();c&&a(c)&&(s.summary=c);let l=e.meter;if(l&&typeof l.label==`string`&&l.label.trim()&&Number.isFinite(l.used)&&Number.isFinite(l.limit)&&l.limit>0&&a(l.label)){let n=Math.max(0,Math.min(l.used,l.limit)),i=n>=l.limit?`reached`:n/l.limit>=Te?`near`:`ok`;s.meter={label:l.label.trim(),used:n,limit:l.limit,state:i};let a=l.freesAt?new Date(l.freesAt):null;i!==`ok`&&a&&a>r&&(s.meter.freesNote=`A slot frees up ${Oe(a,r)}`);let c=e.actions?.find(e=>e.kind===`primary`);i!==`ok`&&c&&o(t)&&(s.action={id:c.id,label:c.label})}return s}var De=864e5;function Oe(e,t,n){let r=Math.ceil((e.getTime()-t.getTime())/6e4);if(r<60)return`in ${Math.max(1,r)} min`;let i=e.toLocaleTimeString(n,{hour:`2-digit`,minute:`2-digit`}),a=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),o=Math.round((a(e)-a(t))/De);return o===0?`today at ${i}`:o===1?`tomorrow at ${i}`:`${e.toLocaleDateString(n,o<6?{weekday:`short`}:{weekday:`short`,day:`numeric`,month:`short`})} at ${i}`}function ke(e,t=i){let n=e?.offer;if(!n||!o(t)||typeof n.title!=`string`||!n.title.trim())return;let r=e.actions?.find(e=>e.id===n.action);if(!r)return;let a=e=>typeof e==`string`&&e.trim()?e.trim():void 0;return{title:n.title.trim(),price:a(n.price),description:a(n.description),points:Array.isArray(n.points)?n.points.map(a).filter(e=>!!e):[],action:{id:r.id,label:r.label}}}function Ae(e,t){let n=t?.meter?.label?.trim().toLowerCase();return n?e.filter(e=>e.label.trim().toLowerCase()!==n):[...e]}var je={claude:`Claude`,codex:`Codex`,grok:`Grok`},Me={ready:`Ready to import`,conflict:`Already saved — use another name to keep both`,missing:`No credential file found`,unreadable:`Credential file could not be read`,unsupported:`Login format not supported`},Ne={imported:`Imported`,conflict:`Skipped — credential already exists`,changed:`Login changed — scan again`};function Pe({state:e,onBack:t}){let{currentNodeId:n,nodes:r,status:i}=e.connection,[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(`node`),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),y=(0,J.useRef)(0),b=()=>{y.current++,u(null),f([]),m(null),v(null),g(null)};(0,J.useEffect)(()=>(b(),()=>{y.current+=1}),[n,i]);let x=r.find(e=>e.id===n)?.name||n||`Connected machine`,S=async()=>{let e=++y.current;g(`scan`),v(null),m(null),u(null);try{let t=await T.previewNativeCredentials(n,a);if(y.current!==e)return;u(t),f(t.items.filter(e=>e.status===`ready`).map(e=>e.agent))}catch(t){y.current===e&&v(t instanceof Error?t.message:`Scan failed.`)}finally{y.current===e&&g(null)}},C=async()=>{if(!l)return;let e=++y.current;g(`import`),v(null);try{let t=await T.importNativeCredentials(n,l.previewId,d,s);if(y.current!==e)return;m(t),u(null),f([]),T.listCredentialRecords(),T.listProviders()}catch(t){y.current===e&&(v(t instanceof Error?t.message:`Import failed. Scan again before retrying.`),u(null))}finally{y.current===e&&g(null)}};return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{autoFocus:T.direct||!r.length,className:`btn link`,disabled:h===`import`,onClick:t,children:`‹ Credentials`}),(0,Y.jsx)(`h3`,{children:`Import from machine`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Bring existing Claude, Codex, or Grok sign-ins into Bivy. Saved credentials are never replaced.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-machine`,children:`Source machine`}),(0,Y.jsxs)(`select`,{autoFocus:!T.direct&&r.length>0,id:`native-import-machine`,className:`picker-search`,value:n??``,disabled:T.direct||!!h||!r.length,onChange:e=>{b(),T.switchNode(e.target.value)},children:[!r.some(e=>e.id===n)&&(0,Y.jsx)(`option`,{value:n??``,children:i===`online`?x:`Choose an online machine`}),r.filter(e=>!T.direct||e.id===n).map(e=>(0,Y.jsxs)(`option`,{value:e.id,disabled:!e.online&&e.id!==n,children:[e.name||e.id,e.online?``:` — offline`]},e.id))]}),(0,Y.jsxs)(`p`,{className:`muted small`,children:[T.direct?`Direct connection: imports run on this machine only.`:`Selecting a machine also connects Settings to it.`,` Only logins readable by the Bivy daemon’s OS user can be found.`]}),i!==`online`&&(0,Y.jsx)(`p`,{className:`banner inline`,role:`status`,children:i===`connecting`?`Connecting to machine…`:`Connect an online machine to scan its logins.`}),(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`Keep a second login`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-label`,children:`Credential name (optional)`}),(0,Y.jsx)(`input`,{id:`native-import-label`,className:`picker-search`,maxLength:100,placeholder:`Default — or Work to keep a second login`,disabled:!!h,value:a,onChange:e=>{o(e.target.value),b()}})]}),(0,Y.jsx)(`button`,{className:`btn`,disabled:i!==`online`||!!h,onClick:()=>void S(),children:h===`scan`?`Scanning…`:l||p?`Scan again`:`Scan for logins`}),h&&(0,Y.jsx)(`p`,{className:`muted`,role:`status`,children:h===`scan`?`Reading login files on the selected machine…`:`Importing selected logins…`}),l&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`h4`,{className:`settings-subhead`,children:[`Logins on `,x]}),(0,Y.jsx)(`div`,{className:`picker-list`,children:l.items.map(e=>(0,Y.jsxs)(`label`,{className:`picker-item`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:je[e.agent]}),(0,Y.jsxs)(`small`,{children:[e.provider?`${e.provider} · ${e.kind===`oauth`?`Subscription sign-in`:`API key`} · `:``,Me[e.status]]})]}),(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":`Import ${je[e.agent]}`,disabled:e.status!==`ready`||!!h,checked:d.includes(e.agent),onChange:t=>f(n=>t.target.checked?[...n,e.agent]:n.filter(t=>t!==e.agent))})]},e.agent))}),!l.items.some(e=>e.status===`ready`)&&(0,Y.jsx)(`p`,{role:`status`,className:`muted`,children:`No new logins to import. Sign in on this machine, or use another credential name if already saved.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`native-import-scope`,children:`Available on`}),(0,Y.jsxs)(`select`,{id:`native-import-scope`,className:`picker-search`,value:s,disabled:!!h,onChange:e=>c(e.target.value),children:[(0,Y.jsx)(`option`,{value:`node`,children:`Only the source machine`}),(0,Y.jsx)(`option`,{value:`account`,children:`All my machines — end-to-end encrypted`})]}),(0,Y.jsx)(`p`,{className:`muted`,children:s===`account`?`Importing grants account sync, not unattended cloud access. Other machines receive credentials when connected.`:`Imported logins stay in this machine’s encrypted vault. You can enable account sync later.`}),(0,Y.jsx)(`button`,{className:`btn primary block`,disabled:!d.length||!!h||i!==`online`,onClick:()=>void C(),children:h===`import`?`Importing…`:`Import ${d.length||`selected`} login${d.length===1?``:`s`}`})]}),p&&(0,Y.jsxs)(`div`,{className:`banner inline`,role:`status`,children:[p.items.map(e=>(0,Y.jsxs)(`p`,{children:[je[e.agent],`: `,Ne[e.status]]},e.agent)),p.warning&&(0,Y.jsx)(`p`,{children:p.warning}),p.items.some(e=>e.status===`imported`)&&(0,Y.jsxs)(`p`,{children:[s===`account`?`Saved and eligible for account sync; delivery to other machines is not yet confirmed.`:`Saved only on ${x}.`,a.trim()&&` Select the named credential in model accounts to use it.`]})]}),_&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:_}),(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`What can be imported?`}),(0,Y.jsx)(`p`,{className:`muted`,children:`File-based logins only; OS-keychain-only logins are not supported. Tokens never appear in this preview. Native logins are left untouched.`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Access is not verified. Subscription sign-ins work only with compatible Bivy-managed runtimes. Concurrent OAuth refresh by native CLIs or other machines may require signing in again.`})]})]})}var Fe=b.map(e=>({id:e.id,name:e.name,oauth:e.authMethods.some(e=>e.kind===`oauth`),apiKey:e.authMethods.some(e=>e.kind===`api_key`),reference:e.authMethods.some(e=>e.kind===`reference`),help:e.authMethods.find(e=>e.kind===`api_key`)?.helpUrl})),Q=(e,t)=>`${e}\u0000${t||`default`}`,Ie=e=>e.label==="default"?e.providerName:`${e.providerName} — ${e.label}`,Le=e=>e===`oauth`?`Subscription sign-in`:e===`reference`?`Password-manager reference`:e===`environment`?`Environment`:`API key`,Re=e=>e===`account`?`All my machines`:e===`node`?`Only this machine`:`Only this device`;function ze({state:e,initialProvider:t=null}){let n=e.connection.status,r=e.connection.currentNodeId,i=e.connection.nodes,a=e.catalogs.providers,o=e.catalogs.repos,s=e.settings.credentialRecords,c=e.settings.credentialPresets,l=e.settings.localModels,u=e.presentation.oauth,[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)(()=>t?`add`:`list`),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(``),[b,x]=(0,J.useState)(()=>t??``),[S,C]=(0,J.useState)(`api_key`),[w,D]=(0,J.useState)(``),[O,k]=(0,J.useState)(``),[A,j]=(0,J.useState)(``),[M,N]=(0,J.useState)(``),[te,P]=(0,J.useState)(`openai-completions`),[ne,re]=(0,J.useState)(``),[ie,F]=(0,J.useState)(!1),[I,L]=(0,J.useState)(null),[R,B]=(0,J.useState)(`account`),[V,ae]=(0,J.useState)(e.draft.repo??``),[H,U]=(0,J.useState)(!1),[oe,W]=(0,J.useState)(null),[se,G]=(0,J.useState)(null),[K,q]=(0,J.useState)(null),[ce,le]=(0,J.useState)(()=>T.getOAuthBrowserRecovery()),ue=(0,J.useRef)(null),de=(0,J.useRef)(p);(0,J.useEffect)(()=>{de.current===`import`&&p===`list`&&ue.current?.focus(),de.current=p},[p]);let he=()=>T.listEphemeralModelKeys().then(f).catch(()=>f([])),ge=()=>{T.listProviders(),T.listCredentialRecords(),T.getCredentialPresets(),he()};(0,J.useEffect)(()=>{T.listProviders(),T.listCredentialRecords(),T.getCredentialPresets(),T.listLocalModels(),T.listRepos(),T.listEphemeralModelKeys().then(f).catch(()=>f([]))},[r]);let _e=(0,J.useRef)(null),ve=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(u){_e.current={provider:u.provider||b,label:w.trim().toLowerCase()||`default`};return}if(!_e.current)return;let e=_e.current;_e.current=null,ve.current=Q(e.provider,e.label),W(`Sign-in complete.`),ge()},[u]);let ye=(0,J.useMemo)(()=>{let e=new Map(Fe.map(e=>[e.id,e]));for(let t of a)e.set(t.id,{...e.get(t.id),id:t.id,name:t.name||t.id,oauth:t.oauth});for(let t of s)e.has(t.provider)||e.set(t.provider,{id:t.provider,name:t.provider});for(let t of d)e.has(t.provider)||e.set(t.provider,{id:t.provider,name:t.provider});for(let t of l)e.set(t.id,{id:t.id,name:t.name||t.id});return[...e.values()].sort((e,t)=>e.name.localeCompare(t.name))},[a,s,d,l]),be=e=>ye.find(t=>t.id===e)?.name||e,X=(0,J.useMemo)(()=>{let e=new Map,t=fe(pe(d),me(s,r||`current-node`));for(let n of t){let t=s.find(e=>e.provider===n.provider&&e.label===n.label),r=d.find(e=>e.provider===n.provider&&e.label===n.label);e.set(Q(n.provider,n.label),{provider:n.provider,providerName:be(n.provider),label:n.label,kind:n.kind,availability:n.availability.account?`account`:r?.scope===`device`?`device`:`node`,...t?{record:t}:{},...r?{device:r}:{}})}for(let t of a)t.configured&&![...e.values()].some(e=>e.provider===t.id)&&e.set(Q(t.id,`default`),{provider:t.id,providerName:t.name||t.id,label:`default`,kind:t.kind===`oauth`?`oauth`:`environment`,availability:`node`,ambient:!0});for(let t of l)e.has(Q(t.id,`default`))||e.set(Q(t.id,`default`),{provider:t.id,providerName:t.name||t.id,label:`default`,kind:`api_key`,availability:t.scope===`machine`?`node`:`account`});return[...e.values()].sort((e,t)=>e.providerName.localeCompare(t.providerName)||e.label.localeCompare(t.label))},[s,a,r,d,ye,l]),Z=h?X.find(e=>Q(e.provider,e.label)===h):void 0;(0,J.useEffect)(()=>{ve.current&&X.some(e=>Q(e.provider,e.label)===ve.current)&&(g(ve.current),ve.current=null,m(`detail`))},[X]);let xe=(0,J.useMemo)(()=>new Map(X.map(e=>[e.provider,X.filter(t=>t.provider===e.provider).length])),[X]),Se=(e=``)=>{x(e),C(`api_key`),D(``),k(``),j(``),N(``),P(`openai-completions`),re(``),F(!1),L(null),B(`account`),G(null),W(null)},Ce=async()=>{let e=b.trim().toLowerCase(),t=w.trim().toLowerCase()||`default`;if(!e)return;let r=!ie&&(Fe.some(t=>t.id===e)||a.some(t=>t.id===e)&&!l.some(t=>t.id===e)||X.some(t=>t.provider===e&&!l.some(t=>t.id===e)));if(!r||S===`oauth`||O.trim()){U(!0),G(null),W(null);try{if(!r){if(n!==`online`)throw Error(`Connect a machine to configure a custom model endpoint.`);if(!M.trim())throw Error(`A custom provider needs a base URL.`);let t=await T.saveLocalModel({providerId:e,name:A.trim()||e,baseUrl:M.trim(),api:te,...O.trim()?{apiKey:O.trim()}:{},models:ne.split(/[,\n]/).map(e=>e.trim()).filter(Boolean).map(e=>({id:e,name:e}))});T.listLocalModels(),ge(),W(`Custom provider saved.`),g(Q(t,`default`)),m(`detail`);return}if(S===`oauth`){if(n!==`online`)throw Error(`An online machine is needed to complete subscription sign-in.`);d.some(n=>n.provider===e&&n.label===t)&&await T.removeEphemeralModelKey(e,t),T.startOauth(e,t);return}if(S===`api_key`){let r=s.find(n=>n.provider===e&&n.label===t),i=d.find(n=>n.provider===e&&n.label===t);if(R===`device`&&r&&n!==`online`)throw Error(`Connect a machine to remove its existing copy before making this credential device-only.`);if(R===`account`||R===`device`?await T.setEphemeralModelKey(e,O.trim(),R===`device`?`device`:`account`,t):i&&await T.removeEphemeralModelKey(e,t),R===`device`)r&&await T.removeCredential(e,t);else if(n!==`online`){if(R===`node`)throw Error(`Connect to the machine where this key should be stored.`)}else await T.setCredential(e,t,{key:O.trim(),sync:R===`node`?`node`:`account`})}else{if(n!==`online`)throw Error(`Connect a machine to add a password-manager reference.`);d.some(n=>n.provider===e&&n.label===t)&&await T.removeEphemeralModelKey(e,t),await T.setCredential(e,t,{ref:O.trim(),sync:R===`account`?`account`:`node`})}W(`Credential saved.`),k(``),ge(),g(Q(e,t)),m(`detail`)}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}}},we=async(e,t,n,r)=>{U(!0),G(null);try{await T.setPresetMapping(e,t,n),W(r),T.getCredentialPresets()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}},Te=async e=>{U(!0),G(null);try{l.some(t=>t.id===e.provider)&&T.removeLocalModel(e.provider),e.device&&await T.removeEphemeralModelKey(e.provider,e.label),e.record&&await T.removeCredential(e.provider,e.label),q(null),m(`list`),g(null),ge()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(p===`import`)return(0,Y.jsx)(Pe,{state:e,onBack:()=>{m(`list`),ge()}});if(p===`add`){let e=ye.find(e=>e.id===b)??(b?{id:b,name:b}:void 0);if(!e){let e=ye.filter(e=>`${e.name} ${e.id}`.toLowerCase().includes(_.toLowerCase()));return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>m(`list`),children:`‹ Credentials`}),(0,Y.jsx)(`h3`,{children:`Add model access`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Connect a hosted provider or point Bivy at a model server you control.`}),(0,Y.jsxs)(`button`,{className:`custom-provider-card`,onClick:()=>{let e=_.trim().toLowerCase()||`local`;Se(e),x(e),F(!0)},children:[(0,Y.jsx)(`span`,{className:`custom-provider-card-icon`,"aria-hidden":!0,children:`+`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:`Local server or custom endpoint`}),(0,Y.jsx)(`small`,{children:`Ollama, LM Studio, vLLM, Azure, or another compatible API`})]}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`›`})]}),(0,Y.jsx)(`div`,{className:`vault-picker-label`,children:`Hosted providers`}),(0,Y.jsx)(`input`,{autoFocus:!0,className:`picker-search`,placeholder:`Search providers…`,value:_,onChange:e=>v(e.target.value)}),(0,Y.jsxs)(`div`,{className:`picker-list`,children:[e.map(e=>(0,Y.jsxs)(`button`,{className:`picker-item`,onClick:()=>{Se(e.id),x(e.id),e.apiKey===!1&&e.oauth&&C(`oauth`)},children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:e.name}),(0,Y.jsx)(`small`,{children:e.id})]}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`›`})]},e.id)),e.length===0&&(0,Y.jsx)(`div`,{className:`picker-empty`,children:`No hosted providers match. Add it as a custom endpoint above.`})]})]})}let t=ie||l.some(t=>t.id===e.id)||!Fe.some(t=>t.id===e.id)&&!a.some(t=>t.id===e.id)&&!X.some(t=>t.provider===e.id),n=Z?.provider===e.id,r=n||X.some(t=>t.provider===e.id),i=(0,Y.jsxs)(Y.Fragment,{children:[r&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`label`,{className:`field-label`,htmlFor:`credential-name`,children:[`Name `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`})]}),(0,Y.jsx)(`input`,{id:`credential-name`,className:`picker-search`,placeholder:`e.g. Work — leave empty for the default`,value:w,onChange:e=>D(e.target.value)})]}),S!==`oauth`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`credential-availability`,children:`Available on`}),(0,Y.jsxs)(`select`,{id:`credential-availability`,className:`picker-search`,value:R,onChange:e=>B(e.target.value),children:[(0,Y.jsx)(`option`,{value:`account`,children:`All my machines — end-to-end encrypted`}),(0,Y.jsx)(`option`,{value:`node`,children:`Only this machine`}),S===`api_key`&&(0,Y.jsx)(`option`,{value:`device`,children:`Only this device`})]})]})]});return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>x(``),children:`‹ Providers`}),(0,Y.jsx)(`h3`,{children:t?`Custom provider`:e.name}),u?.provider===e.id?(0,Y.jsx)(z,{}):(0,Y.jsxs)(Y.Fragment,{children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Use a local model server or any OpenAI-, Anthropic-, or Azure-compatible endpoint.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-name`,children:`Display name`}),(0,Y.jsx)(`input`,{id:`custom-provider-name`,className:`picker-search`,placeholder:`My local models`,value:A,onChange:e=>j(e.target.value)}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-id`,children:`Provider ID`}),(0,Y.jsx)(`input`,{id:`custom-provider-id`,className:`picker-search`,value:b,disabled:n,onChange:e=>x(e.target.value.toLowerCase())}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-endpoint`,children:`Endpoint`}),(0,Y.jsx)(`input`,{id:`custom-provider-endpoint`,className:`picker-search`,placeholder:`https://api.example.com/v1`,value:M,onChange:e=>N(e.target.value)}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`custom-provider-api`,children:`API compatibility`}),(0,Y.jsxs)(`select`,{id:`custom-provider-api`,className:`picker-search`,value:te,onChange:e=>P(e.target.value),children:[(0,Y.jsx)(`option`,{value:`openai-completions`,children:`OpenAI-compatible`}),(0,Y.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,Y.jsx)(`option`,{value:`azure-openai-responses`,children:`Azure OpenAI`}),(0,Y.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]}),(0,Y.jsxs)(`label`,{className:`field-label`,htmlFor:`custom-provider-key`,children:[`API key `,(0,Y.jsx)(`span`,{className:`muted`,children:`(optional)`})]}),(0,Y.jsx)(`input`,{id:`custom-provider-key`,className:`picker-search`,type:`password`,placeholder:`Leave blank for local servers without authentication`,value:O,onChange:e=>k(e.target.value)}),(0,Y.jsx)(`div`,{className:`row-actions`,children:(0,Y.jsx)(`button`,{className:`btn`,disabled:H||!M.trim(),onClick:async()=>{U(!0),G(null),L(null);try{let e=await T.verifyLocalModel(M.trim(),O.trim()||void 0);L(e),e.status===`ready`&&re(e.models.map(e=>e.id).join(`
3
3
  `))}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}},children:H?`Checking…`:`Test endpoint & find models`})}),I&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":I.status===`ready`?`ok`:`danger`,children:I.status===`ready`?`Connected on ${I.machineName}. Found ${I.models.length} model${I.models.length===1?``:`s`}.`:I.detail||`This endpoint could not be reached.`}),(0,Y.jsxs)(`label`,{className:`field-label`,htmlFor:`custom-provider-models`,children:[`Models `,(0,Y.jsx)(`span`,{className:`muted`,children:`(one per line)`})]}),(0,Y.jsx)(`textarea`,{id:`custom-provider-models`,className:`picker-search`,rows:3,placeholder:`model-id`,value:ne,onChange:e=>re(e.target.value)})]}),!t&&(0,Y.jsxs)(`div`,{className:`vault-methods`,role:`group`,"aria-label":`Sign-in method`,children:[e.oauth&&(0,Y.jsx)(`button`,{"aria-pressed":S===`oauth`,className:`btn ${S===`oauth`?`primary`:``}`,onClick:()=>C(`oauth`),children:`Subscription sign-in`}),e.apiKey!==!1&&(0,Y.jsx)(`button`,{"aria-pressed":S===`api_key`,className:`btn ${S===`api_key`?`primary`:``}`,onClick:()=>C(`api_key`),children:`API key`}),e.reference!==!1&&(0,Y.jsx)(`button`,{"aria-pressed":S===`reference`,className:`btn ${S===`reference`?`primary`:``}`,onClick:()=>{C(`reference`),R===`device`&&B(`node`)},children:`Password manager`})]}),!t&&(r?i:S===`oauth`?null:(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`Advanced options`}),i]})),S!==`oauth`&&!t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`credential-secret`,children:S===`reference`?`Reference`:`API key`}),(0,Y.jsx)(`input`,{id:`credential-secret`,className:`picker-search`,type:S===`reference`?`text`:`password`,placeholder:S===`reference`?`op://Vault/Item/field, env://NAME, or cmd://…`:`Paste API key`,value:O,onChange:e=>k(e.target.value)}),e.help&&S===`api_key`&&(0,Y.jsx)(`a`,{className:`btn link`,href:e.help,target:`_blank`,rel:`noreferrer`,children:`Where to create a key ↗`})]}),(0,Y.jsx)(`button`,{className:`btn primary block`,disabled:H||!t&&S!==`oauth`&&!O.trim()||t&&!M.trim(),onClick:Ce,children:H?`Saving…`:S===`oauth`?`Sign in with ${e.name}`:t?`Save custom provider`:`Save credential`})]}),se&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:se})]})}if(p===`detail`&&Z){let e=xe.get(Z.provider)??1,t=(c?.presets?.default?.[Z.provider]??`default`)===Z.label,n=V.trim(),a=n?`project:${n}`:void 0,s=a?c?.presets?.[a]?.[Z.provider]:void 0,u=s===Z.label,d=Object.entries(c?.presets??{}).filter(([e,t])=>e.startsWith(`project:`)&&t?.[Z.provider]===Z.label).map(([e])=>e.slice(8)),f=[...new Set([...o.map(e=>e.slug),...Object.keys(c?.presets??{}).filter(e=>e.startsWith(`project:`)).map(e=>e.slice(8))])].sort();return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[K&&(0,Y.jsx)(ee,{title:l.some(e=>e.id===K.provider)?`Remove endpoint?`:`Delete credential?`,message:l.some(e=>e.id===K.provider)?`Remove ${Ie(K)} and its models?`:`Delete ${Ie(K)}? Agents and projects using it will lose access.`,confirmLabel:`Delete`,danger:!0,onCancel:()=>q(null),onConfirm:()=>void Te(K)}),(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>m(`list`),children:`‹ Credentials`}),(0,Y.jsxs)(`div`,{className:`vault-title-row`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:Ie(Z)}),(0,Y.jsx)(`p`,{className:`muted`,children:l.some(e=>e.id===Z.provider)?`Local or custom endpoint`:Le(Z.kind)})]}),(0,Y.jsx)(E,{tone:Z.record?.lastVerifiedOk?`ok`:void 0,children:Z.record?.lastVerifiedOk?`Verified`:Z.ambient?`Provided by environment`:`Saved`})]}),(0,Y.jsxs)(`div`,{className:`vault-detail-grid`,children:[(0,Y.jsx)(`span`,{className:`muted`,children:`Available on`}),(0,Y.jsx)(`strong`,{children:Re(Z.availability)}),(0,Y.jsx)(`span`,{className:`muted`,children:`Used by default`}),(0,Y.jsx)(`strong`,{children:t?`Yes`:`No`}),(0,Y.jsx)(`span`,{className:`muted`,children:`Used by projects`}),(0,Y.jsx)(`strong`,{children:d.length?d.join(`, `):`None explicitly — projects use the default`}),V&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`muted`,children:`Selected project`}),(0,Y.jsx)(`strong`,{children:u?`Uses this credential`:s?`Uses ${s}`:`Uses provider default`})]}),y&&Z.record&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`muted`,children:`Unattended runs`}),(0,Y.jsx)(`strong`,{children:Z.record.unattended?`Allowed — encrypted cloud copy enabled`:`Not allowed`})]}),Z.record?.origin===`agent-native`&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`muted`,children:`Added by`}),(0,Y.jsx)(`strong`,{children:`Agent sign-in`})]}),Z.record?.ref&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`muted`,children:`Reference`}),(0,Y.jsx)(`code`,{children:Z.record.ref})]})]}),Z.record&&(0,Y.jsxs)(`div`,{className:`row-actions`,children:[Z.record.testable&&(0,Y.jsx)(`button`,{className:`btn`,disabled:H,onClick:async()=>{U(!0),G(null);let e=await T.testCredential(Z.provider,Z.label).catch(()=>({ok:!1,at:Date.now(),reason:`network_error`}));W(e.ok?`Connection verified.`:`Verification failed: ${e.reason||`unknown error`}.`),ge(),U(!1)},children:`Test connection`}),e>1&&!t&&(0,Y.jsx)(`button`,{className:`btn`,disabled:H,onClick:()=>void we(`default`,Z.provider,Z.label,`Now used by default.`),children:`Use by default`}),e>1&&a&&!u&&(0,Y.jsxs)(`button`,{className:`btn`,disabled:H,onClick:()=>void we(a,Z.provider,Z.label,`Assigned to ${n}.`),children:[`Use for `,n]}),a&&u&&(0,Y.jsx)(`button`,{className:`btn`,disabled:H,onClick:()=>void we(a,Z.provider,``,`${n} now uses the provider default.`),children:`Clear project assignment`}),y&&Z.record.sync===`account`&&Z.record.kind!==`reference`&&(0,Y.jsx)(`button`,{className:`btn`,disabled:H,onClick:async()=>{U(!0),G(null);try{await T.setCredentialUnattended(Z.provider,Z.label,!Z.record.unattended),W(Z.record.unattended?`Unattended access revoked and its encrypted cloud copy removed.`:`Unattended access enabled with a separate encrypted cloud copy.`),ge()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}},children:Z.record.unattended?`Disable unattended runs`:`Allow unattended runs`})]}),y&&Z.record?.sync===`account`&&Z.record.kind!==`reference`&&(0,Y.jsx)(`p`,{className:`muted vault-custody-note`,children:`To run while all your devices are offline, Bivy stores a separate encrypted copy of this credential in its control plane. This is opt-in, used only for unattended runs, and removed when you disable access.`}),e>1&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`credential-project`,children:`Assign for project or repository`}),(0,Y.jsx)(`input`,{id:`credential-project`,className:`picker-search`,list:`credential-project-options`,placeholder:`owner/repository or project ID`,value:V,onChange:e=>ae(e.target.value)}),(0,Y.jsx)(`datalist`,{id:`credential-project-options`,children:f.map(e=>(0,Y.jsx)(`option`,{value:e},e))})]}),!Z.ambient&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`Replace or change availability`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Re-enter the secret to replace it or move it. Bivy never displays saved secrets.`}),(0,Y.jsx)(`button`,{className:`btn`,onClick:()=>{let e=l.find(e=>e.id===Z.provider);Se(Z.provider),D(Z.label==="default"?``:Z.label),C(Z.kind===`reference`?`reference`:`api_key`),B(Z.availability),e&&(F(!0),j(e.name||e.id),N(e.baseUrl),P(e.api),re(e.models.map(e=>e.id).join(`
4
4
  `))),m(`add`)},children:`Edit credential`})]}),(0,Y.jsx)(`button`,{className:`btn danger-ghost`,disabled:H,onClick:()=>q(Z),children:l.some(e=>e.id===Z.provider)?`Remove endpoint`:`Delete credential`})]}),oe&&(0,Y.jsx)(`p`,{className:`banner inline`,children:oe}),se&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,children:se}),i.length>0&&(0,Y.jsxs)(`details`,{className:`vault-advanced`,children:[(0,Y.jsx)(`summary`,{children:`Machine availability`}),(0,Y.jsx)(`div`,{className:`picker-list`,children:i.map(e=>{let t=Z.availability===`account`||Z.availability===`node`&&e.id===r,n=t?e.online?`Available`:Z.availability===`account`?`Will sync when online`:`Offline`:`Not available`;return(0,Y.jsxs)(`div`,{className:`picker-item`,children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:e.name||e.id}),(0,Y.jsx)(`small`,{children:n})]}),(0,Y.jsx)(E,{tone:t&&e.online?`ok`:void 0,children:n})]},e.id)})})]})]})}let Ee=X.filter(e=>`${e.providerName} ${e.provider} ${e.label}`.toLowerCase().includes(_.toLowerCase()));return(0,Y.jsxs)(`div`,{className:`settings-form credential-vault`,children:[(0,Y.jsxs)(`div`,{className:`vault-title-row`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:`Your model access`}),(0,Y.jsx)(`p`,{className:`muted settings-intro`,children:`Hosted providers, subscription sign-ins, API keys, and your own model endpoints.`})]}),(0,Y.jsx)(`button`,{className:`btn primary`,onClick:()=>{g(null),Se(),v(``),m(`add`)},children:`+ Add`})]}),(0,Y.jsx)(`button`,{ref:ue,className:`btn`,onClick:()=>m(`import`),children:`Import from machine`}),(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`div`,{className:`settings-toggle-title`,children:`OAuth browser recovery`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Keep account OAuth refresh tokens end-to-end encrypted on your signed-in devices so a new machine can recover without another machine online.`})]}),(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":ce,"aria-label":`Allow OAuth browser recovery`,className:`settings-toggle${ce?` on`:``}`,onClick:()=>{let e=!ce;le(e),T.setOAuthBrowserRecovery(e).catch(()=>le(!e))},children:(0,Y.jsx)(`span`,{className:`settings-toggle-knob`,"aria-hidden":!0})})]}),X.length===0?(0,Y.jsxs)(`div`,{className:`vault-empty`,children:[(0,Y.jsx)(`h4`,{children:`No providers yet`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Add a sign-in, API key, local model, or custom endpoint.`}),(0,Y.jsx)(`button`,{className:`btn primary`,onClick:()=>{g(null),Se(),m(`add`)},children:`Add provider`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`input`,{className:`picker-search`,placeholder:`Search credentials…`,value:_,onChange:e=>v(e.target.value)}),(0,Y.jsx)(`div`,{className:`picker-list vault-items`,children:Ee.map(e=>(0,Y.jsxs)(`button`,{className:`picker-item`,onClick:()=>{g(Q(e.provider,e.label)),W(null),G(null),m(`detail`)},children:[(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`strong`,{children:Ie(e)}),(0,Y.jsxs)(`small`,{children:[l.some(t=>t.id===e.provider)?`Local or custom endpoint`:Le(e.kind),` · `,Re(e.availability)]})]}),(0,Y.jsxs)(`span`,{className:`vault-row-status`,children:[e.record?.lastVerifiedOk&&(0,Y.jsx)(E,{tone:`ok`,children:`Verified`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`›`})]})]},Q(e.provider,e.label)))})]})]})}var Be=new TextEncoder;function Ve(e){return e<1024?`${e} B`:`${(e/1024).toFixed(+(e<10240))} KB`}function He({state:e}){let t=e.connection.status===`online`,n=t?e.settings.nodeSettings?.agentInstructions:void 0,r=!t||!e.settings.nodeSettings||!!n,[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(!1),b=T.local.cur;(0,J.useEffect)(()=>{t&&T.getNodeSettings()},[t,b]);let x=o!==null&&i!==c,S=!!(n&&o!==null&&n.updatedAt!==o&&n.text!==i),C=()=>{n&&(s(n.updatedAt),l(n.text),p(null))},w=()=>{n&&(a(n.text),s(n.updatedAt),l(n.text),p(null))};if((0,J.useEffect)(()=>{n&&(o===null||!x||n.text===i)?w():n&&n.text===c&&s(n.updatedAt)},[n?.updatedAt,n?.text]),!t)return(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsxs)(`div`,{className:`vault-empty`,children:[(0,Y.jsx)(`h4`,{children:`No machine connected`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Agent instructions are saved through one of your machines. Connect to a machine to edit them.`})]})});if(!r)return(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsxs)(`div`,{className:`vault-empty`,children:[(0,Y.jsx)(`h4`,{children:`Update this machine`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`This machine's version of Bivy doesn't support agent instructions yet. Update it, or connect to another machine.`})]})});if(!n||o===null)return(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(`p`,{className:`muted`,children:`Loading instructions…`})});let E=Be.encode(i).length,D=E>n.maxBytes;return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[f&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:f}),S&&(0,Y.jsxs)(`div`,{className:`banner inline`,"data-tone":`warn`,role:`status`,children:[(0,Y.jsx)(`span`,{className:`banner-text`,children:`These instructions were changed on another device. Load that version, or keep your edit and save over it.`}),(0,Y.jsxs)(`span`,{className:`banner-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:w,children:`Load latest`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn sm ghost`,onClick:C,children:`Keep mine`})]})]}),n.bivyNote!==void 0&&(0,Y.jsx)(`section`,{className:`settings-section`,children:(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:`Send Bivy's system instructions`}),(0,Y.jsx)(`span`,{className:`muted small`,children:`A short note ahead of your instructions that tells agents they run in Bivy and how to send you files and app previews.`}),(0,Y.jsx)(`button`,{type:`button`,className:`btn link`,onClick:()=>y(!0),children:`View system instructions`})]}),(0,Y.jsx)(W,{checked:n.bivyNote,onChange:async e=>{_(!0),p(null);try{await T.setNodeSettings({agentInstructionsBivyNote:e})}catch(e){p(String(e?.message||e))}finally{_(!1)}},disabled:g,label:`Send Bivy's system instructions`})]})}),v&&(0,Y.jsx)(F,{title:`Bivy's system instructions`,onClose:()=>y(!1),autoFocusSearch:!1,children:(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`p`,{className:`muted small`,children:n.bivyNote?`Every agent session gets this note ahead of your instructions.`:`Turned off: agent sessions don't get this note.`}),(0,Y.jsx)(`pre`,{className:`code-snippet agent-note-text`,children:n.bivyNoteText})]})}),(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsx)(`p`,{className:`muted small`,children:`Every agent session on all your machines gets these, in addition to the repository's own AGENTS.md or CLAUDE.md. Where they conflict, the repository wins. Changes apply to new sessions.`}),(0,Y.jsx)(`label`,{className:`field-label`,htmlFor:`agent-instructions`,children:`Instructions (Markdown)`}),(0,Y.jsx)(`textarea`,{id:`agent-instructions`,className:`picker-search`,rows:16,value:i,placeholder:`How you like agents to work, e.g.
5
5
  - Prefer small, focused commits.
6
- - Run the tests before saying you're done.`,"aria-describedby":`agent-instructions-size`,"aria-invalid":D||void 0,onChange:e=>{a(e.target.value),h(!1)}}),(0,Y.jsxs)(`p`,{id:`agent-instructions-size`,className:D?`settings-error`:`muted small`,children:[Ve(E),` of `,Ve(n.maxBytes),D?` — shorten the instructions to save them.`:``]}),(0,Y.jsxs)(`div`,{className:`row-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:async()=>{if(!(u||D||!x||S)){d(!0),p(null),h(!1);try{await T.setNodeSettings({agentInstructions:i,agentInstructionsBaseUpdatedAt:o}),h(!0),window.setTimeout(()=>h(!1),1500)}catch(e){p(String(e?.message||e))}finally{d(!1)}}},disabled:u||D||!x||S,children:u?`Saving…`:m?`Saved`:`Save`}),x&&(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:w,disabled:u,children:`Revert`})]})]}),(0,Y.jsxs)(`details`,{className:`settings-section settings-disclosure`,children:[(0,Y.jsx)(`summary`,{className:`settings-disclosure-summary`,children:`How agents receive them`}),(0,Y.jsx)(`div`,{className:`settings-disclosure-body`,children:(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Claude Code, Codex, Pi and OpenCode get them as part of their system instructions. Other agents get them through Bivy's MCP server where it is available, which each agent may weigh differently. They're synced to your other machines end-to-end encrypted, and stored on each machine as `,(0,Y.jsx)(`code`,{children:`AGENTS.md`}),` in Bivy's data directory.`]})})]})]})}var Ue=(0,J.lazy)(()=>f(()=>import(`./VoiceSettings-CO99U2gC.js`).then(e=>({default:e.VoiceSettings})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),We=[`github`,`linear`,`slack`,`queue`,`webhooks`,`rulesets`];function Ge(e){return e!==null&&We.includes(e)}function $({children:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:e})}var Ke=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,Y.jsx)(`path`,{d:`M12 3v18a9 9 0 0 0 0-18z`,fill:`currentColor`,stroke:`none`})]}),qe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`7.5`,cy:`15.5`,r:`4.5`}),(0,Y.jsx)(`path`,{d:`m11 12 8-8`}),(0,Y.jsx)(`path`,{d:`m16 5 3 3`}),(0,Y.jsx)(`path`,{d:`m13 8 3 3`})]}),Je=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,Y.jsx)(`path`,{d:`M14 3v5h5`}),(0,Y.jsx)(`path`,{d:`M9 13h6M9 17h4`})]}),Ye=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`9`,y:`2`,width:`6`,height:`12`,rx:`3`}),(0,Y.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,Y.jsx)(`path`,{d:`M12 19v3`})]}),Xe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,Y.jsx)(`path`,{d:`M4 21a8 8 0 0 1 16 0`})]}),Ze=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`}),(0,Y.jsx)(`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`})]}),Qe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`}),(0,Y.jsx)(`path`,{d:`M8 21h8M12 17v4`})]}),$e=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`7`,rx:`2`}),(0,Y.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`7`,rx:`2`}),(0,Y.jsx)(`path`,{d:`M7 7.5h.01M7 16.5h.01`})]}),et=()=>(0,Y.jsx)($,{children:(0,Y.jsx)(`path`,{d:`M13 2 4 14h7l-1 8 9-12h-7l1-8z`})}),tt=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,Y.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}),nt=()=>(0,Y.jsx)($,{children:(0,Y.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})}),rt=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9`}),(0,Y.jsx)(`path`,{d:`M13.7 21a2 2 0 0 1-3.4 0`})]}),it=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M12 3v12`}),(0,Y.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,Y.jsx)(`path`,{d:`M5 19h14`})]}),at=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7`}),(0,Y.jsx)(`path`,{d:`m8 6 4-4 4 4`}),(0,Y.jsx)(`path`,{d:`M12 2v13`})]});function ot(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function st(e){let[t,n]=(0,J.useState)(()=>typeof matchMedia==`function`&&matchMedia(e).matches);return(0,J.useEffect)(()=>{if(typeof matchMedia!=`function`)return;let t=matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ct(e){let[t,n]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!e)return;let t=!0;return T.fetchMe().then(e=>{t&&n(e)}).catch(()=>{}),()=>{t=!1}},[e]),t}var lt={ok:null,near:`Almost used up`,reached:`Limit reached`};function ut({meter:e,action:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(null),o=lt[e.state];return(0,Y.jsxs)(`div`,{className:`settings-account-usage`,"data-state":e.state,children:[(0,Y.jsxs)(`div`,{className:`settings-account-usage-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`span`,{className:`settings-account-usage-count`,children:[e.used,` of `,e.limit]})]}),(0,Y.jsx)(`div`,{className:`meter`,role:`meter`,"aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.limit,"aria-valuenow":e.used,"aria-valuetext":`${e.used} of ${e.limit}${o?` — ${o.toLowerCase()}`:``}`,"data-state":e.state,children:(0,Y.jsx)(`span`,{className:`meter-fill`,style:{width:`${e.used/e.limit*100}%`}})}),o&&(0,Y.jsxs)(`span`,{className:`settings-account-usage-status`,children:[(0,Y.jsx)(`span`,{className:`settings-account-usage-note`,children:o}),e.freesNote&&(0,Y.jsx)(`span`,{children:e.freesNote})]}),t&&(0,Y.jsx)(`button`,{type:`button`,className:`btn primary block`,disabled:n,onClick:()=>{r(!0),a(null),T.invokeAccountExtensionAction(t.id).then(({url:e})=>d(e)).catch(e=>a(String(e?.message||e))).finally(()=>r(!1))},children:n?`Opening…`:t.label}),i&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,children:i})]})}function dt(e){return((e.split(`@`)[0]??``).replace(/[^a-z0-9]/gi,``)||e).slice(0,2).toUpperCase()}var ft={appearance:`Appearance`,notifications:`Notifications`,import:`Import session`,providers:`Models & keys`,models:`Models & keys`,instructions:`Agent instructions`,voice:`Voice`,share:`Share to Bivy`,github:`GitHub App`,linear:`Linear`,slack:`Slack`,queue:`Runs`,webhooks:`Webhooks`,rulesets:`Rulesets`,nodes:`Machines`,ephemeral:`Cloud machine profiles`,account:`Account`,link:`Link a device`},pt={appearance:`theme system light dark`,notifications:`push alerts attention approval permission idle completed`,import:`session transcript file upload migrate`,providers:`model provider api key oauth openai anthropic google login credentials custom endpoint local ollama import claude codex grok machine`,models:`model provider api key oauth ollama local custom endpoint`,instructions:`agents.md claude.md system prompt global instructions rules preferences memory`,voice:`microphone speech transcription read aloud reader text to speech voice tone speed`,share:`share sheet send android ios iphone ipad shortcut link url target`,github:`github app repository installation issue pull request`,linear:`linear workspace issue integration`,slack:`slack workspace channel integration`,queue:`work queue issue run evidence outcome retry lease checks`,webhooks:`webhook trigger secret event`,rulesets:`rules policy routing agent runtime model sandbox`,nodes:`node daemon online offline diagnostics version update storage disk cloud machines experimental unstable`,ephemeral:`cloud machine profiles automation offline teardown retention`,account:`account email devices machines usage`,link:`device qr code phone mobile pair`};function mt({state:e,onClose:t,view:n,onViewChange:r,onImported:i,onRedirectToAutomations:a}){let o=!T.direct,s=st(`(min-width: 721px)`),c=`appearance`,[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),h=n??(s?c:null);(0,J.useEffect)(()=>{s&&n===null&&r(c)},[s,n]),(0,J.useEffect)(()=>{Ge(n)&&a?.(n)},[n]);let g=M(t),_=(0,J.useRef)(g);_.current=t,re(()=>_.current()),(0,J.useEffect)(()=>{let e=document.activeElement;return()=>{e?.focus?.()}},[]);let v=A(),b=y&&v,x=[{label:`Models & keys`,items:[{id:`providers`,label:`Providers & credentials`,icon:(0,Y.jsx)(qe,{})}]},{label:`Agents`,items:[{id:`instructions`,label:`Agent instructions`,icon:(0,Y.jsx)(Je,{})}]},{label:`Machines`,items:[{id:`nodes`,label:`Machines`,icon:(0,Y.jsx)($e,{})},...b?[{id:`ephemeral`,label:`Cloud machine profiles`,icon:(0,Y.jsx)(et,{})}]:[],...o?[{id:`link`,label:`Link a device`,icon:(0,Y.jsx)(Ze,{})}]:[]]},{label:`App`,items:[{id:`appearance`,label:`Appearance`,icon:(0,Y.jsx)(Ke,{})},{id:`notifications`,label:`Notifications`,icon:(0,Y.jsx)(rt,{})},{id:`voice`,label:`Voice`,icon:(0,Y.jsx)(Ye,{})},{id:`import`,label:`Import session`,icon:(0,Y.jsx)(it,{})},{id:`share`,label:`Share to Bivy`,icon:(0,Y.jsx)(at,{})}]}],S=ct(o),C=S?.account?.email??null,w=Ee(S?.extension),E={id:`account`,label:C??`Account`,icon:(0,Y.jsx)(Xe,{})},D=l.trim().toLowerCase(),O=e=>!D||`${e.label} ${ft[e.id]} ${pt[e.id]}`.toLowerCase().includes(D),k=o&&O(E),j=k||x.some(e=>e.items.some(O)),te=e=>`settings-nav-item${h===e||e===`providers`&&h===`models`?` active`:``}`,ne=h?ft[h]:`Settings`;return(0,ve.createPortal)((0,Y.jsxs)(`div`,{className:`settings-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[d&&(0,Y.jsx)(ee,{title:`Sign out?`,message:`Sign out of Bivy on this device?`,confirmLabel:`Sign out`,danger:!0,onCancel:()=>f(!1),onConfirm:()=>{f(!1),T.signOut().catch(e=>T.store.setError(String(e?.message||e)))}}),(0,Y.jsx)(`div`,{className:`settings-scrim`,onClick:g}),(0,Y.jsxs)(`div`,{className:`settings-panel`,"data-mode":h?`panel`:`menu`,children:[(0,Y.jsxs)(`aside`,{className:`settings-nav`,children:[(0,Y.jsxs)(`div`,{className:`settings-nav-top`,children:[(0,Y.jsx)(`span`,{className:`settings-nav-heading`,children:`Settings`}),(0,Y.jsx)(`button`,{className:`settings-x`,onClick:g,"aria-label":`Close settings`,children:(0,Y.jsx)(P,{})})]}),(0,Y.jsxs)(`div`,{className:`settings-search-wrap`,children:[(0,Y.jsxs)(`svg`,{className:`settings-search-icon`,viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,Y.jsx)(`input`,{className:`field settings-search`,type:`search`,placeholder:`Search`,value:l,onChange:e=>u(e.target.value)})]}),(0,Y.jsxs)(`nav`,{className:`settings-nav-groups`,children:[!j&&(0,Y.jsxs)(`div`,{className:`picker-empty`,children:[`No settings match "`,l.trim(),`"`]}),k&&(0,Y.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Y.jsxs)(`button`,{className:te(`account`),title:C??void 0,onClick:()=>r(`account`),children:[(0,Y.jsx)(`span`,{className:`settings-account-avatar`,"aria-hidden":!0,children:C?dt(C):E.icon}),(0,Y.jsxs)(`span`,{className:`settings-account-text`,children:[(0,Y.jsx)(`span`,{className:`settings-nav-label`,children:E.label}),(0,Y.jsx)(`span`,{className:`settings-account-sub`,children:w.summary??`Account`})]}),(0,Y.jsx)(`span`,{className:`settings-nav-chevron`,children:(0,Y.jsx)(N,{size:18})})]}),w.meter&&(0,Y.jsx)(ut,{meter:w.meter,action:w.action})]}),x.map(e=>{let t=e.items.filter(O);return t.length===0?null:(0,Y.jsxs)(`div`,{className:`settings-nav-group`,children:[(0,Y.jsx)(`div`,{className:`settings-nav-group-label`,children:e.label}),t.map(e=>(0,Y.jsxs)(`button`,{className:te(e.id),onClick:()=>{e.id===`providers`&&m(null),r(e.id)},children:[(0,Y.jsx)(`span`,{className:`settings-nav-icon`,children:e.icon}),(0,Y.jsx)(`span`,{className:`settings-nav-label`,children:e.label}),(0,Y.jsx)(`span`,{className:`settings-nav-chevron`,children:(0,Y.jsx)(N,{size:18})})]},e.id))]},e.label)})]}),o&&(0,Y.jsx)(`button`,{className:`btn block`,onClick:()=>f(!0),children:`Sign out`}),(0,Y.jsxs)(`div`,{className:`settings-nav-version`,title:`The version of the Bivy app running on this device`,children:[(0,Y.jsxs)(`span`,{children:[`Bivy v`,`0.20.4`]}),ot(`2026-10-01T08:41:44.787Z`)&&(0,Y.jsxs)(`span`,{className:`settings-nav-version-updated`,children:[`Updated `,ot(`2026-10-01T08:41:44.787Z`)]})]})]}),(0,Y.jsxs)(`section`,{className:`settings-content`,children:[(0,Y.jsxs)(`header`,{className:`settings-head`,children:[h&&(0,Y.jsxs)(`button`,{className:`settings-back`,onClick:()=>r(null),"aria-label":`Back to settings`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`‹`}),` Settings`]}),(0,Y.jsx)(`h2`,{className:`settings-head-title`,children:ne}),(0,Y.jsx)(`button`,{className:`settings-x settings-x-content`,onClick:g,"aria-label":`Close settings`,children:(0,Y.jsx)(P,{})})]}),(0,Y.jsxs)(`div`,{className:`settings-body`,children:[h===`appearance`&&(0,Y.jsx)(ht,{}),h===`notifications`&&(0,Y.jsx)(bt,{}),h===`import`&&(0,Y.jsx)(gt,{onImported:e=>i?.(e)}),h===`share`&&(0,Y.jsx)(_t,{}),h===`providers`&&(0,Y.jsx)(ze,{state:e,initialProvider:p}),h===`models`&&(0,Y.jsx)(Et,{state:e,onStartWork:t}),h===`instructions`&&(0,Y.jsx)(He,{state:e}),h===`voice`&&(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`muted`,children:`Loading voice settings…`}),children:(0,Y.jsx)(Ue,{state:e,onManageKey:e=>{m(e),r(`providers`)}})}),h===`nodes`&&(0,Y.jsx)(Dt,{state:e,cloudMachinesEnabled:b}),h===`ephemeral`&&y&&(b?(0,Y.jsx)(jt,{}):(0,Y.jsx)(yt,{})),h===`account`&&(0,Y.jsx)(Ft,{}),h===`link`&&(0,Y.jsx)(Lt,{onDone:t})]},h??`menu`)]})]})]}),document.body)}function ht(){let[e,t]=(0,J.useState)(u()),[n,r]=(0,J.useState)(l());(0,J.useEffect)(()=>s(()=>r(l())),[]);let i=[...n?[{id:`machine`,label:`Machine`,icon:(0,Y.jsx)(Ke,{})}]:[],{id:`system`,label:`System`,icon:(0,Y.jsx)(Qe,{})},{id:`light`,label:`Light`,icon:(0,Y.jsx)(tt,{})},{id:`dark`,label:`Dark`,icon:(0,Y.jsx)(nt,{})}];return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`label`,{className:`field-label`,children:`Theme`}),(0,Y.jsx)(we,{ariaLabel:`Theme`,value:e===`machine`&&!n?`system`:e,options:i,onChange:e=>{p(e),t(e)}}),(0,Y.jsxs)(`p`,{className:`muted`,children:[`Choose how Bivy looks. `,(0,Y.jsx)(`strong`,{children:`System`}),` follows your device's light/dark setting.`,n&&(0,Y.jsxs)(Y.Fragment,{children:[` `,(0,Y.jsx)(`strong`,{children:`Machine`}),` matches this machine's desktop theme, now `,n.name,`, and changes with it.`]})]})]})}function gt({onImported:e}){return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Adopt a Claude Code or Codex session that was started outside Bivy. Only sessions this machine (or another one you pick) can see and safely take over are listed.`}),(0,Y.jsx)(Z,{onDone:e})]})}function _t(){let[e,t]=(0,J.useState)(!1),n=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let r=`${c()}/share?text=`,i=async()=>{await ne(r)&&(t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500))};return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Send text or a link from another app straight into a new Bivy session draft.`}),(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`Android & desktop`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Install Bivy (Add to Home Screen / Install app) and it appears in the system share sheet automatically. Whatever you share is waiting in the composer as a new session draft.`})]}),(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`iPhone & iPad`}),(0,Y.jsx)(`p`,{className:`muted`,children:`iOS doesn't let web apps register in its share sheet, so add a one-time Shortcut that does the same job:`}),(0,Y.jsxs)(`ol`,{className:`eph-steps`,children:[(0,Y.jsxs)(`li`,{children:[`Open the `,(0,Y.jsx)(`strong`,{children:`Shortcuts`}),` app and tap `,(0,Y.jsx)(`strong`,{children:`+`}),` to create a new shortcut.`]}),(0,Y.jsxs)(`li`,{children:[`Add the `,(0,Y.jsx)(`strong`,{children:`URL Encode`}),` action — set its input to the `,(0,Y.jsx)(`em`,{children:`Shortcut Input`}),` variable.`]}),(0,Y.jsxs)(`li`,{children:[`Add the `,(0,Y.jsx)(`strong`,{children:`Open URLs`}),` action, paste the address below into its URL field, and place the `,(0,Y.jsx)(`em`,{children:`URL Encoded Text`}),` variable right after `,(0,Y.jsx)(`code`,{children:`text=`}),`.`]}),(0,Y.jsxs)(`li`,{children:[`Open the shortcut's settings (ⓘ), turn on `,(0,Y.jsx)(`strong`,{children:`Show in Share Sheet`}),`, and name it `,(0,Y.jsx)(`strong`,{children:`Send to Bivy`}),`.`]})]}),(0,Y.jsxs)(`div`,{className:`connect-command`,children:[(0,Y.jsx)(`code`,{tabIndex:0,"aria-label":`Share URL for the iOS Shortcut`,children:r}),(0,Y.jsx)(`button`,{type:`button`,className:`btn sm ghost icon-only${e?` is-copied`:``}`,onClick:()=>void i(),"aria-label":e?`Share URL copied`:`Copy share URL`,title:e?`Copied`:`Copy share URL`,children:e?(0,Y.jsx)(ie,{size:16}):(0,Y.jsx)(te,{size:16})})]}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Sharing opens Bivy in Safari with the shared text in the composer — sign in there once if Safari and the installed app don't share a session.`})]})]})}function vt({enabled:e}){return(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsxs)(`span`,{className:`settings-toggle-title`,children:[`Cloud machines `,(0,Y.jsx)(E,{tone:`warn`,children:`Experimental`})]}),(0,Y.jsx)(`span`,{className:`muted small`,children:`Show cloud machine profiles and automation routing. This feature is experimental and unstable; machines may fail to boot or require manual cleanup in your cloud provider account.`})]}),(0,Y.jsx)(W,{checked:e,onChange:w,label:`Enable experimental cloud machines`})]})}function yt(){let e=A();return(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(`section`,{className:`settings-section`,children:(0,Y.jsx)(vt,{enabled:e})})})}function bt(){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(0,J.useSyncExternalStore)(oe,H),f=()=>T.pushStatus().then(n).catch(()=>{});(0,J.useEffect)(()=>{f(),T.getNotificationPreferences().then(e=>{i(e),U(e)}).catch(()=>{})},[]),(0,J.useEffect)(()=>{if(!a&&!s)return;let e=setTimeout(()=>{o(null),c(null)},5e3);return()=>clearTimeout(e)},[a,s]);let p=!!t?.subscribed,m=async e=>{u(!0),o(null),c(null);try{o(e?await T.enablePush():await T.disablePush())}catch(e){c(String(e.message||e))}finally{u(!1),f()}},h=(e,t)=>{if(!r)return;let n={...r,[e]:t};i(n),T.setNotificationPreferences({[e]:t}).then(e=>{i(e),U(e)}).catch(e=>{i(r),c(String(e.message||e))})};return T.direct?(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(ae,{feature:`push`,inSettings:!0})}):t&&!t.supported?(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(`p`,{className:`muted`,children:`Push notifications aren't supported on this device or browser.`})}):(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:`Push notifications`}),(0,Y.jsx)(`p`,{className:`muted`,children:p?`This device receives Bivy push notifications.`:`Turn on to get notified about your sessions on this device.`})]}),(0,Y.jsx)(W,{checked:p,disabled:l,onChange:m,label:`Enable push notifications`})]}),(!e||typeof navigator.setAppBadge==`function`)&&(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:`App icon badge`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Show the number of sessions that need attention on this device's home screen icon.`})]}),(0,Y.jsx)(W,{checked:d,onChange:V,label:`Show app icon badge`})]}),t?.permission===`denied`&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`warn`,children:`Notifications are blocked in your device or browser settings — allow them there to enable push.`}),a&&(0,Y.jsx)(`div`,{className:`banner inline`,children:a}),s&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}),(0,Y.jsx)(`label`,{className:`field-label`,children:`What to notify me about`}),(0,Y.jsx)(`div`,{className:`settings-toggle-list`,"aria-disabled":!p,children:D.map(e=>(0,Y.jsxs)(`div`,{className:`settings-toggle-row${p?``:` disabled`}`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:e.label}),(0,Y.jsx)(`p`,{className:`muted`,children:e.description})]}),(0,Y.jsx)(W,{checked:!r||r[e.id],disabled:!p||!r,onChange:t=>h(e.id,t),label:e.label})]},e.id))}),(0,Y.jsx)(`p`,{className:`muted`,children:`These choices apply to every device signed in to your account.`})]})}var xt={providerId:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,hasSavedApiKey:!1,models:``,editing:!1},St=[{value:`openai-completions`,label:`OpenAI-compatible (Ollama, vLLM, LM Studio, …)`},{value:`azure-openai-responses`,label:`Azure OpenAI`},{value:`openai-responses`,label:`OpenAI Responses`},{value:`anthropic-messages`,label:`Anthropic Messages`}];function Ct(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`|`),r=(t??``).trim(),i=n.join(`|`).trim();return{id:r,...i?{name:i}:{}}}).filter(e=>e.id)}function wt(e){return{providerId:e.id,name:e.name??``,baseUrl:e.baseUrl,api:e.api||`openai-completions`,apiKey:``,hasSavedApiKey:e.hasKey,models:e.models.map(e=>e.name&&e.name!==e.id?`${e.id} | ${e.name}`:e.id).join(`
6
+ - Run the tests before saying you're done.`,"aria-describedby":`agent-instructions-size`,"aria-invalid":D||void 0,onChange:e=>{a(e.target.value),h(!1)}}),(0,Y.jsxs)(`p`,{id:`agent-instructions-size`,className:D?`settings-error`:`muted small`,children:[Ve(E),` of `,Ve(n.maxBytes),D?` — shorten the instructions to save them.`:``]}),(0,Y.jsxs)(`div`,{className:`row-actions`,children:[(0,Y.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:async()=>{if(!(u||D||!x||S)){d(!0),p(null),h(!1);try{await T.setNodeSettings({agentInstructions:i,agentInstructionsBaseUpdatedAt:o}),h(!0),window.setTimeout(()=>h(!1),1500)}catch(e){p(String(e?.message||e))}finally{d(!1)}}},disabled:u||D||!x||S,children:u?`Saving…`:m?`Saved`:`Save`}),x&&(0,Y.jsx)(`button`,{type:`button`,className:`btn`,onClick:w,disabled:u,children:`Revert`})]})]}),(0,Y.jsxs)(`details`,{className:`settings-section settings-disclosure`,children:[(0,Y.jsx)(`summary`,{className:`settings-disclosure-summary`,children:`How agents receive them`}),(0,Y.jsx)(`div`,{className:`settings-disclosure-body`,children:(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Claude Code, Codex, Pi and OpenCode get them as part of their system instructions. Other agents get them through Bivy's MCP server where it is available, which each agent may weigh differently. They're synced to your other machines end-to-end encrypted, and stored on each machine as `,(0,Y.jsx)(`code`,{children:`AGENTS.md`}),` in Bivy's data directory.`]})})]})]})}var Ue=(0,J.lazy)(()=>f(()=>import(`./VoiceSettings-BBN0TRwk.js`).then(e=>({default:e.VoiceSettings})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),We=[`github`,`linear`,`slack`,`queue`,`webhooks`,`rulesets`];function Ge(e){return e!==null&&We.includes(e)}function $({children:e}){return(0,Y.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:e})}var Ke=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,Y.jsx)(`path`,{d:`M12 3v18a9 9 0 0 0 0-18z`,fill:`currentColor`,stroke:`none`})]}),qe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`7.5`,cy:`15.5`,r:`4.5`}),(0,Y.jsx)(`path`,{d:`m11 12 8-8`}),(0,Y.jsx)(`path`,{d:`m16 5 3 3`}),(0,Y.jsx)(`path`,{d:`m13 8 3 3`})]}),Je=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),(0,Y.jsx)(`path`,{d:`M14 3v5h5`}),(0,Y.jsx)(`path`,{d:`M9 13h6M9 17h4`})]}),Ye=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`9`,y:`2`,width:`6`,height:`12`,rx:`3`}),(0,Y.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,Y.jsx)(`path`,{d:`M12 19v3`})]}),Xe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,Y.jsx)(`path`,{d:`M4 21a8 8 0 0 1 16 0`})]}),Ze=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`}),(0,Y.jsx)(`path`,{d:`M15 7h2a5 5 0 0 1 0 10h-2`}),(0,Y.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`})]}),Qe=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`}),(0,Y.jsx)(`path`,{d:`M8 21h8M12 17v4`})]}),$e=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`7`,rx:`2`}),(0,Y.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`7`,rx:`2`}),(0,Y.jsx)(`path`,{d:`M7 7.5h.01M7 16.5h.01`})]}),et=()=>(0,Y.jsx)($,{children:(0,Y.jsx)(`path`,{d:`M13 2 4 14h7l-1 8 9-12h-7l1-8z`})}),tt=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,Y.jsx)(`path`,{d:`M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4`})]}),nt=()=>(0,Y.jsx)($,{children:(0,Y.jsx)(`path`,{d:`M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z`})}),rt=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M18 8a6 6 0 0 0-12 0c0 7-3 9-3 9h18s-3-2-3-9`}),(0,Y.jsx)(`path`,{d:`M13.7 21a2 2 0 0 1-3.4 0`})]}),it=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M12 3v12`}),(0,Y.jsx)(`path`,{d:`m7 10 5 5 5-5`}),(0,Y.jsx)(`path`,{d:`M5 19h14`})]}),at=()=>(0,Y.jsxs)($,{children:[(0,Y.jsx)(`path`,{d:`M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7`}),(0,Y.jsx)(`path`,{d:`m8 6 4-4 4 4`}),(0,Y.jsx)(`path`,{d:`M12 2v13`})]});function ot(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function st(e){let[t,n]=(0,J.useState)(()=>typeof matchMedia==`function`&&matchMedia(e).matches);return(0,J.useEffect)(()=>{if(typeof matchMedia!=`function`)return;let t=matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ct(e){let[t,n]=(0,J.useState)(null);return(0,J.useEffect)(()=>{if(!e)return;let t=!0;return T.fetchMe().then(e=>{t&&n(e)}).catch(()=>{}),()=>{t=!1}},[e]),t}var lt={ok:null,near:`Almost used up`,reached:`Limit reached`};function ut({meter:e,action:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(null),o=lt[e.state];return(0,Y.jsxs)(`div`,{className:`settings-account-usage`,"data-state":e.state,children:[(0,Y.jsxs)(`div`,{className:`settings-account-usage-row`,children:[(0,Y.jsx)(`span`,{children:e.label}),(0,Y.jsxs)(`span`,{className:`settings-account-usage-count`,children:[e.used,` of `,e.limit]})]}),(0,Y.jsx)(`div`,{className:`meter`,role:`meter`,"aria-label":e.label,"aria-valuemin":0,"aria-valuemax":e.limit,"aria-valuenow":e.used,"aria-valuetext":`${e.used} of ${e.limit}${o?` — ${o.toLowerCase()}`:``}`,"data-state":e.state,children:(0,Y.jsx)(`span`,{className:`meter-fill`,style:{width:`${e.used/e.limit*100}%`}})}),o&&(0,Y.jsxs)(`span`,{className:`settings-account-usage-status`,children:[(0,Y.jsx)(`span`,{className:`settings-account-usage-note`,children:o}),e.freesNote&&(0,Y.jsx)(`span`,{children:e.freesNote})]}),t&&(0,Y.jsx)(`button`,{type:`button`,className:`btn primary block`,disabled:n,onClick:()=>{r(!0),a(null),T.invokeAccountExtensionAction(t.id).then(({url:e})=>d(e)).catch(e=>a(String(e?.message||e))).finally(()=>r(!1))},children:n?`Opening…`:t.label}),i&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,children:i})]})}function dt(e){return((e.split(`@`)[0]??``).replace(/[^a-z0-9]/gi,``)||e).slice(0,2).toUpperCase()}var ft={appearance:`Appearance`,notifications:`Notifications`,import:`Import session`,providers:`Models & keys`,models:`Models & keys`,instructions:`Agent instructions`,voice:`Voice`,share:`Share to Bivy`,github:`GitHub App`,linear:`Linear`,slack:`Slack`,queue:`Runs`,webhooks:`Webhooks`,rulesets:`Rulesets`,nodes:`Machines`,ephemeral:`Cloud machine profiles`,account:`Account`,link:`Link a device`},pt={appearance:`theme system light dark`,notifications:`push alerts attention approval permission idle completed`,import:`session transcript file upload migrate`,providers:`model provider api key oauth openai anthropic google login credentials custom endpoint local ollama import claude codex grok machine`,models:`model provider api key oauth ollama local custom endpoint`,instructions:`agents.md claude.md system prompt global instructions rules preferences memory`,voice:`microphone speech transcription read aloud reader text to speech voice tone speed`,share:`share sheet send android ios iphone ipad shortcut link url target`,github:`github app repository installation issue pull request`,linear:`linear workspace issue integration`,slack:`slack workspace channel integration`,queue:`work queue issue run evidence outcome retry lease checks`,webhooks:`webhook trigger secret event`,rulesets:`rules policy routing agent runtime model sandbox`,nodes:`node daemon online offline diagnostics version update storage disk cloud machines experimental unstable`,ephemeral:`cloud machine profiles automation offline teardown retention`,account:`account email devices machines usage`,link:`device qr code phone mobile pair`};function mt({state:e,onClose:t,view:n,onViewChange:r,onImported:i,onRedirectToAutomations:a}){let o=!T.direct,s=st(`(min-width: 721px)`),c=`appearance`,[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),h=n??(s?c:null);(0,J.useEffect)(()=>{s&&n===null&&r(c)},[s,n]),(0,J.useEffect)(()=>{Ge(n)&&a?.(n)},[n]);let g=M(t),_=(0,J.useRef)(g);_.current=t,re(()=>_.current()),(0,J.useEffect)(()=>{let e=document.activeElement;return()=>{e?.focus?.()}},[]);let v=A(),b=y&&v,x=[{label:`Models & keys`,items:[{id:`providers`,label:`Providers & credentials`,icon:(0,Y.jsx)(qe,{})}]},{label:`Agents`,items:[{id:`instructions`,label:`Agent instructions`,icon:(0,Y.jsx)(Je,{})}]},{label:`Machines`,items:[{id:`nodes`,label:`Machines`,icon:(0,Y.jsx)($e,{})},...b?[{id:`ephemeral`,label:`Cloud machine profiles`,icon:(0,Y.jsx)(et,{})}]:[],...o?[{id:`link`,label:`Link a device`,icon:(0,Y.jsx)(Ze,{})}]:[]]},{label:`App`,items:[{id:`appearance`,label:`Appearance`,icon:(0,Y.jsx)(Ke,{})},{id:`notifications`,label:`Notifications`,icon:(0,Y.jsx)(rt,{})},{id:`voice`,label:`Voice`,icon:(0,Y.jsx)(Ye,{})},{id:`import`,label:`Import session`,icon:(0,Y.jsx)(it,{})},{id:`share`,label:`Share to Bivy`,icon:(0,Y.jsx)(at,{})}]}],S=ct(o),C=S?.account?.email??null,w=Ee(S?.extension),E={id:`account`,label:C??`Account`,icon:(0,Y.jsx)(Xe,{})},D=l.trim().toLowerCase(),O=e=>!D||`${e.label} ${ft[e.id]} ${pt[e.id]}`.toLowerCase().includes(D),k=o&&O(E),j=k||x.some(e=>e.items.some(O)),te=e=>`settings-nav-item${h===e||e===`providers`&&h===`models`?` active`:``}`,ne=h?ft[h]:`Settings`;return(0,ve.createPortal)((0,Y.jsxs)(`div`,{className:`settings-modal`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[d&&(0,Y.jsx)(ee,{title:`Sign out?`,message:`Sign out of Bivy on this device?`,confirmLabel:`Sign out`,danger:!0,onCancel:()=>f(!1),onConfirm:()=>{f(!1),T.signOut().catch(e=>T.store.setError(String(e?.message||e)))}}),(0,Y.jsx)(`div`,{className:`settings-scrim`,onClick:g}),(0,Y.jsxs)(`div`,{className:`settings-panel`,"data-mode":h?`panel`:`menu`,children:[(0,Y.jsxs)(`aside`,{className:`settings-nav`,children:[(0,Y.jsxs)(`div`,{className:`settings-nav-top`,children:[(0,Y.jsx)(`span`,{className:`settings-nav-heading`,children:`Settings`}),(0,Y.jsx)(`button`,{className:`settings-x`,onClick:g,"aria-label":`Close settings`,children:(0,Y.jsx)(P,{})})]}),(0,Y.jsxs)(`div`,{className:`settings-search-wrap`,children:[(0,Y.jsxs)(`svg`,{className:`settings-search-icon`,viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,Y.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,Y.jsx)(`path`,{d:`m21 21-4.3-4.3`})]}),(0,Y.jsx)(`input`,{className:`field settings-search`,type:`search`,placeholder:`Search`,value:l,onChange:e=>u(e.target.value)})]}),(0,Y.jsxs)(`nav`,{className:`settings-nav-groups`,children:[!j&&(0,Y.jsxs)(`div`,{className:`picker-empty`,children:[`No settings match "`,l.trim(),`"`]}),k&&(0,Y.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Y.jsxs)(`button`,{className:te(`account`),title:C??void 0,onClick:()=>r(`account`),children:[(0,Y.jsx)(`span`,{className:`settings-account-avatar`,"aria-hidden":!0,children:C?dt(C):E.icon}),(0,Y.jsxs)(`span`,{className:`settings-account-text`,children:[(0,Y.jsx)(`span`,{className:`settings-nav-label`,children:E.label}),(0,Y.jsx)(`span`,{className:`settings-account-sub`,children:w.summary??`Account`})]}),(0,Y.jsx)(`span`,{className:`settings-nav-chevron`,children:(0,Y.jsx)(N,{size:18})})]}),w.meter&&(0,Y.jsx)(ut,{meter:w.meter,action:w.action})]}),x.map(e=>{let t=e.items.filter(O);return t.length===0?null:(0,Y.jsxs)(`div`,{className:`settings-nav-group`,children:[(0,Y.jsx)(`div`,{className:`settings-nav-group-label`,children:e.label}),t.map(e=>(0,Y.jsxs)(`button`,{className:te(e.id),onClick:()=>{e.id===`providers`&&m(null),r(e.id)},children:[(0,Y.jsx)(`span`,{className:`settings-nav-icon`,children:e.icon}),(0,Y.jsx)(`span`,{className:`settings-nav-label`,children:e.label}),(0,Y.jsx)(`span`,{className:`settings-nav-chevron`,children:(0,Y.jsx)(N,{size:18})})]},e.id))]},e.label)})]}),o&&(0,Y.jsx)(`button`,{className:`btn block`,onClick:()=>f(!0),children:`Sign out`}),(0,Y.jsxs)(`div`,{className:`settings-nav-version`,title:`The version of the Bivy app running on this device`,children:[(0,Y.jsxs)(`span`,{children:[`Bivy v`,`0.20.4`]}),ot(`2026-10-01T09:16:22.158Z`)&&(0,Y.jsxs)(`span`,{className:`settings-nav-version-updated`,children:[`Updated `,ot(`2026-10-01T09:16:22.158Z`)]})]})]}),(0,Y.jsxs)(`section`,{className:`settings-content`,children:[(0,Y.jsxs)(`header`,{className:`settings-head`,children:[h&&(0,Y.jsxs)(`button`,{className:`settings-back`,onClick:()=>r(null),"aria-label":`Back to settings`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`‹`}),` Settings`]}),(0,Y.jsx)(`h2`,{className:`settings-head-title`,children:ne}),(0,Y.jsx)(`button`,{className:`settings-x settings-x-content`,onClick:g,"aria-label":`Close settings`,children:(0,Y.jsx)(P,{})})]}),(0,Y.jsxs)(`div`,{className:`settings-body`,children:[h===`appearance`&&(0,Y.jsx)(ht,{}),h===`notifications`&&(0,Y.jsx)(bt,{}),h===`import`&&(0,Y.jsx)(gt,{onImported:e=>i?.(e)}),h===`share`&&(0,Y.jsx)(_t,{}),h===`providers`&&(0,Y.jsx)(ze,{state:e,initialProvider:p}),h===`models`&&(0,Y.jsx)(Et,{state:e,onStartWork:t}),h===`instructions`&&(0,Y.jsx)(He,{state:e}),h===`voice`&&(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`muted`,children:`Loading voice settings…`}),children:(0,Y.jsx)(Ue,{state:e,onManageKey:e=>{m(e),r(`providers`)}})}),h===`nodes`&&(0,Y.jsx)(Dt,{state:e,cloudMachinesEnabled:b}),h===`ephemeral`&&y&&(b?(0,Y.jsx)(jt,{}):(0,Y.jsx)(yt,{})),h===`account`&&(0,Y.jsx)(Ft,{}),h===`link`&&(0,Y.jsx)(Lt,{onDone:t})]},h??`menu`)]})]})]}),document.body)}function ht(){let[e,t]=(0,J.useState)(u()),[n,r]=(0,J.useState)(l());(0,J.useEffect)(()=>s(()=>r(l())),[]);let i=[...n?[{id:`machine`,label:`Machine`,icon:(0,Y.jsx)(Ke,{})}]:[],{id:`system`,label:`System`,icon:(0,Y.jsx)(Qe,{})},{id:`light`,label:`Light`,icon:(0,Y.jsx)(tt,{})},{id:`dark`,label:`Dark`,icon:(0,Y.jsx)(nt,{})}];return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`label`,{className:`field-label`,children:`Theme`}),(0,Y.jsx)(we,{ariaLabel:`Theme`,value:e===`machine`&&!n?`system`:e,options:i,onChange:e=>{p(e),t(e)}}),(0,Y.jsxs)(`p`,{className:`muted`,children:[`Choose how Bivy looks. `,(0,Y.jsx)(`strong`,{children:`System`}),` follows your device's light/dark setting.`,n&&(0,Y.jsxs)(Y.Fragment,{children:[` `,(0,Y.jsx)(`strong`,{children:`Machine`}),` matches this machine's desktop theme, now `,n.name,`, and changes with it.`]})]})]})}function gt({onImported:e}){return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Adopt a Claude Code or Codex session that was started outside Bivy. Only sessions this machine (or another one you pick) can see and safely take over are listed.`}),(0,Y.jsx)(Z,{onDone:e})]})}function _t(){let[e,t]=(0,J.useState)(!1),n=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let r=`${c()}/share?text=`,i=async()=>{await ne(r)&&(t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500))};return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`p`,{className:`muted`,children:`Send text or a link from another app straight into a new Bivy session draft.`}),(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`Android & desktop`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Install Bivy (Add to Home Screen / Install app) and it appears in the system share sheet automatically. Whatever you share is waiting in the composer as a new session draft.`})]}),(0,Y.jsxs)(`section`,{className:`settings-section`,children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`iPhone & iPad`}),(0,Y.jsx)(`p`,{className:`muted`,children:`iOS doesn't let web apps register in its share sheet, so add a one-time Shortcut that does the same job:`}),(0,Y.jsxs)(`ol`,{className:`eph-steps`,children:[(0,Y.jsxs)(`li`,{children:[`Open the `,(0,Y.jsx)(`strong`,{children:`Shortcuts`}),` app and tap `,(0,Y.jsx)(`strong`,{children:`+`}),` to create a new shortcut.`]}),(0,Y.jsxs)(`li`,{children:[`Add the `,(0,Y.jsx)(`strong`,{children:`URL Encode`}),` action — set its input to the `,(0,Y.jsx)(`em`,{children:`Shortcut Input`}),` variable.`]}),(0,Y.jsxs)(`li`,{children:[`Add the `,(0,Y.jsx)(`strong`,{children:`Open URLs`}),` action, paste the address below into its URL field, and place the `,(0,Y.jsx)(`em`,{children:`URL Encoded Text`}),` variable right after `,(0,Y.jsx)(`code`,{children:`text=`}),`.`]}),(0,Y.jsxs)(`li`,{children:[`Open the shortcut's settings (ⓘ), turn on `,(0,Y.jsx)(`strong`,{children:`Show in Share Sheet`}),`, and name it `,(0,Y.jsx)(`strong`,{children:`Send to Bivy`}),`.`]})]}),(0,Y.jsxs)(`div`,{className:`connect-command`,children:[(0,Y.jsx)(`code`,{tabIndex:0,"aria-label":`Share URL for the iOS Shortcut`,children:r}),(0,Y.jsx)(`button`,{type:`button`,className:`btn sm ghost icon-only${e?` is-copied`:``}`,onClick:()=>void i(),"aria-label":e?`Share URL copied`:`Copy share URL`,title:e?`Copied`:`Copy share URL`,children:e?(0,Y.jsx)(ie,{size:16}):(0,Y.jsx)(te,{size:16})})]}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Sharing opens Bivy in Safari with the shared text in the composer — sign in there once if Safari and the installed app don't share a session.`})]})]})}function vt({enabled:e}){return(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsxs)(`span`,{className:`settings-toggle-title`,children:[`Cloud machines `,(0,Y.jsx)(E,{tone:`warn`,children:`Experimental`})]}),(0,Y.jsx)(`span`,{className:`muted small`,children:`Show cloud machine profiles and automation routing. This feature is experimental and unstable; machines may fail to boot or require manual cleanup in your cloud provider account.`})]}),(0,Y.jsx)(W,{checked:e,onChange:w,label:`Enable experimental cloud machines`})]})}function yt(){let e=A();return(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(`section`,{className:`settings-section`,children:(0,Y.jsx)(vt,{enabled:e})})})}function bt(){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(0,J.useSyncExternalStore)(oe,H),f=()=>T.pushStatus().then(n).catch(()=>{});(0,J.useEffect)(()=>{f(),T.getNotificationPreferences().then(e=>{i(e),U(e)}).catch(()=>{})},[]),(0,J.useEffect)(()=>{if(!a&&!s)return;let e=setTimeout(()=>{o(null),c(null)},5e3);return()=>clearTimeout(e)},[a,s]);let p=!!t?.subscribed,m=async e=>{u(!0),o(null),c(null);try{o(e?await T.enablePush():await T.disablePush())}catch(e){c(String(e.message||e))}finally{u(!1),f()}},h=(e,t)=>{if(!r)return;let n={...r,[e]:t};i(n),T.setNotificationPreferences({[e]:t}).then(e=>{i(e),U(e)}).catch(e=>{i(r),c(String(e.message||e))})};return T.direct?(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(ae,{feature:`push`,inSettings:!0})}):t&&!t.supported?(0,Y.jsx)(`div`,{className:`settings-form`,children:(0,Y.jsx)(`p`,{className:`muted`,children:`Push notifications aren't supported on this device or browser.`})}):(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:`Push notifications`}),(0,Y.jsx)(`p`,{className:`muted`,children:p?`This device receives Bivy push notifications.`:`Turn on to get notified about your sessions on this device.`})]}),(0,Y.jsx)(W,{checked:p,disabled:l,onChange:m,label:`Enable push notifications`})]}),(!e||typeof navigator.setAppBadge==`function`)&&(0,Y.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:`App icon badge`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Show the number of sessions that need attention on this device's home screen icon.`})]}),(0,Y.jsx)(W,{checked:d,onChange:V,label:`Show app icon badge`})]}),t?.permission===`denied`&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`warn`,children:`Notifications are blocked in your device or browser settings — allow them there to enable push.`}),a&&(0,Y.jsx)(`div`,{className:`banner inline`,children:a}),s&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,role:`alert`,children:s}),(0,Y.jsx)(`label`,{className:`field-label`,children:`What to notify me about`}),(0,Y.jsx)(`div`,{className:`settings-toggle-list`,"aria-disabled":!p,children:D.map(e=>(0,Y.jsxs)(`div`,{className:`settings-toggle-row${p?``:` disabled`}`,children:[(0,Y.jsxs)(`div`,{className:`settings-toggle-text`,children:[(0,Y.jsx)(`span`,{className:`settings-toggle-title`,children:e.label}),(0,Y.jsx)(`p`,{className:`muted`,children:e.description})]}),(0,Y.jsx)(W,{checked:!r||r[e.id],disabled:!p||!r,onChange:t=>h(e.id,t),label:e.label})]},e.id))}),(0,Y.jsx)(`p`,{className:`muted`,children:`These choices apply to every device signed in to your account.`})]})}var xt={providerId:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,hasSavedApiKey:!1,models:``,editing:!1},St=[{value:`openai-completions`,label:`OpenAI-compatible (Ollama, vLLM, LM Studio, …)`},{value:`azure-openai-responses`,label:`Azure OpenAI`},{value:`openai-responses`,label:`OpenAI Responses`},{value:`anthropic-messages`,label:`Anthropic Messages`}];function Ct(e){return e.split(/[\n,]/).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`|`),r=(t??``).trim(),i=n.join(`|`).trim();return{id:r,...i?{name:i}:{}}}).filter(e=>e.id)}function wt(e){return{providerId:e.id,name:e.name??``,baseUrl:e.baseUrl,api:e.api||`openai-completions`,apiKey:``,hasSavedApiKey:e.hasKey,models:e.models.map(e=>e.name&&e.name!==e.id?`${e.id} | ${e.name}`:e.id).join(`
7
7
  `),editing:!0}}function Tt(e){return{providerId:e.id,name:e.name,baseUrl:e.baseUrl,api:e.api||`openai-completions`,apiKey:``,hasSavedApiKey:!1,models:``,editing:!1}}function Et({state:e,onStartWork:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(null);(0,J.useEffect)(()=>{T.listLocalModels(),T.listLocalModelPresets()},[]);let b=e=>r(t=>({...t??xt,...e})),x=e=>{s(null),l(null),r(e)},S=(e,n)=>{T.newSession(),T.chooseModel({id:n.id,label:n.name||n.id,provider:e}),t()};if(n){let e=n.baseUrl.trim().length>0&&!i,t=St.some(e=>e.value===n.api),u=n.api.toLowerCase().startsWith(`azure`),d=async(e=!1)=>{a(!0),s(null);try{let t=await T.saveLocalModel({providerId:(n.providerId||n.name||`local`).trim(),name:n.name.trim()||void 0,baseUrl:n.baseUrl.trim(),api:n.api.trim()||`openai-completions`,...n.apiKey.trim()?{apiKey:n.apiKey.trim()}:{},models:Ct(n.models)});T.listLocalModels();let i=Ct(n.models);e&&i[0]&&S(t,i[0]),r(null)}catch(e){s(String(e?.message||e))}finally{a(!1)}};return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[(0,Y.jsx)(`button`,{className:`btn link`,onClick:()=>x(null),children:`‹ All endpoints`}),(0,Y.jsx)(`h3`,{children:n.editing?n.name||n.providerId:`Add endpoint`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Verify an OpenAI-compatible server, then import the models it actually reports. Ollama, LM Studio, vLLM, SGLang, and custom endpoints are supported.`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`A localhost endpoint is bound to this connected Machine and will not appear as usable on another Machine. An explicitly entered network endpoint can be shared only where that URL is really reachable.`}),(0,Y.jsx)(`label`,{className:`field-label`,children:`Display name`}),(0,Y.jsx)(`input`,{className:`picker-search`,value:n.name,placeholder:`My local models`,onChange:e=>b({name:e.target.value})}),(0,Y.jsx)(`label`,{className:`field-label`,children:`Identifier`}),(0,Y.jsx)(`input`,{className:`picker-search`,value:n.providerId,placeholder:`ollama`,disabled:n.editing,onChange:e=>b({providerId:e.target.value})}),(0,Y.jsx)(`label`,{className:`field-label`,children:`Base URL`}),(0,Y.jsx)(`input`,{className:`picker-search`,value:n.baseUrl,placeholder:u?`https://YOUR-RESOURCE.openai.azure.com`:`http://localhost:11434/v1`,onChange:e=>b({baseUrl:e.target.value})}),/localhost|127\.0\.0\.1/i.test(n.baseUrl)&&(0,Y.jsxs)(`p`,{className:`muted small`,children:[`⚠ This points at the current machine. Once synced, other machines will only reach it if they also run a server at `,(0,Y.jsx)(`code`,{children:n.baseUrl.match(/localhost|127\.0\.0\.1/i)?.[0]??`localhost`}),` `,`themselves.`]}),(0,Y.jsx)(`label`,{className:`field-label`,children:`API type`}),(0,Y.jsxs)(`select`,{className:`picker-search`,value:t?n.api:`__custom__`,onChange:e=>b({api:e.target.value===`__custom__`?``:e.target.value}),children:[St.map(e=>(0,Y.jsx)(`option`,{value:e.value,children:e.label},e.value)),(0,Y.jsx)(`option`,{value:`__custom__`,children:`Custom…`})]}),!t&&(0,Y.jsx)(`input`,{className:`picker-search`,value:n.api,placeholder:`custom-api-id`,onChange:e=>b({api:e.target.value})}),(0,Y.jsxs)(`label`,{className:`field-label`,children:[`API key `,n.editing?`(leave blank to keep)`:u?`(Azure API key)`:`(optional)`]}),(0,Y.jsx)(`input`,{className:`picker-search`,type:`password`,value:n.apiKey,placeholder:n.hasSavedApiKey?`•••••••• (saved — leave blank to keep)`:u?`Azure OpenAI key`:`local`,onChange:e=>b({apiKey:e.target.value})}),n.hasSavedApiKey&&!n.apiKey&&(0,Y.jsx)(`p`,{className:`muted small`,children:`An API key is saved. Leave this blank to keep it, or enter a new key to replace it.`}),(0,Y.jsx)(`div`,{className:`row-actions`,children:(0,Y.jsx)(`button`,{className:`btn`,disabled:!n.baseUrl.trim()||i,onClick:async()=>{a(!0),s(null),l(null);try{let e=await T.verifyLocalModel(n.baseUrl.trim(),n.apiKey.trim()||void 0);if(l(e),e.status===`ready`){let t=[...Ct(n.models),...e.models].filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t);b({models:t.map(e=>e.name&&e.name!==e.id?`${e.id} | ${e.name}`:e.id).join(`
8
8
  `)})}}catch(e){s(String(e?.message||e))}finally{a(!1)}},children:i?`Verifying…`:`Verify endpoint & list models`})}),c&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":c.status===`ready`?`ok`:`danger`,children:c.status===`ready`?`Verified on ${c.machineName}: ${c.models.length} model${c.models.length===1?``:`s`} available.`:`${c.status.replace(`_`,` `)}: ${c.detail||`No compatible catalog was returned.`}`}),(0,Y.jsxs)(`label`,{className:`field-label`,children:[`Models — one per line (`,(0,Y.jsx)(`code`,{children:`id`}),` or `,(0,Y.jsx)(`code`,{children:`id | Name`}),`)`]}),(0,Y.jsx)(`textarea`,{className:`picker-search`,rows:4,value:n.models,placeholder:u?`my-gpt-4o-deployment | GPT-4o`:`llama3.1
9
9
  qwen2.5-coder | Qwen 2.5 Coder`,onChange:e=>b({models:e.target.value})}),u&&(0,Y.jsxs)(`p`,{className:`muted`,children:[`Azure routes by `,(0,Y.jsx)(`em`,{children:`deployment`}),`: set each model’s id to your deployment name. The key is sent as the`,(0,Y.jsx)(`code`,{children:` api-key`}),` header and `,(0,Y.jsx)(`code`,{children:`api-version`}),` is handled automatically.`]}),(0,Y.jsxs)(`div`,{className:`row-actions`,children:[(0,Y.jsx)(`button`,{className:`btn primary`,disabled:!e,onClick:()=>void d(!1),children:i?`Saving…`:n.editing?`Save changes`:`Import models`}),Ct(n.models).length>0&&(0,Y.jsx)(`button`,{className:`btn`,disabled:!e,onClick:()=>void d(!0),children:`Import & use in new session`}),(0,Y.jsx)(`button`,{className:`btn`,onClick:()=>x(null),children:`Cancel`})]}),o&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,children:o})]})}return(0,Y.jsxs)(`div`,{className:`settings-form`,children:[v&&(0,Y.jsx)(ee,{title:v.title,message:v.message,confirmLabel:`Remove`,danger:!0,onCancel:()=>y(null),onConfirm:()=>{v.action(),y(null)}}),(0,Y.jsx)(`h3`,{children:`Model endpoints`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Connect OpenAI-compatible servers (Ollama, LM Studio, vLLM, SGLang, Azure…) and import the models they report. Localhost endpoints stay tied to the Machine that hosts them.`}),e.settings.localModels.length===0?(0,Y.jsxs)(`div`,{className:`vault-empty`,children:[(0,Y.jsx)(`h4`,{children:`No endpoints yet`}),(0,Y.jsx)(`p`,{className:`muted`,children:`Add an OpenAI-compatible server, or discover one running on this Machine below.`}),(0,Y.jsx)(`button`,{className:`btn primary`,onClick:()=>x({...xt}),children:`Add endpoint`})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`picker-list vault-items`,children:e.settings.localModels.map(e=>(0,Y.jsx)(I,{title:e.name||e.id,meta:`${e.baseUrl} · ${e.modelCount} model${e.modelCount===1?``:`s`}${e.hasKey?` · key`:``} · ${e.scope===`machine`?`hosted by ${e.machineName||`one Machine`}`:`network endpoint`}${e.availableOnThisMachine?``:` · unavailable on this Machine`}`,right:(0,Y.jsxs)(`div`,{className:`row-actions`,children:[e.availableOnThisMachine&&e.models[0]&&(0,Y.jsx)(`button`,{className:`btn sm`,onClick:t=>{t.stopPropagation(),S(e.id,e.models[0])},children:`Use`}),(0,Y.jsx)(`button`,{className:`btn danger-ghost sm`,onClick:t=>{t.stopPropagation(),y({title:`Remove endpoint?`,message:`Remove ${e.name||e.id}? This also removes its models.`,action:()=>{T.removeLocalModel(e.id),setTimeout(()=>T.listLocalModels(),400)}})},children:`Remove`})]}),onClick:()=>x(wt(e))},e.id))}),(0,Y.jsx)(`button`,{className:`btn primary block`,onClick:()=>x({...xt}),children:`+ Add endpoint`})]}),(0,Y.jsxs)(`div`,{className:`settings-section`,children:[(0,Y.jsx)(`h4`,{className:`settings-subhead`,children:`Find models on this Machine`}),(0,Y.jsx)(`p`,{className:`muted small`,children:`Discover checks a short, fixed list of common localhost ports on the connected Machine only — it never scans your LAN. Localhost models stay tied to the Machine that hosts them.`}),(0,Y.jsx)(`button`,{className:`btn block`,disabled:f,onClick:async()=>{p(!0),h(null);try{let e=await T.discoverLocalModels();d(e.endpoints),_(e.machineName)}catch(e){h(String(e?.message||e))}finally{p(!1)}},children:f?`Discovering on this Machine…`:`Discover on this Machine`}),g&&(0,Y.jsxs)(`p`,{className:`muted small`,children:[`Results from `,(0,Y.jsx)(`strong`,{children:g}),`. They do not describe other Machines.`]}),m&&(0,Y.jsx)(`div`,{className:`banner inline`,"data-tone":`danger`,children:m}),u&&(0,Y.jsx)(`div`,{className:`picker-list`,children:u.map(e=>(0,Y.jsx)(I,{title:e.name||e.baseUrl,meta:e.status===`ready`?`${e.models.length} model${e.models.length===1?``:`s`} available on ${e.machineName}`:`${e.status.replace(`_`,` `)} · ${e.detail||`No compatible response`}`,right:e.status===`ready`?(0,Y.jsx)(E,{tone:`ok`,children:`Import`}):e.status===`auth_required`?(0,Y.jsx)(E,{tone:`warn`,children:`Add key`}):(0,Y.jsx)(E,{tone:`warn`,children:e.status.replace(`_`,` `)}),onClick:e.status===`ready`||e.status===`auth_required`?()=>x({...Tt({id:e.candidateId||`local`,name:e.name||`Local models`,baseUrl:e.baseUrl,api:e.api}),models:e.models.map(e=>e.name===e.id?e.id:`${e.id} | ${e.name}`).join(`
@@ -1,2 +1,2 @@
1
- import{t as e}from"./rolldown-runtime-hePW80VL.js";import{Nt as t,O as n}from"./useStore-BvVbjZ1v.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";var i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),a=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=a(),s=t(),c=[],l=!1;function u(){l||typeof window>`u`||(l=!0,window.addEventListener(`keydown`,e=>{if(e.key!==`Escape`)return;let t=c[c.length-1];t&&(e.stopPropagation(),e.preventDefault(),t.handler())},!0))}function d(e){u();let t={handler:e};return c.push(t),()=>{let e=c.lastIndexOf(t);e>=0&&c.splice(e,1)}}function f(e,t=!0){let n=(0,s.useRef)(e);n.current=e,(0,s.useEffect)(()=>{if(t)return d(()=>n.current())},[t])}function p(e){let t=(0,s.useRef)(e);t.current=e;let r=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(typeof window>`u`)return;let e=n(()=>t.current());return r.current=e,()=>{e.dispose(),r.current=null}},[]),()=>r.current?.close()}var m=r(),h={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};function g({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 6 12 12M18 6 6 18`})})}function _({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}function v({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}function y({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 15 6-6 6 6`})})}function b({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function x({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M5 12h14`})})}function S({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,m.jsx)(`path`,{d:`m7 9 3 3-3 3M13 15h4`})]})}function C({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,m.jsx)(`path`,{d:`m21 21-4.3-4.3`})]})}function w({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`8`,y:`3`,width:`8`,height:`4`,rx:`1`}),(0,m.jsx)(`path`,{d:`M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2`})]})}function T({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,m.jsx)(`path`,{d:`M5 15V5a2 2 0 0 1 2-2h10`})]})}function E({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-4 3v-3H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z`}),(0,m.jsx)(`path`,{d:`M8 9.5h8M8 13h5`})]})}function D({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`})]})}function O({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}function k({size:e=18,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m5 12 4 4L19 6`})})}function A({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]})}function j({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,m.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function M({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1`}),(0,m.jsx)(`path`,{d:`M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1`})]})}function N({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M5 6h14M5 10h14M5 14h9M5 18h6`})})}function P({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6.4`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.5`}),(0,m.jsx)(`path`,{d:`M12 4v1.6M12 18.4V20M4 12h1.6M18.4 12H20M6.3 6.3l1.2 1.2M16.5 16.5l1.2 1.2M17.7 6.3l-1.2 1.2M7.5 16.5l-1.2 1.2`})]})}function F({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.34-5.66L20 8.5`}),(0,m.jsx)(`path`,{d:`M20 4v4.5h-4.5`})]})}var I=`a[href],button:not(:disabled),textarea:not(:disabled),input:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])`,L=[],R=new WeakMap;function z(e,t){(0,s.useEffect)(()=>{let n=e.current?.closest(`[aria-modal="true"]`)??e.current;if(!n)return;let r=document.activeElement;L.push(n);let i=[];for(let e=n;e.parentElement;e=e.parentElement){for(let t of e.parentElement.children){if(!(t instanceof HTMLElement)||t===e||/^(SCRIPT|STYLE|LINK)$/.test(t.tagName))continue;let n=R.get(t)??{count:0,inert:t.inert};n.count++,R.set(t,n),t.inert=!0,i.push(t)}if(e.parentElement===document.body)break}let a=()=>Array.from(n.querySelectorAll(I)).filter(e=>!e.closest(`[inert]`)&&e.getClientRects().length>0);(t?.current??a()[0]??n).focus();let o=e=>{if(e.key!==`Tab`||L.at(-1)!==n)return;let t=a(),r=t[0],i=t.at(-1);if(!r||!i){e.preventDefault(),n.focus();return}!n.contains(document.activeElement)||!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())};return window.addEventListener(`keydown`,o),()=>{window.removeEventListener(`keydown`,o),L.splice(L.indexOf(n),1);for(let e of i){let t=R.get(e);--t.count===0&&(e.inert=t.inert,R.delete(e))}r?.isConnected&&!r.closest(`[inert]`)&&r.focus()}},[e,t])}function B({title:e,message:t,confirmLabel:n=`Confirm`,danger:r,onConfirm:i,onCancel:a}){let c=p(a);f(c);let l=(0,s.useRef)(null),u=(0,s.useRef)(null);z(u,l);let d=(0,s.useId)();return(0,o.createPortal)((0,m.jsxs)(`div`,{className:`app-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,children:[(0,m.jsx)(`div`,{className:`app-dialog-backdrop`,onClick:c}),(0,m.jsxs)(`div`,{className:`app-dialog-body`,ref:u,children:[(0,m.jsx)(`h3`,{id:d,children:e}),(0,m.jsx)(`p`,{children:t}),(0,m.jsxs)(`div`,{className:`app-dialog-actions`,children:[(0,m.jsx)(`button`,{ref:l,className:`btn`,onClick:c,children:`Cancel`}),(0,m.jsx)(`button`,{className:r?`btn danger`:`btn primary`,onClick:()=>{c(),i()},children:n})]})]})]}),document.body)}function V({title:e=`Rename`,initialValue:t,onSave:n,onCancel:r}){let[i,a]=(0,s.useState)(t),c=(0,s.useRef)(null),l=(0,s.useRef)(null),u=p(r);f(u),z(l,c),(0,s.useEffect)(()=>{c.current?.select()},[]);let d=(0,s.useId)();return(0,o.createPortal)((0,m.jsxs)(`div`,{className:`app-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,children:[(0,m.jsx)(`div`,{className:`app-dialog-backdrop`,onClick:u}),(0,m.jsxs)(`form`,{ref:l,className:`app-dialog-body`,onSubmit:e=>{e.preventDefault();let r=i.trim();r&&r!==t?(u(),n(r)):u()},children:[(0,m.jsx)(`h3`,{id:d,children:e}),(0,m.jsx)(`input`,{ref:c,className:`picker-search`,value:i,onChange:e=>a(e.target.value)}),(0,m.jsxs)(`div`,{className:`app-dialog-actions`,children:[(0,m.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,m.jsx)(`button`,{className:`btn primary`,type:`submit`,disabled:!i.trim(),children:`Save`})]})]})]}),document.body)}function H(e){return[`Bivy session reference`,`URL: ${e.url}`,`Session ID: ${e.sessionId}`,e.node?`Machine: ${e.node}`:``,e.agent?`Agent: ${e.agent}`:``,e.worktree?`Worktree: ${e.worktree}`:``,e.workspace?`Workspace: ${e.workspace}`:``,e.branch?`Branch: ${e.branch}`:``,e.sessionFile?`Session file: ${e.sessionFile}`:``].filter(Boolean).join(`
1
+ import{t as e}from"./rolldown-runtime-hePW80VL.js";import{Nt as t,O as n}from"./useStore-IOxPOH3e.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";var i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),a=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=a(),s=t(),c=[],l=!1;function u(){l||typeof window>`u`||(l=!0,window.addEventListener(`keydown`,e=>{if(e.key!==`Escape`)return;let t=c[c.length-1];t&&(e.stopPropagation(),e.preventDefault(),t.handler())},!0))}function d(e){u();let t={handler:e};return c.push(t),()=>{let e=c.lastIndexOf(t);e>=0&&c.splice(e,1)}}function f(e,t=!0){let n=(0,s.useRef)(e);n.current=e,(0,s.useEffect)(()=>{if(t)return d(()=>n.current())},[t])}function p(e){let t=(0,s.useRef)(e);t.current=e;let r=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(typeof window>`u`)return;let e=n(()=>t.current());return r.current=e,()=>{e.dispose(),r.current=null}},[]),()=>r.current?.close()}var m=r(),h={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0};function g({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 6 12 12M18 6 6 18`})})}function _({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m9 18 6-6-6-6`})})}function v({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m15 18-6-6 6-6`})})}function y({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 15 6-6 6 6`})})}function b({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m6 9 6 6 6-6`})})}function x({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M5 12h14`})})}function S({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,m.jsx)(`path`,{d:`m7 9 3 3-3 3M13 15h4`})]})}function C({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,m.jsx)(`path`,{d:`m21 21-4.3-4.3`})]})}function w({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`8`,y:`3`,width:`8`,height:`4`,rx:`1`}),(0,m.jsx)(`path`,{d:`M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2`})]})}function T({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,m.jsx)(`path`,{d:`M5 15V5a2 2 0 0 1 2-2h10`})]})}function E({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M4 5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9l-4 3v-3H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z`}),(0,m.jsx)(`path`,{d:`M8 9.5h8M8 13h5`})]})}function D({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`})]})}function O({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M12 5v14M5 12h14`})})}function k({size:e=18,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`m5 12 4 4L19 6`})})}function A({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,m.jsx)(`path`,{d:`M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18`})]})}function j({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`12`,rx:`2`}),(0,m.jsx)(`path`,{d:`M8 20h8M12 16v4`})]})}function M({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1`}),(0,m.jsx)(`path`,{d:`M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1`})]})}function N({size:e=20,...t}){return(0,m.jsx)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:(0,m.jsx)(`path`,{d:`M5 6h14M5 10h14M5 14h9M5 18h6`})})}function P({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6.4`}),(0,m.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.5`}),(0,m.jsx)(`path`,{d:`M12 4v1.6M12 18.4V20M4 12h1.6M18.4 12H20M6.3 6.3l1.2 1.2M16.5 16.5l1.2 1.2M17.7 6.3l-1.2 1.2M7.5 16.5l-1.2 1.2`})]})}function F({size:e=20,...t}){return(0,m.jsxs)(`svg`,{...h,...t,viewBox:`0 0 24 24`,width:e,height:e,children:[(0,m.jsx)(`path`,{d:`M20 12a8 8 0 1 1-2.34-5.66L20 8.5`}),(0,m.jsx)(`path`,{d:`M20 4v4.5h-4.5`})]})}var I=`a[href],button:not(:disabled),textarea:not(:disabled),input:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])`,L=[],R=new WeakMap;function z(e,t){(0,s.useEffect)(()=>{let n=e.current?.closest(`[aria-modal="true"]`)??e.current;if(!n)return;let r=document.activeElement;L.push(n);let i=[];for(let e=n;e.parentElement;e=e.parentElement){for(let t of e.parentElement.children){if(!(t instanceof HTMLElement)||t===e||/^(SCRIPT|STYLE|LINK)$/.test(t.tagName))continue;let n=R.get(t)??{count:0,inert:t.inert};n.count++,R.set(t,n),t.inert=!0,i.push(t)}if(e.parentElement===document.body)break}let a=()=>Array.from(n.querySelectorAll(I)).filter(e=>!e.closest(`[inert]`)&&e.getClientRects().length>0);(t?.current??a()[0]??n).focus();let o=e=>{if(e.key!==`Tab`||L.at(-1)!==n)return;let t=a(),r=t[0],i=t.at(-1);if(!r||!i){e.preventDefault(),n.focus();return}!n.contains(document.activeElement)||!e.shiftKey&&document.activeElement===i?(e.preventDefault(),r.focus()):e.shiftKey&&document.activeElement===r&&(e.preventDefault(),i.focus())};return window.addEventListener(`keydown`,o),()=>{window.removeEventListener(`keydown`,o),L.splice(L.indexOf(n),1);for(let e of i){let t=R.get(e);--t.count===0&&(e.inert=t.inert,R.delete(e))}r?.isConnected&&!r.closest(`[inert]`)&&r.focus()}},[e,t])}function B({title:e,message:t,confirmLabel:n=`Confirm`,danger:r,onConfirm:i,onCancel:a}){let c=p(a);f(c);let l=(0,s.useRef)(null),u=(0,s.useRef)(null);z(u,l);let d=(0,s.useId)();return(0,o.createPortal)((0,m.jsxs)(`div`,{className:`app-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,children:[(0,m.jsx)(`div`,{className:`app-dialog-backdrop`,onClick:c}),(0,m.jsxs)(`div`,{className:`app-dialog-body`,ref:u,children:[(0,m.jsx)(`h3`,{id:d,children:e}),(0,m.jsx)(`p`,{children:t}),(0,m.jsxs)(`div`,{className:`app-dialog-actions`,children:[(0,m.jsx)(`button`,{ref:l,className:`btn`,onClick:c,children:`Cancel`}),(0,m.jsx)(`button`,{className:r?`btn danger`:`btn primary`,onClick:()=>{c(),i()},children:n})]})]})]}),document.body)}function V({title:e=`Rename`,initialValue:t,onSave:n,onCancel:r}){let[i,a]=(0,s.useState)(t),c=(0,s.useRef)(null),l=(0,s.useRef)(null),u=p(r);f(u),z(l,c),(0,s.useEffect)(()=>{c.current?.select()},[]);let d=(0,s.useId)();return(0,o.createPortal)((0,m.jsxs)(`div`,{className:`app-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":d,children:[(0,m.jsx)(`div`,{className:`app-dialog-backdrop`,onClick:u}),(0,m.jsxs)(`form`,{ref:l,className:`app-dialog-body`,onSubmit:e=>{e.preventDefault();let r=i.trim();r&&r!==t?(u(),n(r)):u()},children:[(0,m.jsx)(`h3`,{id:d,children:e}),(0,m.jsx)(`input`,{ref:c,className:`picker-search`,value:i,onChange:e=>a(e.target.value)}),(0,m.jsxs)(`div`,{className:`app-dialog-actions`,children:[(0,m.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,m.jsx)(`button`,{className:`btn primary`,type:`submit`,disabled:!i.trim(),children:`Save`})]})]})]}),document.body)}function H(e){return[`Bivy session reference`,`URL: ${e.url}`,`Session ID: ${e.sessionId}`,e.node?`Machine: ${e.node}`:``,e.agent?`Agent: ${e.agent}`:``,e.worktree?`Worktree: ${e.worktree}`:``,e.workspace?`Workspace: ${e.workspace}`:``,e.branch?`Branch: ${e.branch}`:``,e.sessionFile?`Session file: ${e.sessionFile}`:``].filter(Boolean).join(`
2
2
  `)}async function U(e){if(!e)return!1;if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function W({title:e,onClose:t,children:n,headExtra:r,autoFocusSearch:i=!0,variant:a=`default`,size:c=`content`,ariaLabel:l}){let u=(0,s.useId)(),d=(0,s.useRef)(null),h=(0,s.useRef)(null),_=(0,s.useRef)(null),v=(0,s.useRef)(null),y=(0,s.useRef)(0),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(0),w=()=>{h.current||=(x(!0),y.current=0,C(0),setTimeout(()=>{t(),_.current?.(),_.current=null},200))};(0,s.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]);let T=e=>{b||(v.current=e.clientY,e.currentTarget.setPointerCapture(e.pointerId))},E=e=>{if(v.current==null||b)return;let t=Math.max(0,Math.min(e.clientY-v.current,320));y.current=t,C(t)},D=()=>{if(v.current==null)return;let e=y.current>96;v.current=null,y.current=0,e?O():C(0)},O=p(w),k=e=>{_.current=e??null,O()};f(O);let A=(0,s.useRef)(null);return(0,s.useEffect)(()=>{A.current=i?d.current?.querySelector(`input, textarea`)??null:d.current},[i]),z(d,A),(0,o.createPortal)((0,m.jsxs)(`div`,{className:`sheet${b?` is-closing`:``}`,"data-variant":a,"data-size":c,role:`dialog`,"aria-modal":`true`,"aria-label":l,"aria-labelledby":l?void 0:u,children:[(0,m.jsx)(`div`,{className:`sheet-backdrop`,onClick:O,style:S>0?{opacity:Math.max(.25,1-S/320)}:void 0}),(0,m.jsxs)(`div`,{className:`sheet-body${b?` is-closing`:``}`,ref:d,tabIndex:-1,style:S>0?{transform:`translateY(${S}px)`}:void 0,children:[(0,m.jsx)(`div`,{className:`sheet-grabber`,"aria-hidden":`true`,onPointerDown:T,onPointerMove:E,onPointerUp:D,onPointerCancel:D}),(0,m.jsxs)(`div`,{className:`sheet-head`,onPointerDown:e=>{e.target.closest(`button, a, input, textarea, select`)||T(e)},onPointerMove:E,onPointerUp:D,onPointerCancel:D,children:[(0,m.jsx)(`span`,{id:u,className:`sheet-title`,children:e}),r,(0,m.jsx)(`button`,{className:`sheet-close`,onClick:O,"aria-label":`Close`,children:(0,m.jsx)(g,{})})]}),(0,m.jsx)(`div`,{className:`sheet-content`,children:typeof n==`function`?n(k):n})]})]}),document.body)}function G({active:e,title:t,meta:n,right:r,onClick:i,disabled:a,layout:o=`default`}){return(0,m.jsxs)(`div`,{className:`picker-item-row${e?` active`:``}${o===`actions`?` with-actions`:``}`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`picker-item`,onClick:i,disabled:a,children:[(0,m.jsx)(`span`,{className:`picker-check`,children:e?(0,m.jsx)(k,{size:15}):null}),(0,m.jsxs)(`span`,{className:`picker-main`,children:[(0,m.jsx)(`span`,{className:`picker-name`,children:t}),n!=null&&(0,m.jsx)(`span`,{className:`picker-meta`,children:n})]})]}),r!=null&&(0,m.jsx)(`span`,{className:`picker-item-extra`,children:r})]})}export{a as A,D as C,S as D,C as E,p as O,x as S,F as T,j as _,B as a,M as b,E as c,v as d,_ as f,T as g,g as h,U as i,f as k,k as l,w as m,W as n,V as o,y as p,H as r,z as s,G as t,b as u,P as v,O as w,N as x,A as y};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-hePW80VL.js";import{Nt as t,i as n,t as r}from"./useStore-BvVbjZ1v.js";import{A as i,D as a,E as o,S as s,c,d as l,f as u,h as d,i as f,k as p,m,n as h,o as g,p as _,u as v,w as y}from"./Sheet-D3E-yLpV.js";import{d as ee,l as te,u as ne}from"./ChangesCard-CZDQXY3_.js";import{t as re}from"./jsx-runtime-NZYk81nU.js";import{n as b,r as x}from"./mount-BpiVD2yE.js";var S=t(),C=i(),w=Object.defineProperty,T=Object.getOwnPropertyDescriptor,ie=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},E=(e,t,n,r)=>{for(var i=r>1?void 0:r?T(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&w(t,n,i),i},D=(e,t)=>(n,r)=>t(n,r,e),O=`Terminal input`,k={get:()=>O,set:e=>O=e},A=`Too much output to announce, navigate to rows manually to read`,ae={get:()=>A,set:e=>A=e};function oe(e){return e.replace(/\r?\n/g,`\r`)}function j(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function M(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function N(e,t,n,r){e.stopPropagation(),e.clipboardData&&se(e.clipboardData.getData(`text/plain`),t,n,r)}function se(e,t,n,r){e=oe(e),e=j(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ce(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){ce(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function P(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ue(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var de=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},pe=``,me=` `,he=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ge}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ge=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_e=class e extends he{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ge,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?P(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ve=`di$target`,ye=`di$dependencies`,be=new Map;function xe(e){return e[ye]||[]}function F(e){if(be.has(e))return be.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Se(t,e,r)};return t._id=e,be.set(e,t),t}function Se(e,t,n){t[ve]===t?t[ye].push({id:e,index:n}):(t[ye]=[{id:e,index:n}],t[ve]=t)}var I=F(`BufferService`),Ce=F(`CoreMouseService`),we=F(`CoreService`),Te=F(`CharsetService`),Ee=F(`InstantiationService`),De=F(`LogService`),Oe=F(`OptionsService`),ke=F(`OscLinkService`),Ae=F(`UnicodeService`),je=F(`DecorationService`),Me=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new _e,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ne(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Me=E([D(0,I),D(1,Oe),D(2,ke)],Me);function Ne(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{t as e}from"./rolldown-runtime-hePW80VL.js";import{Nt as t,i as n,t as r}from"./useStore-IOxPOH3e.js";import{A as i,D as a,E as o,S as s,c,d as l,f as u,h as d,i as f,k as p,m,n as h,o as g,p as _,u as v,w as y}from"./Sheet-BcTCzY9r.js";import{d as ee,l as te,u as ne}from"./ChangesCard-ChUvrnBi.js";import{t as re}from"./jsx-runtime-NZYk81nU.js";import{n as b,r as x}from"./mount-DDNxGSlT.js";var S=t(),C=i(),w=Object.defineProperty,T=Object.getOwnPropertyDescriptor,ie=(e,t)=>{for(var n in t)w(e,n,{get:t[n],enumerable:!0})},E=(e,t,n,r)=>{for(var i=r>1?void 0:r?T(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&w(t,n,i),i},D=(e,t)=>(n,r)=>t(n,r,e),O=`Terminal input`,k={get:()=>O,set:e=>O=e},A=`Too much output to announce, navigate to rows manually to read`,ae={get:()=>A,set:e=>A=e};function oe(e){return e.replace(/\r?\n/g,`\r`)}function j(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function M(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function N(e,t,n,r){e.stopPropagation(),e.clipboardData&&se(e.clipboardData.getData(`text/plain`),t,n,r)}function se(e,t,n,r){e=oe(e),e=j(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ce(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function le(e,t,n,r,i){ce(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function P(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function ue(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var de=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},fe=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},pe=``,me=` `,he=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ge}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ge=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_e=class e extends he{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ge,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?P(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ve=`di$target`,ye=`di$dependencies`,be=new Map;function xe(e){return e[ye]||[]}function F(e){if(be.has(e))return be.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Se(t,e,r)};return t._id=e,be.set(e,t),t}function Se(e,t,n){t[ve]===t?t[ye].push({id:e,index:n}):(t[ye]=[{id:e,index:n}],t[ve]=t)}var I=F(`BufferService`),Ce=F(`CoreMouseService`),we=F(`CoreService`),Te=F(`CharsetService`),Ee=F(`InstantiationService`),De=F(`LogService`),Oe=F(`OptionsService`),ke=F(`OscLinkService`),Ae=F(`UnicodeService`),je=F(`DecorationService`),Me=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new _e,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ne(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Me=E([D(0,I),D(1,Oe),D(2,ke)],Me);function Ne(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Pe=F(`CharSizeService`),Fe=F(`CoreBrowserService`),Ie=F(`MouseService`),Le=F(`RenderService`),Re=F(`SelectionService`),ze=F(`CharacterJoinerService`),Be=F(`ThemeService`),Ve=F(`LinkProviderService`),He=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Je.isErrorNoTelemetry(e)?new Je(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{Nt as e,i as t,n}from"./useStore-BvVbjZ1v.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{g as i,h as a,m as o,p as s}from"./mount-BpiVD2yE.js";var c=e(),l=r();function u({state:e,onManageKey:r}){let[u,d]=(0,c.useState)(()=>a()),[f,p]=(0,c.useState)([]);(0,c.useEffect)(()=>{t.getSttConfig()},[]),(0,c.useEffect)(()=>{if(!(`speechSynthesis`in window))return;let e=()=>p(window.speechSynthesis.getVoices());return e(),window.speechSynthesis.addEventListener(`voiceschanged`,e),()=>window.speechSynthesis.removeEventListener(`voiceschanged`,e)},[]);let m=e=>{let t={...u,...e};d(t),i(t)},h=e.settings.sttConfig,g=h?.providers??[],_=g.some(e=>e.id===`openai`&&e.configured);return(0,l.jsxs)(`div`,{className:`settings-form`,children:[(0,l.jsxs)(`section`,{className:`settings-section`,children:[(0,l.jsx)(`h3`,{children:`Voice input`}),(0,l.jsx)(`p`,{className:`muted settings-intro`,children:`Dictate with the composer mic. Whisper converts speech to text using a Groq or OpenAI key. Add or manage each provider's key below. With no key, supported browsers use built-in dictation.`}),(0,l.jsx)(`label`,{className:`field-label`,children:`Preferred transcription provider`}),(0,l.jsxs)(`div`,{className:`seg-row`,children:[g.map(e=>(0,l.jsx)(`button`,{type:`button`,className:`selectable`,"aria-pressed":h?.provider===e.id,onClick:()=>t.setSttProvider(e.id),children:e.label},e.id)),g.length===0&&(0,l.jsx)(`span`,{className:`muted`,children:`Loading…`})]}),g.map(e=>(0,l.jsxs)(`div`,{className:`voice-provider`,children:[(0,l.jsxs)(`div`,{className:`voice-provider-head`,children:[(0,l.jsx)(`span`,{className:`field-label`,children:e.label}),e.configured?(0,l.jsx)(n,{tone:`ok`,children:`Available`}):(0,l.jsx)(n,{children:`No account key`})]}),(0,l.jsxs)(`div`,{className:`muted small`,children:[e.model,` ·`,` `,(0,l.jsxs)(`button`,{type:`button`,className:`btn link voice-key-link`,onClick:()=>r(e.id),children:[e.configured?`Manage`:`Add`,` `,e.label,` key`]})]})]},e.id))]}),(0,l.jsxs)(`section`,{className:`settings-section`,children:[(0,l.jsx)(`h3`,{children:`Read aloud`}),(0,l.jsx)(`p`,{className:`muted settings-intro`,children:`Choose the reader used by the speaker button on assistant replies. OpenAI speech is higher quality; browser speech is free and stays on this device.`}),(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`speech-reader`,children:`Reader`}),(0,l.jsxs)(`select`,{id:`speech-reader`,className:`picker-search`,value:u.reader,onChange:e=>m({reader:e.target.value}),children:[(0,l.jsx)(`option`,{value:`browser`,children:`Browser voice (free, on-device)`}),(0,l.jsxs)(`option`,{value:`openai`,disabled:!_,children:[`OpenAI neural voice`,_?``:` — add OpenAI key`]})]}),u.reader===`browser`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`browser-reader-voice`,children:`Voice`}),(0,l.jsxs)(`select`,{id:`browser-reader-voice`,className:`picker-search`,value:u.browserVoice,onChange:e=>m({browserVoice:e.target.value}),children:[(0,l.jsx)(`option`,{value:``,children:`System default`}),f.map(e=>(0,l.jsxs)(`option`,{value:e.voiceURI,children:[e.name,` (`,e.lang,`)`]},e.voiceURI))]}),(0,l.jsxs)(`label`,{className:`field-label`,htmlFor:`reader-speed`,children:[`Speed · `,u.rate.toFixed(1),`×`]}),(0,l.jsx)(`input`,{id:`reader-speed`,type:`range`,min:`0.7`,max:`1.5`,step:`0.1`,value:u.rate,onChange:e=>m({rate:Number(e.target.value)})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`openai-reader-voice`,children:`Voice`}),(0,l.jsx)(`select`,{id:`openai-reader-voice`,className:`picker-search`,value:u.openaiVoice,onChange:e=>m({openaiVoice:e.target.value}),children:s.map(e=>(0,l.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`reader-tone`,children:`Tone`}),(0,l.jsx)(`select`,{id:`reader-tone`,className:`picker-search`,value:u.tone,onChange:e=>m({tone:e.target.value}),children:o.map(e=>(0,l.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,l.jsx)(`div`,{className:`muted small`,children:`Uses gpt-4o-mini-tts and your existing OpenAI API key. Audio text is sent to OpenAI and may incur usage charges.`})]})]})]})}export{u as VoiceSettings};
1
+ import{Nt as e,i as t,n}from"./useStore-IOxPOH3e.js";import{t as r}from"./jsx-runtime-NZYk81nU.js";import{g as i,h as a,m as o,p as s}from"./mount-DDNxGSlT.js";var c=e(),l=r();function u({state:e,onManageKey:r}){let[u,d]=(0,c.useState)(()=>a()),[f,p]=(0,c.useState)([]);(0,c.useEffect)(()=>{t.getSttConfig()},[]),(0,c.useEffect)(()=>{if(!(`speechSynthesis`in window))return;let e=()=>p(window.speechSynthesis.getVoices());return e(),window.speechSynthesis.addEventListener(`voiceschanged`,e),()=>window.speechSynthesis.removeEventListener(`voiceschanged`,e)},[]);let m=e=>{let t={...u,...e};d(t),i(t)},h=e.settings.sttConfig,g=h?.providers??[],_=g.some(e=>e.id===`openai`&&e.configured);return(0,l.jsxs)(`div`,{className:`settings-form`,children:[(0,l.jsxs)(`section`,{className:`settings-section`,children:[(0,l.jsx)(`h3`,{children:`Voice input`}),(0,l.jsx)(`p`,{className:`muted settings-intro`,children:`Dictate with the composer mic. Whisper converts speech to text using a Groq or OpenAI key. Add or manage each provider's key below. With no key, supported browsers use built-in dictation.`}),(0,l.jsx)(`label`,{className:`field-label`,children:`Preferred transcription provider`}),(0,l.jsxs)(`div`,{className:`seg-row`,children:[g.map(e=>(0,l.jsx)(`button`,{type:`button`,className:`selectable`,"aria-pressed":h?.provider===e.id,onClick:()=>t.setSttProvider(e.id),children:e.label},e.id)),g.length===0&&(0,l.jsx)(`span`,{className:`muted`,children:`Loading…`})]}),g.map(e=>(0,l.jsxs)(`div`,{className:`voice-provider`,children:[(0,l.jsxs)(`div`,{className:`voice-provider-head`,children:[(0,l.jsx)(`span`,{className:`field-label`,children:e.label}),e.configured?(0,l.jsx)(n,{tone:`ok`,children:`Available`}):(0,l.jsx)(n,{children:`No account key`})]}),(0,l.jsxs)(`div`,{className:`muted small`,children:[e.model,` ·`,` `,(0,l.jsxs)(`button`,{type:`button`,className:`btn link voice-key-link`,onClick:()=>r(e.id),children:[e.configured?`Manage`:`Add`,` `,e.label,` key`]})]})]},e.id))]}),(0,l.jsxs)(`section`,{className:`settings-section`,children:[(0,l.jsx)(`h3`,{children:`Read aloud`}),(0,l.jsx)(`p`,{className:`muted settings-intro`,children:`Choose the reader used by the speaker button on assistant replies. OpenAI speech is higher quality; browser speech is free and stays on this device.`}),(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`speech-reader`,children:`Reader`}),(0,l.jsxs)(`select`,{id:`speech-reader`,className:`picker-search`,value:u.reader,onChange:e=>m({reader:e.target.value}),children:[(0,l.jsx)(`option`,{value:`browser`,children:`Browser voice (free, on-device)`}),(0,l.jsxs)(`option`,{value:`openai`,disabled:!_,children:[`OpenAI neural voice`,_?``:` — add OpenAI key`]})]}),u.reader===`browser`?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`browser-reader-voice`,children:`Voice`}),(0,l.jsxs)(`select`,{id:`browser-reader-voice`,className:`picker-search`,value:u.browserVoice,onChange:e=>m({browserVoice:e.target.value}),children:[(0,l.jsx)(`option`,{value:``,children:`System default`}),f.map(e=>(0,l.jsxs)(`option`,{value:e.voiceURI,children:[e.name,` (`,e.lang,`)`]},e.voiceURI))]}),(0,l.jsxs)(`label`,{className:`field-label`,htmlFor:`reader-speed`,children:[`Speed · `,u.rate.toFixed(1),`×`]}),(0,l.jsx)(`input`,{id:`reader-speed`,type:`range`,min:`0.7`,max:`1.5`,step:`0.1`,value:u.rate,onChange:e=>m({rate:Number(e.target.value)})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`openai-reader-voice`,children:`Voice`}),(0,l.jsx)(`select`,{id:`openai-reader-voice`,className:`picker-search`,value:u.openaiVoice,onChange:e=>m({openaiVoice:e.target.value}),children:s.map(e=>(0,l.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,l.jsx)(`label`,{className:`field-label`,htmlFor:`reader-tone`,children:`Tone`}),(0,l.jsx)(`select`,{id:`reader-tone`,className:`picker-search`,value:u.tone,onChange:e=>m({tone:e.target.value}),children:o.map(e=>(0,l.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,l.jsx)(`div`,{className:`muted small`,children:`Uses gpt-4o-mini-tts and your existing OpenAI API key. Audio text is sent to OpenAI and may incur usage charges.`})]})]})]})}export{u as VoiceSettings};
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-CpQYZmiE.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-B6xuSHsQ.js";import"./chunk-DU6HZSFF-gkVFtNv3.js";import{n as i,r as a,t as o}from"./chunk-SVP7TREG-NxzQDJme.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-BmN60RVS.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{m as e,t}from"./mermaid-parser.core-BtiNyzFG.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-B6xuSHsQ.js";import"./chunk-DU6HZSFF-DEWchgqz.js";import{n as i,r as a,t as o}from"./chunk-SVP7TREG-C4KhIsre.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-_waZYNe5.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
@@ -0,0 +1 @@
1
+ import"./chunk-FOHPRMQF-DzxwRta7.js";import{M as e}from"./mermaid-parser.core-BtiNyzFG.js";export{e as createArchitectureServices};