-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththe-datepicker.min.js
1 lines (1 loc) · 48.9 KB
/
the-datepicker.min.js
1
var TheDatepicker;!function(t){var f=function(){};t.CannotParseDateException=f;var l=(i.prototype.createDate=function(){if(null===this.day||null===this.month||null===this.year)throw new f;var t=new Date(this.year,this.month-1,this.day);if(isNaN(t.getTime()))throw new f;for(;t.getDate()!==this.day||t.getMonth()!==this.month-1||t.getFullYear()!==this.year;){if(!(28<this.day))throw new f;this.day--,t=new Date(this.year,this.month-1,this.day)}return t},i);function i(){this.day=null,this.month=null,this.year=null}var n=(s.prototype.t=function(t,i){if(null===i)return null;for(var n=!1,s="",h=0;h<t.length;h++){var r,u=t.substring(h,h+1);n?(s+=u,n=!1):u!==this.i?s+=null===(r=this.s(u))?u:r.call(this,i):n=!0}return s},s.prototype.h=function(t,i){if(""===i)return null;for(var n=new l,s=!1,h=0,r=0;r<t.length;r++){var u=t.substring(r,r+1);if(s)s=!1;else{if(u===this.i){s=!0;continue}var e=this.u(u);if(null!==e){try{h+=e.call(this,i.substring(h),n)}catch(t){if(!(t instanceof f))throw t;if(" "!==i.substring(h,h+1))throw t;h++,r--;continue}continue}}var o=i.substring(h,h+1);if(o===u)h++;else{if(" "===u)continue;if(" "!==o)throw new f;h++,r--}}return n.createDate()},s.prototype.s=function(t){switch(t){case"j":return this.o;case"d":return this.l;case"D":return this.v;case"l":return this.p;case"n":return this.D;case"m":return this.m;case"F":return this.k;case"M":return this.T;case"Y":return this.M;case"y":return this.g;default:return null}},s.prototype.o=function(t){return t.getDate()+""},s.prototype.l=function(t){return("0"+t.getDate()).slice(-2)},s.prototype.v=function(t){return this.I.translator.translateDayOfWeek(t.getDay())},s.prototype.p=function(t){return this.I.translator.translateDayOfWeekFull(t.getDay())},s.prototype.D=function(t){return t.getMonth()+1+""},s.prototype.m=function(t){return("0"+(t.getMonth()+1)).slice(-2)},s.prototype.k=function(t){return this.I.translator.translateMonth(t.getMonth())},s.prototype.T=function(t){return this.I.translator.translateMonthShort(t.getMonth())},s.prototype.M=function(t){return t.getFullYear()+""},s.prototype.g=function(t){var i=t.getFullYear()+"";return i.substring(i.length-2)},s.prototype.u=function(t){switch(t){case"j":case"d":return this.N;case"D":return this.R;case"l":return this.C;case"n":case"m":return this.A;case"F":return this.F;case"M":return this.S;case"Y":return this.j;case"y":return this.H;default:return null}},s.prototype.N=function(t,i){for(var n=0;"0"===t.substring(0,1);)t=t.substring(1),n++;var s=t.substring(0,2);if(!/[12][0-9]|3[01]/.test(s)&&(s=s.substring(0,1),!/[1-9]/.test(s)))throw new f;return i.day=parseInt(s,10),n+s.length},s.prototype.R=function(t){var i=this;return this.J(t,function(t){return i.I.translator.translateDayOfWeek(t)})},s.prototype.C=function(t){var i=this;return this.J(t,function(t){return i.I.translator.translateDayOfWeekFull(t)})},s.prototype.J=function(t,i){for(var n=0,s=0;s<7;s++){var h=i(s),n=Math.max(n,h.length);if(t.substring(0,h.length).toLowerCase()===h.toLowerCase())return h.length}for(var r=0;/[a-zA-Z]/.test(t.substring(0,1))&&(t=t.substring(1),++r!==n););return r},s.prototype.A=function(t,i){for(var n=0;"0"===t.substring(0,1);)t=t.substring(1),n++;var s=t.substring(0,2);if("10"!==s&&"11"!==s&&"12"!==s&&(s=s.substring(0,1),!/[1-9]/.test(s)))throw new f;return i.month=parseInt(s,10),n+s.length},s.prototype.F=function(t,i){var n=this;return this.O(t,i,function(t){return n.I.translator.translateMonth(t)})},s.prototype.S=function(t,i){var n=this;return this.O(t,i,function(t){return n.I.translator.translateMonthShort(t)})},s.prototype.O=function(t,i,n){for(var s=1;s<=12;s++){var h=n(s-1);if(t.substring(0,h.length).toLowerCase()===h.toLowerCase())return i.month=s,h.length}throw new f},s.prototype.j=function(t,i){var n=!1;"-"===t.substring(0,1)&&(n=!0,t=t.substring(1));for(var s=0;/[0-9]/.test(t.substring(s,s+1));)s++;if(0===s)throw new f;var h=parseInt(t.substring(0,s),10);return n&&(h=-h),i.year=h,s+(n?1:0)},s.prototype.H=function(t,i){var n=t.substring(0,2);if(!/[0-9]{2}/.test(n))throw new f;var s=this.I.getToday().getFullYear()+"",h=s.substring(0,s.length-2);return i.year=parseInt(h+n,10),2},s);function s(t){this.I=t,this.i="\\"}t.L=n}(TheDatepicker=TheDatepicker||{}),function(h){var k,t;(t=k=k||{})[t.Untouched=0]="Untouched",t[t.Waiting=1]="Waiting",t[t.Ready=2]="Ready",t[t.Initialized=3]="Initialized",t[t.Destroyed=4]="Destroyed";var i=(r.prototype.render=function(){var i=this;switch(this.P){case k.Destroyed:return;case k.Initialized:return void this.W.U();case k.Ready:return this.Y(),this.P=k.Initialized,void this.render();case k.Waiting:return this.G(),this.options.isHiddenOnBlur()?void(this.W._()||this.B()):void this.open();case k.Untouched:if(this.Z(),this.G(),this.W.$(null)||this.B(),null!==this.input&&this.options.isHiddenOnBlur())return this.input===this.q.activeElement?(this.P=k.Ready,this.render(),void this.open()):(this.K=h.X.V(this.input,h.tt.Focus,function(t){i.open(t)}),void(this.P=k.Waiting));this.P=k.Ready,this.render()}},r.prototype.open=function(t){return void 0===t&&(t=null),this.P===k.Untouched&&this.render(),this.P===k.Waiting&&(this.P=k.Ready,this.render(),r.it=!0),!!r.nt(t,this)&&(null!==this.input&&this.input.focus(),!0)},r.prototype.isOpened=function(){return this.W.st()},r.prototype.close=function(t){return void 0===t&&(t=null),!this.W.st()||!!r.nt(t,null)&&(null!==this.input&&this.input.blur(),!0)},r.prototype.reset=function(t){return void 0===t&&(t=null),this.W.ht(t)},r.prototype.destroy=function(){if(this.P!==k.Destroyed){for(var t=0;t<this.rt.length;t++)this.rt[t]();this.rt=[],this.ut?this.container.innerHTML="":this.container.parentNode.removeChild(this.container),delete this.container.datepicker,null!==this.input&&(delete this.input.datepicker,this.et(),this.input=null),null!==this.ot&&(this.ot.parentNode.removeChild(this.ot),this.ot=null),this.P=k.Destroyed}},r.prototype.selectDate=function(t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=null),this.W.ft(n,h.X.lt("Date",t,this.options),!!i)},r.prototype.getSelectedDate=function(){return null!==this.W.at?new Date(this.W.at.getTime()):null},r.prototype.getSelectedDateFormatted=function(){return this.ct.t(this.options.getInputFormat(),this.W.at)},r.prototype.getCurrentMonth=function(){return new Date(this.W.vt().getTime())},r.prototype.goToMonth=function(t,i){return void 0===i&&(i=null),this.W.dt(i,h.X.lt("Month",t,this.options))},r.prototype.parseRawInput=function(){return this.wt?this.ct.h(this.options.getInputFormat(),this.input.value):null},r.prototype.pt=function(t){if(void 0===t&&(t=null),!this.wt)return!1;try{var i=this.parseRawInput();return null!==i?this.W.yt(t,i):this.W.Dt(t)}catch(t){if(!(t instanceof h.CannotParseDateException))throw t;return!1}},r.prototype.B=function(){var t;this.wt&&this.input!==this.q.activeElement&&(this.input.value=this.ct.t(this.options.getInputFormat(),this.W.at)||"",null!==this.ot&&(t=this.options.isDeselectButtonShown()&&""!==this.input.value,this.ot.style.visibility=t?"visible":"hidden"))},r.onDatepickerReady=function(t,i){if(void 0===i&&(i=null),!h.X.bt(t))throw new Error("Element was expected to be an HTMLElement.");i=h.X.kt("Callback",i);var n=null,s=null;return"undefined"!=typeof Promise&&(n=new Promise(function(t){s=t})),void 0!==t.datepicker&&t.datepicker instanceof r?(t.datepicker.Tt(i,t),null!==s&&s(t.datepicker)):r.Mt.push({promiseResolve:s,element:t,callback:i}),n},r.prototype.gt=function(){var t=this.q.createElement("div");return t.className=this.options.Et("container"),t.style.position="absolute",t.style.zIndex="99",t},r.prototype.G=function(){var i=this;if(!this.wt||!this.options.isDeselectButtonShown()||null!==this.ot)return null;var t=this.q.createElement("span");t.style.position="absolute";var n=this.q.createElement("a");n.innerHTML=this.options.getDeselectHtml(),n.style.position="relative",n.style.left="-0.8em",n.href="#",n.onclick=function(t){t=t||window.event,h.X.It(t),i.W.Dt(t)},t.className=this.options.Et("deselect"),n.className=this.options.Et("deselect-button"),t.appendChild(n),this.input.parentNode.insertBefore(t,this.input.nextSibling),this.ot=t},r.prototype.Z=function(){if(this.wt)try{var t=this.parseRawInput();null!==t&&this.options.setInitialDate(t)}catch(t){if(!(t instanceof h.CannotParseDateException))throw t}},r.prototype.Y=function(){var t,i=this;function n(t){r.nt(t,i),r.it=!0}r.Nt||(t=function(t){r.it?r.it=!1:r.nt(t,null)},h.X.V(this.q,h.tt.MouseDown,t),h.X.V(this.q,h.tt.FocusIn,t),h.X.V(this.q,h.tt.KeyDown,function(t){null!==r.Rt&&r.Rt.xt(t)}),r.Nt=!0),this.et(),this.rt.push(h.X.V(this.container,h.tt.MouseDown,n)),this.rt.push(h.X.V(this.container,h.tt.FocusIn,n)),null!==this.ot&&(this.rt.push(h.X.V(this.ot,h.tt.MouseDown,n)),this.rt.push(h.X.V(this.ot,h.tt.FocusIn,n))),null!==this.input&&(this.rt.push(h.X.V(this.input,h.tt.MouseDown,n)),this.rt.push(h.X.V(this.input,h.tt.Focus,n)),this.rt.push(h.X.V(this.input,h.tt.Blur,function(){i.B()})),this.rt.push(h.X.V(this.input,h.tt.KeyDown,function(t){h.X.Ct(t)})),this.rt.push(h.X.V(this.input,h.tt.KeyUp,function(t){i.pt(t)})))},r.prototype.et=function(){null!==this.K&&(this.K(),this.K=null)},r.prototype.At=function(t){for(var i=r.Mt.length-1;0<=i;i--){var n=r.Mt[i];n.element===t&&(this.Tt(n.callback,t),null!==n.promiseResolve&&n.promiseResolve(this),r.Mt.splice(i,1))}},r.prototype.Tt=function(t,i){null!==t&&t.call(i,this,i)},r.prototype.Ft=function(){if(!this.ut&&this.P!==k.Destroyed){var t=window.pageYOffset||this.q.documentElement.scrollTop,i=window.pageXOffset||this.q.documentElement.scrollLeft,n=null,s=null;window.visualViewport&&(n=window.visualViewport.height,s=window.visualViewport.width);for(var h=t+(n||window.innerHeight||Math.max(this.q.documentElement.clientHeight,this.q.body.clientHeight)||0),r=i+(s||window.innerWidth||Math.max(this.q.documentElement.clientWidth,this.q.body.clientWidth)||0),u=0,e=0,o=this.input;null!==o&&!isNaN(o.offsetLeft)&&!isNaN(o.offsetTop);)u+=o.offsetTop-(o.scrollTop||0),e+=o.offsetLeft-(o.scrollLeft||0),o=o.offsetParent;var f=null;this.options.isPositionFixingEnabled()&&0<this.container.childNodes.length&&((f=this.container.childNodes[0]).style.position="",f.style.top="",f.style.left="");var l,a,c=this.input.offsetWidth,v=this.input.offsetHeight,d=u+v,w=e+c,p=this.container.offsetHeight,y=this.container.offsetWidth,D="",b=p<u-t&&h-d<p,m=y-c<e-i&&r-w<y-c;b&&(D+=" "+this.options.Et("container--over")),m&&(D+=" "+this.options.Et("container--left")),this.container.className=this.options.Et("container")+D,null!==f&&(b||m)&&(b&&(l=v+p,f.style.top="-"+l+"px"),m&&(a=y-c,f.style.left="-"+a+"px"),f.style.position="absolute")}},r.nt=function(t,i){var n=null!==i?i.W:null,s=r.Rt;return!(s!==n&&(null!==s&&!s.St(t,!1)||r.Rt===s&&(null===n?r.Rt=null:!n.St(t,!0)||(r.Rt!==s||(i.Ft(),r.Rt=n),0))))},r.Mt=[],r.Nt=!1,r.Rt=null,r.it=!1,r);function r(t,i,n){if(void 0===i&&(i=null),void 0===n&&(n=null),this.P=k.Untouched,this.K=null,this.rt=[],(this.ot=null)!==t&&!h.X.bt(t))throw new Error("Input was expected to be null or an HTMLElement.");if(null!==i&&!h.X.bt(i))throw new Error("Container was expected to be null or an HTMLElement.");if(null===t&&null===i)throw new Error("At least one of input or container is mandatory.");if(null!==n&&!(n instanceof h.Options))throw new Error("Options was expected to be an instance of Options");this.q=document,this.options=null!==n?n.clone():new h.Options;var s="There is already a datepicker present on ";if(this.ut=null!==i,null===i)i=this.gt(),null!==t&&t.parentNode.insertBefore(i,t.nextSibling);else if(void 0!==i.datepicker)throw new Error(s+"container.");if(null!==t){if(void 0!==t.datepicker)throw new Error(s+"input.");t.datepicker=this}this.wt=null!==t&&("undefined"==typeof HTMLInputElement||t instanceof HTMLInputElement)&&"text"===t.type,this.wt&&(t.autocomplete="off"),(i.datepicker=this).input=t,this.container=i,this.ct=new h.L(this.options),this.W=new h.jt(this.options,this),this.At(t),this.At(i)}h.Datepicker=i,h.onDatepickerReady=i.onDatepickerReady}(TheDatepicker=TheDatepicker||{}),function(i){var t=(n.prototype.getDate=function(){return new Date(this.year,this.month-1,this.dayNumber,0,0,0,0)},n.prototype.getFormatted=function(){return this.year+"-"+("0"+this.month).slice(-2)+"-"+("0"+this.dayNumber).slice(-2)},n.prototype.isEqualToDate=function(t){return null!==t&&this.dayNumber===t.getDate()&&this.month===t.getMonth()+1&&this.year===t.getFullYear()},n.prototype.isEqualToDay=function(t){return null!==t&&this.dayNumber===t.dayNumber&&this.month===t.month&&this.year===t.year},n);function n(t){this.isToday=!1,this.isPast=!1,this.isAvailable=!0,this.isInValidity=!0,this.isVisible=!0,this.isInCurrentMonth=!0,this.isSelected=!1,this.isHighlighted=!1,this.isFocused=!1,this.dayNumber=t.getDate(),this.month=t.getMonth()+1,this.year=t.getFullYear(),this.dayOfWeek=t.getDay(),this.isWeekend=this.dayOfWeek===i.DayOfWeek.Saturday||this.dayOfWeek===i.DayOfWeek.Sunday}i.Day=t}(TheDatepicker=TheDatepicker||{}),function(f){var t,i,n,r,s;(t=f.DayOfWeek||(f.DayOfWeek={}))[t.Monday=1]="Monday",t[t.Tuesday=2]="Tuesday",t[t.Wednesday=3]="Wednesday",t[t.Thursday=4]="Thursday",t[t.Friday=5]="Friday",t[t.Saturday=6]="Saturday",t[t.Sunday=0]="Sunday",(i=f.Month||(f.Month={}))[i.January=0]="January",i[i.February=1]="February",i[i.March=2]="March",i[i.April=3]="April",i[i.May=4]="May",i[i.June=5]="June",i[i.July=6]="July",i[i.August=7]="August",i[i.September=8]="September",i[i.October=9]="October",i[i.November=10]="November",i[i.December=11]="December",(n=f.Ht||(f.Ht={}))[n.Enter=13]="Enter",n[n.Space=32]="Space",n[n.Left=37]="Left",n[n.Up=38]="Up",n[n.Right=39]="Right",n[n.Down=40]="Down",(s=r=f.tt||(f.tt={})).MouseDown="mousedown",s.Focus="focus",s.FocusIn="focusin",s.Blur="blur",s.KeyDown="keydown",s.KeyUp="keyup",s.TouchStart="touchstart",s.TouchMove="touchmove",s.AnimationEnd="animationend";var h=(l.Jt=function(t){return null===t?null:(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)},l.lt=function(t,i,n){if(!i)return null;if(i instanceof f.Day)return i.getDate();if("string"==typeof i){if("today"===i||"now"===i)return n.getToday();if("tomorrow"===i){var s=n.getToday();return s.setDate(s.getDate()+1),s}if("yesterday"===i){var h=n.getToday();return h.setDate(h.getDate()-1),h}var r=i.match(/^\s*([+-]?)\s*([0-9]+)\s*(day|month|year)s?\s*$/i);if(null!==r){var u=n.getToday(),e=parseInt(r[2],10)*("-"===r[1]?-1:1);switch(r[3].toLowerCase()){case"day":case"days":u.setDate(u.getDate()+e);break;case"month":case"months":u.setMonth(u.getMonth()+e);break;case"year":case"years":u.setFullYear(u.getFullYear()+e)}return u}var o=l.Jt(new Date(i));if(!isNaN(o.getTime()))return o}else if(l.Ot(i)&&(o=l.Jt(new Date(i.getTime())),!isNaN(o.getTime())))return o;throw new Error(t+" was expected to be a valid Date string or valid Date or Day or null.")},l.bt=function(t){return"object"==typeof t&&1===t.nodeType&&"object"==typeof t.style&&"object"==typeof t.ownerDocument},l.Ot=function(t){return"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(t.getTime())},l.Lt=function(t,i){for(var n=0;n<t.length;n++)if(t[n]===i)return!0;return!1},l.V=function(i,t,n){if(i.addEventListener)return i.addEventListener(t,n),function(){i.removeEventListener(t,n)};var s="on"+t,h=i[s]||null;return i[s]=function(t){t=t||window.event,null!==h&&h.call(i,t),n(t)},function(){i[s]=h}},l.It=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},l.Ct=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},l.Pt=function(t,i,n){if(void 0===n&&(n=!1),!n&&!i)return"";if("string"!=typeof i||n&&""===i)throw new Error(t+" was expected to be a"+(n?" non empty":"")+" string.");return i},l.Ut=function(t,i,n,s){if(void 0===n&&(n=null),void 0===s&&(s=null),"number"!=typeof(i="string"==typeof i?parseInt(i):i)||isNaN(i)||null!==n&&i<n||null!==s&&s<i)throw new Error(t+" was expected to be a valid number"+(null!==n?" from "+n:"")+(null!==s?" to "+s:"")+".");return i},l.kt=function(t,i,n){if(void 0===n&&(n=!0),n&&!i)return null;if("function"!=typeof i)throw new Error(t+" was expected to be a function"+(n?" or null":"")+".");return i},l.Wt=function(t,i){if(window.console){for(var n=0;n<l.Yt.length;n++)if(t===l.Yt[0])return;window.console.warn("TheDatepicker: "+t+"() is deprecated, use "+i+"()"),l.Yt.push(t)}},l.zt=function(i,n){var s=null,h=null;l.V(i,r.TouchStart,function(t){s=t.touches[0].clientX,h=i.offsetWidth/5}),l.V(i,r.TouchMove,function(t){var i;null!==s&&(i=t.touches[0].clientX-s,Math.abs(i)>h&&(n(t,0<i),s=null))})},l.Gt=function(){var t;return null===l._t&&(t=document.createElement("div"),l._t=""===t.style.animationName),l._t},l.Yt=[],l._t=null,l);function l(){}f.X=h}(TheDatepicker=TheDatepicker||{}),function(h){var t=(i.prototype.Bt=function(t){var i=this.q.createElement("div");return this.Zt(i,t),i},i.prototype.$t=function(i){var t=this.q.createElement("a");return this.Zt(t,"button"),t.href="#",t.onclick=function(t){t=t||window.event,h.X.It(t),i(t)},t.onkeydown=function(t){t=t||window.event,h.X.Lt([h.Ht.Enter,h.Ht.Space],t.keyCode)&&(h.X.It(t),i(t))},t},i.prototype.qt=function(){return this.q.createElement("span")},i.prototype.Kt=function(t,i,n){var s=this.q.createElement("table");return this.Zt(s,t),s.appendChild(i),s.appendChild(n),s},i.prototype.Qt=function(t,i){var n=this.q.createElement("thead");this.Zt(n,t);for(var s=this.q.createElement("tr"),h=0;h<i.length;h++)s.appendChild(i[h]);return n.appendChild(s),n},i.prototype.Vt=function(t){var i=this.q.createElement("th");return i.scope="col",this.Zt(i,t),i},i.prototype.Xt=function(t,i){var n=this.q.createElement("tbody");this.Zt(n,t);for(var s=0;s<i.length;s++)n.appendChild(i[s]);return n},i.prototype.ti=function(t,i){for(var n=this.q.createElement("tr"),s=0;s<i.length;s++)n.appendChild(i[s]);return n},i.prototype.ii=function(){return this.q.createElement("td")},i.prototype.ni=function(t,i){var n=this.q.createElement("select");this.Zt(n,"select");for(var s=0;s<t.length;s++)n.appendChild(this.si(t[s].value,t[s].label));return n.onchange=function(t){i(t||window.event,n.value)},n.onkeydown=function(t){t=t||window.event,h.X.Ct(t)},n},i.prototype.si=function(t,i){var n=this.q.createElement("option");return n.value=t,n.innerText=i,n},i.prototype.Zt=function(t,i){i=this.I.Et(i),""!==t.className&&(i=" "+i),t.className+=i},i.prototype.hi=function(t,i){i&&t.appendChild(i)},i);function i(t){this.I=t,this.q=document}h.ri=t}(TheDatepicker=TheDatepicker||{}),function(h){var i,t;(t=i=h.ui||(h.ui={})).BeforeSelect="beforeSelect",t.Select="select",t.BeforeOpenAndClose="beforeOpenAndClose",t.OpenAndClose="openAndClose",t.BeforeMonthChange="beforeMonthChange",t.MonthChange="monthChange",t.Focus="focus",t.BeforeFocus="beforeFocus";var n=function(){};h.AvailableDateNotFoundException=n;var s=(r.prototype.clone=function(){var t=new r(this.translator);return t.ei=this.ei,t.oi=this.oi,t.fi=this.fi,t.li=this.li,t.ai=this.ai,t.ci=this.ci,t.vi=this.vi,t.di=this.di,t.wi=this.wi,t.pi=this.pi,t.yi=this.yi,t.Di=this.Di,t.bi=this.bi,t.mi=this.mi,t.ki=this.ki.slice(0),t.Ti=this.Ti.slice(0),t.Mi=this.Mi,t.gi=this.gi,t.Ei=this.Ei,t.Ii=this.Ii,t.Ni=this.Ni,t.Ri=this.Ri,t.xi=this.xi,t.Ci=this.Ci,t.Ai=this.Ai,t.Fi=this.Fi,t.Si=this.Si,t.ji=this.ji,t.Hi=this.Hi,t.Ji=this.Ji,t.Oi=this.Oi,t.Li=this.Li,t.Pi=this.Pi,t.Ui=this.Ui,t.Wi=this.Wi,t.Yi=this.Yi,t.zi=this.zi,t.Gi=this.Gi,t._i=this._i,t.Bi=this.Bi,t.Zi.beforeSelect=this.Zi.beforeSelect.slice(0),t.Zi.select=this.Zi.select.slice(0),t.Zi.beforeOpenAndClose=this.Zi.beforeOpenAndClose.slice(0),t.Zi.openAndClose=this.Zi.openAndClose.slice(0),t.Zi.beforeMonthChange=this.Zi.beforeMonthChange.slice(0),t.Zi.monthChange=this.Zi.monthChange.slice(0),t.Zi.beforeFocus=this.Zi.beforeFocus.slice(0),t.Zi.focus=this.Zi.focus.slice(0),t},r.prototype.setHideOnBlur=function(t){this.ei=!!t},r.prototype.setHideOnSelect=function(t){this.oi=!!t},r.prototype.setMinDate=function(t){var i=h.X.lt("Min date",t,this);this.$i(i,this.li),this.fi=i},r.prototype.setMaxDate=function(t){var i=h.X.lt("Max date",t,this);this.$i(this.fi,i),this.li=i},r.prototype.setInitialMonth=function(t){this.ci=h.X.lt("Initial month",t,this)},r.prototype.setInitialDate=function(t){this.ai=h.X.lt("Initial date",t,this)},r.prototype.setInitialDatePriority=function(t){this.vi=!!t},r.prototype.setFirstDayOfWeek=function(t){this.di=h.X.Ut("First day of week",t,0,6)},r.prototype.setDateAvailabilityResolver=function(t){this.wi=h.X.kt("Resolver",t)},r.prototype.setCellContentResolver=function(t){this.pi=h.X.kt("Resolver",t)},r.prototype.setCellContentStructureResolver=function(t,i){void 0===i&&(i=null),t=h.X.kt("Resolver (init)",t),i=h.X.kt("Resolver (update)",i),this.yi=null===t?null:{init:t,update:i}},r.prototype.setHeaderStructureResolver=function(t){this.Di=h.X.kt("Resolver",t)},r.prototype.setFooterStructureResolver=function(t){this.bi=h.X.kt("Resolver",t)},r.prototype.setCellClassesResolver=function(t){h.X.Wt("setCellClassesResolver","addCellClassesResolver"),this.mi=h.X.kt("Resolver",t)},r.prototype.addCellClassesResolver=function(t){this.ki.push(h.X.kt("Resolver",t,!1))},r.prototype.removeCellClassesResolver=function(t){if(void 0===t&&(t=null),null===(t=h.X.kt("Resolver",t)))this.ki=[];else{for(var i=[],n=0;n<this.ki.length;n++)this.ki[n]!==t&&i.push(this.ki[n]);this.ki=i}},r.prototype.addDayModifier=function(t){this.Ti.push(h.X.kt("Modifier",t,!1))},r.prototype.removeDayModifier=function(t){if(void 0===t&&(t=null),null===(t=h.X.kt("Modifier",t)))this.Ti=[];else{for(var i=[],n=0;n<this.Ti.length;n++)this.Ti[n]!==t&&i.push(this.Ti[n]);this.Ti=i}},r.prototype.setInputFormat=function(t){this.Mi=h.X.Pt("Input format",t,!0)},r.prototype.setDaysOutOfMonthVisible=function(t){this.gi=!!t},r.prototype.setFixedRowsCount=function(t){this.Ei=!!t},r.prototype.setToggleSelection=function(t){this.Ii=!!t},r.prototype.setShowDeselectButton=function(t){this.Ri=!!t},r.prototype.setAllowEmpty=function(t){this.Ni=!!t},r.prototype.setShowResetButton=function(t){this.xi=!!t},r.prototype.setMonthAsDropdown=function(t){this.Ci=!!t},r.prototype.setYearAsDropdown=function(t){this.Ai=!!t},r.prototype.setMonthAndYearSeparated=function(t){this.Fi=!!t},r.prototype.setMonthShort=function(t){this.Si=!!t},r.prototype.setChangeMonthOnSwipe=function(t){this.ji=!!t},r.prototype.setAnimateMonthChange=function(t){this.Hi=!!t},r.prototype.setClassesPrefix=function(t){this.Ji=h.X.Pt("Prefix",t)},r.prototype.setShowCloseButton=function(t){this.Oi=!!t},r.prototype.setTitle=function(t){this.Li=h.X.Pt("Title",t)},r.prototype.setDropdownItemsLimit=function(t){this.Pi=h.X.Ut("Items limit",t,1)},r.prototype.setHideDropdownWithOneItem=function(t){this.Ui=!!t},r.prototype.setGoBackHtml=function(t){this.Wi=h.X.Pt("Html",t)},r.prototype.setGoForwardHtml=function(t){this.Yi=h.X.Pt("Html",t)},r.prototype.setCloseHtml=function(t){this.zi=h.X.Pt("Html",t)},r.prototype.setResetHtml=function(t){this.Gi=h.X.Pt("Html",t)},r.prototype.setDeselectHtml=function(t){this._i=h.X.Pt("Html",t)},r.prototype.setPositionFixing=function(t){this.Bi=!!t},r.prototype.setToday=function(t){this.qi=h.X.lt("Today",t,this)},r.prototype.onBeforeSelect=function(t){this.Ki(i.BeforeSelect,t)},r.prototype.offBeforeSelect=function(t){void 0===t&&(t=null),this.Qi(i.BeforeSelect,t)},r.prototype.onSelect=function(t){this.Ki(i.Select,t)},r.prototype.offSelect=function(t){void 0===t&&(t=null),this.Qi(i.Select,t)},r.prototype.onBeforeOpenAndClose=function(t){this.Ki(i.BeforeOpenAndClose,t)},r.prototype.offBeforeOpenAndClose=function(t){void 0===t&&(t=null),this.Qi(i.BeforeOpenAndClose,t)},r.prototype.onOpenAndClose=function(t){this.Ki(i.OpenAndClose,t)},r.prototype.offOpenAndClose=function(t){void 0===t&&(t=null),this.Qi(i.OpenAndClose,t)},r.prototype.onBeforeMonthChange=function(t){this.Ki(i.BeforeMonthChange,t)},r.prototype.offBeforeMonthChange=function(t){void 0===t&&(t=null),this.Qi(i.BeforeMonthChange,t)},r.prototype.onMonthChange=function(t){this.Ki(i.MonthChange,t)},r.prototype.offMonthChange=function(t){void 0===t&&(t=null),this.Qi(i.MonthChange,t)},r.prototype.onBeforeFocus=function(t){this.Ki(i.BeforeFocus,t)},r.prototype.offBeforeFocus=function(t){void 0===t&&(t=null),this.Qi(i.BeforeFocus,t)},r.prototype.onFocus=function(t){this.Ki(i.Focus,t)},r.prototype.offFocus=function(t){void 0===t&&(t=null),this.Qi(i.Focus,t)},r.prototype.getInitialMonth=function(){var t=this.vi?this.ai:this.ci,i=this.vi?this.ci:this.ai,n=null!==t?new Date(t.getTime()):null!==i?new Date(i.getTime()):this.getToday();return n.setDate(1),this.correctMonth(n)},r.prototype.isMonthInValidity=function(t){return null===this.Vi(t)},r.prototype.correctMonth=function(t){var i=this.Vi(t);return null!==i?i:t},r.prototype.getInitialDate=function(){return this.findPossibleAvailableDate(this.ai)},r.prototype.findPossibleAvailableDate=function(t){if(this.isAllowedEmpty())return null!==t&&this.isDateInValidity(t)&&this.isDateAvailable(t)?new Date(t.getTime()):null;if(t=null!==t?new Date(t.getTime()):this.getToday(),null!==(t=this.findNearestAvailableDate(t)))return t;throw new n},r.prototype.findNearestAvailableDate=function(t){if(t=this.Xi(t),this.isDateAvailable(t))return t;var i=this.tn().getTime(),n=this.in().getTime(),s=1e3,h=t,r=new Date(t.getTime());do{if(null!==h)if(h.setDate(h.getDate()+1),h.getTime()>n)h=null;else if(this.isDateAvailable(h))return h;if(null!==r)if(r.setDate(r.getDate()-1),r.getTime()<i)r=null;else if(this.isDateAvailable(r))return r;s--}while((null!==h||null!==r)&&0<s);return null},r.prototype.isDateInValidity=function(t){return null===this.nn(t)},r.prototype.Xi=function(t){var i=this.nn(t);return null!==i?i:t},r.prototype.getFirstDayOfWeek=function(){return this.di},r.prototype.areDaysOutOfMonthVisible=function(){return this.gi},r.prototype.hasFixedRowsCount=function(){return this.Ei},r.prototype.hasToggleSelection=function(){return this.Ni&&this.Ii},r.prototype.isAllowedEmpty=function(){return this.Ni},r.prototype.isDeselectButtonShown=function(){return this.Ni&&this.Ri},r.prototype.isResetButtonShown=function(){return this.xi},r.prototype.isMonthAsDropdown=function(){return this.Ci},r.prototype.isYearAsDropdown=function(){return this.Ai},r.prototype.isMonthAndYearSeparated=function(){return this.Fi},r.prototype.isMonthShort=function(){return this.Si},r.prototype.sn=function(){return this.ji},r.prototype.isMonthChangeAnimated=function(){return this.Hi},r.prototype.getClassesPrefix=function(){return this.Ji},r.prototype.isCloseButtonShown=function(){return this.ei&&this.Oi},r.prototype.getTitle=function(){return this.Li},r.prototype.getMinDate=function(){return null!==this.fi?new Date(this.fi.getTime()):null},r.prototype.getMaxDate=function(){return null!==this.li?new Date(this.li.getTime()):null},r.prototype.tn=function(){var t=this.getMinDate();return null===t?new Date(-271821,4,1):t},r.prototype.in=function(){var t=this.getMaxDate();return null===t?new Date(275760,7,31):t},r.prototype.getMinMonth=function(){if(null===this.fi)return null;var t=new Date(this.fi.getTime());return t.setDate(1),t},r.prototype.getMaxMonth=function(){if(null===this.li)return null;var t=new Date(this.li.getTime());return t.setDate(1),t},r.prototype.hn=function(){var t=this.getMinMonth();return null===t&&(t=this.tn()),t},r.prototype.rn=function(){var t=this.getMaxMonth();return null===t&&(t=this.in()).setDate(1),t},r.prototype.isDropdownWithOneItemHidden=function(){return this.Ui},r.prototype.getDropdownItemsLimit=function(){return this.Pi},r.prototype.isDateAvailable=function(t){return null===this.wi||!!this.wi(new Date(t.getTime()))},r.prototype.getCellContent=function(t){return null!==this.pi?this.pi(t):t.dayNumber+""},r.prototype.Et=function(t){return this.Ji+t},r.prototype.un=function(){return null!==this.yi?this.yi.init():this.q.createElement("span")},r.prototype.en=function(t,i){null!==this.yi?this.yi.update(t,i):t.innerText=this.getCellContent(i)},r.prototype.on=function(){return null!==this.Di?this.Di():null},r.prototype.fn=function(){return null!==this.bi?this.bi():null},r.prototype.getCellClasses=function(t){var i=[];null!==this.mi&&("string"==typeof(n=this.mi(t))?i.push(n):"object"==typeof n&&n.constructor===Array&&(i=i.concat(n)));for(var n,s=this.ki.slice(0),h=0;h<s.length;h++)"string"==typeof(n=s[h](t))?i.push(n):"object"==typeof n&&n.constructor===Array&&(i=i.concat(n));return i},r.prototype.modifyDay=function(t){for(var i=this.Ti.slice(0),n=0;n<i.length;n++)i[n](t)},r.prototype.getGoBackHtml=function(){return this.Wi},r.prototype.getGoForwardHtml=function(){return this.Yi},r.prototype.getCloseHtml=function(){return this.zi},r.prototype.getResetHtml=function(){return this.Gi},r.prototype.getDeselectHtml=function(){return this._i},r.prototype.isHiddenOnBlur=function(){return this.ei},r.prototype.isHiddenOnSelect=function(){return this.ei&&this.oi},r.prototype.getInputFormat=function(){return this.Mi},r.prototype.isPositionFixingEnabled=function(){return this.ei&&this.Bi},r.prototype.getToday=function(){return null!==this.qi?new Date(this.qi.getTime()):h.X.Jt(new Date)},r.prototype.getDateAvailabilityResolver=function(){return this.wi},r.prototype.getCellContentResolver=function(){return this.pi},r.prototype.getCellContentStructureResolver=function(){return this.yi},r.prototype.getHeaderStructureResolver=function(){return this.Di},r.prototype.getFooterStructureResolver=function(){return this.bi},r.prototype.getCellClassesResolvers=function(){return this.ki},r.prototype.getDayModifiers=function(){return this.Ti},r.prototype.getBeforeSelectListeners=function(){return this.Zi.beforeSelect},r.prototype.getSelectListeners=function(){return this.Zi.select},r.prototype.getBeforeOpenAndCloseListeners=function(){return this.Zi.beforeOpenAndClose},r.prototype.getOpenAndCloseListeners=function(){return this.Zi.openAndClose},r.prototype.getBeforeMonthChangeListeners=function(){return this.Zi.beforeMonthChange},r.prototype.getMonthChangeListeners=function(){return this.Zi.monthChange},r.prototype.getBeforeFocusListeners=function(){return this.Zi.beforeFocus},r.prototype.getFocusListeners=function(){return this.Zi.focus},r.prototype.$i=function(t,i){if(null!==t&&null!==i&&t.getTime()>i.getTime())throw new Error("Min date cannot be higher then max date.")},r.prototype.Vi=function(t){var i=this.hn();if(t.getTime()<i.getTime())return i;var n=this.rn();return t.getTime()>n.getTime()?n:null},r.prototype.nn=function(t){var i=this.tn();if(t.getTime()<i.getTime())return i;var n=this.in();return t.getTime()>n.getTime()?n:null},r.prototype.Ki=function(t,i){this.Zi[t].push(h.X.kt("Event listener",i,!1))},r.prototype.Qi=function(t,i){if(null===(i=h.X.kt("Event listener",i)))this.Zi[t]=[];else{for(var n=[],s=0;s<this.Zi[t].length;s++)this.Zi[t][s]!==i&&n.push(this.Zi[t][s]);this.Zi[t]=n}},r.prototype.ln=function(t,i){for(var n=this.Zi[t].slice(0),s=0;s<n.length;s++)if(!1===i(n[s]))return!1;return!0},r);function r(t){void 0===t&&(t=null),this.ei=!0,this.oi=!0,this.fi=null,this.li=null,this.ai=null,this.ci=null,this.vi=!0,this.di=h.DayOfWeek.Monday,this.wi=null,this.pi=null,this.yi=null,this.Di=null,this.bi=null,this.mi=null,this.ki=[],this.Ti=[],this.Mi="j. n. Y",this.gi=!1,this.Ei=!1,this.Ii=!1,this.Ni=!0,this.Ri=!0,this.xi=!1,this.Ci=!0,this.Ai=!0,this.Fi=!0,this.Si=!1,this.ji=!0,this.Hi=!0,this.Ji="the-datepicker__",this.Oi=!0,this.Li="",this.Pi=200,this.Ui=!0,this.Wi="<",this.Yi=">",this.zi="×",this.Gi="↺",this._i="×",this.Bi=!0,this.qi=null,this.Zi={beforeSelect:[],select:[],beforeOpenAndClose:[],openAndClose:[],beforeMonthChange:[],monthChange:[],beforeFocus:[],focus:[]},this.translator=null!==t?t:new h.Translator,this.q=document}h.Options=s}(TheDatepicker=TheDatepicker||{}),function(o){var t=(i.prototype.U=function(t){if(null===this.an){if(this.cn&&this.I.isHiddenOnBlur()&&!t.st())return;this.vn.innerHTML="",this.vn.appendChild(this.dn(t))}this.wn(t),this.pn(t),this.yn(t),this.Dn(t),this.bn(t),this.mn(t),this.kn(t),this.Tn(t),this.Mn(t),this.gn(t),this.En(t)},i.prototype.dn=function(t){var i=this.In.Bt("main");return this.In.hi(i,this.I.on()),i.appendChild(this.Nn(t)),i.appendChild(this.Rn(t)),this.In.hi(i,this.I.fn()),this.an=i},i.prototype.wn=function(t){this.an.style.display=this.cn&&!t.st()&&this.I.isHiddenOnBlur()?"none":""},i.prototype.Rn=function(n){var s=this,t=this.In.Bt("body");return this.I.sn()&&o.X.zt(t,function(t,i){s.xn(n,t,!i)}),t.appendChild(this.Cn(n)),this.An=t},i.prototype.Nn=function(t){var i=this.In.Bt("header"),n=this.In.Bt("top");i.appendChild(n),n.appendChild(this.Fn(t));var s=this.In.Bt("control");n.appendChild(s),s.appendChild(this.Sn(t)),s.appendChild(this.jn(t));var h=this.In.Bt("navigation");i.appendChild(h),h.appendChild(this.Hn(t));var r=this.In.Bt("state");return h.appendChild(r),this.I.isMonthAndYearSeparated()?(r.appendChild(this.Jn(t)),r.appendChild(this.On(t))):r.appendChild(this.Ln(t)),h.appendChild(this.Pn(t)),this.Un=s,i},i.prototype.pn=function(t){var i=""!==this.I.getTitle()||this.I.isResetButtonShown()||this.cn&&this.I.isCloseButtonShown();this.Un.style.display=i?"":"none",this.Wn.style.display=i?"":"none"},i.prototype.Fn=function(t){var i=this.In.Bt("title"),n=this.In.qt();return i.appendChild(n),this.In.Zt(n,"title-content"),this.Wn=i,this.Yn=n,i},i.prototype.yn=function(t){var i=this.I.getTitle();this.Yn.style.display=""!==i?"":"none",this.Yn.innerText=i},i.prototype.Sn=function(i){var t=this.In.Bt("reset"),n=this.In.$t(function(t){i.ht(t)});n.innerHTML=this.I.getResetHtml();var s=this.I.translator.translateTitle(o.TitleName.Reset);return""!==s&&(n.title=s),t.appendChild(n),this.zn=t},i.prototype.bn=function(t){this.zn.style.display=this.I.isResetButtonShown()?"":"none"},i.prototype.jn=function(i){var t=this.In.Bt("close"),n=this.In.$t(function(t){i.Gn(t)});n.innerHTML=this.I.getCloseHtml();var s=this.I.translator.translateTitle(o.TitleName.Close);return""!==s&&(n.title=s),t.appendChild(n),this._n=t},i.prototype.Dn=function(t){this._n.style.display=this.cn&&this.I.isCloseButtonShown()?"":"none"},i.prototype.Hn=function(t){return this.Bn(t,!1)},i.prototype.Pn=function(t){return this.Bn(t,!0)},i.prototype.Bn=function(i,n){var s=this,t=this.In.Bt("go");this.In.Zt(t,n?"go-next":"go-previous");var h=this.In.$t(function(t){s.xn(i,t,n)});h.innerHTML=n?this.I.getGoForwardHtml():this.I.getGoBackHtml();var r=this.I.translator.translateTitle(n?o.TitleName.GoForward:o.TitleName.GoBack);return""!==r&&(h.title=r),t.appendChild(h),n?this.Zn=h:this.$n=h,t},i.prototype.mn=function(t){this.$n.style.visibility=t.qn()?"visible":"hidden"},i.prototype.kn=function(t){this.Zn.style.visibility=t.Kn()?"visible":"hidden"},i.prototype.Jn=function(h){for(var r=this,t=[],i=0;i<12;i++)t.push({value:i+"",label:this.translateMonth(i)});var n=this.In.ni(t,function(t,i){var n=h.vt(),s=new Date(n.getTime());s.setMonth(parseInt(i,10)),h.dt(t,s)||(r.Qn.value=n.getMonth()+"")}),s=this.In.Bt("month"),u=this.In.qt();return s.appendChild(n),s.appendChild(u),this.Vn=u,this.Qn=n,s},i.prototype.Tn=function(t){if(null!==this.Vn){var i=t.vt().getMonth();if(this.Vn.innerText=this.translateMonth(i),!this.I.isMonthAsDropdown())return this.Qn.style.display="none",void(this.Vn.style.display="");for(var n=0,s=0;s<12;s++){var h=new Date(t.vt().getTime());h.setMonth(s);var r=this.Qn.getElementsByTagName("option")[s],u=t.Xn(h);r.disabled=!u,r.style.display=u?"":"none",n+=u?1:0}this.Qn.value=i+"";var e=!this.I.isDropdownWithOneItemHidden()||1<n;this.Qn.style.display=e?"":"none",this.Vn.style.display=e?"none":""}},i.prototype.On=function(u){var e=this,t=this.In.ni([],function(t,i){var n=u.vt(),s=new Date(n.getTime());s.setFullYear(parseInt(i,10));var h=e.I.hn(),r=e.I.rn();s.getTime()<h.getTime()&&(s=h),s.getTime()>r.getTime()&&(s=r),u.dt(t,s)||(e.ts.value=n.getFullYear()+"")}),i=this.In.Bt("year"),n=this.In.qt();return i.appendChild(t),i.appendChild(n),this.ns=n,this.ts=t,i},i.prototype.Mn=function(t){if(null!==this.ns){var i=t.vt().getFullYear();if(this.ns.innerText=i+"",!this.I.isYearAsDropdown())return this.ts.style.display="none",void(this.ns.style.display="");for(var n=this.I.tn().getFullYear(),s=this.I.in().getFullYear(),h=this.ss(i,n,s),r=this.ts.getElementsByTagName("option"),u=this.hs(r,h,function(t){return parseInt(t,10)}),e=0;e<u.remove.length;e++)this.ts.removeChild(u.remove[e]);for(e=u.prepend.length-1;0<=e;e--)this.ts.insertBefore(this.In.si(u.prepend[e]+"",u.prepend[e]+""),this.ts.firstChild);for(e=0;e<u.append.length;e++)this.ts.appendChild(this.In.si(u.append[e]+"",u.append[e]+""));this.ts.value=i+"";var o=!this.I.isDropdownWithOneItemHidden()||h.from<h.to;this.ts.style.display=o?"":"none",this.ns.style.display=o?"none":""}},i.prototype.Ln=function(r){var u=this,t=this.In.Bt("month-year"),i=this.In.ni([],function(t,i){var n=r.vt(),s=new Date(n.getTime()),h=u.rs(i);s.setFullYear(h.year),s.setMonth(h.month),r.dt(t,s)||(u.us.value=u.es({month:n.getMonth(),year:n.getFullYear()}))}),n=this.In.qt();return this.os=n,this.us=i,t.appendChild(n),t.appendChild(i),t},i.prototype.gn=function(t){var i=this;if(null!==this.os){var n=t.vt(),s={month:n.getMonth(),year:n.getFullYear()},h=this.fs(s);if(this.os.innerText=this.ls(s),!this.I.isYearAsDropdown()||!this.I.isMonthAsDropdown())return this.us.style.display="none",void(this.os.style.display="");for(var r=this.I.tn(),u=this.I.in(),e=12*r.getFullYear()+r.getMonth(),o=12*u.getFullYear()+u.getMonth(),f=this.ss(h,e,o),l=this.us.getElementsByTagName("option"),a=this.hs(l,f,function(t){return i.fs(i.rs(t))}),c=0;c<a.remove.length;c++)this.us.removeChild(a.remove[c]);for(c=a.prepend.length-1;0<=c;c--){var v=this.cs(a.prepend[c]);this.us.insertBefore(this.In.si(this.es(v),this.ls(v)),this.us.firstChild)}for(c=0;c<a.append.length;c++)v=this.cs(a.append[c]),this.us.appendChild(this.In.si(this.es(v),this.ls(v)));this.us.value=this.es(s);var d=!this.I.isDropdownWithOneItemHidden()||f.from<f.to;this.us.style.display=d?"":"none",this.os.style.display=d?"none":""}},i.prototype.ls=function(t){return this.translateMonth(t.month)+" "+t.year},i.prototype.fs=function(t){return 12*t.year+t.month},i.prototype.cs=function(t){return{year:Math.floor(t/12),month:t%12}},i.prototype.es=function(t){return t.year+"-"+t.month},i.prototype.rs=function(t){var i=t.split("-");return{month:parseInt(i[1],10),year:parseInt(i[0],10)}},i.prototype.ss=function(t,i,n){var s=this.I.getDropdownItemsLimit()-1,h=Math.ceil(s/2),r=t-(s-h),u=t+h;return r<i?(n<(u+=i-r)&&(u=n),r=i):n<u&&((r-=u-n)<i&&(r=i),u=n),{from:r,to:u}},i.prototype.hs=function(t,i,n){for(var s=0<t.length?n(t[0].value):null,h=0<t.length?n(t[t.length-1].value):null,r=[],u=[],e=[],o=i.from;o<=i.to;o++)null===s||o<s?r.push(o):h<o&&u.push(o);for(var f=0;f<t.length;f++)((o=n(t[f].value))<i.from||o>i.to)&&e.push(t[f]);return{prepend:r,append:u,remove:e}},i.prototype.Cn=function(t){var i=this.vs(t),n=this.ds(t);return this.In.Kt("calendar",i,n)},i.prototype.vs=function(t){for(var i=t.ws(),n=[],s=0;s<i.length;s++){var h=i[s];n.push(this.ps(t,h))}return this.In.Qt("calendar-header",n)},i.prototype.ps=function(t,i){var n=this.In.Vt("week-day");return i!==o.DayOfWeek.Saturday&&i!==o.DayOfWeek.Sunday||this.In.Zt(n,"week-day--weekend"),n.innerText=this.I.translator.translateDayOfWeek(i),n},i.prototype.ds=function(t){this.ys=[],this.Ds=[],this.bs=[];for(var i=[],n=0;n<6;n++)i.push(this.ms(t));return this.ks=i,this.In.Xt("calendar-body",i)},i.prototype.En=function(t){for(var i=t.Ts(),n=0;n<this.ks.length;n++){var s=this.ks[n],h=i.length>n?i[n]:null;if(s.style.display=null!==h?"":"none",null!==h)for(var r=0;r<this.ys[n].length;r++)this.Ms(t,this.ys[n][r],this.Ds[n][r],this.bs[n][r],h[r])}},i.prototype.ms=function(t){for(var i=[],n=[],s=[],h=0;h<7;h++){var r=this.In.ii(),u=this.gs(t),e=this.Es(t);i.push(r),n.push(u),s.push(e),r.appendChild(u),u.appendChild(e)}return this.ys.push(i),this.Ds.push(n),this.bs.push(s),this.In.ti("week",i)},i.prototype.Ms=function(t,i,n,s,h){if(n.day=h,i.setAttribute("data-date",h.getFormatted()),i.className="",this.In.Zt(i,"cell"),this.I.en(s,h),!h.isVisible)return n.removeAttribute("href"),void(n.style.visibility="hidden");this.In.Zt(i,"day"),h.isToday&&this.In.Zt(i,"day--today"),h.isPast&&this.In.Zt(i,"day--past"),h.isWeekend&&this.In.Zt(i,"day--weekend"),h.isAvailable||this.In.Zt(i,"day--unavailable"),h.isInCurrentMonth||this.In.Zt(i,"day--outside"),h.isHighlighted&&this.In.Zt(i,"day--highlighted"),h.isSelected&&this.In.Zt(i,"day--selected");for(var r=this.I.getCellClasses(h),u=0;u<r.length;u++)i.className+=" "+r[u];n.style.visibility="visible",h.isAvailable?n.href="#":n.removeAttribute("href"),h.isFocused&&n.focus()},i.prototype.gs=function(s){var h=this,r=this.In.$t(function(t){var i=s.at,n=s.ft(t,r.day,!1,!0,!0);h.I.isHiddenOnSelect()&&(n||null!==i&&r.day.isEqualToDate(i))&&s.Gn(t)});return r.onfocus=function(t){s.Is(t||window.event,r.day)},r.onmouseenter=function(t){0<h.I.getBeforeFocusListeners().length||0<h.I.getFocusListeners().length?s.Is(t||window.event,r.day,!1,!1):s.Ns(t||window.event)},r.onmouseleave=function(t){s.Ns(t||window.event)},r},i.prototype.Es=function(t){var i=this.I.un();return this.In.Zt(i,"day-content"),i},i.prototype.xn=function(t,i,n){var s,h,r,u,e=this;(n?t.Kn():t.qn())&&(s=function(){n?t.Rs(i):t.xs(i)},this.I.isMonthChangeAnimated()&&o.X.Gt()?(h=n?"fade-out-left":"fade-out-right",r=n?"fade-in-right":"fade-in-left",u=o.X.V(this.An,o.tt.AnimationEnd,function(t){s(),u(),e.An.className=e.I.Et("body"),e.In.Zt(e.An,"animated"),e.In.Zt(e.An,r),u=o.X.V(e.An,o.tt.AnimationEnd,function(t){u(),e.An.className=e.I.Et("body")})}),this.An.className=this.I.Et("body"),this.In.Zt(this.An,"animated"),this.In.Zt(this.An,h)):s())},i.prototype.translateMonth=function(t){return this.I.isMonthShort()?this.I.translator.translateMonthShort(t):this.I.translator.translateMonth(t)},i);function i(t,i,n,s){this.I=t,this.In=i,this.vn=n,this.cn=s,this.an=null,this.An=null,this.Un=null,this.$n=null,this.Zn=null,this.Wn=null,this.Yn=null,this.zn=null,this._n=null,this.Qn=null,this.Vn=null,this.ts=null,this.ns=null,this.us=null,this.os=null,this.ks=[],this.ys=[],this.Ds=[],this.bs=[]}o.Cs=t}(TheDatepicker=TheDatepicker||{}),function(n){var i,t;(t=i=n.TitleName||(n.TitleName={}))[t.GoBack=0]="GoBack",t[t.GoForward=1]="GoForward",t[t.Close=2]="Close",t[t.Reset=3]="Reset";var s=(h.prototype.setDayOfWeekTranslation=function(t,i){this.As[n.X.Ut("Day of week",t,0,6)]=n.X.Pt("Translation",i)},h.prototype.setDayOfWeekFullTranslation=function(t,i){this.Fs[n.X.Ut("Day of week",t,0,6)]=n.X.Pt("Translation",i)},h.prototype.setMonthTranslation=function(t,i){this.Ss[n.X.Ut("Month",t,0,11)]=n.X.Pt("Translation",i)},h.prototype.setMonthShortTranslation=function(t,i){this.js[n.X.Ut("Month",t,0,11)]=n.X.Pt("Translation",i)},h.prototype.setTitleTranslation=function(t,i){this.Hs[t]=n.X.Pt("Translation",i)},h.prototype.translateDayOfWeek=function(t){return this.As[t]},h.prototype.translateDayOfWeekFull=function(t){return this.Fs[t]},h.prototype.translateMonth=function(t){return this.Ss[t]},h.prototype.translateMonthShort=function(t){return this.js[t]},h.prototype.translateTitle=function(t){var i=this.Hs[t];if("string"!=typeof i)throw new Error("Unknown title "+t);return i},h);function h(){var t;this.Fs=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],this.As=["Su","Mo","Tu","We","Th","Fr","Sa"],this.Ss=["January","February","March","April","May","June","July","August","September","October","November","December"],this.js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],this.Hs=((t={})[i.GoBack]="Previous month",t[i.GoForward]="Next month",t[i.Close]="Close",t[i.Reset]="Reset",t)}n.Translator=s}(TheDatepicker=TheDatepicker||{}),function(e){var i,t;(t=i=e.Js||(e.Js={}))[t.Left=-1]="Left",t[t.Up=-7]="Up",t[t.Right=1]="Right",t[t.Down=7]="Down";var n=(s.prototype.U=function(){var t;this._()||(t=this.I.correctMonth(this.vt()),this.dt(null,t)||(this.Os.U(this),this.Ls.B()))},s.prototype.St=function(t,i){return this.Ps===i||!!this.Us(t,i)&&(this.Ps=i,this.I.isHiddenOnBlur()&&this.U(),this.Ws(t,i),!0)},s.prototype.st=function(){return this.Ps},s.prototype.Gn=function(t){return this.Ls.close(t)},s.prototype.vt=function(){return null===this.Ys&&(this.Ys=this.I.getInitialMonth()),this.Ys},s.prototype.qn=function(){var t=new Date(this.vt().getTime());return t.setMonth(t.getMonth()-1),this.Xn(t)},s.prototype.Kn=function(){var t=new Date(this.vt().getTime());return t.setMonth(t.getMonth()+1),this.Xn(t)},s.prototype.Xn=function(t){return!!e.X.Ot(t)&&this.I.isMonthInValidity(t)},s.prototype.xs=function(t){var i=new Date(this.vt().getTime());return i.setMonth(i.getMonth()-1),this.dt(t,i)},s.prototype.Rs=function(t){var i=new Date(this.vt().getTime());return i.setMonth(i.getMonth()+1),this.dt(t,i)},s.prototype.dt=function(t,i,n){return void 0===n&&(n=!0),(i=e.X.Jt(new Date(i.getTime()))).setDate(1),!(i.getTime()===this.vt().getTime()||!this.Xn(i)||!this.zs(t,i,this.Ys)||(this.Ys=i,n&&this.Ns(t)||this.U(),this.Gs(t,i,this.Ys),0))},s.prototype.ht=function(t){var i=this.dt(t,this.I.getInitialMonth()),n=this.$(t);return i||n},s.prototype.ft=function(t,i,n,s,h){if(void 0===n&&(n=!0),void 0===s&&(s=!1),void 0===h&&(h=!1),null===i)return this.Dt(t);var r;if(i instanceof e.Day?i=(r=i).getDate():r=this._s(i),!r.isAvailable)return!1;if(r.isEqualToDate(this.at))return!(!h||!this.I.hasToggleSelection())&&this.Dt(t);var u=null!==this.at?this._s(this.at):null;return!!this.Bs(t,r,u)&&(this.at=r.getDate(),s&&this.Is(t,r),n&&this.dt(t,i)||this.U(),this.Zs(t,r,u),!0)},s.prototype.yt=function(t,i){return this.ft(t,this.I.findNearestAvailableDate(i))},s.prototype._=function(){try{return this.ft(null,this.I.findPossibleAvailableDate(this.at),!1)}catch(t){if(!(t instanceof e.AvailableDateNotFoundException))throw t;return this.Dt(null,!0)}},s.prototype.$=function(t){try{return this.ft(t,this.I.getInitialDate(),!1)}catch(t){if(!(t instanceof e.AvailableDateNotFoundException))throw t;return this.Dt(null,!0)}},s.prototype.Is=function(t,i,n,s){if(void 0===n&&(n=!1),void 0===s&&(s=!0),!i.isAvailable)return!1;if(i.isEqualToDay(this.$s))return!1;var h=this.$s;if(!this.qs(t,i,h))return!1;this.$s=i,s&&(this.Ks=!0);var r=i.getDate();return n&&this.dt(t,r,!1)||this.U(),this.Qs(t,i,h),!0},s.prototype.Vs=function(t){for(var i=new Date(this.vt().getTime()),n=this.I.in(),s=this._s(i);!(s.isAvailable||(i.setDate(s.dayNumber+1),1===i.getDate())||i.getTime()>n.getTime());)s=this._s(i);return this.Is(t,s)},s.prototype.Xs=function(t,i,n){var s=i,h=s.getDate(),r=1e3;do{if(h.setDate(s.dayNumber+n),!(s=this._s(h)).isInValidity)break;r--}while(!s.isAvailable&&0<r);return this.Is(t,s,!0)},s.prototype.Dt=function(t,i){if(void 0===i&&(i=!1),!this.I.isAllowedEmpty()&&!i)return!1;if(null===this.at)return!1;var n=this._s(this.at);return!!this.Bs(t,null,n)&&(this.at=null,this.U(),this.Zs(t,null,n),!0)},s.prototype.Ns=function(t){if(null===this.$s)return!1;var i=this.$s;return!!this.qs(t,null,i)&&(this.$s=null,this.U(),this.Qs(t,null,i),!0)},s.prototype.ws=function(){for(var t=[],i=0;i<7;i++)t.push((this.I.getFirstDayOfWeek()+i)%7);return t},s.prototype.Ts=function(){for(var t=[],i=this.vt(),n=new Date(i.getFullYear(),i.getMonth(),1),s=new Date(i.getFullYear(),i.getMonth(),0).getDate(),h=s-(n.getDay()-this.I.getFirstDayOfWeek()+7)%7+1;h<=s;h++)(o=this._s(new Date(i.getFullYear(),i.getMonth()-1,h))).isVisible=this.I.areDaysOutOfMonthVisible(),o.isInCurrentMonth=!1,t.push(o);var r=new Date(i.getFullYear(),i.getMonth()+1,0),u=r.getDate();for(h=1;h<=u;h++)t.push(this._s(new Date(i.getFullYear(),i.getMonth(),h)));var e=6-(r.getDay()-this.I.getFirstDayOfWeek()+7)%7;for(h=1;h<=e;h++)(o=this._s(new Date(i.getFullYear(),i.getMonth()+1,h))).isVisible=this.I.areDaysOutOfMonthVisible(),o.isInCurrentMonth=!1,t.push(o);if(this.I.hasFixedRowsCount())for(var o,f=1+e;t.length<42;f++)(o=this._s(new Date(i.getFullYear(),i.getMonth()+1,f))).isVisible=this.I.areDaysOutOfMonthVisible(),o.isInCurrentMonth=!1,t.push(o);for(var l=[],a=0;a<t.length;a+=7)l.push(t.slice(a,a+7));return l},s.prototype.xt=function(t){e.X.Lt([e.Ht.Left,e.Ht.Up,e.Ht.Right,e.Ht.Down],t.keyCode)&&(e.X.It(t),null!==this.$s?this.Xs(t,this.$s,this.th(t.keyCode)):null!==this.at&&this.at.getFullYear()===this.vt().getFullYear()&&this.at.getMonth()===this.vt().getMonth()?this.Xs(t,this._s(this.at),this.th(t.keyCode)):this.Vs(t))},s.prototype.Bs=function(i,n,s){var h=this;return this.I.ln(e.ui.BeforeSelect,function(t){return t.call(h.Ls,i,n,s)})},s.prototype.Zs=function(i,n,s){var h=this;this.I.ln(e.ui.Select,function(t){return t.call(h.Ls,i,n,s)})},s.prototype.Us=function(i,n){var s=this;return this.I.ln(e.ui.BeforeOpenAndClose,function(t){return t.call(s.Ls,i,n)})},s.prototype.Ws=function(i,n){var s=this;this.I.ln(e.ui.OpenAndClose,function(t){return t.call(s.Ls,i,n)})},s.prototype.zs=function(i,n,s){var h=this;return this.I.ln(e.ui.BeforeMonthChange,function(t){return t.call(h.Ls,i,n,s)})},s.prototype.Gs=function(i,n,s){var h=this;this.I.ln(e.ui.MonthChange,function(t){return t.call(h.Ls,i,n,s)})},s.prototype.qs=function(i,n,s){var h=this;return this.I.ln(e.ui.BeforeFocus,function(t){return t.call(h.Ls,i,n,s)})},s.prototype.Qs=function(i,n,s){var h=this;this.I.ln(e.ui.Focus,function(t){return t.call(h.Ls,i,n,s)})},s.prototype._s=function(t){t=e.X.Jt(new Date(t.getTime()));var i=this.I.getToday(),n=new e.Day(t);return n.isToday=t.getTime()===i.getTime(),n.isPast=t.getTime()<i.getTime(),n.isInValidity=this.I.isDateInValidity(t),n.isAvailable=n.isInValidity&&this.I.isDateAvailable(t),n.isAvailable&&(n.isEqualToDate(this.at)&&(n.isSelected=!0),n.isEqualToDay(this.$s)&&(n.isHighlighted=!0,this.Ks&&(n.isFocused=!0,this.Ks=!1))),this.I.modifyDay(n),n},s.prototype.th=function(t){switch(t){case e.Ht.Left:return i.Left;case e.Ht.Up:return i.Up;case e.Ht.Right:return i.Right;case e.Ht.Down:return i.Down;default:throw new Error("Invalid key code: "+t)}},s);function s(t,i){this.I=t,this.Ls=i,this.at=null,this.Ys=null,this.$s=null,this.Ks=!1,this.Ps=!1,this.Os=new e.Cs(this.I,new e.ri(this.I),i.container,null!==i.input)}e.jt=n}(TheDatepicker=TheDatepicker||{});