PageSourceSearch

https://mycircle.co/assets/EventsManage-CIgsq4eR.js

js mycircle.co collected 2026-10-07 21:26:37 UTC 152,140 bytes, 3 lines download raw bytes

1import{r as n,f as Re,j as e,D as as,m as ls,n as is,o as ns,p as js,B as D,X as it,d as nt,q as ds,e as le,G as He,S as Fe,N as Ce,l as Ns,F as Ut,R as Oe,C as dt,E as Os,t as Rt,b as $t,a0 as zt}from"./index-dk3pS_5c.js";import{D as Hs,a as Ws,b as qs,c as ue,d as Je,N as It}from"./Navbar-C-R_g-my.js";import{S as Et}from"./SEOHead-BxsYUEiz.js";import{I as xe}from"./input-BMJ6tdtB.js";import{B as A}from"./badge-BjKW3kmT.js";import{g as $e,P as Pe,a as gs,b as ot,E as os,c as Ft,i as ct,C as Lt,v as Ys,d as Bt,f as Vt,e as _t,u as Ot,h as ms,j as Le}from"./EventRegistrationCard-Fx5bFe3b.js";import{S as he,a as ge,b as be,c as fe,d as O}from"./select-ButOwnkc.js";import{T as Ht,a as Wt,b as Be}from"./tabs-CTTlioZp.js";import{A as mt,a as xt,b as ut,M as Ne}from"./avatar-DbDoCHR8.js";import{U as pe}from"./users-RHY69_ro.js";import{D as pt}from"./download-DYHGk5O5.js";import{U as qt}from"./user-check-IXCR3K_T.js";import{S as ht}from"./search-Bl_twnj7.js";import{C as cs}from"./clock-BRO_vb6H.js";import{f as ke}from"./format-IxRXk_B0.js";import{C as ts}from"./chart-column-DDSkg1bR.js";import{E as We}from"./eye-Dw_jRCqw.js";import{T as Yt}from"./trending-up-Cdk0OH5b.js";import{D as gt,C as Gt,M as bt}from"./monitor-CDgPEG8P.js";import{C as Ye}from"./calendar-CHM8Kf6_.js";import{S as Ge}from"./sparkles-B1wo8Bv0.js";import{L as Zt}from"./layout-grid-lUgUlKZ9.js";import{L as Xt,F as _e,S as Gs,T as Kt,C as Jt}from"./tablet-DQJGT_hD.js";import{P as Zs}from"./plus-DVrT2dIT.js";import{C as ze}from"./circle-check-PJmDdJjU.js";import{F as Qt,A as xs}from"./filter-DIP54qbn.js";import{t as er,m as ft,a as jt}from"./en-US-BOoww7nS.js";import{E as Xs}from"./ellipsis-vertical-CSUqnItp.js";import{L as rs}from"./link-DuD_Fvlp.js";import{S as bs}from"./send-L_kLdeiG.js";import{C as Ks}from"./copy-BR_EF7Fd.js";import{T as fs}from"./trash-2-B-gs5h2t.js";import{A as Js,a as us}from"./arrow-up-Cao27Q52.js";import{C as Nt}from"./chevron-left-L0kcg48z.js";import{C as vt}from"./chevron-right-C0ZcGKoU.js";import{V as we,M as qe}from"./video-D_55y-BI.js";import{L as E}from"./label-D49Nl3pW.js";import{T as yt}from"./textarea-DEASh_yD.js";import{S as je}from"./switch-DfpJfPHW.js";import{r as wt,E as Qe,c as sr,S as tr,g as Ue,R as rr,f as Qs,v as ar,a as lr}from"./imageOptimizer-DX9Bty8x.js";import{S as ir}from"./slider-DhSL0iUU.js";import{C as kt,M as Ct,Z as et,a as nr,R as dr,F as or,b as cr}from"./zoom-out-dXT-2MkM.js";import{I as vs}from"./info-Cr3HfP5Y.js";import{I as ys}from"./image-B4bRiMrQ.js";import{S as St}from"./smartphone-lYfbvXwP.js";import{U as st}from"./upload-D4ATHDhh.js";import{A as Tt}from"./arrow-left-CWKXeP6o.js";import{S as tt}from"./save-C4dJnata.js";import{S as mr}from"./shield-check-q0QYn8KW.js";import{S as xr}from"./share-2-DrRxo-C1.js";import{L as rt}from"./lock-4k3Sh-cJ.js";import{B as ur}from"./bookmark-DQGCMiYq.js";import"./index-B9CkV6UH.js";import"./circle-CeD0EWsP.js";import"./mycircle-logo-CoBjxzYT.js";import"./useTranslation-BOckQ-e2.js";import"./socket-BTJRNTpY.js";import"./bell-BuOQxLSn.js";import"./useAdminAccess-c25oeH6i.js";import"./ThemeToggle-DjolepYn.js";import"./settings-BwdvoszP.js";import"./shield-DqJV-nYa.js";import"./building-2-CrI_AGdd.js";import"./menu-Bkxxoepk.js";import"./presentation-BzdSiB0k.js";import"./award-8bTQOIbT.js";import"./addHours-EvxOR2zM.js";import"./radio-group-ByeJnd1z.js";import"./circle-x-D9gGMvv2.js";import"./handshake-ympMDC_C.js";import"./chevron-up-DAcVXwXS.js";import"./fileValidation-DfZbUV8K.js";function pr(s){return+er(s)<Date.now()}function at(s,l){const m=fr(s);let o;if(m.date){const u=jr(m.date,2);o=Nr(u.restDateString,u.year)}if(!o||isNaN(o.getTime()))return new Date(NaN);const w=o.getTime();let B=0,$;if(m.time&&(B=vr(m.time),isNaN(B)))return new Date(NaN);if(m.timezone){if($=yr(m.timezone),isNaN($))return new Date(NaN)}else{const u=new Date(w+B),M=new Date(0);return M.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),M.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),M}return new Date(w+B+$)}
1const es={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},hr=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,gr=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,br=/^([+-])(\d{2})(?::?(\d{2}))?$/;function fr(s){const l={},i=s.split(es.dateTimeDelimiter);let m;if(i.length>2)return l;if(/:/.test(i[0])?m=i[0]:(l.date=i[0],m=i[1],es.timeZoneDelimiter.test(l.date)&&(l.date=s.split(es.timeZoneDelimiter)[0],m=s.substr(l.date.length,s.length))),m){const o=es.timezone.exec(m);o?(l.time=m.replace(o[1],""),l.timezone=o[1]):l.time=m}return l}function jr(s,l){const i=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+l)+"})|(\\d{2}|[+-]\\d{"+(2+l)+"})$)"),m=s.match(i);if(!m)return{year:NaN,restDateString:""};const o=m[1]?parseInt(m[1]):null,w=m[2]?parseInt(m[2]):null;return{year:w===null?o:w*100,restDateString:s.slice((m[1]||m[2]).length)}}function Nr(s,l){if(l===null)return new Date(NaN);const i=s.match(hr);if(!i)return new Date(NaN);const m=!!i[4],o=Ve(i[1]),w=Ve(i[2])-1,B=Ve(i[3]),$=Ve(i[4]),u=Ve(i[5])-1;if(m)return Tr(l,$,u)?wr(l,$,u):new Date(NaN);{const M=new Date(0);return!Cr(l,w,B)||!Sr(l,o)?new Date(NaN):(M.setUTCFullYear(l,w,Math.max(o,B)),M)}}function Ve(s){return s?parseInt(s):1}function vr(s){const l=s.match(gr);if(!l)return NaN;const i=ps(l[1]),m=ps(l[2]),o=ps(l[3]);return Dr(i,m,o)?i*ft+m*jt+o*1e3:NaN}function ps(s){return s&&parseFloat(s.replace(",","."))||0}function yr(s){if(s==="Z")return 0;const l=s.match(br);if(!l)return 0;const i=l[1]==="+"?-1:1,m=parseInt(l[2]),o=l[3]&&parseInt(l[3])||0;return Pr(m,o)?i*(m*ft+o*jt):NaN}function wr(s,l,i){const m=new Date(0);m.setUTCFullYear(s,0,4);const o=m.getUTCDay()||7,w=(l-1)*7+i+1-o;return m.setUTCDate(m.getUTCDate()+w),m}const kr=[31,null,31,30,31,30,31,31,30,31,30,31];function Dt(s){return s%400===0||s%4===0&&s%100!==0}function Cr(s,l,i){return l>=0&&l<=11&&i>=1&&i<=(kr[l]||(Dt(s)?29:28))}function Sr(s,l){return l>=1&&l<=(Dt(s)?366:365)}function Tr(s,l,i){return l>=1&&l<=53&&i>=0&&i<=6}function Dr(s,l,i){return s===24?l===0&&i===0:i>=0&&i<60&&l>=0&&l<60&&s>=0&&s<25}function Pr(s,l){return l>=0&&l<=59}const ss=s=>s==="confirmed"||s==="registered"?"registered":s==="waitlist"||s==="waitlisted"?"waitlisted":s==="cancelled"?"cancelled":"registered",lt=[{value:"all",label:"All types"},{value:"attendee",label:"Attendee"},{value:"speaker",label:"Speaker"},{value:"sponsor",label:"Sponsor"},{value:"exhibitor",label:"Exhibitor"}],Ar=[{value:"all",label:"All statuses"},{value:"registered",label:"Registered"},{value:"waitlisted",label:"Waitlisted"},{value:"cancelled",label:"Cancelled"}];function Mr({isOpen:s,onClose:l,event:i,customAttendees:m}){var Z,S;const[o,w]=n.useState(""),[B,$]=n.useState("all"),[u,M]=n.useState("all"),[j,z]=n.useState([]),[Y,g]=n.useState(!1),[a,y]=n.useState(null),x=i==null?void 0:i.id,N=!!m,J=n.useCallback(async()=>{if(x){g(!0),y(null);try{const d=await Re.get(`/api/events/${x}/attendees`);z(d.attendees||[])}catch(d){const U=(d==null?void 0:d.message)||"Failed to load the attendee roster";y(U)}finally{g(!1)}}},[x]);n.useEffect(()=>{s&&x&&!N&&J()},[s,x,N,J]);const C=m??j,G=n.useMemo(()=>{const d=o.trim().toLowerCase();return C.filter(U=>B!=="all"&&(U.type||"attendee")!==B||u!=="all"&&ss(U.status)!==u?!1:d?U.firstName.toLowerCase().includes(d)||U.lastName.toLowerCase().includes(d)||U.headline&&U.headline.toLowerCase().includes(d)||U.email&&U.email.toLowerCase().includes(d)||U.ticketType&&U.ticketType.toLowerCase().includes(d):!0)},[C,o,B,u]),_=!!o.trim()||B!=="all"||u!=="all";if(!i)return null;const F=i.attendeesCount||C.length,L=((Z=i.capacity)==null?void 0:Z.isUnlimited)!==!1,Q=((S=i.capacity)==null?void 0:S.maxAttendees)||50,ie=!L&&Q>0?Math.min(100,Math.round(F/Q*100)):100,ne=async(d,U)=>{if(!x||N)return;const de=j;z(W=>W.map(h=>h.id===d?{...h,type:U}:h));try{await Re.patch(`/api/events/${x}/registrations/${d}`,{type:U}),le.success("Attendee type updated")}catch(W){z(de);const h=(W==null?void 0:W.message)||"Failed to update attendee type";le.error(h)}},K=()=>{if(C.length===0){le.info("No attendees to export");return}const d=["Attendee ID","First Name","Last Name","Email","Headline","Ticket Type","Status","Registered At"],U=C.map(oe=>[`"${oe.id}"`,`"${oe.firstName}"`,`"${oe.lastName}"`,`"${oe.email||""}"`,`"${oe.headline||""}"`,`"${oe.ticketType||"Standard"}"`,`"${oe.status||"confirmed"}"`,`"${oe.registeredAt?ke(new Date(oe.registeredAt),"yyyy-MM-dd HH:mm"):""}"`]),de=[d.join(","),...U.map(oe=>oe.join(","))].join(`
2`),W=new Blob([de],{type:"text/csv;charset=utf-8;"}),h=URL.createObjectURL(W),R=document.createElement("a");R.setAttribute("href",h);const re=(i.title||"event").replace(/[^a-z0-9]/gi,"_").toLowerCase();R.setAttribute("download",`${re}_attendees_${ke(new Date,"yyyyMMdd")}.csv`),document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(h),le.success(`Exported ${C.length} attendees to CSV`)};return e.jsx(as,{open:s,onOpenChange:d=>!d&&l(),children:e.jsxs(ls,{className:"max-w-2xl sm:max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden bg-card text-card-foreground border-border",children:[e.jsxs(is,{className:"p-5 pb-4 border-b border-border space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10 text-primary",children:e.jsx(pe,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(ns,{className:"text-lg font-bold text-foreground line-clamp-1",children:"Attendee Roster"}),e.jsx(js,{className:"text-xs text-muted-foreground line-clamp-1",children:i.title})]})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:K,className:"gap-1.5 text-xs h-8 shrink-0 border-border",children:[e.jsx(pt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Export CSV"})]})]}),e.jsxs("div",{className:"mt-3 p-3 rounded-xl bg-muted/40 border border-border/80 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs font-medium",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(qt,{className:"h-3.5 w-3.5 text-primary"}),"Registrations:",e.jsx("strong",{className:"text-foreground",children:F}),!L&&` / ${Q} spots`]}),e.jsx("span",{className:"text-xs text-foreground font-semibold",children:L?"Unlimited Capacity":`${ie}% filled`})]}),$e(i.registrations)&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:$e(i.registrations)}),!L&&e.jsx(Pe,{value:ie,className:`h-2 ${ie>=100?"[&>div]:bg-red-500":ie>=80?"[&>div]:bg-amber-500":"[&>div]:bg-emerald-500"}`})]})]}),e.jsxs("div",{className:"px-5 py-3 border-b border-border/60 bg-muted/20 space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx(ht,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(xe,{placeholder:"Search by attendee name, email, or role...",value:o,onChange:d=>w(d.target.value),className:"pl-9 pr-8 h-9 text-xs bg-background"}),o&&e.jsx("button",{type:"button",onClick:()=>w(""),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:e.jsx(it,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(he,{value:B,onValueChange:d=>$(d),children:[e.jsx(ge,{className:"h-8 text-xs bg-background flex-1",children:e.jsx(be,{placeholder:"Type"})}),e.jsx(fe,{children:lt.map(d=>e.jsx(O,{value:d.value,className:"text-xs",children:d.label},d.value))})]}),e.jsxs(he,{value:u,onValueChange:d=>M(d),children:[e.jsx(ge,{className:"h-8 text-xs bg-background flex-1",children:e.jsx(be,{placeholder:"Status"})}),e.jsx(fe,{children:Ar.map(d=>e.jsx(O,{value:d.value,className:"text-xs",children:d.label},d.value))})]}),_&&e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>{w(""),$("all"),M("all")},className:"h-8 px-2 text-xs text-muted-foreground shrink-0",children:"Clear"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-2.5 max-h-[420px]",children:Y?e.jsxs("div",{className:"py-12 text-center space-y-2",children:[e.jsx(nt,{className:"h-6 w-6 text-muted-foreground animate-spin mx-auto"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading attendee roster…"})]}):a?e.jsxs("div",{className:"py-12 text-center space-y-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:a}),e.jsx(D,{variant:"outline",size:"sm",onClick:J,className:"h-8 text-xs",children:"Try again"})]}):G.length===0?e.jsxs("div",{className:"py-12 text-center space-y-2",children:[e.jsx(pe,{className:"h-8 w-8 text-muted-foreground
2/50 mx-auto"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:_?"No attendees match your filters":"No registered attendees yet"}),e.jsx("p",{className:"text-xs text-muted-foreground max-w-xs mx-auto",children:_?"Try a different search term or clearing the type/status filters.":"As people RSVP or purchase tickets, they will appear here."})]}):G.map(d=>{var de,W,h;const U=`${((de=d.firstName)==null?void 0:de[0])||""}${((W=d.lastName)==null?void 0:W[0])||""}`.toUpperCase()||"?";return e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-card border border-border/80 hover:border-primary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsxs(mt,{className:"h-9 w-9 border border-border shrink-0",children:[e.jsx(xt,{src:d.avatarUrl,alt:d.firstName}),e.jsx(ut,{className:"bg-primary/10 text-primary text-xs font-semibold",children:U})]}),e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-semibold text-foreground truncate",children:[d.firstName," ",d.lastName]}),((h=d.ticketType)==null?void 0:h.toLowerCase().includes("host"))&&e.jsx(A,{variant:"secondary",className:"text-[10px] h-4 px-1.5 bg-primary/10 text-primary border-primary/20",children:"Host"}),N&&d.type&&d.type!=="attendee"&&e.jsx(A,{variant:"outline",className:"text-[10px] h-4 px-1.5 capitalize",children:d.type})]}),d.headline&&e.jsx("p",{className:"text-[11px] text-muted-foreground truncate max-w-xs",children:d.headline})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0 ml-2",children:[N?e.jsx(A,{variant:"outline",className:"text-[10px] font-medium bg-muted/40 text-muted-foreground",children:d.ticketType||"Confirmed"}):e.jsxs(he,{value:d.type||"attendee",onValueChange:R=>ne(d.id,R),children:[e.jsx(ge,{"aria-label":`Change attendee type for ${d.firstName} ${d.lastName}`,className:"h-6 text-[10px] w-[110px] bg-background capitalize",children:e.jsx(be,{})}),e.jsx(fe,{children:lt.filter(R=>R.value!=="all").map(R=>e.jsx(O,{value:R.value,className:"text-xs",children:R.label},R.value))})]}),e.jsx(A,{variant:"outline",className:`text-[10px] font-medium capitalize ${ss(d.status)==="cancelled"?"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20":ss(d.status)==="waitlisted"?"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20":"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20"}`,children:ss(d.status)}),d.registeredAt&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-1",children:[e.jsx(cs,{className:"h-2.5 w-2.5"}),ke(new Date(d.registeredAt),"MMM d, h:mm a")]})]})]},d.id)})}),e.jsxs(ds,{className:"p-4 border-t border-border bg-muted/20 flex sm:justify-between items-center",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Showing ",G.length," of ",C.length," attendees"]}),e.jsx(D,{onClick:l,size:"sm",className:"h-8 text-xs",children:"Done"})]})]})})}function Ur({isOpen:s,onClose:l,event:i,customAnalytics:m}){var w,B,$,u,M;const o=n.useMemo(()=>{var F,L,Q,ie,ne,K;if(m)return m;if(!i)return null;const j=i.attendeesCount||1,z=((F=i.capacity)==null?void 0:F.isUnlimited)!==!1,Y=((L=i.capacity)==null?void 0:L.maxAttendees)||50,g=!z&&Y>0?Math.min(100,Math.round(j/Y*100)):100,a=3+j%4,y=Math.max(j*a+15,25),x=Math.round(y*.78),N=y>0?Math.min(100,Math.round(j/y*100)):0,C=((Q=i.registration)!=null&&Q.isFree?0:((ie=i.registration)==null?void 0:ie.price)||0)*j,_=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((Z,S)=>({date:Z,count:Math.max(0,Math.round(j/7*(.5+S*3%4*.4)))}));return{eventId:i.id,totalViews:y,uniqueVisitors:x,totalRegistrations:j,capacity:Y,fillRatePercent:g,conversionRatePercent:N,ticketRevenue:C,isFree:((ne=i.registration)==null?void 0:ne.isFree)!==!1,currency:((K=i.registration)==null?void 0:K.currency)||"USD",registeredTimeline:_,deviceBreakdown:{mobile:54,desktop:38,tablet:8}}},[i,m]);return!i||!o?null:e.jsx(as,{open:s,onOpenChange:j=>!j&&l(),children:e.jsxs(ls,{className:"max-w-3xl sm:max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden bg-card text-card-foreground border-border",children:[e.jsx(is,{className:"p-5 pb-4 border-b border-border space-y-1",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-xl bg-purple-500/10 text-purple-600 dar
2k:text-purple-400",children:e.jsx(ts,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx(ns,{className:"text-lg font-bold text-foreground line-clamp-1",children:"Event Analytics & Performance"}),e.jsx(js,{className:"text-xs text-muted-foreground line-clamp-1",children:i.title})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border/80 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Registrations"}),e.jsx(pe,{className:"h-4 w-4 text-primary"})]}),e.jsx("div",{className:"text-2xl font-black text-foreground",children:o.totalRegistrations}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:(w=i.capacity)!=null&&w.isUnlimited?"Unlimited spots":`${o.fillRatePercent}% of ${o.capacity} cap`})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border/80 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Total Views"}),e.jsx(We,{className:"h-4 w-4 text-blue-500"})]}),e.jsx("div",{className:"text-2xl font-black text-foreground",children:o.totalViews}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[o.uniqueVisitors," unique visitors"]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border/80 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Conversion"}),e.jsx(Yt,{className:"h-4 w-4 text-emerald-500"})]}),e.jsxs("div",{className:"text-2xl font-black text-foreground",children:[o.conversionRatePercent,"%"]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Views to registrations"})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 border border-border/80 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Gross Revenue"}),e.jsx(gt,{className:"h-4 w-4 text-amber-500"})]}),e.jsx("div",{className:"text-2xl font-black text-foreground",children:o.isFree?"Free":`$${o.ticketRevenue}`}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:o.isFree?"Zero admission fee":`@ $${(B=i.registration)==null?void 0:B.price}/ticket`})]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/20 border border-border/80 space-y-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:"font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(pe,{className:"h-4 w-4 text-primary"})," Capacity Utilization"]}),e.jsx("span",{className:"font-bold text-foreground",children:($=i.capacity)!=null&&$.isUnlimited?"Unlimited":`${o.fillRatePercent}% Filled`})]}),!((u=i.capacity)!=null&&u.isUnlimited)&&e.jsx(Pe,{value:o.fillRatePercent,className:"h-2"}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsxs("span",{children:[o.totalRegistrations," Confirmed Attendees"]}),e.jsx("span",{children:(M=i.capacity)!=null&&M.isUnlimited?"No attendee ceiling":`${Math.max(0,o.capacity-o.totalRegistrations)} Spots Remaining`})]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/20 border border-border/80 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(Ye,{className:"h-4 w-4 text-primary"})," Registration Velocity"]}),e.jsx(A,{variant:"outline",className:"text-[10px] text-muted-foreground",children:"Past 7 Days"})]}),e.jsx("div",{className:"grid grid-cols-7 gap-2 pt-2 items-end h-28",children:o.registeredTimeline.map(j=>{const z=Math.max(...o.registeredTimeline.map(g=>g.count),1),Y=Math.max(12,Math.round(j.count/z*100));return e.jsxs("div",{className:"flex flex-col items-center gap-1.5 h-full justify-end",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground font-medium",children:j.count}),e.jsx("div",{style:{height:`${Y}%`},className:"w-full rounded-t-md bg-primary/80 hover:bg-primary transition-all"}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-semibold",children:j.date})]},j.date)})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-muted/20 border border-border/80 space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(He,{className:"h-4 w-4 text-blue-500"})," Device Breakdown"]}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Mobile"}),e.jsxs("span",{className:"font-medium text-foreground",children:[o.deviceBreakdown.mobile,"%"]})]}),e.jsx(Pe,{value:o.deviceBreakdown.mobile,className:"h-1.5"}),e.jsxs("div",{className:"flex justify-between text-muted-foreground pt-1",children:[e.jsx("span",{children:"Desktop"}),e.jsxs("span",{className:"font-medium text-foreground",children:[o.deviceBreakdown.desktop,"%"]})]}),e.jsx(Pe,{value:o.deviceBreakdown.desktop,className:"h-1.5"})]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/20 border border-border/80 space-y-2",children:[e.jsxs("h4",{className:"text-xs font-semibold text-foreground flex items-center gap-1.5",children:[e.jsx(Ge,{className:"h-4 w-4 text-amber-500"})," Organizer Pro-Tip"]}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["Events shared across active 
2Circles experience an average of"," ",e.jsx("strong",{className:"text-foreground",children:"3.4x higher registration conversion"}),". Send an automated reminder update 24 hours prior to maximize live attendance!"]})]})]})]}),e.jsx(ds,{className:"p-4 border-t border-border bg-muted/20 flex justify-end",children:e.jsx(D,{onClick:l,size:"sm",className:"h-8 text-xs",children:"Close"})})]})})}function Rr({events:s,isLoading:l,error:i,onRefresh:m,onCreateNew:o,onEdit:w,onPreview:B,onPublish:$,onUnpublish:u,onCancelRequest:M,onComplete:j,onDelete:z,onDuplicate:Y}){const[g,a]=n.useState({status:"all",search:"",category:"all",eventType:"all",format:"all",sortBy:"upcoming",viewMode:"grid",page:1,pageSize:12}),[y,x]=n.useState(null),[N,J]=n.useState(null),C=g.viewMode||"grid",G=g.page||1,_=g.pageSize||12,F=t=>{a(I=>({...I,...t,page:t.page??1}))},L=n.useMemo(()=>{const t=s.filter(T=>T.status==="published"),I=s.filter(T=>T.status==="draft"),te=s.filter(T=>T.status==="completed"),c=s.filter(T=>T.status==="cancelled"),P=s.reduce((T,q)=>T+(q.attendeesCount||0),0),k=t.filter(T=>{var q;return!((q=T.capacity)!=null&&q.isUnlimited)}),ae=k.reduce((T,q)=>{var H;return T+(((H=q.capacity)==null?void 0:H.maxAttendees)||0)},0),v=k.reduce((T,q)=>T+(q.attendeesCount||0),0),ce=ae>0?Math.round(v/ae*100):0;return{total:s.length,publishedCount:t.length,draftsCount:I.length,completedCount:te.length,cancelledCount:c.length,totalAttendees:P,capacityUtilization:ce}},[s]),Q=n.useMemo(()=>s.filter(t=>{var te,c,P,k,ae,v,ce;if(g.status!=="all"&&t.status!==g.status)return!1;const I=t.eventType||(t.category==="conference"?"conference":t.category==="webinar"?"webinar":t.category==="meetup"?"meetup":"in_person");if(g.eventType&&g.eventType!=="all"&&I!==g.eventType||g.format!=="all"&&t.format!==g.format)return!1;if(g.search.trim()){const T=g.search.toLowerCase(),q=t.title.toLowerCase().includes(T),H=(te=t.description)==null?void 0:te.toLowerCase().includes(T),ee=(c=t.location)==null?void 0:c.toLowerCase().includes(T),me=(k=(P=t.venue)==null?void 0:P.name)==null?void 0:k.toLowerCase().includes(T),b=(ae=t.tagline)==null?void 0:ae.toLowerCase().includes(T),X=(ce=(v=t.meetupConfig)==null?void 0:v.discussionTopic)==null?void 0:ce.toLowerCase().includes(T);if(!q&&!H&&!ee&&!me&&!b&&!X)return!1}return!0}).sort((t,I)=>{switch(g.sortBy){case"date_desc":return new Date(I.startsAt).getTime()-new Date(t.startsAt).getTime();case"attendees":return(I.attendeesCount||0)-(t.attendeesCount||0);case"recent":return new Date(I.createdAt||0).getTime()-new Date(t.createdAt||0).getTime();case"title":return t.title.localeCompare(I.title);case"title_desc":return I.title.localeCompare(t.title);case"upcoming":default:return new Date(t.startsAt).getTime()-new Date(I.startsAt).getTime()}}),[s,g]),ie=Q.length,ne=Math.max(1,Math.ceil(ie/_)),K=Math.min(G,ne),Z=(K-1)*_,S=Math.min(Z+_,ie),d=n.useMemo(()=>Q.slice(Z,S),[Q,Z,S]),U=n.useRef(null);n.useEffect(()=>{const t=I=>{var te,c,P;I.key==="/"&&((te=document.activeElement)==null?void 0:te.tagName)!=="INPUT"&&((c=document.activeElement)==null?void 0:c.tagName)!=="TEXTAREA"&&(I.preventDefault(),(P=U.current)==null||P.focus())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]);const de=t=>{t==="title"?F({sortBy:g.sortBy==="title"?"title_desc":"title"}):t==="date"?F({sortBy:g.sortBy==="upcoming"?"date_desc":"upcoming"}):t==="attendees"&&F({sortBy:g.sortBy==="attendees"?"recent":"attendees"})},W=n.useCallback(()=>{if(s.length===0){le.info("No events to export");return}const t=["Event ID","Title","Tagline","Event Type","Category","Format","Status","Start Date","End Date","Timezone","Location / Venue","Capacity","Attendees Count","Price","Currency"],I=s.map(k=>{var ae,v,ce,T,q,H;return[`"${k.id}"`,`"${(k.title||"").replace(/"/g,'""')}"`,`"${(k.tagline||"").replace(/"/g,'""')}"`,`"${k.eventType||"in_person"}"`,`"${k.category||"other"}"`,`"${k.format||"in_person"}"`,`"${k.status||"draft"}"`,`"${k.startsAt||""}"`,`"${k.endsAt||""}"`,`"${k.timezone||"UTC"}"`,`"${(((ae=k.venue)==null?void 0:ae.name)||k.location||"").replace(/"/g,'""')}"`,`"${(v=k.capacity)!=null&&v.isUnlimited?"Unlimited":((ce=k.capacity)==null?void 0:ce.maxAttendees)||50}"`,`"${k.attendeesCount||0}"`,`"${(T=k.registration)!=null&&T.isFree?"Free":((q=k.registration)==null?void 0:q.price)||0}"`,`"${((H=k.registration)==null?void 0:H.currency)||"USD"}"`]}),te="data:text/csv;charset=utf-8,"+[t.join(","),...I.map(k=>k.join(","))].join(`
3`),c=encodeURI(te),P=document.createElement("a");P.setAttribute("href",c),P.setAttribute("download",`events-export-${ke(new Date,"yyyy-MM-dd")}.csv`),document.body.appendChild(P),P.click(),document.body.removeChild(P),le.success(`Exported ${s.length} events to CSV`)},[s]),h=t=>{const te=`${window.location.origin}/events/${t.id}`;navigator.clipboard.writeText(te),le.success("Event link copied to clipboard!")},R=t=>{switch(t){case"published":return e.jsxs(A,{className:"bg-emerald-600 hover:bg-emerald-700 text-white gap-1.5 text-[11px] shadow-xs",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-200 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-100"})]}),"Live"]});case"draft":return e.jsxs(A,{variant:"secondary",className:"bg-muted text-muted-foreground gap-1 text-[11px]",children:[e.jsx(_e,{className:"h-3 w-3"})," Draft"]});case"cancelled":return e.jsxs(A,{variant:"destructive",className:"gap-1 text-[11px]",children:[e.jsx(Ce,{className:"h-3 w-3"})," Cancelled"]});case"completed":return e.jsxs(A,{className:"bg-blue-600 text-white gap-1 text-[11px]",children:[e.jsx(Gt,{className:"h-3 w-3"})," Completed"]})}},re=t=>{switch(t){case"conference":return e.jsxs(A,{className:"bg-purple-600/90 text-white gap-1 text-[11px] border-purple-500/30",children:[e.jsx(qe,{className:"h-3 w-3"})," Conference"]});case"meetup":return e.jsxs(A,{className:"bg-amber-600/90 text-white gap-1 text-[11px] border-amber-500/30",children:[e.jsx(pe,{className:"h-3 w-3"})," Meetup"]});case"webinar":return e.jsxs(A,{className:"bg-blue-600/90 text-white gap-1 text-[11px] border-blue-500/30",children:[e.jsx(we,{className:"h-3 w-3"})," Webinar"]});case"in_person":default:return e.jsxs(A,{className:"bg-emerald-600/90 text-white gap-1 text-[11px] border-emerald-500/30",children:[e.jsx(Ne,{className:"h-3 w-3"})," In-person"]})}},oe=t=>{switch(t){case"virtual":return e.jsx(we,{className:"h-3.5 w-3.5 text-blue-500"});case"hybrid":return e.jsx(He,{className:"h-3.5 w-3.5 text-purple-500"});case"in_person":default:return e.jsx(Ne,{className:"h-3.5 w-3.5 text-emerald-500"})}};return e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 space-y-8 relative z-10",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 pb-6 border-b border-border",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2.5 rounded-2xl bg-primary/10 text-primary border border-primary/20",children:e.jsx(Ye,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-foreground",children:"Event Organizer Studio"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Centralized management for in-person events, webinars, conferences, and meetups"})]})]})}),e.jsxs("div",{className:"flex items-center gap-2.5 shrink-0 self-start sm:self-auto",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:W,className:"rounded-xl border-border hover:bg-muted gap-1.5 h-9 text-xs font-medium",title:"Export all events to CSV",children:[e.jsx(pt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Export CSV"})]}),e.jsxs("div",{className:"flex items-center rounded-xl border border-border bg-muted/40 p-1",children:[e.jsx(D,{variant:C==="grid"?"secondary":"ghost",size:"sm",onClick:()=>
3F({viewMode:"grid"}),className:"h-8 w-8 p-0 rounded-lg",title:"Grid View",children:e.jsx(Zt,{className:"h-4 w-4"})}),e.jsx(D,{variant:C==="table"?"secondary":"ghost",size:"sm",onClick:()=>F({viewMode:"table"}),className:"h-8 w-8 p-0 rounded-lg",title:"Table View",children:e.jsx(Xt,{className:"h-4 w-4"})})]}),e.jsxs(D,{onClick:o,size:"lg",className:"rounded-full bg-primary text-primary-foreground shadow-[0_0_15px_hsl(var(--primary)/0.3)] hover:shadow-[0_0_25px_hsl(var(--primary)/0.5)] hover:opacity-90 gap-2 transition-all",children:[e.jsx(Zs,{className:"h-5 w-5"}),e.jsx("span",{children:"Create Event"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>F({status:"published"}),className:`p-4 sm:p-5 rounded-2xl bg-card border text-left transition-all ${g.status==="published"?"border-emerald-500 shadow-md ring-1 ring-emerald-500/20":"border-border shadow-xs hover:border-border/80"} space-y-2 cursor-pointer`,children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Live Events"}),e.jsx("div",{className:"p-1.5 rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:e.jsx(ze,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-extrabold text-foreground",children:L.publishedCount}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Accepting registrations"})]}),e.jsxs("div",{className:"p-4 sm:p-5 rounded-2xl bg-card border border-border shadow-xs space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Total Attendees"}),e.jsx("div",{className:"p-1.5 rounded-lg bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e.jsx(pe,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-extrabold text-foreground",children:L.totalAttendees}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Across all organized events"})]}),e.jsxs("div",{className:"p-4 sm:p-5 rounded-2xl bg-card border border-border shadow-xs space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Capacity Fill Rate"}),e.jsx("div",{className:"p-1.5 rounded-lg bg-purple-500/10 text-purple-600 dark:text-purple-400",children:e.jsx(ts,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"text-2xl sm:text-3xl font-extrabold text-foreground",children:[L.capacityUtilization,"%"]}),e.jsx(Pe,{value:L.capacityUtilization,className:"h-1.5"})]}),e.jsxs("button",{type:"button",onClick:()=>F({status:"draft"}),className:`p-4 sm:p-5 rounded-2xl bg-card border text-left transition-all ${g.status==="draft"?"border-amber-500 shadow-md ring-1 ring-amber-500/20":"border-border shadow-xs hover:border-border/80"} space-y-2 cursor-pointer`,children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"Drafts"}),e.jsx("div",{className:"p-1.5 rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400",children:e.jsx(_e,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"text-2xl sm:text-3xl font-extrabold text-foreground",children:L.draftsCount}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Unpublished events in progress"})]})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[e.jsx(Ht,{value:g.status,onValueChange:t=>F({status:t}),className:"w-full lg:w-auto",children:e.jsxs(Wt,{className:"grid grid-cols-5 w-full sm:w-auto h-10 p-1 bg-muted/60",children:[e.jsxs(Be,{value:"all",className:"text-xs",children:["All (",s.length,")"]}),e.jsxs(Be,{value:"published",className:"text-xs",children:["Live (",L.publishedCount,")"]}),e.jsxs(Be,{value:"draft",className:"text-xs",children:["Drafts (",L.draftsCount,")"]}),e.jsxs(Be,{value:"completed",className:"text-xs",children:["Done (",L.completedCount,")"]}),e.jsxs(Be,{value:"cancelled",className:"text-xs",children:["Cancelled (",L.cancelledCount,")"]})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1 sm:w-64",children:[e.jsx(ht,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(xe,{ref:U,placeholder:"Search events... (Press '/' to focus)",value:g.search,onChange:t=>F({search:t.target.value}),className:"pl-9 pr-8 h-9 text-xs"}),g.search&&e.jsx("button",{type:"button",onClick:()=>F({search:""}),className:"absolute right-2.5 top-2.5 text-muted-foreground hover:text-foreground",children:e.jsx(it,{className:"h-4 w-4"})})]}),e.jsxs(he,{value:g.eventType||"all",onValueChange:t=>F({eventType:t}),children:[e.jsx(ge,{className:"w-[130px] h-9 text-xs",children:e.jsx(be,{placeholder:"Type"})}),e.jsxs(fe,{children:[e.jsx(O,{value:"all",children:"All Types"}),e.jsx(O,{value:"conference",children:"Conference"}),e.jsx(O,{value:"meetup",children:"Meetup"}),e.jsx(O,{value:"webinar",children:"Webinar"}),e.jsx(O,{value:"in_person",children:"In-Person"})]})]}),e.jsxs(he,{value:g.format,onValueChange:t=>F({format:t}),children:[e.jsx(ge,{className:"w-[125px] h-9 text-xs",children:e.jsx(be,{placeholder:"Format"})}),e.jsxs(fe,{children:[e.jsx(O,{value:"all",children:"All Formats"}),e.jsx(O,{value:"in_person",children:"In-Person"}),e.jsx(O,{value:"virtual",children:"Virtual"}),e.jsx(O,{value:"hybrid",children:"Hybrid"})]})]}),e.jsxs(he,{value:g.sortBy,onValueChange:t=>F({sortBy:t}),children:[e.jsx(ge,{className:"w-[145px] h-9 text-xs",children:e.jsx(be,{placeholder:"Sort By"})}),e.jsxs(fe,{children:[e.jsx(O,{value:"upcoming",children:"Upcoming First"}),e.jsx(O,{value:"date_desc",children:"Latest Date First"}),e.jsx(O,{value:"recent",children:"Recently Created"}),e.jsx(O,{value:"attendees",children:"Most Attendees"}),e.jsx(O,{value:"title",children:"Title (A-Z)"}),e.jsx(O,{value:"title_desc",children:"Title (Z-A)"})]})]})]})]})}),l&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[1,2,3,4,5,6].map(t=>e.jsxs("div",{className:"rounded-2xl border border-border p-4 space-y-3 bg-card",children:[e.jsx(Fe,{className:"aspect-video w-full rounded-xl"}),e.jsx(Fe,{className:"h-5 w-3/4"}),e.jsx(Fe,{className:"h-4 w-1/2"}),e.jsxs("div",{className:"flex justify-between pt-2",children:[e.jsx(Fe,{className:"h-8 w-20"}),e.jsx(Fe,{className:"h-8 w-8 rounded-full"})]})]},t))}),!l&&i&&e.jsxs("div",{className:"p-8 text-center rounded-2xl border border-destructive/20 bg-destructive/5 space-y-3",children:[e.jsx(Ce,{className:"h-10 w-10 text-destructive mx-auto"}),e.jsx("h3",{className:"font-bold text-foreground",children:"Failed to Load Events"}),e.jsx("p",{className:"text-xs text-muted-foreground max-w-sm mx-auto",children:i}),e.jsx(D,{variant:"outline",size:"sm",onClick:m,children:"Retry"})]}),!l&&!i&&s.length===0&&e.jsxs("div",{className:"p-12 text-center rounded-3xl border-2 border-dashed border-border bg-card/50 space-y-4",children:[e.jsx("div",{className:"p-4 rounded-full bg-primary/10 text-primary w-16 h-16 mx-auto flex items-center justify-center",children:e.jsx(Ge,{className:"h-8 w-8"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-xl font-bold text-foreground",children:"You haven't created any events yet"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:"Start organizing your community by creating an in-person meetup, multi-track conference, or interactive webinar."})]}),e.jsxs(D,{onClick:o,className:"bg-primary text-primary-foreground gap-2",children:[e.jsx(Zs,{className:"h-4 w-4"})," Create Your First Event"]})]}),!l&&!i&&s.length>0&&Q.length===0&&e.jsxs("div",{className:"p-8 text-center rounded-2xl border border-border bg-card space-y-3",children:[e.jsx(Qt,{className:"h-8 w-8 text-muted-foreground mx-auto"}),e.jsx("h3",{className:"font-semibold text-foreground",children:"No matching events found"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Try adjusting your search query, clearing your filters, or switching status tabs."}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>F({status:"all",search:"",category:"all",eventType:"all",format:"all",sortBy:"upcoming"}),children:"Clear Filters"})]}),!l&&Q.length>0&&C==="grid"&&e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:d.map(t=>{var v,ce,T,q,H,ee;const I=at(t.startsAt),te=pr(new Date(t.endsAt)),c=t.capacity&&!t.capacity.isUnlimited?Math.min(100,Math.round((t.attendeesCount||0)/t.capacity.maxAttendees*100)):0,P=gs(t),k=ot(P.status),ae=t.eventType||(t.category==="conference"?"conference":t.category==="webinar"?"webinar":t.category==="meetup"?"meetup":"in_person");return e.jsxs("div",{className:"group flex flex-col justify-between bg-card rounded-2xl border border-border shadow-xs hover:shadow-md hover:border-primary/40 transition-all overflow-hidden",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"relative aspect-video w-full bg-muted overflow-hidden",children:[t.imageUrl?e.jsx("img",{src:t.imageUrl,alt:t.imageAlt||t.coverImageAlt||`Cover thumbnail for ${t.title||"event"}`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300",onError:me=>{var X;me.currentTarget.style.display="none";const b=(X=me.currentTarget.parentElement)==null?void 0:X.querySelector(".card-fallback-cover");b&&(b.style.display="flex")}}):null,e.jsx("div",{className:`card-fallback-cover w-full h-full ${t.imageUrl?"hidden":"flex"}`,children:e.jsx(os,{title:t.title,category:t.category,eventType:ae,color:t.color,alt:t.imageAlt||t.coverImageAlt,className:"w-full h-full",showIcon:!0})}),e.jsx("div",{className:"absolute top-2.5 left-2.5 right-2.5 flex items-center justify-between pointer-events-none",children:e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[R(t.status),t.status==="published"&&e.jsx(A,{className:`${k.bg} ${k.text} ${k.border} text-[10px] gap-1`,children:P.badgeText}),re(ae),te&&e.jsx(A,{variant:"outline",className:"bg-background/90 text-[10px]",children:"Ended"})]})})]}),e.jsxs("div",{className:"p-4 sm:p-5 space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"font-bold text-base text-foreground line-clamp-1 group-hover:text-primary transition-colors",children:t.title}),t.tagline&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:t.tagline})]}),ae==="conference"&&t.conferenceConfig&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.conferenceConfig.enableTracks&&e.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded-sm bg-purple-500/10 text-purple-600 dar
3k:text-purple-400 font-medium border border-purple-500/20",children:[t.conferenceConfig.expectedTracksCount||1," Tracks"]}),t.conferenceConfig.enableSpeakers&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-sm bg-purple-500/10 text-purple-600 dark:text-purple-400 font-medium border border-purple-500/20",children:"Speakers"}),t.conferenceConfig.enableSponsors&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-sm bg-purple-500/10 text-purple-600 dark:text-purple-400 font-medium border border-purple-500/20",children:"Sponsors"}),t.conferenceConfig.enableBadgeScanning&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-sm bg-purple-500/10 text-purple-600 dark:text-purple-400 font-medium border border-purple-500/20",children:"Badges"})]}),ae==="meetup"&&((v=t.meetupConfig)==null?void 0:v.discussionTopic)&&e.jsxs("div",{className:"text-[11px] text-amber-700 dark:text-amber-300 bg-amber-500/10 px-2 py-1 rounded-md line-clamp-1",children:["💬 ",t.meetupConfig.discussionTopic]}),e.jsxs("div",{className:"space-y-1.5 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(cs,{className:"h-3.5 w-3.5 text-primary shrink-0"}),e.jsxs("span",{className:"truncate",children:[ke(I,"MMM d, yyyy")," •"," ",t.allDay?"All Day":ke(I,"h:mm a")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[oe(t.format),e.jsx("span",{className:"truncate",children:t.format==="virtual"?`Online (${((ce=t.virtualDetails)==null?void 0:ce.platform)||"Video"})`:((T=t.venue)==null?void 0:T.name)||t.location||"In-Person"})]})]}),e.jsxs("div",{className:"pt-2 border-t border-border/60 space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsxs("button",{type:"button",onClick:()=>x(t),className:"flex items-center gap-1 text-primary hover:underline font-medium",title:"View Attendee Roster",children:[e.jsx(pe,{className:"h-3 w-3"}),t.attendeesCount||0," ",(q=t.capacity)!=null&&q.isUnlimited?"registered":`/ ${((H=t.capacity)==null?void 0:H.maxAttendees)||50} spots`]}),e.jsx("span",{className:"font-medium text-foreground",children:P.availabilityLabel})]}),$e(t.registrations)&&e.jsx("p",{className:"text-[10px] text-muted-foreground/80",children:$e(t.registrations)}),!((ee=t.capacity)!=null&&ee.isUnlimited)&&e.jsx(Pe,{value:c,className:`h-1.5 ${c>=100?"[&>div]:bg-red-500":c>=80?"[&>div]:bg-amber-500":"[&>div]:bg-emerald-500"}`})]})]})]}),e.jsxs("div",{className:"px-4 py-3 bg-muted/20 border-t border-border flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>w(t),disabled:t.status==="completed"||t.status==="cancelled",title:t.status==="completed"||t.status==="cancelled"?`Cannot edit ${t.status} events`:"Edit event",className:"h-8 px-2.5 text-xs gap-1 disabled:opacity-50",children:[e.jsx(Gs,{className:"h-3.5 w-3.5"})," Edit"]}),e.jsxs(D,{variant:"ghost",size:"sm",onClick:()=>B(t),className:"h-8 px-2.5 text-xs gap-1 text-muted-foreground hover:text-foreground",children:[e.jsx(We,{className:"h-3.5 w-3.5"})," Preview"]})]}),e.jsxs(Hs,{children:[e.jsx(Ws,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(Xs,{className:"h-4 w-4"})})}),e.jsxs(qs,{align:"end",className:"w-52",children:[e.jsxs(ue,{onClick:()=>x(t),className:"gap-2",children:[e.jsx(pe,{className:"h-4 w-4"})," Manage Attendees"]}),e.jsxs(ue,{onClick:()=>J(t),className:"gap-2",children:[e.jsx(ts,{className:"h-4 w-4 text-purple-500"})," Event Analytics"]}),e.jsxs(ue,{onClick:()=>h(t),className:"gap-2",children:[e.jsx(rs,{className:"h-4 w-4 text-blue-500"})," Copy Registration Link"]}),e.jsx(Je,{}),t.status==="draft"&&e.jsxs(ue,{onClick:()=>$(t.id),className:"gap-2 text-emerald-600 focus:text-emerald-700",children:[e.jsx(bs,{className:"h-4 w-4"})," Publish Event"]}),e.jsxs(ue,{onClick:()=>Y(t),className:"gap-2",children:[e.jsx(Ks,{className:"h-4 w-4"})," Duplicate Event"]}),t.status==="published"&&e.jsxs(e.Fragment,{children:[u&&e.jsxs(ue,{onClick:()=>u(t.id),className:"gap-2 text-amber-600 focus:text-amber-700",children:[e.jsx(_e,{className:"h-4 w-4"})," Unpublish (Revert to Draft)"]}),e.jsxs(ue,{onClick:()=>j(t.id),className:"gap-2 text-blue-600",children:[e.jsx(ze,{className:"h-4 w-4"})," Mark Completed"]}),e.jsxs(ue,{onClick:()=>M(t),className:"gap-2 text-amber-600",children:[e.jsx(Ce,{className:"h-4 w-4"})," Cancel Event"]})]}),e.jsx(Je,{}),e.jsxs(ue,{onClick:()=>z(t.id),className:"gap-2 text-destructive focus:text-destructive",children:[e.jsx(fs,{className:"h-4 w-4"})," Delete"]})]})]})]})]},t.id)})}),!l&&Q.length>0&&C==="table"&&e.jsx("div",{className:"rounded-2xl border border-border bg-card overflow-hidden shadow-xs",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left text-xs text-foreground",children:[e.jsx("thead",{className:"bg-muted/40 border-b border-border text-muted-foreground font-semibold uppercase tracking-wider text-[10px]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"py-3 px-4 cursor-pointer hover:text-foreground transition-colors select-none",onClick:()=>de("title"),title:"Sort by Event Name",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Event Details"}),g.sortBy==="title"?e.jsx(Js,{className:"h-3 w-3 text-primary"}):g.sortBy==="title_desc"?e.jsx(us,{className:"h-3 w-3 text-primary"}):e.jsx(xs,{className:"h-3 w-3 opacity-40 hover:opacity-100"})]})}),e.jsx("th",{className:"py-3 px-4",children:"Type & Format"}),e.jsx("th",{className:"py-3 px-4 cursor-pointer hover:text-foreground transition-colors select-none",onClick:()=>de("date"),title:"Sort by Schedule Date",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Date & Time"}),g.sortBy==="upcoming"?e.jsx(Js,{className:"h-3 w-3 text-primary"}):g.sortBy==="date_desc"?e.jsx(us,{className:"h-3 w-3 text-primary"}):e.jsx(xs,{className:"h-3 w-3 opacity-40 hover:opacity-100"})]})}),e.jsx("th",{className:"py-3 px-4",children:"Status"}),e.jsx("th",{className:"py-3 px-4 cursor-pointer hover:text-foreground transition-colors select-none",onClick:()=>de("attendees"),title:"Sort by Registrations",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Registrations"}),g.sortBy==="attendees"?e.jsx(us,{className:"h-3 w-3 text-primary"}):e.jsx(xs,{className:"h-3 w-3 opacity-40 hover:opacity-100"})]})}),e.jsx("th",{className:"py-3 px-4 text-right",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:d.map(t=>{var P,k;const I=at(t.startsAt),te=t.eventType||(t.category==="conference"?"conference":t.category==="webinar"?"webinar":t.category==="meetup"?"meetup":"in_person"),c=gs(t);return e.jsxs("tr",{className:"hover:bg-muted/20 transition-colors group",children:[e.jsx("td",{className:"py-3.5 px-4 min-w-[200px]",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("span",{className:"font-semibold text-foreground line-clamp-1 group-hover:text-primary",children:t.title}),t.tagline&&e.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:t.tagline})]})}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[re(te),e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[oe(t.format),t.format]})]})}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:e.jsxs("div",{className:"space-y-0.5 text-[11px]",children:[e.jsx("span",{className:"font-medium text-foreground",children:ke(I,"MMM d, yyyy")}),e.jsx("p",{className:"text-muted-foreground",children:t.allDay?"All Day":ke(I,"h:mm a")})]})}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:R(t.status)}),e.jsx("td",{className:"py-3.5 px-4 whitespace-nowrap",children:e.jsxs("button",{type:"button",onClick:()=>x(t),className:"space-y-1 text-left block hover:opacity-80",title:"View Attendee Roster",children:[e.jsxs("span",{className:"font-medium text-primary flex items-center gap-1",children:[e.jsx(pe,{className:"h-3 w-3"}),t.attendeesCount||0,!((P=t.capacity)!=null&&P.isUnlimited)&&` / ${(k=t.capacity)==null?void 0:k.maxAttendees}`]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:c.availabilityLabel}),$e(t.registrations)&&e.jsx("span",{className:"block text-[10px] text-muted-foreground
3/80",children:$e(t.registrations)})]})}),e.jsx("td",{className:"py-3.5 px-4 text-right whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>w(t),disabled:t.status==="completed"||t.status==="cancelled",className:"h-7 px-2 text-xs",children:e.jsx(Gs,{className:"h-3.5 w-3.5"})}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>B(t),className:"h-7 px-2 text-xs",children:e.jsx(We,{className:"h-3.5 w-3.5"})}),e.jsxs(Hs,{children:[e.jsx(Ws,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",children:e.jsx(Xs,{className:"h-3.5 w-3.5"})})}),e.jsxs(qs,{align:"end",className:"w-52",children:[e.jsxs(ue,{onClick:()=>x(t),className:"gap-2",children:[e.jsx(pe,{className:"h-4 w-4"})," Manage Attendees"]}),e.jsxs(ue,{onClick:()=>J(t),className:"gap-2",children:[e.jsx(ts,{className:"h-4 w-4 text-purple-500"})," Event Analytics"]}),e.jsxs(ue,{onClick:()=>h(t),className:"gap-2",children:[e.jsx(rs,{className:"h-4 w-4 text-blue-500"})," Copy Registration Link"]}),e.jsx(Je,{}),t.status==="draft"&&e.jsxs(ue,{onClick:()=>$(t.id),className:"gap-2 text-emerald-600",children:[e.jsx(bs,{className:"h-4 w-4"})," Publish"]}),e.jsxs(ue,{onClick:()=>Y(t),className:"gap-2",children:[e.jsx(Ks,{className:"h-4 w-4"})," Duplicate"]}),t.status==="published"&&e.jsxs(e.Fragment,{children:[u&&e.jsxs(ue,{onClick:()=>u(t.id),className:"gap-2 text-amber-600 focus:text-amber-700",children:[e.jsx(_e,{className:"h-4 w-4"})," Unpublish"]}),e.jsxs(ue,{onClick:()=>j(t.id),className:"gap-2 text-blue-600",children:[e.jsx(ze,{className:"h-4 w-4"})," Mark Completed"]}),e.jsxs(ue,{onClick:()=>M(t),className:"gap-2 text-amber-600",children:[e.jsx(Ce,{className:"h-4 w-4"})," Cancel Event"]})]}),e.jsx(Je,{}),e.jsxs(ue,{onClick:()=>z(t.id),className:"gap-2 text-destructive focus:text-destructive",children:[e.jsx(fs,{className:"h-4 w-4"})," Delete"]})]})]})]})})]},t.id)})})]})})}),!l&&ie>0&&e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 pt-4 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{children:["Showing ",e.jsx("strong",{className:"text-foreground",children:Z+1})," to"," ",e.jsx("strong",{className:"text-foreground",children:S})," of"," ",e.jsx("strong",{className:"text-foreground",children:ie})," events"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{children:"Per page:"}),e.jsxs(he,{value:String(_),onValueChange:t=>F({pageSize:Number(t),page:1}),children:[e.jsx(ge,{className:"w-16 h-8 text-xs",children:e.jsx(be,{})}),e.jsxs(fe,{children:[e.jsx(O,{value:"6",children:"6"}),e.jsx(O,{value:"12",children:"12"}),e.jsx(O,{value:"24",children:"24"}),e.jsx(O,{value:"48",children:"48"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>F({page:Math.max(1,K-1)}),disabled:K<=1,className:"h-8 px-2.5 text-xs gap-1",children:[e.jsx(Nt,{className:"h-3.5 w-3.5"})," Prev"]}),Array.from({length:ne},(t,I)=>I+1).filter(t=>t===1||t===ne||Math.abs(t-K)<=1).reduce((t,I,te,c)=>(te>0&&I-c[te-1]>1&&t.push(-1),t.push(I),t),[]).map((t,I)=>t===-1?e.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"..."},`ellipsis-${I}`):e.jsx(D,{variant:t===K?"default":"outline",size:"sm",onClick:()=>F({page:t}),className:"h-8 w-8 p-0 text-xs",children:t},t)),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>F({page:Math.min(ne,K+1)}),disabled:K>=ne,className:"h-8 px-2.5 text-xs gap-1",children:["Next ",e.jsx(vt,{className:"h-3.5 w-3.5"})]})]})]}),e.jsx(Mr,{isOpen:!!y,onClose:()=>x(null),event:y}),e.jsx(Ur,{isOpen:!!N,onClose:()=>J(null),event:N})]})}const $r=Ut("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Pt=n.forwardRef(({className:s,variant:l,...i},m)=>e.jsx("div",{ref:m,role:"alert",className:Ns($r({variant:l}),s),...i}));Pt.displayName="Alert";const At=n.forwardRef(({className:s,...l},i)=>e.jsx("h5",{ref:i,className:Ns("mb-1 font-medium leading-none tracking-tight",s),...l}));At.displayName="AlertTitle";const Mt=n.forwardRef(({className:s,...l},i)=>e.jsx("div",{ref:i,className:Ns("text-sm [&_p]:leading-relaxed",s),...l}));Mt.displayName="AlertDescription";const zr=({isOpen:s,onClose:l,imageSource:i,onApply:m,initialAspect:o="16:9"})=>{const[w,B]=n.useState(o),[$,u]=n.useState(0),[M,j]=n.useState(!1),[z,Y]=n.useState(!1),[g,a]=n.useState(1),[y,x]=n.useState(!1),[N,J]=n.useState({width:1200,height:675}),[C,G]=n.useState({x:5,y:10,width:90,height:80}),[_,F]=n.useState("none"),L=n.useRef({clientX:0,clientY:0,crop:{x:0,y:0,width:0,height:0}}),Q=n.useRef(null),ie=n.useRef(null);n.useEffect(()=>{!s||!i||wt(i).then(c=>{J({width:c.width,height:c.height}),S(w,c.width,c.height)}
3).catch(()=>{J({width:1200,height:675}),S(w,1200,675)})},[s,i]);const ne=$%180!==0,K=ne?N.height:N.width,Z=ne?N.width:N.height,S=n.useCallback((c,P,k)=>{const v=(Qe.find(T=>T.id===c)||Qe[0]).ratio;if(!v){G({x:5,y:5,width:90,height:90});return}const ce=P/k;if(ce>v){const q=Math.min(95,90*(v/ce)),H=Math.max(0,(100-q)/2),ee=10/2;G({x:H,y:ee,width:q,height:90})}else{const q=Math.min(95,90*(ce/v)),H=10/2,ee=Math.max(0,(100-q)/2);G({x:H,y:ee,width:90,height:q})}},[]),d=c=>{B(c.id),S(c.id,K,Z)},U=()=>{const c=($+90)%360;u(c);const P=c%180!==0,k=P?N.height:N.width,ae=P?N.width:N.height;S(w,k,ae)},de=()=>{u(0),j(!1),Y(!1),a(1),B("16:9"),S("16:9",N.width,N.height),le.info("Crop & adjustments reset to default.")},W=(c,P)=>{c.preventDefault(),c.stopPropagation(),F(P),L.current={clientX:c.clientX,clientY:c.clientY,crop:{...C}}},h=n.useCallback(c=>{if(_==="none"||!Q.current)return;const P=Q.current.getBoundingClientRect();if(P.width===0||P.height===0)return;const k=(c.clientX-L.current.clientX)/P.width*100,ae=(c.clientY-L.current.clientY)/P.height*100,v=L.current.crop,ce=Qe.find(H=>H.id===w),T=(ce==null?void 0:ce.ratio)||null,q=P.width/P.height;if(_==="move"){const H=Math.max(0,Math.min(100-v.width,v.x+k)),ee=Math.max(0,Math.min(100-v.height,v.y+ae));G(me=>({...me,x:H,y:ee}))}else if(_==="se"){let H=Math.max(10,Math.min(100-v.x,v.width+k)),ee=Math.max(10,Math.min(100-v.y,v.height+ae));if(T){const me=H*q/T;v.y+me<=100?ee=me:(ee=100-v.y,H=ee*T/q)}G(me=>({...me,width:Math.min(100-me.x,H),height:Math.min(100-me.y,ee)}))}else if(_==="nw"){let H=Math.max(10,Math.min(v.x+v.width,v.width-k)),ee=Math.max(10,Math.min(v.y+v.height,v.height-ae)),me=v.x+v.width-H,b=v.y+v.height-ee;if(T){const X=H*q/T;v.y+v.height-X>=0?(ee=X,b=v.y+v.height-ee):(ee=v.y+v.height,b=0,H=ee*T/q,me=v.x+v.width-H)}G({x:Math.max(0,me),y:Math.max(0,b),width:H,height:ee})}},[_,w]),R=n.useCallback(()=>{F("none")},[]);n.useEffect(()=>{if(_!=="none")return window.addEventListener("pointermove",h),window.addEventListener("pointerup",R),()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",R)}},[_,h,R]);const re=Math.round(C.width/100*K),oe=Math.round(C.height/100*Z),t=re/(oe||1),I=async()=>{x(!0);try{const c={x:Math.round(C.x/100*K),y:Math.round(C.y/100*Z),width:Math.max(1,re),height:Math.max(1,oe)},P=await sr(i,c,{rotation:$,flipHorizontal:M,flipVertical:z,maxWidth:1920,maxHeight:1080,quality:.9,format:"image/webp",fileName:"event-cover-cropped.webp"});await m(P),le.success("Cover image cropped and updated!"),l()}catch(c){console.error("Failed to apply crop:",c),le.error((c==null?void 0:c.message)||"Failed to crop image.")}finally{x(!1)}},te=typeof i=="string"?i:URL.createObjectURL(i);return e.jsx(as,{open:s,onOpenChange:c=>!c&&l(),children:e.jsxs(ls,{className:"max-w-4xl bg-gray-950 text-white border-gray-800 p-0 overflow-hidden rounded-2xl shadow-2xl flex flex-col max-h-[90vh]",children:[e.jsx(is,{className:"px-6 py-4 border-b border-gray-800 bg-gray-900/80 flex flex-row items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-emerald-500/20 text-emerald-400 flex items-center justify-center",children:e.jsx(kt,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx(ns,{className:"text-base font-bold text-white",children:"Edit & Crop Cover Image"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Fit your image perfectly for desktop hero banners and mobile previews."})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[e.jsxs("div",{className:"relative w-full aspect-[16/9] max-h-[420px] bg-black rounded-xl overflow-hidden border border-gray-800 select-none flex items-center justify-center",children:[e.jsxs("div",{ref:Q,className:"relative w-full h-full flex items-center justify-center overflow-hidden",style:{touchAction:"none"},children:[e.jsx("img",{ref:ie,src:te,alt:"Crop preview source",crossOrigin:"anonymous",className:"w-full h-full object-contain pointer-events-none transition-transform duration-150",style:{transform:`scale(${g}) rotate(${$}deg) scaleX(${M?-1:1}) scaleY(${z?-1:1})`}}),e.jsx("div",{className:"absolute inset-0 bg-black/60 pointer-events-none"}),e.jsxs("div",{className:"absolute border-2 border-emerald-400 shadow-[0_0_0_9999px_rgba(0,0,0,0.55)] cursor-move transition-all duration-75",style:{left:`${C.x}%`,top:`${C.y}%`,width:`${C.width}%`,height:`${C.height}%`},onPointerDown:c=>W(c,"move"),children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none grid grid-cols-3 grid-rows-3 opacity-40",children:[e.jsx("div",{className:"border-r border-b border-white/50"}),e.jsx("div",{className:"border-r border-b border-white/50"}),e.jsx("div",{className:"border-b border-white/50"}),e.jsx("div",{className:"border-r border-b border-white/50"}),e.jsx("div",{className:"border-r border-b border-white/50"}),e.jsx("div",{className:"border-b border-white/50"}),e.jsx("div",{className:"border-r border-white/50"}),e.jsx("div",{className:"border-r border-white/50"}),e.jsx("div",{})]}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none opacity-30",children:[e.jsx("div",{className:"w-4 h-4 border-t border-b border-white"}),e.jsx("div",{className:"h-4 w-4 border-l border-r border-white absolute"})]}),e.jsx("div",{onPointerDown:c=>W(c,"nw"),className:"absolute -top-1.5 -left-1.5 w-4 h-4 bg-emerald-400 rounded-sm cursor-nwse-resize shadow-md hover:scale-125 transition-transform"}),e.jsx("div",{onPointerDown:c=>W(c,"ne"),className:"absolute -top-1.5 -right-1.5 w-4 h-4 bg-emerald-400 rounded-sm cursor-nesw-resize shadow-md hover:scale-125 transition-transform"}),e.jsx("div",{onPointerDown:c=>W(c,"se"),className:"absolute -bottom-1.5 -right-1.5 w-4 h-4 bg-emerald-400 rounded-sm cursor-nwse-resize shadow-md hover:scale-125 transition-transform"}),e.jsx("div",{onPointerDown:c=>W(c,"sw"),className:"absolute -bottom-1.5 -left-1.5 w-4 h-4 bg-emerald-400 rounded-sm cursor-nesw-resize shadow-md hover:scale-125 transition-transform"})]})]}),e.jsxs("div",{className:"absolute bottom-3 left-3 z-10 flex items-center gap-2 pointer-events-none",children:[e.jsxs(A,{variant:"outline",className:"bg-black/75 border-white/20 text-white text-xs font-mono backdrop-blur-md",children:[re," × ",oe," px"]}),Math.abs(t-16/9)<.1&&e.jsx(A,{className:"bg-emerald-500/80 text-white text-[11px] backdrop-blur-md",children:"Optimal 16:9 Banner"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold text-gray-300",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Ct,{className:"w-3.5 h-3.5 text-emerald-400"}),"Aspect Ratio Presets"]}
3),e.jsx("span",{className:"text-gray-500 text-[11px]",children:"Recommended 16:9 for responsive headers"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-2",children:Qe.map(c=>{const P=w===c.id;return e.jsxs("button",{type:"button",onClick:()=>d(c),className:`flex flex-col items-center justify-center p-2.5 rounded-xl border text-xs font-medium transition-all ${P?"border-emerald-500 bg-emerald-500/15 text-emerald-300 shadow-sm":"border-gray-800 bg-gray-900/60 text-gray-300 hover:border-gray-700 hover:bg-gray-800"}`,children:[e.jsx("span",{className:"font-bold",children:c.label}),e.jsx("span",{className:"text-[10px] text-gray-400 truncate mt-0.5",children:c.description})]},c.id)})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 rounded-xl bg-gray-900/60 border border-gray-800",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-300",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(et,{className:"w-3.5 h-3.5 text-gray-400"}),"Zoom Level (",g.toFixed(1),"x)"]}),e.jsx("button",{type:"button",onClick:()=>a(1),className:"text-[11px] text-gray-400 hover:text-white",children:"Reset Zoom"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(nr,{className:"w-3.5 h-3.5 text-gray-400"}),e.jsx(ir,{value:[g],min:1,max:3,step:.1,onValueChange:c=>a(c[0]),className:"flex-1"}),e.jsx(et,{className:"w-3.5 h-3.5 text-gray-400"})]})]}),e.jsxs("div",{className:"flex items-center justify-between md:justify-end gap-2",children:[e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:U,className:"bg-gray-800 hover:bg-gray-700 text-gray-200 border-gray-700 text-xs",children:[e.jsx(dr,{className:"w-3.5 h-3.5 mr-1.5 text-emerald-400"}),"Rotate 90°"]}),e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:()=>j(!M),className:`text-xs border-gray-700 ${M?"bg-emerald-500/20 text-emerald-300 border-emerald-500/40":"bg-gray-800 hover:bg-gray-700 text-gray-200"}`,children:[e.jsx(or,{className:"w-3.5 h-3.5 mr-1.5"}),"Flip H"]}),e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:()=>Y(!z),className:`text-xs border-gray-700 ${z?"bg-emerald-500/20 text-emerald-300 border-emerald-500/40":"bg-gray-800 hover:bg-gray-700 text-gray-200"}`,children:[e.jsx(cr,{className:"w-3.5 h-3.5 mr-1.5"}),"Flip V"]}),e.jsxs(D,{type:"button",variant:"ghost",size:"sm",onClick:de,className:"text-gray-400 hover:text-white text-xs",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 mr-1"}),"Reset"]})]})]})]}),e.jsxs(ds,{className:"px-6 py-3 border-t border-gray-800 bg-gray-900/80 flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-gray-400 flex items-center gap-1.5",children:[e.jsx(vs,{className:"w-3.5 h-3.5 text-gray-400"}),e.jsx("span",{children:"Output will be optimized to high-efficiency WebP format."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{type:"button",variant:"outline",onClick:l,disabled:y,className:"bg-gray-800 hover:bg-gray-700 text-gray-300 border-gray-700 text-xs",children:"Cancel"}),e.jsx(D,{type:"button",onClick:I,disabled:y,className:"bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold shadow-md shadow-emerald-600/20 min-w-[120px]",children:y?e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Applying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(dt,{className:"w-3.5 h-3.5 mr-1.5"}),"Apply & Save Crop"]})})]})]})]})})},Ir=({imageUrl:s,imageAlt:l="",imageKey:i="",eventTitle:m="",eventCategory:o="networking",eventType:w="in_person",eventColor:B="#3CB680",onChange:$,onRemove:u,disabled:M=!1})=>{const[j,z]=n.useState(!1),[Y,g]=n.useState(!1),[a,y]=n.useState(0),[x,N]=n.useState(null),[J,C]=n.useState(null),[G,_]=n.useState(null),[F,L]=n.useState(null),[Q,ie]=n.useState(!1),[ne,K]=n.useState(""),[Z,S]=n.useState(l),[d,U]=n.useState("desktop"),[de,W]=n.useState(!1),[h,R]=n.useState(!1),[re,oe]=n.useState(null),t=n.useRef(null),I=n.useRef(null);n.useEffect(()=>{S(l)},[l]),n.useEffect(()=>{s&&!de?wt(s).then(b=>{_(b),W(!1)}).catch(()=>{_(null)}):_(null)},[s,de]);const te=async b=>{N(null),C(null),L(null);const X=await ar(b);if(!X.valid){N(X.error||"Invalid image file."),le.error(X.error||"Invalid image file.");return}X.warning&&C(X.warning),g(!0),y(10);try{y(25);const{file:se,dimensions:ve,compressed:Ae}=await lr(b,{maxWidth:1920,maxHeight:1080,quality:.88,format:b.type==="image/png"?"image/png":"image/webp"});
3if(_(ve),Ae&&se.size<b.size){const Me=Math.round((b.size-se.size)/b.size*100);L(`Optimized: ${Qs(se.size)} (${Me}% reduction)`)}y(45);const Se=await Re.get(`/api/upload/presigned-url?folder=events&fileType=${encodeURIComponent(se.type)}`),{uploadUrl:Te,fileUrl:De,key:Ze}=Se;y(65);const Ie=await fetch(Te,{method:"PUT",body:se,headers:{"Content-Type":se.type}});if(!Ie.ok)throw new Error(`S3 upload failed with status ${Ie.status}`);y(85);try{await Re.post("/api/upload/event-cover/confirm",{fileUrl:De})}catch(Me){console.warn("Cover confirmation scan alert:",Me)}y(100),W(!1);const Ee=Z.trim()||Ue(m,o,w);S(Ee),$(De,Ee,Ze),le.success("Cover image uploaded and optimized successfully!")}catch(se){console.error("Event cover upload error:",se);const ve=(se==null?void 0:se.message)||"Failed to upload cover image.";N(ve),le.error(ve)}finally{g(!1),y(0),t.current&&(t.current.value="")}},c=b=>{var se;const X=(se=b.target.files)==null?void 0:se[0];X&&te(X)},P=b=>{b.preventDefault(),b.stopPropagation(),!M&&!Y&&z(!0)},k=b=>{b.preventDefault(),b.stopPropagation(),z(!1)},ae=b=>{var se;if(b.preventDefault(),b.stopPropagation(),z(!1),M||Y)return;const X=(se=b.dataTransfer.files)==null?void 0:se[0];X&&te(X)},v=()=>{W(!1),_(null),L(null),N(null),C(null),S(""),$("","",""),u&&u(),le.success("Cover image removed. Fallback theme will be used.")},ce=()=>{s&&(oe(s),R(!0))},T=async b=>{g(!0),y(20);try{_(b.dimensions),y(40);const X=await Re.get(`/api/upload/presigned-url?folder=events&fileType=${encodeURIComponent(b.file.type)}`),{uploadUrl:se,fileUrl:ve,key:Ae}=X;y(70);const Se=await fetch(se,{method:"PUT",body:b.file,headers:{"Content-Type":b.file.type}});if(!Se.ok)throw new Error(`S3 upload failed with status ${Se.status}`);y(90);try{await Re.post("/api/upload/event-cover/confirm",{fileUrl:ve})}catch(De){console.warn("Cover confirmation scan alert:",De)}const Te=Z.trim()||Ue(m,o,w);S(Te),L(`Cropped: ${b.dimensions.width}×${b.dimensions.height}px (${Qs(b.file.size)})`),$(ve,Te,Ae),le.success("Cover image cropped and updated successfully!")}catch(X){console.error("Cropped image upload error:",X);const se=Z.trim()||Ue(m,o,w);$(b.previewUrl,se,i),le.success("Cover image cropped and applied!")}finally{g(!1),y(0),R(!1)}},q=b=>{b.preventDefault();const X=ne.trim();if(!X)return;if(!/^https?:\/\/.+/i.test(X)){N("Please provide a valid HTTPS image URL.");return}N(null),W(!1);const se=Z.trim()||Ue(m,o,w);S(se),$(X,se,""),ie(!1),K(""),le.success("External image URL applied!")},H=()=>{const b=Ue(m,o,w);S(b),$(s,b,i),le.success("Descriptive alt text auto-generated!")},ee=()=>{Z!==l&&$(s,Z.trim(),i)},me=!!(s&&!de);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("input",{ref:t,type:"file",accept:tr.join(","),className:"hidden",onChange:c,disabled:M||Y}),e.jsxs("div",{ref:I,onDragOver:P,onDragLeave:k,onDrop:ae,className:`relative group rounded-2xl overflow-hidden border-2 transition-all duration-300 ${j?"border-emerald-500 bg-emerald-500/10 scale-[1.01] shadow-xl":me?"border-gray-200 dark:border-gray-700 bg-gray-900 shadow-sm":"border-dashed border-gray-300 dark:border-gray-700 bg-gray-50/50 dark:bg-gray-800/30 hover:border-emerald-500/60 hover:bg-emerald-50/30 dark:hover:bg-emerald-950/20"} ${d==="mobile"?"max-w-sm mx-auto aspect-[4/3]":"w-full aspect-[21/9] min-h-[220px]"}`,children:[me?e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("img",{src:s,alt:Z||Ue(m,o,w),loading:"lazy",decoding:"async",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-[1.02]",onError:()=>W(!0)}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-black/40 opacity-90 sm:opacity-75 sm:group-hover:opacity-95 transition-opacity"}),e.jsxs("div",{className:"absolute top-3 inset-x-3 flex items-center justify-between z-10 pointer-events-auto",children:[G?e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-black/60 backdrop-blur-md border border-white/10 text-xs font-medium text-white shadow-sm",children:[e.jsx(Ct,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsxs("span",{children:[G.width," × ",G.height,"px"]}),e.jsx("span",{className:"text-white/40",children:"•"}),e.jsx("span",{className:G.isRecommendedRatio?"text-emerald-300":"text-amber-300",children:G.aspectRatioLabel})]}):e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-black/60 backdrop-blur-md border border-white/10 text-xs text-white/80",children:[e.jsx(ys,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{children:"Custom Cover"})]}),e.jsxs("div",{className:"flex items-center gap-1 p-0.5 rounded-lg bg-black/60 backdrop-blur-md border border-white/10 text-white",children:[e.jsx("button",{type:"button",title:"Widescreen Banner Preview (16:9 / 21:9)",onClick:()=>U("desktop"),className:`p-1.5 rounded-md text-xs transition-colors ${d==="desktop"?"bg-emerald-600 text-white shadow-sm":"text-white/70 hover:text-white"}`,children:e.jsx(bt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",title:"Mobile Card Preview (4:3)",onClick:()=>U("mobile"),className:`p-1.5 rounded-md text-xs transition-colors ${d==="mobile"?"bg-emerald-600 text-white shadow-sm":"text-white/70 hover:text-white"}`,children:e.jsx(St,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"absolute bottom-3 inset-x-3 flex flex-wrap items-center justify-between gap-2 z-10",children:[e.jsx("div",{className:"text-xs text-white/90 font-medium drop-shadow truncate max-w-[50%]",children:m||"Event Cover Image"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:M||Y,onClick:ce,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold shadow-md transition-all active:scale-95 disabled:opacity-50",title:"Edit and crop image to fit dimensions",children:[e.jsx(kt,{className:"w-3.5 h-3.5"}),"Edit & Crop"]}),e.jsxs("button",{type:"button",disabled:M||Y,onClick:()=>{var b;return(b=t.current)==null?void 0:b.click()},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-white/90 hover:bg-white text-gray-900 text-xs font-semibold shadow-md transition-all active:scale-95 disabled:opacity-50",children:[e.jsx(Oe,{className:"w-3.5 h-3.5 text-gray-700"}),"Replace"]}),e.jsxs("button",{type:"button",disabled:M||Y,onClick:v,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-xl bg-red-600/90 hover:bg-red-600 text-white text-xs font-semibold shadow-md transition-all active:scale-95 disabled:opacity-50",children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),"Remove"]})]})]})]}):e.jsxs("div",{className:"relative w-full h-full flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(os,{title:m,category:o,eventType:w,color:B,className:"absolute inset-0 w-full h-full opacity-60 pointer-events-none",showIcon:!1}),e.jsxs("div",{className:"relative z-10 flex flex-col items-center max-w-md mx-auto p-4 rounded-2xl bg-white/90 dark:bg-gray-900/90 backdrop-blur-md border border-gray-200/80 dark:border-gray-700/80 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-emerald-100 dark:bg-emerald-950/60 text-emerald-600 dark:text-emerald-400 flex items-center justify-center mb-3 shadow-inner",children:Y?e.jsx(Oe,{className:"w-6 h-6 animate-spin"}):e.jsx(st,{className:"w-6 h-6"})}),e.jsx("h4",{className:"text-sm font-bold text-gray-900 dark:text-white",children:j?"Drop Image Here to Upload":"Upload Event Cover Image"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Drag & drop or browse your files. Supported formats: JPEG, PNG, WebP, GIF, AVIF (Max 5MB)."}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-2",children:[e.jsxs("button",{type:"button",disabled:M||Y,onClick:()=>{var b;return(b=t.current)==null?void 0:b.click()},className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white text-xs font-semibold shadow-md shadow-emerald-600/20 transition-all active:scale-95 disabled:opacity-50",children:[e.jsx(st,{className:"w-3.5 h-3.5"}),"Choose Image"]}),e.jsxs("button",{type:"button",disabled:M||Y,onClick:()=>ie(!Q),className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-xl bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 text-xs font-semibold transition-all active:scale-95 disabled:opacity-50",children:[e.jsx(rs,{className:"w-3.5 h-3.5"}),"Paste URL"]})]})]})]}),Y&&e.jsxs("div",{className:"absolute inset-0 bg-black/75 backdrop-blur-sm z-30 flex flex-col items-center justify-center p-6 text-white text-center",children:[e.jsx(Oe,{className:"w-8 h-8 text-emerald-400 animate-spin mb
3-3"}),e.jsx("h5",{className:"text-sm font-bold",children:"Optimizing & Uploading Cover..."}),e.jsx("p",{className:"text-xs text-white/70 mt-1 max-w-xs",children:"Compressing image, generating previews, and securing on storage."}),e.jsx("div",{className:"w-48 h-2 bg-white/20 rounded-full overflow-hidden mt-3",children:e.jsx("div",{className:"h-full bg-emerald-500 transition-all duration-300 rounded-full",style:{width:`${a}%`}})}),e.jsxs("span",{className:"text-xs text-emerald-300 font-mono mt-1.5",children:[a,"%"]})]})]}),Q&&!me&&e.jsxs("form",{onSubmit:q,className:"p-4 rounded-xl border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/60 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"text-xs font-semibold text-gray-800 dark:text-gray-200 flex items-center gap-1.5",children:[e.jsx(rs,{className:"w-3.5 h-3.5 text-emerald-600"}),"Public Image Web Link (HTTPS)"]}),e.jsx("button",{type:"button",onClick:()=>ie(!1),className:"text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:"Cancel"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"url",placeholder:"https://images.unsplash.com/...",value:ne,onChange:b=>K(b.target.value),className:"flex-1 px-3 py-2 text-xs rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-emerald-500"}),e.jsx("button",{type:"submit",disabled:!ne.trim(),className:"px-4 py-2 rounded-lg bg-emerald-600 text-white text-xs font-semibold hover:bg-emerald-500 disabled:opacity-50",children:"Apply"})]})]}),x&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900/50 text-red-700 dark:text-red-400 text-xs",children:[e.jsx(Ce,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"font-semibold",children:"Upload Error: "}),x]})]}),J&&!x&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-900/50 text-amber-700 dark:text-amber-400 text-xs",children:[e.jsx(vs,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("span",{className:"font-semibold",children:"Recommendation: "}),J]})]}),F&&!x&&e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-xl bg-emerald-50 dark:bg-emerald-950/30 border border-emerald-200 dark:border-emerald-900/50 text-emerald-700 dark:text-emerald-400 text-xs font-medium",children:[e.jsx(ze,{className:"w-4 h-4 flex-shrink-0"}),e.jsx("span",{children:F})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-gray-50/80 dark:bg-gray-800/40 border border-gray-200 dark:border-gray-800 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"text-xs font-semibold text-gray-800 dark:text-gray-200 flex items-center gap-1.5",children:[e.jsx(We,{className:"w-3.5 h-3.5 text-emerald-600 dark:text-emerald-400"}),"Image Alternative Text (Accessibility)"]}),e.jsxs("button",{type:"button",onClick:H,className:"inline-flex items-center gap-1 text-[11px] font-semibold text-emerald-600 dark:text-emerald-400 hover:underline",children:[e.jsx(Ge,{className:"w-3 h-3"}),"Auto-generate"]})]}),e.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:"Describe the cover image for screen readers and search engines. Keep it descriptive yet concise."}),e.jsx("input",{type:"text",maxLength:250,placeholder:"e.g. Graphic banner announcing Global Tech Summit 2026 keynote speakers",value:Z,onChange:b=>S(b.target.value),onBlur:ee,disabled:M,className:"w-full px-3 py-2 text-xs rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:ring-2 focus:ring-emerald-500"}),e.jsxs("div",{className:"flex items-center justify-between text-[10px] text-gray-400",children:[e.jsxs("span",{children:["Recommended size: ",rr.label]}),e.jsxs("span",{children:[Z.length,"/250"]})]})]}),h&&re&&e.jsx(zr,{isOpen:h,onClose:()=>{R(!1),oe(null)},imageSource:re,onApply:T,initialAspect:"16:9"})]})},Er=[{value:"conference",label:"Conference",badge:"Multi-track & Speakers",description:"Summits & conventions with speaker rosters, multi-track agendas, and sponsors.",icon:qe,accentBorder:"border-purple-500/40",accentBg:"bg-purple-500/10",accentText:"text-purple-600 dar
3k:text-purple-400"},{value:"meetup",label:"Meetup",badge:"Community & Discussion",description:"Community gatherings, roundtables, networking, and peer-to-peer discussions.",icon:pe,accentBorder:"border-amber-500/40",accentBg:"bg-amber-500/10",accentText:"text-amber-600 dark:text-amber-400"},{value:"webinar",label:"Webinar",badge:"Virtual Presentation",description:"Online masterclasses, live broadcasts, demonstrations, and digital workshops.",icon:we,accentBorder:"border-blue-500/40",accentBg:"bg-blue-500/10",accentText:"text-blue-600 dark:text-blue-400"},{value:"in_person",label:"In-person event",badge:"Physical Venue",description:"On-site workshops, venue-based meetups, and local events requiring location.",icon:Ne,accentBorder:"border-emerald-500/40",accentBg:"bg-emerald-500/10",accentText:"text-emerald-600 dark:text-emerald-400"}],Fr=[{value:"conference",label:"Conference",icon:"🎤"},{value:"webinar",label:"Webinar",icon:"💻"},{value:"workshop",label:"Workshop / Training",icon:"🛠️"},{value:"meetup",label:"Community Meetup",icon:"🤝"},{value:"networking",label:"Networking Session",icon:"🌐"},{value:"interview",label:"Panel / Interview",icon:"🎙️"},{value:"work",label:"Work & Co-working",icon:"💼"},{value:"personal",label:"Social / Personal",icon:"🎉"},{value:"other",label:"General / Other",icon:"📌"}],Lr=[{value:"zoom",label:"Zoom Video"},{value:"google_meet",label:"Google Meet"},{value:"teams",label:"Microsoft Teams"},{value:"webex",label:"Cisco Webex"},{value:"youtube",label:"YouTube Live"},{value:"twitch",label:"Twitch Livestream"},{value:"webinar",label:"Custom Webinar Platform"},{value:"custom",label:"Direct Stream URL"}],Br=[{hex:"#10B981",label:"Emerald"},{hex:"#3B82F6",label:"Ocean Blue"},{hex:"#8B5CF6",label:"Purple"},{hex:"#EC4899",label:"Rose Pink"},{hex:"#F59E0B",label:"Amber"},{hex:"#06B6D4",label:"Cyan"},{hex:"#6366F1",label:"Indigo"},{hex:"#64748B",label:"Slate"}],hs=[{step:1,id:"basic-info",title:"Basic Info",subtitle:"Type & Overview",icon:Ge},{step:2,id:"date-time",title:"Date & Time",subtitle:"Schedule & Timezone",icon:Ye},{step:3,id:"location-format",title:"Location & Format",subtitle:"Venue or Virtual",icon:Ne},{step:4,id:"branding",title:"Branding",subtitle:"Cover Media & Theme",icon:ys},{step:5,id:"registration-capacity",title:"Registration & Capacity",subtitle:"Tickets & Pre-Publish",icon:pe}];function Vr({initialData:s,existingEvent:l,onSave:i,onPublish:m,onUnpublish:o,onCancelRequest:w,onCompleteRequest:B,onTogglePreview:$,onChange:u,onBack:M}){var k,ae,v,ce,T,q,H,ee,me,b,X,se,ve,Ae,Se,Te,De,Ze,Ie,Ee,Me,ws,ks,Cs,Ss,Ts,Ds,Ps,As,Ms,Us,Rs,$s,zs;const[j,z]=n.useState(1),[Y,g]=n.useState(new Set),[a,y]=n.useState(s),[x,N]=n.useState({}),[J,C]=n.useState(!1),[G,_]=n.useState(!1),[F,L]=n.useState("upload"),[Q,ie]=n.useState(!1);n.useRef(null),n.useEffect(()=>{y(s)},[s]);const ne=r=>{y(p=>{let f=p.format;r==="webinar"?f="virtual":r==="in_person"&&(f="in_person");const V={...p,eventType:r,format:f,category:r==="conference"?"conference":r==="webinar"?"webinar":r==="meetup"?"meetup":p.category==="conference"||p.category==="webinar"||p.category==="meetup"?"other":p.category};return u==null||u(V),V}),(x.eventType||x.venue||x.meetingUrl)&&N(p=>{const f={...p};return delete f.eventType,delete f.venue,delete f.meetingUrl,f})},K=(r,p)=>{y(f=>{const V={...f,conferenceConfig:{...f.conferenceConfig,[r]:p}};return u==null||u(V),V})},Z=(r,p)=>{y(f=>{const V={...f,meetupConfig:{...f.meetupConfig,[r]:p}};return u==null||u(V),V})},S=(r,p)=>{y(f=>{const V={...f,[r]:p};return u==null||u(V),V}),x[r]&&N(f=>{const V={...f};return delete V[r],V})},d=(r,p)=>{y(f=>{const V={...f,venue:{...f.venue,[r]:p}};return u==null||u(V),V}),x.venue&&N(f=>{const V={...f};return delete V.venue,V})},U=(r,p)=>{y(f=>{const V={...f,virtualDetails:{...f.virtualDetails,[r]:p}};return u==null||u(V),V}),x.meetingUrl&&N(f=>{const V={...f};return delete V.meetingUrl,V})},de=(r,p)=>{y(f=>{const V={...f,capacity:{...f.capacity,[r]:p}};return u==null||u(V),V})},W=(r,p)=>{y(f=>{const V={...f,registration:{...f.registration,[r]:p}};return u==null||u(V),V})};n.useEffect(()=>{const r=p=>{(p.metaKey||p.ctrlKey)&&p.key==="s"&&(p.preventDefault(),I())};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[a]);const h=n.useMemo(()=>{var p,f;let r=0;return a.title.trim().length>=3&&(r+=20),a.description.trim().length>=10&&(r+=20),a.startDate&&a.startTime&&(r+=20),(a.format==="virtual"?(p=a.virtualDetails)!=null&&p.meetingUrl:(f=a.venue)!=null&&f.name)&&(r+=20),(a.imageUrl||a.coverImageUrl)&&(r+=20),r},[a]),R=r=>{var f,V,Is,Es,Fs,Ls,Bs,Vs;const p={};if(r===1)!a.title||!a.title.trim()?p.title="Event title is required":a.title.trim().length<3&&(p.title="Title must be at least 3 characters"),a.eventType||(p.eventType="Please select an event type"),a.category||(p.category="Please select a category");else if(r===2){if(a.startDate||(p.startDate="Start date is required"),!a.startTime&&!a.allDay&&(p.startTime="Start time is required"),a.startDate&&a.endDate){const ye=a.allDay?`${a.startDate}T00:00:00`:`${a.startDate}T${a.startTime||"00:00"}`,Xe=a.allDay?`${a.endDate}T23:59:59`:`${a.endDate}T${a.endTime||"00:00"}`,Ke=new Date(ye),_s=new Date(Xe);isNaN(Ke.getTime())?p.startDate="Invalid start date format":isNaN(_s.getTime())?p.endDate="Invalid end date format":_s<=Ke&&(p.endDate="End time must be strictly after start time")}}else if(r===3)(a.format==="in_person"||a.format==="hybrid")&&((V=(f=a.venue)==null?void 0:f.name)!=null&&V.trim()||(p.venue="Venue name is required for in-person / hybrid events")),(a.format==="virtual"||a.format==="hybrid")&&(l==null?void 0:l.status)==="published"&&!((Es=(Is=a.virtualDetails)==null?void 0:Is.meetingUrl)!=null&&Es.trim())&&(p.meetingUrl="Meeting URL is required for published virtual events");else if(r===4)a.imageUrl&&!a.imageUrl.startsWith("http")&&!a.imageUrl.startsWith("data:image")&&(p.imageUrl="Image URL must be a valid HTTP URL or data image");else if(r===5){if(!((Fs=a.capacity)!=null&&Fs.isUnlimited)){const ye=Number((Ls=a.capacity)==null?void 0:Ls.maxAttendees);(!ye||ye<1)&&(p.maxAttendees="Max attendees must be at least 1")}if(!((Bs=a.registration)!=null&&Bs.isFree)){const ye=Number((Vs=a.registration)==null?void 0:Vs.price);(isNaN(ye)||ye<0)&&(p.price="Price must be a valid positive amount")}}if(Object.keys(p).length>0){N(Ke=>({...Ke,...p}));const ye=Object.keys(p)[0],Xe=document.getElementById(`field-${ye}`);return Xe&&Xe.scrollIntoView({behavior:"smooth",block:"center"}),le.error(p[ye]||"Please complete highlighted fields"),!1}return!0},re=()=>{R(j)&&(g(r=>new Set([...r,j])),j<5?(z(r=>r+1),window.scrollTo({top:0,behavior:"smooth"})):te())},oe=()=>{j>1&&(z(r=>r-1),window.scrollTo({top:0,behavior:"smooth"}))},t=r=>{if(r<j){z(r),window.scrollTo({top:0,behavior:"smooth"});return}for(let p=j;p<r;p++){if(!R(p))return;g(f=>new Set([...f,p]))}z(r),window.scrollTo({top:0,behavior:"smooth"})},I=async()=>{_(!0);try{const r=Ys(a,!0);if(Object.keys(r).length>0){N(r),le.error("Please resolve highlighted date issues before saving draft");return}await i(a,!0)}finally{_(!1)}},te=async()=>{const r=Ys(a,!1);if(Object.keys(r).length>0){N(r),le.error("Please complete all required fields before publishing");const p=Object.keys(r)[0],f=document.getElementById(`field-${p}`);f&&f.scrollIntoView({behavior:"smooth",block:"center"});return}C(!0);try{await i(a,!1)}finally{C(!1)}},c=l&&l.status==="published",P=((l==null?void 0:l.attendeesCount)||0)>0;return e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 space-y-6 pb-36 relative z-10",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 p-4 sm:p-6 rounded-2xl bg-card border border-border/80 shadow-xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(D,{variant:"ghost",size:"sm",onClick:M,className:"gap-1.5 text-muted-foreground hover:text-foreground h-9 px-3 rounded-xl",children:[e.jsx(Tt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Events Hub"})]}),e.jsx("div",{className:"h-4 w-px bg-border hidden sm:block"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-base sm:text-lg font-bold text-foreground truncate max-w-[200px] sm:max-w-md",children:l?`Edit: ${l.title}`:"Create New Event"}),l&&e.jsx(A,{variant:"outline",className:`text-xs capitalize ${l.status==="published"?"border-emerald-500 text-emerald-600 bg-emerald-500/10":l.status==="draft"?"border-amber-500 text-amber-600 bg-amber-500/10":"border-destructive text-destructive bg-destructive/10"}`,children:l.status})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5",children:[e.jsx("div",{className:"w-28 sm:w-36",children:e.jsx(Pe,{value:h,className:"h-1.5"})}),e.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground",children:[h,"% setup complete ",h===100?"🎉":""]})]})]})]}
3),e.jsxs("div",{className:"flex items-center gap-2 self-end sm:self-auto",children:[e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:()=>$(a),className:"gap-1.5 text-xs h-9 rounded-xl border-border hover:bg-muted",children:[e.jsx(We,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"hidden md:inline",children:"Live Preview"})]}),e.jsxs(D,{type:"button",variant:"secondary",size:"sm",onClick:I,disabled:G||J,className:"gap-1.5 text-xs h-9 rounded-xl",children:[e.jsx(tt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Save Draft"})]}),c&&o&&e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:async()=>{l!=null&&l.id&&(await o(l.id),M())},disabled:J||G,className:"gap-1.5 text-xs h-9 rounded-xl text-amber-600 hover:text-amber-700 hover:bg-amber-500/10 border-amber-500/30",children:[e.jsx(_e,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Unpublish"})]})]})]}),e.jsx("div",{className:"sticky top-20 z-20 bg-card/95 backdrop-blur-md border border-border/80 rounded-2xl p-3 sm:p-4 shadow-sm",children:e.jsx("div",{className:"grid grid-cols-5 gap-1 sm:gap-2",children:hs.map(r=>{const p=j===r.step,f=j>r.step||Y.has(r.step);return r.icon,e.jsxs("button",{type:"button",onClick:()=>t(r.step),className:`flex flex-col sm:flex-row items-center sm:items-start gap-1.5 sm:gap-2.5 p-2 sm:p-2.5 rounded-xl text-left transition-all cursor-pointer ${p?"bg-primary/10 border border-primary/40 shadow-xs":f?"hover:bg-muted/50 border border-transparent text-foreground":"opacity-60 border border-transparent hover:opacity-80"}`,children:[e.jsx("div",{className:`w-7 h-7 sm:w-8 sm:h-8 rounded-full flex items-center justify-center shrink-0 text-xs font-bold transition-all ${p?"bg-primary text-primary-foreground ring-2 ring-primary/30 ring-offset-1 ring-offset-background":f?"bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 border border-emerald-500/30":"bg-muted text-muted-foreground"}`,children:f&&!p?e.jsx(dt,{className:"h-3.5 w-3.5 stroke-[3]"}):r.step}),e.jsxs("div",{className:"min-w-0 hidden sm:block",children:[e.jsx("div",{className:"flex items-center gap-1.5",children:e.jsx("span",{className:`text-xs font-semibold truncate ${p?"text-primary":f?"text-foreground":"text-muted-foreground"}`,children:r.title})}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate leading-tight mt-0.5",children:r.subtitle})]})]},r.step)})})}),c&&P&&e.jsxs(Pt,{className:"border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-300",children:[e.jsx(Ce,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"}),e.jsxs(At,{className:"font-semibold text-sm",children:["Event is live with ",l==null?void 0:l.attendeesCount," registered attendee",((l==null?void 0:l.attendeesCount)||0)>1?"s":""]}),e.jsx(Mt,{className:"text-xs mt-1 text-amber-800 dark:text-amber-300/90",children:"Changes to date, time, or location will send an automated schedule update notice to all registered participants."})]}),j===1&&e.jsxs("section",{className:"bg-card rounded-2xl border border-border/80 p-5 sm:p-7 shadow-xs space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(Ge,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:"Basic Information & Event Type"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select your event type and provide essential details"})]})]}),e.jsx(A,{variant:"secondary",className:"text-xs font-medium",children:"Step 1 of 5"})]}),e.jsxs("div",{className:"space-y-3",id:"field-eventType",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(E,{className:"text-sm font-semibold text-foreground",children:["Event Type ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Choose type to tailor setup"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Er.map(r=>{const p=r.icon,f=a.eventType===r.value;return e.jsxs("button",{type:"button",onClick:()=>ne(r.value),className:`relative p-4 rounded-xl border text-left transition-all flex flex-col justify-between cursor-pointer space-y-3 ${f?`${r.accentBorder} ${r.accentBg} ring-2 ring-primary/30 shadow-md`:"border-border/80 bg-card hover:border-border hover:bg-muted/20 shadow-xs"}`,children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:`p-2.5 rounded-lg ${f?"bg-background shadow-xs text-primary":"bg-muted text-muted-foreground"}`,children:e.jsx(p,{className:"h-5 w-5"})}),f&&e.jsx("span",{className:"flex h-2 w-2 rounded-full bg-primary"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-foreground",children:r.label}),e.jsx(A,{variant:"outline",className:`mt-1 text-[10px] ${r.accentText}`,children:r.badge}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 leading-relaxed",children:r.description})]})]},r.value)})}),x.eventType&&e.jsx("p",{className:"text-xs text-destructive font-medium mt
3-1",children:x.eventType})]}),a.eventType==="conference"&&e.jsxs("div",{className:"p-4 sm:p-5 rounded-xl border border-purple-500/30 bg-purple-500/5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-600 dark:text-purple-400 font-semibold text-sm",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{children:"Conference Feature Setup"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-card border border-border",children:[e.jsxs("div",{className:"space-y-0.5 pr-2",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground",children:"Multi-Track Agendas"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Multiple simultaneous track schedules"})]}),e.jsx(je,{checked:((k=a.conferenceConfig)==null?void 0:k.enableTracks)??!0,onCheckedChange:r=>K("enableTracks",r)})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-card border border-border",children:[e.jsxs("div",{className:"space-y-0.5 pr-2",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground",children:"Speaker Roster"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Featured keynotes & bio profiles"})]}),e.jsx(je,{checked:((ae=a.conferenceConfig)==null?void 0:ae.enableSpeakers)??!0,onCheckedChange:r=>K("enableSpeakers",r)})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-card border border-border",children:[e.jsxs("div",{className:"space-y-0.5 pr-2",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground",children:"Sponsor Directory"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sponsor tiers and logo links"})]}),e.jsx(je,{checked:((v=a.conferenceConfig)==null?void 0:v.enableSponsors)??!0,onCheckedChange:r=>K("enableSponsors",r)})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-card border border-border",children:[e.jsxs("div",{className:"space-y-0.5 pr-2",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground",children:"Badge Scanning"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"QR code check-ins at sessions"})]}),e.jsx(je,{checked:((ce=a.conferenceConfig)==null?void 0:ce.enableBadgeScanning)??!0,onCheckedChange:r=>K("enableBadgeScanning",r)})]})]})]}),a.eventType==="meetup"&&e.jsxs("div",{className:"p-4 sm:p-5 rounded-xl border border-amber-500/30 bg-amber-500/5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-600 dark:text-amber-400 font-semibold text-sm",children:[e.jsx(pe,{className:"h-4 w-4"}),e.jsx("span",{children:"Meetup & Discussion Settings"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1.5 block",children:"Discussion Topic / Round Table Theme"}),e.jsx(xe,{placeholder:"e.g., Scaling Next.js Apps or Open Source Monetization",value:((T=a.meetupConfig)==null?void 0:T.discussionTopic)||"",onChange:r=>Z("discussionTopic",r.target.value),className:"h-11 rounded-xl bg-card"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1.5 block",children:"Networking Icebreaker Prompt"}),e.jsx(xe,{placeholder:"e.g., Share the biggest engineering challenge you solved this quarter",value:((q=a.meetupConfig)==null?void 0:q.networkingPrompt)||"",onChange:r=>Z("networkingPrompt",r.target.value),className:"h-11 rounded-xl bg-card"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",id:"field-title",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsxs(E,{htmlFor:"event-title",className:"text-sm font-semibold text-foreground",children:["Event Title ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[a.title.length,"/120"]})]}
3),e.jsx(xe,{id:"event-title",placeholder:"e.g., Global AI & Cloud Summit 2026",value:a.title,onChange:r=>S("title",r.target.value.slice(0,120)),className:`h-11 rounded-xl text-sm font-medium ${x.title?"border-destructive focus-visible:ring-destructive":""}`}),x.title&&e.jsx("p",{className:"text-xs text-destructive font-medium mt-1",children:x.title})]}),e.jsxs("div",{className:"space-y-1.5",id:"field-tagline",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsx(E,{htmlFor:"event-tagline",className:"text-sm font-semibold text-foreground",children:"Short Tagline"}),e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[a.tagline.length,"/180"]})]}),e.jsx(xe,{id:"event-tagline",placeholder:"A concise, compelling summary hook for social feeds & discovery cards",value:a.tagline,onChange:r=>S("tagline",r.target.value.slice(0,180)),className:"h-11 rounded-xl text-sm"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",id:"field-category",children:[e.jsxs(E,{className:"text-sm font-semibold text-foreground mb-1.5 block",children:["Category ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(he,{value:a.category,onValueChange:r=>S("category",r),children:[e.jsx(ge,{className:"h-11 rounded-xl text-sm",children:e.jsx(be,{placeholder:"Select Category"})}),e.jsx(fe,{className:"z-[60]",children:Fr.map(r=>e.jsxs(O,{value:r.value,className:"text-sm",children:[e.jsx("span",{className:"mr-2",children:r.icon})," ",r.label]},r.value))})]})]}),e.jsxs("div",{className:"space-y-1.5",id:"field-visibility",children:[e.jsx(E,{className:"text-sm font-semibold text-foreground mb-1.5 block",children:"Visibility"}),e.jsxs(he,{value:a.visibility,onValueChange:r=>S("visibility",r),children:[e.jsx(ge,{className:"h-11 rounded-xl text-sm",children:e.jsx(be,{placeholder:"Select Visibility"})}),e.jsxs(fe,{className:"z-[60]",children:[e.jsx(O,{value:"public",className:"text-sm",children:"🌐 Public (Visible in Search & Community Feeds)"}),e.jsx(O,{value:"unlisted",className:"text-sm",children:"🔒 Unlisted (Only accessible via direct link)"}),e.jsx(O,{value:"private",className:"text-sm",children:"🛡️ Private (Invite-only members)"})]})]})]})]}),e.jsxs("div",{className:"space-y-1.5",id:"field-description",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1.5",children:[e.jsx(E,{htmlFor:"event-description",className:"text-sm font-semibold text-foreground",children:"Detailed Event Description"}),e.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[a.description.length,"/3000"]})]}),e.jsx(yt,{id:"event-description",rows:5,placeholder:"Detail the agenda, keynote speakers, target audience, and key takeaways...",value:a.description,onChange:r=>S("description",r.target.value.slice(0,3e3)),className:"rounded-xl text-sm leading-relaxed min-h-[120px]"})]})]}),j===2&&e.jsxs("section",{className:"bg-card rounded-2xl border border-border/80 p-5 sm:p-7 shadow-xs space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(Ye,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:"Date, Time & Timezone"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure your event schedule and multi-region timezone synchronization"})]})]}),e.jsx(A,{variant:"secondary",className:"text-xs font-medium",children:"Step 2 of 5"})]}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border bg-muted/20",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"all-day-switch",className:"text-sm font-semibold text-foreground cursor-pointer",children:"All-Day Event"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Event runs for entire calendar day without specific start/end hour"})]}),e.jsx(je,{id:"all-day-switch",checked:a.allDay,onCheckedChange:r=>S("allDay",r)}
3)]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-3",children:[e.jsxs(E,{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Start Schedule ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",id:"field-startDate",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Date"}),e.jsx(xe,{type:"date",value:a.startDate,onChange:r=>S("startDate",r.target.value),className:`h-11 rounded-xl text-sm ${x.startDate?"border-destructive focus-visible:ring-destructive":""}`})]}),!a.allDay&&e.jsxs("div",{className:"space-y-1",id:"field-startTime",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Time"}),e.jsx(xe,{type:"time",value:a.startTime,onChange:r=>S("startTime",r.target.value),className:`h-11 rounded-xl text-sm ${x.startTime?"border-destructive focus-visible:ring-destructive":""}`})]})]}),x.startDate&&e.jsx("p",{className:"text-xs text-destructive font-medium",children:x.startDate}),x.startTime&&e.jsx("p",{className:"text-xs text-destructive font-medium",children:x.startTime})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-3",children:[e.jsxs(E,{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["End Schedule ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",id:"field-endDate",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Date"}),e.jsx(xe,{type:"date",value:a.endDate,onChange:r=>S("endDate",r.target.value),className:`h-11 rounded-xl text-sm ${x.endDate?"border-destructive focus-visible:ring-destructive":""}`})]}),!a.allDay&&e.jsxs("div",{className:"space-y-1",id:"field-endTime",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Time"}),e.jsx(xe,{type:"time",value:a.endTime,onChange:r=>S("endTime",r.target.value),className:"h-11 rounded-xl text-sm"})]})]}),x.endDate&&e.jsx("p",{className:"text-xs text-destructive font-medium",children:x.endDate})]})]}),e.jsxs("div",{className:"space-y-2",id:"field-timezone",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs(E,{htmlFor:"event-timezone",className:"text-sm font-semibold text-foreground",children:["Event Timezone ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{variant:"outline",className:"text-[11px] bg-primary/5 text-primary border-primary/20",children:Ft(a.timezone||"UTC")}),ct(new Date,a.timezone||"UTC")&&e.jsx(A,{variant:"secondary",className:"text-[10px] bg-amber-500/10 text-amber-600",children:"DST Active"})]})]}),e.jsxs(he,{value:a.timezone,onValueChange:r=>S("timezone",r),children:[e.jsx(ge,{id:"event-timezone",className:"h-11 rounded-xl text-sm",children:e.jsx(be,{placeholder:"Select Timezone"})}),e.jsx(fe,{className:"max-h-60 z-[60]",children:Lt.map(r=>e.jsx(O,{value:r.name,className:"text-sm",children:e.jsxs("div",{className:"flex items-center justify-between w-full gap-4",children:[e.jsx("span",{children:r.label}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:r.offset})]})},r.name))})]})]}),a.startDate&&e.jsxs("div",{className:"p-4 rounded-xl border border-primary/20 bg-primary/5 flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary shrink-0 mt-0.5",children:e.jsx(cs,{className:"h-4 w-4"})}),e.jsxs("div",{className:"space-y-0.5 text-xs",children:[e.jsx("span",{className:"font-semibold text-foreground",children:"Schedule Confirmation"}),e.jsxs("p",{className:"text-muted-foreground leading-relaxed",children:[a.startDate," ",!a.allDay&&a.startTime?`@ ${a.startTime}`:" (All Day)"," ",a.endDate&&a.endDate!==a.startDate?`until ${a.endDate}`:""," ",!a.allDay&&a.endTime?`- ${a.endTime}`:""," [",a.timezone,"]"]})]})]})]}),j===3&&e.jsxs("section",{className:"bg-card rounded-2xl border border-border/80 p-5 sm:p-7 shadow-xs space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(Ne,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:"Location & Event Format"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Specify physical venue details, live stream links, or hybrid access"})]})]}),e.jsx(A,{variant:"secondary",className:"text-xs font-medium",children:"Step 3 of 5"})]}),e.jsxs("div",{className:"space-y-3",id:"field-format",children:[e.jsxs(E,{className:"text-sm font-semibold text-foreground",children:["Delivery Format ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>S("format","in_person"),className:`p-4 rounded-xl border text-left transition-all flex items-center gap-3 cursor-pointer ${a.format==="in_person"?"border-emerald-500 bg-emerald-500/10 ring-2 ring-emerald-500/20 shadow-xs":"border-border/80 bg-card hover:bg-muted/20"}`,children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 shrink-0",children:e.jsx(Ne,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-foreground",children:"In-Person"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Physical on-site venue"})]})]}),e.jsxs("button",{type:"button",onClick:()=>S("format","virtual"),className:`p-4 rounded-xl border text-left transition-all flex items-center gap-3 cursor-pointer ${a.format==="virtual"?"border-blue-500 bg-blue-500/10 ring-2 ring-blue-500/20 shadow-xs":"border-border/80 bg-card hover:bg-muted/20"}`,children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-blue-500/10 text-blue-600 dar
3k:text-blue-400 shrink-0",children:e.jsx(we,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-foreground",children:"Virtual"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Live stream / meeting URL"})]})]}),e.jsxs("button",{type:"button",onClick:()=>S("format","hybrid"),className:`p-4 rounded-xl border text-left transition-all flex items-center gap-3 cursor-pointer ${a.format==="hybrid"?"border-purple-500 bg-purple-500/10 ring-2 ring-purple-500/20 shadow-xs":"border-border/80 bg-card hover:bg-muted/20"}`,children:[e.jsx("div",{className:"p-2.5 rounded-lg bg-purple-500/10 text-purple-600 dark:text-purple-400 shrink-0",children:e.jsx(He,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-bold text-foreground",children:"Hybrid"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Venue + live stream link"})]})]})]})]}),(a.format==="in_person"||a.format==="hybrid")&&e.jsxs("div",{className:"p-5 rounded-xl border border-border bg-card space-y-4",id:"field-venue",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground font-semibold text-sm",children:[e.jsx(Ne,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}),e.jsx("span",{children:"Physical Venue Address"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsxs(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:["Venue Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(xe,{placeholder:"e.g., Moscone Center, Hall B",value:((H=a.venue)==null?void 0:H.name)||"",onChange:r=>d("name",r.target.value),className:`h-11 rounded-xl text-sm ${x.venue?"border-destructive focus-visible:ring-destructive":""}`}),x.venue&&e.jsx("p",{className:"text-xs text-destructive font-medium mt-1",children:x.venue})]}),e.jsxs("div",{className:"space-y-1.5 sm:col-span-2",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Street Address"}),e.jsx(xe,{placeholder:"e.g., 747 Howard St",value:((ee=a.venue)==null?void 0:ee.address)||"",onChange:r=>d("address",r.target.value),className:"h-11 rounded-xl text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"City"}),e.jsx(xe,{placeholder:"e.g., San Francisco",value:((me=a.venue)==null?void 0:me.city)||"",onChange:r=>d("city",r.target.value),className:"h-11 rounded-xl text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"State / Province"}),e.jsx(xe,{placeholder:"e.g., CA",value:((b=a.venue)==null?void 0:b.state)||"",onChange:r=>d("state",r.target.value),className:"h-11 rounded-xl text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Postal Code"}),e.jsx(xe,{placeholder:"e.g., 94103",value:((X=a.venue)==null?void 0:X.postalCode)||"",onChange:r=>d("postalCode",r.target.value),className:"h-11 rounded-xl text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Directions / Maps URL"}),e.jsx(xe,{placeholder:"https://maps.google.com/...",value:((se=a.venue)==null?void 0:se.directionsUrl)||"",onChange:r=>d("directionsUrl",r.target.value),className:"h-11 rounded-xl text-sm"})]})]})]}),(a.format==="virtual"||a.format==="hybrid")&&e.jsxs("div",{className:"p-5 rounded-xl border border-border bg-card space-y-4",id:"field-meetingUrl",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground font-semibold text-sm",children:[e.jsx(we,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),e.jsx("span",{children:"Virtual Meeting & Live Stream Access"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Platform"}),e.jsxs(he,{value:((ve=a.virtualDetails)==null?void 0:ve.platform)||"zoom",onValueChange:r=>U("platform",r),children:[e.jsx(ge,{className:"h-11 rounded-xl text-sm",children:e.jsx(be,{placeholder:"Select Platform"})}),e.jsx(fe,{className:"z-[60]",children:Lr.map(r=>e.jsx(O,{value:r.value,className:"text-sm",children:r.label},r.value))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Meeting / Stream URL"}),e.jsx(xe,{placeholder:"https://zoom.us/j/... or https://meet.google.com/...",value:((Ae=a.virtualDetails)==null?void 0:Ae.meetingUrl)||"",onChange:r=>U("meetingUrl",r.target.value),className:`h-11 rounded-xl text-sm ${x.meetingUrl?"border-destructive focus-visible:ring-destructive":""}`}),x.meetingUrl&&e.jsx("p",{className:"text-xs text-destructive font-medium mt
3-1",children:x.meetingUrl})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Meeting ID (Optional)"}),e.jsx(xe,{placeholder:"e.g., 891 2345 6789",value:((Se=a.virtualDetails)==null?void 0:Se.meetingId)||"",onChange:r=>U("meetingId",r.target.value),className:"h-11 rounded-xl text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Passcode (Optional)"}),e.jsx(xe,{placeholder:"e.g., 2026",value:((Te=a.virtualDetails)==null?void 0:Te.passcode)||"",onChange:r=>U("passcode",r.target.value),className:"h-11 rounded-xl text-sm"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"hide-link-switch",className:"text-xs font-semibold text-foreground cursor-pointer",children:"Gate Meeting Link Behind Registration"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Only registered and approved attendees will view the direct joining link"})]}),e.jsx(je,{id:"hide-link-switch",checked:((De=a.virtualDetails)==null?void 0:De.hideLinkUntilRegistration)??!0,onCheckedChange:r=>U("hideLinkUntilRegistration",r)})]})]})]}),j===4&&e.jsxs("section",{className:"bg-card rounded-2xl border border-border/80 p-5 sm:p-7 shadow-xs space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(ys,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:"Branding & Cover Media"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload responsive hero banners and choose your brand accent palette"})]})]}),e.jsx(A,{variant:"secondary",className:"text-xs font-medium",children:"Step 4 of 5"})]}),e.jsxs("div",{className:"space-y-3",id:"field-imageUrl",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(E,{className:"text-sm font-semibold text-foreground",children:"Event Cover Banner"}),e.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-border bg-muted/40 p-0.5 text-xs",children:[e.jsx("button",{type:"button",onClick:()=>L("upload"),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${F==="upload"?"bg-card text-foreground shadow-xs":"text-muted-foreground"}`,children:"Upload File"}),e.jsx("button",{type:"button",onClick:()=>L("url"),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors ${F==="url"?"bg-card text-foreground shadow-xs":"text-muted-foreground"}`,children:"Image URL"})]})]}),F==="upload"?e.jsx(Ir,{currentImageUrl:a.imageUrl||a.coverImageUrl,onImageChange:r=>S("imageUrl",r),aspectRatio:"16:9"}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(xe,{placeholder:"https://images.unsplash.com/photo-...",value:a.imageUrl,onChange:r=>S("imageUrl",r.target.value),className:"h-11 rounded-xl text-sm"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Paste a direct HTTPS link to a high-resolution PNG, JPG, or WebP graphic."})]}),x.imageUrl&&e.jsx("p",{className:"text-xs text-destructive font-medium",children:x.imageUrl})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{className:"text-sm font-semibold text-foreground",children:"Event Accent Color Theme"}),e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:Br.map(r=>{const p=a.color===r.hex;return e.jsxs("button",{type:"button",onClick:()=>S("color",r.hex),className:`group flex items-center gap-2 px-3 py-2 rounded-xl border text-xs font-medium transition-all cursor-pointer ${p?"border-primary ring-2 ring-primary/20 bg-primary/5 text-foreground":"border-border/80 bg-card hover:bg-muted/30 text-muted-foreground"}`,children:[e.jsx("span",{style:{backgroundColor:r.hex},className:"w-4 h-4 rounded-full shrink-0 shadow-xs"}),e.jsx("span",{children:r.label})]},r.hex)})})]}),e.jsxs("div",{className:"space-y-2 pt-2 border-t border-border",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Cover Preview"}),e.jsx("div",{className:"rounded-xl overflow-hidden border border-border aspect-21/9 relative bg-muted",children:a.imageUrl?e.jsx("img",{src:a.imageUrl,alt:a.title||"Event Cover",className:"w-full h-full object-cover"}):e.jsx(os,{title:a.title||"Your Event Title",category:a.category,eventType:a.eventType,color:a.color})})]})]}),j===5&&e.jsxs("section",{className:"bg-card rounded-2xl border border-border/80 p-5 sm:p-7 shadow-xs space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"p-2 rounded-lg bg-primary/10 text-primary",children:e.jsx(pe,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-bold text-foreground",children:"Registration, Capacity & Pre-Publish Review"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure attendee limits, ticket pricing, and review complete details"})]})]}),e.jsx(A,{variant:"secondary",className:"text-xs font-medium",children:"Step 5 of 5"})]}),e.jsxs("div",{className:"p-5 rounded-xl border border-border bg-card space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"unlimited-capacity",className:"text-sm font-semibold text-foreground cursor-pointer",children:"Unlimited Attendee Capacity"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow unrestricted registrations without attendee ceiling"})]}),e.jsx(je,{id:"unlimited-capacity",checked:((Ze=a.capacity)==null?void 0:Ze.isUnlimited)??!0,onCheckedChange:r=>de("isUnlimited",r)})]}),!((Ie=a.capacity)!=null&&Ie.isUnlimited)&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 pt-3 border-t border-border",id:"field-maxAttendees",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:["Maximum Attendees ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(xe,{type:"number",min:"1",max:"100000",placeholder:"e.g., 250",value:((Ee=a.capacity)==null?void 0:Ee.maxAttendees)||50,onChange:r=>de("maxAttendees",parseInt(r.target.value)||0),className:`h-11 rounded-xl text-sm ${x.maxAttendees?"border-destructive focus-visible:ring-destructive":""}`}),x.maxAttendees&&e.jsx("p",{className:"text-xs text-destructive font-medium mt
3-1",children:x.maxAttendees})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-border bg-muted/20 self-end h-11",children:[e.jsxs("div",{className:"space-y-0.5 pr-2",children:[e.jsx(E,{htmlFor:"waitlist-toggle",className:"text-xs font-semibold text-foreground cursor-pointer",children:"Enable Waitlist"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Queue attendees if sold out"})]}),e.jsx(je,{id:"waitlist-toggle",checked:((Me=a.capacity)==null?void 0:Me.waitlistEnabled)??!0,onCheckedChange:r=>de("waitlistEnabled",r)})]})]})]}),e.jsxs("div",{className:"p-5 rounded-xl border border-border bg-card space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"reg-required-toggle",className:"text-sm font-semibold text-foreground cursor-pointer",children:"Registration Required"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Attendees must RSVP or purchase tickets to access the event"})]}),e.jsx(je,{id:"reg-required-toggle",checked:((ws=a.registration)==null?void 0:ws.required)??!0,onCheckedChange:r=>W("required",r)})]}),((ks=a.registration)==null?void 0:ks.required)&&e.jsxs("div",{className:"space-y-4 pt-3 border-t border-border",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-xl border border-border bg-muted/10",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"free-ticket-toggle",className:"text-sm font-semibold text-foreground cursor-pointer",children:"Free Admission Event"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Zero ticket cost for community attendees"})]}),e.jsx(je,{id:"free-ticket-toggle",checked:((Cs=a.registration)==null?void 0:Cs.isFree)??!0,onCheckedChange:r=>W("isFree",r)})]}),!((Ss=a.registration)!=null&&Ss.isFree)&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",id:"field-price",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:["Ticket Price ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(gt,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(xe,{type:"number",step:"0.01",min:"0",placeholder:"49.00",value:((Ts=a.registration)==null?void 0:Ts.price)||"",onChange:r=>W("price",parseFloat(r.target.value)||0),className:"pl-9 h-11 rounded-xl text-sm"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(E,{className:"text-xs font-semibold text-foreground mb-1 block",children:"Currency"}),e.jsxs(he,{value:((Ds=a.registration)==null?void 0:Ds.currency)||"USD",onValueChange:r=>W("currency",r),children:[e.jsx(ge,{className:"h-11 rounded-xl text-sm",children:e.jsx(be,{placeholder:"USD"})}),e.jsxs(fe,{className:"z-[60]",children:[e.jsx(O,{value:"USD",children:"USD ($)"}),e.jsx(O,{value:"EUR",children:"EUR (€)"}),e.jsx(O,{value:"GBP",children:"GBP (£)"}),e.jsx(O,{value:"CAD",children:"CAD ($)"}),e.jsx(O,{value:"AUD",children:"AUD ($)"}),e.jsx(O,{value:"INR",children:"INR (₹)"})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-border bg-muted/20",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(E,{htmlFor:"approval-switch",className:"text-xs font-semibold text-foreground cursor-pointer",children:"Require Organizer Approval"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Manually vet and approve attendees before issuing tickets"})]}),e.jsx(je,{id:"approval-switch",checked:((Ps=a.registration)==null?void 0:Ps.requireApproval)??!1,onCheckedChange:r=>W("requireApproval",r)})]})]})]}),e.jsxs("div",{className:"p-5 rounded-2xl border border-primary/30 bg-primary/5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary font-bold text-sm",children:[e.jsx(mr,{className:"h-5 w-5"}),e.jsx("span",{children:"Pre-Publish Verification Summary"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 text-xs",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Event Title"}),e.jsx("p",{className:"font-bold text-foreground truncate",children:a.title||"Untitled"})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Type & Category"}),e.jsxs("p",{className:"font-bold text-foreground capitalize",children:[a.eventType," (",a.category,")"]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Schedule"}),e.jsxs("p",{className:"font-bold text-foreground truncate",children:[a.startDate," ",a.startTime&&`@ ${a.startTime}`]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Format & Venue"}),e.jsxs("p",{className:"font-bold text-foreground capitalize truncate",children:[a.format,": ",a.format==="virtual"?"Online":((As=a.venue)==null?void 0:As.name)||"Unset"]})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Capacity"}),e.jsx("p",{className:"font-bold text-foreground",children:(Ms=a.capacity)!=null&&Ms.isUnlimited?"Unlimited":`${(Us=a.capacity)==null?void 0:Us.maxAttendees} Max Spots`})]}),e.jsxs("div",{className:"p-3 rounded-xl bg-card border border-border space-y-1",children:[e.jsx("span",{className:"text-muted-foreground font-medium",children:"Admission"}),e.jsx("p",{className:"font-bold text-foreground",children:(Rs=a.registration)!=null&&Rs.isFree?"Free Admission":`$${($s=a.registration)==null?void 0:$s.price} ${(zs=a.registration)==null?void 0:zs.currency}`})]})]})]})]}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-30 bg-card/95 backdrop-blur-md border-t border-border shadow-[0_-4px_20px_rgba(0,0,0,0.15)] py-3 px-4 sm:px-8",children:e.jsxs("div",{className:"max-w-5xl mx-auto flex items-center justify-between gap-4",children:[e.jsxs(D,{type:"button",variant:"ghost",onClick:oe,disabled:j===1,className:"gap-2 h-11 px-4 sm:px-5 rounded-xl text-muted-foreground hover:text-foreground disabled:opacity-30",children:[e.jsx(Nt,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Previous"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs font-semibold text-muted-foreground hidden md:inline",children:["Step ",j," of 5: ",e.jsx("strong",{className:"text-foreground",children:hs[j-1].title})]}),e.jsxs(D,{type:"button",variant:"outline",size:"sm",onClick:I,disabled:G||J,className:"gap-1.5 h-11 px-4 roun
3ded-xl border-border hover:bg-muted text-xs font-medium",title:"Save in-progress changes without publishing",children:[e.jsx(tt,{className:"h-4 w-4"}),e.jsx("span",{children:"Save Draft"}),e.jsx("kbd",{className:"hidden lg:inline-block ml-1 text-[10px] px-1.5 py-0.5 rounded bg-muted-foreground/10 border border-border text-muted-foreground font-mono",children:"Ctrl+S"})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:j<5?e.jsxs(D,{type:"button",onClick:re,className:"gap-2 h-11 px-5 sm:px-6 rounded-xl bg-primary text-primary-foreground shadow-[0_0_15px_hsl(var(--primary)/0.3)] hover:shadow-[0_0_25px_hsl(var(--primary)/0.5)] font-semibold transition-all",children:[e.jsxs("span",{className:"hidden sm:inline",children:["Continue to ",hs[j].title]}),e.jsx("span",{className:"sm:hidden",children:"Next"}),e.jsx(vt,{className:"h-4 w-4"})]}):e.jsx(D,{type:"button",onClick:te,disabled:J||G,className:"gap-2 h-11 px-6 sm:px-8 rounded-xl bg-primary text-primary-foreground shadow-[0_0_20px_hsl(var(--primary)/0.4)] hover:shadow-[0_0_30px_hsl(var(--primary)/0.6)] font-bold transition-all",children:J?"Saving...":c?e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4"})," Save Changes"]}):e.jsxs(e.Fragment,{children:[e.jsx(bs,{className:"h-4 w-4"})," Publish Event"]})})})]})})]})}function _r({formData:s,existingEvent:l,onBackToEdit:i,onPublish:m,isPublishing:o}){var Q,ie,ne,K,Z,S,d;const[w,B]=n.useState("desktop"),[$,u]=n.useState(!1),[M,j]=n.useState(!1),z=s.startDate?s.allDay?`${s.startDate}T00:00:00`:`${s.startDate}T${s.startTime||"00:00"}:00`:new Date().toISOString(),Y=s.endDate?s.allDay?`${s.endDate}T23:59:59`:`${s.endDate}T${s.endTime||"23:59"}:00`:z,g=Bt(),a=Vt({startsAt:z,endsAt:Y,allDay:s.allDay,timezone:s.timezone||g,viewerTimezone:g}),y=ct(z,s.timezone||g),x=(l==null?void 0:l.attendeesCount)||($?1:0),N={id:(l==null?void 0:l.id)||"preview-event",title:s.title,description:s.description,location:((Q=s.venue)==null?void 0:Q.name)||((ie=s.venue)==null?void 0:ie.address)||"",startsAt:z,endsAt:Y,timezone:s.timezone||g,status:s.status,allDay:s.allDay,eventType:s.eventType,category:s.category,visibility:s.visibility,format:s.format,imageUrl:s.imageUrl,color:s.color,venue:s.venue,virtualDetails:s.virtualDetails,capacity:s.capacity,registration:s.registration,attendeesCount:x,attendees:Array.from({length:x},(U,de)=>`attendee-${de}`),cancellationReason:(l==null?void 0:l.cancellationReason)||"",cancelledAt:l==null?void 0:l.cancelledAt,creator:(l==null?void 0:l.creator)||null},J=gs(N),C=ot(J.status),G=()=>{switch(s.eventType){case"conference":return e.jsxs(A,{className:"bg-purple-600/90 text-white gap-1 text-[11px] border-purple-500/30",children:[e.jsx(qe,{className:"h-3 w-3"})," Conference"]});case"meetup":return e.jsxs(A,{className:"bg-amber-600/90 text-white gap-1 text-[11px] border-amber-500/30",children:[e.jsx(pe,{className:"h-3 w-3"})," Meetup"]});case"webinar":return e.jsxs(A,{className:"bg-blue-600/90 text-white gap-1 text-[11px] border-blue-500/30",children:[e.jsx(we,{className:"h-3 w-3"})," Webinar"]});case"in_person":default:return e.jsxs(A,{className:"bg-emerald-600/90 text-white gap-1 text-[11px] border-emerald-500/30",children:[e.jsx(Ne,{className:"h-3 w-3"})," In-person"]})}},_=()=>{switch(s.format){case"virtual":return e.jsxs(A,{className:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 hover:bg-blue-500/20 gap-1",children:[e.jsx(we,{className:"h-3 w-3"})," Virtual Event"]});case"hybrid":return e.jsxs(A,{className:"bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/20 hover:bg-purple-500/20 gap-1",children:[e.jsx(He,{className:"h-3 w-3"})," Hybrid (In-Person + Online)"]});case"in_person":default:return e.jsxs(A,{className:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20 hover:bg-emerald-500/20 gap-1",children:[e.jsx(Ne,{className:"h-3 w-3"})," In-Person Event"]})}},F=()=>{switch(s.status){case"draft":return e.jsx(A,{variant:"secondary",className:"bg-muted text-muted-foreground",children:"Draft Preview"});case"cancelled":return e.jsx(A,{variant:"destructive",children:"Cancelled"});case"completed":return e.jsx(A,{className:"bg-blue-600 text-white",children:"Completed"});case"published":default:return e.jsx(A,{className:"bg-emerald-600 text-white",children:"Live / Published"})}},L=()=>{var U;(U=navigator.clipboard)==null||U.writeText(window.location.href),le.success("Event link copied to clipboard (Simulated)")};return e.jsxs("div",{className:"flex flex-col min-h-screen bg-muted/30",children:[e.jsxs("header",{className:"sticky top-0 z-30 flex items-center justify-between px-4 py-3 bg-card border-b border-border shadow-xs",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[i&&e.jsxs(D,{variant:"ghost",size:"sm",onClick:i,className:"gap-1 text-muted-foreground hover:text-foreground",children:[e.jsx(Tt,{className:"h-4 w-4"})," Back to Editor"]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsx(A,{variant:"outline",className:"bg-primary/5 text-primary border-primary/20",children:"Live Attendee Preview"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Simulating attendee view across devices"})]})]}),e.jsxs("div",{className:"flex items-center gap-1 bg-muted p-1 rounded-lg border border-border",children:[e.jsxs(D,{type:"button",variant:w==="desktop"?"secondary":"ghost",size:"sm",onClick:()=>B("desktop"),className:"h-8 px-2.5 gap-1.5 text-xs",title:"Desktop View",children:[e.jsx(bt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"Desktop"})]}),e.jsxs(D,{type:"button",variant:w==="tablet"?"secondary":"ghost",size:"sm",onClick:()=>B("tablet"),className:"h-8 px-2.5 gap-1.5 text-xs",title:"Tablet View (768px)",children:[e.jsx(Kt,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"Tablet"})]}),e.jsxs(D,{type:"button",variant:w==="mobile"?"secondary":"ghost",size:"sm",onClick:()=>B("mobile"),className:"h-8 px-2.5 gap-1.5 text-xs",title:"Mobile View (375px)",children:[e.jsx(St,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden md:inline",children:"Mobile"})]})]}),m&&s.status==="draft"&&e.jsx(D,{size:"sm",onClick:m,disabled:o,className:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",children:o?"Publishing...":"Publish Event"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3 sm:p-6 flex justify-center items-start",children:e.jsxs("div",{className:`transition-all duration-300 w-full ${w==="mobile"?"max-w-[400px] border border-border rounded-2xl shadow-xl overflow-hidden bg-background my-4":w==="tablet"?"max-w-[768px] border border-border rounded-2xl shadow-lg overflow-hidden bg-background my-4":"max-w-4xl bg-background rounded-xl border border-border shadow-sm"}`,children:[e.jsxs("div",{className:"relative aspect-video sm:aspect-21/9 w-full overflow-hidden bg-muted",children:[s.imageUrl&&!M?e.jsx("img",{src:s.imageUrl,alt:s.imageAlt||s.coverImageAlt||`Cover banner for ${s.title||"event"}`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover",onError:()=>j(!0)}):e.jsx(os,{title:s.title,category:s.category,eventType:s.eventType,color:s.color,alt:s.imageAlt||s.coverImageAlt,className:"w-full h-full",showIcon:!0}),e.jsxs("div",{className:"absolute top-3 left-3 right-3 flex items-center justify-between gap-2 pointer-events-none",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[F(),e.jsx(A,{className:`${C.bg} ${C.text} ${C.border} gap-1 text-[11px]`,children:J.badgeText}),G(),_()]}),e.jsx(A,{variant:"secondary",className:"backdrop-blur-md bg-background/80 text-xs capitalize",children:s.category})]})]}),e.jsxs("div",{className:"p-4 sm:p-8 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight text-foreground",children:s.title||"Untitled Event"}),s.tagline&&e.jsx("p",{className:"text-base sm:text-lg text-muted-foreground",children:s.tagline})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3.5 rounded-xl bg-muted/40 border border-border/60",children:[e.jsxs(mt,{className:"h-11 w-11 border border-border",children:[e.jsx(xt,{src:(ne=l==null?void 0:l.creator)==null?void 0:ne.avatarUrl}),e.jsx(ut,{className:"bg-primary/10 text-primary font-semibold",children:((Z=(K=l==null?void 0:l.creator)==null?void 0:K.firstName)==null?void 0:Z[0])||"O"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-sm text-foreground",children:l!=null&&l.creator?`${l.creator.firstName} ${l.creator.lastName}`:"Event Organizer"}),e.jsx(ze,{className:"h-3.5 w-3.5 text-primary fill-primary/20"})]}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:((S=l==null?void 0:l.creator)==null?void 0:S.headline)||"Organizer & Host"})]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:L,className:"h-8 gap-1.5 text-xs shrink-0",children:[e.jsx(xr,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Share"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary font-medium text-sm",children:[e.jsx(Ye,{className:"h-4 w-4"}),e.jsx("span",{children:"Date & Schedule"})]}),y&&e.jsx(A,{variant:"outline",className:"text-[10px] bg-amber-500/10 text-amber-700 dark:text-amber-300 border-amber-300",children:"DST Active"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-semibold text-foreground text-sm",children:a.eventTz.fullDisplay}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),e.jsxs("span",{children:["Original Event Timezone: ",e.jsx("span",{className:"font-medium text-foreground",children:s.timezone||"UTC"})]})]})]}),a.isDifferentTimezone&&e.jsxs("div",{className:"p-2.5 rounded-lg bg-muted/50 border border-border/70 text-xs space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-foreground",children:[e.jsx(cs,{className:"h-3.5 w-3.5 text-primary"}),e.jsxs("span",{children:["Your Local Time (",a.viewerTz.timezone,")"]})]}),e.jsx("p",{className:"text-muted-foreground",children:a.viewerTz.fullDisplay})]})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-primary font-medium text-sm",children:[s.format==="virtual"?e.jsx(we,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"}),e.jsx("span",{children:s.format==="virtual"?"Virtual Event Access":s.format==="hybrid"?"Hybrid (In-Person & Virtual)":"Physical Venue Location"})]}),s.format!=="virtual"&&e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsxs("div",{className:"font-semibold text-foreground text-sm flex items-center gap-1.5",children:[e.jsx(Ne,{className:"h-4 w-4 text-emerald-600 shrink-0"}),e.jsx("span",{children:s.venue.name||"Venue to be announced"}),s.venue.room&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",s.venue.room,")"]})]}),s.venue.address&&e.jsx("p",{className:"text-muted-foreground pl-5",children:s.venue.address}),(s.venue.city||s.venue.state||s.venue.country||s.venue.postalCode)&&e.jsxs("p",{className:"text-muted-foreground pl-5 font-medium",children:[[s.venue.city,s.venue.state,s.venue.postalCode].filter(
3Boolean).join(", "),s.venue.country?` ${s.venue.country}`:""]}),s.venue.directionsUrl&&e.jsx("div",{className:"pl-5 pt-1",children:e.jsxs("a",{href:s.venue.directionsUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline font-medium",children:[e.jsx(Os,{className:"h-3 w-3"})," View Map / Directions"]})})]}),s.format!=="in_person"&&e.jsxs("div",{className:"space-y-2 text-xs pt-1 border-t border-border/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium text-foreground capitalize flex items-center gap-1.5",children:[e.jsx(we,{className:"h-3.5 w-3.5 text-blue-500"}),s.virtualDetails.platform.replace("_"," ")," Platform"]}),s.virtualDetails.hideLinkUntilRegistration&&e.jsxs(A,{variant:"secondary",className:"text-[10px] gap-1",children:[e.jsx(rt,{className:"h-2.5 w-2.5"})," Protected Link"]})]}),s.virtualDetails.hideLinkUntilRegistration&&!$&&!((d=l==null?void 0:l.virtualDetails)!=null&&d.hasAccessLink)?e.jsxs("div",{className:"p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-800 dark:text-amber-300",children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium",children:[e.jsx(rt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Private Meeting Credentials"})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Direct join URL, Meeting ID, and Passcode are securely hidden and will be unlocked once you register."})]}):e.jsxs("div",{className:"p-2.5 rounded-lg bg-muted/40 border border-border/70 space-y-1.5",children:[s.virtualDetails.meetingUrl?e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide font-semibold",children:"Join Link"}),e.jsxs("a",{href:s.virtualDetails.meetingUrl,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1 font-mono break-all",children:[s.virtualDetails.meetingUrl,e.jsx(Os,{className:"h-3 w-3 shrink-0"})]})]}):e.jsx("p",{className:"text-muted-foreground italic",children:"Link will be provided prior to event."}),(s.virtualDetails.meetingId||s.virtualDetails.passcode)&&e.jsxs("div",{className:"flex flex-wrap gap-3 pt-1 border-t border-border/40 text-[11px]",children:[s.virtualDetails.meetingId&&e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:"Meeting ID:"})," ",s.virtualDetails.meetingId]}),s.virtualDetails.passcode&&e.jsxs("span",{children:[e.jsx("strong",{className:"text-foreground",children:"Passcode:"})," ",s.virtualDetails.passcode]})]}),s.virtualDetails.instructions&&e.jsxs("p",{className:"text-[11px] text-muted-foreground pt-1 border-t border-border/40",children:[e.jsx("strong",{children:"Instructions:"})," ",s.virtualDetails.instructions]})]})]})]})]}),e.jsx(_t,{event:N,simulate:!0,onRegistrationChange:({attending:U})=>u(U)}),s.eventType==="conference"&&e.jsxs("div",{className:"p-4 rounded-xl border border-purple-500/30 bg-purple-500/5 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-700 dark:text-purple-300 font-semibold text-sm",children:[e.jsx(qe,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),e.jsx("span",{children:"Conference Modules & Experience"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:[e.jsxs("div",{className:`p-2.5 rounded-lg border text-xs ${s.conferenceConfig.enableTracks?"border-purple-500/30 bg-card text-foreground font-medium":"border-border/50 opacity-40 text-muted-foreground"}`,children:["📌 ",s.conferenceConfig.expectedTracksCount||1," Agenda Track",s.conferenceConfig.expectedTracksCount>1?"s":""]}),e.jsx("div",{className:`p-2.5 rounded-lg border text-xs ${s.conferenceConfig.enableSpeakers?"border-purple-500/30 bg-card text-foreground font-medium":"border-border/50 opacity-40 text-muted-foreground"}`,children:"🎤 Speaker Showcase"}),e.jsx("div",{className:`p-2.5 rounded-lg border text-xs ${s.conferenceConfig.enableSponsors?"border-purple-500/30 bg-card text-foreground font-medium":"border-border/50 opacity-40 text-muted-foreground"}`,children:"🤝 Sponsor Expo"}),e.jsx("div",{className:`p-2.5 rounded-lg border text-xs ${s.conferenceConfig.enableBadgeScanning?"border-purple-500/30 bg-card text-foreground font-medium":"border-border/50 opacity-40 text-muted-foreground"}`,children:"🎫 Digital Badge Check-in"}),e.jsx("div",{className:`p-2.5 rounded-lg border text-xs ${s.conferenceConfig.enableBreakouts?"border-purple-500/30 bg-card text-foreground font-medium":"border-border/50 opacity-40 text-muted-foreground"}`,children:"💡 Breakout Workshops"})]})]}
3),s.eventType==="meetup"&&(s.meetupConfig.discussionTopic||s.meetupConfig.networkingPrompt)&&e.jsxs("div",{className:"p-4 rounded-xl border border-amber-500/30 bg-amber-500/5 space-y-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-700 dark:text-amber-300 font-semibold text-sm",children:[e.jsx(pe,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),e.jsx("span",{children:"Meetup Discussion & Networking"})]}),s.meetupConfig.discussionTopic&&e.jsxs("div",{className:"text-xs space-y-0.5",children:[e.jsx("span",{className:"font-semibold text-foreground",children:"Featured Topic:"}),e.jsx("p",{className:"text-muted-foreground bg-card p-2 rounded border border-border",children:s.meetupConfig.discussionTopic})]}),s.meetupConfig.networkingPrompt&&e.jsxs("div",{className:"text-xs space-y-0.5",children:[e.jsx("span",{className:"font-semibold text-foreground",children:"Icebreaker Prompt:"}),e.jsx("p",{className:"text-muted-foreground bg-card p-2 rounded border border-border",children:s.meetupConfig.networkingPrompt})]})]}),e.jsxs("div",{className:"space-y-3 pt-2",children:[e.jsx("h2",{className:"text-lg font-bold text-foreground",children:"About This Event"}),e.jsx("div",{className:"text-sm leading-relaxed text-muted-foreground whitespace-pre-line bg-card p-4 rounded-xl border border-border",children:s.description||"No description provided yet."})]}),(s.format==="virtual"||s.format==="hybrid")&&s.virtualDetails.instructions&&e.jsxs("div",{className:"p-4 rounded-xl border border-border bg-card space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground font-semibold text-sm",children:[e.jsx(vs,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:"Special Attendee Instructions"})]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s.virtualDetails.instructions})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 pt-4 border-t border-border text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:"Add to Google Calendar / Outlook / iCal"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ur,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Save to MyCircle Calendar"})]})]})]})]})})]})}function Or({isOpen:s,onClose:l,onConfirm:i,event:m}){const[o,w]=n.useState(""),[B,$]=n.useState(!1),[u,M]=n.useState(!1),j=async()=>{if(o.trim()){$(!0);try{await i(o.trim())&&(w(""),M(!1),l())}finally{$(!1)}}};return m?e.jsx(as,{open:s,onOpenChange:z=>!B&&!z&&l(),children:e.jsxs(ls,{className:"sm:max-w-[520px] bg-card border-border",children:[e.jsxs(is,{children:[e.jsxs("div",{className:"flex items-center gap-3 text-destructive mb-1",children:[e.jsx("div",{className:"p-2 rounded-full bg-destructive/10",children:e.jsx(Ce,{className:"h-6 w-6 text-destructive"})}),e.jsx(ns,{className:"text-xl",children:"Cancel Event"})]}),e.jsxs(js,{className:"text-muted-foreground text-sm",children:["Are you sure you want to cancel ",e.jsx("span",{className:"font-semibold text-foreground",children:m.title}),"? This will notify all registered attendees and halt further registrations."]})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[m.attendeesCount>0&&e.jsxs("div",{className:"p-3.5 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-700 dark:text-amber-400 text-sm",children:[e.jsxs("div",{className:"font-medium flex items-center gap-1.5 mb-1",children:[e.jsx(Ce,{className:"h-4 w-4 shrink-0"}),e.jsxs("span",{children:[m.attendeesCount," registered participant",m.attendeesCount>1?"s":""]})]}),"An automated cancellation email and notification will be dispatched to all registered attendees."]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(E,{htmlFor:"cancellation-reason",className:"text-sm font-medium",children:["Cancellation Reason ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(yt,{id:"cancellation-reason",placeholder:"Please explain why the event is being cancelled (e.g., unforeseen scheduling conflict, weather, speaker illness)...",value:o,onChange:z=>w(z.target.value),rows:3,maxLength:500,className:"resize-none"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:"This reason will be displayed on the event page and sent to attendees."}),e.jsxs("span",{children:[o.length,"/500"]})]})]}),e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer pt-1",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:z=>
3M(z.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-destructive focus:ring-destructive"}),e.jsx("span",{className:"text-xs text-muted-foreground leading-relaxed",children:"I confirm that I want to cancel this event and understand that this action is irreversible."})]})]}),e.jsxs(ds,{className:"gap-2 sm:gap-0",children:[e.jsx(D,{type:"button",variant:"outline",onClick:l,disabled:B,children:"Keep Event"}),e.jsx(D,{type:"button",variant:"destructive",onClick:j,disabled:!o.trim()||!u||B,className:"gap-1.5",children:B?e.jsxs(e.Fragment,{children:[e.jsx(nt,{className:"h-4 w-4 animate-spin"}),"Cancelling..."]}):"Confirm Cancellation"})]})]})}):null}function dl(){const{eventId:s}=Rt(),l=$t(),i=zt(),{events:m,isLoading:o,error:w,refetch:B,saveEvent:$,publishEvent:u,unpublishEvent:M,cancelEvent:j,completeEvent:z,deleteEvent:Y,getEventById:g}=Ot(),[a,y]=n.useState("dashboard"),[x,N]=n.useState(null),[J,C]=n.useState(()=>ms()),[G,_]=n.useState(null),[F,L]=n.useState(!1),Q=n.useRef("");n.useEffect(()=>{const h=i.pathname,R=Q.current!==h;Q.current=h,R&&(h.endsWith("/new")?(y("create"),N(null),C(ms())):h.includes("/edit")&&s?(y("edit"),g(s).then(re=>{re?(N(re),C(Le(re))):(le.error("Event not found"),l("/events/manage"))})):h.includes("/preview")&&s?(y("preview"),g(s).then(re=>{re?(N(re),C(Le(re))):(le.error("Event not found or unauthorized"),l("/events/manage"))})):(y("dashboard"),N(null)))},[i.pathname,s,g,l]);const ie=()=>{N(null),C(ms()),l("/events/manage/new")},ne=h=>{N(h),C(Le(h)),l(`/events/manage/${h.id}/edit`)},K=h=>{N(h),C(Le(h)),y("preview")},Z=h=>{const R=Le(h);R.title=`${R.title} (Copy)`,R.status="draft",C(R),N(null),l("/events/manage/new"),le.info("Event duplicated as a new draft")},S=async(h,R=!1)=>{const re=await $(h,x==null?void 0:x.id,R);return re&&(R?N(re):l("/events/manage")),re},d=async h=>await u(h),U=async()=>{if(x){L(!0);try{await u(x.id)&&l("/events/manage")}finally{L(!1)}}else{L(!0);try{await $(J,void 0,!1)&&l("/events/manage")}finally{L(!1)}}},de=async h=>{if(!G)return!1;const R=await j(G.id,h);return R&&a==="edit"&&l("/events/manage"),R},W=async h=>window.confirm("Are you sure you want to delete this event? This action cannot be undone.")?await Y(h):!1;return e.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col",children:[e.jsx(Et,{title:"Event Organizer Studio | myCircle",description:"Design, create, edit, preview, and manage in-person, virtual, and hybrid events on myCircle."}),a!=="preview"&&e.jsx(It,{}),e.jsxs("main",{className:`flex-1 w-full ${a!=="preview"?"pb-16":""}`,style:a!=="preview"?{paddingTop:"120px"}:void 0,children:[a==="dashboard"&&e.jsx(Rr,{events:m,isLoading:o,error:w,onRefresh:B,onCreateNew:ie,onEdit:ne,onPreview:K,onPublish:d,onUnpublish:M,onCancelRequest:h=>_(h),onComplete:z,onDelete:W,onDuplicate:Z}),(a==="create"||a==="edit")&&e.jsx(Vr,{initialData:J,existingEvent:x,onSave:S,onPublish:d,onUnpublish:M,onCancelRequest:h=>_(h),onCompleteRequest:z,onChange:h=>C(h),onTogglePreview:h=>{h&&C(h),y("preview")},onBack:()=>l("/events/manage")}),a==="preview"&&e.jsx(_r,{formData:J,existingEvent:x,onBackToEdit:()=>{y(x?"edit":"create")},onPublish:U,isPublishing:F})]}),e.jsx(Or,{isOpen:!!G,onClose:()=>_(null),onConfirm:de,event:G})]})}export{dl 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.