1import{r as n,X as ae,k as y,j as e,g as m,U as re,C as _,f as v,I as le,m as i,M as ne,n as ie,S as oe,B as ce,a2 as de}from"./index-IxvR3ybE.js";import{d as me,a as xe}from"./index-PqXJKzHr.js";import{A as he,a as pe,b as ue}from"./avatar-BaQ7HthH.js";import{T as I,a as B,b as x}from"./tabs-_QLeAqis.js";import{S as fe,i as ge}from"./ScheduleItemModal-BjsOuHkf.js";import{u as je}from"./useAdminSpeakers-DJa83alm.js";import{X as be}from"./XLogo-CDpl-AjT.js";import{i as M,b as P,c as we,p as Ne,a as $,f as ye,d as _e}from"./timezone-pZ1uXfyL.js";import{C as k}from"./clock-DaRv8o2j.js";import{S as ve}from"./search-DJbhdKSj.js";import{T as ke}from"./tag-DM1wd7fF.js";import{E as Te}from"./external-link-DjtQGYET.js";import{L as Ce}from"./linkedin--K-iqxqh.js";import{f as O}from"./format-DUXQdFez.js";import"./constructNow-BxmPnzq9.js";import"./en-US-CujKlCMr.js";import"./isSameDay-BaVzxeLX.js";import"./subDays-B53mm5KN.js";import"./index-Cm6HJhbV.js";import"./queryCache-BtqcWBRl.js";import"./startOfWeek-CKe6unVT.js";const Se=()=>{const[h,U]=n.useState(""),[p,z]=n.useState("all"),[w,F]=n.useState("all"),[f,g]=n.useState([]),[T,V]=n.useState([]),[X,C]=n.useState(null),[q,S]=n.useState(!1),[H,j]=n.useState(!0),{selectedEventId:o,selectedEvent:Y}=ae(),{speakers:c,isLoading:G,error:b}=je();n.useEffect(()=>{const t=async()=>{if(!o){g([]),j(!1);return}try{j(!0);const{data:s,error:a}=await y.from("schedule_items").select("*").eq("event_id",o).order("start_time",{ascending:!0});a?(console.error("Error fetching schedule items:",a),g([])):g(s||[])}catch(s){console.error("Error fetching schedule items:",s),g([])}finally{j(!1)}};if(o?t():j(!1),o){const s=y.channel("admin-schedule-changes").on("postgres_changes",{event:"*",schema:"public",table:"schedule_items",filter:`event_id=eq.${o}`},()=>{t()}).subscribe();return()=>{y.removeChannel(s)}}},[o]),n.useEffect(()=>{const t=[];c&&c.length>0&&c.forEach(s=>{t.push({id:`speaker-${s.id}`,title:s.session_title||"Session Topic TBA",description:null,start_time:s.session_time||void 0,start_time_full:s.session_time||void 0,location:void 0,type:"speaker",speaker_name:s.name,speaker_photo:s.photo_url,speaker_company:s.company,speaker_bio:s.bio,speaker_twitter:s.twitter_link,speaker_linkedin:s.linkedin_link,speaker_website:s.website_link,speaker_instagram:s.instagram_link,speaker_tiktok:s.tiktok_link,speaker_topic:s.topic,speaker_title:s.title,time_allocation:s.time_allocation})}),f&&f.length>0&&f.forEach(s=>{t.push({id:`schedule-${s.id}`,title:s.title,description:s.description,start_date:s.start_date,end_date:s.end_date,start_time:s.start_time,end_time:s.end_time,start_time_full:s.start_time_full,end_time_full:s.end_time_full,start_time_only:s.start_time_only,end_time_only:s.end_time_only,location:s.location,type:"schedule",priority:s.priority,image_url:s.image_url,time_allocation:s.time_allocation})}),t.sort((s,a)=>{const r=l=>l.start_time?new Date(l.start_time).getTime():l.start_time_full?new Date(l.start_time_full).getTime():0;return r(s)-r(a)}),V(t)},[c,f]);const N=T.filter(t=>{var l,d,E,D;const s=t.title.toLowerCase().includes(h.toLowerCase())||((l=t.description)==null?void 0:l.toLowerCase().includes(h.toLowerCase()))||((d=t.speaker_name)==null?void 0:d.toLowerCase().includes(h.toLowerCase()))||((E=t.speaker_topic)==null?void 0:E.toLowerCase().includes(h.toLowerCase()))||((D=t.speaker_company)==null?void 0:D.toLowerCase().includes(h.toLowerCase())),a=w==="all"||t.type===w,r=(()=>{if(p==="all")return!0;const L=t.start_time||t.start_time_full;if(!L)return p==="tba";const A=new Date(L);return p==="today"?M(A):p==="tomorrow"?P(A):p!=="tba"})();return s&&a&&r}),u=N.reduce((t,s)=>{const a=s.start_time||s.start_time_full,r=a?O(new Date(a),"yyyy-MM-dd"):"tba";return t[r]||(t[r]=[]),t[r].push(s),t},{}),R=t=>{if(!t.start_time&&!t.start_time_full)return"Time TBA";const s=t.start_time||t.start_time_full;if(!s)return"Time TBA";try{const a=$(s);if(t.end_time||t.end_time_full){const r=$(t.end_time||t.end_time_full);return`${a} - ${r}`}return a}catch{return"Time TBA"}},J=t=>{const s=t.start_time||t.start_time_full;if(!s)return null;try{return ye(s)}catch{return null}},K=t=>{if(t==="tba")return"Time To Be Announced";
1try{const s=Ne(t);return M(s)?"Today":P(s)?"Tomorrow":ge(s)?"Yesterday":O(s,"EEEE, MMMM d")}catch{return"Unknown Date"}},Q=t=>{switch(t){case"speaker":return e.jsxs(i,{className:"bg-gradient-to-r from-blue-500 to-indigo-500 text-white border-0",children:[e.jsx(ie,{className:"w-3 h-3 mr-1"}),"Speaker Session"]});case"schedule":return e.jsxs(i,{className:"bg-gradient-to-r from-green-500 to-emerald-500 text-white border-0",children:[e.jsx(m,{className:"w-3 h-3 mr-1"}),"Event"]});default:return e.jsx(i,{variant:"outline",children:t})}},W=t=>{if(!t)return null;switch(t){case"high":return e.jsxs(i,{className:"bg-gradient-to-r from-red-500 to-orange-500 text-white border-0",children:[e.jsx(oe,{className:"w-3 h-3 mr-1"}),"High Priority"]});case"medium":return e.jsx(i,{className:"bg-gradient-to-r from-yellow-500 to-amber-500 text-white border-0",children:"Medium Priority"});case"low":return e.jsx(i,{className:"bg-gradient-to-r from-green-500 to-emerald-500 text-white border-0",children:"Low Priority"});default:return e.jsx(i,{variant:"outline",children:t})}},Z=t=>{switch(t){case"x":return e.jsx(be,{size:12});case"linkedin":return e.jsx(Ce,{className:"w-3 h-3"});case"website":return e.jsx(de,{className:"w-3 h-3"});case"instagram":return e.jsx(xe,{className:"w-3 h-3"});case"tiktok":return e.jsx(me,{className:"w-3 h-3"});default:return e.jsx(Te,{className:"w-3 h-3"})}},ee=t=>{if(t.type!=="speaker")return null;const s=[];return t.speaker_twitter&&s.push({platform:"x",url:t.speaker_twitter}),t.speaker_linkedin&&s.push({platform:"linkedin",url:t.speaker_linkedin}),t.speaker_website&&s.push({platform:"website",url:t.speaker_website}),t.speaker_instagram&&s.push({platform:"instagram",url:t.speaker_instagram}),t.speaker_tiktok&&s.push({platform:"tiktok",url:t.speaker_tiktok}),s.length===0?null:e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs text-gray-500",children:"Connect:"}),e.jsx("div",{className:"flex gap-1",children:s.map((a,r)=>e.jsx(ce,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-gray-100 rounded-full",onClick:l=>{l.stopPropagation(),window.open(a.url,"_blank")},children:Z(a.platform)},r))})]})},se=t=>{C(t),S(!0)},te=()=>{S(!1),C(null)};return G||H?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600 font-medium",children:"Loading event preview..."})]})})}):b?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx(m,{className:"h-16 w-16 mx-auto mb-4 text-gray-400"}),e.jsx("h3",{className:"text-xl font-semibold mb-2 text-gray-900",children:"Unable to Load Preview"}),e.jsx("p",{className:"text-gray-600",children:(b==null?void 0:b.message)||"Please try again later"})]})})}):!o||!Y?e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx(m,{className:"h-16 w-16 mx-auto mb-4 text-gray-400"}),e.jsx("h3",{className:"text-xl font-semibold mb-2 text-gray-900",children:"No Event Selected"}),e.jsx("p",{className:"text-gray-600",children:"Select an event to preview its schedule and sessions."})]})})}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50",children:[e.jsxs("div",{className:"relative overflow-hidden bg-gradient-to-r from-indigo-600 via-purple-600 to-pink-500",children:[e.jsx("div",{className:"absolute inset-0 bg-black/10"}),e.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3
1E%3C/g%3E%3C/g%3E%3C/svg%3E")`}}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx("h1",{className:"text-4xl sm:text-5xl lg:text-6xl font-bold mb-4",children:"Event Preview"}),e.jsx("p",{className:"text-xl sm:text-2xl opacity-90 mb-8 max-w-3xl mx-auto",children:"See how your event schedule will appear to attendees"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-sm sm:text-base",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-white/20 backdrop-blur-sm rounded-full px-4 py-2",children:[e.jsx(m,{className:"w-5 h-5"}),e.jsxs("span",{className:"font-medium",children:[N.length," Sessions"]})]}),e.jsxs("div",{className:"flex items-center gap-2 bg-white/20 backdrop-blur-sm rounded-full px-4 py-2",children:[e.jsx(re,{className:"w-5 h-5"}),e.jsxs("span",{className:"font-medium",children:[(c==null?void 0:c.length)||0," Speakers"]})]}),e.jsxs("div",{className:"flex items-center gap-2 bg-white/20 backdrop-blur-sm rounded-full px-4 py-2",children:[e.jsx(k,{className:"w-5 h-5"}),e.jsxs("span",{className:"font-medium",children:[Object.keys(u).length," Days"]})]})]})]})})]}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 -mt-8 relative z-10",children:e.jsx(_,{className:"border-0 shadow-xl bg-white/95 backdrop-blur-sm",children:e.jsx(v,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(ve,{className:"absolute left-4 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-400"}),e.jsx(le,{placeholder:"Search sessions, speakers, topics, or companies...",value:h,onChange:t=>U(t.target.value),className:"pl-12 h-12 border-0 bg-gray-50 focus:bg-white transition-all duration-200 text-base"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(I,{value:w,onValueChange:F,className:"w-auto",children:e.jsxs(B,{className:"bg-gray-100 p-1",children:[e.jsx(x,{value:"all",className:"px-4",children:"All"}),e.jsx(x,{value:"speaker",className:"px-4",children:"Speakers"}),e.jsx(x,{value:"schedule",className:"px-4",children:"Events"})]})}),e.jsx(I,{value:p,onValueChange:z,className:"w-auto",children:e.jsxs(B,{className:"bg-gray-100 p-1",children:[e.jsx(x,{value:"all",className:"px-4",children:"All Days"}),e.jsx(x,{value:"today",className:"px-4",children:"Today"}),e.jsx(x,{value:"tomorrow",className:"px-4",children:"Tomorrow"}),e.jsx(x,{value:"tba",className:"px-4",children:"TBA"})]})})]})]})})})}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:N.length===0?e.jsx(_,{className:"border-0 shadow-lg",children:e.jsxs(v,{className:"py-16 text-center",children:[e.jsx(m,{className:"h-20 w-20 mx-auto mb-6 text-gray-300"}),e.jsx("h3",{className:"text-2xl font-semibold mb-3 text-gray-900",children:"No sessions found"}),e.jsx("p",{className:"text-gray-500 max-w-md mx-auto text-lg",children:T.length===0?"No sessions have been scheduled yet. Check back soon!":"Try adjusting your search or filter criteria to find what you're looking for."})]})}):e.jsx("div",{className:"space-y-8",children:Object.keys(u).sort((t,s)=>t==="tba"?1:s==="tba"?-1:t.localeCompare(s)).map(t=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-indigo-500 to-purple-600 rounded-2xl flex items-center justify-center shadow-lg",children:e.jsx(m,{className:"w-7 h-7 text-white"})})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-gray-900",children:K(t)}),e.jsxs("p",{className:"text-gray-500 text-lg",children:[u[t].length," session",u[t].length!==1?"s":""," ","scheduled"]})]})]}),e.jsx("div",{className:"grid gap-6",children:u[t].map(s=>{const a=R(s),r=J(s),l=s.time_allocation?we(s.time_allocation):0,d=_e(l);return e.jsx(_,{className:"group hover:shadow-2xl transition-all duration-300 border-0 shadow-md hover:-translate-y-1 cursor-pointer overflow-hidden bg-white",onClick:()=>se(s),children:e.jsx(v,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col lg:flex-row",children:[e.jsx("div",{className:"w-full lg:w-32 bg-gradient-to-br from-gray-50 to-gray-100 p-4 lg:p-6 flex flex-row lg:flex-col items-center justify-center border-b lg:border-b-0 lg:border-r",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-base lg:text-lg font-bold text-gray-900 mb-1",children:a==="Time TBA"?e.jsx("span",{className:"text-sm text-amber-600 font-medium px-2 py-1 bg-amber-50 rounded-full",children:"TBA"}):a.split(" - ")[0]}),a.includes(" - ")&&a!=="Time TBA"&&e.jsx("div",{className:"text-xs lg:text-sm text-gray-500",children:a.split(" - ")[1]}),d&&a!=="Time TBA"&&e.jsxs("div",{className:"text-xs text-gray-400 mt-2 flex items-center justify-center",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),d]})]})}),e.jsx("div",{className:"flex-1 p-4 lg:p-6",children:e.jsxs("div",{className:"flex flex-col space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg lg:text-xl font-semibold text-gray-900 mb-2 group-hover:text-indigo-600 transition-colors line-clamp-2",children:s.title}),s.type==="speaker"&&s.speaker_topic&&e.jsx("div",{className:"mb-3",children:e.jsxs(i,{className:"bg-gradient-to-r from-purple-500 to-pink-500 text-white border-0 text-xs",children:[e.jsx(ke,{className:"w-3 h-3 mr-1"}),s.speaker_topic]})})]}),s.description&&s.type!=="speaker"&&e.jsx("p",{className:"text-gray-600 text-sm lg:text-base line-clamp-2",children:s.description}),s.type==="speaker"&&s.speaker_bio&&e.jsx("p",{className:"text-gray-600 text-sm lg:text-base line-clamp-2",children:s.speaker_bio}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs lg:text-sm text-gray-500",children:[r&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(m,{className:"h-3 w-3 lg:h-4 lg:w-4"}),e.jsx("span",{children:r})]}),s.location&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3 lg:h-4 lg:w-4"}),e.jsx("span",{className:"truncate max-w-[150px]",children:s.location})]})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-end lg:justify-between gap-4",children:[s.type==="speaker"&&s.speaker_name&&e.jsxs("div",{className:"flex items-center gap-3 bg-gray-50 rounded-lg p-3 flex-1",children:[e.jsxs(he,{className:"h-12 w-12 ring-2 ring-white shadow-sm",children:[e.jsx(pe,{src:s.speaker_photo,alt:s.speaker_name}),e.jsx(ue,{className:"bg-gradient-to-br from-indigo-500 to-purple-600 text-white text-sm font-semibold",children:s.speaker_name.charAt(0)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-gray-900 text-sm lg:text-base truncate",children:s.speaker_name}),(s.speaker_company||s.speaker_title)&&e.jsx("p",{className:"text-xs lg:text-sm text-gray-600 truncate",children:s.speaker_title&&s.speaker_company?`${s.speaker_title} at ${s.speaker_company}`:s.speaker_title||s.speaker_company})]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Q(s.type),W(s.priority),d&&e.jsxs(i,{variant:"outline",className:"text-xs",children:[e.jsx(k,{className:"w-3 h-3 mr-1"}),d]})]}),ee(s)]})]})]})})]})})},s.id)})})]},t))})}),e.jsx(fe,{item:X,isOpen:q,onClose:te})]})},Ke=Se;export{Ke 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.