1import{K as Fe,_ as ve,a5 as Ne,N as $e,r as j,a as he,a6 as B,j as e,C as K,b as Ie,d as Pe,J as W,B as f,aD as qe,bi as Le,w as Ae,aE as Oe,aF as M,e as z,ab as u,bd as Q,s as P,aH as me,af as Re,ag as He,ah as Ke,ai as J,aj as ze,Q as Y,aY as Qe,T as Ve,aM as We,ak as Be,al as Ge,am as Ue,an as _e,ao as Je,$ as q,a0 as L,a1 as A,a2 as O,a3 as h,ap as ue,bj as Ye,au as Xe,a7 as w}from"./index-CuSEeJFb.js";import{u as Ze,a as xe,D as es,c as ss,S as ge,v as pe,b as as,d as ts,C as rs,e as is,s as ls,K as ns,P as cs}from"./sortable.esm-CaaY9462.js";import{T as ds,a as os,b as X,c as Z}from"./tabs-CcPOXtvT.js";import{s as je,a as hs,f as b}from"./format-hhvI2L0z.js";import{a as we,s as ms,i as us}from"./isSameMonth-GNceXh6W.js";import{a as Ce,e as ye}from"./endOfWeek-COLolEil.js";import{e as xs}from"./endOfMonth-DMtDxPW7.js";import{e as gs}from"./endOfDay-CTvcx9iE.js";import{a as ee,i as V}from"./isSameDay-asvKFMkz.js";import{F as ps}from"./filter-DIYm3mPi.js";import{G as js}from"./grid-3x3-CB6J-yDX.js";import{C as ys}from"./calendar-days-B9ClAFA5.js";import{L as fs}from"./list-CcOCoqUW.js";import{E as bs}from"./ellipsis-vertical-04pZ3iRl.js";import{S as vs}from"./square-pen-Wwme7SiP.js";import{C as Ns}from"./copy-Ctw93tQ7.js";import{T as ws}from"./trash-_M2Okieu.js";import{M as fe}from"./mail-Dl1RGATy.js";import{F as Cs}from"./facebook-BJe1dDtq.js";import{I as Ds,T as ks}from"./twitter-C-GvanjD.js";import{L as Es}from"./linkedin-Ds6akugu.js";import{i as Ss}from"./isToday-Bu0C7MAz.js";import"./en-US-BOoww7nS.js";import"./constructNow-CAQUuh76.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ts=Fe("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);function Ms(c,x){return we(c,-x)}function Fs(c,x){return Ce(c,-x)}const F=[{value:"email",label:"Email",color:"bg-blue-500",icon:fe},{value:"social",label:"Social Media",color:"bg-purple-500",icon:Y},{value:"website",label:"Website",color:"bg-green-500",icon:Qe},{value:"facebook",label:"Facebook",color:"bg-blue-600",icon:Cs},{value:"instagram",label:"Instagram",color:"bg-pink-500",icon:Ds},{value:"twitter",label:"Twitter",color:"bg-blue-400",icon:ks},{value:"linkedin",label:"LinkedIn",color:"bg-blue-700",icon:Es},{value:"youtube",label:"YouTube",color:"bg-red-500",icon:Ve},{value:"blog",label:"Blog",color:"bg-gray-600",icon:Y},{value:"newsletter",label:"Newsletter",color:"bg-indigo-500",icon:fe},{value:"sms",label:"SMS",color:"bg-orange-500",icon:Y}];function se({event:c,onEventClick:x,className:a}){const{attributes:n,listeners:p,setNodeRef:d,transform:o,transition:T,isDragging:N}=ts({id:c.id}),C={transform:rs.Transform.toString(o),transition:T},D=F.find(k=>k.value===c.platform)||F[0];return e.jsxs("div",{ref:d,style:C,...n,...p,className:` 7 ${a} 8 ${D.color} text-white text-xs p-2 rounded cursor-pointer transition-all 9 ${N?"opacity-50 shadow-lg scale-105":"hover:shadow-md"} 10 `,onClick:k=>{k.stopPropagation(),x(c)},children:[e.jsx("div",{className:"font-medium truncate",children:c.title}),e.jsx("div",{className:"text-xs opacity-80",children:b(c.publishDate,"HH:mm")})]})}function be({date:c,children:x,onDateClick:a,className:n}){const p=`day-${c.toISOString().split("T")[0]}`,{isOver:d,setNodeRef:o}=is({id:p});return e.jsx("div",{ref:o,className:` 11 ${n} 12 transition-colors duration-200 13 ${d?"bg-orange-100 dark:bg-orange-900/30 ring-2 ring-orange-500 ring-dashed":""} 14 `,onClick:()=>a(c),children:x})}function $s({isOpen:c,onClose:x,event:a,selectedDate:n}){const{toast:p}=ve(),d=Ne(),[o,T]=j.useState({title:"",description:"",platform:"",eventType:"content",status:"scheduled",priority:"medium",publishTime:"09:00",notes:"",tags:"",assignedTo:[],isRecurring:!1,recurringFrequency:"weekly",recurringInterval:1,recurringEnd
14Date:""});We.useEffect(()=>{var r,v,m,y;c&&T({title:(a==null?void 0:a.title)||"",description:(a==null?void 0:a.description)||"",platform:(a==null?void 0:a.platform)||"",eventType:(a==null?void 0:a.eventType)||"content",status:(a==null?void 0:a.status)||"scheduled",priority:(a==null?void 0:a.priority)||"medium",publishTime:a!=null&&a.publishDate?b(a.publishDate,"HH:mm"):"09:00",notes:(a==null?void 0:a.notes)||"",tags:((r=a==null?void 0:a.tags)==null?void 0:r.join(", "))||"",assignedTo:(a==null?void 0:a.assignedTo)||[],isRecurring:!!(a!=null&&a.recurring),recurringFrequency:((v=a==null?void 0:a.recurring)==null?void 0:v.frequency)||"weekly",recurringInterval:((m=a==null?void 0:a.recurring)==null?void 0:m.interval)||1,recurringEndDate:(y=a==null?void 0:a.recurring)!=null&&y.endDate?b(a.recurring.endDate,"yyyy-MM-dd"):""})},[c,a,n]);const N=B({mutationFn:async r=>{const v={...r,publishDate:n||(a==null?void 0:a.publishDate),tags:r.tags.split(",").map(m=>m.trim()).filter(Boolean)};return a!=null&&a.id?await w(`/api/content-schedule/${a.id}`,{method:"PUT",body:JSON.stringify(v)}):await w("/api/content-schedule",{method:"POST",body:JSON.stringify(v)})},onSuccess:()=>{p({title:a!=null&&a.id?"Event Updated":"Event Created",description:"Your calendar event has been saved successfully."}),d.invalidateQueries({queryKey:["/api/content-schedule"]}),x()},onError:r=>{p({title:"Save Failed",description:r.message||"Failed to save event. Please try again.",variant:"destructive"})}}),C=B({mutationFn:async()=>{if(a!=null&&a.id)return a.source==="marketing-calendar"?await w(`/api/marketing-calendar/events/${a.id}`,{method:"DELETE"}):await w(`/api/content-schedule/${a.id}`,{method:"DELETE"})},onSuccess:()=>{p({title:"Event Deleted",description:"The calendar event has been removed."}),d.invalidateQueries({queryKey:["/api/content-schedule"]}),d.invalidateQueries({predicate:r=>Array.isArray(r.queryKey)&&r.queryKey[0]==="/api/marketing-calendar/events"}),x()},onError:r=>{p({title:"Delete Failed",description:r.message||"Failed to delete event. Please try again.",variant:"destructive"})}}),D=r=>{r.preventDefault(),N.mutate(o)},k=()=>{window.confirm("Are you sure you want to delete this event? This action cannot be undone.")&&C.mutate()},g=(r,v)=>{T(m=>({...m,[r]:v}))};return e.jsx(Be,{open:c,onOpenChange:x,children:e.jsxs(Ge,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[e.jsxs(Ue,{children:[e.jsxs(_e,{className:"flex items-center gap-2",children:[e.jsx(W,{className:"w-5 h-5 text-orange-500"}),a!=null&&a.id?"Edit Event":"Create New Event"]}),e.jsx(Je,{children:n?`Scheduled for ${b(n,"MMMM dd, yyyy")}`:"Manage your marketing calendar event"})]}),e.jsxs("form",{onSubmit:D,className:"space-y-6",children:[e.jsxs(ds,{defaultValue:"basic",className:"w-full",children:[e.jsxs(os,{className:"grid w-full grid-cols-3",children:[e.jsx(X,{value:"basic",children:"Basic Info"}),e.jsx(X,{value:"details",children:"Details"}),e.jsx(X,{value:"advanced",children:"Advanced"})]}),e.jsx(Z,{value:"basic",className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx(u,{htmlFor:"title",children:"Title *"}),e.jsx(M,{id:"title",value:o.title,onChange:r=>g("title",r.target.value),placeholder:"Enter event title",required:!0})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"platform",children:"Platform *"}),e.jsxs(q,{value:o.platform,onValueChange:r=>g("platform",r),children:[e.jsx(L,{children:e.jsx(A,{placeholder:"Select platform"})}),e.jsx(O,{children:F.map(r=>e.jsx(h,{value:r.value,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r.icon,{className:"w-4 h-4"}),r.label]})},r.value))})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"eventType",children:"Type"}),e.jsxs(q,{value:o.eventType,onValueChange:r=>g("eventType",r),children:[e.jsx(L,{children:e.jsx(A,{})}),e.jsxs(O,{children:[e.jsx(h,{value:"campaign",children:"Campaign"}),e.jsx(h,{value:"content",children:"Content"}),e.jsx(h,{value:"email",children:"Email"}),e.jsx(h,{value:"social_media",children:"Social Media"}),e.jsx(h,{value:"advertising",children:"Advertising"}),e.jsx(h,{value:"event",children:"Event"}),e.jsx(h,{value:"other",children:"Other"})]})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"status",children:"Status"}),e.jsxs(q,{value:o.status,onValueChange:r=>g("status",r),children:[e.jsx(L,{children:e.jsx(A,{})}),e.jsxs(O,{children:[e.jsx(h,{value:"draft",children:"Draft"}),e.jsx(h,{value:"scheduled",children:"Scheduled"}),e.jsx(h,{value:"active",children:"Active"}),e.jsx(h,{value:"completed",children:"Completed"}),e.jsx(h,{value:"cancelled",children:"Cancelled"})]})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"priority",children:"Priority"}),e.jsxs(q,{value:o.priority,onValueChange:r=>g("priority",r),children:[e.jsx(L,{children:e.jsx(A,{})}),e.jsxs(O,{children:[e.jsx(h,{value:"low",children:"Low"}),e.jsx(h,{value:"medium",children:"Medium"}),e.jsx(h,{value:"high",children:"High"}),e.jsx(h,{value:"urgent",children:"Urgent"})]})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"publishTime",children:"Publish Time"}),e.jsx(M,{id:"publishTime",type:"time",value:o.publishTime,onChange:r=>g("publishTime",r.target.value)})]})]})}),e.jsxs(Z,{value:"details",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"description",children:"Description"}),e.jsx(ue,{id:"description",value:o.description,onChange:r=>g("description",r.target.value),placeholder:"Add event description...",rows:3})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"notes",children:"Notes"}),e.jsx(ue,{id:"notes",value:o.notes,onChange:r=>g("notes",r.target.value),placeholder:"Add internal notes...",rows:3})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"tags",children:"Tags"}),e.jsx(M,{id:"tags",value:o.tags,onChange:r=>g("tags",r.target.value),placeholder:"Enter tags separated by commas"})]})]}),e.jsxs(Z,{value:"advanced",className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ye,{id:"recurring",checked:o.isRecurring,onCheckedChange:r=>g("isRecurring",r)}),e.jsx(u,{htmlFor:"recurring",children:"Recurring Event"})]}),o.isRecurring&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 p-4 border rounded-lg",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"frequency",children:"Frequency"}),e.jsxs(q,{value:o.recurringFrequency,onValueChange:r=>g("recurringFrequency",r),children:[e.jsx(L,{children:e.jsx(A,{})}),e.jsxs(O,{children:[e.jsx(h,{value:"daily",children:"Daily"}),e.jsx(h,{value:"weekly",children:"Weekly"}),e.jsx(h,{value:"monthly",children:"Monthly"}),e.jsx(h,{value:"yearly",children:"Yearly"})]})]})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"interval",children:"Interval"}),e.jsx(M,{id:"interval",type:"number",min:"1",value:o.recurringInterval,onChange:r=>g("recurringInterval",parseInt(r.target.value))})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx(u,{htmlFor:"endDate",children:"End Date (Optional)"}
14),e.jsx(M,{id:"endDate",type:"date",value:o.recurringEndDate,onChange:r=>g("recurringEndDate",r.target.value)})]})]})]})]}),e.jsxs("div",{className:"flex justify-between gap-2 pt-4 border-t",children:[e.jsx("div",{children:(a==null?void 0:a.id)&&e.jsxs(f,{type:"button",variant:"destructive",onClick:k,disabled:C.isPending,children:[e.jsx(Xe,{className:"w-4 h-4 mr-2"}),C.isPending?"Deleting...":"Delete"]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{type:"button",variant:"outline",onClick:x,children:"Cancel"}),e.jsx(f,{type:"submit",disabled:N.isPending,className:"bg-orange-500 hover:bg-orange-600",children:N.isPending?"Saving...":a!=null&&a.id?"Update Event":"Create Event"})]})]})]})]})})}function ia(){const{toast:c}=ve(),x=Ne(),{activeCompanyId:a}=$e(),[n,p]=j.useState(new Date),[d,o]=j.useState("month"),[T,N]=j.useState(null),[C,D]=j.useState(!1),[k,g]=j.useState(null),[r,v]=j.useState(""),[m,y]=j.useState({platforms:[],types:[],statuses:[],priorities:[]}),[ae,te]=j.useState(!1),[re,ie]=j.useState(null),De=Ze(xe(cs,{activationConstraint:{distance:8}}),xe(ns,{coordinateGetter:ls})),{data:le=[],isLoading:Is}=he({queryKey:["/api/content-schedule",n,d],queryFn:async()=>{try{return(await w("/api/content-schedule",{method:"GET"})||[]).map(t=>({id:`content-${t.id}`,title:t.title||`${t.campaignName} - Content`,description:t.notes,publishDate:new Date(t.publishDate),platform:t.platform,eventType:"content",status:t.isActive?"scheduled":"draft",priority:"medium",campaignId:t.campaignId,notes:t.notes,isActive:t.isActive,publishedAt:t.publishedAt?new Date(t.publishedAt):void 0}))}catch(s){return console.error("Error fetching content events:",s),[]}}}),{data:ne=[],isLoading:Ps}=he({queryKey:["/api/marketing-calendar/events",a,n,d],queryFn:async()=>{try{const s=a?`/api/marketing-calendar/events?companyId=${a}`:"/api/marketing-calendar/events";return(await(await w(s,{method:"GET"})).json()||[]).map(l=>({id:`calendar-${l.id}`,title:l.title,description:l.description,publishDate:new Date(l.startDate),platform:l.platform||"general",eventType:l.eventType||"other",status:l.status||"scheduled",priority:l.priority||"medium",notes:l.description,tags:l.tags||[]}))}catch(s){return console.error("Error fetching calendar events:",s),[]}},enabled:!0}),ce=j.useMemo(()=>[...le,...ne],[le,ne]),ke=B({mutationFn:async s=>await w(`/api/content-schedule/${s}`,{method:"DELETE"}),onSuccess:()=>{c({title:"Event Deleted",description:"The event has been removed from your calendar."}),x.invalidateQueries({queryKey:["/api/content-schedule"]})},onError:s=>{c({title:"Delete Failed",description:s.message||"Failed to delete event. Please try again.",variant:"destructive"})}}),Ee=B({mutationFn:async({eventId:s,newDate:t})=>await w(`/api/content-schedule/${s}`,{method:"PUT",body:JSON.stringify({publishDate:t.toISOString()})}),onSuccess:(s,{newDate:t})=>{c({title:"Event Rescheduled",description:`Event has been moved to ${b(t,"MMMM dd, yyyy")}`}),x.invalidateQueries({queryKey:["/api/content-schedule"]})},onError:s=>{c({title:"Reschedule Failed",description:s.message||"Failed to reschedule event. Please try again.",variant:"destructive"})}}),Se=s=>{const t=E.find(i=>i.id===s.active.id);ie(t||null)},Te=s=>{const{active:t,over:i}=s;if(ie(null),!i||!t)return;const l=i.id;let S;try{l.startsWith("day-")?S=new Date(l.replace("day-","")):S=new Date(l)}catch{console.error("Invalid drop target date:",l);return}const I=t.id,H=E.find(Me=>Me.id===I);if(!H||V(H.publishDate,S))return;const _=new Date(S);_.setHours(H.publishDate.getHours()),_.setMinutes(H.publishDate.getMinutes()),Ee.mutate({eventId:I,newDate:_})},G=j.useMemo(()=>{const s=[];let t,i;d==="month"?(t=je(ms(n)),i=ye(xs(n))):d==="week"?(t=je(n),i=ye(n)):(t=hs(n),i=gs(n));let l=t;for(;l<=i;)s.push(l),l=ee(l,1);return s},[n,d]),E=j.useMemo(()=>ce.filter(s=>{var t;return!(r&&!s.title.toLowerCase().includes(r.toLowerCase())&&!((t=s.description)!=null&&t.toLowerCase().includes(r.toLowerCase()))||m.platforms.length>0&&!m.platforms.includes(s.platform)||m.types.length>0&&!m.types.includes(s.eventType)||m.statuses.length>0&&!m.statuses.includes(s.status)||m.priorities.length>0&&!m.priorities.includes(s.priority))}),[ce,r,m]),R=s=>E.filter(t=>V(t.publishDate,s)),de=s=>{p(d==="month"?s==="prev"?Ms(n,1):we(n,1):d==="week"?s==="prev"?Fs(n,1):Ce(n,1):s==="prev"?ee(n,-1):ee(n,1))},$=s=>{N(s),D(!0)},U=s=>{g(s),N(null),D(!0)},oe=s=>F.find(t=>t.value===s)||F[0];return e.jsx(es,{sensors:De,collisionDetection:ss,onDragStart:Se,onDragEnd:Te,children:e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-orange-50 to-red-50 dark:from-orange-900/20 dark:to-red-900/20 p-4 space-y-6",children:[e.jsxs(K,{children:[e.jsxs(Ie,{children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{children:[e.jsxs(Pe,{className:"flex items-center gap-2",children:[e.jsx(W,{className:"w-6 h-6 text-orange-500"}),"Marketing Calendar"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and schedule your marketing content across all platforms"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>te(!ae),className:"flex items-center gap-2",children:[e.jsx(ps,{className:"w-4 h-4"}),"Filters"]}),e.jsxs(f,{onClick:()=>U(new Date),className:"bg-orange-500 hover:bg-orange-600 flex items-center gap-2",children:[e.jsx(qe,{className:"w-4 h-4"}),"New Event"]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[e.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 p-1 rounded-lg",children:["month","week","day","agenda"].map(s=>e.jsxs(f,{variant:d===s?"default":"ghost",size:"sm",onClick:()=>o(s),className:d===s?"bg-orange-500 hover:bg-orange-600":"",children:[s==="month"&&e.jsx(js,{className:"w-4 h-4"}),s==="week"&&e.jsx(ys,{className:"w-4 h-4"}),s==="day"&&e.jsx(Ts,{className:"w-4 h-4"}),s==="agenda"&&e.jsx(fs,{className:"w-4 h-4"}),e.jsx("span",{className:"ml-2 capitalize",children:s})]},s))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{variant:"outline",size:"sm",onClick:()=>de("prev"),children:e.jsx(Le,{className:"w-4 h-4"})}),e.jsx(f,{variant:"outline",onClick:()=>p(new Date),children:"Today"}),e.jsx(f,{variant:"outline",size:"sm",onClick:()=>de("next"),children:e.jsx(Ae,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex-1 max-w-sm",children:e.jsxs("div",{className:"relative",children:[e.jsx(Oe,{className:"absolute left-3 top-3 w-4 h-4 text-gray-400"}),e.jsx(M,{placeholder:"Search events...",value:r,onChange:s=>v(s.target.value),className:"pl-10"})]})})]}),e.jsx("div",{className:"text-lg font-medium",children:b(n,"MMMM yyyy")})]}),ae&&e.jsxs(z,{className:"border-t bg-gray-50 dark:bg-gray-800/50",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-sm font-medium",children:"Platforms"}),e.jsx("div",{className:"mt-2 space-y-2 max-h-32 overflow-y-auto",children:F.map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Q,{id:`platform-${s.value}`,checked:m.platforms.includes(s.value),onCheckedChange:t=>{y(t?i=>({...i,platforms:[...i.platforms,s.value]}):i=>({...i,platforms:i.platforms.filter(l=>l!==s.value)}))}}),e.jsxs("label",{htmlFor:`platform-${s.value}`,className:"text-sm flex items-center gap-2",children:[e.jsx(s.icon,{className:"w-3 h-3"}),s.label]})]},s.value))})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-sm font-medium",children:"Status"}),e.jsx("div",{className:"mt-2 space-y-2",children:["draft","scheduled","active","completed","cancelled"].map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Q,{id:`status-${s}`,checked:m.statuses.includes(s),onCheckedChange:t=>{y(t?i=>({...i,statuses:[...i.statuses,s]}):i=>({...i,statuses:i.statuses.filter(l=>l!==s)}))}}),e.jsx("label",{htmlFor:`status-${s}`,className:"text-sm capitalize",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-sm font-medium",children:"Type"}),e.jsx("div",{className:"mt-2 space-y-2",children:["campaign","content","email","social_media","advertising","event","other"].map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Q,{id:`type-${s}`,checked:m.types.includes(s),onCheckedChange:t=>{y(t?i=>({...i,types:[...i.types,s]}):i=>({...i,types:i.types.filter(l=>l!==s)}))}}),e.jsx("label",{htmlFor:`type-${s}`,className:"text-sm capitalize",children:s.replace("_"," ")})]},s))})]}),e.jsxs("div",{children:[e.jsx(u,{className:"text-sm font-medium",children:"Priority"}),e.jsx("div",{className:"mt-2 space-y-2",children:["low","medium","high","urgent"].map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Q,{id:`priority-${s}`,checked:m.priorities.includes(s),onCheckedChange:t=>{y(t?i=>({...i,priorities:[...i.priorities,s]}):i=>({...i,priorities:i.priorities.filter(l=>l!==s)}))}}),e.jsx("label",{htmlFor:`priority-${s}`,className:"text-sm capitalize",children:s})]},s))})]})]}),e.jsxs("div",{className:"mt-4 flex justify-between",children:[e.jsx(f,{variant:"outline",size:"sm",onClick:()=>y({platforms:[],types:[],statuses:[],priorities:[]}),children:"Clear All"}),e.jsx(f,{variant:"outline",size:"sm",onClick:()=>te(!1),children:"Close Filters"})]})]})]}),e.jsx(K,{children:e.jsxs(z,{className:"p-0",children:[d==="month"&&e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-4",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(s=>e.jsx("div",{className:"p-3 text-center text-sm font-medium text-gray-500",children:s},s))}),e.jsx(ge,{items:E.map(s=>s.id),strategy:pe,children:e.jsx("div",{className:"grid grid-cols-7 gap-1",children:G.map((s,t)=>{const i=R(s),l=us(s,n),S=V(s,new Date);return e.jsxs(be,{date:s,onDateClick:U,className:` 15 min-h-[120px] p-2 border rounded-lg cursor-pointer transition-colors 16 ${l?"bg-white dark:bg-gray-800":"bg-gray-50 dark:bg-gray-900"} 17 ${S?"ring-2 ring-orange-500":""} 18 hover:bg-gray-50 dark:hover:bg-gray-700 19 `,children:[e.jsx("div",{className:`text-sm mb-1 ${l?"text-gray-900 dark:text-gray-100":"text-gray-400"} ${S?"font-bold text-orange-500":""}`,children:b(s,"d")}),e.jsxs("div",{className:"space-y-1",children:[i.slice(0,3).map(I=>e.jsx(se,{event:I,onEventClick:$,className:"truncate"},I.id)),i.length>3&&e.jsxs("div",{className:"text-xs text-gray-500",children:["+",i.length-3," more"]})]})]},t)})})})]}),d==="week"&&e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"grid grid-cols-7 gap-4 mb-4",children:G.map(s=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-sm text-gray-500",children:b(s,"EEE")}),e.jsx("div",{className:`text-lg font-medium ${V(s,new Date)?"text-orange-500":""}`,children:b(s,"d")})]},s.toString()))}),e.jsx(ge,{items:E.map(s=>s.id),strategy:pe,children:e.jsx("div",{className:"grid grid-cols-7 gap-4",children:G.map(s=>{const t=R(s);return e.jsx(be,{date:s,onDateClick:U,className:"min-h-[300px] border rounded-lg p-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800",children:e.jsx("div",{className:"space-y-2",children:t.map(i=>e.jsx(se,{event:i,onEventClick:$,className:"truncate"},i.id))})},s.toString())})})})]}),d==="day"&&e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"text-lg font-semibold",children:b(n,"EEEE, MMMM dd, yyyy")}),Ss(n)&&e.jsx(P,{className:"bg-orange-500 mt-1",children:"Today"})]}),e.jsx(me,{className:"h-[600px]",children:e.jsxs("div",{className:"space-y-4",children:[R(n).sort((s,t)=>s.publishDate.getTime()-t.publishDate.getTime()).map(s=>{const t=oe(s.platform);return e.jsx(K,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>$(s),children:e.jsx(z,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${t.color}`,children:e.jsx(t.icon,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.title}),e.jsx("div",{className:"text-sm text-gray-500",children:b(s.publishDate,"HH:mm")}
19),s.description&&e.jsx("div",{className:"text-sm text-gray-600 mt-1",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:s.status==="scheduled"?"default":"secondary",className:s.status==="scheduled"?"bg-green-500":"",children:s.status}),e.jsx(P,{variant:"outline",className:s.priority==="urgent"?"border-red-500 text-red-500":s.priority==="high"?"border-orange-500 text-orange-500":s.priority==="medium"?"border-yellow-500 text-yellow-500":"border-gray-300 text-gray-500",children:s.priority})]})]})})},s.id)}),R(n).length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(W,{className:"w-16 h-16 mx-auto text-gray-300 mb-4"}),e.jsx("p",{className:"text-gray-500",children:"No events for this day"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:'Click "New Event" to create one'})]})]})})]}),d==="agenda"&&e.jsx("div",{className:"p-6",children:e.jsx(me,{className:"h-[600px]",children:e.jsxs("div",{className:"space-y-4",children:[E.sort((s,t)=>s.publishDate.getTime()-t.publishDate.getTime()).map(s=>{const t=oe(s.platform);return e.jsx(K,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>$(s),children:e.jsx(z,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`p-2 rounded-lg ${t.color}`,children:e.jsx(t.icon,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:s.title}),e.jsx("div",{className:"text-sm text-gray-500",children:b(s.publishDate,"MMMM dd, yyyy ⢠HH:mm")}),s.description&&e.jsx("div",{className:"text-sm text-gray-600 mt-1",children:s.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:s.status==="scheduled"?"default":"secondary",className:s.status==="scheduled"?"bg-green-500":"",children:s.status}),e.jsx(P,{variant:"outline",className:s.priority==="urgent"?"border-red-500 text-red-500":s.priority==="high"?"border-orange-500 text-orange-500":s.priority==="medium"?"border-yellow-500 text-yellow-500":"border-gray-300 text-gray-500",children:s.priority}),e.jsxs(Re,{children:[e.jsx(He,{asChild:!0,children:e.jsx(f,{variant:"ghost",size:"sm",onClick:i=>i.stopPropagation(),children:e.jsx(bs,{className:"w-4 h-4"})})}),e.jsxs(Ke,{align:"end",children:[e.jsxs(J,{onClick:i=>{i.stopPropagation(),$(s)},children:[e.jsx(vs,{className:"w-4 h-4 mr-2"}),"Edit"]}),e.jsxs(J,{onClick:i=>{i.stopPropagation(),navigator.clipboard.writeText(s.title),c({title:"Copied to clipboard"})},children:[e.jsx(Ns,{className:"w-4 h-4 mr-2"}),"Copy"]}),e.jsx(ze,{}),e.jsxs(J,{className:"text-red-600",onClick:i=>{i.stopPropagation(),confirm("Are you sure you want to delete this event?")&&ke.mutate(s.id)},children:[e.jsx(ws,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]})]})]})})},s.id)}),E.length===0&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx(W,{className:"w-16 h-16 mx-auto text-gray-300 mb-4"}),e.jsx("p",{className:"text-gray-500",children:"No events found"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Create your first event to get started"})]})]})})})]})}),e.jsx($s,{isOpen:C,onClose:()=>D(!1),event:T,selectedDate:k}),e.jsx(as,{children:re?e.jsx(se,{event:re,onEventClick:()=>{},className:"shadow-2xl scale-105"}):null})]})})}export{ia 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.