import{r as e,h as a,H as t}from"./p-c1e62c18.js";import{h as i}from"./p-acad969c.js";const s=class{constructor(a){e(this,a),this.availabilitiesForTheSelectedDate=[],this.availabilities=[{duration:30,date:new Date,availabilities:[{start:"9:00 AM",end:"6:00 PM"}]},{duration:30,date:new Date(2020,10,27),availabilities:[{start:"9:00 AM",end:"6:00 PM"}]},{duration:30,date:new Date(2020,11,23),availabilities:[{start:"10:00 AM",end:"6:00 PM"}]},{duration:60,date:new Date(2020,11,23),availabilities:[{start:"11:00 AM",end:"6:00 PM"}]},{duration:30,date:new Date(2020,11,11),availabilities:[{start:"12:00 AM",end:"6:00 PM"}]}],this.onSelectDate=e=>{const a=e.detail,{availabilities:t}=this,i=t.map((e=>e.date));var s,l;this.selectedDate=(s=i).length<(l=a).length?l.find((e=>!s.find((a=>a.toISOString()===e.toISOString())))):s.find((e=>!l.find((a=>e.toISOString()===a.toISOString())))),this.availabilitiesForTheSelectedDate=t.filter((e=>{var a;return e.date.toISOString()===(null===(a=this.selectedDate)||void 0===a?void 0:a.toISOString())})),0===this.availabilitiesForTheSelectedDate.length?(this.selectedDate=void 0,this.selectedAvailability=void 0):this.selectedAvailability=1===this.availabilitiesForTheSelectedDate.length?this.availabilitiesForTheSelectedDate[0]:void 0}}render(){const{availabilities:e,availabilitiesForTheSelectedDate:s,selectedAvailability:l,selectedDate:d}=this;return a(t,{class:"d-flex"},a("dvn-date-picker",{embedded:!0,leaned:!0,multiple:!0,value:e.map((e=>e.date)),onChange:this.onSelectDate}),d&&a("dvn-card",{class:"selected-day-container",elevation:0,leaned:!0},a("dvn-card-header",{title:i(d).format("DD MMMM YYYY"),slot:"header",separated:!1}),a("div",{class:"selected-day-availabilities"},!l&&s.map((e=>a("dvn-card",{elevation:0,outlined:!0,selectable:!0,onClick:()=>this.selectedAvailability=e},"Book a ",e.duration," min call"))),l&&[{start:"9:00 AM",end:"10:00 AM"},{start:"12:00 AM",end:"13:00 PM"},{start:"13:00 PM",end:"14:00 PM"},{start:"14:00 PM",end:"15:00 PM"}].map((e=>a("dvn-card",{elevation:0,outlined:!0,selectable:!0},e.start," - ",e.end))))))}};s.style="takvim-available-time-picker .selected-day-container{flex:1;margin-left:1rem !important;max-height:253px}takvim-available-time-picker .selected-day-container .selected-day-availabilities dvn-card{margin:0 0 0.5rem 0;text-align:center;font-size:0.9em}";export{s as takvim_available_time_picker}