module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(o,a,function(t){return e[t]}.bind(null,a));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t){e.exports=flarum.core.compat.Model},function(e,t){e.exports=flarum.core.compat.extend},function(e,t){e.exports=flarum.core.compat["components/Button"]},function(e,t){e.exports=flarum.core.compat["utils/mixin"]},function(e,t){e.exports=flarum.core.compat["components/Modal"]},function(e,t){e.exports=flarum.core.compat["components/DiscussionComposer"]},,function(e,t){e.exports=flarum.core.compat["components/Badge"]},function(e,t){e.exports=flarum.core.compat["components/DiscussionList"]},function(e,t){e.exports=flarum.core.compat["models/Discussion"]},function(e,t){e.exports=flarum.core.compat["components/Switch"]},function(e,t,n){
/* flatpickr v4.6.1, @license MIT */
e.exports=function(){"use strict";
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},t=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],n={_disable:[],_enable:[],allowInput:!1,altFormat:"F j, Y",altInput:!1,altInputClass:"form-control input",animate:"object"==typeof window&&-1===window.navigator.userAgent.indexOf("MSIE"),ariaDateFormat:"F j, Y",clickOpens:!0,closeOnSelect:!0,conjunction:", ",dateFormat:"Y-m-d",defaultHour:12,defaultMinute:0,defaultSeconds:0,disable:[],disableMobile:!1,enable:[],enableSeconds:!1,enableTime:!1,errorHandler:function(e){return"undefined"!=typeof console&&console.warn(e)},getWeek:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},hourIncrement:1,ignoredFocusElements:[],inline:!1,locale:"default",minuteIncrement:5,mode:"single",nextArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",noCalendar:!1,now:new Date,onChange:[],onClose:[],onDayCreate:[],onDestroy:[],onKeyDown:[],onMonthChange:[],onOpen:[],onParseConfig:[],onReady:[],onValueUpdate:[],onYearChange:[],onPreCalendarPosition:[],plugins:[],position:"auto",positionElement:void 0,prevArrow:"<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",shorthandCurrentMonth:!1,showMonths:1,static:!1,time_24hr:!1,weekNumbers:!1,wrap:!1},o={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",time_24hr:!1},a=function(e){return("0"+e).slice(-2)},i=function(e){return!0===e?1:0};function r(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 l=function(e){return e instanceof Array?e:[e]};function s(e,t,n){if(!0===n)return e.classList.add(t);e.classList.remove(t)}function c(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 u(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function d(e,t){var n=c("div","numInputWrapper"),o=c("input","numInput "+e),a=c("span","arrowUp"),i=c("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}var p=function(){},f=function(e,t,n){return n.months[t?"shorthand":"longhand"][e]},m={D:p,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*i(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:p,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:p,y:function(e,t){e.setFullYear(2e3+parseFloat(t))}},h={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})"},g={Z:function(e){return e.toISOString()},D:function(e,t,n){return t.weekdays.shorthand[g.w(e,t,n)]},F:function(e,t,n){return f(g.n(e,t,n)-1,!1,t)},G:function(e,t,n){return a(g.h(e,t,n))},H:function(e){return a(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[i(e.getHours()>11)]},M:function(e,t){return f(e.getMonth(),!0,t)},S:function(e){return a(e.getSeconds())},U:function(e){return e.getTime()/1e3},W:function(e,t,n){return n.getWeek(e)},Y:function(e){return e.getFullYear()},d:function(e){return a(e.getDate())},h:function(e){return e.getHours()%12?e.getHours()%12:12},i:function(e){return a(e.getMinutes())},j:function(e){return e.getDate()},l:function(e,t){return t.weekdays.longhand[e.getDay()]},m:function(e){return a(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)}},v=function(e){var t=e.config,a=void 0===t?n:t,i=e.l10n,r=void 0===i?o:i;return function(e,t,n){var o=n||r;return void 0!==a.formatDate?a.formatDate(e,t,o):t.split("").map(function(t,n,i){return g[t]&&"\\"!==i[n-1]?g[t](e,o,a):"\\"!==t?t:""}).join("")}},D=function(e){var t=e.config,a=void 0===t?n:t,i=e.l10n,r=void 0===i?o:i;return function(e,t,o,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||(a||n).dateFormat,d=String(e).trim();if("today"===d)l=new Date,o=!0;else if(/Z$/.test(d)||/GMT$/.test(d))l=new Date(e);else if(a&&a.parseDate)l=a.parseDate(e,u);else{l=a&&a.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=[],g=0,v=0,D="";g<u.length;g++){var b=u[g],y="\\"===b,w="\\"===u[g-1]||y;if(h[b]&&!w){D+=h[b];var M=new RegExp(D).exec(e);M&&(p=!0)&&f["Y"!==b?"push":"unshift"]({fn:m[b],val:M[++v]})}else y||(D+=".");f.forEach(function(e){var t=e.fn,n=e.val;return l=t(l,n,s)||l})}l=p?l:void 0}}if(l instanceof Date&&!isNaN(l.getTime()))return!0===o&&l.setHours(0,0,0,0),l;a.errorHandler(new Error("Invalid date provided: "+c))}}};function b(e,t,n){return void 0===n&&(n=!0),!1!==n?new Date(e.getTime()).setHours(0,0,0,0)-new Date(t.getTime()).setHours(0,0,0,0):e.getTime()-t.getTime()}var y=function(e,t,n){return e>Math.min(t,n)&&e<Math.max(t,n)},w={DAY:864e5};"function"!=typeof Object.assign&&(Object.assign=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(!e)throw TypeError("Cannot convert undefined or null to object");for(var o=function(t){t&&Object.keys(t).forEach(function(n){return e[n]=t[n]})},a=0,i=t;a<i.length;a++){var r=i[a];o(r)}return e});var M=300;function C(p,m){var g={config:e({},n,E.defaultConfig),l10n:o};function C(e){return e.bind(g)}function x(){var e=g.config;!1===e.weekNumbers&&1===e.showMonths||!0!==e.noCalendar&&window.requestAnimationFrame(function(){if(void 0!==g.calendarContainer&&(g.calendarContainer.style.visibility="hidden",g.calendarContainer.style.display="block"),void 0!==g.daysContainer){var t=(g.days.offsetWidth+1)*e.showMonths;g.daysContainer.style.width=t+"px",g.calendarContainer.style.width=t+(void 0!==g.weekWrapper?g.weekWrapper.offsetWidth:0)+"px",g.calendarContainer.style.removeProperty("visibility"),g.calendarContainer.style.removeProperty("display")}})}function P(e){0===g.selectedDates.length&&re(),void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,n=e.target;void 0!==g.amPM&&e.target===g.amPM&&(g.amPM.textContent=g.l10n.amPM[i(g.amPM.textContent===g.l10n.amPM[0])]);var o=parseFloat(n.getAttribute("min")),r=parseFloat(n.getAttribute("max")),l=parseFloat(n.getAttribute("step")),s=parseInt(n.value,10),c=e.delta||(t?38===e.which?1:-1:0),u=s+l*c;if(void 0!==n.value&&2===n.value.length){var d=n===g.hourElement,p=n===g.minuteElement;u<o?(u=r+u+i(!d)+(i(d)&&i(!g.amPM)),p&&H(void 0,-1,g.hourElement)):u>r&&(u=n===g.hourElement?u-r-i(!g.amPM):o,p&&H(void 0,1,g.hourElement)),g.amPM&&d&&(1===l?u+s===23:Math.abs(u-s)>l)&&(g.amPM.textContent=g.l10n.amPM[i(g.amPM.textContent===g.l10n.amPM[0])]),n.value=a(u)}}(e);var t=g._input.value;T(),we(),g._input.value!==t&&g._debouncedChange()}function T(){if(void 0!==g.hourElement&&void 0!==g.minuteElement){var e,t,n=(parseInt(g.hourElement.value.slice(-2),10)||0)%24,o=(parseInt(g.minuteElement.value,10)||0)%60,a=void 0!==g.secondElement?(parseInt(g.secondElement.value,10)||0)%60:0;void 0!==g.amPM&&(e=n,t=g.amPM.textContent,n=e%12+12*i(t===g.l10n.amPM[1]));var r=void 0!==g.config.minTime||g.config.minDate&&g.minDateHasTime&&g.latestSelectedDateObj&&0===b(g.latestSelectedDateObj,g.config.minDate,!0),l=void 0!==g.config.maxTime||g.config.maxDate&&g.maxDateHasTime&&g.latestSelectedDateObj&&0===b(g.latestSelectedDateObj,g.config.maxDate,!0);if(l){var s=void 0!==g.config.maxTime?g.config.maxTime:g.config.maxDate;(n=Math.min(n,s.getHours()))===s.getHours()&&(o=Math.min(o,s.getMinutes())),o===s.getMinutes()&&(a=Math.min(a,s.getSeconds()))}if(r){var c=void 0!==g.config.minTime?g.config.minTime:g.config.minDate;(n=Math.max(n,c.getHours()))===c.getHours()&&(o=Math.max(o,c.getMinutes())),o===c.getMinutes()&&(a=Math.max(a,c.getSeconds()))}N(n,o,a)}}function k(e){var t=e||g.latestSelectedDateObj;t&&N(t.getHours(),t.getMinutes(),t.getSeconds())}function O(){var e=g.config.defaultHour,t=g.config.defaultMinute,n=g.config.defaultSeconds;if(void 0!==g.config.minDate){var o=g.config.minDate.getHours(),a=g.config.minDate.getMinutes();(e=Math.max(e,o))===o&&(t=Math.max(a,t)),e===o&&t===a&&(n=g.config.minDate.getSeconds())}if(void 0!==g.config.maxDate){var i=g.config.maxDate.getHours(),r=g.config.maxDate.getMinutes();(e=Math.min(e,i))===i&&(t=Math.min(r,t)),e===i&&t===r&&(n=g.config.maxDate.getSeconds())}N(e,t,n)}function N(e,t,n){void 0!==g.latestSelectedDateObj&&g.latestSelectedDateObj.setHours(e%24,t,n||0,0),g.hourElement&&g.minuteElement&&!g.isMobile&&(g.hourElement.value=a(g.config.time_24hr?e:(12+e)%12+12*i(e%12==0)),g.minuteElement.value=a(t),void 0!==g.amPM&&(g.amPM.textContent=g.l10n.amPM[i(e>=12)]),void 0!==g.secondElement&&(g.secondElement.value=a(n)))}function _(e){var t=parseInt(e.target.value)+(e.delta||0);(t/1e3>1||"Enter"===e.key&&!/[^\d]/.test(t.toString()))&&ee(t)}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 g._handlers.push({element:e,event:t,handler:n,options:o}))}function S(e){return function(t){1===t.which&&e(t)}}function F(){ge("onChange")}function A(){if(g.config.wrap&&["open","close","toggle","clear"].forEach(function(e){Array.prototype.forEach.call(g.element.querySelectorAll("[data-"+e+"]"),function(t){return I(t,"click",g[e])})}),g.isMobile)!function(){var e=g.config.enableTime?g.config.noCalendar?"time":"datetime-local":"date";g.mobileInput=c("input",g.input.className+" flatpickr-mobile"),g.mobileInput.step=g.input.getAttribute("step")||"any",g.mobileInput.tabIndex=1,g.mobileInput.type=e,g.mobileInput.disabled=g.input.disabled,g.mobileInput.required=g.input.required,g.mobileInput.placeholder=g.input.placeholder,g.mobileFormatStr="datetime-local"===e?"Y-m-d\\TH:i:S":"date"===e?"Y-m-d":"H:i:S",g.selectedDates.length>0&&(g.mobileInput.defaultValue=g.mobileInput.value=g.formatDate(g.selectedDates[0],g.mobileFormatStr)),g.config.minDate&&(g.mobileInput.min=g.formatDate(g.config.minDate,"Y-m-d")),g.config.maxDate&&(g.mobileInput.max=g.formatDate(g.config.maxDate,"Y-m-d")),g.input.type="hidden",void 0!==g.altInput&&(g.altInput.type="hidden");try{g.input.parentNode&&g.input.parentNode.insertBefore(g.mobileInput,g.input.nextSibling)}catch(e){}I(g.mobileInput,"change",function(e){g.setDate(e.target.value,!1,g.mobileFormatStr),ge("onChange"),ge("onClose")})}();else{var e=r(ie,50);g._debouncedChange=r(F,M),g.daysContainer&&!/iPhone|iPad|iPod/i.test(navigator.userAgent)&&I(g.daysContainer,"mouseover",function(e){"range"===g.config.mode&&ae(e.target)}),I(window.document.body,"keydown",oe),g.config.inline||g.config.static||I(window,"resize",e),void 0!==window.ontouchstart?I(window.document,"touchstart",X):I(window.document,"mousedown",S(X)),I(window.document,"focus",X,{capture:!0}),!0===g.config.clickOpens&&(I(g._input,"focus",g.open),I(g._input,"mousedown",S(g.open))),void 0!==g.daysContainer&&(I(g.monthNav,"mousedown",S(Me)),I(g.monthNav,["keyup","increment"],_),I(g.daysContainer,"mousedown",S(pe))),void 0!==g.timeContainer&&void 0!==g.minuteElement&&void 0!==g.hourElement&&(I(g.timeContainer,["increment"],P),I(g.timeContainer,"blur",P,{capture:!0}),I(g.timeContainer,"mousedown",S(j)),I([g.hourElement,g.minuteElement],["focus","click"],function(e){return e.target.select()}),void 0!==g.secondElement&&I(g.secondElement,"focus",function(){return g.secondElement&&g.secondElement.select()}),void 0!==g.amPM&&I(g.amPM,"mousedown",S(function(e){P(e),F()})))}}function Y(e,t){var n=void 0!==e?g.parseDate(e):g.latestSelectedDateObj||(g.config.minDate&&g.config.minDate>g.now?g.config.minDate:g.config.maxDate&&g.config.maxDate<g.now?g.config.maxDate:g.now),o=g.currentYear,a=g.currentMonth;try{void 0!==n&&(g.currentYear=n.getFullYear(),g.currentMonth=n.getMonth())}catch(e){e.message="Invalid date supplied: "+n,g.config.errorHandler(e)}t&&g.currentYear!==o&&(ge("onYearChange"),V()),!t||g.currentYear===o&&g.currentMonth===a||ge("onMonthChange"),g.redraw()}function j(e){~e.target.className.indexOf("arrow")&&H(e,e.target.classList.contains("arrowUp")?1:-1)}function H(e,t,n){var o=e&&e.target,a=n||o&&o.parentNode&&o.parentNode.firstChild,i=ve("increment");i.delta=t,a&&a.dispatchEvent(i)}function L(){var e=window.document.createDocumentFragment();if(g.calendarContainer=c("div","flatpickr-calendar"),g.calendarContainer.tabIndex=-1,!g.config.noCalendar){if(e.appendChild((g.monthNav=c("div","flatpickr-months"),g.yearElements=[],g.monthElements=[],g.prevMonthNav=c("span","flatpickr-prev-month"),g.prevMonthNav.innerHTML=g.config.prevArrow,g.nextMonthNav=c("span","flatpickr-next-month"),g.nextMonthNav.innerHTML=g.config.nextArrow,$(),Object.defineProperty(g,"_hidePrevMonthArrow",{get:function(){return g.__hidePrevMonthArrow},set:function(e){g.__hidePrevMonthArrow!==e&&(s(g.prevMonthNav,"flatpickr-disabled",e),g.__hidePrevMonthArrow=e)}}),Object.defineProperty(g,"_hideNextMonthArrow",{get:function(){return g.__hideNextMonthArrow},set:function(e){g.__hideNextMonthArrow!==e&&(s(g.nextMonthNav,"flatpickr-disabled",e),g.__hideNextMonthArrow=e)}}),g.currentYearElement=g.yearElements[0],be(),g.monthNav)),g.innerContainer=c("div","flatpickr-innerContainer"),g.config.weekNumbers){var t=function(){g.calendarContainer.classList.add("hasWeeks");var e=c("div","flatpickr-weekwrapper");e.appendChild(c("span","flatpickr-weekday",g.l10n.weekAbbreviation));var t=c("div","flatpickr-weeks");return e.appendChild(t),{weekWrapper:e,weekNumbers:t}}(),n=t.weekWrapper,o=t.weekNumbers;g.innerContainer.appendChild(n),g.weekNumbers=o,g.weekWrapper=n}g.rContainer=c("div","flatpickr-rContainer"),g.rContainer.appendChild(z()),g.daysContainer||(g.daysContainer=c("div","flatpickr-days"),g.daysContainer.tabIndex=-1),K(),g.rContainer.appendChild(g.daysContainer),g.innerContainer.appendChild(g.rContainer),e.appendChild(g.innerContainer)}g.config.enableTime&&e.appendChild(function(){g.calendarContainer.classList.add("hasTime"),g.config.noCalendar&&g.calendarContainer.classList.add("noCalendar"),g.timeContainer=c("div","flatpickr-time"),g.timeContainer.tabIndex=-1;var e=c("span","flatpickr-time-separator",":"),t=d("flatpickr-hour");g.hourElement=t.getElementsByTagName("input")[0];var n=d("flatpickr-minute");if(g.minuteElement=n.getElementsByTagName("input")[0],g.hourElement.tabIndex=g.minuteElement.tabIndex=-1,g.hourElement.value=a(g.latestSelectedDateObj?g.latestSelectedDateObj.getHours():g.config.time_24hr?g.config.defaultHour:function(e){switch(e%24){case 0:case 12:return 12;default:return e%12}}(g.config.defaultHour)),g.minuteElement.value=a(g.latestSelectedDateObj?g.latestSelectedDateObj.getMinutes():g.config.defaultMinute),g.hourElement.setAttribute("step",g.config.hourIncrement.toString()),g.minuteElement.setAttribute("step",g.config.minuteIncrement.toString()),g.hourElement.setAttribute("min",g.config.time_24hr?"0":"1"),g.hourElement.setAttribute("max",g.config.time_24hr?"23":"12"),g.minuteElement.setAttribute("min","0"),g.minuteElement.setAttribute("max","59"),g.timeContainer.appendChild(t),g.timeContainer.appendChild(e),g.timeContainer.appendChild(n),g.config.time_24hr&&g.timeContainer.classList.add("time24hr"),g.config.enableSeconds){g.timeContainer.classList.add("hasSeconds");var o=d("flatpickr-second");g.secondElement=o.getElementsByTagName("input")[0],g.secondElement.value=a(g.latestSelectedDateObj?g.latestSelectedDateObj.getSeconds():g.config.defaultSeconds),g.secondElement.setAttribute("step",g.minuteElement.getAttribute("step")),g.secondElement.setAttribute("min","0"),g.secondElement.setAttribute("max","59"),g.timeContainer.appendChild(c("span","flatpickr-time-separator",":")),g.timeContainer.appendChild(o)}return g.config.time_24hr||(g.amPM=c("span","flatpickr-am-pm",g.l10n.amPM[i((g.latestSelectedDateObj?g.hourElement.value:g.config.defaultHour)>11)]),g.amPM.title=g.l10n.toggleTitle,g.amPM.tabIndex=-1,g.timeContainer.appendChild(g.amPM)),g.timeContainer}()),s(g.calendarContainer,"rangeMode","range"===g.config.mode),s(g.calendarContainer,"animate",!0===g.config.animate),s(g.calendarContainer,"multiMonth",g.config.showMonths>1),g.calendarContainer.appendChild(e);var r=void 0!==g.config.appendTo&&void 0!==g.config.appendTo.nodeType;if((g.config.inline||g.config.static)&&(g.calendarContainer.classList.add(g.config.inline?"inline":"static"),g.config.inline&&(!r&&g.element.parentNode?g.element.parentNode.insertBefore(g.calendarContainer,g._input.nextSibling):void 0!==g.config.appendTo&&g.config.appendTo.appendChild(g.calendarContainer)),g.config.static)){var l=c("div","flatpickr-wrapper");g.element.parentNode&&g.element.parentNode.insertBefore(l,g.element),l.appendChild(g.element),g.altInput&&l.appendChild(g.altInput),l.appendChild(g.calendarContainer)}g.config.static||g.config.inline||(void 0!==g.config.appendTo?g.config.appendTo:window.document.body).appendChild(g.calendarContainer)}function B(e,t,n,o){var a=te(t,!0),i=c("span","flatpickr-day "+e,t.getDate().toString());return i.dateObj=t,i.$i=o,i.setAttribute("aria-label",g.formatDate(t,g.config.ariaDateFormat)),-1===e.indexOf("hidden")&&0===b(t,g.now)&&(g.todayDateElem=i,i.classList.add("today"),i.setAttribute("aria-current","date")),a?(i.tabIndex=-1,De(t)&&(i.classList.add("selected"),g.selectedDateElem=i,"range"===g.config.mode&&(s(i,"startRange",g.selectedDates[0]&&0===b(t,g.selectedDates[0],!0)),s(i,"endRange",g.selectedDates[1]&&0===b(t,g.selectedDates[1],!0)),"nextMonthDay"===e&&i.classList.add("inRange")))):i.classList.add("flatpickr-disabled"),"range"===g.config.mode&&function(e){return!("range"!==g.config.mode||g.selectedDates.length<2)&&b(e,g.selectedDates[0])>=0&&b(e,g.selectedDates[1])<=0}(t)&&!De(t)&&i.classList.add("inRange"),g.weekNumbers&&1===g.config.showMonths&&"prevMonthDay"!==e&&n%7==1&&g.weekNumbers.insertAdjacentHTML("beforeend","<span class='flatpickr-day'>"+g.config.getWeek(t)+"</span>"),ge("onDayCreate",i),i}function q(e){e.focus(),"range"===g.config.mode&&ae(e)}function W(e){for(var t=e>0?0:g.config.showMonths-1,n=e>0?g.config.showMonths:-1,o=t;o!=n;o+=e)for(var a=g.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")&&te(s.dateObj))return s}}function R(e,t){var n=ne(document.activeElement||document.body),o=void 0!==e?e:n?document.activeElement:void 0!==g.selectedDateElem&&ne(g.selectedDateElem)?g.selectedDateElem:void 0!==g.todayDateElem&&ne(g.todayDateElem)?g.todayDateElem:W(t>0?1:-1);return void 0===o?g._input.focus():n?void function(e,t){for(var n=-1===e.className.indexOf("Month")?e.dateObj.getMonth():g.currentMonth,o=t>0?g.config.showMonths:-1,a=t>0?1:-1,i=n-g.currentMonth;i!=o;i+=a)for(var r=g.daysContainer.children[i],l=n-g.currentMonth===i?e.$i+t:t<0?r.children.length-1:0,s=r.children.length,c=l;c>=0&&c<s&&c!=(t>0?s:-1);c+=a){var u=r.children[c];if(-1===u.className.indexOf("hidden")&&te(u.dateObj)&&Math.abs(e.$i-c)>=Math.abs(t))return q(u)}g.changeMonth(a),R(W(a),0)}(o,t):q(o)}function J(e,t){for(var n=(new Date(e,t,1).getDay()-g.l10n.firstDayOfWeek+7)%7,o=g.utils.getDaysInMonth((t-1+12)%12),a=g.utils.getDaysInMonth(t),i=window.document.createDocumentFragment(),r=g.config.showMonths>1,l=r?"prevMonthDay hidden":"prevMonthDay",s=r?"nextMonthDay hidden":"nextMonthDay",u=o+1-n,d=0;u<=o;u++,d++)i.appendChild(B(l,new Date(e,t-1,u),u,d));for(u=1;u<=a;u++,d++)i.appendChild(B("",new Date(e,t,u),u,d));for(var p=a+1;p<=42-n&&(1===g.config.showMonths||d%7!=0);p++,d++)i.appendChild(B(s,new Date(e,t+1,p%a),p,d));var f=c("div","dayContainer");return f.appendChild(i),f}function K(){if(void 0!==g.daysContainer){u(g.daysContainer),g.weekNumbers&&u(g.weekNumbers);for(var e=document.createDocumentFragment(),t=0;t<g.config.showMonths;t++){var n=new Date(g.currentYear,g.currentMonth,1);n.setMonth(g.currentMonth+t),e.appendChild(J(n.getFullYear(),n.getMonth()))}g.daysContainer.appendChild(e),g.days=g.daysContainer.firstChild,"range"===g.config.mode&&1===g.selectedDates.length&&ae()}}function V(){if(!(g.config.showMonths>1)){var e=function(e){return!(void 0!==g.config.minDate&&g.currentYear===g.config.minDate.getFullYear()&&e<g.config.minDate.getMonth()||void 0!==g.config.maxDate&&g.currentYear===g.config.maxDate.getFullYear()&&e>g.config.maxDate.getMonth())};g.monthsDropdownContainer.tabIndex=-1,g.monthsDropdownContainer.innerHTML="";for(var t=0;t<12;t++)if(e(t)){var n=c("option","flatpickr-monthDropdown-month");n.value=new Date(g.currentYear,t).getMonth().toString(),n.textContent=f(t,!1,g.l10n),n.tabIndex=-1,g.currentMonth===t&&(n.selected=!0),g.monthsDropdownContainer.appendChild(n)}}}function U(){var e,t=c("div","flatpickr-month"),n=window.document.createDocumentFragment();g.config.showMonths>1?e=c("span","cur-month"):(g.monthsDropdownContainer=c("select","flatpickr-monthDropdown-months"),I(g.monthsDropdownContainer,"change",function(e){var t=e.target,n=parseInt(t.value,10);g.changeMonth(n-g.currentMonth),ge("onMonthChange")}),V(),e=g.monthsDropdownContainer);var o=d("cur-year",{tabindex:"-1"}),a=o.getElementsByTagName("input")[0];a.setAttribute("aria-label",g.l10n.yearAriaLabel),g.config.minDate&&a.setAttribute("min",g.config.minDate.getFullYear().toString()),g.config.maxDate&&(a.setAttribute("max",g.config.maxDate.getFullYear().toString()),a.disabled=!!g.config.minDate&&g.config.minDate.getFullYear()===g.config.maxDate.getFullYear());var i=c("div","flatpickr-current-month");return i.appendChild(e),i.appendChild(o),n.appendChild(i),t.appendChild(n),{container:t,yearElement:a,monthElement:e}}function $(){u(g.monthNav),g.monthNav.appendChild(g.prevMonthNav),g.config.showMonths&&(g.yearElements=[],g.monthElements=[]);for(var e=g.config.showMonths;e--;){var t=U();g.yearElements.push(t.yearElement),g.monthElements.push(t.monthElement),g.monthNav.appendChild(t.container)}g.monthNav.appendChild(g.nextMonthNav)}function z(){g.weekdayContainer?u(g.weekdayContainer):g.weekdayContainer=c("div","flatpickr-weekdays");for(var e=g.config.showMonths;e--;){var t=c("div","flatpickr-weekdaycontainer");g.weekdayContainer.appendChild(t)}return G(),g.weekdayContainer}function G(){var e=g.l10n.firstDayOfWeek,t=g.l10n.weekdays.shorthand.slice();e>0&&e<t.length&&(t=t.splice(e,t.length).concat(t.splice(0,e)));for(var n=g.config.showMonths;n--;)g.weekdayContainer.children[n].innerHTML="\n      <span class='flatpickr-weekday'>\n        "+t.join("</span><span class='flatpickr-weekday'>")+"\n      </span>\n      "}function Z(e,t){void 0===t&&(t=!0);var n=t?e:e-g.currentMonth;n<0&&!0===g._hidePrevMonthArrow||n>0&&!0===g._hideNextMonthArrow||(g.currentMonth+=n,(g.currentMonth<0||g.currentMonth>11)&&(g.currentYear+=g.currentMonth>11?1:-1,g.currentMonth=(g.currentMonth+12)%12,ge("onYearChange"),V()),K(),ge("onMonthChange"),be())}function Q(e){return!(!g.config.appendTo||!g.config.appendTo.contains(e))||g.calendarContainer.contains(e)}function X(e){if(g.isOpen&&!g.config.inline){var t=function(e){if("function"==typeof e.composedPath){var t=e.composedPath();return t[0]}return e.target}(e),n=Q(t),o=t===g.input||t===g.altInput||g.element.contains(t)||e.path&&e.path.indexOf&&(~e.path.indexOf(g.input)||~e.path.indexOf(g.altInput)),a="blur"===e.type?o&&e.relatedTarget&&!Q(e.relatedTarget):!o&&!n&&!Q(e.relatedTarget),i=!g.config.ignoredFocusElements.some(function(e){return e.contains(t)});a&&i&&(g.close(),"range"===g.config.mode&&1===g.selectedDates.length&&(g.clear(!1),g.redraw()))}}function ee(e){if(!(!e||g.config.minDate&&e<g.config.minDate.getFullYear()||g.config.maxDate&&e>g.config.maxDate.getFullYear())){var t=e,n=g.currentYear!==t;g.currentYear=t||g.currentYear,g.config.maxDate&&g.currentYear===g.config.maxDate.getFullYear()?g.currentMonth=Math.min(g.config.maxDate.getMonth(),g.currentMonth):g.config.minDate&&g.currentYear===g.config.minDate.getFullYear()&&(g.currentMonth=Math.max(g.config.minDate.getMonth(),g.currentMonth)),n&&(g.redraw(),ge("onYearChange"),V())}}function te(e,t){void 0===t&&(t=!0);var n=g.parseDate(e,void 0,t);if(g.config.minDate&&n&&b(n,g.config.minDate,void 0!==t?t:!g.minDateHasTime)<0||g.config.maxDate&&n&&b(n,g.config.maxDate,void 0!==t?t:!g.maxDateHasTime)>0)return!1;if(0===g.config.enable.length&&0===g.config.disable.length)return!0;if(void 0===n)return!1;for(var o=g.config.enable.length>0,a=o?g.config.enable:g.config.disable,i=0,r=void 0;i<a.length;i++){if("function"==typeof(r=a[i])&&r(n))return o;if(r instanceof Date&&void 0!==n&&r.getTime()===n.getTime())return o;if("string"==typeof r&&void 0!==n){var l=g.parseDate(r,void 0,!0);return l&&l.getTime()===n.getTime()?o:!o}if("object"==typeof r&&void 0!==n&&r.from&&r.to&&n.getTime()>=r.from.getTime()&&n.getTime()<=r.to.getTime())return o}return!o}function ne(e){return void 0!==g.daysContainer&&-1===e.className.indexOf("hidden")&&g.daysContainer.contains(e)}function oe(e){var t=e.target===g._input,n=g.config.allowInput,o=g.isOpen&&(!n||!t),a=g.config.inline&&t&&!n;if(13===e.keyCode&&t){if(n)return g.setDate(g._input.value,!0,e.target===g.altInput?g.config.altFormat:g.config.dateFormat),e.target.blur();g.open()}else if(Q(e.target)||o||a){var i=!!g.timeContainer&&g.timeContainer.contains(e.target);switch(e.keyCode){case 13:i?(e.preventDefault(),P(),de()):pe(e);break;case 27:e.preventDefault(),de();break;case 8:case 46:t&&!g.config.allowInput&&(e.preventDefault(),g.clear());break;case 37:case 39:if(i||t)g.hourElement&&g.hourElement.focus();else if(e.preventDefault(),void 0!==g.daysContainer&&(!1===n||document.activeElement&&ne(document.activeElement))){var r=39===e.keyCode?1:-1;e.ctrlKey?(e.stopPropagation(),Z(r),R(W(1),0)):R(void 0,r)}break;case 38:case 40:e.preventDefault();var l=40===e.keyCode?1:-1;g.daysContainer&&void 0!==e.target.$i||e.target===g.input?e.ctrlKey?(e.stopPropagation(),ee(g.currentYear-l),R(W(1),0)):i||R(void 0,7*l):e.target===g.currentYearElement?ee(g.currentYear-l):g.config.enableTime&&(!i&&g.hourElement&&g.hourElement.focus(),P(e),g._debouncedChange());break;case 9:if(i){var s=[g.hourElement,g.minuteElement,g.secondElement,g.amPM].concat(g.pluginElements).filter(function(e){return e}),c=s.indexOf(e.target);if(-1!==c){var u=s[c+(e.shiftKey?-1:1)];e.preventDefault(),(u||g._input).focus()}}else!g.config.noCalendar&&g.daysContainer&&g.daysContainer.contains(e.target)&&e.shiftKey&&(e.preventDefault(),g._input.focus())}}if(void 0!==g.amPM&&e.target===g.amPM)switch(e.key){case g.l10n.amPM[0].charAt(0):case g.l10n.amPM[0].charAt(0).toLowerCase():g.amPM.textContent=g.l10n.amPM[0],T(),we();break;case g.l10n.amPM[1].charAt(0):case g.l10n.amPM[1].charAt(0).toLowerCase():g.amPM.textContent=g.l10n.amPM[1],T(),we()}(t||Q(e.target))&&ge("onKeyDown",e)}function ae(e){if(1===g.selectedDates.length&&(!e||e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled"))){for(var t=e?e.dateObj.getTime():g.days.firstElementChild.dateObj.getTime(),n=g.parseDate(g.selectedDates[0],void 0,!0).getTime(),o=Math.min(t,g.selectedDates[0].getTime()),a=Math.max(t,g.selectedDates[0].getTime()),i=!1,r=0,l=0,s=o;s<a;s+=w.DAY)te(new Date(s),!0)||(i=i||s>o&&s<a,s<n&&(!r||s>r)?r=s:s>n&&(!l||s<l)&&(l=s));for(var c=0;c<g.config.showMonths;c++)for(var u=g.daysContainer.children[c],d=function(o,a){var s=u.children[o],c=s.dateObj,d=c.getTime(),p=r>0&&d<r||l>0&&d>l;return p?(s.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(e){s.classList.remove(e)}),"continue"):i&&!p?"continue":(["startRange","inRange","endRange","notAllowed"].forEach(function(e){s.classList.remove(e)}),void(void 0!==e&&(e.classList.add(t<=g.selectedDates[0].getTime()?"startRange":"endRange"),n<t&&d===n?s.classList.add("startRange"):n>t&&d===n&&s.classList.add("endRange"),d>=r&&(0===l||d<=l)&&y(d,n,t)&&s.classList.add("inRange"))))},p=0,f=u.children.length;p<f;p++)d(p)}}function ie(){!g.isOpen||g.config.static||g.config.inline||ce()}function re(){g.setDate(void 0!==g.config.minDate?new Date(g.config.minDate.getTime()):new Date,!0),O(),we()}function le(e){return function(t){var n=g.config["_"+e+"Date"]=g.parseDate(t,g.config.dateFormat),o=g.config["_"+("min"===e?"max":"min")+"Date"];void 0!==n&&(g["min"===e?"minDateHasTime":"maxDateHasTime"]=n.getHours()>0||n.getMinutes()>0||n.getSeconds()>0),g.selectedDates&&(g.selectedDates=g.selectedDates.filter(function(e){return te(e)}),g.selectedDates.length||"min"!==e||k(n),we()),g.daysContainer&&(ue(),void 0!==n?g.currentYearElement[e]=n.getFullYear().toString():g.currentYearElement.removeAttribute(e),g.currentYearElement.disabled=!!o&&void 0!==n&&o.getFullYear()===n.getFullYear())}}function se(){"object"!=typeof g.config.locale&&void 0===E.l10ns[g.config.locale]&&g.config.errorHandler(new Error("flatpickr: invalid locale "+g.config.locale)),g.l10n=e({},E.l10ns.default,"object"==typeof g.config.locale?g.config.locale:"default"!==g.config.locale?E.l10ns[g.config.locale]:void 0),h.K="("+g.l10n.amPM[0]+"|"+g.l10n.amPM[1]+"|"+g.l10n.amPM[0].toLowerCase()+"|"+g.l10n.amPM[1].toLowerCase()+")";var t=e({},m,JSON.parse(JSON.stringify(p.dataset||{})));void 0===t.time_24hr&&void 0===E.defaultConfig.time_24hr&&(g.config.time_24hr=g.l10n.time_24hr),g.formatDate=v(g),g.parseDate=D({config:g.config,l10n:g.l10n})}function ce(e){if(void 0!==g.calendarContainer){ge("onPreCalendarPosition");var t=e||g._positionElement,n=Array.prototype.reduce.call(g.calendarContainer.children,function(e,t){return e+t.offsetHeight},0),o=g.calendarContainer.offsetWidth,a=g.config.position.split(" "),i=a[0],r=a.length>1?a[1]:null,l=t.getBoundingClientRect(),c=window.innerHeight-l.bottom,u="above"===i||"below"!==i&&c<n&&l.top>n,d=window.pageYOffset+l.top+(u?-n-2:t.offsetHeight+2);if(s(g.calendarContainer,"arrowTop",!u),s(g.calendarContainer,"arrowBottom",u),!g.config.inline){var p=window.pageXOffset+l.left-(null!=r&&"center"===r?(o-l.width)/2:0),f=window.document.body.offsetWidth-l.right,m=p+o>window.document.body.offsetWidth,h=f+o>window.document.body.offsetWidth;if(s(g.calendarContainer,"rightMost",m),!g.config.static)if(g.calendarContainer.style.top=d+"px",m)if(h){var v=document.styleSheets[0];if(void 0===v)return;var D=window.document.body.offsetWidth,b=Math.max(0,D/2-o/2),y=v.cssRules.length,w="{left:"+l.left+"px;right:auto;}";s(g.calendarContainer,"rightMost",!1),s(g.calendarContainer,"centerMost",!0),v.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after"+w,y),g.calendarContainer.style.left=b+"px",g.calendarContainer.style.right="auto"}else g.calendarContainer.style.left="auto",g.calendarContainer.style.right=f+"px";else g.calendarContainer.style.left=p+"px",g.calendarContainer.style.right="auto"}}}function ue(){g.config.noCalendar||g.isMobile||(be(),K())}function de(){g._input.focus(),-1!==window.navigator.userAgent.indexOf("MSIE")||void 0!==navigator.msMaxTouchPoints?setTimeout(g.close,0):g.close()}function pe(e){e.preventDefault(),e.stopPropagation();var t=function e(t,n){return n(t)?t:t.parentNode?e(t.parentNode,n):void 0}(e.target,function(e){return e.classList&&e.classList.contains("flatpickr-day")&&!e.classList.contains("flatpickr-disabled")&&!e.classList.contains("notAllowed")});if(void 0!==t){var n=t,o=g.latestSelectedDateObj=new Date(n.dateObj.getTime()),a=(o.getMonth()<g.currentMonth||o.getMonth()>g.currentMonth+g.config.showMonths-1)&&"range"!==g.config.mode;if(g.selectedDateElem=n,"single"===g.config.mode)g.selectedDates=[o];else if("multiple"===g.config.mode){var i=De(o);i?g.selectedDates.splice(parseInt(i),1):g.selectedDates.push(o)}else"range"===g.config.mode&&(2===g.selectedDates.length&&g.clear(!1,!1),g.latestSelectedDateObj=o,g.selectedDates.push(o),0!==b(o,g.selectedDates[0],!0)&&g.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()}));if(T(),a){var r=g.currentYear!==o.getFullYear();g.currentYear=o.getFullYear(),g.currentMonth=o.getMonth(),r&&(ge("onYearChange"),V()),ge("onMonthChange")}if(be(),K(),we(),g.config.enableTime&&setTimeout(function(){return g.showTimeInput=!0},50),a||"range"===g.config.mode||1!==g.config.showMonths?void 0!==g.selectedDateElem&&void 0===g.hourElement&&g.selectedDateElem&&g.selectedDateElem.focus():q(n),void 0!==g.hourElement&&void 0!==g.hourElement&&g.hourElement.focus(),g.config.closeOnSelect){var l="single"===g.config.mode&&!g.config.enableTime,s="range"===g.config.mode&&2===g.selectedDates.length&&!g.config.enableTime;(l||s)&&de()}F()}}g.parseDate=D({config:g.config,l10n:g.l10n}),g._handlers=[],g.pluginElements=[],g.loadedPlugins=[],g._bind=I,g._setHoursFromDate=k,g._positionCalendar=ce,g.changeMonth=Z,g.changeYear=ee,g.clear=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),g.input.value="",void 0!==g.altInput&&(g.altInput.value=""),void 0!==g.mobileInput&&(g.mobileInput.value=""),g.selectedDates=[],g.latestSelectedDateObj=void 0,!0===t&&(g.currentYear=g._initialDate.getFullYear(),g.currentMonth=g._initialDate.getMonth()),g.showTimeInput=!1,!0===g.config.enableTime&&O(),g.redraw(),e&&ge("onChange")},g.close=function(){g.isOpen=!1,g.isMobile||(void 0!==g.calendarContainer&&g.calendarContainer.classList.remove("open"),void 0!==g._input&&g._input.classList.remove("active")),ge("onClose")},g._createElement=c,g.destroy=function(){void 0!==g.config&&ge("onDestroy");for(var e=g._handlers.length;e--;){var t=g._handlers[e];t.element.removeEventListener(t.event,t.handler,t.options)}if(g._handlers=[],g.mobileInput)g.mobileInput.parentNode&&g.mobileInput.parentNode.removeChild(g.mobileInput),g.mobileInput=void 0;else if(g.calendarContainer&&g.calendarContainer.parentNode)if(g.config.static&&g.calendarContainer.parentNode){var n=g.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 g.calendarContainer.parentNode.removeChild(g.calendarContainer);g.altInput&&(g.input.type="text",g.altInput.parentNode&&g.altInput.parentNode.removeChild(g.altInput),delete g.altInput),g.input&&(g.input.type=g.input._type,g.input.classList.remove("flatpickr-input"),g.input.removeAttribute("readonly"),g.input.value=""),["_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 g[e]}catch(e){}})},g.isEnabled=te,g.jumpToDate=Y,g.open=function(e,t){if(void 0===t&&(t=g._positionElement),!0===g.isMobile)return e&&(e.preventDefault(),e.target&&e.target.blur()),void 0!==g.mobileInput&&(g.mobileInput.focus(),g.mobileInput.click()),void ge("onOpen");if(!g._input.disabled&&!g.config.inline){var n=g.isOpen;g.isOpen=!0,n||(g.calendarContainer.classList.add("open"),g._input.classList.add("active"),ge("onOpen"),ce(t)),!0===g.config.enableTime&&!0===g.config.noCalendar&&(0===g.selectedDates.length&&re(),!1!==g.config.allowInput||void 0!==e&&g.timeContainer.contains(e.relatedTarget)||setTimeout(function(){return g.hourElement.select()},50))}},g.redraw=ue,g.set=function(e,n){if(null!==e&&"object"==typeof e)for(var o in Object.assign(g.config,e),e)void 0!==fe[o]&&fe[o].forEach(function(e){return e()});else g.config[e]=n,void 0!==fe[e]?fe[e].forEach(function(e){return e()}):t.indexOf(e)>-1&&(g.config[e]=l(n));g.redraw(),we(!1)},g.setDate=function(e,t,n){if(void 0===t&&(t=!1),void 0===n&&(n=g.config.dateFormat),0!==e&&!e||e instanceof Array&&0===e.length)return g.clear(t);me(e,n),g.showTimeInput=g.selectedDates.length>0,g.latestSelectedDateObj=g.selectedDates[g.selectedDates.length-1],g.redraw(),Y(),k(),0===g.selectedDates.length&&g.clear(!1),we(t),t&&ge("onChange")},g.toggle=function(e){if(!0===g.isOpen)return g.close();g.open(e)};var fe={locale:[se,G],showMonths:[$,x,z],minDate:[Y],maxDate:[Y]};function me(e,t){var n=[];if(e instanceof Array)n=e.map(function(e){return g.parseDate(e,t)});else if(e instanceof Date||"number"==typeof e)n=[g.parseDate(e,t)];else if("string"==typeof e)switch(g.config.mode){case"single":case"time":n=[g.parseDate(e,t)];break;case"multiple":n=e.split(g.config.conjunction).map(function(e){return g.parseDate(e,t)});break;case"range":n=e.split(g.l10n.rangeSeparator).map(function(e){return g.parseDate(e,t)})}else g.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(e)));g.selectedDates=n.filter(function(e){return e instanceof Date&&te(e,!1)}),"range"===g.config.mode&&g.selectedDates.sort(function(e,t){return e.getTime()-t.getTime()})}function he(e){return e.slice().map(function(e){return"string"==typeof e||"number"==typeof e||e instanceof Date?g.parseDate(e,void 0,!0):e&&"object"==typeof e&&e.from&&e.to?{from:g.parseDate(e.from,void 0),to:g.parseDate(e.to,void 0)}:e}).filter(function(e){return e})}function ge(e,t){if(void 0!==g.config){var n=g.config[e];if(void 0!==n&&n.length>0)for(var o=0;n[o]&&o<n.length;o++)n[o](g.selectedDates,g.input.value,g,t);"onChange"===e&&(g.input.dispatchEvent(ve("change")),g.input.dispatchEvent(ve("input")))}}function ve(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t}function De(e){for(var t=0;t<g.selectedDates.length;t++)if(0===b(g.selectedDates[t],e))return""+t;return!1}function be(){g.config.noCalendar||g.isMobile||!g.monthNav||(g.yearElements.forEach(function(e,t){var n=new Date(g.currentYear,g.currentMonth,1);n.setMonth(g.currentMonth+t),g.config.showMonths>1?g.monthElements[t].textContent=f(n.getMonth(),g.config.shorthandCurrentMonth,g.l10n)+" ":g.monthsDropdownContainer.value=n.getMonth().toString(),e.value=n.getFullYear().toString()}),g._hidePrevMonthArrow=void 0!==g.config.minDate&&(g.currentYear===g.config.minDate.getFullYear()?g.currentMonth<=g.config.minDate.getMonth():g.currentYear<g.config.minDate.getFullYear()),g._hideNextMonthArrow=void 0!==g.config.maxDate&&(g.currentYear===g.config.maxDate.getFullYear()?g.currentMonth+1>g.config.maxDate.getMonth():g.currentYear>g.config.maxDate.getFullYear()))}function ye(e){return g.selectedDates.map(function(t){return g.formatDate(t,e)}).filter(function(e,t,n){return"range"!==g.config.mode||g.config.enableTime||n.indexOf(e)===t}).join("range"!==g.config.mode?g.config.conjunction:g.l10n.rangeSeparator)}function we(e){void 0===e&&(e=!0),void 0!==g.mobileInput&&g.mobileFormatStr&&(g.mobileInput.value=void 0!==g.latestSelectedDateObj?g.formatDate(g.latestSelectedDateObj,g.mobileFormatStr):""),g.input.value=ye(g.config.dateFormat),void 0!==g.altInput&&(g.altInput.value=ye(g.config.altFormat)),!1!==e&&ge("onValueUpdate")}function Me(e){var t=g.prevMonthNav.contains(e.target),n=g.nextMonthNav.contains(e.target);t||n?Z(t?-1:1):g.yearElements.indexOf(e.target)>=0?e.target.select():e.target.classList.contains("arrowUp")?g.changeYear(g.currentYear+1):e.target.classList.contains("arrowDown")&&g.changeYear(g.currentYear-1)}return function(){g.element=g.input=p,g.isOpen=!1,function(){var o=["wrap","weekNumbers","allowInput","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],a=e({},m,JSON.parse(JSON.stringify(p.dataset||{}))),i={};g.config.parseDate=a.parseDate,g.config.formatDate=a.formatDate,Object.defineProperty(g.config,"enable",{get:function(){return g.config._enable},set:function(e){g.config._enable=he(e)}}),Object.defineProperty(g.config,"disable",{get:function(){return g.config._disable},set:function(e){g.config._disable=he(e)}});var r="time"===a.mode;if(!a.dateFormat&&(a.enableTime||r)){var s=E.defaultConfig.dateFormat||n.dateFormat;i.dateFormat=a.noCalendar||r?"H:i"+(a.enableSeconds?":S":""):s+" H:i"+(a.enableSeconds?":S":"")}if(a.altInput&&(a.enableTime||r)&&!a.altFormat){var c=E.defaultConfig.altFormat||n.altFormat;i.altFormat=a.noCalendar||r?"h:i"+(a.enableSeconds?":S K":" K"):c+" h:i"+(a.enableSeconds?":S":"")+" K"}a.altInputClass||(g.config.altInputClass=g.input.className+" "+g.config.altInputClass),Object.defineProperty(g.config,"minDate",{get:function(){return g.config._minDate},set:le("min")}),Object.defineProperty(g.config,"maxDate",{get:function(){return g.config._maxDate},set:le("max")});var u=function(e){return function(t){g.config["min"===e?"_minTime":"_maxTime"]=g.parseDate(t,"H:i")}};Object.defineProperty(g.config,"minTime",{get:function(){return g.config._minTime},set:u("min")}),Object.defineProperty(g.config,"maxTime",{get:function(){return g.config._maxTime},set:u("max")}),"time"===a.mode&&(g.config.noCalendar=!0,g.config.enableTime=!0),Object.assign(g.config,i,a);for(var d=0;d<o.length;d++)g.config[o[d]]=!0===g.config[o[d]]||"true"===g.config[o[d]];t.filter(function(e){return void 0!==g.config[e]}).forEach(function(e){g.config[e]=l(g.config[e]||[]).map(C)}),g.isMobile=!g.config.disableMobile&&!g.config.inline&&"single"===g.config.mode&&!g.config.disable.length&&!g.config.enable.length&&!g.config.weekNumbers&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);for(var d=0;d<g.config.plugins.length;d++){var f=g.config.plugins[d](g)||{};for(var h in f)t.indexOf(h)>-1?g.config[h]=l(f[h]).map(C).concat(g.config[h]):void 0===a[h]&&(g.config[h]=f[h])}ge("onParseConfig")}(),se(),g.input=g.config.wrap?p.querySelector("[data-input]"):p,g.input?(g.input._type=g.input.type,g.input.type="text",g.input.classList.add("flatpickr-input"),g._input=g.input,g.config.altInput&&(g.altInput=c(g.input.nodeName,g.config.altInputClass),g._input=g.altInput,g.altInput.placeholder=g.input.placeholder,g.altInput.disabled=g.input.disabled,g.altInput.required=g.input.required,g.altInput.tabIndex=g.input.tabIndex,g.altInput.type="text",g.input.setAttribute("type","hidden"),!g.config.static&&g.input.parentNode&&g.input.parentNode.insertBefore(g.altInput,g.input.nextSibling)),g.config.allowInput||g._input.setAttribute("readonly","readonly"),g._positionElement=g.config.positionElement||g._input):g.config.errorHandler(new Error("Invalid input element specified")),function(){g.selectedDates=[],g.now=g.parseDate(g.config.now)||new Date;var e=g.config.defaultDate||("INPUT"!==g.input.nodeName&&"TEXTAREA"!==g.input.nodeName||!g.input.placeholder||g.input.value!==g.input.placeholder?g.input.value:null);e&&me(e,g.config.dateFormat),g._initialDate=g.selectedDates.length>0?g.selectedDates[0]:g.config.minDate&&g.config.minDate.getTime()>g.now.getTime()?g.config.minDate:g.config.maxDate&&g.config.maxDate.getTime()<g.now.getTime()?g.config.maxDate:g.now,g.currentYear=g._initialDate.getFullYear(),g.currentMonth=g._initialDate.getMonth(),g.selectedDates.length>0&&(g.latestSelectedDateObj=g.selectedDates[0]),void 0!==g.config.minTime&&(g.config.minTime=g.parseDate(g.config.minTime,"H:i")),void 0!==g.config.maxTime&&(g.config.maxTime=g.parseDate(g.config.maxTime,"H:i")),g.minDateHasTime=!!g.config.minDate&&(g.config.minDate.getHours()>0||g.config.minDate.getMinutes()>0||g.config.minDate.getSeconds()>0),g.maxDateHasTime=!!g.config.maxDate&&(g.config.maxDate.getHours()>0||g.config.maxDate.getMinutes()>0||g.config.maxDate.getSeconds()>0),Object.defineProperty(g,"showTimeInput",{get:function(){return g._showTimeInput},set:function(e){g._showTimeInput=e,g.calendarContainer&&s(g.calendarContainer,"showTimeInput",e),g.isOpen&&ce()}})}(),g.utils={getDaysInMonth:function(e,t){return void 0===e&&(e=g.currentMonth),void 0===t&&(t=g.currentYear),1===e&&(t%4==0&&t%100!=0||t%400==0)?29:g.l10n.daysInMonth[e]}},g.isMobile||L(),A(),(g.selectedDates.length||g.config.noCalendar)&&(g.config.enableTime&&k(g.config.noCalendar?g.latestSelectedDateObj||g.config.minDate:void 0),we(!1)),x(),g.showTimeInput=g.selectedDates.length>0||g.config.noCalendar;var o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);!g.isMobile&&o&&ce(),ge("onReady")}(),g}function x(e,t){for(var n=Array.prototype.slice.call(e).filter(function(e){return e instanceof HTMLElement}),o=[],a=0;a<n.length;a++){var i=n[a];try{if(null!==i.getAttribute("data-fp-omit"))continue;void 0!==i._flatpickr&&(i._flatpickr.destroy(),i._flatpickr=void 0),i._flatpickr=C(i,t||{}),o.push(i._flatpickr)}catch(e){console.error(e)}}return 1===o.length?o[0]:o}"undefined"!=typeof HTMLElement&&"undefined"!=typeof HTMLCollection&&"undefined"!=typeof NodeList&&(HTMLCollection.prototype.flatpickr=NodeList.prototype.flatpickr=function(e){return x(this,e)},HTMLElement.prototype.flatpickr=function(e){return x([this],e)});var E=function(e,t){return"string"==typeof e?x(window.document.querySelectorAll(e),t):e instanceof Node?x([e],t):x(e,t)};return E.defaultConfig={},E.l10ns={en:e({},o),default:e({},o)},E.localize=function(t){E.l10ns.default=e({},E.l10ns.default,t)},E.setDefaults=function(t){E.defaultConfig=e({},E.defaultConfig,t)},E.parseDate=D({}),E.formatDate=v({}),E.compareDates=b,"undefined"!=typeof jQuery&&void 0!==jQuery.fn&&(jQuery.fn.flatpickr=function(e){return x(this,e)}),Date.prototype.fp_incr=function(e){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+("string"==typeof e?parseInt(e,10):e))},"undefined"!=typeof window&&(window.flatpickr=E),E}()},function(e,t){e.exports=flarum.core.compat["components/CommentPost"]},function(e,t){e.exports=flarum.core.compat.Component},function(e,t){e.exports=flarum.core.compat["components/LogInModal"]},function(e,t){e.exports=flarum.core.compat["helpers/avatar"]},function(e,t){e.exports=flarum.core.compat["helpers/username"]},function(e,t){e.exports=flarum.core.compat["utils/PostControls"]},function(e,t,n){"use strict";n.r(t);var o=n(0),a=n.n(o);function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r=n(3),l=n.n(r),s=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.apiEndpoint=function(){return"/fof/polls"+(this.exists?"/"+this.data.id:"")},t}(l()(a.a,{question:a.a.attribute("question"),hasEnded:a.a.attribute("hasEnded"),endDate:a.a.attribute("endDate"),publicPoll:a.a.attribute("publicPoll"),options:a.a.hasMany("options"),votes:a.a.hasMany("votes")})),c=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.apiEndpoint=function(){return"/fof/polls/answers"+(this.exists?"/"+this.data.id:"")},t}(l()(a.a,{answer:a.a.attribute("answer"),poll:a.a.hasOne("polls"),votes:a.a.hasMany("votes")})),u=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.prototype.apiEndpoint=function(){return"/fof/polls/"+this.pollId()+"/vote"},t}(l()(a.a,{poll:a.a.hasOne("poll"),option:a.a.hasOne("option"),user:a.a.hasOne("user"),pollId:a.a.attribute("pollId"),optionId:a.a.attribute("optionId")})),d=n(1),p=n(7),f=n.n(p),h=n(8),g=n.n(h),v=n(9),D=n.n(v),b=n(5),y=n.n(b),w=n(2),M=n.n(w),C=n(4),x=n.n(C),E=n(10),P=n.n(E),T=n(11),k=n.n(T),O=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){if(e.prototype.init.call(this),this.options=[m.prop(""),m.prop("")],this.question=m.prop(""),this.endDate=m.prop(),this.publicPoll=m.prop(!1),this.props.poll){var t=this.props.poll;this.options=t.relationships.options.map(function(e){return m.prop(e)}),this.question(t.question),this.endDate(!t.endDate||isNaN(t.endDate.getTime())?null:t.endDate),this.publicPoll(t.publicPoll)}},n.title=function(){return app.translator.trans("fof-polls.forum.modal.add_title")},n.className=function(){return"PollDiscussionModal Modal--small"},n.configDatePicker=function(e,t){var n=this;t||k()(e,{enableTime:!0,minDate:this.endDate()||"today",dateFormat:"Y-m-d H:i",defaultDate:this.endDate(),wrap:!0,onChange:function(e){return n.endDate(e[0])}})},n.content=function(){return[m("div",{className:"Modal-body"},m("div",{className:"PollDiscussionModal-form"},m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-polls.forum.modal.question_placeholder")),m("input",{type:"text",name:"question",className:"FormControl",bidi:this.question})),m("div",{className:"PollModal--answers Form-group"},m("label",{className:"label PollModal--answers-title"},m("span",null,app.translator.trans("fof-polls.forum.modal.options_label")),M.a.component({className:"Button PollModal--button small",icon:"fas fa-plus",onclick:this.addOption.bind(this)})),this.displayOptions()),m("div",{className:"Form-group"},m("label",{className:"label"},app.translator.trans("fof-polls.forum.modal.date_placeholder")),m("div",{className:"PollModal--date",config:this.configDatePicker.bind(this)},m("input",{style:"opacity: 1; color: inherit",className:"FormControl","data-input":!0}),M.a.component({className:"Button PollModal--button",icon:"fas fa-times","data-clear":!0}))),m("div",{className:"Form-group"},P.a.component({state:this.publicPoll()||!1,children:app.translator.trans("fof-polls.forum.modal.public_poll_label"),onchange:this.publicPoll})),m("div",{className:"Form-group"},M.a.component({type:"submit",className:"Button Button--primary PollModal-SubmitButton",children:app.translator.trans("fof-polls.forum.modal.submit"),loading:this.loading}))))]},n.displayOptions=function(){var e=this;return Object.keys(this.options).map(function(t,n){return m("div",{className:""===e.options[n+1]?"Form-group hide":"Form-group"},m("fieldset",{className:"Poll-answer-input"},m("input",{className:"FormControl",type:"text",name:"answer"+(n+1),bidi:e.options[n],placeholder:app.translator.trans("fof-polls.forum.modal.option_placeholder")+" #"+(n+1)})),n>=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<t?this.options.push(m.prop("")):alert(app.translator.trans("fof-polls.forum.modal.max"))},n.removeOption=function(e){this.options.splice(e,1)},n.onsubmit=function(e){e.preventDefault();var t={question:this.question(),endDate:this.endDate(),publicPoll:this.publicPoll()},n=this.options.map(function(e){return e()}).filter(Boolean);""!==this.question()?n.length<2?alert(app.translator.trans("fof-polls.forum.modal.min")):(t.relationships={options:n},this.props.onsubmit(t),app.modal.close()):alert(app.translator.trans("fof-polls.forum.modal.include_question"))},t}(x.a),N=n(12),_=n.n(N);function I(){return(I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}var S=n(13),F=n.n(S),A=n(14),Y=n.n(A),j=n(15),H=n.n(j),L=n(16),B=n.n(L),q=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.className=function(){return"Modal--small"},n.title=function(){return app.translator.trans("fof-polls.forum.votes_modal.title")},n.content=function(){var e=this;return m("div",{className:"Modal-body"},m("ul",{className:"VotesModal-list"},this.props.poll.options().map(function(t){var n=e.props.poll.votes().filter(function(e){return t.id()===e.option().id()}).map(function(e){return e.user()});return m("div",null,m("h2",null,t.answer()+":"),n.length?n.map(function(e){var t=e&&{href:app.route.user(e),config:m.route};return m("li",null,m("a",t,H()(e)," ",B()(e)))}):m("h4",{style:"color: #000"},app.translator.trans("fof-polls.forum.modal.no_voters")))})))},t}(x.a),W=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.poll=this.props.poll,this.vote=m.prop(),this.voted=m.prop(!1),this.updateData()},n.view=function(){var e=this;return m("div",null,m("h3",null,this.poll.question()),this.options.map(function(t){var n=e.voted(),o=e.vote()&&e.vote().option().id()===t.id(),a=e.votes.filter(function(e){return e.option().id()===t.id()}).length,i=Math.round(a/e.poll.votes().length*100),r=o?{title:n&&app.translator.transChoice("fof-polls.forum.tooltip.votes",a,{count:String(a)}).join(""),config:function(e){$(e).tooltip({placement:"right"})}}:{},l=o?{checked:!0}:{};return m("div",{className:"PollOption "+(n&&"PollVoted")},m("div",I({},r,{className:"PollBar","data-selected":o}),(!e.poll.hasEnded()&&app.session.user&&app.session.user.canVotePolls()||!app.session.user)&&m("label",{className:"checkbox"},m("input",I({onchange:e.changeVote.bind(e,t),type:"checkbox"},l)),m("span",{className:"checkmark"})),m("div",{style:n&&"--width: "+i+"%",className:"PollOption-active"}),m("label",{style:e.poll.hasEnded()?"":"margin-left: 25px",className:"PollAnswer"},m("span",null,t.answer())),n&&m("label",null,m("span",{className:100!==i?"PollPercent PollPercent--option":"PollPercent"},i,"%"))))}),m("div",{style:"clear: both;"}),this.poll.publicPoll()?M.a.component({className:"Button Button--primary PublicPollButton",children:app.translator.trans("fof-polls.forum.public_poll"),onclick:function(){return e.showVoters()}}):"",app.session.user&&!app.session.user.canVotePolls()?m("div",{className:"helpText PollInfoText"},app.translator.trans("fof-polls.forum.no_permission")):this.poll.hasEnded()?m("div",{className:"helpText PollInfoText"},app.translator.trans("fof-polls.forum.poll_ended")):null!==this.poll.endDate()?m("div",{className:"helpText PollInfoText"},m("i",{class:"icon fa fa-clock-o"}),app.translator.trans("fof-polls.forum.days_remaining",{time:moment(this.poll.endDate()).fromNow()})):"")},n.updateData=function(){this.poll=app.store.getById("polls",this.poll.id()),this.options=this.poll.options()||[],this.votes=this.poll.votes()||[],this.vote(app.session.user?this.votes.find(function(e){return e.user()&&e.user().id()===app.session.user.id()}):null),this.voted(!!this.vote())},n.onError=function(e,t){e.target.checked=!1,app.alerts.show(t.alert)},n.changeVote=function(e,t){var n=this;if(!app.session.user)return app.modal.show(new Y.a),void(t.target.checked=!1);this.vote()&&e.id()===this.vote().option().id()&&(e=null),this.vote()||(this.vote(app.store.createRecord("poll_votes")),this.vote().pollId(this.poll.id())),m.startComputation(),app.request({method:"PATCH",url:app.forum.attribute("apiUrl")+"/fof/polls/"+this.poll.id()+"/vote",errorHandler:this.onError.bind(this,t),data:{data:{optionId:e?e.id():null}}}).then(function(t){app.store.pushPayload(t),e||app.store.remove(n.vote()),n.updateData(),e||(m.redraw.strategy("all"),m.redraw(),m.redraw.strategy("diff")),m.endComputation()})},n.showVoters=function(){app.modal.show(new q({poll:this.poll}))},t}(F.a),R=n(17),J=n.n(R),K=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.init=function(){this.poll=this.props.poll,this.options=this.poll.options(),this.optionAnswers=this.options.map(function(e){return m.prop(e.answer())}),this.question=m.prop(this.poll.question()),this.endDate=m.prop(this.poll.endDate()),this.publicPoll=m.prop(this.poll.publicPoll())},n.title=function(){return app.translator.trans("fof-polls.forum.modal.edit_title")},n.displayOptions=function(){var e=this;return this.options.map(function(t,n){return m("div",{className:"Form-group"},m("fieldset",{className:"Poll-answer-input"},m("input",{className:"FormControl",type:"text",name:"answer"+(n+1),bidi:e.optionAnswers[n],placeholder:app.translator.trans("fof-polls.forum.modal.option_placeholder")+" #"+(n+1)})),n>=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<t?(this.options.push(app.store.createRecord("poll_options")),this.optionAnswers.push(m.prop(""))):alert(app.translator.trans("fof-polls.forum.modal.max"))},n.removeOption=function(e){this.options.splice(e,1),this.optionAnswers.splice(e,1)},n.onsubmit=function(e){var t=this;if(e.preventDefault(),!this.loading){this.loading=!0;var n=this.options.map(function(e,n){return e.data.attributes||(e.data.attributes={}),e.data.attributes.answer=t.optionAnswers[n](),e.data});return this.poll.save({question:this.question(),endDate:this.endDate()||!1,publicPoll:this.publicPoll(),options:n}).then(function(){document.location.reload()}).catch(function(e){t.loaded(),t.onerror(e)})}},t}(O);app.initializers.add("fof/polls",function(){app.store.models.polls=s,app.store.models.poll_options=c,app.store.models.poll_votes=u,app.store.models.discussions.prototype.poll=a.a.hasOne("poll"),app.store.models.users.prototype.canEditPolls=a.a.attribute("canEditPolls"),app.store.models.users.prototype.canStartPolls=a.a.attribute("canStartPolls"),app.store.models.users.prototype.canSelfEditPolls=a.a.attribute("canSelfEditPolls"),app.store.models.users.prototype.canVotePolls=a.a.attribute("canVotePolls"),Object(d.extend)(g.a.prototype,"requestParams",function(e){e.include.push("poll")}),Object(d.extend)(D.a.prototype,"badges",function(e){this.poll()&&e.add("poll",f.a.component({type:"poll",label:app.translator.trans("fof-polls.forum.tooltip.badge"),icon:"fa fa-signal"}),5)}),Object(d.extend)(J.a,"moderationControls",function(e,t){var n=t.discussion().poll(),o=app.session.user;n&&(o&&o.canEditPolls()||t.user().canSelfEditPolls()&&t.user().id()===o.id())&&1===t.number()&&(n.hasEnded()||e.add("fof-polls-edit",M.a.component({icon:"fas fa-check-square",children:app.translator.trans("fof-polls.forum.moderation.edit"),onclick:function(){return app.modal.show(new K({poll:n}))}})),e.add("fof-polls-remove",M.a.component({icon:"fas fa-trash",children:app.translator.trans("fof-polls.forum.moderation.delete"),onclick:function(){confirm(app.translator.trans("fof-polls.forum.moderation.delete_confirm"))&&n.delete().then(function(){m.redraw.strategy("all"),m.redraw(),m.redraw.strategy("diff")})}})))}),y.a.prototype.addPoll=function(){var e=this;app.modal.show(new O({poll:this.poll,onsubmit:function(t){return e.poll=t}}))},Object(d.extend)(y.a.prototype,"headerItems",function(e){app.session.user.canStartPolls()&&e.add("polls",m("a",{className:"DiscussionComposer-poll",onclick:this.addPoll.bind(this)},m("span",{className:"PollLabel "+(this.poll?"":"none")},app.translator.trans("fof-polls.forum.composer_discussion."+(this.poll?"edit":"add")+"_poll"))),1)}),Object(d.extend)(y.a.prototype,"data",function(e){this.poll&&(e.poll=this.poll)}),Object(d.extend)(_.a.prototype,"content",function(e){var t=this.props.post.discussion();t.poll()&&1===this.props.post.number()&&e.push(W.component({poll:t.poll()}))})})}]);
//# sourceMappingURL=forum.js.map