import{p as i}from"./useEvent-WUlsM6MC.js";import{On as o,kn as h,ui as l}from"./cells-CCtxWKxf.js";import{d as m}from"./once-DRC4SgqY.js";import{t as d}from"./createLucideIcon-BvP5LBIs.js";var p=d("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),f="marimo:ai:chatState:v5";const v=i(null),u=l("marimo:ai:includeOtherCells",!0,h);function C(a){let t=new Map;for(let[s,e]of a.entries()){if(e.messages.length===0)continue;let c=m(e.messages,n=>n.id);t.set(s,{...e,messages:c})}return t}const r=l(f,{chats:new Map,activeChatId:null},o({toSerializable:a=>({chats:[...C(a.chats).entries()],activeChatId:a.activeChatId}),fromSerializable:a=>({chats:new Map(a.chats),activeChatId:a.activeChatId})})),I=i(a=>{let t=a(r);return t.activeChatId?t.chats.get(t.activeChatId):null},(a,t,s)=>{t(r,e=>({...e,activeChatId:s}))});export{p as a,u as i,v as n,r,I as t};
