1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4738],{4738:function(e,a,t){t.r(a),t.d(a,{default:function(){return el}});var s=t(57437),n=t(2265),r=t(99376),l=t(69064),i=t(13041),o=t(89345),d=t(31047),c=t(29374),u=t(53417),m=t(91723),x=t(92369),p=t(60044),g=t(85954),h=t(33276),f=t(65302),j=t(17684),v=t(42208),y=t(12527),_=t(51548),b=t(12194),w=t(82431),N=t(99397),k=t(63639),C=t(66901),S=t(20265),T=t(73247),Z=t(95805),R=t(22252),z=t(84881),D=t(24746),I=t(79820),P=t(12381),Q=t(69174),A=t(40279),V=t(60183),F=t(17168),Y=t(15291),M=t(74291),O=t(32060),E=t(75060),B=t(23675),L=t(93448),U=t(87919),q=t(5442);let X=e=>{let a=new Date(e),t=new Date,s=new Date(t);return(s.setDate(s.getDate()+1),a.toDateString()===t.toDateString())?"Today":a.toDateString()===s.toDateString()?"Tomorrow":a.toLocaleDateString("en-US",{month:"short",day:"numeric"})},H=e=>e||"",W=e=>{if(e<60)return"".concat(e,"s");let a=Math.floor(e/60),t=e%60;return t>0?"".concat(a,"m ").concat(t,"s"):"".concat(a,"m")},$=e=>({call:i.Z,email:o.Z,meeting:d.Z,demo:c.Z,follow_up:u.Z,proposal:u.Z,contract:u.Z,other:m.Z})[e]||m.Z,G=e=>({call:"bg-green-100 text-green-700",email:"bg-blue-100 text-blue-700",meeting:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",demo:"bg-orange-100 dark:bg-orange-900/50 text-orange-700 dark:text-orange-300",follow_up:"bg-cyan-100 dark:bg-cyan-900/50 text-cyan-700 dark:text-cyan-300",proposal:"bg-pink-100 dark:bg-pink-900/50 text-pink-700 dark:text-pink-300",contract:"bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-300",other:"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"})[e]||"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300",K=e=>({low:"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400",normal:"bg-blue-100 dark:bg-blue-900/50 text-blue-600 dark:text-blue-400",high:"bg-orange-100 dark:bg-orange-900/50 text-orange-600 dark:text-orange-400",urgent:"bg-red-100 dark:bg-red-900/50 text-red-600 dark:text-red-400"})[e]||"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400",J=e=>({pending:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",scheduled:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",in_progress:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",completed:"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300",cancelled:"bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400",skipped:"bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400",overdue:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300"})[e]||"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400";function ee(e){let{title:a,value:t,icon:n,color:r,subtitle:l}=e;return(0,s.jsx)(I.Zb,{children:(0,s.jsx)(I.aY,{className:"pt-3 sm:pt-4 md:pt-6 pb-3 sm:pb-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-500 truncate",children:a}),(0,s.jsx)("p",{className:"text-xl sm:text-2xl md:text-3xl font-bold mt-0.5 sm:mt-1",children:t}),l&&(0,s.jsx)("p",{className:"text-[10px] sm:text-xs text-gray-400 mt-0.5 sm:mt-1",children:l})]}),(0,s.jsx)("div",{className:(0,L.cn)("w-8 h-8 sm:w-10 sm:h-10 md:w-12 md:h-12 rounded-lg sm:rounded-xl flex items-center justify-center flex-shrink-0",r),children:(0,s.jsx)(n,{className:"w-4 h-4 sm:w-5 sm:h-5 md:w-6 md:h-6 text-white"})})]})})})}function ea(e){let{task:a,onStart:t,onComplete:n,onSkip:r,onReschedule:l,onView:i}=e,o=$(a.task_type),c="overdue"===a.status||"completed"!==a.status&&"cancelled"!==a.status&&"skipped"!==a.status&&new Date(a.due_date)<new Date;return(0,s.jsx)(I.Zb,{className:(0,L.cn)("hover:shadow-md transition-shadow",c&&"border-red-200 bg-red-50/50"),children:(0,s.jsx)(I.aY,{className:"p-4",children:(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:(0,L.cn)("w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",G(a.task_type)),children:(0,s.jsx)(o,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("h3",{className:"font-medium truncate",children:a.title}),(0,s.jsx)(Q.C,{className:(0,L.cn)("text-xs",K(a.priority)),children:a.priority}),c&&(0,s.jsx)(Q.C,{className:"bg-red-100 text-red-700 text-xs",children:"Overdue"})]}),(a.contact_name||a.company_name)&&(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-sm text-gray-500",children:[a.contact_name&&(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(x.Z,{className:"w-3 h-3"}),a.contact_name]}),a.company_name&&(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(p.Z,{className:"w-3 h-3"}),a.company_name]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-2 text-sm",children:[(0,s.jsxs)("span",{className:(0,L.cn)("flex items-center gap-1",c?"text-red-600":"text-gray-500"),children:[(0,s.jsx)(d.Z,{className:"w-3 h-3"}),X(a.due_date),a.due_time&&" at ".concat(H(a.due_time))]}),a.duration_minutes>0&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-gray-400",children:[(0,s.jsx)(g.Z,{className:"w-3 h-3"}),a.duration_minutes,"m"]})]}),a.tags&&a.tags.length>0&&(0,s.jsxs)("div",{className:"flex gap-1 mt-2 flex-wrap",children:[a.tags.slice(0,3).map(e=>(0,s.jsx)(Q.C,{variant:"outline",className:"text-xs",children:e},e)),a.tags.length>3&&(0,s.jsxs)(Q.C,{variant:"outline",className:"text-xs",children:["+",a.tags.length-3]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:["pending"===a.status&&(0,s.jsxs)(P.z,{size:"sm",variant:"outline",onClick:()=>t(a),className:"text-purple-600 border-purple-200 hover:bg-purple-50 hover:text-purple-700 dark:text-purple-400 dark:border-purple-700 dark:hover:bg-purple-900/30 dark:hover:text-purple-300",children:[(0,s.jsx)(h.Z,{className:"w-4 h-4 mr-1"}),"Start"]}),("pending"===a.status||"in_progress"===a.status||"scheduled"===a.status)&&(0,s.jsxs)(P.z,{size:"sm",onClick:()=>n(a),className:"bg-green-600 hover:bg-green-700",children:[(0,s.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),"Complete"]}),(0,s.jsxs)(O.h_,{children:[(0,s.jsx)(O.$F,{asChild:!0,children:(0,s.jsx)(P.z,{size:"sm",variant:"ghost",children:(0,s.jsx)(j.Z,{className:"w-4 h-4"})})}),(0,s.jsxs)(O.AW,{align:"end",children:[(0,s.jsxs)(O.Xi,{onClick:()=>i(a),children:[(0,s.jsx)(v.Z,{className:"w-4 h-4 mr-2"}),"View Details"]}
1),(0,s.jsxs)(O.Xi,{onClick:()=>l(a),children:[(0,s.jsx)(y.Z,{className:"w-4 h-4 mr-2"}),"Reschedule"]}),(0,s.jsxs)(O.Xi,{onClick:()=>r(a),children:[(0,s.jsx)(_.Z,{className:"w-4 h-4 mr-2"}),"Skip"]})]})]})]})]})})})}function et(e){let{call:a}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-4 p-3 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[(0,s.jsx)("div",{className:(0,L.cn)("w-10 h-10 rounded-full flex items-center justify-center","connected"===a.disposition?"bg-green-100 dark:bg-green-900/50 text-green-600 dark:text-green-400":"no_answer"===a.disposition?"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-600 dark:text-yellow-400":"bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400"),children:"inbound"===a.direction?(0,s.jsx)(b.Z,{className:"w-5 h-5"}):(0,s.jsx)(i.Z,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium",children:a.phone_number}),(0,s.jsx)(Q.C,{variant:"outline",className:"text-xs capitalize",children:a.direction}),a.disposition&&(0,s.jsx)(Q.C,{className:(0,L.cn)("text-xs capitalize","connected"===a.disposition?"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300":"voicemail"===a.disposition?"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300":"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300"),children:a.disposition.replace("_"," ")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 text-sm text-gray-500 mt-1",children:[(0,s.jsx)("span",{children:new Date(a.started_at).toLocaleString()}),a.duration_seconds>0&&(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(g.Z,{className:"w-3 h-3"}),W(a.duration_seconds)]}),a.agent_name&&(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)(x.Z,{className:"w-3 h-3"}),a.agent_name]})]})]}),a.outcome&&(0,s.jsx)(Q.C,{className:(0,L.cn)("text-xs capitalize","interested"===a.outcome||"meeting_scheduled"===a.outcome?"bg-green-100 text-green-700":"not_interested"===a.outcome?"bg-red-100 text-red-700":"bg-blue-100 text-blue-700"),children:a.outcome.replace("_"," ")})]})}function es(e){let{open:a,onOpenChange:t,onSubmit:r,teamMembers:l}=e,[i,o]=(0,n.useState)({title:"",task_type:"call",priority:"normal",due_date:new Date().toISOString().split("T")[0],due_time:"10:00",duration_minutes:30,contact_name:"",contact_phone:"",contact_email:"",company_name:"",description:"",assigned_to_id:"",assigned_to_name:""});return(0,s.jsx)(M.Vq,{open:a,onOpenChange:t,children:(0,s.jsxs)(M.cZ,{className:"max-w-[95vw] sm:max-w-md max-h-[90vh]",children:[(0,s.jsxs)(M.fK,{children:[(0,s.jsx)(M.$N,{children:"Create Follow-up Task"}),(0,s.jsx)(M.Be,{children:"Schedule a new follow-up task"})]}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),r({...i,due_date:new Date("".concat(i.due_date,"T").concat(i.due_time||"00:00")).toISOString()}),t(!1),o({title:"",task_type:"call",priority:"normal",due_date:new Date().toISOString().split("T")[0],due_time:"10:00",duration_minutes:30,contact_name:"",contact_phone:"",contact_email:"",company_name:"",description:"",assigned_to_id:"",assigned_to_name:""})},className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"title",children:"Title"}),(0,s.jsx)(A.I,{id:"title",value:i.title,onChange:e=>o({...i,title:e.target.value}),placeholder:"Follow-up call with...",required:!0})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"task_type",children:"Type"}),(0,s.jsxs)(Y.Ph,{value:i.task_type,onValueChange:e=>o({...i,task_type:e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"call",children:"Call"}),(0,s.jsx)(Y.Ql,{value:"email",children:"Email"}),(0,s.jsx)(Y.Ql,{value:"meeting",children:"Meeting"}),(0,s.jsx)(Y.Ql,{value:"demo",children:"Demo"}),(0,s.jsx)(Y.Ql,{value:"follow_up",children:"Follow-up"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"priority",children:"Priority"}),(0,s.jsxs)(Y.Ph,{value:i.priority,onValueChange:e=>o({...i,priority:e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"low",children:"Low"}),(0,s.jsx)(Y.Ql,{value:"normal",children:"Normal"}),(0,s.jsx)(Y.Ql,{value:"high",children:"High"}),(0,s.jsx)(Y.Ql,{value:"urgent",children:"Urgent"})]})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"assigned_to",children:"Assign To"}),(0,s.jsxs)(Y.Ph,{value:i.assigned_to_id||"unassigned",onValueChange:e=>{if("unassigned"===e)o({...i,assigned_to_id:"",assigned_to_name:""});else{let a=l.find(a=>a.id===e);a&&o({...i,assigned_to_id:a.id,assigned_to_name:a.full_name||a.email})}},children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{placeholder:"Select assignee..."})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"unassigned",children:"Unassigned (Self)"}),l.map(e=>(0,s.jsxs)(Y.Ql,{value:e.id,children:[e.full_name||e.email,e.dashboard_role&&(0,s.jsxs)("span",{className:"text-gray-400 ml-2",children:["(",e.dashboard_role.replace("_"," "),")"]})]},e.id))]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"due_date",children:"Due Date"}),(0,s.jsx)(A.I,{id:"due_date",type:"date",value:i.due_date,onChange:e=>o({...i,due_date:e.target.value}),required:!0})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"due_time",children:"Time"}),(0,s.jsx)(A.I,{id:"due_time",type:"time",value:i.due_time,onChange:e=>o({...i,due_time:e.target.value})})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"contact_name",children:"Contact Name"}),(0,s.jsx)(A.I,{id:"contact_name",value:i.contact_name,onChange:e=>o({...i,contact_name:e.target.value}),placeholder:"John Doe"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"contact_phone",children:"Phone"}),(0,s.jsx)(V.s,{id:"contact_phone",value:i.contact_phone,onChange:e=>o({...i,contact_phone:e||""}),placeholder:"Enter phone number"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"company_name",children:"Company"}),(0,s.jsx)(A.I,{id:"company_name",value:i.company_name,onChange:e=>o({...i,company_name:e.target.value}),placeholder:"Acme Inc"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"description",children:"Notes"}),(0,s.jsx)(B.g,{id:"description",value:i.description,onChange:e=>o({...i,description:e.target.value}),placeholder:"Add any notes...",rows:3})]}),(0,s.jsxs)(M.cN,{children:[(0,s.jsx)(P.z,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),(0,s.jsx)(P.z,{type:"submit",children:"Create Task"})]})]})]})})}function en(e){let{task:a,open:t,onOpenChange:r,onUpdate:l,onDelete:d,teamMembers:c}
1=e,[u,m]=(0,n.useState)(!1),[g,h]=(0,n.useState)({title:"",task_type:"call",priority:"normal",due_date:"",due_time:"",duration_minutes:30,contact_name:"",contact_phone:"",contact_email:"",company_name:"",description:"",assigned_to_id:"",assigned_to_name:"",tags:[]}),[f,j]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(a){let e=new Date(a.due_date);h({title:a.title||"",task_type:a.task_type||"call",priority:a.priority||"normal",due_date:e.toISOString().split("T")[0],due_time:a.due_time||"",duration_minutes:a.duration_minutes||30,contact_name:a.contact_name||"",contact_phone:a.contact_phone||"",contact_email:a.contact_email||"",company_name:a.company_name||"",description:a.description||"",assigned_to_id:a.assigned_to_id||"",assigned_to_name:a.assigned_to_name||"",tags:a.tags||[]}),m(!1)}},[a]);let v=async()=>{if(a){j(!0);try{await l(a.id,{...g,due_date:new Date("".concat(g.due_date,"T").concat(g.due_time||"00:00")).toISOString()}),m(!1)}finally{j(!1)}}};if(!a)return null;let y=$(a.task_type),_="overdue"===a.status||"completed"!==a.status&&"cancelled"!==a.status&&"skipped"!==a.status&&new Date(a.due_date)<new Date;return(0,s.jsx)(M.Vq,{open:t,onOpenChange:r,children:(0,s.jsxs)(M.cZ,{className:"max-w-[95vw] sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[(0,s.jsx)(M.fK,{children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:(0,L.cn)("w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",G(a.task_type)),children:(0,s.jsx)(y,{className:"w-5 h-5"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)(M.$N,{className:"text-lg",children:u?"Edit Task":"Task Details"}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,s.jsx)(Q.C,{className:(0,L.cn)("text-xs",J(a.status)),children:a.status.replace("_"," ")}),(0,s.jsx)(Q.C,{className:(0,L.cn)("text-xs",K(a.priority)),children:a.priority}),_&&(0,s.jsx)(Q.C,{className:"bg-red-100 text-red-700 text-xs",children:"Overdue"})]})]})]})}),u?(0,s.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{htmlFor:"edit-title",children:"Title"}),(0,s.jsx)(A.I,{id:"edit-title",value:g.title,onChange:e=>h({...g,title:e.target.value}),required:!0})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Type"}),(0,s.jsxs)(Y.Ph,{value:g.task_type,onValueChange:e=>h({...g,task_type:e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"call",children:"Call"}),(0,s.jsx)(Y.Ql,{value:"email",children:"Email"}),(0,s.jsx)(Y.Ql,{value:"meeting",children:"Meeting"}),(0,s.jsx)(Y.Ql,{value:"demo",children:"Demo"}),(0,s.jsx)(Y.Ql,{value:"follow_up",children:"Follow-up"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Priority"}),(0,s.jsxs)(Y.Ph,{value:g.priority,onValueChange:e=>h({...g,priority:e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"low",children:"Low"}),(0,s.jsx)(Y.Ql,{value:"normal",children:"Normal"}),(0,s.jsx)(Y.Ql,{value:"high",children:"High"}),(0,s.jsx)(Y.Ql,{value:"urgent",children:"Urgent"})]})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Assign To"}),(0,s.jsxs)(Y.Ph,{value:g.assigned_to_id||"unassigned",onValueChange:e=>{if("unassigned"===e)h({...g,assigned_to_id:"",assigned_to_name:""});else{let a=c.find(a=>a.id===e);a&&h({...g,assigned_to_id:a.id,assigned_to_name:a.full_name||a.email})}},children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{placeholder:"Select assignee..."})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"unassigned",children:"Unassigned"}),c.map(e=>(0,s.jsx)(Y.Ql,{value:e.id,children:e.full_name||e.email},e.id))]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Due Date"}),(0,s.jsx)(A.I,{type:"date",value:g.due_date,onChange:e=>h({...g,due_date:e.target.value}),required:!0})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Time"}),(0,s.jsx)(A.I,{type:"time",value:g.due_time,onChange:e=>h({...g,due_time:e.target.value})})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Contact Name"}),(0,s.jsx)(A.I,{value:g.contact_name,onChange:e=>h({...g,contact_name:e.target.value})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Phone"}),(0,s.jsx)(A.I,{value:g.contact_phone,onChange:e=>h({...g,contact_phone:e.target.value})})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Company"}),(0,s.jsx)(A.I,{value:g.company_name,onChange:e=>h({...g,company_name:e.target.value})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Description / Notes"}
1),(0,s.jsx)(B.g,{value:g.description,onChange:e=>h({...g,description:e.target.value}),rows:3})]}),(0,s.jsxs)(M.cN,{className:"gap-2",children:[(0,s.jsx)(P.z,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),(0,s.jsx)(P.z,{onClick:v,disabled:f,children:f?"Saving...":"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4 mt-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-semibold",children:a.title}),a.description&&(0,s.jsx)("p",{className:"text-gray-600 mt-1 text-sm",children:a.description})]}),(a.contact_name||a.contact_phone||a.contact_email||a.company_name)&&(0,s.jsxs)("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-lg p-3 space-y-2",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Contact Details"}),a.contact_name&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)(x.Z,{className:"w-4 h-4 text-gray-400 dark:text-gray-500"}),(0,s.jsx)("span",{children:a.contact_name})]}),a.contact_phone&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)(i.Z,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{children:a.contact_phone})]}),a.contact_email&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)(o.Z,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{children:a.contact_email})]}),a.company_name&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,s.jsx)(p.Z,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{children:a.company_name})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Due Date"}),(0,s.jsxs)("p",{className:(0,L.cn)("font-medium",_&&"text-red-600"),children:[X(a.due_date),a.due_time&&" at ".concat(a.due_time)]})]}),a.duration_minutes>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Duration"}),(0,s.jsxs)("p",{className:"font-medium",children:[a.duration_minutes," minutes"]})]})]}),a.assigned_to_name&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Assigned To"}),(0,s.jsx)("p",{className:"font-medium",children:a.assigned_to_name})]}),a.tags&&a.tags.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-2",children:"Tags"}),(0,s.jsx)("div",{className:"flex gap-1 flex-wrap",children:a.tags.map(e=>(0,s.jsx)(Q.C,{variant:"outline",className:"text-xs",children:e},e))})]}),a.outcome&&(0,s.jsxs)("div",{className:"bg-green-50 rounded-lg p-3",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-green-700",children:"Outcome"}),(0,s.jsx)("p",{className:"text-sm text-green-800 capitalize",children:a.outcome.replace("_"," ")}),a.completed_at&&(0,s.jsxs)("p",{className:"text-xs text-green-600 mt-1",children:["Completed: ",new Date(a.completed_at).toLocaleString()]})]}),(0,s.jsxs)("div",{className:"border-t pt-3 text-xs text-gray-400",children:[(0,s.jsxs)("p",{children:["Created: ",new Date(a.created_at).toLocaleString()]}),a.updated_at&&(0,s.jsxs)("p",{children:["Last updated: ",new Date(a.updated_at).toLocaleString()]})]}),(0,s.jsxs)(M.cN,{className:"gap-2",children:[(0,s.jsx)(P.z,{type:"button",variant:"outline",className:"text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-900/30 dark:hover:text-red-300",onClick:()=>{a&&confirm("Are you sure you want to delete this task?")&&(d(a.id),r(!1))},children:"Delete"}),(0,s.jsx)(P.z,{type:"button",variant:"outline",onClick:()=>m(!0),children:"Edit"}),(0,s.jsx)(P.z,{onClick:()=>r(!1),children:"Close"})]})]})]})})}function er(e){let{task:a,open:t,onOpenChange:r,onSubmit:i}=e,[o,d]=(0,n.useState)({outcome:"",outcome_reason:"",completion_notes:"",call_outcome:"connected",call_duration_seconds:300,next_action_type:"",next_action_date:""});return((0,n.useEffect)(()=>{t&&a&&d({outcome:"",outcome_reason:"",completion_notes:"",call_outcome:"connected",call_duration_seconds:300,next_action_type:"",next_action_date:""})},[t,null==a?void 0:a.id]),a)?(0,s.jsx)(M.Vq,{open:t,onOpenChange:r,children:(0,s.jsxs)(M.cZ,{className:"max-w-[95vw] sm:max-w-md max-h-[90vh]",children:[(0,s.jsxs)(M.fK,{children:[(0,s.jsx)(M.$N,{children:"Complete Task"}),(0,s.jsx)(M.Be,{children:a.title})]}),(0,s.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!o.outcome){l.default.error("Please select an outcome");return}if("not_eligible"===o.outcome&&!o.outcome_reason){l.default.error("Please provide a reason for Not Eligible");return}if(o.next_action_type&&!o.next_action_date){l.default.error("Please select a date for the next action");return}
1if(a){let e={...o,outcome_reason:o.outcome_reason||null,next_action_type:o.next_action_type||null,next_action_date:o.next_action_date||null};i(a.id,e)}r(!1)},className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Outcome *"}),(0,s.jsxs)(Y.Ph,{value:o.outcome,onValueChange:e=>d({...o,outcome:e,outcome_reason:""}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{placeholder:"Select outcome..."})}),(0,s.jsx)(Y.Bw,{children:[{value:"rnr",label:"RNR (Ring No Response)"},{value:"not_interested",label:"Not Interested"},{value:"out_of_coverage",label:"Out of Coverage Area"},{value:"switched_off",label:"Switched Off"},{value:"unavailable",label:"Unavailable"},{value:"number_not_exists",label:"Number Not Exists"},{value:"no_incoming",label:"No Incoming"},{value:"not_eligible",label:"Not Eligible"},{value:"doesnt_meet_criteria",label:"Doesn't Meet Criteria"},{value:"cold",label:"Cold"},{value:"warm",label:"Warm"},{value:"hot",label:"Hot"},{value:"registration",label:"Registration"},{value:"admission_completed",label:"Admission Completed"},{value:"not_connected",label:"Not Connected"}].map(e=>(0,s.jsx)(Y.Ql,{value:e.value,children:e.label},e.value))})]})]}),"not_eligible"===o.outcome&&(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Reason for Not Eligible *"}),(0,s.jsx)(A.I,{value:o.outcome_reason,onChange:e=>d({...o,outcome_reason:e.target.value}),placeholder:"Enter reason..."})]}),"call"===a.task_type&&(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Call Result"}),(0,s.jsxs)(Y.Ph,{value:o.call_outcome,onValueChange:e=>d({...o,call_outcome:e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"connected",children:"Connected"}),(0,s.jsx)(Y.Ql,{value:"voicemail",children:"Voicemail"}),(0,s.jsx)(Y.Ql,{value:"no_answer",children:"No Answer"}),(0,s.jsx)(Y.Ql,{value:"busy",children:"Busy"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Duration (seconds)"}),(0,s.jsx)(A.I,{type:"number",value:o.call_duration_seconds,onChange:e=>d({...o,call_duration_seconds:parseInt(e.target.value)||0})})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Notes"}),(0,s.jsx)(B.g,{value:o.completion_notes,onChange:e=>d({...o,completion_notes:e.target.value}),placeholder:"Add completion notes...",rows:3})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(E._,{children:"Next Action"}),(0,s.jsxs)(Y.Ph,{value:o.next_action_type||"none",onValueChange:e=>d({...o,next_action_type:"none"===e?"":e}),children:[(0,s.jsx)(Y.i4,{children:(0,s.jsx)(Y.ki,{placeholder:"Select..."})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"none",children:"None"}),(0,s.jsx)(Y.Ql,{value:"call",children:"Call"}),(0,s.jsx)(Y.Ql,{value:"email",children:"Email"}),(0,s.jsx)(Y.Ql,{value:"meeting",children:"Meeting"}),(0,s.jsx)(Y.Ql,{value:"demo",children:"Demo"})]})]})]}),o.next_action_type&&(0,s.jsxs)("div",{children:[(0,s.jsxs)(E._,{children:["Next Action Date ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(A.I,{type:"date",required:!0,value:o.next_action_date,onChange:e=>d({...o,next_action_date:e.target.value})})]})]}),(0,s.jsxs)(M.cN,{children:[(0,s.jsx)(P.z,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),(0,s.jsx)(P.z,{type:"submit",className:"bg-green-600 hover:bg-green-700",children:"Complete Task"})]})]})]})}):null}function el(){let e=(0,r.useSearchParams)(),a=(0,r.useRouter)(),t=e.get("type"),[l,o]=(0,n.useState)(!1),[c,p]=(0,n.useState)("default"),{user:f}=(0,z.a)(),{enterpriseTier:j,isManager:v,isAdmin:y,loading:_}=(0,D.DO)(),V=(0,n.useMemo)(()=>4===j&&!v&&!y,[j,v,y]),[M,O]=(0,n.useState)(!0),[E,B]=(0,n.useState)(null),[X,H]=(0,n.useState)([]),[W,$]=(0,n.useState)(null),[G,K]=(0,n.useState)([]),[J,el]=(0,n.use
1State)(null),[ei,eo]=(0,n.useState)([]),[ed,ec]=(0,n.useState)(""),[eu,em]=(0,n.useState)(t||""),[ex,ep]=(0,n.useState)(""),[eg,eh]=(0,n.useState)(""),[ef,ej]=(0,n.useState)("tasks"),[ev,ey]=(0,n.useState)(""),[e_,eb]=(0,n.useState)(!1),[ew,eN]=(0,n.useState)(!1),[ek,eC]=(0,n.useState)(!1),[eS,eT]=(0,n.useState)(null);(0,n.useEffect)(()=>{o(!0);let e=localStorage.getItem("workspace_id");e&&p(e)},[]),(0,n.useEffect)(()=>{t&&em(t)},[t]);let eZ=(0,n.useRef)(null);(0,n.useEffect)(()=>{let t=e.get("openTask");if(!t||eZ.current===t||M)return;eZ.current=t;let s=X.find(e=>e.id===t);if(s){eT(s),eC(!0),a.replace("/dashboard/tasks",{scroll:!1});return}(async()=>{try{let e=localStorage.getItem("workspace_id")||"default",a=await (0,U._X)(t,e);(null==a?void 0:a.task)&&(eT(a.task),eC(!0))}catch(e){console.error("Failed to fetch task:",e)}finally{a.replace("/dashboard/tasks",{scroll:!1})}})()},[e,X,M,a]);let eR=(0,n.useMemo)(()=>V&&(null==f?void 0:f.id)?f.id:ev||void 0,[V,null==f?void 0:f.id,ev]),ez=(0,n.useCallback)(async()=>{if(!_){O(!0),B(null);try{let[e,a,t,s,n]=await Promise.all([U.Yw.getTasks(c,{status:ed||void 0,task_type:eu||void 0,priority:ex||void 0,assigned_to_id:eR,search:eg||void 0,limit:50,order_by:"due_date",order_dir:"asc"}),U.Yw.getTaskStats(c,eR),U.t9.getRecentCalls(c,void 0,20),U.t9.getCallStats(c),U.v1.getTeamMembers()]);H(e.tasks),$(a),K(t.calls),el(s),eo(n)}catch(e){console.error("Failed to fetch data:",e),B((0,q._V)(e,"Failed to load data"))}finally{O(!1)}}},[c,ed,eu,ex,eg,eR,_]);(0,n.useEffect)(()=>{l&&ez()},[l,ez]);let eD=async e=>{try{await U.Yw.createTask(c,e),ez()}catch(e){console.error("Failed to create task:",e)}},eI=async e=>{try{await U.Yw.startTask(e.id,c),ez()}catch(e){console.error("Failed to start task:",e)}},eP=async(e,a)=>{try{await U.Yw.completeTask(e,c,a),ez()}catch(e){console.error("Failed to complete task:",e)}},eQ=async e=>{try{await U.Yw.skipTask(e.id,c,"Skipped by user"),ez()}catch(e){console.error("Failed to skip task:",e)}},eA=async e=>{let a=prompt("Enter new due date (YYYY-MM-DD):");if(a)try{await U.Yw.rescheduleTask(e.id,c,new Date(a).toISOString()),ez()}catch(e){console.error("Failed to reschedule task:",e)}},eV=e=>{eT(e),eN(!0)},eF=e=>{eT(e),eC(!0)},eY=async(e,a)=>{try{await U.Yw.updateTask(e,c,a),ez()}catch(e){console.error("Failed to update task:",e)}},eM=async e=>{try{await U.Yw.deleteTask(e,c),ez()}catch(e){console.error("Failed to delete task:",e)}},eO=X.filter(e=>"follow_up"===e.task_type||"call"===e.task_type);return X.filter(e=>"follow_up"!==e.task_type&&"call"!==e.task_type),(0,s.jsxs)("div",{className:"p-3 sm:p-4 md:p-6 space-y-4 sm:space-y-6",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 sm:gap-4",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h1",{className:"text-xl sm:text-2xl md:text-3xl font-bold",children:"Tasks"}),(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-500 mt-1",children:V?"Your assigned tasks, calls, and follow-ups":"Manage tasks, calls, and follow-ups"}),V&&(0,s.jsxs)(Q.C,{className:"mt-2 bg-blue-100 text-blue-700 text-xs",children:[(0,s.jsx)(x.Z,{className:"w-3 h-3 mr-1"}),"Showing your assigned tasks only"]})]}),(0,s.jsxs)("div",{className:"flex gap-2 sm:gap-3 flex-shrink-0",children:[(0,s.jsxs)(P.z,{variant:"outline",onClick:ez,disabled:M||_,size:"sm",className:"sm:size-default",children:[(0,s.jsx)(w.Z,{className:(0,L.cn)("w-4 h-4 sm:mr-2",(M||_)&&"animate-spin")}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Refresh"})]}),(0,s.jsxs)(P.z,{onClick:()=>eb(!0),size:"sm",className:"sm:size-default",children:[(0,s.jsx)(N.Z,{className:"w-4 h-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"New Task"})]})]})]}),W&&(0,s.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-2 sm:gap-3 md:gap-4",children:[(0,s.jsx)(ee,{title:"Pending",value:W.pending,icon:m.Z,
1color:"bg-yellow-500"}),(0,s.jsx)(ee,{title:"In Progress",value:W.in_progress,icon:h.Z,color:"bg-purple-500"}),(0,s.jsx)(ee,{title:"Due Today",value:W.due_today,icon:d.Z,color:"bg-blue-500"}),(0,s.jsx)(ee,{title:"Overdue",value:W.overdue,icon:k.Z,color:"bg-red-500"}),(0,s.jsx)(ee,{title:"Completed",value:W.completed,icon:C.Z,color:"bg-green-500"}),(0,s.jsx)(ee,{title:"Completion Rate",value:Math.round(W.completion_rate),icon:S.Z,color:"bg-teal-500",subtitle:"%"})]}),(0,s.jsxs)(F.Tabs,{value:ef,onValueChange:ej,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)(F.TabsList,{children:[(0,s.jsx)(F.TabsTrigger,{value:"tasks",children:"All Tasks"}),(0,s.jsxs)(F.TabsTrigger,{value:"follow-ups",children:["Follow-ups",eO.length>0&&(0,s.jsx)(Q.C,{variant:"secondary",className:"ml-2 h-5 px-1.5",children:eO.length})]}),(0,s.jsx)(F.TabsTrigger,{value:"calls",children:"Call Log"})]}),"tasks"===ef&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(T.Z,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),(0,s.jsx)(A.I,{placeholder:"Search tasks...",value:eg,onChange:e=>eh(e.target.value),className:"pl-10 w-64"})]}),(0,s.jsxs)(Y.Ph,{value:ed||"all",onValueChange:e=>ec("all"===e?"":e),children:[(0,s.jsx)(Y.i4,{className:"w-32",children:(0,s.jsx)(Y.ki,{placeholder:"Status"})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"all",children:"All Status"}),(0,s.jsx)(Y.Ql,{value:"pending",children:"Pending"}),(0,s.jsx)(Y.Ql,{value:"in_progress",children:"In Progress"}),(0,s.jsx)(Y.Ql,{value:"overdue",children:"Overdue"}),(0,s.jsx)(Y.Ql,{value:"completed",children:"Completed"})]})]}),(0,s.jsxs)(Y.Ph,{value:eu||"all",onValueChange:e=>em("all"===e?"":e),children:[(0,s.jsx)(Y.i4,{className:"w-32",children:(0,s.jsx)(Y.ki,{placeholder:"Type"})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"all",children:"All Types"}),(0,s.jsx)(Y.Ql,{value:"call",children:"Call"}),(0,s.jsx)(Y.Ql,{value:"email",children:"Email"}),(0,s.jsx)(Y.Ql,{value:"meeting",children:"Meeting"}),(0,s.jsx)(Y.Ql,{value:"demo",children:"Demo"})]})]}),(0,s.jsxs)(Y.Ph,{value:ex||"all",onValueChange:e=>ep("all"===e?"":e),children:[(0,s.jsx)(Y.i4,{className:"w-32",children:(0,s.jsx)(Y.ki,{placeholder:"Priority"})}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"all",children:"All Priority"}),(0,s.jsx)(Y.Ql,{value:"urgent",children:"Urgent"}),(0,s.jsx)(Y.Ql,{value:"high",children:"High"}),(0,s.jsx)(Y.Ql,{value:"normal",children:"Normal"}),(0,s.jsx)(Y.Ql,{value:"low",children:"Low"})]})]}),!V&&(0,s.jsxs)(Y.Ph,{value:ev||"all",onValueChange:e=>ey("all"===e?"":e),children:[(0,s.jsxs)(Y.i4,{className:"w-40",children:[(0,s.jsx)(Z.Z,{className:"w-4 h-4 mr-2"}),(0,s.jsx)(Y.ki,{placeholder:"All Assignees"})]}),(0,s.jsxs)(Y.Bw,{children:[(0,s.jsx)(Y.Ql,{value:"all",children:"All Assignees"}),(null==f?void 0:f.id)&&(0,s.jsx)(Y.Ql,{value:f.id,children:"My Tasks"}),ei.map(e=>(0,s.jsx)(Y.Ql,{value:e.id,children:e.full_name||e.email},e.id))]})]})]})]}),(0,s.jsx)(F.TabsContent,{value:"tasks",className:"mt-6",children:M?(0,s.jsx)("div",{className:"space-y-4",children:[,,,,,].fill(0).map((e,a)=>(0,s.jsx)(I.Zb,{className:"animate-pulse",children:(0,s.jsx)(I.aY,{className:"p-4",children:(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-gray-200 rounded-lg"}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/3"}),(0,s.jsx)("div",{className:"h-3 bg-gray-200 rounded w-1/2"})]})]})})},a))}):E?(0,s.jsx)(I.Zb,{children:(0,s.jsx)(I.aY,{className:"flex items-center justify-center py-12",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)(R.Z,{className:"w-12 h-12 text-red-500 mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-gray-600",children:E}),(0,s.jsx)(P.z,{onClick:ez,variant:"outline",className:"mt-4",children:"Retry"})]})})}):0===X.length?(0,s.jsx)(I.Zb,{children:(0,s.jsx)(I.aY,{className:"flex items-center justify-center py-12",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)(C.Z,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-gray-500",children:"No tasks foun
1d"}),(0,s.jsx)(P.z,{onClick:()=>eb(!0),className:"mt-4",children:"Create your first task"})]})})}):(0,s.jsx)("div",{className:"space-y-3",children:X.map(e=>(0,s.jsx)(ea,{task:e,onStart:eI,onComplete:eV,onSkip:eQ,onReschedule:eA,onView:eF},e.id))})}),(0,s.jsx)(F.TabsContent,{value:"follow-ups",className:"mt-6",children:M?(0,s.jsx)("div",{className:"space-y-4",children:[,,,,,].fill(0).map((e,a)=>(0,s.jsx)(I.Zb,{className:"animate-pulse",children:(0,s.jsx)(I.aY,{className:"p-4",children:(0,s.jsxs)("div",{className:"flex gap-4",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-gray-200 rounded-lg"}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/3"}),(0,s.jsx)("div",{className:"h-3 bg-gray-200 rounded w-1/2"})]})]})})},a))}):0===eO.length?(0,s.jsx)(I.Zb,{children:(0,s.jsx)(I.aY,{className:"flex items-center justify-center py-12",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)(u.Z,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-gray-500",children:"No follow-up tasks found"}),(0,s.jsx)("p",{className:"text-gray-400 text-sm mt-1",children:"Create a call or follow-up task to see it here"})]})})}):(0,s.jsx)("div",{className:"space-y-3",children:eO.map(e=>(0,s.jsx)(ea,{task:e,onStart:eI,onComplete:eV,onSkip:eQ,onReschedule:eA,onView:eF},e.id))})}),(0,s.jsxs)(F.TabsContent,{value:"calls",className:"mt-6",children:[J&&(0,s.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[(0,s.jsx)(ee,{title:"Total Calls",value:J.total_calls,icon:i.Z,color:"bg-blue-500"}),(0,s.jsx)(ee,{title:"Connected",value:J.connected_calls,icon:b.Z,color:"bg-green-500"}),(0,s.jsx)(ee,{title:"Connection Rate",value:Math.round(J.connection_rate),icon:S.Z,color:"bg-teal-500",subtitle:"%"}),(0,s.jsx)(ee,{title:"Avg Duration",value:Math.round(J.avg_duration_seconds/60),icon:g.Z,color:"bg-purple-500",subtitle:"min"})]}),(0,s.jsxs)(I.Zb,{children:[(0,s.jsx)(I.Ol,{children:(0,s.jsx)(I.ll,{children:"Recent Calls"})}),(0,s.jsx)(I.aY,{children:0===G.length?(0,s.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,s.jsx)(i.Z,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),(0,s.jsx)("p",{children:"No call history"})]}):(0,s.jsx)("div",{className:"divide-y",children:G.map(e=>(0,s.jsx)(et,{call:e},e.id))})})]})]})]}),(0,s.jsx)(es,{open:e_,onOpenChange:eb,onSubmit:eD,teamMembers:ei}),(0,s.jsx)(er,{task:eS,open:ew,onOpenChange:eN,onSubmit:eP}),(0,s.jsx)(en,{task:eS,open:ek,onOpenChange:eC,onUpdate:eY,onDelete:eM,teamMembers:ei})]})}},69174:function(e,a,t){t.d(a,{C:function(){return i}});var s=t(57437);t(2265);var n=t(90535),r=t(93448);let l=(0,n.j)("inline-flex items-center rounded-[4px] border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:a,variant:t,...n}=e;return(0,s.jsx)("div",{className:(0,r.cn)(l({variant:t}),a),...n})}},12381:function(e,a,t){t.d(a,{d:function(){return o},z:function(){return d}});var s=t(57437),n=t(2265),r=t(37053),l=t(90535),i=t(93448);let o=(0,l.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[4px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-[4px] px-3 text-xs",lg:"h-10 rounded-[4px] px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=n.forwardRef((e,a)=>{let{className:t,variant:n,size:l,asChild:d=!1,...c}=e,u=d?r.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(o({variant:n,size:l,className:t})),ref:a,...c})});d.displayName="Button"},79820:function(e,a,t){t.d(a,{Ol:function(){return i},SZ:function(){return d},Zb:function(){return l},aY:function(){return c},eW:function(){return u},ll:function(){return o}});var s=t(57437),n=t(2265),r=t(93448);let l=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("rounded-[4px] border bg-card text-card-foreground shadow",t),...n})});
1l.displayName="Card";let i=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",t),...n})});i.displayName="CardHeader";let o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("font-display font-semibold leading-none tracking-tight",t),...n})});o.displayName="CardTitle";let d=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("text-sm text-muted-foreground",t),...n})});d.displayName="CardDescription";let c=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("p-6 pt-0",t),...n})});c.displayName="CardContent";let u=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)("div",{ref:a,className:(0,r.cn)("flex items-center p-6 pt-0",t),...n})});u.displayName="CardFooter"},74291:function(e,a,t){t.d(a,{$N:function(){return g},Be:function(){return h},Vq:function(){return o},cN:function(){return p},cZ:function(){return m},fK:function(){return x},hg:function(){return d}});var s=t(57437),n=t(2265),r=t(49027),l=t(93448),i=t(20653);let o=r.fC,d=r.xz,c=r.h_;r.x8;let u=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.aV,{ref:a,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n})});u.displayName=r.aV.displayName;let m=n.forwardRef((e,a)=>{let{className:t,children:n,overlayClassName:o,...d}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{className:o}),(0,s.jsxs)(r.VY,{ref:a,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200","w-[calc(100%-1rem)] xs:w-[calc(100%-2rem)] sm:w-full max-w-lg","p-4 sm:p-6","max-h-[90vh] sm:max-h-[85vh]","rounded-lg sm:rounded-lg","flex flex-col","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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...d,children:[n,(0,s.jsxs)(r.x8,{className:"absolute right-3 top-3 sm:right-4 sm:top-4 z-50 rounded-full opacity-70 ring-offset-background transition-all hover:opacity-100 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground bg-white dark:bg-gray-900 shadow-md border border-gray-200 dark:border-gray-700 p-1.5",children:[(0,s.jsx)(i.Pxu,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=r.VY.displayName;let x=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left flex-shrink-0",a),...t})};x.displayName="DialogHeader";let p=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 flex-shrink-0 mt-4",a),...t})};p.displayName="DialogFooter";let g=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.Dx,{ref:a,className:(0,l.cn)("font-display text-lg font-semibold leading-none tracking-tight",t),...n})});g.displayName=r.Dx.displayName;let h=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.dk,{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",t),...n})});h.displayName=r.dk.displayName},32060:function(e,a,t){t.d(a,{$F:function(){return d},AW:function(){return c},Ju:function(){return x},VD:function(){return p},Xi:function(){return u},bO:function(){return m},h_:function(){return o}});var s=t(57437),n=t(2265),r=t(70085),l=t(93448),i=t(20653);let o=r.fC,d=r.xz;r.ZA,r.Uv,r.Tr,r.Ee,n.forwardRef((e,a)=>{let{className:t,inset:n,children:o,...d}=e;return(0,s.jsxs)(r.fF,{ref:a,className:(0,l.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",t),...d,children:[o,(0,s.jsx)(i.XCv,{className:"ml-auto"})]})}).displayName=r.fF.displayName,n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.tu,{ref:a,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground shadow-lg 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]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...n})}).displayName=r.tu.displayName;let c=n.forwardRef((e,a)=>{let{className:t,sideOffset:n=4,...i}=e;return(0,s.jsx)(r.Uv,{children:(0,s.jsx)(r.VY,{ref:a,sideOffset:n,className:(0,l.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground 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 origin-[--radix-dropdown-menu-content-transform-origin]",t),...i})})});c.displayName=r.VY.displayName;let u=n.forwardRef((e,a)=>{let{className:t,inset:n,...i}=e;return(0,s.jsx)(r.ck,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",n&&"pl-8",t),...i})});u.displayName=r.ck.displayName;let m=n.forwardRef((e,a)=>{let{className:t,children:n,checked:o,...d}=e;return(0,s.jsxs)(r.oC,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:o,...d,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(i.nQG,{className:"h-4 w-4"})})}),n]})});m.displayName=r.oC.displayName,n.forwardRef((e,a)=>{let{className:t,children:n,...o}=e;return(0,s.jsxs)(r.Rk,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(i.jXb,{className:"h-2 w-2 fill-current"})})}),n]})}).displayName=r.Rk.displayName;let x=n.forwardRef((e,a)=>{let{className:t,inset:n,...i}=e;return(0,s.jsx)(r.__,{ref:a,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...i})});x.displayName=r.__.displayName;let p=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.Z0,{ref:a,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",t),...n})});p.displayName=r.Z0.displayName},40279:function(e,a,t){t.d(a,{I:function(){return l}});var s=t(57437),n=t(2265),r=t(93448);let l=n.forwardRef((e,a)=>{let{className:t,type:n,error:l,...i}=e;return(0,s.jsx)("input",{type:n,"aria-invalid":l?"true":void 0,className:(0,r.cn)("flex h-9 w-full rounded-[4px] border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l&&"border-red-500 focus-visible:ring-red-500",t),ref:a,...i})});l.displayName="Input"},75060:function(e,a,t){t.d(a,{_:function(){return d}});var s=t(57437),n=t(2265),r=t(6394),l=t(90535),i=t(93448);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.f,{ref:a,className:(0,i.cn)(o(),t),...n})});d.displayName=r.f.displayName},60183:function(e,a,t){t.d(a,{s:function(){return d}});var s=t(57437),n=t(29),r=t.n(n),l=t(2265),i=t(73892);t(28356);var o=t(93448);let d=l.forwardRef((e,a)=>{let{value:t,onChange:n,placeholder:l="Enter phone number",className:d,defaultCountry:c="IN",disabled:u,id:m}=e;return(0,s.jsxs)("div",{ref:a,className:"jsx-978175d6c61f5131 "+((0,o.cn)("phone-input-wrapper",d)||""),children:[(0,s.jsx)(i.ZP,{international:!0,defaultCountry:c,value:t||"",onChange:e=>null==n?void 0:n(e),placeholder:l,disabled:u,id:m,className:(0,o.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-within:outline-none focus-within:ring-1 focus-within:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm")}),(0,s.jsx)(r(),{id:"978175d6c61f5131",children:".phone-input-wrapper .PhoneInput{gap:8px}.phone-input-wrapper .PhoneInputCountry{display:-webkit-box;display:-webkit-flex;display:-moz-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-moz-box-align:center;-ms-flex-align:center;align-items:center}.phone-input-wrapper .PhoneInputCountrySelect{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1;border:0;opacity:0;cursor:pointer}.phone-input-wrapper .PhoneInputCountryIcon{width:24px;height:16px}.phone-input-wrapper .PhoneInputCountryIconImg{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.phone-input-wrapper .PhoneInputInput{-webkit-box-flex:1;-webkit-flex:1;-moz-box-flex:1;-ms-flex:1;flex:1;background:transparent;border:none;outline:none;font-size:inherit;color:inherit;padding:0}.phone-input-wrapper .PhoneInputInput::-webkit-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput:-moz-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::-moz-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput:-ms-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::-ms-input-placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputInput::placeholder{color:hsl(var(--muted-foreground))}.phone-input-wrapper .PhoneInputCountrySelectArrow{display:block;width:6px;height:6px;margin-left:4px;border-style:solid;border-color:hsl(var(--foreground));border-top-width:0;border-bottom-width:1px;border-left-width:0;border-right-width:1px;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg);opacity:.5}"})]})});d.displayName="PhoneInput"},15291:function(e,a,t){t.d(a,{Bw:function(){return x},DI:function(){return c},Ph:function(){return d},Ql:function(){return g},i4:function(){return m},ki:function(){return u},n5:function(){return p}});var s=t(57437),n=t(2265),r=t(56873),l=t(40875),i=t(30401),o=t(93448);let d=r.fC,c=r.ZA,u=r.B4,m=n.forwardRef((e,a)=>{let{className:t,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:a,className:(0,o.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),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let x=n.forwardRef((e,a)=>{let{className:t,children:n,position:l="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsx)(r.VY,{ref:a,className:(0,o.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,...i,children:(0,s.jsx)(r.l_,{className:(0,o.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===l&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:n})})})});x.displayName=r.VY.displayName;let p=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.__,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...n})});p.displayName=r.__.displayName;let g=n.forwardRef((e,a)=>{let{className:t,children:n,...l}=e;return(0,s.jsxs)(r.ck,{ref:a,className:(0,o.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,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});g.displayName=r.ck.displayName,n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.Z0,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-700",t),...n})}).displayName=r.Z0.displayName},17168:function(e,a,t){t.d(a,{Tabs:function(){return i},TabsContent:function(){return c},TabsList:function(){return o},TabsTrigger:function(){return d}});var s=t(57437),n=t(2265),r=t(20271),l=t(93448);let i=r.fC,o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.aV,{ref:a,className:(0,l.cn)("inline-flex h-10 items-center justify-center rounded-[4px] bg-gray-100 dark:bg-gray-800 p-1 text-gray-500 dark:text-gray-400",t),...n})});o.displayName=r.aV.displayName;let d=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.xz,{ref:a,className:(0,l.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white dark:ring-offset-gray-950 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 dark:focus-visible:ring-gray-300 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white dark:data-[state=active]:bg-gray-900 data-[state=active]:text-gray-950 dark:data-[state=active]:text-gray-100 data-[state=active]:shadow-sm",t),...n})});d.displayName=r.xz.displayName;let c=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,s.jsx)(r.VY,{ref:a,className:(0,l.cn)("mt-2 ring-offset-white dark:ring-offset-gray-950 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 dark:focus-visible:ring-gray-300 focus-visible:ring-offset-2",t),...n})});c.displayName=r.VY.displayName},23675:function(e,a,t){t.d(a,{g:function(){return l}});var s=t(57437),n=t(2265),r=t(93448);let l=n.forwardRef((e,a)=>{let{className:t,error:n,...l}=e;return(0,s.jsx)("textarea",{"aria-invalid":n?"true":void 0,className:(0,r.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",n&&"border-red-500 focus-visible:ring-red-500",t),ref:a,...l})});l.displayName="Textarea"},24746:function(e,a,t){t.d(a,{DO:function(){return l}});var s=t(2265),n=t(71837);let r={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,s.useState)({...r,loading:!1}),t=(0,s.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 n.api.get("/auth/me/dashboard-role")).data;console.log("[useRolePermissions] API response:",e);let s=e.permissions||[],r=e.enterprise_tier||4,l={dashboardRole:e.dashboard_role||"viewer",systemRole:e.system_role||"Customer",enterpriseRole:e.enterprise_role||"staff",enterpriseTier:r,agentGroups:e.agent_groups||[],permissions:s,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=>s.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=>s.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=>s.includes(e))},hasMinimumTier:e=>r<=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,s.useEffect)(()=>{t()},[t]),e}},87919:function(e,a,t){t.d(a,{Ak:function(){return n},SR:function(){return m},Vn:function(){return h},Vv:function(){return u},Wl:function(){return c},YY:function(){return x},Yw:function(){return p},_5:function(){return o},_X:function(){return l},lV:function(){return d},lg:function(){return r},t9:function(){return f},v1:function(){return g},vr:function(){return i}});var s=t(71837);async function n(e,a){return(await s.api.get("/follow-ups",{params:{workspace_id:e,...a}})).data}async function r(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:7,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,n=arguments.length>3?arguments[3]:void 0;return(await s.api.get("/follow-ups/upcoming",{params:{workspace_id:e,days:a,limit:t,assigned_to_id:n}})).data}async function l(e,a){return(await s.api.get("/follow-ups/".concat(e),{params:{workspace_id:a}})).data}async function i(e,a){return(await s.api.post("/follow-ups",a,{params:{workspace_id:e}})).data}async function o(e,a){return(await s.api.delete("/follow-ups/".concat(e),{params:{workspace_id:a}})).data}async function d(e,a){return(await s.api.post("/follow-ups/".concat(e,"/start"),null,{params:{workspace_id:a}})).data}async function c(e,a,t){return(await s.api.post("/follow-ups/".concat(e,"/complete"),t,{params:{workspace_id:a}})).data}async function u(e,a,t){return(await s.api.post("/follow-ups/".concat(e,"/skip"),{reason:t},{params:{workspace_id:a}})).data}async function m(e,a){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20;return(await s.api.get("/calls/recent",{params:{workspace_id:e,agent_id:a,limit:t}})).data}async function x(){try{return(await s.api.get("/users",{params:{status:"active",limit:100}})).data}catch(e){return console.error("Failed to fetch team members:",e),[]}}let p={getTasks:n,getTaskStats:async function(e,a){return(await s.api.get("/follow-ups/stats",{params:{workspace_id:e,assigned_to_id:a}})).data},getUpcomingTasks:r,getOverdueTasks:async function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return(await s.api.get("/follow-ups/overdue",{params:{workspace_id:e,limit:a}})).data},getTask:l,createTask:i,updateTask:async function(e,a,t){return(await s.api.put("/follow-ups/".concat(e),t,{params:{workspace_id:a}})).data},deleteTask:o,startTask:d,completeTask:c,skipTask:u,rescheduleTask:async function(e,a,t,n,r){return(await s.api.post("/follow-ups/".concat(e,"/reschedule"),{new_due_date:t,new_due_time:n,reason:r},{params:{workspace_id:a}})).data}},g={getTeamMembers:x};async function h(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;
1return(await s.api.get("/calls",{params:{workspace_id:e,disposition:"no_answer",limit:a,order_by:"started_at",order_dir:"desc"}})).data}let f={getCalls:async function(e,a){return(await s.api.get("/calls",{params:{workspace_id:e,...a}})).data},getCallStats:async function(e,a,t,n){return(await s.api.get("/calls/stats",{params:{workspace_id:e,agent_id:a,date_from:t,date_to:n}})).data},getRecentCalls:m,getMissedCalls:h,getCall:async function(e,a){return(await s.api.get("/calls/".concat(e),{params:{workspace_id:a}})).data}}},93448:function(e,a,t){t.d(a,{cn:function(){return r}});var s=t(61994),n=t(53335);function r(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return(0,n.m6)((0,s.W)(a))}}}]);
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.