1import{r as d,e as g,bF as B,bG as A,j as r,q as l,a7 as p,n as c,P as C,Q as I,ap as P,F as R,p as v,l as U,y as b,t as x,u as F,z as L,ae as N}from"./vue.Pa8PNnh_.js";import{l as T}from"./inertia.Bp-rNqZe.js";import V from"./ChatActionsMenu.DQAU04Jt.js";import K from"./PinIcon.D341yE-G.js";import"./vendor.BAgskFVL.js";import"./realtime.Cz-gfRDS.js";import"./axios.BaK2N65j.js";import"./_plugin-vue_export-helper.DlAUqK2U.js";const _={class:"group relative"},j=["for"],q=["id","onKeydown"],z={class:"min-w-0 flex-1 truncate"},E={key:0,class:"absolute right-1 top-1/2 -translate-y-1/2 opacity-0 transition group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100"},Y={__name:"SessionItem",props:{chat:{type:Object,required:!0},isActive:{type:Boolean,default:!1},routePrefix:{type:String,default:"ai-chat"},manageable:{type:Boolean,default:!1}},emits:["rename","toggle-pin","delete","navigate"],setup(e,{emit:y}){const n=e,u=y,o=d(!1),s=d(""),m=d(null),w=g(()=>[{key:"pin",label:n.chat.pinned_at?"Unpin":"Pin",icon:K},{key:"rename",label:"Rename",icon:B},{key:"delete",label:"Delete",icon:A,danger:!0}]),k=g(()=>{const t=n.chat.last_message_at||n.chat.created_at;if(!t)return"";const a=new Date(t),i=new Date;if(a.toDateString()===i.toDateString())return a.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0});const f=new Date(i);return f.setDate(i.getDate()-6),f.setHours(0,0,0,0),a>=f?a.toLocaleDateString("en-US",{weekday:"short"}):a.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function D(t){t==="pin"&&u("toggle-pin",n.chat),t==="delete"&&u("delete",n.chat),t==="rename"&&S()}function S(){s.value=n.chat.title||"",o.value=!0,N(()=>{m.value?.focus(),m.value?.select()})}function h(){if(!o.value)return;const t=s.value.trim();o.value=!1,t!==""&&t!==n.chat.title&&u("rename",n.chat,t)}function $(){o.value=!1}return(t,a)=>(r(),l("li",_,[o.value?(r(),l("form",{key:0,class:"px-1 py-0.5",onSubmit:p(h,["prevent"])},[c("label",{for:`rename-chat-${e.chat.id}`,class:"sr-only"},"Chat name",8,j),C(c("input",{id:`rename-chat-${e.chat.id}`,ref_key:"renameInput",ref:m,"onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),type:"text",maxlength:"100",class:"block h-[34px] w-full rounded-md border-action px-2 text-[13px] text-ink focus:border-action focus:ring-action",onKeydown:P(p($,["prevent"]),["esc"]),onBlur:h},null,40,q),[[I,s.value]])],32)):(r(),l(R,{key:1},[v(F(T),{href:`/${e.routePrefix}/${e.chat.id}`,class:x(["flex h-[34px] items-center gap-2 rounded-md px-2 text-[13px] leading-[18px] text-ink transition hover:bg-canvas focus:outline-none focus-visible:ring-2 focus-visible:ring-action",[e.isActive?"bg-surface font-semibold shadow-[inset_0_0_0_1px_#DCE2FA] hover:bg-surface":"",e.manageable?"pr-9":""]]),"aria-current":e.isActive?"page":void 0,onClick:a[1]||(a[1]=i=>t.$emit("navigate"))},{default:U(()=>[c("span",z,b(e.chat.title||"New chat"),1),c("span",{class:x(["shrink-0 text-xs font-normal text-[#6B7280]",{"group-hover:invisible group-focus-within:invisible":e.manageable}])},b(k.value),3)]),_:1},8,["href","class","aria-current"]),e.manageable?(r(),l("div",E,[v(V,{items:w.value,label:`Actions for ${e.chat.title||"chat"}`,"trigger-class":"h-7 w-7",onSelect:D},null,8,["items","label"])])):L("",!0)],64))]))}};export{Y as default};
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.