1import{Ln as e,M as t,Nn as n,_t as r}from"./DNGt8a1j.js";import{C as i,O as a,T as o,d as s}from"./CtVQs1uU.js";var c=e(null);function l(){function e(e){return c.value=e,()=>{c.value===e&&(c.value=null)}}return{main:n(c),register:e}}function u(e){return e.kind===`chat`}function d(e,t){return i(null,t,e)}function f(){let e=s(),n=t(()=>e.entries.value.filter(u));function c(t){let n=e.get(t);return n&&u(n)?n:null}function f(e){return n.value.find(t=>t.target.kind===`conversation`&&t.target.id===e)??null}function p(t,n={}){if(t.kind===`conversation`){let r=f(t.id);if(r&&r.id!==n.in)return n.in&&e.remove(n.in),e.focus(r.id),r.id}return n.in&&c(n.in)?(e.replace(n.in,{kind:`chat`,target:t}),e.focus(n.in),n.in):e.add({kind:`chat`,target:t})}function m(t){e.focus(t)}function h(t){e.remove(t)}function g(){e.removeKind(`chat`)}function _(t){return e.titles.value[t]??null}function v(t,n){e.setTitle(t,n)}function y(){return(e.shownId.value?c(e.shownId.value):null)??n.value.at(-1)??null}async function b(e){let t=l().main.value;if(!t)return;let n=e?c(e):y(),s=n?.target??null,u=t.conversationId(),f=t.groupId(),m=t.runId(),h;h=m?{kind:`run`,runId:m}:u&&f?{kind:`conversation`,id:u,groupId:f}:u?{kind:`conversation`,id:u}:{kind:`draft`,projectId:null};let g=p(h,n?{in:n.id}:{});await r();
1let _=s?.kind===`draft`?d(g,s.projectId):null,v=i(null,s?.kind===`draft`?s.projectId:null);h.kind===`draft`&&_?a(_,v):h.kind===`draft`?o(i(null,null),d(g,null)):_&&o(_,v),await S(t,s)}async function x(e){let t=l().main.value;if(!t)return;let n=c(e);n&&(h(e),await r(),n.target.kind===`draft`&&o(d(e,n.target.projectId),i(null,n.target.projectId)),await S(t,n.target))}async function S(e,t){t?.kind===`conversation`?await e.navigate({to:`conversation`,id:t.id,...t.groupId?{groupId:t.groupId}:{}}):t?.kind===`run`?await e.navigate({to:`run`,runId:t.runId}):t?.kind===`draft`?await e.navigate(t.projectId?{to:`new-chat`,projectId:t.projectId}:{to:`new-chat`}):await e.navigate({to:`new-chat`})}return{chats:n,viewing:e.viewing,get:c,holding:f,open:p,focus:m,close:h,closeAll:g,title:_,setTitle:v,swapWithMain:b,openInMain:x}}export{l as n,f as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.