text: !function(d,h){var t="bootstrapMaterialDatePicker",i="plugin_"+t;function a(t,e){this.currentView=0,this.minDate,this.maxDate,this._attachedEvents=[],this.element=t,this.$element=d(t),this.params={date:!0,time:!0,format:"YYYY-MM-DD",minDate:null,maxDate:null,currentDate:null,lang:"en",weekStart:0,disabledDays:[],shortTime:!1,clearButton:!1,nowButton:!1,cancelText:"Cancel",okText:"OK",clearText:"Clear",nowText:"Now",switchOnClick:!1,triggerEvent:"focus",monthPicker:!1,year:!0},this.params=d.fn.extend(this.params,e),this.name="dtp_"+this.setName(),this.$element.attr("data-dtp",this.name),h.locale(this.params.lang),this.init()}h.locale("en"),d.fn[t]=function(t,e){return this.each(function(){d.data(this,i)?("function"==typeof d.data(this,i)[t]&&d.data(this,i)[t](e),"destroy"===t&&d.data(this,i)):d.data(this,i,new a(this,t))}),this},a.prototype={init:function(){this.initDays(),this.initDates(),this.initTemplate(),this.initButtons(),this._attachEvent(d(window),"resize",this._centerBox.bind(this)),this._attachEvent(this.$dtpElement.find(".dtp-content"),"click",this._onElementClick.bind(this)),this._attachEvent(this.$dtpElement,"click",this._onBackgroundClick.bind(this)),this._attachEvent(this.$dtpElement.find(".dtp-close > a"),"click",this._onCloseClick.bind(this)),this._attachEvent(this.$element,this.params.triggerEvent,this._fireCalendar.bind(this))},initDays:function(){this.days=[];for(var t=this.params.weekStart;this.days.length<7;t++)6<t&&(t=0),this.days.push(t.toString())},initDates:function(){if(0<this.$element.val().length)void 0!==this.params.format&&null!==this.params.format?this.currentDate=h(this.$element.val(),this.params.format).locale(this.params.lang):this.currentDate=h(this.$element.val()).locale(this.params.lang);else if(void 0!==this.$element.attr("value")&&null!==this.$element.attr("value")&&""!==this.$element.attr("value"))"string"==typeof this.$element.attr("value")&&(void 0!==this.params.format&&null!==this.params.format?this.currentDate=h(this.$element.attr("value"),this.params.format).locale(this.params.lang):this.currentDate=h(this.$element.attr("value")).locale(this.params.lang));else if(void 0!==this.params.currentDate&&null!==this.params.currentDate){if("string"==typeof this.params.currentDate)void 0!==this.params.format&&null!==this.params.format?this.currentDate=h(this.params.currentDate,this.params.format).locale(this.params.lang):this.currentDate=h(this.params.currentDate).locale(this.params.lang);else if(void 0===this.params.currentDate.isValid||"function"!=typeof this.params.currentDate.isValid){var t=this.params.currentDate.getTime();this.currentDate=h(t,"x").locale(this.params.lang)}else this.currentDate=this.params.currentDate;this.$element.val(this.currentDate.format(this.params.format))}else this.currentDate=h();if(void 0!==this.params.minDate&&null!==this.params.minDate)if("string"==typeof this.params.minDate)void 0!==this.params.format&&null!==this.params.format?this.minDate=h(this.params.minDate,this.params.format).locale(this.params.lang):this.minDate=h(this.params.minDate).locale(this.params.lang);else if(void 0===this.params.minDate.isValid||"function"!=typeof this.params.minDate.isValid){t=this.params.minDate.getTime();this.minDate=h(t,"x").locale(this.params.lang)}else this.minDate=this.params.minDate;else null===this.params.minDate&&(this.minDate=null);if(void 0!==this.params.maxDate&&null!==this.params.maxDate)if("string"==typeof this.params.maxDate)void 0!==this.params.format&&null!==this.params.format?this.maxDate=h(this.params.maxDate,this.params.format).locale(this.params.lang):this.maxDate=h(this.params.maxDate).locale(this.params.lang);else if(void 0===this.params.maxDate.isValid||"function"!=typeof this.params.maxDate.isValid){t=this.params.maxDate.getTime();this.maxDate=h(t,"x").locale(this.params.lang)}else this.maxDate=this.params.maxDate;else null===this.params.maxDate&&(this.maxDate=null);this.isAfterMinDate(this.currentDate)||(this.currentDate=h(this.minDate)),this.isBeforeMaxDate(this.currentDate)||(this.currentDate=h(this.maxDate))},initTemplate:function(){for(var t="",e=this.currentDate.year(),i=e-3;i<e+4;i++)t+='<div class="year-picker-item" data-year="'+i+'">'+i+"</div>";this.midYear=e;var a='<div class="dtp-picker-year hidden" ><div><a href="javascript:void(0);" class="btn btn-default dtp-select-year-range before" style="margin: 0;"><i class="material-icons">keyboard_arrow_up</i></a></div>'+t+'<div><a href="javascript:void(0);" class="btn btn-default dtp-select-year-range after" style="margin: 0;"><i class="material-icons">keyboard_arrow_down</i></a></div></div>';this.template='<div class="dtp hidden" id="'+this.name+'"><div class="dtp-content"><div class="dtp-date-view"><header class="dtp-header"><div class="dtp-actual-day">Lundi</div><div class="dtp-close"><a href="javascript:void(0);"><i class="material-icons">clear</i></a></div></header><div class="dtp-date hidden"><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-month-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-month p80">MAR</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-month-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div><div class="dtp-actual-num">13</div><div><div class="left center p10"><a href="javascript:void(0);" class="dtp-select-year-before"><i class="material-icons">chevron_left</i></a></div><div class="dtp-actual-year p80'+(this.params.year?"":" disabled")+'">2014</div><div class="right center p10"><a href="javascript:void(0);" class="dtp-select-year-after"><i class="material-icons">chevron_right</i></a></div><div class="clearfix"></div></div></div><div class="dtp-time hidden"><div class="dtp-actual-maxtime">23:55</div></div><div class="dtp-picker"><div class="dtp-picker-calendar"></div><div class="dtp-picker-datetime hidden"><div class="dtp-actual-meridien"><div class="left p20"><a class="dtp-meridien-am" href="javascript:void(0);">AM</a></div><div class="dtp-actual-time p60"></div><div class="right p20"><a class="dtp-meridien-pm" href="javascript:void(0);">PM</a></div><div class="clearfix"></div></div><div id="dtp-svg-clock"></div></div>'+a+'</div></div><div class="dtp-buttons"><button class="dtp-btn-now btn btn-flat hidden">'+this.params.nowText+'</button><button class="dtp-btn-clear btn btn-flat hidden">'+this.params.clearText+'</button><button class="dtp-btn-cancel btn btn-flat">'+this.params.cancelText+'</button><button class="dtp-btn-ok btn btn-flat">'+this.params.okText+'</button><div class="clearfix"></div></div></div></div>',d("body").find("#"+this.name).length<=0&&(d("body").append(this.template),this&&(this.dtpElement=d("body").find("#"+this.name)),this.$dtpElement=d(this.dtpElement))},initButtons:function(){this._attachEvent(this.$dtpElement.find(".dtp-btn-cancel"),"click",this._onCancelClick.bind(this)),this._attachEvent(this.$dtpElement.find(".dtp-btn-ok"),"click",this._onOKClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-month-before"),"click",this._onMonthBeforeClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-month-after"),"click",this._onMonthAfterClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-year-before"),"click",this._onYearBeforeClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-year-after"),"click",this._onYearAfterClick.bind(this)),this._attachEvent(this.$dtpElement.find(".dtp-actual-year"),"click",this._onActualYearClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-year-range.before"),"click",this._onYearRangeBeforeClick.bind(this)),this._attachEvent(this.$dtpElement.find("a.dtp-select-year-range.after"),"click",this._onYearRangeAfterClick.bind(this)),this._attachEvent(this.$dtpElement.find("div.year-picker-item"),"click",this._onYearItemClick.bind(this)),!0===this.params.clearButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-clear"),"click",this._onClearClick.bind(this)),this.$dtpElement.find(".dtp-btn-clear").removeClass("hidden")),!0===this.params.nowButton&&(this._attachEvent(this.$dtpElement.find(".dtp-btn-now"),"click",this._onNowClick.bind(this)),this.$dtpElement.find(".dtp-btn-now").removeClass("hidden")),!0===this.params.nowButton&&!0===this.params.clearButton?this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-xs"):!0!==this.params.nowButton&&!0!==this.params.clearButton||this.$dtpElement.find(".dtp-btn-clear, .dtp-btn-now, .dtp-btn-cancel, .dtp-btn-ok").addClass("btn-sm")},initMeridienButtons:function(){this.$dtpElement.find("a.dtp-meridien-am").off("click").on("click",this._onSelectAM.bind(this)),this.$dtpElement.find("a.dtp-meridien-pm").off("click").on("click",this._onSelectPM.bind(this))},initDate:function(t){this.currentView=0,!1===this.params.monthPicker&&this.$dtpElement.find(".dtp-picker-calendar").removeClass("hidden"),this.$dtpElement.find(".dtp-picker-datetime").addClass("hidden"),this.$dtpElement.find(".dtp-picker-year").addClass("hidden");var e=void 0!==this.currentDate&&null!==this.currentDate?this.currentDate:null,i=this.generateCalendar(this.currentDate);if(void 0!==i.week&&void 0!==i.days){var a=this.constructHTMLCalendar(e,i);this.$dtpElement.find("a.dtp-select-day").off("click"),this.$dtpElement.find(".dtp-picker-calendar").html(a),this.$dtpElement.find("a.dtp-select-day").on("click",this._onSelectDate.bind(this)),this.toggleButtons(e)}this._centerBox(),this.showDate(e)},initHours:function(){this.currentView=1,this.showTime(this.currentDate),this.initMeridienButtons(),this.currentDate.hour()<12?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click();var t=this.params.shortTime?"h":"H";this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden"),this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden"),this.$dtpElement.find(".dtp-picker-year").addClass("hidden");for(var e=this.createSVGClock(!0),i=0;i<12;i++){var a=-162*Math.sin(2*-Math.PI*(i/12)),s=-162*Math.cos(2*-Math.PI*(i/12)),n=this.currentDate.format(t)==i?"#8BC34A":"transparent",r=this.currentDate.format(t)==i?"#fff":"#000",d=this.createSVGElement("circle",{id:"h-"+i,class:"dtp-select-hour",style:"cursor:pointer",r:"30",cx:a,cy:s,fill:n,"data-hour":i});(h=this.createSVGElement("text",{id:"th-"+i,class:"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"20",x:a,y:s+7,fill:r,"data-hour":i})).textContent=0===i&&this.params.shortTime?12:i,this.toggleTime(i,!0)?(d.addEventListener("click",this._onSelectHour.bind(this)),h.addEventListener("click",this._onSelectHour.bind(this))):(d.className+=" disabled",h.className+=" disabled",h.setAttribute("fill","#bdbdbd")),e.appendChild(d),e.appendChild(h)}if(!this.params.shortTime){for(i=0;i<12;i++){var h;a=-110*Math.sin(2*-Math.PI*(i/12)),s=-110*Math.cos(2*-Math.PI*(i/12)),n=this.currentDate.format(t)==i+12?"#8BC34A":"transparent",r=this.currentDate.format(t)==i+12?"#fff":"#000",d=this.createSVGElement("circle",{id:"h-"+(i+12),class:"dtp-select-hour",style:"cursor:pointer",r:"30",cx:a,cy:s,fill:n,"data-hour":i+12});(h=this.createSVGElement("text",{id:"th-"+(i+12),class:"dtp-select-hour-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"22",x:a,y:s+7,fill:r,"data-hour":i+12})).textContent=i+12,this.toggleTime(i+12,!0)?(d.addEventListener("click",this._onSelectHour.bind(this)),h.addEventListener("click",this._onSelectHour.bind(this))):(d.className+=" disabled",h.className+=" disabled",h.setAttribute("fill","#bdbdbd")),e.appendChild(d),e.appendChild(h)}this.$dtpElement.find("a.dtp-meridien-am").addClass("hidden"),this.$dtpElement.find("a.dtp-meridien-pm").addClass("hidden")}this._centerBox()},initMinutes:function(){this.currentView=2,this.showTime(this.currentDate),this.initMeridienButtons(),this.currentDate.hour()<12?this.$dtpElement.find("a.dtp-meridien-am").click():this.$dtpElement.find("a.dtp-meridien-pm").click(),this.$dtpElement.find(".dtp-picker-year").addClass("hidden"),this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden"),this.$dtpElement.find(".dtp-picker-datetime").removeClass("hidden");for(var t=this.createSVGClock(!1),e=0;e<60;e++){var i=e%5==0?162:158,a=e%5==0?30:20,s=-i*Math.sin(2*-Math.PI*(e/60)),n=-i*Math.cos(2*-Math.PI*(e/60)),r=this.currentDate.format("m")==e?"#8BC34A":"transparent",d=this.createSVGElement("circle",{id:"m-"+e,class:"dtp-select-minute",style:"cursor:pointer",r:a,cx:s,cy:n,fill:r,"data-minute":e});this.toggleTime(e,!1)?d.addEventListener("click",this._onSelectMinute.bind(this)):d.className+=" disabled",t.appendChild(d)}for(e=0;e<60;e++)if(e%5==0){s=-162*Math.sin(2*-Math.PI*(e/60)),n=-162*Math.cos(2*-Math.PI*(e/60)),r=this.currentDate.format("m")==e?"#fff":"#000";var h=this.createSVGElement("text",{id:"tm-"+e,class:"dtp-select-minute-text","text-anchor":"middle",style:"cursor:pointer","font-weight":"bold","font-size":"20",x:s,y:n+7,fill:r,"data-minute":e});h.textContent=e,this.toggleTime(e,!1)?h.addEventListener("click",this._onSelectMinute.bind(this)):(h.className+=" disabled",h.setAttribute("fill","#bdbdbd")),t.appendChild(h)}this._centerBox()},animateHands:function(){var t=this.currentDate.hour(),e=this.currentDate.minute();this.$dtpElement.find(".hour-hand")[0].setAttribute("transform","rotate("+360*t/12+")"),this.$dtpElement.find(".minute-hand")[0].setAttribute("transform","rotate("+360*e/60+")")},createSVGClock:function(t){var e=this.params.shortTime?-120:-90,i=this.createSVGElement("svg",{class:"svg-clock",viewBox:"0,0,400,400"}),a=this.createSVGElement("g",{transform:"translate(200,200) "}),s=this.createSVGElement("circle",{r:"192",fill:"#eee",stroke:"#bdbdbd","stroke-width":2}),n=this.createSVGElement("circle",{r:"15",fill:"#757575"});if(a.appendChild(s),t){var r=this.createSVGElement("line",{class:"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#bdbdbd","stroke-width":2}),d=this.createSVGElement("line",{class:"hour-hand",x1:0,y1:0,x2:0,y2:e,stroke:"#8BC34A","stroke-width":8});a.appendChild(r),a.appendChild(d)}else{r=this.createSVGElement("line",{class:"minute-hand",x1:0,y1:0,x2:0,y2:-150,stroke:"#8BC34A","stroke-width":2}),d=this.createSVGElement("line",{class:"hour-hand",x1:0,y1:0,x2:0,y2:e,stroke:"#bdbdbd","stroke-width":8});a.appendChild(d),a.appendChild(r)}return a.appendChild(n),i.appendChild(a),this.$dtpElement.find("#dtp-svg-clock").empty(),this.$dtpElement.find("#dtp-svg-clock")[0].appendChild(i),this.animateHands(),a},createSVGElement:function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg",t);for(var a in e)i.setAttribute(a,e[a]);return i},isAfterMinDate:function(t,e,i){var a=!0;if(void 0!==this.minDate&&null!==this.minDate){var s=h(this.minDate),n=h(t);e||i||(s.hour(0),s.minute(0),n.hour(0),n.minute(0)),s.second(0),n.second(0),s.millisecond(0),n.millisecond(0),i||(n.minute(0),s.minute(0)),a=parseInt(n.format("X"))>=parseInt(s.format("X"))}return a},isBeforeMaxDate:function(t,e,i){var a=!0;if(void 0!==this.maxDate&&null!==this.maxDate){var s=h(this.maxDate),n=h(t);e||i||(s.hour(0),s.minute(0),n.hour(0),n.minute(0)),s.second(0),n.second(0),s.millisecond(0),n.millisecond(0),i||(n.minute(0),s.minute(0)),a=parseInt(n.format("X"))<=parseInt(s.format("X"))}return a},rotateElement:function(t,e){d(t).css({WebkitTransform:"rotate("+e+"deg)","-moz-transform":"rotate("+e+"deg)"})},showDate:function(t){t&&(this.$dtpElement.find(".dtp-actual-day").html(t.locale(this.params.lang).format("dddd")),this.$dtpElement.find(".dtp-actual-month").html(t.locale(this.params.lang).format("MMM").toUpperCase()),this.$dtpElement.find(".dtp-actual-num").html(t.locale(this.params.lang).format("DD")),this.$dtpElement.find(".dtp-actual-year").html(t.locale(this.params.lang).format("YYYY")))},showTime:function(t){if(t){var e=t.minute(),i=(this.params.shortTime?t.format("hh"):t.format("HH"))+":"+(2==e.toString().length?e:"0"+e)+(this.params.shortTime?" "+t.format("A"):"");this.params.date?this.$dtpElement.find(".dtp-actual-time").html(i):(this.params.shortTime?this.$dtpElement.find(".dtp-actual-day").html(t.format("A")):this.$dtpElement.find(".dtp-actual-day").html("&nbsp;"),this.$dtpElement.find(".dtp-actual-maxtime").html(i))}},selectDate:function(t){t&&(this.currentDate.date(t),this.showDate(this.currentDate),this.$element.trigger("dateSelected",this.currentDate))},generateCalendar:function(t){var e={};if(null!==t){var i=h(t).locale(this.params.lang).startOf("month"),a=h(t).locale(this.params.lang).endOf("month"),s=i.format("d");e.week=this.days,e.days=[];for(var n=i.date();n<=a.date();n++){if(n===i.date()){var r=e.week.indexOf(s.toString());if(0<r)for(var d=0;d<r;d++)e.days.push(0)}e.days.push(h(i).locale(this.params.lang).date(n))}}return e},constructHTMLCalendar:function(t,e){var i="";i+='<div class="dtp-picker-month">'+t.locale(this.params.lang).format("MMMM YYYY")+"</div>",i+='<table class="table dtp-picker-days"><thead>';for(var a=0;a<e.week.length;a++)i+="<th>"+h(parseInt(e.week[a]),"d").locale(this.params.lang).format("dd").substring(0,1)+"</th>";i+="</thead>",i+="<tbody><tr>";for(a=0;a<e.days.length;a++)a%7==0&&(i+="</tr><tr>"),i+='<td data-date="'+h(e.days[a]).locale(this.params.lang).format("D")+'">',0!=e.days[a]&&(!1===this.isBeforeMaxDate(h(e.days[a]),!1,!1)||!1===this.isAfterMinDate(h(e.days[a]),!1,!1)||-1!==this.params.disabledDays.indexOf(e.days[a].isoWeekday())?i+='<span class="dtp-select-day">'+h(e.days[a]).locale(this.params.lang).format("DD")+"</span>":h(e.days[a]).locale(this.params.lang).format("DD")===h(this.currentDate).locale(this.params.lang).format("DD")?i+='<a href="javascript:void(0);" class="dtp-select-day selected">'+h(e.days[a]).locale(this.params.lang).format("DD")+"</a>":i+='<a href="javascript:void(0);" class="dtp-select-day">'+h(e.days[a]).locale(this.params.lang).format("DD")+"</a>",i+="</td>");return i+="</tr></tbody></table>"},setName:function(){for(var t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t},isPM:function(){return this.$dtpElement.find("a.dtp-meridien-pm").hasClass("selected")},setElementValue:function(){this.$element.trigger("beforeChange",this.currentDate),void 0!==d.material&&this.$element.removeClass("empty"),this.$element.val(h(this.currentDate).locale(this.params.lang).format(this.params.format)),this.$element.trigger("change",this.currentDate)},toggleButtons:function(t){if(t&&t.isValid()){var e=h(t).locale(this.params.lang).startOf("month"),i=h(t).locale(this.params.lang).endOf("month");this.isAfterMinDate(e,!1,!1)?this.$dtpElement.find("a.dtp-select-month-before").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-month-before").addClass("invisible"),this.isBeforeMaxDate(i,!1,!1)?this.$dtpElement.find("a.dtp-select-month-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-month-after").addClass("invisible");var a=h(t).locale(this.params.lang).startOf("year"),s=h(t).locale(this.params.lang).endOf("year");this.isAfterMinDate(a,!1,!1)?this.$dtpElement.find("a.dtp-select-year-before").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-before").addClass("invisible"),this.isBeforeMaxDate(s,!1,!1)?this.$dtpElement.find("a.dtp-select-year-after").removeClass("invisible"):this.$dtpElement.find("a.dtp-select-year-after").addClass("invisible")}},toggleTime:function(t,e){var i,a=!1;e?((i=h(this.currentDate)).hour(this.convertHours(t)).minute(0).second(0),a=!(!1===this.isAfterMinDate(i,!0,!1)||!1===this.isBeforeMaxDate(i,!0,!1))):((i=h(this.currentDate)).minute(t).second(0),a=!(!1===this.isAfterMinDate(i,!0,!0)||!1===this.isBeforeMaxDate(i,!0,!0)));return a},_attachEvent:function(t,e,i){t.on(e,null,null,i),this._attachedEvents.push([t,e,i])},_detachEvents:function(){for(var t=this._attachedEvents.length-1;0<=t;t--)this._attachedEvents[t][0].off(this._attachedEvents[t][1],this._attachedEvents[t][2]),this._attachedEvents.splice(t,1)},_fireCalendar:function(){this.currentView=0,this.$element.blur(),this.initDates(),this.show(),this.params.date?(this.$dtpElement.find(".dtp-date").removeClass("hidden"),this.initDate()):this.params.time&&(this.$dtpElement.find(".dtp-time").removeClass("hidden"),this.initHours())},_onBackgroundClick:function(t){t.stopPropagation(),this.hide()},_onElementClick:function(t){t.stopPropagation()},_onKeydown:function(t){27===t.which&&this.hide()},_onCloseClick:function(){this.hide()},_onClearClick:function(){this.currentDate=null,this.$element.trigger("beforeChange",this.currentDate),this.hide(),void 0!==d.material&&this.$element.addClass("empty"),this.$element.val(""),this.$element.trigger("change",this.currentDate)},_onNowClick:function(){if(this.currentDate=h(),!0===this.params.date&&(this.showDate(this.currentDate),0===this.currentView&&this.initDate()),!0===this.params.time){switch(this.showTime(this.currentDate),this.currentView){case 1:this.initHours();break;case 2:this.initMinutes()}this.animateHands()}},_onOKClick:function(){switch(this.currentView){case 0:!0===this.params.time?this.initHours():(this.setElementValue(),this.hide());break;case 1:this.initMinutes();break;case 2:this.setElementValue(),this.hide()}},_onCancelClick:function(){if(this.params.time)switch(this.currentView){case 0:this.hide();break;case 1:this.params.date?this.initDate():this.hide();break;case 2:this.initHours()}else this.hide()},_onMonthBeforeClick:function(){this.currentDate.subtract(1,"months"),this.initDate(this.currentDate),this._closeYearPicker()},_onMonthAfterClick:function(){this.currentDate.add(1,"months"),this.initDate(this.currentDate),this._closeYearPicker()},_onYearBeforeClick:function(){this.currentDate.subtract(1,"years"),this.initDate(this.currentDate),this._closeYearPicker()},_onYearAfterClick:function(){this.currentDate.add(1,"years"),this.initDate(this.currentDate),this._closeYearPicker()},refreshYearItems:function(){var a=this.currentDate.year(),s=this.midYear,n=1850;void 0!==this.minDate&&null!==this.minDate&&(n=h(this.minDate).year());var r=2200;void 0!==this.maxDate&&null!==this.maxDate&&(r=h(this.maxDate).year()),this.$dtpElement.find(".dtp-picker-year .invisible").removeClass("invisible"),this.$dtpElement.find(".year-picker-item").each(function(t,e){var i=s-3+t;d(e).attr("data-year",i).text(i).data("year",i),a==i?d(e).addClass("active"):d(e).removeClass("active"),(i<n||r<i)&&d(e).addClass("invisible")}),s-3<=n&&this.$dtpElement.find(".dtp-select-year-range.before").addClass("invisible"),r<=s+3&&this.$dtpElement.find(".dtp-select-year-range.after").addClass("invisible"),this.$dtpElement.find(".dtp-select-year-range").data("mid",s)},_onActualYearClick:function(){this.params.year&&(0<this.$dtpElement.find(".dtp-picker-year.hidden").length?(this.$dtpElement.find(".dtp-picker-datetime").addClass("hidden"),this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden"),this.$dtpElement.find(".dtp-picker-year").removeClass("hidden"),this.midYear=this.currentDate.year(),this.refreshYearItems()):this._closeYearPicker())},_onYearRangeBeforeClick:function(){this.midYear-=7,this.refreshYearItems()},_onYearRangeAfterClick:function(){this.midYear+=7,this.refreshYearItems()},_onYearItemClick:function(t){var e=d(t.currentTarget).data("year")-this.currentDate.year();this.currentDate.add(e,"years"),this.initDate(this.currentDate),this._closeYearPicker(),this.$element.trigger("yearSelected",this.currentDate)},_closeYearPicker:function(){this.$dtpElement.find(".dtp-picker-calendar").removeClass("hidden"),this.$dtpElement.find(".dtp-picker-year").addClass("hidden")},enableYearPicker:function(){this.params.year=!0,this.$dtpElement.find(".dtp-actual-year").reomveClass("disabled")},disableYearPicker:function(){this.params.year=!1,this.$dtpElement.find(".dtp-actual-year").addClass("disabled"),this._closeYearPicker()},_onSelectDate:function(t){this.$dtpElement.find("a.dtp-select-day").removeClass("selected"),d(t.currentTarget).addClass("selected"),this.selectDate(d(t.currentTarget).parent().data("date")),!0===this.params.switchOnClick&&!0===this.params.time&&setTimeout(this.initHours.bind(this),200),!0===this.params.switchOnClick&&!1===this.params.time&&setTimeout(this._onOKClick.bind(this),200)},_onSelectHour:function(t){if(!d(t.target).hasClass("disabled")){for(var e=d(t.target).data("hour"),i=d(t.target).parent(),a=i.find(".dtp-select-hour"),s=0;s<a.length;s++)d(a[s]).attr("fill","transparent");var n=i.find(".dtp-select-hour-text");for(s=0;s<n.length;s++)d(n[s]).attr("fill","#000");d(i.find("#h-"+e)).attr("fill","#8BC34A"),d(i.find("#th-"+e)).attr("fill","#fff"),this.currentDate.hour(parseInt(e)),!0===this.params.shortTime&&this.isPM()&&this.currentDate.add(12,"hours"),this.showTime(this.currentDate),this.animateHands(),!0===this.params.switchOnClick&&setTimeout(this.initMinutes.bind(this),200)}},_onSelectMinute:function(t){if(!d(t.target).hasClass("disabled")){for(var e=d(t.target).data("minute"),i=d(t.target).parent(),a=i.find(".dtp-select-minute"),s=0;s<a.length;s++)d(a[s]).attr("fill","transparent");var n=i.find(".dtp-select-minute-text");for(s=0;s<n.length;s++)d(n[s]).attr("fill","#000");d(i.find("#m-"+e)).attr("fill","#8BC34A"),d(i.find("#tm-"+e)).attr("fill","#fff"),this.currentDate.minute(parseInt(e)),this.showTime(this.currentDate),this.animateHands(),!0===this.params.switchOnClick&&setTimeout(function(){this.setElementValue(),this.hide()}.bind(this),200)}},_onSelectAM:function(t){d(".dtp-actual-meridien").find("a").removeClass("selected"),d(t.currentTarget).addClass("selected"),12<=this.currentDate.hour()&&this.currentDate.subtract(12,"hours")&&this.showTime(this.currentDate),this.toggleTime(1===this.currentView)},_onSelectPM:function(t){d(".dtp-actual-meridien").find("a").removeClass("selected"),d(t.currentTarget).addClass("selected"),this.currentDate.hour()<12&&this.currentDate.add(12,"hours")&&this.showTime(this.currentDate),this.toggleTime(1===this.currentView)},_hideCalendar:function(){this.$dtpElement.find(".dtp-picker-calendar").addClass("hidden")},convertHours:function(t){var e=t;return!0===this.params.shortTime&&t<12&&this.isPM()&&(e+=12),e},setDate:function(t){this.params.currentDate=t,this.initDates()},setMinDate:function(t){this.params.minDate=t,this.initDates()},setMaxDate:function(t){this.params.maxDate=t,this.initDates()},destroy:function(){this._detachEvents(),this.$dtpElement.remove()},show:function(){this.$dtpElement.removeClass("hidden"),this._attachEvent(d(window),"keydown",this._onKeydown.bind(this)),this._centerBox(),this.$element.trigger("open"),!0===this.params.monthPicker&&this._hideCalendar()},hide:function(){d(window).off("keydown",null,null,this._onKeydown.bind(this)),this.$dtpElement.addClass("hidden"),this.$element.trigger("close")},_centerBox:function(){var t=(this.$dtpElement.height()-this.$dtpElement.find(".dtp-content").height())/2;this.$dtpElement.find(".dtp-content").css("marginLeft",-this.$dtpElement.find(".dtp-content").width()/2+"px"),this.$dtpElement.find(".dtp-content").css("top",t+"px")},enableDays:function(){var t=this.params.enableDays;t&&d(".dtp-picker-days tbody tr td").each(function(){0<=d.inArray(d(this).index(),t)||d(this).find("a").css({background:"#e3e3e3",cursor:"no-drop",opacity:"0.5"}).off("click")})}}}(jQuery,moment);