import{j as t}from"./ui-vendor-oFzHwyuF.js";import{u as c,a as m}from"./main-Bfm0Ar4t.js";import{r as d}from"./react-vendor-BJie2xkO.js";import{d as f}from"./api-DAXyRoTB.js";function v({title:e,showBack:s,onBack:r,action:i}){const a=c(o=>o.eventName);return t.jsx("header",{className:"sticky top-0 z-30 bg-primary text-white px-4 pt-safe-top",children:t.jsxs("div",{className:"flex items-center h-14 gap-3",children:[s&&t.jsx("button",{onClick:r,className:"p-2 -ml-2 rounded-full hover:bg-white/10 active:bg-white/20 transition-colors","aria-label":"Go back",children:t.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:2.5,viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h1",{className:"font-semibold text-base leading-tight truncate",children:e}),a&&t.jsx("p",{className:"text-xs text-blue-200 truncate",children:a})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[i,t.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:navigator.onLine?t.jsxs("span",{className:"flex items-center gap-1 text-emerald-300",children:[t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400"}),"Online"]}):t.jsxs("span",{className:"flex items-center gap-1 text-red-300",children:[t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-400"}),"Offline"]})})]})]})})}function h(){const[e,s]=d.useState(!1),{setGuests:r,markLoaded:i}=c(),a=m(n=>n.showToast);return{refresh:async n=>{if(!e){s(!0);try{const{guests:u,total:l}=await f();r(u),i(l),a("success",`${l} guests refreshed.`),n==null||n()}catch{a("error","Refresh failed. Check your connection.")}finally{s(!1)}}},refreshing:e}}function N({onDone:e}){const{refresh:s,refreshing:r}=h();return t.jsx("button",{onClick:()=>s(e),disabled:r,className:"p-1.5 rounded-full hover:bg-white/10 active:bg-white/20 transition-colors disabled:opacity-60","aria-label":"Refresh guest list",children:t.jsx("svg",{className:`w-4 h-4 transition-transform ${r?"animate-spin":""}`,fill:"none",stroke:"currentColor",strokeWidth:2.5,viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})}function x(e){return e?new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}):"—"}function p(e){return e?new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}function k(e){return e?`${p(e)} ${x(e)}`:"—"}function L(e){return e.split(" ").filter(Boolean).slice(0,2).map(s=>s[0].toUpperCase()).join("")}function y(e){switch(e){case"SINGLE":return"Single";case"DOUBLE":return"Double";case"GROUP":return"Group";default:return e}}export{N as R,v as T,x as a,y as c,k as f,L as i,h as u};
