1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72201],{72201:function(e,a,t){t.r(a),t.d(a,{default:function(){return eg}});var r=t(57437),s=t(2265),n=t(99376),l=t(12381),o=t(69174),i=t(15291),d=t(40279),c=t(75060),m=t(23675),g=t(13041),u=t(89345),x=t(95805),h=t(29374),p=t(53417),b=t(48736),f=t(31047),y=t(15863),v=t(92369),w=t(91723),k=t(83774),j=t(98420),N=t(66901),_=t(92451),C=t(10407),S=t(82431),T=t(99397),D=t(32489),Z=t(37806),I=t(73247),P=t(29202),M=t(78867),E=t(96362),F=t(98728),A=t(18930),L=t(63639),z=t(69064),R=t(84881),H=t(9310),U=t(24746),B=t(40806),O=t(87919),Y=t(98999),Q=t(64841);let G={call:"#10b981",meeting:"#3b82f6",email:"#f59e0b",demo:"#8b5cf6",follow_up:"#06b6d4",proposal:"#ec4899",contract:"#6366f1",other:"#64748b"};var V=t(83426),W=t(48580);function q(e){return"".concat(Math.floor(e/60).toString().padStart(2,"0"),":").concat((e%60).toString().padStart(2,"0"))}var J=t(87133);let K={idle:{label:"Ready to call",color:"text-gray-600",bgColor:"bg-gray-50 dark:bg-gray-800",dotColor:"bg-gray-400"},initiated:{label:"Initiating call...",color:"text-blue-600",bgColor:"bg-blue-50 dark:bg-blue-900/20",dotColor:"bg-blue-500",pulse:!0},ringing:{label:"Ringing...",color:"text-amber-600",bgColor:"bg-amber-50 dark:bg-amber-900/20",dotColor:"bg-amber-500",pulse:!0},connected:{label:"Connected",color:"text-green-600",bgColor:"bg-green-50 dark:bg-green-900/20",dotColor:"bg-green-500"},completed:{label:"Call ended",color:"text-gray-600",bgColor:"bg-gray-50 dark:bg-gray-800",dotColor:"bg-gray-400"},failed:{label:"Call failed",color:"text-red-600",bgColor:"bg-red-50 dark:bg-red-900/20",dotColor:"bg-red-500"}};function X(e){let{status:a,duration:t,onEndCall:s,isEndingCall:n=!1}=e,o=K[a],i=["initiated","ringing","connected"].includes(a);return(0,r.jsxs)("div",{className:"rounded-xl p-4 ".concat(o.bgColor," transition-colors duration-300"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full ".concat(o.dotColor," ").concat(o.pulse?"animate-pulse":"")}),o.pulse&&(0,r.jsx)("div",{className:"absolute inset-0 w-3 h-3 rounded-full ".concat(o.dotColor," animate-ping opacity-75")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(g.Z,{className:"h-4 w-4 ".concat(o.color)}),(0,r.jsx)("span",{className:"font-medium ".concat(o.color),children:o.label})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:["connected"===a&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1 bg-white dark:bg-gray-900 rounded-lg shadow-sm",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500 animate-pulse"}),(0,r.jsx)("span",{className:"font-mono text-sm font-semibold text-gray-900 dark:text-gray-100",children:q(t)})]}),i&&(0,r.jsx)(l.z,{size:"sm",variant:"destructive",onClick:s,disabled:n,className:"rounded-lg",children:n?(0,r.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(J.Z,{className:"h-4 w-4 mr-1.5"}),"End Call"]})})]})]}),"ringing"===a&&(0,r.jsx)("p",{className:"mt-2 text-sm text-amber-600 dark:text-amber-400",children:"Your phone is ringing. Answer to connect with the customer."}),"initiated"===a&&(0,r.jsx)("p",{className:"mt-2 text-sm text-blue-600 dark:text-blue-400",children:"Setting up the call..."})]})}var $=t(82222),ee=t(90641);function ea(e){let{messages:a,callStatus:t,isLoading:n=!1}=e,l=(0,s.useRef)(null),o=["initiated","ringing","connected"].includes(t),i=["completed","failed"].includes(t);return((0,s.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[a]),o&&0===a.length)?(0,r.jsx)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center mb-3",children:(0,r.jsx)(p.Z,{className:"h-6 w-6 text-blue-600 dar
1k:text-blue-400"})}),(0,r.jsx)("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:"Transcript"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Transcript will be available after the call ends"}),"connected"===t&&(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2 text-xs text-gray-400",children:[(0,r.jsx)(w.Z,{className:"h-3 w-3"}),(0,r.jsx)("span",{children:"Recording in progress..."})]})]})}):n?(0,r.jsx)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center mb-3 animate-pulse",children:(0,r.jsx)(p.Z,{className:"h-6 w-6 text-gray-400"})}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Loading transcript..."})]})}):i&&0===a.length?(0,r.jsx)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50 p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center text-center",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-gray-100 dark:bg-gray-700 flex items-center justify-center mb-3",children:(0,r.jsx)(p.Z,{className:"h-6 w-6 text-gray-400"})}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No transcript available for this call"})]})}):(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden",children:[(0,r.jsx)("div",{className:"px-4 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:(0,r.jsxs)("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center gap-2",children:[(0,r.jsx)(p.Z,{className:"h-4 w-4"}),"Call Transcript"]})}),(0,r.jsx)(ee.x,{className:"h-[200px]",ref:l,children:(0,r.jsx)("div",{className:"p-4 space-y-3",children:a.map((e,a)=>(0,r.jsxs)("div",{className:"flex gap-2 ".concat("agent"===e.role?"justify-start":"justify-end"),children:["agent"===e.role&&(0,r.jsx)("div",{className:"w-7 h-7 rounded-full bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center flex-shrink-0",children:(0,r.jsx)($.Z,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"})}),(0,r.jsx)("div",{className:"max-w-[80%] rounded-xl px-3 py-2 ".concat("agent"===e.role?"bg-purple-50 dark:bg-purple-900/20 text-purple-900 dark:text-purple-100":"bg-emerald-50 dark:bg-emerald-900/20 text-emerald-900 dark:text-emerald-100"),children:(0,r.jsx)("p",{className:"text-sm",children:e.message})}),"user"===e.role&&(0,r.jsx)("div",{className:"w-7 h-7 rounded-full bg-emerald-100 dark:bg-emerald-900/30 flex items-center justify-center flex-shrink-0",children:(0,r.jsx)(v.Z,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"})})]},a))})})]})}var et=t(83229);let er="call-notes-draft-";function es(e){let{value:a,onChange:t,callId:n,onSave:o,isSaving:i=!1,showSaveButton:d=!1,placeholder:c="Type notes during the call...",disabled:g=!1}=e;(0,s.useEffect)(()=>{n&&a&&localStorage.setItem("".concat(er).concat(n),a)},[n,a]),(0,s.useEffect)(()=>{if(n){let e=localStorage.getItem("".concat(er).concat(n));e&&!a&&t(e)}},[n]);let u=(0,s.useCallback)(()=>{n&&localStorage.removeItem("".concat(er).concat(n)),null==o||o()},[n,o]);return(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 dark:border-gray-700 overflow-hidden",children:[(0,r.jsxs)("div",{className:"px-4 py-2 bg-gray-100 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex items-center justify-between",children:[(0,r.jsxs)("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center gap-2",children:[(0,r.jsx)(b.Z,{className:"h-4 w-4"}),"Notes"]}),d&&o&&(0,r.jsx)(l.z,{size:"sm",variant:"ghost",onClick:u,disabled:i||!a.trim(),className:"h-7 text-xs",children:i?"Saving...":(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(et.Z,{className:"h-3 w-3 mr-1"}),"Save"]})})]}),(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)(m.g,{value:a,onChange:e=>t(e.target.value),placeholder:c,disabled:g,className:"min-h-[100px] resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent p-0"})}),a&&(0,r.jsx)("div",{className:"px-4 py-2 border-t border-gray-100 dark:border-gray-800",children:(0,r.jsxs)("p",{className:"text-xs text-gray-400",children:[a.length," characters",n&&
1(0,r.jsx)("span",{className:"ml-2",children:"Auto-saved"})]})})]})}var en=t(71837);let el={listEvents:async function(e,a){return(await en.api.get("/events",{params:{workspace_id:e,...a}})).data},createEvent:async function(e,a){return(await en.api.post("/events",a,{params:{workspace_id:e}})).data},deleteEvent:async function(e,a){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(await en.api.delete("/events/".concat(e),{params:{workspace_id:a,hard_delete:t}})).data}},eo=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"h-3.5 w-3.5";switch(null==e?void 0:e.toLowerCase()){case"call":return(0,r.jsx)(g.Z,{className:a});case"email":return(0,r.jsx)(u.Z,{className:a});case"meeting":return(0,r.jsx)(x.Z,{className:a});case"demo":return(0,r.jsx)(h.Z,{className:a});case"follow_up":return(0,r.jsx)(p.Z,{className:a});case"proposal":case"contract":return(0,r.jsx)(b.Z,{className:a});default:return(0,r.jsx)(f.Z,{className:a})}},ei=e=>new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),ed=(e,a)=>new Date(e,a+1,0).getDate(),ec=(e,a)=>new Date(e,a,1).getDay(),em={call:"#22c55e",meeting:"#6366f1",other:"#64748b",email:"#f97316",demo:"#a855f7",follow_up:"#eab308",overdue:"#ef4444",proposal:"#ec4899",contract:"#6b7280",task:"#3b82f6",announcement:"#6366f1",holiday:"#ef4444",program:"#10b981",reminder:"#f59e0b"};function eg(){let{user:e}=(0,R.a)(),{endNavigation:a}=(0,H.H)(),{isAdmin:t,isManager:J,isSuperAdmin:K}=(0,U.DO)(),$=(0,n.useSearchParams)(),ee=(0,n.useRouter)(),et=(0,s.useRef)(null),[er,eg]=(0,s.useState)(new Date),[eu,ex]=(0,s.useState)("week"),[eh,ep]=(0,s.use
vendor: 1,065 bytes, line 1
1State)([]),[eb,ef]=(0,s.useState)([]),[ey,ev]=(0,s.useState)([]),[ew,ek]=(0,s.useState)("all"),[ej,eN]=(0,s.useState)("all"),[e_,eC]=(0,s.useState)(!0),[eS,eT]=(0,s.useState)(null),[eD,eZ]=(0,s.useState)(null),[eI,eP]=(0,s.useState)(!1),[eM,eE]=(0,s.useState)(!1),[eF,eA]=(0,s.useState)(null),[eL,ez]=(0,s.useState)(null),[eR,eH]=(0,s.useState)(""),[eU,eB]=(0,s.useState)([]),[eO,eY]=(0,s.useState)(!1),[eQ,eG]=(0,s.useState)(!1),[eV,eW]=(0,s.useState)(!1),[eq,eJ]=(0,s.useState)(!1),[eK,eX]=(0,s.useState)("task"),[e$,e0]=(0,s.useState)(!1),[e1,e5]=(0,s.useState)(null),[e2,e4]=(0,s.useState)("09:00"),[e3,e6]=(0,s.useState)({title:"",description:"",location:"",taskType:"call",priority:"normal",durationMinutes:30,contactName:"",contactPhone:"",contactEmail:"",assignedToId:"",assignedToName:""}),[e7,e9]=(0,s.useState)({title:"",description:"",eventType:"announcement",allDay:!0,color:"#6366f1",startTime:"09:00",endTime:"",location:""}),[e8,ae]=(0,s.useState)([]),[aa,at]=(0,s.useState)([]),[ar,as]=(0,s.useState)([]),[an,al]=(0,s.useState)(""),[ao,ai]=(0,s.use
1State)(""),[ad,ac]=(0,s.useState)(!1),[am,ag]=(0,s.useState)(!1),[au,ax]=(0,s.useState)(!1),ah=(0,s.useRef)(null),ap=(0,s.useRef)(null),[ab,af]=(0,s.useState)([]),[ay,av]=(0,s.useState)(null),[aw,ak]=(0,s.useState)([]),[aj,aN]=(0,s.useState)("quick"),[a_,aC]=(0,s.useState)(!1),[aS,aT]=(0,s.useState)({name:"",description:"",duration_minutes:30,location_type:"google_meet",buffer_before_minutes:0,buffer_after_minutes:0,min_notice_hours:24,max_days_ahead:60}),[aD,aZ]=(0,s.useState)(!1),[aI,aP]=(0,s.useState)(!1),aM=function(e){let{callId:a,voiceCallId:t,workspaceId:r,pollInterval:n=3e3,onStatusChange:l,onCallEnded:o}=e,[i,d]=(0,s.useState)({status:"idle",duration:0,answered:!1}),c=(0,s.useRef)(null),m=(0,s.useRef)(null),g=(0,s.useRef)(null),u=(0,s.useRef)("idle"),x=(0,s.useCallback)(()=>{c.current&&(clearInterval(c.current),c.current=null),m.current&&(clearInterval(m.current),m.current=null)},[]),h=(0,s.useCallback)(async()=>{if(a&&r)try{let e=await (0,Y.o8)(a,r,t||void 0),s=function(e){let a=(null==e?void 0:e.toLowerCase())||"";return["queued","initiated","init"].includes(a)?"initiated":["ringing","ring","alerting"].includes(a)?"ringing":["connected","in-progress","in_progress","answered","live"].includes(a)?"connected":["completed","ended","hangup","terminated"].includes(a)?"completed":["failed","busy","no_answer","no-answer","rejected","error","canceled"].includes(a)?"failed":"initiated"}(e.status);d(a=>{let t={status:s,duration:e.duration_seconds||a.duration,answered:e.call_answered||"connected"===s,rawStatus:e.raw_provider_status};return"connected"!==s||g.current||(g.current=Date.now()),s!==u.current&&(u.current=s,null==l||l(s)),t}),["completed","failed"].includes(s)&&(x(),null==o||o({status:s,duration:e.duration_seconds||0,answered:e.call_answered||!1,rawStatus:e.raw_provider_status}))}catch(e){console.error("Failed to poll call status:",e)}},[a,t,r,l,o,x]);return(0,s.useEffect)(()=>(a&&r&&(d({status:"initiated",duration:0,answered:!1}),u.current="initiated",g.current=null,h(),c.current=setInterval(h,n),m.current=setInterval(()=>{if(g.current){let e=Math.floor((Date.now()-g.current)/1e3);d(a=>({...a,duration:e}))}},1e3)),()=>{x()}),[a,r,n,h,x]),(0,s.useEffect)(()=>{a||(d({status:"idle",duration:0,answered:!1}),u.current="idle",g.current=null)},[a]),{...i,stopPolling:x,isActive:["initiated","ringing","connected"].includes(i.status),isEnded:["completed","failed"].includes(i.status)}}({callId:eF,voiceCallId:eL,workspaceId:(null==e?void 0:e.workspace_id)||"",pollInterval:3e3,onStatusChange:e=>{console.log("[Calendar] Call status changed:",e)},onCallEnded:async e=>{console.log("[Calendar] Call ended:",e),eF&&await aE(eF)}}),aE=async e=>{eY(!0);try{var a;let t=await en.api.get("/calls/elevenlabs/transcript/".concat(e));(null===(a=t.data)||void 0===a?void 0:a.transcript)&&eB(t.data.transcript.map(e=>({role:"agent"===e.role?"agent":"user",message:e.message})))}catch(e){console.log("[Calendar] Transcript not available:",e)}finally{eY(!1)}},aF=async()=>{if(!(null==eS?void 0:eS.leadId)||!eR.trim()||!(null==e?void 0:e.workspace_id)){(null==eS?void 0:eS.leadId)||z.default.error("No lead associated with this task");return}eG(!0);try{await en.api.post("/leads/".concat(eS.leadId,"/notes"),{content:"[Call Notes - ".concat(q(aM.duration),"]\n\n").concat(eR),lead_id:eS.leadId}),z.default.success("Notes saved successfully"),eH(""),eF&&localStorage.removeItem("call-notes-draft-".concat(eF))}catch(e){console.error("Failed to save notes:",e),z.default.error(e.message||"Failed to save notes")}finally{eG(!1)}},aA=async()=>{if(eF){eW(!0);try{await en.api.post("/calls/".concat(eF,"/hangup")),z.default.success("Call ended")}catch(e){console.error("Failed to end call:",e),z.default.error(e.message||"Failed to end call")}finally{eW(!1)}}},aL=()=>{eA(null),ez(null),eZ(null),eB([]),eH("")},az=()=>{aM.isActive?window.confirm("You have an active call. The call will continue but you will lose any unsaved notes. Close anyway?")&&(aL(),eT(null),eP(!1)):aM.isEnded&&eR.trim()&&(null==eS?void 0:eS.leadId)?window.confirm("You have unsaved notes. Close without saving?")&&(aL(),eT(null),eP(!1)):(aL(),eT(null),eP(!1))},aR=(0,s.useCallback)(async()=>{try{let[e,a,t]=await Promise.all([(0,Q.J2)().catch(()=>[]),(0,Q.dU)().catch(()=>null),(0,Q.S6)().catch(()=>[])]);af(e),av(a),ak(t)}catch(e){console.error("Error loading meeting scheduler data:",e)}},[]),aH=async()=>
1{if(!aS.name.trim()){z.default.error("Please enter a meeting type name");return}aZ(!0);try{await (0,Q.BS)({name:aS.name,description:aS.description,duration_minutes:aS.duration_minutes,location_type:aS.location_type,buffer_before_minutes:aS.buffer_before_minutes,buffer_after_minutes:aS.buffer_after_minutes,min_notice_hours:aS.min_notice_hours,max_days_ahead:aS.max_days_ahead});let e=await (0,Q.J2)();af(e),aC(!1),aT({name:"",description:"",duration_minutes:30,location_type:"google_meet",buffer_before_minutes:0,buffer_after_minutes:0,min_notice_hours:24,max_days_ahead:60}),z.default.success("Meeting type created!")}catch(e){console.error("Error creating meeting type:",e),z.default.error("Failed to create meeting type")}finally{aZ(!1)}},aU=e=>{if(!(null==ay?void 0:ay.booking_url_slug))return;let a=window.location.origin,t=e?"".concat(a,"/book/").concat(ay.booking_url_slug,"/").concat(e):"".concat(a,"/book/").concat(ay.booking_url_slug);navigator.clipboard.writeText(t),aP(!0),z.default.success("Booking link copied!"),setTimeout(()=>aP(!1),2e3)},aB=(a,t)=>{e5(a||new Date),e4(t||"09:00"),eX("task"),e6({title:"",description:"",location:"",taskType:"call",priority:"normal",durationMinutes:30,contactName:"",contactPhone:"",contactEmail:"",assignedToId:(null==e?void 0:e.id)||"",assignedToName:(null==e?void 0:e.full_name)||(null==e?void 0:e.email)||""}),e9({title:"",description:"",eventType:"announcement",allDay:!0,color:"#6366f1",startTime:"09:00",endTime:"",location:""}),ai(""),al(""),ax(!1),aN("quick"),aC(!1),eJ(!0)},aO=async()=>{var a,t,r,s;if(!e1){z.default.error("Please select a date");return}if(!(null==e?void 0:e.workspace_id)){z.default.error("Workspace not found");return}if("event"===eK){if(!e7.title.trim()){z.default.error("Please enter a title");return}if(!e7.description.trim()){z.default.error("Please enter a description");return}e0(!0);try{let a;let t=new Date(e1);if(e7.allDay)t.setHours(0,0,0,0);else{let[e,r]=e7.startTime.split(":").map(Number);if(t.setHours(e,r,0,0),e7.endTime){a=new Date(e1);let[e,t]=e7.endTime.split(":").map(Number);a.setHours(e,t,0,0)}}let r={title:e7.title,description:e7.description,start_date:t.toISOString(),end_date:null==a?void 0:a.toISOString(),all_day:e7.allDay,event_type:e7.eventType,color:e7.color,is_public:!0,meta_data:e7.location?{location:e7.location}:void 0};await el.createEvent(e.workspace_id,r),z.default.success("Event created successfully"),eJ(!1),aq()}catch(r){console.error("Create event error:",r);let e=(null===(t=r.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.detail)||r.message||"Failed to create event";z.default.error(e)}finally{e0(!1)}return}if(!e3.title.trim()){z.default.error("Please enter a title");return}if("call"===e3.taskType){if(!ao){z.default.error("Please select a contact for the call");return}if(!e3.contactPhone.trim()){z.default.error("Selected contact does not have a phone number");return}}e0(!0);try{let[a,t]=e2.split(":").map(Number),r=new Date(e1);r.setHours(a,t,0,0);let s=new Date(r);s.setMinutes(s.getMinutes()+e3.durationMinutes);let n={title:e3.title,task_type:e3.taskType,due_date:r.toISOString(),due_time:e2,description:e3.description,priority:e3.priority,duration_minutes:e3.durationMinutes,meeting_location:e3.location||void 0,assigned_to_id:e3.assignedToId||e.id,assigned_to_name:e3.assignedToName||e.full_name||e.email,contact_name:e3.contactName||void 0,contact_phone:e3.contactPhone||void 0,contact_email:e3.contactEmail||void 0};await (0,O.vr)(e.workspace_id,n),z.default.success("Task created successfully"),eJ(!1),aW()}catch(a){console.error("Create error:",a);let e=(null===(s=a.response)||void 0===s?void 0:null===(r=s.data)||void 0===r?void 0:r.detail)||a.message||"Failed to create ".concat(eK);z.default.error(e)}finally{e0(!1)}},aY=async(a,t)=>{if(t.stopPropagation(),!a.contactPhone){z.default.error("No phone number available for this contact");return}if(!(null==e?void 0:e.workspace_id)){z.default.error("Workspace not found");return}await aQ(a,"917994631745")},aQ=async(a,t)=>{if((null==e?void 0:e.workspace_id)&&a.contactPhone)try{eZ(a.id),eB([]),eH("");let r=await (0,Y.x$)(e.workspace_id,{lead_id:a.leadId||"",customer_phone:a.contactPhone,agent_phone:t,record:!0,agent_id:e.id,agent_name:e.full_name||e.email});r.success?(eA(r.call_id),ez(r.voice_call_id),z.default.success("Calling... Your phone will ring first")):(z.default.error(r.error||"Failed to initiate call"),eZ(null))}catch(e){console.error("Call error:",e),z.default.error(e.message||"Failed to initiate call"),eZ(null)}},aG=async()=>
1{if(eS&&(null==e?void 0:e.workspace_id))try{if(eE(!0),"task"===eS.source&&eS.taskId)await (0,O._5)(eS.taskId,e.workspace_id),z.default.success("Task deleted successfully");else if("calendar"===eS.source&&eS.id)await el.deleteEvent(eS.id,e.workspace_id),z.default.success("Event deleted successfully"),aq();else if(eS.uid)await B.Bt(eS.uid,eS.calendarId),z.default.success("Event deleted successfully");else{z.default.error("Unable to delete this item");return}eT(null),eP(!1),aW()}catch(e){console.error("Delete error:",e),z.default.error(e.message||"Failed to delete")}finally{eE(!1)}},aV=(0,s.useCallback)(()=>{let e=new Date(er),a=new Date(er);if("day"===eu)e.setHours(0,0,0,0),a.setHours(23,59,59,999);else if("week"===eu){let t=e.getDay();e.setDate(e.getDate()-t),e.setHours(0,0,0,0),a.setDate(a.getDate()+(6-t)),a.setHours(23,59,59,999)}else"month"===eu&&(e.setDate(1),e.setHours(0,0,0,0),a.setMonth(a.getMonth()+1,0),a.setHours(23,59,59,999));return{start:e,end:a}},[er,eu]),aW=(0,s.useCallback)(async()=>{try{eC(!0);let{start:e,end:a}=aV(),t=await B.vw({start:e.toISOString(),end:a.toISOString(),agentId:"all"!==ew?ew:void 0,taskType:"all"!==ej?ej:void 0,includeTasks:!0,includeCalendar:!0});ep(t.events)}catch(e){console.error("Failed to fetch events:",e),z.default.error("Failed to load calendar events",{id:"calendar-events-error"})}finally{eC(!1),a()}},[aV,ew,ej,a]),aq=(0,s.useCallback)(async()=>{if(null==e?void 0:e.workspace_id)try{let{start:a,end:t}=aV(),r=await el.listEvents(e.workspace_id,{start:a.toISOString(),end:t.toISOString(),is_active:!0});ae(r.events||[])}catch(e){console.error("Failed to fetch announcement events:",e)}},[null==e?void 0:e.workspace_id,aV]),aJ=(0,s.useCallback)(async()=>
1{try{let e=await B.tT();ef(e)}catch(e){console.error("Failed to fetch calendars:",e)}},[]),aK=(0,s.useCallback)(async()=>{if(t||J)try{let e=await B.j8();ev(e)}catch(e){console.error("Failed to fetch agents:",e)}},[t,J]),aX=(0,s.useCallback)(async()=>{ag(!0);try{let e=await O.v1.getTeamMembers();at(e)}catch(e){console.error("Failed to fetch team members:",e)}finally{ag(!1)}},[]),a$=(0,s.useCallback)(async a=>{if(null==e?void 0:e.workspace_id){ac(!0);try{let t=await en.api.get("/contacts",{params:{workspace_id:e.workspace_id,search:a||void 0,has_phone:!0,limit:50,status:"active"}});as(t.data.contacts||t.data||[])}catch(e){console.error("Failed to fetch contacts:",e),as([])}finally{ac(!1)}}},[null==e?void 0:e.workspace_id]),a0=(0,s.useCallback)(e=>{al(e),ah.current&&clearTimeout(ah.current),ah.current=setTimeout(()=>{a$(e)},300)},[a$]),a1=e=>{ai(e.id),al(e.name||e.phone||""),ax(!1),e6(a=>({...a,contactName:e.name||"",contactPhone:e.phone||"",contactEmail:e.email||""}))};(0,s.useEffect)(()=>{let e=e=>{ap.current&&!ap.current.contains(e.target)&&ax(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,s.useEffect)(()=>{aJ(),aK(),aX(),a$(),aR()},[aJ,aK,aX,a$,aR]),(0,s.useEffect)(()=>{aW(),aq()},[aW,aq]),(0,s.useEffect)(()=>{console.log("[Calendar] selectedEvent changed:",null==eS?void 0:eS.id,null==eS?void 0:eS.title,eS)},[eS]),(0,s.useEffect)(()=>{let a=$.get("openTask");if(console.log("[Calendar] openTask effect - openTaskId:",a,"loading:",e_,"processed:",et.current),!a||et.current===a)return;if(e_){console.log("[Calendar] Still loading, waiting...");return}et.current=a,console.log("[Calendar] Processing openTaskId:",a);let t=eh.find(e=>e.taskId===a||e.id===a);if(console.log("[Calendar] Found in events:",t),t){eT(t),ee.replace("/dashboard/calendar",{scroll:!1});return}console.log("[Calendar] Fetching task directly..."),(async()=>{try{let t=String((null==e?void 0:e.workspace_id)||localStorage.getItem("workspace_id")||"");console.log("[Calendar] Using workspace_id:",t);let r=await (0,O._X)(a,t);if(console.log("[Calendar] Task fetch response:",r),null==r?void 0:r.task){let e=r.task;console.log("[Calendar] Converting task to event:",e);let a=e.task_type||"other",t={id:e.id,taskId:e.id,title:e.title||e.description||"Task",start:e.due_date||new Date().toISOString(),end:e.due_date||new Date().toISOString(),allDay:!1,calendarId:"tasks",color:G[a]||G.other,taskType:a,priority:e.priority||"normal",status:e.status||"scheduled",description:e.description,contactName:e.contact_name,contactPhone:e.contact_phone,contactEmail:e.contact_email,companyName:e.company_name,assignedToName:e.assigned_to_name,source:"task"};console.log("[Calendar] Setting selectedEvent:",t),eT(t)}else console.log("[Calendar] No task in response"),z.default.error("Task not found - it may have been deleted")}catch(e){var t;console.error("Failed to fetch task:",e),(null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.status)===404?z.default.error("Task not found - it may have been deleted"):z.default.error("Failed to load task")}finally{ee.replace("/dashboard/calendar",{scroll:!1})}})()},[$,eh,e_,ee,null==e?void 0:e.workspace_id]);let a5=e=>{eg(a=>{let t=new Date(a);if("today"===e)return new Date;let r="next"===e?1:-1;return"day"===eu?t.setDate(t.getDate()+r):"week"===eu?t.setDate(t.getDate()+7*r):t.setMonth(t.getMonth()+r),t})},a2=e=>[...eh.filter(a=>{let t=new Date(a.start);return t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}),...e8.filter(a=>{let t=new Date(a.start_date);return t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}).map(e=>{var a;return{id:e.id,title:e.title,description:e.description,location:(null===(a=e.meta_data)||void 0===a?void 0:a.location)||"",start:e.start_date,end:e.end_date,allDay:e.all_day,calendarId:"announcements",color:e.color,status:e.is_active?"active":"inactive",source:"calendar",taskType:e.event_type}})],a4=e=>{let a=(e.taskType||"").toLowerCase().replace(/\s+/g,"_"),t=(e.title||"").toLowerCase(),r=new Date(e.start),s=new Date;if("calendar"===e.source)return a&&em[a]?a:"announcement";let n=r.getTime()<s.getTime()&&"completed"!==e.status,l="call"===a||a.includes("call")||t.startsWith("[call]"),o="follow_up"===a||"followup"===a||a.includes("follow");return l&&n?"overdue":l?"call":o&&n?"overdue":o?"follow_up":"task"===a||"task"===e.source?"task":a&&em[a
1]?a:"task"},a3=e=>em[a4(e)]||em.task,[a6,a7]=(0,s.useState)(new Date);(0,s.useEffect)(()=>{let e=setInterval(()=>{a7(new Date)},6e4);return()=>clearInterval(e)},[]);let a9=(e,a)=>{let t=new Date(e.start),r=new Date(e.end?e.end:t.getTime()+18e5),s=t.getHours(),n=t.getMinutes(),l=r.getHours(),o=r.getMinutes(),i=(s-7)*60+n;return{top:i/60*a,height:Math.max(Math.max((l-7)*60+o-i,30)/60*a,28)}},[a8,te]=(0,s.useState)(new Date);return(0,r.jsxs)("div",{className:"min-h-full flex flex-col bg-[#f8fafc] dark:bg-[#0f172a]",children:[(0,r.jsxs)("div",{className:"flex-shrink-0 z-30 bg-gradient-to-r from-white via-white to-gray-50/80 dark:from-[#1e293b] dark:via-[#1e293b] dark:to-slate-800/80 border-b border-gray-200/80 dark:border-gray-700/50 shadow-sm backdrop-blur-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-2 sm:px-4 md:px-5 h-14 sm:h-16 md:h-[72px]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 md:gap-5",children:[(0,r.jsx)("button",{onClick:()=>a5("today"),className:"group relative h-8 sm:h-10 px-3 sm:px-5 bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 hover:from-green-600 hover:via-emerald-600 hover:to-teal-600 text-white text-xs sm:text-sm font-semibold rounded-lg sm:rounded-xl shadow-md shadow-green-500/20 hover:shadow-lg hover:shadow-green-500/30 transition-all duration-200",children:(0,r.jsx)("span",{className:"relative z-10",children:"Today"})}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 sm:gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg sm:rounded-xl p-0.5 sm:p-1",children:[(0,r.jsx)("button",{onClick:()=>a5("prev"),className:"h-7 w-7 sm:h-9 sm:w-9 rounded-md sm:rounded-lg flex items-center justify-center hover:bg-white dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-150 hover:shadow-sm",children:(0,r.jsx)(_.Z,{className:"h-4 w-4 sm:h-5 sm:w-5"})}),(0,r.jsx)("button",{onClick:()=>a5("next"),className:"h-7 w-7 sm:h-9 sm:w-9 rounded-md sm:rounded-lg flex items-center justify-center hover:bg-white dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white transition-all duration-150 hover:shadow-sm",children:(0,r.jsx)(C.Z,{className:"h-4 w-4 sm:h-5 sm:w-5"})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,r.jsx)("div",{className:"hidden md:flex items-center justify-center w-10 h-10 sm:w-12 sm:h-12 rounded-xl sm:rounded-2xl bg-gradient-to-br from-green-500/10 via-emerald-500/10 to-teal-500/10 dark:from-green-500/20 dark:via-emerald-500/20 dark:to-teal-500/20 border border-green-200/50 dark:border-green-700/30",children:(0,r.jsx)(f.Z,{className:"h-5 w-5 sm:h-6 sm:w-6 text-green-600 dark:text-green-400"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-base sm:text-lg md:text-xl font-bold text-gray-900 dark:text-white",children:er.toLocaleDateString("en-US",{month:"long"})}),(0,r.jsx)("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 font-medium hidden sm:block",children:er.getFullYear()})]})]})]}),(0,r.jsx)("div",{"data-tour":"calendar-view-selector",className:"hidden lg:flex items-center bg-gray-100 dark:bg-gray-800/80 rounded-2xl p-1.5 shadow-inner",children:["day","week","month","schedule"].map(e=>(0,r.jsx)("button",{onClick:()=>ex(e),className:"px-5 py-2 text-sm font-semibold rounded-xl transition-all duration-200 ".concat(eu===e?"bg-white dark:bg-gray-700 text-green-600 dark:text-green-400 shadow-md":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-white/50 dark:hover:bg-gray-700/50"),children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(t||J)&&ey.length>0&&(0,r.jsxs)(i.Ph,{value:ew,onValueChange:ek,children:[(0,r.jsxs)(i.i4,{className:"w-[150px] h-10 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 rounded-xl text-sm font-medium shadow-sm hover:shadow-md transition-shadow",children:[(0,r.jsx)(x.Z,{className:"h-4 w-4 mr-2 text-green-500"}),(0,r.jsx)(i.ki,{placeholder:"All team"})]}),(0,r.jsxs)(i.Bw,{children:[(0,r.jsx)(i.Ql,{value:"all",children:"All Team"}),(null==e?void 0:e.id)&&(0,r.jsx)(i.Ql,{value:e.id,children:"My Calendar"}),ey.filter(a=>a.id!==(null==e?void 0:e.id)).map(e=>(0,r.jsx)(i.Ql,{value:e.id,children:e.name},e.id))]})]}),(0,r.jsxs)(i.Ph,{value:ej,onValueChange:eN,children:[(0,r.jsx)(i.i4,{"data-tour":"calendar-type-filter",className:"w-[140px] h-10 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 rounded-xl text-sm font-medium shadow-sm hover:shadow-md transition-shadow",children:(0,r.jsx)(i.ki,{placeholder:"All types"})}),(0,r.jsxs)(i.Bw,{children:[(0,r.jsx)(i.Ql,{value:"all",children:"All Types"}),(0,r.jsx)(i.Ql,{value:"call",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})," Calls"]})}),(0,r.jsx)(i.Ql,{value:"meeting",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-indigo-500"})," Meetings"]})}),(0,r.jsx)(i.Ql,{value:"email",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-orange-500"})," Emails"]}
1)}),(0,r.jsx)(i.Ql,{value:"demo",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-purple-500"})," Demos"]})}),(0,r.jsx)(i.Ql,{value:"follow_up",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"})," Follow-ups"]})})]})]}),(0,r.jsx)("button",{onClick:()=>aW(),className:"h-10 w-10 rounded-xl bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 flex items-center justify-center hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 shadow-sm hover:shadow-md transition-all duration-200",children:(0,r.jsx)(S.Z,{className:"h-4 w-4 ".concat(e_?"animate-spin":"")})})]})]}),(0,r.jsx)("div",{className:"lg:hidden flex items-center justify-center py-3 border-t border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/30",children:(0,r.jsx)("div",{className:"flex items-center bg-white dark:bg-gray-800 rounded-xl p-1 shadow-sm border border-gray-200 dark:border-gray-700",children:["day","week","month","schedule"].map(e=>(0,r.jsx)("button",{onClick:()=>ex(e),className:"px-4 py-2 text-sm font-semibold rounded-lg transition-all duration-200 ".concat(eu===e?"bg-gradient-to-r from-green-500 to-emerald-500 text-white shadow-md":"text-gray-600 dark:text-gray-400 hover:text-gray-900"),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})})]}),(0,r.jsxs)("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[(0,r.jsxs)("div",{className:"hidden xl:flex xl:flex-col w-72 flex-shrink-0 border-r border-gray-200/60 dark:border-gray-700/60 bg-gradient-to-b from-white via-gray-50/30 to-white dark:from-[#1e293b] dark:via-slate-800/50 dark:to-[#1e293b] sticky top-0 max-h-[calc(100vh-140px)]",children:[(0,r.jsx)("div",{className:"flex-shrink-0 p-5 pb-0",children:(0,r.jsx)("button",{"data-tour":"calendar-create-button",onClick:()=>aB(),className:"group relative w-full mb-5",children:(0,r.jsxs)("div",{className:"relative flex items-center justify-center gap-2 px-4 py-2.5 bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 hover:from-green-600 hover:via-emerald-600 hover:to-teal-600 rounded-full shadow-lg shadow-green-500/25 hover:shadow-xl hover:shadow-green-500/35 transition-all duration-300 hover:scale-[1.03]",children:[(0,r.jsx)("div",{className:"absolute inset-0 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"absolute -inset-full top-0 h-full w-1/2 bg-gradient-to-r from-transparent via-white/25 to-transparent skew-x-12 group-hover:animate-shine"})}),(0,r.jsx)("div",{className:"relative w-7 h-7 rounded-full bg-white/20 flex items-center justify-center group-hover:rotate-90 transition-all duration-300",children:(0,r.jsx)(T.Z,{className:"h-4 w-4 text-white"})}),(0,r.jsx)("span",{className:"text-sm font-semibold text-white pr-1",children:"Create"})]})})}),(0,r.jsxs)("div",{className:"flex-1 min-h-0 px-5 pb-5 calendar-sidebar-scroll",children:[(0,r.jsx)("div",{className:"mb-6",children:(()=>{let e=a8.getFullYear(),a=a8.getMonth(),t=ed(e,a),s=ec(e,a),n=[],l=[],o=0===a?11:a-1,i=ed(0===a?e-1:e,o);for(let e=s-1;e>=0;e--){let a=i-e;l.push((0,r.jsx)("div",{className:"w-7 h-7 flex items-center justify-center",children:(0,r.jsx)("span",{className:"text-[11px] text-gray-300 dark:text-gray-600",children:a})},"prev-".concat(e)))}for(let o=1;o<=t;o++){let i=new Date(e,a,o),d=a2(i),c=new Date().toDateString()===i.toDateString(),m=er.toDateString()===i.toDateString(),g=d.length>0,u=0===i.getDay()||6===i.getDay();if(l.push((0,r.jsxs)("div",{className:"w-7 h-7 flex items-center justify-center relative group",children:[(0,r.jsx)("button",{onClick:()=>{eg(i),"month"===eu&&ex("day")},className:"w-6 h-6 rounded-lg text-[11px] font-semibold transition-all duration-200 transform hover:scale-110 ".concat(m?"bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-md shadow-blue-500/30 scale-110":c?"bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 ring-2 ring-blue-500/50 ring-offset-1 ring-offset-white dark:ring-offset-gray-800":u?"text-rose-500 dark:text-rose-400 hover:bg-rose-50 dark:hover:bg-rose-900/20":"text-gray-700 dark:text-gray-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 hover:text-blue-600 dar
1k:hover:text-blue-400"),children:o}),g&&!m&&(0,r.jsxs)("div",{className:"absolute -bottom-0.5 left-1/2 -translate-x-1/2 flex gap-0.5",children:[1===d.length&&(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-blue-500 animate-pulse"}),2===d.length&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-blue-500"}),(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-green-500"})]}),d.length>=3&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-blue-500"}),(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-green-500"}),(0,r.jsx)("div",{className:"w-1 h-1 rounded-full bg-orange-500"})]})]}),g&&(0,r.jsxs)("div",{className:"absolute -top-8 left-1/2 -translate-x-1/2 px-2 py-1 bg-gray-900 dark:bg-gray-700 text-white text-[10px] rounded-md opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap z-10",children:[d.length," event",d.length>1?"s":"",(0,r.jsx)("div",{className:"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-gray-900 dark:border-t-gray-700"})]})]},o)),(s+o)%7==0||o===t){for(;l.length<7;){let e=l.length-(s+t-1)+1;l.push((0,r.jsx)("div",{className:"w-7 h-7 flex items-center justify-center",children:(0,r.jsx)("span",{className:"text-[11px] text-gray-300 dark:text-gray-600",children:e})},"next-".concat(l.length)))}n.push((0,r.jsx)("div",{className:"grid grid-cols-7 gap-0.5",children:l},"week-".concat(n.length))),l=[]}}return(0,r.jsxs)("div",{className:"select-none relative overflow-hidden rounded-2xl bg-gradient-to-br from-white via-blue-50/30 to-indigo-50/50 dark:from-gray-800 dark:via-gray-800/95 dark:to-indigo-950/30 border border-gray-200/60 dark:border-gray-700/60 shadow-lg shadow-blue-500/5 dark:shadow-indigo-500/5 p-4",children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-blue-400/10 to-indigo-400/10 dark:from-blue-500/5 dark:to-indigo-500/5 rounded-full blur-2xl -translate-y-1/2 translate-x-1/2"}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 w-16 h-16 bg-gradient-to-tr from-indigo-400/10 to-purple-400/10 dark:from-indigo-500/5 dark:to-purple-500/5 rounded-full blur-xl translate-y-1/2 -translate-x-1/2"}),(0,r.jsxs)("div",{className:"relative flex items-center justify-between mb-4",children:[(0,r.jsx)("button",{onClick:()=>te(new Date),className:"text-sm font-bold text-gray-800 dark:text-gray-100 hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200",children:a8.toLocaleDateString("en-US",{month:"long",year:"numeric"})}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("button",{onClick:()=>te(new Date(e,a-1,1)),className:"w-7 h-7 rounded-lg flex items-center justify-center hover:bg-blue-100 dark:hover:bg-blue-900/30 text-gray-500 hover:text-blue-600 dark:hover:text-blue-400 transition-all duration-200 hover:scale-110",children:(0,r.jsx)(_.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:()=>te(new Date(e,a+1,1)),className:"w-7 h-7 rounded-lg flex items-center justify-center hover:bg-blue-100 dark:hover:bg-blue-900/30 text-gray-500 hover:text-blue-600 dark:hover:text-blue-400 transition-all duration-200 hover:scale-110",children:(0,r.jsx)(C.Z,{className:"h-4 w-4"})})]})]}),(0,r.jsx)("div",{className:"relative grid grid-cols-7 gap-0 mb-2 pb-2 border-b border-gray-200/50 dark:border-gray-700/50",children:["S","M","T","W","T","F","S"].map((e,a)=>(0,r.jsx)("div",{className:"w-7 h-6 flex items-center justify-center",children:(0,r.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-wider ".concat(0===a||6===a?"text-rose-400 dark:text-rose-500":"text-gray-400 dark:text-gray-500"),children:e})},a))}),(0,r.jsx)("div",{className:"relative space-y-1",children:n}),(0,r.jsx)("div",{className:"relative mt-3 pt-3 border-t border-gray-200/50 dark:border-gray-700/50",children:(0,r.jsxs)("button",{onClick:()=>{te(new Date),eg(new Date)},className:"w-full flex items-center justify-center gap-2 py-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-all duration-200",children:[(0,r.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse"}),"Go to Today"]})})]})})()}),(0,r.jsxs)("div",{"data-tour":"calendar-event-types",className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-slate-50 via-white to-gray-50 dark:from-gray-900 dark:via-gray-850 dar
1k:to-slate-900 border border-gray-200/60 dark:border-gray-700/50 p-4 shadow-lg shadow-gray-200/50 dark:shadow-black/20",children:[(0,r.jsx)("div",{className:"absolute -top-6 -right-6 w-20 h-20 bg-gradient-to-br from-green-400/15 via-emerald-400/10 to-teal-400/5 rounded-full blur-2xl"}),(0,r.jsx)("div",{className:"absolute -bottom-4 -left-4 w-16 h-16 bg-gradient-to-tr from-blue-400/10 via-indigo-400/8 to-purple-400/5 rounded-full blur-xl"}),(0,r.jsx)("div",{className:"absolute inset-0 opacity-[0.4] dark:opacity-[0.15]",style:{backgroundImage:"radial-gradient(circle, #94a3b8 0.5px, transparent 0.5px)",backgroundSize:"16px 16px"}}),(0,r.jsxs)("div",{className:"relative flex items-center justify-between mb-4",children:[(0,r.jsxs)("h4",{className:"text-xs font-bold text-gray-700 dark:text-gray-200 uppercase tracking-wider flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-1.5 h-5 rounded-full bg-gradient-to-b from-green-500 via-blue-500 to-purple-500"}),(0,r.jsx)("span",{children:"Event Types"})]}),"all"!==ej&&(0,r.jsx)("button",{onClick:()=>eN("all"),className:"text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:"Clear"})]}),(0,r.jsxs)("div",{className:"relative space-y-1",children:[(0,r.jsxs)("button",{onClick:()=>eN("call"===ej?"all":"call"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("call"===ej?"bg-green-100 dark:bg-green-950/50":"hover:bg-green-50/60 dark:hover:bg-green-950/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm transition-transform ".concat("call"===ej?"scale-110":""),style:{backgroundColor:em.call,boxShadow:"0 2px 6px ".concat(em.call,"30")}}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("call"===ej?"text-green-700 dark:text-green-400":"text-gray-600 dark:text-gray-400"),children:"Calls"}),(0,r.jsx)(g.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("call"===ej?"text-green-600":"text-green-500/60")}),"call"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-green-600"})]}),(0,r.jsxs)("button",{onClick:()=>eN("meeting"===ej?"all":"meeting"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("meeting"===ej?"bg-indigo-100 dark:bg-indigo-950/50":"hover:bg-indigo-50/60 dark:hover:bg-indigo-950/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm transition-transform ".concat("meeting"===ej?"scale-110":""),style:{backgroundColor:em.meeting,boxShadow:"0 2px 6px ".concat(em.meeting,"30")}}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("meeting"===ej?"text-indigo-700 dark:text-indigo-400":"text-gray-600 dark:text-gray-400"),children:"Meetings"}),(0,r.jsx)(x.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("meeting"===ej?"text-indigo-600":"text-indigo-500/60")}),"meeting"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-indigo-600"})]}),(0,r.jsxs)("button",{onClick:()=>eN("email"===ej?"all":"email"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("email"===ej?"bg-orange-100 dark:bg-orange-950/50":"hover:bg-orange-50/60 dark:hover:bg-orange-950/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm transition-transform ".concat("email"===ej?"scale-110":""),style:{backgroundColor:em.email,boxShadow:"0 2px 6px ".concat(em.email,"30")}}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("email"===ej?"text-orange-700 dark:text-orange-400":"text-gray-600 dark:text-gray-400"),children:"Emails"}),(0,r.jsx)(u.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("email"===ej?"text-orange-600":"text-orange-500/60")}),"email"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-orange-600"})]}),(0,r.jsxs)("button",{onClick:()=>eN("demo"===ej?"all":"demo"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("demo"===ej?"bg-purple-100 dark:bg-purple-950/50":"hover:bg-purple-50/60 dark:hover:bg-purple-950/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm transition-transform ".concat("demo"===ej?"scale-110":""),style:{backgroundColor:em.demo,boxShadow:"0 2px 6px ".concat(em.demo,"30")}}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("demo"===ej?"text-purple-700 dark:text-purple-400":"text-gray-600 dark:text-gray-400"),children:"Demos"}),(0,r.jsx)(h.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("demo"===ej?"text-purple-600":"text-purple-500/60")}),"demo"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-purple-600"})]}),(0,r.jsxs)("button",{onClick:()=>eN("follow_up"===ej?"all":"follow_up"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("follow_up"===ej?"bg-amber-100 dar
1k:bg-amber-950/50":"hover:bg-amber-50/60 dark:hover:bg-amber-950/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm transition-transform ".concat("follow_up"===ej?"scale-110":""),style:{backgroundColor:em.follow_up,boxShadow:"0 2px 6px ".concat(em.follow_up,"30")}}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("follow_up"===ej?"text-amber-700 dark:text-amber-400":"text-gray-600 dark:text-gray-400"),children:"Follow-ups"}),(0,r.jsx)(p.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("follow_up"===ej?"text-amber-600":"text-amber-500/60")}),"follow_up"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-amber-600"})]}),(0,r.jsxs)("button",{onClick:()=>eN("all"),className:"w-full flex items-center gap-3 p-2 -mx-2 rounded-xl transition-colors ".concat("all"===ej?"bg-gray-100 dark:bg-gray-800/50":"hover:bg-gray-50/60 dark:hover:bg-gray-800/30"),children:[(0,r.jsx)("div",{className:"w-3.5 h-3.5 rounded-md shadow-sm bg-gradient-to-br from-gray-400 to-gray-500"}),(0,r.jsx)("span",{className:"text-sm font-medium transition-colors ".concat("all"===ej?"text-gray-700 dark:text-gray-200":"text-gray-600 dark:text-gray-400"),children:"All Types"}),(0,r.jsx)(f.Z,{className:"h-3.5 w-3.5 ml-auto ".concat("all"===ej?"text-gray-600":"text-gray-500/60")}),"all"===ej&&(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 text-gray-600"})]})]}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-gray-300/50 dark:via-gray-600/30 to-transparent"})]}),(0,r.jsxs)("div",{"data-tour":"calendar-today-schedule",className:"mt-4 rounded-2xl bg-gradient-to-br from-blue-50 via-indigo-50/50 to-purple-50/30 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-purple-950/10 border border-blue-200/40 dark:border-blue-800/30 p-4 shadow-sm",children:[(0,r.jsxs)("h4",{className:"text-xs font-bold text-blue-700 dark:text-blue-300 uppercase tracking-wider mb-3 flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full bg-blue-500 animate-pulse"}),"Today's Schedule"]}),(()=>{let e=a2(new Date);return 0===e.length?(0,r.jsxs)("div",{className:"text-center py-3",children:[(0,r.jsx)(f.Z,{className:"h-8 w-8 mx-auto text-blue-300 dark:text-blue-700 mb-2"}),(0,r.jsx)("p",{className:"text-sm text-blue-600/70 dark:text-blue-400/70",children:"No events today"})]}):(0,r.jsxs)("div",{className:"space-y-2",children:[e.slice(0,4).map(e=>(0,r.jsxs)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation(),eT(e)},className:"w-full flex items-center gap-2.5 p-2.5 rounded-xl bg-white/60 dark:bg-gray-800/40 hover:bg-white dark:hover:bg-gray-800/60 border border-transparent hover:border-blue-200/50 dark:hover:border-blue-700/30 cursor-pointer transition-all duration-200 hover:shadow-sm group text-left",children:[(0,r.jsx)("div",{className:"w-1.5 h-9 rounded-full flex-shrink-0 transition-transform group-hover:scale-y-110",style:{backgroundColor:a3(e)}}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 truncate group-hover:text-gray-900 dark:group-hover:text-gray-100 transition-colors",children:e.title.replace(/^\[.*?\]\s*/,"")}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 dark:text-gray-400 flex items-center gap-1",children:[(0,r.jsx)(w.Z,{className:"h-3 w-3"}),ei(e.start)]})]})]},e.id)),e.length>4&&(0,r.jsxs)("button",{onClick:()=>{eg(new Date),ex("day")},className:"w-full text-xs font-semibold text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 py-2 rounded-lg hover:bg-white/50 dark:hover:bg-gray-800/30 transition-all",children:["+",e.length-4," more events"]})]})})()]})]})]}),(0,r.jsxs)("div",{className:"flex-1 p-4 relative overflow-auto ".concat("month"===eu?"bg-gray-50 dark:bg-slate-900":""),children:["month"!==eu&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-gray-50 via-emerald-50/20 to-teal-50/30 dark:from-slate-900 dark:via-emerald-950/10 dark:to-slate-900"}),(0,r.jsx)("div",{className:"absolute inset-0 opacity-[0.4] dar
1k:opacity-[0.15]",style:{backgroundImage:"radial-gradient(circle, #10b981 0.5px, transparent 0.5px)",backgroundSize:"24px 24px"}}),(0,r.jsx)("div",{className:"absolute top-0 right-0 w-[600px] h-[600px] bg-gradient-to-bl from-green-400/15 via-emerald-300/10 to-transparent dark:from-green-500/10 dark:via-emerald-500/5 rounded-full blur-3xl"}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 w-[500px] h-[500px] bg-gradient-to-tr from-teal-400/15 via-cyan-300/10 to-transparent dark:from-teal-500/10 dark:via-cyan-500/5 rounded-full blur-3xl"}),(0,r.jsx)("div",{className:"absolute top-1/4 right-1/4 w-64 h-64 bg-gradient-to-br from-green-400/20 to-emerald-500/15 dark:from-green-500/10 dark:to-emerald-500/5 rounded-full blur-3xl animate-pulse",style:{animationDuration:"5s"}}),(0,r.jsx)("div",{className:"absolute bottom-1/3 left-1/3 w-80 h-80 bg-gradient-to-tr from-emerald-400/15 to-teal-400/10 dark:from-emerald-500/8 dark:to-teal-500/5 rounded-full blur-3xl animate-pulse",style:{animationDuration:"7s",animationDelay:"2s"}}),(0,r.jsx)("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[400px] bg-gradient-to-r from-transparent via-green-400/5 to-transparent dark:via-green-500/3 blur-3xl"}),(0,r.jsx)("div",{className:"absolute top-20 left-10 w-32 h-[1px] bg-gradient-to-r from-green-400/30 to-transparent dark:from-green-500/20"}),(0,r.jsx)("div",{className:"absolute top-28 left-10 w-20 h-[1px] bg-gradient-to-r from-emerald-400/20 to-transparent dark:from-emerald-500/15"}),(0,r.jsx)("div",{className:"absolute bottom-20 right-10 w-32 h-[1px] bg-gradient-to-l from-teal-400/30 to-transparent dark:from-teal-500/20"}),(0,r.jsx)("div",{className:"absolute bottom-28 right-10 w-20 h-[1px] bg-gradient-to-l from-green-400/20 to-transparent dark:from-green-500/15"})]}),(0,r.jsx)("div",{className:"relative z-10",children:e_?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-20",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"w-16 h-16 rounded-full border-4 border-blue-200 dark:border-blue-800"}),(0,r.jsx)("div",{className:"absolute inset-0 w-16 h-16 rounded-full border-4 border-transparent border-t-blue-600 animate-spin"})]}),(0,r.jsx)("p",{className:"mt-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:"Loading calendar..."})]}):(0,r.jsxs)(r.Fragment,{children:["day"===eu&&(()=>{let e=Array.from({length:14},(e,a)=>a+7),a=a2(er),t=new Date().toDateString()===er.toDateString(),s=a6.getHours(),n=a6.getMinutes(),l=t&&s>=7&&s<=20;return(0,r.jsxs)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm rounded-2xl border border-gray-200/60 dark:border-gray-700/60 shadow-xl shadow-gray-200/50 dark:shadow-gray-900/50 overflow-hidden",children:[(0,r.jsxs)("div",{className:"py-5 px-4 border-b border-gray-200/60 dark:border-gray-700/60 text-center relative overflow-hidden ".concat(t?"bg-gradient-to-br from-blue-50 via-indigo-50/50 to-purple-50/30 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-purple-950/10":"bg-gradient-to-b from-gray-50 to-white dark:from-gray-800 dark:to-gray-900"),children:[t&&(0,r.jsx)("div",{className:"absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-blue-500 via-indigo-500 to-purple-500"}),(0,r.jsx)("div",{className:"text-[11px] font-bold tracking-widest uppercase ".concat(t?"text-blue-600 dark:text-blue-400":"text-gray-500 dark:text-gray-400"),children:er.toLocaleDateString("en-US",{weekday:"long"})}),(0,r.jsx)("div",{className:"mt-2 w-14 h-14 mx-auto flex items-center justify-center rounded-2xl text-2xl font-bold transition-all duration-200 ".concat(t?"bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-lg shadow-blue-500/40":"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-gray-100"),children:er.getDate()}),(0,r.jsx)("div",{className:"text-sm text-gray-500 dark:text-gray-400 mt-2 font-medium",children:er.toLocaleDateString("en-US",{month:"long",year:"numeric"})}),a.length>0&&(0,r.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 px-3 py-1.5 bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm rounded-full border border-gray-200/60 dark:border-gray-700/60 shadow-sm",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-pulse"}),(0,r.jsxs)("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:[a.length," event",1!==a.length?"s":""," scheduled"]})]})]}),(0,r.jsxs)("div",{className:"overflow-auto max-h-[400px] sm:max-h-[500px] lg:max-h-[55vh] relative",children:[l&&(0,r.jsxs)("div",{className:"absolute left-0 right-0 z-20 pointer-events-none flex items-center",style:{to
1p:l?((s-7)*60+n)/60*80:-1},children:[(0,r.jsx)("div",{className:"w-[72px] flex justify-end pr-1",children:(0,r.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 shadow-lg shadow-red-500/50"})}),(0,r.jsx)("div",{className:"flex-1 h-0.5 bg-red-500 shadow-sm"})]}),e.map(e=>{let t=a.filter(a=>a.allDay?7===e:new Date(a.start).getHours()===e);return(0,r.jsxs)("div",{className:"flex border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50/50 dark:hover:bg-gray-800/30 transition-colors duration-150",children:[(0,r.jsx)("div",{className:"flex-shrink-0 px-3 text-right border-r border-gray-200 dark:border-gray-700 relative",style:{width:72,minWidth:72,height:80},children:(0,r.jsx)("span",{className:"absolute -top-2.5 right-3 text-[13px] font-medium text-gray-600 dark:text-gray-400",children:12===e?"12 PM":e>12?"".concat(e-12," PM"):"".concat(e," AM")})}),(0,r.jsxs)("div",{className:"flex-1 relative p-1 cursor-pointer",style:{minHeight:80},onClick:()=>{aB(er,"".concat(e.toString().padStart(2,"0"),":00"))},children:[(0,r.jsx)("div",{className:"absolute left-0 right-0 border-b border-dashed border-gray-100 dark:border-gray-800",style:{to
1p:40}}),t.map((e,a)=>{let s=a4(e),{top:n,height:l}=a9(e,80),o=e.allDay?0:new Date(e.start).getMinutes()/60*80,i=t.length;return(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation(),eT(e)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),eT(e))},className:"absolute rounded-lg px-2 py-1.5 cursor-pointer z-10 hover:z-20 transition-all duration-200 hover:scale-[1.02] hover:shadow-lg",style:{background:em[s]||em.task,top:"".concat(o,"px"),minHeight:e.allDay?"36px":"52px",boxShadow:"0 2px 6px rgba(0,0,0,0.1)",left:i>1?"".concat(i>1?100/i*a:0,"%"):"4px",width:i>1?"".concat(i>1?100/i-1:100,"%"):"calc(100% - 8px)"},children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,r.jsx)("div",{className:"p-1 bg-white/20 rounded flex-shrink-0",children:eo(e.taskType,"h-3.5 w-3.5")}),(0,r.jsxs)("span",{className:"font-semibold text-sm truncate",children:[e.allDay?(0,r.jsx)("span",{className:"text-white/80 text-xs mr-1",children:"All Day"}):(0,r.jsx)("span",{className:"text-white/80 text-xs mr-1",children:ei(e.start)}),e.title.replace(/^\[.*?\]\s*/,"")]})]}),e.contactName&&(0,r.jsxs)("div",{className:"text-white/80 text-xs mt-1 ml-7 flex items-center gap-1 truncate",children:[(0,r.jsx)(v.Z,{className:"h-3 w-3 flex-shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:e.contactName})]}),e.assignedToName&&(0,r.jsxs)("div",{className:"text-white/80 text-xs mt-0.5 ml-7 flex items-center gap-1 truncate",children:[(0,r.jsx)(x.Z,{className:"h-3 w-3 flex-shrink-0"}),(0,r.jsx)("span",{className:"truncate",children:e.assignedToName})]})]},e.id)})]})]},e)})]})]})})(),"week"===eu&&(()=>{let{start:e}=aV(),a=Array.from({length:12},(e,a)=>a+7),t=a6.getHours(),s=a6.getMinutes(),n=t>=7&&t<=18,l=Array.from({length:7},(a,t)=>{let r=new Date(e);return r.setDate(e.getDate()+t),{date:r,dayName:r.toLocaleDateString("en-US",{weekday:"short"}).toUpperCase(),dayNum:r.getDate(),isToday:new Date().toDateString()===r.toDateString(),events:a2(r)}}),o=()=>{let e=s.toString().padStart(2,"0");return"".concat(t>12?t-12:t,":").concat(e," ").concat(t>=12?"PM":"AM")};return(0,r.jsx)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm rounded-2xl border border-gray-200/60 dark:border-gray-700/60 overflow-hidden shadow-xl shadow-gray-200/50 dark:shadow-gray-900/50",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("div",{className:"grid min-w-[800px]",style:{gridTemplateColumns:"70px repeat(7, 1fr)"},children:[(0,r.jsx)("div",{className:"border-b border-r border-gray-200/60 dark:border-gray-700/60 bg-gradient-to-b from-gray-50 to-white dark:from-gray-800 dark:to-gray-900"}),l.map((e,a)=>{let t=e.events.filter(e=>{var a;return(null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase())==="call"}).length,s=e.events.filter(e=>{var a;return"follow_up"===(null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase())}).length,n=e.events.filter(e=>{var a;return(null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase())==="meeting"}).length,l=e.events.filter(e=>{var a;return(null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase())==="demo"}).length,o=e.events.filter(e=>{var a;return(null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase())==="email"}).length,i=e.events.filter(e=>{var a;let t=null===(a=e.taskType)||void 0===a?void 0:a.toLowerCase();return!t||!["call","follow_up","meeting","demo","email"].includes(t)}).length,d=e.events.length;return(0,r.jsxs)("div",{className:"py-3 text-center border-b border-r last:border-r-0 border-gray-200 dark:border-gray-700 ".concat(e.isToday?"bg-green-50/50 dark:bg-green-950/20":"bg-white dark:bg-gray-900"),children:[(0,r.jsx)("div",{className:"text-xs font-semibold tracking-wide ".concat(e.isToday?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-gray-400"),children:e.dayName}),(0,r.jsx)("div",{className:"mt-1 w-9 h-9 mx-auto flex items-center justify-center rounded-full text-xl font-semibold ".concat(e.isToday?"bg-green-500 text-white":"text-gray-800 dark:text-gray-200"),children:e.dayNum}),d>0?(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap justify-center gap-1 px-1",children:[t>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",children:[(0,r.jsx)(g.Z,{className:"h-2.5 w-2.5"})," ",t]}),s>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",children:[(0,r.jsx)(p.Z,{className:"h-2.5 w-2.5"})," ",s]}),n>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400",children:[(0,r.jsx)(x.Z,{className:"h-2.5 w-2.5"})," ",n]}),l>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",children:[(0,r.jsx)(h.Z,{className:"h-2.5 w-2.5"})," ",l]}),o>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",children:[(0,r.jsx)(u.Z,{className:"h-2.5 w-2.5"})," ",o]}),i>0&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[(0,r.jsx)(f.Z,{className:"h-2.5 w-2.5"})," ",i]})]}):(0,r.jsx)("div",{className:"mt-2 text-[10px] text-gray-400 dark:text-gray-500",children:"No events"})]},a)}),a.map(e=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border-r border-b border-gray-200 dark:border-gray-700 pr-3 py-0 text-right relative bg-white dark:bg-gray-900",style:{height:80},children:(0,r.jsx)("span",{className:"absolute -top-2 right-3 text-xs text-gray-500 dark:text-gray-400 font-medium",children:12===e?"12 PM":e>12?"".concat(e-12," PM"):"".concat(e," AM")})},"time-".concat(e)),l.map((a,l)=>{let i=a.events.filter(a=>a.allDay?7===e:new Date(a.start).getHours()===e);return(0,r.jsxs)("div",{className:"border-r border-b last:border-r-0 border-gray-200 dark:border-gray-700 relative cursor-pointer hover:bg-green-50/50 dark:hover:bg-green-950/20 transition-colors ".concat(a.isToday?"bg-green-50/30 dark:bg-green-950/10":"bg-white dark:bg-gray-900"),style:{height:80},onClick:()=>{aB(new Date(a.date),"".concat(e.toString().padStart(2,"0"),":00"))},children:[a.isToday&&n&&t===e&&(0,r.jsxs)(r.Fragment,{children:[0===l&&(0,r.jsxs)("div",{className:"absolute z-30 flex items-center pointer-events-none",style:{to
1p:s/60*80-8,left:-70,width:70},children:[(0,r.jsx)("span",{className:"text-[11px] font-semibold text-rose-500 pr-1",children:o()}),(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500 flex-shrink-0"})]}),(0,r.jsx)("div",{className:"absolute left-0 right-0 z-20 pointer-events-none border-t border-dashed border-green-500",style:{top:s/60*80}})]}),i.slice(0,4).map((e,a)=>{var t,s,n;let l=a3(e),o=e.allDay?0:new Date(e.start).getMinutes(),d=new Date(e.end?e.end:new Date(e.start).getTime()+36e5),c=e.allDay?45:Math.max((d.getTime()-new Date(e.start).getTime())/6e4,45),m=e.allDay?36:Math.max(c/60*80,50),u=e.allDay?0:o/60*80,x=(null===(t=e.taskType)||void 0===t?void 0:t.toLowerCase())==="follow_up"||(null===(s=e.taskType)||void 0===s?void 0:s.toLowerCase())==="call"||(null===(n=e.title)||void 0===n?void 0:n.toLowerCase().includes("follow")),h=!!e.contactPhone,p=eD===e.id,b=Math.min(i.length,4);return(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation(),eT(e)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),eT(e))},className:"absolute rounded-lg px-1.5 py-1 cursor-pointer z-10 hover:shadow-lg hover:z-20 transition-all duration-200 group overflow-hidden",style:{backgroundColor:l,top:"".concat(u,"px"),height:"".concat(m,"px"),minHeight:e.allDay?"36px":"50px",left:b>1?"".concat(b>1?100/b*a+1:0,"%"):"4px",width:b>1?"".concat(b>1?100/b-2:100,"%"):"calc(100% - 8px)"},children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1 text-white",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[eo(e.taskType,"h-3 w-3 flex-shrink-0"),(0,r.jsx)("span",{className:"font-semibold text-xs truncate",children:e.title.replace(/^\[.*?\]\s*/,"")})]}),x&&1===b&&!e.allDay&&(0,r.jsx)("button",{onClick:a=>aY(e,a),disabled:p||!h,className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center transition-all border ".concat(h?"bg-white text-green-600 border-green-600 hover:bg-green-100 hover:text-green-700 hover:scale-110 shadow-sm":"bg-gray-200 text-gray-400 border-gray-300 cursor-not-allowed"),title:h?"Call ".concat(e.contactPhone):"No phone number",children:p?(0,r.jsx)(y.Z,{className:"h-3 w-3 animate-spin"}):(0,r.jsx)(g.Z,{className:"h-3 w-3"})})]}),(0,r.jsxs)("div",{className:"text-white/90 text-[10px] mt-0.5 flex items-center gap-1",children:[(0,r.jsx)("span",{children:e.allDay?"All Day":ei(e.start)}),e.assignedToName&&1===b&&(0,r.jsxs)("span",{className:"opacity-75",children:["⢠",e.assignedToName]})]})]},e.id)}),i.length>4&&(0,r.jsxs)("div",{onClick:e=>{e.stopPropagation(),eg(a.date),ex("day")},className:"absolute bottom-1 right-1 z-30 bg-green-600 text-white text-[10px] font-semibold px-1.5 py-0.5 rounded-full cursor-pointer hover:bg-green-700 transition-colors shadow-md",children:["+",i.length-4]}),12===e&&0===a.events.length&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:(0,r.jsx)("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"No events"})})]},"cell-".concat(e,"-").concat(l))})]}))]})})})})(),"month"===eu&&(()=>{let e=er.getFullYear(),a=er.getMonth(),t=ed(e,a),s=ec(e,a),n=[],l=[],o=0===a?11:a-1,i=ed(0===a?e-1:e,o);for(let e=s-1;e>=0;e--){let a=i-e;l.push((0,r.jsx)("div",{className:"p-2 bg-gray-50 dark:bg-gray-900/70 border-b border-r border-gray-200 dark:border-gray-800",children:(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,r.jsx)("span",{className:"w-7 h-7 flex items-center justify-center text-sm text-gray-400 dark:text-gray-600",children:a})})},"prev-".concat(e)))}for(let o=1;o<=t;o++){let i=new Date(e,a,o),d=a2(i),c=new Date().toDateString()===i.toDateString();if(l.push((0,r.jsxs)("div",{className:"p-2 border-b border-r border-gray-200 dark:border-gray-800 transition-all duration-150 group cursor-pointer ".concat(c?"bg-green-50 dark:bg-green-950/30 border-t-[3px] border-t-green-500":"bg-white dark:bg-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800/50"),onClick:e=>{e.target.closest("button[data-event-card]")||aB(i)},children:[(0,r.jsx)("div",{className:"flex items-center justify-center mb-1.5",children:(0,r.jsx)("span",{className:"w-7 h-7 flex items-center justify-center rounded-full text-sm font-medium transition-all duration-150 ".concat(c?"bg-green-500 text-white shadow-md shadow-green-500/30":"text-gray-700 dark:text-gray-300 group-hover:bg-gray-200 dark:group-hover:bg-gray-700"),children:o})}),(0,r.jsxs)("div",{className:"space-y-0.5 flex-1 relative z-10",children:[d.slice(0,4).map(e=>{let a=em[a4(e)]||em.other;return(0,r.jsx)("button",{type:"button","data-event-card":"true",onClick:a=>{a.preventDefault(),a.stopPropagation(),console.log("[Calendar] Month view event clicked:",e.id,e.title),eT(e)},className:"w-full flex items-center gap-1.5 px-1.5 py-1 rounded cursor-pointer transition-all duration-150 hover:shadow-md hover:scale-[1.02] relative z-20 text-left",style:{backgroundColor:a+"20",borderLeft:"3px solid ".concat(a)},children:(0,r.jsxs)("span",{className:"text-[10px] font-medium truncate",style:{color:a},children:[ei(e.start).replace(":00","").toLowerCase()," ",e.title.replace(/^\[.*?\]\s*/,"")]})},e.id)}),d.length>4&&(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),eg(i),ex("day")},className:"w-full text-[10px] font-semibold text-green-600 dark:text-green-400 hover:text-green-700 dark:hover:text-green-300 py-0.5 rounded hover:bg-green-100 dark:hover:bg-green-900/30 transition-colors duration-150 flex items-center justify-center gap-1",children:(0,r.jsxs)("span",{children:["+",d.length-4," more"]})})]})]},o)),(s+o)%7==0||o===t){let e=1;for(;l.length<7;)l.push((0,r.jsx)("div",{className:"p-2 bg-gray-50 dark:bg-gray-900/70 border-b border-r border-gray-200 dark:border-gray-800",children:(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,r.jsx)("span",{className:"w-7 h-7 flex items-center justify-center text-sm text-gray-400 dark:text-gray-600",children:e++})})},"next-".concat(l.length)));n.push((0,r.jsx)("div",{className:"grid grid-cols-7 flex-1",children:l},"week-".concat(n.length))),l=[]}}return(0,r.jsx)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm rounded-2xl border border-gray-200/60 dark:border-gray-700/60 shadow-xl shadow-gray-200/50 dark:shadow-gray-900/50 overflow-hidden min-h-[500px] lg:min-h-[60vh] flex flex-col",children:(0,r.jsx)("div",{className:"overflow-x-auto flex-1 flex flex-col",children:(0,r.jsxs)("div",{className:"min-w-[700px] flex-1 flex flex-col",children:[(0,r.jsx)("div",{className:"grid grid-cols-7 bg-gradient-to-b from-gray-50 to-white dark:from-gray-800 dark:to-gray-900 border-b border-gray-200/60 dark:border-gray-700/60 flex-shrink-0",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map((e,a)=>(0,r.jsx)("div",{className:"py-3 text-center border-r border-gray-200/60 dark:border-gray-700/60 last:border-r-0",children:(0,r.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-widest ".concat(0===a||6===a?"text-rose-500 dark:text-rose-400":"text-gray-600 dark:text-gray-400"),children:e})},e))}),(0,r.jsx)("div",{className:"flex-1 flex flex-col",children:n})]})})})})(),"schedule"===eu&&(()=>{let e=[...eh].sort((e,a)=>new Date(e.start).getTime()-new Date(a.start).getTime()),a={};
1return e.forEach(e=>{let t=new Date(e.start).toDateString();a[t]||(a[t]=[]),a[t].push(e)}),(0,r.jsxs)("div",{className:"space-y-4",children:[Object.entries(a).map(e=>{let[a,t]=e,s=new Date().toDateString()===a;return(0,r.jsxs)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm rounded-2xl border border-gray-200/60 dark:border-gray-700/60 shadow-lg shadow-gray-200/30 dark:shadow-gray-900/30 overflow-hidden transition-all duration-200 hover:shadow-xl",children:[(0,r.jsxs)("div",{className:"px-4 py-3 border-b border-gray-200/60 dark:border-gray-700/60 relative ".concat(s?"bg-gradient-to-r from-blue-50 via-indigo-50/50 to-blue-50 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-blue-950/30":"bg-gradient-to-b from-gray-50 to-white dark:from-gray-800 dark:to-gray-900"),children:[s&&(0,r.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-1 bg-gradient-to-b from-blue-500 to-indigo-500"}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-11 h-11 rounded-xl flex items-center justify-center text-lg font-bold transition-all duration-200 ".concat(s?"bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-md shadow-blue-500/30":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"),children:new Date(a).getDate()}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-2",children:[new Date(a).toLocaleDateString("en-US",{weekday:"long"}),s&&(0,r.jsx)(o.C,{className:"bg-gradient-to-r from-blue-500 to-indigo-500 text-white border-0 shadow-sm",children:"Today"})]}),(0,r.jsx)("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(a).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})})]})]})]}),(0,r.jsx)("div",{className:"divide-y dark:divide-gray-800",children:t.map(e=>{let a=em[a4(e)]||em.other;return(0,r.jsxs)("div",{role:"button",tabIndex:0,onClick:a=>{a.preventDefault(),a.stopPropagation(),eT(e)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),eT(e))},className:"flex items-start gap-4 p-4 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors",children:[(0,r.jsx)("div",{className:"w-1 self-stretch rounded-full flex-shrink-0",style:{background:a}}),(0,r.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:a+"20"},children:eo(e.taskType,"h-5 w-5")}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-medium text-gray-900 dark:text-gray-100",children:e.title.replace(/^\[.*?\]\s*/,"")}),(0,r.jsxs)("div",{className:"flex items-center gap-4 mt-1 text-sm text-gray-500 dark:text-gray-400",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(w.Z,{className:"h-3.5 w-3.5"}),ei(e.start),e.end&&" - ".concat(ei(e.end))]}),e.location&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(k.Z,{className:"h-3.5 w-3.5"}),e.location]})]}),(e.contactName||e.companyName)&&(0,r.jsxs)("div",{className:"flex items-center gap-4 mt-1 text-sm text-gray-500 dark:text-gray-400",children:[e.contactName&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(v.Z,{className:"h-3.5 w-3.5"}),e.contactName]}),e.companyName&&(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(j.Z,{className:"h-3.5 w-3.5"}),e.companyName]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.priority&&(0,r.jsx)(o.C,{variant:"urgent"===e.priority?"destructive":"secondary",className:"text-xs",children:e.priority}),"completed"===e.status&&(0,r.jsx)(N.Z,{className:"h-5 w-5 text-green-500"})]})]},e.id)})})]},a)}),0===Object.keys(a).length&&(0,r.jsxs)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm rounded-2xl border border-gray-200/60 dark:border-gray-700/60 shadow-lg p-12 text-center",children:[(0,r.jsx)("div",{className:"w-20 h-20 mx-auto mb-4 rounded-2xl bg-gradient-to-br from-blue-100 to-indigo-100 dark:from-blue-900/30 dark:to-indigo-900/30 flex items-center justify-center",children:(0,r.jsx)(f.Z,{className:"h-10 w-10 text-blue-500 dark:text-blue-400"})}),(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-700 dark:text-gray-300 mb-2",children:"No events scheduled"}),(0,r.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"There are no events scheduled for this period"})]})]})})()]})})]})]}),(0,r.jsx)("button",{onClick:()=>aB(),className:"xl:hidden fixed bottom-8 right-8 z-40 w-14 h-14 bg-blue-600 hover:bg-blue-700 text-white rounded-full shadow-lg hover:shadow-xl transition-all duration-200 flex items-center justify-center group",title:"Add Event or Task",children:(0,r.jsx)(T.Z,{className:"h-6 w-6 group-hover:rotate-90 transition-transform duration-200"})}),eq&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>eJ(!1),children:(0,r.jsxs)("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl sm:rounded-3xl shadow-2xl w-full max-w-[95vw] sm:max-w-lg md:max-w-2xl max-h-[90vh] overflow-hidden animate-in fade-in zoom-in-95 duration-300 flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{className:"absolute top-0 right-0 w-40 h-40 bg-gradient-to-bl from-green-400/20 via-emerald-400/10 to-transparent roun
1ded-full blur-3xl"}),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 w-32 h-32 bg-gradient-to-tr from-teal-400/15 via-cyan-400/10 to-transparent rounded-full blur-2xl"}),(0,r.jsxs)("div",{className:"relative px-4 sm:px-6 py-4 sm:py-5 bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 flex-shrink-0",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxjaXJjbGUgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iLjEiIGN4PSIyMCIgY3k9IjIwIiByPSIyIi8+PC9nPjwvc3ZnPg==')] opacity-30"}),(0,r.jsxs)("div",{className:"relative flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 sm:w-10 sm:h-10 rounded-lg sm:rounded-xl bg-white/20 backdrop-blur-sm flex items-center justify-center",children:"task"===eK?(0,r.jsx)(N.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 text-white"}):(0,r.jsx)(f.Z,{className:"h-4 w-4 sm:h-5 sm:w-5 text-white"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("h3",{className:"text-base sm:text-lg font-bold text-white",children:["Create ","event"===eK?"Event":"Task"]}),(0,r.jsx)("p",{className:"text-white/70 text-[10px] sm:text-xs",children:e1?e1.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"Select a date"})]})]}),(0,r.jsx)("button",{onClick:()=>eJ(!1),className:"w-8 h-8 rounded-lg bg-white/10 hover:bg-white/20 flex items-center justify-center transition-colors",children:(0,r.jsx)(D.Z,{className:"h-4 w-4 text-white"})})]})]}),(t||K)&&(0,r.jsx)("div",{className:"relative px-4 sm:px-6 pt-4 sm:pt-5 flex-shrink-0",children:(0,r.jsxs)("div",{className:"flex bg-gray-100 dark:bg-gray-800 rounded-lg sm:rounded-xl p-1 sm:p-1.5 shadow-inner",children:[(0,r.jsxs)("button",{onClick:()=>eX("task"),className:"flex-1 flex items-center justify-center gap-1.5 sm:gap-2 py-2 sm:py-2.5 px-3 sm:px-4 text-xs sm:text-sm font-semibold rounded-md sm:rounded-lg transition-all duration-200 ".concat("task"===eK?"bg-white dark:bg-gray-700 text-green-600 dark:text-green-400 shadow-md":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:[(0,r.jsx)(N.Z,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 ".concat("task"===eK?"text-green-500":"")}),"Task"]}),(0,r.jsxs)("button",{onClick:()=>eX("event"),className:"flex-1 flex items-center justify-center gap-1.5 sm:gap-2 py-2 sm:py-2.5 px-3 sm:px-4 text-xs sm:text-sm font-semibold rounded-md sm:rounded-lg transition-all duration-200 ".concat("event"===eK?"bg-white dark:bg-gray-700 text-green-600 dark:text-green-400 shadow-md":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:[(0,r.jsx)(f.Z,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 ".concat("event"===eK?"text-green-500":"")}),"Event"]})]})}),(0,r.jsxs)("div",{className:"relative px-4 sm:px-6 py-4 sm:py-5 space-y-3 sm:space-y-4 flex-1 overflow-y-auto",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"title",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Title *"}),(0,r.jsx)(d.I,{id:"title",value:"event"===eK?e7.title:e3.title,onChange:e=>"event"===eK?e9({...e7,title:e.target.value}):e6({...e3,title:e.target.value}),placeholder:"event"===eK?"e.g., Company Holiday, Team Meeting...":"e.g., Follow up with client...",className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 focus:border-green-500 focus:ring-green-500/20 text-sm"})]}),"event"===eK&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"eventDescription",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description *"}),(0,r.jsx)(m.g,{id:"eventDescription",value:e7.description,onChange:e=>e9({...e7,description:e.target.value}),placeholder:"Describe the event, announcement, or holiday...",className:"mt-1 sm:mt-1.5 h-20 sm:h-24 rounded-lg sm:rounded-xl resize-none border-gray-200 dark:border-gray-700 text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 sm:mb-2 block",children:"Event Type"}),(0,r.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-5 ga
1p-2",children:[{value:"announcement",label:"Announcement",color:"#6366f1"},{value:"holiday",label:"Holiday",color:"#ef4444"},{value:"program",label:"Program",color:"#10b981"},{value:"reminder",label:"Reminder",color:"#f59e0b"},{value:"other",label:"Other",color:"#6b7280"}].map(e=>{let{value:a,label:t,color:s}=e;return(0,r.jsxs)("button",{type:"button",onClick:()=>e9({...e7,eventType:a,color:s}),className:"flex flex-col items-center gap-1 p-2 sm:p-3 rounded-lg border-2 transition-all duration-200",style:{borderColor:e7.eventType===a?s:"#e5e7eb",backgroundColor:e7.eventType===a?"".concat(s,"15"):void 0},children:[(0,r.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:s}}),(0,r.jsx)("span",{className:"text-[9px] sm:text-[10px] font-medium ".concat(e7.eventType===a?"text-gray-900 dark:text-gray-100":"text-gray-500"),children:t})]},a)})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("button",{type:"button",onClick:()=>e9({...e7,allDay:!e7.allDay}),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors ".concat(e7.allDay?"bg-green-500":"bg-gray-300"),children:(0,r.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(e7.allDay?"translate-x-6":"translate-x-1")})}),(0,r.jsx)(c._,{className:"text-xs sm:text-sm text-gray-700 dark:text-gray-300",children:"All Day Event"})]}),!e7.allDay&&(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"eventStartTime",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Start Time *"}),(0,r.jsx)(d.I,{id:"eventStartTime",type:"time",value:e7.startTime,onChange:e=>e9({...e7,startTime:e.target.value}),className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)(c._,{htmlFor:"eventEndTime",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:["End Time ",(0,r.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,r.jsx)(d.I,{id:"eventEndTime",type:"time",value:e7.endTime,onChange:e=>e9({...e7,endTime:e.target.value}),className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"date",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Date"}),(0,r.jsx)(d.I,{id:"date",type:"date",value:e1?"".concat(e1.getFullYear(),"-").concat(String(e1.getMonth()+1).padStart(2,"0"),"-").concat(String(e1.getDate()).padStart(2,"0")):"",onChange:e=>{let[a,t,r]=e.target.value.split("-").map(Number);e5(new Date(a,t-1,r))},className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]}),"event"===eK&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(c._,{htmlFor:"eventLocation",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:["Location ",(0,r.jsx)("span",{className:"text-gray-400",children:"(Optional)"})]}),(0,r.jsx)(d.I,{id:"eventLocation",value:e7.location,onChange:e=>e9({...e7,location:e.target.value}),placeholder:"e.g., Conference Room, Online, etc.",className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]}),"task"===eK&&(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"time",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Time"}),(0,r.jsx)(d.I,{id:"time",type:"time",value:e2,onChange:e=>e4(e.target.value),className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]})]}),"task"===eK&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 sm:mb-2 block",children:"Task Type"}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:gap-3",children:[{value:"call",icon:g.Z,label:"Call",description:"Phone call with contact"},{value:"meeting",icon:x.Z,label:"Meeting",description:"In-person or video meeting"},{value:"other",icon:b.Z,label:"Other",description:"Email, demo, proposal, etc."}].map(e=>{let{value:a,icon:t,label:s,description:n}=e;return(0,r.jsxs)("button",{type:"button",onClick:()=>e6({...e3,taskType:a}),className:"flex flex-col items-center gap-1.5 sm:gap-2 p-3 sm:p-4 roun
1ded-xl border-2 transition-all duration-200",style:{borderColor:e3.taskType===a?em[a]||"#6b7280":"#e5e7eb",backgroundColor:e3.taskType===a?"".concat(em[a]||"#6b7280","15"):void 0},children:[(0,r.jsx)(t,{className:"h-5 w-5 sm:h-6 sm:w-6",style:{color:e3.taskType===a?em[a]||"#6b7280":"#9ca3af"}}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("span",{className:"text-xs sm:text-sm font-semibold block ".concat(e3.taskType===a?"text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"),children:s}),(0,r.jsx)("span",{className:"text-[9px] sm:text-[10px] text-gray-400 dark:text-gray-500 hidden sm:block",children:n})]})]},a)})})]}),"call"===e3.taskType&&(0,r.jsxs)("div",{className:"p-3 sm:p-4 rounded-lg sm:rounded-xl bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800/30 space-y-3 sm:space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center gap-1.5",children:[(0,r.jsx)(Z.Z,{className:"h-3.5 w-3.5"}),"Assign To"]}),(0,r.jsxs)(i.Ph,{value:e3.assignedToId||"self",onValueChange:a=>{if("self"===a||""===a)e6(a=>({...a,assignedToId:(null==e?void 0:e.id)||"",assignedToName:(null==e?void 0:e.full_name)||(null==e?void 0:e.email)||""}));else{let e=aa.find(e=>e.id===a);e&&e6(a=>({...a,assignedToId:e.id,assignedToName:e.full_name||e.email}))}},children:[(0,r.jsx)(i.i4,{className:"mt-1 h-9 sm:h-10 rounded-lg text-sm",children:(0,r.jsx)(i.ki,{placeholder:"Select staff member..."})}),(0,r.jsxs)(i.Bw,{children:[(0,r.jsx)(i.Ql,{value:"self",children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)(v.Z,{className:"h-3.5 w-3.5"}),(null==e?void 0:e.full_name)||(null==e?void 0:e.email)," (Me)"]})}),aa.filter(a=>a.id!==(null==e?void 0:e.id)).map(e=>(0,r.jsx)(i.Ql,{value:e.id,children:(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)(v.Z,{className:"h-3.5 w-3.5"}),e.full_name||e.email,e.dashboard_role&&(0,r.jsxs)("span",{className:"text-xs text-gray-400",children:["(",e.dashboard_role.replace("_"," "),")"]})]})},e.id))]})]})]}),(0,r.jsxs)("div",{ref:ap,children:[(0,r.jsxs)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 flex items-center gap-1.5",children:[(0,r.jsx)(x.Z,{className:"h-3.5 w-3.5"}),"Select Contact *"]}),(0,r.jsxs)("div",{className:"mt-1 relative",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(I.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 z-10"}),(0,r.jsx)(d.I,{value:an,onChange:e=>a0(e.target.value),onFocus:()=>{ax(!0),0===ar.length&&a$()},placeholder:"Search contacts by name, phone, or email...",className:"pl-9 pr-9 h-9 sm:h-10 rounded-lg text-sm ".concat(ao?"border-green-500 bg-green-50 dark:bg-green-950/20":"")}),ad?(0,r.jsx)(y.Z,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 animate-spin text-gray-400"}):ao?(0,r.jsx)("button",{type:"button",onClick:()=>{ai(""),al(""),e6(e=>({...e,contactName:"",contactPhone:"",contactEmail:""}))},className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 hover:text-gray-600",children:(0,r.jsx)(D.Z,{className:"h-4 w-4"})}):null]}),au&&(0,r.jsx)("div",{className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-auto",children:0===ar.length?(0,r.jsx)("div",{className:"p-3 text-center text-sm text-gray-500",children:ad?(0,r.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}),"Searching..."]}):an?"No contacts found":"Type to search contacts..."}):ar.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>a1(e),className:"w-full px-3 py-2.5 text-left hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border-b border-gray-100 dark:border-gray-700 last:border-0 ".concat(ao===e.id?"bg-green-50 dark:bg-green-950/30":""),children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0 w-8 h-8 bg-gray-100 dark:bg-gray-700 rounded-full flex items-center justify-center",children:(0,r.jsx)(v.Z,{className:"h-4 w-4 text-gray-500"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"font-medium text-sm text-gray-900 dark:text-gray-100 truncate",children:e.name||"Unnamed"}),(0,r.jsxs)("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:[e.phone||"No phone",e.email&&" ⢠".concat(e.email)]})]}),ao===e.id&&(0,r.jsx)(N.Z,{className:"h-4 w-4 text-green-500 flex-shrink-0"})]})},e.id))})]})]}),ao&&e3.contactName&&(0,r.jsxs)("div",{className:"p-3 bg-white dark:bg-gray-800 rounded-lg border border-green-200 dark:border-green-700/50 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-700 dark:text-green-400",children:[(0,r.jsx)(N.Z,{className:"h-4 w-4"}),"Contact Selected"]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Name:"}),(0,r.jsx)("p",{className:"font-medium",children:e3.contactName})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Phone:"}),(0,r.jsx)("p",{className:"font-medium",children:e3.contactPhone||"N/A"})]}),e3.contactEmail&&(0,r.jsxs)("div",{className:"col-span-2",children:[(0,r.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Email:"}),(0,r.jsx)("p",{className:"font-medium",children:e3.contactEmail})]})]})]})]}),"meeting"===e3.taskType&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex bg-indigo-50 dark:bg-indigo-950/30 rounded-xl p-1",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>aN("quick"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-3 text-sm font-medium rounded-lg transition-all ".concat("quick"===aj?"bg-white dark:bg-gray-800 text-indigo-600 shadow-sm":"text-gray-500 hover:text-gray-700"),children:[(0,r.jsx)(w.Z,{className:"h-4 w-4"}),"Quick Meeting"]}),(0,r.jsxs)("button",{type:"button",onClick:()=>aN("scheduler"),className:"flex-1 flex items-center justify-center gap-2 py-2 px-3 text-sm font-medium rounded-lg transition-all ".concat("scheduler"===aj?"bg-white dark:bg-gray-800 text-indigo-600 shadow-sm":"text-gray-500 hover:text-gray-700"),children:[(0,r.jsx)(P.Z,{className:"h-4 w-4"}),"Meeting Scheduler"]})]}
1),"scheduler"===aj&&(0,r.jsxs)("div",{className:"p-4 rounded-xl bg-indigo-50 dark:bg-indigo-950/20 border border-indigo-200 dark:border-indigo-800/30 space-y-4",children:[(null==ay?void 0:ay.booking_url_slug)&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-white dark:bg-gray-800 rounded-lg border border-indigo-100 dark:border-indigo-800/50",children:[(0,r.jsx)(P.Z,{className:"h-4 w-4 text-indigo-500"}),(0,r.jsx)("span",{className:"text-sm text-gray-600 dark:text-gray-400 flex-1 truncate",children:"".concat(window.location.origin,"/book/").concat(ay.booking_url_slug)}),(0,r.jsx)("button",{type:"button",onClick:()=>aU(),className:"p-1.5 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 rounded-md transition-colors",children:aI?(0,r.jsx)(N.Z,{className:"h-4 w-4 text-green-500"}):(0,r.jsx)(M.Z,{className:"h-4 w-4 text-indigo-500"})}),(0,r.jsx)("a",{href:"/book/".concat(ay.booking_url_slug),target:"_blank",rel:"noopener noreferrer",className:"p-1.5 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 rounded-md transition-colors",children:(0,r.jsx)(E.Z,{className:"h-4 w-4 text-indigo-500"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)(c._,{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Meeting Types"}),(0,r.jsxs)("button",{type:"button",onClick:()=>aC(!a_),className:"text-xs text-indigo-600 hover:text-indigo-700 font-medium flex items-center gap-1",children:[(0,r.jsx)(T.Z,{className:"h-3 w-3"}),"New Type"]})]}),a_&&(0,r.jsxs)("div",{className:"p-3 bg-white dark:bg-gray-800 rounded-lg border border-indigo-200 dark:border-indigo-700 mb-3 space-y-3",children:[(0,r.jsx)(d.I,{placeholder:"Meeting type name (e.g., 30-min Discovery Call)",value:aS.name,onChange:e=>aT({...aS,name:e.target.value}),className:"h-9 text-sm"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)(i.Ph,{value:aS.duration_minutes.toString(),onValueChange:e=>aT({...aS,duration_minutes:parseInt(e)}),children:[(0,r.jsx)(i.i4,{className:"h-9 text-sm",children:(0,r.jsx)(i.ki,{placeholder:"Duration"})}),(0,r.jsx)(i.Bw,{children:Q.sT.map(e=>(0,r.jsx)(i.Ql,{value:e.value.toString(),children:e.label},e.value))})]}),(0,r.jsxs)(i.Ph,{value:aS.location_type,onValueChange:e=>aT({...aS,location_type:e}),children:[(0,r.jsx)(i.i4,{className:"h-9 text-sm",children:(0,r.jsx)(i.ki,{placeholder:"Location"})}),(0,r.jsx)(i.Bw,{children:Q.Bq.map(e=>(0,r.jsx)(i.Ql,{value:e.value,children:e.label},e.value))})]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(l.z,{type:"button",size:"sm",variant:"outline",onClick:()=>aC(!1),className:"flex-1",children:"Cancel"}),(0,r.jsx)(l.z,{type:"button",size:"sm",onClick:aH,disabled:aD,className:"flex-1 bg-indigo-600 hover:bg-indigo-700",children:aD?(0,r.jsx)(y.Z,{className:"h-4 w-4 animate-spin"}):"Create"})]})]}),ab.length>0?(0,r.jsx)("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:ab.filter(e=>e&&e.id).map(e=>{var a;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-2.5 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-indigo-300 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:e.name}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[e.duration_minutes," min ⢠",(null===(a=Q.Bq.find(a=>a.value===e.location_type))||void 0===a?void 0:a.label)||e.location_type]})]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>aU(e.slug),className:"p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-md transition-colors",title:"Copy booking link",children:(0,r.jsx)(M.Z,{className:"h-3.5 w-3.5 text-gray-400"})})]},e.id)})}):(0,r.jsx)("p",{className:"text-sm text-gray-500 text-center py-3",children:"No meeting types yet. Create one to enable public booking."})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("a",{href:"/dashboard/booking/settings",target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-indigo-600 border border-gray-200 dark:border-gray-700 rounded-lg transition-colors",children:[(0,r.jsx)(F.Z,{className:"h-4 w-4"}),"Booking Settings"]}),(0,r.jsxs)("a",{href:"/dashboard/booking/availability",target:"_blank",rel:"noopener noreferrer",className:"flex-1 flex items-center justify-center gap-2 py-2 px-3 text-sm font-medium text-gray-600 dark:text-gray-400 hover:text-indigo-600 border border-gray-200 dark:border-gray-700 rounded-lg transition-colors",children:[(0,r.jsx)(w.Z,{className:"h-4 w-4"}),"Availability"]})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 sm:mb-2 block",children:"Priority"}),(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-1.5 sm:gap-2",children:[{value:"low",label:"Low",color:"bg-gray-100 text-gray-600 border-gray-300"},{value:"normal",label:"Normal",color:"bg-blue-50 text-blue-600 border-blue-300"},{value:"high",label:"High",color:"bg-orange-50 text-orange-600 border-orange-300"},{value:"urgent",label:"Urgent",color:"bg-red-50 text-red-600 border-red-300"}].map(e=>{let{value:a,label:t,color:s}=e;return(0,r.jsx)("button",{type:"button",onClick:()=>e6({...e3,priority:a}),className:"py-1.5 sm:py-2 px-2 sm:px-3 text-xs sm:text-sm font-medium rounded-lg border-2 transition-all ".concat(e3.priority===a?"".concat(s):"bg-white dark:bg-gray-800 text-gray-500 border-gray-200 dark:border-gray-700 hover:border-gray-300"),children:t},a)})})]})]}),"task"===eK&&("meeting"===e3.taskType||"demo"===e3.taskType)&&(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300 mb-1.5 sm:mb-2 block",children:"Duration"}),(0,r.jsx)("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-1.5 sm:gap-2",children:[{value:"15",label:"15m",fullLabel:"15 minutes"},{value:"30",label:"30m",fullLabel:"30 minutes"},{value:"45",label:"45m",fullLabel:"45 minutes"},{value:"60",label:"1h",fullLabel:"1 hour"},{value:"90",label:"1.5h",fullLabel:"1.5 hours"},{value:"120",label:"2h",fullLabel:"2 hours"}].map(e=>{let{value:a,label:t,fullLabel:s}=e;return(0,r.jsxs)("button",{type:"button",onClick:()=>e6({...e3,durationMinutes:parseInt(a)}),className:"py-1.5 sm:py-2 px-2 text-[10px] sm:text-xs font-medium rounded-lg border-2 transition-all ".concat(e3.durationMinutes.toString()===a?"bg-green-50 dark:bg-green-950/30 text-green-600 dark:text-green-400 border-green-500":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700 hover:border-gray-300"),children:[(0,r.jsx)("span",{className:"sm:hidden",children:t}),(0,r.jsx)("span",{className:"hidden sm:inline",children:s})]},a)})})]}),"task"===eK&&"meeting"===e3.taskType&&(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"location",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Location"}),(0,r.jsx)(d.I,{id:"location",value:e3.location,onChange:e=>e6({...e3,location:e.target.value}),className:"mt-1 sm:mt-1.5 h-9 sm:h-10 rounded-lg sm:rounded-xl border-gray-200 dark:border-gray-700 text-sm"})]}),"task"===eK&&(0,r.jsxs)("div",{children:[(0,r.jsx)(c._,{htmlFor:"description",className:"text-xs sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:"Description"}),(0,r.jsx)(m.g,{id:"description",value:e3.description,onChange:e=>e6({...e3,description:e.target.value}),className:"mt-1 sm:mt-1.5 h-16 sm:h-20 rounded-lg sm:rounded-xl resize-none border-gray-200 dark:border-gray-700 text-sm"})]})]}),(0,r.jsxs)("div",{className:"relative px-4 sm:px-6 py-3 sm:py-4 bg-gradient-to-t from-gray-50 to-white dark:from-gray-800 dark:to-gray-900 border-t border-gray-100 dark:border-gray-800 flex items-center justify-end gap-2 sm:gap-3 flex-shrink-0",children:[(0,r.jsx)(l.z,{variant:"outline",onClick:()=>eJ(!1),className:"rounded-lg sm:rounded-xl text-xs sm:text-sm h-8 sm:h-10 px-3 sm:px-4",children:"Cancel"}),(0,r.jsx)("button",{onClick:aO,disabled:e$,className:"flex items-center gap-1.5 sm:gap-2 px-4 sm:px-6 py-2 sm:py-2.5 bg-gradient-to-r from-green-500 via-emerald-500 to-teal-500 hover:from-green-600 hover:via-emerald-600 hover:to-teal-600 text-white text-xs sm:text-sm font-semibold rounded-lg sm:rounded-xl shadow-lg shadow-green-500/25 hover:shadow-xl hover:shadow-green-500/30 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:e$?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 animate-spin"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Creating..."}),(0,r.jsx)("span",{className:"sm:hidden",children:"..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T.Z,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4"}),(0,r.jsxs)("span",{className:"hidden sm:inline",children:["Create ","event"===eK?"Event":"Task"]}),(0,r.jsx)("span",{className:"sm:hidden",children:"Create"})]})})]})]})}),eS&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black/40 flex items-center justify-center z-[100] p-4",onClick:az,children:(0,r.jsxs)("div",{className:"bg-white dark:bg-gray-900 rounded-2xl shadow-xl w-full overflow-hidden animate-in fade-in zoom-in-95 duration-200 max-h-[90vh] flex flex-col ".concat(eF&&eD===eS.id?"max-w-2xl":"max-w-md"),onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{className:"px-6 py-4",style:{background:a3(eS)},children:(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 text-white",children:[eo(eS.taskType,"h-6 w-6"),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:eS.title.replace(/^\[.*?\]\s*/,"")}),eS.taskType&&(0,r.jsx)("span",{className:"text-white/80 text-sm capitalize",children:eS.taskType.replace("_"," ")})]})]}),(0,r.jsx)("button",{onClick:az,className:"text-white/80 hover:text-white transition-colors",children:(0,r.jsx)(D.Z,{className:"h-5 w-5"})})]})}),(0,r.jsxs)("div",{className:"px-6 py-4 space-y-4 overflow-y-auto flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)(w.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"font-medium",children:new Date(eS.start).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),(0,r.jsxs)("div",{className:"text-sm text-gray-500",children:[ei(eS.start),eS.end&&" - ".concat(ei(eS.end))]})]})]}),eS.location&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)(k.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsx)("span",{children:eS.location})]}),eS.contactName&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)(v.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:eS.contactName}),eS.contactPhone&&(0,r.jsx)("div",{className:"text-sm text-gray-500",children:eS.contactPhone}),eS.contactEmail&&(0,r.jsx)("div",{className:"text-sm text-gray-500",children:eS.contactEmail})]})]}),eS.companyName&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)(j.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsx)("span",{children:eS.companyName})]}),eS.assignedToName&&(0,r.jsxs)("div",{className:"flex items-center gap-3 text-gray-700 dark:text-gray-300",children:[(0,r.jsx)(x.Z,{className:"h-5 w-5 text-gray-400"}),(0,r.jsxs)("span",{children:["Assigned to ",eS.assignedToName]})]}),eS.description&&(0,r.jsx)("div",{className:"pt-3 border-t",children:(0,r.jsx)("p",{className:"text-gray-600 dark:text-gray-400 text-sm whitespace-pre-wrap",children:eS.description})}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 pt-2",children:[eS.priority&&(0,r.jsxs)(o.C,{variant:"urgent"===eS.priority?"destructive":"secondary",children:[eS.priority," priority"]}),eS.status&&(0,r.jsx)(o.C,{variant:"outline",children:eS.status}),"task"===eS.source&&(0,r.jsx)(o.C,{variant:"outline",children:"Task"})]}),eF&&eD===eS.id&&(0,r.jsx)("div",{className:"pt-4",children:(0,r.jsx)(X,{status:aM.status,duration:aM.duration,onEndCall:aA,isEndingCall:eV})}),eF&&eD===eS.id&&(0,r.jsx)("div",{className:"pt-4",children:(0,r.jsx)(ea,{messages:eU,callStatus:aM.status,isLoading:eO})}),eF&&eD===eS.id&&(0,r.jsx)("div",{className:"pt-4",children:(0,r.jsx)(es,{value:eR,onChange:eH,callId:eF,onSave:aF,isSaving:eQ,showSaveButton:aM.isEnded&&!!eS.leadId,placeholder:"Type notes during the call..."})})]}),(0,r.jsxs)("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-800 flex justify-between items-center",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[eS.contactPhone&&!aM.isActive&&(0,r.jsx)(l.z,{type:"button",variant:"default",className:"bg-green-600 hover:bg-green-700",onClick:e=>{e.preventDefault(),e.stopPropagation(),aY(eS,e)},disabled:eD===eS.id&&!aM.isEnded,children:eD!==eS.id||aM.isEnded?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(g.Z,{className:"h-4 w-4 mr-2"}),aM.isEnded?"Call Again":"Call Now"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Calling..."]})}),aM.isEnded&&eR.trim()&&eS.leadId&&(0,r.jsx)(l.z,{type:"button",variant:"default",onClick:e=>{e.preventDefault(),e.stopPropagation(),aF()},disabled:eQ,children:eQ?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Z,{className:"h-4 w-4 mr-2"}),"Save Notes"]})})]}),(0,r.jsx)("div",{className:"flex gap-2",children:eI?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-amber-600 dar
1k:text-amber-500 text-sm mr-2",children:[(0,r.jsx)(L.Z,{className:"h-4 w-4"}),(0,r.jsxs)("span",{children:["Delete this ",(null==eS?void 0:eS.source)==="task"?"task":"event","?"]})]}),(0,r.jsx)(l.z,{variant:"destructive",size:"sm",onClick:aG,disabled:eM,children:eM?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y.Z,{className:"h-4 w-4 mr-1 animate-spin"}),"Deleting..."]}):"Yes, Delete"}),(0,r.jsx)(l.z,{variant:"outline",size:"sm",onClick:()=>eP(!1),disabled:eM,children:"Cancel"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.z,{variant:"outline",size:"sm",className:"text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950/30 border-red-200 dark:border-red-800",onClick:()=>eP(!0),children:[(0,r.jsx)(A.Z,{className:"h-4 w-4 mr-1"}),"Delete"]}),(0,r.jsx)(l.z,{variant:"outline",onClick:az,children:"Close"})]})})]})]})}),(0,r.jsx)(V.X,{pageId:W.O,steps:W.P})]})}},75060:function(e,a,t){t.d(a,{_:function(){return d}});var r=t(57437),s=t(2265),n=t(6394),l=t(90535),o=t(93448);let i=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=s.forwardRef((e,a)=>{let{className:t,...s}=e;return(0,r.jsx)(n.f,{ref:a,className:(0,o.cn)(i(),t),...s})});d.displayName=n.f.displayName},90641:function(e,a,t){t.d(a,{x:function(){return o}});var r=t(57437),s=t(2265),n=t(43643),l=t(93448);let o=s.forwardRef((e,a)=>{let{className:t,children:s,...o}=e;return(0,r.jsxs)(n.fC,{ref:a,className:(0,l.cn)("relative overflow-hidden",t),...o,children:[(0,r.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:s}),(0,r.jsx)(i,{}),(0,r.jsx)(n.Ns,{})]})});o.displayName=n.fC.displayName;let i=s.forwardRef((e,a)=>{let{className:t,orientation:s="vertical",...o}=e;return(0,r.jsx)(n.gb,{ref:a,orientation:s,forceMount:!0,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===s&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...o,children:(0,r.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-slate-300 dark:bg-slate-600 hover:bg-slate-400 dark:hover:bg-slate-500 transition-colors"})})});i.displayName=n.gb.displayName},15291:function(e,a,t){t.d(a,{Bw:function(){return u},DI:function(){return c},Ph:function(){return d},Ql:function(){return h},i4:function(){return g},ki:function(){return m},n5:function(){return x}});var r=t(57437),s=t(2265),n=t(56873),l=t(40875),o=t(30401),i=t(93448);let d=n.fC,c=n.ZA,m=n.B4,g=s.forwardRef((e,a)=>{let{className:t,children:s,...o}=e;return(0,r.jsxs)(n.xz,{ref:a,className:(0,i.cn)("flex h-10 w-full items-center justify-between rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 dark:text-gray-100 px-3 py-2 text-sm r
1ing-offset-white dark:ring-offset-gray-950 placeholder:text-gray-500 dark:placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-950 dark:focus:ring-gray-300 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...o,children:[s,(0,r.jsx)(n.JO,{asChild:!0,children:(0,r.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});g.displayName=n.xz.displayName;let u=s.forwardRef((e,a)=>{let{className:t,children:s,position:l="popper",...o}=e;return(0,r.jsx)(n.h_,{children:(0,r.jsx)(n.VY,{ref:a,className:(0,i.cn)("relative z-50 min-w-[8rem] overflow-hidden rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-950 dark:text-gray-100 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...o,children:(0,r.jsx)(n.l_,{className:(0,i.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===l&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:s})})})});u.displayName=n.VY.displayName;let x=s.forwardRef((e,a)=>{let{className:t,...s}=e;return(0,r.jsx)(n.__,{ref:a,className:(0,i.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s})});x.displayName=n.__.displayName;let h=s.forwardRef((e,a)=>{let{className:t,children:s,...l}=e;return(0,r.jsxs)(n.ck,{ref:a,className:(0,i.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...l,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(n.wU,{children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(n.eT,{children:s})]})});h.displayName=n.ck.displayName,s.forwardRef((e,a)=>{let{className:t,...s}=e;return(0,r.jsx)(n.Z0,{ref:a,className:(0,i.cn)("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-700",t),...s})}).displayName=n.Z0.displayName},23675:function(e,a,t){t.d(a,{g:function(){return l}});var r=t(57437),s=t(2265),n=t(93448);let l=s.forwardRef((e,a)=>{let{className:t,error:s,...l}=e;return(0,r.jsx)("textarea",{"aria-invalid":s?"true":void 0,className:(0,n.cn)("flex min-h-[80px] w-full rounded-[4px] border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s&&"border-red-500 focus-visible:ring-red-500",t),ref:a,...l})});l.displayName="Textarea"},48580:function(e,a,t){t.d(a,{O:function(){return s},P:function(){return r}});let r=[{target:'[data-tour="calendar-create-button"]',title:"Create Event/Task",content:"Click here to create a new event or task. Schedule calls, meetings, demos, and follow-ups.",placement:"left"},{target:'[data-tour="calendar-type-filter"]',title:"Filter by Type",content:"Filter events by type - Calls, Meetings, Emails, Demos, and Follow-ups.",placement:"bottom"},{target:'[data-tour="calendar-event-types"]',title:"Event Categories",content:"See event type counts and click any type to filter the calendar view.",placement:"left"},{target:'[data-tour="calendar-today-schedule"]',title:"Today's Schedule",content:"View all your tasks and events scheduled for today. Click any item to see details.",placement:"left"}],s="calendar-page-v2"},9310:function(e,a,t){t.d(a,{H:function(){return i},K:function(){return o}});var r=t(57437),s=t(2265),n=t(99376);let l=(0,s.createContext)(void 0);function o(e){let{children:a}
1=e,[t,o]=(0,s.useState)(!1),i=(0,n.useRouter)(),d=(0,n.usePathname)(),c=(0,s.useRef)(d),m=(0,s.useRef)(null),g=(0,s.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),u=(0,s.useCallback)(()=>{g(),o(!0),m.current=setTimeout(()=>{o(!1)},4e3)},[g]),x=(0,s.useCallback)(()=>{g(),o(!1)},[g]),h=(0,s.useCallback)(e=>{e!==d&&(u(),i.push(e))},[i,d,u]);return(0,s.useEffect)(()=>(d!==c.current&&(c.current=d),()=>g()),[d,g]),(0,r.jsx)(l.Provider,{value:{isNavigating:t,startNavigation:u,endNavigation:x,navigateTo:h},children:a})}function i(){let e=(0,s.useContext)(l);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}},24746:function(e,a,t){t.d(a,{DO:function(){return l}});var r=t(2265),s=t(71837);let n={dashboardRole:"viewer",systemRole:"Customer",enterpriseRole:"staff",enterpriseTier:4,agentGroups:[],permissions:[],dashboardPermissions:[],canAssignLeads:!1,canMoveLeads:!1,canConvertLeads:!1,canDeleteLeads:!1,canManageTeam:!1,canViewReports:!1,canManageCampaigns:!1,canManageBilling:!1,canManageAgentGroups:!1,isAdmin:!1,isManager:!1,isSuperAdmin:!1,loading:!0,error:null,hasPermission:()=>!1,hasAnyPermission:()=>!1,hasAllPermissions:()=>!1,hasMinimumTier:()=>!1,refresh:async()=>{}};function l(){let[e,a]=(0,r.useState)({...n,loading:!1}),t=(0,r.useCallback)(async()=>{let e=localStorage.getItem("access_token");if(console.log("[useRolePermissions] Token found:",!!e),!e){console.log("[useRolePermissions] No token, using default permissions"),a(e=>({...e,loading:!1}));return}try{a(e=>({...e,loading:!0,error:null}));let e=(await s.api.get("/auth/me/dashboard-role")).data;console.log("[useRolePermissions] API response:",e);let r=e.permissions||[],n=e.enterprise_tier||4,l={dashboardRole:e.dashboard_role||"viewer",systemRole:e.system_role||"Customer",enterpriseRole:e.enterprise_role||"staff",enterpriseTier:n,agentGroups:e.agent_groups||[],permissions:r,dashboardPermissions:e.dashboard_permissions||[],canAssignLeads:e.can_assign_leads||!1,canMoveLeads:e.can_move_leads||!1,canConvertLeads:e.can_convert_leads||!1,canDeleteLeads:e.can_delete_leads||!1,canManageTeam:e.can_manage_team||!1,canViewReports:e.can_view_reports||!1,canManageCampaigns:e.can_manage_campaigns||!1,canManageBilling:e.can_manage_billing||!1,canManageAgentGroups:e.can_manage_agent_groups||!1,isAdmin:e.is_admin||!1,isManager:e.is_manager||!1,isSuperAdmin:e.is_super_admin||!1,loading:!1,error:null,hasPermission:e=>r.includes(e),hasAnyPermission:function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.some(e=>r.includes(e))},hasAllPermissions:function(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return a.every(e=>r.includes(e))},hasMinimumTier:e=>n<=e,refresh:t};a(l)}catch(e){console.error("Failed to fetch role permissions:",e),a(a=>({...a,loading:!1,error:e.message||"Failed to fetch permissions"}))}},[]);return(0,r.useEffect)(()=>{t()},[t]),e}},64841:function(e,a,t){t.d(a,{BS:function(){return n},Bq:function(){return w},DS:function(){return l},J2:function(){return s},KI:function(){return v},S6:function(){return o},Tn:function(){return p},Xs:function(){return b},aL:function(){return m},co:function(){return d},d$:function(){return g},dU:function(){return u},ft:function(){return c},iK:function(){return y},iu:function(){return f},mZ:function(){return N},om:function(){return x},sT:function(){return k},uQ:function(){return i},wP:function(){return h},z:function(){return j}});var r=t(71837);async function s(){var e;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(null===(e=(await r.api.get("/booking/meeting-types?include_inactive=".concat(a))).data)||void 0===e?void 0:e.meeting_types)||[]}async function n(e){var a;return null===(a=(await r.api.post("/booking/meeting-types",e)).data)||void 0===a?void 0:a.meeting_type}async function l(e){await r.api.delete("/booking/meeting-types/".concat(e))}async function o(){var e;return(null===(e=(await r.api.get("/booking/availability/schedules")).data)||void 0===e?void 0:e.schedules)||[]}async function i(e){var a;return null===(a=(await r.api.post("/booking/availability/schedules",e)).data)||void 0===a?void 0:a.schedule}async function d(e,a){var t;return null===(t=(await r.api.put("/booking/availability/schedules/".concat(e),a)).data)||void 0===t?void 0:t.schedule}async function c(e,a){var t;return null===(t=(await r.api.post("/booking/availability/schedules/".concat(e,"/exceptions"),a)).data)||void 0===t?void 0:t.exception}async function m(){var e,a;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=new URLSearchParams;t.status&&s.append("status",t.status),t.start_date&&s.append("start_date",t.start_date),t.end_date&&s.append("end_date",t.end_date),t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let n=await r.api.get("/booking/meetings?".concat(s.toString()));return{bookings:(null===(e=n.data)||void 0===e?void 0:e.bookings)||[],total:(null===(a=n.data)||void 0===a?void 0:a.total)||0}}async function g(e,a){var t;return null===(t=(await r.api.post("/booking/meetings/".concat(e,"/cancel"),{reason:a})).data)||void 0===t?void 0:t.booking}async function u(){var e;return null===(e=(await r.api.get("/booking/settings")).data)||void 0===e?void 0:e.settings}async function x(e){var a;return null===(a=(await r.api.put("/booking/settings",e)).data)||void 0===a?void 0:a.settings}async function h(e){return(await r.api.get("/booking/public/".concat(e))).data}async function p(e,a){return(await r.api.get("/booking/public/".concat(e,"/").concat(a))).data}async function b(e,a,t,s,n){let l=new URLSearchParams({start_date:t});return s&&l.append("end_date",s),n&&l.append("guest_timezone",n),(await r.api.get("/booking/public/".concat(e,"/").concat(a,"/slots?").concat(l.toString()))).data}async function f(e,a,t){return(await r.api.post("/booking/public/".concat(e,"/").concat(a,"/book"),t)).data}async function y(e,a){return(await r.api.get("/booking/lookup/".concat(e,"?email=").concat(encodeURIComponent(a)))).data}async function v(e,a,t){return(await r.api.post("/booking/lookup/".concat(e,"/cancel?email=").concat(encodeURIComponent(a)),{reason:t})).data}let w=[{value:"zoom",label:"Zoom",icon:"video"},{value:"google_meet",label:"Google Meet",icon:"video"},{value:"microsoft_teams",label:"Microsoft Teams",icon:"video"},{value:"phone_call",label:"Phone Call",icon:"phone"},{value:"in_person",label:"In Person",icon:"map-pin"},{value:"custom",label:"Custom Location",icon:"link"},{value:"ask_invitee",label:"Ask Invitee",icon:"message-circle"}],k=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:45,label:"45 minutes"},{value:60,label:"1 hour"},{value:90,label:"1.5 hours"},{value:120,label:"2 hours"}],j=[{value:"Asia/Kolkata",label:"India (IST)"}
1,{value:"America/New_York",label:"Eastern Time (ET)"},{value:"America/Chicago",label:"Central Time (CT)"},{value:"America/Denver",label:"Mountain Time (MT)"},{value:"America/Los_Angeles",label:"Pacific Time (PT)"},{value:"Europe/London",label:"London (GMT/BST)"},{value:"Europe/Paris",label:"Paris (CET/CEST)"},{value:"Asia/Dubai",label:"Dubai (GST)"},{value:"Asia/Singapore",label:"Singapore (SGT)"},{value:"Asia/Tokyo",label:"Tokyo (JST)"},{value:"Australia/Sydney",label:"Sydney (AEST)"}],N=[{day:"monday",enabled:!0,slots:[{start:"09:00",end:"17:00"}]},{day:"tuesday",enabled:!0,slots:[{start:"09:00",end:"17:00"}]},{day:"wednesday",enabled:!0,slots:[{start:"09:00",end:"17:00"}]},{day:"thursday",enabled:!0,slots:[{start:"09:00",end:"17:00"}]},{day:"friday",enabled:!0,slots:[{start:"09:00",end:"17:00"}]},{day:"saturday",enabled:!1,slots:[]},{day:"sunday",enabled:!1,slots:[]}]},98999:function(e,a,t){t.d(a,{er:function(){return l},o8:function(){return n},x$:function(){return s}});var r=t(71837);async function s(e,a){return(await r.api.post("/calls/two-way-call",a,{params:{workspace_id:e}})).data}async function n(e,a,t){return(await r.api.get("/calls/".concat(e,"/live-status"),{params:{workspace_id:a,voice_call_id:t}})).data}let l={initiateTwoWayCall:s,getAgentPhone:async function(){return(await r.api.get("/users/me/settings/phone")).data},updateAgentPhone:async function(e){return(await r.api.put("/users/me/settings/phone",{phone:e})).data},getLiveCallStatus:n}},87919:function(e,a,t){t.d(a,{Ak:function(){return s},SR:function(){return g},Vn:function(){return p},Vv:function(){return m},Wl:function(){return c},YY:function(){return u},Yw:function(){return x},_5:function(){return i},_X:function(){return l},lV:function(){return d},lg:function(){return n},t9:function(){return b},v1:function(){return h},vr:function(){return o}});var r=t(71837);async function s(e,a){return(await r.api.get("/follow-ups",{params:{workspace_id:e,...a}})).data}async function n(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:7,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,s=arguments.length>3?arguments[3]:void 0;return(await r.api.get("/follow-ups/upcoming",{params:{workspace_id:e,days:a,limit:t,assigned_to_id:s}})).data}async function l(e,a){return(await r.api.get("/follow-ups/".concat(e),{params:{workspace_id:a}})).data}async function o(e,a){return(await r.api.post("/follow-ups",a,{params:{workspace_id:e}})).data}async function i(e,a){return(await r.api.delete("/follow-ups/".concat(e),{params:{workspace_id:a}})).data}async function d(e,a){return(await r.api.post("/follow-ups/".concat(e,"/start"),null,{params:{workspace_id:a}})).data}async function c(e,a,t){return(await r.api.post("/follow-ups/".concat(e,"/complete"),t,{params:{workspace_id:a}})).data}async function m(e,a,t){return(await r.api.post("/follow-ups/".concat(e,"/skip"),{reason:t},{params:{workspace_id:a}})).data}async function g(e,a){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20;return(await r.api.get("/calls/recent",{params:{workspace_id:e,agent_id:a,limit:t}})).data}async function u(){try{return(await r.api.get("/users",{params:{status:"active",limit:100}})).data}catch(e){return console.error("Failed to fetch team members:",e),[]}}let x={getTasks:s,getTaskStats:async function(e,a){return(await r.api.get("/follow-ups/stats",{params:{workspace_id:e,assigned_to_id:a}})).data},getUpcomingTasks:n,getOverdueTasks:async function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return(await r.api.get("/follow-ups/overdue",{params:{workspace_id:e,limit:a}})).data},getTask:l,createTask:o,updateTask:async function(e,a,t){return(await r.api.put("/follow-ups/".concat(e),t,{params:{workspace_id:a}})).data},deleteTask:i,startTask:d,completeTask:c,skipTask:m,rescheduleTask:async function(e,a,t,s,n){return(await r.api.post("/follow-ups/".concat(e,"/reschedule"),{new_due_date:t,new_due_time:s,reason:n},{params:{workspace_id:a}})).data}},h={getTeamMembers:u};async function p(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;
1return(await r.api.get("/calls",{params:{workspace_id:e,disposition:"no_answer",limit:a,order_by:"started_at",order_dir:"desc"}})).data}let b={getCalls:async function(e,a){return(await r.api.get("/calls",{params:{workspace_id:e,...a}})).data},getCallStats:async function(e,a,t,s){return(await r.api.get("/calls/stats",{params:{workspace_id:e,agent_id:a,date_from:t,date_to:s}})).data},getRecentCalls:g,getMissedCalls:p,getCall:async function(e,a){return(await r.api.get("/calls/".concat(e),{params:{workspace_id:a}})).data}}},40806:function(e,a,t){t.d(a,{Bt:function(){return d},j8:function(){return c},tT:function(){return o},vw:function(){return i}});var r=t(71837);let s=e=>({id:e.id,uid:e.uid,title:e.title,description:e.description,location:e.location,start:e.start,end:e.end,allDay:e.all_day||!1,calendarId:e.calendar_id||"personal",color:e.color||"#3b82f6",status:e.status||"confirmed",source:e.source||"calendar",taskId:e.task_id,taskType:e.task_type,contactName:e.contact_name,contactPhone:e.contact_phone,contactEmail:e.contact_email,companyName:e.company_name,assignedToId:e.assigned_to_id,assignedToName:e.assigned_to_name,leadI
1d:e.lead_id,priority:e.priority,leadStatus:e.lead_status,leadScore:e.lead_score,leadSource:e.lead_source,pipelineId:e.pipeline_id,pipelineName:e.pipeline_name,pipelineColor:e.pipeline_color,stageId:e.stage_id,stageName:e.stage_name,stageColor:e.stage_color,aiInterestCategory:e.ai_interest_category,aiInterestScore:e.ai_interest_score,aiCallSummary:e.ai_call_summary,aiRecommendedAction:e.ai_recommended_action}),n=e=>({id:e.id,name:e.name,color:e.color||"#3b82f6",isDefault:e.is_default||!1}),l=e=>({id:e.id,name:e.name,color:e.color}),o=async()=>((await r.api.get("/calendar/calendars")).data.calendars||[]).map(n),i=async e=>{var a,t;let n=(await r.api.get("/calendar/events",{params:{start:e.start,end:e.end,agent_id:e.agentId,include_tasks:null===(a=e.includeTasks)||void 0===a||a,include_calendar:null===(t=e.includeCalendar)||void 0===t||t,task_type:e.taskType,status:e.status,calendar_id:e.calendarId,pipeline_id:e.pipelineId,stage_id:e.stageId,ai_category:e.aiCategory}})).data;return{events:(n.events||[]).map(s),total:n.total||0,hasCalendar:n.has_calendar||!1,hasTasks:n.has_tasks||!0}},d=async(e,a)=>(await r.api.delete("/calendar/events/".concat(e),{params:{calendar_id:a||"personal"}})).data,c=async()=>((await r.api.get("/calendar/agents")).data.agents||[]).map(l)}}]);
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.