/* =========================================================
 * bootstrap-datetimepicker.js
 * =========================================================
 * Copyright 2012 Stefan Petre
 * Improvements by Andrew Rowls
 * Improvements by Sébastien Malot
 * Improvements by Yun Lai
 * Improved by Keenthemes for Bootstrap 3.0 Support

 * Project URL : http://www.malot.fr/bootstrap-datetimepicker
 *
 * 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
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */
!function(e){function r(){return new Date(Date.UTC.apply(Date,arguments))}var p=function(a,c){var b=this;this.element=e(a);this.language=c.language||this.element.data("date-language")||"en";this.language=this.language in h?this.language:"en";this.isRTL=h[this.language].rtl||"rtl"==e("body").css("direction");this.formatType=c.formatType||this.element.data("format-type")||"standard";this.format=f.parseFormat(c.format||this.element.data("date-format")||h[this.language].format||f.getDefaultFormat(this.formatType,"input"),this.formatType);this.isVisible=this.isInline=!1;this.isInput=this.element.is("input");this.component=this.element.is(".date")?this.element.find(".date-set").parent():!1;this.componentReset=this.element.is(".date")?this.element.find(".date-reset").parent():!1;this.hasInput=this.component&&this.element.find("input").length;this.component&&0===this.component.length&&(this.component=!1);this.linkField=c.linkField||this.element.data("link-field")||!1;this.linkFormat=f.parseFormat(c.linkFormat||this.element.data("link-format")||f.getDefaultFormat(this.formatType,"link"),this.formatType);this.minuteStep=c.minuteStep||this.element.data("minute-step")||5;this.pickerPosition=c.pickerPosition||this.element.data("picker-position")||"bottom-right";this.showMeridian=c.showMeridian||this.element.data("show-meridian")||!1;this.initialDate=c.initialDate||new Date;this._attachEvents();this.formatViewType="datetime";"formatViewType"in c?this.formatViewType=c.formatViewType:"formatViewType"in this.element.data()&&(this.formatViewType=this.element.data("formatViewType"));this.minView=0;"minView"in c?this.minView=c.minView:"minView"in this.element.data()&&(this.minView=this.element.data("min-view"));this.minView=f.convertViewMode(this.minView);this.maxView=f.modes.length-1;"maxView"in c?this.maxView=c.maxView:"maxView"in this.element.data()&&(this.maxView=this.element.data("max-view"));this.maxView=f.convertViewMode(this.maxView);this.wheelViewModeNavigation=!1;"wheelViewModeNavigation"in c?this.wheelViewModeNavigation=c.wheelViewModeNavigation:"wheelViewModeNavigation"in this.element.data()&&(this.wheelViewModeNavigation=this.element.data("view-mode-wheel-navigation"));this.wheelViewModeNavigationInverseDirection=!1;"wheelViewModeNavigationInverseDirection"in c?this.wheelViewModeNavigationInverseDirection=c.wheelViewModeNavigationInverseDirection:"wheelViewModeNavigationInverseDirection"in this.element.data()&&(this.wheelViewModeNavigationInverseDirection=this.element.data("view-mode-wheel-navigation-inverse-dir"));this.wheelViewModeNavigationDelay=100;"wheelViewModeNavigationDelay"in c?this.wheelViewModeNavigationDelay=c.wheelViewModeNavigationDelay:"wheelViewModeNavigationDelay"in this.element.data()&&(this.wheelViewModeNavigationDelay=this.element.data("view-mode-wheel-navigation-delay"));this.startViewMode=2;"startView"in c?this.startViewMode=c.startView:"startView"in this.element.data()&&(this.startViewMode=this.element.data("start-view"));this.viewMode=this.startViewMode=f.convertViewMode(this.startViewMode);this.viewSelect=this.minView;"viewSelect"in c?this.viewSelect=c.viewSelect:"viewSelect"in this.element.data()&&(this.viewSelect=this.element.data("view-select"));this.viewSelect=f.convertViewMode(this.viewSelect);this.forceParse=!0;"forceParse"in c?this.forceParse=c.forceParse:"dateForceParse"in this.element.data()&&(this.forceParse=this.element.data("date-force-parse"));this.picker=e(f.template).appendTo(this.isInline?this.element:"body").on({click:e.proxy(this.click,this),mousedown:e.proxy(this.mousedown,this)});if(this.wheelViewModeNavigation)if(e.fn.mousewheel)this.picker.on({mousewheel:e.proxy(this.mousewheel,this)});else console.log("Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option");this.isInline?this.picker.addClass("datetimepicker-inline"):this.picker.addClass("datetimepicker-dropdown-"+this.pickerPosition+" dropdown-menu");this.isRTL&&(this.picker.addClass("datetimepicker-rtl"),this.picker.find(".prev i, .next i").toggleClass("fa-arrow-left fa-arrow-right"));e(document).on("mousedown",function(a){0===e(a.target).closest(".datetimepicker").length&&b.hide()});this.autoclose=!1;"autoclose"in c?this.autoclose=c.autoclose:"dateAutoclose"in this.element.data()&&(this.autoclose=this.element.data("date-autoclose"));this.keyboardNavigation=!0;"keyboardNavigation"in c?this.keyboardNavigation=c.keyboardNavigation:"dateKeyboardNavigation"in this.element.data()&&(this.keyboardNavigation=this.element.data("date-keyboard-navigation"));this.todayBtn=c.todayBtn||this.element.data("date-today-btn")||!1;this.todayHighlight=c.todayHighlight||this.element.data("date-today-highlight")||!1;this.weekStart=(c.weekStart||this.element.data("date-weekstart")||h[this.language].weekStart||0)%7;this.weekEnd=(this.weekStart+6)%7;this.startDate=-Infinity;this.endDate=Infinity;this.daysOfWeekDisabled=[];this.setStartDate(c.startDate||this.element.data("date-startdate"));this.setEndDate(c.endDate||this.element.data("date-enddate"));this.setDaysOfWeekDisabled(c.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();this.isInline&&this.show()};p.prototype={constructor:p,_events:[],_attachEvents:function(){this._detachEvents();this.isInput?this._events=[[this.element,{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}]]:this.component&&this.hasInput?(this._events=[[this.element.find("input"),{focus:e.proxy(this.show,this),keyup:e.proxy(this.update,this),keydown:e.proxy(this.keydown,this)}],[this.component,{click:e.proxy(this.show,this)}]],this.componentReset&&this._events.push([this.componentReset,{click:e.proxy(this.reset,this)}])):this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:e.proxy(this.show,this)}]];for(var a=0,c,b;a<this._events.length;a++)c=this._events[a][0],b=this._events[a][1],c.on(b)},_detachEvents:function(){for(var a=0,c,b;a<this._events.length;a++)c=this._events[a][0],b=this._events[a][1],c.off(b);this._events=[]},show:function(a){this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();this.forceParse&&this.update();this.place();e(window).on("resize",e.proxy(this.place,this));a&&(a.stopPropagation(),a.preventDefault());this.isVisible=!0;this.element.trigger({type:"show",date:this.date})},hide:function(a){this.isVisible&&!this.isInline&&(this.picker.hide(),e(window).off("resize",this.place),this.viewMode=this.startViewMode,this.showMode(),this.isInput||e(document).off("mousedown",this.hide),this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this.isVisible=!1,this.element.trigger({type:"hide",date:this.date}))},remove:function(){this._detachEvents();this.picker.remove();delete this.picker;delete this.element.data().datetimepicker},getDate:function(){var a=this.getUTCDate();return new Date(a.getTime()+6E4*a.getTimezoneOffset())},getUTCDate:function(){return this.date},setDate:function(a){this.setUTCDate(new Date(a.getTime()-6E4*a.getTimezoneOffset()))},setUTCDate:function(a){a>=this.startDate&&a<=this.endDate?(this.date=a,this.setValue(),this.viewDate=this.date,this.fill()):this.element.trigger({type:"outOfRange",date:a,startDate:this.startDate,endDate:this.endDate})},setFormat:function(a){this.format=f.parseFormat(a,this.formatType);var c;this.isInput?c=this.element:this.component&&(c=this.element.find("input"));c&&c.val()&&this.setValue()},setValue:function(){var a=this.getFormattedDate();this.isInput?this.element.val(a):(this.component&&this.element.find("input").val(a),this.element.data("date",a));this.linkField&&e("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))},getFormattedDate:function(a){void 0==a&&(a=this.format);return f.formatDate(this.date,a,this.language,this.formatType)},setStartDate:function(a){this.startDate=a||-Infinity;-Infinity!==this.startDate&&(this.startDate=f.parseDate(this.startDate,this.format,this.language,this.formatType));this.update();this.updateNavArrows()},setEndDate:function(a){this.endDate=a||Infinity;Infinity!==this.endDate&&(this.endDate=f.parseDate(this.endDate,this.format,this.language,this.formatType));this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(a){this.daysOfWeekDisabled=a||[];e.isArray(this.daysOfWeekDisabled)||(this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/));this.daysOfWeekDisabled=e.map(this.daysOfWeekDisabled,function(a){return parseInt(a,10)});this.update();this.updateNavArrows()},place:function(){if(!this.isInline){var a=parseInt(this.element.parents().filter(function(){return"auto"!=e(this).css("z-index")}).first().css("z-index"))+10,c,b;if(this.component){if(c=this.component.offset(),b=c.left,"bottom-left"==this.pickerPosition||"top-left"==this.pickerPosition)b+=this.component.outerWidth()-this.picker.outerWidth()}else c=this.element.offset(),b=c.left;c="top-left"==this.pickerPosition||"top-right"==this.pickerPosition?c.top-this.picker.outerHeight():c.top+this.height;this.picker.css({top:c,left:b,zIndex:a})}},update:function(){var a,c=!1;arguments&&arguments.length&&("string"===typeof arguments[0]||arguments[0]instanceof Date)?(a=arguments[0],c=!0):a=this.element.data("date")||(this.isInput?this.element.val():this.element.find("input").val())||this.initialDate;a||(a=new Date,c=!1);this.date=f.parseDate(a,this.format,this.language,this.formatType);c&&this.setValue();this.viewDate=this.date<this.startDate?new Date(this.startDate):this.date>this.endDate?new Date(this.endDate):new Date(this.date);this.fill()},fillDow:function(){for(var a=this.weekStart,c="\x3ctr\x3e";a<this.weekStart+7;)c+='\x3cth class\x3d"dow"\x3e'+h[this.language].daysMin[a++%7]+"\x3c/th\x3e";c+="\x3c/tr\x3e";this.picker.find(".datetimepicker-days thead").append(c)},fillMonths:function(){for(var a="",c=0;12>c;)a+='\x3cspan class\x3d"month"\x3e'+h[this.language].monthsShort[c++]+"\x3c/span\x3e";this.picker.find(".datetimepicker-months td").html(a)},fill:function(){if(null!=this.date&&null!=this.viewDate){var a=new Date(this.viewDate),c=a.getUTCFullYear(),b=a.getUTCMonth(),d=a.getUTCDate(),g=a.getUTCHours(),t=a.getUTCMinutes(),a=-Infinity!==this.startDate?this.startDate.getUTCFullYear():-Infinity,v=-Infinity!==this.startDate?this.startDate.getUTCMonth():-Infinity,w=Infinity!==this.endDate?this.endDate.getUTCFullYear():Infinity,u=Infinity!==this.endDate?this.endDate.getUTCMonth():Infinity,l=(new r(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),q=new Date;this.picker.find(".datetimepicker-days thead th:eq(1)").text(h[this.language].months[b]+" "+c);if("time"==this.formatViewType){var m=g%12?g%12:12,m=(10>m?"0":"")+m,n=(10>t?"0":"")+t,k=h[this.language].meridiem[12>g?0:1];this.picker.find(".datetimepicker-hours thead th:eq(1)").text(m+":"+n+" "+k.toUpperCase());this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(m+":"+n+" "+k.toUpperCase())}else this.picker.find(".datetimepicker-hours thead th:eq(1)").text(d+" "+h[this.language].months[b]+" "+c),this.picker.find(".datetimepicker-minutes thead th:eq(1)").text(d+" "+h[this.language].months[b]+" "+c);this.picker.find("tfoot th.today").text(h[this.language].today).toggle(!1!==this.todayBtn);this.updateNavArrows();this.fillMonths();k=r(c,b-1,28,0,0,0,0);m=f.getDaysInMonth(k.getUTCFullYear(),k.getUTCMonth());k.setUTCDate(m);k.setUTCDate(m-(k.getUTCDay()-this.weekStart+7)%7);var p=new Date(k);p.setUTCDate(p.getUTCDate()+42);p=p.valueOf();for(m=[];k.valueOf()<p;){k.getUTCDay()==this.weekStart&&m.push("\x3ctr\x3e");n="";if(k.getUTCFullYear()<c||k.getUTCFullYear()==c&&k.getUTCMonth()<b)n+=" old";else if(k.getUTCFullYear()>c||k.getUTCFullYear()==c&&k.getUTCMonth()>b)n+=" new";this.todayHighlight&&k.getUTCFullYear()==q.getFullYear()&&k.getUTCMonth()==q.getMonth()&&k.getUTCDate()==q.getDate()&&(n+=" today");k.valueOf()==l&&(n+=" active");if(k.valueOf()+864E5<=this.startDate||k.valueOf()>this.endDate||-1!==e.inArray(k.getUTCDay(),this.daysOfWeekDisabled))n+=" disabled";m.push('\x3ctd class\x3d"day'+n+'"\x3e'+k.getUTCDate()+"\x3c/td\x3e");k.getUTCDay()==this.weekEnd&&m.push("\x3c/tr\x3e");k.setUTCDate(k.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(m.join(""));m=[];q="";for(l=0;24>l;l++)k=r(c,b,d,l),n="",k.valueOf()+36E5<=this.startDate||k.valueOf()>this.endDate?n+=" disabled":g==l&&(n+=" active"),this.showMeridian&&2==h[this.language].meridiem.length?(k=12>l?h[this.language].meridiem[0]:h[this.language].meridiem[1],k!=q&&(""!=q&&m.push("\x3c/fieldset\x3e"),m.push('\x3cfieldset class\x3d"hour"\x3e\x3clegend\x3e'+k.toUpperCase()+"\x3c/legend\x3e")),q=k,k=l%12?l%12:12,m.push('\x3cspan class\x3d"hour'+n+" hour_"+(12>l?"am":"pm")+'"\x3e'+k+"\x3c/span\x3e"),23==l&&m.push("\x3c/fieldset\x3e")):(k=l+":00",m.push('\x3cspan class\x3d"hour'+n+'"\x3e'+k+"\x3c/span\x3e"));this.picker.find(".datetimepicker-hours td").html(m.join(""));m=[];q="";for(l=0;60>l;l+=this.minuteStep)k=r(c,b,d,g,l,0),n="",k.valueOf()<this.startDate||k.valueOf()>this.endDate?n+=" disabled":Math.floor(t/this.minuteStep)==Math.floor(l/this.minuteStep)&&(n+=" active"),this.showMeridian&&2==h[this.language].meridiem.length?(k=12>g?h[this.language].meridiem[0]:h[this.language].meridiem[1],k!=q&&(""!=q&&m.push("\x3c/fieldset\x3e"),m.push('\x3cfieldset class\x3d"minute"\x3e\x3clegend\x3e'+k.toUpperCase()+"\x3c/legend\x3e")),q=k,k=g%12?g%12:12,m.push('\x3cspan class\x3d"minute'+n+'"\x3e'+k+":"+(10>l?"0"+l:l)+"\x3c/span\x3e"),59==l&&m.push("\x3c/fieldset\x3e")):m.push('\x3cspan class\x3d"minute'+n+'"\x3e'+g+":"+(10>l?"0"+l:l)+"\x3c/span\x3e");this.picker.find(".datetimepicker-minutes td").html(m.join(""));b=this.date.getUTCFullYear();d=this.picker.find(".datetimepicker-months").find("th:eq(1)").text(c).end().find("span").removeClass("active");b==c&&d.eq(this.date.getUTCMonth()).addClass("active");(c<a||c>w)&&d.addClass("disabled");c==a&&d.slice(0,v).addClass("disabled");c==w&&d.slice(u+1).addClass("disabled");m="";c=10*parseInt(c/10,10);v=this.picker.find(".datetimepicker-years").find("th:eq(1)").text(c+"-"+(c+9)).end().find("td");--c;for(l=-1;11>l;l++)m+='\x3cspan class\x3d"year'+(-1==l||10==l?" old":"")+(b==c?" active":"")+(c<a||c>w?" disabled":"")+'"\x3e'+c+"\x3c/span\x3e",c+=1;v.html(m);this.place()}},updateNavArrows:function(){var a=new Date(this.viewDate),c=a.getUTCFullYear(),b=a.getUTCMonth(),d=a.getUTCDate(),a=a.getUTCHours();switch(this.viewMode){case 0:-Infinity!==this.startDate&&c<=this.startDate.getUTCFullYear()&&b<=this.startDate.getUTCMonth()&&d<=this.startDate.getUTCDate()&&a<=this.startDate.getUTCHours()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"});Infinity!==this.endDate&&c>=this.endDate.getUTCFullYear()&&b>=this.endDate.getUTCMonth()&&d>=this.endDate.getUTCDate()&&a>=this.endDate.getUTCHours()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:-Infinity!==this.startDate&&c<=this.startDate.getUTCFullYear()&&b<=this.startDate.getUTCMonth()&&d<=this.startDate.getUTCDate()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"});Infinity!==this.endDate&&c>=this.endDate.getUTCFullYear()&&b>=this.endDate.getUTCMonth()&&d>=this.endDate.getUTCDate()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 2:-Infinity!==this.startDate&&c<=this.startDate.getUTCFullYear()&&b<=this.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"});Infinity!==this.endDate&&c>=this.endDate.getUTCFullYear()&&b>=this.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 3:case 4:-Infinity!==this.startDate&&c<=this.startDate.getUTCFullYear()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),Infinity!==this.endDate&&c>=this.endDate.getUTCFullYear()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}},mousewheel:function(a){a.preventDefault();a.stopPropagation();this.wheelPause||(this.wheelPause=!0,a=a.originalEvent.wheelDelta,a=0<a?1:0===a?0:-1,this.wheelViewModeNavigationInverseDirection&&(a=-a),this.showMode(a),setTimeout(e.proxy(function(){this.wheelPause=!1},this),this.wheelViewModeNavigationDelay))},click:function(a){a.stopPropagation();a.preventDefault();a=e(a.target).closest("span, td, th, legend");if(1==a.length)if(a.is(".disabled"))this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});else switch(a[0].nodeName.toLowerCase()){case "th":switch(a[0].className){case "switch":this.showMode(1);break;case "prev":case "next":a=f.modes[this.viewMode].navStep*("prev"==a[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,a);break;case 1:this.viewDate=this.moveDate(this.viewDate,a);break;case 2:this.viewDate=this.moveMonth(this.viewDate,a);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,a)}this.fill();break;case "today":a=new Date,a=r(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),0),this.viewMode=this.startViewMode,this.showMode(0),this._setDate(a),this.fill(),this.autoclose&&this.hide()}break;case "span":if(!a.is(".disabled")){var c=this.viewDate.getUTCFullYear(),b=this.viewDate.getUTCMonth(),d=this.viewDate.getUTCDate(),g=this.viewDate.getUTCHours(),t=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds();if(a.is(".month"))this.viewDate.setUTCDate(1),b=a.parent().find("span").index(a),d=this.viewDate.getUTCDate(),this.viewDate.setUTCMonth(b),this.element.trigger({type:"changeMonth",date:this.viewDate}),3<=this.viewSelect&&this._setDate(r(c,b,d,g,t,h,0));else if(a.is(".year"))this.viewDate.setUTCDate(1),c=parseInt(a.text(),10)||0,this.viewDate.setUTCFullYear(c),this.element.trigger({type:"changeYear",date:this.viewDate}),4<=this.viewSelect&&this._setDate(r(c,b,d,g,t,h,0));else if(a.is(".hour")){g=parseInt(a.text(),10)||0;if(a.hasClass("hour_am")||a.hasClass("hour_pm"))12==g&&a.hasClass("hour_am")?g=0:12!=g&&a.hasClass("hour_pm")&&(g+=12);this.viewDate.setUTCHours(g);this.element.trigger({type:"changeHour",date:this.viewDate});1<=this.viewSelect&&this._setDate(r(c,b,d,g,t,h,0))}else a.is(".minute")&&(t=parseInt(a.text().substr(a.text().indexOf(":")+1),10)||0,this.viewDate.setUTCMinutes(t),this.element.trigger({type:"changeMinute",date:this.viewDate}),0<=this.viewSelect&&this._setDate(r(c,b,d,g,t,h,0)));0!=this.viewMode?(a=this.viewMode,this.showMode(-1),this.fill(),a==this.viewMode&&this.autoclose&&this.hide()):(this.fill(),this.autoclose&&this.hide())}break;case "td":a.is(".day")&&!a.is(".disabled")&&(d=parseInt(a.text(),10)||1,c=this.viewDate.getUTCFullYear(),b=this.viewDate.getUTCMonth(),g=this.viewDate.getUTCHours(),t=this.viewDate.getUTCMinutes(),h=this.viewDate.getUTCSeconds(),a.is(".old")?0===b?(b=11,--c):--b:a.is(".new")&&(11==b?(b=0,c+=1):b+=1),this.viewDate.setUTCFullYear(c),this.viewDate.setUTCMonth(b),this.viewDate.setUTCDate(d),this.element.trigger({type:"changeDay",date:this.viewDate}),2<=this.viewSelect&&this._setDate(r(c,b,d,g,t,h,0))),a=this.viewMode,this.showMode(-1),this.fill(),a==this.viewMode&&this.autoclose&&this.hide()}},_setDate:function(a,c){c&&"date"!=c||(this.date=a);c&&"view"!=c||(this.viewDate=a);this.fill();this.setValue();var b;this.isInput?b=this.element:this.component&&(b=this.element.find("input"));b&&b.change();this.element.trigger({type:"changeDate",date:this.date})},moveMinute:function(a,c){if(!c)return a;var b=new Date(a.valueOf());b.setUTCMinutes(b.getUTCMinutes()+c*this.minuteStep);return b},moveHour:function(a,c){if(!c)return a;var b=new Date(a.valueOf());b.setUTCHours(b.getUTCHours()+c);return b},moveDate:function(a,c){if(!c)return a;var b=new Date(a.valueOf());b.setUTCDate(b.getUTCDate()+c);return b},moveMonth:function(a,c){if(!c)return a;var b=new Date(a.valueOf()),d=b.getUTCDate(),g=b.getUTCMonth(),e=Math.abs(c),h;c=0<c?1:-1;if(1==e){if(e=-1==c?function(){return b.getUTCMonth()==g}:function(){return b.getUTCMonth()!=h},h=g+c,b.setUTCMonth(h),0>h||11<h)h=(h+12)%12}else{for(var f=0;f<e;f++)b=this.moveMonth(b,c);h=b.getUTCMonth();b.setUTCDate(d);e=function(){return h!=b.getUTCMonth()}}for(;e();)b.setUTCDate(--d),b.setUTCMonth(h);return b},moveYear:function(a,c){return this.moveMonth(a,12*c)},dateWithinRange:function(a){return a>=this.startDate&&a<=this.endDate},keydown:function(a){if(this.picker.is(":not(:visible)"))27==a.keyCode&&this.show();else{var c=!1,b,d,g;switch(a.keyCode){case 27:this.hide();a.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation)break;b=37==a.keyCode?-1:1;viewMode=this.viewMode;a.ctrlKey?viewMode+=2:a.shiftKey&&(viewMode+=1);4==viewMode?(d=this.moveYear(this.date,b),g=this.moveYear(this.viewDate,b)):3==viewMode?(d=this.moveMonth(this.date,b),g=this.moveMonth(this.viewDate,b)):2==viewMode?(d=this.moveDate(this.date,b),g=this.moveDate(this.viewDate,b)):1==viewMode?(d=this.moveHour(this.date,b),g=this.moveHour(this.viewDate,b)):0==viewMode&&(d=this.moveMinute(this.date,b),g=this.moveMinute(this.viewDate,b));this.dateWithinRange(d)&&(this.date=d,this.viewDate=g,this.setValue(),this.update(),a.preventDefault(),c=!0);break;case 38:case 40:if(!this.keyboardNavigation)break;b=38==a.keyCode?-1:1;viewMode=this.viewMode;a.ctrlKey?viewMode+=2:a.shiftKey&&(viewMode+=1);4==viewMode?(d=this.moveYear(this.date,b),g=this.moveYear(this.viewDate,b)):3==viewMode?(d=this.moveMonth(this.date,b),g=this.moveMonth(this.viewDate,b)):2==viewMode?(d=this.moveDate(this.date,7*b),g=this.moveDate(this.viewDate,7*b)):1==viewMode?this.showMeridian?(d=this.moveHour(this.date,6*b),g=this.moveHour(this.viewDate,6*b)):(d=this.moveHour(this.date,4*b),g=this.moveHour(this.viewDate,4*b)):0==viewMode&&(d=this.moveMinute(this.date,4*b),g=this.moveMinute(this.viewDate,4*b));this.dateWithinRange(d)&&(this.date=d,this.viewDate=g,this.setValue(),this.update(),a.preventDefault(),c=!0);break;case 13:0!=this.viewMode?(b=this.viewMode,this.showMode(-1),this.fill(),b==this.viewMode&&this.autoclose&&this.hide()):(this.fill(),this.autoclose&&this.hide());a.preventDefault();break;case 9:this.hide()}if(c){var e;this.isInput?e=this.element:this.component&&(e=this.element.find("input"));e&&e.change();this.element.trigger({type:"changeDate",date:this.date})}}},showMode:function(a){a&&(a=Math.max(0,Math.min(f.modes.length-1,this.viewMode+a)),a>=this.minView&&a<=this.maxView&&(this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:a}),this.viewMode=a));this.picker.find("\x3ediv").hide().filter(".datetimepicker-"+f.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(a){this._setDate(null,"date")}};e.fn.datetimepicker=function(a){var c=Array.apply(null,arguments);c.shift();return this.each(function(){var b=e(this),d=b.data("datetimepicker"),g="object"==typeof a&&a;d||b.data("datetimepicker",d=new p(this,e.extend({},e.fn.datetimepicker.defaults,g)));"string"==typeof a&&"function"==typeof d[a]&&d[a].apply(d,c)})};e.fn.datetimepicker.defaults={};e.fn.datetimepicker.Constructor=p;finecms_datepicker_lang.suffix=[];finecms_datepicker_lang.meridiem=[];var h=e.fn.datetimepicker.dates={en:finecms_datepicker_lang},f={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(a){return 0===a%4&&0!==a%100||0===a%400},getDaysInMonth:function(a,c){return[31,f.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][c]},getDefaultFormat:function(a,c){if("standard"==a)return"input"==c?"yyyy-mm-dd hh:ii":"yyyy-mm-dd hh:ii:ss";if("php"==a)return"input"==c?"Y-m-d H:i":"Y-m-d H:i:s";throw Error("Invalid format type.");},validParts:function(a){if("standard"==a)return/hh?|HH?|p|P|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g;if("php"==a)return/[dDjlNwzFmMnStyYaABgGhHis]/g;throw Error("Invalid format type.");},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(a,c){var b=a.replace(this.validParts(c),"\x00").split("\x00"),d=a.match(this.validParts(c));if(!b||!b.length||!d||0==d.length)throw Error("Invalid date format.");return{separators:b,parts:d}},parseDate:function(a,c,b,d){if(a instanceof Date)return a=new Date(a.valueOf()-6E4*a.getTimezoneOffset()),a.setMilliseconds(0),a;/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(a)&&(c=this.parseFormat("yyyy-mm-dd",d));/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(a)&&(c=this.parseFormat("yyyy-mm-dd hh:ii",d));/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(a)&&(c=this.parseFormat("yyyy-mm-dd hh:ii:ss",d));if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(a)){c=/([-+]\d+)([dmwy])/;var g=a.match(/([-+]\d+)([dmwy])/g);a=new Date;for(var f=0;f<g.length;f++)switch(d=c.exec(g[f]),b=parseInt(d[1]),d[2]){case "d":a.setUTCDate(a.getUTCDate()+b);break;case "m":a=p.prototype.moveMonth.call(p.prototype,a,b);break;case "w":a.setUTCDate(a.getUTCDate()+7*b);break;case "y":a=p.prototype.moveYear.call(p.prototype,a,b)}return r(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),0)}g=a&&a.match(this.nonpunctuation)||[];a=new Date(0,0,0,0,0,0,0);var v={},w="hh h ii i ss s yyyy yy M MM m mm D DD d dd H HH p P".split(" "),u={hh:function(a,b){return a.setUTCHours(b)},h:function(a,b){return a.setUTCHours(b)},HH:function(a,b){return a.setUTCHours(12==b?0:b)},H:function(a,b){return a.setUTCHours(12==b?0:b)},ii:function(a,b){return a.setUTCMinutes(b)},i:function(a,b){return a.setUTCMinutes(b)},ss:function(a,b){return a.setUTCSeconds(b)},s:function(a,b){return a.setUTCSeconds(b)},yyyy:function(a,b){return a.setUTCFullYear(b)},yy:function(a,b){return a.setUTCFullYear(2E3+b)},m:function(a,b){for(--b;0>b;)b+=12;b%=12;for(a.setUTCMonth(b);a.getUTCMonth()!=b;)a.setUTCDate(a.getUTCDate()-1);return a},d:function(a,b){return a.setUTCDate(b)},p:function(a,b){return a.setUTCHours(1==b?a.getUTCHours()+12:a.getUTCHours())}},l;u.M=u.MM=u.mm=u.m;u.dd=u.d;u.P=u.p;a=r(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds());if(g.length==c.parts.length){for(var f=0,q=c.parts.length;f<q;f++){l=parseInt(g[f],10);d=c.parts[f];if(isNaN(l))switch(d){case "MM":l=e(h[b].months).filter(function(){var a=this.slice(0,g[f].length),b=g[f].slice(0,a.length);return a==b});l=e.inArray(l[0],h[b].months)+1;break;case "M":l=e(h[b].monthsShort).filter(function(){var a=this.slice(0,g[f].length),b=g[f].slice(0,a.length);return a==b});l=e.inArray(l[0],h[b].monthsShort)+1;break;case "p":case "P":l=e.inArray(g[f].toLowerCase(),h[b].meridiem)}v[d]=l}for(f=0;f<w.length;f++)if(d=w[f],d in v&&!isNaN(v[d]))u[d](a,v[d])}return a},formatDate:function(a,c,b,d){if(null==a)return"";if("standard"==d)b={yy:a.getUTCFullYear().toString().substring(2),yyyy:a.getUTCFullYear(),m:a.getUTCMonth()+1,M:h[b].monthsShort[a.getUTCMonth()],MM:h[b].months[a.getUTCMonth()],d:a.getUTCDate(),D:h[b].daysShort[a.getUTCDay()],DD:h[b].days[a.getUTCDay()],p:2==h[b].meridiem.length?h[b].meridiem[12>a.getUTCHours()?0:1]:"",h:a.getUTCHours(),i:a.getUTCMinutes(),s:a.getUTCSeconds()},b.H=0==b.h%12?12:b.h%12,b.HH=(10>b.H?"0":"")+b.H,b.P=b.p.toUpperCase(),b.hh=(10>b.h?"0":"")+b.h,b.ii=(10>b.i?"0":"")+b.i,b.ss=(10>b.s?"0":"")+b.s,b.dd=(10>b.d?"0":"")+b.d,b.mm=(10>b.m?"0":"")+b.m;else if("php"==d)b={y:a.getUTCFullYear().toString().substring(2),Y:a.getUTCFullYear(),F:h[b].months[a.getUTCMonth()],M:h[b].monthsShort[a.getUTCMonth()],n:a.getUTCMonth()+1,t:f.getDaysInMonth(a.getUTCFullYear(),a.getUTCMonth()),j:a.getUTCDate(),l:h[b].days[a.getUTCDay()],D:h[b].daysShort[a.getUTCDay()],w:a.getUTCDay(),N:0==a.getUTCDay()?7:a.getUTCDay(),S:a.getUTCDate()%10<=h[b].suffix.length?h[b].suffix[a.getUTCDate()%10-1]:"",a:2==h[b].meridiem.length?h[b].meridiem[12>a.getUTCHours()?0:1]:"",g:0==a.getUTCHours()%12?12:a.getUTCHours()%12,G:a.getUTCHours(),i:a.getUTCMinutes(),s:a.getUTCSeconds()},b.m=(10>b.n?"0":"")+b.n,b.d=(10>b.j?"0":"")+b.j,b.A=b.a.toString().toUpperCase(),b.h=(10>b.g?"0":"")+b.g,b.H=(10>b.G?"0":"")+b.G,b.i=(10>b.i?"0":"")+b.i,b.s=(10>b.s?"0":"")+b.s;else throw Error("Invalid format type.");a=[];d=e.extend([],c.separators);for(var g=0,p=c.parts.length;g<p;g++)d.length&&a.push(d.shift()),a.push(b[c.parts[g]]);return a.join("")},convertViewMode:function(a){switch(a){case 4:case "decade":a=4;break;case 3:case "year":a=3;break;case 2:case "month":a=2;break;case 1:case "day":a=1;break;case 0:case "hour":a=0}return a},headTemplate:'\x3cthead\x3e\x3ctr\x3e\x3cth class\x3d"prev"\x3e\x3ci class\x3d"fa fa-angle-left"/\x3e\x3c/th\x3e\x3cth colspan\x3d"5" class\x3d"switch"\x3e\x3c/th\x3e\x3cth class\x3d"next"\x3e\x3ci class\x3d"fa fa-angle-right"/\x3e\x3c/th\x3e\x3c/tr\x3e\x3c/thead\x3e',contTemplate:'\x3ctbody\x3e\x3ctr\x3e\x3ctd colspan\x3d"7"\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/tbody\x3e',footTemplate:'\x3ctfoot\x3e\x3ctr\x3e\x3cth colspan\x3d"7" class\x3d"today"\x3e\x3c/th\x3e\x3c/tr\x3e\x3c/tfoot\x3e'};f.template='\x3cdiv class\x3d"datetimepicker"\x3e\x3cdiv class\x3d"datetimepicker-minutes"\x3e\x3ctable class\x3d" table-condensed"\x3e'+f.headTemplate+f.contTemplate+f.footTemplate+'\x3c/table\x3e\x3c/div\x3e\x3cdiv class\x3d"datetimepicker-hours"\x3e\x3ctable class\x3d" table-condensed"\x3e'+f.headTemplate+f.contTemplate+f.footTemplate+'\x3c/table\x3e\x3c/div\x3e\x3cdiv class\x3d"datetimepicker-days"\x3e\x3ctable class\x3d" table-condensed"\x3e'+f.headTemplate+"\x3ctbody\x3e\x3c/tbody\x3e"+f.footTemplate+'\x3c/table\x3e\x3c/div\x3e\x3cdiv class\x3d"datetimepicker-months"\x3e\x3ctable class\x3d"table-condensed"\x3e'+f.headTemplate+f.contTemplate+f.footTemplate+'\x3c/table\x3e\x3c/div\x3e\x3cdiv class\x3d"datetimepicker-years"\x3e\x3ctable class\x3d"table-condensed"\x3e'+f.headTemplate+f.contTemplate+f.footTemplate+"\x3c/table\x3e\x3c/div\x3e\x3c/div\x3e";e.fn.datetimepicker.DPGlobal=f;e.fn.datetimepicker.noConflict=function(){e.fn.datetimepicker=old;return this};e(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide\x3d"datetimepicker"]',function(a){var c=e(this);c.data("datetimepicker")||(a.preventDefault(),c.datetimepicker("show"))});e(function(){e('[data-provide\x3d"datetimepicker-inline"]').datetimepicker()})}(window.jQuery);