var FPF_Datepicker=function(){function t(){this.datePickerClass=".fpf-datepicker-item:not(.no-render)",this.init()}var e=t.prototype;return e.init=function(){this.datePickersExist()&&(this.initEvents(),this.initDatepickers())},e.initDatepickers=function(){var i=this;document.querySelectorAll(this.datePickerClass).forEach(function(t){var e={onValueUpdate:function(){i.showClearButton(t)}};t.classList.add("no-render"),"1"==t.getAttribute("data-timepicker")&&(e.enableTime=!0),"1"==t.getAttribute("data-nocalendar")&&(e.noCalendar=!0,e.time_24hr=!0),"1"==t.getAttribute("data-time12")&&(e.time_24hr=!1),flatpickr(t,e)})},e.showClearButton=function(t){t.closest(".fpf-datepicker-parent").querySelector(".fpf-datepicker-clear-calendar").classList.remove("is-hidden")},e.initEvents=function(){document.addEventListener("click",function(t){this.initButtonsEvents(t)}.bind(this))},e.initButtonsEvents=function(t){var e=t.target;if(e.classList.contains("fpf-datepicker-button")){var i=e.closest(".fpf-datepicker-parent").querySelector("input")._flatpickr;e.classList.contains("fpf-datepicker-open-calendar")?i.open():e.classList.contains("fpf-datepicker-clear-calendar")&&(i.clear(),e.classList.add("is-hidden")),t.preventDefault()}},e.datePickersExist=function(){return!!document.querySelectorAll(this.datePickerClass).length},t}();FPF_Helper.onReady(function(){new FPF_Datepicker});

