(function(l,i){if(typeof define=="function"&&define.amd)define(["moment","jquery"],function(t,a){return a.fn||(a.fn={}),typeof t!="function"&&t.hasOwnProperty("default")&&(t=t.default),i(t,a)});else if(typeof module=="object"&&module.exports){var w=typeof window!="undefined"?window.jQuery:void 0;w||(w=require("jquery"),w.fn||(w.fn={}));var e=typeof window!="undefined"&&typeof window.moment!="undefined"?window.moment:require("moment");module.exports=i(e,w)}else l.daterangepicker=i(l.moment,l.jQuery)})(typeof window!="undefined"?window:exports,function(l,i){var w=function(e,t,a){if(this.parentEl="body",this.element=i(e),this.startDate=l().startOf("day"),this.endDate=l().endOf("day"),this.minDate=!1,this.maxDate=!1,this.maxSpan=!1,this.autoApply=!1,this.singleDatePicker=!1,this.showDropdowns=!1,this.minYear=l().subtract(100,"year").format("YYYY"),this.maxYear=l().add(100,"year").format("YYYY"),this.showWeekNumbers=!1,this.showISOWeekNumbers=!1,this.showCustomRangeLabel=!0,this.timePicker=!1,this.timePicker24Hour=!1,this.timePickerIncrement=1,this.timePickerSeconds=!1,this.linkedCalendars=!0,this.autoUpdateInput=!0,this.alwaysShowCalendars=!1,this.ranges={},this.opens="right",this.element.hasClass("pull-right")&&(this.opens="left"),this.drops="down",this.element.hasClass("dropup")&&(this.drops="up"),this.buttonClasses="btn btn-sm",this.applyButtonClasses="btn-primary",this.cancelButtonClasses="btn-default",this.locale={direction:"ltr",format:l.localeData().longDateFormat("L"),separator:" - ",applyLabel:"Apply",cancelLabel:"Cancel",weekLabel:"W",customRangeLabel:"Custom Range",daysOfWeek:l.weekdaysMin(),monthNames:l.monthsShort(),firstDay:l.localeData().firstDayOfWeek()},this.callback=function(){},this.isShowing=!1,this.leftCalendar={},this.rightCalendar={},(typeof t!="object"||t===null)&&(t={}),t=i.extend(this.element.data(),t),typeof t.template!="string"&&!(t.template instanceof i)&&(t.template='<div class="daterangepicker"><div class="ranges"></div><div class="drp-calendar left"><div class="calendar-table"></div><div class="calendar-time"></div></div><div class="drp-calendar right"><div class="calendar-table"></div><div class="calendar-time"></div></div><div class="drp-buttons"><span class="drp-selected"></span><button class="cancelBtn" type="button"></button><button class="applyBtn" disabled="disabled" type="button"></button> </div></div>'),this.parentEl=t.parentEl&&i(t.parentEl).length?i(t.parentEl):i(this.parentEl),this.container=i(t.template).appendTo(this.parentEl),typeof t.locale=="object"&&(typeof t.locale.direction=="string"&&(this.locale.direction=t.locale.direction),typeof t.locale.format=="string"&&(this.locale.format=t.locale.format),typeof t.locale.separator=="string"&&(this.locale.separator=t.locale.separator),typeof t.locale.daysOfWeek=="object"&&(this.locale.daysOfWeek=t.locale.daysOfWeek.slice()),typeof t.locale.monthNames=="object"&&(this.locale.monthNames=t.locale.monthNames.slice()),typeof t.locale.firstDay=="number"&&(this.locale.firstDay=t.locale.firstDay),typeof t.locale.applyLabel=="string"&&(this.locale.applyLabel=t.locale.applyLabel),typeof t.locale.cancelLabel=="string"&&(this.locale.cancelLabel=t.locale.cancelLabel),typeof t.locale.weekLabel=="string"&&(this.locale.weekLabel=t.locale.weekLabel),typeof t.locale.customRangeLabel=="string")){var n=document.createElement("textarea");n.innerHTML=t.locale.customRangeLabel;var o=n.value;this.locale.customRangeLabel=o}if(this.container.addClass(this.locale.direction),typeof t.startDate=="string"&&(this.startDate=l(t.startDate,this.locale.format)),typeof t.endDate=="string"&&(this.endDate=l(t.endDate,this.locale.format)),typeof t.minDate=="string"&&(this.minDate=l(t.minDate,this.locale.format)),typeof t.maxDate=="string"&&(this.maxDate=l(t.maxDate,this.locale.format)),typeof t.startDate=="object"&&(this.startDate=l(t.startDate)),typeof t.endDate=="object"&&(this.endDate=l(t.endDate)),typeof t.minDate=="object"&&(this.minDate=l(t.minDate)),typeof t.maxDate=="object"&&(this.maxDate=l(t.maxDate)),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),typeof t.applyButtonClasses=="string"&&(this.applyButtonClasses=t.applyButtonClasses),typeof t.applyClass=="string"&&(this.applyButtonClasses=t.applyClass),typeof t.cancelButtonClasses=="string"&&(this.cancelButtonClasses=t.cancelButtonClasses),typeof t.cancelClass=="string"&&(this.cancelButtonClasses=t.cancelClass),typeof t.maxSpan=="object"&&(this.maxSpan=t.maxSpan),typeof t.dateLimit=="object"&&(this.maxSpan=t.dateLimit),typeof t.opens=="string"&&(this.opens=t.opens),typeof t.drops=="string"&&(this.drops=t.drops),typeof t.showWeekNumbers=="boolean"&&(this.showWeekNumbers=t.showWeekNumbers),typeof t.showISOWeekNumbers=="boolean"&&(this.showISOWeekNumbers=t.showISOWeekNumbers),typeof t.buttonClasses=="string"&&(this.buttonClasses=t.buttonClasses),typeof t.buttonClasses=="object"&&(this.buttonClasses=t.buttonClasses.join(" ")),typeof t.showDropdowns=="boolean"&&(this.showDropdowns=t.showDropdowns),typeof t.minYear=="number"&&(this.minYear=t.minYear),typeof t.maxYear=="number"&&(this.maxYear=t.maxYear),typeof t.showCustomRangeLabel=="boolean"&&(this.showCustomRangeLabel=t.showCustomRangeLabel),typeof t.singleDatePicker=="boolean"&&(this.singleDatePicker=t.singleDatePicker,this.singleDatePicker&&(this.endDate=this.startDate.clone())),typeof t.timePicker=="boolean"&&(this.timePicker=t.timePicker),typeof t.timePickerSeconds=="boolean"&&(this.timePickerSeconds=t.timePickerSeconds),typeof t.timePickerIncrement=="number"&&(this.timePickerIncrement=t.timePickerIncrement),typeof t.timePicker24Hour=="boolean"&&(this.timePicker24Hour=t.timePicker24Hour),typeof t.autoApply=="boolean"&&(this.autoApply=t.autoApply),typeof t.autoUpdateInput=="boolean"&&(this.autoUpdateInput=t.autoUpdateInput),typeof t.linkedCalendars=="boolean"&&(this.linkedCalendars=t.linkedCalendars),typeof t.isInvalidDate=="function"&&(this.isInvalidDate=t.isInvalidDate),typeof t.isCustomDate=="function"&&(this.isCustomDate=t.isCustomDate),typeof t.alwaysShowCalendars=="boolean"&&(this.alwaysShowCalendars=t.alwaysShowCalendars),this.locale.firstDay!=0)for(var h=this.locale.firstDay;h>0;)this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()),h--;var d,c,f;if(typeof t.startDate=="undefined"&&typeof t.endDate=="undefined"&&i(this.element).is(":text")){var s=i(this.element).val(),y=s.split(this.locale.separator);d=c=null,y.length==2?(d=l(y[0],this.locale.format),c=l(y[1],this.locale.format)):this.singleDatePicker&&s!==""&&(d=l(s,this.locale.format),c=l(s,this.locale.format)),d!==null&&c!==null&&(this.setStartDate(d),this.setEndDate(c))}if(typeof t.ranges=="object"){for(f in t.ranges){typeof t.ranges[f][0]=="string"?d=l(t.ranges[f][0],this.locale.format):d=l(t.ranges[f][0]),typeof t.ranges[f][1]=="string"?c=l(t.ranges[f][1],this.locale.format):c=l(t.ranges[f][1]),this.minDate&&d.isBefore(this.minDate)&&(d=this.minDate.clone());var m=this.maxDate;if(this.maxSpan&&m&&d.clone().add(this.maxSpan).isAfter(m)&&(m=d.clone().add(this.maxSpan)),m&&c.isAfter(m)&&(c=m.clone()),!(this.minDate&&c.isBefore(this.minDate,this.timepicker?"minute":"day")||m&&d.isAfter(m,this.timepicker?"minute":"day"))){var n=document.createElement("textarea");n.innerHTML=f;var o=n.value;this.ranges[o]=[d,c]}}var D="<ul>";for(f in this.ranges)D+='<li data-range-key="'+f+'">'+f+"</li>";this.showCustomRangeLabel&&(D+='<li data-range-key="'+this.locale.customRangeLabel+'">'+this.locale.customRangeLabel+"</li>"),D+="</ul>",this.container.find(".ranges").prepend(D)}typeof a=="function"&&(this.callback=a),this.timePicker||(this.startDate=this.startDate.startOf("day"),this.endDate=this.endDate.endOf("day"),this.container.find(".calendar-time").hide()),this.timePicker&&this.autoApply&&(this.autoApply=!1),this.autoApply&&this.container.addClass("auto-apply"),typeof t.ranges=="object"&&this.container.addClass("show-ranges"),this.singleDatePicker&&(this.container.addClass("single"),this.container.find(".drp-calendar.left").addClass("single"),this.container.find(".drp-calendar.left").show(),this.container.find(".drp-calendar.right").hide(),!this.timePicker&&this.autoApply&&this.container.addClass("auto-apply")),(typeof t.ranges=="undefined"&&!this.singleDatePicker||this.alwaysShowCalendars)&&this.container.addClass("show-calendar"),this.container.addClass("opens"+this.opens),this.container.find(".applyBtn, .cancelBtn").addClass(this.buttonClasses),this.applyButtonClasses.length&&this.container.find(".applyBtn").addClass(this.applyButtonClasses),this.cancelButtonClasses.length&&this.container.find(".cancelBtn").addClass(this.cancelButtonClasses),this.container.find(".applyBtn").html(this.locale.applyLabel),this.container.find(".cancelBtn").html(this.locale.cancelLabel),this.container.find(".drp-calendar").on("click.daterangepicker",".prev",i.proxy(this.clickPrev,this)).on("click.daterangepicker",".next",i.proxy(this.clickNext,this)).on("mousedown.daterangepicker","td.available",i.proxy(this.clickDate,this)).on("mouseenter.daterangepicker","td.available",i.proxy(this.hoverDate,this)).on("change.daterangepicker","select.yearselect",i.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.monthselect",i.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.hourselect,select.minuteselect,select.secondselect,select.ampmselect",i.proxy(this.timeChanged,this)),this.container.find(".ranges").on("click.daterangepicker","li",i.proxy(this.clickRange,this)),this.container.find(".drp-buttons").on("click.daterangepicker","button.applyBtn",i.proxy(this.clickApply,this)).on("click.daterangepicker","button.cancelBtn",i.proxy(this.clickCancel,this)),this.element.is("input")||this.element.is("button")?this.element.on({"click.daterangepicker":i.proxy(this.show,this),"focus.daterangepicker":i.proxy(this.show,this),"keyup.daterangepicker":i.proxy(this.elementChanged,this),"keydown.daterangepicker":i.proxy(this.keydown,this)}):(this.element.on("click.daterangepicker",i.proxy(this.toggle,this)),this.element.on("keydown.daterangepicker",i.proxy(this.toggle,this))),this.updateElement()};return w.prototype={constructor:w,setStartDate:function(e){typeof e=="string"&&(this.startDate=l(e,this.locale.format)),typeof e=="object"&&(this.startDate=l(e)),this.timePicker||(this.startDate=this.startDate.startOf("day")),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.maxDate&&this.startDate.isAfter(this.maxDate)&&(this.startDate=this.maxDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.isShowing||this.updateElement(),this.updateMonthsInView()},setEndDate:function(e){typeof e=="string"&&(this.endDate=l(e,this.locale.format)),typeof e=="object"&&(this.endDate=l(e)),this.timePicker||(this.endDate=this.endDate.endOf("day")),this.timePicker&&this.timePickerIncrement&&this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.endDate.isBefore(this.startDate)&&(this.endDate=this.startDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),this.maxSpan&&this.startDate.clone().add(this.maxSpan).isBefore(this.endDate)&&(this.endDate=this.startDate.clone().add(this.maxSpan)),this.previousRightTime=this.endDate.clone(),this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.isShowing||this.updateElement(),this.updateMonthsInView()},isInvalidDate:function(){return!1},isCustomDate:function(){return!1},updateView:function(){this.timePicker&&(this.renderTimePicker("left"),this.renderTimePicker("right"),this.endDate?this.container.find(".right .calendar-time select").prop("disabled",!1).removeClass("disabled"):this.container.find(".right .calendar-time select").prop("disabled",!0).addClass("disabled")),this.endDate&&this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.updateMonthsInView(),this.updateCalendars(),this.updateFormInputs()},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.startDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM"))&&(this.endDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.endDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM")))return;this.leftCalendar.month=this.startDate.clone().date(2),!this.linkedCalendars&&(this.endDate.month()!=this.startDate.month()||this.endDate.year()!=this.startDate.year())?this.rightCalendar.month=this.endDate.clone().date(2):this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month")}else this.leftCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&this.rightCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&(this.leftCalendar.month=this.startDate.clone().date(2),this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"));this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate&&(this.rightCalendar.month=this.maxDate.clone().date(2),this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,"month"))},updateCalendars:function(){if(this.timePicker){var e,t,a;if(this.endDate){if(e=parseInt(this.container.find(".left .hourselect").val(),10),t=parseInt(this.container.find(".left .minuteselect").val(),10),isNaN(t)&&(t=parseInt(this.container.find(".left .minuteselect option:last").val(),10)),a=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0,!this.timePicker24Hour){var n=this.container.find(".left .ampmselect").val();n==="PM"&&e<12&&(e+=12),n==="AM"&&e===12&&(e=0)}}else if(e=parseInt(this.container.find(".right .hourselect").val(),10),t=parseInt(this.container.find(".right .minuteselect").val(),10),isNaN(t)&&(t=parseInt(this.container.find(".right .minuteselect option:last").val(),10)),a=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,!this.timePicker24Hour){var n=this.container.find(".right .ampmselect").val();n==="PM"&&e<12&&(e+=12),n==="AM"&&e===12&&(e=0)}this.leftCalendar.month.hour(e).minute(t).second(a),this.rightCalendar.month.hour(e).minute(t).second(a)}this.renderCalendar("left"),this.renderCalendar("right"),this.container.find(".ranges li").removeClass("active"),this.endDate!=null&&this.calculateChosenLabel()},renderCalendar:function(e){var r=e=="left"?this.leftCalendar:this.rightCalendar,t=r.month.month(),a=r.month.year(),n=r.month.hour(),o=r.month.minute(),h=r.month.second(),d=l([a,t]).daysInMonth(),c=l([a,t,1]),f=l([a,t,d]),s=l(c).subtract(1,"month").month(),y=l(c).subtract(1,"month").year(),m=l([y,s]).daysInMonth(),D=c.day(),r=[];r.firstDay=c,r.lastDay=f;for(var v=0;v<6;v++)r[v]=[];var b=m-D+this.locale.firstDay+1;b>m&&(b-=7),D==this.locale.firstDay&&(b=m-6);for(var x=l([y,s,b,12,o,h]),u,p,v=0,u=0,p=0;v<42;v++,u++,x=l(x).add(24,"hour"))v>0&&u%7===0&&(u=0,p++),r[p][u]=x.clone().hour(n).minute(o).second(h),x.hour(12),this.minDate&&r[p][u].format("YYYY-MM-DD")==this.minDate.format("YYYY-MM-DD")&&r[p][u].isBefore(this.minDate)&&e=="left"&&(r[p][u]=this.minDate.clone()),this.maxDate&&r[p][u].format("YYYY-MM-DD")==this.maxDate.format("YYYY-MM-DD")&&r[p][u].isAfter(this.maxDate)&&e=="right"&&(r[p][u]=this.maxDate.clone());e=="left"?this.leftCalendar.calendar=r:this.rightCalendar.calendar=r;var P=e=="left"?this.minDate:this.startDate,C=this.maxDate,U=e=="left"?this.startDate:this.endDate,F=this.locale.direction=="ltr"?{left:"chevron-left",right:"chevron-right"}:{left:"chevron-right",right:"chevron-left"},g='<table class="table-condensed">';g+="<thead>",g+="<tr>",(this.showWeekNumbers||this.showISOWeekNumbers)&&(g+="<th></th>"),(!P||P.isBefore(r.firstDay))&&(!this.linkedCalendars||e=="left")?g+='<th class="prev available"><span></span></th>':g+="<th></th>";var N=this.locale.monthNames[r[1][1].month()]+r[1][1].format(" YYYY");if(this.showDropdowns){for(var E=r[1][1].month(),B=r[1][1].year(),O=C&&C.year()||this.maxYear,W=P&&P.year()||this.minYear,T=B==W,j=B==O,I='<select class="monthselect">',Y=0;Y<12;Y++)(!T||P&&Y>=P.month())&&(!j||C&&Y<=C.month())?I+="<option value='"+Y+"'"+(Y===E?" selected='selected'":"")+">"+this.locale.monthNames[Y]+"</option>":I+="<option value='"+Y+"'"+(Y===E?" selected='selected'":"")+" disabled='disabled'>"+this.locale.monthNames[Y]+"</option>";I+="</select>";for(var L='<select class="yearselect">',M=W;M<=O;M++)L+='<option value="'+M+'"'+(M===B?' selected="selected"':"")+">"+M+"</option>";L+="</select>",N=I+L}if(g+='<th colspan="5" class="month">'+N+"</th>",(!C||C.isAfter(r.lastDay))&&(!this.linkedCalendars||e=="right"||this.singleDatePicker)?g+='<th class="next available"><span></span></th>':g+="<th></th>",g+="</tr>",g+="<tr>",(this.showWeekNumbers||this.showISOWeekNumbers)&&(g+='<th class="week">'+this.locale.weekLabel+"</th>"),i.each(this.locale.daysOfWeek,function(q,V){g+="<th>"+V+"</th>"}),g+="</tr>",g+="</thead>",g+="<tbody>",this.endDate==null&&this.maxSpan){var H=this.startDate.clone().add(this.maxSpan).endOf("day");(!C||H.isBefore(C))&&(C=H)}for(var p=0;p<6;p++){g+="<tr>",this.showWeekNumbers?g+='<td class="week">'+r[p][0].week()+"</td>":this.showISOWeekNumbers&&(g+='<td class="week">'+r[p][0].isoWeek()+"</td>");for(var u=0;u<7;u++){var k=[];r[p][u].isSame(new Date,"day")&&k.push("today"),r[p][u].isoWeekday()>5&&k.push("weekend"),r[p][u].month()!=r[1][1].month()&&k.push("off","ends"),this.minDate&&r[p][u].isBefore(this.minDate,"day")&&k.push("off","disabled"),C&&r[p][u].isAfter(C,"day")&&k.push("off","disabled"),this.isInvalidDate(r[p][u])&&k.push("off","disabled"),r[p][u].format("YYYY-MM-DD")==this.startDate.format("YYYY-MM-DD")&&k.push("active","start-date"),this.endDate!=null&&r[p][u].format("YYYY-MM-DD")==this.endDate.format("YYYY-MM-DD")&&k.push("active","end-date"),this.endDate!=null&&r[p][u]>this.startDate&&r[p][u]<this.endDate&&k.push("in-range");var S=this.isCustomDate(r[p][u]);S!==!1&&(typeof S=="string"?k.push(S):Array.prototype.push.apply(k,S));for(var A="",R=!1,v=0;v<k.length;v++)A+=k[v]+" ",k[v]=="disabled"&&(R=!0);R||(A+="available"),g+='<td class="'+A.replace(/^\s+|\s+$/g,"")+'" data-title="r'+p+"c"+u+'">'+r[p][u].date()+"</td>"}g+="</tr>"}g+="</tbody>",g+="</table>",this.container.find(".drp-calendar."+e+" .calendar-table").html(g)},renderTimePicker:function(e){if(!(e=="right"&&!this.endDate)){var t,a,n,o=this.maxDate;if(this.maxSpan&&(!this.maxDate||this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate))&&(o=this.startDate.clone().add(this.maxSpan)),e=="left")a=this.startDate.clone(),n=this.minDate;else if(e=="right"){a=this.endDate.clone(),n=this.startDate;var h=this.container.find(".drp-calendar.right .calendar-time");if(h.html()!=""&&(a.hour(isNaN(a.hour())?h.find(".hourselect option:selected").val():a.hour()),a.minute(isNaN(a.minute())?h.find(".minuteselect option:selected").val():a.minute()),a.second(isNaN(a.second())?h.find(".secondselect option:selected").val():a.second()),!this.timePicker24Hour)){var d=h.find(".ampmselect option:selected").val();d==="PM"&&a.hour()<12&&a.hour(a.hour()+12),d==="AM"&&a.hour()===12&&a.hour(0)}a.isBefore(this.startDate)&&(a=this.startDate.clone()),o&&a.isAfter(o)&&(a=o.clone())}t='<select class="hourselect">';for(var c=this.timePicker24Hour?0:1,f=this.timePicker24Hour?23:12,s=c;s<=f;s++){var y=s;this.timePicker24Hour||(y=a.hour()>=12?s==12?12:s+12:s==12?0:s);var m=a.clone().hour(y),D=!1;n&&m.minute(59).isBefore(n)&&(D=!0),o&&m.minute(0).isAfter(o)&&(D=!0),y==a.hour()&&!D?t+='<option value="'+s+'" selected="selected">'+s+"</option>":D?t+='<option value="'+s+'" disabled="disabled" class="disabled">'+s+"</option>":t+='<option value="'+s+'">'+s+"</option>"}t+="</select> ",t+=': <select class="minuteselect">';for(var s=0;s<60;s+=this.timePickerIncrement){var r=s<10?"0"+s:s,m=a.clone().minute(s),D=!1;n&&m.second(59).isBefore(n)&&(D=!0),o&&m.second(0).isAfter(o)&&(D=!0),a.minute()==s&&!D?t+='<option value="'+s+'" selected="selected">'+r+"</option>":D?t+='<option value="'+s+'" disabled="disabled" class="disabled">'+r+"</option>":t+='<option value="'+s+'">'+r+"</option>"}if(t+="</select> ",this.timePickerSeconds){t+=': <select class="secondselect">';for(var s=0;s<60;s++){var r=s<10?"0"+s:s,m=a.clone().second(s),D=!1;n&&m.isBefore(n)&&(D=!0),o&&m.isAfter(o)&&(D=!0),a.second()==s&&!D?t+='<option value="'+s+'" selected="selected">'+r+"</option>":D?t+='<option value="'+s+'" disabled="disabled" class="disabled">'+r+"</option>":t+='<option value="'+s+'">'+r+"</option>"}t+="</select> "}if(!this.timePicker24Hour){t+='<select class="ampmselect">';var v="",b="";n&&a.clone().hour(12).minute(0).second(0).isBefore(n)&&(v=' disabled="disabled" class="disabled"'),o&&a.clone().hour(0).minute(0).second(0).isAfter(o)&&(b=' disabled="disabled" class="disabled"'),a.hour()>=12?t+='<option value="AM"'+v+'>AM</option><option value="PM" selected="selected"'+b+">PM</option>":t+='<option value="AM" selected="selected"'+v+'>AM</option><option value="PM"'+b+">PM</option>",t+="</select>"}this.container.find(".drp-calendar."+e+" .calendar-time").html(t)}},updateFormInputs:function(){this.singleDatePicker||this.endDate&&(this.startDate.isBefore(this.endDate)||this.startDate.isSame(this.endDate))?this.container.find("button.applyBtn").prop("disabled",!1):this.container.find("button.applyBtn").prop("disabled",!0)},move:function(){var e={top:0,left:0},t,a=this.drops,n=i(window).width();let o=i(window).height(),h=window.scrollY;switch(this.parentEl.is("body")||(e={top:this.parentEl.offset().top-this.parentEl.scrollTop(),left:this.parentEl.offset().left-this.parentEl.scrollLeft()},n=this.parentEl[0].clientWidth+this.parentEl.offset().left),a){case"auto":t=this.element.offset().top+this.element.outerHeight()-e.top;var d=t+this.container.outerHeight();if(d-h>=o){let m=this.element.offset().top-this.container.outerHeight()-e.top;m-h>=0&&(a="up",t=m)}break;case"up":t=this.element.offset().top-this.container.outerHeight()-e.top;break;default:t=this.element.offset().top+this.element.outerHeight()-e.top;break}this.container.css({top:0,left:0,right:"auto"});var c=this.container.outerWidth();if(this.container.toggleClass("drop-up",a=="up"),this.opens=="left"){var f=n-this.element.offset().left-this.element.outerWidth();c+f>i(window).width()?this.container.css({top:t,right:"auto",left:9}):this.container.css({top:t,right:f,left:"auto"})}else if(this.opens=="center"){var s=this.element.offset().left-e.left+this.element.outerWidth()/2-c/2;s<0?this.container.css({top:t,right:"auto",left:9}):s+c>i(window).width()?this.container.css({top:t,left:"auto",right:0}):this.container.css({top:t,left:s,right:"auto"})}else{var s=this.element.offset().left-e.left;s+c>i(window).width()?this.container.css({top:t,left:"auto",right:0}):this.container.css({top:t,left:s,right:"auto"})}},show:function(e){this.isShowing||(this._outsideClickProxy=i.proxy(function(t){this.outsideClick(t)},this),i(document).on("mousedown.daterangepicker",this._outsideClickProxy).on("touchend.daterangepicker",this._outsideClickProxy).on("click.daterangepicker","[data-toggle=dropdown]",this._outsideClickProxy).on("focusin.daterangepicker",this._outsideClickProxy),i(window).on("resize.daterangepicker",i.proxy(function(t){this.move(t)},this)),this.oldStartDate=this.startDate.clone(),this.oldEndDate=this.endDate.clone(),this.previousRightTime=this.endDate.clone(),this.updateView(),this.container.show(),this.move(),this.element.trigger("show.daterangepicker",this),this.isShowing=!0)},hide:function(e){this.isShowing&&(this.endDate||(this.startDate=this.oldStartDate.clone(),this.endDate=this.oldEndDate.clone()),(!this.startDate.isSame(this.oldStartDate)||!this.endDate.isSame(this.oldEndDate))&&this.callback(this.startDate.clone(),this.endDate.clone(),this.chosenLabel),this.updateElement(),i(document).off(".daterangepicker"),i(window).off(".daterangepicker"),this.container.hide(),this.element.trigger("hide.daterangepicker",this),this.isShowing=!1)},toggle:function(e){this.isShowing?this.hide():this.show()},outsideClick:function(e){var t=i(e.target);e.type=="focusin"||t.closest(this.element).length||t.closest(this.container).length||t.closest(".calendar-table").length||(this.hide(),this.element.trigger("outsideClick.daterangepicker",this))},showCalendars:function(){this.container.addClass("show-calendar"),this.move(),this.element.trigger("showCalendar.daterangepicker",this)},hideCalendars:function(){this.container.removeClass("show-calendar"),this.element.trigger("hideCalendar.daterangepicker",this)},clickRange:function(e){var t=e.target.getAttribute("data-range-key");if(this.chosenLabel=t,t==this.locale.customRangeLabel)this.showCalendars();else{var a=this.ranges[t];this.startDate=a[0],this.endDate=a[1],this.timePicker||(this.startDate.startOf("day"),this.endDate.endOf("day")),this.alwaysShowCalendars||this.hideCalendars(),this.clickApply()}},clickPrev:function(e){var t=i(e.target).parents(".drp-calendar");t.hasClass("left")?(this.leftCalendar.month.subtract(1,"month"),this.linkedCalendars&&this.rightCalendar.month.subtract(1,"month")):this.rightCalendar.month.subtract(1,"month"),this.updateCalendars()},clickNext:function(e){var t=i(e.target).parents(".drp-calendar");t.hasClass("left")?this.leftCalendar.month.add(1,"month"):(this.rightCalendar.month.add(1,"month"),this.linkedCalendars&&this.leftCalendar.month.add(1,"month")),this.updateCalendars()},hoverDate:function(e){if(i(e.target).hasClass("available")){var t=i(e.target).attr("data-title"),a=t.substr(1,1),n=t.substr(3,1),o=i(e.target).parents(".drp-calendar"),h=o.hasClass("left")?this.leftCalendar.calendar[a][n]:this.rightCalendar.calendar[a][n],d=this.leftCalendar,c=this.rightCalendar,f=this.startDate;this.endDate||this.container.find(".drp-calendar tbody td").each(function(s,y){if(!i(y).hasClass("week")){var m=i(y).attr("data-title"),D=m.substr(1,1),r=m.substr(3,1),v=i(y).parents(".drp-calendar"),b=v.hasClass("left")?d.calendar[D][r]:c.calendar[D][r];b.isAfter(f)&&b.isBefore(h)||b.isSame(h,"day")?i(y).addClass("in-range"):i(y).removeClass("in-range")}})}},clickDate:function(e){if(i(e.target).hasClass("available")){var t=i(e.target).attr("data-title"),a=t.substr(1,1),n=t.substr(3,1),o=i(e.target).parents(".drp-calendar"),h=o.hasClass("left")?this.leftCalendar.calendar[a][n]:this.rightCalendar.calendar[a][n];if(this.endDate||h.isBefore(this.startDate,"day")){if(this.timePicker){var d=parseInt(this.container.find(".left .hourselect").val(),10);if(!this.timePicker24Hour){var c=this.container.find(".left .ampmselect").val();c==="PM"&&d<12&&(d+=12),c==="AM"&&d===12&&(d=0)}var f=parseInt(this.container.find(".left .minuteselect").val(),10);isNaN(f)&&(f=parseInt(this.container.find(".left .minuteselect option:last").val(),10));var s=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0;h=h.clone().hour(d).minute(f).second(s)}this.endDate=null,this.setStartDate(h.clone())}else if(!this.endDate&&h.isBefore(this.startDate))this.setEndDate(this.startDate.clone());else{if(this.timePicker){var d=parseInt(this.container.find(".right .hourselect").val(),10);if(!this.timePicker24Hour){var c=this.container.find(".right .ampmselect").val();c==="PM"&&d<12&&(d+=12),c==="AM"&&d===12&&(d=0)}var f=parseInt(this.container.find(".right .minuteselect").val(),10);isNaN(f)&&(f=parseInt(this.container.find(".right .minuteselect option:last").val(),10));var s=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0;h=h.clone().hour(d).minute(f).second(s)}this.setEndDate(h.clone()),this.autoApply&&(this.calculateChosenLabel(),this.clickApply())}this.singleDatePicker&&(this.setEndDate(this.startDate),!this.timePicker&&this.autoApply&&this.clickApply()),this.updateView(),e.stopPropagation()}},calculateChosenLabel:function(){var e=!0,t=0;for(var a in this.ranges){if(this.timePicker){var n=this.timePickerSeconds?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm";if(this.startDate.format(n)==this.ranges[a][0].format(n)&&this.endDate.format(n)==this.ranges[a][1].format(n)){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").attr("data-range-key");break}}else if(this.startDate.format("YYYY-MM-DD")==this.ranges[a][0].format("YYYY-MM-DD")&&this.endDate.format("YYYY-MM-DD")==this.ranges[a][1].format("YYYY-MM-DD")){e=!1,this.chosenLabel=this.container.find(".ranges li:eq("+t+")").addClass("active").attr("data-range-key");break}t++}e&&(this.showCustomRangeLabel?this.chosenLabel=this.container.find(".ranges li:last").addClass("active").attr("data-range-key"):this.chosenLabel=null,this.showCalendars())},clickApply:function(e){this.hide(),this.element.trigger("apply.daterangepicker",this)},clickCancel:function(e){this.startDate=this.oldStartDate,this.endDate=this.oldEndDate,this.hide(),this.element.trigger("cancel.daterangepicker",this)},monthOrYearChanged:function(e){var t=i(e.target).closest(".drp-calendar").hasClass("left"),a=t?"left":"right",n=this.container.find(".drp-calendar."+a),o=parseInt(n.find(".monthselect").val(),10),h=n.find(".yearselect").val();t||(h<this.startDate.year()||h==this.startDate.year()&&o<this.startDate.month())&&(o=this.startDate.month(),h=this.startDate.year()),this.minDate&&(h<this.minDate.year()||h==this.minDate.year()&&o<this.minDate.month())&&(o=this.minDate.month(),h=this.minDate.year()),this.maxDate&&(h>this.maxDate.year()||h==this.maxDate.year()&&o>this.maxDate.month())&&(o=this.maxDate.month(),h=this.maxDate.year()),t?(this.leftCalendar.month.month(o).year(h),this.linkedCalendars&&(this.rightCalendar.month=this.leftCalendar.month.clone().add(1,"month"))):(this.rightCalendar.month.month(o).year(h),this.linkedCalendars&&(this.leftCalendar.month=this.rightCalendar.month.clone().subtract(1,"month"))),this.updateCalendars()},timeChanged:function(e){var t=i(e.target).closest(".drp-calendar"),a=t.hasClass("left"),n=parseInt(t.find(".hourselect").val(),10),o=parseInt(t.find(".minuteselect").val(),10);isNaN(o)&&(o=parseInt(t.find(".minuteselect option:last").val(),10));var h=this.timePickerSeconds?parseInt(t.find(".secondselect").val(),10):0;if(!this.timePicker24Hour){var d=t.find(".ampmselect").val();d==="PM"&&n<12&&(n+=12),d==="AM"&&n===12&&(n=0)}if(a){var c=this.startDate.clone();c.hour(n),c.minute(o),c.second(h),this.setStartDate(c),this.singleDatePicker?this.endDate=this.startDate.clone():this.endDate&&this.endDate.format("YYYY-MM-DD")==c.format("YYYY-MM-DD")&&this.endDate.isBefore(c)&&this.setEndDate(c.clone())}else if(this.endDate){var f=this.endDate.clone();f.hour(n),f.minute(o),f.second(h),this.setEndDate(f)}this.updateCalendars(),this.updateFormInputs(),this.renderTimePicker("left"),this.renderTimePicker("right")},elementChanged:function(){if(this.element.is("input")&&this.element.val().length){var e=this.element.val().split(this.locale.separator),t=null,a=null;e.length===2&&(t=l(e[0],this.locale.format),a=l(e[1],this.locale.format)),(this.singleDatePicker||t===null||a===null)&&(t=l(this.element.val(),this.locale.format),a=t),!(!t.isValid()||!a.isValid())&&(this.setStartDate(t),this.setEndDate(a),this.updateView())}},keydown:function(e){(e.keyCode===9||e.keyCode===13)&&this.hide(),e.keyCode===27&&(e.preventDefault(),e.stopPropagation(),this.hide())},updateElement:function(){if(this.element.is("input")&&this.autoUpdateInput){var e=this.startDate.format(this.locale.format);this.singleDatePicker||(e+=this.locale.separator+this.endDate.format(this.locale.format)),e!==this.element.val()&&this.element.val(e).trigger("change")}},remove:function(){this.container.remove(),this.element.off(".daterangepicker"),this.element.removeData()}},i.fn.daterangepicker=function(e,t){var a=i.extend(!0,{},i.fn.daterangepicker.defaultOptions,e);return this.each(function(){var n=i(this);n.data("daterangepicker")&&n.data("daterangepicker").remove(),n.data("daterangepicker",new w(n,a,t))}),this},w});
/**
* @version: 3.1
* @author: Dan Grossman http://www.dangrossman.info/
* @copyright: Copyright (c) 2012-2019 Dan Grossman. All rights reserved.
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
* @website: http://www.daterangepicker.com/
* forked at: https://github.com/s-cork/daterangepicker
*/
