@syncfusion/ej2-calendars
Version:
A complete package of date or time components with built-in features such as date formatting, inline editing, multiple (range) selection, range restriction, month and year selection, strict mode, and globalization.
10 lines • 376 kB
JavaScript
/*!
* filename: ej2-calendars.umd.min.js
* version : 29.1.35
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-lists")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-popups","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-lists"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Popups,e.ej2Inputs,e.ej2Buttons,e.ej2Lists)}(this,function(i,N,H,o,W,F){"use strict";L=function(e,t){return(L=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var L,B,j=function(e,t){function i(){this.constructor=e}L(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,s){var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;0<=l;l--)(a=e[l])&&(r=(n<3?a(r):3<n?a(t,i,r):a(t,i))||r);return 3<n&&r&&Object.defineProperty(t,i,r),r},O="e-other-month",Y="e-other-year",R="e-calendar",z="e-device",q="e-rtl",K="e-year",G="e-month",_="e-decade",Z="e-icons",I="e-disabled",X="e-overlay",J="e-week-number",T="e-selected",y="e-focused-date",$="e-focused-cell",Q="e-month-hide",ee="e-today",te="e-day",ie="e-cell",se="e-zoomin",ae="e-calendar-day-header-lg",ne=864e5,re=(B=N.Component,j(t,B),t.prototype.render=function(){this.rangeValidation(this.min,this.max),this.calendarEleCopy=this.element.cloneNode(!0),"Islamic"===this.calendarMode&&(+this.min.setSeconds(0)==+new Date(1900,0,1,0,0,0)&&(this.min=new Date(1944,2,18)),+this.max==+new Date(2099,11,31))&&(this.max=new Date(2069,10,16)),this.globalize=new N.Internationalization(this.locale),(N.isNullOrUndefined(this.firstDayOfWeek)||6<this.firstDayOfWeek||this.firstDayOfWeek<0)&&this.setProperties({firstDayOfWeek:this.globalize.getFirstDayOfWeek()},!0),this.todayDisabled=!1,this.todayDate=new Date((new Date).setHours(0,0,0,0)),"calendar"===this.getModuleName()?(this.element.classList.add(R),this.enableRtl&&this.element.classList.add(q),N.Browser.isDevice&&this.element.classList.add(z),N.attributes(this.element,{"data-role":"calendar"}),this.tabIndex=this.element.hasAttribute("tabindex")?this.element.getAttribute("tabindex"):"0",this.element.setAttribute("tabindex",this.tabIndex)):(this.calendarElement=this.createElement("div"),this.calendarElement.classList.add(R),this.enableRtl&&this.calendarElement.classList.add(q),N.Browser.isDevice&&this.calendarElement.classList.add(z),N.attributes(this.calendarElement,{"data-role":"calendar"})),!N.isNullOrUndefined(N.closest(this.element,"fieldset"))&&N.closest(this.element,"fieldset").disabled&&(this.enabled=!1),this.createHeader(),this.createContent(),this.wireEvents()},t.prototype.rangeValidation=function(e,t){N.isNullOrUndefined(e)&&this.setProperties({min:new Date(1900,0,1)},!0),N.isNullOrUndefined(t)&&this.setProperties({max:new Date(2099,11,31)},!0)},t.prototype.getDefaultKeyConfig=function(){return this.defaultKeyConfigs={controlUp:"ctrl+38",controlDown:"ctrl+40",moveDown:"downarrow",moveUp:"uparrow",moveLeft:"leftarrow",moveRight:"rightarrow",select:"enter",home:"home",end:"end",pageUp:"pageup",pageDown:"pagedown",shiftPageUp:"shift+pageup",shiftPageDown:"shift+pagedown",controlHome:"ctrl+home",controlEnd:"ctrl+end",altUpArrow:"alt+uparrow",spacebar:"space",altRightArrow:"alt+rightarrow",altLeftArrow:"alt+leftarrow"},this.defaultKeyConfigs},t.prototype.validateDate=function(e){this.setProperties({min:this.checkDateValue(new Date(this.checkValue(this.min)))},!0),this.setProperties({max:this.checkDateValue(new Date(this.checkValue(this.max)))},!0),this.currentDate=this.currentDate||new Date((new Date).setHours(0,0,0,0)),!N.isNullOrUndefined(e)&&this.min<=this.max&&e>=this.min&&e<=this.max&&(this.currentDate=new Date(this.checkValue(e)))},t.prototype.setOverlayIndex=function(e,t,i,s){!s||N.isNullOrUndefined(t)||N.isNullOrUndefined(i)||N.isNullOrUndefined(e)||(s=parseInt(t.style.zIndex,10)?parseInt(t.style.zIndex,10):1e3,i.style.zIndex=(s-1).toString(),e.style.zIndex=s.toString())},t.prototype.minMaxUpdate=function(e){+this.min<=+this.max?N.removeClass([this.element],X):(this.setProperties({min:this.min},!0),N.addClass([this.element],X)),this.min=N.isNullOrUndefined(this.min)||!+this.min?this.min=new Date(1900,0,1):this.min,this.max=N.isNullOrUndefined(this.max)||!+this.max?this.max=new Date(2099,11,31):this.max,+this.min<=+this.max&&e&&+e<=+this.max&&+e>=+this.min?this.currentDate=new Date(this.checkValue(e)):+this.min<=+this.max&&!e&&+this.currentDate>+this.max?this.currentDate=new Date(this.checkValue(this.max)):+this.currentDate<+this.min&&(this.currentDate=new Date(this.checkValue(this.min)))},t.prototype.createHeader=function(){var e={tabindex:"0"},t=(this.headerElement=this.createElement("div",{className:"e-header"}),this.createElement("div",{className:"e-icon-container"}));this.previousIcon=this.createElement("button",{className:"e-prev",attrs:{type:"button"}}),N.rippleEffect(this.previousIcon,{duration:400,selector:".e-prev",isCenterRipple:!0}),N.attributes(this.previousIcon,{"aria-disabled":"false","aria-label":"previous month"}),N.attributes(this.previousIcon,e),this.nextIcon=this.createElement("button",{className:"e-next",attrs:{type:"button"}}),N.rippleEffect(this.nextIcon,{selector:".e-next",duration:400,isCenterRipple:!0}),"daterangepicker"===this.getModuleName()&&(N.attributes(this.previousIcon,{tabIndex:"-1"}),N.attributes(this.nextIcon,{tabIndex:"-1"})),N.attributes(this.nextIcon,{"aria-disabled":"false","aria-label":"next month"}),N.attributes(this.nextIcon,e),this.headerTitleElement=this.createElement("div",{className:te+" e-title"}),N.attributes(this.headerTitleElement,{"aria-atomic":"true","aria-live":"assertive","aria-label":"title"}),N.attributes(this.headerTitleElement,e),this.headerElement.appendChild(this.headerTitleElement),this.previousIcon.appendChild(this.createElement("span",{className:"e-date-icon-prev "+Z})),this.nextIcon.appendChild(this.createElement("span",{className:"e-date-icon-next "+Z})),t.appendChild(this.previousIcon),t.appendChild(this.nextIcon),this.headerElement.appendChild(t),("calendar"===this.getModuleName()?this.element:this.calendarElement).appendChild(this.headerElement),this.adjustLongHeaderSize()},t.prototype.createContent=function(){this.contentElement=this.createElement("div",{className:"e-content"}),this.table=this.createElement("table",{attrs:{class:"e-calendar-content-table",tabIndex:"0",role:"grid","aria-activedescendant":"","aria-labelledby":this.element.id}}),("calendar"===this.getModuleName()?this.element:this.calendarElement).appendChild(this.contentElement),this.contentElement.appendChild(this.table),this.createContentHeader(),this.createContentBody(),this.showTodayButton&&this.createContentFooter(),"daterangepicker"!==this.getModuleName()&&(N.EventHandler.add(this.table,"focus",this.addContentFocus,this),N.EventHandler.add(this.table,"blur",this.removeContentFocus,this))},t.prototype.addContentFocus=function(e){var t=this.tableBodyElement.querySelector("tr td.e-focused-date"),i=this.tableBodyElement.querySelector("tr td.e-selected");N.isNullOrUndefined(i)?N.isNullOrUndefined(t)||t.classList.add($):i.classList.add($)},t.prototype.removeContentFocus=function(e){var t=N.isNullOrUndefined(this.tableBodyElement)?null:this.tableBodyElement.querySelector("tr td.e-focused-date"),i=N.isNullOrUndefined(this.tableBodyElement)?null:this.tableBodyElement.querySelector("tr td.e-selected");N.isNullOrUndefined(i)?N.isNullOrUndefined(t)||t.classList.remove($):i.classList.remove($)},t.prototype.getCultureValues=function(){var e=[],t=N.isNullOrUndefined(this.dayHeaderFormat)?null:"days.stand-alone."+this.dayHeaderFormat.toLowerCase(),i="en"!==this.locale&&"en-US"!==this.locale||N.isNullOrUndefined(t)?this.getCultureObjects(N.cldrData,""+this.locale):N.getValue(t,N.getDefaultDateObject());if(!N.isNullOrUndefined(i))for(var s=0,a=Object.keys(i);s<a.length;s++){var n=a[s];e.push(N.getValue(n,i))}return e},t.prototype.toCapitalize=function(e){return!N.isNullOrUndefined(e)&&e.length?e[0].toUpperCase()+e.slice(1):e},t.prototype.createContentHeader=function(){"calendar"===this.getModuleName()?N.isNullOrUndefined(this.element.querySelectorAll(".e-content .e-week-header")[0])||N.detach(this.element.querySelectorAll(".e-content .e-week-header")[0]):N.isNullOrUndefined(this.calendarElement.querySelectorAll(".e-content .e-week-header")[0])||N.detach(this.calendarElement.querySelectorAll(".e-content .e-week-header")[0]);var e="",t=((6<this.firstDayOfWeek||this.firstDayOfWeek<0)&&this.setProperties({firstDayOfWeek:0},!0),this.tableHeadElement=this.createElement("thead",{className:"e-week-header"}),this.weekNumber&&(e+='<th class="e-week-number" aria-hidden="true"></th>',"calendar"===this.getModuleName()?N.addClass([this.element],J):N.addClass([this.calendarElement],J)),0<this.getCultureValues().length&&this.getCultureValues()?this.shiftArray(0<this.getCultureValues().length&&this.getCultureValues(),this.firstDayOfWeek):null);if(!N.isNullOrUndefined(t))for(var i=0;i<=6;i++)e+='<th class="">'+this.toCapitalize(t[i])+"</th>";this.tableHeadElement.innerHTML=e="<tr>"+e+"</tr>",this.table.appendChild(this.tableHeadElement)},t.prototype.createContentBody=function(){switch("calendar"===this.getModuleName()?N.isNullOrUndefined(this.element.querySelectorAll(".e-content tbody")[0])||N.detach(this.element.querySelectorAll(".e-content tbody")[0]):N.isNullOrUndefined(this.calendarElement.querySelectorAll(".e-content tbody")[0])||N.detach(this.calendarElement.querySelectorAll(".e-content tbody")[0]),this.start){case"Year":this.renderYears();break;case"Decade":this.renderDecades();break;default:this.renderMonths()}},t.prototype.updateFooter=function(){this.todayElement.textContent=this.l10.getConstant("today"),this.todayElement.setAttribute("aria-label",this.l10.getConstant("today")),this.todayElement.setAttribute("tabindex","0")},t.prototype.createContentFooter=function(){var e,t;this.showTodayButton&&(e=new Date(+this.min),t=new Date(+this.max),this.globalize=new N.Internationalization(this.locale),this.l10=new N.L10n(this.getModuleName(),{today:"Today"},this.locale),this.todayElement=this.createElement("button",{attrs:{role:"button"}}),N.rippleEffect(this.todayElement),this.updateFooter(),N.addClass([this.todayElement],["e-btn",ee,"e-flat","e-primary","e-css"]),+new Date(e.setHours(0,0,0,0))<=+this.todayDate&&+this.todayDate<=+new Date(t.setHours(0,0,0,0))&&!this.todayDisabled||N.addClass([this.todayElement],I),this.footer=this.createElement("div",{className:"e-footer-container"}),this.footer.appendChild(this.todayElement),"calendar"===this.getModuleName()&&this.element.appendChild(this.footer),"datepicker"===this.getModuleName()&&this.calendarElement.appendChild(this.footer),"datetimepicker"===this.getModuleName()&&this.calendarElement.appendChild(this.footer),this.todayElement.classList.contains(I)||N.EventHandler.add(this.todayElement,"click",this.todayButtonClick,this))},t.prototype.wireEvents=function(e,t,i,s){N.EventHandler.add(this.headerTitleElement,"click",this.navigateTitle,this),this.defaultKeyConfigs=N.extend(this.defaultKeyConfigs,this.keyConfigs),"calendar"===this.getModuleName()?this.keyboardModule=new N.KeyboardEvents(this.element,{eventName:"keydown",keyAction:this.keyActionHandle.bind(this),keyConfigs:this.defaultKeyConfigs}):this.keyboardModule=new N.KeyboardEvents(this.calendarElement,{eventName:"keydown",keyAction:this.keyActionHandle.bind(this),keyConfigs:this.defaultKeyConfigs})},t.prototype.dateWireEvents=function(e,t,i,s){this.defaultKeyConfigs=this.getDefaultKeyConfig(),this.defaultKeyConfigs=N.extend(this.defaultKeyConfigs,i),this.serverModuleName=s},t.prototype.todayButtonClick=function(e,t,i){this.showTodayButton&&(this.currentView()===this.depth?this.effect="":this.effect="e-zoomin",this.getViewNumber(this.start)>=this.getViewNumber(this.depth)?this.navigateTo(this.depth,new Date(this.checkValue(t)),i):this.navigateTo("Month",new Date(this.checkValue(t)),i))},t.prototype.resetCalendar=function(){this.calendarElement&&N.detach(this.calendarElement),this.tableBodyElement&&N.detach(this.tableBodyElement),this.table&&N.detach(this.table),this.tableHeadElement&&N.detach(this.tableHeadElement),this.nextIcon&&N.detach(this.nextIcon),this.previousIcon&&N.detach(this.previousIcon),this.footer&&N.detach(this.footer),this.todayElement=null,this.renderDayCellArgs=null,this.calendarElement=this.tableBodyElement=this.footer=this.tableHeadElement=this.nextIcon=this.previousIcon=this.table=null},t.prototype.keyActionHandle=function(e,t,i){if(null!==this.calendarElement||"escape"!==e.action){var s,a,n=this.tableBodyElement.querySelector("tr td.e-focused-date"),r=!i||N.isNullOrUndefined(n)||+t!==parseInt(n.getAttribute("id").split("_")[0],10)?this.tableBodyElement.querySelector("tr td.e-selected"):n,l=this.getViewNumber(this.currentView()),i=this.getViewNumber(this.depth),o=l===i&&this.getViewNumber(this.start)>=i;switch(this.effect="",e.action){case"moveLeft":"daterangepicker"===this.getModuleName()||N.isNullOrUndefined(e.target)||(this.keyboardNavigate(-1,l,e,this.max,this.min),e.preventDefault());break;case"moveRight":"daterangepicker"===this.getModuleName()||N.isNullOrUndefined(e.target)||(this.keyboardNavigate(1,l,e,this.max,this.min),e.preventDefault());break;case"moveUp":"daterangepicker"===this.getModuleName()||N.isNullOrUndefined(e.target)||(0===l?this.keyboardNavigate(-7,l,e,this.max,this.min):this.keyboardNavigate(-4,l,e,this.max,this.min),e.preventDefault());break;case"moveDown":"daterangepicker"===this.getModuleName()||N.isNullOrUndefined(e.target)||(0===l?this.keyboardNavigate(7,l,e,this.max,this.min):this.keyboardNavigate(4,l,e,this.max,this.min),e.preventDefault());break;case"select":e.target===this.headerTitleElement?this.navigateTitle(e):e.target!==this.previousIcon||e.target.className.includes(I)?e.target!==this.nextIcon||e.target.className.includes(I)?e.target!==this.todayElement||e.target.className.includes(I)?(s=N.isNullOrUndefined(n)?r:n,N.isNullOrUndefined(s)||s.classList.contains(I)||(o?(a=new Date(parseInt(""+s.id,0)),this.selectDate(e,a,s),"datepicker"!==this.getModuleName()&&"datetimepicker"!==this.getModuleName()||(this.isAngular?this.inputElement:this.element).focus()):e.target.className.includes(I)||this.contentClick(null,--l,s,t))):(this.todayButtonClick(e,t),"datepicker"!==this.getModuleName()&&"datetimepicker"!==this.getModuleName()||(this.isAngular?this.inputElement:this.element).focus()):this.navigateNext(e):this.navigatePrevious(e);break;case"controlUp":this.title(),e.preventDefault();break;case"controlDown":(N.isNullOrUndefined(n)||o)&&(N.isNullOrUndefined(r)||o)||this.contentClick(null,--l,n||r,t),e.preventDefault();break;case"home":this.currentDate=this.firstDay(this.currentDate),N.detach(this.tableBodyElement),0===l?this.renderMonths(e):1===l?this.renderYears(e):this.renderDecades(e),e.preventDefault();break;case"end":this.currentDate=this.lastDay(this.currentDate,l),N.detach(this.tableBodyElement),0===l?this.renderMonths(e):1===l?this.renderYears(e):this.renderDecades(e),e.preventDefault();break;case"pageUp":this.addMonths(this.currentDate,-1),this.navigateTo("Month",this.currentDate),e.preventDefault();break;case"pageDown":this.addMonths(this.currentDate,1),this.navigateTo("Month",this.currentDate),e.preventDefault();break;case"shiftPageUp":this.addYears(this.currentDate,-1),this.navigateTo("Month",this.currentDate),e.preventDefault();break;case"shiftPageDown":this.addYears(this.currentDate,1),this.navigateTo("Month",this.currentDate),e.preventDefault();break;case"controlHome":this.navigateTo("Month",new Date(this.currentDate.getFullYear(),0,1)),e.preventDefault();break;case"controlEnd":this.navigateTo("Month",new Date(this.currentDate.getFullYear(),11,31)),e.preventDefault();break;case"tab":"datepicker"!==this.getModuleName()&&"datetimepicker"!==this.getModuleName()||e.target!==this.todayElement||(e.preventDefault(),(this.isAngular?this.inputElement:this.element).focus(),this.hide());break;case"shiftTab":"datepicker"!==this.getModuleName()&&"datetimepicker"!==this.getModuleName()||e.target!==this.headerTitleElement||(e.preventDefault(),(this.isAngular?this.inputElement:this.element).focus(),this.hide());break;case"escape":"datepicker"!==this.getModuleName()&&"datetimepicker"!==this.getModuleName()||e.target!==this.headerTitleElement&&e.target!==this.previousIcon&&e.target!==this.nextIcon&&e.target!==this.todayElement||this.hide()}}},t.prototype.keyboardNavigate=function(e,t,i,s,a){var n=new Date(this.checkValue(this.currentDate));switch(t){case 2:this.addYears(this.currentDate,e),this.isMonthYearRange(this.currentDate)?(N.detach(this.tableBodyElement),this.renderDecades(i)):this.currentDate=n;break;case 1:this.addMonths(this.currentDate,e),this.calendarMode,this.isMonthYearRange(this.currentDate)?(N.detach(this.tableBodyElement),this.renderYears(i)):this.currentDate=n;break;case 0:this.addDay(this.currentDate,e,i,s,a),this.isMinMaxRange(this.currentDate)?(N.detach(this.tableBodyElement),this.renderMonths(i)):this.currentDate=n}},t.prototype.preRender=function(e){var t=this;this.navigatePreviousHandler=this.navigatePrevious.bind(this),this.navigateNextHandler=this.navigateNext.bind(this),this.defaultKeyConfigs=this.getDefaultKeyConfig(),this.navigateHandler=function(e){t.triggerNavigate(e)}},t.prototype.minMaxDate=function(e){var t=new Date(new Date(+e).setHours(0,0,0,0)),i=new Date(new Date(+this.min).setHours(0,0,0,0)),s=new Date(new Date(+this.max).setHours(0,0,0,0));return+t!=+i&&+t!=+s||+(e=+e<+this.min?new Date(+this.min):e)>+this.max&&(e=new Date(+this.max)),e},t.prototype.renderMonths=function(e,t,i){var s=this.weekNumber?8:7,i="Gregorian"===this.calendarMode?this.renderDays(this.currentDate,t,null,null,i,e):N.isNullOrUndefined(this.islamicModule)?null:this.islamicModule.islamicRenderDays(this.currentDate,t);this.createContentHeader(),"Gregorian"===this.calendarMode?this.renderTemplate(i,s,G,e,t):N.isNullOrUndefined(this.islamicModule)||this.islamicModule.islamicRenderTemplate(i,s,G,e,t)},t.prototype.renderDays=function(e,t,i,s,a,n){for(var r=[],l=a?new Date(+e):this.getDate(new Date,this.timezone),o=(h=new Date(this.checkValue(e))).getMonth(),a=(this.titleUpdate(e,"days"),h),h=new Date(a.getFullYear(),a.getMonth(),0,a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds());h.getDay()!==this.firstDayOfWeek;)this.setStartDate(h,-1*ne);for(var u=0;u<42;++u){var d,p=this.createElement("td",{className:ie}),c=this.createElement("span"),c=(u%7==0&&this.weekNumber&&(d="FirstDay"===this.weekRule?6:"FirstFourDayWeek"===this.weekRule?3:0,d=new Date(h.getFullYear(),h.getMonth(),h.getDate()+d),c.textContent=""+this.getWeek(d),p.appendChild(c),N.addClass([p],J),r.push(p)),d=new Date(+h),h=this.minMaxDate(h),{type:"dateTime",skeleton:"full"}),m=this.globalize.parseDate(this.globalize.formatDate(h,c),c),f=this.dayCell(h),p=this.globalize.formatDate(h,{type:"date",skeleton:"full"}),c=this.createElement("span"),v=(c.textContent=this.globalize.formatDate(h,{format:"d",type:"date",skeleton:"yMd"}),this.min>h||this.max<h),g=(v?(N.addClass([f],I),N.addClass([f],X)):c.setAttribute("title",""+p),o!==h.getMonth()&&(N.addClass([f],O),c.setAttribute("aria-disabled","true")),0!==h.getDay()&&6!==h.getDay()||N.addClass([f],"e-weekend"),f.appendChild(c),this.renderDayCellArgs={date:h,isDisabled:!1,element:f,isOutOfRange:v},this.renderDayCellArgs);if(this.renderDayCellEvent(g),g.isDisabled){p=new Date(this.checkValue(t)),v=new Date(this.checkValue(g.date));if(i){if(!N.isNullOrUndefined(s)&&0<s.length)for(var y=0;y<s.length;y++)+new Date(this.globalize.formatDate(g.date,{type:"date",skeleton:"yMd"}))===+new Date(this.globalize.formatDate(s[y],{type:"date",skeleton:"yMd"}))&&(s.splice(y,1),y=-1)}else p&&+p==+v&&this.setProperties({value:null},!0)}this.renderDayCellArgs.isDisabled&&!f.classList.contains(T)&&(N.addClass([f],I),N.addClass([f],X),c.setAttribute("aria-disabled","true"),+this.renderDayCellArgs.date==+this.todayDate)&&(this.todayDisabled=!0);var b=f.classList.contains(O),D=f.classList.contains(I),E=(D||N.EventHandler.add(f,"click",this.clickHandler,this),void 0);if(N.isNullOrUndefined(n)||"click"!==n.type||(E=n.currentTarget),!i||N.isNullOrUndefined(s)||D)!D&&this.getDateVal(h,t)&&N.addClass([f],T);else{for(var C=0;C<s.length;C++){var k={format:null,type:"date",skeleton:"short",calendar:"Gregorian"===this.calendarMode?"gregorian":"islamic"};if((this.globalize.formatDate(h,k)===this.globalize.formatDate(s[C],k)&&this.getDateVal(h,s[C])||this.getDateVal(h,t))&&N.addClass([f],T),!N.isNullOrUndefined(E)&&E.innerText===f.innerText&&this.previousDates&&f.classList.contains(T)&&E.classList.contains(T)){N.removeClass([f],T),this.previousDates=!1;for(var M=this.copyValues(s),w=0;w<M.length;w++){var V={format:null,type:"date",skeleton:"short",calendar:"Gregorian"===this.calendarMode?"gregorian":"islamic"};this.globalize.formatDate(m,V)===this.globalize.formatDate(M[w],V)&&(y=M.indexOf(M[w]),M.splice(y,1),s.splice(y,1))}this.setProperties({values:M},!0)}else this.updateFocus(b,D,h,f,e)}s.length<=0&&this.updateFocus(b,D,h,f,e)}this.updateFocus(b,D,h,f,e),N.isNullOrUndefined(m)||m.getFullYear()!==l.getFullYear()||m.getMonth()!==l.getMonth()||m.getDate()!==l.getDate()||N.addClass([f],ee),r.push(this.renderDayCellArgs.element),h=new Date(+d),this.addDay(h,1,null,this.max,this.min)}return r},t.prototype.updateFocus=function(e,t,i,s,a){(a.getDate()===i.getDate()&&!e&&!t||(a>=this.max&&parseInt(s.id,0)===+this.max&&!e&&!t&&N.addClass([s],y),a<=this.min&&parseInt(s.id,0)===+this.min&&!e&&!t))&&N.addClass([s],y)},t.prototype.renderYears=function(e,t){this.removeTableHeadElement();var i=[],s=N.isNullOrUndefined(t),a=new Date(this.checkValue(this.currentDate)),n=a.getMonth(),r=a.getFullYear(),l=a,o=l.getFullYear(),h=new Date(this.checkValue(this.min)).getFullYear(),u=new Date(this.checkValue(this.min)).getMonth(),d=new Date(this.checkValue(this.max)).getFullYear(),p=new Date(this.checkValue(this.max)).getMonth();l.setMonth(0),this.titleUpdate(this.currentDate,"months"),l.setDate(1);for(var c=0;c<12;++c){var m=this.dayCell(l),f=this.createElement("span"),v=t&&t.getMonth()===l.getMonth(),v=t&&t.getFullYear()===r&&v,g=this.globalize.formatDate(l,{type:"date",format:"MMM y"});f.textContent=this.toCapitalize(this.globalize.formatDate(l,{format:null,type:"dateTime",skeleton:"MMM"})),this.min&&(o<h||c<u&&o===h)||this.max&&(d<o||p<c&&d<=o)?N.addClass([m],I):!s&&v?N.addClass([m],T):l.getMonth()===n&&this.currentDate.getMonth()===n&&N.addClass([m],y),l.setDate(1),l.setMonth(l.getMonth()+1),m.classList.contains(I)||(N.EventHandler.add(m,"click",this.clickHandler,this),f.setAttribute("title",""+g)),m.appendChild(f),i.push(m)}this.renderTemplate(i,4,K,e,t)},t.prototype.renderDecades=function(e,t){this.removeTableHeadElement();var i=[],s=new Date(this.checkValue(this.currentDate)),a=(s.setMonth(0),s.setDate(1),s.getFullYear()),n=new Date(s.setFullYear(a-a%10)),r=new Date(s.setFullYear(a-a%10+9)),l=n.getFullYear(),o=r.getFullYear(),n=this.globalize.formatDate(n,{format:null,type:"dateTime",skeleton:"y"}),r=this.globalize.formatDate(r,{format:null,type:"dateTime",skeleton:"y"});this.headerTitleElement.textContent=n+" - "+r;for(var h=new Date(a-a%10-1,0,1).getFullYear(),u=0;u<12;++u){var d=h+u,p=(s.setFullYear(d),this.dayCell(s)),c=this.createElement("span");c.textContent=this.globalize.formatDate(s,{format:null,type:"dateTime",skeleton:"y"}),d<l||o<d?(N.addClass([p],Y),c.setAttribute("aria-disabled","true"),N.isNullOrUndefined(t)||s.getFullYear()!==t.getFullYear()||N.addClass([p],T),(d<new Date(this.checkValue(this.min)).getFullYear()||d>new Date(this.checkValue(this.max)).getFullYear())&&N.addClass([p],I)):d<new Date(this.checkValue(this.min)).getFullYear()||d>new Date(this.checkValue(this.max)).getFullYear()?N.addClass([p],I):N.isNullOrUndefined(t)||s.getFullYear()!==t.getFullYear()?s.getFullYear()!==this.currentDate.getFullYear()||p.classList.contains(I)||N.addClass([p],y):N.addClass([p],T),p.classList.contains(I)||(N.EventHandler.add(p,"click",this.clickHandler,this),c.setAttribute("title",""+c.textContent)),p.appendChild(c),i.push(p)}this.renderTemplate(i,4,"e-decade",e,t)},t.prototype.dayCell=function(e){var t,i={skeleton:"full",type:"dateTime",calendar:"Gregorian"===this.calendarMode?"gregorian":"islamic"},e=this.globalize.parseDate(this.globalize.formatDate(e,i),i),i=(N.isNullOrUndefined(e)||(t=e.valueOf()),{className:ie,attrs:{id:""+N.getUniqueID(""+t),"aria-selected":"false"}});return this.createElement("td",i)},t.prototype.firstDay=function(e){var t="Decade"!==this.currentView()?this.tableBodyElement.querySelectorAll("td:not(."+O+"):not(."+J+")"):this.tableBodyElement.querySelectorAll("td:not(."+Y);if(t.length)for(var i=0;i<t.length;i++)if(!t[i].classList.contains(I)){e=new Date(parseInt(t[i].id,0));break}return e},t.prototype.lastDay=function(e,t){var i=new Date(e.getFullYear(),e.getMonth()+1,0);return 2!==t?((t=Math.abs(i.getTimezoneOffset()-this.firstDay(e).getTimezoneOffset()))&&i.setHours(this.firstDay(e).getHours()+t/60),this.findLastDay(i)):this.findLastDay(this.firstDay(i))},t.prototype.checkDateValue=function(e){return!N.isNullOrUndefined(e)&&e instanceof Date&&!isNaN(+e)?e:null},t.prototype.findLastDay=function(e){var t="Decade"===this.currentView()?this.tableBodyElement.querySelectorAll("td:not(."+Y):this.tableBodyElement.querySelectorAll("td:not(."+O+"):not(."+J+")");if(t.length)for(var i=t.length-1;0<=i;i--)if(!t[i].classList.contains(I)){e=new Date(parseInt(t[i].id,0));break}return e},t.prototype.removeTableHeadElement=function(){"calendar"===this.getModuleName()?N.isNullOrUndefined(this.element.querySelectorAll(".e-content table thead")[0])||N.detach(this.tableHeadElement):N.isNullOrUndefined(this.calendarElement.querySelectorAll(".e-content table thead")[0])||N.detach(this.tableHeadElement)},t.prototype.renderTemplate=function(e,t,i,s,a){for(var n,r=this.getViewNumber(this.currentView()),l=(this.tableBodyElement=this.createElement("tbody"),this.table.appendChild(this.tableBodyElement),N.removeClass([this.contentElement,this.headerElement],[G,_,K]),N.addClass([this.contentElement,this.headerElement],[i]),t),o=0,h=0;h<e.length/t;++h){for(n=this.createElement("tr"),o=0+o;o<l;o++)e[o].classList.contains("e-week-number")||N.isNullOrUndefined(e[o].children[0])||(N.addClass([e[o].children[0]],[te]),N.rippleEffect(e[o].children[0],{duration:600,isCenterRipple:!0})),n.appendChild(e[o]),this.weekNumber&&7===o&&e[7].classList.contains(O)&&N.addClass([n],Q),!this.weekNumber&&6===o&&e[6].classList.contains(O)&&N.addClass([n],Q),this.weekNumber?41===o&&e[41].classList.contains(O)&&N.addClass([n],Q):35===o&&e[35].classList.contains(O)&&N.addClass([n],Q);l+=t,o+=0,this.tableBodyElement.appendChild(n)}this.table.querySelector("tbody").className=this.effect,"Gregorian"===this.calendarMode?this.iconHandler():this.islamicModule.islamicIconHandler(),(r!==this.getViewNumber(this.currentView())||0===r&&r!==this.getViewNumber(this.currentView()))&&this.navigateHandler(s),this.setAriaActiveDescendant()},t.prototype.clickHandler=function(e,t){this.clickEventEmitter(e);var i=e.currentTarget,s=this.getViewNumber(this.currentView());i.classList.contains(O)?this.contentClick(e,0,null,t):s===this.getViewNumber(this.depth)&&this.getViewNumber(this.start)>=this.getViewNumber(this.depth)||2===s?this.contentClick(e,1,null,t):i.classList.contains(O)||0!==s?this.contentClick(e,0,i,t):this.selectDate(e,this.getIdValue(e,null),null),"calendar"===this.getModuleName()&&this.table.focus()},t.prototype.clickEventEmitter=function(e){e.preventDefault()},t.prototype.contentClick=function(e,t,i,s){var a,n=this.getViewNumber(this.currentView()),r=this.getIdValue(e,i);switch(t){case 0:n===this.getViewNumber(this.depth)&&this.getViewNumber(this.start)>=this.getViewNumber(this.depth)?(N.detach(this.tableBodyElement),this.currentDate=r,this.effect=se):("Gregorian"===this.calendarMode?(this.currentDate.setMonth(r.getMonth()),0<r.getMonth()&&this.currentDate.getMonth()!==r.getMonth()&&this.currentDate.setDate(0),this.currentDate.setFullYear(r.getFullYear())):this.currentDate=r,this.effect=se,N.detach(this.tableBodyElement)),this.renderMonths(e);break;case 1:n===this.getViewNumber(this.depth)&&this.getViewNumber(this.start)>=this.getViewNumber(this.depth)?this.selectDate(e,r,null):("Gregorian"===this.calendarMode?this.currentDate.setFullYear(r.getFullYear()):(this.islamicPreviousHeader=this.headerElement.textContent,a=this.islamicModule.getIslamicDate(r),this.currentDate=this.islamicModule.toGregorian(a.year,a.month,1)),this.effect=se,N.detach(this.tableBodyElement),this.renderYears(e))}},t.prototype.switchView=function(e,t,i,s){switch(e){case 0:N.detach(this.tableBodyElement),this.renderMonths(t,null,s);break;case 1:N.detach(this.tableBodyElement),this.renderYears(t);break;case 2:N.detach(this.tableBodyElement),this.renderDecades(t)}},t.prototype.getModuleName=function(){return"calendar"},t.prototype.requiredModules=function(){var e=[];return"Islamic"===this.calendarMode&&e.push({args:[this],member:"islamic",name:"Islamic"}),e},t.prototype.getPersistData=function(){return this.addOnPersist(["value"])},t.prototype.onPropertyChanged=function(e,t,i,s){this.effect="";for(var a=0,n=Object.keys(e);a<n.length;a++){var r=n[a];switch(r){case"enableRtl":e.enableRtl?("calendar"===this.getModuleName()?this.element:this.calendarElement).classList.add("e-rtl"):("calendar"===this.getModuleName()?this.element:this.calendarElement).classList.remove("e-rtl");break;case"dayHeaderFormat":this.getCultureValues(),("datepicker"!==this.getModuleName()||this.calendarElement)&&this.createContentHeader(),this.adjustLongHeaderSize();break;case"min":case"max":this.rangeValidation(this.min,this.max),"min"===r?this.setProperties({min:this.checkDateValue(new Date(this.checkValue(e.min)))},!0):this.setProperties({max:this.checkDateValue(new Date(this.checkValue(e.max)))},!0),this.setProperties({start:this.currentView()},!0),this.tableBodyElement&&N.detach(this.tableBodyElement),this.minMaxUpdate(),i&&this.validateValues(i,s),("datepicker"!==this.getModuleName()||this.calendarElement)&&this.createContentBody(),(this.todayDate<this.min||this.max<this.todayDate)&&this.footer&&this.todayElement?(N.detach(this.todayElement),N.detach(this.footer),this.todayElement=this.footer=null,this.createContentFooter()):this.footer&&this.todayElement&&this.todayElement.classList.contains("e-disabled")&&(N.removeClass([this.todayElement],I),N.detach(this.todayElement),N.detach(this.footer),this.todayElement=this.footer=null,this.createContentFooter());break;case"start":case"depth":case"weekNumber":case"firstDayOfWeek":case"weekRule":this.checkView(),("datepicker"!==this.getModuleName()||this.calendarElement)&&(this.createContentHeader(),this.createContentBody());break;case"locale":this.globalize=new N.Internationalization(this.locale),("datepicker"!==this.getModuleName()||this.calendarElement)&&(this.createContentHeader(),this.createContentBody()),"calendar"===this.getModuleName()&&(this.l10=new N.L10n(this.getModuleName(),{today:"Today"},this.locale)),this.l10.setLocale(this.locale),this.showTodayButton&&this.updateFooter();break;case"showTodayButton":e.showTodayButton?this.createContentFooter():N.isNullOrUndefined(this.todayElement)||N.isNullOrUndefined(this.footer)||(N.detach(this.todayElement),N.detach(this.footer),this.todayElement=this.footer=void 0),this.setProperties({showTodayButton:e.showTodayButton},!0)}}},t.prototype.validateValues=function(e,t){if(e&&!N.isNullOrUndefined(t)&&0<t.length){for(var i=this.copyValues(t),s=0;s<i.length;s++){var a=i[s],n="Gregorian"===this.calendarMode?"gregorian":"islamic",r=void 0,r="Gregorian"===this.calendarMode?this.globalize.formatDate(a,{type:"date",skeleton:"yMd"}):this.globalize.formatDate(a,{type:"dateTime",skeleton:"full",calendar:"islamic"}),a=this.globalize.formatDate(this.min,{type:"date",skeleton:"yMd",calendar:n}),n=this.globalize.formatDate(this.max,{type:"date",skeleton:"yMd",calendar:n});(+new Date(r)<+new Date(a)||+new Date(r)>+new Date(n))&&(i.splice(s,1),s=-1)}this.setProperties({values:i},!0)}},t.prototype.setValueUpdate=function(){N.isNullOrUndefined(this.tableBodyElement)||(N.detach(this.tableBodyElement),this.setProperties({start:this.currentView()},!0),this.createContentBody())},t.prototype.copyValues=function(e){var t=[];if(!N.isNullOrUndefined(e)&&0<e.length)for(var i=0;i<e.length;i++)t.push(new Date(+e[i]));return t},t.prototype.titleUpdate=function(e,t){var i,s=new N.Internationalization(this.locale),a="Gregorian"===this.calendarMode?"gregorian":"islamic",n="Gregorian"===this.calendarMode?(i=s.formatDate(e,{type:"dateTime",skeleton:"yMMMM",calendar:a}),s.formatDate(e,{format:null,type:"dateTime",skeleton:"y",calendar:a})):(i=s.formatDate(e,{type:"dateTime",format:"MMMM y",calendar:a}),s.formatDate(e,{type:"dateTime",format:"y",calendar:a}));switch(t){case"days":this.headerTitleElement.textContent=this.toCapitalize(i);break;case"months":this.headerTitleElement.textContent=n}},t.prototype.setActiveDescendant=function(){var e,t=this.tableBodyElement.querySelector("tr td.e-focused-date"),i=this.tableBodyElement.querySelector("tr td.e-selected"),s="Gregorian"===this.calendarMode?"gregorian":"islamic",a=this.currentView(),a="Month"===a?this.globalize.formatDate(this.currentDate,{type:"date",skeleton:"full",calendar:s}):"Year"===a?"islamic"!=s?this.globalize.formatDate(this.currentDate,{type:"date",skeleton:"yMMMM",calendar:s}):this.globalize.formatDate(this.currentDate,{type:"date",skeleton:"GyMMM",calendar:s}):this.globalize.formatDate(this.currentDate,{format:null,type:"date",skeleton:"y",calendar:s});return(i||t)&&(N.isNullOrUndefined(i)||i.setAttribute("aria-selected","true"),(t||i).setAttribute("aria-label",a),e=(t||i).getAttribute("id")),e},t.prototype.iconHandler=function(){switch(new Date(this.checkValue(this.currentDate)).setDate(1),this.currentView()){case"Month":this.previousIconHandler(this.compareMonth(new Date(this.checkValue(this.currentDate)),this.min)<1),this.nextIconHandler(-1<this.compareMonth(new Date(this.checkValue(this.currentDate)),this.max));break;case"Year":this.previousIconHandler(this.compareYear(new Date(this.checkValue(this.currentDate)),this.min)<1),this.nextIconHandler(-1<this.compareYear(new Date(this.checkValue(this.currentDate)),this.max));break;case"Decade":this.previousIconHandler(this.compareDecade(new Date(this.checkValue(this.currentDate)),this.min)<1),this.nextIconHandler(-1<this.compareDecade(new Date(this.checkValue(this.currentDate)),this.max))}},t.prototype.destroy=function(){("calendar"===this.getModuleName()&&this.element||this.calendarElement&&this.element)&&N.removeClass([this.element],[R]),"calendar"===this.getModuleName()&&this.element&&(N.isNullOrUndefined(this.headerTitleElement)||N.EventHandler.remove(this.headerTitleElement,"click",this.navigateTitle),this.todayElement&&N.EventHandler.remove(this.todayElement,"click",this.todayButtonClick),this.previousIconHandler(!0),this.nextIconHandler(!0),this.keyboardModule.destroy(),this.element.removeAttribute("data-role"),N.isNullOrUndefined(this.calendarEleCopy.getAttribute("tabindex"))?this.element.removeAttribute("tabindex"):this.element.setAttribute("tabindex",this.tabIndex)),this.element&&(this.element.innerHTML=""),this.todayElement=null,this.tableBodyElement=null,this.todayButtonEvent=null,this.renderDayCellArgs=null,this.headerElement=null,this.nextIcon=null,this.table=null,this.tableHeadElement=null,this.previousIcon=null,this.headerTitleElement=null,this.footer=null,this.contentElement=null,B.prototype.destroy.call(this)},t.prototype.title=function(e){var t=this.getViewNumber(this.currentView());this.effect=se,this.switchView(++t,e)},t.prototype.getViewNumber=function(e){return"Month"===e?0:"Year"===e?1:2},t.prototype.navigateTitle=function(e){e.preventDefault(),this.title(e)},t.prototype.previous=function(){this.effect="";var e=this.getViewNumber(this.currentView());switch(this.currentView()){case"Month":this.addMonths(this.currentDate,-1),this.switchView(e);break;case"Year":this.addYears(this.currentDate,-1),this.switchView(e);break;case"Decade":this.addYears(this.currentDate,-10),this.switchView(e)}},t.prototype.navigatePrevious=function(e){N.Browser.isDevice||e.preventDefault(),"Gregorian"===this.calendarMode?this.previous():this.islamicModule.islamicPrevious(),this.triggerNavigate(e)},t.prototype.next=function(){this.effect="";var e=this.getViewNumber(this.currentView());switch(this.currentView()){case"Month":this.addMonths(this.currentDate,1),this.switchView(e);break;case"Year":this.addYears(this.currentDate,1),this.switchView(e);break;case"Decade":this.addYears(this.currentDate,10),this.switchView(e)}},t.prototype.navigateNext=function(e){N.Browser.isDevice||e.preventDefault(),"Gregorian"===this.calendarMode?this.next():this.islamicModule.islamicNext(),this.triggerNavigate(e)},t.prototype.navigateTo=function(e,t,i){+t>=+this.min&&+t<=+this.max&&(this.currentDate=t),+t<=+this.min&&(this.currentDate=new Date(this.checkValue(this.min))),+t>=+this.max&&(this.currentDate=new Date(this.checkValue(this.max))),this.getViewNumber(this.depth)>=this.getViewNumber(e)&&(this.getViewNumber(this.depth)<=this.getViewNumber(this.start)||this.getViewNumber(this.depth)===this.getViewNumber(e))&&(e=this.depth),this.switchView(this.getViewNumber(e),null,null,i)},t.prototype.currentView=function(){return!N.isNullOrUndefined(this.contentElement)&&this.contentElement.classList.contains(K)?"Year":!N.isNullOrUndefined(this.contentElement)&&this.contentElement.classList.contains(_)?"Decade":"Month"},t.prototype.getDateVal=function(e,t){return!N.isNullOrUndefined(t)&&e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()},t.prototype.getCultureObjects=function(e,t){var i=N.isNullOrUndefined(this.dayHeaderFormat)?null:".dates.calendars.gregorian.days.format."+this.dayHeaderFormat.toLowerCase(),s=N.isNullOrUndefined(this.dayHeaderFormat)?null:".dates.calendars.islamic.days.format."+this.dayHeaderFormat.toLowerCase();return"Gregorian"===this.calendarMode?N.getValue("main."+this.locale+i,e):N.getValue("main."+this.locale+s,e)},t.prototype.getWeek=function(e){var t=new Date(this.checkValue(e)).valueOf(),e=new Date(e.getFullYear(),0,1).valueOf();return Math.ceil((t-e+ne)/ne/7)},t.prototype.setStartDate=function(e,t){var i=e.getTimezoneOffset(),t=new Date(e.getTime()+t),i=t.getTimezoneOffset()-i;e.setTime(t.getTime()+6e4*i)},t.prototype.addMonths=function(e,t){var i;"Gregorian"===this.calendarMode?(i=e.getDate(),e.setDate(1),e.setMonth(e.getMonth()+t),e.setDate(Math.min(i,this.getMaxDays(e)))):(i=this.islamicModule.getIslamicDate(e),this.currentDate=this.islamicModule.toGregorian(i.year,i.month+t,1))},t.prototype.addYears=function(e,t){var i;"Gregorian"===this.calendarMode?(i=e.getDate(),e.setDate(1),e.setFullYear(e.getFullYear()+t),e.setDate(Math.min(i,this.getMaxDays(e)))):(i=this.islamicModule.getIslamicDate(e),this.currentDate=this.islamicModule.toGregorian(i.year+t,i.month,1))},t.prototype.getIdValue=function(e,t){e=e?e.currentTarget:t,t={type:"dateTime",skeleton:"full",calendar:"Gregorian"===this.calendarMode?"gregorian":"islamic"},e=this.globalize.formatDate(new Date(parseInt(""+e.getAttribute("id"),0)),t),e=this.globalize.parseDate(e,t),t=e.valueOf()-e.valueOf()%1e3;return new Date(t)},t.prototype.adjustLongHeaderSize=function(){N.removeClass([this.element],ae),"Wide"===this.dayHeaderFormat&&N.addClass(["calendar"===this.getModuleName()?this.element:this.calendarElement],ae)},t.prototype.selectDate=function(e,t,i,s,a){var n=i||e.currentTarget,r=(this.isDateSelected=!1,"Decade"===this.currentView()?this.setDateDecade(this.currentDate,t.getFullYear()):"Year"===this.currentView()?this.setDateYear(this.currentDate,t):(s&&!this.checkPresentDate(t,a)?(l=this.copyValues(a),!N.isNullOrUndefined(a)&&0<l.length?(l.push(new Date(this.checkValue(t))),this.setProperties({values:l},!0),this.setProperties({value:a[a.length-1]},!0)):this.setProperties({values:[new Date(this.checkValue(t))]},!0)):this.setProperties({value:new Date(this.checkValue(t))},!0),this.currentDate=new Date(this.checkValue(t))),N.closest(n,"."+R));if(N.isNullOrUndefined(r)&&(r=this.tableBodyElement),s||N.isNullOrUndefined(r.querySelector("."+T))||N.removeClass([r.querySelector("."+T)],T),s||N.isNullOrUndefined(r.querySelector("."+y))||N.removeClass([r.querySelector("."+y)],y),s||N.isNullOrUndefined(r.querySelector("."+$))||N.removeClass([r.querySelector("."+$)],$),s){for(var l=this.copyValues(a),o=Array.prototype.slice.call(this.tableBodyElement.querySelectorAll("td")),h=0;h<o.length;h++){var u=r.querySelectorAll("td."+y)[0],d=r.querySelectorAll("td."+T)[0];o[h]===u&&N.removeClass([o[h]],y),o[h]!==d||this.checkPresentDate(new Date(parseInt(d.getAttribute("id").split("_")[0],10)),a)||N.removeClass([o[h]],T)}if(n.classList.contains(T)){N.removeClass([n],T);for(var p=0;p<l.length;p++){var c={format:null,type:"date",skeleton:"short",calendar:"Gregorian"===this.calendarMode?"gregorian":"islamic"};this.globalize.formatDate(t,c)===this.globalize.formatDate(l[p],c)&&(h=l.indexOf(l[p]),l.splice(h,1),N.addClass([n],y))}this.setProperties({values:l},!0)}else N.addClass([n],T)}else N.addClass([n],T);this.isDateSelected=!0},t.prototype.checkPresentDate=function(e,t){var i=!1;if(!N.isNullOrUndefined(t))for(var s=0;s<t.length;s++){var a="Gregorian"===this.calendarMode?"gregorian":"islamic";this.globalize.formatDate(e,{format:null,type:"date",skeleton:"short",calendar:a})===this.globalize.formatDate(t[s],{format:null,type:"date",skeleton:"short",calendar:a})&&(i=!0)}return i},t.prototype.setAriaActiveDescendant=function(){N.attributes(this.table,{"aria-activedescendant":""+this.setActiveDescendant()})},t.prototype.previousIconHandler=function(e){e?N.isNullOrUndefined(this.previousIcon)||(N.EventHandler.remove(this.previousIcon,"click",this.navigatePreviousHandler),N.addClass([this.previousIcon],I),N.addClass([this.previousIcon],X),this.previousIcon.setAttribute("aria-disabled","true")):(N.EventHandler.add(this.previousIcon,"click",this.navigatePreviousHandler),N.removeClass([this.previousIcon],I),N.removeClass([this.previousIcon],X),this.previousIcon.setAttribute("aria-disabled","false"))},t.prototype.renderDayCellEvent=function(e){N.extend(this.renderDayCellArgs,{name:"renderDayCell"}),this.trigger("renderDayCell",e)},t.prototype.navigatedEvent=function(e){N.extend(this.navigatedArgs,{name:"navigated",event:e}),this.trigger("navigated",this.navigatedArgs)},t.prototype.triggerNavigate=function(e){this.navigatedArgs={view:this.currentView(),date:this.currentDate},this.navigatedEvent(e)},t.prototype.nextIconHandler=function(e){e?N.isNullOrUndefined(this.previousIcon)||(N.EventHandler.remove(this.nextIcon,"click",this.navigateNextHandler),N.addClass([this.nextIcon],I),N.addClass([this.nextIcon],X),this.nextIcon.setAttribute("aria-disabled","true")):(N.EventHandler.add(this.nextIcon,"click",this.navigateNextHandler),N.removeClass([this.nextIcon],I),N.removeClass([this.nextIcon],X),this.nextIcon.setAttribute("aria-disabled","false"))},t.prototype.compare=function(e,t,i){var t=t.getFullYear(),s=t,a=0;return i&&(s=(t-=t%i)-t%i+i-1),e.getFullYear()>s?a=1:e.getFullYear()<t&&(a=-1),a},t.prototype.isMinMaxRange=function(e){return+e>=+this.min&&+e<=+this.max},t.prototype.isMonthYearRange=function(e){return"Gregorian"===this.calendarMode?e.getMonth()>=this.min.getMonth()&&e.getFullYear()>=this.min.getFullYear()&&e.getMonth()<=this.max.getMonth()&&e.getFullYear()<=this.max.getFullYear():(e=this.islamicModule.getIslamicDate(e)).month>=this.islamicModule.getIslamicDate(new Date(1944,1,18)).month&&e.year>=this.islamicModule.getIslamicDate(new Date(1944,1,18)).year&&e.month<=this.islamicModule.getIslamicDate(new Date(2069,1,16)).month&&e.year<=this.islamicModule.getIslamicDate(new Date(2069,1,16)).year},t.prototype.compareYear=function(e,t){return this.compare(e,t,0)},t.prototype.compareDecade=function(e,t){return this.compare(e,t,10)},t.prototype.shiftArray=function(e,t){return e.slice(t).concat(e.slice(0,t))},t.prototype.addDay=function(e,t,i,s,a){var n=t,r=new Date(+e);if(!N.isNullOrUndefined(this.tableBodyElement)&&!N.isNullOrUndefined(i)){for(;this.findNextTD(new Date(+e),n,s,a);)n+=t;i=new Date(r.setDate(r.getDate()+n)),n=+s<+i||+i<+a?n===t?t-t:t:n}e.setDate(e.getDate()+n)},t.prototype.findNextTD=function(e,t,i,s){var a=new Date(e.setDate(e.getDate()+t)),n=[],r=!1;if(n=(!N.isNullOrUndefined(a)&&a.getMonth())===(!N.isNullOrUndefined(this.currentDate)&&this.currentDate.getMonth())?("Gregorian"===this.calendarMode?this.renderDays(a):this.islamicModule.islamicRenderDays(this.currentDate,a)).filter(function(e){return e.classList.contains(I)}):this.tableBodyElement.querySelectorAll("td."+I),+a<=+i&&+s<=+a&&n.length)for(var l=0;l<n.length&&!(r=+a==+new Date(parseInt(n[l].id,0)));l++);return r},t.prototype.getMaxDays=function(e){for(var t=new Date(this.checkValue(e)),i=28,s=t.getMonth();t.getMonth()===s;)t.setDate(++i);return i-1},t.prototype.setDateDecade=function(e,t){e.setFullYear(t),this.setProperties({value:new Date(this.checkValue(e))},!0)},t.prototype.setDateYear=function(e,t){e.setFullYear(t.getFullYear(),t.getMonth(),e.getDate()),t.getMonth()!==e.getMonth()&&(e.setDate(0),this.currentDate=new Date(this.checkValue(t))),this.setProperties({value:new Date(this.checkValue(e))},!0)},t.prototype.compareMonth=function(e,t){e=e.getFullYear()>t.getFullYear()?1:e.getFullYear()<t.getFullYear()?-1:e.getMonth()===t.getMonth()?0:e.getMonth()>t.getMonth()?1:-1;return e},t.prototype.checkValue=function(e){return e instanceof Date?e.toUTCString():""+e},t.prototype.checkView=function(){"Decade"!==this.start&&"Year"!==this.start&&this.setProperties({start:"Month"},!0),"Decade"!==this.depth&&"Year"!==this.depth&&this.setProperties({depth:"Month"},!0),this.getViewNumber(this.depth)>this.getViewNumber(this.start)&&this.setProperties({depth:"Month"},!0)},t.prototype.getDate=function(e,t){return e=t?new Date(e.toLocaleString("en-US",{timeZone:t})):e},e([N.Property(new Date(1900,0,1))],t.prototype,"min",void 0),e([N.Property(!0)],t.prototype,"enabled",void 0),e([N.Property(null)],t.prototype,"cssClass",void 0),e([N.Property(new Date(2099,11,31))],t.prototype,"max",void 0),e([N.Property(null)],t.prototype,"firstDayOfWeek",void 0),e([N.Property("Gregorian")],t.prototype,"calendarMode",void 0),e([N.Property("Month")],t.prototype,"start",void 0),e([N.Property("Month")],t.prototype,"depth",void 0),e([N.Property(!1)],t.prototype,"weekNumber",void 0),e([N.Property("FirstDay")],t.prototype,"weekRule",void 0),e([N.Property(!0)],t.prototype,"showTodayButton",void 0),e([N.Property("Short")],t.prototype,"dayHeaderFormat",void 0),e([N.Property(!1)],t.prototype,"enablePersistence",void 0),e([N.Property(null)],t.prototype,"keyConfigs",void 0),e([N.Property(null)],t.prototype,"serverTimezoneOffset",void 0),e([N.Event()],t.prototype,"created",void 0),e([N.Event()],t.prototype,"destroyed",void 0),e([N.Event()],t.prototype,"navigated",void 0),e([N.Event()],t.prototype,"renderDayCell",void 0),e([N.NotifyPropertyChanges],t));function t(e,t){e=B.call(this,e,t)||this;return e.effect="",e.isPopupClicked=!1,e.isDateSelected=!0,e.isTodayClicked=!1,e.preventChange=!1,e.previousDates=!1,e}j(s,l=re),s.prototype.render=function(){if("Islamic"===this.calendarMode&&void 0===this.islamicModule&&N.throwError("Requires the injectable Islamic modules to render Calendar in Islamic mode"),this.isMultiSelection&&"object"==typeof this.values&&!N.isNullOrUndefined(this.values)&&0<this.values.length){for(var e=[],t=[],i=0;i<this.values.length;i++)-1===e.indexOf(+this.values[i])&&(e.push(+this.values[i]),t.push(this.values[i]));this.setProperties({values:t},!0);for(var s,a=0;a<this.values.length;a++)this.checkDateValue(this.values[a])||("string"==typeof this.values[a]&&this.checkDateValue(new Date(this.checkValue(this.values[a])))?(s=new Date(this.checkValue(this.values[a])),this.values.splice(a,1),this.values.splice(a,0,s)):this.values.splice(a,1));this.setProperties({value:this.values[this.values.length-1]},!0),this.previousValues=this.values.length}var n;this.validateDate(),this.minMaxUpdate(),"calendar"===this.getModuleName()&&(this.setEnable(this.enabled),this.setClass(this.cssClass)),l.prototype.render.call(this),"calendar"===this.getModuleName()&&((n=N.closest(this.element,"form"))&&N.EventHandler.add(n,"reset",this.formResetHandler.bind(this)),this.setTimeZone(this.serverTimezoneOffset)),this.renderComplete()},s.prototype.setEnable=function(e){e?N.removeClass([this.element],I):N.addClass([this.element],I)},s.prototype.setClass=function(e,t){N.isNullOrUndefined(t)||(t=t.replace(/\s+/g," ").trim()),N.isNullOrUndefined(e)||(e=e.replace(/\s+/g," ").trim()),N.isNullOrUndefined(t)||""===t||N.removeClass([this.element],t.split(" ")),N.isNullOrUndefined(e)||N.addClass([this.element],e.split(" "))},s.prototype.isDayLightSaving=function(){var e=new Date(this.value.getFullYear(),6,1).getTimezoneOffset(),t=new Date(this.value.getFullYear(),0,1).getTimezoneOffset();return this.value.getTimezoneOffset()<Math.max(t,e)},s.prototype.setTimeZone=function(e){!N.isNullOrUndefined(this.serverTimezoneOffset)&&this.value&&(e=e+(new Date).getTimezoneOffset()/60,e=this.isDayLi