moment_ago 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Guardfile +5 -0
- data/Rakefile +2 -0
- data/lib/moment_ago/version.rb +1 -1
- data/moment_ago.gemspec +3 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/moment_ago_spec.coffee +50 -0
- data/spec/javascripts/support/jasmine.yml +125 -0
- data/spec/javascripts/support/jasmine_helper.rb +15 -0
- data/spec/javascripts/support/jquery-2.1.1.min.js +4 -0
- data/spec/javascripts/support/moment.js +2610 -0
- data/spec/javascripts/support/timecop.js +245 -0
- data/spec/javascripts/support/underscore-1.6.0.min.js +6 -0
- metadata +50 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 245b7e7fe0b060178a5d649370f492b2055ad34c
|
4
|
+
data.tar.gz: 58441f1ba557357132b86e1baf3859a467d76779
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2113b38c9618c4473a31ab8d2814e164ea1dde634f87dfcb7e9115d148bb91a7415f593416551eda5d3e630bf89640efde062fd55df0caad653e93ce78da3db5
|
7
|
+
data.tar.gz: eb0aceb3d72d94c59a94de17f4d70f078b253762dd24479a61d32fc24f6c265d60917a73493438c290980bbc87223c9071fdbdf373228b63f004033f8df841ba
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
moment_ago
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.1
|
data/Guardfile
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
#guard automatically ignores some directories including vendor
|
2
|
+
ignore! /git/, /bundle/, /log/, /tmp/
|
3
|
+
|
4
|
+
guard 'coffeescript', :input => 'spec/javascripts', :output => 'spec/javascripts/tmp/'
|
5
|
+
guard 'coffeescript', :input => 'vendor/assets/javascripts', :output => 'tmp/vendor/assets/javascripts'
|
data/Rakefile
CHANGED
data/lib/moment_ago/version.rb
CHANGED
data/moment_ago.gemspec
CHANGED
@@ -20,6 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "jasmine"
|
24
|
+
spec.add_development_dependency "guard-coffeescript"
|
25
|
+
|
23
26
|
spec.add_dependency "coffee-rails"
|
24
27
|
spec.add_dependency "momentjs-rails"
|
25
28
|
end
|
File without changes
|
@@ -0,0 +1,50 @@
|
|
1
|
+
describe "MomentAgo", ->
|
2
|
+
beforeEach ->
|
3
|
+
Timecop.install()
|
4
|
+
|
5
|
+
afterEach ->
|
6
|
+
Timecop.returnToPresent()
|
7
|
+
Timecop.uninstall()
|
8
|
+
|
9
|
+
describe "As an extension", ->
|
10
|
+
|
11
|
+
describe "with a good date", ->
|
12
|
+
beforeEach ->
|
13
|
+
@time = '1403895335338'
|
14
|
+
@span = $("<span id='pizza' data-time=#{@time}>pizza</span>")
|
15
|
+
|
16
|
+
Timecop.freeze(new Date(2014, 6, 10, 14, 54));
|
17
|
+
$($('#jasmine_content')).append(@span);
|
18
|
+
|
19
|
+
it "returns 13 days ago", ->
|
20
|
+
expect(@span.text()).toEqual "pizza"
|
21
|
+
$(@span).moment_ago()
|
22
|
+
expect($(@span).text()).toEqual "13 days ago"
|
23
|
+
|
24
|
+
describe "with a blank date", ->
|
25
|
+
beforeEach ->
|
26
|
+
@span = $("<span id='pizza'>pizza</span>")
|
27
|
+
$($('#jasmine_content')).append(@span);
|
28
|
+
|
29
|
+
it "does nothing", ->
|
30
|
+
expect(@span.text()).toEqual "pizza"
|
31
|
+
$(@span).moment_ago()
|
32
|
+
expect($(@span).text()).toEqual "pizza"
|
33
|
+
|
34
|
+
describe "with a future date", ->
|
35
|
+
beforeEach ->
|
36
|
+
@time = '1403895335338000'
|
37
|
+
@span = $("<span id='pizza' data-time=#{@time}>pizza</span>")
|
38
|
+
Timecop.freeze(new Date(2014, 6, 10, 14, 54));
|
39
|
+
$($('#jasmine_content')).append(@span);
|
40
|
+
|
41
|
+
it "returns a few seconds ago", ->
|
42
|
+
expect(@span.text()).toEqual "pizza"
|
43
|
+
$(@span).moment_ago()
|
44
|
+
expect($(@span).text()).toEqual "a few seconds ago"
|
45
|
+
|
46
|
+
describe "As a function", ->
|
47
|
+
it "returns 13 days ago", ->
|
48
|
+
Timecop.freeze(new Date(2014, 6, 10, 14, 54));
|
49
|
+
time = '1403895335338'
|
50
|
+
expect($($.moment_ago(time)).text()).toEqual "13 days ago"
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- 'spec/javascripts/support/*.js'
|
15
|
+
- 'tmp/vendor/**/*.js'
|
16
|
+
|
17
|
+
# stylesheets
|
18
|
+
#
|
19
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
20
|
+
# Default: []
|
21
|
+
#
|
22
|
+
# EXAMPLE:
|
23
|
+
#
|
24
|
+
# stylesheets:
|
25
|
+
# - css/style.css
|
26
|
+
# - stylesheets/*.css
|
27
|
+
#
|
28
|
+
stylesheets:
|
29
|
+
- stylesheets/**/*.css
|
30
|
+
|
31
|
+
# helpers
|
32
|
+
#
|
33
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
34
|
+
# Default: ["helpers/**/*.js"]
|
35
|
+
#
|
36
|
+
# EXAMPLE:
|
37
|
+
#
|
38
|
+
# helpers:
|
39
|
+
# - helpers/**/*.js
|
40
|
+
#
|
41
|
+
helpers:
|
42
|
+
- 'helpers/**/*.js'
|
43
|
+
|
44
|
+
# spec_files
|
45
|
+
#
|
46
|
+
# Return an array of filepaths relative to spec_dir to include.
|
47
|
+
# Default: ["**/*[sS]pec.js"]
|
48
|
+
#
|
49
|
+
# EXAMPLE:
|
50
|
+
#
|
51
|
+
# spec_files:
|
52
|
+
# - **/*[sS]pec.js
|
53
|
+
#
|
54
|
+
spec_files:
|
55
|
+
- '**/*[sS]pec.js'
|
56
|
+
|
57
|
+
# src_dir
|
58
|
+
#
|
59
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
60
|
+
# Default: project root
|
61
|
+
#
|
62
|
+
# EXAMPLE:
|
63
|
+
#
|
64
|
+
# src_dir: public
|
65
|
+
#
|
66
|
+
src_dir:
|
67
|
+
|
68
|
+
# spec_dir
|
69
|
+
#
|
70
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
71
|
+
# Default: spec/javascripts
|
72
|
+
#
|
73
|
+
# EXAMPLE:
|
74
|
+
#
|
75
|
+
# spec_dir: spec/javascripts
|
76
|
+
#
|
77
|
+
spec_dir:
|
78
|
+
|
79
|
+
# spec_helper
|
80
|
+
#
|
81
|
+
# Ruby file that Jasmine server will require before starting.
|
82
|
+
# Returned relative to your root path
|
83
|
+
# Default spec/javascripts/support/jasmine_helper.rb
|
84
|
+
#
|
85
|
+
# EXAMPLE:
|
86
|
+
#
|
87
|
+
# spec_helper: spec/javascripts/support/jasmine_helper.rb
|
88
|
+
#
|
89
|
+
spec_helper: spec/javascripts/support/jasmine_helper.rb
|
90
|
+
|
91
|
+
# boot_dir
|
92
|
+
#
|
93
|
+
# Boot directory path. Your boot_files must be returned relative to this path.
|
94
|
+
# Default: Built in boot file
|
95
|
+
#
|
96
|
+
# EXAMPLE:
|
97
|
+
#
|
98
|
+
# boot_dir: spec/javascripts/support/boot
|
99
|
+
#
|
100
|
+
boot_dir:
|
101
|
+
|
102
|
+
# boot_files
|
103
|
+
#
|
104
|
+
# Return an array of filepaths relative to boot_dir to include in order to boot Jasmine
|
105
|
+
# Default: Built in boot file
|
106
|
+
#
|
107
|
+
# EXAMPLE
|
108
|
+
#
|
109
|
+
# boot_files:
|
110
|
+
# - '**/*.js'
|
111
|
+
#
|
112
|
+
boot_files:
|
113
|
+
|
114
|
+
# rack_options
|
115
|
+
#
|
116
|
+
# Extra options to be passed to the rack server
|
117
|
+
# by default, Port and AccessLog are passed.
|
118
|
+
#
|
119
|
+
# This is an advanced options, and left empty by default
|
120
|
+
#
|
121
|
+
# EXAMPLE
|
122
|
+
#
|
123
|
+
# rack_options:
|
124
|
+
# server: 'thin'
|
125
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#Use this file to set/override Jasmine configuration options
|
2
|
+
#You can remove it if you don't need it.
|
3
|
+
#This file is loaded *after* jasmine.yml is interpreted.
|
4
|
+
#
|
5
|
+
#Example: using a different boot file.
|
6
|
+
#Jasmine.configure do |config|
|
7
|
+
# config.boot_dir = '/absolute/path/to/boot_dir'
|
8
|
+
# config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
#Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
|
12
|
+
#Jasmine.configure do |config|
|
13
|
+
# config.prevent_phantomjs_auto_install = true
|
14
|
+
#end
|
15
|
+
#
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
|
2
|
+
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
|
3
|
+
},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
|
4
|
+
},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
|
@@ -0,0 +1,2610 @@
|
|
1
|
+
//! moment.js
|
2
|
+
//! version : 2.7.0
|
3
|
+
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
4
|
+
//! license : MIT
|
5
|
+
//! momentjs.com
|
6
|
+
|
7
|
+
(function (undefined) {
|
8
|
+
|
9
|
+
/************************************
|
10
|
+
Constants
|
11
|
+
************************************/
|
12
|
+
|
13
|
+
var moment,
|
14
|
+
VERSION = "2.7.0",
|
15
|
+
// the global-scope this is NOT the global object in Node.js
|
16
|
+
globalScope = typeof global !== 'undefined' ? global : this,
|
17
|
+
oldGlobalMoment,
|
18
|
+
round = Math.round,
|
19
|
+
i,
|
20
|
+
|
21
|
+
YEAR = 0,
|
22
|
+
MONTH = 1,
|
23
|
+
DATE = 2,
|
24
|
+
HOUR = 3,
|
25
|
+
MINUTE = 4,
|
26
|
+
SECOND = 5,
|
27
|
+
MILLISECOND = 6,
|
28
|
+
|
29
|
+
// internal storage for language config files
|
30
|
+
languages = {},
|
31
|
+
|
32
|
+
// moment internal properties
|
33
|
+
momentProperties = {
|
34
|
+
_isAMomentObject: null,
|
35
|
+
_i : null,
|
36
|
+
_f : null,
|
37
|
+
_l : null,
|
38
|
+
_strict : null,
|
39
|
+
_tzm : null,
|
40
|
+
_isUTC : null,
|
41
|
+
_offset : null, // optional. Combine with _isUTC
|
42
|
+
_pf : null,
|
43
|
+
_lang : null // optional
|
44
|
+
},
|
45
|
+
|
46
|
+
// check for nodeJS
|
47
|
+
hasModule = (typeof module !== 'undefined' && module.exports),
|
48
|
+
|
49
|
+
// ASP.NET json date format regex
|
50
|
+
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
|
51
|
+
aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
|
52
|
+
|
53
|
+
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
|
54
|
+
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
|
55
|
+
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
|
56
|
+
|
57
|
+
// format tokens
|
58
|
+
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
|
59
|
+
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
|
60
|
+
|
61
|
+
// parsing token regexes
|
62
|
+
parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
|
63
|
+
parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
|
64
|
+
parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
|
65
|
+
parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
|
66
|
+
parseTokenDigits = /\d+/, // nonzero number of digits
|
67
|
+
parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
|
68
|
+
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
|
69
|
+
parseTokenT = /T/i, // T (ISO separator)
|
70
|
+
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
|
71
|
+
parseTokenOrdinal = /\d{1,2}/,
|
72
|
+
|
73
|
+
//strict parsing regexes
|
74
|
+
parseTokenOneDigit = /\d/, // 0 - 9
|
75
|
+
parseTokenTwoDigits = /\d\d/, // 00 - 99
|
76
|
+
parseTokenThreeDigits = /\d{3}/, // 000 - 999
|
77
|
+
parseTokenFourDigits = /\d{4}/, // 0000 - 9999
|
78
|
+
parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
|
79
|
+
parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
|
80
|
+
|
81
|
+
// iso 8601 regex
|
82
|
+
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
|
83
|
+
isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
|
84
|
+
|
85
|
+
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
|
86
|
+
|
87
|
+
isoDates = [
|
88
|
+
['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
|
89
|
+
['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
|
90
|
+
['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
|
91
|
+
['GGGG-[W]WW', /\d{4}-W\d{2}/],
|
92
|
+
['YYYY-DDD', /\d{4}-\d{3}/]
|
93
|
+
],
|
94
|
+
|
95
|
+
// iso time formats and regexes
|
96
|
+
isoTimes = [
|
97
|
+
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
|
98
|
+
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
|
99
|
+
['HH:mm', /(T| )\d\d:\d\d/],
|
100
|
+
['HH', /(T| )\d\d/]
|
101
|
+
],
|
102
|
+
|
103
|
+
// timezone chunker "+10:00" > ["10", "00"] or "-1530" > ["-15", "30"]
|
104
|
+
parseTimezoneChunker = /([\+\-]|\d\d)/gi,
|
105
|
+
|
106
|
+
// getter and setter names
|
107
|
+
proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
|
108
|
+
unitMillisecondFactors = {
|
109
|
+
'Milliseconds' : 1,
|
110
|
+
'Seconds' : 1e3,
|
111
|
+
'Minutes' : 6e4,
|
112
|
+
'Hours' : 36e5,
|
113
|
+
'Days' : 864e5,
|
114
|
+
'Months' : 2592e6,
|
115
|
+
'Years' : 31536e6
|
116
|
+
},
|
117
|
+
|
118
|
+
unitAliases = {
|
119
|
+
ms : 'millisecond',
|
120
|
+
s : 'second',
|
121
|
+
m : 'minute',
|
122
|
+
h : 'hour',
|
123
|
+
d : 'day',
|
124
|
+
D : 'date',
|
125
|
+
w : 'week',
|
126
|
+
W : 'isoWeek',
|
127
|
+
M : 'month',
|
128
|
+
Q : 'quarter',
|
129
|
+
y : 'year',
|
130
|
+
DDD : 'dayOfYear',
|
131
|
+
e : 'weekday',
|
132
|
+
E : 'isoWeekday',
|
133
|
+
gg: 'weekYear',
|
134
|
+
GG: 'isoWeekYear'
|
135
|
+
},
|
136
|
+
|
137
|
+
camelFunctions = {
|
138
|
+
dayofyear : 'dayOfYear',
|
139
|
+
isoweekday : 'isoWeekday',
|
140
|
+
isoweek : 'isoWeek',
|
141
|
+
weekyear : 'weekYear',
|
142
|
+
isoweekyear : 'isoWeekYear'
|
143
|
+
},
|
144
|
+
|
145
|
+
// format function strings
|
146
|
+
formatFunctions = {},
|
147
|
+
|
148
|
+
// default relative time thresholds
|
149
|
+
relativeTimeThresholds = {
|
150
|
+
s: 45, //seconds to minutes
|
151
|
+
m: 45, //minutes to hours
|
152
|
+
h: 22, //hours to days
|
153
|
+
dd: 25, //days to month (month == 1)
|
154
|
+
dm: 45, //days to months (months > 1)
|
155
|
+
dy: 345 //days to year
|
156
|
+
},
|
157
|
+
|
158
|
+
// tokens to ordinalize and pad
|
159
|
+
ordinalizeTokens = 'DDD w W M D d'.split(' '),
|
160
|
+
paddedTokens = 'M D H h m s w W'.split(' '),
|
161
|
+
|
162
|
+
formatTokenFunctions = {
|
163
|
+
M : function () {
|
164
|
+
return this.month() + 1;
|
165
|
+
},
|
166
|
+
MMM : function (format) {
|
167
|
+
return this.lang().monthsShort(this, format);
|
168
|
+
},
|
169
|
+
MMMM : function (format) {
|
170
|
+
return this.lang().months(this, format);
|
171
|
+
},
|
172
|
+
D : function () {
|
173
|
+
return this.date();
|
174
|
+
},
|
175
|
+
DDD : function () {
|
176
|
+
return this.dayOfYear();
|
177
|
+
},
|
178
|
+
d : function () {
|
179
|
+
return this.day();
|
180
|
+
},
|
181
|
+
dd : function (format) {
|
182
|
+
return this.lang().weekdaysMin(this, format);
|
183
|
+
},
|
184
|
+
ddd : function (format) {
|
185
|
+
return this.lang().weekdaysShort(this, format);
|
186
|
+
},
|
187
|
+
dddd : function (format) {
|
188
|
+
return this.lang().weekdays(this, format);
|
189
|
+
},
|
190
|
+
w : function () {
|
191
|
+
return this.week();
|
192
|
+
},
|
193
|
+
W : function () {
|
194
|
+
return this.isoWeek();
|
195
|
+
},
|
196
|
+
YY : function () {
|
197
|
+
return leftZeroFill(this.year() % 100, 2);
|
198
|
+
},
|
199
|
+
YYYY : function () {
|
200
|
+
return leftZeroFill(this.year(), 4);
|
201
|
+
},
|
202
|
+
YYYYY : function () {
|
203
|
+
return leftZeroFill(this.year(), 5);
|
204
|
+
},
|
205
|
+
YYYYYY : function () {
|
206
|
+
var y = this.year(), sign = y >= 0 ? '+' : '-';
|
207
|
+
return sign + leftZeroFill(Math.abs(y), 6);
|
208
|
+
},
|
209
|
+
gg : function () {
|
210
|
+
return leftZeroFill(this.weekYear() % 100, 2);
|
211
|
+
},
|
212
|
+
gggg : function () {
|
213
|
+
return leftZeroFill(this.weekYear(), 4);
|
214
|
+
},
|
215
|
+
ggggg : function () {
|
216
|
+
return leftZeroFill(this.weekYear(), 5);
|
217
|
+
},
|
218
|
+
GG : function () {
|
219
|
+
return leftZeroFill(this.isoWeekYear() % 100, 2);
|
220
|
+
},
|
221
|
+
GGGG : function () {
|
222
|
+
return leftZeroFill(this.isoWeekYear(), 4);
|
223
|
+
},
|
224
|
+
GGGGG : function () {
|
225
|
+
return leftZeroFill(this.isoWeekYear(), 5);
|
226
|
+
},
|
227
|
+
e : function () {
|
228
|
+
return this.weekday();
|
229
|
+
},
|
230
|
+
E : function () {
|
231
|
+
return this.isoWeekday();
|
232
|
+
},
|
233
|
+
a : function () {
|
234
|
+
return this.lang().meridiem(this.hours(), this.minutes(), true);
|
235
|
+
},
|
236
|
+
A : function () {
|
237
|
+
return this.lang().meridiem(this.hours(), this.minutes(), false);
|
238
|
+
},
|
239
|
+
H : function () {
|
240
|
+
return this.hours();
|
241
|
+
},
|
242
|
+
h : function () {
|
243
|
+
return this.hours() % 12 || 12;
|
244
|
+
},
|
245
|
+
m : function () {
|
246
|
+
return this.minutes();
|
247
|
+
},
|
248
|
+
s : function () {
|
249
|
+
return this.seconds();
|
250
|
+
},
|
251
|
+
S : function () {
|
252
|
+
return toInt(this.milliseconds() / 100);
|
253
|
+
},
|
254
|
+
SS : function () {
|
255
|
+
return leftZeroFill(toInt(this.milliseconds() / 10), 2);
|
256
|
+
},
|
257
|
+
SSS : function () {
|
258
|
+
return leftZeroFill(this.milliseconds(), 3);
|
259
|
+
},
|
260
|
+
SSSS : function () {
|
261
|
+
return leftZeroFill(this.milliseconds(), 3);
|
262
|
+
},
|
263
|
+
Z : function () {
|
264
|
+
var a = -this.zone(),
|
265
|
+
b = "+";
|
266
|
+
if (a < 0) {
|
267
|
+
a = -a;
|
268
|
+
b = "-";
|
269
|
+
}
|
270
|
+
return b + leftZeroFill(toInt(a / 60), 2) + ":" + leftZeroFill(toInt(a) % 60, 2);
|
271
|
+
},
|
272
|
+
ZZ : function () {
|
273
|
+
var a = -this.zone(),
|
274
|
+
b = "+";
|
275
|
+
if (a < 0) {
|
276
|
+
a = -a;
|
277
|
+
b = "-";
|
278
|
+
}
|
279
|
+
return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
|
280
|
+
},
|
281
|
+
z : function () {
|
282
|
+
return this.zoneAbbr();
|
283
|
+
},
|
284
|
+
zz : function () {
|
285
|
+
return this.zoneName();
|
286
|
+
},
|
287
|
+
X : function () {
|
288
|
+
return this.unix();
|
289
|
+
},
|
290
|
+
Q : function () {
|
291
|
+
return this.quarter();
|
292
|
+
}
|
293
|
+
},
|
294
|
+
|
295
|
+
lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
|
296
|
+
|
297
|
+
// Pick the first defined of two or three arguments. dfl comes from
|
298
|
+
// default.
|
299
|
+
function dfl(a, b, c) {
|
300
|
+
switch (arguments.length) {
|
301
|
+
case 2: return a != null ? a : b;
|
302
|
+
case 3: return a != null ? a : b != null ? b : c;
|
303
|
+
default: throw new Error("Implement me");
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
function defaultParsingFlags() {
|
308
|
+
// We need to deep clone this object, and es5 standard is not very
|
309
|
+
// helpful.
|
310
|
+
return {
|
311
|
+
empty : false,
|
312
|
+
unusedTokens : [],
|
313
|
+
unusedInput : [],
|
314
|
+
overflow : -2,
|
315
|
+
charsLeftOver : 0,
|
316
|
+
nullInput : false,
|
317
|
+
invalidMonth : null,
|
318
|
+
invalidFormat : false,
|
319
|
+
userInvalidated : false,
|
320
|
+
iso: false
|
321
|
+
};
|
322
|
+
}
|
323
|
+
|
324
|
+
function deprecate(msg, fn) {
|
325
|
+
var firstTime = true;
|
326
|
+
function printMsg() {
|
327
|
+
if (moment.suppressDeprecationWarnings === false &&
|
328
|
+
typeof console !== 'undefined' && console.warn) {
|
329
|
+
console.warn("Deprecation warning: " + msg);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
return extend(function () {
|
333
|
+
if (firstTime) {
|
334
|
+
printMsg();
|
335
|
+
firstTime = false;
|
336
|
+
}
|
337
|
+
return fn.apply(this, arguments);
|
338
|
+
}, fn);
|
339
|
+
}
|
340
|
+
|
341
|
+
function padToken(func, count) {
|
342
|
+
return function (a) {
|
343
|
+
return leftZeroFill(func.call(this, a), count);
|
344
|
+
};
|
345
|
+
}
|
346
|
+
function ordinalizeToken(func, period) {
|
347
|
+
return function (a) {
|
348
|
+
return this.lang().ordinal(func.call(this, a), period);
|
349
|
+
};
|
350
|
+
}
|
351
|
+
|
352
|
+
while (ordinalizeTokens.length) {
|
353
|
+
i = ordinalizeTokens.pop();
|
354
|
+
formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
|
355
|
+
}
|
356
|
+
while (paddedTokens.length) {
|
357
|
+
i = paddedTokens.pop();
|
358
|
+
formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
|
359
|
+
}
|
360
|
+
formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
|
361
|
+
|
362
|
+
|
363
|
+
/************************************
|
364
|
+
Constructors
|
365
|
+
************************************/
|
366
|
+
|
367
|
+
function Language() {
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
// Moment prototype object
|
372
|
+
function Moment(config) {
|
373
|
+
checkOverflow(config);
|
374
|
+
extend(this, config);
|
375
|
+
}
|
376
|
+
|
377
|
+
// Duration Constructor
|
378
|
+
function Duration(duration) {
|
379
|
+
var normalizedInput = normalizeObjectUnits(duration),
|
380
|
+
years = normalizedInput.year || 0,
|
381
|
+
quarters = normalizedInput.quarter || 0,
|
382
|
+
months = normalizedInput.month || 0,
|
383
|
+
weeks = normalizedInput.week || 0,
|
384
|
+
days = normalizedInput.day || 0,
|
385
|
+
hours = normalizedInput.hour || 0,
|
386
|
+
minutes = normalizedInput.minute || 0,
|
387
|
+
seconds = normalizedInput.second || 0,
|
388
|
+
milliseconds = normalizedInput.millisecond || 0;
|
389
|
+
|
390
|
+
// representation for dateAddRemove
|
391
|
+
this._milliseconds = +milliseconds +
|
392
|
+
seconds * 1e3 + // 1000
|
393
|
+
minutes * 6e4 + // 1000 * 60
|
394
|
+
hours * 36e5; // 1000 * 60 * 60
|
395
|
+
// Because of dateAddRemove treats 24 hours as different from a
|
396
|
+
// day when working around DST, we need to store them separately
|
397
|
+
this._days = +days +
|
398
|
+
weeks * 7;
|
399
|
+
// It is impossible translate months into days without knowing
|
400
|
+
// which months you are are talking about, so we have to store
|
401
|
+
// it separately.
|
402
|
+
this._months = +months +
|
403
|
+
quarters * 3 +
|
404
|
+
years * 12;
|
405
|
+
|
406
|
+
this._data = {};
|
407
|
+
|
408
|
+
this._bubble();
|
409
|
+
}
|
410
|
+
|
411
|
+
/************************************
|
412
|
+
Helpers
|
413
|
+
************************************/
|
414
|
+
|
415
|
+
|
416
|
+
function extend(a, b) {
|
417
|
+
for (var i in b) {
|
418
|
+
if (b.hasOwnProperty(i)) {
|
419
|
+
a[i] = b[i];
|
420
|
+
}
|
421
|
+
}
|
422
|
+
|
423
|
+
if (b.hasOwnProperty("toString")) {
|
424
|
+
a.toString = b.toString;
|
425
|
+
}
|
426
|
+
|
427
|
+
if (b.hasOwnProperty("valueOf")) {
|
428
|
+
a.valueOf = b.valueOf;
|
429
|
+
}
|
430
|
+
|
431
|
+
return a;
|
432
|
+
}
|
433
|
+
|
434
|
+
function cloneMoment(m) {
|
435
|
+
var result = {}, i;
|
436
|
+
for (i in m) {
|
437
|
+
if (m.hasOwnProperty(i) && momentProperties.hasOwnProperty(i)) {
|
438
|
+
result[i] = m[i];
|
439
|
+
}
|
440
|
+
}
|
441
|
+
|
442
|
+
return result;
|
443
|
+
}
|
444
|
+
|
445
|
+
function absRound(number) {
|
446
|
+
if (number < 0) {
|
447
|
+
return Math.ceil(number);
|
448
|
+
} else {
|
449
|
+
return Math.floor(number);
|
450
|
+
}
|
451
|
+
}
|
452
|
+
|
453
|
+
// left zero fill a number
|
454
|
+
// see http://jsperf.com/left-zero-filling for performance comparison
|
455
|
+
function leftZeroFill(number, targetLength, forceSign) {
|
456
|
+
var output = '' + Math.abs(number),
|
457
|
+
sign = number >= 0;
|
458
|
+
|
459
|
+
while (output.length < targetLength) {
|
460
|
+
output = '0' + output;
|
461
|
+
}
|
462
|
+
return (sign ? (forceSign ? '+' : '') : '-') + output;
|
463
|
+
}
|
464
|
+
|
465
|
+
// helper function for _.addTime and _.subtractTime
|
466
|
+
function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
|
467
|
+
var milliseconds = duration._milliseconds,
|
468
|
+
days = duration._days,
|
469
|
+
months = duration._months;
|
470
|
+
updateOffset = updateOffset == null ? true : updateOffset;
|
471
|
+
|
472
|
+
if (milliseconds) {
|
473
|
+
mom._d.setTime(+mom._d + milliseconds * isAdding);
|
474
|
+
}
|
475
|
+
if (days) {
|
476
|
+
rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
|
477
|
+
}
|
478
|
+
if (months) {
|
479
|
+
rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
|
480
|
+
}
|
481
|
+
if (updateOffset) {
|
482
|
+
moment.updateOffset(mom, days || months);
|
483
|
+
}
|
484
|
+
}
|
485
|
+
|
486
|
+
// check if is an array
|
487
|
+
function isArray(input) {
|
488
|
+
return Object.prototype.toString.call(input) === '[object Array]';
|
489
|
+
}
|
490
|
+
|
491
|
+
function isDate(input) {
|
492
|
+
return Object.prototype.toString.call(input) === '[object Date]' ||
|
493
|
+
input instanceof Date;
|
494
|
+
}
|
495
|
+
|
496
|
+
// compare two arrays, return the number of differences
|
497
|
+
function compareArrays(array1, array2, dontConvert) {
|
498
|
+
var len = Math.min(array1.length, array2.length),
|
499
|
+
lengthDiff = Math.abs(array1.length - array2.length),
|
500
|
+
diffs = 0,
|
501
|
+
i;
|
502
|
+
for (i = 0; i < len; i++) {
|
503
|
+
if ((dontConvert && array1[i] !== array2[i]) ||
|
504
|
+
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
|
505
|
+
diffs++;
|
506
|
+
}
|
507
|
+
}
|
508
|
+
return diffs + lengthDiff;
|
509
|
+
}
|
510
|
+
|
511
|
+
function normalizeUnits(units) {
|
512
|
+
if (units) {
|
513
|
+
var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
|
514
|
+
units = unitAliases[units] || camelFunctions[lowered] || lowered;
|
515
|
+
}
|
516
|
+
return units;
|
517
|
+
}
|
518
|
+
|
519
|
+
function normalizeObjectUnits(inputObject) {
|
520
|
+
var normalizedInput = {},
|
521
|
+
normalizedProp,
|
522
|
+
prop;
|
523
|
+
|
524
|
+
for (prop in inputObject) {
|
525
|
+
if (inputObject.hasOwnProperty(prop)) {
|
526
|
+
normalizedProp = normalizeUnits(prop);
|
527
|
+
if (normalizedProp) {
|
528
|
+
normalizedInput[normalizedProp] = inputObject[prop];
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}
|
532
|
+
|
533
|
+
return normalizedInput;
|
534
|
+
}
|
535
|
+
|
536
|
+
function makeList(field) {
|
537
|
+
var count, setter;
|
538
|
+
|
539
|
+
if (field.indexOf('week') === 0) {
|
540
|
+
count = 7;
|
541
|
+
setter = 'day';
|
542
|
+
}
|
543
|
+
else if (field.indexOf('month') === 0) {
|
544
|
+
count = 12;
|
545
|
+
setter = 'month';
|
546
|
+
}
|
547
|
+
else {
|
548
|
+
return;
|
549
|
+
}
|
550
|
+
|
551
|
+
moment[field] = function (format, index) {
|
552
|
+
var i, getter,
|
553
|
+
method = moment.fn._lang[field],
|
554
|
+
results = [];
|
555
|
+
|
556
|
+
if (typeof format === 'number') {
|
557
|
+
index = format;
|
558
|
+
format = undefined;
|
559
|
+
}
|
560
|
+
|
561
|
+
getter = function (i) {
|
562
|
+
var m = moment().utc().set(setter, i);
|
563
|
+
return method.call(moment.fn._lang, m, format || '');
|
564
|
+
};
|
565
|
+
|
566
|
+
if (index != null) {
|
567
|
+
return getter(index);
|
568
|
+
}
|
569
|
+
else {
|
570
|
+
for (i = 0; i < count; i++) {
|
571
|
+
results.push(getter(i));
|
572
|
+
}
|
573
|
+
return results;
|
574
|
+
}
|
575
|
+
};
|
576
|
+
}
|
577
|
+
|
578
|
+
function toInt(argumentForCoercion) {
|
579
|
+
var coercedNumber = +argumentForCoercion,
|
580
|
+
value = 0;
|
581
|
+
|
582
|
+
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
583
|
+
if (coercedNumber >= 0) {
|
584
|
+
value = Math.floor(coercedNumber);
|
585
|
+
} else {
|
586
|
+
value = Math.ceil(coercedNumber);
|
587
|
+
}
|
588
|
+
}
|
589
|
+
|
590
|
+
return value;
|
591
|
+
}
|
592
|
+
|
593
|
+
function daysInMonth(year, month) {
|
594
|
+
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
595
|
+
}
|
596
|
+
|
597
|
+
function weeksInYear(year, dow, doy) {
|
598
|
+
return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
|
599
|
+
}
|
600
|
+
|
601
|
+
function daysInYear(year) {
|
602
|
+
return isLeapYear(year) ? 366 : 365;
|
603
|
+
}
|
604
|
+
|
605
|
+
function isLeapYear(year) {
|
606
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
607
|
+
}
|
608
|
+
|
609
|
+
function checkOverflow(m) {
|
610
|
+
var overflow;
|
611
|
+
if (m._a && m._pf.overflow === -2) {
|
612
|
+
overflow =
|
613
|
+
m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
|
614
|
+
m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
|
615
|
+
m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
|
616
|
+
m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
|
617
|
+
m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
|
618
|
+
m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
|
619
|
+
-1;
|
620
|
+
|
621
|
+
if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
622
|
+
overflow = DATE;
|
623
|
+
}
|
624
|
+
|
625
|
+
m._pf.overflow = overflow;
|
626
|
+
}
|
627
|
+
}
|
628
|
+
|
629
|
+
function isValid(m) {
|
630
|
+
if (m._isValid == null) {
|
631
|
+
m._isValid = !isNaN(m._d.getTime()) &&
|
632
|
+
m._pf.overflow < 0 &&
|
633
|
+
!m._pf.empty &&
|
634
|
+
!m._pf.invalidMonth &&
|
635
|
+
!m._pf.nullInput &&
|
636
|
+
!m._pf.invalidFormat &&
|
637
|
+
!m._pf.userInvalidated;
|
638
|
+
|
639
|
+
if (m._strict) {
|
640
|
+
m._isValid = m._isValid &&
|
641
|
+
m._pf.charsLeftOver === 0 &&
|
642
|
+
m._pf.unusedTokens.length === 0;
|
643
|
+
}
|
644
|
+
}
|
645
|
+
return m._isValid;
|
646
|
+
}
|
647
|
+
|
648
|
+
function normalizeLanguage(key) {
|
649
|
+
return key ? key.toLowerCase().replace('_', '-') : key;
|
650
|
+
}
|
651
|
+
|
652
|
+
// Return a moment from input, that is local/utc/zone equivalent to model.
|
653
|
+
function makeAs(input, model) {
|
654
|
+
return model._isUTC ? moment(input).zone(model._offset || 0) :
|
655
|
+
moment(input).local();
|
656
|
+
}
|
657
|
+
|
658
|
+
/************************************
|
659
|
+
Languages
|
660
|
+
************************************/
|
661
|
+
|
662
|
+
|
663
|
+
extend(Language.prototype, {
|
664
|
+
|
665
|
+
set : function (config) {
|
666
|
+
var prop, i;
|
667
|
+
for (i in config) {
|
668
|
+
prop = config[i];
|
669
|
+
if (typeof prop === 'function') {
|
670
|
+
this[i] = prop;
|
671
|
+
} else {
|
672
|
+
this['_' + i] = prop;
|
673
|
+
}
|
674
|
+
}
|
675
|
+
},
|
676
|
+
|
677
|
+
_months : "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
678
|
+
months : function (m) {
|
679
|
+
return this._months[m.month()];
|
680
|
+
},
|
681
|
+
|
682
|
+
_monthsShort : "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
|
683
|
+
monthsShort : function (m) {
|
684
|
+
return this._monthsShort[m.month()];
|
685
|
+
},
|
686
|
+
|
687
|
+
monthsParse : function (monthName) {
|
688
|
+
var i, mom, regex;
|
689
|
+
|
690
|
+
if (!this._monthsParse) {
|
691
|
+
this._monthsParse = [];
|
692
|
+
}
|
693
|
+
|
694
|
+
for (i = 0; i < 12; i++) {
|
695
|
+
// make the regex if we don't have it already
|
696
|
+
if (!this._monthsParse[i]) {
|
697
|
+
mom = moment.utc([2000, i]);
|
698
|
+
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
|
699
|
+
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
700
|
+
}
|
701
|
+
// test the regex
|
702
|
+
if (this._monthsParse[i].test(monthName)) {
|
703
|
+
return i;
|
704
|
+
}
|
705
|
+
}
|
706
|
+
},
|
707
|
+
|
708
|
+
_weekdays : "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
709
|
+
weekdays : function (m) {
|
710
|
+
return this._weekdays[m.day()];
|
711
|
+
},
|
712
|
+
|
713
|
+
_weekdaysShort : "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
|
714
|
+
weekdaysShort : function (m) {
|
715
|
+
return this._weekdaysShort[m.day()];
|
716
|
+
},
|
717
|
+
|
718
|
+
_weekdaysMin : "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
|
719
|
+
weekdaysMin : function (m) {
|
720
|
+
return this._weekdaysMin[m.day()];
|
721
|
+
},
|
722
|
+
|
723
|
+
weekdaysParse : function (weekdayName) {
|
724
|
+
var i, mom, regex;
|
725
|
+
|
726
|
+
if (!this._weekdaysParse) {
|
727
|
+
this._weekdaysParse = [];
|
728
|
+
}
|
729
|
+
|
730
|
+
for (i = 0; i < 7; i++) {
|
731
|
+
// make the regex if we don't have it already
|
732
|
+
if (!this._weekdaysParse[i]) {
|
733
|
+
mom = moment([2000, 1]).day(i);
|
734
|
+
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
735
|
+
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
736
|
+
}
|
737
|
+
// test the regex
|
738
|
+
if (this._weekdaysParse[i].test(weekdayName)) {
|
739
|
+
return i;
|
740
|
+
}
|
741
|
+
}
|
742
|
+
},
|
743
|
+
|
744
|
+
_longDateFormat : {
|
745
|
+
LT : "h:mm A",
|
746
|
+
L : "MM/DD/YYYY",
|
747
|
+
LL : "MMMM D YYYY",
|
748
|
+
LLL : "MMMM D YYYY LT",
|
749
|
+
LLLL : "dddd, MMMM D YYYY LT"
|
750
|
+
},
|
751
|
+
longDateFormat : function (key) {
|
752
|
+
var output = this._longDateFormat[key];
|
753
|
+
if (!output && this._longDateFormat[key.toUpperCase()]) {
|
754
|
+
output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
|
755
|
+
return val.slice(1);
|
756
|
+
});
|
757
|
+
this._longDateFormat[key] = output;
|
758
|
+
}
|
759
|
+
return output;
|
760
|
+
},
|
761
|
+
|
762
|
+
isPM : function (input) {
|
763
|
+
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
|
764
|
+
// Using charAt should be more compatible.
|
765
|
+
return ((input + '').toLowerCase().charAt(0) === 'p');
|
766
|
+
},
|
767
|
+
|
768
|
+
_meridiemParse : /[ap]\.?m?\.?/i,
|
769
|
+
meridiem : function (hours, minutes, isLower) {
|
770
|
+
if (hours > 11) {
|
771
|
+
return isLower ? 'pm' : 'PM';
|
772
|
+
} else {
|
773
|
+
return isLower ? 'am' : 'AM';
|
774
|
+
}
|
775
|
+
},
|
776
|
+
|
777
|
+
_calendar : {
|
778
|
+
sameDay : '[Today at] LT',
|
779
|
+
nextDay : '[Tomorrow at] LT',
|
780
|
+
nextWeek : 'dddd [at] LT',
|
781
|
+
lastDay : '[Yesterday at] LT',
|
782
|
+
lastWeek : '[Last] dddd [at] LT',
|
783
|
+
sameElse : 'L'
|
784
|
+
},
|
785
|
+
calendar : function (key, mom) {
|
786
|
+
var output = this._calendar[key];
|
787
|
+
return typeof output === 'function' ? output.apply(mom) : output;
|
788
|
+
},
|
789
|
+
|
790
|
+
_relativeTime : {
|
791
|
+
future : "in %s",
|
792
|
+
past : "%s ago",
|
793
|
+
s : "a few seconds",
|
794
|
+
m : "a minute",
|
795
|
+
mm : "%d minutes",
|
796
|
+
h : "an hour",
|
797
|
+
hh : "%d hours",
|
798
|
+
d : "a day",
|
799
|
+
dd : "%d days",
|
800
|
+
M : "a month",
|
801
|
+
MM : "%d months",
|
802
|
+
y : "a year",
|
803
|
+
yy : "%d years"
|
804
|
+
},
|
805
|
+
relativeTime : function (number, withoutSuffix, string, isFuture) {
|
806
|
+
var output = this._relativeTime[string];
|
807
|
+
return (typeof output === 'function') ?
|
808
|
+
output(number, withoutSuffix, string, isFuture) :
|
809
|
+
output.replace(/%d/i, number);
|
810
|
+
},
|
811
|
+
pastFuture : function (diff, output) {
|
812
|
+
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
|
813
|
+
return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
|
814
|
+
},
|
815
|
+
|
816
|
+
ordinal : function (number) {
|
817
|
+
return this._ordinal.replace("%d", number);
|
818
|
+
},
|
819
|
+
_ordinal : "%d",
|
820
|
+
|
821
|
+
preparse : function (string) {
|
822
|
+
return string;
|
823
|
+
},
|
824
|
+
|
825
|
+
postformat : function (string) {
|
826
|
+
return string;
|
827
|
+
},
|
828
|
+
|
829
|
+
week : function (mom) {
|
830
|
+
return weekOfYear(mom, this._week.dow, this._week.doy).week;
|
831
|
+
},
|
832
|
+
|
833
|
+
_week : {
|
834
|
+
dow : 0, // Sunday is the first day of the week.
|
835
|
+
doy : 6 // The week that contains Jan 1st is the first week of the year.
|
836
|
+
},
|
837
|
+
|
838
|
+
_invalidDate: 'Invalid date',
|
839
|
+
invalidDate: function () {
|
840
|
+
return this._invalidDate;
|
841
|
+
}
|
842
|
+
});
|
843
|
+
|
844
|
+
// Loads a language definition into the `languages` cache. The function
|
845
|
+
// takes a key and optionally values. If not in the browser and no values
|
846
|
+
// are provided, it will load the language file module. As a convenience,
|
847
|
+
// this function also returns the language values.
|
848
|
+
function loadLang(key, values) {
|
849
|
+
values.abbr = key;
|
850
|
+
if (!languages[key]) {
|
851
|
+
languages[key] = new Language();
|
852
|
+
}
|
853
|
+
languages[key].set(values);
|
854
|
+
return languages[key];
|
855
|
+
}
|
856
|
+
|
857
|
+
// Remove a language from the `languages` cache. Mostly useful in tests.
|
858
|
+
function unloadLang(key) {
|
859
|
+
delete languages[key];
|
860
|
+
}
|
861
|
+
|
862
|
+
// Determines which language definition to use and returns it.
|
863
|
+
//
|
864
|
+
// With no parameters, it will return the global language. If you
|
865
|
+
// pass in a language key, such as 'en', it will return the
|
866
|
+
// definition for 'en', so long as 'en' has already been loaded using
|
867
|
+
// moment.lang.
|
868
|
+
function getLangDefinition(key) {
|
869
|
+
var i = 0, j, lang, next, split,
|
870
|
+
get = function (k) {
|
871
|
+
if (!languages[k] && hasModule) {
|
872
|
+
try {
|
873
|
+
require('./lang/' + k);
|
874
|
+
} catch (e) { }
|
875
|
+
}
|
876
|
+
return languages[k];
|
877
|
+
};
|
878
|
+
|
879
|
+
if (!key) {
|
880
|
+
return moment.fn._lang;
|
881
|
+
}
|
882
|
+
|
883
|
+
if (!isArray(key)) {
|
884
|
+
//short-circuit everything else
|
885
|
+
lang = get(key);
|
886
|
+
if (lang) {
|
887
|
+
return lang;
|
888
|
+
}
|
889
|
+
key = [key];
|
890
|
+
}
|
891
|
+
|
892
|
+
//pick the language from the array
|
893
|
+
//try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
|
894
|
+
//substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
|
895
|
+
while (i < key.length) {
|
896
|
+
split = normalizeLanguage(key[i]).split('-');
|
897
|
+
j = split.length;
|
898
|
+
next = normalizeLanguage(key[i + 1]);
|
899
|
+
next = next ? next.split('-') : null;
|
900
|
+
while (j > 0) {
|
901
|
+
lang = get(split.slice(0, j).join('-'));
|
902
|
+
if (lang) {
|
903
|
+
return lang;
|
904
|
+
}
|
905
|
+
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
|
906
|
+
//the next array item is better than a shallower substring of this one
|
907
|
+
break;
|
908
|
+
}
|
909
|
+
j--;
|
910
|
+
}
|
911
|
+
i++;
|
912
|
+
}
|
913
|
+
return moment.fn._lang;
|
914
|
+
}
|
915
|
+
|
916
|
+
/************************************
|
917
|
+
Formatting
|
918
|
+
************************************/
|
919
|
+
|
920
|
+
|
921
|
+
function removeFormattingTokens(input) {
|
922
|
+
if (input.match(/\[[\s\S]/)) {
|
923
|
+
return input.replace(/^\[|\]$/g, "");
|
924
|
+
}
|
925
|
+
return input.replace(/\\/g, "");
|
926
|
+
}
|
927
|
+
|
928
|
+
function makeFormatFunction(format) {
|
929
|
+
var array = format.match(formattingTokens), i, length;
|
930
|
+
|
931
|
+
for (i = 0, length = array.length; i < length; i++) {
|
932
|
+
if (formatTokenFunctions[array[i]]) {
|
933
|
+
array[i] = formatTokenFunctions[array[i]];
|
934
|
+
} else {
|
935
|
+
array[i] = removeFormattingTokens(array[i]);
|
936
|
+
}
|
937
|
+
}
|
938
|
+
|
939
|
+
return function (mom) {
|
940
|
+
var output = "";
|
941
|
+
for (i = 0; i < length; i++) {
|
942
|
+
output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
|
943
|
+
}
|
944
|
+
return output;
|
945
|
+
};
|
946
|
+
}
|
947
|
+
|
948
|
+
// format date using native date object
|
949
|
+
function formatMoment(m, format) {
|
950
|
+
|
951
|
+
if (!m.isValid()) {
|
952
|
+
return m.lang().invalidDate();
|
953
|
+
}
|
954
|
+
|
955
|
+
format = expandFormat(format, m.lang());
|
956
|
+
|
957
|
+
if (!formatFunctions[format]) {
|
958
|
+
formatFunctions[format] = makeFormatFunction(format);
|
959
|
+
}
|
960
|
+
|
961
|
+
return formatFunctions[format](m);
|
962
|
+
}
|
963
|
+
|
964
|
+
function expandFormat(format, lang) {
|
965
|
+
var i = 5;
|
966
|
+
|
967
|
+
function replaceLongDateFormatTokens(input) {
|
968
|
+
return lang.longDateFormat(input) || input;
|
969
|
+
}
|
970
|
+
|
971
|
+
localFormattingTokens.lastIndex = 0;
|
972
|
+
while (i >= 0 && localFormattingTokens.test(format)) {
|
973
|
+
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
|
974
|
+
localFormattingTokens.lastIndex = 0;
|
975
|
+
i -= 1;
|
976
|
+
}
|
977
|
+
|
978
|
+
return format;
|
979
|
+
}
|
980
|
+
|
981
|
+
|
982
|
+
/************************************
|
983
|
+
Parsing
|
984
|
+
************************************/
|
985
|
+
|
986
|
+
|
987
|
+
// get the regex to find the next token
|
988
|
+
function getParseRegexForToken(token, config) {
|
989
|
+
var a, strict = config._strict;
|
990
|
+
switch (token) {
|
991
|
+
case 'Q':
|
992
|
+
return parseTokenOneDigit;
|
993
|
+
case 'DDDD':
|
994
|
+
return parseTokenThreeDigits;
|
995
|
+
case 'YYYY':
|
996
|
+
case 'GGGG':
|
997
|
+
case 'gggg':
|
998
|
+
return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
|
999
|
+
case 'Y':
|
1000
|
+
case 'G':
|
1001
|
+
case 'g':
|
1002
|
+
return parseTokenSignedNumber;
|
1003
|
+
case 'YYYYYY':
|
1004
|
+
case 'YYYYY':
|
1005
|
+
case 'GGGGG':
|
1006
|
+
case 'ggggg':
|
1007
|
+
return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
|
1008
|
+
case 'S':
|
1009
|
+
if (strict) { return parseTokenOneDigit; }
|
1010
|
+
/* falls through */
|
1011
|
+
case 'SS':
|
1012
|
+
if (strict) { return parseTokenTwoDigits; }
|
1013
|
+
/* falls through */
|
1014
|
+
case 'SSS':
|
1015
|
+
if (strict) { return parseTokenThreeDigits; }
|
1016
|
+
/* falls through */
|
1017
|
+
case 'DDD':
|
1018
|
+
return parseTokenOneToThreeDigits;
|
1019
|
+
case 'MMM':
|
1020
|
+
case 'MMMM':
|
1021
|
+
case 'dd':
|
1022
|
+
case 'ddd':
|
1023
|
+
case 'dddd':
|
1024
|
+
return parseTokenWord;
|
1025
|
+
case 'a':
|
1026
|
+
case 'A':
|
1027
|
+
return getLangDefinition(config._l)._meridiemParse;
|
1028
|
+
case 'X':
|
1029
|
+
return parseTokenTimestampMs;
|
1030
|
+
case 'Z':
|
1031
|
+
case 'ZZ':
|
1032
|
+
return parseTokenTimezone;
|
1033
|
+
case 'T':
|
1034
|
+
return parseTokenT;
|
1035
|
+
case 'SSSS':
|
1036
|
+
return parseTokenDigits;
|
1037
|
+
case 'MM':
|
1038
|
+
case 'DD':
|
1039
|
+
case 'YY':
|
1040
|
+
case 'GG':
|
1041
|
+
case 'gg':
|
1042
|
+
case 'HH':
|
1043
|
+
case 'hh':
|
1044
|
+
case 'mm':
|
1045
|
+
case 'ss':
|
1046
|
+
case 'ww':
|
1047
|
+
case 'WW':
|
1048
|
+
return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
|
1049
|
+
case 'M':
|
1050
|
+
case 'D':
|
1051
|
+
case 'd':
|
1052
|
+
case 'H':
|
1053
|
+
case 'h':
|
1054
|
+
case 'm':
|
1055
|
+
case 's':
|
1056
|
+
case 'w':
|
1057
|
+
case 'W':
|
1058
|
+
case 'e':
|
1059
|
+
case 'E':
|
1060
|
+
return parseTokenOneOrTwoDigits;
|
1061
|
+
case 'Do':
|
1062
|
+
return parseTokenOrdinal;
|
1063
|
+
default :
|
1064
|
+
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i"));
|
1065
|
+
return a;
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
function timezoneMinutesFromString(string) {
|
1070
|
+
string = string || "";
|
1071
|
+
var possibleTzMatches = (string.match(parseTokenTimezone) || []),
|
1072
|
+
tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
|
1073
|
+
parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
|
1074
|
+
minutes = +(parts[1] * 60) + toInt(parts[2]);
|
1075
|
+
|
1076
|
+
return parts[0] === '+' ? -minutes : minutes;
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
// function to convert string input to date
|
1080
|
+
function addTimeToArrayFromToken(token, input, config) {
|
1081
|
+
var a, datePartArray = config._a;
|
1082
|
+
|
1083
|
+
switch (token) {
|
1084
|
+
// QUARTER
|
1085
|
+
case 'Q':
|
1086
|
+
if (input != null) {
|
1087
|
+
datePartArray[MONTH] = (toInt(input) - 1) * 3;
|
1088
|
+
}
|
1089
|
+
break;
|
1090
|
+
// MONTH
|
1091
|
+
case 'M' : // fall through to MM
|
1092
|
+
case 'MM' :
|
1093
|
+
if (input != null) {
|
1094
|
+
datePartArray[MONTH] = toInt(input) - 1;
|
1095
|
+
}
|
1096
|
+
break;
|
1097
|
+
case 'MMM' : // fall through to MMMM
|
1098
|
+
case 'MMMM' :
|
1099
|
+
a = getLangDefinition(config._l).monthsParse(input);
|
1100
|
+
// if we didn't find a month name, mark the date as invalid.
|
1101
|
+
if (a != null) {
|
1102
|
+
datePartArray[MONTH] = a;
|
1103
|
+
} else {
|
1104
|
+
config._pf.invalidMonth = input;
|
1105
|
+
}
|
1106
|
+
break;
|
1107
|
+
// DAY OF MONTH
|
1108
|
+
case 'D' : // fall through to DD
|
1109
|
+
case 'DD' :
|
1110
|
+
if (input != null) {
|
1111
|
+
datePartArray[DATE] = toInt(input);
|
1112
|
+
}
|
1113
|
+
break;
|
1114
|
+
case 'Do' :
|
1115
|
+
if (input != null) {
|
1116
|
+
datePartArray[DATE] = toInt(parseInt(input, 10));
|
1117
|
+
}
|
1118
|
+
break;
|
1119
|
+
// DAY OF YEAR
|
1120
|
+
case 'DDD' : // fall through to DDDD
|
1121
|
+
case 'DDDD' :
|
1122
|
+
if (input != null) {
|
1123
|
+
config._dayOfYear = toInt(input);
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
break;
|
1127
|
+
// YEAR
|
1128
|
+
case 'YY' :
|
1129
|
+
datePartArray[YEAR] = moment.parseTwoDigitYear(input);
|
1130
|
+
break;
|
1131
|
+
case 'YYYY' :
|
1132
|
+
case 'YYYYY' :
|
1133
|
+
case 'YYYYYY' :
|
1134
|
+
datePartArray[YEAR] = toInt(input);
|
1135
|
+
break;
|
1136
|
+
// AM / PM
|
1137
|
+
case 'a' : // fall through to A
|
1138
|
+
case 'A' :
|
1139
|
+
config._isPm = getLangDefinition(config._l).isPM(input);
|
1140
|
+
break;
|
1141
|
+
// 24 HOUR
|
1142
|
+
case 'H' : // fall through to hh
|
1143
|
+
case 'HH' : // fall through to hh
|
1144
|
+
case 'h' : // fall through to hh
|
1145
|
+
case 'hh' :
|
1146
|
+
datePartArray[HOUR] = toInt(input);
|
1147
|
+
break;
|
1148
|
+
// MINUTE
|
1149
|
+
case 'm' : // fall through to mm
|
1150
|
+
case 'mm' :
|
1151
|
+
datePartArray[MINUTE] = toInt(input);
|
1152
|
+
break;
|
1153
|
+
// SECOND
|
1154
|
+
case 's' : // fall through to ss
|
1155
|
+
case 'ss' :
|
1156
|
+
datePartArray[SECOND] = toInt(input);
|
1157
|
+
break;
|
1158
|
+
// MILLISECOND
|
1159
|
+
case 'S' :
|
1160
|
+
case 'SS' :
|
1161
|
+
case 'SSS' :
|
1162
|
+
case 'SSSS' :
|
1163
|
+
datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
|
1164
|
+
break;
|
1165
|
+
// UNIX TIMESTAMP WITH MS
|
1166
|
+
case 'X':
|
1167
|
+
config._d = new Date(parseFloat(input) * 1000);
|
1168
|
+
break;
|
1169
|
+
// TIMEZONE
|
1170
|
+
case 'Z' : // fall through to ZZ
|
1171
|
+
case 'ZZ' :
|
1172
|
+
config._useUTC = true;
|
1173
|
+
config._tzm = timezoneMinutesFromString(input);
|
1174
|
+
break;
|
1175
|
+
// WEEKDAY - human
|
1176
|
+
case 'dd':
|
1177
|
+
case 'ddd':
|
1178
|
+
case 'dddd':
|
1179
|
+
a = getLangDefinition(config._l).weekdaysParse(input);
|
1180
|
+
// if we didn't get a weekday name, mark the date as invalid
|
1181
|
+
if (a != null) {
|
1182
|
+
config._w = config._w || {};
|
1183
|
+
config._w['d'] = a;
|
1184
|
+
} else {
|
1185
|
+
config._pf.invalidWeekday = input;
|
1186
|
+
}
|
1187
|
+
break;
|
1188
|
+
// WEEK, WEEK DAY - numeric
|
1189
|
+
case 'w':
|
1190
|
+
case 'ww':
|
1191
|
+
case 'W':
|
1192
|
+
case 'WW':
|
1193
|
+
case 'd':
|
1194
|
+
case 'e':
|
1195
|
+
case 'E':
|
1196
|
+
token = token.substr(0, 1);
|
1197
|
+
/* falls through */
|
1198
|
+
case 'gggg':
|
1199
|
+
case 'GGGG':
|
1200
|
+
case 'GGGGG':
|
1201
|
+
token = token.substr(0, 2);
|
1202
|
+
if (input) {
|
1203
|
+
config._w = config._w || {};
|
1204
|
+
config._w[token] = toInt(input);
|
1205
|
+
}
|
1206
|
+
break;
|
1207
|
+
case 'gg':
|
1208
|
+
case 'GG':
|
1209
|
+
config._w = config._w || {};
|
1210
|
+
config._w[token] = moment.parseTwoDigitYear(input);
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
function dayOfYearFromWeekInfo(config) {
|
1215
|
+
var w, weekYear, week, weekday, dow, doy, temp, lang;
|
1216
|
+
|
1217
|
+
w = config._w;
|
1218
|
+
if (w.GG != null || w.W != null || w.E != null) {
|
1219
|
+
dow = 1;
|
1220
|
+
doy = 4;
|
1221
|
+
|
1222
|
+
// TODO: We need to take the current isoWeekYear, but that depends on
|
1223
|
+
// how we interpret now (local, utc, fixed offset). So create
|
1224
|
+
// a now version of current config (take local/utc/offset flags, and
|
1225
|
+
// create now).
|
1226
|
+
weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year);
|
1227
|
+
week = dfl(w.W, 1);
|
1228
|
+
weekday = dfl(w.E, 1);
|
1229
|
+
} else {
|
1230
|
+
lang = getLangDefinition(config._l);
|
1231
|
+
dow = lang._week.dow;
|
1232
|
+
doy = lang._week.doy;
|
1233
|
+
|
1234
|
+
weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year);
|
1235
|
+
week = dfl(w.w, 1);
|
1236
|
+
|
1237
|
+
if (w.d != null) {
|
1238
|
+
// weekday -- low day numbers are considered next week
|
1239
|
+
weekday = w.d;
|
1240
|
+
if (weekday < dow) {
|
1241
|
+
++week;
|
1242
|
+
}
|
1243
|
+
} else if (w.e != null) {
|
1244
|
+
// local weekday -- counting starts from begining of week
|
1245
|
+
weekday = w.e + dow;
|
1246
|
+
} else {
|
1247
|
+
// default to begining of week
|
1248
|
+
weekday = dow;
|
1249
|
+
}
|
1250
|
+
}
|
1251
|
+
temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
|
1252
|
+
|
1253
|
+
config._a[YEAR] = temp.year;
|
1254
|
+
config._dayOfYear = temp.dayOfYear;
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
// convert an array to a date.
|
1258
|
+
// the array should mirror the parameters below
|
1259
|
+
// note: all values past the year are optional and will default to the lowest possible value.
|
1260
|
+
// [year, month, day , hour, minute, second, millisecond]
|
1261
|
+
function dateFromConfig(config) {
|
1262
|
+
var i, date, input = [], currentDate, yearToUse;
|
1263
|
+
|
1264
|
+
if (config._d) {
|
1265
|
+
return;
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
currentDate = currentDateArray(config);
|
1269
|
+
|
1270
|
+
//compute day of the year from weeks and weekdays
|
1271
|
+
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
1272
|
+
dayOfYearFromWeekInfo(config);
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
//if the day of the year is set, figure out what it is
|
1276
|
+
if (config._dayOfYear) {
|
1277
|
+
yearToUse = dfl(config._a[YEAR], currentDate[YEAR]);
|
1278
|
+
|
1279
|
+
if (config._dayOfYear > daysInYear(yearToUse)) {
|
1280
|
+
config._pf._overflowDayOfYear = true;
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
date = makeUTCDate(yearToUse, 0, config._dayOfYear);
|
1284
|
+
config._a[MONTH] = date.getUTCMonth();
|
1285
|
+
config._a[DATE] = date.getUTCDate();
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
// Default to current date.
|
1289
|
+
// * if no year, month, day of month are given, default to today
|
1290
|
+
// * if day of month is given, default month and year
|
1291
|
+
// * if month is given, default only year
|
1292
|
+
// * if year is given, don't default anything
|
1293
|
+
for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
1294
|
+
config._a[i] = input[i] = currentDate[i];
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
// Zero out whatever was not defaulted, including time
|
1298
|
+
for (; i < 7; i++) {
|
1299
|
+
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
|
1303
|
+
// Apply timezone offset from input. The actual zone can be changed
|
1304
|
+
// with parseZone.
|
1305
|
+
if (config._tzm != null) {
|
1306
|
+
config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
|
1307
|
+
}
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
function dateFromObject(config) {
|
1311
|
+
var normalizedInput;
|
1312
|
+
|
1313
|
+
if (config._d) {
|
1314
|
+
return;
|
1315
|
+
}
|
1316
|
+
|
1317
|
+
normalizedInput = normalizeObjectUnits(config._i);
|
1318
|
+
config._a = [
|
1319
|
+
normalizedInput.year,
|
1320
|
+
normalizedInput.month,
|
1321
|
+
normalizedInput.day,
|
1322
|
+
normalizedInput.hour,
|
1323
|
+
normalizedInput.minute,
|
1324
|
+
normalizedInput.second,
|
1325
|
+
normalizedInput.millisecond
|
1326
|
+
];
|
1327
|
+
|
1328
|
+
dateFromConfig(config);
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
function currentDateArray(config) {
|
1332
|
+
var now = new Date();
|
1333
|
+
if (config._useUTC) {
|
1334
|
+
return [
|
1335
|
+
now.getUTCFullYear(),
|
1336
|
+
now.getUTCMonth(),
|
1337
|
+
now.getUTCDate()
|
1338
|
+
];
|
1339
|
+
} else {
|
1340
|
+
return [now.getFullYear(), now.getMonth(), now.getDate()];
|
1341
|
+
}
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
// date from string and format string
|
1345
|
+
function makeDateFromStringAndFormat(config) {
|
1346
|
+
|
1347
|
+
if (config._f === moment.ISO_8601) {
|
1348
|
+
parseISO(config);
|
1349
|
+
return;
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
config._a = [];
|
1353
|
+
config._pf.empty = true;
|
1354
|
+
|
1355
|
+
// This array is used to make a Date, either with `new Date` or `Date.UTC`
|
1356
|
+
var lang = getLangDefinition(config._l),
|
1357
|
+
string = '' + config._i,
|
1358
|
+
i, parsedInput, tokens, token, skipped,
|
1359
|
+
stringLength = string.length,
|
1360
|
+
totalParsedInputLength = 0;
|
1361
|
+
|
1362
|
+
tokens = expandFormat(config._f, lang).match(formattingTokens) || [];
|
1363
|
+
|
1364
|
+
for (i = 0; i < tokens.length; i++) {
|
1365
|
+
token = tokens[i];
|
1366
|
+
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
|
1367
|
+
if (parsedInput) {
|
1368
|
+
skipped = string.substr(0, string.indexOf(parsedInput));
|
1369
|
+
if (skipped.length > 0) {
|
1370
|
+
config._pf.unusedInput.push(skipped);
|
1371
|
+
}
|
1372
|
+
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
1373
|
+
totalParsedInputLength += parsedInput.length;
|
1374
|
+
}
|
1375
|
+
// don't parse if it's not a known token
|
1376
|
+
if (formatTokenFunctions[token]) {
|
1377
|
+
if (parsedInput) {
|
1378
|
+
config._pf.empty = false;
|
1379
|
+
}
|
1380
|
+
else {
|
1381
|
+
config._pf.unusedTokens.push(token);
|
1382
|
+
}
|
1383
|
+
addTimeToArrayFromToken(token, parsedInput, config);
|
1384
|
+
}
|
1385
|
+
else if (config._strict && !parsedInput) {
|
1386
|
+
config._pf.unusedTokens.push(token);
|
1387
|
+
}
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
// add remaining unparsed input length to the string
|
1391
|
+
config._pf.charsLeftOver = stringLength - totalParsedInputLength;
|
1392
|
+
if (string.length > 0) {
|
1393
|
+
config._pf.unusedInput.push(string);
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
// handle am pm
|
1397
|
+
if (config._isPm && config._a[HOUR] < 12) {
|
1398
|
+
config._a[HOUR] += 12;
|
1399
|
+
}
|
1400
|
+
// if is 12 am, change hours to 0
|
1401
|
+
if (config._isPm === false && config._a[HOUR] === 12) {
|
1402
|
+
config._a[HOUR] = 0;
|
1403
|
+
}
|
1404
|
+
|
1405
|
+
dateFromConfig(config);
|
1406
|
+
checkOverflow(config);
|
1407
|
+
}
|
1408
|
+
|
1409
|
+
function unescapeFormat(s) {
|
1410
|
+
return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
|
1411
|
+
return p1 || p2 || p3 || p4;
|
1412
|
+
});
|
1413
|
+
}
|
1414
|
+
|
1415
|
+
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
|
1416
|
+
function regexpEscape(s) {
|
1417
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
// date from string and array of format strings
|
1421
|
+
function makeDateFromStringAndArray(config) {
|
1422
|
+
var tempConfig,
|
1423
|
+
bestMoment,
|
1424
|
+
|
1425
|
+
scoreToBeat,
|
1426
|
+
i,
|
1427
|
+
currentScore;
|
1428
|
+
|
1429
|
+
if (config._f.length === 0) {
|
1430
|
+
config._pf.invalidFormat = true;
|
1431
|
+
config._d = new Date(NaN);
|
1432
|
+
return;
|
1433
|
+
}
|
1434
|
+
|
1435
|
+
for (i = 0; i < config._f.length; i++) {
|
1436
|
+
currentScore = 0;
|
1437
|
+
tempConfig = extend({}, config);
|
1438
|
+
tempConfig._pf = defaultParsingFlags();
|
1439
|
+
tempConfig._f = config._f[i];
|
1440
|
+
makeDateFromStringAndFormat(tempConfig);
|
1441
|
+
|
1442
|
+
if (!isValid(tempConfig)) {
|
1443
|
+
continue;
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
// if there is any input that was not parsed add a penalty for that format
|
1447
|
+
currentScore += tempConfig._pf.charsLeftOver;
|
1448
|
+
|
1449
|
+
//or tokens
|
1450
|
+
currentScore += tempConfig._pf.unusedTokens.length * 10;
|
1451
|
+
|
1452
|
+
tempConfig._pf.score = currentScore;
|
1453
|
+
|
1454
|
+
if (scoreToBeat == null || currentScore < scoreToBeat) {
|
1455
|
+
scoreToBeat = currentScore;
|
1456
|
+
bestMoment = tempConfig;
|
1457
|
+
}
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
extend(config, bestMoment || tempConfig);
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
// date from iso format
|
1464
|
+
function parseISO(config) {
|
1465
|
+
var i, l,
|
1466
|
+
string = config._i,
|
1467
|
+
match = isoRegex.exec(string);
|
1468
|
+
|
1469
|
+
if (match) {
|
1470
|
+
config._pf.iso = true;
|
1471
|
+
for (i = 0, l = isoDates.length; i < l; i++) {
|
1472
|
+
if (isoDates[i][1].exec(string)) {
|
1473
|
+
// match[5] should be "T" or undefined
|
1474
|
+
config._f = isoDates[i][0] + (match[6] || " ");
|
1475
|
+
break;
|
1476
|
+
}
|
1477
|
+
}
|
1478
|
+
for (i = 0, l = isoTimes.length; i < l; i++) {
|
1479
|
+
if (isoTimes[i][1].exec(string)) {
|
1480
|
+
config._f += isoTimes[i][0];
|
1481
|
+
break;
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
if (string.match(parseTokenTimezone)) {
|
1485
|
+
config._f += "Z";
|
1486
|
+
}
|
1487
|
+
makeDateFromStringAndFormat(config);
|
1488
|
+
} else {
|
1489
|
+
config._isValid = false;
|
1490
|
+
}
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
// date from iso format or fallback
|
1494
|
+
function makeDateFromString(config) {
|
1495
|
+
parseISO(config);
|
1496
|
+
if (config._isValid === false) {
|
1497
|
+
delete config._isValid;
|
1498
|
+
moment.createFromInputFallback(config);
|
1499
|
+
}
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
function makeDateFromInput(config) {
|
1503
|
+
var input = config._i,
|
1504
|
+
matched = aspNetJsonRegex.exec(input);
|
1505
|
+
|
1506
|
+
if (input === undefined) {
|
1507
|
+
config._d = new Date();
|
1508
|
+
} else if (matched) {
|
1509
|
+
config._d = new Date(+matched[1]);
|
1510
|
+
} else if (typeof input === 'string') {
|
1511
|
+
makeDateFromString(config);
|
1512
|
+
} else if (isArray(input)) {
|
1513
|
+
config._a = input.slice(0);
|
1514
|
+
dateFromConfig(config);
|
1515
|
+
} else if (isDate(input)) {
|
1516
|
+
config._d = new Date(+input);
|
1517
|
+
} else if (typeof(input) === 'object') {
|
1518
|
+
dateFromObject(config);
|
1519
|
+
} else if (typeof(input) === 'number') {
|
1520
|
+
// from milliseconds
|
1521
|
+
config._d = new Date(input);
|
1522
|
+
} else {
|
1523
|
+
moment.createFromInputFallback(config);
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
function makeDate(y, m, d, h, M, s, ms) {
|
1528
|
+
//can't just apply() to create a date:
|
1529
|
+
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
|
1530
|
+
var date = new Date(y, m, d, h, M, s, ms);
|
1531
|
+
|
1532
|
+
//the date constructor doesn't accept years < 1970
|
1533
|
+
if (y < 1970) {
|
1534
|
+
date.setFullYear(y);
|
1535
|
+
}
|
1536
|
+
return date;
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
function makeUTCDate(y) {
|
1540
|
+
var date = new Date(Date.UTC.apply(null, arguments));
|
1541
|
+
if (y < 1970) {
|
1542
|
+
date.setUTCFullYear(y);
|
1543
|
+
}
|
1544
|
+
return date;
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
function parseWeekday(input, language) {
|
1548
|
+
if (typeof input === 'string') {
|
1549
|
+
if (!isNaN(input)) {
|
1550
|
+
input = parseInt(input, 10);
|
1551
|
+
}
|
1552
|
+
else {
|
1553
|
+
input = language.weekdaysParse(input);
|
1554
|
+
if (typeof input !== 'number') {
|
1555
|
+
return null;
|
1556
|
+
}
|
1557
|
+
}
|
1558
|
+
}
|
1559
|
+
return input;
|
1560
|
+
}
|
1561
|
+
|
1562
|
+
/************************************
|
1563
|
+
Relative Time
|
1564
|
+
************************************/
|
1565
|
+
|
1566
|
+
|
1567
|
+
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
|
1568
|
+
function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
|
1569
|
+
return lang.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
function relativeTime(milliseconds, withoutSuffix, lang) {
|
1573
|
+
var seconds = round(Math.abs(milliseconds) / 1000),
|
1574
|
+
minutes = round(seconds / 60),
|
1575
|
+
hours = round(minutes / 60),
|
1576
|
+
days = round(hours / 24),
|
1577
|
+
years = round(days / 365),
|
1578
|
+
args = seconds < relativeTimeThresholds.s && ['s', seconds] ||
|
1579
|
+
minutes === 1 && ['m'] ||
|
1580
|
+
minutes < relativeTimeThresholds.m && ['mm', minutes] ||
|
1581
|
+
hours === 1 && ['h'] ||
|
1582
|
+
hours < relativeTimeThresholds.h && ['hh', hours] ||
|
1583
|
+
days === 1 && ['d'] ||
|
1584
|
+
days <= relativeTimeThresholds.dd && ['dd', days] ||
|
1585
|
+
days <= relativeTimeThresholds.dm && ['M'] ||
|
1586
|
+
days < relativeTimeThresholds.dy && ['MM', round(days / 30)] ||
|
1587
|
+
years === 1 && ['y'] || ['yy', years];
|
1588
|
+
args[2] = withoutSuffix;
|
1589
|
+
args[3] = milliseconds > 0;
|
1590
|
+
args[4] = lang;
|
1591
|
+
return substituteTimeAgo.apply({}, args);
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
|
1595
|
+
/************************************
|
1596
|
+
Week of Year
|
1597
|
+
************************************/
|
1598
|
+
|
1599
|
+
|
1600
|
+
// firstDayOfWeek 0 = sun, 6 = sat
|
1601
|
+
// the day of the week that starts the week
|
1602
|
+
// (usually sunday or monday)
|
1603
|
+
// firstDayOfWeekOfYear 0 = sun, 6 = sat
|
1604
|
+
// the first week is the week that contains the first
|
1605
|
+
// of this day of the week
|
1606
|
+
// (eg. ISO weeks use thursday (4))
|
1607
|
+
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
|
1608
|
+
var end = firstDayOfWeekOfYear - firstDayOfWeek,
|
1609
|
+
daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
|
1610
|
+
adjustedMoment;
|
1611
|
+
|
1612
|
+
|
1613
|
+
if (daysToDayOfWeek > end) {
|
1614
|
+
daysToDayOfWeek -= 7;
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
if (daysToDayOfWeek < end - 7) {
|
1618
|
+
daysToDayOfWeek += 7;
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
adjustedMoment = moment(mom).add('d', daysToDayOfWeek);
|
1622
|
+
return {
|
1623
|
+
week: Math.ceil(adjustedMoment.dayOfYear() / 7),
|
1624
|
+
year: adjustedMoment.year()
|
1625
|
+
};
|
1626
|
+
}
|
1627
|
+
|
1628
|
+
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
|
1629
|
+
function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
|
1630
|
+
var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
|
1631
|
+
|
1632
|
+
d = d === 0 ? 7 : d;
|
1633
|
+
weekday = weekday != null ? weekday : firstDayOfWeek;
|
1634
|
+
daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
|
1635
|
+
dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
|
1636
|
+
|
1637
|
+
return {
|
1638
|
+
year: dayOfYear > 0 ? year : year - 1,
|
1639
|
+
dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
|
1640
|
+
};
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
/************************************
|
1644
|
+
Top Level Functions
|
1645
|
+
************************************/
|
1646
|
+
|
1647
|
+
function makeMoment(config) {
|
1648
|
+
var input = config._i,
|
1649
|
+
format = config._f;
|
1650
|
+
|
1651
|
+
if (input === null || (format === undefined && input === '')) {
|
1652
|
+
return moment.invalid({nullInput: true});
|
1653
|
+
}
|
1654
|
+
|
1655
|
+
if (typeof input === 'string') {
|
1656
|
+
config._i = input = getLangDefinition().preparse(input);
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
if (moment.isMoment(input)) {
|
1660
|
+
config = cloneMoment(input);
|
1661
|
+
|
1662
|
+
config._d = new Date(+input._d);
|
1663
|
+
} else if (format) {
|
1664
|
+
if (isArray(format)) {
|
1665
|
+
makeDateFromStringAndArray(config);
|
1666
|
+
} else {
|
1667
|
+
makeDateFromStringAndFormat(config);
|
1668
|
+
}
|
1669
|
+
} else {
|
1670
|
+
makeDateFromInput(config);
|
1671
|
+
}
|
1672
|
+
|
1673
|
+
return new Moment(config);
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
moment = function (input, format, lang, strict) {
|
1677
|
+
var c;
|
1678
|
+
|
1679
|
+
if (typeof(lang) === "boolean") {
|
1680
|
+
strict = lang;
|
1681
|
+
lang = undefined;
|
1682
|
+
}
|
1683
|
+
// object construction must be done this way.
|
1684
|
+
// https://github.com/moment/moment/issues/1423
|
1685
|
+
c = {};
|
1686
|
+
c._isAMomentObject = true;
|
1687
|
+
c._i = input;
|
1688
|
+
c._f = format;
|
1689
|
+
c._l = lang;
|
1690
|
+
c._strict = strict;
|
1691
|
+
c._isUTC = false;
|
1692
|
+
c._pf = defaultParsingFlags();
|
1693
|
+
|
1694
|
+
return makeMoment(c);
|
1695
|
+
};
|
1696
|
+
|
1697
|
+
moment.suppressDeprecationWarnings = false;
|
1698
|
+
|
1699
|
+
moment.createFromInputFallback = deprecate(
|
1700
|
+
"moment construction falls back to js Date. This is " +
|
1701
|
+
"discouraged and will be removed in upcoming major " +
|
1702
|
+
"release. Please refer to " +
|
1703
|
+
"https://github.com/moment/moment/issues/1407 for more info.",
|
1704
|
+
function (config) {
|
1705
|
+
config._d = new Date(config._i);
|
1706
|
+
});
|
1707
|
+
|
1708
|
+
// Pick a moment m from moments so that m[fn](other) is true for all
|
1709
|
+
// other. This relies on the function fn to be transitive.
|
1710
|
+
//
|
1711
|
+
// moments should either be an array of moment objects or an array, whose
|
1712
|
+
// first element is an array of moment objects.
|
1713
|
+
function pickBy(fn, moments) {
|
1714
|
+
var res, i;
|
1715
|
+
if (moments.length === 1 && isArray(moments[0])) {
|
1716
|
+
moments = moments[0];
|
1717
|
+
}
|
1718
|
+
if (!moments.length) {
|
1719
|
+
return moment();
|
1720
|
+
}
|
1721
|
+
res = moments[0];
|
1722
|
+
for (i = 1; i < moments.length; ++i) {
|
1723
|
+
if (moments[i][fn](res)) {
|
1724
|
+
res = moments[i];
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
return res;
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
moment.min = function () {
|
1731
|
+
var args = [].slice.call(arguments, 0);
|
1732
|
+
|
1733
|
+
return pickBy('isBefore', args);
|
1734
|
+
};
|
1735
|
+
|
1736
|
+
moment.max = function () {
|
1737
|
+
var args = [].slice.call(arguments, 0);
|
1738
|
+
|
1739
|
+
return pickBy('isAfter', args);
|
1740
|
+
};
|
1741
|
+
|
1742
|
+
// creating with utc
|
1743
|
+
moment.utc = function (input, format, lang, strict) {
|
1744
|
+
var c;
|
1745
|
+
|
1746
|
+
if (typeof(lang) === "boolean") {
|
1747
|
+
strict = lang;
|
1748
|
+
lang = undefined;
|
1749
|
+
}
|
1750
|
+
// object construction must be done this way.
|
1751
|
+
// https://github.com/moment/moment/issues/1423
|
1752
|
+
c = {};
|
1753
|
+
c._isAMomentObject = true;
|
1754
|
+
c._useUTC = true;
|
1755
|
+
c._isUTC = true;
|
1756
|
+
c._l = lang;
|
1757
|
+
c._i = input;
|
1758
|
+
c._f = format;
|
1759
|
+
c._strict = strict;
|
1760
|
+
c._pf = defaultParsingFlags();
|
1761
|
+
|
1762
|
+
return makeMoment(c).utc();
|
1763
|
+
};
|
1764
|
+
|
1765
|
+
// creating with unix timestamp (in seconds)
|
1766
|
+
moment.unix = function (input) {
|
1767
|
+
return moment(input * 1000);
|
1768
|
+
};
|
1769
|
+
|
1770
|
+
// duration
|
1771
|
+
moment.duration = function (input, key) {
|
1772
|
+
var duration = input,
|
1773
|
+
// matching against regexp is expensive, do it on demand
|
1774
|
+
match = null,
|
1775
|
+
sign,
|
1776
|
+
ret,
|
1777
|
+
parseIso;
|
1778
|
+
|
1779
|
+
if (moment.isDuration(input)) {
|
1780
|
+
duration = {
|
1781
|
+
ms: input._milliseconds,
|
1782
|
+
d: input._days,
|
1783
|
+
M: input._months
|
1784
|
+
};
|
1785
|
+
} else if (typeof input === 'number') {
|
1786
|
+
duration = {};
|
1787
|
+
if (key) {
|
1788
|
+
duration[key] = input;
|
1789
|
+
} else {
|
1790
|
+
duration.milliseconds = input;
|
1791
|
+
}
|
1792
|
+
} else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
|
1793
|
+
sign = (match[1] === "-") ? -1 : 1;
|
1794
|
+
duration = {
|
1795
|
+
y: 0,
|
1796
|
+
d: toInt(match[DATE]) * sign,
|
1797
|
+
h: toInt(match[HOUR]) * sign,
|
1798
|
+
m: toInt(match[MINUTE]) * sign,
|
1799
|
+
s: toInt(match[SECOND]) * sign,
|
1800
|
+
ms: toInt(match[MILLISECOND]) * sign
|
1801
|
+
};
|
1802
|
+
} else if (!!(match = isoDurationRegex.exec(input))) {
|
1803
|
+
sign = (match[1] === "-") ? -1 : 1;
|
1804
|
+
parseIso = function (inp) {
|
1805
|
+
// We'd normally use ~~inp for this, but unfortunately it also
|
1806
|
+
// converts floats to ints.
|
1807
|
+
// inp may be undefined, so careful calling replace on it.
|
1808
|
+
var res = inp && parseFloat(inp.replace(',', '.'));
|
1809
|
+
// apply sign while we're at it
|
1810
|
+
return (isNaN(res) ? 0 : res) * sign;
|
1811
|
+
};
|
1812
|
+
duration = {
|
1813
|
+
y: parseIso(match[2]),
|
1814
|
+
M: parseIso(match[3]),
|
1815
|
+
d: parseIso(match[4]),
|
1816
|
+
h: parseIso(match[5]),
|
1817
|
+
m: parseIso(match[6]),
|
1818
|
+
s: parseIso(match[7]),
|
1819
|
+
w: parseIso(match[8])
|
1820
|
+
};
|
1821
|
+
}
|
1822
|
+
|
1823
|
+
ret = new Duration(duration);
|
1824
|
+
|
1825
|
+
if (moment.isDuration(input) && input.hasOwnProperty('_lang')) {
|
1826
|
+
ret._lang = input._lang;
|
1827
|
+
}
|
1828
|
+
|
1829
|
+
return ret;
|
1830
|
+
};
|
1831
|
+
|
1832
|
+
// version number
|
1833
|
+
moment.version = VERSION;
|
1834
|
+
|
1835
|
+
// default format
|
1836
|
+
moment.defaultFormat = isoFormat;
|
1837
|
+
|
1838
|
+
// constant that refers to the ISO standard
|
1839
|
+
moment.ISO_8601 = function () {};
|
1840
|
+
|
1841
|
+
// Plugins that add properties should also add the key here (null value),
|
1842
|
+
// so we can properly clone ourselves.
|
1843
|
+
moment.momentProperties = momentProperties;
|
1844
|
+
|
1845
|
+
// This function will be called whenever a moment is mutated.
|
1846
|
+
// It is intended to keep the offset in sync with the timezone.
|
1847
|
+
moment.updateOffset = function () {};
|
1848
|
+
|
1849
|
+
// This function allows you to set a threshold for relative time strings
|
1850
|
+
moment.relativeTimeThreshold = function(threshold, limit) {
|
1851
|
+
if (relativeTimeThresholds[threshold] === undefined) {
|
1852
|
+
return false;
|
1853
|
+
}
|
1854
|
+
relativeTimeThresholds[threshold] = limit;
|
1855
|
+
return true;
|
1856
|
+
};
|
1857
|
+
|
1858
|
+
// This function will load languages and then set the global language. If
|
1859
|
+
// no arguments are passed in, it will simply return the current global
|
1860
|
+
// language key.
|
1861
|
+
moment.lang = function (key, values) {
|
1862
|
+
var r;
|
1863
|
+
if (!key) {
|
1864
|
+
return moment.fn._lang._abbr;
|
1865
|
+
}
|
1866
|
+
if (values) {
|
1867
|
+
loadLang(normalizeLanguage(key), values);
|
1868
|
+
} else if (values === null) {
|
1869
|
+
unloadLang(key);
|
1870
|
+
key = 'en';
|
1871
|
+
} else if (!languages[key]) {
|
1872
|
+
getLangDefinition(key);
|
1873
|
+
}
|
1874
|
+
r = moment.duration.fn._lang = moment.fn._lang = getLangDefinition(key);
|
1875
|
+
return r._abbr;
|
1876
|
+
};
|
1877
|
+
|
1878
|
+
// returns language data
|
1879
|
+
moment.langData = function (key) {
|
1880
|
+
if (key && key._lang && key._lang._abbr) {
|
1881
|
+
key = key._lang._abbr;
|
1882
|
+
}
|
1883
|
+
return getLangDefinition(key);
|
1884
|
+
};
|
1885
|
+
|
1886
|
+
// compare moment object
|
1887
|
+
moment.isMoment = function (obj) {
|
1888
|
+
return obj instanceof Moment ||
|
1889
|
+
(obj != null && obj.hasOwnProperty('_isAMomentObject'));
|
1890
|
+
};
|
1891
|
+
|
1892
|
+
// for typechecking Duration objects
|
1893
|
+
moment.isDuration = function (obj) {
|
1894
|
+
return obj instanceof Duration;
|
1895
|
+
};
|
1896
|
+
|
1897
|
+
for (i = lists.length - 1; i >= 0; --i) {
|
1898
|
+
makeList(lists[i]);
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
moment.normalizeUnits = function (units) {
|
1902
|
+
return normalizeUnits(units);
|
1903
|
+
};
|
1904
|
+
|
1905
|
+
moment.invalid = function (flags) {
|
1906
|
+
var m = moment.utc(NaN);
|
1907
|
+
if (flags != null) {
|
1908
|
+
extend(m._pf, flags);
|
1909
|
+
}
|
1910
|
+
else {
|
1911
|
+
m._pf.userInvalidated = true;
|
1912
|
+
}
|
1913
|
+
|
1914
|
+
return m;
|
1915
|
+
};
|
1916
|
+
|
1917
|
+
moment.parseZone = function () {
|
1918
|
+
return moment.apply(null, arguments).parseZone();
|
1919
|
+
};
|
1920
|
+
|
1921
|
+
moment.parseTwoDigitYear = function (input) {
|
1922
|
+
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
|
1923
|
+
};
|
1924
|
+
|
1925
|
+
/************************************
|
1926
|
+
Moment Prototype
|
1927
|
+
************************************/
|
1928
|
+
|
1929
|
+
|
1930
|
+
extend(moment.fn = Moment.prototype, {
|
1931
|
+
|
1932
|
+
clone : function () {
|
1933
|
+
return moment(this);
|
1934
|
+
},
|
1935
|
+
|
1936
|
+
valueOf : function () {
|
1937
|
+
return +this._d + ((this._offset || 0) * 60000);
|
1938
|
+
},
|
1939
|
+
|
1940
|
+
unix : function () {
|
1941
|
+
return Math.floor(+this / 1000);
|
1942
|
+
},
|
1943
|
+
|
1944
|
+
toString : function () {
|
1945
|
+
return this.clone().lang('en').format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
|
1946
|
+
},
|
1947
|
+
|
1948
|
+
toDate : function () {
|
1949
|
+
return this._offset ? new Date(+this) : this._d;
|
1950
|
+
},
|
1951
|
+
|
1952
|
+
toISOString : function () {
|
1953
|
+
var m = moment(this).utc();
|
1954
|
+
if (0 < m.year() && m.year() <= 9999) {
|
1955
|
+
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
1956
|
+
} else {
|
1957
|
+
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
1958
|
+
}
|
1959
|
+
},
|
1960
|
+
|
1961
|
+
toArray : function () {
|
1962
|
+
var m = this;
|
1963
|
+
return [
|
1964
|
+
m.year(),
|
1965
|
+
m.month(),
|
1966
|
+
m.date(),
|
1967
|
+
m.hours(),
|
1968
|
+
m.minutes(),
|
1969
|
+
m.seconds(),
|
1970
|
+
m.milliseconds()
|
1971
|
+
];
|
1972
|
+
},
|
1973
|
+
|
1974
|
+
isValid : function () {
|
1975
|
+
return isValid(this);
|
1976
|
+
},
|
1977
|
+
|
1978
|
+
isDSTShifted : function () {
|
1979
|
+
|
1980
|
+
if (this._a) {
|
1981
|
+
return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
|
1982
|
+
}
|
1983
|
+
|
1984
|
+
return false;
|
1985
|
+
},
|
1986
|
+
|
1987
|
+
parsingFlags : function () {
|
1988
|
+
return extend({}, this._pf);
|
1989
|
+
},
|
1990
|
+
|
1991
|
+
invalidAt: function () {
|
1992
|
+
return this._pf.overflow;
|
1993
|
+
},
|
1994
|
+
|
1995
|
+
utc : function () {
|
1996
|
+
return this.zone(0);
|
1997
|
+
},
|
1998
|
+
|
1999
|
+
local : function () {
|
2000
|
+
this.zone(0);
|
2001
|
+
this._isUTC = false;
|
2002
|
+
return this;
|
2003
|
+
},
|
2004
|
+
|
2005
|
+
format : function (inputString) {
|
2006
|
+
var output = formatMoment(this, inputString || moment.defaultFormat);
|
2007
|
+
return this.lang().postformat(output);
|
2008
|
+
},
|
2009
|
+
|
2010
|
+
add : function (input, val) {
|
2011
|
+
var dur;
|
2012
|
+
// switch args to support add('s', 1) and add(1, 's')
|
2013
|
+
if (typeof input === 'string' && typeof val === 'string') {
|
2014
|
+
dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input);
|
2015
|
+
} else if (typeof input === 'string') {
|
2016
|
+
dur = moment.duration(+val, input);
|
2017
|
+
} else {
|
2018
|
+
dur = moment.duration(input, val);
|
2019
|
+
}
|
2020
|
+
addOrSubtractDurationFromMoment(this, dur, 1);
|
2021
|
+
return this;
|
2022
|
+
},
|
2023
|
+
|
2024
|
+
subtract : function (input, val) {
|
2025
|
+
var dur;
|
2026
|
+
// switch args to support subtract('s', 1) and subtract(1, 's')
|
2027
|
+
if (typeof input === 'string' && typeof val === 'string') {
|
2028
|
+
dur = moment.duration(isNaN(+val) ? +input : +val, isNaN(+val) ? val : input);
|
2029
|
+
} else if (typeof input === 'string') {
|
2030
|
+
dur = moment.duration(+val, input);
|
2031
|
+
} else {
|
2032
|
+
dur = moment.duration(input, val);
|
2033
|
+
}
|
2034
|
+
addOrSubtractDurationFromMoment(this, dur, -1);
|
2035
|
+
return this;
|
2036
|
+
},
|
2037
|
+
|
2038
|
+
diff : function (input, units, asFloat) {
|
2039
|
+
var that = makeAs(input, this),
|
2040
|
+
zoneDiff = (this.zone() - that.zone()) * 6e4,
|
2041
|
+
diff, output;
|
2042
|
+
|
2043
|
+
units = normalizeUnits(units);
|
2044
|
+
|
2045
|
+
if (units === 'year' || units === 'month') {
|
2046
|
+
// average number of days in the months in the given dates
|
2047
|
+
diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
|
2048
|
+
// difference in months
|
2049
|
+
output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
|
2050
|
+
// adjust by taking difference in days, average number of days
|
2051
|
+
// and dst in the given months.
|
2052
|
+
output += ((this - moment(this).startOf('month')) -
|
2053
|
+
(that - moment(that).startOf('month'))) / diff;
|
2054
|
+
// same as above but with zones, to negate all dst
|
2055
|
+
output -= ((this.zone() - moment(this).startOf('month').zone()) -
|
2056
|
+
(that.zone() - moment(that).startOf('month').zone())) * 6e4 / diff;
|
2057
|
+
if (units === 'year') {
|
2058
|
+
output = output / 12;
|
2059
|
+
}
|
2060
|
+
} else {
|
2061
|
+
diff = (this - that);
|
2062
|
+
output = units === 'second' ? diff / 1e3 : // 1000
|
2063
|
+
units === 'minute' ? diff / 6e4 : // 1000 * 60
|
2064
|
+
units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
|
2065
|
+
units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
|
2066
|
+
units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
|
2067
|
+
diff;
|
2068
|
+
}
|
2069
|
+
return asFloat ? output : absRound(output);
|
2070
|
+
},
|
2071
|
+
|
2072
|
+
from : function (time, withoutSuffix) {
|
2073
|
+
return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix);
|
2074
|
+
},
|
2075
|
+
|
2076
|
+
fromNow : function (withoutSuffix) {
|
2077
|
+
return this.from(moment(), withoutSuffix);
|
2078
|
+
},
|
2079
|
+
|
2080
|
+
calendar : function (time) {
|
2081
|
+
// We want to compare the start of today, vs this.
|
2082
|
+
// Getting start-of-today depends on whether we're zone'd or not.
|
2083
|
+
var now = time || moment(),
|
2084
|
+
sod = makeAs(now, this).startOf('day'),
|
2085
|
+
diff = this.diff(sod, 'days', true),
|
2086
|
+
format = diff < -6 ? 'sameElse' :
|
2087
|
+
diff < -1 ? 'lastWeek' :
|
2088
|
+
diff < 0 ? 'lastDay' :
|
2089
|
+
diff < 1 ? 'sameDay' :
|
2090
|
+
diff < 2 ? 'nextDay' :
|
2091
|
+
diff < 7 ? 'nextWeek' : 'sameElse';
|
2092
|
+
return this.format(this.lang().calendar(format, this));
|
2093
|
+
},
|
2094
|
+
|
2095
|
+
isLeapYear : function () {
|
2096
|
+
return isLeapYear(this.year());
|
2097
|
+
},
|
2098
|
+
|
2099
|
+
isDST : function () {
|
2100
|
+
return (this.zone() < this.clone().month(0).zone() ||
|
2101
|
+
this.zone() < this.clone().month(5).zone());
|
2102
|
+
},
|
2103
|
+
|
2104
|
+
day : function (input) {
|
2105
|
+
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
|
2106
|
+
if (input != null) {
|
2107
|
+
input = parseWeekday(input, this.lang());
|
2108
|
+
return this.add({ d : input - day });
|
2109
|
+
} else {
|
2110
|
+
return day;
|
2111
|
+
}
|
2112
|
+
},
|
2113
|
+
|
2114
|
+
month : makeAccessor('Month', true),
|
2115
|
+
|
2116
|
+
startOf: function (units) {
|
2117
|
+
units = normalizeUnits(units);
|
2118
|
+
// the following switch intentionally omits break keywords
|
2119
|
+
// to utilize falling through the cases.
|
2120
|
+
switch (units) {
|
2121
|
+
case 'year':
|
2122
|
+
this.month(0);
|
2123
|
+
/* falls through */
|
2124
|
+
case 'quarter':
|
2125
|
+
case 'month':
|
2126
|
+
this.date(1);
|
2127
|
+
/* falls through */
|
2128
|
+
case 'week':
|
2129
|
+
case 'isoWeek':
|
2130
|
+
case 'day':
|
2131
|
+
this.hours(0);
|
2132
|
+
/* falls through */
|
2133
|
+
case 'hour':
|
2134
|
+
this.minutes(0);
|
2135
|
+
/* falls through */
|
2136
|
+
case 'minute':
|
2137
|
+
this.seconds(0);
|
2138
|
+
/* falls through */
|
2139
|
+
case 'second':
|
2140
|
+
this.milliseconds(0);
|
2141
|
+
/* falls through */
|
2142
|
+
}
|
2143
|
+
|
2144
|
+
// weeks are a special case
|
2145
|
+
if (units === 'week') {
|
2146
|
+
this.weekday(0);
|
2147
|
+
} else if (units === 'isoWeek') {
|
2148
|
+
this.isoWeekday(1);
|
2149
|
+
}
|
2150
|
+
|
2151
|
+
// quarters are also special
|
2152
|
+
if (units === 'quarter') {
|
2153
|
+
this.month(Math.floor(this.month() / 3) * 3);
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
return this;
|
2157
|
+
},
|
2158
|
+
|
2159
|
+
endOf: function (units) {
|
2160
|
+
units = normalizeUnits(units);
|
2161
|
+
return this.startOf(units).add((units === 'isoWeek' ? 'week' : units), 1).subtract('ms', 1);
|
2162
|
+
},
|
2163
|
+
|
2164
|
+
isAfter: function (input, units) {
|
2165
|
+
units = typeof units !== 'undefined' ? units : 'millisecond';
|
2166
|
+
return +this.clone().startOf(units) > +moment(input).startOf(units);
|
2167
|
+
},
|
2168
|
+
|
2169
|
+
isBefore: function (input, units) {
|
2170
|
+
units = typeof units !== 'undefined' ? units : 'millisecond';
|
2171
|
+
return +this.clone().startOf(units) < +moment(input).startOf(units);
|
2172
|
+
},
|
2173
|
+
|
2174
|
+
isSame: function (input, units) {
|
2175
|
+
units = units || 'ms';
|
2176
|
+
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
|
2177
|
+
},
|
2178
|
+
|
2179
|
+
min: deprecate(
|
2180
|
+
"moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",
|
2181
|
+
function (other) {
|
2182
|
+
other = moment.apply(null, arguments);
|
2183
|
+
return other < this ? this : other;
|
2184
|
+
}
|
2185
|
+
),
|
2186
|
+
|
2187
|
+
max: deprecate(
|
2188
|
+
"moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",
|
2189
|
+
function (other) {
|
2190
|
+
other = moment.apply(null, arguments);
|
2191
|
+
return other > this ? this : other;
|
2192
|
+
}
|
2193
|
+
),
|
2194
|
+
|
2195
|
+
// keepTime = true means only change the timezone, without affecting
|
2196
|
+
// the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200
|
2197
|
+
// It is possible that 5:31:26 doesn't exist int zone +0200, so we
|
2198
|
+
// adjust the time as needed, to be valid.
|
2199
|
+
//
|
2200
|
+
// Keeping the time actually adds/subtracts (one hour)
|
2201
|
+
// from the actual represented time. That is why we call updateOffset
|
2202
|
+
// a second time. In case it wants us to change the offset again
|
2203
|
+
// _changeInProgress == true case, then we have to adjust, because
|
2204
|
+
// there is no such time in the given timezone.
|
2205
|
+
zone : function (input, keepTime) {
|
2206
|
+
var offset = this._offset || 0;
|
2207
|
+
if (input != null) {
|
2208
|
+
if (typeof input === "string") {
|
2209
|
+
input = timezoneMinutesFromString(input);
|
2210
|
+
}
|
2211
|
+
if (Math.abs(input) < 16) {
|
2212
|
+
input = input * 60;
|
2213
|
+
}
|
2214
|
+
this._offset = input;
|
2215
|
+
this._isUTC = true;
|
2216
|
+
if (offset !== input) {
|
2217
|
+
if (!keepTime || this._changeInProgress) {
|
2218
|
+
addOrSubtractDurationFromMoment(this,
|
2219
|
+
moment.duration(offset - input, 'm'), 1, false);
|
2220
|
+
} else if (!this._changeInProgress) {
|
2221
|
+
this._changeInProgress = true;
|
2222
|
+
moment.updateOffset(this, true);
|
2223
|
+
this._changeInProgress = null;
|
2224
|
+
}
|
2225
|
+
}
|
2226
|
+
} else {
|
2227
|
+
return this._isUTC ? offset : this._d.getTimezoneOffset();
|
2228
|
+
}
|
2229
|
+
return this;
|
2230
|
+
},
|
2231
|
+
|
2232
|
+
zoneAbbr : function () {
|
2233
|
+
return this._isUTC ? "UTC" : "";
|
2234
|
+
},
|
2235
|
+
|
2236
|
+
zoneName : function () {
|
2237
|
+
return this._isUTC ? "Coordinated Universal Time" : "";
|
2238
|
+
},
|
2239
|
+
|
2240
|
+
parseZone : function () {
|
2241
|
+
if (this._tzm) {
|
2242
|
+
this.zone(this._tzm);
|
2243
|
+
} else if (typeof this._i === 'string') {
|
2244
|
+
this.zone(this._i);
|
2245
|
+
}
|
2246
|
+
return this;
|
2247
|
+
},
|
2248
|
+
|
2249
|
+
hasAlignedHourOffset : function (input) {
|
2250
|
+
if (!input) {
|
2251
|
+
input = 0;
|
2252
|
+
}
|
2253
|
+
else {
|
2254
|
+
input = moment(input).zone();
|
2255
|
+
}
|
2256
|
+
|
2257
|
+
return (this.zone() - input) % 60 === 0;
|
2258
|
+
},
|
2259
|
+
|
2260
|
+
daysInMonth : function () {
|
2261
|
+
return daysInMonth(this.year(), this.month());
|
2262
|
+
},
|
2263
|
+
|
2264
|
+
dayOfYear : function (input) {
|
2265
|
+
var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
|
2266
|
+
return input == null ? dayOfYear : this.add("d", (input - dayOfYear));
|
2267
|
+
},
|
2268
|
+
|
2269
|
+
quarter : function (input) {
|
2270
|
+
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
|
2271
|
+
},
|
2272
|
+
|
2273
|
+
weekYear : function (input) {
|
2274
|
+
var year = weekOfYear(this, this.lang()._week.dow, this.lang()._week.doy).year;
|
2275
|
+
return input == null ? year : this.add("y", (input - year));
|
2276
|
+
},
|
2277
|
+
|
2278
|
+
isoWeekYear : function (input) {
|
2279
|
+
var year = weekOfYear(this, 1, 4).year;
|
2280
|
+
return input == null ? year : this.add("y", (input - year));
|
2281
|
+
},
|
2282
|
+
|
2283
|
+
week : function (input) {
|
2284
|
+
var week = this.lang().week(this);
|
2285
|
+
return input == null ? week : this.add("d", (input - week) * 7);
|
2286
|
+
},
|
2287
|
+
|
2288
|
+
isoWeek : function (input) {
|
2289
|
+
var week = weekOfYear(this, 1, 4).week;
|
2290
|
+
return input == null ? week : this.add("d", (input - week) * 7);
|
2291
|
+
},
|
2292
|
+
|
2293
|
+
weekday : function (input) {
|
2294
|
+
var weekday = (this.day() + 7 - this.lang()._week.dow) % 7;
|
2295
|
+
return input == null ? weekday : this.add("d", input - weekday);
|
2296
|
+
},
|
2297
|
+
|
2298
|
+
isoWeekday : function (input) {
|
2299
|
+
// behaves the same as moment#day except
|
2300
|
+
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
|
2301
|
+
// as a setter, sunday should belong to the previous week.
|
2302
|
+
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
|
2303
|
+
},
|
2304
|
+
|
2305
|
+
isoWeeksInYear : function () {
|
2306
|
+
return weeksInYear(this.year(), 1, 4);
|
2307
|
+
},
|
2308
|
+
|
2309
|
+
weeksInYear : function () {
|
2310
|
+
var weekInfo = this._lang._week;
|
2311
|
+
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
|
2312
|
+
},
|
2313
|
+
|
2314
|
+
get : function (units) {
|
2315
|
+
units = normalizeUnits(units);
|
2316
|
+
return this[units]();
|
2317
|
+
},
|
2318
|
+
|
2319
|
+
set : function (units, value) {
|
2320
|
+
units = normalizeUnits(units);
|
2321
|
+
if (typeof this[units] === 'function') {
|
2322
|
+
this[units](value);
|
2323
|
+
}
|
2324
|
+
return this;
|
2325
|
+
},
|
2326
|
+
|
2327
|
+
// If passed a language key, it will set the language for this
|
2328
|
+
// instance. Otherwise, it will return the language configuration
|
2329
|
+
// variables for this instance.
|
2330
|
+
lang : function (key) {
|
2331
|
+
if (key === undefined) {
|
2332
|
+
return this._lang;
|
2333
|
+
} else {
|
2334
|
+
this._lang = getLangDefinition(key);
|
2335
|
+
return this;
|
2336
|
+
}
|
2337
|
+
}
|
2338
|
+
});
|
2339
|
+
|
2340
|
+
function rawMonthSetter(mom, value) {
|
2341
|
+
var dayOfMonth;
|
2342
|
+
|
2343
|
+
// TODO: Move this out of here!
|
2344
|
+
if (typeof value === 'string') {
|
2345
|
+
value = mom.lang().monthsParse(value);
|
2346
|
+
// TODO: Another silent failure?
|
2347
|
+
if (typeof value !== 'number') {
|
2348
|
+
return mom;
|
2349
|
+
}
|
2350
|
+
}
|
2351
|
+
|
2352
|
+
dayOfMonth = Math.min(mom.date(),
|
2353
|
+
daysInMonth(mom.year(), value));
|
2354
|
+
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
|
2355
|
+
return mom;
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
function rawGetter(mom, unit) {
|
2359
|
+
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
|
2360
|
+
}
|
2361
|
+
|
2362
|
+
function rawSetter(mom, unit, value) {
|
2363
|
+
if (unit === 'Month') {
|
2364
|
+
return rawMonthSetter(mom, value);
|
2365
|
+
} else {
|
2366
|
+
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
|
2367
|
+
}
|
2368
|
+
}
|
2369
|
+
|
2370
|
+
function makeAccessor(unit, keepTime) {
|
2371
|
+
return function (value) {
|
2372
|
+
if (value != null) {
|
2373
|
+
rawSetter(this, unit, value);
|
2374
|
+
moment.updateOffset(this, keepTime);
|
2375
|
+
return this;
|
2376
|
+
} else {
|
2377
|
+
return rawGetter(this, unit);
|
2378
|
+
}
|
2379
|
+
};
|
2380
|
+
}
|
2381
|
+
|
2382
|
+
moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
|
2383
|
+
moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
|
2384
|
+
moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
|
2385
|
+
// Setting the hour should keep the time, because the user explicitly
|
2386
|
+
// specified which hour he wants. So trying to maintain the same hour (in
|
2387
|
+
// a new timezone) makes sense. Adding/subtracting hours does not follow
|
2388
|
+
// this rule.
|
2389
|
+
moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
|
2390
|
+
// moment.fn.month is defined separately
|
2391
|
+
moment.fn.date = makeAccessor('Date', true);
|
2392
|
+
moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true));
|
2393
|
+
moment.fn.year = makeAccessor('FullYear', true);
|
2394
|
+
moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true));
|
2395
|
+
|
2396
|
+
// add plural methods
|
2397
|
+
moment.fn.days = moment.fn.day;
|
2398
|
+
moment.fn.months = moment.fn.month;
|
2399
|
+
moment.fn.weeks = moment.fn.week;
|
2400
|
+
moment.fn.isoWeeks = moment.fn.isoWeek;
|
2401
|
+
moment.fn.quarters = moment.fn.quarter;
|
2402
|
+
|
2403
|
+
// add aliased format methods
|
2404
|
+
moment.fn.toJSON = moment.fn.toISOString;
|
2405
|
+
|
2406
|
+
/************************************
|
2407
|
+
Duration Prototype
|
2408
|
+
************************************/
|
2409
|
+
|
2410
|
+
|
2411
|
+
extend(moment.duration.fn = Duration.prototype, {
|
2412
|
+
|
2413
|
+
_bubble : function () {
|
2414
|
+
var milliseconds = this._milliseconds,
|
2415
|
+
days = this._days,
|
2416
|
+
months = this._months,
|
2417
|
+
data = this._data,
|
2418
|
+
seconds, minutes, hours, years;
|
2419
|
+
|
2420
|
+
// The following code bubbles up values, see the tests for
|
2421
|
+
// examples of what that means.
|
2422
|
+
data.milliseconds = milliseconds % 1000;
|
2423
|
+
|
2424
|
+
seconds = absRound(milliseconds / 1000);
|
2425
|
+
data.seconds = seconds % 60;
|
2426
|
+
|
2427
|
+
minutes = absRound(seconds / 60);
|
2428
|
+
data.minutes = minutes % 60;
|
2429
|
+
|
2430
|
+
hours = absRound(minutes / 60);
|
2431
|
+
data.hours = hours % 24;
|
2432
|
+
|
2433
|
+
days += absRound(hours / 24);
|
2434
|
+
data.days = days % 30;
|
2435
|
+
|
2436
|
+
months += absRound(days / 30);
|
2437
|
+
data.months = months % 12;
|
2438
|
+
|
2439
|
+
years = absRound(months / 12);
|
2440
|
+
data.years = years;
|
2441
|
+
},
|
2442
|
+
|
2443
|
+
weeks : function () {
|
2444
|
+
return absRound(this.days() / 7);
|
2445
|
+
},
|
2446
|
+
|
2447
|
+
valueOf : function () {
|
2448
|
+
return this._milliseconds +
|
2449
|
+
this._days * 864e5 +
|
2450
|
+
(this._months % 12) * 2592e6 +
|
2451
|
+
toInt(this._months / 12) * 31536e6;
|
2452
|
+
},
|
2453
|
+
|
2454
|
+
humanize : function (withSuffix) {
|
2455
|
+
var difference = +this,
|
2456
|
+
output = relativeTime(difference, !withSuffix, this.lang());
|
2457
|
+
|
2458
|
+
if (withSuffix) {
|
2459
|
+
output = this.lang().pastFuture(difference, output);
|
2460
|
+
}
|
2461
|
+
|
2462
|
+
return this.lang().postformat(output);
|
2463
|
+
},
|
2464
|
+
|
2465
|
+
add : function (input, val) {
|
2466
|
+
// supports only 2.0-style add(1, 's') or add(moment)
|
2467
|
+
var dur = moment.duration(input, val);
|
2468
|
+
|
2469
|
+
this._milliseconds += dur._milliseconds;
|
2470
|
+
this._days += dur._days;
|
2471
|
+
this._months += dur._months;
|
2472
|
+
|
2473
|
+
this._bubble();
|
2474
|
+
|
2475
|
+
return this;
|
2476
|
+
},
|
2477
|
+
|
2478
|
+
subtract : function (input, val) {
|
2479
|
+
var dur = moment.duration(input, val);
|
2480
|
+
|
2481
|
+
this._milliseconds -= dur._milliseconds;
|
2482
|
+
this._days -= dur._days;
|
2483
|
+
this._months -= dur._months;
|
2484
|
+
|
2485
|
+
this._bubble();
|
2486
|
+
|
2487
|
+
return this;
|
2488
|
+
},
|
2489
|
+
|
2490
|
+
get : function (units) {
|
2491
|
+
units = normalizeUnits(units);
|
2492
|
+
return this[units.toLowerCase() + 's']();
|
2493
|
+
},
|
2494
|
+
|
2495
|
+
as : function (units) {
|
2496
|
+
units = normalizeUnits(units);
|
2497
|
+
return this['as' + units.charAt(0).toUpperCase() + units.slice(1) + 's']();
|
2498
|
+
},
|
2499
|
+
|
2500
|
+
lang : moment.fn.lang,
|
2501
|
+
|
2502
|
+
toIsoString : function () {
|
2503
|
+
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
|
2504
|
+
var years = Math.abs(this.years()),
|
2505
|
+
months = Math.abs(this.months()),
|
2506
|
+
days = Math.abs(this.days()),
|
2507
|
+
hours = Math.abs(this.hours()),
|
2508
|
+
minutes = Math.abs(this.minutes()),
|
2509
|
+
seconds = Math.abs(this.seconds() + this.milliseconds() / 1000);
|
2510
|
+
|
2511
|
+
if (!this.asSeconds()) {
|
2512
|
+
// this is the same as C#'s (Noda) and python (isodate)...
|
2513
|
+
// but not other JS (goog.date)
|
2514
|
+
return 'P0D';
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
return (this.asSeconds() < 0 ? '-' : '') +
|
2518
|
+
'P' +
|
2519
|
+
(years ? years + 'Y' : '') +
|
2520
|
+
(months ? months + 'M' : '') +
|
2521
|
+
(days ? days + 'D' : '') +
|
2522
|
+
((hours || minutes || seconds) ? 'T' : '') +
|
2523
|
+
(hours ? hours + 'H' : '') +
|
2524
|
+
(minutes ? minutes + 'M' : '') +
|
2525
|
+
(seconds ? seconds + 'S' : '');
|
2526
|
+
}
|
2527
|
+
});
|
2528
|
+
|
2529
|
+
function makeDurationGetter(name) {
|
2530
|
+
moment.duration.fn[name] = function () {
|
2531
|
+
return this._data[name];
|
2532
|
+
};
|
2533
|
+
}
|
2534
|
+
|
2535
|
+
function makeDurationAsGetter(name, factor) {
|
2536
|
+
moment.duration.fn['as' + name] = function () {
|
2537
|
+
return +this / factor;
|
2538
|
+
};
|
2539
|
+
}
|
2540
|
+
|
2541
|
+
for (i in unitMillisecondFactors) {
|
2542
|
+
if (unitMillisecondFactors.hasOwnProperty(i)) {
|
2543
|
+
makeDurationAsGetter(i, unitMillisecondFactors[i]);
|
2544
|
+
makeDurationGetter(i.toLowerCase());
|
2545
|
+
}
|
2546
|
+
}
|
2547
|
+
|
2548
|
+
makeDurationAsGetter('Weeks', 6048e5);
|
2549
|
+
moment.duration.fn.asMonths = function () {
|
2550
|
+
return (+this - this.years() * 31536e6) / 2592e6 + this.years() * 12;
|
2551
|
+
};
|
2552
|
+
|
2553
|
+
|
2554
|
+
/************************************
|
2555
|
+
Default Lang
|
2556
|
+
************************************/
|
2557
|
+
|
2558
|
+
|
2559
|
+
// Set default language, other languages will inherit from English.
|
2560
|
+
moment.lang('en', {
|
2561
|
+
ordinal : function (number) {
|
2562
|
+
var b = number % 10,
|
2563
|
+
output = (toInt(number % 100 / 10) === 1) ? 'th' :
|
2564
|
+
(b === 1) ? 'st' :
|
2565
|
+
(b === 2) ? 'nd' :
|
2566
|
+
(b === 3) ? 'rd' : 'th';
|
2567
|
+
return number + output;
|
2568
|
+
}
|
2569
|
+
});
|
2570
|
+
|
2571
|
+
/* EMBED_LANGUAGES */
|
2572
|
+
|
2573
|
+
/************************************
|
2574
|
+
Exposing Moment
|
2575
|
+
************************************/
|
2576
|
+
|
2577
|
+
function makeGlobal(shouldDeprecate) {
|
2578
|
+
/*global ender:false */
|
2579
|
+
if (typeof ender !== 'undefined') {
|
2580
|
+
return;
|
2581
|
+
}
|
2582
|
+
oldGlobalMoment = globalScope.moment;
|
2583
|
+
if (shouldDeprecate) {
|
2584
|
+
globalScope.moment = deprecate(
|
2585
|
+
"Accessing Moment through the global scope is " +
|
2586
|
+
"deprecated, and will be removed in an upcoming " +
|
2587
|
+
"release.",
|
2588
|
+
moment);
|
2589
|
+
} else {
|
2590
|
+
globalScope.moment = moment;
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
|
2594
|
+
// CommonJS module is defined
|
2595
|
+
if (hasModule) {
|
2596
|
+
module.exports = moment;
|
2597
|
+
} else if (typeof define === "function" && define.amd) {
|
2598
|
+
define("moment", function (require, exports, module) {
|
2599
|
+
if (module.config && module.config() && module.config().noGlobal === true) {
|
2600
|
+
// release the global variable
|
2601
|
+
globalScope.moment = oldGlobalMoment;
|
2602
|
+
}
|
2603
|
+
|
2604
|
+
return moment;
|
2605
|
+
});
|
2606
|
+
makeGlobal(true);
|
2607
|
+
} else {
|
2608
|
+
makeGlobal();
|
2609
|
+
}
|
2610
|
+
}).call(this);
|