From f3c5dda19dfa0006ad388ec88fb500c998bab5d9 Mon Sep 17 00:00:00 2001 From: Clark Winkelmann Date: Tue, 1 Dec 2020 22:09:38 +0100 Subject: [PATCH] Add javascript exports --- js/dist/forum.js | 2 +- js/dist/forum.js.map | 2 +- js/src/forum/components/DiscussionPoll.js | 2 +- js/src/forum/components/ListVotersModal.js | 2 +- js/src/forum/components/index.js | 11 +++++++++++ js/src/forum/index.js | 3 +++ js/src/forum/models/index.js | 9 +++++++++ 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 js/src/forum/components/index.js create mode 100644 js/src/forum/models/index.js diff --git a/js/dist/forum.js b/js/dist/forum.js index e3a81e09..7756b10c 100755 --- a/js/dist/forum.js +++ b/js/dist/forum.js @@ -14,5 +14,5 @@ e.exports=function(){"use strict"; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},a={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},i=function(e,t){return void 0===t&&(t=2),("000"+e).slice(-1*t)},r=function(e){return!0===e?1:0};function l(e,t,n){var o;return void 0===n&&(n=!1),function(){var a=this,i=arguments;null!==o&&clearTimeout(o),o=window.setTimeout((function(){o=null,n||e.apply(a,i)}),t),n&&!o&&e.apply(a,i)}}var s=function(e){return e instanceof Array?e:[e]};function c(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function u(e,t,n){var o=window.document.createElement(e);return t=t||"",n=n||"",o.className=t,void 0!==n&&(o.textContent=n),o}function d(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function p(e,t){var n=u("div","numInputWrapper"),o=u("input","numInput "+e),a=u("span","arrowUp"),i=u("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?o.type="number":(o.type="text",o.pattern="\\d*"),void 0!==t)for(var r in t)o.setAttribute(r,t[r]);return n.appendChild(o),n.appendChild(a),n.appendChild(i),n}function f(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(t){return e.target}}var m=function(){},h=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},g={D:m,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*r(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var o=parseInt(t),a=new Date(e.getFullYear(),0,2+7*(o-1),0,0,0,0);return a.setDate(a.getDate()-a.getDay()+n.firstDayOfWeek),a},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:m,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:m,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},v={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},b={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[b.w(e,t,n)]},F:function(e,t,n){return h(b.n(e,t,n)-1,!1,t)},G:function(e,t,n){return i(b.h(e,t,n))},H:function(e){return i(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[r(e.getHours()>11)]},M:function(e,t){return h(e.getMonth(),!0,t)},S:function(e){return i(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return i(e.getFullYear(),4)},d:function(e){return i(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return i(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return i(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},D=function(e){var t=e.config,n=void 0===t?o:t,i=e.l10n,r=void 0===i?a:i,l=e.isMobile,s=void 0!==l&&l;return function(e,t,o){var a=o||r;return void 0===n.formatDate||s?t.split("").map((function(t,o,i){return b[t]&&"\\"!==i[o-1]?b[t](e,a,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,a)}},y=function(e){var t=e.config,n=void 0===t?o:t,i=e.l10n,r=void 0===i?a:i;return function(e,t,a,i){if(0===e||e){var l,s=i||r,c=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var u=t||(n||o).dateFormat,d=String(e).trim();if("today"===d)l=new Date,a=!0;else if(/Z$/.test(d)||/GMT$/.test(d))l=new Date(e);else if(n&&n.parseDate)l=n.parseDate(e,u);else{l=n&&n.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var p=void 0,f=[],m=0,h=0,b="";ml&&(d=o===b.hourElement?d-l-r(!b.amPM):a,m&&j(void 0,1,b.hourElement)),b.amPM&&p&&(1===s?d+c===23:Math.abs(d-c)>s)&&(b.amPM.textContent=b.l10n.amPM[r(b.amPM.textContent===b.l10n.amPM[0])]),o.value=i(d)}}(e);var s=b._input.value;k(),De(),b._input.value!==s&&b._debouncedChange()}function k(){if(void 0!==b.hourElement&&void 0!==b.minuteElement){var e,t,n=(parseInt(b.hourElement.value.slice(-2),10)||0)%24,o=(parseInt(b.minuteElement.value,10)||0)%60,a=void 0!==b.secondElement?(parseInt(b.secondElement.value,10)||0)%60:0;void 0!==b.amPM&&(e=n,t=b.amPM.textContent,n=e%12+12*r(t===b.l10n.amPM[1]));var i=void 0!==b.config.minTime||b.config.minDate&&b.minDateHasTime&&b.latestSelectedDateObj&&0===w(b.latestSelectedDateObj,b.config.minDate,!0);if(void 0!==b.config.maxTime||b.config.maxDate&&b.maxDateHasTime&&b.latestSelectedDateObj&&0===w(b.latestSelectedDateObj,b.config.maxDate,!0)){var l=void 0!==b.config.maxTime?b.config.maxTime:b.config.maxDate;(n=Math.min(n,l.getHours()))===l.getHours()&&(o=Math.min(o,l.getMinutes())),o===l.getMinutes()&&(a=Math.min(a,l.getSeconds()))}if(i){var s=void 0!==b.config.minTime?b.config.minTime:b.config.minDate;(n=Math.max(n,s.getHours()))===s.getHours()&&(o=Math.max(o,s.getMinutes())),o===s.getMinutes()&&(a=Math.max(a,s.getSeconds()))}O(n,o,a)}}function T(e){var t=e||b.latestSelectedDateObj;t&&O(t.getHours(),t.getMinutes(),t.getSeconds())}function _(){var e=b.config.defaultHour,t=b.config.defaultMinute,n=b.config.defaultSeconds;if(void 0!==b.config.minDate){var o=b.config.minDate.getHours(),a=b.config.minDate.getMinutes();(e=Math.max(e,o))===o&&(t=Math.max(a,t)),e===o&&t===a&&(n=b.config.minDate.getSeconds())}if(void 0!==b.config.maxDate){var i=b.config.maxDate.getHours(),r=b.config.maxDate.getMinutes();(e=Math.min(e,i))===i&&(t=Math.min(r,t)),e===i&&t===r&&(n=b.config.maxDate.getSeconds())}return{hours:e,minutes:t,seconds:n}}function O(e,t,n){void 0!==b.latestSelectedDateObj&&b.latestSelectedDateObj.setHours(e%24,t,n||0,0),b.hourElement&&b.minuteElement&&!b.isMobile&&(b.hourElement.value=i(b.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),b.minuteElement.value=i(t),void 0!==b.amPM&&(b.amPM.textContent=b.l10n.amPM[r(e>=12)]),void 0!==b.secondElement&&(b.secondElement.value=i(n)))}function N(e){var t=f(e),n=parseInt(t.value)+(e.delta||0);(n/1e3>1||"Enter"===e.key&&!/[^\d]/.test(n.toString()))&&Z(n)}function I(e,t,n,o){return t instanceof Array?t.forEach((function(t){return I(e,t,n,o)})):e instanceof Array?e.forEach((function(e){return I(e,t,n,o)})):(e.addEventListener(t,n,o),void b._handlers.push({element:e,event:t,handler:n,options:o}))}function S(){me("onChange")}function F(e,t){var n=void 0!==e?b.parseDate(e):b.latestSelectedDateObj||(b.config.minDate&&b.config.minDate>b.now?b.config.minDate:b.config.maxDate&&b.config.maxDate=0&&w(e,b.selectedDates[1])<=0}(t)&&!ge(t)&&i.classList.add("inRange"),b.weekNumbers&&1===b.config.showMonths&&"prevMonthDay"!==e&&n%7==1&&b.weekNumbers.insertAdjacentHTML("beforeend",""+b.config.getWeek(t)+""),me("onDayCreate",i),i}function H(e){e.focus(),"range"===b.config.mode&&ne(e)}function L(e){for(var t=e>0?0:b.config.showMonths-1,n=e>0?b.config.showMonths:-1,o=t;o!=n;o+=e)for(var a=b.daysContainer.children[o],i=e>0?0:a.children.length-1,r=e>0?a.children.length:-1,l=i;l!=r;l+=e){var s=a.children[l];if(-1===s.className.indexOf("hidden")&&Q(s.dateObj))return s}}function B(e,t){var n=X(document.activeElement||document.body),o=void 0!==e?e:n?document.activeElement:void 0!==b.selectedDateElem&&X(b.selectedDateElem)?b.selectedDateElem:void 0!==b.todayDateElem&&X(b.todayDateElem)?b.todayDateElem:L(t>0?1:-1);void 0===o?b._input.focus():n?function(e,t){for(var n=-1===e.className.indexOf("Month")?e.dateObj.getMonth():b.currentMonth,o=t>0?b.config.showMonths:-1,a=t>0?1:-1,i=n-b.currentMonth;i!=o;i+=a)for(var r=b.daysContainer.children[i],l=n-b.currentMonth===i?e.$i+t:t<0?r.children.length-1:0,s=r.children.length,c=l;c>=0&&c0?s:-1);c+=a){var u=r.children[c];if(-1===u.className.indexOf("hidden")&&Q(u.dateObj)&&Math.abs(e.$i-c)>=Math.abs(t))return H(u)}b.changeMonth(a),B(L(a),0)}(o,t):H(o)}function q(e,t){for(var n=(new Date(e,t,1).getDay()-b.l10n.firstDayOfWeek+7)%7,o=b.utils.getDaysInMonth((t-1+12)%12,e),a=b.utils.getDaysInMonth(t,e),i=window.document.createDocumentFragment(),r=b.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",s=r?"nextMonthDay hidden":"nextMonthDay",c=o+1-n,d=0;c<=o;c++,d++)i.appendChild(Y(l,new Date(e,t-1,c),c,d));for(c=1;c<=a;c++,d++)i.appendChild(Y("",new Date(e,t,c),c,d));for(var p=a+1;p<=42-n&&(1===b.config.showMonths||d%7!=0);p++,d++)i.appendChild(Y(s,new Date(e,t+1,p%a),p,d));var f=u("div","dayContainer");return f.appendChild(i),f}function R(){if(void 0!==b.daysContainer){d(b.daysContainer),b.weekNumbers&&d(b.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t1||"dropdown"!==b.config.monthSelectorType)){var e=function(e){return!(void 0!==b.config.minDate&&b.currentYear===b.config.minDate.getFullYear()&&eb.config.maxDate.getMonth())};b.monthsDropdownContainer.tabIndex=-1,b.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var n=u("option","flatpickr-monthDropdown-month");n.value=new Date(b.currentYear,t).getMonth().toString(),n.textContent=h(t,b.config.shorthandCurrentMonth,b.l10n),n.tabIndex=-1,b.currentMonth===t&&(n.selected=!0),b.monthsDropdownContainer.appendChild(n)}}}function V(){var e,t=u("div","flatpickr-month"),n=window.document.createDocumentFragment();b.config.showMonths>1||"static"===b.config.monthSelectorType?e=u("span","cur-month"):(b.monthsDropdownContainer=u("select","flatpickr-monthDropdown-months"),b.monthsDropdownContainer.setAttribute("aria-label",b.l10n.monthAriaLabel),I(b.monthsDropdownContainer,"change",(function(e){var t=f(e),n=parseInt(t.value,10);b.changeMonth(n-b.currentMonth),me("onMonthChange")})),W(),e=b.monthsDropdownContainer);var o=p("cur-year",{tabindex:"-1"}),a=o.getElementsByTagName("input")[0];a.setAttribute("aria-label",b.l10n.yearAriaLabel),b.config.minDate&&a.setAttribute("min",b.config.minDate.getFullYear().toString()),b.config.maxDate&&(a.setAttribute("max",b.config.maxDate.getFullYear().toString()),a.disabled=!!b.config.minDate&&b.config.minDate.getFullYear()===b.config.maxDate.getFullYear());var i=u("div","flatpickr-current-month");return i.appendChild(e),i.appendChild(o),n.appendChild(i),t.appendChild(n),{container:t,yearElement:a,monthElement:e}}function J(){d(b.monthNav),b.monthNav.appendChild(b.prevMonthNav),b.config.showMonths&&(b.yearElements=[],b.monthElements=[]);for(var e=b.config.showMonths;e--;){var t=V();b.yearElements.push(t.yearElement),b.monthElements.push(t.monthElement),b.monthNav.appendChild(t.container)}b.monthNav.appendChild(b.nextMonthNav)}function K(){b.weekdayContainer?d(b.weekdayContainer):b.weekdayContainer=u("div","flatpickr-weekdays");for(var e=b.config.showMonths;e--;){var t=u("div","flatpickr-weekdaycontainer");b.weekdayContainer.appendChild(t)}return U(),b.weekdayContainer}function U(){if(b.weekdayContainer){var e=b.l10n.firstDayOfWeek,n=t(b.l10n.weekdays.shorthand);e>0&&e\n "+n.join("")+"\n \n "}}function $(e,t){void 0===t&&(t=!0);var n=t?e:e-b.currentMonth;n<0&&!0===b._hidePrevMonthArrow||n>0&&!0===b._hideNextMonthArrow||(b.currentMonth+=n,(b.currentMonth<0||b.currentMonth>11)&&(b.currentYear+=b.currentMonth>11?1:-1,b.currentMonth=(b.currentMonth+12)%12,me("onYearChange"),W()),R(),me("onMonthChange"),ve())}function z(e){return!(!b.config.appendTo||!b.config.appendTo.contains(e))||b.calendarContainer.contains(e)}function G(e){if(b.isOpen&&!b.config.inline){var t=f(e),n=z(t),o=t===b.input||t===b.altInput||b.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(b.input)||~e.path.indexOf(b.altInput)),a="blur"===e.type?o&&e.relatedTarget&&!z(e.relatedTarget):!o&&!n&&!z(e.relatedTarget),i=!b.config.ignoredFocusElements.some((function(e){return e.contains(t)}));a&&i&&(void 0!==b.timeContainer&&void 0!==b.minuteElement&&void 0!==b.hourElement&&""!==b.input.value&&void 0!==b.input.value&&P(),b.close(),b.config&&"range"===b.config.mode&&1===b.selectedDates.length&&(b.clear(!1),b.redraw()))}}function Z(e){if(!(!e||b.config.minDate&&eb.config.maxDate.getFullYear())){var t=e,n=b.currentYear!==t;b.currentYear=t||b.currentYear,b.config.maxDate&&b.currentYear===b.config.maxDate.getFullYear()?b.currentMonth=Math.min(b.config.maxDate.getMonth(),b.currentMonth):b.config.minDate&&b.currentYear===b.config.minDate.getFullYear()&&(b.currentMonth=Math.max(b.config.minDate.getMonth(),b.currentMonth)),n&&(b.redraw(),me("onYearChange"),W())}}function Q(e,t){void 0===t&&(t=!0);var n=b.parseDate(e,void 0,t);if(b.config.minDate&&n&&w(n,b.config.minDate,void 0!==t?t:!b.minDateHasTime)<0||b.config.maxDate&&n&&w(n,b.config.maxDate,void 0!==t?t:!b.maxDateHasTime)>0)return!1;if(0===b.config.enable.length&&0===b.config.disable.length)return!0;if(void 0===n)return!1;for(var o=b.config.enable.length>0,a=o?b.config.enable:b.config.disable,i=0,r=void 0;i=r.from.getTime()&&n.getTime()<=r.to.getTime())return o}return!o}function X(e){return void 0!==b.daysContainer&&-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&b.daysContainer.contains(e)}function ee(e){e.target!==b._input||e.relatedTarget&&z(e.relatedTarget)||b.setDate(b._input.value,!0,e.target===b.altInput?b.config.altFormat:b.config.dateFormat)}function te(e){var t=f(e),n=b.config.wrap?m.contains(t):t===b._input,o=b.config.allowInput,a=b.isOpen&&(!o||!n),i=b.config.inline&&n&&!o;if(13===e.keyCode&&n){if(o)return b.setDate(b._input.value,!0,t===b.altInput?b.config.altFormat:b.config.dateFormat),t.blur();b.open()}else if(z(t)||a||i){var r=!!b.timeContainer&&b.timeContainer.contains(t);switch(e.keyCode){case 13:r?(e.preventDefault(),P(),ce()):ue(e);break;case 27:e.preventDefault(),ce();break;case 8:case 46:n&&!b.config.allowInput&&(e.preventDefault(),b.clear());break;case 37:case 39:if(r||n)b.hourElement&&b.hourElement.focus();else if(e.preventDefault(),void 0!==b.daysContainer&&(!1===o||document.activeElement&&X(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),$(l),B(L(1),0)):B(void 0,l)}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;b.daysContainer&&void 0!==t.$i||t===b.input||t===b.altInput?e.ctrlKey?(e.stopPropagation(),Z(b.currentYear-s),B(L(1),0)):r||B(void 0,7*s):t===b.currentYearElement?Z(b.currentYear-s):b.config.enableTime&&(!r&&b.hourElement&&b.hourElement.focus(),P(e),b._debouncedChange());break;case 9:if(r){var c=[b.hourElement,b.minuteElement,b.secondElement,b.amPM].concat(b.pluginElements).filter((function(e){return e})),u=c.indexOf(t);if(-1!==u){var d=c[u+(e.shiftKey?-1:1)];e.preventDefault(),(d||b._input).focus()}}else!b.config.noCalendar&&b.daysContainer&&b.daysContainer.contains(t)&&e.shiftKey&&(e.preventDefault(),b._input.focus())}}if(void 0!==b.amPM&&t===b.amPM)switch(e.key){case b.l10n.amPM[0].charAt(0):case b.l10n.amPM[0].charAt(0).toLowerCase():b.amPM.textContent=b.l10n.amPM[0],k(),De();break;case b.l10n.amPM[1].charAt(0):case b.l10n.amPM[1].charAt(0).toLowerCase():b.amPM.textContent=b.l10n.amPM[1],k(),De()}(n||z(t))&&me("onKeyDown",e)}function ne(e){if(1===b.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():b.days.firstElementChild.dateObj.getTime(),n=b.parseDate(b.selectedDates[0],void 0,!0).getTime(),o=Math.min(t,b.selectedDates[0].getTime()),a=Math.max(t,b.selectedDates[0].getTime()),i=!1,r=0,l=0,s=o;so&&sr)?r=s:s>n&&(!l||s0&&f0&&f>l;return m?(p.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){p.classList.remove(e)})),"continue"):i&&!m?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){p.classList.remove(e)})),void(void 0!==e&&(e.classList.add(t<=b.selectedDates[0].getTime()?"startRange":"endRange"),nt&&f===n&&p.classList.add("endRange"),f>=r&&(0===l||f<=l)&&(c=n,d=t,(s=f)>Math.min(c,d)&&s0||n.getMinutes()>0||n.getSeconds()>0),b.selectedDates&&(b.selectedDates=b.selectedDates.filter((function(e){return Q(e)})),b.selectedDates.length||"min"!==e||T(n),De()),b.daysContainer&&(se(),void 0!==n?b.currentYearElement[e]=n.getFullYear().toString():b.currentYearElement.removeAttribute(e),b.currentYearElement.disabled=!!o&&void 0!==n&&o.getFullYear()===n.getFullYear())}}function ie(){return b.config.wrap?m.querySelector("[data-input]"):m}function re(){"object"!=typeof b.config.locale&&void 0===E.l10ns[b.config.locale]&&b.config.errorHandler(new Error("flatpickr: invalid locale "+b.config.locale)),b.l10n=e(e({},E.l10ns.default),"object"==typeof b.config.locale?b.config.locale:"default"!==b.config.locale?E.l10ns[b.config.locale]:void 0),v.K="("+b.l10n.amPM[0]+"|"+b.l10n.amPM[1]+"|"+b.l10n.amPM[0].toLowerCase()+"|"+b.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},g),JSON.parse(JSON.stringify(m.dataset||{}))).time_24hr&&void 0===E.defaultConfig.time_24hr&&(b.config.time_24hr=b.l10n.time_24hr),b.formatDate=D(b),b.parseDate=y({config:b.config,l10n:b.l10n})}function le(e){if(void 0!==b.calendarContainer){me("onPreCalendarPosition");var t=e||b._positionElement,n=Array.prototype.reduce.call(b.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),o=b.calendarContainer.offsetWidth,a=b.config.position.split(" "),i=a[0],r=a.length>1?a[1]:null,l=t.getBoundingClientRect(),s=window.innerHeight-l.bottom,u="above"===i||"below"!==i&&sn,d=window.pageYOffset+l.top+(u?-n-2:t.offsetHeight+2);if(c(b.calendarContainer,"arrowTop",!u),c(b.calendarContainer,"arrowBottom",u),!b.config.inline){var p=window.pageXOffset+l.left,f=!1,m=!1;"center"===r?(p-=(o-l.width)/2,f=!0):"right"===r&&(p-=o-l.width,m=!0),c(b.calendarContainer,"arrowLeft",!f&&!m),c(b.calendarContainer,"arrowCenter",f),c(b.calendarContainer,"arrowRight",m);var h=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=p+o>window.document.body.offsetWidth,v=h+o>window.document.body.offsetWidth;if(c(b.calendarContainer,"rightMost",g),!b.config.static)if(b.calendarContainer.style.top=d+"px",g)if(v){var D=function(){for(var e=null,t=0;tb.currentMonth+b.config.showMonths-1)&&"range"!==b.config.mode;if(b.selectedDateElem=n,"single"===b.config.mode)b.selectedDates=[o];else if("multiple"===b.config.mode){var i=ge(o);i?b.selectedDates.splice(parseInt(i),1):b.selectedDates.push(o)}else"range"===b.config.mode&&(2===b.selectedDates.length&&b.clear(!1,!1),b.latestSelectedDateObj=o,b.selectedDates.push(o),0!==w(o,b.selectedDates[0],!0)&&b.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(k(),a){var r=b.currentYear!==o.getFullYear();b.currentYear=o.getFullYear(),b.currentMonth=o.getMonth(),r&&(me("onYearChange"),W()),me("onMonthChange")}if(ve(),R(),De(),a||"range"===b.config.mode||1!==b.config.showMonths?void 0!==b.selectedDateElem&&void 0===b.hourElement&&b.selectedDateElem&&b.selectedDateElem.focus():H(n),void 0!==b.hourElement&&void 0!==b.hourElement&&b.hourElement.focus(),b.config.closeOnSelect){var l="single"===b.config.mode&&!b.config.enableTime,s="range"===b.config.mode&&2===b.selectedDates.length&&!b.config.enableTime;(l||s)&&ce()}S()}}b.parseDate=y({config:b.config,l10n:b.l10n}),b._handlers=[],b.pluginElements=[],b.loadedPlugins=[],b._bind=I,b._setHoursFromDate=T,b._positionCalendar=le,b.changeMonth=$,b.changeYear=Z,b.clear=function(e,t){if(void 0===e&&(e=!0),void 0===t&&(t=!0),b.input.value="",void 0!==b.altInput&&(b.altInput.value=""),void 0!==b.mobileInput&&(b.mobileInput.value=""),b.selectedDates=[],b.latestSelectedDateObj=void 0,!0===t&&(b.currentYear=b._initialDate.getFullYear(),b.currentMonth=b._initialDate.getMonth()),!0===b.config.enableTime){var n=_(),o=n.hours,a=n.minutes,i=n.seconds;O(o,a,i)}b.redraw(),e&&me("onChange")},b.close=function(){b.isOpen=!1,b.isMobile||(void 0!==b.calendarContainer&&b.calendarContainer.classList.remove("open"),void 0!==b._input&&b._input.classList.remove("active")),me("onClose")},b._createElement=u,b.destroy=function(){void 0!==b.config&&me("onDestroy");for(var e=b._handlers.length;e--;){var t=b._handlers[e];t.element.removeEventListener(t.event,t.handler,t.options)}if(b._handlers=[],b.mobileInput)b.mobileInput.parentNode&&b.mobileInput.parentNode.removeChild(b.mobileInput),b.mobileInput=void 0;else if(b.calendarContainer&&b.calendarContainer.parentNode)if(b.config.static&&b.calendarContainer.parentNode){var n=b.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else b.calendarContainer.parentNode.removeChild(b.calendarContainer);b.altInput&&(b.input.type="text",b.altInput.parentNode&&b.altInput.parentNode.removeChild(b.altInput),delete b.altInput),b.input&&(b.input.type=b.input._type,b.input.classList.remove("flatpickr-input"),b.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete b[e]}catch(e){}}))},b.isEnabled=Q,b.jumpToDate=F,b.open=function(e,t){if(void 0===t&&(t=b._positionElement),!0===b.isMobile){if(e){e.preventDefault();var n=f(e);n&&n.blur()}return void 0!==b.mobileInput&&(b.mobileInput.focus(),b.mobileInput.click()),void me("onOpen")}if(!b._input.disabled&&!b.config.inline){var o=b.isOpen;b.isOpen=!0,o||(b.calendarContainer.classList.add("open"),b._input.classList.add("active"),me("onOpen"),le(t)),!0===b.config.enableTime&&!0===b.config.noCalendar&&(!1!==b.config.allowInput||void 0!==e&&b.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return b.hourElement.select()}),50))}},b.redraw=se,b.set=function(e,t){if(null!==e&&"object"==typeof e)for(var o in Object.assign(b.config,e),e)void 0!==de[o]&&de[o].forEach((function(e){return e()}));else b.config[e]=t,void 0!==de[e]?de[e].forEach((function(e){return e()})):n.indexOf(e)>-1&&(b.config[e]=s(t));b.redraw(),De(!0)},b.setDate=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=b.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return b.clear(t);pe(e,n),b.latestSelectedDateObj=b.selectedDates[b.selectedDates.length-1],b.redraw(),F(void 0,t),T(),0===b.selectedDates.length&&b.clear(!1),De(t),t&&me("onChange")},b.toggle=function(e){if(!0===b.isOpen)return b.close();b.open(e)};var de={locale:[re,U],showMonths:[J,x,K],minDate:[F],maxDate:[F]};function pe(e,t){var n=[];if(e instanceof Array)n=e.map((function(e){return b.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)n=[b.parseDate(e,t)];else if("string"==typeof e)switch(b.config.mode){case"single":case"time":n=[b.parseDate(e,t)];break;case"multiple":n=e.split(b.config.conjunction).map((function(e){return b.parseDate(e,t)}));break;case"range":n=e.split(b.l10n.rangeSeparator).map((function(e){return b.parseDate(e,t)}))}else b.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));b.selectedDates=b.config.allowInvalidPreload?n:n.filter((function(e){return e instanceof Date&&Q(e,!1)})),"range"===b.config.mode&&b.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()}))}function fe(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?b.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:b.parseDate(e.from,void 0),to:b.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function me(e,t){if(void 0!==b.config){var n=b.config[e];if(void 0!==n&&n.length>0)for(var o=0;n[o]&&o1||"static"===b.config.monthSelectorType?b.monthElements[t].textContent=h(n.getMonth(),b.config.shorthandCurrentMonth,b.l10n)+" ":b.monthsDropdownContainer.value=n.getMonth().toString(),e.value=n.getFullYear().toString()})),b._hidePrevMonthArrow=void 0!==b.config.minDate&&(b.currentYear===b.config.minDate.getFullYear()?b.currentMonth<=b.config.minDate.getMonth():b.currentYearb.config.maxDate.getMonth():b.currentYear>b.config.maxDate.getFullYear()))}function be(e){return b.selectedDates.map((function(t){return b.formatDate(t,e)})).filter((function(e,t,n){return"range"!==b.config.mode||b.config.enableTime||n.indexOf(e)===t})).join("range"!==b.config.mode?b.config.conjunction:b.l10n.rangeSeparator)}function De(e){void 0===e&&(e=!0),void 0!==b.mobileInput&&b.mobileFormatStr&&(b.mobileInput.value=void 0!==b.latestSelectedDateObj?b.formatDate(b.latestSelectedDateObj,b.mobileFormatStr):""),b.input.value=be(b.config.dateFormat),void 0!==b.altInput&&(b.altInput.value=be(b.config.altFormat)),!1!==e&&me("onValueUpdate")}function ye(e){var t=f(e),n=b.prevMonthNav.contains(t),o=b.nextMonthNav.contains(t);n||o?$(n?-1:1):b.yearElements.indexOf(t)>=0?t.select():t.classList.contains("arrowUp")?b.changeYear(b.currentYear+1):t.classList.contains("arrowDown")&&b.changeYear(b.currentYear-1)}return function(){b.element=b.input=m,b.isOpen=!1,function(){var t=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=e(e({},JSON.parse(JSON.stringify(m.dataset||{}))),g),i={};b.config.parseDate=a.parseDate,b.config.formatDate=a.formatDate,Object.defineProperty(b.config,"enable",{get:function(){return b.config._enable},set:function(e){b.config._enable=fe(e)}}),Object.defineProperty(b.config,"disable",{get:function(){return b.config._disable},set:function(e){b.config._disable=fe(e)}});var r="time"===a.mode;if(!a.dateFormat&&(a.enableTime||r)){var l=E.defaultConfig.dateFormat||o.dateFormat;i.dateFormat=a.noCalendar||r?"H:i"+(a.enableSeconds?":S":""):l+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||r)&&!a.altFormat){var c=E.defaultConfig.altFormat||o.altFormat;i.altFormat=a.noCalendar||r?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}Object.defineProperty(b.config,"minDate",{get:function(){return b.config._minDate},set:ae("min")}),Object.defineProperty(b.config,"maxDate",{get:function(){return b.config._maxDate},set:ae("max")});var u=function(e){return function(t){b.config["min"===e?"_minTime":"_maxTime"]=b.parseDate(t,"H:i:S")}};Object.defineProperty(b.config,"minTime",{get:function(){return b.config._minTime},set:u("min")}),Object.defineProperty(b.config,"maxTime",{get:function(){return b.config._maxTime},set:u("max")}),"time"===a.mode&&(b.config.noCalendar=!0,b.config.enableTime=!0),Object.assign(b.config,i,a);for(var d=0;d-1?b.config[f]=s(p[f]).map(C).concat(b.config[f]):void 0===a[f]&&(b.config[f]=p[f])}a.altInputClass||(b.config.altInputClass=ie().className+" "+b.config.altInputClass),me("onParseConfig")}(),re(),b.input=ie(),b.input?(b.input._type=b.input.type,b.input.type="text",b.input.classList.add("flatpickr-input"),b._input=b.input,b.config.altInput&&(b.altInput=u(b.input.nodeName,b.config.altInputClass),b._input=b.altInput,b.altInput.placeholder=b.input.placeholder,b.altInput.disabled=b.input.disabled,b.altInput.required=b.input.required,b.altInput.tabIndex=b.input.tabIndex,b.altInput.type="text",b.input.setAttribute("type","hidden"),!b.config.static&&b.input.parentNode&&b.input.parentNode.insertBefore(b.altInput,b.input.nextSibling)),b.config.allowInput||b._input.setAttribute("readonly","readonly"),b._positionElement=b.config.positionElement||b._input):b.config.errorHandler(new Error("Invalid input element specified")),function(){b.selectedDates=[],b.now=b.parseDate(b.config.now)||new Date;var e=b.config.defaultDate||("INPUT"!==b.input.nodeName&&"TEXTAREA"!==b.input.nodeName||!b.input.placeholder||b.input.value!==b.input.placeholder?b.input.value:null);e&&pe(e,b.config.dateFormat),b._initialDate=b.selectedDates.length>0?b.selectedDates[0]:b.config.minDate&&b.config.minDate.getTime()>b.now.getTime()?b.config.minDate:b.config.maxDate&&b.config.maxDate.getTime()0&&(b.latestSelectedDateObj=b.selectedDates[0]),void 0!==b.config.minTime&&(b.config.minTime=b.parseDate(b.config.minTime,"H:i")),void 0!==b.config.maxTime&&(b.config.maxTime=b.parseDate(b.config.maxTime,"H:i")),b.minDateHasTime=!!b.config.minDate&&(b.config.minDate.getHours()>0||b.config.minDate.getMinutes()>0||b.config.minDate.getSeconds()>0),b.maxDateHasTime=!!b.config.maxDate&&(b.config.maxDate.getHours()>0||b.config.maxDate.getMinutes()>0||b.config.maxDate.getSeconds()>0)}(),b.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=b.currentMonth),void 0===t&&(t=b.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:b.l10n.daysInMonth[e]}},b.isMobile||function(){var e=window.document.createDocumentFragment();if(b.calendarContainer=u("div","flatpickr-calendar"),b.calendarContainer.tabIndex=-1,!b.config.noCalendar){if(e.appendChild((b.monthNav=u("div","flatpickr-months"),b.yearElements=[],b.monthElements=[],b.prevMonthNav=u("span","flatpickr-prev-month"),b.prevMonthNav.innerHTML=b.config.prevArrow,b.nextMonthNav=u("span","flatpickr-next-month"),b.nextMonthNav.innerHTML=b.config.nextArrow,J(),Object.defineProperty(b,"_hidePrevMonthArrow",{get:function(){return b.__hidePrevMonthArrow},set:function(e){b.__hidePrevMonthArrow!==e&&(c(b.prevMonthNav,"flatpickr-disabled",e),b.__hidePrevMonthArrow=e)}}),Object.defineProperty(b,"_hideNextMonthArrow",{get:function(){return b.__hideNextMonthArrow},set:function(e){b.__hideNextMonthArrow!==e&&(c(b.nextMonthNav,"flatpickr-disabled",e),b.__hideNextMonthArrow=e)}}),b.currentYearElement=b.yearElements[0],ve(),b.monthNav)),b.innerContainer=u("div","flatpickr-innerContainer"),b.config.weekNumbers){var t=function(){b.calendarContainer.classList.add("hasWeeks");var e=u("div","flatpickr-weekwrapper");e.appendChild(u("span","flatpickr-weekday",b.l10n.weekAbbreviation));var t=u("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),n=t.weekWrapper,o=t.weekNumbers;b.innerContainer.appendChild(n),b.weekNumbers=o,b.weekWrapper=n}b.rContainer=u("div","flatpickr-rContainer"),b.rContainer.appendChild(K()),b.daysContainer||(b.daysContainer=u("div","flatpickr-days"),b.daysContainer.tabIndex=-1),R(),b.rContainer.appendChild(b.daysContainer),b.innerContainer.appendChild(b.rContainer),e.appendChild(b.innerContainer)}b.config.enableTime&&e.appendChild(function(){b.calendarContainer.classList.add("hasTime"),b.config.noCalendar&&b.calendarContainer.classList.add("noCalendar"),b.timeContainer=u("div","flatpickr-time"),b.timeContainer.tabIndex=-1;var e=u("span","flatpickr-time-separator",":"),t=p("flatpickr-hour",{"aria-label":b.l10n.hourAriaLabel});b.hourElement=t.getElementsByTagName("input")[0];var n=p("flatpickr-minute",{"aria-label":b.l10n.minuteAriaLabel});if(b.minuteElement=n.getElementsByTagName("input")[0],b.hourElement.tabIndex=b.minuteElement.tabIndex=-1,b.hourElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getHours():b.config.time_24hr?b.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(b.config.defaultHour)),b.minuteElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getMinutes():b.config.defaultMinute),b.hourElement.setAttribute("step",b.config.hourIncrement.toString()),b.minuteElement.setAttribute("step",b.config.minuteIncrement.toString()),b.hourElement.setAttribute("min",b.config.time_24hr?"0":"1"),b.hourElement.setAttribute("max",b.config.time_24hr?"23":"12"),b.minuteElement.setAttribute("min","0"),b.minuteElement.setAttribute("max","59"),b.timeContainer.appendChild(t),b.timeContainer.appendChild(e),b.timeContainer.appendChild(n),b.config.time_24hr&&b.timeContainer.classList.add("time24hr"),b.config.enableSeconds){b.timeContainer.classList.add("hasSeconds");var o=p("flatpickr-second");b.secondElement=o.getElementsByTagName("input")[0],b.secondElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getSeconds():b.config.defaultSeconds),b.secondElement.setAttribute("step",b.minuteElement.getAttribute("step")),b.secondElement.setAttribute("min","0"),b.secondElement.setAttribute("max","59"),b.timeContainer.appendChild(u("span","flatpickr-time-separator",":")),b.timeContainer.appendChild(o)}return b.config.time_24hr||(b.amPM=u("span","flatpickr-am-pm",b.l10n.amPM[r((b.latestSelectedDateObj?b.hourElement.value:b.config.defaultHour)>11)]),b.amPM.title=b.l10n.toggleTitle,b.amPM.tabIndex=-1,b.timeContainer.appendChild(b.amPM)),b.timeContainer}()),c(b.calendarContainer,"rangeMode","range"===b.config.mode),c(b.calendarContainer,"animate",!0===b.config.animate),c(b.calendarContainer,"multiMonth",b.config.showMonths>1),b.calendarContainer.appendChild(e);var a=void 0!==b.config.appendTo&&void 0!==b.config.appendTo.nodeType;if((b.config.inline||b.config.static)&&(b.calendarContainer.classList.add(b.config.inline?"inline":"static"),b.config.inline&&(!a&&b.element.parentNode?b.element.parentNode.insertBefore(b.calendarContainer,b._input.nextSibling):void 0!==b.config.appendTo&&b.config.appendTo.appendChild(b.calendarContainer)),b.config.static)){var l=u("div","flatpickr-wrapper");b.element.parentNode&&b.element.parentNode.insertBefore(l,b.element),l.appendChild(b.element),b.altInput&&l.appendChild(b.altInput),l.appendChild(b.calendarContainer)}b.config.static||b.config.inline||(void 0!==b.config.appendTo?b.config.appendTo:window.document.body).appendChild(b.calendarContainer)}(),function(){if(b.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(b.element.querySelectorAll("[data-"+e+"]"),(function(t){return I(t,"click",b[e])}))})),b.isMobile)!function(){var e=b.config.enableTime?b.config.noCalendar?"time":"datetime-local":"date";b.mobileInput=u("input",b.input.className+" flatpickr-mobile"),b.mobileInput.tabIndex=1,b.mobileInput.type=e,b.mobileInput.disabled=b.input.disabled,b.mobileInput.required=b.input.required,b.mobileInput.placeholder=b.input.placeholder,b.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",b.selectedDates.length>0&&(b.mobileInput.defaultValue=b.mobileInput.value=b.formatDate(b.selectedDates[0],b.mobileFormatStr)),b.config.minDate&&(b.mobileInput.min=b.formatDate(b.config.minDate,"Y-m-d")),b.config.maxDate&&(b.mobileInput.max=b.formatDate(b.config.maxDate,"Y-m-d")),b.input.getAttribute("step")&&(b.mobileInput.step=String(b.input.getAttribute("step"))),b.input.type="hidden",void 0!==b.altInput&&(b.altInput.type="hidden");try{b.input.parentNode&&b.input.parentNode.insertBefore(b.mobileInput,b.input.nextSibling)}catch(e){}I(b.mobileInput,"change",(function(e){b.setDate(f(e).value,!1,b.mobileFormatStr),me("onChange"),me("onClose")}))}();else{var e=l(oe,50);b._debouncedChange=l(S,300),b.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&I(b.daysContainer,"mouseover",(function(e){"range"===b.config.mode&&ne(f(e))})),I(window.document.body,"keydown",te),b.config.inline||b.config.static||I(window,"resize",e),void 0!==window.ontouchstart?I(window.document,"touchstart",G):I(window.document,"click",G),I(window.document,"focus",G,{capture:!0}),!0===b.config.clickOpens&&(I(b._input,"focus",b.open),I(b._input,"click",b.open)),void 0!==b.daysContainer&&(I(b.monthNav,"click",ye),I(b.monthNav,["keyup","increment"],N),I(b.daysContainer,"click",ue)),void 0!==b.timeContainer&&void 0!==b.minuteElement&&void 0!==b.hourElement&&(I(b.timeContainer,["increment"],P),I(b.timeContainer,"blur",P,{capture:!0}),I(b.timeContainer,"click",A),I([b.hourElement,b.minuteElement],["focus","click"],(function(e){return f(e).select()})),void 0!==b.secondElement&&I(b.secondElement,"focus",(function(){return b.secondElement&&b.secondElement.select()})),void 0!==b.amPM&&I(b.amPM,"click",(function(e){P(e),S()}))),b.config.allowInput&&I(b._input,"blur",ee)}}(),(b.selectedDates.length||b.config.noCalendar)&&(b.config.enableTime&&T(b.config.noCalendar?b.latestSelectedDateObj||b.config.minDate:void 0),De(!1)),x();var t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!b.isMobile&&t&&le(),me("onReady")}(),b}function x(e,t){for(var n=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),o=[],a=0;a=2?M.a.component({type:"button",className:"Button Button--warning PollModal--button",icon:"fas fa-minus",onclick:n>=2?e.removeOption.bind(e,n):""}):"")}))},n.addOption=function(){var e=app.data["fof-polls.options.max"],t=e&&parseInt(e)||11;this.options.length=2?M.a.component({type:"button",className:"Button PollModal--button",icon:"fas fa-minus",onclick:n>=2?e.removeOption.bind(e,n):""}):"")}))},n.addOption=function(){var e=app.data["fof-polls.options.max"],t=e&&parseInt(e)||11;this.options.length",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},a={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(e){var t=e%100;if(t>3&&t<21)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},i=function(e,t){return void 0===t&&(t=2),("000"+e).slice(-1*t)},r=function(e){return!0===e?1:0};function l(e,t,n){var o;return void 0===n&&(n=!1),function(){var a=this,i=arguments;null!==o&&clearTimeout(o),o=window.setTimeout((function(){o=null,n||e.apply(a,i)}),t),n&&!o&&e.apply(a,i)}}var s=function(e){return e instanceof Array?e:[e]};function c(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function u(e,t,n){var o=window.document.createElement(e);return t=t||"",n=n||"",o.className=t,void 0!==n&&(o.textContent=n),o}function d(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function p(e,t){var n=u("div","numInputWrapper"),o=u("input","numInput "+e),a=u("span","arrowUp"),i=u("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?o.type="number":(o.type="text",o.pattern="\\d*"),void 0!==t)for(var r in t)o.setAttribute(r,t[r]);return n.appendChild(o),n.appendChild(a),n.appendChild(i),n}function f(e){try{return"function"==typeof e.composedPath?e.composedPath()[0]:e.target}catch(t){return e.target}}var m=function(){},h=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},g={D:m,F:function(e,t,n){e.setMonth(n.months.longhand.indexOf(t))},G:function(e,t){e.setHours(parseFloat(t))},H:function(e,t){e.setHours(parseFloat(t))},J:function(e,t){e.setDate(parseFloat(t))},K:function(e,t,n){e.setHours(e.getHours()%12+12*r(new RegExp(n.amPM[1],"i").test(t)))},M:function(e,t,n){e.setMonth(n.months.shorthand.indexOf(t))},S:function(e,t){e.setSeconds(parseFloat(t))},U:function(e,t){return new Date(1e3*parseFloat(t))},W:function(e,t,n){var o=parseInt(t),a=new Date(e.getFullYear(),0,2+7*(o-1),0,0,0,0);return a.setDate(a.getDate()-a.getDay()+n.firstDayOfWeek),a},Y:function(e,t){e.setFullYear(parseFloat(t))},Z:function(e,t){return new Date(t)},d:function(e,t){e.setDate(parseFloat(t))},h:function(e,t){e.setHours(parseFloat(t))},i:function(e,t){e.setMinutes(parseFloat(t))},j:function(e,t){e.setDate(parseFloat(t))},l:m,m:function(e,t){e.setMonth(parseFloat(t)-1)},n:function(e,t){e.setMonth(parseFloat(t)-1)},s:function(e,t){e.setSeconds(parseFloat(t))},u:function(e,t){return new Date(parseFloat(t))},w:m,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},v={D:"(\\w+)",F:"(\\w+)",G:"(\\d\\d|\\d)",H:"(\\d\\d|\\d)",J:"(\\d\\d|\\d)\\w+",K:"",M:"(\\w+)",S:"(\\d\\d|\\d)",U:"(.+)",W:"(\\d\\d|\\d)",Y:"(\\d{4})",Z:"(.+)",d:"(\\d\\d|\\d)",h:"(\\d\\d|\\d)",i:"(\\d\\d|\\d)",j:"(\\d\\d|\\d)",l:"(\\w+)",m:"(\\d\\d|\\d)",n:"(\\d\\d|\\d)",s:"(\\d\\d|\\d)",u:"(.+)",w:"(\\d\\d|\\d)",y:"(\\d{2})"},b={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[b.w(e,t,n)]},F:function(e,t,n){return h(b.n(e,t,n)-1,!1,t)},G:function(e,t,n){return i(b.h(e,t,n))},H:function(e){return i(e.getHours())},J:function(e,t){return void 0!==t.ordinal?e.getDate()+t.ordinal(e.getDate()):e.getDate()},K:function(e,t){return t.amPM[r(e.getHours()>11)]},M:function(e,t){return h(e.getMonth(),!0,t)},S:function(e){return i(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return i(e.getFullYear(),4)},d:function(e){return i(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return i(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return i(e.getMonth()+1)},n:function(e){return e.getMonth()+1},s:function(e){return e.getSeconds()},u:function(e){return e.getTime()},w:function(e){return e.getDay()},y:function(e){return String(e.getFullYear()).substring(2)}},D=function(e){var t=e.config,n=void 0===t?o:t,i=e.l10n,r=void 0===i?a:i,l=e.isMobile,s=void 0!==l&&l;return function(e,t,o){var a=o||r;return void 0===n.formatDate||s?t.split("").map((function(t,o,i){return b[t]&&"\\"!==i[o-1]?b[t](e,a,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,a)}},y=function(e){var t=e.config,n=void 0===t?o:t,i=e.l10n,r=void 0===i?a:i;return function(e,t,a,i){if(0===e||e){var l,s=i||r,c=e;if(e instanceof Date)l=new Date(e.getTime());else if("string"!=typeof e&&void 0!==e.toFixed)l=new Date(e);else if("string"==typeof e){var u=t||(n||o).dateFormat,d=String(e).trim();if("today"===d)l=new Date,a=!0;else if(/Z$/.test(d)||/GMT$/.test(d))l=new Date(e);else if(n&&n.parseDate)l=n.parseDate(e,u);else{l=n&&n.noCalendar?new Date((new Date).setHours(0,0,0,0)):new Date((new Date).getFullYear(),0,1,0,0,0,0);for(var p=void 0,f=[],m=0,h=0,b="";ml&&(d=o===b.hourElement?d-l-r(!b.amPM):a,m&&j(void 0,1,b.hourElement)),b.amPM&&p&&(1===s?d+c===23:Math.abs(d-c)>s)&&(b.amPM.textContent=b.l10n.amPM[r(b.amPM.textContent===b.l10n.amPM[0])]),o.value=i(d)}}(e);var s=b._input.value;k(),De(),b._input.value!==s&&b._debouncedChange()}function k(){if(void 0!==b.hourElement&&void 0!==b.minuteElement){var e,t,n=(parseInt(b.hourElement.value.slice(-2),10)||0)%24,o=(parseInt(b.minuteElement.value,10)||0)%60,a=void 0!==b.secondElement?(parseInt(b.secondElement.value,10)||0)%60:0;void 0!==b.amPM&&(e=n,t=b.amPM.textContent,n=e%12+12*r(t===b.l10n.amPM[1]));var i=void 0!==b.config.minTime||b.config.minDate&&b.minDateHasTime&&b.latestSelectedDateObj&&0===w(b.latestSelectedDateObj,b.config.minDate,!0);if(void 0!==b.config.maxTime||b.config.maxDate&&b.maxDateHasTime&&b.latestSelectedDateObj&&0===w(b.latestSelectedDateObj,b.config.maxDate,!0)){var l=void 0!==b.config.maxTime?b.config.maxTime:b.config.maxDate;(n=Math.min(n,l.getHours()))===l.getHours()&&(o=Math.min(o,l.getMinutes())),o===l.getMinutes()&&(a=Math.min(a,l.getSeconds()))}if(i){var s=void 0!==b.config.minTime?b.config.minTime:b.config.minDate;(n=Math.max(n,s.getHours()))===s.getHours()&&(o=Math.max(o,s.getMinutes())),o===s.getMinutes()&&(a=Math.max(a,s.getSeconds()))}_(n,o,a)}}function T(e){var t=e||b.latestSelectedDateObj;t&&_(t.getHours(),t.getMinutes(),t.getSeconds())}function O(){var e=b.config.defaultHour,t=b.config.defaultMinute,n=b.config.defaultSeconds;if(void 0!==b.config.minDate){var o=b.config.minDate.getHours(),a=b.config.minDate.getMinutes();(e=Math.max(e,o))===o&&(t=Math.max(a,t)),e===o&&t===a&&(n=b.config.minDate.getSeconds())}if(void 0!==b.config.maxDate){var i=b.config.maxDate.getHours(),r=b.config.maxDate.getMinutes();(e=Math.min(e,i))===i&&(t=Math.min(r,t)),e===i&&t===r&&(n=b.config.maxDate.getSeconds())}return{hours:e,minutes:t,seconds:n}}function _(e,t,n){void 0!==b.latestSelectedDateObj&&b.latestSelectedDateObj.setHours(e%24,t,n||0,0),b.hourElement&&b.minuteElement&&!b.isMobile&&(b.hourElement.value=i(b.config.time_24hr?e:(12+e)%12+12*r(e%12==0)),b.minuteElement.value=i(t),void 0!==b.amPM&&(b.amPM.textContent=b.l10n.amPM[r(e>=12)]),void 0!==b.secondElement&&(b.secondElement.value=i(n)))}function N(e){var t=f(e),n=parseInt(t.value)+(e.delta||0);(n/1e3>1||"Enter"===e.key&&!/[^\d]/.test(n.toString()))&&Z(n)}function I(e,t,n,o){return t instanceof Array?t.forEach((function(t){return I(e,t,n,o)})):e instanceof Array?e.forEach((function(e){return I(e,t,n,o)})):(e.addEventListener(t,n,o),void b._handlers.push({element:e,event:t,handler:n,options:o}))}function S(){me("onChange")}function F(e,t){var n=void 0!==e?b.parseDate(e):b.latestSelectedDateObj||(b.config.minDate&&b.config.minDate>b.now?b.config.minDate:b.config.maxDate&&b.config.maxDate=0&&w(e,b.selectedDates[1])<=0}(t)&&!ge(t)&&i.classList.add("inRange"),b.weekNumbers&&1===b.config.showMonths&&"prevMonthDay"!==e&&n%7==1&&b.weekNumbers.insertAdjacentHTML("beforeend",""+b.config.getWeek(t)+""),me("onDayCreate",i),i}function H(e){e.focus(),"range"===b.config.mode&&ne(e)}function L(e){for(var t=e>0?0:b.config.showMonths-1,n=e>0?b.config.showMonths:-1,o=t;o!=n;o+=e)for(var a=b.daysContainer.children[o],i=e>0?0:a.children.length-1,r=e>0?a.children.length:-1,l=i;l!=r;l+=e){var s=a.children[l];if(-1===s.className.indexOf("hidden")&&Q(s.dateObj))return s}}function B(e,t){var n=X(document.activeElement||document.body),o=void 0!==e?e:n?document.activeElement:void 0!==b.selectedDateElem&&X(b.selectedDateElem)?b.selectedDateElem:void 0!==b.todayDateElem&&X(b.todayDateElem)?b.todayDateElem:L(t>0?1:-1);void 0===o?b._input.focus():n?function(e,t){for(var n=-1===e.className.indexOf("Month")?e.dateObj.getMonth():b.currentMonth,o=t>0?b.config.showMonths:-1,a=t>0?1:-1,i=n-b.currentMonth;i!=o;i+=a)for(var r=b.daysContainer.children[i],l=n-b.currentMonth===i?e.$i+t:t<0?r.children.length-1:0,s=r.children.length,c=l;c>=0&&c0?s:-1);c+=a){var u=r.children[c];if(-1===u.className.indexOf("hidden")&&Q(u.dateObj)&&Math.abs(e.$i-c)>=Math.abs(t))return H(u)}b.changeMonth(a),B(L(a),0)}(o,t):H(o)}function q(e,t){for(var n=(new Date(e,t,1).getDay()-b.l10n.firstDayOfWeek+7)%7,o=b.utils.getDaysInMonth((t-1+12)%12,e),a=b.utils.getDaysInMonth(t,e),i=window.document.createDocumentFragment(),r=b.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",s=r?"nextMonthDay hidden":"nextMonthDay",c=o+1-n,d=0;c<=o;c++,d++)i.appendChild(Y(l,new Date(e,t-1,c),c,d));for(c=1;c<=a;c++,d++)i.appendChild(Y("",new Date(e,t,c),c,d));for(var p=a+1;p<=42-n&&(1===b.config.showMonths||d%7!=0);p++,d++)i.appendChild(Y(s,new Date(e,t+1,p%a),p,d));var f=u("div","dayContainer");return f.appendChild(i),f}function R(){if(void 0!==b.daysContainer){d(b.daysContainer),b.weekNumbers&&d(b.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t1||"dropdown"!==b.config.monthSelectorType)){var e=function(e){return!(void 0!==b.config.minDate&&b.currentYear===b.config.minDate.getFullYear()&&eb.config.maxDate.getMonth())};b.monthsDropdownContainer.tabIndex=-1,b.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var n=u("option","flatpickr-monthDropdown-month");n.value=new Date(b.currentYear,t).getMonth().toString(),n.textContent=h(t,b.config.shorthandCurrentMonth,b.l10n),n.tabIndex=-1,b.currentMonth===t&&(n.selected=!0),b.monthsDropdownContainer.appendChild(n)}}}function V(){var e,t=u("div","flatpickr-month"),n=window.document.createDocumentFragment();b.config.showMonths>1||"static"===b.config.monthSelectorType?e=u("span","cur-month"):(b.monthsDropdownContainer=u("select","flatpickr-monthDropdown-months"),b.monthsDropdownContainer.setAttribute("aria-label",b.l10n.monthAriaLabel),I(b.monthsDropdownContainer,"change",(function(e){var t=f(e),n=parseInt(t.value,10);b.changeMonth(n-b.currentMonth),me("onMonthChange")})),W(),e=b.monthsDropdownContainer);var o=p("cur-year",{tabindex:"-1"}),a=o.getElementsByTagName("input")[0];a.setAttribute("aria-label",b.l10n.yearAriaLabel),b.config.minDate&&a.setAttribute("min",b.config.minDate.getFullYear().toString()),b.config.maxDate&&(a.setAttribute("max",b.config.maxDate.getFullYear().toString()),a.disabled=!!b.config.minDate&&b.config.minDate.getFullYear()===b.config.maxDate.getFullYear());var i=u("div","flatpickr-current-month");return i.appendChild(e),i.appendChild(o),n.appendChild(i),t.appendChild(n),{container:t,yearElement:a,monthElement:e}}function J(){d(b.monthNav),b.monthNav.appendChild(b.prevMonthNav),b.config.showMonths&&(b.yearElements=[],b.monthElements=[]);for(var e=b.config.showMonths;e--;){var t=V();b.yearElements.push(t.yearElement),b.monthElements.push(t.monthElement),b.monthNav.appendChild(t.container)}b.monthNav.appendChild(b.nextMonthNav)}function K(){b.weekdayContainer?d(b.weekdayContainer):b.weekdayContainer=u("div","flatpickr-weekdays");for(var e=b.config.showMonths;e--;){var t=u("div","flatpickr-weekdaycontainer");b.weekdayContainer.appendChild(t)}return U(),b.weekdayContainer}function U(){if(b.weekdayContainer){var e=b.l10n.firstDayOfWeek,n=t(b.l10n.weekdays.shorthand);e>0&&e\n "+n.join("")+"\n \n "}}function $(e,t){void 0===t&&(t=!0);var n=t?e:e-b.currentMonth;n<0&&!0===b._hidePrevMonthArrow||n>0&&!0===b._hideNextMonthArrow||(b.currentMonth+=n,(b.currentMonth<0||b.currentMonth>11)&&(b.currentYear+=b.currentMonth>11?1:-1,b.currentMonth=(b.currentMonth+12)%12,me("onYearChange"),W()),R(),me("onMonthChange"),ve())}function z(e){return!(!b.config.appendTo||!b.config.appendTo.contains(e))||b.calendarContainer.contains(e)}function G(e){if(b.isOpen&&!b.config.inline){var t=f(e),n=z(t),o=t===b.input||t===b.altInput||b.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(b.input)||~e.path.indexOf(b.altInput)),a="blur"===e.type?o&&e.relatedTarget&&!z(e.relatedTarget):!o&&!n&&!z(e.relatedTarget),i=!b.config.ignoredFocusElements.some((function(e){return e.contains(t)}));a&&i&&(void 0!==b.timeContainer&&void 0!==b.minuteElement&&void 0!==b.hourElement&&""!==b.input.value&&void 0!==b.input.value&&P(),b.close(),b.config&&"range"===b.config.mode&&1===b.selectedDates.length&&(b.clear(!1),b.redraw()))}}function Z(e){if(!(!e||b.config.minDate&&eb.config.maxDate.getFullYear())){var t=e,n=b.currentYear!==t;b.currentYear=t||b.currentYear,b.config.maxDate&&b.currentYear===b.config.maxDate.getFullYear()?b.currentMonth=Math.min(b.config.maxDate.getMonth(),b.currentMonth):b.config.minDate&&b.currentYear===b.config.minDate.getFullYear()&&(b.currentMonth=Math.max(b.config.minDate.getMonth(),b.currentMonth)),n&&(b.redraw(),me("onYearChange"),W())}}function Q(e,t){void 0===t&&(t=!0);var n=b.parseDate(e,void 0,t);if(b.config.minDate&&n&&w(n,b.config.minDate,void 0!==t?t:!b.minDateHasTime)<0||b.config.maxDate&&n&&w(n,b.config.maxDate,void 0!==t?t:!b.maxDateHasTime)>0)return!1;if(0===b.config.enable.length&&0===b.config.disable.length)return!0;if(void 0===n)return!1;for(var o=b.config.enable.length>0,a=o?b.config.enable:b.config.disable,i=0,r=void 0;i=r.from.getTime()&&n.getTime()<=r.to.getTime())return o}return!o}function X(e){return void 0!==b.daysContainer&&-1===e.className.indexOf("hidden")&&-1===e.className.indexOf("flatpickr-disabled")&&b.daysContainer.contains(e)}function ee(e){e.target!==b._input||e.relatedTarget&&z(e.relatedTarget)||b.setDate(b._input.value,!0,e.target===b.altInput?b.config.altFormat:b.config.dateFormat)}function te(e){var t=f(e),n=b.config.wrap?m.contains(t):t===b._input,o=b.config.allowInput,a=b.isOpen&&(!o||!n),i=b.config.inline&&n&&!o;if(13===e.keyCode&&n){if(o)return b.setDate(b._input.value,!0,t===b.altInput?b.config.altFormat:b.config.dateFormat),t.blur();b.open()}else if(z(t)||a||i){var r=!!b.timeContainer&&b.timeContainer.contains(t);switch(e.keyCode){case 13:r?(e.preventDefault(),P(),ce()):ue(e);break;case 27:e.preventDefault(),ce();break;case 8:case 46:n&&!b.config.allowInput&&(e.preventDefault(),b.clear());break;case 37:case 39:if(r||n)b.hourElement&&b.hourElement.focus();else if(e.preventDefault(),void 0!==b.daysContainer&&(!1===o||document.activeElement&&X(document.activeElement))){var l=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),$(l),B(L(1),0)):B(void 0,l)}break;case 38:case 40:e.preventDefault();var s=40===e.keyCode?1:-1;b.daysContainer&&void 0!==t.$i||t===b.input||t===b.altInput?e.ctrlKey?(e.stopPropagation(),Z(b.currentYear-s),B(L(1),0)):r||B(void 0,7*s):t===b.currentYearElement?Z(b.currentYear-s):b.config.enableTime&&(!r&&b.hourElement&&b.hourElement.focus(),P(e),b._debouncedChange());break;case 9:if(r){var c=[b.hourElement,b.minuteElement,b.secondElement,b.amPM].concat(b.pluginElements).filter((function(e){return e})),u=c.indexOf(t);if(-1!==u){var d=c[u+(e.shiftKey?-1:1)];e.preventDefault(),(d||b._input).focus()}}else!b.config.noCalendar&&b.daysContainer&&b.daysContainer.contains(t)&&e.shiftKey&&(e.preventDefault(),b._input.focus())}}if(void 0!==b.amPM&&t===b.amPM)switch(e.key){case b.l10n.amPM[0].charAt(0):case b.l10n.amPM[0].charAt(0).toLowerCase():b.amPM.textContent=b.l10n.amPM[0],k(),De();break;case b.l10n.amPM[1].charAt(0):case b.l10n.amPM[1].charAt(0).toLowerCase():b.amPM.textContent=b.l10n.amPM[1],k(),De()}(n||z(t))&&me("onKeyDown",e)}function ne(e){if(1===b.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():b.days.firstElementChild.dateObj.getTime(),n=b.parseDate(b.selectedDates[0],void 0,!0).getTime(),o=Math.min(t,b.selectedDates[0].getTime()),a=Math.max(t,b.selectedDates[0].getTime()),i=!1,r=0,l=0,s=o;so&&sr)?r=s:s>n&&(!l||s0&&f0&&f>l;return m?(p.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach((function(e){p.classList.remove(e)})),"continue"):i&&!m?"continue":(["startRange","inRange","endRange","notAllowed"].forEach((function(e){p.classList.remove(e)})),void(void 0!==e&&(e.classList.add(t<=b.selectedDates[0].getTime()?"startRange":"endRange"),nt&&f===n&&p.classList.add("endRange"),f>=r&&(0===l||f<=l)&&(c=n,d=t,(s=f)>Math.min(c,d)&&s0||n.getMinutes()>0||n.getSeconds()>0),b.selectedDates&&(b.selectedDates=b.selectedDates.filter((function(e){return Q(e)})),b.selectedDates.length||"min"!==e||T(n),De()),b.daysContainer&&(se(),void 0!==n?b.currentYearElement[e]=n.getFullYear().toString():b.currentYearElement.removeAttribute(e),b.currentYearElement.disabled=!!o&&void 0!==n&&o.getFullYear()===n.getFullYear())}}function ie(){return b.config.wrap?m.querySelector("[data-input]"):m}function re(){"object"!=typeof b.config.locale&&void 0===E.l10ns[b.config.locale]&&b.config.errorHandler(new Error("flatpickr: invalid locale "+b.config.locale)),b.l10n=e(e({},E.l10ns.default),"object"==typeof b.config.locale?b.config.locale:"default"!==b.config.locale?E.l10ns[b.config.locale]:void 0),v.K="("+b.l10n.amPM[0]+"|"+b.l10n.amPM[1]+"|"+b.l10n.amPM[0].toLowerCase()+"|"+b.l10n.amPM[1].toLowerCase()+")",void 0===e(e({},g),JSON.parse(JSON.stringify(m.dataset||{}))).time_24hr&&void 0===E.defaultConfig.time_24hr&&(b.config.time_24hr=b.l10n.time_24hr),b.formatDate=D(b),b.parseDate=y({config:b.config,l10n:b.l10n})}function le(e){if(void 0!==b.calendarContainer){me("onPreCalendarPosition");var t=e||b._positionElement,n=Array.prototype.reduce.call(b.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),o=b.calendarContainer.offsetWidth,a=b.config.position.split(" "),i=a[0],r=a.length>1?a[1]:null,l=t.getBoundingClientRect(),s=window.innerHeight-l.bottom,u="above"===i||"below"!==i&&sn,d=window.pageYOffset+l.top+(u?-n-2:t.offsetHeight+2);if(c(b.calendarContainer,"arrowTop",!u),c(b.calendarContainer,"arrowBottom",u),!b.config.inline){var p=window.pageXOffset+l.left,f=!1,m=!1;"center"===r?(p-=(o-l.width)/2,f=!0):"right"===r&&(p-=o-l.width,m=!0),c(b.calendarContainer,"arrowLeft",!f&&!m),c(b.calendarContainer,"arrowCenter",f),c(b.calendarContainer,"arrowRight",m);var h=window.document.body.offsetWidth-(window.pageXOffset+l.right),g=p+o>window.document.body.offsetWidth,v=h+o>window.document.body.offsetWidth;if(c(b.calendarContainer,"rightMost",g),!b.config.static)if(b.calendarContainer.style.top=d+"px",g)if(v){var D=function(){for(var e=null,t=0;tb.currentMonth+b.config.showMonths-1)&&"range"!==b.config.mode;if(b.selectedDateElem=n,"single"===b.config.mode)b.selectedDates=[o];else if("multiple"===b.config.mode){var i=ge(o);i?b.selectedDates.splice(parseInt(i),1):b.selectedDates.push(o)}else"range"===b.config.mode&&(2===b.selectedDates.length&&b.clear(!1,!1),b.latestSelectedDateObj=o,b.selectedDates.push(o),0!==w(o,b.selectedDates[0],!0)&&b.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(k(),a){var r=b.currentYear!==o.getFullYear();b.currentYear=o.getFullYear(),b.currentMonth=o.getMonth(),r&&(me("onYearChange"),W()),me("onMonthChange")}if(ve(),R(),De(),a||"range"===b.config.mode||1!==b.config.showMonths?void 0!==b.selectedDateElem&&void 0===b.hourElement&&b.selectedDateElem&&b.selectedDateElem.focus():H(n),void 0!==b.hourElement&&void 0!==b.hourElement&&b.hourElement.focus(),b.config.closeOnSelect){var l="single"===b.config.mode&&!b.config.enableTime,s="range"===b.config.mode&&2===b.selectedDates.length&&!b.config.enableTime;(l||s)&&ce()}S()}}b.parseDate=y({config:b.config,l10n:b.l10n}),b._handlers=[],b.pluginElements=[],b.loadedPlugins=[],b._bind=I,b._setHoursFromDate=T,b._positionCalendar=le,b.changeMonth=$,b.changeYear=Z,b.clear=function(e,t){if(void 0===e&&(e=!0),void 0===t&&(t=!0),b.input.value="",void 0!==b.altInput&&(b.altInput.value=""),void 0!==b.mobileInput&&(b.mobileInput.value=""),b.selectedDates=[],b.latestSelectedDateObj=void 0,!0===t&&(b.currentYear=b._initialDate.getFullYear(),b.currentMonth=b._initialDate.getMonth()),!0===b.config.enableTime){var n=O(),o=n.hours,a=n.minutes,i=n.seconds;_(o,a,i)}b.redraw(),e&&me("onChange")},b.close=function(){b.isOpen=!1,b.isMobile||(void 0!==b.calendarContainer&&b.calendarContainer.classList.remove("open"),void 0!==b._input&&b._input.classList.remove("active")),me("onClose")},b._createElement=u,b.destroy=function(){void 0!==b.config&&me("onDestroy");for(var e=b._handlers.length;e--;){var t=b._handlers[e];t.element.removeEventListener(t.event,t.handler,t.options)}if(b._handlers=[],b.mobileInput)b.mobileInput.parentNode&&b.mobileInput.parentNode.removeChild(b.mobileInput),b.mobileInput=void 0;else if(b.calendarContainer&&b.calendarContainer.parentNode)if(b.config.static&&b.calendarContainer.parentNode){var n=b.calendarContainer.parentNode;if(n.lastChild&&n.removeChild(n.lastChild),n.parentNode){for(;n.firstChild;)n.parentNode.insertBefore(n.firstChild,n);n.parentNode.removeChild(n)}}else b.calendarContainer.parentNode.removeChild(b.calendarContainer);b.altInput&&(b.input.type="text",b.altInput.parentNode&&b.altInput.parentNode.removeChild(b.altInput),delete b.altInput),b.input&&(b.input.type=b.input._type,b.input.classList.remove("flatpickr-input"),b.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach((function(e){try{delete b[e]}catch(e){}}))},b.isEnabled=Q,b.jumpToDate=F,b.open=function(e,t){if(void 0===t&&(t=b._positionElement),!0===b.isMobile){if(e){e.preventDefault();var n=f(e);n&&n.blur()}return void 0!==b.mobileInput&&(b.mobileInput.focus(),b.mobileInput.click()),void me("onOpen")}if(!b._input.disabled&&!b.config.inline){var o=b.isOpen;b.isOpen=!0,o||(b.calendarContainer.classList.add("open"),b._input.classList.add("active"),me("onOpen"),le(t)),!0===b.config.enableTime&&!0===b.config.noCalendar&&(!1!==b.config.allowInput||void 0!==e&&b.timeContainer.contains(e.relatedTarget)||setTimeout((function(){return b.hourElement.select()}),50))}},b.redraw=se,b.set=function(e,t){if(null!==e&&"object"==typeof e)for(var o in Object.assign(b.config,e),e)void 0!==de[o]&&de[o].forEach((function(e){return e()}));else b.config[e]=t,void 0!==de[e]?de[e].forEach((function(e){return e()})):n.indexOf(e)>-1&&(b.config[e]=s(t));b.redraw(),De(!0)},b.setDate=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=b.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return b.clear(t);pe(e,n),b.latestSelectedDateObj=b.selectedDates[b.selectedDates.length-1],b.redraw(),F(void 0,t),T(),0===b.selectedDates.length&&b.clear(!1),De(t),t&&me("onChange")},b.toggle=function(e){if(!0===b.isOpen)return b.close();b.open(e)};var de={locale:[re,U],showMonths:[J,x,K],minDate:[F],maxDate:[F]};function pe(e,t){var n=[];if(e instanceof Array)n=e.map((function(e){return b.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)n=[b.parseDate(e,t)];else if("string"==typeof e)switch(b.config.mode){case"single":case"time":n=[b.parseDate(e,t)];break;case"multiple":n=e.split(b.config.conjunction).map((function(e){return b.parseDate(e,t)}));break;case"range":n=e.split(b.l10n.rangeSeparator).map((function(e){return b.parseDate(e,t)}))}else b.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));b.selectedDates=b.config.allowInvalidPreload?n:n.filter((function(e){return e instanceof Date&&Q(e,!1)})),"range"===b.config.mode&&b.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()}))}function fe(e){return e.slice().map((function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?b.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:b.parseDate(e.from,void 0),to:b.parseDate(e.to,void 0)}:e})).filter((function(e){return e}))}function me(e,t){if(void 0!==b.config){var n=b.config[e];if(void 0!==n&&n.length>0)for(var o=0;n[o]&&o1||"static"===b.config.monthSelectorType?b.monthElements[t].textContent=h(n.getMonth(),b.config.shorthandCurrentMonth,b.l10n)+" ":b.monthsDropdownContainer.value=n.getMonth().toString(),e.value=n.getFullYear().toString()})),b._hidePrevMonthArrow=void 0!==b.config.minDate&&(b.currentYear===b.config.minDate.getFullYear()?b.currentMonth<=b.config.minDate.getMonth():b.currentYearb.config.maxDate.getMonth():b.currentYear>b.config.maxDate.getFullYear()))}function be(e){return b.selectedDates.map((function(t){return b.formatDate(t,e)})).filter((function(e,t,n){return"range"!==b.config.mode||b.config.enableTime||n.indexOf(e)===t})).join("range"!==b.config.mode?b.config.conjunction:b.l10n.rangeSeparator)}function De(e){void 0===e&&(e=!0),void 0!==b.mobileInput&&b.mobileFormatStr&&(b.mobileInput.value=void 0!==b.latestSelectedDateObj?b.formatDate(b.latestSelectedDateObj,b.mobileFormatStr):""),b.input.value=be(b.config.dateFormat),void 0!==b.altInput&&(b.altInput.value=be(b.config.altFormat)),!1!==e&&me("onValueUpdate")}function ye(e){var t=f(e),n=b.prevMonthNav.contains(t),o=b.nextMonthNav.contains(t);n||o?$(n?-1:1):b.yearElements.indexOf(t)>=0?t.select():t.classList.contains("arrowUp")?b.changeYear(b.currentYear+1):t.classList.contains("arrowDown")&&b.changeYear(b.currentYear-1)}return function(){b.element=b.input=m,b.isOpen=!1,function(){var t=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=e(e({},JSON.parse(JSON.stringify(m.dataset||{}))),g),i={};b.config.parseDate=a.parseDate,b.config.formatDate=a.formatDate,Object.defineProperty(b.config,"enable",{get:function(){return b.config._enable},set:function(e){b.config._enable=fe(e)}}),Object.defineProperty(b.config,"disable",{get:function(){return b.config._disable},set:function(e){b.config._disable=fe(e)}});var r="time"===a.mode;if(!a.dateFormat&&(a.enableTime||r)){var l=E.defaultConfig.dateFormat||o.dateFormat;i.dateFormat=a.noCalendar||r?"H:i"+(a.enableSeconds?":S":""):l+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||r)&&!a.altFormat){var c=E.defaultConfig.altFormat||o.altFormat;i.altFormat=a.noCalendar||r?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}Object.defineProperty(b.config,"minDate",{get:function(){return b.config._minDate},set:ae("min")}),Object.defineProperty(b.config,"maxDate",{get:function(){return b.config._maxDate},set:ae("max")});var u=function(e){return function(t){b.config["min"===e?"_minTime":"_maxTime"]=b.parseDate(t,"H:i:S")}};Object.defineProperty(b.config,"minTime",{get:function(){return b.config._minTime},set:u("min")}),Object.defineProperty(b.config,"maxTime",{get:function(){return b.config._maxTime},set:u("max")}),"time"===a.mode&&(b.config.noCalendar=!0,b.config.enableTime=!0),Object.assign(b.config,i,a);for(var d=0;d-1?b.config[f]=s(p[f]).map(C).concat(b.config[f]):void 0===a[f]&&(b.config[f]=p[f])}a.altInputClass||(b.config.altInputClass=ie().className+" "+b.config.altInputClass),me("onParseConfig")}(),re(),b.input=ie(),b.input?(b.input._type=b.input.type,b.input.type="text",b.input.classList.add("flatpickr-input"),b._input=b.input,b.config.altInput&&(b.altInput=u(b.input.nodeName,b.config.altInputClass),b._input=b.altInput,b.altInput.placeholder=b.input.placeholder,b.altInput.disabled=b.input.disabled,b.altInput.required=b.input.required,b.altInput.tabIndex=b.input.tabIndex,b.altInput.type="text",b.input.setAttribute("type","hidden"),!b.config.static&&b.input.parentNode&&b.input.parentNode.insertBefore(b.altInput,b.input.nextSibling)),b.config.allowInput||b._input.setAttribute("readonly","readonly"),b._positionElement=b.config.positionElement||b._input):b.config.errorHandler(new Error("Invalid input element specified")),function(){b.selectedDates=[],b.now=b.parseDate(b.config.now)||new Date;var e=b.config.defaultDate||("INPUT"!==b.input.nodeName&&"TEXTAREA"!==b.input.nodeName||!b.input.placeholder||b.input.value!==b.input.placeholder?b.input.value:null);e&&pe(e,b.config.dateFormat),b._initialDate=b.selectedDates.length>0?b.selectedDates[0]:b.config.minDate&&b.config.minDate.getTime()>b.now.getTime()?b.config.minDate:b.config.maxDate&&b.config.maxDate.getTime()0&&(b.latestSelectedDateObj=b.selectedDates[0]),void 0!==b.config.minTime&&(b.config.minTime=b.parseDate(b.config.minTime,"H:i")),void 0!==b.config.maxTime&&(b.config.maxTime=b.parseDate(b.config.maxTime,"H:i")),b.minDateHasTime=!!b.config.minDate&&(b.config.minDate.getHours()>0||b.config.minDate.getMinutes()>0||b.config.minDate.getSeconds()>0),b.maxDateHasTime=!!b.config.maxDate&&(b.config.maxDate.getHours()>0||b.config.maxDate.getMinutes()>0||b.config.maxDate.getSeconds()>0)}(),b.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=b.currentMonth),void 0===t&&(t=b.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:b.l10n.daysInMonth[e]}},b.isMobile||function(){var e=window.document.createDocumentFragment();if(b.calendarContainer=u("div","flatpickr-calendar"),b.calendarContainer.tabIndex=-1,!b.config.noCalendar){if(e.appendChild((b.monthNav=u("div","flatpickr-months"),b.yearElements=[],b.monthElements=[],b.prevMonthNav=u("span","flatpickr-prev-month"),b.prevMonthNav.innerHTML=b.config.prevArrow,b.nextMonthNav=u("span","flatpickr-next-month"),b.nextMonthNav.innerHTML=b.config.nextArrow,J(),Object.defineProperty(b,"_hidePrevMonthArrow",{get:function(){return b.__hidePrevMonthArrow},set:function(e){b.__hidePrevMonthArrow!==e&&(c(b.prevMonthNav,"flatpickr-disabled",e),b.__hidePrevMonthArrow=e)}}),Object.defineProperty(b,"_hideNextMonthArrow",{get:function(){return b.__hideNextMonthArrow},set:function(e){b.__hideNextMonthArrow!==e&&(c(b.nextMonthNav,"flatpickr-disabled",e),b.__hideNextMonthArrow=e)}}),b.currentYearElement=b.yearElements[0],ve(),b.monthNav)),b.innerContainer=u("div","flatpickr-innerContainer"),b.config.weekNumbers){var t=function(){b.calendarContainer.classList.add("hasWeeks");var e=u("div","flatpickr-weekwrapper");e.appendChild(u("span","flatpickr-weekday",b.l10n.weekAbbreviation));var t=u("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),n=t.weekWrapper,o=t.weekNumbers;b.innerContainer.appendChild(n),b.weekNumbers=o,b.weekWrapper=n}b.rContainer=u("div","flatpickr-rContainer"),b.rContainer.appendChild(K()),b.daysContainer||(b.daysContainer=u("div","flatpickr-days"),b.daysContainer.tabIndex=-1),R(),b.rContainer.appendChild(b.daysContainer),b.innerContainer.appendChild(b.rContainer),e.appendChild(b.innerContainer)}b.config.enableTime&&e.appendChild(function(){b.calendarContainer.classList.add("hasTime"),b.config.noCalendar&&b.calendarContainer.classList.add("noCalendar"),b.timeContainer=u("div","flatpickr-time"),b.timeContainer.tabIndex=-1;var e=u("span","flatpickr-time-separator",":"),t=p("flatpickr-hour",{"aria-label":b.l10n.hourAriaLabel});b.hourElement=t.getElementsByTagName("input")[0];var n=p("flatpickr-minute",{"aria-label":b.l10n.minuteAriaLabel});if(b.minuteElement=n.getElementsByTagName("input")[0],b.hourElement.tabIndex=b.minuteElement.tabIndex=-1,b.hourElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getHours():b.config.time_24hr?b.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(b.config.defaultHour)),b.minuteElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getMinutes():b.config.defaultMinute),b.hourElement.setAttribute("step",b.config.hourIncrement.toString()),b.minuteElement.setAttribute("step",b.config.minuteIncrement.toString()),b.hourElement.setAttribute("min",b.config.time_24hr?"0":"1"),b.hourElement.setAttribute("max",b.config.time_24hr?"23":"12"),b.minuteElement.setAttribute("min","0"),b.minuteElement.setAttribute("max","59"),b.timeContainer.appendChild(t),b.timeContainer.appendChild(e),b.timeContainer.appendChild(n),b.config.time_24hr&&b.timeContainer.classList.add("time24hr"),b.config.enableSeconds){b.timeContainer.classList.add("hasSeconds");var o=p("flatpickr-second");b.secondElement=o.getElementsByTagName("input")[0],b.secondElement.value=i(b.latestSelectedDateObj?b.latestSelectedDateObj.getSeconds():b.config.defaultSeconds),b.secondElement.setAttribute("step",b.minuteElement.getAttribute("step")),b.secondElement.setAttribute("min","0"),b.secondElement.setAttribute("max","59"),b.timeContainer.appendChild(u("span","flatpickr-time-separator",":")),b.timeContainer.appendChild(o)}return b.config.time_24hr||(b.amPM=u("span","flatpickr-am-pm",b.l10n.amPM[r((b.latestSelectedDateObj?b.hourElement.value:b.config.defaultHour)>11)]),b.amPM.title=b.l10n.toggleTitle,b.amPM.tabIndex=-1,b.timeContainer.appendChild(b.amPM)),b.timeContainer}()),c(b.calendarContainer,"rangeMode","range"===b.config.mode),c(b.calendarContainer,"animate",!0===b.config.animate),c(b.calendarContainer,"multiMonth",b.config.showMonths>1),b.calendarContainer.appendChild(e);var a=void 0!==b.config.appendTo&&void 0!==b.config.appendTo.nodeType;if((b.config.inline||b.config.static)&&(b.calendarContainer.classList.add(b.config.inline?"inline":"static"),b.config.inline&&(!a&&b.element.parentNode?b.element.parentNode.insertBefore(b.calendarContainer,b._input.nextSibling):void 0!==b.config.appendTo&&b.config.appendTo.appendChild(b.calendarContainer)),b.config.static)){var l=u("div","flatpickr-wrapper");b.element.parentNode&&b.element.parentNode.insertBefore(l,b.element),l.appendChild(b.element),b.altInput&&l.appendChild(b.altInput),l.appendChild(b.calendarContainer)}b.config.static||b.config.inline||(void 0!==b.config.appendTo?b.config.appendTo:window.document.body).appendChild(b.calendarContainer)}(),function(){if(b.config.wrap&&["open","close","toggle","clear"].forEach((function(e){Array.prototype.forEach.call(b.element.querySelectorAll("[data-"+e+"]"),(function(t){return I(t,"click",b[e])}))})),b.isMobile)!function(){var e=b.config.enableTime?b.config.noCalendar?"time":"datetime-local":"date";b.mobileInput=u("input",b.input.className+" flatpickr-mobile"),b.mobileInput.tabIndex=1,b.mobileInput.type=e,b.mobileInput.disabled=b.input.disabled,b.mobileInput.required=b.input.required,b.mobileInput.placeholder=b.input.placeholder,b.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",b.selectedDates.length>0&&(b.mobileInput.defaultValue=b.mobileInput.value=b.formatDate(b.selectedDates[0],b.mobileFormatStr)),b.config.minDate&&(b.mobileInput.min=b.formatDate(b.config.minDate,"Y-m-d")),b.config.maxDate&&(b.mobileInput.max=b.formatDate(b.config.maxDate,"Y-m-d")),b.input.getAttribute("step")&&(b.mobileInput.step=String(b.input.getAttribute("step"))),b.input.type="hidden",void 0!==b.altInput&&(b.altInput.type="hidden");try{b.input.parentNode&&b.input.parentNode.insertBefore(b.mobileInput,b.input.nextSibling)}catch(e){}I(b.mobileInput,"change",(function(e){b.setDate(f(e).value,!1,b.mobileFormatStr),me("onChange"),me("onClose")}))}();else{var e=l(oe,50);b._debouncedChange=l(S,300),b.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&I(b.daysContainer,"mouseover",(function(e){"range"===b.config.mode&&ne(f(e))})),I(window.document.body,"keydown",te),b.config.inline||b.config.static||I(window,"resize",e),void 0!==window.ontouchstart?I(window.document,"touchstart",G):I(window.document,"click",G),I(window.document,"focus",G,{capture:!0}),!0===b.config.clickOpens&&(I(b._input,"focus",b.open),I(b._input,"click",b.open)),void 0!==b.daysContainer&&(I(b.monthNav,"click",ye),I(b.monthNav,["keyup","increment"],N),I(b.daysContainer,"click",ue)),void 0!==b.timeContainer&&void 0!==b.minuteElement&&void 0!==b.hourElement&&(I(b.timeContainer,["increment"],P),I(b.timeContainer,"blur",P,{capture:!0}),I(b.timeContainer,"click",A),I([b.hourElement,b.minuteElement],["focus","click"],(function(e){return f(e).select()})),void 0!==b.secondElement&&I(b.secondElement,"focus",(function(){return b.secondElement&&b.secondElement.select()})),void 0!==b.amPM&&I(b.amPM,"click",(function(e){P(e),S()}))),b.config.allowInput&&I(b._input,"blur",ee)}}(),(b.selectedDates.length||b.config.noCalendar)&&(b.config.enableTime&&T(b.config.noCalendar?b.latestSelectedDateObj||b.config.minDate:void 0),De(!1)),x();var t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!b.isMobile&&t&&le(),me("onReady")}(),b}function x(e,t){for(var n=Array.prototype.slice.call(e).filter((function(e){return e instanceof HTMLElement})),o=[],a=0;a=2?M.a.component({type:"button",className:"Button Button--warning PollModal--button",icon:"fas fa-minus",onclick:n>=2?e.removeOption.bind(e,n):""}):"")}))},n.addOption=function(){var e=app.data["fof-polls.options.max"],t=e&&parseInt(e)||11;this.options.length=2?M.a.component({type:"button",className:"Button PollModal--button",icon:"fas fa-minus",onclick:n>=2?e.removeOption.bind(e,n):""}):"")}))},n.addOption=function(){var e=app.data["fof-polls.options.max"],t=e&&parseInt(e)||11;this.options.length\",\n noCalendar: false,\n now: new Date(),\n onChange: [],\n onClose: [],\n onDayCreate: [],\n onDestroy: [],\n onKeyDown: [],\n onMonthChange: [],\n onOpen: [],\n onParseConfig: [],\n onReady: [],\n onValueUpdate: [],\n onYearChange: [],\n onPreCalendarPosition: [],\n plugins: [],\n position: \"auto\",\n positionElement: undefined,\n prevArrow: \"\",\n shorthandCurrentMonth: false,\n showMonths: 1,\n static: false,\n time_24hr: false,\n weekNumbers: false,\n wrap: false,\n };\n\n var english = {\n weekdays: {\n shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n longhand: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n },\n months: {\n shorthand: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n longhand: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n },\n daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n firstDayOfWeek: 0,\n ordinal: function (nth) {\n var s = nth % 100;\n if (s > 3 && s < 21)\n return \"th\";\n switch (s % 10) {\n case 1:\n return \"st\";\n case 2:\n return \"nd\";\n case 3:\n return \"rd\";\n default:\n return \"th\";\n }\n },\n rangeSeparator: \" to \",\n weekAbbreviation: \"Wk\",\n scrollTitle: \"Scroll to increment\",\n toggleTitle: \"Click to toggle\",\n amPM: [\"AM\", \"PM\"],\n yearAriaLabel: \"Year\",\n monthAriaLabel: \"Month\",\n hourAriaLabel: \"Hour\",\n minuteAriaLabel: \"Minute\",\n time_24hr: false,\n };\n\n var pad = function (number, length) {\n if (length === void 0) { length = 2; }\n return (\"000\" + number).slice(length * -1);\n };\n var int = function (bool) { return (bool === true ? 1 : 0); };\n /* istanbul ignore next */\n function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n return function () {\n var context = this, args = arguments;\n timeout !== null && clearTimeout(timeout);\n timeout = window.setTimeout(function () {\n timeout = null;\n if (!immediate)\n func.apply(context, args);\n }, wait);\n if (immediate && !timeout)\n func.apply(context, args);\n };\n }\n var arrayify = function (obj) {\n return obj instanceof Array ? obj : [obj];\n };\n\n function toggleClass(elem, className, bool) {\n if (bool === true)\n return elem.classList.add(className);\n elem.classList.remove(className);\n }\n function createElement(tag, className, content) {\n var e = window.document.createElement(tag);\n className = className || \"\";\n content = content || \"\";\n e.className = className;\n if (content !== undefined)\n e.textContent = content;\n return e;\n }\n function clearNode(node) {\n while (node.firstChild)\n node.removeChild(node.firstChild);\n }\n function findParent(node, condition) {\n if (condition(node))\n return node;\n else if (node.parentNode)\n return findParent(node.parentNode, condition);\n return undefined; // nothing found\n }\n function createNumberInput(inputClassName, opts) {\n var wrapper = createElement(\"div\", \"numInputWrapper\"), numInput = createElement(\"input\", \"numInput \" + inputClassName), arrowUp = createElement(\"span\", \"arrowUp\"), arrowDown = createElement(\"span\", \"arrowDown\");\n if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n }\n else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\n }\n if (opts !== undefined)\n for (var key in opts)\n numInput.setAttribute(key, opts[key]);\n wrapper.appendChild(numInput);\n wrapper.appendChild(arrowUp);\n wrapper.appendChild(arrowDown);\n return wrapper;\n }\n function getEventTarget(event) {\n try {\n if (typeof event.composedPath === \"function\") {\n var path = event.composedPath();\n return path[0];\n }\n return event.target;\n }\n catch (error) {\n return event.target;\n }\n }\n\n var doNothing = function () { return undefined; };\n var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber]; };\n var revFormat = {\n D: doNothing,\n F: function (dateObj, monthName, locale) {\n dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n },\n G: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n H: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n J: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n K: function (dateObj, amPM, locale) {\n dateObj.setHours((dateObj.getHours() % 12) +\n 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n },\n M: function (dateObj, shortMonth, locale) {\n dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n },\n S: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },\n W: function (dateObj, weekNum, locale) {\n var weekNumber = parseInt(weekNum);\n var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n return date;\n },\n Y: function (dateObj, year) {\n dateObj.setFullYear(parseFloat(year));\n },\n Z: function (_, ISODate) { return new Date(ISODate); },\n d: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n h: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n i: function (dateObj, minutes) {\n dateObj.setMinutes(parseFloat(minutes));\n },\n j: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n l: doNothing,\n m: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n n: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n s: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n u: function (_, unixMillSeconds) {\n return new Date(parseFloat(unixMillSeconds));\n },\n w: doNothing,\n y: function (dateObj, year) {\n dateObj.setFullYear(2000 + parseFloat(year));\n },\n };\n var tokenRegex = {\n D: \"(\\\\w+)\",\n F: \"(\\\\w+)\",\n G: \"(\\\\d\\\\d|\\\\d)\",\n H: \"(\\\\d\\\\d|\\\\d)\",\n J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n K: \"\",\n M: \"(\\\\w+)\",\n S: \"(\\\\d\\\\d|\\\\d)\",\n U: \"(.+)\",\n W: \"(\\\\d\\\\d|\\\\d)\",\n Y: \"(\\\\d{4})\",\n Z: \"(.+)\",\n d: \"(\\\\d\\\\d|\\\\d)\",\n h: \"(\\\\d\\\\d|\\\\d)\",\n i: \"(\\\\d\\\\d|\\\\d)\",\n j: \"(\\\\d\\\\d|\\\\d)\",\n l: \"(\\\\w+)\",\n m: \"(\\\\d\\\\d|\\\\d)\",\n n: \"(\\\\d\\\\d|\\\\d)\",\n s: \"(\\\\d\\\\d|\\\\d)\",\n u: \"(.+)\",\n w: \"(\\\\d\\\\d|\\\\d)\",\n y: \"(\\\\d{2})\",\n };\n var formats = {\n // get the date in UTC\n Z: function (date) { return date.toISOString(); },\n // weekday name, short, e.g. Thu\n D: function (date, locale, options) {\n return locale.weekdays.shorthand[formats.w(date, locale, options)];\n },\n // full month name e.g. January\n F: function (date, locale, options) {\n return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n },\n // padded hour 1-12\n G: function (date, locale, options) {\n return pad(formats.h(date, locale, options));\n },\n // hours with leading zero e.g. 03\n H: function (date) { return pad(date.getHours()); },\n // day (1-30) with ordinal suffix e.g. 1st, 2nd\n J: function (date, locale) {\n return locale.ordinal !== undefined\n ? date.getDate() + locale.ordinal(date.getDate())\n : date.getDate();\n },\n // AM/PM\n K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },\n // shorthand month e.g. Jan, Sep, Oct, etc\n M: function (date, locale) {\n return monthToStr(date.getMonth(), true, locale);\n },\n // seconds 00-59\n S: function (date) { return pad(date.getSeconds()); },\n // unix timestamp\n U: function (date) { return date.getTime() / 1000; },\n W: function (date, _, options) {\n return options.getWeek(date);\n },\n // full year e.g. 2016, padded (0001-9999)\n Y: function (date) { return pad(date.getFullYear(), 4); },\n // day in month, padded (01-30)\n d: function (date) { return pad(date.getDate()); },\n // hour from 1-12 (am/pm)\n h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },\n // minutes, padded with leading zero e.g. 09\n i: function (date) { return pad(date.getMinutes()); },\n // day in month (1-30)\n j: function (date) { return date.getDate(); },\n // weekday name, full, e.g. Thursday\n l: function (date, locale) {\n return locale.weekdays.longhand[date.getDay()];\n },\n // padded month number (01-12)\n m: function (date) { return pad(date.getMonth() + 1); },\n // the month number (1-12)\n n: function (date) { return date.getMonth() + 1; },\n // seconds 0-59\n s: function (date) { return date.getSeconds(); },\n // Unix Milliseconds\n u: function (date) { return date.getTime(); },\n // number of the day of the week\n w: function (date) { return date.getDay(); },\n // last two digits of year e.g. 16 for 2016\n y: function (date) { return String(date.getFullYear()).substring(2); },\n };\n\n var createDateFormatter = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;\n return function (dateObj, frmt, overrideLocale) {\n var locale = overrideLocale || l10n;\n if (config.formatDate !== undefined && !isMobile) {\n return config.formatDate(dateObj, frmt, locale);\n }\n return frmt\n .split(\"\")\n .map(function (c, i, arr) {\n return formats[c] && arr[i - 1] !== \"\\\\\"\n ? formats[c](dateObj, locale, config)\n : c !== \"\\\\\"\n ? c\n : \"\";\n })\n .join(\"\");\n };\n };\n var createDateParser = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n return function (date, givenFormat, timeless, customLocale) {\n if (date !== 0 && !date)\n return undefined;\n var locale = customLocale || l10n;\n var parsedDate;\n var dateOrig = date;\n if (date instanceof Date)\n parsedDate = new Date(date.getTime());\n else if (typeof date !== \"string\" &&\n date.toFixed !== undefined // timestamp\n )\n // create a copy\n parsedDate = new Date(date);\n else if (typeof date === \"string\") {\n // date string\n var format = givenFormat || (config || defaults).dateFormat;\n var datestr = String(date).trim();\n if (datestr === \"today\") {\n parsedDate = new Date();\n timeless = true;\n }\n else if (/Z$/.test(datestr) ||\n /GMT$/.test(datestr) // datestrings w/ timezone\n )\n parsedDate = new Date(date);\n else if (config && config.parseDate)\n parsedDate = config.parseDate(date, format);\n else {\n parsedDate =\n !config || !config.noCalendar\n ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)\n : new Date(new Date().setHours(0, 0, 0, 0));\n var matched = void 0, ops = [];\n for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n var token_1 = format[i];\n var isBackSlash = token_1 === \"\\\\\";\n var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n if (tokenRegex[token_1] && !escaped) {\n regexStr += tokenRegex[token_1];\n var match = new RegExp(regexStr).exec(date);\n if (match && (matched = true)) {\n ops[token_1 !== \"Y\" ? \"push\" : \"unshift\"]({\n fn: revFormat[token_1],\n val: match[++matchIndex],\n });\n }\n }\n else if (!isBackSlash)\n regexStr += \".\"; // don't really care\n ops.forEach(function (_a) {\n var fn = _a.fn, val = _a.val;\n return (parsedDate = fn(parsedDate, val, locale) || parsedDate);\n });\n }\n parsedDate = matched ? parsedDate : undefined;\n }\n }\n /* istanbul ignore next */\n if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\n }\n if (timeless === true)\n parsedDate.setHours(0, 0, 0, 0);\n return parsedDate;\n };\n };\n /**\n * Compute the difference in dates, measured in ms\n */\n function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }\n var isBetween = function (ts, ts1, ts2) {\n return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n };\n var duration = {\n DAY: 86400000,\n };\n\n if (typeof Object.assign !== \"function\") {\n Object.assign = function (target) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\n }\n var _loop_1 = function (source) {\n if (source) {\n Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });\n }\n };\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n _loop_1(source);\n }\n return target;\n };\n }\n\n var DEBOUNCED_CHANGE_MS = 300;\n function FlatpickrInstance(element, instanceConfig) {\n var self = {\n config: __assign(__assign({}, defaults), flatpickr.defaultConfig),\n l10n: english,\n };\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n self._handlers = [];\n self.pluginElements = [];\n self.loadedPlugins = [];\n self._bind = bind;\n self._setHoursFromDate = setHoursFromDate;\n self._positionCalendar = positionCalendar;\n self.changeMonth = changeMonth;\n self.changeYear = changeYear;\n self.clear = clear;\n self.close = close;\n self._createElement = createElement;\n self.destroy = destroy;\n self.isEnabled = isEnabled;\n self.jumpToDate = jumpToDate;\n self.open = open;\n self.redraw = redraw;\n self.set = set;\n self.setDate = setDate;\n self.toggle = toggle;\n function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function (month, yr) {\n if (month === void 0) { month = self.currentMonth; }\n if (yr === void 0) { yr = self.currentYear; }\n if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))\n return 29;\n return self.l10n.daysInMonth[month];\n },\n };\n }\n function init() {\n self.element = self.input = element;\n self.isOpen = false;\n parseConfig();\n setupLocale();\n setupInputs();\n setupDates();\n setupHelperFunctions();\n if (!self.isMobile)\n build();\n bindEvents();\n if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar\n ? self.latestSelectedDateObj || self.config.minDate\n : undefined);\n }\n updateValue(false);\n }\n setCalendarWidth();\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n /* TODO: investigate this further\n \n Currently, there is weird positioning behavior in safari causing pages\n to scroll up. https://github.com/chmln/flatpickr/issues/563\n \n However, most browsers are not Safari and positioning is expensive when used\n in scale. https://github.com/chmln/flatpickr/issues/1096\n */\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n triggerEvent(\"onReady\");\n }\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n function setCalendarWidth() {\n var config = self.config;\n if (config.weekNumbers === false && config.showMonths === 1) {\n return;\n }\n else if (config.noCalendar !== true) {\n window.requestAnimationFrame(function () {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.style.visibility = \"hidden\";\n self.calendarContainer.style.display = \"block\";\n }\n if (self.daysContainer !== undefined) {\n var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n self.daysContainer.style.width = daysWidth + \"px\";\n self.calendarContainer.style.width =\n daysWidth +\n (self.weekWrapper !== undefined\n ? self.weekWrapper.offsetWidth\n : 0) +\n \"px\";\n self.calendarContainer.style.removeProperty(\"visibility\");\n self.calendarContainer.style.removeProperty(\"display\");\n }\n });\n }\n }\n /**\n * The handler for all events targeting the time inputs\n */\n function updateTime(e) {\n if (self.selectedDates.length === 0) {\n var defaultDate = self.config.minDate !== undefined\n ? new Date(self.config.minDate.getTime())\n : new Date();\n var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;\n defaultDate.setHours(hours, minutes, seconds, 0);\n self.setDate(defaultDate, false);\n }\n if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n function ampm2military(hour, amPM) {\n return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);\n }\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n default:\n return hour % 12;\n }\n }\n /**\n * Syncs the selected date object time with user's time input\n */\n function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined)\n return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n ? (parseInt(self.secondElement.value, 10) || 0) % 60\n : 0;\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n var limitMinHours = self.config.minTime !== undefined ||\n (self.config.minDate &&\n self.minDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n 0);\n var limitMaxHours = self.config.maxTime !== undefined ||\n (self.config.maxDate &&\n self.maxDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n 0);\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined\n ? self.config.maxTime\n : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours())\n minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes())\n seconds = Math.min(seconds, maxTime.getSeconds());\n }\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined\n ? self.config.minTime\n : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours())\n minutes = Math.max(minutes, minTime.getMinutes());\n if (minutes === minTime.getMinutes())\n seconds = Math.max(seconds, minTime.getSeconds());\n }\n setHours(hours, minutes, seconds);\n }\n /**\n * Syncs time input values with a date\n */\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n if (date) {\n setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n }\n }\n function getDefaultHours() {\n var hours = self.config.defaultHour;\n var minutes = self.config.defaultMinute;\n var seconds = self.config.defaultSeconds;\n if (self.config.minDate !== undefined) {\n var minHr = self.config.minDate.getHours();\n var minMinutes = self.config.minDate.getMinutes();\n hours = Math.max(hours, minHr);\n if (hours === minHr)\n minutes = Math.max(minMinutes, minutes);\n if (hours === minHr && minutes === minMinutes)\n seconds = self.config.minDate.getSeconds();\n }\n if (self.config.maxDate !== undefined) {\n var maxHr = self.config.maxDate.getHours();\n var maxMinutes = self.config.maxDate.getMinutes();\n hours = Math.min(hours, maxHr);\n if (hours === maxHr)\n minutes = Math.min(maxMinutes, minutes);\n if (hours === maxHr && minutes === maxMinutes)\n seconds = self.config.maxDate.getSeconds();\n }\n return { hours: hours, minutes: minutes, seconds: seconds };\n }\n /**\n * Sets the hours, minutes, and optionally seconds\n * of the latest selected date object and the\n * corresponding time inputs\n * @param {Number} hours the hour. whether its military\n * or am-pm gets inferred from config\n * @param {Number} minutes the minutes\n * @param {Number} seconds the seconds (optional)\n */\n function setHours(hours, minutes, seconds) {\n if (self.latestSelectedDateObj !== undefined) {\n self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n }\n if (!self.hourElement || !self.minuteElement || self.isMobile)\n return;\n self.hourElement.value = pad(!self.config.time_24hr\n ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)\n : hours);\n self.minuteElement.value = pad(minutes);\n if (self.amPM !== undefined)\n self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n if (self.secondElement !== undefined)\n self.secondElement.value = pad(seconds);\n }\n /**\n * Handles the year input and incrementing events\n * @param {Event} event the keyup or increment event\n */\n function onYearInput(event) {\n var eventTarget = getEventTarget(event);\n var year = parseInt(eventTarget.value) + (event.delta || 0);\n if (year / 1000 > 1 ||\n (event.key === \"Enter\" && !/[^\\d]/.test(year.toString()))) {\n changeYear(year);\n }\n }\n /**\n * Essentially addEventListener + tracking\n * @param {Element} element the element to addEventListener to\n * @param {String} event the event name\n * @param {Function} handler the event handler\n */\n function bind(element, event, handler, options) {\n if (event instanceof Array)\n return event.forEach(function (ev) { return bind(element, ev, handler, options); });\n if (element instanceof Array)\n return element.forEach(function (el) { return bind(el, event, handler, options); });\n element.addEventListener(event, handler, options);\n self._handlers.push({\n element: element,\n event: event,\n handler: handler,\n options: options,\n });\n }\n function triggerChange() {\n triggerEvent(\"onChange\");\n }\n /**\n * Adds all the necessary event listeners\n */\n function bindEvents() {\n if (self.config.wrap) {\n [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n return bind(el, \"click\", self[evt]);\n });\n });\n }\n if (self.isMobile) {\n setupMobile();\n return;\n }\n var debouncedResize = debounce(onResize, 50);\n self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))\n bind(self.daysContainer, \"mouseover\", function (e) {\n if (self.config.mode === \"range\")\n onMouseOver(getEventTarget(e));\n });\n bind(window.document.body, \"keydown\", onKeyDown);\n if (!self.config.inline && !self.config.static)\n bind(window, \"resize\", debouncedResize);\n if (window.ontouchstart !== undefined)\n bind(window.document, \"touchstart\", documentClick);\n else\n bind(window.document, \"click\", documentClick);\n bind(window.document, \"focus\", documentClick, { capture: true });\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n }\n if (self.daysContainer !== undefined) {\n bind(self.monthNav, \"click\", onMonthNavClick);\n bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n bind(self.daysContainer, \"click\", selectDate);\n }\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined) {\n var selText = function (e) {\n return getEventTarget(e).select();\n };\n bind(self.timeContainer, [\"increment\"], updateTime);\n bind(self.timeContainer, \"blur\", updateTime, { capture: true });\n bind(self.timeContainer, \"click\", timeIncrement);\n bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n if (self.secondElement !== undefined)\n bind(self.secondElement, \"focus\", function () { return self.secondElement && self.secondElement.select(); });\n if (self.amPM !== undefined) {\n bind(self.amPM, \"click\", function (e) {\n updateTime(e);\n triggerChange();\n });\n }\n }\n if (self.config.allowInput)\n bind(self._input, \"blur\", onBlur);\n }\n /**\n * Set the calendar view to a particular date.\n * @param {Date} jumpDate the date to set the view to\n * @param {boolean} triggerChange if change events should be triggered\n */\n function jumpToDate(jumpDate, triggerChange) {\n var jumpTo = jumpDate !== undefined\n ? self.parseDate(jumpDate)\n : self.latestSelectedDateObj ||\n (self.config.minDate && self.config.minDate > self.now\n ? self.config.minDate\n : self.config.maxDate && self.config.maxDate < self.now\n ? self.config.maxDate\n : self.now);\n var oldYear = self.currentYear;\n var oldMonth = self.currentMonth;\n try {\n if (jumpTo !== undefined) {\n self.currentYear = jumpTo.getFullYear();\n self.currentMonth = jumpTo.getMonth();\n }\n }\n catch (e) {\n /* istanbul ignore next */\n e.message = \"Invalid date supplied: \" + jumpTo;\n self.config.errorHandler(e);\n }\n if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n if (triggerChange &&\n (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n self.redraw();\n }\n /**\n * The up/down arrow handler for time inputs\n * @param {Event} e the click event\n */\n function timeIncrement(e) {\n var eventTarget = getEventTarget(e);\n if (~eventTarget.className.indexOf(\"arrow\"))\n incrementNumInput(e, eventTarget.classList.contains(\"arrowUp\") ? 1 : -1);\n }\n /**\n * Increments/decrements the value of input associ-\n * ated with the up/down arrow by dispatching an\n * \"increment\" event on the input.\n *\n * @param {Event} e the click event\n * @param {Number} delta the diff (usually 1 or -1)\n * @param {Element} inputElem the input element\n */\n function incrementNumInput(e, delta, inputElem) {\n var target = e && getEventTarget(e);\n var input = inputElem ||\n (target && target.parentNode && target.parentNode.firstChild);\n var event = createEvent(\"increment\");\n event.delta = delta;\n input && input.dispatchEvent(event);\n }\n function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n if (self.config.weekNumbers) {\n var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\n }\n toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n self.calendarContainer.appendChild(fragment);\n var customAppend = self.config.appendTo !== undefined &&\n self.config.appendTo.nodeType !== undefined;\n if (self.config.inline || self.config.static) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n if (self.config.inline) {\n if (!customAppend && self.element.parentNode)\n self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);\n else if (self.config.appendTo !== undefined)\n self.config.appendTo.appendChild(self.calendarContainer);\n }\n if (self.config.static) {\n var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n if (self.element.parentNode)\n self.element.parentNode.insertBefore(wrapper, self.element);\n wrapper.appendChild(self.element);\n if (self.altInput)\n wrapper.appendChild(self.altInput);\n wrapper.appendChild(self.calendarContainer);\n }\n }\n if (!self.config.static && !self.config.inline)\n (self.config.appendTo !== undefined\n ? self.config.appendTo\n : window.document.body).appendChild(self.calendarContainer);\n }\n function createDay(className, date, dayNumber, i) {\n var dateIsEnabled = isEnabled(date, true), dayElement = createElement(\"span\", \"flatpickr-day \" + className, date.getDate().toString());\n dayElement.dateObj = date;\n dayElement.$i = i;\n dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n if (className.indexOf(\"hidden\") === -1 &&\n compareDates(date, self.now) === 0) {\n self.todayDateElem = dayElement;\n dayElement.classList.add(\"today\");\n dayElement.setAttribute(\"aria-current\", \"date\");\n }\n if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\n if (self.config.mode === \"range\") {\n toggleClass(dayElement, \"startRange\", self.selectedDates[0] &&\n compareDates(date, self.selectedDates[0], true) === 0);\n toggleClass(dayElement, \"endRange\", self.selectedDates[1] &&\n compareDates(date, self.selectedDates[1], true) === 0);\n if (className === \"nextMonthDay\")\n dayElement.classList.add(\"inRange\");\n }\n }\n }\n else {\n dayElement.classList.add(\"flatpickr-disabled\");\n }\n if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date))\n dayElement.classList.add(\"inRange\");\n }\n if (self.weekNumbers &&\n self.config.showMonths === 1 &&\n className !== \"prevMonthDay\" &&\n dayNumber % 7 === 1) {\n self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n }\n triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\")\n onMouseOver(targetNode);\n }\n function getFirstAvailableDay(delta) {\n var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n for (var m = startMonth; m != endMonth; m += delta) {\n var month = self.daysContainer.children[m];\n var startIndex = delta > 0 ? 0 : month.children.length - 1;\n var endIndex = delta > 0 ? month.children.length : -1;\n for (var i = startIndex; i != endIndex; i += delta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj))\n return c;\n }\n }\n return undefined;\n }\n function getNextAvailableDay(current, delta) {\n var givenMonth = current.className.indexOf(\"Month\") === -1\n ? current.dateObj.getMonth()\n : self.currentMonth;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n var loopDelta = delta > 0 ? 1 : -1;\n for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n var month = self.daysContainer.children[m];\n var startIndex = givenMonth - self.currentMonth === m\n ? current.$i + delta\n : delta < 0\n ? month.children.length - 1\n : 0;\n var numMonthDays = month.children.length;\n for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 &&\n isEnabled(c.dateObj) &&\n Math.abs(current.$i - i) >= Math.abs(delta))\n return focusOnDayElem(c);\n }\n }\n self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\n }\n function focusOnDay(current, offset) {\n var dayFocused = isInView(document.activeElement || document.body);\n var startElem = current !== undefined\n ? current\n : dayFocused\n ? document.activeElement\n : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)\n ? self.selectedDateElem\n : self.todayDateElem !== undefined && isInView(self.todayDateElem)\n ? self.todayDateElem\n : getFirstAvailableDay(offset > 0 ? 1 : -1);\n if (startElem === undefined) {\n self._input.focus();\n }\n else if (!dayFocused) {\n focusOnDayElem(startElem);\n }\n else {\n getNextAvailableDay(startElem, offset);\n }\n }\n function buildMonthDays(year, month) {\n var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);\n var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\", nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;\n // prepend days from the ending of previous month\n for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n }\n // Start at 1 since there is no 0th day\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n }\n // append days from the next month\n for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&\n (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n }\n //updateNavigationCurrentMonth();\n var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n clearNode(self.daysContainer);\n // TODO: week numbers for each month\n if (self.weekNumbers)\n clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\n for (var i = 0; i < self.config.showMonths; i++) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n }\n self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType !== \"dropdown\")\n return;\n var shouldBuildMonth = function (month) {\n if (self.config.minDate !== undefined &&\n self.currentYear === self.config.minDate.getFullYear() &&\n month < self.config.minDate.getMonth()) {\n return false;\n }\n return !(self.config.maxDate !== undefined &&\n self.currentYear === self.config.maxDate.getFullYear() &&\n month > self.config.maxDate.getMonth());\n };\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\n for (var i = 0; i < 12; i++) {\n if (!shouldBuildMonth(i))\n continue;\n var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n month.value = new Date(self.currentYear, i).getMonth().toString();\n month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n month.tabIndex = -1;\n if (self.currentMonth === i) {\n month.selected = true;\n }\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n monthElement = createElement(\"span\", \"cur-month\");\n }\n else {\n self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n self.monthsDropdownContainer.setAttribute(\"aria-label\", self.l10n.monthAriaLabel);\n bind(self.monthsDropdownContainer, \"change\", function (e) {\n var target = getEventTarget(e);\n var selectedMonth = parseInt(target.value, 10);\n self.changeMonth(selectedMonth - self.currentMonth);\n triggerEvent(\"onMonthChange\");\n });\n buildMonthSwitch();\n monthElement = self.monthsDropdownContainer;\n }\n var yearInput = createNumberInput(\"cur-year\", { tabindex: \"-1\" });\n var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n }\n if (self.config.maxDate) {\n yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n yearElement.disabled =\n !!self.config.minDate &&\n self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n }\n var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n currentMonth.appendChild(monthElement);\n currentMonth.appendChild(yearInput);\n monthNavFragment.appendChild(currentMonth);\n container.appendChild(monthNavFragment);\n return {\n container: container,\n yearElement: yearElement,\n monthElement: monthElement,\n };\n }\n function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\n }\n for (var m = self.config.showMonths; m--;) {\n var month = buildMonth();\n self.yearElements.push(month.yearElement);\n self.monthElements.push(month.monthElement);\n self.monthNav.appendChild(month.container);\n }\n self.monthNav.appendChild(self.nextMonthNav);\n }\n function buildMonthNav() {\n self.monthNav = createElement(\"div\", \"flatpickr-months\");\n self.yearElements = [];\n self.monthElements = [];\n self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n self.prevMonthNav.innerHTML = self.config.prevArrow;\n self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n self.nextMonthNav.innerHTML = self.config.nextArrow;\n buildMonths();\n Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n get: function () { return self.__hidePrevMonthArrow; },\n set: function (bool) {\n if (self.__hidePrevMonthArrow !== bool) {\n toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n self.__hidePrevMonthArrow = bool;\n }\n },\n });\n Object.defineProperty(self, \"_hideNextMonthArrow\", {\n get: function () { return self.__hideNextMonthArrow; },\n set: function (bool) {\n if (self.__hideNextMonthArrow !== bool) {\n toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n self.__hideNextMonthArrow = bool;\n }\n },\n });\n self.currentYearElement = self.yearElements[0];\n updateNavigationCurrentMonth();\n return self.monthNav;\n }\n function buildTime() {\n self.calendarContainer.classList.add(\"hasTime\");\n if (self.config.noCalendar)\n self.calendarContainer.classList.add(\"noCalendar\");\n self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n self.timeContainer.tabIndex = -1;\n var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n var hourInput = createNumberInput(\"flatpickr-hour\", {\n \"aria-label\": self.l10n.hourAriaLabel,\n });\n self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n var minuteInput = createNumberInput(\"flatpickr-minute\", {\n \"aria-label\": self.l10n.minuteAriaLabel,\n });\n self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n self.hourElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getHours()\n : self.config.time_24hr\n ? self.config.defaultHour\n : military2ampm(self.config.defaultHour));\n self.minuteElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getMinutes()\n : self.config.defaultMinute);\n self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n self.minuteElement.setAttribute(\"min\", \"0\");\n self.minuteElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(hourInput);\n self.timeContainer.appendChild(separator);\n self.timeContainer.appendChild(minuteInput);\n if (self.config.time_24hr)\n self.timeContainer.classList.add(\"time24hr\");\n if (self.config.enableSeconds) {\n self.timeContainer.classList.add(\"hasSeconds\");\n var secondInput = createNumberInput(\"flatpickr-second\");\n self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n self.secondElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getSeconds()\n : self.config.defaultSeconds);\n self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n self.secondElement.setAttribute(\"min\", \"0\");\n self.secondElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n self.timeContainer.appendChild(secondInput);\n }\n if (!self.config.time_24hr) {\n // add self.amPM if appropriate\n self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj\n ? self.hourElement.value\n : self.config.defaultHour) > 11)]);\n self.amPM.title = self.l10n.toggleTitle;\n self.amPM.tabIndex = -1;\n self.timeContainer.appendChild(self.amPM);\n }\n return self.timeContainer;\n }\n function buildWeekdays() {\n if (!self.weekdayContainer)\n self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");\n else\n clearNode(self.weekdayContainer);\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n updateWeekdays();\n return self.weekdayContainer;\n }\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));\n }\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n }\n }\n /* istanbul ignore next */\n function buildWeeks() {\n self.calendarContainer.classList.add(\"hasWeeks\");\n var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n weekWrapper.appendChild(weekNumbers);\n return {\n weekWrapper: weekWrapper,\n weekNumbers: weekNumbers,\n };\n }\n function changeMonth(value, isOffset) {\n if (isOffset === void 0) { isOffset = true; }\n var delta = isOffset ? value : value - self.currentMonth;\n if ((delta < 0 && self._hidePrevMonthArrow === true) ||\n (delta > 0 && self._hideNextMonthArrow === true))\n return;\n self.currentMonth += delta;\n if (self.currentMonth < 0 || self.currentMonth > 11) {\n self.currentYear += self.currentMonth > 11 ? 1 : -1;\n self.currentMonth = (self.currentMonth + 12) % 12;\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }\n if (toInitial === void 0) { toInitial = true; }\n self.input.value = \"\";\n if (self.altInput !== undefined)\n self.altInput.value = \"\";\n if (self.mobileInput !== undefined)\n self.mobileInput.value = \"\";\n self.selectedDates = [];\n self.latestSelectedDateObj = undefined;\n if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n }\n if (self.config.enableTime === true) {\n var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;\n setHours(hours, minutes, seconds);\n }\n self.redraw();\n if (triggerChangeEvent)\n // triggerChangeEvent is true (default) or an Event\n triggerEvent(\"onChange\");\n }\n function close() {\n self.isOpen = false;\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n triggerEvent(\"onClose\");\n }\n function destroy() {\n if (self.config !== undefined)\n triggerEvent(\"onDestroy\");\n for (var i = self._handlers.length; i--;) {\n var h = self._handlers[i];\n h.element.removeEventListener(h.event, h.handler, h.options);\n }\n self._handlers = [];\n if (self.mobileInput) {\n if (self.mobileInput.parentNode)\n self.mobileInput.parentNode.removeChild(self.mobileInput);\n self.mobileInput = undefined;\n }\n else if (self.calendarContainer && self.calendarContainer.parentNode) {\n if (self.config.static && self.calendarContainer.parentNode) {\n var wrapper = self.calendarContainer.parentNode;\n wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n if (wrapper.parentNode) {\n while (wrapper.firstChild)\n wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n }\n }\n else\n self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n }\n if (self.altInput) {\n self.input.type = \"text\";\n if (self.altInput.parentNode)\n self.altInput.parentNode.removeChild(self.altInput);\n delete self.altInput;\n }\n if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\n }\n [\n \"_showTimeInput\",\n \"latestSelectedDateObj\",\n \"_hideNextMonthArrow\",\n \"_hidePrevMonthArrow\",\n \"__hideNextMonthArrow\",\n \"__hidePrevMonthArrow\",\n \"isMobile\",\n \"isOpen\",\n \"selectedDateElem\",\n \"minDateHasTime\",\n \"maxDateHasTime\",\n \"days\",\n \"daysContainer\",\n \"_input\",\n \"_positionElement\",\n \"innerContainer\",\n \"rContainer\",\n \"monthNav\",\n \"todayDateElem\",\n \"calendarContainer\",\n \"weekdayContainer\",\n \"prevMonthNav\",\n \"nextMonthNav\",\n \"monthsDropdownContainer\",\n \"currentMonthElement\",\n \"currentYearElement\",\n \"navigationCurrentMonth\",\n \"selectedDateElem\",\n \"config\",\n ].forEach(function (k) {\n try {\n delete self[k];\n }\n catch (_) { }\n });\n }\n function isCalendarElem(elem) {\n if (self.config.appendTo && self.config.appendTo.contains(elem))\n return true;\n return self.calendarContainer.contains(elem);\n }\n function documentClick(e) {\n if (self.isOpen && !self.config.inline) {\n var eventTarget_1 = getEventTarget(e);\n var isCalendarElement = isCalendarElem(eventTarget_1);\n var isInput = eventTarget_1 === self.input ||\n eventTarget_1 === self.altInput ||\n self.element.contains(eventTarget_1) ||\n // web components\n // e.path is not present in all browsers. circumventing typechecks\n (e.path &&\n e.path.indexOf &&\n (~e.path.indexOf(self.input) ||\n ~e.path.indexOf(self.altInput)));\n var lostFocus = e.type === \"blur\"\n ? isInput &&\n e.relatedTarget &&\n !isCalendarElem(e.relatedTarget)\n : !isInput &&\n !isCalendarElement &&\n !isCalendarElem(e.relatedTarget);\n var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n return elem.contains(eventTarget_1);\n });\n if (lostFocus && isIgnored) {\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined &&\n self.input.value !== \"\" &&\n self.input.value !== undefined) {\n updateTime();\n }\n self.close();\n if (self.config &&\n self.config.mode === \"range\" &&\n self.selectedDates.length === 1) {\n self.clear(false);\n self.redraw();\n }\n }\n }\n }\n function changeYear(newYear) {\n if (!newYear ||\n (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||\n (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))\n return;\n var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;\n self.currentYear = newYearNum || self.currentYear;\n if (self.config.maxDate &&\n self.currentYear === self.config.maxDate.getFullYear()) {\n self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n }\n else if (self.config.minDate &&\n self.currentYear === self.config.minDate.getFullYear()) {\n self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n }\n if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n function isEnabled(date, timeless) {\n if (timeless === void 0) { timeless = true; }\n var dateToCheck = self.parseDate(date, undefined, timeless); // timeless\n if ((self.config.minDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||\n (self.config.maxDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))\n return false;\n if (self.config.enable.length === 0 && self.config.disable.length === 0)\n return true;\n if (dateToCheck === undefined)\n return false;\n var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;\n for (var i = 0, d = void 0; i < array.length; i++) {\n d = array[i];\n if (typeof d === \"function\" &&\n d(dateToCheck) // disabled by function\n )\n return bool;\n else if (d instanceof Date &&\n dateToCheck !== undefined &&\n d.getTime() === dateToCheck.getTime())\n // disabled by date\n return bool;\n else if (typeof d === \"string\" && dateToCheck !== undefined) {\n // disabled by date string\n var parsed = self.parseDate(d, undefined, true);\n return parsed && parsed.getTime() === dateToCheck.getTime()\n ? bool\n : !bool;\n }\n else if (\n // disabled by range\n typeof d === \"object\" &&\n dateToCheck !== undefined &&\n d.from &&\n d.to &&\n dateToCheck.getTime() >= d.from.getTime() &&\n dateToCheck.getTime() <= d.to.getTime())\n return bool;\n }\n return !bool;\n }\n function isInView(elem) {\n if (self.daysContainer !== undefined)\n return (elem.className.indexOf(\"hidden\") === -1 &&\n elem.className.indexOf(\"flatpickr-disabled\") === -1 &&\n self.daysContainer.contains(elem));\n return false;\n }\n function onBlur(e) {\n var isInput = e.target === self._input;\n if (isInput &&\n !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {\n self.setDate(self._input.value, true, e.target === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n }\n }\n function onKeyDown(e) {\n // e.key e.keyCode\n // \"Backspace\" 8\n // \"Tab\" 9\n // \"Enter\" 13\n // \"Escape\" (IE \"Esc\") 27\n // \"ArrowLeft\" (IE \"Left\") 37\n // \"ArrowUp\" (IE \"Up\") 38\n // \"ArrowRight\" (IE \"Right\") 39\n // \"ArrowDown\" (IE \"Down\") 40\n // \"Delete\" (IE \"Del\") 46\n var eventTarget = getEventTarget(e);\n var isInput = self.config.wrap\n ? element.contains(eventTarget)\n : eventTarget === self._input;\n var allowInput = self.config.allowInput;\n var allowKeydown = self.isOpen && (!allowInput || !isInput);\n var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n if (e.keyCode === 13 && isInput) {\n if (allowInput) {\n self.setDate(self._input.value, true, eventTarget === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n return eventTarget.blur();\n }\n else {\n self.open();\n }\n }\n else if (isCalendarElem(eventTarget) ||\n allowKeydown ||\n allowInlineKeydown) {\n var isTimeObj = !!self.timeContainer &&\n self.timeContainer.contains(eventTarget);\n switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n }\n else\n selectDate(e);\n break;\n case 27: // escape\n e.preventDefault();\n focusAndClose();\n break;\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n break;\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n if (self.daysContainer !== undefined &&\n (allowInput === false ||\n (document.activeElement && isInView(document.activeElement)))) {\n var delta_1 = e.keyCode === 39 ? 1 : -1;\n if (!e.ctrlKey)\n focusOnDay(undefined, delta_1);\n else {\n e.stopPropagation();\n changeMonth(delta_1);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n }\n }\n else if (self.hourElement)\n self.hourElement.focus();\n break;\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\n if ((self.daysContainer &&\n eventTarget.$i !== undefined) ||\n eventTarget === self.input ||\n eventTarget === self.altInput) {\n if (e.ctrlKey) {\n e.stopPropagation();\n changeYear(self.currentYear - delta);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n else if (!isTimeObj)\n focusOnDay(undefined, delta * 7);\n }\n else if (eventTarget === self.currentYearElement) {\n changeYear(self.currentYear - delta);\n }\n else if (self.config.enableTime) {\n if (!isTimeObj && self.hourElement)\n self.hourElement.focus();\n updateTime(e);\n self._debouncedChange();\n }\n break;\n case 9:\n if (isTimeObj) {\n var elems = [\n self.hourElement,\n self.minuteElement,\n self.secondElement,\n self.amPM,\n ]\n .concat(self.pluginElements)\n .filter(function (x) { return x; });\n var i = elems.indexOf(eventTarget);\n if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n (target || self._input).focus();\n }\n }\n else if (!self.config.noCalendar &&\n self.daysContainer &&\n self.daysContainer.contains(eventTarget) &&\n e.shiftKey) {\n e.preventDefault();\n self._input.focus();\n }\n break;\n }\n }\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n switch (e.key) {\n case self.l10n.amPM[0].charAt(0):\n case self.l10n.amPM[0].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[0];\n setHoursFromInputs();\n updateValue();\n break;\n case self.l10n.amPM[1].charAt(0):\n case self.l10n.amPM[1].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[1];\n setHoursFromInputs();\n updateValue();\n break;\n }\n }\n if (isInput || isCalendarElem(eventTarget)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n function onMouseOver(elem) {\n if (self.selectedDates.length !== 1 ||\n (elem &&\n (!elem.classList.contains(\"flatpickr-day\") ||\n elem.classList.contains(\"flatpickr-disabled\"))))\n return;\n var hoverDate = elem\n ? elem.dateObj.getTime()\n : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n var containsDisabled = false;\n var minRange = 0, maxRange = 0;\n for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n if (!isEnabled(new Date(t), true)) {\n containsDisabled =\n containsDisabled || (t > rangeStartDate && t < rangeEndDate);\n if (t < initialDate && (!minRange || t > minRange))\n minRange = t;\n else if (t > initialDate && (!maxRange || t < maxRange))\n maxRange = t;\n }\n }\n for (var m = 0; m < self.config.showMonths; m++) {\n var month = self.daysContainer.children[m];\n var _loop_1 = function (i, l) {\n var dayElem = month.children[i], date = dayElem.dateObj;\n var timestamp = date.getTime();\n var outOfRange = (minRange > 0 && timestamp < minRange) ||\n (maxRange > 0 && timestamp > maxRange);\n if (outOfRange) {\n dayElem.classList.add(\"notAllowed\");\n [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n return \"continue\";\n }\n else if (containsDisabled && !outOfRange)\n return \"continue\";\n [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n if (elem !== undefined) {\n elem.classList.add(hoverDate <= self.selectedDates[0].getTime()\n ? \"startRange\"\n : \"endRange\");\n if (initialDate < hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"startRange\");\n else if (initialDate > hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"endRange\");\n if (timestamp >= minRange &&\n (maxRange === 0 || timestamp <= maxRange) &&\n isBetween(timestamp, initialDate, hoverDate))\n dayElem.classList.add(\"inRange\");\n }\n };\n for (var i = 0, l = month.children.length; i < l; i++) {\n _loop_1(i, l);\n }\n }\n }\n function onResize() {\n if (self.isOpen && !self.config.static && !self.config.inline)\n positionCalendar();\n }\n function open(e, positionElement) {\n if (positionElement === void 0) { positionElement = self._positionElement; }\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n var eventTarget = getEventTarget(e);\n eventTarget && eventTarget.blur();\n }\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n triggerEvent(\"onOpen\");\n return;\n }\n if (self._input.disabled || self.config.inline)\n return;\n var wasOpen = self.isOpen;\n self.isOpen = true;\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n self._input.classList.add(\"active\");\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\n }\n if (self.config.enableTime === true && self.config.noCalendar === true) {\n if (self.config.allowInput === false &&\n (e === undefined ||\n !self.timeContainer.contains(e.relatedTarget))) {\n setTimeout(function () { return self.hourElement.select(); }, 50);\n }\n }\n }\n function minMaxDateSetter(type) {\n return function (date) {\n var dateObj = (self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat));\n var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] =\n dateObj.getHours() > 0 ||\n dateObj.getMinutes() > 0 ||\n dateObj.getSeconds() > 0;\n }\n if (self.selectedDates) {\n self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });\n if (!self.selectedDates.length && type === \"min\")\n setHoursFromDate(dateObj);\n updateValue();\n }\n if (self.daysContainer) {\n redraw();\n if (dateObj !== undefined)\n self.currentYearElement[type] = dateObj.getFullYear().toString();\n else\n self.currentYearElement.removeAttribute(type);\n self.currentYearElement.disabled =\n !!inverseDateObj &&\n dateObj !== undefined &&\n inverseDateObj.getFullYear() === dateObj.getFullYear();\n }\n };\n }\n function parseConfig() {\n var boolOpts = [\n \"wrap\",\n \"weekNumbers\",\n \"allowInput\",\n \"allowInvalidPreload\",\n \"clickOpens\",\n \"time_24hr\",\n \"enableTime\",\n \"noCalendar\",\n \"altInput\",\n \"shorthandCurrentMonth\",\n \"inline\",\n \"static\",\n \"enableSeconds\",\n \"disableMobile\",\n ];\n var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);\n var formats = {};\n self.config.parseDate = userConfig.parseDate;\n self.config.formatDate = userConfig.formatDate;\n Object.defineProperty(self.config, \"enable\", {\n get: function () { return self.config._enable; },\n set: function (dates) {\n self.config._enable = parseDateRules(dates);\n },\n });\n Object.defineProperty(self.config, \"disable\", {\n get: function () { return self.config._disable; },\n set: function (dates) {\n self.config._disable = parseDateRules(dates);\n },\n });\n var timeMode = userConfig.mode === \"time\";\n if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;\n formats.dateFormat =\n userConfig.noCalendar || timeMode\n ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\")\n : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n }\n if (userConfig.altInput &&\n (userConfig.enableTime || timeMode) &&\n !userConfig.altFormat) {\n var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;\n formats.altFormat =\n userConfig.noCalendar || timeMode\n ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\")\n : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n }\n Object.defineProperty(self.config, \"minDate\", {\n get: function () { return self.config._minDate; },\n set: minMaxDateSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxDate\", {\n get: function () { return self.config._maxDate; },\n set: minMaxDateSetter(\"max\"),\n });\n var minMaxTimeSetter = function (type) { return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n }; };\n Object.defineProperty(self.config, \"minTime\", {\n get: function () { return self.config._minTime; },\n set: minMaxTimeSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxTime\", {\n get: function () { return self.config._maxTime; },\n set: minMaxTimeSetter(\"max\"),\n });\n if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n Object.assign(self.config, formats, userConfig);\n for (var i = 0; i < boolOpts.length; i++)\n // https://github.com/microsoft/TypeScript/issues/31663\n self.config[boolOpts[i]] =\n self.config[boolOpts[i]] === true ||\n self.config[boolOpts[i]] === \"true\";\n HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {\n self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n });\n self.isMobile =\n !self.config.disableMobile &&\n !self.config.inline &&\n self.config.mode === \"single\" &&\n !self.config.disable.length &&\n !self.config.enable.length &&\n !self.config.weekNumbers &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\n for (var key in pluginConf) {\n if (HOOKS.indexOf(key) > -1) {\n self.config[key] = arrayify(pluginConf[key])\n .map(bindToInstance)\n .concat(self.config[key]);\n }\n else if (typeof userConfig[key] === \"undefined\")\n self.config[key] = pluginConf[key];\n }\n }\n if (!userConfig.altInputClass) {\n self.config.altInputClass =\n getInputElem().className + \" \" + self.config.altInputClass;\n }\n triggerEvent(\"onParseConfig\");\n }\n function getInputElem() {\n return self.config.wrap\n ? element.querySelector(\"[data-input]\")\n : element;\n }\n function setupLocale() {\n if (typeof self.config.locale !== \"object\" &&\n typeof flatpickr.l10ns[self.config.locale] === \"undefined\")\n self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === \"object\"\n ? self.config.locale\n : self.config.locale !== \"default\"\n ? flatpickr.l10ns[self.config.locale]\n : undefined));\n tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));\n if (userConfig.time_24hr === undefined &&\n flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n }\n function positionCalendar(customPositionElement) {\n if (self.calendarContainer === undefined)\n return;\n triggerEvent(\"onPreCalendarPosition\");\n var positionElement = customPositionElement || self._positionElement;\n var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(\" \"), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === \"above\" ||\n (configPosVertical !== \"below\" &&\n distanceFromBottom < calendarHeight &&\n inputBounds.top > calendarHeight);\n var top = window.pageYOffset +\n inputBounds.top +\n (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n if (self.config.inline)\n return;\n var left = window.pageXOffset + inputBounds.left;\n var isCenter = false;\n var isRight = false;\n if (configPosHorizontal === \"center\") {\n left -= (calendarWidth - inputBounds.width) / 2;\n isCenter = true;\n }\n else if (configPosHorizontal === \"right\") {\n left -= calendarWidth - inputBounds.width;\n isRight = true;\n }\n toggleClass(self.calendarContainer, \"arrowLeft\", !isCenter && !isRight);\n toggleClass(self.calendarContainer, \"arrowCenter\", isCenter);\n toggleClass(self.calendarContainer, \"arrowRight\", isRight);\n var right = window.document.body.offsetWidth -\n (window.pageXOffset + inputBounds.right);\n var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n if (self.config.static)\n return;\n self.calendarContainer.style.top = top + \"px\";\n if (!rightMost) {\n self.calendarContainer.style.left = left + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n else if (!centerMost) {\n self.calendarContainer.style.left = \"auto\";\n self.calendarContainer.style.right = right + \"px\";\n }\n else {\n var doc = getDocumentStyleSheet();\n // some testing environments don't have css support\n if (doc === undefined)\n return;\n var bodyWidth = window.document.body.offsetWidth;\n var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n var centerBefore = \".flatpickr-calendar.centerMost:before\";\n var centerAfter = \".flatpickr-calendar.centerMost:after\";\n var centerIndex = doc.cssRules.length;\n var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n toggleClass(self.calendarContainer, \"rightMost\", false);\n toggleClass(self.calendarContainer, \"centerMost\", true);\n doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n self.calendarContainer.style.left = centerLeft + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n }\n function getDocumentStyleSheet() {\n var editableSheet = null;\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n try {\n sheet.cssRules;\n }\n catch (err) {\n continue;\n }\n editableSheet = sheet;\n break;\n }\n return editableSheet != null ? editableSheet : createStyleSheet();\n }\n function createStyleSheet() {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n return style.sheet;\n }\n function redraw() {\n if (self.config.noCalendar || self.isMobile)\n return;\n buildMonthSwitch();\n updateNavigationCurrentMonth();\n buildDays();\n }\n function focusAndClose() {\n self._input.focus();\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 ||\n navigator.msMaxTouchPoints !== undefined) {\n // hack - bugs in the way IE handles focus keeps the calendar open\n setTimeout(self.close, 0);\n }\n else {\n self.close();\n }\n }\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\n var isSelectable = function (day) {\n return day.classList &&\n day.classList.contains(\"flatpickr-day\") &&\n !day.classList.contains(\"flatpickr-disabled\") &&\n !day.classList.contains(\"notAllowed\");\n };\n var t = findParent(getEventTarget(e), isSelectable);\n if (t === undefined)\n return;\n var target = t;\n var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));\n var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||\n selectedDate.getMonth() >\n self.currentMonth + self.config.showMonths - 1) &&\n self.config.mode !== \"range\";\n self.selectedDateElem = target;\n if (self.config.mode === \"single\")\n self.selectedDates = [selectedDate];\n else if (self.config.mode === \"multiple\") {\n var selectedIndex = isDateSelected(selectedDate);\n if (selectedIndex)\n self.selectedDates.splice(parseInt(selectedIndex), 1);\n else\n self.selectedDates.push(selectedDate);\n }\n else if (self.config.mode === \"range\") {\n if (self.selectedDates.length === 2) {\n self.clear(false, false);\n }\n self.latestSelectedDateObj = selectedDate;\n self.selectedDates.push(selectedDate);\n // unless selecting same date twice, sort ascendingly\n if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n setHoursFromInputs();\n if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n triggerEvent(\"onMonthChange\");\n }\n updateNavigationCurrentMonth();\n buildDays();\n updateValue();\n // maintain focus\n if (!shouldChangeMonth &&\n self.config.mode !== \"range\" &&\n self.config.showMonths === 1)\n focusOnDayElem(target);\n else if (self.selectedDateElem !== undefined &&\n self.hourElement === undefined) {\n self.selectedDateElem && self.selectedDateElem.focus();\n }\n if (self.hourElement !== undefined)\n self.hourElement !== undefined && self.hourElement.focus();\n if (self.config.closeOnSelect) {\n var single = self.config.mode === \"single\" && !self.config.enableTime;\n var range = self.config.mode === \"range\" &&\n self.selectedDates.length === 2 &&\n !self.config.enableTime;\n if (single || range) {\n focusAndClose();\n }\n }\n triggerChange();\n }\n var CALLBACKS = {\n locale: [setupLocale, updateWeekdays],\n showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n minDate: [jumpToDate],\n maxDate: [jumpToDate],\n };\n function set(option, value) {\n if (option !== null && typeof option === \"object\") {\n Object.assign(self.config, option);\n for (var key in option) {\n if (CALLBACKS[key] !== undefined)\n CALLBACKS[key].forEach(function (x) { return x(); });\n }\n }\n else {\n self.config[option] = value;\n if (CALLBACKS[option] !== undefined)\n CALLBACKS[option].forEach(function (x) { return x(); });\n else if (HOOKS.indexOf(option) > -1)\n self.config[option] = arrayify(value);\n }\n self.redraw();\n updateValue(true);\n }\n function setSelectedDate(inputDate, format) {\n var dates = [];\n if (inputDate instanceof Array)\n dates = inputDate.map(function (d) { return self.parseDate(d, format); });\n else if (inputDate instanceof Date || typeof inputDate === \"number\")\n dates = [self.parseDate(inputDate, format)];\n else if (typeof inputDate === \"string\") {\n switch (self.config.mode) {\n case \"single\":\n case \"time\":\n dates = [self.parseDate(inputDate, format)];\n break;\n case \"multiple\":\n dates = inputDate\n .split(self.config.conjunction)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n case \"range\":\n dates = inputDate\n .split(self.l10n.rangeSeparator)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n }\n }\n else\n self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n self.selectedDates = (self.config.allowInvalidPreload\n ? dates\n : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));\n if (self.config.mode === \"range\")\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) { triggerChange = false; }\n if (format === void 0) { format = self.config.dateFormat; }\n if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))\n return self.clear(triggerChange);\n setSelectedDate(date, format);\n self.latestSelectedDateObj =\n self.selectedDates[self.selectedDates.length - 1];\n self.redraw();\n jumpToDate(undefined, triggerChange);\n setHoursFromDate();\n if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n updateValue(triggerChange);\n if (triggerChange)\n triggerEvent(\"onChange\");\n }\n function parseDateRules(arr) {\n return arr\n .slice()\n .map(function (rule) {\n if (typeof rule === \"string\" ||\n typeof rule === \"number\" ||\n rule instanceof Date) {\n return self.parseDate(rule, undefined, true);\n }\n else if (rule &&\n typeof rule === \"object\" &&\n rule.from &&\n rule.to)\n return {\n from: self.parseDate(rule.from, undefined),\n to: self.parseDate(rule.to, undefined),\n };\n return rule;\n })\n .filter(function (x) { return x; }); // remove falsy values\n }\n function setupDates() {\n self.selectedDates = [];\n self.now = self.parseDate(self.config.now) || new Date();\n // Workaround IE11 setting placeholder as the input's value\n var preloadedDate = self.config.defaultDate ||\n ((self.input.nodeName === \"INPUT\" ||\n self.input.nodeName === \"TEXTAREA\") &&\n self.input.placeholder &&\n self.input.value === self.input.placeholder\n ? null\n : self.input.value);\n if (preloadedDate)\n setSelectedDate(preloadedDate, self.config.dateFormat);\n self._initialDate =\n self.selectedDates.length > 0\n ? self.selectedDates[0]\n : self.config.minDate &&\n self.config.minDate.getTime() > self.now.getTime()\n ? self.config.minDate\n : self.config.maxDate &&\n self.config.maxDate.getTime() < self.now.getTime()\n ? self.config.maxDate\n : self.now;\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n if (self.selectedDates.length > 0)\n self.latestSelectedDateObj = self.selectedDates[0];\n if (self.config.minTime !== undefined)\n self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n if (self.config.maxTime !== undefined)\n self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n self.minDateHasTime =\n !!self.config.minDate &&\n (self.config.minDate.getHours() > 0 ||\n self.config.minDate.getMinutes() > 0 ||\n self.config.minDate.getSeconds() > 0);\n self.maxDateHasTime =\n !!self.config.maxDate &&\n (self.config.maxDate.getHours() > 0 ||\n self.config.maxDate.getMinutes() > 0 ||\n self.config.maxDate.getSeconds() > 0);\n }\n function setupInputs() {\n self.input = getInputElem();\n /* istanbul ignore next */\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n }\n // hack: store previous type to restore it after destroy()\n self.input._type = self.input.type;\n self.input.type = \"text\";\n self.input.classList.add(\"flatpickr-input\");\n self._input = self.input;\n if (self.config.altInput) {\n // replicate self.element\n self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n self._input = self.altInput;\n self.altInput.placeholder = self.input.placeholder;\n self.altInput.disabled = self.input.disabled;\n self.altInput.required = self.input.required;\n self.altInput.tabIndex = self.input.tabIndex;\n self.altInput.type = \"text\";\n self.input.setAttribute(\"type\", \"hidden\");\n if (!self.config.static && self.input.parentNode)\n self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n }\n if (!self.config.allowInput)\n self._input.setAttribute(\"readonly\", \"readonly\");\n self._positionElement = self.config.positionElement || self._input;\n }\n function setupMobile() {\n var inputType = self.config.enableTime\n ? self.config.noCalendar\n ? \"time\"\n : \"datetime-local\"\n : \"date\";\n self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n self.mobileInput.tabIndex = 1;\n self.mobileInput.type = inputType;\n self.mobileInput.disabled = self.input.disabled;\n self.mobileInput.required = self.input.required;\n self.mobileInput.placeholder = self.input.placeholder;\n self.mobileFormatStr =\n inputType === \"datetime-local\"\n ? \"Y-m-d\\\\TH:i:S\"\n : inputType === \"date\"\n ? \"Y-m-d\"\n : \"H:i:S\";\n if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n }\n if (self.config.minDate)\n self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n if (self.config.maxDate)\n self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n if (self.input.getAttribute(\"step\"))\n self.mobileInput.step = String(self.input.getAttribute(\"step\"));\n self.input.type = \"hidden\";\n if (self.altInput !== undefined)\n self.altInput.type = \"hidden\";\n try {\n if (self.input.parentNode)\n self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n }\n catch (_a) { }\n bind(self.mobileInput, \"change\", function (e) {\n self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);\n triggerEvent(\"onChange\");\n triggerEvent(\"onClose\");\n });\n }\n function toggle(e) {\n if (self.isOpen === true)\n return self.close();\n self.open(e);\n }\n function triggerEvent(event, data) {\n // If the instance has been destroyed already, all hooks have been removed\n if (self.config === undefined)\n return;\n var hooks = self.config[event];\n if (hooks !== undefined && hooks.length > 0) {\n for (var i = 0; hooks[i] && i < hooks.length; i++)\n hooks[i](self.selectedDates, self.input.value, self, data);\n }\n if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\"));\n // many front-end frameworks bind to the input event\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\n }\n function isDateSelected(date) {\n for (var i = 0; i < self.selectedDates.length; i++) {\n if (compareDates(self.selectedDates[i], date) === 0)\n return \"\" + i;\n }\n return false;\n }\n function isDateInRange(date) {\n if (self.config.mode !== \"range\" || self.selectedDates.length < 2)\n return false;\n return (compareDates(date, self.selectedDates[0]) >= 0 &&\n compareDates(date, self.selectedDates[1]) <= 0);\n }\n function updateNavigationCurrentMonth() {\n if (self.config.noCalendar || self.isMobile || !self.monthNav)\n return;\n self.yearElements.forEach(function (yearElement, i) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n self.monthElements[i].textContent =\n monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n }\n else {\n self.monthsDropdownContainer.value = d.getMonth().toString();\n }\n yearElement.value = d.getFullYear().toString();\n });\n self._hidePrevMonthArrow =\n self.config.minDate !== undefined &&\n (self.currentYear === self.config.minDate.getFullYear()\n ? self.currentMonth <= self.config.minDate.getMonth()\n : self.currentYear < self.config.minDate.getFullYear());\n self._hideNextMonthArrow =\n self.config.maxDate !== undefined &&\n (self.currentYear === self.config.maxDate.getFullYear()\n ? self.currentMonth + 1 > self.config.maxDate.getMonth()\n : self.currentYear > self.config.maxDate.getFullYear());\n }\n function getDateStr(format) {\n return self.selectedDates\n .map(function (dObj) { return self.formatDate(dObj, format); })\n .filter(function (d, i, arr) {\n return self.config.mode !== \"range\" ||\n self.config.enableTime ||\n arr.indexOf(d) === i;\n })\n .join(self.config.mode !== \"range\"\n ? self.config.conjunction\n : self.l10n.rangeSeparator);\n }\n /**\n * Updates the values of inputs associated with the calendar\n */\n function updateValue(triggerChange) {\n if (triggerChange === void 0) { triggerChange = true; }\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value =\n self.latestSelectedDateObj !== undefined\n ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)\n : \"\";\n }\n self.input.value = getDateStr(self.config.dateFormat);\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n if (triggerChange !== false)\n triggerEvent(\"onValueUpdate\");\n }\n function onMonthNavClick(e) {\n var eventTarget = getEventTarget(e);\n var isPrevMonth = self.prevMonthNav.contains(eventTarget);\n var isNextMonth = self.nextMonthNav.contains(eventTarget);\n if (isPrevMonth || isNextMonth) {\n changeMonth(isPrevMonth ? -1 : 1);\n }\n else if (self.yearElements.indexOf(eventTarget) >= 0) {\n eventTarget.select();\n }\n else if (eventTarget.classList.contains(\"arrowUp\")) {\n self.changeYear(self.currentYear + 1);\n }\n else if (eventTarget.classList.contains(\"arrowDown\")) {\n self.changeYear(self.currentYear - 1);\n }\n }\n function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\", eventTarget = getEventTarget(e), input = eventTarget;\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n var min = parseFloat(input.getAttribute(\"min\")), max = parseFloat(input.getAttribute(\"max\")), step = parseFloat(input.getAttribute(\"step\")), curValue = parseInt(input.value, 10), delta = e.delta ||\n (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);\n var newValue = curValue + step * delta;\n if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;\n if (newValue < min) {\n newValue =\n max +\n newValue +\n int(!isHourElem) +\n (int(isHourElem) && int(!self.amPM));\n if (isMinuteElem)\n incrementNumInput(undefined, -1, self.hourElement);\n }\n else if (newValue > max) {\n newValue =\n input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n if (isMinuteElem)\n incrementNumInput(undefined, 1, self.hourElement);\n }\n if (self.amPM &&\n isHourElem &&\n (step === 1\n ? newValue + curValue === 23\n : Math.abs(newValue - curValue) > step)) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n input.value = pad(newValue);\n }\n }\n init();\n return self;\n }\n /* istanbul ignore next */\n function _flatpickr(nodeList, config) {\n // static list\n var nodes = Array.prototype.slice\n .call(nodeList)\n .filter(function (x) { return x instanceof HTMLElement; });\n var instances = [];\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null)\n continue;\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n node._flatpickr = undefined;\n }\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n }\n catch (e) {\n console.error(e);\n }\n }\n return instances.length === 1 ? instances[0] : instances;\n }\n /* istanbul ignore next */\n if (typeof HTMLElement !== \"undefined\" &&\n typeof HTMLCollection !== \"undefined\" &&\n typeof NodeList !== \"undefined\") {\n // browser env\n HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\n };\n }\n /* istanbul ignore next */\n var flatpickr = function (selector, config) {\n if (typeof selector === \"string\") {\n return _flatpickr(window.document.querySelectorAll(selector), config);\n }\n else if (selector instanceof Node) {\n return _flatpickr([selector], config);\n }\n else {\n return _flatpickr(selector, config);\n }\n };\n /* istanbul ignore next */\n flatpickr.defaultConfig = {};\n flatpickr.l10ns = {\n en: __assign({}, english),\n default: __assign({}, english),\n };\n flatpickr.localize = function (l10n) {\n flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);\n };\n flatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);\n };\n flatpickr.parseDate = createDateParser({});\n flatpickr.formatDate = createDateFormatter({});\n flatpickr.compareDates = compareDates;\n /* istanbul ignore next */\n if (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n }\n // eslint-disable-next-line @typescript-eslint/camelcase\n Date.prototype.fp_incr = function (days) {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n };\n if (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\n }\n\n return flatpickr;\n\n})));\n","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['components/LogInModal'];","module.exports = flarum.core.compat['helpers/avatar'];","module.exports = flarum.core.compat['helpers/username'];","module.exports = flarum.core.compat['utils/PostControls'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class Poll extends mixin(Model, {\n question: Model.attribute('question'),\n hasEnded: Model.attribute('hasEnded'),\n endDate: Model.attribute('endDate'),\n publicPoll: Model.attribute('publicPoll'),\n\n options: Model.hasMany('options'),\n votes: Model.hasMany('votes'),\n}) {\n apiEndpoint() {\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class PollOption extends mixin(Model, {\n answer: Model.attribute('answer'),\n\n poll: Model.hasOne('polls'),\n votes: Model.hasMany('votes'),\n}) {\n apiEndpoint() {\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class PollVote extends mixin(Model, {\n poll: Model.hasOne('poll'),\n option: Model.hasOne('option'),\n user: Model.hasOne('user'),\n\n pollId: Model.attribute('pollId'),\n optionId: Model.attribute('optionId'),\n}) {\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Button from 'flarum/components/Button';\nimport Modal from 'flarum/components/Modal';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\nimport flatpickr from 'flatpickr';\n\nexport default class CreatePollModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.options = [Stream(''), Stream('')];\n\n this.question = Stream('');\n\n this.endDate = Stream();\n\n this.publicPoll = Stream(false);\n\n if (this.attrs.poll && this.attrs.poll.relationships) {\n const poll = this.attrs.poll;\n\n this.options = poll.relationships.options.map((o) => Stream(o));\n this.question(poll.question);\n this.endDate(!poll.endDate || isNaN(poll.endDate.getTime()) ? null : poll.endDate);\n this.publicPoll(poll.publicPoll);\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--small';\n }\n\n configDatePicker(vnode) {\n flatpickr(vnode.dom, {\n enableTime: true,\n minDate: this.endDate() || 'today',\n dateFormat: 'Y-m-d H:i',\n defaultDate: this.endDate(),\n wrap: true,\n\n onChange: (dates) => this.endDate(dates[0]),\n });\n }\n\n content() {\n return [\n
\n
\n
\n \n\n \n
\n\n
\n \n\n {this.displayOptions()}\n
\n\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n 'data-clear': true,\n })}\n
\n
\n\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
\n\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary PollModal-SubmitButton',\n loading: this.loading,\n },\n app.translator.trans('fof-polls.forum.modal.submit')\n )}\n
\n
\n
,\n ];\n }\n\n displayOptions() {\n return Object.keys(this.options).map((el, i) => (\n
\n
\n \n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const setting = app.data['fof-polls.options.max'];\n const max = (setting && parseInt(setting)) || 11;\n\n if (this.options.length < max) {\n this.options.push(Stream(''));\n } else {\n alert(app.translator.trans('fof-polls.forum.modal.max'));\n }\n }\n\n removeOption(option) {\n this.options.splice(option, 1);\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n const poll = {\n question: this.question(),\n endDate: this.endDate(),\n publicPoll: this.publicPoll(),\n };\n const options = this.options.map((a) => a()).filter(Boolean);\n\n if (this.question() === '') {\n alert(app.translator.trans('fof-polls.forum.modal.include_question'));\n\n return;\n }\n\n if (options.length < 2) {\n alert(app.translator.trans('fof-polls.forum.modal.min'));\n\n return;\n }\n\n poll.relationships = { options };\n\n this.attrs.onsubmit(poll);\n\n app.modal.close();\n }\n}\n","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import Modal from 'flarum/components/Modal';\nimport avatar from 'flarum/helpers/avatar';\nimport username from 'flarum/helpers/username';\n\nexport default class ShowVotersModal extends Modal {\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return (\n
\n
    \n {this.attrs.poll.options().map((opt) => {\n const votes = this.attrs.poll\n .votes()\n .filter((v) => opt.id() === v.option().id())\n .map((v) => v.user());\n\n return (\n
    \n

    {opt.answer() + ':'}

    \n\n {votes.length ? (\n votes.map((u) => {\n const attrs = u && { href: app.route.user(u), config: m.route };\n\n return (\n
  • \n \n {avatar(u)} {username(u)}\n \n
  • \n );\n })\n ) : (\n

    {app.translator.trans('fof-polls.forum.modal.no_voters')}

    \n )}\n
    \n );\n })}\n
\n
\n );\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LogInModal from 'flarum/components/LogInModal';\nimport Stream from 'flarum/utils/Stream';\nimport ListVotersModal from './ListVotersModal';\n\nexport default class PollVote extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n this.poll = this.attrs.poll;\n\n this.vote = Stream();\n this.voted = Stream(false);\n\n this.updateData();\n }\n\n view() {\n return (\n
\n

{this.poll.question()}

\n\n {this.options.map((opt) => {\n const hasVoted = this.voted();\n const voted = this.vote() && this.vote().option().id() === opt.id();\n const votes = this.votes.filter((v) => v.option().id() === opt.id()).length;\n const percent = Math.round((votes / this.poll.votes().length) * 100);\n\n const attrs = voted\n ? {\n title:\n hasVoted && app.translator.transChoice('fof-polls.forum.tooltip.votes', votes, { count: String(votes) }).join(''),\n oncreate: function (vnode) {\n $(vnode.dom).tooltip({ placement: 'right' });\n },\n }\n : {};\n\n const inputAttrs = voted\n ? {\n checked: true,\n }\n : {};\n\n return (\n
\n
\n {((!this.poll.hasEnded() && app.session.user && app.session.user.canVotePolls()) || !app.session.user) && (\n \n )}\n\n
\n \n {hasVoted && (\n \n )}\n
\n
\n );\n })}\n\n
\n\n {this.poll.publicPoll()\n ? Button.component(\n {\n className: 'Button Button--primary PublicPollButton',\n onclick: () => this.showVoters(),\n },\n app.translator.trans('fof-polls.forum.public_poll')\n )\n : ''}\n\n {app.session.user && !app.session.user.canVotePolls() ? (\n
{app.translator.trans('fof-polls.forum.no_permission')}
\n ) : this.poll.hasEnded() ? (\n
{app.translator.trans('fof-polls.forum.poll_ended')}
\n ) : this.poll.endDate() !== null ? (\n
\n \n {app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.poll.endDate()).fromNow() })}\n
\n ) : (\n ''\n )}\n
\n );\n }\n\n updateData() {\n this.poll = app.store.getById('polls', this.poll.id());\n this.options = this.poll.options() || [];\n this.votes = this.poll.votes() || [];\n\n this.vote(app.session.user ? this.votes.find((v) => v.user() && v.user().id() === app.session.user.id()) : null);\n\n this.voted(!!this.vote());\n }\n\n onError(evt, error) {\n evt.target.checked = false;\n\n app.alerts.show(error.alert);\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n if (this.vote() && option.id() === this.vote().option().id()) option = null;\n\n if (!this.vote()) {\n this.vote(app.store.createRecord('poll_votes'));\n\n this.vote().pollId(this.poll.id());\n }\n\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.poll.id()}/vote`,\n errorHandler: this.onError.bind(this, evt),\n body: {\n data: {\n optionId: option ? option.id() : null,\n },\n },\n }).then((res) => {\n app.store.pushPayload(res);\n\n if (!option) app.store.remove(this.vote());\n\n this.updateData();\n\n if (!option) {\n m.redraw.sync();\n }\n m.redraw();\n });\n }\n\n showVoters() {\n app.modal.show(ListVotersModal, {\n poll: this.poll,\n });\n }\n}\n","import Button from 'flarum/components/Button';\nimport Stream from 'flarum/utils/Stream';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.poll = this.attrs.poll;\n\n this.options = this.poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.question = Stream(this.poll.question());\n this.endDate = Stream(this.poll.endDate());\n this.publicPoll = Stream(this.poll.publicPoll());\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n\n displayOptions() {\n return this.options.map((opt, i) => (\n
\n
\n \n
\n\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const setting = app.data['fof-polls.options.max'];\n const max = (setting && parseInt(setting)) || 11;\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n } else {\n alert(app.translator.trans('fof-polls.forum.modal.max'));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (this.loading) return;\n\n this.loading = true;\n\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n\n return o.data;\n });\n\n return this.poll\n .save({\n question: this.question(),\n endDate: this.endDate() || false,\n publicPoll: this.publicPoll(),\n options,\n })\n .then(() => {\n document.location.reload();\n })\n .catch((e) => {\n this.loaded();\n this.onerror(e);\n });\n }\n}\n","import Model from 'flarum/Model';\n\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addDiscussionComposerItem from './addDiscussionComposerItem';\nimport addPollToDiscussion from './addPollToDiscussion';\nimport addDiscussionControls from './addDiscussionControls';\n\napp.initializers.add('fof/polls', () => {\n app.store.models.polls = Poll;\n app.store.models.poll_options = PollOption;\n app.store.models.poll_votes = PollVote;\n\n app.store.models.discussions.prototype.poll = Model.hasOne('poll');\n\n app.store.models.users.prototype.canEditPolls = Model.attribute('canEditPolls');\n app.store.models.users.prototype.canStartPolls = Model.attribute('canStartPolls');\n app.store.models.users.prototype.canSelfEditPolls = Model.attribute('canSelfEditPolls');\n app.store.models.users.prototype.canVotePolls = Model.attribute('canVotePolls');\n\n addDiscussionBadge();\n addDiscussionControls();\n addDiscussionComposerItem();\n addPollToDiscussion();\n});\n","import { extend } from 'flarum/extend';\nimport Badge from 'flarum/components/Badge';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport Discussion from 'flarum/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.poll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fa fa-signal',\n }),\n 5\n );\n }\n });\n};\n","import { extend } from 'flarum/extend';\nimport PostControls from 'flarum/utils/PostControls';\nimport Button from 'flarum/components/Button';\n\nimport EditPollModal from './components/EditPollModal';\n\nexport default () => {\n extend(PostControls, 'moderationControls', function (items, post) {\n const discussion = post.discussion();\n const poll = discussion.poll();\n const user = app.session.user;\n\n if (!(poll && ((user && user.canEditPolls()) || (post.user() && post.user().canSelfEditPolls() && post.user().id() === user.id())) && post.number() === 1)) {\n return;\n }\n\n if (!poll.hasEnded()) {\n items.add(\n 'fof-polls-edit',\n Button.component(\n {\n icon: 'fas fa-check-square',\n onclick: () => app.modal.show(EditPollModal, { poll: poll }),\n },\n app.translator.trans('fof-polls.forum.moderation.edit')\n )\n );\n }\n\n items.add(\n 'fof-polls-remove',\n Button.component(\n {\n icon: 'fas fa-trash',\n onclick: () => {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n },\n },\n app.translator.trans('fof-polls.forum.moderation.delete')\n )\n );\n });\n};\n","import { extend } from 'flarum/extend';\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport default () => {\n DiscussionComposer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.poll,\n onsubmit: (poll) => (this.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(DiscussionComposer.prototype, 'headerItems', function (items) {\n if (app.session.user && app.session.user.canStartPolls()) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(DiscussionComposer.prototype, 'data', function (data) {\n if (this.poll) {\n data.poll = this.poll;\n }\n });\n};\n","import { extend } from 'flarum/extend';\nimport CommentPost from 'flarum/components/CommentPost';\nimport Stream from 'flarum/utils/Stream';\nimport DiscussionPoll from './components/DiscussionPoll';\n\n// import PollVote from './components/PollVote';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const discussion = this.attrs.post.discussion();\n\n if (discussion.poll() && this.attrs.post.number() === 1) {\n content.push(\n DiscussionPoll.component({\n poll: discussion.poll(),\n })\n );\n }\n });\n\n extend(CommentPost.prototype, 'oncreate', function (context) {\n if (app.pusher) {\n app.pusher.then((channels) => {\n channels.main.bind('newPollVote', (data) => {\n var userId = parseInt(data['user_id']);\n\n if (app.session.user && userId == app.session.user.id()) return;\n\n let poll = app.store.getById('polls', this.attrs.post.discussion().poll().id());\n\n if (parseInt(poll.id()) === parseInt(data['poll_id'])) {\n let vote = {};\n\n Object.keys(data).map((key) => {\n vote[key] = Stream(data[key]);\n });\n\n vote['option'] = Stream(app.store.getById('poll_options', data['option_id']));\n vote['user'] = Stream(app.store.getById('users', data['user_id']));\n\n let newVotes = poll.votes();\n\n newVotes.some((vote, i) => {\n if (parseInt(vote.user() && vote.user().id()) === userId) {\n newVotes.splice(i, 1);\n }\n });\n\n newVotes.push(vote);\n\n poll.votes = Stream(newVotes);\n\n m.redraw.sync();\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPollVote'));\n });\n }\n });\n};\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://@fof/polls/webpack/bootstrap","webpack://@fof/polls/external \"flarum.core.compat['Model']\"","webpack://@fof/polls/external \"flarum.core.compat['utils/Stream']\"","webpack://@fof/polls/external \"flarum.core.compat['extend']\"","webpack://@fof/polls/external \"flarum.core.compat['components/Button']\"","webpack://@fof/polls/external \"flarum.core.compat['utils/mixin']\"","webpack://@fof/polls/external \"flarum.core.compat['components/Modal']\"","webpack://@fof/polls/external \"flarum.core.compat['components/DiscussionComposer']\"","webpack://@fof/polls/external \"flarum.core.compat['components/CommentPost']\"","webpack://@fof/polls/external \"flarum.core.compat['components/Badge']\"","webpack://@fof/polls/external \"flarum.core.compat['components/DiscussionList']\"","webpack://@fof/polls/external \"flarum.core.compat['models/Discussion']\"","webpack://@fof/polls/external \"flarum.core.compat['components/Switch']\"","webpack://@fof/polls/./node_modules/flatpickr/dist/flatpickr.js","webpack://@fof/polls/external \"flarum.core.compat['Component']\"","webpack://@fof/polls/external \"flarum.core.compat['components/LogInModal']\"","webpack://@fof/polls/external \"flarum.core.compat['helpers/avatar']\"","webpack://@fof/polls/external \"flarum.core.compat['helpers/username']\"","webpack://@fof/polls/external \"flarum.core.compat['utils/PostControls']\"","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@fof/polls/./src/forum/models/Poll.js","webpack://@fof/polls/./src/forum/models/PollOption.js","webpack://@fof/polls/./src/forum/models/PollVote.js","webpack://@fof/polls/./src/forum/components/CreatePollModal.js","webpack://@fof/polls/./node_modules/@babel/runtime/helpers/esm/extends.js","webpack://@fof/polls/./src/forum/components/ListVotersModal.js","webpack://@fof/polls/./src/forum/components/DiscussionPoll.js","webpack://@fof/polls/./src/forum/components/EditPollModal.js","webpack://@fof/polls/./src/forum/components/index.js","webpack://@fof/polls/./src/forum/models/index.js","webpack://@fof/polls/./src/forum/index.js","webpack://@fof/polls/./src/forum/addDiscussionBadge.js","webpack://@fof/polls/./src/forum/addDiscussionControls.js","webpack://@fof/polls/./src/forum/addDiscussionComposerItem.js","webpack://@fof/polls/./src/forum/addPollToDiscussion.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","flarum","core","compat","__assign","assign","arguments","length","apply","this","__spreadArrays","il","Array","k","a","j","jl","HOOKS","defaults","_disable","_enable","allowInput","allowInvalidPreload","altFormat","altInput","altInputClass","animate","window","navigator","userAgent","indexOf","ariaDateFormat","autoFillDefaultTime","clickOpens","closeOnSelect","conjunction","dateFormat","defaultHour","defaultMinute","defaultSeconds","disable","disableMobile","enable","enableSeconds","enableTime","errorHandler","err","console","warn","getWeek","givenDate","date","Date","getTime","setHours","setDate","getDate","getDay","week1","getFullYear","Math","round","hourIncrement","ignoredFocusElements","inline","locale","minuteIncrement","monthSelectorType","nextArrow","noCalendar","now","onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition","plugins","position","positionElement","undefined","prevArrow","shorthandCurrentMonth","showMonths","static","time_24hr","weekNumbers","wrap","english","weekdays","shorthand","longhand","months","daysInMonth","firstDayOfWeek","ordinal","nth","rangeSeparator","weekAbbreviation","scrollTitle","toggleTitle","amPM","yearAriaLabel","monthAriaLabel","hourAriaLabel","minuteAriaLabel","pad","number","slice","int","bool","debounce","func","wait","immediate","timeout","context","args","clearTimeout","setTimeout","arrayify","obj","toggleClass","elem","className","classList","add","remove","createElement","tag","content","e","document","textContent","clearNode","node","firstChild","removeChild","createNumberInput","inputClassName","opts","wrapper","numInput","arrowUp","arrowDown","type","pattern","setAttribute","appendChild","getEventTarget","event","composedPath","target","error","doNothing","monthToStr","monthNumber","revFormat","D","F","dateObj","monthName","setMonth","G","hour","parseFloat","H","J","day","K","getHours","RegExp","test","M","shortMonth","S","seconds","setSeconds","U","_","unixSeconds","W","weekNum","weekNumber","parseInt","Y","year","setFullYear","Z","ISODate","h","minutes","setMinutes","month","u","unixMillSeconds","w","y","tokenRegex","formats","toISOString","options","getMonth","getSeconds","getMinutes","String","substring","createDateFormatter","_a","_b","config","_c","l10n","_d","isMobile","frmt","overrideLocale","formatDate","split","map","arr","join","createDateParser","givenFormat","timeless","customLocale","parsedDate","dateOrig","toFixed","format","datestr","trim","parseDate","matched","ops","matchIndex","regexStr","token_1","isBackSlash","escaped","match","exec","fn","val","forEach","isNaN","Error","compareDates","date1","date2","duration","FlatpickrInstance","element","instanceConfig","self","flatpickr","defaultConfig","bindToInstance","setCalendarWidth","requestAnimationFrame","calendarContainer","style","visibility","display","daysContainer","daysWidth","days","offsetWidth","width","weekWrapper","removeProperty","updateTime","selectedDates","defaultDate","minDate","getDefaultHours","hours","preventDefault","isKeyDown","eventTarget","input","min","getAttribute","max","step","curValue","delta","which","newValue","isHourElem","hourElement","isMinuteElem","minuteElement","incrementNumInput","abs","timeWrapper","prevValue","_input","setHoursFromInputs","updateValue","_debouncedChange","secondElement","limitMinHours","minTime","minDateHasTime","latestSelectedDateObj","maxTime","maxDate","maxDateHasTime","setHoursFromDate","minHr","minMinutes","maxHr","maxMinutes","onYearInput","toString","changeYear","handler","ev","el","addEventListener","_handlers","push","triggerChange","triggerEvent","jumpToDate","jumpDate","jumpTo","oldYear","currentYear","oldMonth","currentMonth","message","buildMonthSwitch","redraw","timeIncrement","contains","inputElem","parentNode","createEvent","dispatchEvent","createDay","dayNumber","dateIsEnabled","isEnabled","dayElement","$i","todayDateElem","tabIndex","isDateSelected","selectedDateElem","isDateInRange","insertAdjacentHTML","focusOnDayElem","targetNode","focus","onMouseOver","getFirstAvailableDay","startMonth","endMonth","children","startIndex","endIndex","focusOnDay","current","offset","dayFocused","isInView","activeElement","body","startElem","givenMonth","loopDelta","numMonthDays","changeMonth","getNextAvailableDay","buildMonthDays","firstOfMonth","prevMonthDays","utils","getDaysInMonth","createDocumentFragment","isMultiMonth","prevMonthDayClass","nextMonthDayClass","dayIndex","dayNum","dayContainer","buildDays","frag","shouldBuildMonth","monthsDropdownContainer","innerHTML","selected","buildMonth","monthElement","container","monthNavFragment","selectedMonth","yearInput","tabindex","yearElement","getElementsByTagName","disabled","buildMonths","monthNav","prevMonthNav","yearElements","monthElements","nextMonthNav","buildWeekdays","weekdayContainer","updateWeekdays","splice","isOffset","_hidePrevMonthArrow","_hideNextMonthArrow","updateNavigationCurrentMonth","isCalendarElem","appendTo","documentClick","isOpen","eventTarget_1","isCalendarElement","isInput","path","lostFocus","relatedTarget","isIgnored","some","timeContainer","close","clear","newYear","newYearNum","isNewYear","dateToCheck","array","parsed","from","to","onBlur","allowKeydown","allowInlineKeydown","keyCode","blur","open","isTimeObj","focusAndClose","selectDate","delta_1","ctrlKey","stopPropagation","currentYearElement","elems","concat","pluginElements","filter","x","shiftKey","charAt","toLowerCase","hoverDate","firstElementChild","initialDate","rangeStartDate","rangeEndDate","containsDisabled","minRange","maxRange","_loop_1","ts","ts1","ts2","dayElem","timestamp","outOfRange","onResize","positionCalendar","minMaxDateSetter","inverseDateObj","removeAttribute","getInputElem","querySelector","setupLocale","l10ns","default","JSON","parse","stringify","dataset","customPositionElement","_positionElement","calendarHeight","reduce","acc","child","offsetHeight","calendarWidth","configPos","configPosVertical","configPosHorizontal","inputBounds","getBoundingClientRect","distanceFromBottom","innerHeight","bottom","showOnTop","top","pageYOffset","left","pageXOffset","isCenter","isRight","right","rightMost","centerMost","doc","editableSheet","styleSheets","sheet","cssRules","head","getDocumentStyleSheet","bodyWidth","centerLeft","centerIndex","centerStyle","insertRule","centerBefore","msMaxTouchPoints","findParent","condition","selectedDate","shouldChangeMonth","selectedIndex","sort","b","single","range","loadedPlugins","_bind","_setHoursFromDate","_positionCalendar","triggerChangeEvent","toInitial","mobileInput","_initialDate","_createElement","destroy","removeEventListener","lastChild","insertBefore","_type","click","wasOpen","select","set","option","CALLBACKS","setSelectedDate","toggle","inputDate","dates","parseDateRules","rule","data","hooks","initEvent","getDateStr","dObj","mobileFormatStr","onMonthNavClick","isPrevMonth","isNextMonth","boolOpts","userConfig","timeMode","defaultDateFormat","defaultAltFormat","_minDate","_maxDate","minMaxTimeSetter","_minTime","_maxTime","hook","pluginConf","parseConfig","nodeName","placeholder","required","nextSibling","preloadedDate","setupDates","yr","fragment","__hidePrevMonthArrow","__hideNextMonthArrow","innerContainer","buildWeeks","rContainer","separator","hourInput","minuteInput","military2ampm","secondInput","title","buildTime","customAppend","nodeType","build","evt","querySelectorAll","inputType","defaultValue","setupMobile","debouncedResize","ontouchstart","capture","bindEvents","isSafari","init","_flatpickr","nodeList","nodes","HTMLElement","instances","_i","TypeError","source","keys","args_1","HTMLCollection","NodeList","selector","Node","en","localize","setDefaults","jQuery","fp_incr","factory","_inheritsLoose","subClass","superClass","constructor","__proto__","Poll","apiEndpoint","exists","id","mixin","Model","question","attribute","hasEnded","endDate","publicPoll","hasMany","votes","PollOption","answer","poll","hasOne","PollVote","pollId","user","optionId","CreatePollModal","oninit","vnode","Stream","attrs","relationships","app","translator","trans","configDatePicker","dom","bidi","Button","component","icon","onclick","addOption","displayOptions","oncreate","data-input","Switch","state","onchange","loading","removeOption","setting","alert","onsubmit","Boolean","modal","Modal","_extends","ListVotersModal","opt","v","href","route","avatar","username","DiscussionPoll","vote","voted","updateData","view","hasVoted","percent","transChoice","count","$","tooltip","placement","inputAttrs","checked","data-selected","session","canVotePolls","changeVote","showVoters","class","time","dayjs","fromNow","store","getById","find","onError","alerts","show","LogInModal","createRecord","request","method","url","forum","then","res","pushPayload","sync","Component","EditPollModal","optionAnswers","attributes","save","location","reload","loaded","onerror","components","models","initializers","polls","poll_options","poll_votes","discussions","users","canEditPolls","canStartPolls","canSelfEditPolls","extend","DiscussionList","params","include","Discussion","badges","Badge","label","PostControls","items","post","discussion","confirm","DiscussionComposer","addPoll","CommentPost","pusher","channels","main","userId","newVotes","unbind"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KA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nzB,EAAE+W,OAAO2Z,YAIjBqB,iBAAO1oB,EAAS,YAAY,kBAAM2pB,EAASC,KAAKG,OAAO","file":"forum.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 19);\n","module.exports = flarum.core.compat['Model'];","module.exports = flarum.core.compat['utils/Stream'];","module.exports = flarum.core.compat['extend'];","module.exports = flarum.core.compat['components/Button'];","module.exports = flarum.core.compat['utils/mixin'];","module.exports = flarum.core.compat['components/Modal'];","module.exports = flarum.core.compat['components/DiscussionComposer'];","module.exports = flarum.core.compat['components/CommentPost'];","module.exports = flarum.core.compat['components/Badge'];","module.exports = flarum.core.compat['components/DiscussionList'];","module.exports = flarum.core.compat['models/Discussion'];","module.exports = flarum.core.compat['components/Switch'];","/* flatpickr v4.6.6, @license MIT */\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.flatpickr = factory());\n}(this, (function () { 'use strict';\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation.\r\n\r\n Permission to use, copy, modify, and/or distribute this software for any\r\n purpose with or without fee is hereby granted.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\n PERFORMANCE OF THIS SOFTWARE.\r\n ***************************************************************************** */\r\n\r\n var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n };\r\n\r\n function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n }\n\n var HOOKS = [\n \"onChange\",\n \"onClose\",\n \"onDayCreate\",\n \"onDestroy\",\n \"onKeyDown\",\n \"onMonthChange\",\n \"onOpen\",\n \"onParseConfig\",\n \"onReady\",\n \"onValueUpdate\",\n \"onYearChange\",\n \"onPreCalendarPosition\",\n ];\n var defaults = {\n _disable: [],\n _enable: [],\n allowInput: false,\n allowInvalidPreload: false,\n altFormat: \"F j, Y\",\n altInput: false,\n altInputClass: \"form-control input\",\n animate: typeof window === \"object\" &&\n window.navigator.userAgent.indexOf(\"MSIE\") === -1,\n ariaDateFormat: \"F j, Y\",\n autoFillDefaultTime: true,\n clickOpens: true,\n closeOnSelect: true,\n conjunction: \", \",\n dateFormat: \"Y-m-d\",\n defaultHour: 12,\n defaultMinute: 0,\n defaultSeconds: 0,\n disable: [],\n disableMobile: false,\n enable: [],\n enableSeconds: false,\n enableTime: false,\n errorHandler: function (err) {\n return typeof console !== \"undefined\" && console.warn(err);\n },\n getWeek: function (givenDate) {\n var date = new Date(givenDate.getTime());\n date.setHours(0, 0, 0, 0);\n // Thursday in current week decides the year.\n date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));\n // January 4 is always in week 1.\n var week1 = new Date(date.getFullYear(), 0, 4);\n // Adjust to Thursday in week 1 and count number of weeks from date to week1.\n return (1 +\n Math.round(((date.getTime() - week1.getTime()) / 86400000 -\n 3 +\n ((week1.getDay() + 6) % 7)) /\n 7));\n },\n hourIncrement: 1,\n ignoredFocusElements: [],\n inline: false,\n locale: \"default\",\n minuteIncrement: 5,\n mode: \"single\",\n monthSelectorType: \"dropdown\",\n nextArrow: \"\",\n noCalendar: false,\n now: new Date(),\n onChange: [],\n onClose: [],\n onDayCreate: [],\n onDestroy: [],\n onKeyDown: [],\n onMonthChange: [],\n onOpen: [],\n onParseConfig: [],\n onReady: [],\n onValueUpdate: [],\n onYearChange: [],\n onPreCalendarPosition: [],\n plugins: [],\n position: \"auto\",\n positionElement: undefined,\n prevArrow: \"\",\n shorthandCurrentMonth: false,\n showMonths: 1,\n static: false,\n time_24hr: false,\n weekNumbers: false,\n wrap: false,\n };\n\n var english = {\n weekdays: {\n shorthand: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n longhand: [\n \"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n ],\n },\n months: {\n shorthand: [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ],\n longhand: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n },\n daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],\n firstDayOfWeek: 0,\n ordinal: function (nth) {\n var s = nth % 100;\n if (s > 3 && s < 21)\n return \"th\";\n switch (s % 10) {\n case 1:\n return \"st\";\n case 2:\n return \"nd\";\n case 3:\n return \"rd\";\n default:\n return \"th\";\n }\n },\n rangeSeparator: \" to \",\n weekAbbreviation: \"Wk\",\n scrollTitle: \"Scroll to increment\",\n toggleTitle: \"Click to toggle\",\n amPM: [\"AM\", \"PM\"],\n yearAriaLabel: \"Year\",\n monthAriaLabel: \"Month\",\n hourAriaLabel: \"Hour\",\n minuteAriaLabel: \"Minute\",\n time_24hr: false,\n };\n\n var pad = function (number, length) {\n if (length === void 0) { length = 2; }\n return (\"000\" + number).slice(length * -1);\n };\n var int = function (bool) { return (bool === true ? 1 : 0); };\n /* istanbul ignore next */\n function debounce(func, wait, immediate) {\n if (immediate === void 0) { immediate = false; }\n var timeout;\n return function () {\n var context = this, args = arguments;\n timeout !== null && clearTimeout(timeout);\n timeout = window.setTimeout(function () {\n timeout = null;\n if (!immediate)\n func.apply(context, args);\n }, wait);\n if (immediate && !timeout)\n func.apply(context, args);\n };\n }\n var arrayify = function (obj) {\n return obj instanceof Array ? obj : [obj];\n };\n\n function toggleClass(elem, className, bool) {\n if (bool === true)\n return elem.classList.add(className);\n elem.classList.remove(className);\n }\n function createElement(tag, className, content) {\n var e = window.document.createElement(tag);\n className = className || \"\";\n content = content || \"\";\n e.className = className;\n if (content !== undefined)\n e.textContent = content;\n return e;\n }\n function clearNode(node) {\n while (node.firstChild)\n node.removeChild(node.firstChild);\n }\n function findParent(node, condition) {\n if (condition(node))\n return node;\n else if (node.parentNode)\n return findParent(node.parentNode, condition);\n return undefined; // nothing found\n }\n function createNumberInput(inputClassName, opts) {\n var wrapper = createElement(\"div\", \"numInputWrapper\"), numInput = createElement(\"input\", \"numInput \" + inputClassName), arrowUp = createElement(\"span\", \"arrowUp\"), arrowDown = createElement(\"span\", \"arrowDown\");\n if (navigator.userAgent.indexOf(\"MSIE 9.0\") === -1) {\n numInput.type = \"number\";\n }\n else {\n numInput.type = \"text\";\n numInput.pattern = \"\\\\d*\";\n }\n if (opts !== undefined)\n for (var key in opts)\n numInput.setAttribute(key, opts[key]);\n wrapper.appendChild(numInput);\n wrapper.appendChild(arrowUp);\n wrapper.appendChild(arrowDown);\n return wrapper;\n }\n function getEventTarget(event) {\n try {\n if (typeof event.composedPath === \"function\") {\n var path = event.composedPath();\n return path[0];\n }\n return event.target;\n }\n catch (error) {\n return event.target;\n }\n }\n\n var doNothing = function () { return undefined; };\n var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? \"shorthand\" : \"longhand\"][monthNumber]; };\n var revFormat = {\n D: doNothing,\n F: function (dateObj, monthName, locale) {\n dateObj.setMonth(locale.months.longhand.indexOf(monthName));\n },\n G: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n H: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n J: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n K: function (dateObj, amPM, locale) {\n dateObj.setHours((dateObj.getHours() % 12) +\n 12 * int(new RegExp(locale.amPM[1], \"i\").test(amPM)));\n },\n M: function (dateObj, shortMonth, locale) {\n dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));\n },\n S: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); },\n W: function (dateObj, weekNum, locale) {\n var weekNumber = parseInt(weekNum);\n var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);\n date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);\n return date;\n },\n Y: function (dateObj, year) {\n dateObj.setFullYear(parseFloat(year));\n },\n Z: function (_, ISODate) { return new Date(ISODate); },\n d: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n h: function (dateObj, hour) {\n dateObj.setHours(parseFloat(hour));\n },\n i: function (dateObj, minutes) {\n dateObj.setMinutes(parseFloat(minutes));\n },\n j: function (dateObj, day) {\n dateObj.setDate(parseFloat(day));\n },\n l: doNothing,\n m: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n n: function (dateObj, month) {\n dateObj.setMonth(parseFloat(month) - 1);\n },\n s: function (dateObj, seconds) {\n dateObj.setSeconds(parseFloat(seconds));\n },\n u: function (_, unixMillSeconds) {\n return new Date(parseFloat(unixMillSeconds));\n },\n w: doNothing,\n y: function (dateObj, year) {\n dateObj.setFullYear(2000 + parseFloat(year));\n },\n };\n var tokenRegex = {\n D: \"(\\\\w+)\",\n F: \"(\\\\w+)\",\n G: \"(\\\\d\\\\d|\\\\d)\",\n H: \"(\\\\d\\\\d|\\\\d)\",\n J: \"(\\\\d\\\\d|\\\\d)\\\\w+\",\n K: \"\",\n M: \"(\\\\w+)\",\n S: \"(\\\\d\\\\d|\\\\d)\",\n U: \"(.+)\",\n W: \"(\\\\d\\\\d|\\\\d)\",\n Y: \"(\\\\d{4})\",\n Z: \"(.+)\",\n d: \"(\\\\d\\\\d|\\\\d)\",\n h: \"(\\\\d\\\\d|\\\\d)\",\n i: \"(\\\\d\\\\d|\\\\d)\",\n j: \"(\\\\d\\\\d|\\\\d)\",\n l: \"(\\\\w+)\",\n m: \"(\\\\d\\\\d|\\\\d)\",\n n: \"(\\\\d\\\\d|\\\\d)\",\n s: \"(\\\\d\\\\d|\\\\d)\",\n u: \"(.+)\",\n w: \"(\\\\d\\\\d|\\\\d)\",\n y: \"(\\\\d{2})\",\n };\n var formats = {\n // get the date in UTC\n Z: function (date) { return date.toISOString(); },\n // weekday name, short, e.g. Thu\n D: function (date, locale, options) {\n return locale.weekdays.shorthand[formats.w(date, locale, options)];\n },\n // full month name e.g. January\n F: function (date, locale, options) {\n return monthToStr(formats.n(date, locale, options) - 1, false, locale);\n },\n // padded hour 1-12\n G: function (date, locale, options) {\n return pad(formats.h(date, locale, options));\n },\n // hours with leading zero e.g. 03\n H: function (date) { return pad(date.getHours()); },\n // day (1-30) with ordinal suffix e.g. 1st, 2nd\n J: function (date, locale) {\n return locale.ordinal !== undefined\n ? date.getDate() + locale.ordinal(date.getDate())\n : date.getDate();\n },\n // AM/PM\n K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; },\n // shorthand month e.g. Jan, Sep, Oct, etc\n M: function (date, locale) {\n return monthToStr(date.getMonth(), true, locale);\n },\n // seconds 00-59\n S: function (date) { return pad(date.getSeconds()); },\n // unix timestamp\n U: function (date) { return date.getTime() / 1000; },\n W: function (date, _, options) {\n return options.getWeek(date);\n },\n // full year e.g. 2016, padded (0001-9999)\n Y: function (date) { return pad(date.getFullYear(), 4); },\n // day in month, padded (01-30)\n d: function (date) { return pad(date.getDate()); },\n // hour from 1-12 (am/pm)\n h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); },\n // minutes, padded with leading zero e.g. 09\n i: function (date) { return pad(date.getMinutes()); },\n // day in month (1-30)\n j: function (date) { return date.getDate(); },\n // weekday name, full, e.g. Thursday\n l: function (date, locale) {\n return locale.weekdays.longhand[date.getDay()];\n },\n // padded month number (01-12)\n m: function (date) { return pad(date.getMonth() + 1); },\n // the month number (1-12)\n n: function (date) { return date.getMonth() + 1; },\n // seconds 0-59\n s: function (date) { return date.getSeconds(); },\n // Unix Milliseconds\n u: function (date) { return date.getTime(); },\n // number of the day of the week\n w: function (date) { return date.getDay(); },\n // last two digits of year e.g. 16 for 2016\n y: function (date) { return String(date.getFullYear()).substring(2); },\n };\n\n var createDateFormatter = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d;\n return function (dateObj, frmt, overrideLocale) {\n var locale = overrideLocale || l10n;\n if (config.formatDate !== undefined && !isMobile) {\n return config.formatDate(dateObj, frmt, locale);\n }\n return frmt\n .split(\"\")\n .map(function (c, i, arr) {\n return formats[c] && arr[i - 1] !== \"\\\\\"\n ? formats[c](dateObj, locale, config)\n : c !== \"\\\\\"\n ? c\n : \"\";\n })\n .join(\"\");\n };\n };\n var createDateParser = function (_a) {\n var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;\n return function (date, givenFormat, timeless, customLocale) {\n if (date !== 0 && !date)\n return undefined;\n var locale = customLocale || l10n;\n var parsedDate;\n var dateOrig = date;\n if (date instanceof Date)\n parsedDate = new Date(date.getTime());\n else if (typeof date !== \"string\" &&\n date.toFixed !== undefined // timestamp\n )\n // create a copy\n parsedDate = new Date(date);\n else if (typeof date === \"string\") {\n // date string\n var format = givenFormat || (config || defaults).dateFormat;\n var datestr = String(date).trim();\n if (datestr === \"today\") {\n parsedDate = new Date();\n timeless = true;\n }\n else if (/Z$/.test(datestr) ||\n /GMT$/.test(datestr) // datestrings w/ timezone\n )\n parsedDate = new Date(date);\n else if (config && config.parseDate)\n parsedDate = config.parseDate(date, format);\n else {\n parsedDate =\n !config || !config.noCalendar\n ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)\n : new Date(new Date().setHours(0, 0, 0, 0));\n var matched = void 0, ops = [];\n for (var i = 0, matchIndex = 0, regexStr = \"\"; i < format.length; i++) {\n var token_1 = format[i];\n var isBackSlash = token_1 === \"\\\\\";\n var escaped = format[i - 1] === \"\\\\\" || isBackSlash;\n if (tokenRegex[token_1] && !escaped) {\n regexStr += tokenRegex[token_1];\n var match = new RegExp(regexStr).exec(date);\n if (match && (matched = true)) {\n ops[token_1 !== \"Y\" ? \"push\" : \"unshift\"]({\n fn: revFormat[token_1],\n val: match[++matchIndex],\n });\n }\n }\n else if (!isBackSlash)\n regexStr += \".\"; // don't really care\n ops.forEach(function (_a) {\n var fn = _a.fn, val = _a.val;\n return (parsedDate = fn(parsedDate, val, locale) || parsedDate);\n });\n }\n parsedDate = matched ? parsedDate : undefined;\n }\n }\n /* istanbul ignore next */\n if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {\n config.errorHandler(new Error(\"Invalid date provided: \" + dateOrig));\n return undefined;\n }\n if (timeless === true)\n parsedDate.setHours(0, 0, 0, 0);\n return parsedDate;\n };\n };\n /**\n * Compute the difference in dates, measured in ms\n */\n function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }\n var isBetween = function (ts, ts1, ts2) {\n return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);\n };\n var duration = {\n DAY: 86400000,\n };\n\n if (typeof Object.assign !== \"function\") {\n Object.assign = function (target) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!target) {\n throw TypeError(\"Cannot convert undefined or null to object\");\n }\n var _loop_1 = function (source) {\n if (source) {\n Object.keys(source).forEach(function (key) { return (target[key] = source[key]); });\n }\n };\n for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {\n var source = args_1[_a];\n _loop_1(source);\n }\n return target;\n };\n }\n\n var DEBOUNCED_CHANGE_MS = 300;\n function FlatpickrInstance(element, instanceConfig) {\n var self = {\n config: __assign(__assign({}, defaults), flatpickr.defaultConfig),\n l10n: english,\n };\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n self._handlers = [];\n self.pluginElements = [];\n self.loadedPlugins = [];\n self._bind = bind;\n self._setHoursFromDate = setHoursFromDate;\n self._positionCalendar = positionCalendar;\n self.changeMonth = changeMonth;\n self.changeYear = changeYear;\n self.clear = clear;\n self.close = close;\n self._createElement = createElement;\n self.destroy = destroy;\n self.isEnabled = isEnabled;\n self.jumpToDate = jumpToDate;\n self.open = open;\n self.redraw = redraw;\n self.set = set;\n self.setDate = setDate;\n self.toggle = toggle;\n function setupHelperFunctions() {\n self.utils = {\n getDaysInMonth: function (month, yr) {\n if (month === void 0) { month = self.currentMonth; }\n if (yr === void 0) { yr = self.currentYear; }\n if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0))\n return 29;\n return self.l10n.daysInMonth[month];\n },\n };\n }\n function init() {\n self.element = self.input = element;\n self.isOpen = false;\n parseConfig();\n setupLocale();\n setupInputs();\n setupDates();\n setupHelperFunctions();\n if (!self.isMobile)\n build();\n bindEvents();\n if (self.selectedDates.length || self.config.noCalendar) {\n if (self.config.enableTime) {\n setHoursFromDate(self.config.noCalendar\n ? self.latestSelectedDateObj || self.config.minDate\n : undefined);\n }\n updateValue(false);\n }\n setCalendarWidth();\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n /* TODO: investigate this further\n \n Currently, there is weird positioning behavior in safari causing pages\n to scroll up. https://github.com/chmln/flatpickr/issues/563\n \n However, most browsers are not Safari and positioning is expensive when used\n in scale. https://github.com/chmln/flatpickr/issues/1096\n */\n if (!self.isMobile && isSafari) {\n positionCalendar();\n }\n triggerEvent(\"onReady\");\n }\n function bindToInstance(fn) {\n return fn.bind(self);\n }\n function setCalendarWidth() {\n var config = self.config;\n if (config.weekNumbers === false && config.showMonths === 1) {\n return;\n }\n else if (config.noCalendar !== true) {\n window.requestAnimationFrame(function () {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.style.visibility = \"hidden\";\n self.calendarContainer.style.display = \"block\";\n }\n if (self.daysContainer !== undefined) {\n var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;\n self.daysContainer.style.width = daysWidth + \"px\";\n self.calendarContainer.style.width =\n daysWidth +\n (self.weekWrapper !== undefined\n ? self.weekWrapper.offsetWidth\n : 0) +\n \"px\";\n self.calendarContainer.style.removeProperty(\"visibility\");\n self.calendarContainer.style.removeProperty(\"display\");\n }\n });\n }\n }\n /**\n * The handler for all events targeting the time inputs\n */\n function updateTime(e) {\n if (self.selectedDates.length === 0) {\n var defaultDate = self.config.minDate !== undefined\n ? new Date(self.config.minDate.getTime())\n : new Date();\n var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;\n defaultDate.setHours(hours, minutes, seconds, 0);\n self.setDate(defaultDate, false);\n }\n if (e !== undefined && e.type !== \"blur\") {\n timeWrapper(e);\n }\n var prevValue = self._input.value;\n setHoursFromInputs();\n updateValue();\n if (self._input.value !== prevValue) {\n self._debouncedChange();\n }\n }\n function ampm2military(hour, amPM) {\n return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]);\n }\n function military2ampm(hour) {\n switch (hour % 24) {\n case 0:\n case 12:\n return 12;\n default:\n return hour % 12;\n }\n }\n /**\n * Syncs the selected date object time with user's time input\n */\n function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined)\n return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n ? (parseInt(self.secondElement.value, 10) || 0) % 60\n : 0;\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n var limitMinHours = self.config.minTime !== undefined ||\n (self.config.minDate &&\n self.minDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n 0);\n var limitMaxHours = self.config.maxTime !== undefined ||\n (self.config.maxDate &&\n self.maxDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n 0);\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined\n ? self.config.maxTime\n : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours())\n minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes())\n seconds = Math.min(seconds, maxTime.getSeconds());\n }\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined\n ? self.config.minTime\n : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours())\n minutes = Math.max(minutes, minTime.getMinutes());\n if (minutes === minTime.getMinutes())\n seconds = Math.max(seconds, minTime.getSeconds());\n }\n setHours(hours, minutes, seconds);\n }\n /**\n * Syncs time input values with a date\n */\n function setHoursFromDate(dateObj) {\n var date = dateObj || self.latestSelectedDateObj;\n if (date) {\n setHours(date.getHours(), date.getMinutes(), date.getSeconds());\n }\n }\n function getDefaultHours() {\n var hours = self.config.defaultHour;\n var minutes = self.config.defaultMinute;\n var seconds = self.config.defaultSeconds;\n if (self.config.minDate !== undefined) {\n var minHr = self.config.minDate.getHours();\n var minMinutes = self.config.minDate.getMinutes();\n hours = Math.max(hours, minHr);\n if (hours === minHr)\n minutes = Math.max(minMinutes, minutes);\n if (hours === minHr && minutes === minMinutes)\n seconds = self.config.minDate.getSeconds();\n }\n if (self.config.maxDate !== undefined) {\n var maxHr = self.config.maxDate.getHours();\n var maxMinutes = self.config.maxDate.getMinutes();\n hours = Math.min(hours, maxHr);\n if (hours === maxHr)\n minutes = Math.min(maxMinutes, minutes);\n if (hours === maxHr && minutes === maxMinutes)\n seconds = self.config.maxDate.getSeconds();\n }\n return { hours: hours, minutes: minutes, seconds: seconds };\n }\n /**\n * Sets the hours, minutes, and optionally seconds\n * of the latest selected date object and the\n * corresponding time inputs\n * @param {Number} hours the hour. whether its military\n * or am-pm gets inferred from config\n * @param {Number} minutes the minutes\n * @param {Number} seconds the seconds (optional)\n */\n function setHours(hours, minutes, seconds) {\n if (self.latestSelectedDateObj !== undefined) {\n self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);\n }\n if (!self.hourElement || !self.minuteElement || self.isMobile)\n return;\n self.hourElement.value = pad(!self.config.time_24hr\n ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0)\n : hours);\n self.minuteElement.value = pad(minutes);\n if (self.amPM !== undefined)\n self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];\n if (self.secondElement !== undefined)\n self.secondElement.value = pad(seconds);\n }\n /**\n * Handles the year input and incrementing events\n * @param {Event} event the keyup or increment event\n */\n function onYearInput(event) {\n var eventTarget = getEventTarget(event);\n var year = parseInt(eventTarget.value) + (event.delta || 0);\n if (year / 1000 > 1 ||\n (event.key === \"Enter\" && !/[^\\d]/.test(year.toString()))) {\n changeYear(year);\n }\n }\n /**\n * Essentially addEventListener + tracking\n * @param {Element} element the element to addEventListener to\n * @param {String} event the event name\n * @param {Function} handler the event handler\n */\n function bind(element, event, handler, options) {\n if (event instanceof Array)\n return event.forEach(function (ev) { return bind(element, ev, handler, options); });\n if (element instanceof Array)\n return element.forEach(function (el) { return bind(el, event, handler, options); });\n element.addEventListener(event, handler, options);\n self._handlers.push({\n element: element,\n event: event,\n handler: handler,\n options: options,\n });\n }\n function triggerChange() {\n triggerEvent(\"onChange\");\n }\n /**\n * Adds all the necessary event listeners\n */\n function bindEvents() {\n if (self.config.wrap) {\n [\"open\", \"close\", \"toggle\", \"clear\"].forEach(function (evt) {\n Array.prototype.forEach.call(self.element.querySelectorAll(\"[data-\" + evt + \"]\"), function (el) {\n return bind(el, \"click\", self[evt]);\n });\n });\n }\n if (self.isMobile) {\n setupMobile();\n return;\n }\n var debouncedResize = debounce(onResize, 50);\n self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);\n if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))\n bind(self.daysContainer, \"mouseover\", function (e) {\n if (self.config.mode === \"range\")\n onMouseOver(getEventTarget(e));\n });\n bind(window.document.body, \"keydown\", onKeyDown);\n if (!self.config.inline && !self.config.static)\n bind(window, \"resize\", debouncedResize);\n if (window.ontouchstart !== undefined)\n bind(window.document, \"touchstart\", documentClick);\n else\n bind(window.document, \"click\", documentClick);\n bind(window.document, \"focus\", documentClick, { capture: true });\n if (self.config.clickOpens === true) {\n bind(self._input, \"focus\", self.open);\n bind(self._input, \"click\", self.open);\n }\n if (self.daysContainer !== undefined) {\n bind(self.monthNav, \"click\", onMonthNavClick);\n bind(self.monthNav, [\"keyup\", \"increment\"], onYearInput);\n bind(self.daysContainer, \"click\", selectDate);\n }\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined) {\n var selText = function (e) {\n return getEventTarget(e).select();\n };\n bind(self.timeContainer, [\"increment\"], updateTime);\n bind(self.timeContainer, \"blur\", updateTime, { capture: true });\n bind(self.timeContainer, \"click\", timeIncrement);\n bind([self.hourElement, self.minuteElement], [\"focus\", \"click\"], selText);\n if (self.secondElement !== undefined)\n bind(self.secondElement, \"focus\", function () { return self.secondElement && self.secondElement.select(); });\n if (self.amPM !== undefined) {\n bind(self.amPM, \"click\", function (e) {\n updateTime(e);\n triggerChange();\n });\n }\n }\n if (self.config.allowInput)\n bind(self._input, \"blur\", onBlur);\n }\n /**\n * Set the calendar view to a particular date.\n * @param {Date} jumpDate the date to set the view to\n * @param {boolean} triggerChange if change events should be triggered\n */\n function jumpToDate(jumpDate, triggerChange) {\n var jumpTo = jumpDate !== undefined\n ? self.parseDate(jumpDate)\n : self.latestSelectedDateObj ||\n (self.config.minDate && self.config.minDate > self.now\n ? self.config.minDate\n : self.config.maxDate && self.config.maxDate < self.now\n ? self.config.maxDate\n : self.now);\n var oldYear = self.currentYear;\n var oldMonth = self.currentMonth;\n try {\n if (jumpTo !== undefined) {\n self.currentYear = jumpTo.getFullYear();\n self.currentMonth = jumpTo.getMonth();\n }\n }\n catch (e) {\n /* istanbul ignore next */\n e.message = \"Invalid date supplied: \" + jumpTo;\n self.config.errorHandler(e);\n }\n if (triggerChange && self.currentYear !== oldYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n if (triggerChange &&\n (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {\n triggerEvent(\"onMonthChange\");\n }\n self.redraw();\n }\n /**\n * The up/down arrow handler for time inputs\n * @param {Event} e the click event\n */\n function timeIncrement(e) {\n var eventTarget = getEventTarget(e);\n if (~eventTarget.className.indexOf(\"arrow\"))\n incrementNumInput(e, eventTarget.classList.contains(\"arrowUp\") ? 1 : -1);\n }\n /**\n * Increments/decrements the value of input associ-\n * ated with the up/down arrow by dispatching an\n * \"increment\" event on the input.\n *\n * @param {Event} e the click event\n * @param {Number} delta the diff (usually 1 or -1)\n * @param {Element} inputElem the input element\n */\n function incrementNumInput(e, delta, inputElem) {\n var target = e && getEventTarget(e);\n var input = inputElem ||\n (target && target.parentNode && target.parentNode.firstChild);\n var event = createEvent(\"increment\");\n event.delta = delta;\n input && input.dispatchEvent(event);\n }\n function build() {\n var fragment = window.document.createDocumentFragment();\n self.calendarContainer = createElement(\"div\", \"flatpickr-calendar\");\n self.calendarContainer.tabIndex = -1;\n if (!self.config.noCalendar) {\n fragment.appendChild(buildMonthNav());\n self.innerContainer = createElement(\"div\", \"flatpickr-innerContainer\");\n if (self.config.weekNumbers) {\n var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;\n self.innerContainer.appendChild(weekWrapper);\n self.weekNumbers = weekNumbers;\n self.weekWrapper = weekWrapper;\n }\n self.rContainer = createElement(\"div\", \"flatpickr-rContainer\");\n self.rContainer.appendChild(buildWeekdays());\n if (!self.daysContainer) {\n self.daysContainer = createElement(\"div\", \"flatpickr-days\");\n self.daysContainer.tabIndex = -1;\n }\n buildDays();\n self.rContainer.appendChild(self.daysContainer);\n self.innerContainer.appendChild(self.rContainer);\n fragment.appendChild(self.innerContainer);\n }\n if (self.config.enableTime) {\n fragment.appendChild(buildTime());\n }\n toggleClass(self.calendarContainer, \"rangeMode\", self.config.mode === \"range\");\n toggleClass(self.calendarContainer, \"animate\", self.config.animate === true);\n toggleClass(self.calendarContainer, \"multiMonth\", self.config.showMonths > 1);\n self.calendarContainer.appendChild(fragment);\n var customAppend = self.config.appendTo !== undefined &&\n self.config.appendTo.nodeType !== undefined;\n if (self.config.inline || self.config.static) {\n self.calendarContainer.classList.add(self.config.inline ? \"inline\" : \"static\");\n if (self.config.inline) {\n if (!customAppend && self.element.parentNode)\n self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);\n else if (self.config.appendTo !== undefined)\n self.config.appendTo.appendChild(self.calendarContainer);\n }\n if (self.config.static) {\n var wrapper = createElement(\"div\", \"flatpickr-wrapper\");\n if (self.element.parentNode)\n self.element.parentNode.insertBefore(wrapper, self.element);\n wrapper.appendChild(self.element);\n if (self.altInput)\n wrapper.appendChild(self.altInput);\n wrapper.appendChild(self.calendarContainer);\n }\n }\n if (!self.config.static && !self.config.inline)\n (self.config.appendTo !== undefined\n ? self.config.appendTo\n : window.document.body).appendChild(self.calendarContainer);\n }\n function createDay(className, date, dayNumber, i) {\n var dateIsEnabled = isEnabled(date, true), dayElement = createElement(\"span\", \"flatpickr-day \" + className, date.getDate().toString());\n dayElement.dateObj = date;\n dayElement.$i = i;\n dayElement.setAttribute(\"aria-label\", self.formatDate(date, self.config.ariaDateFormat));\n if (className.indexOf(\"hidden\") === -1 &&\n compareDates(date, self.now) === 0) {\n self.todayDateElem = dayElement;\n dayElement.classList.add(\"today\");\n dayElement.setAttribute(\"aria-current\", \"date\");\n }\n if (dateIsEnabled) {\n dayElement.tabIndex = -1;\n if (isDateSelected(date)) {\n dayElement.classList.add(\"selected\");\n self.selectedDateElem = dayElement;\n if (self.config.mode === \"range\") {\n toggleClass(dayElement, \"startRange\", self.selectedDates[0] &&\n compareDates(date, self.selectedDates[0], true) === 0);\n toggleClass(dayElement, \"endRange\", self.selectedDates[1] &&\n compareDates(date, self.selectedDates[1], true) === 0);\n if (className === \"nextMonthDay\")\n dayElement.classList.add(\"inRange\");\n }\n }\n }\n else {\n dayElement.classList.add(\"flatpickr-disabled\");\n }\n if (self.config.mode === \"range\") {\n if (isDateInRange(date) && !isDateSelected(date))\n dayElement.classList.add(\"inRange\");\n }\n if (self.weekNumbers &&\n self.config.showMonths === 1 &&\n className !== \"prevMonthDay\" &&\n dayNumber % 7 === 1) {\n self.weekNumbers.insertAdjacentHTML(\"beforeend\", \"\" + self.config.getWeek(date) + \"\");\n }\n triggerEvent(\"onDayCreate\", dayElement);\n return dayElement;\n }\n function focusOnDayElem(targetNode) {\n targetNode.focus();\n if (self.config.mode === \"range\")\n onMouseOver(targetNode);\n }\n function getFirstAvailableDay(delta) {\n var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n for (var m = startMonth; m != endMonth; m += delta) {\n var month = self.daysContainer.children[m];\n var startIndex = delta > 0 ? 0 : month.children.length - 1;\n var endIndex = delta > 0 ? month.children.length : -1;\n for (var i = startIndex; i != endIndex; i += delta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 && isEnabled(c.dateObj))\n return c;\n }\n }\n return undefined;\n }\n function getNextAvailableDay(current, delta) {\n var givenMonth = current.className.indexOf(\"Month\") === -1\n ? current.dateObj.getMonth()\n : self.currentMonth;\n var endMonth = delta > 0 ? self.config.showMonths : -1;\n var loopDelta = delta > 0 ? 1 : -1;\n for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {\n var month = self.daysContainer.children[m];\n var startIndex = givenMonth - self.currentMonth === m\n ? current.$i + delta\n : delta < 0\n ? month.children.length - 1\n : 0;\n var numMonthDays = month.children.length;\n for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {\n var c = month.children[i];\n if (c.className.indexOf(\"hidden\") === -1 &&\n isEnabled(c.dateObj) &&\n Math.abs(current.$i - i) >= Math.abs(delta))\n return focusOnDayElem(c);\n }\n }\n self.changeMonth(loopDelta);\n focusOnDay(getFirstAvailableDay(loopDelta), 0);\n return undefined;\n }\n function focusOnDay(current, offset) {\n var dayFocused = isInView(document.activeElement || document.body);\n var startElem = current !== undefined\n ? current\n : dayFocused\n ? document.activeElement\n : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)\n ? self.selectedDateElem\n : self.todayDateElem !== undefined && isInView(self.todayDateElem)\n ? self.todayDateElem\n : getFirstAvailableDay(offset > 0 ? 1 : -1);\n if (startElem === undefined) {\n self._input.focus();\n }\n else if (!dayFocused) {\n focusOnDayElem(startElem);\n }\n else {\n getNextAvailableDay(startElem, offset);\n }\n }\n function buildMonthDays(year, month) {\n var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;\n var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year);\n var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? \"prevMonthDay hidden\" : \"prevMonthDay\", nextMonthDayClass = isMultiMonth ? \"nextMonthDay hidden\" : \"nextMonthDay\";\n var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;\n // prepend days from the ending of previous month\n for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {\n days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));\n }\n // Start at 1 since there is no 0th day\n for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {\n days.appendChild(createDay(\"\", new Date(year, month, dayNumber), dayNumber, dayIndex));\n }\n // append days from the next month\n for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&\n (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {\n days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));\n }\n //updateNavigationCurrentMonth();\n var dayContainer = createElement(\"div\", \"dayContainer\");\n dayContainer.appendChild(days);\n return dayContainer;\n }\n function buildDays() {\n if (self.daysContainer === undefined) {\n return;\n }\n clearNode(self.daysContainer);\n // TODO: week numbers for each month\n if (self.weekNumbers)\n clearNode(self.weekNumbers);\n var frag = document.createDocumentFragment();\n for (var i = 0; i < self.config.showMonths; i++) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));\n }\n self.daysContainer.appendChild(frag);\n self.days = self.daysContainer.firstChild;\n if (self.config.mode === \"range\" && self.selectedDates.length === 1) {\n onMouseOver();\n }\n }\n function buildMonthSwitch() {\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType !== \"dropdown\")\n return;\n var shouldBuildMonth = function (month) {\n if (self.config.minDate !== undefined &&\n self.currentYear === self.config.minDate.getFullYear() &&\n month < self.config.minDate.getMonth()) {\n return false;\n }\n return !(self.config.maxDate !== undefined &&\n self.currentYear === self.config.maxDate.getFullYear() &&\n month > self.config.maxDate.getMonth());\n };\n self.monthsDropdownContainer.tabIndex = -1;\n self.monthsDropdownContainer.innerHTML = \"\";\n for (var i = 0; i < 12; i++) {\n if (!shouldBuildMonth(i))\n continue;\n var month = createElement(\"option\", \"flatpickr-monthDropdown-month\");\n month.value = new Date(self.currentYear, i).getMonth().toString();\n month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);\n month.tabIndex = -1;\n if (self.currentMonth === i) {\n month.selected = true;\n }\n self.monthsDropdownContainer.appendChild(month);\n }\n }\n function buildMonth() {\n var container = createElement(\"div\", \"flatpickr-month\");\n var monthNavFragment = window.document.createDocumentFragment();\n var monthElement;\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n monthElement = createElement(\"span\", \"cur-month\");\n }\n else {\n self.monthsDropdownContainer = createElement(\"select\", \"flatpickr-monthDropdown-months\");\n self.monthsDropdownContainer.setAttribute(\"aria-label\", self.l10n.monthAriaLabel);\n bind(self.monthsDropdownContainer, \"change\", function (e) {\n var target = getEventTarget(e);\n var selectedMonth = parseInt(target.value, 10);\n self.changeMonth(selectedMonth - self.currentMonth);\n triggerEvent(\"onMonthChange\");\n });\n buildMonthSwitch();\n monthElement = self.monthsDropdownContainer;\n }\n var yearInput = createNumberInput(\"cur-year\", { tabindex: \"-1\" });\n var yearElement = yearInput.getElementsByTagName(\"input\")[0];\n yearElement.setAttribute(\"aria-label\", self.l10n.yearAriaLabel);\n if (self.config.minDate) {\n yearElement.setAttribute(\"min\", self.config.minDate.getFullYear().toString());\n }\n if (self.config.maxDate) {\n yearElement.setAttribute(\"max\", self.config.maxDate.getFullYear().toString());\n yearElement.disabled =\n !!self.config.minDate &&\n self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();\n }\n var currentMonth = createElement(\"div\", \"flatpickr-current-month\");\n currentMonth.appendChild(monthElement);\n currentMonth.appendChild(yearInput);\n monthNavFragment.appendChild(currentMonth);\n container.appendChild(monthNavFragment);\n return {\n container: container,\n yearElement: yearElement,\n monthElement: monthElement,\n };\n }\n function buildMonths() {\n clearNode(self.monthNav);\n self.monthNav.appendChild(self.prevMonthNav);\n if (self.config.showMonths) {\n self.yearElements = [];\n self.monthElements = [];\n }\n for (var m = self.config.showMonths; m--;) {\n var month = buildMonth();\n self.yearElements.push(month.yearElement);\n self.monthElements.push(month.monthElement);\n self.monthNav.appendChild(month.container);\n }\n self.monthNav.appendChild(self.nextMonthNav);\n }\n function buildMonthNav() {\n self.monthNav = createElement(\"div\", \"flatpickr-months\");\n self.yearElements = [];\n self.monthElements = [];\n self.prevMonthNav = createElement(\"span\", \"flatpickr-prev-month\");\n self.prevMonthNav.innerHTML = self.config.prevArrow;\n self.nextMonthNav = createElement(\"span\", \"flatpickr-next-month\");\n self.nextMonthNav.innerHTML = self.config.nextArrow;\n buildMonths();\n Object.defineProperty(self, \"_hidePrevMonthArrow\", {\n get: function () { return self.__hidePrevMonthArrow; },\n set: function (bool) {\n if (self.__hidePrevMonthArrow !== bool) {\n toggleClass(self.prevMonthNav, \"flatpickr-disabled\", bool);\n self.__hidePrevMonthArrow = bool;\n }\n },\n });\n Object.defineProperty(self, \"_hideNextMonthArrow\", {\n get: function () { return self.__hideNextMonthArrow; },\n set: function (bool) {\n if (self.__hideNextMonthArrow !== bool) {\n toggleClass(self.nextMonthNav, \"flatpickr-disabled\", bool);\n self.__hideNextMonthArrow = bool;\n }\n },\n });\n self.currentYearElement = self.yearElements[0];\n updateNavigationCurrentMonth();\n return self.monthNav;\n }\n function buildTime() {\n self.calendarContainer.classList.add(\"hasTime\");\n if (self.config.noCalendar)\n self.calendarContainer.classList.add(\"noCalendar\");\n self.timeContainer = createElement(\"div\", \"flatpickr-time\");\n self.timeContainer.tabIndex = -1;\n var separator = createElement(\"span\", \"flatpickr-time-separator\", \":\");\n var hourInput = createNumberInput(\"flatpickr-hour\", {\n \"aria-label\": self.l10n.hourAriaLabel,\n });\n self.hourElement = hourInput.getElementsByTagName(\"input\")[0];\n var minuteInput = createNumberInput(\"flatpickr-minute\", {\n \"aria-label\": self.l10n.minuteAriaLabel,\n });\n self.minuteElement = minuteInput.getElementsByTagName(\"input\")[0];\n self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;\n self.hourElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getHours()\n : self.config.time_24hr\n ? self.config.defaultHour\n : military2ampm(self.config.defaultHour));\n self.minuteElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getMinutes()\n : self.config.defaultMinute);\n self.hourElement.setAttribute(\"step\", self.config.hourIncrement.toString());\n self.minuteElement.setAttribute(\"step\", self.config.minuteIncrement.toString());\n self.hourElement.setAttribute(\"min\", self.config.time_24hr ? \"0\" : \"1\");\n self.hourElement.setAttribute(\"max\", self.config.time_24hr ? \"23\" : \"12\");\n self.minuteElement.setAttribute(\"min\", \"0\");\n self.minuteElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(hourInput);\n self.timeContainer.appendChild(separator);\n self.timeContainer.appendChild(minuteInput);\n if (self.config.time_24hr)\n self.timeContainer.classList.add(\"time24hr\");\n if (self.config.enableSeconds) {\n self.timeContainer.classList.add(\"hasSeconds\");\n var secondInput = createNumberInput(\"flatpickr-second\");\n self.secondElement = secondInput.getElementsByTagName(\"input\")[0];\n self.secondElement.value = pad(self.latestSelectedDateObj\n ? self.latestSelectedDateObj.getSeconds()\n : self.config.defaultSeconds);\n self.secondElement.setAttribute(\"step\", self.minuteElement.getAttribute(\"step\"));\n self.secondElement.setAttribute(\"min\", \"0\");\n self.secondElement.setAttribute(\"max\", \"59\");\n self.timeContainer.appendChild(createElement(\"span\", \"flatpickr-time-separator\", \":\"));\n self.timeContainer.appendChild(secondInput);\n }\n if (!self.config.time_24hr) {\n // add self.amPM if appropriate\n self.amPM = createElement(\"span\", \"flatpickr-am-pm\", self.l10n.amPM[int((self.latestSelectedDateObj\n ? self.hourElement.value\n : self.config.defaultHour) > 11)]);\n self.amPM.title = self.l10n.toggleTitle;\n self.amPM.tabIndex = -1;\n self.timeContainer.appendChild(self.amPM);\n }\n return self.timeContainer;\n }\n function buildWeekdays() {\n if (!self.weekdayContainer)\n self.weekdayContainer = createElement(\"div\", \"flatpickr-weekdays\");\n else\n clearNode(self.weekdayContainer);\n for (var i = self.config.showMonths; i--;) {\n var container = createElement(\"div\", \"flatpickr-weekdaycontainer\");\n self.weekdayContainer.appendChild(container);\n }\n updateWeekdays();\n return self.weekdayContainer;\n }\n function updateWeekdays() {\n if (!self.weekdayContainer) {\n return;\n }\n var firstDayOfWeek = self.l10n.firstDayOfWeek;\n var weekdays = __spreadArrays(self.l10n.weekdays.shorthand);\n if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {\n weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));\n }\n for (var i = self.config.showMonths; i--;) {\n self.weekdayContainer.children[i].innerHTML = \"\\n \\n \" + weekdays.join(\"\") + \"\\n \\n \";\n }\n }\n /* istanbul ignore next */\n function buildWeeks() {\n self.calendarContainer.classList.add(\"hasWeeks\");\n var weekWrapper = createElement(\"div\", \"flatpickr-weekwrapper\");\n weekWrapper.appendChild(createElement(\"span\", \"flatpickr-weekday\", self.l10n.weekAbbreviation));\n var weekNumbers = createElement(\"div\", \"flatpickr-weeks\");\n weekWrapper.appendChild(weekNumbers);\n return {\n weekWrapper: weekWrapper,\n weekNumbers: weekNumbers,\n };\n }\n function changeMonth(value, isOffset) {\n if (isOffset === void 0) { isOffset = true; }\n var delta = isOffset ? value : value - self.currentMonth;\n if ((delta < 0 && self._hidePrevMonthArrow === true) ||\n (delta > 0 && self._hideNextMonthArrow === true))\n return;\n self.currentMonth += delta;\n if (self.currentMonth < 0 || self.currentMonth > 11) {\n self.currentYear += self.currentMonth > 11 ? 1 : -1;\n self.currentMonth = (self.currentMonth + 12) % 12;\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n buildDays();\n triggerEvent(\"onMonthChange\");\n updateNavigationCurrentMonth();\n }\n function clear(triggerChangeEvent, toInitial) {\n if (triggerChangeEvent === void 0) { triggerChangeEvent = true; }\n if (toInitial === void 0) { toInitial = true; }\n self.input.value = \"\";\n if (self.altInput !== undefined)\n self.altInput.value = \"\";\n if (self.mobileInput !== undefined)\n self.mobileInput.value = \"\";\n self.selectedDates = [];\n self.latestSelectedDateObj = undefined;\n if (toInitial === true) {\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n }\n if (self.config.enableTime === true) {\n var _a = getDefaultHours(), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds;\n setHours(hours, minutes, seconds);\n }\n self.redraw();\n if (triggerChangeEvent)\n // triggerChangeEvent is true (default) or an Event\n triggerEvent(\"onChange\");\n }\n function close() {\n self.isOpen = false;\n if (!self.isMobile) {\n if (self.calendarContainer !== undefined) {\n self.calendarContainer.classList.remove(\"open\");\n }\n if (self._input !== undefined) {\n self._input.classList.remove(\"active\");\n }\n }\n triggerEvent(\"onClose\");\n }\n function destroy() {\n if (self.config !== undefined)\n triggerEvent(\"onDestroy\");\n for (var i = self._handlers.length; i--;) {\n var h = self._handlers[i];\n h.element.removeEventListener(h.event, h.handler, h.options);\n }\n self._handlers = [];\n if (self.mobileInput) {\n if (self.mobileInput.parentNode)\n self.mobileInput.parentNode.removeChild(self.mobileInput);\n self.mobileInput = undefined;\n }\n else if (self.calendarContainer && self.calendarContainer.parentNode) {\n if (self.config.static && self.calendarContainer.parentNode) {\n var wrapper = self.calendarContainer.parentNode;\n wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);\n if (wrapper.parentNode) {\n while (wrapper.firstChild)\n wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);\n wrapper.parentNode.removeChild(wrapper);\n }\n }\n else\n self.calendarContainer.parentNode.removeChild(self.calendarContainer);\n }\n if (self.altInput) {\n self.input.type = \"text\";\n if (self.altInput.parentNode)\n self.altInput.parentNode.removeChild(self.altInput);\n delete self.altInput;\n }\n if (self.input) {\n self.input.type = self.input._type;\n self.input.classList.remove(\"flatpickr-input\");\n self.input.removeAttribute(\"readonly\");\n }\n [\n \"_showTimeInput\",\n \"latestSelectedDateObj\",\n \"_hideNextMonthArrow\",\n \"_hidePrevMonthArrow\",\n \"__hideNextMonthArrow\",\n \"__hidePrevMonthArrow\",\n \"isMobile\",\n \"isOpen\",\n \"selectedDateElem\",\n \"minDateHasTime\",\n \"maxDateHasTime\",\n \"days\",\n \"daysContainer\",\n \"_input\",\n \"_positionElement\",\n \"innerContainer\",\n \"rContainer\",\n \"monthNav\",\n \"todayDateElem\",\n \"calendarContainer\",\n \"weekdayContainer\",\n \"prevMonthNav\",\n \"nextMonthNav\",\n \"monthsDropdownContainer\",\n \"currentMonthElement\",\n \"currentYearElement\",\n \"navigationCurrentMonth\",\n \"selectedDateElem\",\n \"config\",\n ].forEach(function (k) {\n try {\n delete self[k];\n }\n catch (_) { }\n });\n }\n function isCalendarElem(elem) {\n if (self.config.appendTo && self.config.appendTo.contains(elem))\n return true;\n return self.calendarContainer.contains(elem);\n }\n function documentClick(e) {\n if (self.isOpen && !self.config.inline) {\n var eventTarget_1 = getEventTarget(e);\n var isCalendarElement = isCalendarElem(eventTarget_1);\n var isInput = eventTarget_1 === self.input ||\n eventTarget_1 === self.altInput ||\n self.element.contains(eventTarget_1) ||\n // web components\n // e.path is not present in all browsers. circumventing typechecks\n (e.path &&\n e.path.indexOf &&\n (~e.path.indexOf(self.input) ||\n ~e.path.indexOf(self.altInput)));\n var lostFocus = e.type === \"blur\"\n ? isInput &&\n e.relatedTarget &&\n !isCalendarElem(e.relatedTarget)\n : !isInput &&\n !isCalendarElement &&\n !isCalendarElem(e.relatedTarget);\n var isIgnored = !self.config.ignoredFocusElements.some(function (elem) {\n return elem.contains(eventTarget_1);\n });\n if (lostFocus && isIgnored) {\n if (self.timeContainer !== undefined &&\n self.minuteElement !== undefined &&\n self.hourElement !== undefined &&\n self.input.value !== \"\" &&\n self.input.value !== undefined) {\n updateTime();\n }\n self.close();\n if (self.config &&\n self.config.mode === \"range\" &&\n self.selectedDates.length === 1) {\n self.clear(false);\n self.redraw();\n }\n }\n }\n }\n function changeYear(newYear) {\n if (!newYear ||\n (self.config.minDate && newYear < self.config.minDate.getFullYear()) ||\n (self.config.maxDate && newYear > self.config.maxDate.getFullYear()))\n return;\n var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;\n self.currentYear = newYearNum || self.currentYear;\n if (self.config.maxDate &&\n self.currentYear === self.config.maxDate.getFullYear()) {\n self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);\n }\n else if (self.config.minDate &&\n self.currentYear === self.config.minDate.getFullYear()) {\n self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);\n }\n if (isNewYear) {\n self.redraw();\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n }\n function isEnabled(date, timeless) {\n if (timeless === void 0) { timeless = true; }\n var dateToCheck = self.parseDate(date, undefined, timeless); // timeless\n if ((self.config.minDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) ||\n (self.config.maxDate &&\n dateToCheck &&\n compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0))\n return false;\n if (self.config.enable.length === 0 && self.config.disable.length === 0)\n return true;\n if (dateToCheck === undefined)\n return false;\n var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;\n for (var i = 0, d = void 0; i < array.length; i++) {\n d = array[i];\n if (typeof d === \"function\" &&\n d(dateToCheck) // disabled by function\n )\n return bool;\n else if (d instanceof Date &&\n dateToCheck !== undefined &&\n d.getTime() === dateToCheck.getTime())\n // disabled by date\n return bool;\n else if (typeof d === \"string\" && dateToCheck !== undefined) {\n // disabled by date string\n var parsed = self.parseDate(d, undefined, true);\n return parsed && parsed.getTime() === dateToCheck.getTime()\n ? bool\n : !bool;\n }\n else if (\n // disabled by range\n typeof d === \"object\" &&\n dateToCheck !== undefined &&\n d.from &&\n d.to &&\n dateToCheck.getTime() >= d.from.getTime() &&\n dateToCheck.getTime() <= d.to.getTime())\n return bool;\n }\n return !bool;\n }\n function isInView(elem) {\n if (self.daysContainer !== undefined)\n return (elem.className.indexOf(\"hidden\") === -1 &&\n elem.className.indexOf(\"flatpickr-disabled\") === -1 &&\n self.daysContainer.contains(elem));\n return false;\n }\n function onBlur(e) {\n var isInput = e.target === self._input;\n if (isInput &&\n !(e.relatedTarget && isCalendarElem(e.relatedTarget))) {\n self.setDate(self._input.value, true, e.target === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n }\n }\n function onKeyDown(e) {\n // e.key e.keyCode\n // \"Backspace\" 8\n // \"Tab\" 9\n // \"Enter\" 13\n // \"Escape\" (IE \"Esc\") 27\n // \"ArrowLeft\" (IE \"Left\") 37\n // \"ArrowUp\" (IE \"Up\") 38\n // \"ArrowRight\" (IE \"Right\") 39\n // \"ArrowDown\" (IE \"Down\") 40\n // \"Delete\" (IE \"Del\") 46\n var eventTarget = getEventTarget(e);\n var isInput = self.config.wrap\n ? element.contains(eventTarget)\n : eventTarget === self._input;\n var allowInput = self.config.allowInput;\n var allowKeydown = self.isOpen && (!allowInput || !isInput);\n var allowInlineKeydown = self.config.inline && isInput && !allowInput;\n if (e.keyCode === 13 && isInput) {\n if (allowInput) {\n self.setDate(self._input.value, true, eventTarget === self.altInput\n ? self.config.altFormat\n : self.config.dateFormat);\n return eventTarget.blur();\n }\n else {\n self.open();\n }\n }\n else if (isCalendarElem(eventTarget) ||\n allowKeydown ||\n allowInlineKeydown) {\n var isTimeObj = !!self.timeContainer &&\n self.timeContainer.contains(eventTarget);\n switch (e.keyCode) {\n case 13:\n if (isTimeObj) {\n e.preventDefault();\n updateTime();\n focusAndClose();\n }\n else\n selectDate(e);\n break;\n case 27: // escape\n e.preventDefault();\n focusAndClose();\n break;\n case 8:\n case 46:\n if (isInput && !self.config.allowInput) {\n e.preventDefault();\n self.clear();\n }\n break;\n case 37:\n case 39:\n if (!isTimeObj && !isInput) {\n e.preventDefault();\n if (self.daysContainer !== undefined &&\n (allowInput === false ||\n (document.activeElement && isInView(document.activeElement)))) {\n var delta_1 = e.keyCode === 39 ? 1 : -1;\n if (!e.ctrlKey)\n focusOnDay(undefined, delta_1);\n else {\n e.stopPropagation();\n changeMonth(delta_1);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n }\n }\n else if (self.hourElement)\n self.hourElement.focus();\n break;\n case 38:\n case 40:\n e.preventDefault();\n var delta = e.keyCode === 40 ? 1 : -1;\n if ((self.daysContainer &&\n eventTarget.$i !== undefined) ||\n eventTarget === self.input ||\n eventTarget === self.altInput) {\n if (e.ctrlKey) {\n e.stopPropagation();\n changeYear(self.currentYear - delta);\n focusOnDay(getFirstAvailableDay(1), 0);\n }\n else if (!isTimeObj)\n focusOnDay(undefined, delta * 7);\n }\n else if (eventTarget === self.currentYearElement) {\n changeYear(self.currentYear - delta);\n }\n else if (self.config.enableTime) {\n if (!isTimeObj && self.hourElement)\n self.hourElement.focus();\n updateTime(e);\n self._debouncedChange();\n }\n break;\n case 9:\n if (isTimeObj) {\n var elems = [\n self.hourElement,\n self.minuteElement,\n self.secondElement,\n self.amPM,\n ]\n .concat(self.pluginElements)\n .filter(function (x) { return x; });\n var i = elems.indexOf(eventTarget);\n if (i !== -1) {\n var target = elems[i + (e.shiftKey ? -1 : 1)];\n e.preventDefault();\n (target || self._input).focus();\n }\n }\n else if (!self.config.noCalendar &&\n self.daysContainer &&\n self.daysContainer.contains(eventTarget) &&\n e.shiftKey) {\n e.preventDefault();\n self._input.focus();\n }\n break;\n }\n }\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n switch (e.key) {\n case self.l10n.amPM[0].charAt(0):\n case self.l10n.amPM[0].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[0];\n setHoursFromInputs();\n updateValue();\n break;\n case self.l10n.amPM[1].charAt(0):\n case self.l10n.amPM[1].charAt(0).toLowerCase():\n self.amPM.textContent = self.l10n.amPM[1];\n setHoursFromInputs();\n updateValue();\n break;\n }\n }\n if (isInput || isCalendarElem(eventTarget)) {\n triggerEvent(\"onKeyDown\", e);\n }\n }\n function onMouseOver(elem) {\n if (self.selectedDates.length !== 1 ||\n (elem &&\n (!elem.classList.contains(\"flatpickr-day\") ||\n elem.classList.contains(\"flatpickr-disabled\"))))\n return;\n var hoverDate = elem\n ? elem.dateObj.getTime()\n : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());\n var containsDisabled = false;\n var minRange = 0, maxRange = 0;\n for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {\n if (!isEnabled(new Date(t), true)) {\n containsDisabled =\n containsDisabled || (t > rangeStartDate && t < rangeEndDate);\n if (t < initialDate && (!minRange || t > minRange))\n minRange = t;\n else if (t > initialDate && (!maxRange || t < maxRange))\n maxRange = t;\n }\n }\n for (var m = 0; m < self.config.showMonths; m++) {\n var month = self.daysContainer.children[m];\n var _loop_1 = function (i, l) {\n var dayElem = month.children[i], date = dayElem.dateObj;\n var timestamp = date.getTime();\n var outOfRange = (minRange > 0 && timestamp < minRange) ||\n (maxRange > 0 && timestamp > maxRange);\n if (outOfRange) {\n dayElem.classList.add(\"notAllowed\");\n [\"inRange\", \"startRange\", \"endRange\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n return \"continue\";\n }\n else if (containsDisabled && !outOfRange)\n return \"continue\";\n [\"startRange\", \"inRange\", \"endRange\", \"notAllowed\"].forEach(function (c) {\n dayElem.classList.remove(c);\n });\n if (elem !== undefined) {\n elem.classList.add(hoverDate <= self.selectedDates[0].getTime()\n ? \"startRange\"\n : \"endRange\");\n if (initialDate < hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"startRange\");\n else if (initialDate > hoverDate && timestamp === initialDate)\n dayElem.classList.add(\"endRange\");\n if (timestamp >= minRange &&\n (maxRange === 0 || timestamp <= maxRange) &&\n isBetween(timestamp, initialDate, hoverDate))\n dayElem.classList.add(\"inRange\");\n }\n };\n for (var i = 0, l = month.children.length; i < l; i++) {\n _loop_1(i, l);\n }\n }\n }\n function onResize() {\n if (self.isOpen && !self.config.static && !self.config.inline)\n positionCalendar();\n }\n function open(e, positionElement) {\n if (positionElement === void 0) { positionElement = self._positionElement; }\n if (self.isMobile === true) {\n if (e) {\n e.preventDefault();\n var eventTarget = getEventTarget(e);\n eventTarget && eventTarget.blur();\n }\n if (self.mobileInput !== undefined) {\n self.mobileInput.focus();\n self.mobileInput.click();\n }\n triggerEvent(\"onOpen\");\n return;\n }\n if (self._input.disabled || self.config.inline)\n return;\n var wasOpen = self.isOpen;\n self.isOpen = true;\n if (!wasOpen) {\n self.calendarContainer.classList.add(\"open\");\n self._input.classList.add(\"active\");\n triggerEvent(\"onOpen\");\n positionCalendar(positionElement);\n }\n if (self.config.enableTime === true && self.config.noCalendar === true) {\n if (self.config.allowInput === false &&\n (e === undefined ||\n !self.timeContainer.contains(e.relatedTarget))) {\n setTimeout(function () { return self.hourElement.select(); }, 50);\n }\n }\n }\n function minMaxDateSetter(type) {\n return function (date) {\n var dateObj = (self.config[\"_\" + type + \"Date\"] = self.parseDate(date, self.config.dateFormat));\n var inverseDateObj = self.config[\"_\" + (type === \"min\" ? \"max\" : \"min\") + \"Date\"];\n if (dateObj !== undefined) {\n self[type === \"min\" ? \"minDateHasTime\" : \"maxDateHasTime\"] =\n dateObj.getHours() > 0 ||\n dateObj.getMinutes() > 0 ||\n dateObj.getSeconds() > 0;\n }\n if (self.selectedDates) {\n self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); });\n if (!self.selectedDates.length && type === \"min\")\n setHoursFromDate(dateObj);\n updateValue();\n }\n if (self.daysContainer) {\n redraw();\n if (dateObj !== undefined)\n self.currentYearElement[type] = dateObj.getFullYear().toString();\n else\n self.currentYearElement.removeAttribute(type);\n self.currentYearElement.disabled =\n !!inverseDateObj &&\n dateObj !== undefined &&\n inverseDateObj.getFullYear() === dateObj.getFullYear();\n }\n };\n }\n function parseConfig() {\n var boolOpts = [\n \"wrap\",\n \"weekNumbers\",\n \"allowInput\",\n \"allowInvalidPreload\",\n \"clickOpens\",\n \"time_24hr\",\n \"enableTime\",\n \"noCalendar\",\n \"altInput\",\n \"shorthandCurrentMonth\",\n \"inline\",\n \"static\",\n \"enableSeconds\",\n \"disableMobile\",\n ];\n var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig);\n var formats = {};\n self.config.parseDate = userConfig.parseDate;\n self.config.formatDate = userConfig.formatDate;\n Object.defineProperty(self.config, \"enable\", {\n get: function () { return self.config._enable; },\n set: function (dates) {\n self.config._enable = parseDateRules(dates);\n },\n });\n Object.defineProperty(self.config, \"disable\", {\n get: function () { return self.config._disable; },\n set: function (dates) {\n self.config._disable = parseDateRules(dates);\n },\n });\n var timeMode = userConfig.mode === \"time\";\n if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {\n var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat;\n formats.dateFormat =\n userConfig.noCalendar || timeMode\n ? \"H:i\" + (userConfig.enableSeconds ? \":S\" : \"\")\n : defaultDateFormat + \" H:i\" + (userConfig.enableSeconds ? \":S\" : \"\");\n }\n if (userConfig.altInput &&\n (userConfig.enableTime || timeMode) &&\n !userConfig.altFormat) {\n var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat;\n formats.altFormat =\n userConfig.noCalendar || timeMode\n ? \"h:i\" + (userConfig.enableSeconds ? \":S K\" : \" K\")\n : defaultAltFormat + (\" h:i\" + (userConfig.enableSeconds ? \":S\" : \"\") + \" K\");\n }\n Object.defineProperty(self.config, \"minDate\", {\n get: function () { return self.config._minDate; },\n set: minMaxDateSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxDate\", {\n get: function () { return self.config._maxDate; },\n set: minMaxDateSetter(\"max\"),\n });\n var minMaxTimeSetter = function (type) { return function (val) {\n self.config[type === \"min\" ? \"_minTime\" : \"_maxTime\"] = self.parseDate(val, \"H:i:S\");\n }; };\n Object.defineProperty(self.config, \"minTime\", {\n get: function () { return self.config._minTime; },\n set: minMaxTimeSetter(\"min\"),\n });\n Object.defineProperty(self.config, \"maxTime\", {\n get: function () { return self.config._maxTime; },\n set: minMaxTimeSetter(\"max\"),\n });\n if (userConfig.mode === \"time\") {\n self.config.noCalendar = true;\n self.config.enableTime = true;\n }\n Object.assign(self.config, formats, userConfig);\n for (var i = 0; i < boolOpts.length; i++)\n // https://github.com/microsoft/TypeScript/issues/31663\n self.config[boolOpts[i]] =\n self.config[boolOpts[i]] === true ||\n self.config[boolOpts[i]] === \"true\";\n HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) {\n self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);\n });\n self.isMobile =\n !self.config.disableMobile &&\n !self.config.inline &&\n self.config.mode === \"single\" &&\n !self.config.disable.length &&\n !self.config.enable.length &&\n !self.config.weekNumbers &&\n /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n for (var i = 0; i < self.config.plugins.length; i++) {\n var pluginConf = self.config.plugins[i](self) || {};\n for (var key in pluginConf) {\n if (HOOKS.indexOf(key) > -1) {\n self.config[key] = arrayify(pluginConf[key])\n .map(bindToInstance)\n .concat(self.config[key]);\n }\n else if (typeof userConfig[key] === \"undefined\")\n self.config[key] = pluginConf[key];\n }\n }\n if (!userConfig.altInputClass) {\n self.config.altInputClass =\n getInputElem().className + \" \" + self.config.altInputClass;\n }\n triggerEvent(\"onParseConfig\");\n }\n function getInputElem() {\n return self.config.wrap\n ? element.querySelector(\"[data-input]\")\n : element;\n }\n function setupLocale() {\n if (typeof self.config.locale !== \"object\" &&\n typeof flatpickr.l10ns[self.config.locale] === \"undefined\")\n self.config.errorHandler(new Error(\"flatpickr: invalid locale \" + self.config.locale));\n self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === \"object\"\n ? self.config.locale\n : self.config.locale !== \"default\"\n ? flatpickr.l10ns[self.config.locale]\n : undefined));\n tokenRegex.K = \"(\" + self.l10n.amPM[0] + \"|\" + self.l10n.amPM[1] + \"|\" + self.l10n.amPM[0].toLowerCase() + \"|\" + self.l10n.amPM[1].toLowerCase() + \")\";\n var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));\n if (userConfig.time_24hr === undefined &&\n flatpickr.defaultConfig.time_24hr === undefined) {\n self.config.time_24hr = self.l10n.time_24hr;\n }\n self.formatDate = createDateFormatter(self);\n self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });\n }\n function positionCalendar(customPositionElement) {\n if (self.calendarContainer === undefined)\n return;\n triggerEvent(\"onPreCalendarPosition\");\n var positionElement = customPositionElement || self._positionElement;\n var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(\" \"), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === \"above\" ||\n (configPosVertical !== \"below\" &&\n distanceFromBottom < calendarHeight &&\n inputBounds.top > calendarHeight);\n var top = window.pageYOffset +\n inputBounds.top +\n (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);\n toggleClass(self.calendarContainer, \"arrowTop\", !showOnTop);\n toggleClass(self.calendarContainer, \"arrowBottom\", showOnTop);\n if (self.config.inline)\n return;\n var left = window.pageXOffset + inputBounds.left;\n var isCenter = false;\n var isRight = false;\n if (configPosHorizontal === \"center\") {\n left -= (calendarWidth - inputBounds.width) / 2;\n isCenter = true;\n }\n else if (configPosHorizontal === \"right\") {\n left -= calendarWidth - inputBounds.width;\n isRight = true;\n }\n toggleClass(self.calendarContainer, \"arrowLeft\", !isCenter && !isRight);\n toggleClass(self.calendarContainer, \"arrowCenter\", isCenter);\n toggleClass(self.calendarContainer, \"arrowRight\", isRight);\n var right = window.document.body.offsetWidth -\n (window.pageXOffset + inputBounds.right);\n var rightMost = left + calendarWidth > window.document.body.offsetWidth;\n var centerMost = right + calendarWidth > window.document.body.offsetWidth;\n toggleClass(self.calendarContainer, \"rightMost\", rightMost);\n if (self.config.static)\n return;\n self.calendarContainer.style.top = top + \"px\";\n if (!rightMost) {\n self.calendarContainer.style.left = left + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n else if (!centerMost) {\n self.calendarContainer.style.left = \"auto\";\n self.calendarContainer.style.right = right + \"px\";\n }\n else {\n var doc = getDocumentStyleSheet();\n // some testing environments don't have css support\n if (doc === undefined)\n return;\n var bodyWidth = window.document.body.offsetWidth;\n var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);\n var centerBefore = \".flatpickr-calendar.centerMost:before\";\n var centerAfter = \".flatpickr-calendar.centerMost:after\";\n var centerIndex = doc.cssRules.length;\n var centerStyle = \"{left:\" + inputBounds.left + \"px;right:auto;}\";\n toggleClass(self.calendarContainer, \"rightMost\", false);\n toggleClass(self.calendarContainer, \"centerMost\", true);\n doc.insertRule(centerBefore + \",\" + centerAfter + centerStyle, centerIndex);\n self.calendarContainer.style.left = centerLeft + \"px\";\n self.calendarContainer.style.right = \"auto\";\n }\n }\n function getDocumentStyleSheet() {\n var editableSheet = null;\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n try {\n sheet.cssRules;\n }\n catch (err) {\n continue;\n }\n editableSheet = sheet;\n break;\n }\n return editableSheet != null ? editableSheet : createStyleSheet();\n }\n function createStyleSheet() {\n var style = document.createElement(\"style\");\n document.head.appendChild(style);\n return style.sheet;\n }\n function redraw() {\n if (self.config.noCalendar || self.isMobile)\n return;\n buildMonthSwitch();\n updateNavigationCurrentMonth();\n buildDays();\n }\n function focusAndClose() {\n self._input.focus();\n if (window.navigator.userAgent.indexOf(\"MSIE\") !== -1 ||\n navigator.msMaxTouchPoints !== undefined) {\n // hack - bugs in the way IE handles focus keeps the calendar open\n setTimeout(self.close, 0);\n }\n else {\n self.close();\n }\n }\n function selectDate(e) {\n e.preventDefault();\n e.stopPropagation();\n var isSelectable = function (day) {\n return day.classList &&\n day.classList.contains(\"flatpickr-day\") &&\n !day.classList.contains(\"flatpickr-disabled\") &&\n !day.classList.contains(\"notAllowed\");\n };\n var t = findParent(getEventTarget(e), isSelectable);\n if (t === undefined)\n return;\n var target = t;\n var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime()));\n var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth ||\n selectedDate.getMonth() >\n self.currentMonth + self.config.showMonths - 1) &&\n self.config.mode !== \"range\";\n self.selectedDateElem = target;\n if (self.config.mode === \"single\")\n self.selectedDates = [selectedDate];\n else if (self.config.mode === \"multiple\") {\n var selectedIndex = isDateSelected(selectedDate);\n if (selectedIndex)\n self.selectedDates.splice(parseInt(selectedIndex), 1);\n else\n self.selectedDates.push(selectedDate);\n }\n else if (self.config.mode === \"range\") {\n if (self.selectedDates.length === 2) {\n self.clear(false, false);\n }\n self.latestSelectedDateObj = selectedDate;\n self.selectedDates.push(selectedDate);\n // unless selecting same date twice, sort ascendingly\n if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n setHoursFromInputs();\n if (shouldChangeMonth) {\n var isNewYear = self.currentYear !== selectedDate.getFullYear();\n self.currentYear = selectedDate.getFullYear();\n self.currentMonth = selectedDate.getMonth();\n if (isNewYear) {\n triggerEvent(\"onYearChange\");\n buildMonthSwitch();\n }\n triggerEvent(\"onMonthChange\");\n }\n updateNavigationCurrentMonth();\n buildDays();\n updateValue();\n // maintain focus\n if (!shouldChangeMonth &&\n self.config.mode !== \"range\" &&\n self.config.showMonths === 1)\n focusOnDayElem(target);\n else if (self.selectedDateElem !== undefined &&\n self.hourElement === undefined) {\n self.selectedDateElem && self.selectedDateElem.focus();\n }\n if (self.hourElement !== undefined)\n self.hourElement !== undefined && self.hourElement.focus();\n if (self.config.closeOnSelect) {\n var single = self.config.mode === \"single\" && !self.config.enableTime;\n var range = self.config.mode === \"range\" &&\n self.selectedDates.length === 2 &&\n !self.config.enableTime;\n if (single || range) {\n focusAndClose();\n }\n }\n triggerChange();\n }\n var CALLBACKS = {\n locale: [setupLocale, updateWeekdays],\n showMonths: [buildMonths, setCalendarWidth, buildWeekdays],\n minDate: [jumpToDate],\n maxDate: [jumpToDate],\n };\n function set(option, value) {\n if (option !== null && typeof option === \"object\") {\n Object.assign(self.config, option);\n for (var key in option) {\n if (CALLBACKS[key] !== undefined)\n CALLBACKS[key].forEach(function (x) { return x(); });\n }\n }\n else {\n self.config[option] = value;\n if (CALLBACKS[option] !== undefined)\n CALLBACKS[option].forEach(function (x) { return x(); });\n else if (HOOKS.indexOf(option) > -1)\n self.config[option] = arrayify(value);\n }\n self.redraw();\n updateValue(true);\n }\n function setSelectedDate(inputDate, format) {\n var dates = [];\n if (inputDate instanceof Array)\n dates = inputDate.map(function (d) { return self.parseDate(d, format); });\n else if (inputDate instanceof Date || typeof inputDate === \"number\")\n dates = [self.parseDate(inputDate, format)];\n else if (typeof inputDate === \"string\") {\n switch (self.config.mode) {\n case \"single\":\n case \"time\":\n dates = [self.parseDate(inputDate, format)];\n break;\n case \"multiple\":\n dates = inputDate\n .split(self.config.conjunction)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n case \"range\":\n dates = inputDate\n .split(self.l10n.rangeSeparator)\n .map(function (date) { return self.parseDate(date, format); });\n break;\n }\n }\n else\n self.config.errorHandler(new Error(\"Invalid date supplied: \" + JSON.stringify(inputDate)));\n self.selectedDates = (self.config.allowInvalidPreload\n ? dates\n : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); }));\n if (self.config.mode === \"range\")\n self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });\n }\n function setDate(date, triggerChange, format) {\n if (triggerChange === void 0) { triggerChange = false; }\n if (format === void 0) { format = self.config.dateFormat; }\n if ((date !== 0 && !date) || (date instanceof Array && date.length === 0))\n return self.clear(triggerChange);\n setSelectedDate(date, format);\n self.latestSelectedDateObj =\n self.selectedDates[self.selectedDates.length - 1];\n self.redraw();\n jumpToDate(undefined, triggerChange);\n setHoursFromDate();\n if (self.selectedDates.length === 0) {\n self.clear(false);\n }\n updateValue(triggerChange);\n if (triggerChange)\n triggerEvent(\"onChange\");\n }\n function parseDateRules(arr) {\n return arr\n .slice()\n .map(function (rule) {\n if (typeof rule === \"string\" ||\n typeof rule === \"number\" ||\n rule instanceof Date) {\n return self.parseDate(rule, undefined, true);\n }\n else if (rule &&\n typeof rule === \"object\" &&\n rule.from &&\n rule.to)\n return {\n from: self.parseDate(rule.from, undefined),\n to: self.parseDate(rule.to, undefined),\n };\n return rule;\n })\n .filter(function (x) { return x; }); // remove falsy values\n }\n function setupDates() {\n self.selectedDates = [];\n self.now = self.parseDate(self.config.now) || new Date();\n // Workaround IE11 setting placeholder as the input's value\n var preloadedDate = self.config.defaultDate ||\n ((self.input.nodeName === \"INPUT\" ||\n self.input.nodeName === \"TEXTAREA\") &&\n self.input.placeholder &&\n self.input.value === self.input.placeholder\n ? null\n : self.input.value);\n if (preloadedDate)\n setSelectedDate(preloadedDate, self.config.dateFormat);\n self._initialDate =\n self.selectedDates.length > 0\n ? self.selectedDates[0]\n : self.config.minDate &&\n self.config.minDate.getTime() > self.now.getTime()\n ? self.config.minDate\n : self.config.maxDate &&\n self.config.maxDate.getTime() < self.now.getTime()\n ? self.config.maxDate\n : self.now;\n self.currentYear = self._initialDate.getFullYear();\n self.currentMonth = self._initialDate.getMonth();\n if (self.selectedDates.length > 0)\n self.latestSelectedDateObj = self.selectedDates[0];\n if (self.config.minTime !== undefined)\n self.config.minTime = self.parseDate(self.config.minTime, \"H:i\");\n if (self.config.maxTime !== undefined)\n self.config.maxTime = self.parseDate(self.config.maxTime, \"H:i\");\n self.minDateHasTime =\n !!self.config.minDate &&\n (self.config.minDate.getHours() > 0 ||\n self.config.minDate.getMinutes() > 0 ||\n self.config.minDate.getSeconds() > 0);\n self.maxDateHasTime =\n !!self.config.maxDate &&\n (self.config.maxDate.getHours() > 0 ||\n self.config.maxDate.getMinutes() > 0 ||\n self.config.maxDate.getSeconds() > 0);\n }\n function setupInputs() {\n self.input = getInputElem();\n /* istanbul ignore next */\n if (!self.input) {\n self.config.errorHandler(new Error(\"Invalid input element specified\"));\n return;\n }\n // hack: store previous type to restore it after destroy()\n self.input._type = self.input.type;\n self.input.type = \"text\";\n self.input.classList.add(\"flatpickr-input\");\n self._input = self.input;\n if (self.config.altInput) {\n // replicate self.element\n self.altInput = createElement(self.input.nodeName, self.config.altInputClass);\n self._input = self.altInput;\n self.altInput.placeholder = self.input.placeholder;\n self.altInput.disabled = self.input.disabled;\n self.altInput.required = self.input.required;\n self.altInput.tabIndex = self.input.tabIndex;\n self.altInput.type = \"text\";\n self.input.setAttribute(\"type\", \"hidden\");\n if (!self.config.static && self.input.parentNode)\n self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);\n }\n if (!self.config.allowInput)\n self._input.setAttribute(\"readonly\", \"readonly\");\n self._positionElement = self.config.positionElement || self._input;\n }\n function setupMobile() {\n var inputType = self.config.enableTime\n ? self.config.noCalendar\n ? \"time\"\n : \"datetime-local\"\n : \"date\";\n self.mobileInput = createElement(\"input\", self.input.className + \" flatpickr-mobile\");\n self.mobileInput.tabIndex = 1;\n self.mobileInput.type = inputType;\n self.mobileInput.disabled = self.input.disabled;\n self.mobileInput.required = self.input.required;\n self.mobileInput.placeholder = self.input.placeholder;\n self.mobileFormatStr =\n inputType === \"datetime-local\"\n ? \"Y-m-d\\\\TH:i:S\"\n : inputType === \"date\"\n ? \"Y-m-d\"\n : \"H:i:S\";\n if (self.selectedDates.length > 0) {\n self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);\n }\n if (self.config.minDate)\n self.mobileInput.min = self.formatDate(self.config.minDate, \"Y-m-d\");\n if (self.config.maxDate)\n self.mobileInput.max = self.formatDate(self.config.maxDate, \"Y-m-d\");\n if (self.input.getAttribute(\"step\"))\n self.mobileInput.step = String(self.input.getAttribute(\"step\"));\n self.input.type = \"hidden\";\n if (self.altInput !== undefined)\n self.altInput.type = \"hidden\";\n try {\n if (self.input.parentNode)\n self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);\n }\n catch (_a) { }\n bind(self.mobileInput, \"change\", function (e) {\n self.setDate(getEventTarget(e).value, false, self.mobileFormatStr);\n triggerEvent(\"onChange\");\n triggerEvent(\"onClose\");\n });\n }\n function toggle(e) {\n if (self.isOpen === true)\n return self.close();\n self.open(e);\n }\n function triggerEvent(event, data) {\n // If the instance has been destroyed already, all hooks have been removed\n if (self.config === undefined)\n return;\n var hooks = self.config[event];\n if (hooks !== undefined && hooks.length > 0) {\n for (var i = 0; hooks[i] && i < hooks.length; i++)\n hooks[i](self.selectedDates, self.input.value, self, data);\n }\n if (event === \"onChange\") {\n self.input.dispatchEvent(createEvent(\"change\"));\n // many front-end frameworks bind to the input event\n self.input.dispatchEvent(createEvent(\"input\"));\n }\n }\n function createEvent(name) {\n var e = document.createEvent(\"Event\");\n e.initEvent(name, true, true);\n return e;\n }\n function isDateSelected(date) {\n for (var i = 0; i < self.selectedDates.length; i++) {\n if (compareDates(self.selectedDates[i], date) === 0)\n return \"\" + i;\n }\n return false;\n }\n function isDateInRange(date) {\n if (self.config.mode !== \"range\" || self.selectedDates.length < 2)\n return false;\n return (compareDates(date, self.selectedDates[0]) >= 0 &&\n compareDates(date, self.selectedDates[1]) <= 0);\n }\n function updateNavigationCurrentMonth() {\n if (self.config.noCalendar || self.isMobile || !self.monthNav)\n return;\n self.yearElements.forEach(function (yearElement, i) {\n var d = new Date(self.currentYear, self.currentMonth, 1);\n d.setMonth(self.currentMonth + i);\n if (self.config.showMonths > 1 ||\n self.config.monthSelectorType === \"static\") {\n self.monthElements[i].textContent =\n monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + \" \";\n }\n else {\n self.monthsDropdownContainer.value = d.getMonth().toString();\n }\n yearElement.value = d.getFullYear().toString();\n });\n self._hidePrevMonthArrow =\n self.config.minDate !== undefined &&\n (self.currentYear === self.config.minDate.getFullYear()\n ? self.currentMonth <= self.config.minDate.getMonth()\n : self.currentYear < self.config.minDate.getFullYear());\n self._hideNextMonthArrow =\n self.config.maxDate !== undefined &&\n (self.currentYear === self.config.maxDate.getFullYear()\n ? self.currentMonth + 1 > self.config.maxDate.getMonth()\n : self.currentYear > self.config.maxDate.getFullYear());\n }\n function getDateStr(format) {\n return self.selectedDates\n .map(function (dObj) { return self.formatDate(dObj, format); })\n .filter(function (d, i, arr) {\n return self.config.mode !== \"range\" ||\n self.config.enableTime ||\n arr.indexOf(d) === i;\n })\n .join(self.config.mode !== \"range\"\n ? self.config.conjunction\n : self.l10n.rangeSeparator);\n }\n /**\n * Updates the values of inputs associated with the calendar\n */\n function updateValue(triggerChange) {\n if (triggerChange === void 0) { triggerChange = true; }\n if (self.mobileInput !== undefined && self.mobileFormatStr) {\n self.mobileInput.value =\n self.latestSelectedDateObj !== undefined\n ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr)\n : \"\";\n }\n self.input.value = getDateStr(self.config.dateFormat);\n if (self.altInput !== undefined) {\n self.altInput.value = getDateStr(self.config.altFormat);\n }\n if (triggerChange !== false)\n triggerEvent(\"onValueUpdate\");\n }\n function onMonthNavClick(e) {\n var eventTarget = getEventTarget(e);\n var isPrevMonth = self.prevMonthNav.contains(eventTarget);\n var isNextMonth = self.nextMonthNav.contains(eventTarget);\n if (isPrevMonth || isNextMonth) {\n changeMonth(isPrevMonth ? -1 : 1);\n }\n else if (self.yearElements.indexOf(eventTarget) >= 0) {\n eventTarget.select();\n }\n else if (eventTarget.classList.contains(\"arrowUp\")) {\n self.changeYear(self.currentYear + 1);\n }\n else if (eventTarget.classList.contains(\"arrowDown\")) {\n self.changeYear(self.currentYear - 1);\n }\n }\n function timeWrapper(e) {\n e.preventDefault();\n var isKeyDown = e.type === \"keydown\", eventTarget = getEventTarget(e), input = eventTarget;\n if (self.amPM !== undefined && eventTarget === self.amPM) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n var min = parseFloat(input.getAttribute(\"min\")), max = parseFloat(input.getAttribute(\"max\")), step = parseFloat(input.getAttribute(\"step\")), curValue = parseInt(input.value, 10), delta = e.delta ||\n (isKeyDown ? (e.which === 38 ? 1 : -1) : 0);\n var newValue = curValue + step * delta;\n if (typeof input.value !== \"undefined\" && input.value.length === 2) {\n var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement;\n if (newValue < min) {\n newValue =\n max +\n newValue +\n int(!isHourElem) +\n (int(isHourElem) && int(!self.amPM));\n if (isMinuteElem)\n incrementNumInput(undefined, -1, self.hourElement);\n }\n else if (newValue > max) {\n newValue =\n input === self.hourElement ? newValue - max - int(!self.amPM) : min;\n if (isMinuteElem)\n incrementNumInput(undefined, 1, self.hourElement);\n }\n if (self.amPM &&\n isHourElem &&\n (step === 1\n ? newValue + curValue === 23\n : Math.abs(newValue - curValue) > step)) {\n self.amPM.textContent =\n self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];\n }\n input.value = pad(newValue);\n }\n }\n init();\n return self;\n }\n /* istanbul ignore next */\n function _flatpickr(nodeList, config) {\n // static list\n var nodes = Array.prototype.slice\n .call(nodeList)\n .filter(function (x) { return x instanceof HTMLElement; });\n var instances = [];\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n try {\n if (node.getAttribute(\"data-fp-omit\") !== null)\n continue;\n if (node._flatpickr !== undefined) {\n node._flatpickr.destroy();\n node._flatpickr = undefined;\n }\n node._flatpickr = FlatpickrInstance(node, config || {});\n instances.push(node._flatpickr);\n }\n catch (e) {\n console.error(e);\n }\n }\n return instances.length === 1 ? instances[0] : instances;\n }\n /* istanbul ignore next */\n if (typeof HTMLElement !== \"undefined\" &&\n typeof HTMLCollection !== \"undefined\" &&\n typeof NodeList !== \"undefined\") {\n // browser env\n HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n HTMLElement.prototype.flatpickr = function (config) {\n return _flatpickr([this], config);\n };\n }\n /* istanbul ignore next */\n var flatpickr = function (selector, config) {\n if (typeof selector === \"string\") {\n return _flatpickr(window.document.querySelectorAll(selector), config);\n }\n else if (selector instanceof Node) {\n return _flatpickr([selector], config);\n }\n else {\n return _flatpickr(selector, config);\n }\n };\n /* istanbul ignore next */\n flatpickr.defaultConfig = {};\n flatpickr.l10ns = {\n en: __assign({}, english),\n default: __assign({}, english),\n };\n flatpickr.localize = function (l10n) {\n flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n);\n };\n flatpickr.setDefaults = function (config) {\n flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config);\n };\n flatpickr.parseDate = createDateParser({});\n flatpickr.formatDate = createDateFormatter({});\n flatpickr.compareDates = compareDates;\n /* istanbul ignore next */\n if (typeof jQuery !== \"undefined\" && typeof jQuery.fn !== \"undefined\") {\n jQuery.fn.flatpickr = function (config) {\n return _flatpickr(this, config);\n };\n }\n // eslint-disable-next-line @typescript-eslint/camelcase\n Date.prototype.fp_incr = function (days) {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === \"string\" ? parseInt(days, 10) : days));\n };\n if (typeof window !== \"undefined\") {\n window.flatpickr = flatpickr;\n }\n\n return flatpickr;\n\n})));\n","module.exports = flarum.core.compat['Component'];","module.exports = flarum.core.compat['components/LogInModal'];","module.exports = flarum.core.compat['helpers/avatar'];","module.exports = flarum.core.compat['helpers/username'];","module.exports = flarum.core.compat['utils/PostControls'];","export default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class Poll extends mixin(Model, {\n question: Model.attribute('question'),\n hasEnded: Model.attribute('hasEnded'),\n endDate: Model.attribute('endDate'),\n publicPoll: Model.attribute('publicPoll'),\n\n options: Model.hasMany('options'),\n votes: Model.hasMany('votes'),\n}) {\n apiEndpoint() {\n return `/fof/polls${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class PollOption extends mixin(Model, {\n answer: Model.attribute('answer'),\n\n poll: Model.hasOne('polls'),\n votes: Model.hasMany('votes'),\n}) {\n apiEndpoint() {\n return `/fof/polls/answers${this.exists ? `/${this.data.id}` : ''}`;\n }\n}\n","import Model from 'flarum/Model';\nimport mixin from 'flarum/utils/mixin';\n\nexport default class PollVote extends mixin(Model, {\n poll: Model.hasOne('poll'),\n option: Model.hasOne('option'),\n user: Model.hasOne('user'),\n\n pollId: Model.attribute('pollId'),\n optionId: Model.attribute('optionId'),\n}) {\n apiEndpoint() {\n return `/fof/polls/${this.pollId()}/vote`;\n }\n}\n","import Button from 'flarum/components/Button';\nimport Modal from 'flarum/components/Modal';\nimport Switch from 'flarum/components/Switch';\nimport Stream from 'flarum/utils/Stream';\nimport flatpickr from 'flatpickr';\n\nexport default class CreatePollModal extends Modal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.options = [Stream(''), Stream('')];\n\n this.question = Stream('');\n\n this.endDate = Stream();\n\n this.publicPoll = Stream(false);\n\n if (this.attrs.poll && this.attrs.poll.relationships) {\n const poll = this.attrs.poll;\n\n this.options = poll.relationships.options.map((o) => Stream(o));\n this.question(poll.question);\n this.endDate(!poll.endDate || isNaN(poll.endDate.getTime()) ? null : poll.endDate);\n this.publicPoll(poll.publicPoll);\n }\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.add_title');\n }\n\n className() {\n return 'PollDiscussionModal Modal--small';\n }\n\n configDatePicker(vnode) {\n flatpickr(vnode.dom, {\n enableTime: true,\n minDate: this.endDate() || 'today',\n dateFormat: 'Y-m-d H:i',\n defaultDate: this.endDate(),\n wrap: true,\n\n onChange: (dates) => this.endDate(dates[0]),\n });\n }\n\n content() {\n return [\n
\n
\n
\n \n\n \n
\n\n
\n \n\n {this.displayOptions()}\n
\n\n
\n \n\n
\n \n {Button.component({\n className: 'Button PollModal--button',\n icon: 'fas fa-times',\n 'data-clear': true,\n })}\n
\n
\n\n
\n {Switch.component(\n {\n state: this.publicPoll() || false,\n onchange: this.publicPoll,\n },\n app.translator.trans('fof-polls.forum.modal.public_poll_label')\n )}\n
\n\n
\n {Button.component(\n {\n type: 'submit',\n className: 'Button Button--primary PollModal-SubmitButton',\n loading: this.loading,\n },\n app.translator.trans('fof-polls.forum.modal.submit')\n )}\n
\n
\n
,\n ];\n }\n\n displayOptions() {\n return Object.keys(this.options).map((el, i) => (\n
\n
\n \n
\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button Button--warning PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const setting = app.data['fof-polls.options.max'];\n const max = (setting && parseInt(setting)) || 11;\n\n if (this.options.length < max) {\n this.options.push(Stream(''));\n } else {\n alert(app.translator.trans('fof-polls.forum.modal.max'));\n }\n }\n\n removeOption(option) {\n this.options.splice(option, 1);\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n const poll = {\n question: this.question(),\n endDate: this.endDate(),\n publicPoll: this.publicPoll(),\n };\n const options = this.options.map((a) => a()).filter(Boolean);\n\n if (this.question() === '') {\n alert(app.translator.trans('fof-polls.forum.modal.include_question'));\n\n return;\n }\n\n if (options.length < 2) {\n alert(app.translator.trans('fof-polls.forum.modal.min'));\n\n return;\n }\n\n poll.relationships = { options };\n\n this.attrs.onsubmit(poll);\n\n app.modal.close();\n }\n}\n","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import Modal from 'flarum/components/Modal';\nimport avatar from 'flarum/helpers/avatar';\nimport username from 'flarum/helpers/username';\n\nexport default class ListVotersModal extends Modal {\n className() {\n return 'Modal--small';\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.votes_modal.title');\n }\n\n content() {\n return (\n
\n
    \n {this.attrs.poll.options().map((opt) => {\n const votes = this.attrs.poll\n .votes()\n .filter((v) => opt.id() === v.option().id())\n .map((v) => v.user());\n\n return (\n
    \n

    {opt.answer() + ':'}

    \n\n {votes.length ? (\n votes.map((u) => {\n const attrs = u && { href: app.route.user(u), config: m.route };\n\n return (\n
  • \n \n {avatar(u)} {username(u)}\n \n
  • \n );\n })\n ) : (\n

    {app.translator.trans('fof-polls.forum.modal.no_voters')}

    \n )}\n
    \n );\n })}\n
\n
\n );\n }\n}\n","import Component from 'flarum/Component';\nimport Button from 'flarum/components/Button';\nimport LogInModal from 'flarum/components/LogInModal';\nimport Stream from 'flarum/utils/Stream';\nimport ListVotersModal from './ListVotersModal';\n\nexport default class DiscussionPoll extends Component {\n oninit(vnode) {\n super.oninit(vnode);\n this.poll = this.attrs.poll;\n\n this.vote = Stream();\n this.voted = Stream(false);\n\n this.updateData();\n }\n\n view() {\n return (\n
\n

{this.poll.question()}

\n\n {this.options.map((opt) => {\n const hasVoted = this.voted();\n const voted = this.vote() && this.vote().option().id() === opt.id();\n const votes = this.votes.filter((v) => v.option().id() === opt.id()).length;\n const percent = Math.round((votes / this.poll.votes().length) * 100);\n\n const attrs = voted\n ? {\n title:\n hasVoted && app.translator.transChoice('fof-polls.forum.tooltip.votes', votes, { count: String(votes) }).join(''),\n oncreate: function (vnode) {\n $(vnode.dom).tooltip({ placement: 'right' });\n },\n }\n : {};\n\n const inputAttrs = voted\n ? {\n checked: true,\n }\n : {};\n\n return (\n
\n
\n {((!this.poll.hasEnded() && app.session.user && app.session.user.canVotePolls()) || !app.session.user) && (\n \n )}\n\n
\n \n {hasVoted && (\n \n )}\n
\n
\n );\n })}\n\n
\n\n {this.poll.publicPoll()\n ? Button.component(\n {\n className: 'Button Button--primary PublicPollButton',\n onclick: () => this.showVoters(),\n },\n app.translator.trans('fof-polls.forum.public_poll')\n )\n : ''}\n\n {app.session.user && !app.session.user.canVotePolls() ? (\n
{app.translator.trans('fof-polls.forum.no_permission')}
\n ) : this.poll.hasEnded() ? (\n
{app.translator.trans('fof-polls.forum.poll_ended')}
\n ) : this.poll.endDate() !== null ? (\n
\n \n {app.translator.trans('fof-polls.forum.days_remaining', { time: dayjs(this.poll.endDate()).fromNow() })}\n
\n ) : (\n ''\n )}\n
\n );\n }\n\n updateData() {\n this.poll = app.store.getById('polls', this.poll.id());\n this.options = this.poll.options() || [];\n this.votes = this.poll.votes() || [];\n\n this.vote(app.session.user ? this.votes.find((v) => v.user() && v.user().id() === app.session.user.id()) : null);\n\n this.voted(!!this.vote());\n }\n\n onError(evt, error) {\n evt.target.checked = false;\n\n app.alerts.show(error.alert);\n }\n\n changeVote(option, evt) {\n if (!app.session.user) {\n app.modal.show(LogInModal);\n evt.target.checked = false;\n return;\n }\n\n if (this.vote() && option.id() === this.vote().option().id()) option = null;\n\n if (!this.vote()) {\n this.vote(app.store.createRecord('poll_votes'));\n\n this.vote().pollId(this.poll.id());\n }\n\n app.request({\n method: 'PATCH',\n url: `${app.forum.attribute('apiUrl')}/fof/polls/${this.poll.id()}/vote`,\n errorHandler: this.onError.bind(this, evt),\n body: {\n data: {\n optionId: option ? option.id() : null,\n },\n },\n }).then((res) => {\n app.store.pushPayload(res);\n\n if (!option) app.store.remove(this.vote());\n\n this.updateData();\n\n if (!option) {\n m.redraw.sync();\n }\n m.redraw();\n });\n }\n\n showVoters() {\n app.modal.show(ListVotersModal, {\n poll: this.poll,\n });\n }\n}\n","import Button from 'flarum/components/Button';\nimport Stream from 'flarum/utils/Stream';\nimport CreatePollModal from './CreatePollModal';\n\nexport default class EditPollModal extends CreatePollModal {\n oninit(vnode) {\n super.oninit(vnode);\n\n this.poll = this.attrs.poll;\n\n this.options = this.poll.options();\n this.optionAnswers = this.options.map((o) => Stream(o.answer()));\n this.question = Stream(this.poll.question());\n this.endDate = Stream(this.poll.endDate());\n this.publicPoll = Stream(this.poll.publicPoll());\n }\n\n title() {\n return app.translator.trans('fof-polls.forum.modal.edit_title');\n }\n\n displayOptions() {\n return this.options.map((opt, i) => (\n
\n
\n \n
\n\n {i >= 2\n ? Button.component({\n type: 'button',\n className: 'Button PollModal--button',\n icon: 'fas fa-minus',\n onclick: i >= 2 ? this.removeOption.bind(this, i) : '',\n })\n : ''}\n
\n ));\n }\n\n addOption() {\n const setting = app.data['fof-polls.options.max'];\n const max = (setting && parseInt(setting)) || 11;\n\n if (this.options.length < max) {\n this.options.push(app.store.createRecord('poll_options'));\n this.optionAnswers.push(Stream(''));\n } else {\n alert(app.translator.trans('fof-polls.forum.modal.max'));\n }\n }\n\n removeOption(i) {\n this.options.splice(i, 1);\n this.optionAnswers.splice(i, 1);\n }\n\n onsubmit(e) {\n e.preventDefault();\n\n if (this.loading) return;\n\n this.loading = true;\n\n const options = this.options.map((o, i) => {\n if (!o.data.attributes) o.data.attributes = {};\n\n o.data.attributes.answer = this.optionAnswers[i]();\n\n return o.data;\n });\n\n return this.poll\n .save({\n question: this.question(),\n endDate: this.endDate() || false,\n publicPoll: this.publicPoll(),\n options,\n })\n .then(() => {\n document.location.reload();\n })\n .catch((e) => {\n this.loaded();\n this.onerror(e);\n });\n }\n}\n","import CreatePollModal from './CreatePollModal';\nimport DiscussionPoll from './DiscussionPoll';\nimport EditPollModal from './EditPollModal';\nimport ListVotersModal from './ListVotersModal';\n\nexport const components = {\n CreatePollModal,\n DiscussionPoll,\n EditPollModal,\n ListVotersModal,\n};\n","import Poll from './Poll';\nimport PollOption from './PollOption';\nimport PollVote from './PollVote';\n\nexport const models = {\n Poll,\n PollOption,\n PollVote,\n};\n","import Model from 'flarum/Model';\n\nimport Poll from './models/Poll';\nimport PollOption from './models/PollOption';\nimport PollVote from './models/PollVote';\n\nimport addDiscussionBadge from './addDiscussionBadge';\nimport addDiscussionComposerItem from './addDiscussionComposerItem';\nimport addPollToDiscussion from './addPollToDiscussion';\nimport addDiscussionControls from './addDiscussionControls';\n\nexport * from './components';\nexport * from './models';\n\napp.initializers.add('fof/polls', () => {\n app.store.models.polls = Poll;\n app.store.models.poll_options = PollOption;\n app.store.models.poll_votes = PollVote;\n\n app.store.models.discussions.prototype.poll = Model.hasOne('poll');\n\n app.store.models.users.prototype.canEditPolls = Model.attribute('canEditPolls');\n app.store.models.users.prototype.canStartPolls = Model.attribute('canStartPolls');\n app.store.models.users.prototype.canSelfEditPolls = Model.attribute('canSelfEditPolls');\n app.store.models.users.prototype.canVotePolls = Model.attribute('canVotePolls');\n\n addDiscussionBadge();\n addDiscussionControls();\n addDiscussionComposerItem();\n addPollToDiscussion();\n});\n","import { extend } from 'flarum/extend';\nimport Badge from 'flarum/components/Badge';\nimport DiscussionList from 'flarum/components/DiscussionList';\nimport Discussion from 'flarum/models/Discussion';\n\nexport default () => {\n extend(DiscussionList.prototype, 'requestParams', (params) => {\n params.include.push('poll');\n });\n\n extend(Discussion.prototype, 'badges', function (badges) {\n if (this.poll()) {\n badges.add(\n 'poll',\n Badge.component({\n type: 'poll',\n label: app.translator.trans('fof-polls.forum.tooltip.badge'),\n icon: 'fa fa-signal',\n }),\n 5\n );\n }\n });\n};\n","import { extend } from 'flarum/extend';\nimport PostControls from 'flarum/utils/PostControls';\nimport Button from 'flarum/components/Button';\n\nimport EditPollModal from './components/EditPollModal';\n\nexport default () => {\n extend(PostControls, 'moderationControls', function (items, post) {\n const discussion = post.discussion();\n const poll = discussion.poll();\n const user = app.session.user;\n\n if (!(poll && ((user && user.canEditPolls()) || (post.user() && post.user().canSelfEditPolls() && post.user().id() === user.id())) && post.number() === 1)) {\n return;\n }\n\n if (!poll.hasEnded()) {\n items.add(\n 'fof-polls-edit',\n Button.component(\n {\n icon: 'fas fa-check-square',\n onclick: () => app.modal.show(EditPollModal, { poll: poll }),\n },\n app.translator.trans('fof-polls.forum.moderation.edit')\n )\n );\n }\n\n items.add(\n 'fof-polls-remove',\n Button.component(\n {\n icon: 'fas fa-trash',\n onclick: () => {\n if (confirm(app.translator.trans('fof-polls.forum.moderation.delete_confirm'))) {\n poll.delete().then(() => {\n m.redraw.sync();\n });\n }\n },\n },\n app.translator.trans('fof-polls.forum.moderation.delete')\n )\n );\n });\n};\n","import { extend } from 'flarum/extend';\nimport DiscussionComposer from 'flarum/components/DiscussionComposer';\n\nimport CreatePollModal from './components/CreatePollModal';\n\nexport default () => {\n DiscussionComposer.prototype.addPoll = function () {\n app.modal.show(CreatePollModal, {\n poll: this.poll,\n onsubmit: (poll) => (this.poll = poll),\n });\n };\n\n // Add button to DiscussionComposer header\n extend(DiscussionComposer.prototype, 'headerItems', function (items) {\n if (app.session.user && app.session.user.canStartPolls()) {\n items.add(\n 'polls',\n \n \n {app.translator.trans(`fof-polls.forum.composer_discussion.${this.poll ? 'edit' : 'add'}_poll`)}\n \n ,\n 1\n );\n }\n });\n\n extend(DiscussionComposer.prototype, 'data', function (data) {\n if (this.poll) {\n data.poll = this.poll;\n }\n });\n};\n","import { extend } from 'flarum/extend';\nimport CommentPost from 'flarum/components/CommentPost';\nimport Stream from 'flarum/utils/Stream';\nimport DiscussionPoll from './components/DiscussionPoll';\n\n// import PollVote from './components/PollVote';\n\nexport default () => {\n extend(CommentPost.prototype, 'content', function (content) {\n const discussion = this.attrs.post.discussion();\n\n if (discussion.poll() && this.attrs.post.number() === 1) {\n content.push(\n DiscussionPoll.component({\n poll: discussion.poll(),\n })\n );\n }\n });\n\n extend(CommentPost.prototype, 'oncreate', function (context) {\n if (app.pusher) {\n app.pusher.then((channels) => {\n channels.main.bind('newPollVote', (data) => {\n var userId = parseInt(data['user_id']);\n\n if (app.session.user && userId == app.session.user.id()) return;\n\n let poll = app.store.getById('polls', this.attrs.post.discussion().poll().id());\n\n if (parseInt(poll.id()) === parseInt(data['poll_id'])) {\n let vote = {};\n\n Object.keys(data).map((key) => {\n vote[key] = Stream(data[key]);\n });\n\n vote['option'] = Stream(app.store.getById('poll_options', data['option_id']));\n vote['user'] = Stream(app.store.getById('users', data['user_id']));\n\n let newVotes = poll.votes();\n\n newVotes.some((vote, i) => {\n if (parseInt(vote.user() && vote.user().id()) === userId) {\n newVotes.splice(i, 1);\n }\n });\n\n newVotes.push(vote);\n\n poll.votes = Stream(newVotes);\n\n m.redraw.sync();\n }\n });\n\n extend(context, 'onunload', () => channels.main.unbind('newPollVote'));\n });\n }\n });\n};\n"],"sourceRoot":""} \ No newline at end of file diff --git a/js/src/forum/components/DiscussionPoll.js b/js/src/forum/components/DiscussionPoll.js index 2f45f3b1..ab2d5719 100755 --- a/js/src/forum/components/DiscussionPoll.js +++ b/js/src/forum/components/DiscussionPoll.js @@ -4,7 +4,7 @@ import LogInModal from 'flarum/components/LogInModal'; import Stream from 'flarum/utils/Stream'; import ListVotersModal from './ListVotersModal'; -export default class PollVote extends Component { +export default class DiscussionPoll extends Component { oninit(vnode) { super.oninit(vnode); this.poll = this.attrs.poll; diff --git a/js/src/forum/components/ListVotersModal.js b/js/src/forum/components/ListVotersModal.js index cb831d4d..54be6437 100755 --- a/js/src/forum/components/ListVotersModal.js +++ b/js/src/forum/components/ListVotersModal.js @@ -2,7 +2,7 @@ import Modal from 'flarum/components/Modal'; import avatar from 'flarum/helpers/avatar'; import username from 'flarum/helpers/username'; -export default class ShowVotersModal extends Modal { +export default class ListVotersModal extends Modal { className() { return 'Modal--small'; } diff --git a/js/src/forum/components/index.js b/js/src/forum/components/index.js new file mode 100644 index 00000000..1221c0fb --- /dev/null +++ b/js/src/forum/components/index.js @@ -0,0 +1,11 @@ +import CreatePollModal from './CreatePollModal'; +import DiscussionPoll from './DiscussionPoll'; +import EditPollModal from './EditPollModal'; +import ListVotersModal from './ListVotersModal'; + +export const components = { + CreatePollModal, + DiscussionPoll, + EditPollModal, + ListVotersModal, +}; diff --git a/js/src/forum/index.js b/js/src/forum/index.js index 618259f2..00351c93 100755 --- a/js/src/forum/index.js +++ b/js/src/forum/index.js @@ -9,6 +9,9 @@ import addDiscussionComposerItem from './addDiscussionComposerItem'; import addPollToDiscussion from './addPollToDiscussion'; import addDiscussionControls from './addDiscussionControls'; +export * from './components'; +export * from './models'; + app.initializers.add('fof/polls', () => { app.store.models.polls = Poll; app.store.models.poll_options = PollOption; diff --git a/js/src/forum/models/index.js b/js/src/forum/models/index.js new file mode 100644 index 00000000..b10f9cd3 --- /dev/null +++ b/js/src/forum/models/index.js @@ -0,0 +1,9 @@ +import Poll from './Poll'; +import PollOption from './PollOption'; +import PollVote from './PollVote'; + +export const models = { + Poll, + PollOption, + PollVote, +};