mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-11 00:02:05 -05:00
116 lines
43 KiB
JavaScript
116 lines
43 KiB
JavaScript
|
/*
|
||
|
* Sugar Library v1.3.5
|
||
|
*
|
||
|
* Freely distributable and licensed under the MIT-style license.
|
||
|
* Copyright (c) 2012 Andrew Plummer
|
||
|
* http://sugarjs.com/
|
||
|
*
|
||
|
* ---------------------------- */
|
||
|
(function(){var k=true,l=null,n=false;function aa(a){return function(){return a}}var p=Object,q=Array,r=RegExp,s=Date,t=String,u=Number,v=Math,ba=typeof global!=="undefined"?global:this,ca=p.defineProperty&&p.defineProperties,x="Array,Boolean,Date,Function,Number,String,RegExp".split(","),da=y(x[0]),fa=y(x[1]),ga=y(x[2]),z=y(x[3]),A=y(x[4]),C=y(x[5]),D=y(x[6]);function y(a){return function(b){return p.prototype.toString.call(b)==="[object "+a+"]"}}
|
||
|
function ha(a){if(!a.SugarMethods){ia(a,"SugarMethods",{});E(a,n,n,{restore:function(){var b=arguments.length===0,c=F(arguments);G(a.SugarMethods,function(d,e){if(b||c.indexOf(d)>-1)ia(e.wa?a.prototype:a,d,e.method)})},extend:function(b,c,d){E(a,d!==n,c,b)}})}}function E(a,b,c,d){var e=b?a.prototype:a,g;ha(a);G(d,function(f,i){g=e[f];if(typeof c==="function")i=ja(e[f],i,c);if(c!==n||!e[f])ia(e,f,i);a.SugarMethods[f]={wa:b,method:i,Da:g}})}
|
||
|
function H(a,b,c,d,e){var g={};d=C(d)?d.split(","):d;d.forEach(function(f,i){e(g,f,i)});E(a,b,c,g)}function ja(a,b,c){return function(){return a&&(c===k||!c.apply(this,arguments))?a.apply(this,arguments):b.apply(this,arguments)}}function ia(a,b,c){if(ca)p.defineProperty(a,b,{value:c,configurable:k,enumerable:n,writable:k});else a[b]=c}function F(a,b){var c=[],d;for(d=0;d<a.length;d++){c.push(a[d]);b&&b.call(a,a[d],d)}return c}function I(a){return a!==void 0}function K(a){return a===void 0}
|
||
|
function ka(a){return a&&typeof a==="object"}function L(a){return!!a&&p.prototype.toString.call(a)==="[object Object]"&&"hasOwnProperty"in a}function la(a,b){return p.hasOwnProperty.call(a,b)}function G(a,b){for(var c in a)if(la(a,c))if(b.call(a,c,a[c])===n)break}function ma(a,b){G(b,function(c){a[c]=b[c]});return a}function na(a){ma(this,a)}na.prototype.constructor=p;function oa(a,b,c,d){var e=[];a=parseInt(a);for(var g=d<0;!g&&a<=b||g&&a>=b;){e.push(a);c&&c.call(this,a);a+=d||1}return e}
|
||
|
function M(a,b,c){c=v[c||"round"];var d=v.pow(10,v.abs(b||0));if(b<0)d=1/d;return c(a*d)/d}function N(a,b){return M(a,b,"floor")}function P(a,b,c,d){d=v.abs(a).toString(d||10);d=pa(b-d.replace(/\.\d+/,"").length,"0")+d;if(c||a<0)d=(a<0?"-":"+")+d;return d}function qa(a){if(a>=11&&a<=13)return"th";else switch(a%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}
|
||
|
function ra(){return"\t\n\u000b\u000c\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u2028\u2029\u3000\ufeff"}function pa(a,b){return q(v.max(0,I(a)?a:1)+1).join(b||"")}function sa(a,b){var c=a.toString().match(/[^/]*$/)[0];if(b)c=(c+b).split("").sort().join("").replace(/([gimy])\1+/g,"$1");return c}function Q(a){C(a)||(a=t(a));return a.replace(/([\\/'*+?|()\[\]{}.^$])/g,"\\$1")}
|
||
|
function ta(a,b){var c=typeof a,d,e,g,f,i,j;if(c==="string")return a;g=p.prototype.toString.call(a);d=L(a);e=g==="[object Array]";if(a!=l&&d||e){b||(b=[]);if(b.length>1)for(j=b.length;j--;)if(b[j]===a)return"CYC";b.push(a);d=t(a.constructor);f=e?a:p.keys(a).sort();for(j=0;j<f.length;j++){i=e?j:f[j];d+=i+ta(a[i],b)}b.pop()}else d=1/a===-Infinity?"-0":t(a&&a.valueOf?a.valueOf():a);return c+g+d}
|
||
|
function ua(a){var b=p.prototype.toString.call(a);return b==="[object Date]"||b==="[object Array]"||b==="[object String]"||b==="[object Number]"||b==="[object RegExp]"||b==="[object Boolean]"||b==="[object Arguments]"||L(a)}function va(a,b,c){var d=[],e=a.length,g=b[b.length-1]!==n,f;F(b,function(i){if(fa(i))return n;if(g){i%=e;if(i<0)i=e+i}f=c?a.charAt(i)||"":a[i];d.push(f)});return d.length<2?d[0]:d}
|
||
|
function wa(a,b){H(b,k,n,a,function(c,d){c[d+(d==="equal"?"s":"")]=function(){return p[d].apply(l,[this].concat(F(arguments)))}})}ha(p);G(x,function(a,b){ha(ba[b])});
|
||
|
E(p,n,n,{keys:function(a){var b=[];if(!ka(a)&&!D(a)&&!z(a))throw new TypeError("Object required");G(a,function(c){b.push(c)});return b}});
|
||
|
function xa(a,b,c,d){var e=a.length,g=d==-1,f=g?e-1:0;c=isNaN(c)?f:parseInt(c>>0);if(c<0)c=e+c;if(!g&&c<0||g&&c>=e)c=f;for(;g&&c>=0||!g&&c<e;){if(a[c]===b)return c;c+=d}return-1}function ya(a,b,c,d){var e=a.length,g=0,f=I(c);za(b);if(e==0&&!f)throw new TypeError("Reduce called on empty array with no initial value");else if(f)c=c;else{c=a[d?e-1:g];g++}for(;g<e;){f=d?e-g-1:g;if(f in a)c=b(c,a[f],f,a);g++}return c}function za(a){if(!a||!a.call)throw new TypeError("Callback is not callable");}
|
||
|
function Aa(a){if(a.length===0)throw new TypeError("First argument must be defined");}E(q,n,n,{isArray:function(a){return da(a)}});
|
||
|
E(q,k,n,{every:function(a,b){var c=this.length,d=0;for(Aa(arguments);d<c;){if(d in this&&!a.call(b,this[d],d,this))return n;d++}return k},some:function(a,b){var c=this.length,d=0;for(Aa(arguments);d<c;){if(d in this&&a.call(b,this[d],d,this))return k;d++}return n},map:function(a,b){var c=this.length,d=0,e=Array(c);for(Aa(arguments);d<c;){if(d in this)e[d]=a.call(b,this[d],d,this);d++}return e},filter:function(a,b){var c=this.length,d=0,e=[];for(Aa(arguments);d<c;){d in this&&a.call(b,this[d],d,this)&&
|
||
|
e.push(this[d]);d++}return e},indexOf:function(a,b){if(C(this))return this.indexOf(a,b);return xa(this,a,b,1)},lastIndexOf:function(a,b){if(C(this))return this.lastIndexOf(a,b);return xa(this,a,b,-1)},forEach:function(a,b){var c=this.length,d=0;for(za(a);d<c;){d in this&&a.call(b,this[d],d,this);d++}},reduce:function(a,b){return ya(this,a,b)},reduceRight:function(a,b){return ya(this,a,b,k)}});
|
||
|
E(Function,k,n,{bind:function(a){var b=this,c=F(arguments).slice(1),d;if(!z(this))throw new TypeError("Function.prototype.bind called on a non-function");d=function(){return b.apply(b.prototype&&this instanceof b?this:a,c.concat(F(arguments)))};d.prototype=this.prototype;return d}});E(s,n,n,{now:function(){return(new s).getTime()}});
|
||
|
(function(){var a=ra().match(/^\s+$/);try{t.prototype.trim.call([1])}catch(b){a=n}E(t,k,!a,{trim:function(){return this.toString().trimLeft().trimRight()},trimLeft:function(){return this.replace(r("^["+ra()+"]+"),"")},trimRight:function(){return this.replace(r("["+ra()+"]+$"),"")}})})();
|
||
|
(function(){var a=new s(s.UTC(1999,11,31));a=a.toISOString&&a.toISOString()==="1999-12-31T00:00:00.000Z";H(s,k,!a,"toISOString,toJSON",function(b,c){b[c]=function(){return P(this.getUTCFullYear(),4)+"-"+P(this.getUTCMonth()+1,2)+"-"+P(this.getUTCDate(),2)+"T"+P(this.getUTCHours(),2)+":"+P(this.getUTCMinutes(),2)+":"+P(this.getUTCSeconds(),2)+"."+P(this.getUTCMilliseconds(),3)+"Z"}})})();
|
||
|
function Ba(a,b,c,d){var e=k;if(a===b)return k;else if(D(b)&&C(a))return r(b).test(a);else if(z(b)&&!z(a))return b.apply(c,d);else if(L(b)&&ka(a)){G(b,function(g){Ba(a[g],b[g],c,[a[g],a])||(e=n)});return e}else return ua(a)&&ua(b)?ta(a)===ta(b):a===b}function R(a,b,c,d){return K(b)?a:z(b)?b.apply(c,d||[]):z(a[b])?a[b].call(a):a[b]}
|
||
|
function T(a,b,c,d){var e,g;if(c<0)c=a.length+c;g=isNaN(c)?0:c;for(c=d===k?a.length+g:a.length;g<c;){e=g%a.length;if(e in a){if(b.call(a,a[e],e,a)===n)break}else return Ca(a,b,g,d);g++}}function Ca(a,b,c){var d=[],e;for(e in a)e in a&&e>>>0==e&&e!=4294967295&&e>=c&&d.push(parseInt(e));d.sort().each(function(g){return b.call(a,a[g],g,a)});return a}function Ea(a,b,c,d,e){var g,f;T(a,function(i,j,h){if(Ba(i,b,h,[i,j,h])){g=i;f=j;return n}},c,d);return e?f:g}
|
||
|
function Fa(a,b){var c=[],d={},e;T(a,function(g,f){e=b?R(g,b,a,[g,f,a]):g;Ga(d,e)||c.push(g)});return c}function Ha(a,b,c){var d=[],e={};b.each(function(g){Ga(e,g)});a.each(function(g){var f=ta(g),i=!ua(g);if(Ia(e,f,g,i)!=c){var j=0;if(i)for(f=e[f];j<f.length;)if(f[j]===g)f.splice(j,1);else j+=1;else delete e[f];d.push(g)}});return d}function Ja(a,b,c){b=b||Infinity;c=c||0;var d=[];T(a,function(e){if(da(e)&&c<b)d=d.concat(Ja(e,b,c+1));else d.push(e)});return d}
|
||
|
function Ka(a){var b=[];F(a,function(c){b=b.concat(c)});return b}function Ia(a,b,c,d){var e=b in a;if(d){a[b]||(a[b]=[]);e=a[b].indexOf(c)!==-1}return e}function Ga(a,b){var c=ta(b),d=!ua(b),e=Ia(a,c,b,d);if(d)a[c].push(b);else a[c]=b;return e}function La(a,b,c,d){var e,g=[],f=c==="max",i=c==="min",j=Array.isArray(a);G(a,function(h){var m=a[h];h=R(m,b,a,j?[m,parseInt(h),a]:[]);if(h===e)g.push(m);else if(K(e)||f&&h>e||i&&h<e){g=[m];e=h}});j||(g=Ja(g,1));return d?g:g[0]}
|
||
|
function Ma(a){if(q[Na])a=a.toLowerCase();return a.replace(q[Oa],"")}function Pa(a,b){var c=a.charAt(b);return(q[Qa]||{})[c]||c}function Ra(a){var b=q[Sa];return a?b.indexOf(a):l}var Sa="AlphanumericSortOrder",Oa="AlphanumericSortIgnore",Na="AlphanumericSortIgnoreCase",Qa="AlphanumericSortEquivalents";E(q,n,n,{create:function(){var a=[],b;F(arguments,function(c){if(ka(c)){b=q.prototype.slice.call(c);if(b.length>0)c=b}a=a.concat(c)});return a}});
|
||
|
E(q,k,n,{find:function(a,b,c){return Ea(this,a,b,c)},findAll:function(a,b,c){var d=[];T(this,function(e,g,f){Ba(e,a,f,[e,g,f])&&d.push(e)},b,c);return d},findIndex:function(a,b,c){a=Ea(this,a,b,c,k);return K(a)?-1:a},count:function(a){if(K(a))return this.length;return this.findAll(a).length},removeAt:function(a,b){if(K(a))return this;if(K(b))b=a;for(var c=0;c<=b-a;c++)this.splice(a,1);return this},include:function(a,b){return this.clone().add(a,b)},exclude:function(){return q.prototype.remove.apply(this.clone(),
|
||
|
arguments)},clone:function(){return ma([],this)},unique:function(a){return Fa(this,a)},flatten:function(a){return Ja(this,a)},union:function(){return Fa(this.concat(Ka(arguments)))},intersect:function(){return Ha(this,Ka(arguments),n)},subtract:function(){return Ha(this,Ka(arguments),k)},at:function(){return va(this,arguments)},first:function(a){if(K(a))return this[0];if(a<0)a=0;return this.slice(0,a)},last:function(a){if(K(a))return this[this.length-1];return this.slice(this.length-a<0?0:this.length-
|
||
|
a)},from:function(a){return this.slice(a)},to:function(a){if(K(a))a=this.length;return this.slice(0,a)},min:function(a,b){return La(this,a,"min",b)},max:function(a,b){return La(this,a,"max",b)},least:function(a,b){return La(this.groupBy.apply(this,[a]),"length","min",b)},most:function(a,b){return La(this.groupBy.apply(this,[a]),"length","max",b)},sum:function(a){a=a?this.map(a):this;return a.length>0?a.reduce(function(b,c){return b+c}):0},average:function(a){a=a?this.map(a):this;return a.length>0?
|
||
|
a.sum()/a.length:0},inGroups:function(a,b){var c=arguments.length>1,d=this,e=[],g=M(this.length/a,void 0,"ceil");oa(0,a-1,function(f){f=f*g;var i=d.slice(f,f+g);c&&i.length<g&&oa(1,g-i.length,function(){i=i.add(b)});e.push(i)});return e},inGroupsOf:function(a,b){var c=[],d=this.length,e=this,g;if(d===0||a===0)return e;if(K(a))a=1;if(K(b))b=l;oa(0,M(d/a,void 0,"ceil")-1,function(f){for(g=e.slice(a*f,a*f+a);g.length<a;)g.push(b);c.push(g)});return c},isEmpty:function(){return this.compact().length==
|
||
|
0},sortBy:function(a,b){var c=this.clone();c.sort(function(d,e){var g,f;g=R(d,a,c,[d]);f=R(e,a,c,[e]);if(C(g)&&C(f)){g=g;f=f;var i,j,h,m,o=0,w=0;g=Ma(g);f=Ma(f);do{h=Pa(g,o);m=Pa(f,o);i=Ra(h);j=Ra(m);if(i===-1||j===-1){i=g.charCodeAt(o)||l;j=f.charCodeAt(o)||l}h=h!==g.charAt(o);m=m!==f.charAt(o);if(h!==m&&w===0)w=h-m;o+=1}while(i!=l&&j!=l&&i===j);g=i===j?w:i<j?-1:1}else g=g<f?-1:g>f?1:0;return g*(b?-1:1)});return c},randomize:function(){for(var a=this.concat(),b,c,d=a.length;d;b=parseInt(v.random()*
|
||
|
d),c=a[--d],a[d]=a[b],a[b]=c);return a},zip:function(){var a=F(arguments);return this.map(function(b,c){return[b].concat(a.map(function(d){return c in d?d[c]:l}))})},sample:function(a){var b=[],c=this.clone(),d;if(K(a))a=1;for(;b.length<a;){d=N(v.random()*(c.length-1));b.push(c[d]);c.removeAt(d);if(c.length==0)break}return arguments.length>0?b:b[0]},each:function(a,b,c){T(this,a,b,c);return this},add:function(a,b){if(!A(u(b))||isNaN(b))b=this.length;q.prototype.splice.apply(this,[b,0].concat(a));
|
||
|
return this},remove:function(){var a,b=this;F(arguments,function(c){for(a=0;a<b.length;)if(Ba(b[a],c,b,[b[a],a,b]))b.splice(a,1);else a++});return b},compact:function(a){var b=[];T(this,function(c){if(da(c))b.push(c.compact());else if(a&&c)b.push(c);else!a&&c!=l&&c.valueOf()===c.valueOf()&&b.push(c)});return b},groupBy:function(a,b){var c=this,d={},e;T(c,function(g,f){e=R(g,a,c,[g,f,c]);d[e]||(d[e]=[]);d[e].push(g)});b&&G(d,b);return d},none:function(){return!this.any.apply(this,arguments)}});
|
||
|
E(q,k,n,{all:q.prototype.every,any:q.prototype.some,insert:q.prototype.add});function Ta(a){if(a&&a.valueOf)a=a.valueOf();return p.keys(a)}function Ua(a,b){H(p,n,n,a,function(c,d){c[d]=function(e,g,f){f=q.prototype[d].call(Ta(e),function(i){return b?R(e[i],g,e,[i,e[i],e]):Ba(e[i],g,e,[i,e[i],e])},f);if(da(f))f=f.reduce(function(i,j){i[j]=e[j];return i},{});return f}});wa(a,na)}
|
||
|
E(p,n,n,{map:function(a,b){return Ta(a).reduce(function(c,d){c[d]=R(a[d],b,a,[d,a[d],a]);return c},{})},reduce:function(a){var b=Ta(a).map(function(c){return a[c]});return b.reduce.apply(b,F(arguments).slice(1))},size:function(a){return Ta(a).length}});(function(){H(q,k,function(){var a=arguments;return a.length>0&&!z(a[0])},"map,every,all,some,any,none,filter",function(a,b){a[b]=function(c){return this[b](function(d,e){return b==="map"?R(d,c,this,[d,e,this]):Ba(d,c,this,[d,e,this])})}})})();
|
||
|
(function(){q[Sa]="A\u00c1\u00c0\u00c2\u00c3\u0104BC\u0106\u010c\u00c7D\u010e\u00d0E\u00c9\u00c8\u011a\u00ca\u00cb\u0118FG\u011eH\u0131I\u00cd\u00cc\u0130\u00ce\u00cfJKL\u0141MN\u0143\u0147\u00d1O\u00d3\u00d2\u00d4PQR\u0158S\u015a\u0160\u015eT\u0164U\u00da\u00d9\u016e\u00db\u00dcVWXY\u00ddZ\u0179\u017b\u017d\u00de\u00c6\u0152\u00d8\u00d5\u00c5\u00c4\u00d6".split("").map(function(b){return b+b.toLowerCase()}).join("");var a={};T("A\u00c1\u00c0\u00c2\u00c3\u00c4,C\u00c7,E\u00c9\u00c8\u00ca\u00cb,I\u00cd\u00cc\u0130\u00ce\u00cf,O\u00d3\u00d2\u00d4\u00d5\u00d6,S\u00df,U\u00da\u00d9\u00db\u00dc".split(","),
|
||
|
function(b){var c=b.charAt(0);T(b.slice(1).split(""),function(d){a[d]=c;a[d.toLowerCase()]=c.toLowerCase()})});q[Na]=k;q[Qa]=a})();Ua("each,any,all,none,count,find,findAll,isEmpty");Ua("sum,average,min,max,least,most",k);wa("map,reduce,size",na);
|
||
|
var U,Va,Wa=["ampm","hour","minute","second","ampm","utc","offset_sign","offset_hours","offset_minutes","ampm"],Xa="({t})?\\s*(\\d{1,2}(?:[,.]\\d+)?)(?:{h}(\\d{1,2}(?:[,.]\\d+)?)?{m}(?::?(\\d{1,2}(?:[,.]\\d+)?){s})?\\s*(?:({t})|(Z)|(?:([+-])(\\d{2,2})(?::?(\\d{2,2}))?)?)?|\\s*({t}))",Ya={},Za,$a,ab,bb=[],cb=[{ba:"f{1,4}|ms|milliseconds",format:function(a){return V(a,"Milliseconds")}},{ba:"ss?|seconds",format:function(a){return V(a,"Seconds")}},{ba:"mm?|minutes",format:function(a){return V(a,"Minutes")}},
|
||
|
{ba:"hh?|hours|12hr",format:function(a){a=V(a,"Hours");return a===0?12:a-N(a/13)*12}},{ba:"HH?|24hr",format:function(a){return V(a,"Hours")}},{ba:"dd?|date|day",format:function(a){return V(a,"Date")}},{ba:"dow|weekday",la:k,format:function(a,b,c){a=V(a,"Day");return b.weekdays[a+(c-1)*7]}},{ba:"MM?",format:function(a){return V(a,"Month")+1}},{ba:"mon|month",la:k,format:function(a,b,c){a=V(a,"Month");return b.months[a+(c-1)*12]}},{ba:"y{2,4}|year",format:function(a){return V(a,"FullYear")}},{ba:"[Tt]{1,2}",
|
||
|
format:function(a,b,c,d){if(b.ampm.length==0)return"";a=V(a,"Hours");b=b.ampm[N(a/12)];if(d.length===1)b=b.slice(0,1);if(d.slice(0,1)==="T")b=b.toUpperCase();return b}},{ba:"z{1,4}|tz|timezone",text:k,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 P(g,d.length)});return a}},{ba:"iso(tz|timezone)",format:function(a){return a.getUTCOffset(k)}},{ba:"ord",format:function(a){a=V(a,"Date");return a+qa(a)}}],db=[{$:"year",method:"FullYear",
|
||
|
ja:k,da:function(a){return(365+(a?a.isLeapYear()?1:0:0.25))*24*60*60*1E3}},{$:"month",method:"Month",ja:k,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:aa(6048E5)},{$:"day",method:"Date",ja:k,da:aa(864E5)},{$:"hour",method:"Hours",da:aa(36E5)},{$:"minute",method:"Minutes",da:aa(6E4)},{$:"second",method:"Seconds",da:aa(1E3)},{$:"millisecond",method:"Milliseconds",da:aa(1)}],eb={};
|
||
|
function fb(a){ma(this,a);this.ga=bb.concat()}
|
||
|
fb.prototype={getMonth:function(a){return A(a)?a-1:this.months.indexOf(a)%12},getWeekday:function(a){return this.weekdays.indexOf(a)%7},oa:function(a){var b;return A(a)?a:a&&(b=this.numbers.indexOf(a))!==-1?(b+1)%10:1},ta:function(a){var b=this;return a.replace(r(this.num,"g"),function(c){return b.oa(c)||""})},ra:function(a){return U.units[this.units.indexOf(a)%8]},ua:function(a){return this.na(a,a[2]>0?"future":"past")},qa:function(a){return this.na(gb(a),"duration")},va:function(a){a=a||this.code;
|
||
|
return a==="en"||a==="en-US"?k:this.variant},ya:function(a){return a===this.ampm[0]},za:function(a){return a&&a===this.ampm[1]},na:function(a,b){var c,d,e=a[0],g=a[1],f=a[2],i=this[b]||this.relative;if(z(i))return i.call(this,e,g,f,b);d=this.units[(this.plural&&e>1?1:0)*8+g]||this.units[g];if(this.capitalizeUnit)d=hb(d);c=this.modifiers.filter(function(j){return j.name=="sign"&&j.value==(f>0?1:-1)})[0];return i.replace(/\{(.*?)\}/g,function(j,h){switch(h){case "num":return e;case "unit":return d;
|
||
|
case "sign":return c.src}})},sa:function(){return this.ma?[this.ma].concat(this.ga):this.ga},addFormat:function(a,b,c,d,e){var g=c||[],f=this,i;a=a.replace(/\s+/g,"[-,. ]*");a=a.replace(/\{([^,]+?)\}/g,function(j,h){var m,o,w,B=h.match(/\?$/);w=h.match(/^(\d+)\??$/);var J=h.match(/(\d)(?:-(\d))?/),O=h.replace(/[^a-z]+$/,"");if(w)m=f.tokens[w[1]];else if(f[O])m=f[O];else if(f[O+"s"]){m=f[O+"s"];if(J){o=[];m.forEach(function(ea,Da){var S=Da%(f.units?8:m.length);if(S>=J[1]&&S<=(J[2]||J[1]))o.push(ea)});
|
||
|
m=o}m=ib(m)}if(w)w="(?:"+m+")";else{c||g.push(O);w="("+m+")"}if(B)w+="?";return w});if(b){b=jb(Xa,f,e);e=["t","[\\s\\u3000]"].concat(f.timeMarker);i=a.match(/\\d\{\d,\d\}\)+\??$/);kb(f,"(?:"+b+")[,\\s\\u3000]+?"+a,Wa.concat(g),d);kb(f,a+"(?:[,\\s]*(?:"+e.join("|")+(i?"+":"*")+")"+b+")?",g.concat(Wa),d)}else kb(f,a,g,d)}};function lb(a,b){var c;C(a)||(a="");c=eb[a]||eb[a.slice(0,2)];if(b===n&&!c)throw Error("Invalid locale.");return c||Va}
|
||
|
function mb(a,b){function c(j){var h=f[j];if(C(h))f[j]=h.split(",");else h||(f[j]=[])}function d(j,h){j=j.split("+").map(function(m){return m.replace(/(.+):(.+)$/,function(o,w,B){return B.split("|").map(function(J){return w+J}).join("|")})}).join("|");return j.split("|").forEach(h)}function e(j,h,m){var o=[];f[j].forEach(function(w,B){if(h)w+="+"+w.slice(0,3);d(w,function(J,O){o[O*m+B]=J.toLowerCase()})});f[j]=o}function g(j,h,m){j="\\d{"+j+","+h+"}";if(m)j+="|(?:"+ib(f.numbers)+")+";return j}var f,
|
||
|
i;f=new fb(b);c("modifiers");"months,weekdays,units,numbers,articles,tokens,timeMarker,ampm,timeSuffixes,dateParse,timeParse".split(",").forEach(c);i=!f.monthSuffix;e("months",i,12);e("weekdays",i,7);e("units",n,8);e("numbers",n,10);f.code=a;f.date=g(1,2,f.digitDate);f.year=g(4,4);f.num=function(){var j=["\\d+"].concat(f.articles);if(f.numbers)j=j.concat(f.numbers);return ib(j)}();(function(){var j=[];f.ha={};f.modifiers.forEach(function(h){var m=h.name;d(h.src,function(o){var w=f[m];f.ha[o]=h;j.push({name:m,
|
||
|
src:o,value:h.value});f[m]=w?w+"|"+o:o})});f.day+="|"+ib(f.weekdays);f.modifiers=j})();if(f.monthSuffix){f.month=g(1,2);f.months=oa(1,12).map(function(j){return j+f.monthSuffix})}f.full_month=g(1,2)+"|"+ib(f.months);f.timeSuffixes.length>0&&f.addFormat(jb(Xa,f),n,Wa);f.addFormat("{day}",k);f.addFormat("{month}"+(f.monthSuffix||""));f.addFormat("{year}"+(f.yearSuffix||""));f.timeParse.forEach(function(j){f.addFormat(j,k)});f.dateParse.forEach(function(j){f.addFormat(j)});return eb[a]=f}
|
||
|
function kb(a,b,c,d){a.ga.unshift({Ba:d,xa:a,Aa:r("^"+b+"$","i"),to:c})}function hb(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function ib(a){return a.filter(function(b){return!!b}).join("|")}function nb(a,b){var c;if(L(a[0]))return a;else if(A(a[0])&&!A(a[1]))return[a[0]];else if(C(a[0])&&b)return[ob(a[0]),a[1]];c={};$a.forEach(function(d,e){c[d.$]=a[e]});return[c]}
|
||
|
function ob(a,b){var c={};if(match=a.match(/^(\d+)?\s?(\w+?)s?$/i)){if(K(b))b=parseInt(match[1])||1;c[match[2].toLowerCase()]=b}return c}function pb(a,b){var c={},d,e;b.forEach(function(g,f){d=a[f+1];if(!(K(d)||d==="")){if(g==="year")c.Ca=d;e=parseFloat(d.replace(/,/,"."));c[g]=!isNaN(e)?e:d.toLowerCase()}});return c}function qb(a){a=a.trim().replace(/^(just )?now|\.+$/i,"");return rb(a)}
|
||
|
function rb(a){return a.replace(Za,function(b,c,d){var e=0,g=1,f,i;if(c)return b;d.split("").reverse().forEach(function(j){j=Ya[j];var h=j>9;if(h){if(f)e+=g;g*=j/(i||1);i=j}else{if(f===n)g*=10;e+=g*j}f=h});if(f)e+=g;return e})}
|
||
|
function sb(a,b,c,d){var e=new s,g=n,f,i,j,h,m,o,w,B,J;e.utc(d);if(ga(a))e=new s(a.getTime());else if(A(a))e=new s(a);else if(L(a)){e.set(a,k);h=a}else if(C(a)){f=lb(b);a=qb(a);f&&G(f.sa(),function(O,ea){var Da=a.match(ea.Aa);if(Da){j=ea;i=j.xa;h=pb(Da,j.to,i);h.utc&&e.utc();i.ma=j;if(h.timestamp){h=h.timestamp;return n}if(j.Ba&&!C(h.month)&&(C(h.date)||f.va(b))){B=h.month;h.month=h.date;h.date=B}if(h.year&&h.Ca.length===2)h.year=M(V(new s,"FullYear")/100)*100-M(h.year/100)*100+h.year;if(h.month){h.month=
|
||
|
i.getMonth(h.month);if(h.shift&&!h.unit)h.unit=i.units[7]}if(h.weekday&&h.date)delete h.weekday;else if(h.weekday){h.weekday=i.getWeekday(h.weekday);if(h.shift&&!h.unit)h.unit=i.units[5]}if(h.day&&(B=i.ha[h.day])){h.day=B.value;e.reset();g=k}else if(h.day&&(o=i.getWeekday(h.day))>-1){delete h.day;if(h.num&&h.month){J=function(){var S=e.getWeekday();e.setWeekday(7*(h.num-1)+(S>o?o+7:o))};h.day=1}else h.weekday=o}if(h.date&&!A(h.date))h.date=i.ta(h.date);if(i.za(h.ampm)&&h.hour<12)h.hour+=12;else if(i.ya(h.ampm)&&
|
||
|
h.hour===12)h.hour=0;if("offset_hours"in h||"offset_minutes"in h){e.utc();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){g=k;w=i.oa(h.num);m=i.ra(h.unit);if(h.shift||h.edge){w*=(B=i.ha[h.shift])?B.value:0;if(m==="month"&&I(h.date)){e.set({day:h.date},k);delete h.date}if(m==="year"&&I(h.month)){e.set({month:h.month,day:h.date},k);delete h.month;delete h.date}}if(h.sign&&(B=i.ha[h.sign]))w*=B.value;
|
||
|
if(I(h.weekday)){e.set({weekday:h.weekday},k);delete h.weekday}h[m]=(h[m]||0)+w}if(h.year_sign==="-")h.year*=-1;ab.slice(1,4).forEach(function(S,Ub){var zb=h[S.$],Ab=zb%1;if(Ab){h[ab[Ub].$]=M(Ab*(S.$==="second"?1E3:60));h[S.$]=N(zb)}});return n}});if(j)if(g)e.advance(h);else{e._utc&&e.reset();tb(e,h,k,n,c)}else e=a?new s(a):new s;if(h&&h.edge){B=i.ha[h.edge];G(ab.slice(4),function(O,ea){if(I(h[ea.$])){m=ea.$;return n}});if(m==="year")h.fa="month";else if(m==="month"||m==="week")h.fa="day";e[(B.value<
|
||
|
0?"endOf":"beginningOf")+hb(m)]();B.value===-2&&e.reset()}J&&J()}e.utc(n);return{ea:e,set:h}}function gb(a){var b,c=v.abs(a),d=c,e=0;ab.slice(1).forEach(function(g,f){b=N(M(c/g.da()*10)/10);if(b>=1){d=b;e=f+1}});return[d,e,a]}
|
||
|
function ub(a,b,c,d){var e,g=lb(d),f=r(/^[A-Z]/);if(a.isValid())if(Date[b])b=Date[b];else{if(z(b)){e=gb(a.millisecondsFromNow());b=b.apply(a,e.concat(g))}}else return"Invalid Date";if(!b&&c){e=e||gb(a.millisecondsFromNow());if(e[1]===0){e[1]=1;e[0]=1}return g.ua(e)}b=b||"long";b=g[b]||b;cb.forEach(function(i){b=b.replace(r("\\{("+i.ba+")(\\d)?\\}",i.la?"i":""),function(j,h,m){j=i.format(a,g,m||1,h);m=h.length;var o=h.match(/^(.)\1+$/);if(i.la){if(m===3)j=j.slice(0,3);if(o||h.match(f))j=hb(j)}else if(o&&
|
||
|
!i.text)j=(A(j)?P(j,m):j.toString()).slice(-m);return j})});return b}
|
||
|
function vb(a,b,c,d){var e=sb(b,l,l,d),g=0;d=b=0;var f;if(c>0){b=d=c;f=k}if(!e.ea.isValid())return n;if(e.set&&e.set.fa){db.forEach(function(j){if(j.$===e.set.fa)g=j.da(e.ea,a-e.ea)-1});c=hb(e.set.fa);if(e.set.edge||e.set.shift)e.ea["beginningOf"+c]();if(e.set.fa==="month")i=e.ea.clone()["endOf"+c]().getTime();if(!f&&e.set.sign&&e.set.fa!="millisecond"){b=50;d=-50}}f=a.getTime();c=e.ea.getTime();var i=i||c+g;return f>=c-b&&f<=i+d}
|
||
|
function tb(a,b,c,d,e){function g(h){return I(b[h])?b[h]:b[h+"s"]}function f(h){return I(g(h))}var i,j;if(A(b)&&d)b={milliseconds:b};else if(A(b)){a.setTime(b);return a}if(b.date)b.day=b.date;G(ab,function(h,m){var o=m.$==="day";if(f(m.$)||o&&f("weekday")){b.fa=m.$;j=+h;return n}else if(c&&m.$!=="week"&&(!o||!f("week")))W(a,m.method,o?1:0)});db.forEach(function(h){var m=h.$;h=h.method;var o;o=g(m);if(!K(o)){if(d){if(m==="week"){o=(b.day||0)+o*7;h="Date"}o=o*d+V(a,h)}else m==="month"&&f("day")&&W(a,
|
||
|
"Date",15);W(a,h,o);if(d&&m==="month"){m=o;if(m<0)m+=12;m%12!=V(a,"Month")&&W(a,"Date",0)}}});if(!d&&!f("day")&&f("weekday")){i=g("weekday");a.setWeekday(i)}(function(){var h=new s;return e===-1&&a>h||e===1&&a<h})()&&G(ab.slice(j+1),function(h,m){if((m.ja||m.$==="week"&&f("weekday"))&&!(f(m.$)||m.$==="day"&&f("weekday"))){a[m.ia](e);return n}});return a}function V(a,b){return a["get"+(a._utc?"UTC":"")+b]()}function W(a,b,c){return a["set"+(a._utc?"UTC":"")+b](c)}
|
||
|
function jb(a,b,c){var d={h:0,m:1,s:2},e;b=b||U;return a.replace(/{([a-z])}/g,function(g,f){var i=[],j=f==="h",h=j&&!c;if(f==="t")return b.ampm.join("|");else{j&&i.push(":");if(e=b.timeSuffixes[d[f]])i.push(e+"\\s*");return i.length===0?"":"(?:"+i.join("|")+")"+(h?"":"?")}})}function X(a,b,c){var d,e;if(A(a[1]))d=nb(a)[0];else{d=a[0];e=a[1]}return sb(d,e,b,c).ea}
|
||
|
s.extend({create:function(){return X(arguments)},past:function(){return X(arguments,-1)},future:function(){return X(arguments,1)},addLocale:function(a,b){return mb(a,b)},setLocale:function(a){var b=lb(a,n);Va=b;if(a&&a!=b.code)b.code=a;return b},getLocale:function(a){return!a?Va:lb(a,n)},addFormat:function(a,b,c){kb(lb(c),a,b)}},n,n);
|
||
|
s.extend({set:function(){var a=nb(arguments);return tb(this,a[0],a[1])},setWeekday:function(a){if(!K(a))return W(this,"Date",V(this,"Date")+a-V(this,"Day"))},setWeek:function(a){if(!K(a)){V(this,"Date");W(this,"Month",0);W(this,"Date",a*7+1);return this.getTime()}},getWeek:function(){var a=this;a=a.clone();var b=V(a,"Day")||7;a.addDays(4-b).reset();return 1+N(a.daysSince(a.clone().beginningOfYear())/7)},getUTCOffset:function(a){var b=this._utc?0:this.getTimezoneOffset(),c=a===k?":":"";if(!b&&a)return"Z";
|
||
|
return P(M(-b/60),2,k)+c+P(b%60,2)},utc:function(a){this._utc=a===k||arguments.length===0;return this},isUTC:function(){return!!this._utc||this.getTimezoneOffset()===0},advance:function(){var a=nb(arguments,k);return tb(this,a[0],a[1],1)},rewind:function(){var a=nb(arguments,k);return tb(this,a[0],a[1],-1)},isValid:function(){return!isNaN(this.getTime())},isAfter:function(a,b){return this.getTime()>s.create(a).getTime()-(b||0)},isBefore:function(a,b){return this.getTime()<s.create(a).getTime()+(b||
|
||
|
0)},isBetween:function(a,b,c){var d=this.getTime();a=s.create(a).getTime();var e=s.create(b).getTime();b=v.min(a,e);a=v.max(a,e);c=c||0;return b-c<d&&a+c>d},isLeapYear:function(){var a=V(this,"FullYear");return a%4===0&&a%100!==0||a%400===0},daysInMonth:function(){return 32-V(new s(V(this,"FullYear"),V(this,"Month"),32),"Date")},format:function(a,b){return ub(this,a,n,b)},relative:function(a,b){if(C(a)){b=a;a=l}return ub(this,a,k,b)},is:function(a,b,c){var d,e;if(this.isValid()){if(C(a)){a=a.trim().toLowerCase();
|
||
|
e=this.clone().utc(c);switch(k){case a==="future":return this.getTime()>(new s).getTime();case a==="past":return this.getTime()<(new s).getTime();case a==="weekday":return V(e,"Day")>0&&V(e,"Day")<6;case a==="weekend":return V(e,"Day")===0||V(e,"Day")===6;case (d=U.weekdays.indexOf(a)%7)>-1:return V(e,"Day")===d;case (d=U.months.indexOf(a)%12)>-1:return V(e,"Month")===d}}return vb(this,a,b,c)}},reset:function(a){var b={},c;a=a||"hours";if(a==="date")a="days";c=db.some(function(d){return a===d.$||
|
||
|
a===d.$+"s"});b[a]=a.match(/^days?/)?1:0;return c?this.set(b,k):this},clone:function(){var a=new s(this.getTime());a._utc=this._utc;return a}});s.extend({iso:function(){return this.toISOString()},getWeekday:s.prototype.getDay,getUTCWeekday:s.prototype.getUTCDay});
|
||
|
function wb(a,b){function c(){return M(this*b)}function d(){return X(arguments)[a.ia](this)}function e(){return X(arguments)[a.ia](-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;u.extend(f)}u.extend({duration:function(a){return lb(a).qa(this)}});
|
||
|
U=Va=s.addLocale("en",{plural:k,timeMarker:"at",ampm:"am,pm",months:"January,February,March,April,May,June,July,August,September,October,November,December",weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",units:"millisecond:|s,second:|s,minute:|s,hour:|s,day:|s,week:|s,month:|s,year:|s",numbers:"one,two,three,four,five,six,seven,eight,nine,ten",articles:"a,an,the",tokens:"the,st|nd|rd|th,of","short":"{Month} {d}, {yyyy}","long":"{Month} {d}, {yyyy} {h}:{mm}{tt}",full:"{Weekday} {Month} {d}, {yyyy} {h}:{mm}:{ss}{tt}",
|
||
|
past:"{num} {unit} {sign}",future:"{num} {unit} {sign}",duration:"{num} {unit}",modifiers:[{name:"day",src:"yesterday",value:-1},{name:"day",src:"today",value:0},{name:"day",src:"tomorrow",value:1},{name:"sign",src:"ago|before",value:-1},{name:"sign",src:"from now|after|from|in|later",value:1},{name:"edge",src:"last day",value:-2},{name:"edge",src:"end",value:-1},{name:"edge",src:"first day|beginning",value:1},{name:"shift",src:"last",value:-1},{name:"shift",src:"the|this",value:0},{name:"shift",
|
||
|
src:"next",value:1}],dateParse:["{num} {unit} {sign}","{sign} {num} {unit}","{month} {year}","{shift} {unit=5-7}","{0?} {date}{1}","{0?} {edge} of {shift?} {unit=4-7?}{month?}{year?}"],timeParse:["{0} {num}{1} {day} of {month} {year?}","{weekday?} {month} {date}{1?} {year?}","{date} {month} {year}","{shift} {weekday}","{shift} week {weekday}","{weekday} {2?} {shift} week","{num} {unit=4-5} {sign} {day}","{0?} {date}{1} of {month}","{0?}{month?} {date?}{1?} of {shift} {unit=6-7}"]});ab=db.concat().reverse();
|
||
|
$a=db.concat();$a.splice(2,1);
|
||
|
H(s,k,n,db,function(a,b,c){var d=b.$,e=hb(d),g=b.da(),f,i;b.ia="add"+e+"s";f=function(j,h){return M((this.getTime()-s.create(j,h).getTime())/g)};i=function(j,h){return M((s.create(j,h).getTime()-this.getTime())/g)};a[d+"sAgo"]=i;a[d+"sUntil"]=i;a[d+"sSince"]=f;a[d+"sFromNow"]=f;a[b.ia]=function(j,h){var m={};m[d]=j;return this.advance(m,h)};wb(b,g);c<3&&["Last","This","Next"].forEach(function(j){a["is"+j+e]=function(){return this.is(j+" "+d)}});if(c<4){a["beginningOf"+e]=function(){var j={};switch(d){case "year":j.year=
|
||
|
V(this,"FullYear");break;case "month":j.month=V(this,"Month");break;case "day":j.day=V(this,"Date");break;case "week":j.weekday=0}return this.set(j,k)};a["endOf"+e]=function(){var j={hours:23,minutes:59,seconds:59,milliseconds:999};switch(d){case "year":j.month=11;j.day=31;break;case "month":j.day=this.daysInMonth();break;case "week":j.weekday=6}return this.set(j,k)}}});U.addFormat("([+-])?(\\d{4,4})[-.]?{full_month}[-.]?(\\d{1,2})?",k,["year_sign","year","month","date"],n,k);
|
||
|
U.addFormat("(\\d{1,2})[-.\\/]{full_month}(?:[-.\\/](\\d{2,4}))?",k,["date","month","year"],k);U.addFormat("{full_month}[-.](\\d{4,4})",n,["month","year"]);U.addFormat("\\/Date\\((\\d+(?:\\+\\d{4,4})?)\\)\\/",n,["timestamp"]);U.addFormat(jb(Xa,U),n,Wa);bb=U.ga.slice(0,7).reverse();U.ga=U.ga.slice(7).concat(bb);H(s,k,n,"short,long,full",function(a,b){a[b]=function(c){return ub(this,b,n,c)}});
|
||
|
"\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d\u5341\u767e\u5343\u4e07".split("").forEach(function(a,b){if(b>9)b=v.pow(10,b-9);Ya[a]=b});"\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19".split("").forEach(function(a,b){Ya[a]=b});Za=r("([\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=U.weekdays.slice(0,7),c=U.months.slice(0,12);H(s,k,n,a.concat(b).concat(c),function(d,e){d["is"+hb(e)]=function(g){return this.is(e,0,g)}})})();(function(){s.extend({utc:{create:function(){return X(arguments,0,k)},past:function(){return X(arguments,-1,k)},future:function(){return X(arguments,1,k)}}},n,n)})();
|
||
|
s.extend({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}"},n,n);
|
||
|
DateRange=function(a,b){this.start=s.create(a);this.end=s.create(b)};DateRange.prototype.toString=function(){return this.isValid()?this.start.full()+".."+this.end.full():"Invalid DateRange"};
|
||
|
E(DateRange,k,n,{isValid:function(){return this.start<this.end},duration:function(){return this.isValid()?this.end.getTime()-this.start.getTime():NaN},contains:function(a){var b=this;return(a.start&&a.end?[a.start,a.end]:[a]).every(function(c){return c>=b.start&&c<=b.end})},every:function(a,b){var c=this.start.clone(),d=[],e=0,g,f;if(C(a)){c.advance(ob(a,0),k);g=ob(a);f=a.toLowerCase()==="day"}else g={milliseconds:a};for(;c<=this.end;){d.push(c);b&&b(c,e);if(f&&V(c,"Hours")===23){c=c.clone();W(c,
|
||
|
"Hours",48)}else c=c.clone().advance(g,k);e++}return d},union:function(a){return new DateRange(this.start<a.start?this.start:a.start,this.end>a.end?this.end:a.end)},intersect:function(a){return new DateRange(this.start>a.start?this.start:a.start,this.end<a.end?this.end:a.end)}});H(DateRange,k,n,"Millisecond,Second,Minute,Hour,Day,Week,Month,Year",function(a,b){a["each"+b]=function(c){return this.every(b,c)}});E(s,n,n,{range:function(a,b){return new DateRange(a,b)}});
|
||
|
function xb(a,b,c,d,e){var g;if(!a.timers)a.timers=[];A(b)||(b=0);a.timers.push(setTimeout(function(){a.timers.splice(g,1);c.apply(d,e||[])},b));g=a.timers.length}
|
||
|
E(Function,k,n,{lazy:function(a,b){function c(){if(!(g&&e.length>b-2)){e.push([this,arguments]);f()}}var d=this,e=[],g=n,f,i,j;a=a||1;b=b||Infinity;i=M(a,void 0,"ceil");j=M(i/a);f=function(){if(!(g||e.length==0)){for(var h=v.max(e.length-j,0);e.length>h;)Function.prototype.apply.apply(d,e.shift());xb(c,i,function(){g=n;f()});g=k}};return c},delay:function(a){var b=F(arguments).slice(1);xb(this,a,this,this,b);return this},throttle:function(a){return this.lazy(a,1)},debounce:function(a){function b(){b.cancel();
|
||
|
xb(b,a,c,this,arguments)}var c=this;return b},cancel:function(){if(da(this.timers))for(;this.timers.length>0;)clearTimeout(this.timers.shift());return this},after:function(a){var b=this,c=0,d=[];if(A(a)){if(a===0){b.call();return b}}else a=1;return function(){var e;d.push(F(arguments));c++;if(c==a){e=b.call(this,d);c=0;d=[];return e}}},once:function(){var a=this;return function(){return la(a,"memo")?a.memo:a.memo=a.apply(this,arguments)}},fill:function(){var a=this,b=F(arguments);return function(){var c=
|
||
|
F(arguments);b.forEach(function(d,e){if(d!=l||e>=c.length)c.splice(e,0,d)});return a.apply(this,c)}}});
|
||
|
function yb(a,b,c,d,e,g){var f=a.toFixed(20),i=f.search(/\./);f=f.search(/[1-9]/);i=i-f;if(i>0)i-=1;e=v.max(v.min((i/3).floor(),e===n?c.length:e),-d);d=c.charAt(e+d-1);if(i<-9){e=-3;b=i.abs()-9;d=c.slice(0,1)}return(a/(g?(2).pow(10*e):(10).pow(e*3))).round(b||0).format()+d.trim()}
|
||
|
E(u,n,n,{random:function(a,b){var c,d;if(arguments.length==1){b=a;a=0}c=v.min(a||0,K(b)?1:b);d=v.max(a||0,K(b)?1:b)+1;return N(v.random()*(d-c)+c)}});
|
||
|
E(u,k,n,{log:function(a){return v.log(this)/(a?v.log(a):1)},abbr:function(a){return yb(this,a,"kmbt",0,4)},metric:function(a,b){return yb(this,a,"n\u03bcm kMGTPE",4,K(b)?1:b)},bytes:function(a,b){return yb(this,a,"kMGTPE",0,K(b)?4:b,k)+"B"},isInteger:function(){return this%1==0},isOdd:function(){return!this.isMultipleOf(2)},isEven:function(){return this.isMultipleOf(2)},isMultipleOf:function(a){return this%a===0},format:function(a,b,c){var d,e,g=/(\d+)(\d{3})/;if(t(b).match(/\d/))throw new TypeError("Thousands separator cannot contain numbers.");
|
||
|
d=A(a)?M(this,a||0).toFixed(v.max(a,0)):this.toString();b=b||",";c=c||".";e=d.split(".");d=e[0];for(e=e[1]||"";d.match(g);)d=d.replace(g,"$1"+b+"$2");if(e.length>0)d+=c+pa((a||0)-e.length,"0")+e;return d},hex:function(a){return this.pad(a||1,n,16)},upto:function(a,b,c){return oa(this,a,b,c||1)},downto:function(a,b,c){return oa(this,a,b,-(c||1))},times:function(a){if(a)for(var b=0;b<this;b++)a.call(this,b);return this.toNumber()},chr:function(){return t.fromCharCode(this)},pad:function(a,b,c){return P(this,
|
||
|
a,b,c)},ordinalize:function(){var a=this.abs();a=parseInt(a.toString().slice(-2));return this+qa(a)},toNumber:function(){return parseFloat(this,10)}});H(u,k,n,"round,floor,ceil",function(a,b){a[b]=function(c){return M(this,c,b)}});H(u,k,n,"abs,pow,sin,asin,cos,acos,tan,atan,exp,pow,sqrt",function(a,b){a[b]=function(c,d){return v[b](this,c,d)}});
|
||
|
var Bb="isObject,isNaN".split(","),Cb="keys,values,each,merge,clone,equal,watch,tap,has".split(",");
|
||
|
function Db(a,b,c,d){var e=/^(.+?)(\[.*\])$/,g,f,i;if(d!==n&&(f=b.match(e))){i=f[1];b=f[2].replace(/^\[|\]$/g,"").split("][");b.forEach(function(j){g=!j||j.match(/^\d+$/);if(!i&&da(a))i=a.length;a[i]||(a[i]=g?[]:{});a=a[i];i=j});if(!i&&g)i=a.length.toString();Db(a,i,c)}else a[b]=c.match(/^[\d.]+$/)?parseFloat(c):c==="true"?k:c==="false"?n:c}E(p,n,k,{watch:function(a,b,c){if(ca){var d=a[b];p.defineProperty(a,b,{enumerable:k,configurable:k,get:function(){return d},set:function(e){d=c.call(a,b,d,e)}})}}});
|
||
|
E(p,n,function(a,b){return z(b)},{keys:function(a,b){var c=p.keys(a);c.forEach(function(d){b.call(a,d,a[d])});return c}});
|
||
|
E(p,n,n,{isObject:function(a){return L(a)},isNaN:function(a){return A(a)&&a.valueOf()!==a.valueOf()},equal:function(a,b){return ua(a)&&ua(b)?ta(a)===ta(b):a===b},extended:function(a){return new na(a)},merge:function(a,b,c,d){var e,g;if(a&&typeof b!="string")for(e in b)if(la(b,e)&&a){g=b[e];if(I(a[e])){if(d===n)continue;if(z(d))g=d.call(b,e,a[e],b[e])}if(c===k&&g&&ka(g))if(ga(g))g=new s(g.getTime());else if(D(g))g=new r(g.source,sa(g));else{a[e]||(a[e]=q.isArray(g)?[]:{});p.merge(a[e],b[e],c,d);continue}a[e]=
|
||
|
g}return a},values:function(a,b){var c=[];G(a,function(d,e){c.push(e);b&&b.call(a,e)});return c},clone:function(a,b){if(!ka(a))return a;if(q.isArray(a))return a.concat();var c=a instanceof na?new na:{};return p.merge(c,a,b)},fromQueryString:function(a,b){var c=p.extended();a=a&&a.toString?a.toString():"";a.replace(/^.*?\?/,"").split("&").forEach(function(d){d=d.split("=");d.length===2&&Db(c,d[0],decodeURIComponent(d[1]),b)});return c},tap:function(a,b){var c=b;z(b)||(c=function(){b&&a[b]()});c.call(a,
|
||
|
a);return a},has:function(a,b){return la(a,b)}});H(p,n,n,x,function(a,b){var c="is"+b;Bb.push(c);a[c]=function(d){return p.prototype.toString.call(d)==="[object "+b+"]"}});(function(){E(p,n,function(){return arguments.length===0},{extend:function(){wa(Bb.concat(Cb),p)}})})();wa(Cb,na);
|
||
|
E(r,n,n,{escape:function(a){return Q(a)}});
|
||
|
E(r,k,n,{getFlags:function(){return sa(this)},setFlags:function(a){return r(this.source,a)},addFlag:function(a){return this.setFlags(sa(this,a))},removeFlag:function(a){return this.setFlags(sa(this).replace(a,""))}});
|
||
|
var Eb,Fb;
|
||
|
E(t,k,n,{escapeRegExp:function(){return Q(this)},escapeURL:function(a){return a?encodeURIComponent(this):encodeURI(this)},unescapeURL:function(a){return a?decodeURI(this):decodeURIComponent(this)},escapeHTML:function(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},unescapeHTML:function(){return this.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")},encodeBase64:function(){return Eb(this)},decodeBase64:function(){return Fb(this)},each:function(a,b){var c,
|
||
|
d;if(z(a)){b=a;a=/[\s\S]/g}else if(a)if(C(a))a=r(Q(a),"gi");else{if(D(a))a=r(a.source,sa(a,"g"))}else a=/[\s\S]/g;c=this.match(a)||[];if(b)for(d=0;d<c.length;d++)c[d]=b.call(this,c[d],d,c)||c[d];return c},shift:function(a){var b="";a=a||0;this.codes(function(c){b+=t.fromCharCode(c+a)});return b},codes:function(a){for(var b=[],c=0;c<this.length;c++){var d=this.charCodeAt(c);b.push(d);a&&a.call(this,d,c)}return b},chars:function(a){return this.each(a)},words:function(a){return this.trim().each(/\S+/g,
|
||
|
a)},lines:function(a){return this.trim().each(/^.*$/gm,a)},paragraphs:function(a){var b=this.trim().split(/[\r\n]{2,}/);return b=b.map(function(c){if(a)var d=a.call(c);return d?d:c})},startsWith:function(a,b){if(K(b))b=k;var c=D(a)?a.source.replace("^",""):Q(a);return r("^"+c,b?"":"i").test(this)},endsWith:function(a,b){if(K(b))b=k;var c=D(a)?a.source.replace("$",""):Q(a);return r(c+"$",b?"":"i").test(this)},isBlank:function(){return this.trim().length===0},has:function(a){return this.search(D(a)?
|
||
|
a:Q(a))!==-1},add:function(a,b){b=K(b)?this.length:b;return this.slice(0,b)+a+this.slice(b)},remove:function(a){return this.replace(a,"")},reverse:function(){return this.split("").reverse().join("")},compact:function(){return this.trim().replace(/([\r\n\s\u3000])+/g,function(a,b){return b==="\u3000"?b:" "})},at:function(){return va(this,arguments,k)},from:function(a){return this.slice(a)},to:function(a){if(K(a))a=this.length;return this.slice(0,a)},dasherize:function(){return this.underscore().replace(/_/g,
|
||
|
"-")},underscore:function(){return this.replace(/[-\s]+/g,"_").replace(t.Inflector&&t.Inflector.acronymRegExp,function(a,b){return(b>0?"_":"")+a.toLowerCase()}).replace(/([A-Z\d]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase()},camelize:function(a){return this.underscore().replace(/(^|_)([^_]+)/g,function(b,c,d,e){b=d;b=(c=t.Inflector)&&c.acronyms[b];b=C(b)?b:void 0;e=a!==n||e>0;if(b)return e?b:b.toLowerCase();return e?d.capitalize():d})},spacify:function(){return this.underscore().replace(/_/g,
|
||
|
" ")},stripTags:function(){var a=this;F(arguments.length>0?arguments:[""],function(b){a=a.replace(r("</?"+Q(b)+"[^<>]*>","gi"),"")});return a},removeTags:function(){var a=this;F(arguments.length>0?arguments:["\\S+"],function(b){b=r("<("+b+")[^<>]*(?:\\/>|>.*?<\\/\\1>)","gi");a=a.replace(b,"")});return a},truncate:function(a,b,c,d){var e="",g="",f=this.toString(),i="["+ra()+"]+",j="[^"+ra()+"]*",h=r(i+j+"$");d=K(d)?"...":t(d);if(f.length<=a)return f;switch(c){case "left":a=f.length-a;e=d;f=f.slice(a);
|
||
|
h=r("^"+j+i);break;case "middle":a=N(a/2);g=d+f.slice(f.length-a).trimLeft();f=f.slice(0,a);break;default:a=a;g=d;f=f.slice(0,a)}if(b===n&&this.slice(a,a+1).match(/\S/))f=f.remove(h);return e+f+g},pad:function(a,b){return pa(b,a)+this+pa(b,a)},padLeft:function(a,b){return pa(b,a)+this},padRight:function(a,b){return this+pa(b,a)},first:function(a){if(K(a))a=1;return this.substr(0,a)},last:function(a){if(K(a))a=1;return this.substr(this.length-a<0?0:this.length-a)},repeat:function(a){var b="",c=0;if(A(a)&&
|
||
|
a>0)for(;c<a;){b+=this;c++}return b},toNumber:function(a){var b=this.replace(/,/g,"");return b.match(/\./)?parseFloat(b):parseInt(b,a||10)},capitalize:function(a){var b;return this.toLowerCase().replace(a?/[\s\S]/g:/^\S/,function(c){var d=c.toUpperCase(),e;e=b?c:d;b=d!==c;return e})},assign:function(){var a={};F(arguments,function(b,c){if(L(b))ma(a,b);else a[c+1]=b});return this.replace(/\{([^{]+?)\}/g,function(b,c){return la(a,c)?a[c]:b})},namespace:function(a){a=a||ba;G(this.split("."),function(b,
|
||
|
c){return!!(a=a[c])});return a}});E(t,k,n,{insert:t.prototype.add});
|
||
|
(function(a){if(this.btoa){Eb=this.btoa;Fb=this.atob}else{var b=/[^A-Za-z0-9\+\/\=]/g;Eb=function(c){var d="",e,g,f,i,j,h,m=0;do{e=c.charCodeAt(m++);g=c.charCodeAt(m++);f=c.charCodeAt(m++);i=e>>2;e=(e&3)<<4|g>>4;j=(g&15)<<2|f>>6;h=f&63;if(isNaN(g))j=h=64;else if(isNaN(f))h=64;d=d+a.charAt(i)+a.charAt(e)+a.charAt(j)+a.charAt(h)}while(m<c.length);return d};Fb=function(c){var d="",e,g,f,i,j,h=0;if(c.match(b))throw Error("String contains invalid base64 characters");c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");
|
||
|
do{e=a.indexOf(c.charAt(h++));g=a.indexOf(c.charAt(h++));i=a.indexOf(c.charAt(h++));j=a.indexOf(c.charAt(h++));e=e<<2|g>>4;g=(g&15)<<4|i>>2;f=(i&3)<<6|j;d+=t.fromCharCode(e);if(i!=64)d+=t.fromCharCode(g);if(j!=64)d+=t.fromCharCode(f)}while(h<c.length);return d}}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");})();
|