sugar
Version:
A Javascript library for working with native objects.
51 lines (50 loc) • 26.6 kB
JavaScript
var W,Pa,Qa=["12hr","hour","minute","second","12hr","utc","offset_sign","offset_hours","offset_minutes","12hr"],Ra="({t})?\\s*(\\d{1,2}(?:[,.]\\d+)?)(?:{h}(\\d{1,2}(?:[,.]\\d+)?)?{m}(?::?(\\d{1,2}(?:[,.]\\d+)?){s})?\\s*(?:(am|pm)|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*(am|pm))",Sa={},Ta,Ua,Va,Wa=[],Xa=[{ba:"f{1,4}|ms|milliseconds",format:function(a){return a.getMilliseconds()}},{ba:"ss?|seconds",format:function(a){return a.getSeconds()}},{ba:"mm?|minutes",format:function(a){return a.getMinutes()}},
{ba:"hh?|hours|12hr",format:function(a){a=X(a,"get",void 0,"Hours");return a===0?12:a-P(a/13)*12}},{ba:"HH?|24hr",format:function(a){return a.getHours()}},{ba:"dd?|date|day",format:function(a){return a.getDate()}},{ba:"dow|weekday",na:j,format:function(a,b,c){return b.weekdays[a.getDay()+(c-1)*7]}},{ba:"MM?",format:function(a){return a.getMonth()+1}},{ba:"mon|month",na:j,format:function(a,b,c){return b.months[a.getMonth()+(c-1)*12]}},{ba:"y{2,4}|year",format:function(a){return a.getFullYear()}},{ba:"[Tt]{1,2}",
format:function(a,b,c,d){a=b["12hr"][P(a.getHours()/12)];if(d.length===1)a=a.slice(0,1);if(d.slice(0,1)==="T")a=a.toUpperCase();return a}},{ba:"z{1,4}|tz|timezone",text:j,format:function(a,b,c,d){a=a.getUTCOffset();if(d=="z"||d=="zz")a=a.replace(/(\d{2})(\d{2})/,function(e,g){return Q(g,d.length)});return a}},{ba:"iso(tz|timezone)",format:function(a){return a.getUTCOffset(j)}},{ba:"ord",format:function(a){a=a.getDate();return a+pa(a)}}],Ya=[{$:"year",method:"FullYear",da:function(a){return(365+(a?
a.isLeapYear()?1:0:0.25))*24*60*60*1E3}},{$:"month",method:"Month",pa:j,da:function(a,b){var c=30.4375,d;if(a){d=a.daysInMonth();if(b<=d.days())c=d}return c*24*60*60*1E3}},{$:"week",method:"Week",da:o(6048E5)},{$:"day",method:"Date",pa:j,da:o(864E5)},{$:"hour",method:"Hours",da:o(36E5)},{$:"minute",method:"Minutes",da:o(6E4)},{$:"second",method:"Seconds",da:o(1E3)},{$:"millisecond",method:"Milliseconds",da:o(1)}],Za={},$a={en:"2;;;January,February,March,April,May,June,July,August,September,October,November,December;Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday;millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s;one,two,three,four,five,six,seven,eight,nine,ten;a,an,the;the,st|nd|rd|th,of;am,pm;;{num} {unit} {sign},{sign} {num} {unit},{num} {unit=4-5} {sign} {day},{month} {year},{shift} {unit=5-7},{0} {edge} of {shift?} {unit=4-7?}{month?}{year?};{0} {num}{1} {day} of {month} {year?},{weekday?} {month} {date}{1} {year?},{date} {month} {year},{shift} {weekday},{shift} week {weekday},{weekday} {2} {shift} week,{0} {date}{1} of {month},{0}{month?} {date?}{1} of {shift} {unit=6-7};{Weekday} {Month} {d}, {yyyy};{h}:{mm}:{ss}{tt};,yesterday,today,tomorrow;,ago|before,,from now|after|from|in;,last,the|this,next;last day,end,,first day|beginning",
ja:"1;\u6708;\u5e74;;\u65e5\u66dc\u65e5,\u6708\u66dc\u65e5,\u706b\u66dc\u65e5,\u6c34\u66dc\u65e5,\u6728\u66dc\u65e5,\u91d1\u66dc\u65e5,\u571f\u66dc\u65e5;\u30df\u30ea\u79d2,\u79d2,\u5206,\u6642\u9593,\u65e5,\u9031\u9593|\u9031,\u30f6\u6708|\u30f5\u6708|\u6708,\u5e74;;;;\u5348\u524d,\u5348\u5f8c;\u6642,\u5206,\u79d2;{num}{unit}{sign};{shift}{unit=5-7}{weekday?},{year}\u5e74{month?}\u6708?{date?}\u65e5?,{month}\u6708{date?}\u65e5?,{date}\u65e5;{yyyy}\u5e74{M}\u6708{d}\u65e5 {Weekday};{H}\u6642{mm}\u5206{ss}\u79d2;\u4e00\u6628\u65e5,\u6628\u65e5,\u4eca\u65e5,\u660e\u65e5,\u660e\u5f8c\u65e5;,\u524d,,\u5f8c;,\u53bb|\u5148,,\u6765",
ko:"1;\uc6d4;\ub144;;\uc77c\uc694\uc77c,\uc6d4\uc694\uc77c,\ud654\uc694\uc77c,\uc218\uc694\uc77c,\ubaa9\uc694\uc77c,\uae08\uc694\uc77c,\ud1a0\uc694\uc77c;\ubc00\ub9ac\ucd08,\ucd08,\ubd84,\uc2dc\uac04,\uc77c,\uc8fc,\uac1c\uc6d4|\ub2ec,\ub144;\uc77c|\ud55c,\uc774,\uc0bc,\uc0ac,\uc624,\uc721,\uce60,\ud314,\uad6c,\uc2ed;;;\uc624\uc804,\uc624\ud6c4;\uc2dc,\ubd84,\ucd08;{num}{unit} {sign},{shift?} {unit=5-7};{shift} {unit=5?} {weekday},{year}\ub144{month?}\uc6d4?{date?}\uc77c?,{month}\uc6d4{date?}\uc77c?,{date}\uc77c;{yyyy}\ub144{M}\uc6d4{d}\uc77c {Weekday};{H}\uc2dc{mm}\ubd84{ss}\ucd08;\uadf8\uc800\uaed8,\uc5b4\uc81c,\uc624\ub298,\ub0b4\uc77c,\ubaa8\ub808;,\uc804,,\ud6c4;,\uc9c0\ub09c|\uc791,\uc774\ubc88,\ub2e4\uc74c|\ub0b4",
ru:"4;;;\u042f\u043d\u0432\u0430\u0440:\u044f|\u044c,\u0424\u0435\u0432\u0440\u0430\u043b:\u044f|\u044c,\u041c\u0430\u0440\u0442:\u0430|,\u0410\u043f\u0440\u0435\u043b:\u044f|\u044c,\u041c\u0430:\u044f|\u0439,\u0418\u044e\u043d:\u044f|\u044c,\u0418\u044e\u043b:\u044f|\u044c,\u0410\u0432\u0433\u0443\u0441\u0442:\u0430|,\u0421\u0435\u043d\u0442\u044f\u0431\u0440:\u044f|\u044c,\u041e\u043a\u0442\u044f\u0431\u0440:\u044f|\u044c,\u041d\u043e\u044f\u0431\u0440:\u044f|\u044c,\u0414\u0435\u043a\u0430\u0431\u0440:\u044f|\u044c;\u0412\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435,\u041f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a,\u0412\u0442\u043e\u0440\u043d\u0438\u043a,\u0421\u0440\u0435\u0434\u0430,\u0427\u0435\u0442\u0432\u0435\u0440\u0433,\u041f\u044f\u0442\u043d\u0438\u0446\u0430,\u0421\u0443\u0431\u0431\u043e\u0442\u0430;\u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434:\u0430|\u0443|\u044b|,\u0441\u0435\u043a\u0443\u043d\u0434:\u0430|\u0443|\u044b|,\u043c\u0438\u043d\u0443\u0442:\u0430|\u0443|\u044b|,\u0447\u0430\u0441:||\u0430|\u043e\u0432,\u0434\u0435\u043d\u044c|\u0434\u0435\u043d\u044c|\u0434\u043d\u044f|\u0434\u043d\u0435\u0439,\u043d\u0435\u0434\u0435\u043b:\u044f|\u044e|\u0438|\u044c|\u0435,\u043c\u0435\u0441\u044f\u0446:||\u0430|\u0435\u0432|\u0435,\u0433\u043e\u0434|\u0433\u043e\u0434|\u0433\u043e\u0434\u0430|\u043b\u0435\u0442|\u0433\u043e\u0434\u0443;\u043e\u0434:\u0438\u043d|\u043d\u0443,\u0434\u0432:\u0430|\u0435,\u0442\u0440\u0438,\u0447\u0435\u0442\u044b\u0440\u0435,\u043f\u044f\u0442\u044c,\u0448\u0435\u0441\u0442\u044c,\u0441\u0435\u043c\u044c,\u0432\u043e\u0441\u0435\u043c\u044c,\u0434\u0435\u0432\u044f\u0442\u044c,\u0434\u0435\u0441\u044f\u0442\u044c;;\u0432|\u043d\u0430,\u0433\u043e\u0434\u0430;am,pm;;{num} {unit} {sign},{sign} {num} {unit},{month} {year},{0} {shift} {unit=5-7};{date} {month} {year?} {1},{0} {shift} {weekday};{Weekday} {d} {month} {yyyy} \u0433\u043e\u0434\u0430;{H}:{mm}:{ss};\u043f\u043e\u0437\u0430\u0432\u0447\u0435\u0440\u0430,\u0432\u0447\u0435\u0440\u0430,\u0441\u0435\u0433\u043e\u0434\u043d\u044f,\u0437\u0430\u0432\u0442\u0440\u0430,\u043f\u043e\u0441\u043b\u0435\u0437\u0430\u0432\u0442\u0440\u0430;,\u043d\u0430\u0437\u0430\u0434,,\u0447\u0435\u0440\u0435\u0437;,\u043f\u0440\u043e\u0448\u043b:\u044b\u0439|\u043e\u0439|\u043e\u043c,,\u0441\u043b\u0435\u0434\u0443\u044e\u0449:\u0438\u0439|\u0435\u0439|\u0435\u043c",
es:"6;;;enero,febrero,marzo,abril,mayo,junio,julio,agosto,septiembre,octubre,noviembre,diciembre;domingo,lunes,martes,mi\u00e9rcoles|miercoles,jueves,viernes,s\u00e1bado|sabado;milisegundo:|s,segundo:|s,minuto:|s,hora:|s,d\u00eda|d\u00edas|dia|dias,semana:|s,mes:|es,a\u00f1o|a\u00f1os|ano|anos;uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,diez;;el,de;am,pm;;{sign} {num} {unit},{num} {unit} {sign},{0} {unit=5-7} {shift},{0} {shift} {unit=5-7};{shift} {weekday},{weekday} {shift},{date?} {1} {month} {1} {year?};{Weekday} {d} {month} {yyyy};{H}:{mm}:{ss};anteayer,ayer,hoy,ma\u00f1ana|manana;,hace,,de ahora;,pasad:o|a,,pr\u00f3ximo|pr\u00f3xima|proximo|proxima",
pt:"6;;;janeiro,fevereiro,mar\u00e7o,abril,maio,junho,julho,agosto,setembro,outubro,novembro,dezembro;domingo,segunda-feira,ter\u00e7a-feira,quarta-feira,quinta-feira,sexta-feira,s\u00e1bado|sabado;milisegundo:|s,segundo:|s,minuto:|s,hora:|s,dia:|s,semana:|s,m\u00eas|m\u00eases|mes|meses,ano:|s;um,dois,tr\u00eas|tres,quatro,cinco,seis,sete,oito,nove,dez,uma,duas;;a,de;am,pm;;{num} {unit} {sign},{sign} {num} {unit},{0} {unit=5-7} {shift},{0} {shift} {unit=5-7};{date?} {1} {month} {1} {year?},{0} {shift} {weekday};{Weekday}, {d} de {month} de {yyyy};{H}:{mm}:{ss};anteontem,ontem,hoje,amanh:\u00e3|a;,atr\u00e1s|atras|h\u00e1|ha,,daqui a;,passad:o|a,,pr\u00f3ximo|pr\u00f3xima|proximo|proxima",
fr:"2;;;janvier,f\u00e9vrier|fevrier,mars,avril,mai,juin,juillet,ao\u00fbt,septembre,octobre,novembre,d\u00e9cembre|decembre;dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi;milliseconde:|s,seconde:|s,minute:|s,heure:|s,jour:|s,semaine:|s,mois,an:|s|n\u00e9e|nee;un:|e,deux,trois,quatre,cinq,six,sept,huit,neuf,dix;;l'|la|le;am,pm;;{sign} {num} {unit},{sign} {num} {unit},{0} {unit=5-7} {shift};{0} {date?} {month} {year?},{0} {weekday} {shift};{Weekday} {d} {month} {yyyy};{H}:{mm}:{ss};,hier,aujourd'hui,demain;,il y a,,dans|d'ici;,derni:\u00e8r|er|\u00e8re|ere,,prochain:|e",
it:"2;;;Gennaio,Febbraio,Marzo,Aprile,Maggio,Giugno,Luglio,Agosto,Settembre,Ottobre,Novembre,Dicembre;Domenica,Luned:\u00ec|i,Marted:\u00ec|i,Mercoled:\u00ec|i,Gioved:\u00ec|i,Venerd:\u00ec|i,Sabato;millisecond:o|i,second:o|i,minut:o|i,or:a|e,giorn:o|i,settiman:a|e,mes:e|i,ann:o|i;un:|'|a|o,due,tre,quattro,cinque,sei,sette,otto,nove,dieci;;l'|la|il;am,pm;;{num} {unit} {sign},{0} {unit=5-7} {shift},{0} {shift} {unit=5-7};{weekday?} {date?} {month} {year?},{shift} {weekday};{Weekday} {d} {Month} {yyyy};{H}:{mm}:{ss};,ieri,oggi,domani,dopodomani;,fa,,da adesso;,scors:o|a,,prossim:o|a",
de:"2;;;Januar,Februar,M\u00e4rz|Marz,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember;Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag;Millisekunde:|n,Sekunde:|n,Minute:|n,Stunde:|n,Tag:|en,Woche:|n,Monat:|en,Jahr:|en;ein:|e|er|em|en,zwei,drei,vier,fuenf,sechs,sieben,acht,neun,zehn;;der;am,pm;;{sign} {num} {unit},{num} {unit} {sign},{shift} {unit=5-7};{weekday?} {date?} {month} {year?},{shift} {weekday};{Weekday} {d}. {Month} {yyyy};{H}:{mm}:{ss};vorgestern,gestern,heute,morgen,\u00fcbermorgen|ubermorgen|uebermorgen;,vor:|her,,in;,letzte:|r|n|s,,n\u00e4chste:|r|n|s+naechste:|r|n|s+kommende:n|r",
"zh-TW":"1;\u6708;\u5e74;;\u661f\u671f\u65e5|\u9031\u65e5,\u661f\u671f\u4e00|\u9031\u4e00,\u661f\u671f\u4e8c|\u9031\u4e8c,\u661f\u671f\u4e09|\u9031\u4e09,\u661f\u671f\u56db|\u9031\u56db,\u661f\u671f\u4e94|\u9031\u4e94,\u661f\u671f\u516d|\u9031\u516d;\u6beb\u79d2,\u79d2\u9418,\u5206\u9418,\u5c0f\u6642,\u5929,\u500b\u661f\u671f|\u9031,\u500b\u6708,\u5e74;;;\u65e5|\u865f;\u4e0a\u5348,\u4e0b\u5348;\u9ede|\u6642,\u5206\u9418?,\u79d2;{num}{unit}{sign},{shift}{unit=5-7};{shift}{weekday},{year}\u5e74{month?}\u6708?{date?}{0},{month}\u6708{date?}{0},{date}{0};{yyyy}\u5e74{M}\u6708{d}\u65e5 {Weekday};{tt}{h}:{mm}:{ss};\u524d\u5929,\u6628\u5929,\u4eca\u5929,\u660e\u5929,\u5f8c\u5929;,\u524d,,\u5f8c;,\u4e0a|\u53bb,\u9019,\u4e0b|\u660e",
"zh-CN":"9;\u6708;\u5e74;;\u661f\u671f\u65e5|\u5468\u65e5,\u661f\u671f\u4e00|\u5468\u4e00,\u661f\u671f\u4e8c|\u5468\u4e8c,\u661f\u671f\u4e09|\u5468\u4e09,\u661f\u671f\u56db|\u5468\u56db,\u661f\u671f\u4e94|\u5468\u4e94,\u661f\u671f\u516d|\u5468\u516d;\u6beb\u79d2,\u79d2\u949f,\u5206\u949f,\u5c0f\u65f6,\u5929,\u4e2a\u661f\u671f|\u5468,\u4e2a\u6708,\u5e74;;;\u65e5|\u53f7;\u4e0a\u5348,\u4e0b\u5348;\u70b9|\u65f6,\u5206\u949f?,\u79d2;{num}{unit}{sign},{shift}{unit=5-7};{shift}{weekday},{year}\u5e74{month?}\u6708?{date?}{0},{month}\u6708{date?}{0},{date}{0};{yyyy}\u5e74{M}\u6708{d}\u65e5 {Weekday};{tt}{h}:{mm}:{ss};\u524d\u5929,\u6628\u5929,\u4eca\u5929,\u660e\u5929,\u540e\u5929;,\u524d,,\u540e;,\u4e0a|\u53bb,\u8fd9,\u4e0b|\u660e"};
function ab(a){na(this,a);this.ha=Wa.concat()}
ab.prototype={getMonth:function(a){return D(a)?a-1:this.months.indexOf(a)%12},ta:function(a){return this.weekdays.indexOf(a)%7},sa:function(a){var b;return D(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},ya:function(a){var b=this;return a.replace(t(this.num,"g"),function(c){return b.sa(c)||""})},wa:function(a){return W.units[this.units.indexOf(a)%8]},Ea:function(a){return this.ra(a,a[2]>0?"futureRelativeFormat":"pastRelativeFormat")},duration:function(a){return this.ra(bb(a),"durationFormat")},
za:function(a){a=a||this.code;return a==="en"||a==="en-US"?j:this.variant},Ca:function(a){return a&&(a==="pm"||a===this.pm)},ra:function(a,b){var c=a[0],d=a[1],e=a[2],g,f,i;if(this.code=="ru"){i=c.toString().slice(-1);switch(j){case i==1:i=1;break;case i>=2&&i<=4:i=2;break;default:i=3}}else i=this.hasPlural&&c>1?1:0;f=this.units[i*8+d]||this.units[d];if(this.capitalizeUnit)f=cb(f);g=this.modifiers.filter(function(h){return h.name=="sign"&&h.value==(e>0?1:-1)})[0];return this[b].replace(/\{(.*?)\}/g,
function(h,l){switch(l){case "num":return c;case "unit":return f;case "sign":return g.src}})},xa:function(){return this.qa?[this.qa].concat(this.ha):this.ha},addFormat:function(a,b,c,d,e){var g=c||[],f=this;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(i,h){var l=h.match(/\?$/),n=h.match(/(\d)(?:-(\d))?/),p=h.match(/^\d+$/),q=h.replace(/[^a-z]+$/,""),y,L;if(p)y=f.optionals[p[0]];else if(f[q])y=f[q];else if(f[q+"s"]){y=f[q+"s"];if(n){L=[];y.forEach(function(B,Ca){var ha=Ca%(f.units?
8:y.length);if(ha>=n[1]&&ha<=(n[2]||n[1]))L.push(B)});y=L}y=db(y)}if(p)return"(?:"+y+")?";else{c||g.push(q);return"("+y+")"+(l?"?":"")}});if(b){b=eb(Ra,this,e);e=a.match(/\\d\{\d,\d\}\)+\??$/);fb(this,"(?:"+b+")[,\\s\\u3000]+?"+a,Qa.concat(g),d);fb(this,a+"(?:[,\\s]*(?:t|at |[\\s\\u3000]"+(e?"+":"*")+")"+b+")?",g.concat(Qa),d)}else fb(this,a,g,d)}};function gb(a,b,c){var d;if(!a||!E(a))return Pa;d=Za[a]||Za[a.slice(0,2)];if(!d||c)d=hb(a,c,b);return d}
function hb(a,b,c){function d(i,h){i=i.split("+").map(function(l){return l.replace(/(.+):(.+)$/,function(n,p,q){return q.split("|").map(function(y){return p+y}).join("|")})}).join("|");return i.split("|").forEach(h)}function e(i,h,l){var n=[];if(f[i]){f[i].forEach(function(p,q){d(p,function(y,L){n[L*l+q]=y.toLowerCase()})});if(h)n=n.concat(f[i].map(function(p){return p.slice(0,3).toLowerCase()}));return f[i]=n}}function g(i,h){var l="\\d{"+i+","+h+"}";if(f.digits)l+="|["+f.digits+"]+";return l}var f;
b=b||ib(a);if(!b)return c?m:Pa;f=new ab(b);e("months",j,12);e("weekdays",j,7);e("units",m,8);e("numbers",m,10);f.code=a;f.date=g(1,2);f.year=g(4,4);f.num=function(){var i=["\\d+"].concat(f.articles);if(f.numbers)i=i.concat(f.numbers);return db(i)}();(function(){var i=[];f.ia={};f.modifiers.forEach(function(h){var l=h.name;d(h.src,function(n){var p=f[l];f.ia[n]=h;i.push({name:l,src:n,value:h.value});f[l]=p?p+"|"+n:n})});f.day+="|"+db(f.weekdays);f.modifiers=i})();if(f.monthSuffix){f.month=g(1,2);f.months=
N(1,12).map(function(i){return i+f.monthSuffix})}f.full_month=g(1,2)+"|"+db(f.months);f.timeSuffixes.length>0&&f.addFormat(eb(Ra,f),m,Qa);f.addFormat("{day}",j);f.addFormat("{month}"+f.monthSuffix);f.addFormat("{year}"+f.yearSuffix);f.timeFormats.forEach(function(i){f.addFormat(i,j)});f.formats.forEach(function(i){f.addFormat(i)});return Za[a]=f}
function ib(a){function b(h){return!!(d[0]&x.pow(2,h-1))}var c={modifiers:[]},d,e,g,f,i;d=$a[a]||$a[a.slice(0,2)];if(!d)return k;d=d.split(";");c.monthSuffix=d[1];c.yearSuffix=d[2];["months","weekdays","units","numbers","articles","optionals","12hr","timeSuffixes","formats","timeFormats"].forEach(function(h,l){c[h]=d[l+3]?d[l+3].split(","):[]});e=d[13];g=d[14];f=e.replace(/[,\s]*\{Weekday\}[,\s]*/,"");i=g.replace(/:?\{ss\}[^{]?/,"");c.timeFormat=g;c.shortFormat=f;c.longFormat=f+" "+i;c.fullFormat=
e+" "+g;c.pm=c["12hr"][1];["day","sign","shift","edge"].forEach(function(h,l){d[l+15]&&d[l+15].split(",").forEach(function(n,p){n&&c.modifiers.push({name:h,src:n,value:p-2})})});if(b(1))c.digits=c.numbers.join("").replace(/\|/,"");c.capitalizeUnit=a=="de";c.hasPlural=b(2);c.pastRelativeFormat=c.formats[0];c.futureRelativeFormat=c.formats[b(3)?1:0];c.durationFormat=c.formats[0].replace(/\s*\{sign\}\s*/,"");c.variant=b(4);return c}
function fb(a,b,c,d){a.ha.unshift({Fa:d,Ba:a,Da:t("^"+b+"$","i"),to:c})}function cb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function db(a){return a.filter(function(b){return!!b}).join("|")}function jb(a,b){var c;if(la(a[0]))return a;else if(D(a[0])&&!D(a[1]))return[a[0]];else if(E(a[0])&&b)return[kb(a[0]),a[1]];c={};Ua.forEach(function(d,e){c[d.$]=a[e]});return[c]}
function kb(a,b){var c={};match=a.match(/^(\d+)?\s?(\w+?)s?$/i);if(M(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b;return c}function lb(a,b){var c={},d,e;b.forEach(function(g,f){d=a[f+1];if(!(M(d)||d==="")){if(g==="year")c.Ga=d;e=parseFloat(d.replace(/,/,"."));c[g]=!isNaN(e)?e:d.toLowerCase()}});return c}function mb(a){a=a.trim().replace(/^(just )?now|\.+$/i,"");return nb(a)}
function nb(a){return a.replace(Ta,function(b,c,d){var e=0,g=1,f,i;if(c)return b;d.split("").reverse().forEach(function(h){h=Sa[h];var l=h>9;if(l){if(f)e+=g;g*=h/(i||1);i=h}else{if(f===m)g*=10;e+=g*h}f=l});if(f)e+=g;return e})}
function ob(a,b,c){var d=new u,e=m,g,f,i,h,l,n,p,q,y;if(ea(a))d=a;else if(D(a))d=new u(a);else if(la(a)){d=(new u).set(a,j);h=a}else if(E(a)){g=gb(b,j);a=mb(a);g&&I(g.xa(),function(L,B){var Ca=a.match(B.Da);if(Ca){i=B;f=i.Ba;h=lb(Ca,i.to,f);f.qa=i;if(h.timestamp){h=h.timestamp;return m}if(i.Fa&&!E(h.month)&&(E(h.date)||g.za(b))){q=h.month;h.month=h.date;h.date=q}if(h.year&&h.Ga.length===2)h.year=O((new u).getFullYear()/100)*100-O(h.year/100)*100+h.year;if(h.month){h.month=f.getMonth(h.month);if(h.shift&&
!h.unit)h.unit=f.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=f.ta(h.weekday);if(h.shift&&!h.unit)h.unit=f.units[5]}if(h.day&&(q=f.ia[h.day])){h.day=q.value;d.reset();e=j}else if(h.day&&(n=f.ta(h.day))>-1){delete h.day;if(h.num&&h.month){y=function(){pb(d,{weekday:n+7*(h.num-1)},m,m,m,1)};h.day=1}else h.weekday=n}if(h.date&&!D(h.date))h.date=f.ya(h.date);if(f.Ca(h["12hr"])&&h.hour<12)h.hour+=12;if("offset_hours"in h||"offset_minutes"in h){h.utc=j;h.offset_minutes=h.offset_minutes||
0;h.offset_minutes+=h.offset_hours*60;if(h.offset_sign==="-")h.offset_minutes*=-1;h.minute-=h.offset_minutes}if(h.unit){e=j;p=f.sa(h.num);l=f.wa(h.unit);if(h.shift||h.edge){p*=(q=f.ia[h.shift])?q.value:0;if(l==="month"&&K(h.date)){d.set({day:h.date},j);delete h.date}if(l==="year"&&K(h.month)){d.set({month:h.month,day:h.date},j);delete h.month;delete h.date}}if(h.sign&&(q=f.ia[h.sign]))p*=q.value;if(K(h.weekday)){d.set({weekday:h.weekday},j);delete h.weekday}h[l]=(h[l]||0)+p}if(h.year_sign==="-")h.year*=
-1;Va.slice(1,4).forEach(function(ha,Tb){var ub=h[ha.$],vb=ub%1;if(vb){h[Va[Tb].$]=O(vb*(ha.$==="second"?1E3:60));h[ha.$]=P(ub)}});return m}});if(i)if(e)d.advance(h);else{h.utc&&d.reset();pb(d,h,j,h.utc,m,c)}else d=a?new u(a):new u;if(h&&h.edge){q=f.ia[h.edge];I(Va.slice(4),function(L,B){if(K(h[B.$])){l=B.$;return m}});if(l==="year")h.fa="month";else if(l==="month"||l==="week")h.fa="day";d[(q.value<0?"endOf":"beginningOf")+cb(l)]();q.value===-2&&d.reset()}y&&y()}return{ea:d,set:h}}
function qb(a){a.addDays(4-(a.getDay()||7)).reset();return 1+P(a.daysSince(a.clone().beginningOfYear())/7)}function bb(a){var b,c=x.abs(a),d=c,e=0;Va.slice(1).forEach(function(g,f){b=P(O(c/g.da()*10)/10);if(b>=1){d=b;e=f+1}});return[d,e,a]}
function rb(a,b,c,d){var e,g=gb(d),f=t(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(C(b)){e=bb(a.millisecondsFromNow());b=b.apply(a,e.concat(g))}}else return"Invalid Date";if(!b&&c){e=e||bb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return g.Ea(e)}b=b||"long";b=g[b+"Format"]||b;b=b.replace(/\{time\}/g,g.timeFormat);Xa.forEach(function(i){b=b.replace(t("\\{("+i.ba+")(\\d)?\\}",i.na?"i":""),function(h,l,n){h=i.format(a,g,n||1,l);n=l.length;var p=l.match(/^(.)\1+$/);if(i.na){if(n===
3)h=h.slice(0,3);if(p||l.match(f))h=cb(h)}else if(p&&!i.text)h=(D(h)?Q(h,n):h.toString()).slice(-n);return h})});return b}
function sb(a,b,c){var d=ob(b),e=0,g=b=0,f;if(c>0){b=g=c;f=j}if(!d.ea.isValid())return m;if(d.set&&d.set.fa){Ya.forEach(function(h){if(h.$===d.set.fa)e=h.da(d.ea,a-d.ea)-1});c=cb(d.set.fa);if(d.set.edge||d.set.shift)d.ea["beginningOf"+c]();if(d.set.fa==="month")i=d.ea.clone()["endOf"+c]().getTime();if(!f&&d.set.sign&&d.set.fa!="millisecond"){b=50;g=-50}}f=a.getTime();c=d.ea.getTime();var i=i||c+e;return f>=c-b&&f<=i+g}
function pb(a,b,c,d,e,g){function f(n){return K(b[n])?b[n]:b[n+"s"]}var i;if(D(b)&&e)b={milliseconds:b};else if(D(b)){a.setTime(b);return a}if(b.date)b.day=b.date;I(Va,function(n,p){var q=p.$==="day";if(K(f(p.$))||q&&K(f("weekday"))){b.fa=p.$;return m}else if(c&&p.$!=="week"&&(!q||!K(f("week"))))X(a,"set",d,p.method,q?1:0)});Ya.forEach(function(n,p){var q=n.$,y=n.method,L=Ya[p-1],B;B=f(q);if(!M(B)){g&&n.pa&&!K(f(L.$))&&X(new u,"get",d,n.method)>=B===(g===1)&&a[L.ka](g);if(e){if(q==="week"){B=(b.day||
0)+B*7;y="Date"}B=B*e+X(a,"get",m,y)}else q==="month"&&K(f("day"))&&a.setDate(15);X(a,"set",d,y,B);if(e&&q==="month"){q=B;if(q<0)q+=12;q%12!=a.getMonth()&&a.setDate(0)}}});if(!e&&!K(f("day"))&&K(f("weekday"))){i=f("weekday");var h,l;if(K(g)){h=X(a,"get",d,"Day")-i%7>=0;l=g===1;if(h===l)i+=g*7}X(a,"set",d,"Weekday",i)}return a}function X(a,b,c,d,e){return a[b+(c?"UTC":"")+d](e)}
function eb(a,b,c){var d={h:0,m:1,s:2},e;b=b||W;return a.replace(/{([a-z])}/g,function(g,f){var i=[],h=f==="h",l=h&&!c;if(f==="t")return b["12hr"].join("|");else{h&&i.push(":");if(e=b.timeSuffixes[d[f]])i.push(e+"\\s*");return i.length===0?"":"(?:"+i.join("|")+")"+(l?"":"?")}})}function tb(a,b){var c;c=D(a[1])?jb(a)[0]:a[0];return ob(c,a[1],b).ea}
function wb(a,b){function c(){return O(this*b)}function d(){return tb(arguments)[a.ka](this)}function e(){return tb(arguments)[a.ka](-this)}var g=a.$,f={};f[g]=c;f[g+"s"]=c;f[g+"Before"]=e;f[g+"sBefore"]=e;f[g+"Ago"]=e;f[g+"sAgo"]=e;f[g+"After"]=d;f[g+"sAfter"]=d;f[g+"FromNow"]=d;f[g+"sFromNow"]=d;w.extend(f)}
u.extend({create:function(){return tb(arguments)},past:function(){return tb(arguments,-1)},future:function(){return tb(arguments,1)},now:function(){return(new u).getTime()},setLocale:function(a,b){var c=gb(a,j,b);if(c){Pa=c;if(a&&a!=c.code)c.code=a}return c},getLocale:function(a){return gb(a)},addFormat:function(a,b,c){fb(gb(c),a,b)}},m,m);
u.extend({set:function(){var a=jb(arguments);return pb(this,a[0],a[1])},setUTC:function(){var a=jb(arguments);return pb(this,a[0],a[1],j)},setWeekday:function(a){M(a)||this.setDate(this.getDate()+a-this.getDay())},setUTCWeekday:function(a){M(a)||this.setDate(this.getUTCDate()+a-this.getDay())},setWeek:function(a){if(!M(a)){this.setMonth(0);this.setDate(a*7+1)}},setUTCWeek:function(a){if(!M(a)){this.setMonth(0);this.setUTCDate(a*7+1)}},getWeek:function(){return qb(this)},getUTCWeek:function(){return qb(this.toUTC())},
getUTCOffset:function(a){var b=this.ma?0:this.getTimezoneOffset(),c=a===j?":":"";if(!b&&a)return"Z";return Q(O(-b/60),2,j)+c+Q(b%60,2)},toUTC:function(){if(this.ma)return this;var a=this.clone().addMinutes(this.getTimezoneOffset());a.ma=j;return a},isUTC:function(){return this.ma||this.getTimezoneOffset()===0},advance:function(){var a=jb(arguments,j);return pb(this,a[0],a[1],m,1)},rewind:function(){var a=jb(arguments,j);return pb(this,a[0],a[1],m,-1)},isValid:function(){return!isNaN(this.getTime())},
isAfter:function(a,b){return this.getTime()>u.create(a).getTime()-(b||0)},isBefore:function(a,b){return this.getTime()<u.create(a).getTime()+(b||0)},isBetween:function(a,b,c){var d=this.getTime();a=u.create(a).getTime();var e=u.create(b).getTime();b=x.min(a,e);a=x.max(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=this.getFullYear();return a%4===0&&a%100!==0||a%400===0},daysInMonth:function(){return 32-(new u(this.getFullYear(),this.getMonth(),32)).getDate()},format:function(a,b){return rb(this,
a,m,b)},relative:function(a,b){if(E(a)){b=a;a=k}return rb(this,a,j,b)},is:function(a,b){var c;if(this.isValid()){if(E(a)){a=a.trim().toLowerCase();switch(j){case a==="future":return this.getTime()>(new u).getTime();case a==="past":return this.getTime()<(new u).getTime();case a==="weekday":return this.getDay()>0&&this.getDay()<6;case a==="weekend":return this.getDay()===0||this.getDay()===6;case (c=W.weekdays.indexOf(a)%7)>-1:return this.getDay()===c;case (c=W.months.indexOf(a)%12)>-1:return this.getMonth()===
c}}return sb(this,a,b)}},reset:function(a){var b={};a=a||"hours";b[a]=a.match(/^days?/)?1:0;return this.set(b,j)},clone:function(){return new u(this.getTime())}});u.extend({iso:function(){return this.toISOString()},getWeekday:u.prototype.getDay,getUTCWeekday:u.prototype.getUTCDay});w.extend({duration:function(a){return gb(a).duration(this)}});W=u.setLocale("en");Va=Ya.concat().reverse();Ua=Ya.concat();Ua.splice(2,1);
J(u,j,m,Ya,function(a,b,c){var d=b.$,e=cb(d),g=b.da(),f,i;b.ka="add"+e+"s";f=function(h,l){return O((this.getTime()-u.create(h,l).getTime())/g)};i=function(h,l){return O((u.create(h,l).getTime()-this.getTime())/g)};a[d+"sAgo"]=i;a[d+"sUntil"]=i;a[d+"sSince"]=f;a[d+"sFromNow"]=f;a[b.ka]=function(h,l){var n={};n[d]=h;return this.advance(n,l)};wb(b,g);c<3&&["Last","This","Next"].forEach(function(h){a["is"+h+e]=function(){return this.is(h+" "+d)}});if(c<4){a["beginningOf"+e]=function(){var h={};switch(d){case "year":h.year=
this.getFullYear();break;case "month":h.month=this.getMonth();break;case "day":h.day=this.getDate();break;case "week":h.weekday=0}return this.set(h,j)};a["endOf"+e]=function(){var h={hours:23,minutes:59,seconds:59,milliseconds:999};switch(d){case "year":h.month=11;h.day=31;break;case "month":h.day=this.daysInMonth();break;case "week":h.weekday=6}return this.set(h,j)}}});W.addFormat("([+-])?(\\d{4,4})[-.]?{full_month}[-.]?(\\d{1,2})?",j,["year_sign","year","month","date"],m,j);
W.addFormat("(\\d{1,2})[-.\\/]{full_month}(?:[-.\\/](\\d{2,4}))?",j,["date","month","year"],j);W.addFormat("{full_month}[-.](\\d{4,4})",m,["month","year"]);W.addFormat("\\/Date\\((\\d+(?:\\+\\d{4,4})?)\\)\\/",m,["timestamp"]);W.addFormat(eb(Ra,W),m,Qa);Wa=W.ha.slice(0,7).reverse();W.ha=W.ha.slice(7).concat(Wa);J(u,j,m,"short,long,full",function(a,b){a[b]=function(c){return rb(this,b,m,c)}});
"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07".split("").forEach(function(a,b){if(b>9)b=x.pow(10,b-9);Sa[a]=b});"\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19".split("").forEach(function(a,b){Sa[a]=b});Ta=t("([\u671f\u9031\u5468])?([\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19]+)(?!\u6628)","g");
(function(){var a="today,yesterday,tomorrow,weekday,weekend,future,past".split(","),b=W.weekdays.slice(0,7),c=W.months.slice(0,12);J(u,j,m,a.concat(b).concat(c),function(d,e){d["is"+cb(e)]=function(){return this.is(e)}})})();u.extend({INTERNATIONAL_TIME:"{h}:{mm}:{ss}",RFC1123:"{Dow}, {dd} {Mon} {yyyy} {HH}:{mm}:{ss} {tz}",RFC1036:"{Weekday}, {dd}-{Mon}-{yy} {HH}:{mm}:{ss} {tz}",ISO8601_DATE:"{yyyy}-{MM}-{dd}",ISO8601_DATETIME:"{yyyy}-{MM}-{dd}T{HH}:{mm}:{ss}.{fff}{isotz}"},m,m);