tolaria 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +66 -0
  3. data/.yardopts +4 -0
  4. data/CNAME +1 -0
  5. data/CONTRIBUTING.md +32 -0
  6. data/Gemfile +2 -0
  7. data/LICENSE.md +9 -0
  8. data/README.md +538 -0
  9. data/Rakefile +52 -0
  10. data/app/assets/fonts/admin/fontawesome.eot +0 -0
  11. data/app/assets/fonts/admin/fontawesome.svg +565 -0
  12. data/app/assets/fonts/admin/fontawesome.ttf +0 -0
  13. data/app/assets/fonts/admin/fontawesome.woff +0 -0
  14. data/app/assets/fonts/admin/fontawesome.woff2 +0 -0
  15. data/app/assets/images/admin/columbia_banner.png +0 -0
  16. data/app/assets/images/admin/favicon.ico +0 -0
  17. data/app/assets/images/admin/noise.png +0 -0
  18. data/app/assets/images/admin/select_arrows.svg +1 -0
  19. data/app/assets/javascripts/admin/admin.js +4 -0
  20. data/app/assets/javascripts/admin/base.js +12 -0
  21. data/app/assets/javascripts/admin/lib/backbone.js +1888 -0
  22. data/app/assets/javascripts/admin/lib/jquery.chosen.js +1272 -0
  23. data/app/assets/javascripts/admin/lib/jquery.js +10361 -0
  24. data/app/assets/javascripts/admin/lib/jquery.selection.js +352 -0
  25. data/app/assets/javascripts/admin/lib/moment.js +3103 -0
  26. data/app/assets/javascripts/admin/lib/no.js +6 -0
  27. data/app/assets/javascripts/admin/lib/underscore.js +1570 -0
  28. data/app/assets/javascripts/admin/models/composer_buttons.js +45 -0
  29. data/app/assets/javascripts/admin/models/rails_meta.js +4 -0
  30. data/app/assets/javascripts/admin/views/field_with_errors.js +19 -0
  31. data/app/assets/javascripts/admin/views/fields/attachment_field.js +32 -0
  32. data/app/assets/javascripts/admin/views/fields/has_many.js +64 -0
  33. data/app/assets/javascripts/admin/views/fields/image_association_select.js +31 -0
  34. data/app/assets/javascripts/admin/views/fields/markdown_composer.js +167 -0
  35. data/app/assets/javascripts/admin/views/fields/searchable_select.js +70 -0
  36. data/app/assets/javascripts/admin/views/fields/slug_field.js +38 -0
  37. data/app/assets/javascripts/admin/views/fields/swatch_field.js +55 -0
  38. data/app/assets/javascripts/admin/views/fields/timestamp_field.js +80 -0
  39. data/app/assets/javascripts/admin/views/flash_message.js +18 -0
  40. data/app/assets/javascripts/admin/views/form_orchestrator.js +41 -0
  41. data/app/assets/javascripts/admin/views/navigation.js +20 -0
  42. data/app/assets/javascripts/admin/views/resource_form.js +18 -0
  43. data/app/assets/javascripts/admin/views/search_form.js +20 -0
  44. data/app/assets/javascripts/admin/views/sessions.js +109 -0
  45. data/app/assets/javascripts/admin/views/virtual_form.js +47 -0
  46. data/app/assets/stylesheets/admin/_base.scss +5 -0
  47. data/app/assets/stylesheets/admin/_reset.scss +149 -0
  48. data/app/assets/stylesheets/admin/_root.scss +63 -0
  49. data/app/assets/stylesheets/admin/admin.scss +4 -0
  50. data/app/assets/stylesheets/admin/components/_blank_slate.scss +44 -0
  51. data/app/assets/stylesheets/admin/components/_buttons.scss +82 -0
  52. data/app/assets/stylesheets/admin/components/_flash_message.scss +64 -0
  53. data/app/assets/stylesheets/admin/components/_footer.scss +9 -0
  54. data/app/assets/stylesheets/admin/components/_header.scss +107 -0
  55. data/app/assets/stylesheets/admin/components/_index_table.scss +120 -0
  56. data/app/assets/stylesheets/admin/components/_main.scss +68 -0
  57. data/app/assets/stylesheets/admin/components/_markdown_body.scss +109 -0
  58. data/app/assets/stylesheets/admin/components/_navigation.scss +110 -0
  59. data/app/assets/stylesheets/admin/components/_pagination.scss +36 -0
  60. data/app/assets/stylesheets/admin/components/_pill.scss +11 -0
  61. data/app/assets/stylesheets/admin/components/_resource_form.scss +222 -0
  62. data/app/assets/stylesheets/admin/components/_search_form.scss +36 -0
  63. data/app/assets/stylesheets/admin/components/_sessions.scss +152 -0
  64. data/app/assets/stylesheets/admin/components/_show_table.scss +67 -0
  65. data/app/assets/stylesheets/admin/components/forms/_attachment_field.scss +59 -0
  66. data/app/assets/stylesheets/admin/components/forms/_chosen.scss +478 -0
  67. data/app/assets/stylesheets/admin/components/forms/_image_association_select.scss +20 -0
  68. data/app/assets/stylesheets/admin/components/forms/_markdown_composer.scss +149 -0
  69. data/app/assets/stylesheets/admin/components/forms/_nested_fields.scss +63 -0
  70. data/app/assets/stylesheets/admin/components/forms/_searchable_select.scss +8 -0
  71. data/app/assets/stylesheets/admin/components/forms/_slug_field.scss +20 -0
  72. data/app/assets/stylesheets/admin/components/forms/_swatch_field.scss +47 -0
  73. data/app/assets/stylesheets/admin/components/forms/_timestamp_field.scss +15 -0
  74. data/app/assets/stylesheets/admin/components/help_link.scss +6 -0
  75. data/app/assets/stylesheets/admin/mixins/_clearfix.scss +18 -0
  76. data/app/assets/stylesheets/admin/mixins/_min_max_width.scss +11 -0
  77. data/app/assets/stylesheets/admin/mixins/_rgbb.scss +7 -0
  78. data/app/assets/stylesheets/admin/mixins/_visuallyhidden.scss +33 -0
  79. data/app/assets/stylesheets/admin/settings/_animations.scss +21 -0
  80. data/app/assets/stylesheets/admin/settings/_breakpoints.scss +2 -0
  81. data/app/assets/stylesheets/admin/settings/_colors.scss +32 -0
  82. data/app/assets/stylesheets/admin/settings/_fonts.scss +31 -0
  83. data/app/assets/stylesheets/admin/settings/_icons.scss +1658 -0
  84. data/app/controllers/admin/admin_controller.rb +21 -0
  85. data/app/controllers/admin/sessions_controller.rb +112 -0
  86. data/app/controllers/tolaria/resource_controller.rb +132 -0
  87. data/app/controllers/tolaria/tolaria_controller.rb +40 -0
  88. data/app/helpers/admin/table_helper.rb +175 -0
  89. data/app/helpers/admin/view_helper.rb +76 -0
  90. data/app/mailers/passcode_mailer.rb +11 -0
  91. data/app/models/administrator.rb +146 -0
  92. data/app/views/admin/administrators/_form.html.erb +16 -0
  93. data/app/views/admin/administrators/_index.html.erb +20 -0
  94. data/app/views/admin/administrators/_search.html.erb +5 -0
  95. data/app/views/admin/administrators/_show.html.erb +14 -0
  96. data/app/views/admin/help/help_link.html.erb +16 -0
  97. data/app/views/admin/session/form.html.erb +52 -0
  98. data/app/views/admin/shared/_flash_messages.html.erb +42 -0
  99. data/app/views/admin/shared/_footer.html.erb +8 -0
  100. data/app/views/admin/shared/_head.html.erb +11 -0
  101. data/app/views/admin/shared/_header.html.erb +43 -0
  102. data/app/views/admin/shared/_navigation.html.erb +47 -0
  103. data/app/views/admin/shared/_skiplinks.html.erb +0 -0
  104. data/app/views/admin/shared/forms/_attachment_field.html.erb +17 -0
  105. data/app/views/admin/shared/forms/_has_many.html.erb +14 -0
  106. data/app/views/admin/shared/forms/_has_many_header.html.erb +19 -0
  107. data/app/views/admin/shared/forms/_image_association_select.html.erb +6 -0
  108. data/app/views/admin/shared/forms/_image_field.html.erb +19 -0
  109. data/app/views/admin/shared/forms/_markdown_composer.html.erb +29 -0
  110. data/app/views/admin/shared/forms/_searchable_select.html.erb +3 -0
  111. data/app/views/admin/shared/forms/_slug_field.html.erb +9 -0
  112. data/app/views/admin/shared/forms/_swatch_field.html.erb +4 -0
  113. data/app/views/admin/shared/forms/_timestamp_field.html.erb +19 -0
  114. data/app/views/admin/tolaria_resource/_form_buttons.html.erb +10 -0
  115. data/app/views/admin/tolaria_resource/_index_table.html.erb +73 -0
  116. data/app/views/admin/tolaria_resource/_search_form.html.erb +32 -0
  117. data/app/views/admin/tolaria_resource/_show_buttons.html.erb +13 -0
  118. data/app/views/admin/tolaria_resource/edit.html.erb +34 -0
  119. data/app/views/admin/tolaria_resource/index.html.erb +36 -0
  120. data/app/views/admin/tolaria_resource/new.html.erb +1 -0
  121. data/app/views/admin/tolaria_resource/show.html.erb +52 -0
  122. data/app/views/kaminari/admin/_first_page.html.erb +9 -0
  123. data/app/views/kaminari/admin/_last_page.html.erb +9 -0
  124. data/app/views/kaminari/admin/_next_page.html.erb +9 -0
  125. data/app/views/kaminari/admin/_page.html.erb +17 -0
  126. data/app/views/kaminari/admin/_paginator.html.erb +21 -0
  127. data/app/views/kaminari/admin/_prev_page.html.erb +9 -0
  128. data/app/views/layouts/admin/admin.html.erb +21 -0
  129. data/app/views/layouts/admin/sessions.html.erb +12 -0
  130. data/app/views/passcode_mailer/passcode.text.erb +5 -0
  131. data/lib/generators/tolaria/install/install_generator.rb +21 -0
  132. data/lib/generators/tolaria/install/templates/administrators_migration.rb +31 -0
  133. data/lib/generators/tolaria/install/templates/tolaria_initializer.rb +93 -0
  134. data/lib/tasks/admin.rake +32 -0
  135. data/lib/tolaria.rb +27 -0
  136. data/lib/tolaria/active_record.rb +55 -0
  137. data/lib/tolaria/admin.rb +4 -0
  138. data/lib/tolaria/categories.rb +21 -0
  139. data/lib/tolaria/config.rb +40 -0
  140. data/lib/tolaria/default_config.rb +74 -0
  141. data/lib/tolaria/engine.rb +23 -0
  142. data/lib/tolaria/form_buildable.rb +203 -0
  143. data/lib/tolaria/help_links.rb +78 -0
  144. data/lib/tolaria/introspection.rb +13 -0
  145. data/lib/tolaria/manage.rb +57 -0
  146. data/lib/tolaria/managed_class.rb +90 -0
  147. data/lib/tolaria/markdown.rb +28 -0
  148. data/lib/tolaria/random_tokens.rb +16 -0
  149. data/lib/tolaria/reload.rb +21 -0
  150. data/lib/tolaria/routes.rb +33 -0
  151. data/lib/tolaria/version.rb +13 -0
  152. data/test/demo/Rakefile +4 -0
  153. data/test/demo/app/assets/javascripts/application.js +1 -0
  154. data/test/demo/app/assets/stylesheets/application.scss +1 -0
  155. data/test/demo/app/controllers/application_controller.rb +5 -0
  156. data/test/demo/app/controllers/concerns/.keep +0 -0
  157. data/test/demo/app/controllers/homepage_controller.rb +4 -0
  158. data/test/demo/app/helpers/application_helper.rb +2 -0
  159. data/test/demo/app/mailers/.keep +0 -0
  160. data/test/demo/app/models/.keep +0 -0
  161. data/test/demo/app/models/blog_post.rb +43 -0
  162. data/test/demo/app/models/footnote.rb +5 -0
  163. data/test/demo/app/models/image.rb +19 -0
  164. data/test/demo/app/models/legal_page.rb +24 -0
  165. data/test/demo/app/models/miscellany.rb +12 -0
  166. data/test/demo/app/models/topic.rb +22 -0
  167. data/test/demo/app/models/video.rb +16 -0
  168. data/test/demo/app/views/admin/blog_posts/_form.html.erb +48 -0
  169. data/test/demo/app/views/admin/blog_posts/_search.html.erb +5 -0
  170. data/test/demo/app/views/admin/help/markdown-help.md +95 -0
  171. data/test/demo/app/views/admin/images/_form.html.erb +26 -0
  172. data/test/demo/app/views/admin/legal_pages/_form.html.erb +15 -0
  173. data/test/demo/app/views/admin/topics/_form.html.erb +3 -0
  174. data/test/demo/app/views/admin/videos/_form.html.erb +11 -0
  175. data/test/demo/app/views/homepage/homepage.html.erb +3 -0
  176. data/test/demo/app/views/layouts/application.html.erb +14 -0
  177. data/test/demo/bin/bundle +3 -0
  178. data/test/demo/bin/rails +4 -0
  179. data/test/demo/bin/rake +4 -0
  180. data/test/demo/bin/setup +29 -0
  181. data/test/demo/config.ru +4 -0
  182. data/test/demo/config/application.rb +26 -0
  183. data/test/demo/config/boot.rb +4 -0
  184. data/test/demo/config/database.yml +18 -0
  185. data/test/demo/config/environment.rb +3 -0
  186. data/test/demo/config/environments/development.rb +43 -0
  187. data/test/demo/config/environments/test.rb +44 -0
  188. data/test/demo/config/initializers/assets.rb +11 -0
  189. data/test/demo/config/initializers/cookies_serializer.rb +2 -0
  190. data/test/demo/config/initializers/filter_parameter_logging.rb +3 -0
  191. data/test/demo/config/initializers/inflections.rb +17 -0
  192. data/test/demo/config/initializers/markdown.rb +44 -0
  193. data/test/demo/config/initializers/secret_token.rb +2 -0
  194. data/test/demo/config/initializers/session_store.rb +2 -0
  195. data/test/demo/config/initializers/tolaria.rb +17 -0
  196. data/test/demo/config/initializers/wrap_parameters.rb +14 -0
  197. data/test/demo/config/routes.rb +4 -0
  198. data/test/demo/db/migrate/20150601202901_create_administrators.rb +31 -0
  199. data/test/demo/db/migrate/20150603204006_add_testing_models.rb +27 -0
  200. data/test/demo/db/migrate/20150609232013_create_footnotes.rb +10 -0
  201. data/test/demo/db/migrate/20150610135235_create_additional_demo_objects.rb +50 -0
  202. data/test/demo/db/schema.rb +112 -0
  203. data/test/demo/log/.keep +0 -0
  204. data/test/demo/public/404.html +67 -0
  205. data/test/demo/public/422.html +67 -0
  206. data/test/demo/public/500.html +66 -0
  207. data/test/demo/public/favicon.ico +0 -0
  208. data/test/integration/help_link_test.rb +73 -0
  209. data/test/integration/interface_test.rb +63 -0
  210. data/test/integration/router_test.rb +73 -0
  211. data/test/integration/session_test.rb +88 -0
  212. data/test/test_helper.rb +58 -0
  213. data/test/unit/configuration_test.rb +21 -0
  214. data/test/unit/managed_classes_test.rb +54 -0
  215. data/test/unit/markdown_test.rb +12 -0
  216. data/test/unit/menu_test.rb +32 -0
  217. data/test/unit/random_tokens_test.rb +13 -0
  218. data/tolaria.gemspec +35 -0
  219. metadata +499 -0
@@ -0,0 +1,352 @@
1
+ // jQuery.selection 1.0.1
2
+ // https://github.com/madapaja/jquery.selection
3
+ //
4
+ // Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person obtaining
7
+ // a copy of this software and associated documentation files (the
8
+ // "Software"), to deal in the Software without restriction, including
9
+ // without limitation the rights to use, copy, modify, merge, publish,
10
+ // distribute, sublicense, and/or sell copies of the Software, and to
11
+ // permit persons to whom the Software is furnished to do so, subject to
12
+ // the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be
15
+ // included in all copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ (function($, win, doc) {
26
+ /**
27
+ * get caret status of the selection of the element
28
+ *
29
+ * @param {Element} element target DOM element
30
+ * @return {Object} return
31
+ * @return {String} return.text selected text
32
+ * @return {Number} return.start start position of the selection
33
+ * @return {Number} return.end end position of the selection
34
+ */
35
+ var _getCaretInfo = function(element){
36
+ var res = {
37
+ text: '',
38
+ start: 0,
39
+ end: 0
40
+ };
41
+
42
+ if (!element.value) {
43
+ /* no value or empty string */
44
+ return res;
45
+ }
46
+
47
+ try {
48
+ if (win.getSelection) {
49
+ /* except IE */
50
+ res.start = element.selectionStart;
51
+ res.end = element.selectionEnd;
52
+ res.text = element.value.slice(res.start, res.end);
53
+ } else if (doc.selection) {
54
+ /* for IE */
55
+ element.focus();
56
+
57
+ var range = doc.selection.createRange(),
58
+ range2 = doc.body.createTextRange();
59
+
60
+ res.text = range.text;
61
+
62
+ try {
63
+ range2.moveToElementText(element);
64
+ range2.setEndPoint('StartToStart', range);
65
+ } catch (e) {
66
+ range2 = element.createTextRange();
67
+ range2.setEndPoint('StartToStart', range);
68
+ }
69
+
70
+ res.start = element.value.length - range2.text.length;
71
+ res.end = res.start + range.text.length;
72
+ }
73
+ } catch (e) {
74
+ /* give up */
75
+ }
76
+
77
+ return res;
78
+ };
79
+
80
+ /**
81
+ * caret operation for the element
82
+ * @type {Object}
83
+ */
84
+ var _CaretOperation = {
85
+ /**
86
+ * get caret position
87
+ *
88
+ * @param {Element} element target element
89
+ * @return {Object} return
90
+ * @return {Number} return.start start position for the selection
91
+ * @return {Number} return.end end position for the selection
92
+ */
93
+ getPos: function(element) {
94
+ var tmp = _getCaretInfo(element);
95
+ return {start: tmp.start, end: tmp.end};
96
+ },
97
+
98
+ /**
99
+ * set caret position
100
+ *
101
+ * @param {Element} element target element
102
+ * @param {Object} toRange caret position
103
+ * @param {Number} toRange.start start position for the selection
104
+ * @param {Number} toRange.end end position for the selection
105
+ * @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
106
+ */
107
+ setPos: function(element, toRange, caret) {
108
+ caret = this._caretMode(caret);
109
+
110
+ if (caret === 'start') {
111
+ toRange.end = toRange.start;
112
+ } else if (caret === 'end') {
113
+ toRange.start = toRange.end;
114
+ }
115
+
116
+ element.focus();
117
+ try {
118
+ if (element.createTextRange) {
119
+ var range = element.createTextRange();
120
+
121
+ if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
122
+ toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
123
+ toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
124
+ }
125
+
126
+ range.collapse(true);
127
+ range.moveStart('character', toRange.start);
128
+ range.moveEnd('character', toRange.end - toRange.start);
129
+
130
+ range.select();
131
+ } else if (element.setSelectionRange) {
132
+ element.setSelectionRange(toRange.start, toRange.end);
133
+ }
134
+ } catch (e) {
135
+ /* give up */
136
+ }
137
+ },
138
+
139
+ /**
140
+ * get selected text
141
+ *
142
+ * @param {Element} element target element
143
+ * @return {String} return selected text
144
+ */
145
+ getText: function(element) {
146
+ return _getCaretInfo(element).text;
147
+ },
148
+
149
+ /**
150
+ * get caret mode
151
+ *
152
+ * @param {String} caret caret mode
153
+ * @return {String} return any of the following: "keep" | "start" | "end"
154
+ */
155
+ _caretMode: function(caret) {
156
+ caret = caret || "keep";
157
+ if (caret === false) {
158
+ caret = 'end';
159
+ }
160
+
161
+ switch (caret) {
162
+ case 'keep':
163
+ case 'start':
164
+ case 'end':
165
+ break;
166
+
167
+ default:
168
+ caret = 'keep';
169
+ }
170
+
171
+ return caret;
172
+ },
173
+
174
+ /**
175
+ * replace selected text
176
+ *
177
+ * @param {Element} element target element
178
+ * @param {String} text replacement text
179
+ * @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
180
+ */
181
+ replace: function(element, text, caret) {
182
+ var tmp = _getCaretInfo(element),
183
+ orig = element.value,
184
+ pos = $(element).scrollTop(),
185
+ range = {start: tmp.start, end: tmp.start + text.length};
186
+
187
+ element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
188
+
189
+ $(element).scrollTop(pos);
190
+ this.setPos(element, range, caret);
191
+ },
192
+
193
+ /**
194
+ * insert before the selected text
195
+ *
196
+ * @param {Element} element target element
197
+ * @param {String} text insertion text
198
+ * @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
199
+ */
200
+ insertBefore: function(element, text, caret) {
201
+ var tmp = _getCaretInfo(element),
202
+ orig = element.value,
203
+ pos = $(element).scrollTop(),
204
+ range = {start: tmp.start + text.length, end: tmp.end + text.length};
205
+
206
+ element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
207
+
208
+ $(element).scrollTop(pos);
209
+ this.setPos(element, range, caret);
210
+ },
211
+
212
+ /**
213
+ * insert after the selected text
214
+ *
215
+ * @param {Element} element target element
216
+ * @param {String} text insertion text
217
+ * @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
218
+ */
219
+ insertAfter: function(element, text, caret) {
220
+ var tmp = _getCaretInfo(element),
221
+ orig = element.value,
222
+ pos = $(element).scrollTop(),
223
+ range = {start: tmp.start, end: tmp.end};
224
+
225
+ element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
226
+
227
+ $(element).scrollTop(pos);
228
+ this.setPos(element, range, caret);
229
+ }
230
+ };
231
+
232
+ /* add jQuery.selection */
233
+ $.extend({
234
+ /**
235
+ * get selected text on the window
236
+ *
237
+ * @param {String} mode selection mode: any of the following: "text" | "html"
238
+ * @return {String} return
239
+ */
240
+ selection: function(mode) {
241
+ var getText = ((mode || 'text').toLowerCase() === 'text');
242
+
243
+ try {
244
+ if (win.getSelection) {
245
+ if (getText) {
246
+ // get text
247
+ return win.getSelection().toString();
248
+ } else {
249
+ // get html
250
+ var sel = win.getSelection(), range;
251
+
252
+ if (sel.getRangeAt) {
253
+ range = sel.getRangeAt(0);
254
+ } else {
255
+ range = doc.createRange();
256
+ range.setStart(sel.anchorNode, sel.anchorOffset);
257
+ range.setEnd(sel.focusNode, sel.focusOffset);
258
+ }
259
+
260
+ return $('<div></div>').append(range.cloneContents()).html();
261
+ }
262
+ } else if (doc.selection) {
263
+ if (getText) {
264
+ // get text
265
+ return doc.selection.createRange().text;
266
+ } else {
267
+ // get html
268
+ return doc.selection.createRange().htmlText;
269
+ }
270
+ }
271
+ } catch (e) {
272
+ /* give up */
273
+ }
274
+
275
+ return '';
276
+ }
277
+ });
278
+
279
+ /* add selection */
280
+ $.fn.extend({
281
+ selection: function(mode, opts) {
282
+ opts = opts || {};
283
+
284
+ switch (mode) {
285
+ /**
286
+ * selection('getPos')
287
+ * get caret position
288
+ *
289
+ * @return {Object} return
290
+ * @return {Number} return.start start position for the selection
291
+ * @return {Number} return.end end position for the selection
292
+ */
293
+ case 'getPos':
294
+ return _CaretOperation.getPos(this[0]);
295
+
296
+ /**
297
+ * selection('setPos', opts)
298
+ * set caret position
299
+ *
300
+ * @param {Number} opts.start start position for the selection
301
+ * @param {Number} opts.end end position for the selection
302
+ */
303
+ case 'setPos':
304
+ return this.each(function() {
305
+ _CaretOperation.setPos(this, opts);
306
+ });
307
+
308
+ /**
309
+ * selection('replace', opts)
310
+ * replace the selected text
311
+ *
312
+ * @param {String} opts.text replacement text
313
+ * @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
314
+ */
315
+ case 'replace':
316
+ return this.each(function() {
317
+ _CaretOperation.replace(this, opts.text, opts.caret);
318
+ });
319
+
320
+ /**
321
+ * selection('insert', opts)
322
+ * insert before/after the selected text
323
+ *
324
+ * @param {String} opts.text insertion text
325
+ * @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
326
+ * @param {String} opts.mode insertion mode: any of the following: "before" | "after"
327
+ */
328
+ case 'insert':
329
+ return this.each(function() {
330
+ if (opts.mode === 'before') {
331
+ _CaretOperation.insertBefore(this, opts.text, opts.caret);
332
+ } else {
333
+ _CaretOperation.insertAfter(this, opts.text, opts.caret);
334
+ }
335
+ });
336
+
337
+ /**
338
+ * selection('get')
339
+ * get selected text
340
+ *
341
+ * @return {String} return
342
+ */
343
+ case 'get':
344
+ /* falls through */
345
+ default:
346
+ return _CaretOperation.getText(this[0]);
347
+ }
348
+
349
+ return this;
350
+ }
351
+ });
352
+ })(jQuery, window, window.document);
@@ -0,0 +1,3103 @@
1
+ // Moment.js 2.10.2
2
+ // https://github.com/moment/moment/
3
+ //
4
+ // Copyright (c) 2011-2015 Tim Wood, Iskren Chernev, Moment.js contributors
5
+ //
6
+ // Permission is hereby granted, free of charge, to any person
7
+ // obtaining a copy of this software and associated documentation
8
+ // files (the "Software"), to deal in the Software without
9
+ // restriction, including without limitation the rights to use,
10
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the
12
+ // Software is furnished to do so, subject to the following
13
+ // conditions:
14
+ //
15
+ // The above copyright notice and this permission notice shall be
16
+ // included in all copies or substantial portions of the Software.
17
+ //
18
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ // OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ (function (global, factory) {
28
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
29
+ typeof define === 'function' && define.amd ? define(factory) :
30
+ global.moment = factory()
31
+ }(this, function () { 'use strict';
32
+
33
+ var hookCallback;
34
+
35
+ function utils_hooks__hooks () {
36
+ return hookCallback.apply(null, arguments);
37
+ }
38
+
39
+ // This is done to register the method called with moment()
40
+ // without creating circular dependencies.
41
+ function setHookCallback (callback) {
42
+ hookCallback = callback;
43
+ }
44
+
45
+ function defaultParsingFlags() {
46
+ // We need to deep clone this object.
47
+ return {
48
+ empty : false,
49
+ unusedTokens : [],
50
+ unusedInput : [],
51
+ overflow : -2,
52
+ charsLeftOver : 0,
53
+ nullInput : false,
54
+ invalidMonth : null,
55
+ invalidFormat : false,
56
+ userInvalidated : false,
57
+ iso : false
58
+ };
59
+ }
60
+
61
+ function isArray(input) {
62
+ return Object.prototype.toString.call(input) === '[object Array]';
63
+ }
64
+
65
+ function isDate(input) {
66
+ return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date;
67
+ }
68
+
69
+ function map(arr, fn) {
70
+ var res = [], i;
71
+ for (i = 0; i < arr.length; ++i) {
72
+ res.push(fn(arr[i], i));
73
+ }
74
+ return res;
75
+ }
76
+
77
+ function hasOwnProp(a, b) {
78
+ return Object.prototype.hasOwnProperty.call(a, b);
79
+ }
80
+
81
+ function extend(a, b) {
82
+ for (var i in b) {
83
+ if (hasOwnProp(b, i)) {
84
+ a[i] = b[i];
85
+ }
86
+ }
87
+
88
+ if (hasOwnProp(b, 'toString')) {
89
+ a.toString = b.toString;
90
+ }
91
+
92
+ if (hasOwnProp(b, 'valueOf')) {
93
+ a.valueOf = b.valueOf;
94
+ }
95
+
96
+ return a;
97
+ }
98
+
99
+ function create_utc__createUTC (input, format, locale, strict) {
100
+ return createLocalOrUTC(input, format, locale, strict, true).utc();
101
+ }
102
+
103
+ function valid__isValid(m) {
104
+ if (m._isValid == null) {
105
+ m._isValid = !isNaN(m._d.getTime()) &&
106
+ m._pf.overflow < 0 &&
107
+ !m._pf.empty &&
108
+ !m._pf.invalidMonth &&
109
+ !m._pf.nullInput &&
110
+ !m._pf.invalidFormat &&
111
+ !m._pf.userInvalidated;
112
+
113
+ if (m._strict) {
114
+ m._isValid = m._isValid &&
115
+ m._pf.charsLeftOver === 0 &&
116
+ m._pf.unusedTokens.length === 0 &&
117
+ m._pf.bigHour === undefined;
118
+ }
119
+ }
120
+ return m._isValid;
121
+ }
122
+
123
+ function valid__createInvalid (flags) {
124
+ var m = create_utc__createUTC(NaN);
125
+ if (flags != null) {
126
+ extend(m._pf, flags);
127
+ }
128
+ else {
129
+ m._pf.userInvalidated = true;
130
+ }
131
+
132
+ return m;
133
+ }
134
+
135
+ var momentProperties = utils_hooks__hooks.momentProperties = [];
136
+
137
+ function copyConfig(to, from) {
138
+ var i, prop, val;
139
+
140
+ if (typeof from._isAMomentObject !== 'undefined') {
141
+ to._isAMomentObject = from._isAMomentObject;
142
+ }
143
+ if (typeof from._i !== 'undefined') {
144
+ to._i = from._i;
145
+ }
146
+ if (typeof from._f !== 'undefined') {
147
+ to._f = from._f;
148
+ }
149
+ if (typeof from._l !== 'undefined') {
150
+ to._l = from._l;
151
+ }
152
+ if (typeof from._strict !== 'undefined') {
153
+ to._strict = from._strict;
154
+ }
155
+ if (typeof from._tzm !== 'undefined') {
156
+ to._tzm = from._tzm;
157
+ }
158
+ if (typeof from._isUTC !== 'undefined') {
159
+ to._isUTC = from._isUTC;
160
+ }
161
+ if (typeof from._offset !== 'undefined') {
162
+ to._offset = from._offset;
163
+ }
164
+ if (typeof from._pf !== 'undefined') {
165
+ to._pf = from._pf;
166
+ }
167
+ if (typeof from._locale !== 'undefined') {
168
+ to._locale = from._locale;
169
+ }
170
+
171
+ if (momentProperties.length > 0) {
172
+ for (i in momentProperties) {
173
+ prop = momentProperties[i];
174
+ val = from[prop];
175
+ if (typeof val !== 'undefined') {
176
+ to[prop] = val;
177
+ }
178
+ }
179
+ }
180
+
181
+ return to;
182
+ }
183
+
184
+ var updateInProgress = false;
185
+
186
+ // Moment prototype object
187
+ function Moment(config) {
188
+ copyConfig(this, config);
189
+ this._d = new Date(+config._d);
190
+ // Prevent infinite loop in case updateOffset creates new moment
191
+ // objects.
192
+ if (updateInProgress === false) {
193
+ updateInProgress = true;
194
+ utils_hooks__hooks.updateOffset(this);
195
+ updateInProgress = false;
196
+ }
197
+ }
198
+
199
+ function isMoment (obj) {
200
+ return obj instanceof Moment || (obj != null && hasOwnProp(obj, '_isAMomentObject'));
201
+ }
202
+
203
+ function toInt(argumentForCoercion) {
204
+ var coercedNumber = +argumentForCoercion,
205
+ value = 0;
206
+
207
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
208
+ if (coercedNumber >= 0) {
209
+ value = Math.floor(coercedNumber);
210
+ } else {
211
+ value = Math.ceil(coercedNumber);
212
+ }
213
+ }
214
+
215
+ return value;
216
+ }
217
+
218
+ function compareArrays(array1, array2, dontConvert) {
219
+ var len = Math.min(array1.length, array2.length),
220
+ lengthDiff = Math.abs(array1.length - array2.length),
221
+ diffs = 0,
222
+ i;
223
+ for (i = 0; i < len; i++) {
224
+ if ((dontConvert && array1[i] !== array2[i]) ||
225
+ (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
226
+ diffs++;
227
+ }
228
+ }
229
+ return diffs + lengthDiff;
230
+ }
231
+
232
+ function Locale() {
233
+ }
234
+
235
+ var locales = {};
236
+ var globalLocale;
237
+
238
+ function normalizeLocale(key) {
239
+ return key ? key.toLowerCase().replace('_', '-') : key;
240
+ }
241
+
242
+ // pick the locale from the array
243
+ // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
244
+ // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
245
+ function chooseLocale(names) {
246
+ var i = 0, j, next, locale, split;
247
+
248
+ while (i < names.length) {
249
+ split = normalizeLocale(names[i]).split('-');
250
+ j = split.length;
251
+ next = normalizeLocale(names[i + 1]);
252
+ next = next ? next.split('-') : null;
253
+ while (j > 0) {
254
+ locale = loadLocale(split.slice(0, j).join('-'));
255
+ if (locale) {
256
+ return locale;
257
+ }
258
+ if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
259
+ //the next array item is better than a shallower substring of this one
260
+ break;
261
+ }
262
+ j--;
263
+ }
264
+ i++;
265
+ }
266
+ return null;
267
+ }
268
+
269
+ function loadLocale(name) {
270
+ var oldLocale = null;
271
+ // TODO: Find a better way to register and load all the locales in Node
272
+ if (!locales[name] && typeof module !== 'undefined' &&
273
+ module && module.exports) {
274
+ try {
275
+ oldLocale = globalLocale._abbr;
276
+ require('./locale/' + name);
277
+ // because defineLocale currently also sets the global locale, we
278
+ // want to undo that for lazy loaded locales
279
+ locale_locales__getSetGlobalLocale(oldLocale);
280
+ } catch (e) { }
281
+ }
282
+ return locales[name];
283
+ }
284
+
285
+ // This function will load locale and then set the global locale. If
286
+ // no arguments are passed in, it will simply return the current global
287
+ // locale key.
288
+ function locale_locales__getSetGlobalLocale (key, values) {
289
+ var data;
290
+ if (key) {
291
+ if (typeof values === 'undefined') {
292
+ data = locale_locales__getLocale(key);
293
+ }
294
+ else {
295
+ data = defineLocale(key, values);
296
+ }
297
+
298
+ if (data) {
299
+ // moment.duration._locale = moment._locale = data;
300
+ globalLocale = data;
301
+ }
302
+ }
303
+
304
+ return globalLocale._abbr;
305
+ }
306
+
307
+ function defineLocale (name, values) {
308
+ if (values !== null) {
309
+ values.abbr = name;
310
+ if (!locales[name]) {
311
+ locales[name] = new Locale();
312
+ }
313
+ locales[name].set(values);
314
+
315
+ // backwards compat for now: also set the locale
316
+ locale_locales__getSetGlobalLocale(name);
317
+
318
+ return locales[name];
319
+ } else {
320
+ // useful for testing
321
+ delete locales[name];
322
+ return null;
323
+ }
324
+ }
325
+
326
+ // returns locale data
327
+ function locale_locales__getLocale (key) {
328
+ var locale;
329
+
330
+ if (key && key._locale && key._locale._abbr) {
331
+ key = key._locale._abbr;
332
+ }
333
+
334
+ if (!key) {
335
+ return globalLocale;
336
+ }
337
+
338
+ if (!isArray(key)) {
339
+ //short-circuit everything else
340
+ locale = loadLocale(key);
341
+ if (locale) {
342
+ return locale;
343
+ }
344
+ key = [key];
345
+ }
346
+
347
+ return chooseLocale(key);
348
+ }
349
+
350
+ var aliases = {};
351
+
352
+ function addUnitAlias (unit, shorthand) {
353
+ var lowerCase = unit.toLowerCase();
354
+ aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
355
+ }
356
+
357
+ function normalizeUnits(units) {
358
+ return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
359
+ }
360
+
361
+ function normalizeObjectUnits(inputObject) {
362
+ var normalizedInput = {},
363
+ normalizedProp,
364
+ prop;
365
+
366
+ for (prop in inputObject) {
367
+ if (hasOwnProp(inputObject, prop)) {
368
+ normalizedProp = normalizeUnits(prop);
369
+ if (normalizedProp) {
370
+ normalizedInput[normalizedProp] = inputObject[prop];
371
+ }
372
+ }
373
+ }
374
+
375
+ return normalizedInput;
376
+ }
377
+
378
+ function makeGetSet (unit, keepTime) {
379
+ return function (value) {
380
+ if (value != null) {
381
+ get_set__set(this, unit, value);
382
+ utils_hooks__hooks.updateOffset(this, keepTime);
383
+ return this;
384
+ } else {
385
+ return get_set__get(this, unit);
386
+ }
387
+ };
388
+ }
389
+
390
+ function get_set__get (mom, unit) {
391
+ return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
392
+ }
393
+
394
+ function get_set__set (mom, unit, value) {
395
+ return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
396
+ }
397
+
398
+ // MOMENTS
399
+
400
+ function getSet (units, value) {
401
+ var unit;
402
+ if (typeof units === 'object') {
403
+ for (unit in units) {
404
+ this.set(unit, units[unit]);
405
+ }
406
+ } else {
407
+ units = normalizeUnits(units);
408
+ if (typeof this[units] === 'function') {
409
+ return this[units](value);
410
+ }
411
+ }
412
+ return this;
413
+ }
414
+
415
+ function zeroFill(number, targetLength, forceSign) {
416
+ var output = '' + Math.abs(number),
417
+ sign = number >= 0;
418
+
419
+ while (output.length < targetLength) {
420
+ output = '0' + output;
421
+ }
422
+ return (sign ? (forceSign ? '+' : '') : '-') + output;
423
+ }
424
+
425
+ var 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|X|zz?|ZZ?|.)/g;
426
+
427
+ var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
428
+
429
+ var formatFunctions = {};
430
+
431
+ var formatTokenFunctions = {};
432
+
433
+ // token: 'M'
434
+ // padded: ['MM', 2]
435
+ // ordinal: 'Mo'
436
+ // callback: function () { this.month() + 1 }
437
+ function addFormatToken (token, padded, ordinal, callback) {
438
+ var func = callback;
439
+ if (typeof callback === 'string') {
440
+ func = function () {
441
+ return this[callback]();
442
+ };
443
+ }
444
+ if (token) {
445
+ formatTokenFunctions[token] = func;
446
+ }
447
+ if (padded) {
448
+ formatTokenFunctions[padded[0]] = function () {
449
+ return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
450
+ };
451
+ }
452
+ if (ordinal) {
453
+ formatTokenFunctions[ordinal] = function () {
454
+ return this.localeData().ordinal(func.apply(this, arguments), token);
455
+ };
456
+ }
457
+ }
458
+
459
+ function removeFormattingTokens(input) {
460
+ if (input.match(/\[[\s\S]/)) {
461
+ return input.replace(/^\[|\]$/g, '');
462
+ }
463
+ return input.replace(/\\/g, '');
464
+ }
465
+
466
+ function makeFormatFunction(format) {
467
+ var array = format.match(formattingTokens), i, length;
468
+
469
+ for (i = 0, length = array.length; i < length; i++) {
470
+ if (formatTokenFunctions[array[i]]) {
471
+ array[i] = formatTokenFunctions[array[i]];
472
+ } else {
473
+ array[i] = removeFormattingTokens(array[i]);
474
+ }
475
+ }
476
+
477
+ return function (mom) {
478
+ var output = '';
479
+ for (i = 0; i < length; i++) {
480
+ output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
481
+ }
482
+ return output;
483
+ };
484
+ }
485
+
486
+ // format date using native date object
487
+ function formatMoment(m, format) {
488
+ if (!m.isValid()) {
489
+ return m.localeData().invalidDate();
490
+ }
491
+
492
+ format = expandFormat(format, m.localeData());
493
+
494
+ if (!formatFunctions[format]) {
495
+ formatFunctions[format] = makeFormatFunction(format);
496
+ }
497
+
498
+ return formatFunctions[format](m);
499
+ }
500
+
501
+ function expandFormat(format, locale) {
502
+ var i = 5;
503
+
504
+ function replaceLongDateFormatTokens(input) {
505
+ return locale.longDateFormat(input) || input;
506
+ }
507
+
508
+ localFormattingTokens.lastIndex = 0;
509
+ while (i >= 0 && localFormattingTokens.test(format)) {
510
+ format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
511
+ localFormattingTokens.lastIndex = 0;
512
+ i -= 1;
513
+ }
514
+
515
+ return format;
516
+ }
517
+
518
+ var match1 = /\d/; // 0 - 9
519
+ var match2 = /\d\d/; // 00 - 99
520
+ var match3 = /\d{3}/; // 000 - 999
521
+ var match4 = /\d{4}/; // 0000 - 9999
522
+ var match6 = /[+-]?\d{6}/; // -999999 - 999999
523
+ var match1to2 = /\d\d?/; // 0 - 99
524
+ var match1to3 = /\d{1,3}/; // 0 - 999
525
+ var match1to4 = /\d{1,4}/; // 0 - 9999
526
+ var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
527
+
528
+ var matchUnsigned = /\d+/; // 0 - inf
529
+ var matchSigned = /[+-]?\d+/; // -inf - inf
530
+
531
+ var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
532
+
533
+ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
534
+
535
+ // any word (or two) characters or numbers including two/three word month in arabic.
536
+ var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
537
+
538
+ var regexes = {};
539
+
540
+ function addRegexToken (token, regex, strictRegex) {
541
+ regexes[token] = typeof regex === 'function' ? regex : function (isStrict) {
542
+ return (isStrict && strictRegex) ? strictRegex : regex;
543
+ };
544
+ }
545
+
546
+ function getParseRegexForToken (token, config) {
547
+ if (!hasOwnProp(regexes, token)) {
548
+ return new RegExp(unescapeFormat(token));
549
+ }
550
+
551
+ return regexes[token](config._strict, config._locale);
552
+ }
553
+
554
+ // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
555
+ function unescapeFormat(s) {
556
+ return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
557
+ return p1 || p2 || p3 || p4;
558
+ }).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
559
+ }
560
+
561
+ var tokens = {};
562
+
563
+ function addParseToken (token, callback) {
564
+ var i, func = callback;
565
+ if (typeof token === 'string') {
566
+ token = [token];
567
+ }
568
+ if (typeof callback === 'number') {
569
+ func = function (input, array) {
570
+ array[callback] = toInt(input);
571
+ };
572
+ }
573
+ for (i = 0; i < token.length; i++) {
574
+ tokens[token[i]] = func;
575
+ }
576
+ }
577
+
578
+ function addWeekParseToken (token, callback) {
579
+ addParseToken(token, function (input, array, config, token) {
580
+ config._w = config._w || {};
581
+ callback(input, config._w, config, token);
582
+ });
583
+ }
584
+
585
+ function addTimeToArrayFromToken(token, input, config) {
586
+ if (input != null && hasOwnProp(tokens, token)) {
587
+ tokens[token](input, config._a, config, token);
588
+ }
589
+ }
590
+
591
+ var YEAR = 0;
592
+ var MONTH = 1;
593
+ var DATE = 2;
594
+ var HOUR = 3;
595
+ var MINUTE = 4;
596
+ var SECOND = 5;
597
+ var MILLISECOND = 6;
598
+
599
+ function daysInMonth(year, month) {
600
+ return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
601
+ }
602
+
603
+ // FORMATTING
604
+
605
+ addFormatToken('M', ['MM', 2], 'Mo', function () {
606
+ return this.month() + 1;
607
+ });
608
+
609
+ addFormatToken('MMM', 0, 0, function (format) {
610
+ return this.localeData().monthsShort(this, format);
611
+ });
612
+
613
+ addFormatToken('MMMM', 0, 0, function (format) {
614
+ return this.localeData().months(this, format);
615
+ });
616
+
617
+ // ALIASES
618
+
619
+ addUnitAlias('month', 'M');
620
+
621
+ // PARSING
622
+
623
+ addRegexToken('M', match1to2);
624
+ addRegexToken('MM', match1to2, match2);
625
+ addRegexToken('MMM', matchWord);
626
+ addRegexToken('MMMM', matchWord);
627
+
628
+ addParseToken(['M', 'MM'], function (input, array) {
629
+ array[MONTH] = toInt(input) - 1;
630
+ });
631
+
632
+ addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
633
+ var month = config._locale.monthsParse(input, token, config._strict);
634
+ // if we didn't find a month name, mark the date as invalid.
635
+ if (month != null) {
636
+ array[MONTH] = month;
637
+ } else {
638
+ config._pf.invalidMonth = input;
639
+ }
640
+ });
641
+
642
+ // LOCALES
643
+
644
+ var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
645
+ function localeMonths (m) {
646
+ return this._months[m.month()];
647
+ }
648
+
649
+ var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
650
+ function localeMonthsShort (m) {
651
+ return this._monthsShort[m.month()];
652
+ }
653
+
654
+ function localeMonthsParse (monthName, format, strict) {
655
+ var i, mom, regex;
656
+
657
+ if (!this._monthsParse) {
658
+ this._monthsParse = [];
659
+ this._longMonthsParse = [];
660
+ this._shortMonthsParse = [];
661
+ }
662
+
663
+ for (i = 0; i < 12; i++) {
664
+ // make the regex if we don't have it already
665
+ mom = create_utc__createUTC([2000, i]);
666
+ if (strict && !this._longMonthsParse[i]) {
667
+ this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
668
+ this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
669
+ }
670
+ if (!strict && !this._monthsParse[i]) {
671
+ regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
672
+ this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
673
+ }
674
+ // test the regex
675
+ if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
676
+ return i;
677
+ } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
678
+ return i;
679
+ } else if (!strict && this._monthsParse[i].test(monthName)) {
680
+ return i;
681
+ }
682
+ }
683
+ }
684
+
685
+ // MOMENTS
686
+
687
+ function setMonth (mom, value) {
688
+ var dayOfMonth;
689
+
690
+ // TODO: Move this out of here!
691
+ if (typeof value === 'string') {
692
+ value = mom.localeData().monthsParse(value);
693
+ // TODO: Another silent failure?
694
+ if (typeof value !== 'number') {
695
+ return mom;
696
+ }
697
+ }
698
+
699
+ dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
700
+ mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
701
+ return mom;
702
+ }
703
+
704
+ function getSetMonth (value) {
705
+ if (value != null) {
706
+ setMonth(this, value);
707
+ utils_hooks__hooks.updateOffset(this, true);
708
+ return this;
709
+ } else {
710
+ return get_set__get(this, 'Month');
711
+ }
712
+ }
713
+
714
+ function getDaysInMonth () {
715
+ return daysInMonth(this.year(), this.month());
716
+ }
717
+
718
+ function checkOverflow (m) {
719
+ var overflow;
720
+ var a = m._a;
721
+
722
+ if (a && m._pf.overflow === -2) {
723
+ overflow =
724
+ a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
725
+ a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
726
+ a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
727
+ a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
728
+ a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
729
+ a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
730
+ -1;
731
+
732
+ if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
733
+ overflow = DATE;
734
+ }
735
+
736
+ m._pf.overflow = overflow;
737
+ }
738
+
739
+ return m;
740
+ }
741
+
742
+ function warn(msg) {
743
+ if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
744
+ console.warn('Deprecation warning: ' + msg);
745
+ }
746
+ }
747
+
748
+ function deprecate(msg, fn) {
749
+ var firstTime = true;
750
+ return extend(function () {
751
+ if (firstTime) {
752
+ warn(msg);
753
+ firstTime = false;
754
+ }
755
+ return fn.apply(this, arguments);
756
+ }, fn);
757
+ }
758
+
759
+ var deprecations = {};
760
+
761
+ function deprecateSimple(name, msg) {
762
+ if (!deprecations[name]) {
763
+ warn(msg);
764
+ deprecations[name] = true;
765
+ }
766
+ }
767
+
768
+ utils_hooks__hooks.suppressDeprecationWarnings = false;
769
+
770
+ var from_string__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)?)?$/;
771
+
772
+ var isoDates = [
773
+ ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
774
+ ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
775
+ ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
776
+ ['GGGG-[W]WW', /\d{4}-W\d{2}/],
777
+ ['YYYY-DDD', /\d{4}-\d{3}/]
778
+ ];
779
+
780
+ // iso time formats and regexes
781
+ var isoTimes = [
782
+ ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
783
+ ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
784
+ ['HH:mm', /(T| )\d\d:\d\d/],
785
+ ['HH', /(T| )\d\d/]
786
+ ];
787
+
788
+ var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
789
+
790
+ // date from iso format
791
+ function configFromISO(config) {
792
+ var i, l,
793
+ string = config._i,
794
+ match = from_string__isoRegex.exec(string);
795
+
796
+ if (match) {
797
+ config._pf.iso = true;
798
+ for (i = 0, l = isoDates.length; i < l; i++) {
799
+ if (isoDates[i][1].exec(string)) {
800
+ // match[5] should be 'T' or undefined
801
+ config._f = isoDates[i][0] + (match[6] || ' ');
802
+ break;
803
+ }
804
+ }
805
+ for (i = 0, l = isoTimes.length; i < l; i++) {
806
+ if (isoTimes[i][1].exec(string)) {
807
+ config._f += isoTimes[i][0];
808
+ break;
809
+ }
810
+ }
811
+ if (string.match(matchOffset)) {
812
+ config._f += 'Z';
813
+ }
814
+ configFromStringAndFormat(config);
815
+ } else {
816
+ config._isValid = false;
817
+ }
818
+ }
819
+
820
+ // date from iso format or fallback
821
+ function configFromString(config) {
822
+ var matched = aspNetJsonRegex.exec(config._i);
823
+
824
+ if (matched !== null) {
825
+ config._d = new Date(+matched[1]);
826
+ return;
827
+ }
828
+
829
+ configFromISO(config);
830
+ if (config._isValid === false) {
831
+ delete config._isValid;
832
+ utils_hooks__hooks.createFromInputFallback(config);
833
+ }
834
+ }
835
+
836
+ utils_hooks__hooks.createFromInputFallback = deprecate(
837
+ 'moment construction falls back to js Date. This is ' +
838
+ 'discouraged and will be removed in upcoming major ' +
839
+ 'release. Please refer to ' +
840
+ 'https://github.com/moment/moment/issues/1407 for more info.',
841
+ function (config) {
842
+ config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
843
+ }
844
+ );
845
+
846
+ function createDate (y, m, d, h, M, s, ms) {
847
+ //can't just apply() to create a date:
848
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
849
+ var date = new Date(y, m, d, h, M, s, ms);
850
+
851
+ //the date constructor doesn't accept years < 1970
852
+ if (y < 1970) {
853
+ date.setFullYear(y);
854
+ }
855
+ return date;
856
+ }
857
+
858
+ function createUTCDate (y) {
859
+ var date = new Date(Date.UTC.apply(null, arguments));
860
+ if (y < 1970) {
861
+ date.setUTCFullYear(y);
862
+ }
863
+ return date;
864
+ }
865
+
866
+ addFormatToken(0, ['YY', 2], 0, function () {
867
+ return this.year() % 100;
868
+ });
869
+
870
+ addFormatToken(0, ['YYYY', 4], 0, 'year');
871
+ addFormatToken(0, ['YYYYY', 5], 0, 'year');
872
+ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
873
+
874
+ // ALIASES
875
+
876
+ addUnitAlias('year', 'y');
877
+
878
+ // PARSING
879
+
880
+ addRegexToken('Y', matchSigned);
881
+ addRegexToken('YY', match1to2, match2);
882
+ addRegexToken('YYYY', match1to4, match4);
883
+ addRegexToken('YYYYY', match1to6, match6);
884
+ addRegexToken('YYYYYY', match1to6, match6);
885
+
886
+ addParseToken(['YYYY', 'YYYYY', 'YYYYYY'], YEAR);
887
+ addParseToken('YY', function (input, array) {
888
+ array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
889
+ });
890
+
891
+ // HELPERS
892
+
893
+ function daysInYear(year) {
894
+ return isLeapYear(year) ? 366 : 365;
895
+ }
896
+
897
+ function isLeapYear(year) {
898
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
899
+ }
900
+
901
+ // HOOKS
902
+
903
+ utils_hooks__hooks.parseTwoDigitYear = function (input) {
904
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
905
+ };
906
+
907
+ // MOMENTS
908
+
909
+ var getSetYear = makeGetSet('FullYear', false);
910
+
911
+ function getIsLeapYear () {
912
+ return isLeapYear(this.year());
913
+ }
914
+
915
+ addFormatToken('w', ['ww', 2], 'wo', 'week');
916
+ addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
917
+
918
+ // ALIASES
919
+
920
+ addUnitAlias('week', 'w');
921
+ addUnitAlias('isoWeek', 'W');
922
+
923
+ // PARSING
924
+
925
+ addRegexToken('w', match1to2);
926
+ addRegexToken('ww', match1to2, match2);
927
+ addRegexToken('W', match1to2);
928
+ addRegexToken('WW', match1to2, match2);
929
+
930
+ addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
931
+ week[token.substr(0, 1)] = toInt(input);
932
+ });
933
+
934
+ // HELPERS
935
+
936
+ // firstDayOfWeek 0 = sun, 6 = sat
937
+ // the day of the week that starts the week
938
+ // (usually sunday or monday)
939
+ // firstDayOfWeekOfYear 0 = sun, 6 = sat
940
+ // the first week is the week that contains the first
941
+ // of this day of the week
942
+ // (eg. ISO weeks use thursday (4))
943
+ function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
944
+ var end = firstDayOfWeekOfYear - firstDayOfWeek,
945
+ daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
946
+ adjustedMoment;
947
+
948
+
949
+ if (daysToDayOfWeek > end) {
950
+ daysToDayOfWeek -= 7;
951
+ }
952
+
953
+ if (daysToDayOfWeek < end - 7) {
954
+ daysToDayOfWeek += 7;
955
+ }
956
+
957
+ adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
958
+ return {
959
+ week: Math.ceil(adjustedMoment.dayOfYear() / 7),
960
+ year: adjustedMoment.year()
961
+ };
962
+ }
963
+
964
+ // LOCALES
965
+
966
+ function localeWeek (mom) {
967
+ return weekOfYear(mom, this._week.dow, this._week.doy).week;
968
+ }
969
+
970
+ var defaultLocaleWeek = {
971
+ dow : 0, // Sunday is the first day of the week.
972
+ doy : 6 // The week that contains Jan 1st is the first week of the year.
973
+ };
974
+
975
+ function localeFirstDayOfWeek () {
976
+ return this._week.dow;
977
+ }
978
+
979
+ function localeFirstDayOfYear () {
980
+ return this._week.doy;
981
+ }
982
+
983
+ // MOMENTS
984
+
985
+ function getSetWeek (input) {
986
+ var week = this.localeData().week(this);
987
+ return input == null ? week : this.add((input - week) * 7, 'd');
988
+ }
989
+
990
+ function getSetISOWeek (input) {
991
+ var week = weekOfYear(this, 1, 4).week;
992
+ return input == null ? week : this.add((input - week) * 7, 'd');
993
+ }
994
+
995
+ addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
996
+
997
+ // ALIASES
998
+
999
+ addUnitAlias('dayOfYear', 'DDD');
1000
+
1001
+ // PARSING
1002
+
1003
+ addRegexToken('DDD', match1to3);
1004
+ addRegexToken('DDDD', match3);
1005
+ addParseToken(['DDD', 'DDDD'], function (input, array, config) {
1006
+ config._dayOfYear = toInt(input);
1007
+ });
1008
+
1009
+ // HELPERS
1010
+
1011
+ //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
1012
+ function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
1013
+ var d = createUTCDate(year, 0, 1).getUTCDay();
1014
+ var daysToAdd;
1015
+ var dayOfYear;
1016
+
1017
+ d = d === 0 ? 7 : d;
1018
+ weekday = weekday != null ? weekday : firstDayOfWeek;
1019
+ daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
1020
+ dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
1021
+
1022
+ return {
1023
+ year : dayOfYear > 0 ? year : year - 1,
1024
+ dayOfYear : dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
1025
+ };
1026
+ }
1027
+
1028
+ // MOMENTS
1029
+
1030
+ function getSetDayOfYear (input) {
1031
+ var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
1032
+ return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
1033
+ }
1034
+
1035
+ // Pick the first defined of two or three arguments.
1036
+ function defaults(a, b, c) {
1037
+ if (a != null) {
1038
+ return a;
1039
+ }
1040
+ if (b != null) {
1041
+ return b;
1042
+ }
1043
+ return c;
1044
+ }
1045
+
1046
+ function currentDateArray(config) {
1047
+ var now = new Date();
1048
+ if (config._useUTC) {
1049
+ return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
1050
+ }
1051
+ return [now.getFullYear(), now.getMonth(), now.getDate()];
1052
+ }
1053
+
1054
+ // convert an array to a date.
1055
+ // the array should mirror the parameters below
1056
+ // note: all values past the year are optional and will default to the lowest possible value.
1057
+ // [year, month, day , hour, minute, second, millisecond]
1058
+ function configFromArray (config) {
1059
+ var i, date, input = [], currentDate, yearToUse;
1060
+
1061
+ if (config._d) {
1062
+ return;
1063
+ }
1064
+
1065
+ currentDate = currentDateArray(config);
1066
+
1067
+ //compute day of the year from weeks and weekdays
1068
+ if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
1069
+ dayOfYearFromWeekInfo(config);
1070
+ }
1071
+
1072
+ //if the day of the year is set, figure out what it is
1073
+ if (config._dayOfYear) {
1074
+ yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
1075
+
1076
+ if (config._dayOfYear > daysInYear(yearToUse)) {
1077
+ config._pf._overflowDayOfYear = true;
1078
+ }
1079
+
1080
+ date = createUTCDate(yearToUse, 0, config._dayOfYear);
1081
+ config._a[MONTH] = date.getUTCMonth();
1082
+ config._a[DATE] = date.getUTCDate();
1083
+ }
1084
+
1085
+ // Default to current date.
1086
+ // * if no year, month, day of month are given, default to today
1087
+ // * if day of month is given, default month and year
1088
+ // * if month is given, default only year
1089
+ // * if year is given, don't default anything
1090
+ for (i = 0; i < 3 && config._a[i] == null; ++i) {
1091
+ config._a[i] = input[i] = currentDate[i];
1092
+ }
1093
+
1094
+ // Zero out whatever was not defaulted, including time
1095
+ for (; i < 7; i++) {
1096
+ config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
1097
+ }
1098
+
1099
+ // Check for 24:00:00.000
1100
+ if (config._a[HOUR] === 24 &&
1101
+ config._a[MINUTE] === 0 &&
1102
+ config._a[SECOND] === 0 &&
1103
+ config._a[MILLISECOND] === 0) {
1104
+ config._nextDay = true;
1105
+ config._a[HOUR] = 0;
1106
+ }
1107
+
1108
+ config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
1109
+ // Apply timezone offset from input. The actual utcOffset can be changed
1110
+ // with parseZone.
1111
+ if (config._tzm != null) {
1112
+ config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
1113
+ }
1114
+
1115
+ if (config._nextDay) {
1116
+ config._a[HOUR] = 24;
1117
+ }
1118
+ }
1119
+
1120
+ function dayOfYearFromWeekInfo(config) {
1121
+ var w, weekYear, week, weekday, dow, doy, temp;
1122
+
1123
+ w = config._w;
1124
+ if (w.GG != null || w.W != null || w.E != null) {
1125
+ dow = 1;
1126
+ doy = 4;
1127
+
1128
+ // TODO: We need to take the current isoWeekYear, but that depends on
1129
+ // how we interpret now (local, utc, fixed offset). So create
1130
+ // a now version of current config (take local/utc/offset flags, and
1131
+ // create now).
1132
+ weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
1133
+ week = defaults(w.W, 1);
1134
+ weekday = defaults(w.E, 1);
1135
+ } else {
1136
+ dow = config._locale._week.dow;
1137
+ doy = config._locale._week.doy;
1138
+
1139
+ weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
1140
+ week = defaults(w.w, 1);
1141
+
1142
+ if (w.d != null) {
1143
+ // weekday -- low day numbers are considered next week
1144
+ weekday = w.d;
1145
+ if (weekday < dow) {
1146
+ ++week;
1147
+ }
1148
+ } else if (w.e != null) {
1149
+ // local weekday -- counting starts from begining of week
1150
+ weekday = w.e + dow;
1151
+ } else {
1152
+ // default to begining of week
1153
+ weekday = dow;
1154
+ }
1155
+ }
1156
+ temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
1157
+
1158
+ config._a[YEAR] = temp.year;
1159
+ config._dayOfYear = temp.dayOfYear;
1160
+ }
1161
+
1162
+ utils_hooks__hooks.ISO_8601 = function () {};
1163
+
1164
+ // date from string and format string
1165
+ function configFromStringAndFormat(config) {
1166
+ // TODO: Move this to another part of the creation flow to prevent circular deps
1167
+ if (config._f === utils_hooks__hooks.ISO_8601) {
1168
+ configFromISO(config);
1169
+ return;
1170
+ }
1171
+
1172
+ config._a = [];
1173
+ config._pf.empty = true;
1174
+
1175
+ // This array is used to make a Date, either with `new Date` or `Date.UTC`
1176
+ var string = '' + config._i,
1177
+ i, parsedInput, tokens, token, skipped,
1178
+ stringLength = string.length,
1179
+ totalParsedInputLength = 0;
1180
+
1181
+ tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
1182
+
1183
+ for (i = 0; i < tokens.length; i++) {
1184
+ token = tokens[i];
1185
+ parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
1186
+ if (parsedInput) {
1187
+ skipped = string.substr(0, string.indexOf(parsedInput));
1188
+ if (skipped.length > 0) {
1189
+ config._pf.unusedInput.push(skipped);
1190
+ }
1191
+ string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
1192
+ totalParsedInputLength += parsedInput.length;
1193
+ }
1194
+ // don't parse if it's not a known token
1195
+ if (formatTokenFunctions[token]) {
1196
+ if (parsedInput) {
1197
+ config._pf.empty = false;
1198
+ }
1199
+ else {
1200
+ config._pf.unusedTokens.push(token);
1201
+ }
1202
+ addTimeToArrayFromToken(token, parsedInput, config);
1203
+ }
1204
+ else if (config._strict && !parsedInput) {
1205
+ config._pf.unusedTokens.push(token);
1206
+ }
1207
+ }
1208
+
1209
+ // add remaining unparsed input length to the string
1210
+ config._pf.charsLeftOver = stringLength - totalParsedInputLength;
1211
+ if (string.length > 0) {
1212
+ config._pf.unusedInput.push(string);
1213
+ }
1214
+
1215
+ // clear _12h flag if hour is <= 12
1216
+ if (config._pf.bigHour === true && config._a[HOUR] <= 12) {
1217
+ config._pf.bigHour = undefined;
1218
+ }
1219
+ // handle meridiem
1220
+ config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
1221
+
1222
+ configFromArray(config);
1223
+ checkOverflow(config);
1224
+ }
1225
+
1226
+
1227
+ function meridiemFixWrap (locale, hour, meridiem) {
1228
+ var isPm;
1229
+
1230
+ if (meridiem == null) {
1231
+ // nothing to do
1232
+ return hour;
1233
+ }
1234
+ if (locale.meridiemHour != null) {
1235
+ return locale.meridiemHour(hour, meridiem);
1236
+ } else if (locale.isPM != null) {
1237
+ // Fallback
1238
+ isPm = locale.isPM(meridiem);
1239
+ if (isPm && hour < 12) {
1240
+ hour += 12;
1241
+ }
1242
+ if (!isPm && hour === 12) {
1243
+ hour = 0;
1244
+ }
1245
+ return hour;
1246
+ } else {
1247
+ // this is not supposed to happen
1248
+ return hour;
1249
+ }
1250
+ }
1251
+
1252
+ function configFromStringAndArray(config) {
1253
+ var tempConfig,
1254
+ bestMoment,
1255
+
1256
+ scoreToBeat,
1257
+ i,
1258
+ currentScore;
1259
+
1260
+ if (config._f.length === 0) {
1261
+ config._pf.invalidFormat = true;
1262
+ config._d = new Date(NaN);
1263
+ return;
1264
+ }
1265
+
1266
+ for (i = 0; i < config._f.length; i++) {
1267
+ currentScore = 0;
1268
+ tempConfig = copyConfig({}, config);
1269
+ if (config._useUTC != null) {
1270
+ tempConfig._useUTC = config._useUTC;
1271
+ }
1272
+ tempConfig._pf = defaultParsingFlags();
1273
+ tempConfig._f = config._f[i];
1274
+ configFromStringAndFormat(tempConfig);
1275
+
1276
+ if (!valid__isValid(tempConfig)) {
1277
+ continue;
1278
+ }
1279
+
1280
+ // if there is any input that was not parsed add a penalty for that format
1281
+ currentScore += tempConfig._pf.charsLeftOver;
1282
+
1283
+ //or tokens
1284
+ currentScore += tempConfig._pf.unusedTokens.length * 10;
1285
+
1286
+ tempConfig._pf.score = currentScore;
1287
+
1288
+ if (scoreToBeat == null || currentScore < scoreToBeat) {
1289
+ scoreToBeat = currentScore;
1290
+ bestMoment = tempConfig;
1291
+ }
1292
+ }
1293
+
1294
+ extend(config, bestMoment || tempConfig);
1295
+ }
1296
+
1297
+ function configFromObject(config) {
1298
+ if (config._d) {
1299
+ return;
1300
+ }
1301
+
1302
+ var i = normalizeObjectUnits(config._i);
1303
+ config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];
1304
+
1305
+ configFromArray(config);
1306
+ }
1307
+
1308
+ function createFromConfig (config) {
1309
+ var input = config._i,
1310
+ format = config._f,
1311
+ res;
1312
+
1313
+ config._locale = config._locale || locale_locales__getLocale(config._l);
1314
+
1315
+ if (input === null || (format === undefined && input === '')) {
1316
+ return valid__createInvalid({nullInput: true});
1317
+ }
1318
+
1319
+ if (typeof input === 'string') {
1320
+ config._i = input = config._locale.preparse(input);
1321
+ }
1322
+
1323
+ if (isMoment(input)) {
1324
+ return new Moment(checkOverflow(input));
1325
+ } else if (isArray(format)) {
1326
+ configFromStringAndArray(config);
1327
+ } else if (format) {
1328
+ configFromStringAndFormat(config);
1329
+ } else {
1330
+ configFromInput(config);
1331
+ }
1332
+
1333
+ res = new Moment(checkOverflow(config));
1334
+ if (res._nextDay) {
1335
+ // Adding is smart enough around DST
1336
+ res.add(1, 'd');
1337
+ res._nextDay = undefined;
1338
+ }
1339
+
1340
+ return res;
1341
+ }
1342
+
1343
+ function configFromInput(config) {
1344
+ var input = config._i;
1345
+ if (input === undefined) {
1346
+ config._d = new Date();
1347
+ } else if (isDate(input)) {
1348
+ config._d = new Date(+input);
1349
+ } else if (typeof input === 'string') {
1350
+ configFromString(config);
1351
+ } else if (isArray(input)) {
1352
+ config._a = map(input.slice(0), function (obj) {
1353
+ return parseInt(obj, 10);
1354
+ });
1355
+ configFromArray(config);
1356
+ } else if (typeof(input) === 'object') {
1357
+ configFromObject(config);
1358
+ } else if (typeof(input) === 'number') {
1359
+ // from milliseconds
1360
+ config._d = new Date(input);
1361
+ } else {
1362
+ utils_hooks__hooks.createFromInputFallback(config);
1363
+ }
1364
+ }
1365
+
1366
+ function createLocalOrUTC (input, format, locale, strict, isUTC) {
1367
+ var c = {};
1368
+
1369
+ if (typeof(locale) === 'boolean') {
1370
+ strict = locale;
1371
+ locale = undefined;
1372
+ }
1373
+ // object construction must be done this way.
1374
+ // https://github.com/moment/moment/issues/1423
1375
+ c._isAMomentObject = true;
1376
+ c._useUTC = c._isUTC = isUTC;
1377
+ c._l = locale;
1378
+ c._i = input;
1379
+ c._f = format;
1380
+ c._strict = strict;
1381
+ c._pf = defaultParsingFlags();
1382
+
1383
+ return createFromConfig(c);
1384
+ }
1385
+
1386
+ function local__createLocal (input, format, locale, strict) {
1387
+ return createLocalOrUTC(input, format, locale, strict, false);
1388
+ }
1389
+
1390
+ var prototypeMin = deprecate(
1391
+ 'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
1392
+ function () {
1393
+ var other = local__createLocal.apply(null, arguments);
1394
+ return other < this ? this : other;
1395
+ }
1396
+ );
1397
+
1398
+ var prototypeMax = deprecate(
1399
+ 'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
1400
+ function () {
1401
+ var other = local__createLocal.apply(null, arguments);
1402
+ return other > this ? this : other;
1403
+ }
1404
+ );
1405
+
1406
+ // Pick a moment m from moments so that m[fn](other) is true for all
1407
+ // other. This relies on the function fn to be transitive.
1408
+ //
1409
+ // moments should either be an array of moment objects or an array, whose
1410
+ // first element is an array of moment objects.
1411
+ function pickBy(fn, moments) {
1412
+ var res, i;
1413
+ if (moments.length === 1 && isArray(moments[0])) {
1414
+ moments = moments[0];
1415
+ }
1416
+ if (!moments.length) {
1417
+ return local__createLocal();
1418
+ }
1419
+ res = moments[0];
1420
+ for (i = 1; i < moments.length; ++i) {
1421
+ if (moments[i][fn](res)) {
1422
+ res = moments[i];
1423
+ }
1424
+ }
1425
+ return res;
1426
+ }
1427
+
1428
+ // TODO: Use [].sort instead?
1429
+ function min () {
1430
+ var args = [].slice.call(arguments, 0);
1431
+
1432
+ return pickBy('isBefore', args);
1433
+ }
1434
+
1435
+ function max () {
1436
+ var args = [].slice.call(arguments, 0);
1437
+
1438
+ return pickBy('isAfter', args);
1439
+ }
1440
+
1441
+ function Duration (duration) {
1442
+ var normalizedInput = normalizeObjectUnits(duration),
1443
+ years = normalizedInput.year || 0,
1444
+ quarters = normalizedInput.quarter || 0,
1445
+ months = normalizedInput.month || 0,
1446
+ weeks = normalizedInput.week || 0,
1447
+ days = normalizedInput.day || 0,
1448
+ hours = normalizedInput.hour || 0,
1449
+ minutes = normalizedInput.minute || 0,
1450
+ seconds = normalizedInput.second || 0,
1451
+ milliseconds = normalizedInput.millisecond || 0;
1452
+
1453
+ // representation for dateAddRemove
1454
+ this._milliseconds = +milliseconds +
1455
+ seconds * 1e3 + // 1000
1456
+ minutes * 6e4 + // 1000 * 60
1457
+ hours * 36e5; // 1000 * 60 * 60
1458
+ // Because of dateAddRemove treats 24 hours as different from a
1459
+ // day when working around DST, we need to store them separately
1460
+ this._days = +days +
1461
+ weeks * 7;
1462
+ // It is impossible translate months into days without knowing
1463
+ // which months you are are talking about, so we have to store
1464
+ // it separately.
1465
+ this._months = +months +
1466
+ quarters * 3 +
1467
+ years * 12;
1468
+
1469
+ this._data = {};
1470
+
1471
+ this._locale = locale_locales__getLocale();
1472
+
1473
+ this._bubble();
1474
+ }
1475
+
1476
+ function isDuration (obj) {
1477
+ return obj instanceof Duration;
1478
+ }
1479
+
1480
+ function offset (token, separator) {
1481
+ addFormatToken(token, 0, 0, function () {
1482
+ var offset = this.utcOffset();
1483
+ var sign = '+';
1484
+ if (offset < 0) {
1485
+ offset = -offset;
1486
+ sign = '-';
1487
+ }
1488
+ return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
1489
+ });
1490
+ }
1491
+
1492
+ offset('Z', ':');
1493
+ offset('ZZ', '');
1494
+
1495
+ // PARSING
1496
+
1497
+ addRegexToken('Z', matchOffset);
1498
+ addRegexToken('ZZ', matchOffset);
1499
+ addParseToken(['Z', 'ZZ'], function (input, array, config) {
1500
+ config._useUTC = true;
1501
+ config._tzm = offsetFromString(input);
1502
+ });
1503
+
1504
+ // HELPERS
1505
+
1506
+ // timezone chunker
1507
+ // '+10:00' > ['10', '00']
1508
+ // '-1530' > ['-15', '30']
1509
+ var chunkOffset = /([\+\-]|\d\d)/gi;
1510
+
1511
+ function offsetFromString(string) {
1512
+ var matches = ((string || '').match(matchOffset) || []);
1513
+ var chunk = matches[matches.length - 1] || [];
1514
+ var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
1515
+ var minutes = +(parts[1] * 60) + toInt(parts[2]);
1516
+
1517
+ return parts[0] === '+' ? minutes : -minutes;
1518
+ }
1519
+
1520
+ // Return a moment from input, that is local/utc/zone equivalent to model.
1521
+ function cloneWithOffset(input, model) {
1522
+ var res, diff;
1523
+ if (model._isUTC) {
1524
+ res = model.clone();
1525
+ diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
1526
+ // Use low-level api, because this fn is low-level api.
1527
+ res._d.setTime(+res._d + diff);
1528
+ utils_hooks__hooks.updateOffset(res, false);
1529
+ return res;
1530
+ } else {
1531
+ return local__createLocal(input).local();
1532
+ }
1533
+ return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local();
1534
+ }
1535
+
1536
+ function getDateOffset (m) {
1537
+ // On Firefox.24 Date#getTimezoneOffset returns a floating point.
1538
+ // https://github.com/moment/moment/pull/1871
1539
+ return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
1540
+ }
1541
+
1542
+ // HOOKS
1543
+
1544
+ // This function will be called whenever a moment is mutated.
1545
+ // It is intended to keep the offset in sync with the timezone.
1546
+ utils_hooks__hooks.updateOffset = function () {};
1547
+
1548
+ // MOMENTS
1549
+
1550
+ // keepLocalTime = true means only change the timezone, without
1551
+ // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
1552
+ // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
1553
+ // +0200, so we adjust the time as needed, to be valid.
1554
+ //
1555
+ // Keeping the time actually adds/subtracts (one hour)
1556
+ // from the actual represented time. That is why we call updateOffset
1557
+ // a second time. In case it wants us to change the offset again
1558
+ // _changeInProgress == true case, then we have to adjust, because
1559
+ // there is no such time in the given timezone.
1560
+ function getSetOffset (input, keepLocalTime) {
1561
+ var offset = this._offset || 0,
1562
+ localAdjust;
1563
+ if (input != null) {
1564
+ if (typeof input === 'string') {
1565
+ input = offsetFromString(input);
1566
+ }
1567
+ if (Math.abs(input) < 16) {
1568
+ input = input * 60;
1569
+ }
1570
+ if (!this._isUTC && keepLocalTime) {
1571
+ localAdjust = getDateOffset(this);
1572
+ }
1573
+ this._offset = input;
1574
+ this._isUTC = true;
1575
+ if (localAdjust != null) {
1576
+ this.add(localAdjust, 'm');
1577
+ }
1578
+ if (offset !== input) {
1579
+ if (!keepLocalTime || this._changeInProgress) {
1580
+ add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
1581
+ } else if (!this._changeInProgress) {
1582
+ this._changeInProgress = true;
1583
+ utils_hooks__hooks.updateOffset(this, true);
1584
+ this._changeInProgress = null;
1585
+ }
1586
+ }
1587
+ return this;
1588
+ } else {
1589
+ return this._isUTC ? offset : getDateOffset(this);
1590
+ }
1591
+ }
1592
+
1593
+ function getSetZone (input, keepLocalTime) {
1594
+ if (input != null) {
1595
+ if (typeof input !== 'string') {
1596
+ input = -input;
1597
+ }
1598
+
1599
+ this.utcOffset(input, keepLocalTime);
1600
+
1601
+ return this;
1602
+ } else {
1603
+ return -this.utcOffset();
1604
+ }
1605
+ }
1606
+
1607
+ function setOffsetToUTC (keepLocalTime) {
1608
+ return this.utcOffset(0, keepLocalTime);
1609
+ }
1610
+
1611
+ function setOffsetToLocal (keepLocalTime) {
1612
+ if (this._isUTC) {
1613
+ this.utcOffset(0, keepLocalTime);
1614
+ this._isUTC = false;
1615
+
1616
+ if (keepLocalTime) {
1617
+ this.subtract(getDateOffset(this), 'm');
1618
+ }
1619
+ }
1620
+ return this;
1621
+ }
1622
+
1623
+ function setOffsetToParsedOffset () {
1624
+ if (this._tzm) {
1625
+ this.utcOffset(this._tzm);
1626
+ } else if (typeof this._i === 'string') {
1627
+ this.utcOffset(offsetFromString(this._i));
1628
+ }
1629
+ return this;
1630
+ }
1631
+
1632
+ function hasAlignedHourOffset (input) {
1633
+ if (!input) {
1634
+ input = 0;
1635
+ }
1636
+ else {
1637
+ input = local__createLocal(input).utcOffset();
1638
+ }
1639
+
1640
+ return (this.utcOffset() - input) % 60 === 0;
1641
+ }
1642
+
1643
+ function isDaylightSavingTime () {
1644
+ return (
1645
+ this.utcOffset() > this.clone().month(0).utcOffset() ||
1646
+ this.utcOffset() > this.clone().month(5).utcOffset()
1647
+ );
1648
+ }
1649
+
1650
+ function isDaylightSavingTimeShifted () {
1651
+ if (this._a) {
1652
+ var other = this._isUTC ? create_utc__createUTC(this._a) : local__createLocal(this._a);
1653
+ return this.isValid() && compareArrays(this._a, other.toArray()) > 0;
1654
+ }
1655
+
1656
+ return false;
1657
+ }
1658
+
1659
+ function isLocal () {
1660
+ return !this._isUTC;
1661
+ }
1662
+
1663
+ function isUtcOffset () {
1664
+ return this._isUTC;
1665
+ }
1666
+
1667
+ function isUtc () {
1668
+ return this._isUTC && this._offset === 0;
1669
+ }
1670
+
1671
+ var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;
1672
+
1673
+ // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
1674
+ // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
1675
+ var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;
1676
+
1677
+ function create__createDuration (input, key) {
1678
+ var duration = input,
1679
+ // matching against regexp is expensive, do it on demand
1680
+ match = null,
1681
+ sign,
1682
+ ret,
1683
+ diffRes;
1684
+
1685
+ if (isDuration(input)) {
1686
+ duration = {
1687
+ ms : input._milliseconds,
1688
+ d : input._days,
1689
+ M : input._months
1690
+ };
1691
+ } else if (typeof input === 'number') {
1692
+ duration = {};
1693
+ if (key) {
1694
+ duration[key] = input;
1695
+ } else {
1696
+ duration.milliseconds = input;
1697
+ }
1698
+ } else if (!!(match = aspNetRegex.exec(input))) {
1699
+ sign = (match[1] === '-') ? -1 : 1;
1700
+ duration = {
1701
+ y : 0,
1702
+ d : toInt(match[DATE]) * sign,
1703
+ h : toInt(match[HOUR]) * sign,
1704
+ m : toInt(match[MINUTE]) * sign,
1705
+ s : toInt(match[SECOND]) * sign,
1706
+ ms : toInt(match[MILLISECOND]) * sign
1707
+ };
1708
+ } else if (!!(match = create__isoRegex.exec(input))) {
1709
+ sign = (match[1] === '-') ? -1 : 1;
1710
+ duration = {
1711
+ y : parseIso(match[2], sign),
1712
+ M : parseIso(match[3], sign),
1713
+ d : parseIso(match[4], sign),
1714
+ h : parseIso(match[5], sign),
1715
+ m : parseIso(match[6], sign),
1716
+ s : parseIso(match[7], sign),
1717
+ w : parseIso(match[8], sign)
1718
+ };
1719
+ } else if (duration == null) {// checks for null or undefined
1720
+ duration = {};
1721
+ } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
1722
+ diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));
1723
+
1724
+ duration = {};
1725
+ duration.ms = diffRes.milliseconds;
1726
+ duration.M = diffRes.months;
1727
+ }
1728
+
1729
+ ret = new Duration(duration);
1730
+
1731
+ if (isDuration(input) && hasOwnProp(input, '_locale')) {
1732
+ ret._locale = input._locale;
1733
+ }
1734
+
1735
+ return ret;
1736
+ }
1737
+
1738
+ create__createDuration.fn = Duration.prototype;
1739
+
1740
+ function parseIso (inp, sign) {
1741
+ // We'd normally use ~~inp for this, but unfortunately it also
1742
+ // converts floats to ints.
1743
+ // inp may be undefined, so careful calling replace on it.
1744
+ var res = inp && parseFloat(inp.replace(',', '.'));
1745
+ // apply sign while we're at it
1746
+ return (isNaN(res) ? 0 : res) * sign;
1747
+ }
1748
+
1749
+ function positiveMomentsDifference(base, other) {
1750
+ var res = {milliseconds: 0, months: 0};
1751
+
1752
+ res.months = other.month() - base.month() +
1753
+ (other.year() - base.year()) * 12;
1754
+ if (base.clone().add(res.months, 'M').isAfter(other)) {
1755
+ --res.months;
1756
+ }
1757
+
1758
+ res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
1759
+
1760
+ return res;
1761
+ }
1762
+
1763
+ function momentsDifference(base, other) {
1764
+ var res;
1765
+ other = cloneWithOffset(other, base);
1766
+ if (base.isBefore(other)) {
1767
+ res = positiveMomentsDifference(base, other);
1768
+ } else {
1769
+ res = positiveMomentsDifference(other, base);
1770
+ res.milliseconds = -res.milliseconds;
1771
+ res.months = -res.months;
1772
+ }
1773
+
1774
+ return res;
1775
+ }
1776
+
1777
+ function createAdder(direction, name) {
1778
+ return function (val, period) {
1779
+ var dur, tmp;
1780
+ //invert the arguments, but complain about it
1781
+ if (period !== null && !isNaN(+period)) {
1782
+ deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
1783
+ tmp = val; val = period; period = tmp;
1784
+ }
1785
+
1786
+ val = typeof val === 'string' ? +val : val;
1787
+ dur = create__createDuration(val, period);
1788
+ add_subtract__addSubtract(this, dur, direction);
1789
+ return this;
1790
+ };
1791
+ }
1792
+
1793
+ function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
1794
+ var milliseconds = duration._milliseconds,
1795
+ days = duration._days,
1796
+ months = duration._months;
1797
+ updateOffset = updateOffset == null ? true : updateOffset;
1798
+
1799
+ if (milliseconds) {
1800
+ mom._d.setTime(+mom._d + milliseconds * isAdding);
1801
+ }
1802
+ if (days) {
1803
+ get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
1804
+ }
1805
+ if (months) {
1806
+ setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
1807
+ }
1808
+ if (updateOffset) {
1809
+ utils_hooks__hooks.updateOffset(mom, days || months);
1810
+ }
1811
+ }
1812
+
1813
+ var add_subtract__add = createAdder(1, 'add');
1814
+ var add_subtract__subtract = createAdder(-1, 'subtract');
1815
+
1816
+ function moment_calendar__calendar (time) {
1817
+ // We want to compare the start of today, vs this.
1818
+ // Getting start-of-today depends on whether we're local/utc/offset or not.
1819
+ var now = time || local__createLocal(),
1820
+ sod = cloneWithOffset(now, this).startOf('day'),
1821
+ diff = this.diff(sod, 'days', true),
1822
+ format = diff < -6 ? 'sameElse' :
1823
+ diff < -1 ? 'lastWeek' :
1824
+ diff < 0 ? 'lastDay' :
1825
+ diff < 1 ? 'sameDay' :
1826
+ diff < 2 ? 'nextDay' :
1827
+ diff < 7 ? 'nextWeek' : 'sameElse';
1828
+ return this.format(this.localeData().calendar(format, this, local__createLocal(now)));
1829
+ }
1830
+
1831
+ function clone () {
1832
+ return new Moment(this);
1833
+ }
1834
+
1835
+ function isAfter (input, units) {
1836
+ var inputMs;
1837
+ units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
1838
+ if (units === 'millisecond') {
1839
+ input = isMoment(input) ? input : local__createLocal(input);
1840
+ return +this > +input;
1841
+ } else {
1842
+ inputMs = isMoment(input) ? +input : +local__createLocal(input);
1843
+ return inputMs < +this.clone().startOf(units);
1844
+ }
1845
+ }
1846
+
1847
+ function isBefore (input, units) {
1848
+ var inputMs;
1849
+ units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
1850
+ if (units === 'millisecond') {
1851
+ input = isMoment(input) ? input : local__createLocal(input);
1852
+ return +this < +input;
1853
+ } else {
1854
+ inputMs = isMoment(input) ? +input : +local__createLocal(input);
1855
+ return +this.clone().endOf(units) < inputMs;
1856
+ }
1857
+ }
1858
+
1859
+ function isBetween (from, to, units) {
1860
+ return this.isAfter(from, units) && this.isBefore(to, units);
1861
+ }
1862
+
1863
+ function isSame (input, units) {
1864
+ var inputMs;
1865
+ units = normalizeUnits(units || 'millisecond');
1866
+ if (units === 'millisecond') {
1867
+ input = isMoment(input) ? input : local__createLocal(input);
1868
+ return +this === +input;
1869
+ } else {
1870
+ inputMs = +local__createLocal(input);
1871
+ return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
1872
+ }
1873
+ }
1874
+
1875
+ function absFloor (number) {
1876
+ if (number < 0) {
1877
+ return Math.ceil(number);
1878
+ } else {
1879
+ return Math.floor(number);
1880
+ }
1881
+ }
1882
+
1883
+ function diff (input, units, asFloat) {
1884
+ var that = cloneWithOffset(input, this),
1885
+ zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
1886
+ delta, output;
1887
+
1888
+ units = normalizeUnits(units);
1889
+
1890
+ if (units === 'year' || units === 'month' || units === 'quarter') {
1891
+ output = monthDiff(this, that);
1892
+ if (units === 'quarter') {
1893
+ output = output / 3;
1894
+ } else if (units === 'year') {
1895
+ output = output / 12;
1896
+ }
1897
+ } else {
1898
+ delta = this - that;
1899
+ output = units === 'second' ? delta / 1e3 : // 1000
1900
+ units === 'minute' ? delta / 6e4 : // 1000 * 60
1901
+ units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
1902
+ units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
1903
+ units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
1904
+ delta;
1905
+ }
1906
+ return asFloat ? output : absFloor(output);
1907
+ }
1908
+
1909
+ function monthDiff (a, b) {
1910
+ // difference in months
1911
+ var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
1912
+ // b is in (anchor - 1 month, anchor + 1 month)
1913
+ anchor = a.clone().add(wholeMonthDiff, 'months'),
1914
+ anchor2, adjust;
1915
+
1916
+ if (b - anchor < 0) {
1917
+ anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
1918
+ // linear across the month
1919
+ adjust = (b - anchor) / (anchor - anchor2);
1920
+ } else {
1921
+ anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
1922
+ // linear across the month
1923
+ adjust = (b - anchor) / (anchor2 - anchor);
1924
+ }
1925
+
1926
+ return -(wholeMonthDiff + adjust);
1927
+ }
1928
+
1929
+ utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
1930
+
1931
+ function toString () {
1932
+ return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
1933
+ }
1934
+
1935
+ function moment_format__toISOString () {
1936
+ var m = this.clone().utc();
1937
+ if (0 < m.year() && m.year() <= 9999) {
1938
+ if ('function' === typeof Date.prototype.toISOString) {
1939
+ // native implementation is ~50x faster, use it when we can
1940
+ return this.toDate().toISOString();
1941
+ } else {
1942
+ return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
1943
+ }
1944
+ } else {
1945
+ return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
1946
+ }
1947
+ }
1948
+
1949
+ function format (inputString) {
1950
+ var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
1951
+ return this.localeData().postformat(output);
1952
+ }
1953
+
1954
+ function from (time, withoutSuffix) {
1955
+ return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
1956
+ }
1957
+
1958
+ function fromNow (withoutSuffix) {
1959
+ return this.from(local__createLocal(), withoutSuffix);
1960
+ }
1961
+
1962
+ function locale (key) {
1963
+ var newLocaleData;
1964
+
1965
+ if (key === undefined) {
1966
+ return this._locale._abbr;
1967
+ } else {
1968
+ newLocaleData = locale_locales__getLocale(key);
1969
+ if (newLocaleData != null) {
1970
+ this._locale = newLocaleData;
1971
+ }
1972
+ return this;
1973
+ }
1974
+ }
1975
+
1976
+ var lang = deprecate(
1977
+ 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
1978
+ function (key) {
1979
+ if (key === undefined) {
1980
+ return this.localeData();
1981
+ } else {
1982
+ return this.locale(key);
1983
+ }
1984
+ }
1985
+ );
1986
+
1987
+ function localeData () {
1988
+ return this._locale;
1989
+ }
1990
+
1991
+ function startOf (units) {
1992
+ units = normalizeUnits(units);
1993
+ // the following switch intentionally omits break keywords
1994
+ // to utilize falling through the cases.
1995
+ switch (units) {
1996
+ case 'year':
1997
+ this.month(0);
1998
+ /* falls through */
1999
+ case 'quarter':
2000
+ case 'month':
2001
+ this.date(1);
2002
+ /* falls through */
2003
+ case 'week':
2004
+ case 'isoWeek':
2005
+ case 'day':
2006
+ this.hours(0);
2007
+ /* falls through */
2008
+ case 'hour':
2009
+ this.minutes(0);
2010
+ /* falls through */
2011
+ case 'minute':
2012
+ this.seconds(0);
2013
+ /* falls through */
2014
+ case 'second':
2015
+ this.milliseconds(0);
2016
+ }
2017
+
2018
+ // weeks are a special case
2019
+ if (units === 'week') {
2020
+ this.weekday(0);
2021
+ }
2022
+ if (units === 'isoWeek') {
2023
+ this.isoWeekday(1);
2024
+ }
2025
+
2026
+ // quarters are also special
2027
+ if (units === 'quarter') {
2028
+ this.month(Math.floor(this.month() / 3) * 3);
2029
+ }
2030
+
2031
+ return this;
2032
+ }
2033
+
2034
+ function endOf (units) {
2035
+ units = normalizeUnits(units);
2036
+ if (units === undefined || units === 'millisecond') {
2037
+ return this;
2038
+ }
2039
+ return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
2040
+ }
2041
+
2042
+ function to_type__valueOf () {
2043
+ return +this._d - ((this._offset || 0) * 60000);
2044
+ }
2045
+
2046
+ function unix () {
2047
+ return Math.floor(+this / 1000);
2048
+ }
2049
+
2050
+ function toDate () {
2051
+ return this._offset ? new Date(+this) : this._d;
2052
+ }
2053
+
2054
+ function toArray () {
2055
+ var m = this;
2056
+ return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
2057
+ }
2058
+
2059
+ function moment_valid__isValid () {
2060
+ return valid__isValid(this);
2061
+ }
2062
+
2063
+ function parsingFlags () {
2064
+ return extend({}, this._pf);
2065
+ }
2066
+
2067
+ function invalidAt () {
2068
+ return this._pf.overflow;
2069
+ }
2070
+
2071
+ addFormatToken(0, ['gg', 2], 0, function () {
2072
+ return this.weekYear() % 100;
2073
+ });
2074
+
2075
+ addFormatToken(0, ['GG', 2], 0, function () {
2076
+ return this.isoWeekYear() % 100;
2077
+ });
2078
+
2079
+ function addWeekYearFormatToken (token, getter) {
2080
+ addFormatToken(0, [token, token.length], 0, getter);
2081
+ }
2082
+
2083
+ addWeekYearFormatToken('gggg', 'weekYear');
2084
+ addWeekYearFormatToken('ggggg', 'weekYear');
2085
+ addWeekYearFormatToken('GGGG', 'isoWeekYear');
2086
+ addWeekYearFormatToken('GGGGG', 'isoWeekYear');
2087
+
2088
+ // ALIASES
2089
+
2090
+ addUnitAlias('weekYear', 'gg');
2091
+ addUnitAlias('isoWeekYear', 'GG');
2092
+
2093
+ // PARSING
2094
+
2095
+ addRegexToken('G', matchSigned);
2096
+ addRegexToken('g', matchSigned);
2097
+ addRegexToken('GG', match1to2, match2);
2098
+ addRegexToken('gg', match1to2, match2);
2099
+ addRegexToken('GGGG', match1to4, match4);
2100
+ addRegexToken('gggg', match1to4, match4);
2101
+ addRegexToken('GGGGG', match1to6, match6);
2102
+ addRegexToken('ggggg', match1to6, match6);
2103
+
2104
+ addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
2105
+ week[token.substr(0, 2)] = toInt(input);
2106
+ });
2107
+
2108
+ addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
2109
+ week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
2110
+ });
2111
+
2112
+ // HELPERS
2113
+
2114
+ function weeksInYear(year, dow, doy) {
2115
+ return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
2116
+ }
2117
+
2118
+ // MOMENTS
2119
+
2120
+ function getSetWeekYear (input) {
2121
+ var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
2122
+ return input == null ? year : this.add((input - year), 'y');
2123
+ }
2124
+
2125
+ function getSetISOWeekYear (input) {
2126
+ var year = weekOfYear(this, 1, 4).year;
2127
+ return input == null ? year : this.add((input - year), 'y');
2128
+ }
2129
+
2130
+ function getISOWeeksInYear () {
2131
+ return weeksInYear(this.year(), 1, 4);
2132
+ }
2133
+
2134
+ function getWeeksInYear () {
2135
+ var weekInfo = this.localeData()._week;
2136
+ return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
2137
+ }
2138
+
2139
+ addFormatToken('Q', 0, 0, 'quarter');
2140
+
2141
+ // ALIASES
2142
+
2143
+ addUnitAlias('quarter', 'Q');
2144
+
2145
+ // PARSING
2146
+
2147
+ addRegexToken('Q', match1);
2148
+ addParseToken('Q', function (input, array) {
2149
+ array[MONTH] = (toInt(input) - 1) * 3;
2150
+ });
2151
+
2152
+ // MOMENTS
2153
+
2154
+ function getSetQuarter (input) {
2155
+ return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
2156
+ }
2157
+
2158
+ addFormatToken('D', ['DD', 2], 'Do', 'date');
2159
+
2160
+ // ALIASES
2161
+
2162
+ addUnitAlias('date', 'D');
2163
+
2164
+ // PARSING
2165
+
2166
+ addRegexToken('D', match1to2);
2167
+ addRegexToken('DD', match1to2, match2);
2168
+ addRegexToken('Do', function (isStrict, locale) {
2169
+ return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
2170
+ });
2171
+
2172
+ addParseToken(['D', 'DD'], DATE);
2173
+ addParseToken('Do', function (input, array) {
2174
+ array[DATE] = toInt(input.match(match1to2)[0], 10);
2175
+ });
2176
+
2177
+ // MOMENTS
2178
+
2179
+ var getSetDayOfMonth = makeGetSet('Date', true);
2180
+
2181
+ addFormatToken('d', 0, 'do', 'day');
2182
+
2183
+ addFormatToken('dd', 0, 0, function (format) {
2184
+ return this.localeData().weekdaysMin(this, format);
2185
+ });
2186
+
2187
+ addFormatToken('ddd', 0, 0, function (format) {
2188
+ return this.localeData().weekdaysShort(this, format);
2189
+ });
2190
+
2191
+ addFormatToken('dddd', 0, 0, function (format) {
2192
+ return this.localeData().weekdays(this, format);
2193
+ });
2194
+
2195
+ addFormatToken('e', 0, 0, 'weekday');
2196
+ addFormatToken('E', 0, 0, 'isoWeekday');
2197
+
2198
+ // ALIASES
2199
+
2200
+ addUnitAlias('day', 'd');
2201
+ addUnitAlias('weekday', 'e');
2202
+ addUnitAlias('isoWeekday', 'E');
2203
+
2204
+ // PARSING
2205
+
2206
+ addRegexToken('d', match1to2);
2207
+ addRegexToken('e', match1to2);
2208
+ addRegexToken('E', match1to2);
2209
+ addRegexToken('dd', matchWord);
2210
+ addRegexToken('ddd', matchWord);
2211
+ addRegexToken('dddd', matchWord);
2212
+
2213
+ addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
2214
+ var weekday = config._locale.weekdaysParse(input);
2215
+ // if we didn't get a weekday name, mark the date as invalid
2216
+ if (weekday != null) {
2217
+ week.d = weekday;
2218
+ } else {
2219
+ config._pf.invalidWeekday = input;
2220
+ }
2221
+ });
2222
+
2223
+ addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
2224
+ week[token] = toInt(input);
2225
+ });
2226
+
2227
+ // HELPERS
2228
+
2229
+ function parseWeekday(input, locale) {
2230
+ if (typeof input === 'string') {
2231
+ if (!isNaN(input)) {
2232
+ input = parseInt(input, 10);
2233
+ }
2234
+ else {
2235
+ input = locale.weekdaysParse(input);
2236
+ if (typeof input !== 'number') {
2237
+ return null;
2238
+ }
2239
+ }
2240
+ }
2241
+ return input;
2242
+ }
2243
+
2244
+ // LOCALES
2245
+
2246
+ var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
2247
+ function localeWeekdays (m) {
2248
+ return this._weekdays[m.day()];
2249
+ }
2250
+
2251
+ var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
2252
+ function localeWeekdaysShort (m) {
2253
+ return this._weekdaysShort[m.day()];
2254
+ }
2255
+
2256
+ var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
2257
+ function localeWeekdaysMin (m) {
2258
+ return this._weekdaysMin[m.day()];
2259
+ }
2260
+
2261
+ function localeWeekdaysParse (weekdayName) {
2262
+ var i, mom, regex;
2263
+
2264
+ if (!this._weekdaysParse) {
2265
+ this._weekdaysParse = [];
2266
+ }
2267
+
2268
+ for (i = 0; i < 7; i++) {
2269
+ // make the regex if we don't have it already
2270
+ if (!this._weekdaysParse[i]) {
2271
+ mom = local__createLocal([2000, 1]).day(i);
2272
+ regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
2273
+ this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
2274
+ }
2275
+ // test the regex
2276
+ if (this._weekdaysParse[i].test(weekdayName)) {
2277
+ return i;
2278
+ }
2279
+ }
2280
+ }
2281
+
2282
+ // MOMENTS
2283
+
2284
+ function getSetDayOfWeek (input) {
2285
+ var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
2286
+ if (input != null) {
2287
+ input = parseWeekday(input, this.localeData());
2288
+ return this.add(input - day, 'd');
2289
+ } else {
2290
+ return day;
2291
+ }
2292
+ }
2293
+
2294
+ function getSetLocaleDayOfWeek (input) {
2295
+ var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
2296
+ return input == null ? weekday : this.add(input - weekday, 'd');
2297
+ }
2298
+
2299
+ function getSetISODayOfWeek (input) {
2300
+ // behaves the same as moment#day except
2301
+ // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
2302
+ // as a setter, sunday should belong to the previous week.
2303
+ return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
2304
+ }
2305
+
2306
+ addFormatToken('H', ['HH', 2], 0, 'hour');
2307
+ addFormatToken('h', ['hh', 2], 0, function () {
2308
+ return this.hours() % 12 || 12;
2309
+ });
2310
+
2311
+ function meridiem (token, lowercase) {
2312
+ addFormatToken(token, 0, 0, function () {
2313
+ return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
2314
+ });
2315
+ }
2316
+
2317
+ meridiem('a', true);
2318
+ meridiem('A', false);
2319
+
2320
+ // ALIASES
2321
+
2322
+ addUnitAlias('hour', 'h');
2323
+
2324
+ // PARSING
2325
+
2326
+ function matchMeridiem (isStrict, locale) {
2327
+ return locale._meridiemParse;
2328
+ }
2329
+
2330
+ addRegexToken('a', matchMeridiem);
2331
+ addRegexToken('A', matchMeridiem);
2332
+ addRegexToken('H', match1to2);
2333
+ addRegexToken('h', match1to2);
2334
+ addRegexToken('HH', match1to2, match2);
2335
+ addRegexToken('hh', match1to2, match2);
2336
+
2337
+ addParseToken(['H', 'HH'], HOUR);
2338
+ addParseToken(['a', 'A'], function (input, array, config) {
2339
+ config._isPm = config._locale.isPM(input);
2340
+ config._meridiem = input;
2341
+ });
2342
+ addParseToken(['h', 'hh'], function (input, array, config) {
2343
+ array[HOUR] = toInt(input);
2344
+ config._pf.bigHour = true;
2345
+ });
2346
+
2347
+ // LOCALES
2348
+
2349
+ function localeIsPM (input) {
2350
+ // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
2351
+ // Using charAt should be more compatible.
2352
+ return ((input + '').toLowerCase().charAt(0) === 'p');
2353
+ }
2354
+
2355
+ var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
2356
+ function localeMeridiem (hours, minutes, isLower) {
2357
+ if (hours > 11) {
2358
+ return isLower ? 'pm' : 'PM';
2359
+ } else {
2360
+ return isLower ? 'am' : 'AM';
2361
+ }
2362
+ }
2363
+
2364
+
2365
+ // MOMENTS
2366
+
2367
+ // Setting the hour should keep the time, because the user explicitly
2368
+ // specified which hour he wants. So trying to maintain the same hour (in
2369
+ // a new timezone) makes sense. Adding/subtracting hours does not follow
2370
+ // this rule.
2371
+ var getSetHour = makeGetSet('Hours', true);
2372
+
2373
+ addFormatToken('m', ['mm', 2], 0, 'minute');
2374
+
2375
+ // ALIASES
2376
+
2377
+ addUnitAlias('minute', 'm');
2378
+
2379
+ // PARSING
2380
+
2381
+ addRegexToken('m', match1to2);
2382
+ addRegexToken('mm', match1to2, match2);
2383
+ addParseToken(['m', 'mm'], MINUTE);
2384
+
2385
+ // MOMENTS
2386
+
2387
+ var getSetMinute = makeGetSet('Minutes', false);
2388
+
2389
+ addFormatToken('s', ['ss', 2], 0, 'second');
2390
+
2391
+ // ALIASES
2392
+
2393
+ addUnitAlias('second', 's');
2394
+
2395
+ // PARSING
2396
+
2397
+ addRegexToken('s', match1to2);
2398
+ addRegexToken('ss', match1to2, match2);
2399
+ addParseToken(['s', 'ss'], SECOND);
2400
+
2401
+ // MOMENTS
2402
+
2403
+ var getSetSecond = makeGetSet('Seconds', false);
2404
+
2405
+ addFormatToken('S', 0, 0, function () {
2406
+ return ~~(this.millisecond() / 100);
2407
+ });
2408
+
2409
+ addFormatToken(0, ['SS', 2], 0, function () {
2410
+ return ~~(this.millisecond() / 10);
2411
+ });
2412
+
2413
+ function millisecond__milliseconds (token) {
2414
+ addFormatToken(0, [token, 3], 0, 'millisecond');
2415
+ }
2416
+
2417
+ millisecond__milliseconds('SSS');
2418
+ millisecond__milliseconds('SSSS');
2419
+
2420
+ // ALIASES
2421
+
2422
+ addUnitAlias('millisecond', 'ms');
2423
+
2424
+ // PARSING
2425
+
2426
+ addRegexToken('S', match1to3, match1);
2427
+ addRegexToken('SS', match1to3, match2);
2428
+ addRegexToken('SSS', match1to3, match3);
2429
+ addRegexToken('SSSS', matchUnsigned);
2430
+ addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) {
2431
+ array[MILLISECOND] = toInt(('0.' + input) * 1000);
2432
+ });
2433
+
2434
+ // MOMENTS
2435
+
2436
+ var getSetMillisecond = makeGetSet('Milliseconds', false);
2437
+
2438
+ addFormatToken('z', 0, 0, 'zoneAbbr');
2439
+ addFormatToken('zz', 0, 0, 'zoneName');
2440
+
2441
+ // MOMENTS
2442
+
2443
+ function getZoneAbbr () {
2444
+ return this._isUTC ? 'UTC' : '';
2445
+ }
2446
+
2447
+ function getZoneName () {
2448
+ return this._isUTC ? 'Coordinated Universal Time' : '';
2449
+ }
2450
+
2451
+ var momentPrototype__proto = Moment.prototype;
2452
+
2453
+ momentPrototype__proto.add = add_subtract__add;
2454
+ momentPrototype__proto.calendar = moment_calendar__calendar;
2455
+ momentPrototype__proto.clone = clone;
2456
+ momentPrototype__proto.diff = diff;
2457
+ momentPrototype__proto.endOf = endOf;
2458
+ momentPrototype__proto.format = format;
2459
+ momentPrototype__proto.from = from;
2460
+ momentPrototype__proto.fromNow = fromNow;
2461
+ momentPrototype__proto.get = getSet;
2462
+ momentPrototype__proto.invalidAt = invalidAt;
2463
+ momentPrototype__proto.isAfter = isAfter;
2464
+ momentPrototype__proto.isBefore = isBefore;
2465
+ momentPrototype__proto.isBetween = isBetween;
2466
+ momentPrototype__proto.isSame = isSame;
2467
+ momentPrototype__proto.isValid = moment_valid__isValid;
2468
+ momentPrototype__proto.lang = lang;
2469
+ momentPrototype__proto.locale = locale;
2470
+ momentPrototype__proto.localeData = localeData;
2471
+ momentPrototype__proto.max = prototypeMax;
2472
+ momentPrototype__proto.min = prototypeMin;
2473
+ momentPrototype__proto.parsingFlags = parsingFlags;
2474
+ momentPrototype__proto.set = getSet;
2475
+ momentPrototype__proto.startOf = startOf;
2476
+ momentPrototype__proto.subtract = add_subtract__subtract;
2477
+ momentPrototype__proto.toArray = toArray;
2478
+ momentPrototype__proto.toDate = toDate;
2479
+ momentPrototype__proto.toISOString = moment_format__toISOString;
2480
+ momentPrototype__proto.toJSON = moment_format__toISOString;
2481
+ momentPrototype__proto.toString = toString;
2482
+ momentPrototype__proto.unix = unix;
2483
+ momentPrototype__proto.valueOf = to_type__valueOf;
2484
+
2485
+ // Year
2486
+ momentPrototype__proto.year = getSetYear;
2487
+ momentPrototype__proto.isLeapYear = getIsLeapYear;
2488
+
2489
+ // Week Year
2490
+ momentPrototype__proto.weekYear = getSetWeekYear;
2491
+ momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
2492
+
2493
+ // Quarter
2494
+ momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
2495
+
2496
+ // Month
2497
+ momentPrototype__proto.month = getSetMonth;
2498
+ momentPrototype__proto.daysInMonth = getDaysInMonth;
2499
+
2500
+ // Week
2501
+ momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
2502
+ momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
2503
+ momentPrototype__proto.weeksInYear = getWeeksInYear;
2504
+ momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
2505
+
2506
+ // Day
2507
+ momentPrototype__proto.date = getSetDayOfMonth;
2508
+ momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
2509
+ momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
2510
+ momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
2511
+ momentPrototype__proto.dayOfYear = getSetDayOfYear;
2512
+
2513
+ // Hour
2514
+ momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
2515
+
2516
+ // Minute
2517
+ momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
2518
+
2519
+ // Second
2520
+ momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
2521
+
2522
+ // Millisecond
2523
+ momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
2524
+
2525
+ // Offset
2526
+ momentPrototype__proto.utcOffset = getSetOffset;
2527
+ momentPrototype__proto.utc = setOffsetToUTC;
2528
+ momentPrototype__proto.local = setOffsetToLocal;
2529
+ momentPrototype__proto.parseZone = setOffsetToParsedOffset;
2530
+ momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
2531
+ momentPrototype__proto.isDST = isDaylightSavingTime;
2532
+ momentPrototype__proto.isDSTShifted = isDaylightSavingTimeShifted;
2533
+ momentPrototype__proto.isLocal = isLocal;
2534
+ momentPrototype__proto.isUtcOffset = isUtcOffset;
2535
+ momentPrototype__proto.isUtc = isUtc;
2536
+ momentPrototype__proto.isUTC = isUtc;
2537
+
2538
+ // Timezone
2539
+ momentPrototype__proto.zoneAbbr = getZoneAbbr;
2540
+ momentPrototype__proto.zoneName = getZoneName;
2541
+
2542
+ // Deprecations
2543
+ momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
2544
+ momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
2545
+ momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
2546
+ momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);
2547
+
2548
+ var momentPrototype = momentPrototype__proto;
2549
+
2550
+ function moment__createUnix (input) {
2551
+ return local__createLocal(input * 1000);
2552
+ }
2553
+
2554
+ function moment__createInZone () {
2555
+ return local__createLocal.apply(null, arguments).parseZone();
2556
+ }
2557
+
2558
+ var defaultCalendar = {
2559
+ sameDay : '[Today at] LT',
2560
+ nextDay : '[Tomorrow at] LT',
2561
+ nextWeek : 'dddd [at] LT',
2562
+ lastDay : '[Yesterday at] LT',
2563
+ lastWeek : '[Last] dddd [at] LT',
2564
+ sameElse : 'L'
2565
+ };
2566
+
2567
+ function locale_calendar__calendar (key, mom, now) {
2568
+ var output = this._calendar[key];
2569
+ return typeof output === 'function' ? output.call(mom, now) : output;
2570
+ }
2571
+
2572
+ var defaultLongDateFormat = {
2573
+ LTS : 'h:mm:ss A',
2574
+ LT : 'h:mm A',
2575
+ L : 'MM/DD/YYYY',
2576
+ LL : 'MMMM D, YYYY',
2577
+ LLL : 'MMMM D, YYYY LT',
2578
+ LLLL : 'dddd, MMMM D, YYYY LT'
2579
+ };
2580
+
2581
+ function longDateFormat (key) {
2582
+ var output = this._longDateFormat[key];
2583
+ if (!output && this._longDateFormat[key.toUpperCase()]) {
2584
+ output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
2585
+ return val.slice(1);
2586
+ });
2587
+ this._longDateFormat[key] = output;
2588
+ }
2589
+ return output;
2590
+ }
2591
+
2592
+ var defaultInvalidDate = 'Invalid date';
2593
+
2594
+ function invalidDate () {
2595
+ return this._invalidDate;
2596
+ }
2597
+
2598
+ var defaultOrdinal = '%d';
2599
+ var defaultOrdinalParse = /\d{1,2}/;
2600
+
2601
+ function ordinal (number) {
2602
+ return this._ordinal.replace('%d', number);
2603
+ }
2604
+
2605
+ function preParsePostFormat (string) {
2606
+ return string;
2607
+ }
2608
+
2609
+ var defaultRelativeTime = {
2610
+ future : 'in %s',
2611
+ past : '%s ago',
2612
+ s : 'a few seconds',
2613
+ m : 'a minute',
2614
+ mm : '%d minutes',
2615
+ h : 'an hour',
2616
+ hh : '%d hours',
2617
+ d : 'a day',
2618
+ dd : '%d days',
2619
+ M : 'a month',
2620
+ MM : '%d months',
2621
+ y : 'a year',
2622
+ yy : '%d years'
2623
+ };
2624
+
2625
+ function relative__relativeTime (number, withoutSuffix, string, isFuture) {
2626
+ var output = this._relativeTime[string];
2627
+ return (typeof output === 'function') ?
2628
+ output(number, withoutSuffix, string, isFuture) :
2629
+ output.replace(/%d/i, number);
2630
+ }
2631
+
2632
+ function pastFuture (diff, output) {
2633
+ var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
2634
+ return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
2635
+ }
2636
+
2637
+ function locale_set__set (config) {
2638
+ var prop, i;
2639
+ for (i in config) {
2640
+ prop = config[i];
2641
+ if (typeof prop === 'function') {
2642
+ this[i] = prop;
2643
+ } else {
2644
+ this['_' + i] = prop;
2645
+ }
2646
+ }
2647
+ // Lenient ordinal parsing accepts just a number in addition to
2648
+ // number + (possibly) stuff coming from _ordinalParseLenient.
2649
+ this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + /\d{1,2}/.source);
2650
+ }
2651
+
2652
+ var prototype__proto = Locale.prototype;
2653
+
2654
+ prototype__proto._calendar = defaultCalendar;
2655
+ prototype__proto.calendar = locale_calendar__calendar;
2656
+ prototype__proto._longDateFormat = defaultLongDateFormat;
2657
+ prototype__proto.longDateFormat = longDateFormat;
2658
+ prototype__proto._invalidDate = defaultInvalidDate;
2659
+ prototype__proto.invalidDate = invalidDate;
2660
+ prototype__proto._ordinal = defaultOrdinal;
2661
+ prototype__proto.ordinal = ordinal;
2662
+ prototype__proto._ordinalParse = defaultOrdinalParse;
2663
+ prototype__proto.preparse = preParsePostFormat;
2664
+ prototype__proto.postformat = preParsePostFormat;
2665
+ prototype__proto._relativeTime = defaultRelativeTime;
2666
+ prototype__proto.relativeTime = relative__relativeTime;
2667
+ prototype__proto.pastFuture = pastFuture;
2668
+ prototype__proto.set = locale_set__set;
2669
+
2670
+ // Month
2671
+ prototype__proto.months = localeMonths;
2672
+ prototype__proto._months = defaultLocaleMonths;
2673
+ prototype__proto.monthsShort = localeMonthsShort;
2674
+ prototype__proto._monthsShort = defaultLocaleMonthsShort;
2675
+ prototype__proto.monthsParse = localeMonthsParse;
2676
+
2677
+ // Week
2678
+ prototype__proto.week = localeWeek;
2679
+ prototype__proto._week = defaultLocaleWeek;
2680
+ prototype__proto.firstDayOfYear = localeFirstDayOfYear;
2681
+ prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
2682
+
2683
+ // Day of Week
2684
+ prototype__proto.weekdays = localeWeekdays;
2685
+ prototype__proto._weekdays = defaultLocaleWeekdays;
2686
+ prototype__proto.weekdaysMin = localeWeekdaysMin;
2687
+ prototype__proto._weekdaysMin = defaultLocaleWeekdaysMin;
2688
+ prototype__proto.weekdaysShort = localeWeekdaysShort;
2689
+ prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
2690
+ prototype__proto.weekdaysParse = localeWeekdaysParse;
2691
+
2692
+ // Hours
2693
+ prototype__proto.isPM = localeIsPM;
2694
+ prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
2695
+ prototype__proto.meridiem = localeMeridiem;
2696
+
2697
+ function lists__get (format, index, field, setter) {
2698
+ var locale = locale_locales__getLocale();
2699
+ var utc = create_utc__createUTC().set(setter, index);
2700
+ return locale[field](utc, format);
2701
+ }
2702
+
2703
+ function list (format, index, field, count, setter) {
2704
+ if (typeof format === 'number') {
2705
+ index = format;
2706
+ format = undefined;
2707
+ }
2708
+
2709
+ format = format || '';
2710
+
2711
+ if (index != null) {
2712
+ return lists__get(format, index, field, setter);
2713
+ }
2714
+
2715
+ var i;
2716
+ var out = [];
2717
+ for (i = 0; i < count; i++) {
2718
+ out[i] = lists__get(format, i, field, setter);
2719
+ }
2720
+ return out;
2721
+ }
2722
+
2723
+ function lists__listMonths (format, index) {
2724
+ return list(format, index, 'months', 12, 'month');
2725
+ }
2726
+
2727
+ function lists__listMonthsShort (format, index) {
2728
+ return list(format, index, 'monthsShort', 12, 'month');
2729
+ }
2730
+
2731
+ function lists__listWeekdays (format, index) {
2732
+ return list(format, index, 'weekdays', 7, 'day');
2733
+ }
2734
+
2735
+ function lists__listWeekdaysShort (format, index) {
2736
+ return list(format, index, 'weekdaysShort', 7, 'day');
2737
+ }
2738
+
2739
+ function lists__listWeekdaysMin (format, index) {
2740
+ return list(format, index, 'weekdaysMin', 7, 'day');
2741
+ }
2742
+
2743
+ locale_locales__getSetGlobalLocale('en', {
2744
+ ordinalParse: /\d{1,2}(th|st|nd|rd)/,
2745
+ ordinal : function (number) {
2746
+ var b = number % 10,
2747
+ output = (toInt(number % 100 / 10) === 1) ? 'th' :
2748
+ (b === 1) ? 'st' :
2749
+ (b === 2) ? 'nd' :
2750
+ (b === 3) ? 'rd' : 'th';
2751
+ return number + output;
2752
+ }
2753
+ });
2754
+
2755
+ // Side effect imports
2756
+ utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
2757
+ utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
2758
+
2759
+ var mathAbs = Math.abs;
2760
+
2761
+ function duration_abs__abs () {
2762
+ var data = this._data;
2763
+
2764
+ this._milliseconds = mathAbs(this._milliseconds);
2765
+ this._days = mathAbs(this._days);
2766
+ this._months = mathAbs(this._months);
2767
+
2768
+ data.milliseconds = mathAbs(data.milliseconds);
2769
+ data.seconds = mathAbs(data.seconds);
2770
+ data.minutes = mathAbs(data.minutes);
2771
+ data.hours = mathAbs(data.hours);
2772
+ data.months = mathAbs(data.months);
2773
+ data.years = mathAbs(data.years);
2774
+
2775
+ return this;
2776
+ }
2777
+
2778
+ function duration_add_subtract__addSubtract (duration, input, value, direction) {
2779
+ var other = create__createDuration(input, value);
2780
+
2781
+ duration._milliseconds += direction * other._milliseconds;
2782
+ duration._days += direction * other._days;
2783
+ duration._months += direction * other._months;
2784
+
2785
+ return duration._bubble();
2786
+ }
2787
+
2788
+ // supports only 2.0-style add(1, 's') or add(duration)
2789
+ function duration_add_subtract__add (input, value) {
2790
+ return duration_add_subtract__addSubtract(this, input, value, 1);
2791
+ }
2792
+
2793
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
2794
+ function duration_add_subtract__subtract (input, value) {
2795
+ return duration_add_subtract__addSubtract(this, input, value, -1);
2796
+ }
2797
+
2798
+ function bubble () {
2799
+ var milliseconds = this._milliseconds;
2800
+ var days = this._days;
2801
+ var months = this._months;
2802
+ var data = this._data;
2803
+ var seconds, minutes, hours, years = 0;
2804
+
2805
+ // The following code bubbles up values, see the tests for
2806
+ // examples of what that means.
2807
+ data.milliseconds = milliseconds % 1000;
2808
+
2809
+ seconds = absFloor(milliseconds / 1000);
2810
+ data.seconds = seconds % 60;
2811
+
2812
+ minutes = absFloor(seconds / 60);
2813
+ data.minutes = minutes % 60;
2814
+
2815
+ hours = absFloor(minutes / 60);
2816
+ data.hours = hours % 24;
2817
+
2818
+ days += absFloor(hours / 24);
2819
+
2820
+ // Accurately convert days to years, assume start from year 0.
2821
+ years = absFloor(daysToYears(days));
2822
+ days -= absFloor(yearsToDays(years));
2823
+
2824
+ // 30 days to a month
2825
+ // TODO (iskren): Use anchor date (like 1st Jan) to compute this.
2826
+ months += absFloor(days / 30);
2827
+ days %= 30;
2828
+
2829
+ // 12 months -> 1 year
2830
+ years += absFloor(months / 12);
2831
+ months %= 12;
2832
+
2833
+ data.days = days;
2834
+ data.months = months;
2835
+ data.years = years;
2836
+
2837
+ return this;
2838
+ }
2839
+
2840
+ function daysToYears (days) {
2841
+ // 400 years have 146097 days (taking into account leap year rules)
2842
+ return days * 400 / 146097;
2843
+ }
2844
+
2845
+ function yearsToDays (years) {
2846
+ // years * 365 + absFloor(years / 4) -
2847
+ // absFloor(years / 100) + absFloor(years / 400);
2848
+ return years * 146097 / 400;
2849
+ }
2850
+
2851
+ function as (units) {
2852
+ var days;
2853
+ var months;
2854
+ var milliseconds = this._milliseconds;
2855
+
2856
+ units = normalizeUnits(units);
2857
+
2858
+ if (units === 'month' || units === 'year') {
2859
+ days = this._days + milliseconds / 864e5;
2860
+ months = this._months + daysToYears(days) * 12;
2861
+ return units === 'month' ? months : months / 12;
2862
+ } else {
2863
+ // handle milliseconds separately because of floating point math errors (issue #1867)
2864
+ days = this._days + Math.round(yearsToDays(this._months / 12));
2865
+ switch (units) {
2866
+ case 'week' : return days / 7 + milliseconds / 6048e5;
2867
+ case 'day' : return days + milliseconds / 864e5;
2868
+ case 'hour' : return days * 24 + milliseconds / 36e5;
2869
+ case 'minute' : return days * 24 * 60 + milliseconds / 6e4;
2870
+ case 'second' : return days * 24 * 60 * 60 + milliseconds / 1000;
2871
+ // Math.floor prevents floating point math errors here
2872
+ case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + milliseconds;
2873
+ default: throw new Error('Unknown unit ' + units);
2874
+ }
2875
+ }
2876
+ }
2877
+
2878
+ // TODO: Use this.as('ms')?
2879
+ function duration_as__valueOf () {
2880
+ return (
2881
+ this._milliseconds +
2882
+ this._days * 864e5 +
2883
+ (this._months % 12) * 2592e6 +
2884
+ toInt(this._months / 12) * 31536e6
2885
+ );
2886
+ }
2887
+
2888
+ function makeAs (alias) {
2889
+ return function () {
2890
+ return this.as(alias);
2891
+ };
2892
+ }
2893
+
2894
+ var asMilliseconds = makeAs('ms');
2895
+ var asSeconds = makeAs('s');
2896
+ var asMinutes = makeAs('m');
2897
+ var asHours = makeAs('h');
2898
+ var asDays = makeAs('d');
2899
+ var asWeeks = makeAs('w');
2900
+ var asMonths = makeAs('M');
2901
+ var asYears = makeAs('y');
2902
+
2903
+ function duration_get__get (units) {
2904
+ units = normalizeUnits(units);
2905
+ return this[units + 's']();
2906
+ }
2907
+
2908
+ function makeGetter(name) {
2909
+ return function () {
2910
+ return this._data[name];
2911
+ };
2912
+ }
2913
+
2914
+ var duration_get__milliseconds = makeGetter('milliseconds');
2915
+ var seconds = makeGetter('seconds');
2916
+ var minutes = makeGetter('minutes');
2917
+ var hours = makeGetter('hours');
2918
+ var days = makeGetter('days');
2919
+ var months = makeGetter('months');
2920
+ var years = makeGetter('years');
2921
+
2922
+ function weeks () {
2923
+ return absFloor(this.days() / 7);
2924
+ }
2925
+
2926
+ var round = Math.round;
2927
+ var thresholds = {
2928
+ s: 45, // seconds to minute
2929
+ m: 45, // minutes to hour
2930
+ h: 22, // hours to day
2931
+ d: 26, // days to month
2932
+ M: 11 // months to year
2933
+ };
2934
+
2935
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
2936
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
2937
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
2938
+ }
2939
+
2940
+ function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
2941
+ var duration = create__createDuration(posNegDuration).abs();
2942
+ var seconds = round(duration.as('s'));
2943
+ var minutes = round(duration.as('m'));
2944
+ var hours = round(duration.as('h'));
2945
+ var days = round(duration.as('d'));
2946
+ var months = round(duration.as('M'));
2947
+ var years = round(duration.as('y'));
2948
+
2949
+ var a = seconds < thresholds.s && ['s', seconds] ||
2950
+ minutes === 1 && ['m'] ||
2951
+ minutes < thresholds.m && ['mm', minutes] ||
2952
+ hours === 1 && ['h'] ||
2953
+ hours < thresholds.h && ['hh', hours] ||
2954
+ days === 1 && ['d'] ||
2955
+ days < thresholds.d && ['dd', days] ||
2956
+ months === 1 && ['M'] ||
2957
+ months < thresholds.M && ['MM', months] ||
2958
+ years === 1 && ['y'] || ['yy', years];
2959
+
2960
+ a[2] = withoutSuffix;
2961
+ a[3] = +posNegDuration > 0;
2962
+ a[4] = locale;
2963
+ return substituteTimeAgo.apply(null, a);
2964
+ }
2965
+
2966
+ // This function allows you to set a threshold for relative time strings
2967
+ function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
2968
+ if (thresholds[threshold] === undefined) {
2969
+ return false;
2970
+ }
2971
+ if (limit === undefined) {
2972
+ return thresholds[threshold];
2973
+ }
2974
+ thresholds[threshold] = limit;
2975
+ return true;
2976
+ }
2977
+
2978
+ function humanize (withSuffix) {
2979
+ var locale = this.localeData();
2980
+ var output = duration_humanize__relativeTime(this, !withSuffix, locale);
2981
+
2982
+ if (withSuffix) {
2983
+ output = locale.pastFuture(+this, output);
2984
+ }
2985
+
2986
+ return locale.postformat(output);
2987
+ }
2988
+
2989
+ var iso_string__abs = Math.abs;
2990
+
2991
+ function iso_string__toISOString() {
2992
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
2993
+ var Y = iso_string__abs(this.years());
2994
+ var M = iso_string__abs(this.months());
2995
+ var D = iso_string__abs(this.days());
2996
+ var h = iso_string__abs(this.hours());
2997
+ var m = iso_string__abs(this.minutes());
2998
+ var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000);
2999
+ var total = this.asSeconds();
3000
+
3001
+ if (!total) {
3002
+ // this is the same as C#'s (Noda) and python (isodate)...
3003
+ // but not other JS (goog.date)
3004
+ return 'P0D';
3005
+ }
3006
+
3007
+ return (total < 0 ? '-' : '') +
3008
+ 'P' +
3009
+ (Y ? Y + 'Y' : '') +
3010
+ (M ? M + 'M' : '') +
3011
+ (D ? D + 'D' : '') +
3012
+ ((h || m || s) ? 'T' : '') +
3013
+ (h ? h + 'H' : '') +
3014
+ (m ? m + 'M' : '') +
3015
+ (s ? s + 'S' : '');
3016
+ }
3017
+
3018
+ var duration_prototype__proto = Duration.prototype;
3019
+
3020
+ duration_prototype__proto.abs = duration_abs__abs;
3021
+ duration_prototype__proto.add = duration_add_subtract__add;
3022
+ duration_prototype__proto.subtract = duration_add_subtract__subtract;
3023
+ duration_prototype__proto.as = as;
3024
+ duration_prototype__proto.asMilliseconds = asMilliseconds;
3025
+ duration_prototype__proto.asSeconds = asSeconds;
3026
+ duration_prototype__proto.asMinutes = asMinutes;
3027
+ duration_prototype__proto.asHours = asHours;
3028
+ duration_prototype__proto.asDays = asDays;
3029
+ duration_prototype__proto.asWeeks = asWeeks;
3030
+ duration_prototype__proto.asMonths = asMonths;
3031
+ duration_prototype__proto.asYears = asYears;
3032
+ duration_prototype__proto.valueOf = duration_as__valueOf;
3033
+ duration_prototype__proto._bubble = bubble;
3034
+ duration_prototype__proto.get = duration_get__get;
3035
+ duration_prototype__proto.milliseconds = duration_get__milliseconds;
3036
+ duration_prototype__proto.seconds = seconds;
3037
+ duration_prototype__proto.minutes = minutes;
3038
+ duration_prototype__proto.hours = hours;
3039
+ duration_prototype__proto.days = days;
3040
+ duration_prototype__proto.weeks = weeks;
3041
+ duration_prototype__proto.months = months;
3042
+ duration_prototype__proto.years = years;
3043
+ duration_prototype__proto.humanize = humanize;
3044
+ duration_prototype__proto.toISOString = iso_string__toISOString;
3045
+ duration_prototype__proto.toString = iso_string__toISOString;
3046
+ duration_prototype__proto.toJSON = iso_string__toISOString;
3047
+ duration_prototype__proto.locale = locale;
3048
+ duration_prototype__proto.localeData = localeData;
3049
+
3050
+ // Deprecations
3051
+ duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
3052
+ duration_prototype__proto.lang = lang;
3053
+
3054
+ // Side effect imports
3055
+
3056
+ addFormatToken('X', 0, 0, 'unix');
3057
+ addFormatToken('x', 0, 0, 'valueOf');
3058
+
3059
+ // PARSING
3060
+
3061
+ addRegexToken('x', matchSigned);
3062
+ addRegexToken('X', matchTimestamp);
3063
+ addParseToken('X', function (input, array, config) {
3064
+ config._d = new Date(parseFloat(input, 10) * 1000);
3065
+ });
3066
+ addParseToken('x', function (input, array, config) {
3067
+ config._d = new Date(toInt(input));
3068
+ });
3069
+
3070
+ // Side effect imports
3071
+
3072
+
3073
+ utils_hooks__hooks.version = '2.10.2';
3074
+
3075
+ setHookCallback(local__createLocal);
3076
+
3077
+ utils_hooks__hooks.fn = momentPrototype;
3078
+ utils_hooks__hooks.min = min;
3079
+ utils_hooks__hooks.max = max;
3080
+ utils_hooks__hooks.utc = create_utc__createUTC;
3081
+ utils_hooks__hooks.unix = moment__createUnix;
3082
+ utils_hooks__hooks.months = lists__listMonths;
3083
+ utils_hooks__hooks.isDate = isDate;
3084
+ utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
3085
+ utils_hooks__hooks.invalid = valid__createInvalid;
3086
+ utils_hooks__hooks.duration = create__createDuration;
3087
+ utils_hooks__hooks.isMoment = isMoment;
3088
+ utils_hooks__hooks.weekdays = lists__listWeekdays;
3089
+ utils_hooks__hooks.parseZone = moment__createInZone;
3090
+ utils_hooks__hooks.localeData = locale_locales__getLocale;
3091
+ utils_hooks__hooks.isDuration = isDuration;
3092
+ utils_hooks__hooks.monthsShort = lists__listMonthsShort;
3093
+ utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
3094
+ utils_hooks__hooks.defineLocale = defineLocale;
3095
+ utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
3096
+ utils_hooks__hooks.normalizeUnits = normalizeUnits;
3097
+ utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
3098
+
3099
+ var _moment = utils_hooks__hooks;
3100
+
3101
+ return _moment;
3102
+
3103
+ }));