import{m as e}from"./p-b3edc8b2.js";function t(e,t){return e.startDate<t.startDate?-1:e.startDate>t.startDate?1:0}function n(e){const t=[],n=e.blockedSlots||[],r=60*e.meetingDuration,a=e.meetingBreaks?60*e.meetingBreaks:0,o=(e.endDate-e.startDate)/r;for(let i=0;i<o;i+=1){const o=e.startDate+i*(r+a),s={endDate:o+r,startDate:o+1,location:e.location,duration:e.meetingDuration,isBlocked:n.indexOf(i)>-1};t.push(s)}return t}const r={timeZone:"Europe/Istanbul",locale:"tr",setLocale(t){e.locale(t),r.locale=t},setTimeZone(e){r.timeZone="Europe/Istanbul"===e?"Europe/Moscow":e},setTimeFormat(e){r.timeFormat=e},fixHourDifference(t){const n=((new Date).getTimezoneOffset()-e.tz.zone(r.timeZone).offset(new Date))/60;return t.setHours(t.getHours()-n),t},format:(t,n)=>"HH:mm"===n&&"12-hour"===r.timeFormat?e(t).tz(r.timeZone).format("hh:mm A"):e(t).tz(r.timeZone).format(n),getStartAndEndDateFromInputs(e,t,n){let a=new Date(e.getTime());a.setHours(t.getHours(),t.getMinutes(),0);let o=new Date(e.getTime());return o.setHours(n.getHours(),n.getMinutes(),0),a=r.fixHourDifference(a),o=r.fixHourDifference(o),{startDate:a.getTime()/1e3,endDate:o.getTime()/1e3}},elapsedTime:t=>e(t).tz(r.timeZone).fromNow(),elapsedTimeBetweenDates:(t,n)=>e(t).from(e(n)),getMonday:()=>e().startOf("isoweek"),getStartEndOfWeek(e=0){const t=6048e5*e,n=new Date(new Date(r.getMonday()).getTime()+t);n.setHours(0,0,0,0);const a=new Date(n.getTime());return a.setDate(n.getDate()+6),a.setHours(23,59,59,99),{relativeWeekNumber:e,firstDayOfWeek:n,lastDayOfWeek:a}},getCalendarDataWithBundle(a,o=[],i=7,s=r.getStartEndOfWeek().firstDayOfWeek){const l=[],f=[];a.sort(t),o.sort(t);for(let t=0;t<i;t+=1){const r={dayData:{availabilities:[],isEmpty:!0},eventList:[]},i=new Date(s);i.setDate(i.getDate()+t);let c=0;for(let e=0;e<o.length;e+=1){const t=o[e],s=new Date(1e3*t.startDate),l=t.blockedSlots||[],f=[...t.slots||n(t)];for(let e=0;e<f.length;e+=1)f[e].isBlocked=l.indexOf(e)>-1;if(i.toDateString()===s.toDateString()){let e=t&&a&&a.length>c;const n=[];for(;e;){const r=a[c];if(!r)break;t.startDate<=r.startDate&&t.endDate>=r.endDate?(n.push(r),c+=1,e=a.length>c):t.startDate>r.startDate?c+=1:e=!1}r.dayData.availabilities.push({timeSlots:f,availability:t,eventList:n}),r.dayData.isEmpty=!1}}r.dayData.isEmpty||(f.push(r),l.push({dayNumber:e(i).format("D"),dayNameShort:e(i).format("ddd"),dayName:e(i).format("dddd"),monthName:e(i).format("MMM")}))}return{headerDayInfo:l,eventAndSlotInfoForWeek:f}},orderEventsAndAvailabilities(e,n){let r=[];if(n.sort(t),0===e.length)r=n;else if(0===n.length)r=e;else{let t=0,a=0,o=0;const i=!0;for(;i;){const i=t<e.length?e[t]:null,s=a<n.length?n[a]:null;if(!s&&!i)break;!i&&s?(a+=1,s.startDate>=o&&(r.push(s),o=s.endDate)):!s&&i?(t+=1,i.startDate>=o&&(r.push(i),o=i.endDate)):s.startDate<=i.startDate?(a+=1,s.startDate>=o&&(r.push(s),o=s.endDate)):(t+=1,i.startDate>=o&&(r.push(i),o=i.endDate))}}return r},getMeetingGoalTitle(e,t){if(e.meetingGoalConfig&&e.meetingGoalConfig.meetingGoals&&e.meetingGoalConfig.meetingGoals.length>0)for(let n=0;n<e.meetingGoalConfig.meetingGoals.length;n+=1){const r=e.meetingGoalConfig.meetingGoals[n];if(r.identifier===t.meetingGoalIdentifier)return r.meetingTitle}},getMeetingGoalOfEvent(e,t){if(e.meetingGoalConfig&&e.meetingGoalConfig.meetingGoals&&e.meetingGoalConfig.meetingGoals.length>0)for(let n=0;n<e.meetingGoalConfig.meetingGoals.length;n+=1){const r=e.meetingGoalConfig.meetingGoals[n];if(r.identifier===t.meetingGoalIdentifier)return r}},getRelationsOfUserForMeeting(e,t,n){const r=[...t.guests],a=r.splice(0,1)[0],o=r,i=a._id===n._id;let s=!1,l=!1;if(n)for(let t=0;t<o.length;t+=1){if(o[t]._id===n._id){l=!0;break}if(e.group&&o[t]._id===e.group._id){s=!0;break}}return{isParticipantAsMentor:i,isParticipantAsMentee:l,isParticipantAsGroupMember:s}},getMeetingGoalForms(e,t,n){const a=r.getMeetingGoalOfEvent(e,n);if(!a)return{};let o;return"mentor"===t?o=a.specifications.mentor:"mentee"===t&&(o=a.specifications.mentee),{description:o.description,preMeetingForm:o&&o.preMeetingForm&&o.preMeetingForm.fields&&o.preMeetingForm.fields.length>0&&o.preMeetingForm,postMeetingForm:o&&o.postMeetingForm&&o.postMeetingForm.fields&&o.postMeetingForm.fields.length>0&&o.postMeetingForm}}};export{r as C}