1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[618],{30618:function(e,t,l){l.r(t),l.d(t,{default:function(){return _}});var i=l(85893),n=l(30381),a=l.n(n),o=l(67294),r=l(73721),s=l(66703),d=l(98681),c=l(39828),u=l(15682),m=l(63732),v=l(67707),f=l(27046);l(33732);var p=l(46831),g=l(11163),h=l(62093),y=l(14835),x=l(52415),w=l(9491),j=e=>{var t,l,n;let{dateVar:o,offset:s,timeRef:d,timeArray:c,nearestImeIndex:u,sortedTaskData:m,taskColors:v,setOpenModal:f,setTitle:p,setDescription:g,setStartTime:h,UtcToTIme:j,setEndTime:b,setType:N,setTaskId:S,setAppointmentData:D,setAppointmentDataType:O,taskTypes:T,setDeleteAppointmentModal:_,setDeleteAppointmentData:E,setRegisterLink:k,userData:A,setDeleteModal:C,setDeleteTimeSlotData:I,setDeleteTimeSlotRegisterLink:M,usersPerSlot:J,setUsersPerSlot:U}=e,P=new Date(a()(new Date(o)).format("YYYY-MM-DD"));P.setTime(P.getTime()+-6e4*s),P.setHours(0,0,0,0);let B=P.toISOString();P.setHours(23,59,59,999);let Z=P.toISOString(),z=e=>{var t,l,n,a;let{e:o}=e;return(0,i.jsx)("div",{className:"w-full h-full flex justify-center items-center font14 font-medium overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:(null==o?void 0:o.appointmentData)&&(null===(t=(null==o?void 0:null===(l=o.appointmentData)||void 0===l?void 0:l.slice())||[])||void 0===t?void 0:t.length)>0?(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-start items-center gap-2 py-2",onClick:e=>{null==e||e.stopPropagation()},children:null===(n=((null==o?void 0:null===(a=o.appointmentData)||void 0===a?void 0:a.slice())||[]).slice().sort((e,t)=>{let l=j(null==e?void 0:e.startTimeUtc,17)?c.indexOf(j(null==e?void 0:e.startTimeUtc,18)):-1,i=j(null==e?void 0:e.endTimeUtc,19)?c.indexOf(j(null==e?void 0:e.endTimeUtc,20)):-1,n=j(null==t?void 0:t.startTimeUtc,21)?c.indexOf(j(null==t?void 0:t.startTimeUtc,22)):-1,a=j(null==t?void 0:t.endTimeUtc,23)?c.indexOf(j(null==t?void 0:t.endTimeUtc,24)):-1;return l==n?i-a:l-n}))||void 0===n?void 0:n.map(e=>{let t=(null==o?void 0:o.type)=="Services"||(null==e?void 0:e.slotType)=="Services"?"Services Appointment":(null==o?void 0:o.type)=="Open Appointments"||(null==e?void 0:e.slotType)=="Open Appointments"?"Appointment":null==T?void 0:T[null==o?void 0:o.type];return(0,i.jsxs)("div",{className:"w-full rounded-md bg-[#FAFAFA] p-2 flex flex-col justify-center items-start gap-1.5 cursor-pointer",onClick:()=>{D(e||{}),O(null==o?void 0:o.type)},children:[(0,i.jsxs)("div",{className:"w-full flex justify-end items-center text-[8px] leading-3 sm:text-[8px] lg:text-[10px] font-poppins",children:[(0,i.jsxs)("span",{children:[j(null==e?void 0:e.startTimeUtc,25),"-",j(e.endTimeUtc,26)]}),(0,i.jsxs)("span",{className:"flex justify-center items-center px-2",children:["(",(0,i.jsx)(x.Z,{}),")"]})]}),(0,i.jsx)("div",{className:"w-full font-medium font14 line-clamp-2",children:"".concat(t||T[null==o?void 0:o.type]," with ").concat(null==e?void 0:e.name)}),(0,i.jsx)("div",{className:"w-full flex justify-end items-center p-0.5 my-0.5",children:(0,i.jsx)("button",{className:"p-0.5",onClick:t=>{t.stopPropagation(),_(!0),E(e||{});let l=window.location.origin;k("".concat(l,"/organizer/").concat(null==A?void 0:A.uid))},children:(0,i.jsx)(w.default,{className:"w-3.5 h-3.5"})})})]},(0,r.Km)(10))})}):(0,i.jsx)("div",{className:"w-full h-full flex justify-center items-center ",children:"No Appointments."})})};return(0,i.jsxs)("div",{className:"w-full h-full flex justify-between items-start overflow-y-auto py-1 scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:[(0,i.jsx)("div",{ref:d,className:"h-full flex flex-col justify-start items-start",style:{height:"3136px"},children:null===(t=c||[])||void 0===t?void 0:t.map((e,t)=>(0,i.jsx)("div",{id:"Time_".concat(e),className:"w-20 h-8 flex justify-between items-center px-2 border-b border-r border-tab-inactiveBorder ".concat(u==t?"bg-tab-active":"bg-tab-inactive"),children:(0,i.jsx)("div",{className:"w-full h-full flex justify-start items-center font14",children:e})},"Time_".concat(e)))}),(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-start items-start relative",style:{height:"3136px"},children:[(0,i.jsx)("div",{className:"w-full absolute top-0 left-0 right-0 bottom-0 z-0",children:null===(l=c||[])||void 0===l?void 0:l.map((e,t)=>(0,i.jsx)("div",{id:"Time_".concat(e),className:"w-full h-8 flex justify-between items-center px-2 border-b border-tab-inactiveBorder"},"Time_".concat(e)))}),null===(n=m||[])||void 0===n?void 0:n.map((e,t)=>(0,i.jsxs)("div",{id:"Value_".concat(e.id,"_index_").concat(t),className:"w-full flex flex-col justify-start items-center border border-tab-inactiveBorder gap-1 px-2 py-1 rounded-md shadow-sm overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",style:{position:"absolute",top:"".concat(null==e?void 0:e.startPosition,"px"),height:"".concat((null==e?void 0:e.length)*32,"px"),width:"".concat(null==e?void 0:e.minWidth,"%"),left:"".concat((null==e?void 0:e.position)*(null==e?void 0:e.width),"%"),backgroundColor:"".concat(v[null==e?void 0:e.type])},children:[(0,i.jsxs)("div",{className:"w-full flex justify-between items-center font12",children:[(0,i.jsxs)("div",{className:"flex justify-center items-center gap-2",children:[(0,i.jsx)("button",{className:"p-0.5",onClick:()=>{C(!0),S((null==e?void 0:e.id)||""),I(e||{});let t=window.location.origin;M("".concat(t,"/organizer/").concat(null==A?void 0:A.uid))},children:(0,i.jsx)(w.default,{className:"w-3.5 h-3.5"})}),(0,i.jsx)("div",{className:"p-2 cursor-pointer",onClick:()=>{f(!0),p((null==e?void 0:e.title)||""),g((null==e?void 0:e.description)||""),h(j(null==e?void 0:e.startUtcTIme,11)||""),b(j(null==e?void 0:e.endUtcTIme,12)||""),N((null==e?void 0:e.type)||""),S((null==e?void 0:e.id)||""),U((null==e?void 0:e.usersPerSlot)||1)},children:(0,i.jsx)(y.default,{className:"w-3.5 h-3.5"})})]}),(0,i.jsx)("div",{className:"text-[#3C3C3C] text-[8px] md:text-[10px] ",children:"(".concat(null==e?void 0:e.type,")")}),(0,i.jsxs)("div",{className:"flex justify-end items-center cursor-default",children:[(0,i.jsx)("span",{children:new Date(null==e?void 0:e.startUtcTIme)<new Date(B)||new Date(Z)<new Date(null==e?void 0:e.endUtcTIme)?"".concat(j(null==e?void 0:e.startUtcTIme,13),", ").concat(new Date(null==e?void 0:e.startUtcTIme).toLocaleDateString()," - ").concat(j(null==e?void 0:e.endUtcTIme,14),", ").concat(new Date(null==e?void 0:e.endUtcTIme).toLocaleDateString()):"".concat(j(null==e?void 0:e.startUtcTIme,15)," - ").concat(j(null==e?void 0:e.endUtcTIme,16))}),(0,i.jsxs)("span",{className:"flex justify-center items-center font12 px-2",children:["(",(0,i.jsx)(x.Z,{}),")"]})]})]}),(0,i.jsx)("div",{className:"w-full h-full",children:(null==e?void 0:e.type)=="Open Appointments"||(null==e?void 0:e.type)=="Digital Coffee"||(null==e?void 0:e.type)=="Services"||(null==e?void 0:e.type)=="Appointment and Services"||(null==e?void 0:e.type)=="Multi-Participant"?(0,i.jsx)(i.Fragment,{children:z({e})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-full flex justify-center items-center font14 font-medium",children:e.title}),(0,i.jsx)("div",{className:"w-full py-0.5 flex justify-start items-center font12",children:e.description})]})})]},"Value_".concat(e.id,"_index_").concat(t)))]})]})},b=e=>{var t;let{dateVar:l,offset:n,contentLoader:o,todayTask:s,UtcToTIme:d,timeArray:c,taskColors:u,setNearestTime:m,setNearestTimeIndex:v,setOpenModal:f,setTitle:p,setDescription:g,setStartTime:h,setEndTime:j,setType:b,setTaskId:N,setAppointmentData:S,setAppointmentDataType:D,taskTypes:O,setDeleteAppointmentModal:T,setDeleteAppointmentData:_,setRegisterLink:E,userData:k,setDeleteModal:A,setDeleteTimeSlotData:C,setDeleteTimeSlotRegisterLink:I,usersPerSlot:M,setUsersPerSlot:J}=e,U=new Date(a()(new Date(l)).format("YYYY-MM-DD"));U.setTime(U.getTime()+-6e4*n),U.setHours(0,0,0,0);let P=U.toISOString();U.setHours(23,59,59,999);let B=U.toISOString(),Z=e=>{var t,l,n,a;let{e:o}=e;return(0,i.jsx)("div",{className:"w-full h-full flex justify-center items-center font14 font-medium",children:(null==o?void 0:o.appointmentData)&&(null===(t=(null==o?void 0:null===(l=o.appointmentData)||void 0===l?void 0:l.slice())||[])||void 0===t?void 0:t.length)>0?(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-center items-center gap-2",children:null===(n=((null==o?void 0:null===(a=o.appointmentData)||void 0===a?void 0:a.slice())||[]).slice().sort((e,t)=>
1{let l=d(null==e?void 0:e.startTimeUtc,37.5)?c.indexOf(d(null==e?void 0:e.startTimeUtc,38)):-1,i=d(null==e?void 0:e.endTimeUtc,39)?c.indexOf(d(null==e?void 0:e.endTimeUtc,40)):-1,n=d(null==t?void 0:t.startTimeUtc,41)?c.indexOf(d(null==t?void 0:t.startTimeUtc,42)):-1,a=d(null==t?void 0:t.endTimeUtc,43)?c.indexOf(d(null==t?void 0:t.endTimeUtc,44)):-1;return l==n?i-a:l-n}))||void 0===n?void 0:n.map(e=>{var t;let l=(null==o?void 0:o.type)=="Services"||(null==e?void 0:e.slotType)=="Services"?"Services Appointment":(null==o?void 0:o.type)=="Open Appointments"||(null==e?void 0:e.slotType)=="Open Appointments"?"Appointment":null==O?void 0:O[null==o?void 0:o.type];return(0,i.jsxs)("div",{className:"w-full h-full rounded-md bg-[#FAFAFA] p-2 flex flex-col justify-center items-start gap-1.5 cursor-pointer",onClick:()=>{S(e||{}),D(null==o?void 0:o.type)},children:[(0,i.jsxs)("div",{className:"w-full flex justify-between items-center text-[8px] leading-3 sm:text-[8px] lg:text-[10px] font-poppins",children:[(0,i.jsx)("button",{className:"p-0.5",onClick:t=>{t.stopPropagation(),T(!0),_(e||{});let l=window.location.origin;E("".concat(l,"/organizer/").concat(null==k?void 0:k.uid))},children:(0,i.jsx)(w.default,{className:"w-3.5 h-3.5"})}),(0,i.jsxs)("div",{className:"flex justify-center items-center gap-2",children:[(0,i.jsxs)("span",{children:[d(null==e?void 0:e.startTimeUtc,45),"-",d(e.endTimeUtc,46)]}),(0,i.jsxs)("span",{className:"flex justify-center items-center px-2",children:["(",(0,i.jsx)(x.Z,{}),")"]})]})]}),(0,i.jsx)("div",{className:"w-full font-medium font14 line-clamp-2",children:"".concat(l||O[null==o?void 0:o.type]," with ").concat(null==e?void 0:e.name)}),(0,i.jsx)("div",{className:"w-full font12 truncate",children:"Title: ".concat((null==e?void 0:null===(t=e.selectedAppointementData)||void 0===t?void 0:t.title)||"")}),(0,i.jsx)("div",{className:"w-full font12 truncate",children:"Type: ".concat((null==e?void 0:e.slotType)||"")}),(0,i.jsx)("div",{className:"w-full font12 truncate",children:"From: ".concat(null==e?void 0:e.address)}),(0,i.jsx)("div",{className:"w-full font12 line-clamp-3",children:"Message: ".concat(null==e?void 0:e.message)}),(0,i.jsx)("div",{className:"w-full flex justify-end items-center p-0.5 my-0.5"})]},(0,r.Km)(10))})}):(0,i.jsx)("div",{className:"w-full h-full flex justify-center items-center ",children:"No Appointments."})})};return(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-start items-start gap-2 relative py-4",children:o?(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-start items-center gap-1 p-2",children:[(0,i.jsx)("div",{className:"w-full h-24 rounded-md bg-gray-300 animate-pulse"}),(0,i.jsx)("div",{className:"w-full h-24 rounded-md bg-gray-300 animate-pulse"}),(0,i.jsx)("div",{className:"w-full h-24 rounded-md bg-gray-300 animate-pulse"})]}):(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-start items-center gap-1 p-2",children:null===(t=s.sort((e,t)=>(d(null==e?void 0:e.startUtcTIme,27)?c.indexOf(d(null==e?void 0:e.startUtcTIme,28)):-1)==(d(null==t?void 0:t.startUtcTIme,29)?c.indexOf(d(null==t?void 0:t.startUtcTIme,30)):-1)?new Date(null==e?void 0:e.endUtcTIme)-new Date(null==t?void 0:t.endUtcTIme):new Date(null==e?void 0:e.startUtcTIme)-new Date(null==t?void 0:t.startUtcTIme)))||void 0===t?void 0:t.map((e,t)=>(0,i.jsxs)("div",{className:"w-full flex flex-col justify-between items-center border border-tab-inactiveBorder gap-1 px-2 py-1 rounded-md shadow-sm",style:{backgroundColor:"".concat(u[null==e?void 0:e.type])},onClick:()=>{let t=d(null==e?void 0:e.endUtcTIme,31),l=c.indexOf(t);m(t),v(l)},children:[(0,i.jsxs)("div",{className:"w-full flex justify-between items-center font12",children:[(0,i.jsxs)("div",{className:"flex justify-center items-center gap-2",children:[(0,i.jsx)("button",{className:"p-0.5",onClick:()=>{A(!0),N((null==e?void 0:e.id)||""),C(e||{});let t=window.location.origin;I("".concat(t,"/organizer/").concat(null==k?void 0:k.uid))},children:(0,i.jsx)(w.default,{className:"w-3.5 h-3.5"})}),(0,i.jsx)("div",{className:"p-2 cursor-pointer",onClick:()=>{f(!0),p((null==e?void 0:e.title)||""),g((null==e?void 0:e.description)||""),h(d(null==e?void 0:e.startUtcTIme,32)||""),j(d(null==e?void 0:e.endUtcTIme,33)||""),b((null==e?void 0:e.type)||""),N((null==e?void 0:e.id)||""),J((null==e?void 0:e.usersPerSlot)||1)},children:(0,i.jsx)(y.default,{className:"w-3.5 h-3.5"})})]}),(0,i.jsx)("div",{className:"text-[#3C3C3C] text-[8px] md:text-[10px] ",children:"(".concat(null==e?void 0:e.type,")")}),(0,i.jsxs)("div",{className:"flex justify-end items-center cursor-default",children:[(0,i.jsx)("span",{children:new Date(null==e?void 0:e.startUtcTIme)<new Date(P)||new Date(B)<new Date(null==e?void 0:e.endUtcTIme)?"".concat(d(null==e?void 0:e.startUtcTIme,34),", ").concat(new Date(null==e?void 0:e.startUtcTIme).toLocaleDateString()," - ").concat(d(null==e?void 0:e.endUtcTIme,35),", ").concat(new Date(null==e?void 0:e.endUtcTIme).toLocaleDateString()):"".concat(d(null==e?void 0:e.startUtcTIme,36)," - ").concat(d(null==e?void 0:e.endUtcTIme,37))}),(0,i.jsxs)("span",{className:"flex justify-center items-center font12 px-2",children:["(",(0,i.jsx)(x.Z,{}),")"]})]})]}),(0,i.jsx)("div",{className:"w-full h-full",children:(null==e?void 0:e.type)=="Open Appointments"||"Digital Coffee"==e.type||(null==e?void 0:e.type)=="Blocked Time"||(null==e?void 0:e.type)=="Services"||(null==e?void 0:e.type)=="Appointment and Services"||(null==e?void 0:e.type)=="Multi-Participant"?(0,i.jsx)(i.Fragment,{children:Z({e})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"w-full flex justify-start items-center font14 font-medium",children:e.title}),(0,i.jsx)("div",{className:"w-full py-0.5 flex justify-start items-center font12",children:e.description})]})})]},(0,r.Km)(10)))})})},N=l(35062),S=l(11730),D=l(72741),O=l(87066);let T=e=>{for(var t=[],l=0,i=["AM","PM"],n=0;l<1440;n++){var a=Math.floor(l/60),o=l%60;t[n]=(12==a?"12":("0"+a%12).slice(-2))+":"+("0"+o).slice(-2)+i[Math.floor(a/12)],l+=e}return t};var _=e=>{let{uid:t,dateVar:l,digitalcoffeeDescription:n,setDigitalcoffeeDescription:y,difitalCoffeeLink:x,setDigitalCoffeeLink:w,appointmentDescription:_,setAppointmentDescription:E,appointmentLink:k,setAppointmentLink:A,setStartDate:C,startDate:I,setEndDate:M,endDate:J,userData:U,setUserData:P,multiAppointmentLink:B,setMultiAppointmentLink:Z,multiAppointmentDescription:z,setMultiAppointmentDescription:L}=e,[R,F]=(0,o.useState)(""),[Y,q]=(0,o.useState)(0),[H,G]=(0,o.useState)(!1),[Q,$]=(0,o.useState)(""),[K,W]=(0,o.useState)(""),[V,X]=(0,o.useState)(""),[ee,et]=(0,o.useState)(""),[el,ei]=(0,o.useState)(""),[en,ea]=(0,o.useState)(""),[eo,er]=(0,o.useState)(1),[es,ed]=(0,o.useState)({}),[ec,eu]=(0,o.useState)([]),[em,ev]=(0,o.useState)([]),[ef,ep]=(0,o.useState)({}),[eg,eh]=(0,o.useState)({}),[ey,ex]=(0,o.useState)(""),[ew,ej]=(0,o.useState)(!1),[eb,eN]=(0,o.useState)(!1),[eS,eD]=(0,o.useState)(!1),[eO,eT]=(0,o.useState)(!1),[e_,eE]=(0,o.useState)({}),[ek,eA]=(0,o.useState)(""),[eC,eI]=(0,o.useState)([]),[eM,eJ]=(0,o.useState)(!1),[eU,eP]=(0,o.useState)(!1),[eB,eZ]=(0,o.useState)(!1),[ez,eL]=(0,o.useState)({}),[eR,eF]=(0,o.useState)(!1),[eY,eq]=(0,o.useState)(""),[eH,eG]=(0,o.useState)(""),[eQ,e$]=(0,o.useState)(""),[eK,eW]=(0,o.useState)(""),[eV,eX]=(0,o.useState)(""),[e0,e1]=(0,o.useState)({}),[e5,e3]=(0,o.useState)(!1),[e2,e4]=(0,o.useState)(""),[e6,e9]=(0,o.useState)(""),[e8,e7]=(0,o.useState)(""),[te,tt]=(0,o.useState)(""),tl=(0,g.useRouter)(),{emailtype:ti}=tl.query,tn=(0,o.useRef)(null),ta=(0,o.useMemo)(()=>T(15),[]),[to]=(0,h.F_)(u.I8),tr={"Digital Coffee":"Digital Coffee","Open Appointments":"Appointment only",Tasks:"Task","Multi-Participant":"Multi-Participant Appointment","Blocked Time":"Blocked Time",Services:"Services only","Appointment and Services":"Appointment and Services both"},ts={"Digital Coffee":"#cc8800","Open Appointments":"#CBFFDA",Tasks:"#FFB6C1","Multi-Participant":"#BDA0CB","Blocked Time":"#D3D3D3",Services:"#ADD8E6","Appointment and Services":"#E0FFFF"};var td,tc=a()().utcOffset();let tu=(e,t,l,i,n)=>{let a=[],o=9e5*l,r=new Date(e),s=new Date(t),d=ta.indexOf(i);for(;r<s;)a.push({utc:r.toISOString(),local:ta[d]}),d++,r.setTime(r.getTime()+o);return a};function tm(e,t){let l=new Date(e);return l.setMinutes(l.getMinutes()+t),l.toISOString()}(0,o.useEffect)(()=>{var e;let i=t||(null==to?void 0:to.uid)||(null===u.I8||void 0===u.I8?void 0:null===(e=u.I8.currentUser)||void 0===e?void 0:e.uid);if(i&&l){let e=new Date(l),t="Month_"+e.getFullYear()+"_"+(e.getMonth()+1);if(l&&(null==t?void 0:t.length)>7)try{let e=(0,c.doc)(u.db,"uploads",i,"schedule",t);return eT(!0),(0,c.cf)(e,e=>{if(e.exists()){let t=(null==e?void 0:e.data())||{};ed({...t,dateId:null==e?void 0:e.id})}else ed({}),eu([]),eT(!1)})}catch(e){(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 229] : Error occured while reading schedue data for document ID ".concat(t||""," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}}},[l,t,to]),(0,o.useEffect)(()=>{var e,t,l,i,n;if(ti&&(null==ti?void 0:ti.length)>0&&"cancel"!==ti&&U&&(null===(e=Object.keys(U||{}))||void 0===e?void 0:e.length)>0){let e=JSON.parse(localStorage.getItem("$#Contactify_Email_store_Data$")||"{}")||{};if((null===(t=Object.keys(e||{}))||void 0===t?void 0:t.length)>0){let t=new FormData,a=(null==e?void 0:null===(l=e.selectedEmailAccount)||void 0===l?void 0:l.Email)||"",o=JSON.parse(JSON.stringify(U||{}))||{},s=(null==o?void 0:null===(i=o.emailAccoutDetails)||void 0===i?void 0:i.slice())||[],d=(s||[]).findIndex(e=>(null==e?void 0:e.Email)===a);if(d>-1){let l=JSON.parse(JSON.stringify(s[d]||{}))||{};if((null==l?void 0:l.Comapny)=="Office365"){eh((null==e?void 0:e.appointmentData)||{}),eJ(!0);let i={from_addr:(null==l?void 0:l.Email)||"",to_emails:(null==e?void 0:e.EmailList)||[],to_cc:[],to_bcc:[],subject:(null==e?void 0:e.emailSubject)||"",htmlbody:(null==e?void 0:e.emailConents)||"",access_token:(null==l?void 0:null===(n=l.Access)||void 0===n?void 0:n.access_token)||""};t.append("request",JSON.stringify(i));let a=JSON.stringify(t).length;fetch("https://contactify-api.vercel.app/sendemailwithattachmentpersonaloffice",{method:"POST",body:t,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":a}}).then(e=>e.json()).then(t=>{(null==t?void 0:t.detail)?((0,v.Z)("Error while sending email - ".concat(null==t?void 0:t.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 316] : Error occured while sending email from office 365 using office api with status of 500 for user ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(null==t?void 0:t.detail))})):((0,v.Z)("Email sent successfully"),tf(i,"",[],(null==e?void 0:e.emailConents)||""),eJ(!1),localStorage.removeItem("$#Contactify_Email_store_Data$"),
1(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 340] : Email sent Successfully from office 365 mail to ".concat((null==i?void 0:i.to_emails)||""," from ").concat((null==i?void 0:i.from_addr)||"",".")}))}).catch(e=>{eJ(!1),(0,v.Z)(e,{time:5e3}),console.error("state","error",e),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 346] : Error occured while sending email from offic 365 send email api for user ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}}}}},[ti,U]),(0,o.useEffect)(()=>{var e,t;if(ti&&(null==ti?void 0:ti.length)>0&&"cancel"==ti&&U&&(null===(e=Object.keys(U||{}))||void 0===e?void 0:e.length)>0){let e=JSON.parse(JSON.stringify(U||{}))||{},i=JSON.parse(localStorage.getItem("$#Contactify_Cancel_Data$")||"{}")||{},n=(null==e?void 0:null===(t=e.emailAccoutDetails)||void 0===t?void 0:t.slice())||[],a=(n||[]).findIndex(e=>{var t;return(null==e?void 0:e.Email)===(null==i?void 0:null===(t=i.selectedEmailAccount)||void 0===t?void 0:t.Email)}),o=new Date(l),s="Month_"+o.getFullYear()+"_"+(o.getMonth()+1);if(a>-1){let t=JSON.parse(JSON.stringify(n[a]||{}))||{};if((null==t?void 0:t.Comapny)=="Office365"){"appointment"==el?(eP(!0),eL((null==i?void 0:i.modaldata)||{}),eZ(!0)):(e1((null==i?void 0:i.modaldata)||{}),ej(!0),eD(!0)),((null==i?void 0:i.cancelAppointmentarr)||[]).map((l,n)=>{var a;let o=(null==l?void 0:l.email)||"",s=(null==l?void 0:l.name)||"";tg({toemail:o||"",htmlbody:(0,r.ww)({name:s||"",message:(null==i?void 0:i.email)||"",adminName:(null==e?void 0:e.firstName)+" "+(null==e?void 0:e.lastName)||(null==e?void 0:e.displayName)||"",adminEmail:(null==e?void 0:e.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==e||!e.cancelMessage})||"",subject:"Request to Cancel and Reschedule Our Important Appointment",from:(null==t?void 0:t.Email)||"",accesstoken:(null==t?void 0:null===(a=t.Access)||void 0===a?void 0:a.access_token)||""})});let l=(0,c.doc)(u.db,"uploads",null==e?void 0:e.uid,"schedule",s);(0,c.r7)(l,null==i?void 0:i.toadyCompDataClone).then(()=>{localStorage.removeItem("$#Contactify_Cancel_Data$"),(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),console.error("state","Error writing document: ",e),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 476] : Error occured while storing the deleted schedlue data for user ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}}}},[ti,U]),(0,o.useEffect)(()=>{var e,t,i,n,o,s,d,c,u;if((null===(e=Object.keys(es||{}))||void 0===e?void 0:e.length)>0)try{let e=a()(new Date(l)).format("YYYY-MM-DD"),r=new Date(e);r.setTime(r.getTime()+-6e4*tc),r.setHours(0,0,0,0);let m=r.toISOString();r.setHours(23,59,59,999);let v=r.toISOString(),f=new Date(l),p="Date_"+(f.getDate()-1),g="Date_"+f.getDate(),h="Date_"+(f.getDate()+1),y=es[p]||{},x=es[g]||{},w=es[h]||{},j=[];for(let e in y)j.push({...y[e],id:e,dateId:p});for(let e in x)j.push({...x[e],id:e,dateId:g});for(let e in w)j.push({...w[e],id:e,dateId:h});let b=[...j.slice().filter(e=>new Date(e.endUtcTIme)>new Date(m)&&new Date(e.startUtcTIme)<new Date(m)||new Date(e.startUtcTIme)<new Date(v)&&new Date(e.startUtcTIme)>new Date(m))],N=[],S=[],D=[],O=[],T=[],_=[];for(let e of b){let t=tu(null==e?void 0:e.startUtcTIme,null==e?void 0:e.endUtcTIme,1,null==e?void 0:e.startTime,null==e?void 0:e.endTime),l=[...(null==e?void 0:e.appointmentData)||[]].map(e=>{let t=tu(null==e?void 0:e.startTimeUtc,null==e?void 0:e.endTimeUtc,1,null==e?void 0:e.startTime,null==e?void 0:e.endTime);return{...e,timeArray:t}});if(_.push(...l),N.push({...e,timeArray:t,appointmentData:l}),(null==e?void 0:e.type)=="Blocked Time"){D.push({...e,timeArray:t,appointmentData:l});let i=t.map(e=>null==e?void 0:e.utc);T=[...T||[],...i||[]]}else O.push({...e,timeArray:t,appointmentData:l})}let E=[];for(let e of O){let l=new Date(null==e?void 0:e.startUtcTIme),a=new Date(null==e?void 0:e.endUtcTIme),r=D.every(e=>{let t=new Date(null==e?void 0:e.startUtcTIme),i=new Date(null==e?void 0:e.endUtcTIme);return a<t&&l<t||l>i&&a>i}
1),m={...e,appointmentData:[]};if(r)S.push(e);else{let l=[];for(let a in null==e?void 0:e.timeArray){let r=null==e?void 0:null===(i=e.timeArray)||void 0===i?void 0:null===(t=i[a])||void 0===t?void 0:t.utc,s=null==e?void 0:null===(o=e.timeArray)||void 0===o?void 0:null===(n=o[a])||void 0===n?void 0:n.local;T.includes(r)||l.push({utc:r,local:s})}let a=l.reduce((e,t,l,i)=>{if(0===l)e.push([t]);else{var n;let a=new Date(null==i?void 0:null===(n=i[l-1])||void 0===n?void 0:n.utc),o=(new Date(null==t?void 0:t.utc)-a)/1e3/60;15===o?e[e.length-1].push(t):e.push([t])}return e},[]),r=0;for(let e of a){let t={...m};t.startUtcTIme=null==e?void 0:null===(s=e[0])||void 0===s?void 0:s.utc,t.endUtcTIme=tm(null==e?void 0:null===(d=e[e.length-1])||void 0===d?void 0:d.utc,15),t.startTime=null==e?void 0:null===(c=e[0])||void 0===c?void 0:c.local;let l=ta.indexOf(null==e?void 0:null===(u=e[e.length-1])||void 0===u?void 0:u.local);t.endTime=e.length-1==l?null==ta?void 0:ta[0]:null==ta?void 0:ta[l+1],t.id="".concat(t.id,"_").concat(r),r++,t.timeArray=e,E.push({...t})}}}S=[...S,...E,...D];let k=[],A=new Set;_.forEach(e=>{A.has((null==e?void 0:e.assignedId)||"")||(k.push(e),A.add((null==e?void 0:e.assignedId)||""))});let C=(S||[]).map((e,t)=>{let l={...e||{}},i=(null==l?void 0:l.timeArray)||[],n=null==i?void 0:i.map(e=>null==e?void 0:e.utc),a=[];for(let e of k){var o,r,s,d,c,u;let t={...e},i=(null==e?void 0:e.timeArray)||[],m=[];for(let e in i){let t=null==i?void 0:null===(o=i[e])||void 0===o?void 0:o.utc,l=null==i?void 0:null===(r=i[e])||void 0===r?void 0:r.local;n.includes(t)&&m.push({utc:t,local:l})}let v=m.reduce((e,t,l,i)=>{if(0===l)e.push([t]);else{var n;let a=new Date(null==i?void 0:null===(n=i[l-1])||void 0===n?void 0:n.utc),o=(new Date(null==t?void 0:t.utc)-a)/1e3/60;15===o?e[e.length-1].push(t):e.push([t])}return e},[]),f=0;for(let e of v){let i={...t};if(function(e,t){if(!e||!t)return!1;let{slotType:l}=t,i={Services:["Services","Appointment and Services","Blocked Time"],"Open Appointments":["Open Appointments","Appointment and Services","Blocked Time"]};return i[l]||(i[l]=[l,"Blocked Time"]),i[l].includes(e.type)}(l,i)){i.startUtcTIme=null==e?void 0:null===(s=e[0])||void 0===s?void 0:s.utc,i.endUtcTIme=tm(null==e?void 0:null===(d=e[e.length-1])||void 0===d?void 0:d.utc,15),i.startTime=null==e?void 0:null===(c=e[0])||void 0===c?void 0:c.local;let t=ta.indexOf(null==e?void 0:null===(u=e[e.length-1])||void 0===u?void 0:u.local);i.endTime=e.length-1==t?null==ta?void 0:ta[0]:null==ta?void 0:ta[t+1],i.id="".concat(i.id,"_").concat(f),f++,i.timeArray=e,a.push({...i})}}}return l.appointmentData=a||[],l});eT(!1),eu(C||[])}catch(e){eT(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 549] : Error occured while filtering today's schedule data about task for user ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat((null==e?void 0:e.message)||JSON.stringify(e))})}},[es,l]),(0,o.useEffect)(()=>{if(ta.length>0&&t){let e=(4*new Date().getHours()||0)+(Math.round((new Date().getMinutes()||0)/15)||0);F(ta[e]),q(e)}},[ta,es,t]),(0,o.useEffect)(()=>{try{let e=document.getElementById("Time_".concat(R));e&&e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})}catch(e){console.log("state","error",e)}},[R]),(0,o.useEffect)(()=>{try{var e,t,i,n,o,s;if(ta.length>0&&ec.length>0&&(null==to?void 0:to.uid)){let r={},s={},d={};null===(e=ta||[])||void 0===e||e.map((e,t)=>{r[t]=0,s[t]={}});let c=a()(new Date(l)).format("YYYY-MM-DD"),u=new Date(c);u.setTime(u.getTime()+-6e4*tc),u.setHours(0,0,0,0);let m=u.toISOString();u.setHours(23,59,59,999);let v=u.toISOString(),f=null===(t=(ec||[]).slice().sort((e,t)=>{let l=tb(null==e?void 0:e.startUtcTIme,1)?ta.indexOf(tb(null==e?void 0:e.startUtcTIme,2)):-1,i=tb(null==t?void 0:t.startUtcTIme,3)?ta.indexOf(tb(null==t?void 0:t.startUtcTIme,4)):-1;return l==i?new Date(null==e?void 0:e.endUtcTIme)-new Date(null==t?void 0:t.endUtcTIme):new Date(null==e?void 0:e.startUtcTIme)-new Date(null==t?void 0:t.startUtcTIme)}))||void 0===t?void 0:t.map((e,t)=>{let l=JSON.parse(JSON.stringify(e||{}))||{},i=tb(null==e?void 0:e.startUtcTIme,6)?new Date(null==e?void 0:e.startUtcTIme)<new Date(m)?ta.indexOf(tb(m,7)):ta.indexOf(tb(null==e?void 0:e.startUtcTIme,8)):-1,n=tb(null==e?void 0:e.endUtcTIme,9)?new Date(v)<new Date(null==e?void 0:e.endUtcTIme)?ta.length:ta.indexOf(tb(null==e?void 0:e.endUtcTIme,10)):-1,a=n-i;l.startIndex=i,l.endIndex=n,l.length=a;let o=32*[i],d=o+32*a;l.startPosition=o,l.endposition=d;let c=[],u=0;for(let e=i;e<n;e++){c.push(e),r[e]=r[e]+1;let t=JSON.parse(JSON.stringify(s[e]||{}))||{};if(e==i){let i=Object.keys(t||{})||[],n=(null==i?void 0:i.length)==0?0:Math.max(...i)+1||0,a=!1;for(let i=0;i<=n;i++)a||t[i]||(t[i]=l.id,a=!0,u=i,s[e]=t)}else t[u]=l.id,s[e]=t}return l.indexes=c,l}),p=null===(n=f||[])||void 0===n?void 0:null===(i=n.slice())||void 0===i?void 0:i.map((e,t)=>{var l,i,n;let a=JSON.parse(JSON.stringify(e||{}))||{},o=(null==a?void 0:null===(l=a.indexes)||void 0===l?void 0:l.slice())||[],c=0;null===(i=o||[])||void 0===i||i.map((e,t)=>{r[e]>c&&(c=r[e])});let u=s[a.startIndex];null===(n=Object.entries(u||{})||[])||void 0===n||n.map(e=>{e[1]==a.id&&(a.position=Number(e[0]))}),a.maxValue=c;let m=Math.floor(100/c);return a.width=m,d[a.id]=a,a}),g=JSON.parse(JSON.stringify(d||{}))||{};Object.keys(s||{}
1).forEach((e,t)=>{let l=JSON.parse(JSON.stringify(s[e]||{}))||{},i=Object.entries(l||{})||[];if((null==i?void 0:i.length)>1){var n,a;let e=0;null===(n=i||[])||void 0===n||n.map((t,l)=>{var i,n,a;0==l?e=null===(i=g[t[1]])||void 0===i?void 0:i.width:(null===(n=g[t[1]])||void 0===n?void 0:n.width)<e&&(e=null===(a=g[t[1]])||void 0===a?void 0:a.width)}),null===(a=i||[])||void 0===a||a.map((t,l)=>{g[t[1]].minWidth=e})}});let h=null===(o=(p||[]).slice())||void 0===o?void 0:o.map((e,t)=>{let l=JSON.parse(JSON.stringify(e||{}))||{},i=l.id;return l.minWidth=g[i].minWidth||g[i].width,l});ev(h||[]),ep(r||{});let y={};Object.keys(r||{}).forEach((e,t)=>{y[ta[e]]=r[e]})}else if((null==ta?void 0:ta.length)>0&&(null==ec?void 0:ec.length)==0&&(null==to?void 0:to.uid)){let e={};null===(s=ta||[])||void 0===s||s.map((t,l)=>{e[t]=0}),ep(e||{}),ev([])}}catch(e){(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 780] : Error occured while processsing the data for today's schedule for time chart section for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}},[ta,ec,to]),(0,o.useEffect)(()=>{if(U&&Object.keys(U).length>0){let e=(null==U?void 0:U.uid)||"";if(e&&(null==e?void 0:e.length)>0){let t="https://api.spicyfy.io/contactify/getAllCards/".concat(encodeURIComponent(e));O.Z.post(t,{email:!0,cardId:!0},{headers:{"x-api-key":"a6b089b91029b3e6d0e55477575991cb"}}).then(e=>{if(null==e?void 0:e.data){var t;eI([...(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.cards)||[]])}}).catch(e=>{var t;(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 807] : Error occured while getting user cards data from uploads collection for user ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat((null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||JSON.stringify(e))})})}}},[U]),(0,o.useEffect)(()=>{if(U&&Object.keys(U).length>0){var e,t;let l=JSON.parse(JSON.stringify(U||{}))||{},i=(null==l?void 0:null===(t=l.emailAccoutDetails)||void 0===t?void 0:null===(e=t.slice())||void 0===e?void 0:e.sort((e,t)=>(null==e?void 0:e.Priority)-(null==t?void 0:t.Priority)))||[];eE(JSON.parse(JSON.stringify((null==i?void 0:i[0])||{}))||{})}},[U]);let tv=e=>{if((null==e_?void 0:e_.Comapny)=="Office365"){let l={client_id:(0,p.LB)(null==e_?void 0:e_.client_id),response_type:"code",redirect_uri:"https://contactify.ai/auth",response_mode:"query",scope:"offline_access user.read mail.read mail.readwrite mail.send",state:"12345"},i=(0,r._G)(l||{}),n={client:"",user:t,tab:"organizer",section:"",type:e,email:null==e_?void 0:e_.Email};localStorage.setItem("$#Contactify_email_Data$",JSON.stringify(n||{})),tl.push("https://login.microsoftonline.com/".concat((0,p.LB)(null==e_?void 0:e_.tenant_id),"/oauth2/v2.0/authorize?").concat(i))}},tf=(e,l,i,n)=>{var o;let s=(null==e?void 0:null===(o=e.to_emails)||void 0===o?void 0:o[0])||[],d=(null==eC?void 0:eC.slice())||[],m=eC.findIndex((e,t)=>(null==e?void 0:e.email)==s);if(m>-1){let i=JSON.parse(JSON.stringify((null==d?void 0:d[m])||{}))||{},o=(null==i?void 0:i.cardId)||"",s=a()().format("ddd_DD_MMM_YYYY_HH:mm:ss_Z"),v={to:(null==e?void 0:e.to_emails)||[],Cc:(null==e?void 0:e.to_cc)||[],Bcc:(null==e?void 0:e.to_bcc)||[],html_body:(null==e?void 0:e.htmlbody)||"",from:(null==e?void 0:e.from_addr)||"",AttachmentList:[],id:(0,r.Km)(20)||"",subject:(null==e?void 0:e.subject)||"",date:a()().format("ddd, DD MMM YYYY HH:mm:ss Z"),body:n||"",templateId:l||"",ClientId:o||"",Type:"Sent"},f=(0,c.doc)(u.db,"uploads",t,"emails",s);(0,c.setDoc)(f,v,{merge:!0}).then(()=>{let e=(0,c.doc)(u.db,"uploads",t,"contacts",o,"emails",s);(0,c.setDoc)(e,v,{merge:!0}).then(()=>{let e=(0,c.doc)(u.db,"uploads",t,"contacts",o);(0,c.setDoc)(e,{[s]:{addedAt:Date.parse(new Date),id:null==v?void 0:v.id,type:"Sent"}},{merge:!0}).then(()=>{}).catch(e=>{console.error("state","error",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 934] : Error occured while storing send email information in client ".concat(o," contacts collection for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}).catch(e=>{console.error("state","err",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 948] : Error occured while storing send email information in client ".concat(o," emails collection for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}).catch(e=>{console.error("state",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 966] : Error occured while storing send email information in users emails collection for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}},tp=e=>{var t;let l=e.split(":"),i=l[0]>12?l[0]-12:l[0],n=l[1],a=l[0]>=12?"PM":"AM";return((null===(t=JSON.stringify(i))||void 0===t?void 0:t.length)==1?"0"+i:i)+":"+n+a},tg=e=>{let{toemail:t,htmlbody:l,subject:i,accesstoken:n,from:a}=e;try{let e=new FormData,o={from_addr:a||"",to_emails:[t],to_cc:[],to_bcc:[],subject:i||"",htmlbody:l||"",access_token:n||""};e.append("request",JSON.stringify(o));let s=JSON.stringify(e).length;fetch("https://contactify-api.vercel.app/sendemailwithattachmentpersonaloffice",{method:"POST",body:e,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":s}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3792] : Error occured in the api call sending email to office 365 ".concat(a," with status of 500 for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(o,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3847] : Email sent Successfully from office 365 mail to ".concat((null==o?void 0:o.to_emails)||""," from ").concat((null==o?void 0:o.from_addr)||"",".")}))}).catch(e=>{eJ(!1),(0,v.Z)(e,{time:5e3}),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3816] : Error occured in the api call sending email to office 365 ".concat(a," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}catch(e){(0,v.Z)(e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3826] : Error occured SendOfficeemail for email ".concat(a," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}},th=e=>{let{toemail:t,htmlbody:l,subject:i,from:n,password:a,smtpserver:o,smtpport:s}=e;try{let e=new FormData,d={from_addr:n||"",to_emails:[t],to_cc:[],to_bcc:[],subject:i||"",htmlbody:l||"",priority:3,email:n||"",password:(a?(0,p.W4)(a):"")||"",SMTPServer:o||"",SMTPPort:s||0};if((null==d?void 0:d.email)=="")return(0,v.Z)("Please Add your Email in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==d?void 0:d.password)=="")return(0,v.Z)("Please Add your Password in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==d?void 0:d.SMTPServer)=="")return(0,v.Z)("Please Add your SMTPServer in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==d?void 0:d.SMTPPort)==0)return(0,v.Z)("Please Add your SMTPPort in Email Settings in Teams page",1e4),eJ(!1),!1;e.append("request",JSON.stringify(d));let c=JSON.stringify(e).length;fetch("https://contactify-api.vercel.app/sendemailwithattachment",{method:"POST",body:e,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":c}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3912] : Error occured in the api call sending email to smtp ".concat(n," with status of 500 for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(d,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3975] : Email sent Successfully from office 365 mail to ".concat((null==d?void 0:d.to_emails)||""," from ").concat((null==d?void 0:d.from_addr)||"",".")}))}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),console.error("state","error",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3933] : Error occured in the api call sending email to smtp email ".concat(n," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}catch(e){console.error("state","err",e),(0,v.Z)(e,5e3),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3826] : Error occured SendSmtpEmail for email ".concat(n," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}},ty=e=>{let{toemail:t,htmlbody:l,subject:i,from:n,apiKey:a}=e;try{let e=new FormData,o={from_addr:n||"",to_emails:[t],to_cc:[],to_bcc:[],subject:i||"",htmlbody:l||"",apiKey:a?(0,p.W4)(a):""};if((null==o?void 0:o.email)=="")return(0,v.Z)("Please Add your Email in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==o?void 0:o.apiKey)=="")return(0,v.Z)("Please Add your API key in Email Settings in Teams page",5e3),eJ(!1),!1;e.append("request",JSON.stringify(o));let s=JSON.stringify(e).length;fetch("https://contactify-api.vercel.app/sendgridemailwithattachment",{method:"POST",body:e,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":s}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3823] : Error occured in the api call sending email to sendgrid ".concat(n," with status of 500 for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(o,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3842] : Email sent Successfully from sendgrid mail to ".concat((null==o?void 0:o.to_emails)||""," from ").concat((null==o?void 0:o.from_addr)||"",".")}))}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),console.error("state","error",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3856] : Error occured in the api call sending email to sendgrid email ".concat(n," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}catch(e){console.error("state","err",e),(0,v.Z)(e,5e3),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 3866] : Error occured SendGridEmail for email ".concat(n," for user ").concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}},tx=(e,i,n,a,o)=>{try{var s,d,m,f,g,h,y,x,w,j,b,N,S;let D=new Date(l),O="Month_"+D.getFullYear()+"_"+(D.getMonth()+1),T=JSON.parse(JSON.stringify(es||{}))||{},_=new Date,E=new Date,k=[];if("appointment"==e){let e=JSON.parse(JSON.stringify(a||{}))||{},t=JSON.parse(JSON.stringify((null==T?void 0:T[null==e?void 0:e.dateId])||""))||"",l=(null===(s=(null==e?void 0:e.id)||"")||void 0===s?void 0:s.includes("_"))||(null===(d=(null==e?void 0:e.id)||"")||void 0===d?void 0:d.length)>5?null===(f=(null==e?void 0:e.id)||"")||void 0===f?void 0:null===(m=f.split("_"))||void 0===m?void 0:m[0]:(null==e?void 0:e.id)||"",i=JSON.parse(JSON.stringify((null==t?void 0:t[l])||{}))||{};k.push(e||{});let n=(null==i?void 0:null===(g=i.appointmentData)||void 0===g?void 0:g.slice())||[],o=n.findIndex(t=>(null==t?void 0:t.endTimeUtc)==(null==e?void 0:e.endTimeUtc)&&(null==t?void 0:t.startTimeUtc)==(null==e?void 0:e.startTimeUtc)&&(null==t?void 0:t.name)==(null==e?void 0:e.name)&&(null==t?void 0:t.address)==(null==e?void 0:e.address)&&(null==t?void 0:t.message)==(null==e?void 0:e.message)&&(null==t?void 0:t.email)==(null==e?void 0:e.email));o>-1&&(_=new Date(null==e?void 0:e.startTimeUtc),E=new Date(null==e?void 0:e.endTimeUtc),n.splice(o,1),i.appointmentData=n,t[l]=i,T[null==e?void 0:e.dateId]=t)}if("timeslot"==e){let e={};(null==n?void 0:n.length)>0&&(Object.keys(T||{}).map((t,l)=>{var i,a,o,s,d,c,u;let m=JSON.parse(JSON.stringify((null==T?void 0:T[t])||{}))||{},v=(null===(i=n||"")||void 0===i?void 0:i.includes("_"))||(null===(a=n||"")||void 0===a?void 0:a.length)>5?null===(s=n||"")||void 0===s?void 0:null===(o=s.split("_"))||void 0===o?void 0:o[0]:n||"";if(Object.keys(m||{}).length>0&&Object.keys(m||{}).includes(v)){for(let e of[...ec||[]].filter(e=>{var t,l;return(null==e?void 0:null===(l=e.id)||void 0===l?void 0:null===(t=l.split("_"))||void 0===t?void 0:t[0])==v})){let t={...e||{}};
1if((null==t?void 0:t.id)==n){_=new Date(null==t?void 0:t.startUtcTIme),E=new Date(null==t?void 0:t.endUtcTIme);let e=(null==t?void 0:null===(d=t.appointmentData)||void 0===d?void 0:d.slice())||[];(null==e?void 0:e.length)>0&&e.map((e,t)=>{k.push(e||{})})}else{let e=(0,r.Km)(5),l=(null==t?void 0:null===(c=t.appointmentData)||void 0===c?void 0:c.slice())||[];if((null===(u=l||[])||void 0===u?void 0:u.length)>0){let i=l.map(t=>{let l={...t,id:e};return delete l.timeArray,l});t.appointmentData=i||[]}delete t.timeArray,m[e]={...t,id:e}}}delete m[v]}e[t]=m}),T=JSON.parse(JSON.stringify(e||{}))||{})}let A=JSON.parse(JSON.stringify(U||{}))||{};if((null==k?void 0:k.length)>0&&new Date<_){let l=(null==A?void 0:null===(y=A.emailAccoutDetails)||void 0===y?void 0:null===(h=y.slice())||void 0===h?void 0:h.sort((e,t)=>(null==e?void 0:e.Priority)-(null==t?void 0:t.Priority)))||[],s=JSON.parse(JSON.stringify((null==l?void 0:l[0])||{}))||{},d="Request to Cancel and Reschedule Our Important Appointment";if((null==s?void 0:s.Comapny)=="Office365"){let l={tenant_id:(null==s?void 0:s.tenant_id)||"",client_id:(null==s?void 0:s.client_id)||"",client_secret:(null==s?void 0:s.client_secret)||""};if(""==(0,p.LB)(null==l?void 0:l.tenant_id)||""==(0,p.LB)(null==l?void 0:l.client_id)||""==(0,p.LB)(null==l?void 0:l.client_secret))return(0,v.Z)("Please add Office 365 email ids and keys"),eJ(!1),!1;if((null==s?void 0:s.refresh_token)&&(null==s?void 0:null===(x=s.refresh_token)||void 0===x?void 0:x.length)>0&&(null==s?void 0:s.refrest_token_time)&&(null==s?void 0:s.refrest_token_time)+5184e6>Date.parse(new Date)){if((null==s?void 0:null===(w=s.Access)||void 0===w?void 0:w.access_token)&&(null==s?void 0:null===(b=s.Access)||void 0===b?void 0:null===(j=b.access_token)||void 0===j?void 0:j.length)>0&&(null==s?void 0:null===(N=s.Access)||void 0===N?void 0:N.expireTime)&&(null==s?void 0:null===(S=s.Access)||void 0===S?void 0:S.expireTime)>Date.parse(new Date)-18e4){(k||[]).map((e,t)=>{var l;let n=(null==e?void 0:e.email)||"",a=(null==e?void 0:e.name)||"",o=(0,r.ww)({name:a||"",message:i||"",adminName:(null==A?void 0:A.firstName)+" "+(null==A?void 0:A.lastName)||(null==A?void 0:A.displayName)||"",adminEmail:(null==A?void 0:A.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==A||!A.cancelMessage})||"";tg({toemail:n||"",htmlbody:o||"",subject:d||"",from:(null==s?void 0:s.Email)||"",accesstoken:(null==s?void 0:null===(l=s.Access)||void 0===l?void 0:l.access_token)||""})});let e=(0,c.doc)(u.db,"uploads",null==A?void 0:A.uid,"schedule",O);(0,c.r7)(e,T).then(()=>{(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4156] : Error occured deleting a appointment from firestore for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}else{let e={client_id:null==l?void 0:l.client_id,refresh_token:null==s?void 0:s.refresh_token,client_secret:null==l?void 0:l.client_secret,tenant_id:null==l?void 0:l.tenant_id};fetch("/api/office/refresh_token",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{var l,n;let a=(0,c.doc)(u.db,"users",t),{token_type:o,scope:m,expires_in:f,access_token:p,refresh_token:g,error:h}=e.data;if((null===(l=h||"")||void 0===l?void 0:l.length)==0){let e=JSON.parse(JSON.stringify(U||{}))||{},t=(null==e?void 0:null===(n=e.emailAccoutDetails)||void 0===n?void 0:n.slice())||[],l=null==t?void 0:t.findIndex(e=>(null==e?void 0:e.Email)==(null==s?void 0:s.Email));if(l>-1){let e=JSON.parse(JSON.stringify((null==t?void 0:t[l])||{}))||{};e.Access={expires_in:f,expireTime:Date.parse(new Date)+1e3*f,access_token:p},e.token_type=o,e.scope=m,e.refresh_token=g,e.refrest_token_time=Date.parse(new Date),t.splice(l,1,e)}e.emailAccoutDetails=t,(0,c.setDoc)(a,e,{merge:!0}).then(()=>{(k||[]).map((e,t)=>{var l;let n=(null==e?void 0:e.email)||"",a=(null==e?void 0:e.name)||"",o=(0,r.ww)({name:a||"",message:i||"",adminName:(null==A?void 0:A.firstName)+" "+(null==A?void 0:A.lastName)||(null==A?void 0:A.displayName)||"",adminEmail
1:(null==A?void 0:A.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==A||!A.cancelMessage})||"";tg({toemail:n||"",htmlbody:o||"",subject:d||"",from:(null==s?void 0:s.Email)||"",accesstoken:(null==p?void 0:null===(l=p.Access)||void 0===l?void 0:l.access_token)||""})});let e=(0,c.doc)(u.db,"uploads",null==A?void 0:A.uid,"schedule",O);(0,c.r7)(e,T).then(()=>{(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4312] : Error occured deleting a appointment details from firestore for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),console.error("state","Failed to store the data due to",JSON.stringify(e)),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4337] : Error occured storing accesstoken which was gerated from refresh tokenr user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}else(0,v.Z)(h,1e4),eJ(!1)}).catch(e=>{(0,v.Z)(e,1e4),eJ(!1),console.error("state","error",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4337] : Error occured in api call to get accesstoken which was gerated from refresh tokenr user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}}else{let l={startDate:_.toISOString(),endDate:E.toISOString(),selectedEmailAccount:s||{},cancelAppointmentarr:k||[],toadyCompDataClone:T||{},type:e,email:i||"",id:n||"",appointmentData:a||{},modaldata:o||{}};localStorage.setItem("$#Contactify_Cancel_Data$",JSON.stringify(l));let d={client_id:(0,p.LB)(null==e_?void 0:e_.client_id),response_type:"code",redirect_uri:"https://contactify.ai/auth",response_mode:"query",scope:"offline_access user.read mail.read mail.readwrite mail.send",state:"12345"},c=(0,r._G)(d||{}),u={client:"",user:t,tab:"organizer",section:"",type:"cancel",email:null==e_?void 0:e_.Email};localStorage.setItem("$#Contactify_email_Data$",JSON.stringify(u||{})),tl.push("https://login.microsoftonline.com/".concat((0,p.LB)(null==e_?void 0:e_.tenant_id),"/oauth2/v2.0/authorize?").concat(c))}}else if((null==s?void 0:s.Comapny)=="SendGrid"){let e=(null==s?void 0:s.Email)||"",t=(null==s?void 0:s.APIKey)||"";(k||[]).map((l,n)=>{let a=(null==l?void 0:l.email)||"",o=(null==l?void 0:l.name)||"",s=(0,r.ww)({name:o||"",message:i||"",adminName:(null==A?void 0:A.firstName)+" "+(null==A?void 0:A.lastName)||(null==A?void 0:A.displayName)||"",adminEmail:(null==A?void 0:A.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==A||!A.cancelMessage})||"";ty({toemail:a||"",htmlbody:s||"",subject:d||"",from:e||"",apiKey:t||""})});let l=(0,c.doc)(u.db,"uploads",null==A?void 0:A.uid,"schedule",O);(0,c.r7)(l,T).then(()=>{(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4379] : Error occured storing the deleted appointment data to firestorer for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}else{let e=(null==s?void 0:s.Email)||"",t=(null==s?void 0:s.Password)||"",l=(null==s?void 0:s.SMTPServer)||"",n=(null==s?void 0:s.SMTPPort)||0;(k||[]).map((a,o)=>{let s=(null==a?void 0:a.email)||"",c=(null==a?void 0:a.name)||"",u=(0,r.ww)({name:c||"",message:i||"",adminName:(null==A?void 0:A.firstName)+" "+(null==A?void 0:A.lastName)||(null==A?void 0:A.displayName)||"",adminEmail
1:(null==A?void 0:A.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==A||!A.cancelMessage})||"";th({toemail:s||"",htmlbody:u||"",subject:d||"",from:e||"",password:t||"",smtpserver:l||"",smtpport:n||0})});let a=(0,c.doc)(u.db,"uploads",null==A?void 0:A.uid,"schedule",O);(0,c.r7)(a,T).then(()=>{(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4476] : Error occured storing the deleted appointment data to firestorer for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}}else{let e=(0,c.doc)(u.db,"uploads",null==A?void 0:A.uid,"schedule",O);(0,c.r7)(e,T).then(()=>{(0,v.Z)("Deleted Successfully",5e3),tw(),ej(!1),eD(!1)}).catch(e=>{eD(!1),ej(!1),(0,v.Z)("Something went wrong, while deleting Appointment slots, please try again later.",1e4),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4512] : Error occured storing the deleted empty appointment data to firestorer for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})})}}catch(e){console.eeror("state","err",e),(0,r.wj)({type:"error",uid:(null==to?void 0:to.uid)||"",email:(null==to?void 0:to.email)||"",message:"[components/Organizer/TaskManager.jsx/ 4526] : Error occured in DeleteAppointmentwhileSendingemails function for user ".concat(null==to?void 0:to.uid," and email ").concat(null==to?void 0:to.email,".\n Error: ").concat(JSON.stringify(e))})}},tw=()=>{eD(!1),eP(!1),eZ(!1),eL({}),eF(!1),eq(""),eG(""),e$(""),eW(""),eX(""),e1({}),e3(!1),e4(""),e9(""),e7(""),tt("")},tj=()=>{$(""),W(""),X(""),et(""),ei(""),ea("")},tb=(e,t)=>{try{let t=new Date().getTimezoneOffset(),l=new Date(e);l.setTime(l.getTime()-6e4*t);let i=(null==l?void 0:l.toISOString()).split("T")[1].split(":"),n=i[0]+":"+i[1];return tp(n)}catch(e){console.error("state","error converting time",e)}};return(0,i.jsxs)("div",{className:"w-full h-full flex justify-between items-center gap-2 font-poppins",children:[(0,i.jsxs)("div",{className:"w-3/5 h-full flex flex-col justify-start items-start relative rounded-md border border-tab-inactiveBorder",children:[(0,i.jsx)("div",{className:"w-full p-2 flex justify-between items-center font-medium border-b border-tab-inactiveBorder",children:(0,i.jsx)("div",{className:"w-full font24 flex flex-col justify-center items-center relative py-2",children:(0,i.jsx)(m.Z,{})})}),(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-center items-center my-1 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:j({dateVar:l,offset:tc,timeRef:tn,timeArray:ta,nearestImeIndex:Y,sortedTaskData:em,taskColors:ts,setOpenModal:G,setTitle:$,setDescription:W,setStartTime:X,UtcToTIme:tb,setEndTime:et,setType:ei,setTaskId:ea,setAppointmentData:eh,setAppointmentDataType:ex,taskTypes:tr,setDeleteAppointmentModal:eP,setDeleteAppointmentData:eL,setRegisterLink:eW,userData:U,setDeleteModal:ej,setDeleteTimeSlotData:e1,setDeleteTimeSlotRegisterLink:tt,usersPerSlot:eo,setUsersPerSlot:er})})]}),(0,i.jsxs)("div",{className:"w-2/5 h-full flex flex-col justify-start items-start rounded-md border border-tab-inactiveBorder relative ",children:[(0,i.jsx)("div",{className:"w-full p-2 flex justify-between items-center font-medium border-b border-tab-inactiveBorder",children:(0,i.jsxs)("div",{className:"w-full font24 flex flex-col justify-center items-center relative",children:[(0,i.jsx)("div",{className:"font24",children:a()(l).format("MMMM Do")}),(0,i.jsx)("div",{className:"font16",children:a()(l).format("dddd")})]})}),(0,i.jsx)("div",{className:"w-full h-full flex flex-col justify-center items-center my-1 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:b({dateVar:l,offset:tc,contentLoader:eO,todayTask:ec,UtcToTIme:tb,timeArray:ta,taskColors:ts,setNearestTime:F,setNearestTimeIndex:q,setOpenModal:G,setTitle:$,setDescription:W,setStartTime:X,setEndTime:et,setType:ei,setTaskId:ea,setAppointmentData:eh,setAppointmentDataType:ex,taskTypes:tr,setDeleteAppointmentModal:eP,setDeleteAppointmentData:eL,setRegisterLink:eW,userData:U,setDeleteModal:ej,setDeleteTimeSlotData:e1,setDeleteTimeSlotRegisterLink:tt,usersPerSlot:eo,setUsersPerSlot:er})}),(0,i.jsx)(S.Z,{uid:t,dateVar:l,openModal:H,setOpenModal:G,title:Q,setTitle:$,description:K,setDescription:W,startTime:V,setStartTime:X,endTime:ee,setEndTime:et,type:el,setType:ei,taskId:en,setTaskId:ea,setStartDate:C,startDate:I,setEndDate:M,endDate:J,saveLoader:eb,setSaveLoader:eN,user:to,digitalcoffeeDescription:n,setDigitalcoffeeDescription:y,difitalCoffeeLink:x,setDigitalCoffeeLink:w,appointmentDescription:_,setAppointmentDescription:E,appointmentLink:k,setAppointmentLink:A,multiAppointmentLink:B,setMultiAppointmentLink:Z,multiAppointmentDescription:z,setMultiAppointmentDescription:L,todayCompData:L,setTodayCompData:ed,taskTypes:tr,timeArray:ta,Reset:tj,usersPerSlot:eo,setUsersPerSlot:er}),(0,i.jsx)(D.Z,{uid:t}),ew&&(0,i.jsx)(d.default,{SideHeaderComp:()=>(0,i.jsx)("div",{className:"flex justify-start items-center gap-2 text-base lg:size-one text-textColor-primary font-semibold font-poppins",children:"Delete"}),ClosingFunction:()=>{ej(!1),tj(),eD(!1)},MainBody:()=>{var e;let t=a()(new Date(null==e0?void 0:e0.startUtcTIme)).format("HH:mm"),l=a()(new Date(null==e0?void 0:e0.endUtcTIme)).format("HH:mm"),n=a()(new Date(null==e0?void 0:e0.startUtcTIme)).format("DD/MM/YYYY");return new Date>=new Date(null==e0?void 0:e0.startUtcTIme)||(null===(e=(null==e0?void 0:e0.appointmentData)||[])||void 0===e?void 0:e.length)==0?(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-start items-center gap-4 p-4 relative",children:[eS&&(0,i.jsx)("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-[#5C5C5C40] backdrop-blur-sm",children:(0,i.jsx)(f.default,{className:"w-full h-full flex justify-center items-center ",height:"60"})}),(0,i.jsx)("div",{className:"w-full h-full font16 font-medium text-textColor-primary",children:"Are you sure you want to delete this time slot?"}),(0,i.jsxs)("div",{className:"w-full flex justify-between items-center gap-2",children:[(0,i.jsx)("button",{className:"button bg-gray-300 text-textColor-primary flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 ",onClick:()=>{ej(!1),eD(!1),e1({}),ea("")},children:"Cancel"}),(0,i.jsx)("button",{className:"button bg-red-300 flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 ",onClick:()=>{eD(!0),e4(""),tx("timeslot","",en,{},e0||{})},children:(0,i.jsx)("span",{children:"Delete"})})]})]}):e5?(0,i.jsxs)("div",{className:"w-full h-[98%] p-4 flex flex-col justify-between items-start relative ",children:[(0,i.jsxs)("div",{className:"w-full h-10 flex justify-between items-center gap-2 ",children:[(0,i.jsx)("div",{className:"h-8 w-8 flex justify-center items-center gap-2 border-b border-tab-inactiveBorder cursor-pointer active:scale-95 transition-all duration-300",onClick:()=>{e3(!1),e4("")},children:(0,i.jsx)(s.G6,{className:"w-5 h-5 rotate-90"})}),(0,i.jsx)("div",{className:"h-6 w-0.5 mx-0.5 bg-tab-inactiveBorder"}),(0,i.jsxs)("div",{className:"w-full flex justify-start items-center gap-2 border-b border-tab-inactiveBorder h-8 px-2",children:[(0,i.jsx)("div",{className:"font16 text-textColor-secondary font-medium",children:"Subject:-"}),(0,i.jsx)("div",{className:"font14 font-normal text-textColor-primary",children:"Request to Re
1schedule Our Important Appointment"})]})]}),(0,i.jsx)("div",{className:"w-full h-full pt-2 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:(0,i.jsx)("div",{className:"w-full flex flex-col justify-start items-start gap-2",dangerouslySetInnerHTML:{__html:(0,r.ww)({name:(null==e0?void 0:e0.name)||"[Client Name]",message:e2||"",adminName:(null==U?void 0:U.firstName)+" "+(null==U?void 0:U.lastName)||(null==U?void 0:U.displayName)||"",adminEmail:(null==U?void 0:U.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==U||!U.cancelMessage})}})})]}):(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-between items-center gap-1.5 p-4 relative",children:[eS&&(0,i.jsx)("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-[#5C5C5C40] backdrop-blur-sm",children:(0,i.jsx)(f.default,{className:"w-full h-full flex justify-center items-center ",height:"60"})}),(0,i.jsx)("div",{className:"w-full font16 font-medium text-textColor-primary text-left py-1.5",children:"Are you sure you want to delete this time slot and all the appointments?"}),(0,i.jsxs)("div",{className:"w-full flex flex-col justify-start items-start gap-2 pl-2 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:[(0,i.jsxs)("div",{className:"font16 w-full py-1.5 font-medium text-textColor-secondary flex justify-between items-center pr-2",children:[(0,i.jsx)("span",{className:"w-full",children:"Information for sending email to user about cancelation"}),(0,i.jsx)("button",{className:"text-textColor-secondary active:scale-95 transition-all duration-300",onClick:()=>{e3(!0),e4(((null==U?void 0:U.cancelMessage)||r.ss).split(/{{Date_time}}/gm).join("".concat(n,", ").concat(t," - ").concat(l)).split(/{{Description}}/gm).join("".concat(e8)).split(/{{Reason}}/gm).join("".concat(e6)).split(/{{Alternative_dates}}/gm).join("".concat(eV)).split(/{{Registration_link}}/gm).join("".concat(te)))},children:(0,i.jsx)(s.tE,{className:"w-5 h-5"})})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Date and Time of Appointment (","{{ Date_time }}",")"]}),(0,i.jsx)("input",{placeholder:"Date and Time of Appointment...",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none cursor-not-allowed",required:!0,type:"text",id:"Dateandtime",value:"".concat(n,", ").concat(t," - ").concat(l),readOnly:!0})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Discussion/Appointment About (","{{Description}}",")"]}),(0,i.jsx)("input",{placeholder:"Other Available Dates and Times",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"deleteTimeSlotdescussinonAbout",value:e8,onChange:e=>{e7(e.target.value)}})]}),(0,i.jsxs)("div",{className:"w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Reason for Canceling* (","{{Reason}}",")"]}),(0,i.jsx)("textarea",{name:"deleteTimeSlotreasonforCancel",id:"deleteTimeSlotreasonforCancel",placeholder:"Reason for Canceling...",className:"border border-tab-inactiveBorder h-24 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",value:e6,onChange:e=>{e9(e.target.value)}})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Other Available Dates and Times (","{{Alternative_dates}}",")"]}),(0,i.jsx)("input",{placeholder:"Other Available Dates and Times",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"otherDatesAvailable",value:eV,onChange:e=>{eX(e.target.value)}})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Appointment Booking Link (","{{Registration_link}}",")"]}),(0,i.jsx)("input",{placeholder:"Appointment Booking Link",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"deleteTimeSlotRegisterLink",value:te,onChange:e=>{tt(e.target.value)}})]})]}),(0,i.jsxs)("div",{className:"w-full flex justify-between items-center gap-2",children:[(0,i.jsx)("button",{className:"button bg-gray-300 text-textColor-primary flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 ",onClick:()=>{ej(!1),eD(!1),e1({}),ea("")},children:"Cancel"}),(0,i.jsx)("button",{className:"button bg-red-300 flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 hover:bg-red-500",onClick:()=>{eD(!0);let e=((null==U?void 0:U.cancelMessage)||r.ss).split(/{{Date_time}}/gm).join("".concat(n,", ").concat(t," - ").concat(l)).split(/{{Description}}/gm).join("".concat(e8)).split(/{{Reason}}/gm).join("".concat(e6)).split(/{{Alternative_dates}}/gm).join("".concat(eV)).split(/{{Registration_link}}/gm).join("".concat(te));e4(e||""),tx("timeslot",e||"",en,{},e0)},children:(0,i.jsx)("span",{children:"Delete"})})]})]})},type:"min",className:new Date<new Date(null==e0?void 0:e0.startUtcTIme)&&(null==e0?void 0:e0.appointmentData)&&(null==e0?void 0:null===(td=e0.appointmentData)||void 0===td?void 0:td.length)>0?"w-[75%] h-[95%] sm:h-[75%] lg:w-3/4 lg:h-3/4":"w-[280px] md:w-[350px] h-[180px]",style:{zIndex:9999999}}),eU&&(0,i.jsx)(d.default,{SideHeaderComp:()=>(0,i.jsx)("div",{className:"flex justify-start items-center gap-2 text-base lg:size-one text-textColor-primary font-semibold font-poppins",children:"Delete Appointment"}),ClosingFunction:()=>{eP(!1),tj(),eZ(!1),eL({})},MainBody:()=>{let e=a()(new Date(null==ez?void 0:ez.startTimeUtc)).format("HH:mm"),t=a()(new Date(null==ez?void 0:ez.endTimeUtc)).format("HH:mm"),l=a()(new Date(null==ez?void 0:ez.startTimeUtc)).format("DD/MM/YYYY");return new Date>=new Date(null==ez?void 0:ez.startTimeUtc)?(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-start items-center gap-4 p-4 relative",children:[eB&&(0,i.jsx)("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-[#5C5C5C40] backdrop-blur-sm",children:(0,i.jsx)(f.default,{className:"w-full h-full flex justify-center items-center ",height:"60"})}),(0,i.jsx)("div",{className:"w-full h-full font16 font-medium text-textColor-primary",children:"Are you sure you want to cancel this appointment ?"}),(0,i.jsxs)("div",{className:"w-full flex justify-between items-center gap-2",children:[(0,i.jsx)("button",{className:"button bg-gray-300 text-textColor-primary flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 ",onClick:()=>{eP(!1),eZ(!1),eL({})},children:"Cancel"}),(0,i.jsx)("button",{className:"button bg-red-300 flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 hover:bg-red-500",onClick:()=>{eZ(!0),eq(""),tx("appointment","",null==ez?void 0:ez.id,ez,ez||{})},children:(0,i.jsx)("span",{children:"Delete"})})]})]}):eR?(0,i.jsxs)("div",{className:"w-full h-[98%] p-4 flex flex-col justify-between items-start relative ",children:[(0,i.jsxs)("div",{className:"w-full h-10 flex justify-between items-center gap-2 ",children:[(0,i.jsx)("div",{className:"h-8 w-8 flex justify-center items-center gap-2 border-b border-tab-inactiveBorder cursor-pointer active:scale-95 transition-all duration-300",onClick:()=>{eF(!1),eq("")},children:(0,i.jsx)(s.G6,{className:"w-5 h-5 rotate-90"})}),(0,i.jsx)("div",{className:"h-6 w-0.5 mx-0.5 bg-tab-inactiveBorder"}),(0,i.jsxs)("div",{className:"w-full flex justify-start items-center gap-2 border-b border-tab-inactiveBorder h-8 px-2",children:[(0,i.jsx)("div",{className:"font16 text-textColor-secondary font-medium",children:"Subject:-"}),(0,i.jsx)("div",{className:"font14 font-normal text-textColor-primary",children:"Request to Re
1schedule Our Important Appointment"})]})]}),(0,i.jsx)("div",{className:"w-full h-full pt-2 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:(0,i.jsx)("div",{className:"w-full flex flex-col justify-start items-start gap-2",dangerouslySetInnerHTML:{__html:(0,r.ww)({name:(null==ez?void 0:ez.name)||"[Client Name]",message:eY||"",adminName:(null==U?void 0:U.firstName)+" "+(null==U?void 0:U.lastName)||(null==U?void 0:U.displayName)||"",adminEmail:(null==U?void 0:U.email)||"",subject:"Request to Cancel and Reschedule Our Important Appointment",defaultval:null==U||!U.cancelMessage})}})})]}):(0,i.jsxs)("div",{className:"w-full h-full flex flex-col justify-between items-center gap-1.5 p-4 relative",children:[eB&&(0,i.jsx)("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-[#5C5C5C40] backdrop-blur-sm",children:(0,i.jsx)(f.default,{className:"w-full h-full flex justify-center items-center ",height:"60"})}),(0,i.jsx)("div",{className:"w-full font16 font-medium text-textColor-primary text-left py-1.5",children:"Are you sure you want to cancel this appointment ?"}),(0,i.jsxs)("div",{className:"w-full flex flex-col justify-start items-start gap-2 pl-2 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-400 scrollbar-track-tab-active scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:[(0,i.jsxs)("div",{className:"font16 w-full py-1.5 font-medium text-textColor-secondary flex justify-between items-center pr-2",children:[(0,i.jsx)("span",{className:"w-full",children:"Information for sending email to user about cancelation"}),(0,i.jsx)("button",{className:"text-textColor-secondary active:scale-95 transition-all duration-300",onClick:()=>{eF(!0),eq(((null==U?void 0:U.cancelMessage)||r.ss).split(/{{Date_time}}/gm).join("".concat(l,", ").concat(e," - ").concat(t)).split(/{{Description}}/gm).join("".concat(eQ)).split(/{{Reason}}/gm).join("".concat(eH)).split(/{{Alternative_dates}}/gm).join("".concat(eV)).split(/{{Registration_link}}/gm).join("".concat(eK)))},children:(0,i.jsx)(s.tE,{className:"w-5 h-5"})})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Date and Time of Appointment (","{{ Date_time }}",")"]}),(0,i.jsx)("input",{placeholder:"Date and Time of Appointment...",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none cursor-not-allowed",required:!0,type:"text",id:"Dateandtime",value:"".concat(l,", ").concat(e," - ").concat(t),readOnly:!0})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Discussion/Appointment About (","{{Description}}",")"]}),(0,i.jsx)("input",{placeholder:"Discussion/Appointment About",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"descussinonAbout",value:eQ,onChange:e=>{e$(e.target.value)}})]}),(0,i.jsxs)("div",{className:"w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Reason for Canceling* (","{{Reason}}",")"]}),(0,i.jsx)("textarea",{name:"reasonforCancel",id:"reasonforCancel",placeholder:"Reason for Canceling...",className:"border border-tab-inactiveBorder h-24 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",value:eH,onChange:e=>{eG(e.target.value)}})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Other Available Dates and Times (","{{Alternative_dates}}",")"]}),(0,i.jsx)("input",{placeholder:"Other Available Dates and Times",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"otherDatesAvailable",value:eV,onChange:e=>{eX(e.target.value)}})]}),(0,i.jsxs)("div",{className:" w-full text-left pl-2 ",children:[(0,i.jsxs)("label",{className:"font14 w-full py-2 font-medium text-textColor-secondary",children:["Appointment Booking Link (","{{Registration_link}}",")"]}),(0,i.jsx)("input",{placeholder:"Appointment Booking Link",className:"border border-tab-inactiveBorder h-10 font14 w-full bg-white focus:border-tab-activeBorder text-textColor-primary px-2 py-1.5 rounded-lg focus:outline-none",required:!0,type:"text",id:"registerLink",value:eK,onChange:e=>{eW(e.target.value)}})]})]}),(0,i.jsxs)("div",{className:"w-full flex justify-between items-center gap-2",children:[(0,i.jsx)("button",{className:"button bg-gray-300 text-textColor-primary flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 ",onClick:()=>{eP(!1),eZ(!1),eL({})},children:"Cancel"}),(0,i.jsx)("button",{className:"button bg-red-300 flex justify-center items-center gap-2 font14 active:scale-95 transition-all duration-200 hover:bg-red-500",onClick:()=>{eZ(!0);let i=((null==U?void 0:U.cancelMessage)||r.ss).split(/{{Date_time}}/gm).join("".concat(l,", ").concat(e," - ").concat(t)).split(/{{Description}}/gm).join("".concat(eQ)).split(/{{Reason}}/gm).join("".concat(eH)).split(/{{Alternative_dates}}/gm).join("".concat(eV)).split(/{{Registration_link}}/gm).join("".concat(eK));eq(i||""),tx("appointment",i,null==ez?void 0:ez.id,ez,ez||{})},children:(0,i.jsx)("span",{children:"Delete"})})]})]})},type:"min",className:new Date<new Date(null==ez?void 0:ez.startTimeUtc)?"w-[75%] h-[95%] sm:h-[75%] lg:w-3/4 lg:h-3/4":"w-[280px] md:w-[350px] h-[180px]",style:{zIndex:9999999}}
1),(0,i.jsx)(N.Z,{appointmentData:eg,sendEmailLoader:eM,cardsData:eC,uid:t,appointmentLink:k,UtcToTIme:tb,userData:U,appointmentDataType:ey,SendEmails:(e,l,i)=>{try{var n,a,o,s,d,m,f,g,h;let y=JSON.parse(JSON.stringify(U||{}))||{},x=(null==y?void 0:null===(a=y.emailAccoutDetails)||void 0===a?void 0:null===(n=a.slice())||void 0===n?void 0:n.sort((e,t)=>(null==e?void 0:e.Priority)-(null==t?void 0:t.Priority)))||[],w=JSON.parse(JSON.stringify((null==x?void 0:x[0])||{}))||{},j=new FormData;if((null==w?void 0:w.Comapny)=="Office365"){let n={tenant_id:(null==w?void 0:w.tenant_id)||"",client_id:(null==w?void 0:w.client_id)||"",client_secret:(null==w?void 0:w.client_secret)||""};if(""==(0,p.LB)(null==n?void 0:n.tenant_id)||""==(0,p.LB)(null==n?void 0:n.client_id)||""==(0,p.LB)(null==n?void 0:n.client_secret))return(0,v.Z)("Please add Office 365 email ids and keys"),eJ(!1),!1;if((null==w?void 0:w.refresh_token)&&(null==w?void 0:null===(o=w.refresh_token)||void 0===o?void 0:o.length)>0&&(null==w?void 0:w.refrest_token_time)&&(null==w?void 0:w.refrest_token_time)+5184e6>Date.parse(new Date)){if((null==w?void 0:null===(s=w.Access)||void 0===s?void 0:s.access_token)&&(null==w?void 0:null===(m=w.Access)||void 0===m?void 0:null===(d=m.access_token)||void 0===d?void 0:d.length)>0&&(null==w?void 0:null===(f=w.Access)||void 0===f?void 0:f.expireTime)&&(null==w?void 0:null===(g=w.Access)||void 0===g?void 0:g.expireTime)>Date.parse(new Date)-18e4){let t={from_addr:(null==w?void 0:w.Email)||"",to_emails:[null==i?void 0:i.email],to_cc:[],to_bcc:[],subject:e||"",htmlbody:l||"",access_token:(null==w?void 0:null===(h=w.Access)||void 0===h?void 0:h.access_token)||""};j.append("request",JSON.stringify(t));let n=JSON.stringify(j).length;fetch("https://contactify-api.vercel.app/sendemailwithattachmentpersonaloffice",{method:"POST",body:j,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":n}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1111] : Error occured while sending email from office 365 api with a staus of 500 for userData ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(t,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1135] : Email sent Successfully from office 365 mail to ".concat((null==t?void 0:t.to_emails)||""," from ").concat((null==t?void 0:t.from_addr)||"",".")}))}).catch(e=>{eJ(!1),(0,v.Z)(e,{time:5e3}),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1139] : Error occured while sending email from office 365 api for userData ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}else{let a={client_id:null==n?void 0:n.client_id,refresh_token:null==w?void 0:w.refresh_token,client_secret:null==n?void 0:n.client_secret,tenant_id:null==n?void 0:n.tenant_id};fetch("/api/office/refresh_token",{method:"POST",body:JSON.stringify(a)}).then(e=>e.json()).then(n=>{var a,o;let s=(0,c.doc)(u.db,"users",t),{token_type:d,scope:m,expires_in:f,access_token:p,refresh_token:g,error:h}=n.data;if((null===(a=h||"")||void 0===a?void 0:a.length)==0){let t=JSON.parse(JSON.stringify(U||{}))||{},n=(null==t?void 0:null===(o=t.emailAccoutDetails)||void 0===o?void 0:o.slice())||[],a=null==n?void 0:n.findIndex(e=>(null==e?void 0:e.Email)==(null==w?void 0:w.Email));if(a>-1){let e=JSON.parse(JSON.stringify((null==n?void 0:n[a])||{}))||{};e.Access={expires_in:f,expireTime:Date.parse(new Date)+1e3*f,access_token:p},e.token_type=d,e.scope=m,e.refresh_token=g,e.refrest_token_time=Date.parse(new Date),n.splice(a,1,e)}t.emailAccoutDetails=n,(0,c.setDoc)(s,t,{merge:!0}).then(()=>{var t;let n={from_addr:(null==w?void 0:w.Email)||"",to_emails:[null==i?void 0:i.email],to_cc:[],to_bcc:[],subject:e||"",htmlbody:l||"",access_token:(null==p?void 0:null===(t=p.Access)||void 0===t?void 0:t.access_token)||""};j.append("request",JSON.stringify(n));let a=JSON.stringify(j).length;fetch("https://contactify-api.vercel.app/sendemailwithattachmentpersonaloffice",{method:"POST",body:j,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":a}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),console.error("state","error while sending email","\n",null==e?void 0:e.detail),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1272] : Error occured while sending email from office 365 api with a staus of 500 ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(n,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1314] : Email sent Successfully from office 365 mail to ".concat((null==n?void 0:n.to_emails)||""," from ").concat((null==n?void 0:n.from_addr)||"",".")}))}).catch(e=>{eJ(!1),(0,v.Z)(e,{time:5e3}),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1310] : Error occured while sending email from office 365 api ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1321] : Error occured while storing new accesstoken into firebase ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}else(0,v.Z)(h,1e4),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1337] : Error occured in api call forgetting new access token from refresh token ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(h))})}).catch(e=>{(0,v.Z)(e,1e4),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1352]
1: Error occured while calling api for getting new access token from refresh token ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}}else{let t={AttachmentList:[],emailConents:l||"",emailSubject:e||"",selectedEmail:{},replyEmail:{},forwardEmail:{},newEmail:!1,firstandEnd:[],selectedTemplate:"",EmailList:[null==i?void 0:i.email],bccList:[],ccList:[],ccText:"",bccText:"",emailText:l||"",type:el||"",selectedEmailAccount:w||{},appointmentData:eg||{}};localStorage.setItem("$#Contactify_Email_store_Data$",JSON.stringify(t||{})),eq(""),eJ(!1),tv(el)}}else if((null==w?void 0:w.Comapny)=="SendGrid"){let t={from_addr:(null==w?void 0:w.Email)||"",to_emails:[null==i?void 0:i.email],to_cc:[],to_bcc:[],subject:e||"",htmlbody:l||"",apiKey:((null==w?void 0:w.APIKey)?(0,p.W4)(null==w?void 0:w.APIKey):"")||""};if((null==t?void 0:t.from_addr)=="")return(0,v.Z)("Please Add your Email in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==t?void 0:t.apiKey)=="")return(0,v.Z)("Please Add your API key in Email Settings in Teams page",5e3),eJ(!1),!1;j.append("request",JSON.stringify(t));let n=JSON.stringify(j).length;fetch("https://contactify-api.vercel.app/sendgridemailwithattachment",{method:"POST",body:j,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":n}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1450] : Error occured in api call for sending email using sendgrid ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(t,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1465] : Email sent Successfully from sendgrid mail to ".concat((null==t?void 0:t.to_emails)||""," from ").concat((null==t?void 0:t.from_addr)||"",".")}))}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1478] : Error occured while calling api for sending email using sendgrid email ".concat(null==w?void 0:w.Email," method ").concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}else{let t={from_addr:(null==w?void 0:w.Email)||"",to_emails:[null==i?void 0:i.email],to_cc:[],to_bcc:[],subject:e||"",htmlbody:l||"",priority:3,email:(null==w?void 0:w.Email)||"",password:((null==w?void 0:w.Password)?(0,p.W4)(null==w?void 0:w.Password):"")||"",SMTPServer:(null==w?void 0:w.SMTPServer)||"",SMTPPort:(null==w?void 0:w.SMTPPort)||0};if((null==t?void 0:t.email)=="")return(0,v.Z)("Please Add your Email in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==t?void 0:t.password)=="")return(0,v.Z)("Please Add your Password in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==t?void 0:t.SMTPServer)=="")return(0,v.Z)("Please Add your SMTPServer in Email Settings in Teams page",5e3),eJ(!1),!1;if((null==t?void 0:t.SMTPPort)==0)return(0,v.Z)("Please Add your SMTPPort in Email Settings in Teams page",1e4),eJ(!1),!1;j.append("request",JSON.stringify(t));let n=JSON.stringify(j).length;fetch("https://contactify-api.vercel.app/sendemailwithattachment",{method:"POST",body:j,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate",access_token:"G9QIfGF9E4QM8O6fBnEds","content-Length":n}}).then(e=>e.json()).then(e=>{(null==e?void 0:e.detail)?((0,v.Z)("Error while sending email - ".concat(null==e?void 0:e.detail),{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1564] : Error occured in api call for sending email using smtp ".concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(null==e?void 0:e.detail))})):((0,v.Z)("Email sent successfully"),tf(t,"",[],l||""),eJ(!1),eq(""),(0,r.wj)({type:"event",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1579] : Email sent Successfully from smtp mail to ".concat((null==t?void 0:t.to_emails)||""," from ").concat((null==t?void 0:t.from_addr)||"",".")}))}).catch(e=>{(0,v.Z)(e,{time:5e3}),eJ(!1),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1592] : Error occured while calling api for sending email using smtp email ".concat(null==w?void 0:w.Email," method ").concat(null==w?void 0:w.Email," for userData ").concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})})}}catch(e){console.error("state",e),(0,v.Z)(e),(0,r.wj)({type:"error",uid:(null==U?void 0:U.uid)||"",email:(null==U?void 0:U.email)||"",message:"[components/Organizer/TaskManager.jsx/ 1609] : Error occured in fuction to send email for userData ".concat(null==U?void 0:U.uid," and email ").concat(null==U?void 0:U.email,".\n Error: ").concat(JSON.stringify(e))})}},multiAppointmentDescription:z,digitalcoffeeDescription:n,appointmentDescription:_,offset:tc,multiAppointmentLink:B,difitalCoffeeLink:x,dateVar:l,todayCompData:es,setAppointmentData:eh,user:to,EmailBaseTemplate:r.ww,setMessageType:eA,setSendEmailLoa
1der:eJ,setAppointmentDataType:ex,setSaveLoader:eN})]})]})}}}]);
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.