
var defaultLocaleInfo={SUNDAY:'Sunday:Sun',MONDAY:'Monday:Mon',TUESDAY:'Tuesday:Tue',WEDNESDAY:'Wednesday:Wed',THURSDAY:'Thursday:Thu',FRIDAY:'Friday:Fri',SATURDAY:'Saturday:Sat',JANUARY:'January:Jan',FEBRUARY:'February:Feb',MARCH:'March:Mar',APRIL:'April:Apr',MAY:'May:May',JUNE:'June:Jun',JULY:'July:Jul',AUGUST:'August:Aug',SEPTEMBER:'September:Sep',OCTOBER:'October:Oct',NOVEMBER:'November:Nov',DECEMBER:'December:Dec',AM:'AM',PM:'PM',ERA0:'BCE',ERA1:'CE',COUNT0:'th',COUNT1:'st',COUNT2:'nd',COUNT3:'rd',COUNT21:'st',COUNT22:'nd',COUNT23:'rd',COUNT31:'st',COUNTN:'th'};module.exports={getName:function(){return("gregorian");},RD0_DAYS:1,EPOCH_DAYS:719163,DAYS_IN_400_YEARS:146097,DAYS_IN_100_YEARS:36524,DAYS_IN_4_YEARS:1461,DAYS_IN_1_YEAR:365,CE:1,BCE:0,AD:1,BC:0,getDefaultLocale:function(){return('en_US');},getDefaultLocaleInfo:function(key){return(defaultLocaleInfo[key]);},getStartOfDay:function(){return(JSORM.calendar.MIDNIGHT);},getMaxYear:function(era){return(era===1?100000000000000:-1);},getMaxMonth:function(era,year){return(12);},getMaxDate:function(era,year,month){var o,f,feb;o=(month-1)%2;f=Math.floor(month/8);feb=month===2?1:0;return(31-o+2*f*o-f-feb*(2-this.isLeapYear(year)));},getMaxEra:function(){return(1);},getMaxDayOfYear:function(era,year){return(365+this.isLeapYear(year));},getMinYear:function(era){return(era===1?1:-100000000000000);},getMinMonth:function(era,year){return(1);},getMinDate:function(era,year,month){return(1);},getMinEra:function(){return(0);},getMinDayOfYear:function(era,year){return(1);},leaps:{},isLeapYear:function(y){var leaps=this.leaps,m;if(leaps[y]===undefined){m=y%400;leaps[y]=(y%4===0)&&(m!==100)&&(m!==200)&&(m!==300);}
return(leaps[y]);},mod:function(x,y){return(x-y*(Math.floor(x/y)));},processIso:function(dayOfYear,dayOfWeek,year,leap){var firstDayOfWeek=1,minDaysInWeek=4,relDow,day1dow,day1relDow,day1wk,weekOfYear,prevLeap,jan1dow,daysInYear;relDow=this.mod((dayOfWeek-firstDayOfWeek+7),7);day1dow=this.mod(dayOfWeek-this.mod(dayOfYear-1,7)+7,7);day1relDow=this.mod((day1dow-firstDayOfWeek+7),7);day1wk=7-day1relDow>=minDaysInWeek?1:0;weekOfYear=Math.ceil((dayOfYear-1-relDow)/7)+day1wk;prevLeap=this.getMaxDayOfYear(year-1)===365?1:0;jan1dow=this.mod(dayOfWeek-this.mod(dayOfYear-1,7)+7,7);daysInYear=this.getMaxDayOfYear(year);if(weekOfYear===0){year--;weekOfYear=52+(jan1dow===5||(jan1dow===6&&prevLeap))?1:0;}else if(weekOfYear===53&&jan1dow!==4&&jan1dow+leap!==4){year+=1;weekOfYear=1;}
return({ISO_WEEK_OF_YEAR:weekOfYear,ISO_YEAR:year});},calendarToDays:function(e,y,m,d){var epoch,yearDays,leapDays,monthDays,leapCorrectionDays,fd;if(e===this.BCE&&y>1){y*=-1;}
epoch=1;yearDays=365*(y-1);leapDays=Math.floor((y-1)/4)-Math.floor((y-1)/100)+Math.floor((y-1)/400);monthDays=Math.floor((367*(m)-362)/12);if(m<3){leapCorrectionDays=0;}else if(this.isLeapYear(y)){leapCorrectionDays=-1;}else{leapCorrectionDays=-2;}
fd=epoch-1+yearDays+leapDays+monthDays+leapCorrectionDays+d;return(fd);},daysToCalendar:function(date){var epoch,rDays,n400,d400,n100,d100,n4,d4,n1,lastDayLeap,year,leap,d1,priorDays,leapCorrectionDays,march1,month,day,era,cal;epoch=1;rDays=date-epoch;n400=Math.floor(rDays/this.DAYS_IN_400_YEARS);d400=this.mod(rDays,this.DAYS_IN_400_YEARS);n100=Math.floor(d400/this.DAYS_IN_100_YEARS);d100=this.mod(d400,this.DAYS_IN_100_YEARS);n4=Math.floor(d100/this.DAYS_IN_4_YEARS);d4=this.mod(d100,this.DAYS_IN_4_YEARS);n1=Math.floor(d4/this.DAYS_IN_1_YEAR);lastDayLeap=n100===4||n1===4;year=400*n400+100*n100+4*n4+n1+(lastDayLeap?0:1);leap=this.isLeapYear(year);d1=lastDayLeap?this.DAYS_IN_1_YEAR:this.mod(d4,this.DAYS_IN_1_YEAR);priorDays=d1;leapCorrectionDays=0;march1=31+28+(leap?1:0);if(priorDays<march1){leapCorrectionDays=0;}else if(priorDays>=march1&&leap){leapCorrectionDays=1;}else{leapCorrectionDays=2;}
month=Math.floor((12*(priorDays+leapCorrectionDays)+373)/367);day=d1-Math.floor((367*(month)-362)/12)+leapCorrectionDays+1;era=year<=0?0:1;cal={YEAR:year,MONTH:month,DATE:day,DAY_OF_YEAR:d1+1,LEAP:leap?1:0,ERA:era};JSORM.apply(cal,this.processIso(cal.DAY_OF_YEAR,this.mod(date,7),year,leap));return(cal);}};