@fctc/sme-widget-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/dist/hooks.d.mts +13 -0
- package/dist/hooks.d.ts +13 -0
- package/dist/hooks.js +61 -0
- package/dist/hooks.mjs +34 -0
- package/dist/icons.d.mts +92 -0
- package/dist/icons.d.ts +92 -0
- package/dist/icons.js +2062 -0
- package/dist/icons.mjs +1999 -0
- package/dist/index.css +701 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +34678 -0
- package/dist/index.mjs +34561 -0
- package/dist/types.d.mts +59 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.js +50 -0
- package/dist/types.mjs +13 -0
- package/dist/utils.d.mts +39 -0
- package/dist/utils.d.ts +39 -0
- package/dist/utils.js +4879 -0
- package/dist/utils.mjs +4855 -0
- package/dist/widgets.css +701 -0
- package/dist/widgets.d.mts +405 -0
- package/dist/widgets.d.ts +405 -0
- package/dist/widgets.js +34268 -0
- package/dist/widgets.mjs +34207 -0
- package/package.json +72 -0
package/dist/utils.js
ADDED
|
@@ -0,0 +1,4879 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/moment/moment.js
|
|
34
|
+
var require_moment = __commonJS({
|
|
35
|
+
"node_modules/moment/moment.js"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
(function(global, factory) {
|
|
38
|
+
typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global.moment = factory();
|
|
39
|
+
})(exports2, function() {
|
|
40
|
+
"use strict";
|
|
41
|
+
var hookCallback;
|
|
42
|
+
function hooks() {
|
|
43
|
+
return hookCallback.apply(null, arguments);
|
|
44
|
+
}
|
|
45
|
+
function setHookCallback(callback) {
|
|
46
|
+
hookCallback = callback;
|
|
47
|
+
}
|
|
48
|
+
function isArray(input) {
|
|
49
|
+
return input instanceof Array || Object.prototype.toString.call(input) === "[object Array]";
|
|
50
|
+
}
|
|
51
|
+
function isObject2(input) {
|
|
52
|
+
return input != null && Object.prototype.toString.call(input) === "[object Object]";
|
|
53
|
+
}
|
|
54
|
+
function hasOwnProp(a, b) {
|
|
55
|
+
return Object.prototype.hasOwnProperty.call(a, b);
|
|
56
|
+
}
|
|
57
|
+
function isObjectEmpty2(obj) {
|
|
58
|
+
if (Object.getOwnPropertyNames) {
|
|
59
|
+
return Object.getOwnPropertyNames(obj).length === 0;
|
|
60
|
+
} else {
|
|
61
|
+
var k;
|
|
62
|
+
for (k in obj) {
|
|
63
|
+
if (hasOwnProp(obj, k)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function isUndefined(input) {
|
|
71
|
+
return input === void 0;
|
|
72
|
+
}
|
|
73
|
+
function isNumber(input) {
|
|
74
|
+
return typeof input === "number" || Object.prototype.toString.call(input) === "[object Number]";
|
|
75
|
+
}
|
|
76
|
+
function isDate(input) {
|
|
77
|
+
return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
|
|
78
|
+
}
|
|
79
|
+
function map(arr, fn) {
|
|
80
|
+
var res = [], i, arrLen = arr.length;
|
|
81
|
+
for (i = 0; i < arrLen; ++i) {
|
|
82
|
+
res.push(fn(arr[i], i));
|
|
83
|
+
}
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
86
|
+
function extend(a, b) {
|
|
87
|
+
for (var i in b) {
|
|
88
|
+
if (hasOwnProp(b, i)) {
|
|
89
|
+
a[i] = b[i];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (hasOwnProp(b, "toString")) {
|
|
93
|
+
a.toString = b.toString;
|
|
94
|
+
}
|
|
95
|
+
if (hasOwnProp(b, "valueOf")) {
|
|
96
|
+
a.valueOf = b.valueOf;
|
|
97
|
+
}
|
|
98
|
+
return a;
|
|
99
|
+
}
|
|
100
|
+
function createUTC(input, format2, locale2, strict) {
|
|
101
|
+
return createLocalOrUTC(input, format2, locale2, strict, true).utc();
|
|
102
|
+
}
|
|
103
|
+
function defaultParsingFlags() {
|
|
104
|
+
return {
|
|
105
|
+
empty: false,
|
|
106
|
+
unusedTokens: [],
|
|
107
|
+
unusedInput: [],
|
|
108
|
+
overflow: -2,
|
|
109
|
+
charsLeftOver: 0,
|
|
110
|
+
nullInput: false,
|
|
111
|
+
invalidEra: null,
|
|
112
|
+
invalidMonth: null,
|
|
113
|
+
invalidFormat: false,
|
|
114
|
+
userInvalidated: false,
|
|
115
|
+
iso: false,
|
|
116
|
+
parsedDateParts: [],
|
|
117
|
+
era: null,
|
|
118
|
+
meridiem: null,
|
|
119
|
+
rfc2822: false,
|
|
120
|
+
weekdayMismatch: false
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function getParsingFlags(m) {
|
|
124
|
+
if (m._pf == null) {
|
|
125
|
+
m._pf = defaultParsingFlags();
|
|
126
|
+
}
|
|
127
|
+
return m._pf;
|
|
128
|
+
}
|
|
129
|
+
var some;
|
|
130
|
+
if (Array.prototype.some) {
|
|
131
|
+
some = Array.prototype.some;
|
|
132
|
+
} else {
|
|
133
|
+
some = function(fun) {
|
|
134
|
+
var t = Object(this), len = t.length >>> 0, i;
|
|
135
|
+
for (i = 0; i < len; i++) {
|
|
136
|
+
if (i in t && fun.call(this, t[i], i, t)) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function isValid(m) {
|
|
144
|
+
var flags = null, parsedParts = false, isNowValid = m._d && !isNaN(m._d.getTime());
|
|
145
|
+
if (isNowValid) {
|
|
146
|
+
flags = getParsingFlags(m);
|
|
147
|
+
parsedParts = some.call(flags.parsedDateParts, function(i) {
|
|
148
|
+
return i != null;
|
|
149
|
+
});
|
|
150
|
+
isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
|
|
151
|
+
if (m._strict) {
|
|
152
|
+
isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (Object.isFrozen == null || !Object.isFrozen(m)) {
|
|
156
|
+
m._isValid = isNowValid;
|
|
157
|
+
} else {
|
|
158
|
+
return isNowValid;
|
|
159
|
+
}
|
|
160
|
+
return m._isValid;
|
|
161
|
+
}
|
|
162
|
+
function createInvalid(flags) {
|
|
163
|
+
var m = createUTC(NaN);
|
|
164
|
+
if (flags != null) {
|
|
165
|
+
extend(getParsingFlags(m), flags);
|
|
166
|
+
} else {
|
|
167
|
+
getParsingFlags(m).userInvalidated = true;
|
|
168
|
+
}
|
|
169
|
+
return m;
|
|
170
|
+
}
|
|
171
|
+
var momentProperties = hooks.momentProperties = [], updateInProgress = false;
|
|
172
|
+
function copyConfig(to2, from2) {
|
|
173
|
+
var i, prop, val, momentPropertiesLen = momentProperties.length;
|
|
174
|
+
if (!isUndefined(from2._isAMomentObject)) {
|
|
175
|
+
to2._isAMomentObject = from2._isAMomentObject;
|
|
176
|
+
}
|
|
177
|
+
if (!isUndefined(from2._i)) {
|
|
178
|
+
to2._i = from2._i;
|
|
179
|
+
}
|
|
180
|
+
if (!isUndefined(from2._f)) {
|
|
181
|
+
to2._f = from2._f;
|
|
182
|
+
}
|
|
183
|
+
if (!isUndefined(from2._l)) {
|
|
184
|
+
to2._l = from2._l;
|
|
185
|
+
}
|
|
186
|
+
if (!isUndefined(from2._strict)) {
|
|
187
|
+
to2._strict = from2._strict;
|
|
188
|
+
}
|
|
189
|
+
if (!isUndefined(from2._tzm)) {
|
|
190
|
+
to2._tzm = from2._tzm;
|
|
191
|
+
}
|
|
192
|
+
if (!isUndefined(from2._isUTC)) {
|
|
193
|
+
to2._isUTC = from2._isUTC;
|
|
194
|
+
}
|
|
195
|
+
if (!isUndefined(from2._offset)) {
|
|
196
|
+
to2._offset = from2._offset;
|
|
197
|
+
}
|
|
198
|
+
if (!isUndefined(from2._pf)) {
|
|
199
|
+
to2._pf = getParsingFlags(from2);
|
|
200
|
+
}
|
|
201
|
+
if (!isUndefined(from2._locale)) {
|
|
202
|
+
to2._locale = from2._locale;
|
|
203
|
+
}
|
|
204
|
+
if (momentPropertiesLen > 0) {
|
|
205
|
+
for (i = 0; i < momentPropertiesLen; i++) {
|
|
206
|
+
prop = momentProperties[i];
|
|
207
|
+
val = from2[prop];
|
|
208
|
+
if (!isUndefined(val)) {
|
|
209
|
+
to2[prop] = val;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return to2;
|
|
214
|
+
}
|
|
215
|
+
function Moment(config) {
|
|
216
|
+
copyConfig(this, config);
|
|
217
|
+
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
|
|
218
|
+
if (!this.isValid()) {
|
|
219
|
+
this._d = /* @__PURE__ */ new Date(NaN);
|
|
220
|
+
}
|
|
221
|
+
if (updateInProgress === false) {
|
|
222
|
+
updateInProgress = true;
|
|
223
|
+
hooks.updateOffset(this);
|
|
224
|
+
updateInProgress = false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function isMoment(obj) {
|
|
228
|
+
return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
|
|
229
|
+
}
|
|
230
|
+
function warn2(msg) {
|
|
231
|
+
if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
|
|
232
|
+
console.warn("Deprecation warning: " + msg);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function deprecate(msg, fn) {
|
|
236
|
+
var firstTime = true;
|
|
237
|
+
return extend(function() {
|
|
238
|
+
if (hooks.deprecationHandler != null) {
|
|
239
|
+
hooks.deprecationHandler(null, msg);
|
|
240
|
+
}
|
|
241
|
+
if (firstTime) {
|
|
242
|
+
var args = [], arg, i, key, argLen = arguments.length;
|
|
243
|
+
for (i = 0; i < argLen; i++) {
|
|
244
|
+
arg = "";
|
|
245
|
+
if (typeof arguments[i] === "object") {
|
|
246
|
+
arg += "\n[" + i + "] ";
|
|
247
|
+
for (key in arguments[0]) {
|
|
248
|
+
if (hasOwnProp(arguments[0], key)) {
|
|
249
|
+
arg += key + ": " + arguments[0][key] + ", ";
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
arg = arg.slice(0, -2);
|
|
253
|
+
} else {
|
|
254
|
+
arg = arguments[i];
|
|
255
|
+
}
|
|
256
|
+
args.push(arg);
|
|
257
|
+
}
|
|
258
|
+
warn2(
|
|
259
|
+
msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack
|
|
260
|
+
);
|
|
261
|
+
firstTime = false;
|
|
262
|
+
}
|
|
263
|
+
return fn.apply(this, arguments);
|
|
264
|
+
}, fn);
|
|
265
|
+
}
|
|
266
|
+
var deprecations = {};
|
|
267
|
+
function deprecateSimple(name, msg) {
|
|
268
|
+
if (hooks.deprecationHandler != null) {
|
|
269
|
+
hooks.deprecationHandler(name, msg);
|
|
270
|
+
}
|
|
271
|
+
if (!deprecations[name]) {
|
|
272
|
+
warn2(msg);
|
|
273
|
+
deprecations[name] = true;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
hooks.suppressDeprecationWarnings = false;
|
|
277
|
+
hooks.deprecationHandler = null;
|
|
278
|
+
function isFunction(input) {
|
|
279
|
+
return typeof Function !== "undefined" && input instanceof Function || Object.prototype.toString.call(input) === "[object Function]";
|
|
280
|
+
}
|
|
281
|
+
function set(config) {
|
|
282
|
+
var prop, i;
|
|
283
|
+
for (i in config) {
|
|
284
|
+
if (hasOwnProp(config, i)) {
|
|
285
|
+
prop = config[i];
|
|
286
|
+
if (isFunction(prop)) {
|
|
287
|
+
this[i] = prop;
|
|
288
|
+
} else {
|
|
289
|
+
this["_" + i] = prop;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
this._config = config;
|
|
294
|
+
this._dayOfMonthOrdinalParseLenient = new RegExp(
|
|
295
|
+
(this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
function mergeConfigs(parentConfig, childConfig) {
|
|
299
|
+
var res = extend({}, parentConfig), prop;
|
|
300
|
+
for (prop in childConfig) {
|
|
301
|
+
if (hasOwnProp(childConfig, prop)) {
|
|
302
|
+
if (isObject2(parentConfig[prop]) && isObject2(childConfig[prop])) {
|
|
303
|
+
res[prop] = {};
|
|
304
|
+
extend(res[prop], parentConfig[prop]);
|
|
305
|
+
extend(res[prop], childConfig[prop]);
|
|
306
|
+
} else if (childConfig[prop] != null) {
|
|
307
|
+
res[prop] = childConfig[prop];
|
|
308
|
+
} else {
|
|
309
|
+
delete res[prop];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
for (prop in parentConfig) {
|
|
314
|
+
if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject2(parentConfig[prop])) {
|
|
315
|
+
res[prop] = extend({}, res[prop]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return res;
|
|
319
|
+
}
|
|
320
|
+
function Locale(config) {
|
|
321
|
+
if (config != null) {
|
|
322
|
+
this.set(config);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
var keys;
|
|
326
|
+
if (Object.keys) {
|
|
327
|
+
keys = Object.keys;
|
|
328
|
+
} else {
|
|
329
|
+
keys = function(obj) {
|
|
330
|
+
var i, res = [];
|
|
331
|
+
for (i in obj) {
|
|
332
|
+
if (hasOwnProp(obj, i)) {
|
|
333
|
+
res.push(i);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return res;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
var defaultCalendar = {
|
|
340
|
+
sameDay: "[Today at] LT",
|
|
341
|
+
nextDay: "[Tomorrow at] LT",
|
|
342
|
+
nextWeek: "dddd [at] LT",
|
|
343
|
+
lastDay: "[Yesterday at] LT",
|
|
344
|
+
lastWeek: "[Last] dddd [at] LT",
|
|
345
|
+
sameElse: "L"
|
|
346
|
+
};
|
|
347
|
+
function calendar(key, mom, now2) {
|
|
348
|
+
var output = this._calendar[key] || this._calendar["sameElse"];
|
|
349
|
+
return isFunction(output) ? output.call(mom, now2) : output;
|
|
350
|
+
}
|
|
351
|
+
function zeroFill(number, targetLength, forceSign) {
|
|
352
|
+
var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign2 = number >= 0;
|
|
353
|
+
return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
|
|
354
|
+
}
|
|
355
|
+
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
|
|
356
|
+
function addFormatToken(token2, padded, ordinal2, callback) {
|
|
357
|
+
var func = callback;
|
|
358
|
+
if (typeof callback === "string") {
|
|
359
|
+
func = function() {
|
|
360
|
+
return this[callback]();
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
if (token2) {
|
|
364
|
+
formatTokenFunctions[token2] = func;
|
|
365
|
+
}
|
|
366
|
+
if (padded) {
|
|
367
|
+
formatTokenFunctions[padded[0]] = function() {
|
|
368
|
+
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (ordinal2) {
|
|
372
|
+
formatTokenFunctions[ordinal2] = function() {
|
|
373
|
+
return this.localeData().ordinal(
|
|
374
|
+
func.apply(this, arguments),
|
|
375
|
+
token2
|
|
376
|
+
);
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function removeFormattingTokens(input) {
|
|
381
|
+
if (input.match(/\[[\s\S]/)) {
|
|
382
|
+
return input.replace(/^\[|\]$/g, "");
|
|
383
|
+
}
|
|
384
|
+
return input.replace(/\\/g, "");
|
|
385
|
+
}
|
|
386
|
+
function makeFormatFunction(format2) {
|
|
387
|
+
var array = format2.match(formattingTokens), i, length;
|
|
388
|
+
for (i = 0, length = array.length; i < length; i++) {
|
|
389
|
+
if (formatTokenFunctions[array[i]]) {
|
|
390
|
+
array[i] = formatTokenFunctions[array[i]];
|
|
391
|
+
} else {
|
|
392
|
+
array[i] = removeFormattingTokens(array[i]);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return function(mom) {
|
|
396
|
+
var output = "", i2;
|
|
397
|
+
for (i2 = 0; i2 < length; i2++) {
|
|
398
|
+
output += isFunction(array[i2]) ? array[i2].call(mom, format2) : array[i2];
|
|
399
|
+
}
|
|
400
|
+
return output;
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function formatMoment(m, format2) {
|
|
404
|
+
if (!m.isValid()) {
|
|
405
|
+
return m.localeData().invalidDate();
|
|
406
|
+
}
|
|
407
|
+
format2 = expandFormat(format2, m.localeData());
|
|
408
|
+
formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
|
|
409
|
+
return formatFunctions[format2](m);
|
|
410
|
+
}
|
|
411
|
+
function expandFormat(format2, locale2) {
|
|
412
|
+
var i = 5;
|
|
413
|
+
function replaceLongDateFormatTokens(input) {
|
|
414
|
+
return locale2.longDateFormat(input) || input;
|
|
415
|
+
}
|
|
416
|
+
localFormattingTokens.lastIndex = 0;
|
|
417
|
+
while (i >= 0 && localFormattingTokens.test(format2)) {
|
|
418
|
+
format2 = format2.replace(
|
|
419
|
+
localFormattingTokens,
|
|
420
|
+
replaceLongDateFormatTokens
|
|
421
|
+
);
|
|
422
|
+
localFormattingTokens.lastIndex = 0;
|
|
423
|
+
i -= 1;
|
|
424
|
+
}
|
|
425
|
+
return format2;
|
|
426
|
+
}
|
|
427
|
+
var defaultLongDateFormat = {
|
|
428
|
+
LTS: "h:mm:ss A",
|
|
429
|
+
LT: "h:mm A",
|
|
430
|
+
L: "MM/DD/YYYY",
|
|
431
|
+
LL: "MMMM D, YYYY",
|
|
432
|
+
LLL: "MMMM D, YYYY h:mm A",
|
|
433
|
+
LLLL: "dddd, MMMM D, YYYY h:mm A"
|
|
434
|
+
};
|
|
435
|
+
function longDateFormat(key) {
|
|
436
|
+
var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
|
|
437
|
+
if (format2 || !formatUpper) {
|
|
438
|
+
return format2;
|
|
439
|
+
}
|
|
440
|
+
this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) {
|
|
441
|
+
if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
|
|
442
|
+
return tok.slice(1);
|
|
443
|
+
}
|
|
444
|
+
return tok;
|
|
445
|
+
}).join("");
|
|
446
|
+
return this._longDateFormat[key];
|
|
447
|
+
}
|
|
448
|
+
var defaultInvalidDate = "Invalid date";
|
|
449
|
+
function invalidDate() {
|
|
450
|
+
return this._invalidDate;
|
|
451
|
+
}
|
|
452
|
+
var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
|
|
453
|
+
function ordinal(number) {
|
|
454
|
+
return this._ordinal.replace("%d", number);
|
|
455
|
+
}
|
|
456
|
+
var defaultRelativeTime = {
|
|
457
|
+
future: "in %s",
|
|
458
|
+
past: "%s ago",
|
|
459
|
+
s: "a few seconds",
|
|
460
|
+
ss: "%d seconds",
|
|
461
|
+
m: "a minute",
|
|
462
|
+
mm: "%d minutes",
|
|
463
|
+
h: "an hour",
|
|
464
|
+
hh: "%d hours",
|
|
465
|
+
d: "a day",
|
|
466
|
+
dd: "%d days",
|
|
467
|
+
w: "a week",
|
|
468
|
+
ww: "%d weeks",
|
|
469
|
+
M: "a month",
|
|
470
|
+
MM: "%d months",
|
|
471
|
+
y: "a year",
|
|
472
|
+
yy: "%d years"
|
|
473
|
+
};
|
|
474
|
+
function relativeTime(number, withoutSuffix, string, isFuture) {
|
|
475
|
+
var output = this._relativeTime[string];
|
|
476
|
+
return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
|
|
477
|
+
}
|
|
478
|
+
function pastFuture(diff2, output) {
|
|
479
|
+
var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
|
|
480
|
+
return isFunction(format2) ? format2(output) : format2.replace(/%s/i, output);
|
|
481
|
+
}
|
|
482
|
+
var aliases = {
|
|
483
|
+
D: "date",
|
|
484
|
+
dates: "date",
|
|
485
|
+
date: "date",
|
|
486
|
+
d: "day",
|
|
487
|
+
days: "day",
|
|
488
|
+
day: "day",
|
|
489
|
+
e: "weekday",
|
|
490
|
+
weekdays: "weekday",
|
|
491
|
+
weekday: "weekday",
|
|
492
|
+
E: "isoWeekday",
|
|
493
|
+
isoweekdays: "isoWeekday",
|
|
494
|
+
isoweekday: "isoWeekday",
|
|
495
|
+
DDD: "dayOfYear",
|
|
496
|
+
dayofyears: "dayOfYear",
|
|
497
|
+
dayofyear: "dayOfYear",
|
|
498
|
+
h: "hour",
|
|
499
|
+
hours: "hour",
|
|
500
|
+
hour: "hour",
|
|
501
|
+
ms: "millisecond",
|
|
502
|
+
milliseconds: "millisecond",
|
|
503
|
+
millisecond: "millisecond",
|
|
504
|
+
m: "minute",
|
|
505
|
+
minutes: "minute",
|
|
506
|
+
minute: "minute",
|
|
507
|
+
M: "month",
|
|
508
|
+
months: "month",
|
|
509
|
+
month: "month",
|
|
510
|
+
Q: "quarter",
|
|
511
|
+
quarters: "quarter",
|
|
512
|
+
quarter: "quarter",
|
|
513
|
+
s: "second",
|
|
514
|
+
seconds: "second",
|
|
515
|
+
second: "second",
|
|
516
|
+
gg: "weekYear",
|
|
517
|
+
weekyears: "weekYear",
|
|
518
|
+
weekyear: "weekYear",
|
|
519
|
+
GG: "isoWeekYear",
|
|
520
|
+
isoweekyears: "isoWeekYear",
|
|
521
|
+
isoweekyear: "isoWeekYear",
|
|
522
|
+
w: "week",
|
|
523
|
+
weeks: "week",
|
|
524
|
+
week: "week",
|
|
525
|
+
W: "isoWeek",
|
|
526
|
+
isoweeks: "isoWeek",
|
|
527
|
+
isoweek: "isoWeek",
|
|
528
|
+
y: "year",
|
|
529
|
+
years: "year",
|
|
530
|
+
year: "year"
|
|
531
|
+
};
|
|
532
|
+
function normalizeUnits(units) {
|
|
533
|
+
return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
|
|
534
|
+
}
|
|
535
|
+
function normalizeObjectUnits(inputObject) {
|
|
536
|
+
var normalizedInput = {}, normalizedProp, prop;
|
|
537
|
+
for (prop in inputObject) {
|
|
538
|
+
if (hasOwnProp(inputObject, prop)) {
|
|
539
|
+
normalizedProp = normalizeUnits(prop);
|
|
540
|
+
if (normalizedProp) {
|
|
541
|
+
normalizedInput[normalizedProp] = inputObject[prop];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return normalizedInput;
|
|
546
|
+
}
|
|
547
|
+
var priorities = {
|
|
548
|
+
date: 9,
|
|
549
|
+
day: 11,
|
|
550
|
+
weekday: 11,
|
|
551
|
+
isoWeekday: 11,
|
|
552
|
+
dayOfYear: 4,
|
|
553
|
+
hour: 13,
|
|
554
|
+
millisecond: 16,
|
|
555
|
+
minute: 14,
|
|
556
|
+
month: 8,
|
|
557
|
+
quarter: 7,
|
|
558
|
+
second: 15,
|
|
559
|
+
weekYear: 1,
|
|
560
|
+
isoWeekYear: 1,
|
|
561
|
+
week: 5,
|
|
562
|
+
isoWeek: 5,
|
|
563
|
+
year: 1
|
|
564
|
+
};
|
|
565
|
+
function getPrioritizedUnits(unitsObj) {
|
|
566
|
+
var units = [], u;
|
|
567
|
+
for (u in unitsObj) {
|
|
568
|
+
if (hasOwnProp(unitsObj, u)) {
|
|
569
|
+
units.push({ unit: u, priority: priorities[u] });
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
units.sort(function(a, b) {
|
|
573
|
+
return a.priority - b.priority;
|
|
574
|
+
});
|
|
575
|
+
return units;
|
|
576
|
+
}
|
|
577
|
+
var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, match1to2HasZero = /^([1-9]\d|\d)/, regexes;
|
|
578
|
+
regexes = {};
|
|
579
|
+
function addRegexToken(token2, regex, strictRegex) {
|
|
580
|
+
regexes[token2] = isFunction(regex) ? regex : function(isStrict, localeData2) {
|
|
581
|
+
return isStrict && strictRegex ? strictRegex : regex;
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function getParseRegexForToken(token2, config) {
|
|
585
|
+
if (!hasOwnProp(regexes, token2)) {
|
|
586
|
+
return new RegExp(unescapeFormat(token2));
|
|
587
|
+
}
|
|
588
|
+
return regexes[token2](config._strict, config._locale);
|
|
589
|
+
}
|
|
590
|
+
function unescapeFormat(s) {
|
|
591
|
+
return regexEscape(
|
|
592
|
+
s.replace("\\", "").replace(
|
|
593
|
+
/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
|
|
594
|
+
function(matched, p1, p2, p3, p4) {
|
|
595
|
+
return p1 || p2 || p3 || p4;
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
function regexEscape(s) {
|
|
601
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
602
|
+
}
|
|
603
|
+
function absFloor(number) {
|
|
604
|
+
if (number < 0) {
|
|
605
|
+
return Math.ceil(number) || 0;
|
|
606
|
+
} else {
|
|
607
|
+
return Math.floor(number);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function toInt(argumentForCoercion) {
|
|
611
|
+
var coercedNumber = +argumentForCoercion, value = 0;
|
|
612
|
+
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
|
613
|
+
value = absFloor(coercedNumber);
|
|
614
|
+
}
|
|
615
|
+
return value;
|
|
616
|
+
}
|
|
617
|
+
var tokens = {};
|
|
618
|
+
function addParseToken(token2, callback) {
|
|
619
|
+
var i, func = callback, tokenLen;
|
|
620
|
+
if (typeof token2 === "string") {
|
|
621
|
+
token2 = [token2];
|
|
622
|
+
}
|
|
623
|
+
if (isNumber(callback)) {
|
|
624
|
+
func = function(input, array) {
|
|
625
|
+
array[callback] = toInt(input);
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
tokenLen = token2.length;
|
|
629
|
+
for (i = 0; i < tokenLen; i++) {
|
|
630
|
+
tokens[token2[i]] = func;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function addWeekParseToken(token2, callback) {
|
|
634
|
+
addParseToken(token2, function(input, array, config, token3) {
|
|
635
|
+
config._w = config._w || {};
|
|
636
|
+
callback(input, config._w, config, token3);
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
function addTimeToArrayFromToken(token2, input, config) {
|
|
640
|
+
if (input != null && hasOwnProp(tokens, token2)) {
|
|
641
|
+
tokens[token2](input, config._a, config, token2);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
function isLeapYear(year) {
|
|
645
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
646
|
+
}
|
|
647
|
+
var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
|
|
648
|
+
addFormatToken("Y", 0, 0, function() {
|
|
649
|
+
var y = this.year();
|
|
650
|
+
return y <= 9999 ? zeroFill(y, 4) : "+" + y;
|
|
651
|
+
});
|
|
652
|
+
addFormatToken(0, ["YY", 2], 0, function() {
|
|
653
|
+
return this.year() % 100;
|
|
654
|
+
});
|
|
655
|
+
addFormatToken(0, ["YYYY", 4], 0, "year");
|
|
656
|
+
addFormatToken(0, ["YYYYY", 5], 0, "year");
|
|
657
|
+
addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
|
|
658
|
+
addRegexToken("Y", matchSigned);
|
|
659
|
+
addRegexToken("YY", match1to2, match2);
|
|
660
|
+
addRegexToken("YYYY", match1to4, match4);
|
|
661
|
+
addRegexToken("YYYYY", match1to6, match6);
|
|
662
|
+
addRegexToken("YYYYYY", match1to6, match6);
|
|
663
|
+
addParseToken(["YYYYY", "YYYYYY"], YEAR);
|
|
664
|
+
addParseToken("YYYY", function(input, array) {
|
|
665
|
+
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
|
|
666
|
+
});
|
|
667
|
+
addParseToken("YY", function(input, array) {
|
|
668
|
+
array[YEAR] = hooks.parseTwoDigitYear(input);
|
|
669
|
+
});
|
|
670
|
+
addParseToken("Y", function(input, array) {
|
|
671
|
+
array[YEAR] = parseInt(input, 10);
|
|
672
|
+
});
|
|
673
|
+
function daysInYear(year) {
|
|
674
|
+
return isLeapYear(year) ? 366 : 365;
|
|
675
|
+
}
|
|
676
|
+
hooks.parseTwoDigitYear = function(input) {
|
|
677
|
+
return toInt(input) + (toInt(input) > 68 ? 1900 : 2e3);
|
|
678
|
+
};
|
|
679
|
+
var getSetYear = makeGetSet("FullYear", true);
|
|
680
|
+
function getIsLeapYear() {
|
|
681
|
+
return isLeapYear(this.year());
|
|
682
|
+
}
|
|
683
|
+
function makeGetSet(unit, keepTime) {
|
|
684
|
+
return function(value) {
|
|
685
|
+
if (value != null) {
|
|
686
|
+
set$1(this, unit, value);
|
|
687
|
+
hooks.updateOffset(this, keepTime);
|
|
688
|
+
return this;
|
|
689
|
+
} else {
|
|
690
|
+
return get(this, unit);
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function get(mom, unit) {
|
|
695
|
+
if (!mom.isValid()) {
|
|
696
|
+
return NaN;
|
|
697
|
+
}
|
|
698
|
+
var d = mom._d, isUTC = mom._isUTC;
|
|
699
|
+
switch (unit) {
|
|
700
|
+
case "Milliseconds":
|
|
701
|
+
return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
|
|
702
|
+
case "Seconds":
|
|
703
|
+
return isUTC ? d.getUTCSeconds() : d.getSeconds();
|
|
704
|
+
case "Minutes":
|
|
705
|
+
return isUTC ? d.getUTCMinutes() : d.getMinutes();
|
|
706
|
+
case "Hours":
|
|
707
|
+
return isUTC ? d.getUTCHours() : d.getHours();
|
|
708
|
+
case "Date":
|
|
709
|
+
return isUTC ? d.getUTCDate() : d.getDate();
|
|
710
|
+
case "Day":
|
|
711
|
+
return isUTC ? d.getUTCDay() : d.getDay();
|
|
712
|
+
case "Month":
|
|
713
|
+
return isUTC ? d.getUTCMonth() : d.getMonth();
|
|
714
|
+
case "FullYear":
|
|
715
|
+
return isUTC ? d.getUTCFullYear() : d.getFullYear();
|
|
716
|
+
default:
|
|
717
|
+
return NaN;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
function set$1(mom, unit, value) {
|
|
721
|
+
var d, isUTC, year, month, date;
|
|
722
|
+
if (!mom.isValid() || isNaN(value)) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
d = mom._d;
|
|
726
|
+
isUTC = mom._isUTC;
|
|
727
|
+
switch (unit) {
|
|
728
|
+
case "Milliseconds":
|
|
729
|
+
return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));
|
|
730
|
+
case "Seconds":
|
|
731
|
+
return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
|
|
732
|
+
case "Minutes":
|
|
733
|
+
return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
|
|
734
|
+
case "Hours":
|
|
735
|
+
return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
|
|
736
|
+
case "Date":
|
|
737
|
+
return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
|
|
738
|
+
// case 'Day': // Not real
|
|
739
|
+
// return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
|
|
740
|
+
// case 'Month': // Not used because we need to pass two variables
|
|
741
|
+
// return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
|
|
742
|
+
case "FullYear":
|
|
743
|
+
break;
|
|
744
|
+
// See below ...
|
|
745
|
+
default:
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
year = value;
|
|
749
|
+
month = mom.month();
|
|
750
|
+
date = mom.date();
|
|
751
|
+
date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
|
|
752
|
+
void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));
|
|
753
|
+
}
|
|
754
|
+
function stringGet(units) {
|
|
755
|
+
units = normalizeUnits(units);
|
|
756
|
+
if (isFunction(this[units])) {
|
|
757
|
+
return this[units]();
|
|
758
|
+
}
|
|
759
|
+
return this;
|
|
760
|
+
}
|
|
761
|
+
function stringSet(units, value) {
|
|
762
|
+
if (typeof units === "object") {
|
|
763
|
+
units = normalizeObjectUnits(units);
|
|
764
|
+
var prioritized = getPrioritizedUnits(units), i, prioritizedLen = prioritized.length;
|
|
765
|
+
for (i = 0; i < prioritizedLen; i++) {
|
|
766
|
+
this[prioritized[i].unit](units[prioritized[i].unit]);
|
|
767
|
+
}
|
|
768
|
+
} else {
|
|
769
|
+
units = normalizeUnits(units);
|
|
770
|
+
if (isFunction(this[units])) {
|
|
771
|
+
return this[units](value);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return this;
|
|
775
|
+
}
|
|
776
|
+
function mod(n, x) {
|
|
777
|
+
return (n % x + x) % x;
|
|
778
|
+
}
|
|
779
|
+
var indexOf;
|
|
780
|
+
if (Array.prototype.indexOf) {
|
|
781
|
+
indexOf = Array.prototype.indexOf;
|
|
782
|
+
} else {
|
|
783
|
+
indexOf = function(o) {
|
|
784
|
+
var i;
|
|
785
|
+
for (i = 0; i < this.length; ++i) {
|
|
786
|
+
if (this[i] === o) {
|
|
787
|
+
return i;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return -1;
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function daysInMonth(year, month) {
|
|
794
|
+
if (isNaN(year) || isNaN(month)) {
|
|
795
|
+
return NaN;
|
|
796
|
+
}
|
|
797
|
+
var modMonth = mod(month, 12);
|
|
798
|
+
year += (month - modMonth) / 12;
|
|
799
|
+
return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
|
|
800
|
+
}
|
|
801
|
+
addFormatToken("M", ["MM", 2], "Mo", function() {
|
|
802
|
+
return this.month() + 1;
|
|
803
|
+
});
|
|
804
|
+
addFormatToken("MMM", 0, 0, function(format2) {
|
|
805
|
+
return this.localeData().monthsShort(this, format2);
|
|
806
|
+
});
|
|
807
|
+
addFormatToken("MMMM", 0, 0, function(format2) {
|
|
808
|
+
return this.localeData().months(this, format2);
|
|
809
|
+
});
|
|
810
|
+
addRegexToken("M", match1to2, match1to2NoLeadingZero);
|
|
811
|
+
addRegexToken("MM", match1to2, match2);
|
|
812
|
+
addRegexToken("MMM", function(isStrict, locale2) {
|
|
813
|
+
return locale2.monthsShortRegex(isStrict);
|
|
814
|
+
});
|
|
815
|
+
addRegexToken("MMMM", function(isStrict, locale2) {
|
|
816
|
+
return locale2.monthsRegex(isStrict);
|
|
817
|
+
});
|
|
818
|
+
addParseToken(["M", "MM"], function(input, array) {
|
|
819
|
+
array[MONTH] = toInt(input) - 1;
|
|
820
|
+
});
|
|
821
|
+
addParseToken(["MMM", "MMMM"], function(input, array, config, token2) {
|
|
822
|
+
var month = config._locale.monthsParse(input, token2, config._strict);
|
|
823
|
+
if (month != null) {
|
|
824
|
+
array[MONTH] = month;
|
|
825
|
+
} else {
|
|
826
|
+
getParsingFlags(config).invalidMonth = input;
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split(
|
|
830
|
+
"_"
|
|
831
|
+
), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord;
|
|
832
|
+
function localeMonths(m, format2) {
|
|
833
|
+
if (!m) {
|
|
834
|
+
return isArray(this._months) ? this._months : this._months["standalone"];
|
|
835
|
+
}
|
|
836
|
+
return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m.month()];
|
|
837
|
+
}
|
|
838
|
+
function localeMonthsShort(m, format2) {
|
|
839
|
+
if (!m) {
|
|
840
|
+
return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
|
|
841
|
+
}
|
|
842
|
+
return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m.month()];
|
|
843
|
+
}
|
|
844
|
+
function handleStrictParse(monthName, format2, strict) {
|
|
845
|
+
var i, ii, mom, llc = monthName.toLocaleLowerCase();
|
|
846
|
+
if (!this._monthsParse) {
|
|
847
|
+
this._monthsParse = [];
|
|
848
|
+
this._longMonthsParse = [];
|
|
849
|
+
this._shortMonthsParse = [];
|
|
850
|
+
for (i = 0; i < 12; ++i) {
|
|
851
|
+
mom = createUTC([2e3, i]);
|
|
852
|
+
this._shortMonthsParse[i] = this.monthsShort(
|
|
853
|
+
mom,
|
|
854
|
+
""
|
|
855
|
+
).toLocaleLowerCase();
|
|
856
|
+
this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase();
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
if (strict) {
|
|
860
|
+
if (format2 === "MMM") {
|
|
861
|
+
ii = indexOf.call(this._shortMonthsParse, llc);
|
|
862
|
+
return ii !== -1 ? ii : null;
|
|
863
|
+
} else {
|
|
864
|
+
ii = indexOf.call(this._longMonthsParse, llc);
|
|
865
|
+
return ii !== -1 ? ii : null;
|
|
866
|
+
}
|
|
867
|
+
} else {
|
|
868
|
+
if (format2 === "MMM") {
|
|
869
|
+
ii = indexOf.call(this._shortMonthsParse, llc);
|
|
870
|
+
if (ii !== -1) {
|
|
871
|
+
return ii;
|
|
872
|
+
}
|
|
873
|
+
ii = indexOf.call(this._longMonthsParse, llc);
|
|
874
|
+
return ii !== -1 ? ii : null;
|
|
875
|
+
} else {
|
|
876
|
+
ii = indexOf.call(this._longMonthsParse, llc);
|
|
877
|
+
if (ii !== -1) {
|
|
878
|
+
return ii;
|
|
879
|
+
}
|
|
880
|
+
ii = indexOf.call(this._shortMonthsParse, llc);
|
|
881
|
+
return ii !== -1 ? ii : null;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
function localeMonthsParse(monthName, format2, strict) {
|
|
886
|
+
var i, mom, regex;
|
|
887
|
+
if (this._monthsParseExact) {
|
|
888
|
+
return handleStrictParse.call(this, monthName, format2, strict);
|
|
889
|
+
}
|
|
890
|
+
if (!this._monthsParse) {
|
|
891
|
+
this._monthsParse = [];
|
|
892
|
+
this._longMonthsParse = [];
|
|
893
|
+
this._shortMonthsParse = [];
|
|
894
|
+
}
|
|
895
|
+
for (i = 0; i < 12; i++) {
|
|
896
|
+
mom = createUTC([2e3, i]);
|
|
897
|
+
if (strict && !this._longMonthsParse[i]) {
|
|
898
|
+
this._longMonthsParse[i] = new RegExp(
|
|
899
|
+
"^" + this.months(mom, "").replace(".", "") + "$",
|
|
900
|
+
"i"
|
|
901
|
+
);
|
|
902
|
+
this._shortMonthsParse[i] = new RegExp(
|
|
903
|
+
"^" + this.monthsShort(mom, "").replace(".", "") + "$",
|
|
904
|
+
"i"
|
|
905
|
+
);
|
|
906
|
+
}
|
|
907
|
+
if (!strict && !this._monthsParse[i]) {
|
|
908
|
+
regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
|
|
909
|
+
this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i");
|
|
910
|
+
}
|
|
911
|
+
if (strict && format2 === "MMMM" && this._longMonthsParse[i].test(monthName)) {
|
|
912
|
+
return i;
|
|
913
|
+
} else if (strict && format2 === "MMM" && this._shortMonthsParse[i].test(monthName)) {
|
|
914
|
+
return i;
|
|
915
|
+
} else if (!strict && this._monthsParse[i].test(monthName)) {
|
|
916
|
+
return i;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function setMonth(mom, value) {
|
|
921
|
+
if (!mom.isValid()) {
|
|
922
|
+
return mom;
|
|
923
|
+
}
|
|
924
|
+
if (typeof value === "string") {
|
|
925
|
+
if (/^\d+$/.test(value)) {
|
|
926
|
+
value = toInt(value);
|
|
927
|
+
} else {
|
|
928
|
+
value = mom.localeData().monthsParse(value);
|
|
929
|
+
if (!isNumber(value)) {
|
|
930
|
+
return mom;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
var month = value, date = mom.date();
|
|
935
|
+
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
|
|
936
|
+
void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));
|
|
937
|
+
return mom;
|
|
938
|
+
}
|
|
939
|
+
function getSetMonth(value) {
|
|
940
|
+
if (value != null) {
|
|
941
|
+
setMonth(this, value);
|
|
942
|
+
hooks.updateOffset(this, true);
|
|
943
|
+
return this;
|
|
944
|
+
} else {
|
|
945
|
+
return get(this, "Month");
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
function getDaysInMonth() {
|
|
949
|
+
return daysInMonth(this.year(), this.month());
|
|
950
|
+
}
|
|
951
|
+
function monthsShortRegex(isStrict) {
|
|
952
|
+
if (this._monthsParseExact) {
|
|
953
|
+
if (!hasOwnProp(this, "_monthsRegex")) {
|
|
954
|
+
computeMonthsParse.call(this);
|
|
955
|
+
}
|
|
956
|
+
if (isStrict) {
|
|
957
|
+
return this._monthsShortStrictRegex;
|
|
958
|
+
} else {
|
|
959
|
+
return this._monthsShortRegex;
|
|
960
|
+
}
|
|
961
|
+
} else {
|
|
962
|
+
if (!hasOwnProp(this, "_monthsShortRegex")) {
|
|
963
|
+
this._monthsShortRegex = defaultMonthsShortRegex;
|
|
964
|
+
}
|
|
965
|
+
return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
function monthsRegex(isStrict) {
|
|
969
|
+
if (this._monthsParseExact) {
|
|
970
|
+
if (!hasOwnProp(this, "_monthsRegex")) {
|
|
971
|
+
computeMonthsParse.call(this);
|
|
972
|
+
}
|
|
973
|
+
if (isStrict) {
|
|
974
|
+
return this._monthsStrictRegex;
|
|
975
|
+
} else {
|
|
976
|
+
return this._monthsRegex;
|
|
977
|
+
}
|
|
978
|
+
} else {
|
|
979
|
+
if (!hasOwnProp(this, "_monthsRegex")) {
|
|
980
|
+
this._monthsRegex = defaultMonthsRegex;
|
|
981
|
+
}
|
|
982
|
+
return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function computeMonthsParse() {
|
|
986
|
+
function cmpLenRev(a, b) {
|
|
987
|
+
return b.length - a.length;
|
|
988
|
+
}
|
|
989
|
+
var shortPieces = [], longPieces = [], mixedPieces = [], i, mom, shortP, longP;
|
|
990
|
+
for (i = 0; i < 12; i++) {
|
|
991
|
+
mom = createUTC([2e3, i]);
|
|
992
|
+
shortP = regexEscape(this.monthsShort(mom, ""));
|
|
993
|
+
longP = regexEscape(this.months(mom, ""));
|
|
994
|
+
shortPieces.push(shortP);
|
|
995
|
+
longPieces.push(longP);
|
|
996
|
+
mixedPieces.push(longP);
|
|
997
|
+
mixedPieces.push(shortP);
|
|
998
|
+
}
|
|
999
|
+
shortPieces.sort(cmpLenRev);
|
|
1000
|
+
longPieces.sort(cmpLenRev);
|
|
1001
|
+
mixedPieces.sort(cmpLenRev);
|
|
1002
|
+
this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
|
|
1003
|
+
this._monthsShortRegex = this._monthsRegex;
|
|
1004
|
+
this._monthsStrictRegex = new RegExp(
|
|
1005
|
+
"^(" + longPieces.join("|") + ")",
|
|
1006
|
+
"i"
|
|
1007
|
+
);
|
|
1008
|
+
this._monthsShortStrictRegex = new RegExp(
|
|
1009
|
+
"^(" + shortPieces.join("|") + ")",
|
|
1010
|
+
"i"
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
function createDate(y, m, d, h, M, s, ms) {
|
|
1014
|
+
var date;
|
|
1015
|
+
if (y < 100 && y >= 0) {
|
|
1016
|
+
date = new Date(y + 400, m, d, h, M, s, ms);
|
|
1017
|
+
if (isFinite(date.getFullYear())) {
|
|
1018
|
+
date.setFullYear(y);
|
|
1019
|
+
}
|
|
1020
|
+
} else {
|
|
1021
|
+
date = new Date(y, m, d, h, M, s, ms);
|
|
1022
|
+
}
|
|
1023
|
+
return date;
|
|
1024
|
+
}
|
|
1025
|
+
function createUTCDate(y) {
|
|
1026
|
+
var date, args;
|
|
1027
|
+
if (y < 100 && y >= 0) {
|
|
1028
|
+
args = Array.prototype.slice.call(arguments);
|
|
1029
|
+
args[0] = y + 400;
|
|
1030
|
+
date = new Date(Date.UTC.apply(null, args));
|
|
1031
|
+
if (isFinite(date.getUTCFullYear())) {
|
|
1032
|
+
date.setUTCFullYear(y);
|
|
1033
|
+
}
|
|
1034
|
+
} else {
|
|
1035
|
+
date = new Date(Date.UTC.apply(null, arguments));
|
|
1036
|
+
}
|
|
1037
|
+
return date;
|
|
1038
|
+
}
|
|
1039
|
+
function firstWeekOffset(year, dow, doy) {
|
|
1040
|
+
var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
|
|
1041
|
+
return -fwdlw + fwd - 1;
|
|
1042
|
+
}
|
|
1043
|
+
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
|
|
1044
|
+
var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
|
|
1045
|
+
if (dayOfYear <= 0) {
|
|
1046
|
+
resYear = year - 1;
|
|
1047
|
+
resDayOfYear = daysInYear(resYear) + dayOfYear;
|
|
1048
|
+
} else if (dayOfYear > daysInYear(year)) {
|
|
1049
|
+
resYear = year + 1;
|
|
1050
|
+
resDayOfYear = dayOfYear - daysInYear(year);
|
|
1051
|
+
} else {
|
|
1052
|
+
resYear = year;
|
|
1053
|
+
resDayOfYear = dayOfYear;
|
|
1054
|
+
}
|
|
1055
|
+
return {
|
|
1056
|
+
year: resYear,
|
|
1057
|
+
dayOfYear: resDayOfYear
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
1060
|
+
function weekOfYear(mom, dow, doy) {
|
|
1061
|
+
var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
|
|
1062
|
+
if (week < 1) {
|
|
1063
|
+
resYear = mom.year() - 1;
|
|
1064
|
+
resWeek = week + weeksInYear(resYear, dow, doy);
|
|
1065
|
+
} else if (week > weeksInYear(mom.year(), dow, doy)) {
|
|
1066
|
+
resWeek = week - weeksInYear(mom.year(), dow, doy);
|
|
1067
|
+
resYear = mom.year() + 1;
|
|
1068
|
+
} else {
|
|
1069
|
+
resYear = mom.year();
|
|
1070
|
+
resWeek = week;
|
|
1071
|
+
}
|
|
1072
|
+
return {
|
|
1073
|
+
week: resWeek,
|
|
1074
|
+
year: resYear
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
function weeksInYear(year, dow, doy) {
|
|
1078
|
+
var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
|
|
1079
|
+
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
|
|
1080
|
+
}
|
|
1081
|
+
addFormatToken("w", ["ww", 2], "wo", "week");
|
|
1082
|
+
addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
|
|
1083
|
+
addRegexToken("w", match1to2, match1to2NoLeadingZero);
|
|
1084
|
+
addRegexToken("ww", match1to2, match2);
|
|
1085
|
+
addRegexToken("W", match1to2, match1to2NoLeadingZero);
|
|
1086
|
+
addRegexToken("WW", match1to2, match2);
|
|
1087
|
+
addWeekParseToken(
|
|
1088
|
+
["w", "ww", "W", "WW"],
|
|
1089
|
+
function(input, week, config, token2) {
|
|
1090
|
+
week[token2.substr(0, 1)] = toInt(input);
|
|
1091
|
+
}
|
|
1092
|
+
);
|
|
1093
|
+
function localeWeek(mom) {
|
|
1094
|
+
return weekOfYear(mom, this._week.dow, this._week.doy).week;
|
|
1095
|
+
}
|
|
1096
|
+
var defaultLocaleWeek = {
|
|
1097
|
+
dow: 0,
|
|
1098
|
+
// Sunday is the first day of the week.
|
|
1099
|
+
doy: 6
|
|
1100
|
+
// The week that contains Jan 6th is the first week of the year.
|
|
1101
|
+
};
|
|
1102
|
+
function localeFirstDayOfWeek() {
|
|
1103
|
+
return this._week.dow;
|
|
1104
|
+
}
|
|
1105
|
+
function localeFirstDayOfYear() {
|
|
1106
|
+
return this._week.doy;
|
|
1107
|
+
}
|
|
1108
|
+
function getSetWeek(input) {
|
|
1109
|
+
var week = this.localeData().week(this);
|
|
1110
|
+
return input == null ? week : this.add((input - week) * 7, "d");
|
|
1111
|
+
}
|
|
1112
|
+
function getSetISOWeek(input) {
|
|
1113
|
+
var week = weekOfYear(this, 1, 4).week;
|
|
1114
|
+
return input == null ? week : this.add((input - week) * 7, "d");
|
|
1115
|
+
}
|
|
1116
|
+
addFormatToken("d", 0, "do", "day");
|
|
1117
|
+
addFormatToken("dd", 0, 0, function(format2) {
|
|
1118
|
+
return this.localeData().weekdaysMin(this, format2);
|
|
1119
|
+
});
|
|
1120
|
+
addFormatToken("ddd", 0, 0, function(format2) {
|
|
1121
|
+
return this.localeData().weekdaysShort(this, format2);
|
|
1122
|
+
});
|
|
1123
|
+
addFormatToken("dddd", 0, 0, function(format2) {
|
|
1124
|
+
return this.localeData().weekdays(this, format2);
|
|
1125
|
+
});
|
|
1126
|
+
addFormatToken("e", 0, 0, "weekday");
|
|
1127
|
+
addFormatToken("E", 0, 0, "isoWeekday");
|
|
1128
|
+
addRegexToken("d", match1to2);
|
|
1129
|
+
addRegexToken("e", match1to2);
|
|
1130
|
+
addRegexToken("E", match1to2);
|
|
1131
|
+
addRegexToken("dd", function(isStrict, locale2) {
|
|
1132
|
+
return locale2.weekdaysMinRegex(isStrict);
|
|
1133
|
+
});
|
|
1134
|
+
addRegexToken("ddd", function(isStrict, locale2) {
|
|
1135
|
+
return locale2.weekdaysShortRegex(isStrict);
|
|
1136
|
+
});
|
|
1137
|
+
addRegexToken("dddd", function(isStrict, locale2) {
|
|
1138
|
+
return locale2.weekdaysRegex(isStrict);
|
|
1139
|
+
});
|
|
1140
|
+
addWeekParseToken(["dd", "ddd", "dddd"], function(input, week, config, token2) {
|
|
1141
|
+
var weekday = config._locale.weekdaysParse(input, token2, config._strict);
|
|
1142
|
+
if (weekday != null) {
|
|
1143
|
+
week.d = weekday;
|
|
1144
|
+
} else {
|
|
1145
|
+
getParsingFlags(config).invalidWeekday = input;
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
addWeekParseToken(["d", "e", "E"], function(input, week, config, token2) {
|
|
1149
|
+
week[token2] = toInt(input);
|
|
1150
|
+
});
|
|
1151
|
+
function parseWeekday(input, locale2) {
|
|
1152
|
+
if (typeof input !== "string") {
|
|
1153
|
+
return input;
|
|
1154
|
+
}
|
|
1155
|
+
if (!isNaN(input)) {
|
|
1156
|
+
return parseInt(input, 10);
|
|
1157
|
+
}
|
|
1158
|
+
input = locale2.weekdaysParse(input);
|
|
1159
|
+
if (typeof input === "number") {
|
|
1160
|
+
return input;
|
|
1161
|
+
}
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
function parseIsoWeekday(input, locale2) {
|
|
1165
|
+
if (typeof input === "string") {
|
|
1166
|
+
return locale2.weekdaysParse(input) % 7 || 7;
|
|
1167
|
+
}
|
|
1168
|
+
return isNaN(input) ? null : input;
|
|
1169
|
+
}
|
|
1170
|
+
function shiftWeekdays(ws, n) {
|
|
1171
|
+
return ws.slice(n, 7).concat(ws.slice(0, n));
|
|
1172
|
+
}
|
|
1173
|
+
var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
|
|
1174
|
+
function localeWeekdays(m, format2) {
|
|
1175
|
+
var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
|
|
1176
|
+
return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;
|
|
1177
|
+
}
|
|
1178
|
+
function localeWeekdaysShort(m) {
|
|
1179
|
+
return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
|
|
1180
|
+
}
|
|
1181
|
+
function localeWeekdaysMin(m) {
|
|
1182
|
+
return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
|
|
1183
|
+
}
|
|
1184
|
+
function handleStrictParse$1(weekdayName, format2, strict) {
|
|
1185
|
+
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
|
|
1186
|
+
if (!this._weekdaysParse) {
|
|
1187
|
+
this._weekdaysParse = [];
|
|
1188
|
+
this._shortWeekdaysParse = [];
|
|
1189
|
+
this._minWeekdaysParse = [];
|
|
1190
|
+
for (i = 0; i < 7; ++i) {
|
|
1191
|
+
mom = createUTC([2e3, 1]).day(i);
|
|
1192
|
+
this._minWeekdaysParse[i] = this.weekdaysMin(
|
|
1193
|
+
mom,
|
|
1194
|
+
""
|
|
1195
|
+
).toLocaleLowerCase();
|
|
1196
|
+
this._shortWeekdaysParse[i] = this.weekdaysShort(
|
|
1197
|
+
mom,
|
|
1198
|
+
""
|
|
1199
|
+
).toLocaleLowerCase();
|
|
1200
|
+
this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase();
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (strict) {
|
|
1204
|
+
if (format2 === "dddd") {
|
|
1205
|
+
ii = indexOf.call(this._weekdaysParse, llc);
|
|
1206
|
+
return ii !== -1 ? ii : null;
|
|
1207
|
+
} else if (format2 === "ddd") {
|
|
1208
|
+
ii = indexOf.call(this._shortWeekdaysParse, llc);
|
|
1209
|
+
return ii !== -1 ? ii : null;
|
|
1210
|
+
} else {
|
|
1211
|
+
ii = indexOf.call(this._minWeekdaysParse, llc);
|
|
1212
|
+
return ii !== -1 ? ii : null;
|
|
1213
|
+
}
|
|
1214
|
+
} else {
|
|
1215
|
+
if (format2 === "dddd") {
|
|
1216
|
+
ii = indexOf.call(this._weekdaysParse, llc);
|
|
1217
|
+
if (ii !== -1) {
|
|
1218
|
+
return ii;
|
|
1219
|
+
}
|
|
1220
|
+
ii = indexOf.call(this._shortWeekdaysParse, llc);
|
|
1221
|
+
if (ii !== -1) {
|
|
1222
|
+
return ii;
|
|
1223
|
+
}
|
|
1224
|
+
ii = indexOf.call(this._minWeekdaysParse, llc);
|
|
1225
|
+
return ii !== -1 ? ii : null;
|
|
1226
|
+
} else if (format2 === "ddd") {
|
|
1227
|
+
ii = indexOf.call(this._shortWeekdaysParse, llc);
|
|
1228
|
+
if (ii !== -1) {
|
|
1229
|
+
return ii;
|
|
1230
|
+
}
|
|
1231
|
+
ii = indexOf.call(this._weekdaysParse, llc);
|
|
1232
|
+
if (ii !== -1) {
|
|
1233
|
+
return ii;
|
|
1234
|
+
}
|
|
1235
|
+
ii = indexOf.call(this._minWeekdaysParse, llc);
|
|
1236
|
+
return ii !== -1 ? ii : null;
|
|
1237
|
+
} else {
|
|
1238
|
+
ii = indexOf.call(this._minWeekdaysParse, llc);
|
|
1239
|
+
if (ii !== -1) {
|
|
1240
|
+
return ii;
|
|
1241
|
+
}
|
|
1242
|
+
ii = indexOf.call(this._weekdaysParse, llc);
|
|
1243
|
+
if (ii !== -1) {
|
|
1244
|
+
return ii;
|
|
1245
|
+
}
|
|
1246
|
+
ii = indexOf.call(this._shortWeekdaysParse, llc);
|
|
1247
|
+
return ii !== -1 ? ii : null;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
function localeWeekdaysParse(weekdayName, format2, strict) {
|
|
1252
|
+
var i, mom, regex;
|
|
1253
|
+
if (this._weekdaysParseExact) {
|
|
1254
|
+
return handleStrictParse$1.call(this, weekdayName, format2, strict);
|
|
1255
|
+
}
|
|
1256
|
+
if (!this._weekdaysParse) {
|
|
1257
|
+
this._weekdaysParse = [];
|
|
1258
|
+
this._minWeekdaysParse = [];
|
|
1259
|
+
this._shortWeekdaysParse = [];
|
|
1260
|
+
this._fullWeekdaysParse = [];
|
|
1261
|
+
}
|
|
1262
|
+
for (i = 0; i < 7; i++) {
|
|
1263
|
+
mom = createUTC([2e3, 1]).day(i);
|
|
1264
|
+
if (strict && !this._fullWeekdaysParse[i]) {
|
|
1265
|
+
this._fullWeekdaysParse[i] = new RegExp(
|
|
1266
|
+
"^" + this.weekdays(mom, "").replace(".", "\\.?") + "$",
|
|
1267
|
+
"i"
|
|
1268
|
+
);
|
|
1269
|
+
this._shortWeekdaysParse[i] = new RegExp(
|
|
1270
|
+
"^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$",
|
|
1271
|
+
"i"
|
|
1272
|
+
);
|
|
1273
|
+
this._minWeekdaysParse[i] = new RegExp(
|
|
1274
|
+
"^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$",
|
|
1275
|
+
"i"
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
if (!this._weekdaysParse[i]) {
|
|
1279
|
+
regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
|
|
1280
|
+
this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i");
|
|
1281
|
+
}
|
|
1282
|
+
if (strict && format2 === "dddd" && this._fullWeekdaysParse[i].test(weekdayName)) {
|
|
1283
|
+
return i;
|
|
1284
|
+
} else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i].test(weekdayName)) {
|
|
1285
|
+
return i;
|
|
1286
|
+
} else if (strict && format2 === "dd" && this._minWeekdaysParse[i].test(weekdayName)) {
|
|
1287
|
+
return i;
|
|
1288
|
+
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
|
|
1289
|
+
return i;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
function getSetDayOfWeek(input) {
|
|
1294
|
+
if (!this.isValid()) {
|
|
1295
|
+
return input != null ? this : NaN;
|
|
1296
|
+
}
|
|
1297
|
+
var day = get(this, "Day");
|
|
1298
|
+
if (input != null) {
|
|
1299
|
+
input = parseWeekday(input, this.localeData());
|
|
1300
|
+
return this.add(input - day, "d");
|
|
1301
|
+
} else {
|
|
1302
|
+
return day;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function getSetLocaleDayOfWeek(input) {
|
|
1306
|
+
if (!this.isValid()) {
|
|
1307
|
+
return input != null ? this : NaN;
|
|
1308
|
+
}
|
|
1309
|
+
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
|
|
1310
|
+
return input == null ? weekday : this.add(input - weekday, "d");
|
|
1311
|
+
}
|
|
1312
|
+
function getSetISODayOfWeek(input) {
|
|
1313
|
+
if (!this.isValid()) {
|
|
1314
|
+
return input != null ? this : NaN;
|
|
1315
|
+
}
|
|
1316
|
+
if (input != null) {
|
|
1317
|
+
var weekday = parseIsoWeekday(input, this.localeData());
|
|
1318
|
+
return this.day(this.day() % 7 ? weekday : weekday - 7);
|
|
1319
|
+
} else {
|
|
1320
|
+
return this.day() || 7;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
function weekdaysRegex(isStrict) {
|
|
1324
|
+
if (this._weekdaysParseExact) {
|
|
1325
|
+
if (!hasOwnProp(this, "_weekdaysRegex")) {
|
|
1326
|
+
computeWeekdaysParse.call(this);
|
|
1327
|
+
}
|
|
1328
|
+
if (isStrict) {
|
|
1329
|
+
return this._weekdaysStrictRegex;
|
|
1330
|
+
} else {
|
|
1331
|
+
return this._weekdaysRegex;
|
|
1332
|
+
}
|
|
1333
|
+
} else {
|
|
1334
|
+
if (!hasOwnProp(this, "_weekdaysRegex")) {
|
|
1335
|
+
this._weekdaysRegex = defaultWeekdaysRegex;
|
|
1336
|
+
}
|
|
1337
|
+
return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function weekdaysShortRegex(isStrict) {
|
|
1341
|
+
if (this._weekdaysParseExact) {
|
|
1342
|
+
if (!hasOwnProp(this, "_weekdaysRegex")) {
|
|
1343
|
+
computeWeekdaysParse.call(this);
|
|
1344
|
+
}
|
|
1345
|
+
if (isStrict) {
|
|
1346
|
+
return this._weekdaysShortStrictRegex;
|
|
1347
|
+
} else {
|
|
1348
|
+
return this._weekdaysShortRegex;
|
|
1349
|
+
}
|
|
1350
|
+
} else {
|
|
1351
|
+
if (!hasOwnProp(this, "_weekdaysShortRegex")) {
|
|
1352
|
+
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
|
|
1353
|
+
}
|
|
1354
|
+
return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
function weekdaysMinRegex(isStrict) {
|
|
1358
|
+
if (this._weekdaysParseExact) {
|
|
1359
|
+
if (!hasOwnProp(this, "_weekdaysRegex")) {
|
|
1360
|
+
computeWeekdaysParse.call(this);
|
|
1361
|
+
}
|
|
1362
|
+
if (isStrict) {
|
|
1363
|
+
return this._weekdaysMinStrictRegex;
|
|
1364
|
+
} else {
|
|
1365
|
+
return this._weekdaysMinRegex;
|
|
1366
|
+
}
|
|
1367
|
+
} else {
|
|
1368
|
+
if (!hasOwnProp(this, "_weekdaysMinRegex")) {
|
|
1369
|
+
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
|
|
1370
|
+
}
|
|
1371
|
+
return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
function computeWeekdaysParse() {
|
|
1375
|
+
function cmpLenRev(a, b) {
|
|
1376
|
+
return b.length - a.length;
|
|
1377
|
+
}
|
|
1378
|
+
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp;
|
|
1379
|
+
for (i = 0; i < 7; i++) {
|
|
1380
|
+
mom = createUTC([2e3, 1]).day(i);
|
|
1381
|
+
minp = regexEscape(this.weekdaysMin(mom, ""));
|
|
1382
|
+
shortp = regexEscape(this.weekdaysShort(mom, ""));
|
|
1383
|
+
longp = regexEscape(this.weekdays(mom, ""));
|
|
1384
|
+
minPieces.push(minp);
|
|
1385
|
+
shortPieces.push(shortp);
|
|
1386
|
+
longPieces.push(longp);
|
|
1387
|
+
mixedPieces.push(minp);
|
|
1388
|
+
mixedPieces.push(shortp);
|
|
1389
|
+
mixedPieces.push(longp);
|
|
1390
|
+
}
|
|
1391
|
+
minPieces.sort(cmpLenRev);
|
|
1392
|
+
shortPieces.sort(cmpLenRev);
|
|
1393
|
+
longPieces.sort(cmpLenRev);
|
|
1394
|
+
mixedPieces.sort(cmpLenRev);
|
|
1395
|
+
this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
|
|
1396
|
+
this._weekdaysShortRegex = this._weekdaysRegex;
|
|
1397
|
+
this._weekdaysMinRegex = this._weekdaysRegex;
|
|
1398
|
+
this._weekdaysStrictRegex = new RegExp(
|
|
1399
|
+
"^(" + longPieces.join("|") + ")",
|
|
1400
|
+
"i"
|
|
1401
|
+
);
|
|
1402
|
+
this._weekdaysShortStrictRegex = new RegExp(
|
|
1403
|
+
"^(" + shortPieces.join("|") + ")",
|
|
1404
|
+
"i"
|
|
1405
|
+
);
|
|
1406
|
+
this._weekdaysMinStrictRegex = new RegExp(
|
|
1407
|
+
"^(" + minPieces.join("|") + ")",
|
|
1408
|
+
"i"
|
|
1409
|
+
);
|
|
1410
|
+
}
|
|
1411
|
+
function hFormat() {
|
|
1412
|
+
return this.hours() % 12 || 12;
|
|
1413
|
+
}
|
|
1414
|
+
function kFormat() {
|
|
1415
|
+
return this.hours() || 24;
|
|
1416
|
+
}
|
|
1417
|
+
addFormatToken("H", ["HH", 2], 0, "hour");
|
|
1418
|
+
addFormatToken("h", ["hh", 2], 0, hFormat);
|
|
1419
|
+
addFormatToken("k", ["kk", 2], 0, kFormat);
|
|
1420
|
+
addFormatToken("hmm", 0, 0, function() {
|
|
1421
|
+
return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
|
|
1422
|
+
});
|
|
1423
|
+
addFormatToken("hmmss", 0, 0, function() {
|
|
1424
|
+
return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
|
|
1425
|
+
});
|
|
1426
|
+
addFormatToken("Hmm", 0, 0, function() {
|
|
1427
|
+
return "" + this.hours() + zeroFill(this.minutes(), 2);
|
|
1428
|
+
});
|
|
1429
|
+
addFormatToken("Hmmss", 0, 0, function() {
|
|
1430
|
+
return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
|
|
1431
|
+
});
|
|
1432
|
+
function meridiem(token2, lowercase) {
|
|
1433
|
+
addFormatToken(token2, 0, 0, function() {
|
|
1434
|
+
return this.localeData().meridiem(
|
|
1435
|
+
this.hours(),
|
|
1436
|
+
this.minutes(),
|
|
1437
|
+
lowercase
|
|
1438
|
+
);
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
meridiem("a", true);
|
|
1442
|
+
meridiem("A", false);
|
|
1443
|
+
function matchMeridiem(isStrict, locale2) {
|
|
1444
|
+
return locale2._meridiemParse;
|
|
1445
|
+
}
|
|
1446
|
+
addRegexToken("a", matchMeridiem);
|
|
1447
|
+
addRegexToken("A", matchMeridiem);
|
|
1448
|
+
addRegexToken("H", match1to2, match1to2HasZero);
|
|
1449
|
+
addRegexToken("h", match1to2, match1to2NoLeadingZero);
|
|
1450
|
+
addRegexToken("k", match1to2, match1to2NoLeadingZero);
|
|
1451
|
+
addRegexToken("HH", match1to2, match2);
|
|
1452
|
+
addRegexToken("hh", match1to2, match2);
|
|
1453
|
+
addRegexToken("kk", match1to2, match2);
|
|
1454
|
+
addRegexToken("hmm", match3to4);
|
|
1455
|
+
addRegexToken("hmmss", match5to6);
|
|
1456
|
+
addRegexToken("Hmm", match3to4);
|
|
1457
|
+
addRegexToken("Hmmss", match5to6);
|
|
1458
|
+
addParseToken(["H", "HH"], HOUR);
|
|
1459
|
+
addParseToken(["k", "kk"], function(input, array, config) {
|
|
1460
|
+
var kInput = toInt(input);
|
|
1461
|
+
array[HOUR] = kInput === 24 ? 0 : kInput;
|
|
1462
|
+
});
|
|
1463
|
+
addParseToken(["a", "A"], function(input, array, config) {
|
|
1464
|
+
config._isPm = config._locale.isPM(input);
|
|
1465
|
+
config._meridiem = input;
|
|
1466
|
+
});
|
|
1467
|
+
addParseToken(["h", "hh"], function(input, array, config) {
|
|
1468
|
+
array[HOUR] = toInt(input);
|
|
1469
|
+
getParsingFlags(config).bigHour = true;
|
|
1470
|
+
});
|
|
1471
|
+
addParseToken("hmm", function(input, array, config) {
|
|
1472
|
+
var pos = input.length - 2;
|
|
1473
|
+
array[HOUR] = toInt(input.substr(0, pos));
|
|
1474
|
+
array[MINUTE] = toInt(input.substr(pos));
|
|
1475
|
+
getParsingFlags(config).bigHour = true;
|
|
1476
|
+
});
|
|
1477
|
+
addParseToken("hmmss", function(input, array, config) {
|
|
1478
|
+
var pos1 = input.length - 4, pos2 = input.length - 2;
|
|
1479
|
+
array[HOUR] = toInt(input.substr(0, pos1));
|
|
1480
|
+
array[MINUTE] = toInt(input.substr(pos1, 2));
|
|
1481
|
+
array[SECOND] = toInt(input.substr(pos2));
|
|
1482
|
+
getParsingFlags(config).bigHour = true;
|
|
1483
|
+
});
|
|
1484
|
+
addParseToken("Hmm", function(input, array, config) {
|
|
1485
|
+
var pos = input.length - 2;
|
|
1486
|
+
array[HOUR] = toInt(input.substr(0, pos));
|
|
1487
|
+
array[MINUTE] = toInt(input.substr(pos));
|
|
1488
|
+
});
|
|
1489
|
+
addParseToken("Hmmss", function(input, array, config) {
|
|
1490
|
+
var pos1 = input.length - 4, pos2 = input.length - 2;
|
|
1491
|
+
array[HOUR] = toInt(input.substr(0, pos1));
|
|
1492
|
+
array[MINUTE] = toInt(input.substr(pos1, 2));
|
|
1493
|
+
array[SECOND] = toInt(input.substr(pos2));
|
|
1494
|
+
});
|
|
1495
|
+
function localeIsPM(input) {
|
|
1496
|
+
return (input + "").toLowerCase().charAt(0) === "p";
|
|
1497
|
+
}
|
|
1498
|
+
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true);
|
|
1499
|
+
function localeMeridiem(hours2, minutes2, isLower) {
|
|
1500
|
+
if (hours2 > 11) {
|
|
1501
|
+
return isLower ? "pm" : "PM";
|
|
1502
|
+
} else {
|
|
1503
|
+
return isLower ? "am" : "AM";
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
var baseConfig = {
|
|
1507
|
+
calendar: defaultCalendar,
|
|
1508
|
+
longDateFormat: defaultLongDateFormat,
|
|
1509
|
+
invalidDate: defaultInvalidDate,
|
|
1510
|
+
ordinal: defaultOrdinal,
|
|
1511
|
+
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
|
|
1512
|
+
relativeTime: defaultRelativeTime,
|
|
1513
|
+
months: defaultLocaleMonths,
|
|
1514
|
+
monthsShort: defaultLocaleMonthsShort,
|
|
1515
|
+
week: defaultLocaleWeek,
|
|
1516
|
+
weekdays: defaultLocaleWeekdays,
|
|
1517
|
+
weekdaysMin: defaultLocaleWeekdaysMin,
|
|
1518
|
+
weekdaysShort: defaultLocaleWeekdaysShort,
|
|
1519
|
+
meridiemParse: defaultLocaleMeridiemParse
|
|
1520
|
+
};
|
|
1521
|
+
var locales = {}, localeFamilies = {}, globalLocale;
|
|
1522
|
+
function commonPrefix(arr1, arr2) {
|
|
1523
|
+
var i, minl = Math.min(arr1.length, arr2.length);
|
|
1524
|
+
for (i = 0; i < minl; i += 1) {
|
|
1525
|
+
if (arr1[i] !== arr2[i]) {
|
|
1526
|
+
return i;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
return minl;
|
|
1530
|
+
}
|
|
1531
|
+
function normalizeLocale(key) {
|
|
1532
|
+
return key ? key.toLowerCase().replace("_", "-") : key;
|
|
1533
|
+
}
|
|
1534
|
+
function chooseLocale(names) {
|
|
1535
|
+
var i = 0, j, next, locale2, split;
|
|
1536
|
+
while (i < names.length) {
|
|
1537
|
+
split = normalizeLocale(names[i]).split("-");
|
|
1538
|
+
j = split.length;
|
|
1539
|
+
next = normalizeLocale(names[i + 1]);
|
|
1540
|
+
next = next ? next.split("-") : null;
|
|
1541
|
+
while (j > 0) {
|
|
1542
|
+
locale2 = loadLocale(split.slice(0, j).join("-"));
|
|
1543
|
+
if (locale2) {
|
|
1544
|
+
return locale2;
|
|
1545
|
+
}
|
|
1546
|
+
if (next && next.length >= j && commonPrefix(split, next) >= j - 1) {
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
j--;
|
|
1550
|
+
}
|
|
1551
|
+
i++;
|
|
1552
|
+
}
|
|
1553
|
+
return globalLocale;
|
|
1554
|
+
}
|
|
1555
|
+
function isLocaleNameSane(name) {
|
|
1556
|
+
return !!(name && name.match("^[^/\\\\]*$"));
|
|
1557
|
+
}
|
|
1558
|
+
function loadLocale(name) {
|
|
1559
|
+
var oldLocale = null, aliasedRequire;
|
|
1560
|
+
if (locales[name] === void 0 && typeof module2 !== "undefined" && module2 && module2.exports && isLocaleNameSane(name)) {
|
|
1561
|
+
try {
|
|
1562
|
+
oldLocale = globalLocale._abbr;
|
|
1563
|
+
aliasedRequire = require;
|
|
1564
|
+
aliasedRequire("./locale/" + name);
|
|
1565
|
+
getSetGlobalLocale(oldLocale);
|
|
1566
|
+
} catch (e2) {
|
|
1567
|
+
locales[name] = null;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
return locales[name];
|
|
1571
|
+
}
|
|
1572
|
+
function getSetGlobalLocale(key, values) {
|
|
1573
|
+
var data;
|
|
1574
|
+
if (key) {
|
|
1575
|
+
if (isUndefined(values)) {
|
|
1576
|
+
data = getLocale(key);
|
|
1577
|
+
} else {
|
|
1578
|
+
data = defineLocale(key, values);
|
|
1579
|
+
}
|
|
1580
|
+
if (data) {
|
|
1581
|
+
globalLocale = data;
|
|
1582
|
+
} else {
|
|
1583
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
1584
|
+
console.warn(
|
|
1585
|
+
"Locale " + key + " not found. Did you forget to load it?"
|
|
1586
|
+
);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return globalLocale._abbr;
|
|
1591
|
+
}
|
|
1592
|
+
function defineLocale(name, config) {
|
|
1593
|
+
if (config !== null) {
|
|
1594
|
+
var locale2, parentConfig = baseConfig;
|
|
1595
|
+
config.abbr = name;
|
|
1596
|
+
if (locales[name] != null) {
|
|
1597
|
+
deprecateSimple(
|
|
1598
|
+
"defineLocaleOverride",
|
|
1599
|
+
"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
|
|
1600
|
+
);
|
|
1601
|
+
parentConfig = locales[name]._config;
|
|
1602
|
+
} else if (config.parentLocale != null) {
|
|
1603
|
+
if (locales[config.parentLocale] != null) {
|
|
1604
|
+
parentConfig = locales[config.parentLocale]._config;
|
|
1605
|
+
} else {
|
|
1606
|
+
locale2 = loadLocale(config.parentLocale);
|
|
1607
|
+
if (locale2 != null) {
|
|
1608
|
+
parentConfig = locale2._config;
|
|
1609
|
+
} else {
|
|
1610
|
+
if (!localeFamilies[config.parentLocale]) {
|
|
1611
|
+
localeFamilies[config.parentLocale] = [];
|
|
1612
|
+
}
|
|
1613
|
+
localeFamilies[config.parentLocale].push({
|
|
1614
|
+
name,
|
|
1615
|
+
config
|
|
1616
|
+
});
|
|
1617
|
+
return null;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
|
1622
|
+
if (localeFamilies[name]) {
|
|
1623
|
+
localeFamilies[name].forEach(function(x) {
|
|
1624
|
+
defineLocale(x.name, x.config);
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
getSetGlobalLocale(name);
|
|
1628
|
+
return locales[name];
|
|
1629
|
+
} else {
|
|
1630
|
+
delete locales[name];
|
|
1631
|
+
return null;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
function updateLocale(name, config) {
|
|
1635
|
+
if (config != null) {
|
|
1636
|
+
var locale2, tmpLocale, parentConfig = baseConfig;
|
|
1637
|
+
if (locales[name] != null && locales[name].parentLocale != null) {
|
|
1638
|
+
locales[name].set(mergeConfigs(locales[name]._config, config));
|
|
1639
|
+
} else {
|
|
1640
|
+
tmpLocale = loadLocale(name);
|
|
1641
|
+
if (tmpLocale != null) {
|
|
1642
|
+
parentConfig = tmpLocale._config;
|
|
1643
|
+
}
|
|
1644
|
+
config = mergeConfigs(parentConfig, config);
|
|
1645
|
+
if (tmpLocale == null) {
|
|
1646
|
+
config.abbr = name;
|
|
1647
|
+
}
|
|
1648
|
+
locale2 = new Locale(config);
|
|
1649
|
+
locale2.parentLocale = locales[name];
|
|
1650
|
+
locales[name] = locale2;
|
|
1651
|
+
}
|
|
1652
|
+
getSetGlobalLocale(name);
|
|
1653
|
+
} else {
|
|
1654
|
+
if (locales[name] != null) {
|
|
1655
|
+
if (locales[name].parentLocale != null) {
|
|
1656
|
+
locales[name] = locales[name].parentLocale;
|
|
1657
|
+
if (name === getSetGlobalLocale()) {
|
|
1658
|
+
getSetGlobalLocale(name);
|
|
1659
|
+
}
|
|
1660
|
+
} else if (locales[name] != null) {
|
|
1661
|
+
delete locales[name];
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
return locales[name];
|
|
1666
|
+
}
|
|
1667
|
+
function getLocale(key) {
|
|
1668
|
+
var locale2;
|
|
1669
|
+
if (key && key._locale && key._locale._abbr) {
|
|
1670
|
+
key = key._locale._abbr;
|
|
1671
|
+
}
|
|
1672
|
+
if (!key) {
|
|
1673
|
+
return globalLocale;
|
|
1674
|
+
}
|
|
1675
|
+
if (!isArray(key)) {
|
|
1676
|
+
locale2 = loadLocale(key);
|
|
1677
|
+
if (locale2) {
|
|
1678
|
+
return locale2;
|
|
1679
|
+
}
|
|
1680
|
+
key = [key];
|
|
1681
|
+
}
|
|
1682
|
+
return chooseLocale(key);
|
|
1683
|
+
}
|
|
1684
|
+
function listLocales() {
|
|
1685
|
+
return keys(locales);
|
|
1686
|
+
}
|
|
1687
|
+
function checkOverflow(m) {
|
|
1688
|
+
var overflow, a = m._a;
|
|
1689
|
+
if (a && getParsingFlags(m).overflow === -2) {
|
|
1690
|
+
overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;
|
|
1691
|
+
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
|
1692
|
+
overflow = DATE;
|
|
1693
|
+
}
|
|
1694
|
+
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
|
|
1695
|
+
overflow = WEEK;
|
|
1696
|
+
}
|
|
1697
|
+
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
|
|
1698
|
+
overflow = WEEKDAY;
|
|
1699
|
+
}
|
|
1700
|
+
getParsingFlags(m).overflow = overflow;
|
|
1701
|
+
}
|
|
1702
|
+
return m;
|
|
1703
|
+
}
|
|
1704
|
+
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [
|
|
1705
|
+
["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
|
|
1706
|
+
["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
|
|
1707
|
+
["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
|
|
1708
|
+
["GGGG-[W]WW", /\d{4}-W\d\d/, false],
|
|
1709
|
+
["YYYY-DDD", /\d{4}-\d{3}/],
|
|
1710
|
+
["YYYY-MM", /\d{4}-\d\d/, false],
|
|
1711
|
+
["YYYYYYMMDD", /[+-]\d{10}/],
|
|
1712
|
+
["YYYYMMDD", /\d{8}/],
|
|
1713
|
+
["GGGG[W]WWE", /\d{4}W\d{3}/],
|
|
1714
|
+
["GGGG[W]WW", /\d{4}W\d{2}/, false],
|
|
1715
|
+
["YYYYDDD", /\d{7}/],
|
|
1716
|
+
["YYYYMM", /\d{6}/, false],
|
|
1717
|
+
["YYYY", /\d{4}/, false]
|
|
1718
|
+
], isoTimes = [
|
|
1719
|
+
["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
|
|
1720
|
+
["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
|
|
1721
|
+
["HH:mm:ss", /\d\d:\d\d:\d\d/],
|
|
1722
|
+
["HH:mm", /\d\d:\d\d/],
|
|
1723
|
+
["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
|
|
1724
|
+
["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
|
|
1725
|
+
["HHmmss", /\d\d\d\d\d\d/],
|
|
1726
|
+
["HHmm", /\d\d\d\d/],
|
|
1727
|
+
["HH", /\d\d/]
|
|
1728
|
+
], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = {
|
|
1729
|
+
UT: 0,
|
|
1730
|
+
GMT: 0,
|
|
1731
|
+
EDT: -4 * 60,
|
|
1732
|
+
EST: -5 * 60,
|
|
1733
|
+
CDT: -5 * 60,
|
|
1734
|
+
CST: -6 * 60,
|
|
1735
|
+
MDT: -6 * 60,
|
|
1736
|
+
MST: -7 * 60,
|
|
1737
|
+
PDT: -7 * 60,
|
|
1738
|
+
PST: -8 * 60
|
|
1739
|
+
};
|
|
1740
|
+
function configFromISO(config) {
|
|
1741
|
+
var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
|
|
1742
|
+
if (match) {
|
|
1743
|
+
getParsingFlags(config).iso = true;
|
|
1744
|
+
for (i = 0, l = isoDatesLen; i < l; i++) {
|
|
1745
|
+
if (isoDates[i][1].exec(match[1])) {
|
|
1746
|
+
dateFormat = isoDates[i][0];
|
|
1747
|
+
allowTime = isoDates[i][2] !== false;
|
|
1748
|
+
break;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
if (dateFormat == null) {
|
|
1752
|
+
config._isValid = false;
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
if (match[3]) {
|
|
1756
|
+
for (i = 0, l = isoTimesLen; i < l; i++) {
|
|
1757
|
+
if (isoTimes[i][1].exec(match[3])) {
|
|
1758
|
+
timeFormat = (match[2] || " ") + isoTimes[i][0];
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
if (timeFormat == null) {
|
|
1763
|
+
config._isValid = false;
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (!allowTime && timeFormat != null) {
|
|
1768
|
+
config._isValid = false;
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
if (match[4]) {
|
|
1772
|
+
if (tzRegex.exec(match[4])) {
|
|
1773
|
+
tzFormat = "Z";
|
|
1774
|
+
} else {
|
|
1775
|
+
config._isValid = false;
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
config._f = dateFormat + (timeFormat || "") + (tzFormat || "");
|
|
1780
|
+
configFromStringAndFormat(config);
|
|
1781
|
+
} else {
|
|
1782
|
+
config._isValid = false;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
|
|
1786
|
+
var result = [
|
|
1787
|
+
untruncateYear(yearStr),
|
|
1788
|
+
defaultLocaleMonthsShort.indexOf(monthStr),
|
|
1789
|
+
parseInt(dayStr, 10),
|
|
1790
|
+
parseInt(hourStr, 10),
|
|
1791
|
+
parseInt(minuteStr, 10)
|
|
1792
|
+
];
|
|
1793
|
+
if (secondStr) {
|
|
1794
|
+
result.push(parseInt(secondStr, 10));
|
|
1795
|
+
}
|
|
1796
|
+
return result;
|
|
1797
|
+
}
|
|
1798
|
+
function untruncateYear(yearStr) {
|
|
1799
|
+
var year = parseInt(yearStr, 10);
|
|
1800
|
+
if (year <= 49) {
|
|
1801
|
+
return 2e3 + year;
|
|
1802
|
+
} else if (year <= 999) {
|
|
1803
|
+
return 1900 + year;
|
|
1804
|
+
}
|
|
1805
|
+
return year;
|
|
1806
|
+
}
|
|
1807
|
+
function preprocessRFC2822(s) {
|
|
1808
|
+
return s.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
|
|
1809
|
+
}
|
|
1810
|
+
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
1811
|
+
if (weekdayStr) {
|
|
1812
|
+
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(
|
|
1813
|
+
parsedInput[0],
|
|
1814
|
+
parsedInput[1],
|
|
1815
|
+
parsedInput[2]
|
|
1816
|
+
).getDay();
|
|
1817
|
+
if (weekdayProvided !== weekdayActual) {
|
|
1818
|
+
getParsingFlags(config).weekdayMismatch = true;
|
|
1819
|
+
config._isValid = false;
|
|
1820
|
+
return false;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return true;
|
|
1824
|
+
}
|
|
1825
|
+
function calculateOffset(obsOffset, militaryOffset, numOffset) {
|
|
1826
|
+
if (obsOffset) {
|
|
1827
|
+
return obsOffsets[obsOffset];
|
|
1828
|
+
} else if (militaryOffset) {
|
|
1829
|
+
return 0;
|
|
1830
|
+
} else {
|
|
1831
|
+
var hm = parseInt(numOffset, 10), m = hm % 100, h = (hm - m) / 100;
|
|
1832
|
+
return h * 60 + m;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
function configFromRFC2822(config) {
|
|
1836
|
+
var match = rfc2822.exec(preprocessRFC2822(config._i)), parsedArray;
|
|
1837
|
+
if (match) {
|
|
1838
|
+
parsedArray = extractFromRFC2822Strings(
|
|
1839
|
+
match[4],
|
|
1840
|
+
match[3],
|
|
1841
|
+
match[2],
|
|
1842
|
+
match[5],
|
|
1843
|
+
match[6],
|
|
1844
|
+
match[7]
|
|
1845
|
+
);
|
|
1846
|
+
if (!checkWeekday(match[1], parsedArray, config)) {
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
config._a = parsedArray;
|
|
1850
|
+
config._tzm = calculateOffset(match[8], match[9], match[10]);
|
|
1851
|
+
config._d = createUTCDate.apply(null, config._a);
|
|
1852
|
+
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
|
|
1853
|
+
getParsingFlags(config).rfc2822 = true;
|
|
1854
|
+
} else {
|
|
1855
|
+
config._isValid = false;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
function configFromString(config) {
|
|
1859
|
+
var matched = aspNetJsonRegex.exec(config._i);
|
|
1860
|
+
if (matched !== null) {
|
|
1861
|
+
config._d = /* @__PURE__ */ new Date(+matched[1]);
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1864
|
+
configFromISO(config);
|
|
1865
|
+
if (config._isValid === false) {
|
|
1866
|
+
delete config._isValid;
|
|
1867
|
+
} else {
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
configFromRFC2822(config);
|
|
1871
|
+
if (config._isValid === false) {
|
|
1872
|
+
delete config._isValid;
|
|
1873
|
+
} else {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
if (config._strict) {
|
|
1877
|
+
config._isValid = false;
|
|
1878
|
+
} else {
|
|
1879
|
+
hooks.createFromInputFallback(config);
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
hooks.createFromInputFallback = deprecate(
|
|
1883
|
+
"value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
|
|
1884
|
+
function(config) {
|
|
1885
|
+
config._d = /* @__PURE__ */ new Date(config._i + (config._useUTC ? " UTC" : ""));
|
|
1886
|
+
}
|
|
1887
|
+
);
|
|
1888
|
+
function defaults(a, b, c) {
|
|
1889
|
+
if (a != null) {
|
|
1890
|
+
return a;
|
|
1891
|
+
}
|
|
1892
|
+
if (b != null) {
|
|
1893
|
+
return b;
|
|
1894
|
+
}
|
|
1895
|
+
return c;
|
|
1896
|
+
}
|
|
1897
|
+
function currentDateArray(config) {
|
|
1898
|
+
var nowValue = new Date(hooks.now());
|
|
1899
|
+
if (config._useUTC) {
|
|
1900
|
+
return [
|
|
1901
|
+
nowValue.getUTCFullYear(),
|
|
1902
|
+
nowValue.getUTCMonth(),
|
|
1903
|
+
nowValue.getUTCDate()
|
|
1904
|
+
];
|
|
1905
|
+
}
|
|
1906
|
+
return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
|
|
1907
|
+
}
|
|
1908
|
+
function configFromArray(config) {
|
|
1909
|
+
var i, date, input = [], currentDate, expectedWeekday, yearToUse;
|
|
1910
|
+
if (config._d) {
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
currentDate = currentDateArray(config);
|
|
1914
|
+
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
|
1915
|
+
dayOfYearFromWeekInfo(config);
|
|
1916
|
+
}
|
|
1917
|
+
if (config._dayOfYear != null) {
|
|
1918
|
+
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
|
|
1919
|
+
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
|
|
1920
|
+
getParsingFlags(config)._overflowDayOfYear = true;
|
|
1921
|
+
}
|
|
1922
|
+
date = createUTCDate(yearToUse, 0, config._dayOfYear);
|
|
1923
|
+
config._a[MONTH] = date.getUTCMonth();
|
|
1924
|
+
config._a[DATE] = date.getUTCDate();
|
|
1925
|
+
}
|
|
1926
|
+
for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
|
1927
|
+
config._a[i] = input[i] = currentDate[i];
|
|
1928
|
+
}
|
|
1929
|
+
for (; i < 7; i++) {
|
|
1930
|
+
config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];
|
|
1931
|
+
}
|
|
1932
|
+
if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {
|
|
1933
|
+
config._nextDay = true;
|
|
1934
|
+
config._a[HOUR] = 0;
|
|
1935
|
+
}
|
|
1936
|
+
config._d = (config._useUTC ? createUTCDate : createDate).apply(
|
|
1937
|
+
null,
|
|
1938
|
+
input
|
|
1939
|
+
);
|
|
1940
|
+
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
|
|
1941
|
+
if (config._tzm != null) {
|
|
1942
|
+
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
|
|
1943
|
+
}
|
|
1944
|
+
if (config._nextDay) {
|
|
1945
|
+
config._a[HOUR] = 24;
|
|
1946
|
+
}
|
|
1947
|
+
if (config._w && typeof config._w.d !== "undefined" && config._w.d !== expectedWeekday) {
|
|
1948
|
+
getParsingFlags(config).weekdayMismatch = true;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
function dayOfYearFromWeekInfo(config) {
|
|
1952
|
+
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
|
|
1953
|
+
w = config._w;
|
|
1954
|
+
if (w.GG != null || w.W != null || w.E != null) {
|
|
1955
|
+
dow = 1;
|
|
1956
|
+
doy = 4;
|
|
1957
|
+
weekYear = defaults(
|
|
1958
|
+
w.GG,
|
|
1959
|
+
config._a[YEAR],
|
|
1960
|
+
weekOfYear(createLocal(), 1, 4).year
|
|
1961
|
+
);
|
|
1962
|
+
week = defaults(w.W, 1);
|
|
1963
|
+
weekday = defaults(w.E, 1);
|
|
1964
|
+
if (weekday < 1 || weekday > 7) {
|
|
1965
|
+
weekdayOverflow = true;
|
|
1966
|
+
}
|
|
1967
|
+
} else {
|
|
1968
|
+
dow = config._locale._week.dow;
|
|
1969
|
+
doy = config._locale._week.doy;
|
|
1970
|
+
curWeek = weekOfYear(createLocal(), dow, doy);
|
|
1971
|
+
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
|
|
1972
|
+
week = defaults(w.w, curWeek.week);
|
|
1973
|
+
if (w.d != null) {
|
|
1974
|
+
weekday = w.d;
|
|
1975
|
+
if (weekday < 0 || weekday > 6) {
|
|
1976
|
+
weekdayOverflow = true;
|
|
1977
|
+
}
|
|
1978
|
+
} else if (w.e != null) {
|
|
1979
|
+
weekday = w.e + dow;
|
|
1980
|
+
if (w.e < 0 || w.e > 6) {
|
|
1981
|
+
weekdayOverflow = true;
|
|
1982
|
+
}
|
|
1983
|
+
} else {
|
|
1984
|
+
weekday = dow;
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
|
|
1988
|
+
getParsingFlags(config)._overflowWeeks = true;
|
|
1989
|
+
} else if (weekdayOverflow != null) {
|
|
1990
|
+
getParsingFlags(config)._overflowWeekday = true;
|
|
1991
|
+
} else {
|
|
1992
|
+
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
|
|
1993
|
+
config._a[YEAR] = temp.year;
|
|
1994
|
+
config._dayOfYear = temp.dayOfYear;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
hooks.ISO_8601 = function() {
|
|
1998
|
+
};
|
|
1999
|
+
hooks.RFC_2822 = function() {
|
|
2000
|
+
};
|
|
2001
|
+
function configFromStringAndFormat(config) {
|
|
2002
|
+
if (config._f === hooks.ISO_8601) {
|
|
2003
|
+
configFromISO(config);
|
|
2004
|
+
return;
|
|
2005
|
+
}
|
|
2006
|
+
if (config._f === hooks.RFC_2822) {
|
|
2007
|
+
configFromRFC2822(config);
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
config._a = [];
|
|
2011
|
+
getParsingFlags(config).empty = true;
|
|
2012
|
+
var string = "" + config._i, i, parsedInput, tokens2, token2, skipped, stringLength = string.length, totalParsedInputLength = 0, era, tokenLen;
|
|
2013
|
+
tokens2 = expandFormat(config._f, config._locale).match(formattingTokens) || [];
|
|
2014
|
+
tokenLen = tokens2.length;
|
|
2015
|
+
for (i = 0; i < tokenLen; i++) {
|
|
2016
|
+
token2 = tokens2[i];
|
|
2017
|
+
parsedInput = (string.match(getParseRegexForToken(token2, config)) || [])[0];
|
|
2018
|
+
if (parsedInput) {
|
|
2019
|
+
skipped = string.substr(0, string.indexOf(parsedInput));
|
|
2020
|
+
if (skipped.length > 0) {
|
|
2021
|
+
getParsingFlags(config).unusedInput.push(skipped);
|
|
2022
|
+
}
|
|
2023
|
+
string = string.slice(
|
|
2024
|
+
string.indexOf(parsedInput) + parsedInput.length
|
|
2025
|
+
);
|
|
2026
|
+
totalParsedInputLength += parsedInput.length;
|
|
2027
|
+
}
|
|
2028
|
+
if (formatTokenFunctions[token2]) {
|
|
2029
|
+
if (parsedInput) {
|
|
2030
|
+
getParsingFlags(config).empty = false;
|
|
2031
|
+
} else {
|
|
2032
|
+
getParsingFlags(config).unusedTokens.push(token2);
|
|
2033
|
+
}
|
|
2034
|
+
addTimeToArrayFromToken(token2, parsedInput, config);
|
|
2035
|
+
} else if (config._strict && !parsedInput) {
|
|
2036
|
+
getParsingFlags(config).unusedTokens.push(token2);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
|
|
2040
|
+
if (string.length > 0) {
|
|
2041
|
+
getParsingFlags(config).unusedInput.push(string);
|
|
2042
|
+
}
|
|
2043
|
+
if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {
|
|
2044
|
+
getParsingFlags(config).bigHour = void 0;
|
|
2045
|
+
}
|
|
2046
|
+
getParsingFlags(config).parsedDateParts = config._a.slice(0);
|
|
2047
|
+
getParsingFlags(config).meridiem = config._meridiem;
|
|
2048
|
+
config._a[HOUR] = meridiemFixWrap(
|
|
2049
|
+
config._locale,
|
|
2050
|
+
config._a[HOUR],
|
|
2051
|
+
config._meridiem
|
|
2052
|
+
);
|
|
2053
|
+
era = getParsingFlags(config).era;
|
|
2054
|
+
if (era !== null) {
|
|
2055
|
+
config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
|
|
2056
|
+
}
|
|
2057
|
+
configFromArray(config);
|
|
2058
|
+
checkOverflow(config);
|
|
2059
|
+
}
|
|
2060
|
+
function meridiemFixWrap(locale2, hour, meridiem2) {
|
|
2061
|
+
var isPm;
|
|
2062
|
+
if (meridiem2 == null) {
|
|
2063
|
+
return hour;
|
|
2064
|
+
}
|
|
2065
|
+
if (locale2.meridiemHour != null) {
|
|
2066
|
+
return locale2.meridiemHour(hour, meridiem2);
|
|
2067
|
+
} else if (locale2.isPM != null) {
|
|
2068
|
+
isPm = locale2.isPM(meridiem2);
|
|
2069
|
+
if (isPm && hour < 12) {
|
|
2070
|
+
hour += 12;
|
|
2071
|
+
}
|
|
2072
|
+
if (!isPm && hour === 12) {
|
|
2073
|
+
hour = 0;
|
|
2074
|
+
}
|
|
2075
|
+
return hour;
|
|
2076
|
+
} else {
|
|
2077
|
+
return hour;
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
function configFromStringAndArray(config) {
|
|
2081
|
+
var tempConfig, bestMoment, scoreToBeat, i, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config._f.length;
|
|
2082
|
+
if (configfLen === 0) {
|
|
2083
|
+
getParsingFlags(config).invalidFormat = true;
|
|
2084
|
+
config._d = /* @__PURE__ */ new Date(NaN);
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
for (i = 0; i < configfLen; i++) {
|
|
2088
|
+
currentScore = 0;
|
|
2089
|
+
validFormatFound = false;
|
|
2090
|
+
tempConfig = copyConfig({}, config);
|
|
2091
|
+
if (config._useUTC != null) {
|
|
2092
|
+
tempConfig._useUTC = config._useUTC;
|
|
2093
|
+
}
|
|
2094
|
+
tempConfig._f = config._f[i];
|
|
2095
|
+
configFromStringAndFormat(tempConfig);
|
|
2096
|
+
if (isValid(tempConfig)) {
|
|
2097
|
+
validFormatFound = true;
|
|
2098
|
+
}
|
|
2099
|
+
currentScore += getParsingFlags(tempConfig).charsLeftOver;
|
|
2100
|
+
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
|
|
2101
|
+
getParsingFlags(tempConfig).score = currentScore;
|
|
2102
|
+
if (!bestFormatIsValid) {
|
|
2103
|
+
if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
|
|
2104
|
+
scoreToBeat = currentScore;
|
|
2105
|
+
bestMoment = tempConfig;
|
|
2106
|
+
if (validFormatFound) {
|
|
2107
|
+
bestFormatIsValid = true;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
} else {
|
|
2111
|
+
if (currentScore < scoreToBeat) {
|
|
2112
|
+
scoreToBeat = currentScore;
|
|
2113
|
+
bestMoment = tempConfig;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
extend(config, bestMoment || tempConfig);
|
|
2118
|
+
}
|
|
2119
|
+
function configFromObject(config) {
|
|
2120
|
+
if (config._d) {
|
|
2121
|
+
return;
|
|
2122
|
+
}
|
|
2123
|
+
var i = normalizeObjectUnits(config._i), dayOrDate = i.day === void 0 ? i.date : i.day;
|
|
2124
|
+
config._a = map(
|
|
2125
|
+
[i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
|
|
2126
|
+
function(obj) {
|
|
2127
|
+
return obj && parseInt(obj, 10);
|
|
2128
|
+
}
|
|
2129
|
+
);
|
|
2130
|
+
configFromArray(config);
|
|
2131
|
+
}
|
|
2132
|
+
function createFromConfig(config) {
|
|
2133
|
+
var res = new Moment(checkOverflow(prepareConfig(config)));
|
|
2134
|
+
if (res._nextDay) {
|
|
2135
|
+
res.add(1, "d");
|
|
2136
|
+
res._nextDay = void 0;
|
|
2137
|
+
}
|
|
2138
|
+
return res;
|
|
2139
|
+
}
|
|
2140
|
+
function prepareConfig(config) {
|
|
2141
|
+
var input = config._i, format2 = config._f;
|
|
2142
|
+
config._locale = config._locale || getLocale(config._l);
|
|
2143
|
+
if (input === null || format2 === void 0 && input === "") {
|
|
2144
|
+
return createInvalid({ nullInput: true });
|
|
2145
|
+
}
|
|
2146
|
+
if (typeof input === "string") {
|
|
2147
|
+
config._i = input = config._locale.preparse(input);
|
|
2148
|
+
}
|
|
2149
|
+
if (isMoment(input)) {
|
|
2150
|
+
return new Moment(checkOverflow(input));
|
|
2151
|
+
} else if (isDate(input)) {
|
|
2152
|
+
config._d = input;
|
|
2153
|
+
} else if (isArray(format2)) {
|
|
2154
|
+
configFromStringAndArray(config);
|
|
2155
|
+
} else if (format2) {
|
|
2156
|
+
configFromStringAndFormat(config);
|
|
2157
|
+
} else {
|
|
2158
|
+
configFromInput(config);
|
|
2159
|
+
}
|
|
2160
|
+
if (!isValid(config)) {
|
|
2161
|
+
config._d = null;
|
|
2162
|
+
}
|
|
2163
|
+
return config;
|
|
2164
|
+
}
|
|
2165
|
+
function configFromInput(config) {
|
|
2166
|
+
var input = config._i;
|
|
2167
|
+
if (isUndefined(input)) {
|
|
2168
|
+
config._d = new Date(hooks.now());
|
|
2169
|
+
} else if (isDate(input)) {
|
|
2170
|
+
config._d = new Date(input.valueOf());
|
|
2171
|
+
} else if (typeof input === "string") {
|
|
2172
|
+
configFromString(config);
|
|
2173
|
+
} else if (isArray(input)) {
|
|
2174
|
+
config._a = map(input.slice(0), function(obj) {
|
|
2175
|
+
return parseInt(obj, 10);
|
|
2176
|
+
});
|
|
2177
|
+
configFromArray(config);
|
|
2178
|
+
} else if (isObject2(input)) {
|
|
2179
|
+
configFromObject(config);
|
|
2180
|
+
} else if (isNumber(input)) {
|
|
2181
|
+
config._d = new Date(input);
|
|
2182
|
+
} else {
|
|
2183
|
+
hooks.createFromInputFallback(config);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
function createLocalOrUTC(input, format2, locale2, strict, isUTC) {
|
|
2187
|
+
var c = {};
|
|
2188
|
+
if (format2 === true || format2 === false) {
|
|
2189
|
+
strict = format2;
|
|
2190
|
+
format2 = void 0;
|
|
2191
|
+
}
|
|
2192
|
+
if (locale2 === true || locale2 === false) {
|
|
2193
|
+
strict = locale2;
|
|
2194
|
+
locale2 = void 0;
|
|
2195
|
+
}
|
|
2196
|
+
if (isObject2(input) && isObjectEmpty2(input) || isArray(input) && input.length === 0) {
|
|
2197
|
+
input = void 0;
|
|
2198
|
+
}
|
|
2199
|
+
c._isAMomentObject = true;
|
|
2200
|
+
c._useUTC = c._isUTC = isUTC;
|
|
2201
|
+
c._l = locale2;
|
|
2202
|
+
c._i = input;
|
|
2203
|
+
c._f = format2;
|
|
2204
|
+
c._strict = strict;
|
|
2205
|
+
return createFromConfig(c);
|
|
2206
|
+
}
|
|
2207
|
+
function createLocal(input, format2, locale2, strict) {
|
|
2208
|
+
return createLocalOrUTC(input, format2, locale2, strict, false);
|
|
2209
|
+
}
|
|
2210
|
+
var prototypeMin = deprecate(
|
|
2211
|
+
"moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
|
|
2212
|
+
function() {
|
|
2213
|
+
var other = createLocal.apply(null, arguments);
|
|
2214
|
+
if (this.isValid() && other.isValid()) {
|
|
2215
|
+
return other < this ? this : other;
|
|
2216
|
+
} else {
|
|
2217
|
+
return createInvalid();
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
), prototypeMax = deprecate(
|
|
2221
|
+
"moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
|
|
2222
|
+
function() {
|
|
2223
|
+
var other = createLocal.apply(null, arguments);
|
|
2224
|
+
if (this.isValid() && other.isValid()) {
|
|
2225
|
+
return other > this ? this : other;
|
|
2226
|
+
} else {
|
|
2227
|
+
return createInvalid();
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
);
|
|
2231
|
+
function pickBy(fn, moments) {
|
|
2232
|
+
var res, i;
|
|
2233
|
+
if (moments.length === 1 && isArray(moments[0])) {
|
|
2234
|
+
moments = moments[0];
|
|
2235
|
+
}
|
|
2236
|
+
if (!moments.length) {
|
|
2237
|
+
return createLocal();
|
|
2238
|
+
}
|
|
2239
|
+
res = moments[0];
|
|
2240
|
+
for (i = 1; i < moments.length; ++i) {
|
|
2241
|
+
if (!moments[i].isValid() || moments[i][fn](res)) {
|
|
2242
|
+
res = moments[i];
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
return res;
|
|
2246
|
+
}
|
|
2247
|
+
function min() {
|
|
2248
|
+
var args = [].slice.call(arguments, 0);
|
|
2249
|
+
return pickBy("isBefore", args);
|
|
2250
|
+
}
|
|
2251
|
+
function max() {
|
|
2252
|
+
var args = [].slice.call(arguments, 0);
|
|
2253
|
+
return pickBy("isAfter", args);
|
|
2254
|
+
}
|
|
2255
|
+
var now = function() {
|
|
2256
|
+
return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
|
|
2257
|
+
};
|
|
2258
|
+
var ordering = [
|
|
2259
|
+
"year",
|
|
2260
|
+
"quarter",
|
|
2261
|
+
"month",
|
|
2262
|
+
"week",
|
|
2263
|
+
"day",
|
|
2264
|
+
"hour",
|
|
2265
|
+
"minute",
|
|
2266
|
+
"second",
|
|
2267
|
+
"millisecond"
|
|
2268
|
+
];
|
|
2269
|
+
function isDurationValid(m) {
|
|
2270
|
+
var key, unitHasDecimal = false, i, orderLen = ordering.length;
|
|
2271
|
+
for (key in m) {
|
|
2272
|
+
if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
|
|
2273
|
+
return false;
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
for (i = 0; i < orderLen; ++i) {
|
|
2277
|
+
if (m[ordering[i]]) {
|
|
2278
|
+
if (unitHasDecimal) {
|
|
2279
|
+
return false;
|
|
2280
|
+
}
|
|
2281
|
+
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
|
|
2282
|
+
unitHasDecimal = true;
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
return true;
|
|
2287
|
+
}
|
|
2288
|
+
function isValid$1() {
|
|
2289
|
+
return this._isValid;
|
|
2290
|
+
}
|
|
2291
|
+
function createInvalid$1() {
|
|
2292
|
+
return createDuration(NaN);
|
|
2293
|
+
}
|
|
2294
|
+
function Duration(duration) {
|
|
2295
|
+
var normalizedInput = normalizeObjectUnits(duration), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0;
|
|
2296
|
+
this._isValid = isDurationValid(normalizedInput);
|
|
2297
|
+
this._milliseconds = +milliseconds2 + seconds2 * 1e3 + // 1000
|
|
2298
|
+
minutes2 * 6e4 + // 1000 * 60
|
|
2299
|
+
hours2 * 1e3 * 60 * 60;
|
|
2300
|
+
this._days = +days2 + weeks2 * 7;
|
|
2301
|
+
this._months = +months2 + quarters * 3 + years2 * 12;
|
|
2302
|
+
this._data = {};
|
|
2303
|
+
this._locale = getLocale();
|
|
2304
|
+
this._bubble();
|
|
2305
|
+
}
|
|
2306
|
+
function isDuration(obj) {
|
|
2307
|
+
return obj instanceof Duration;
|
|
2308
|
+
}
|
|
2309
|
+
function absRound(number) {
|
|
2310
|
+
if (number < 0) {
|
|
2311
|
+
return Math.round(-1 * number) * -1;
|
|
2312
|
+
} else {
|
|
2313
|
+
return Math.round(number);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
function compareArrays(array1, array2, dontConvert) {
|
|
2317
|
+
var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i;
|
|
2318
|
+
for (i = 0; i < len; i++) {
|
|
2319
|
+
if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {
|
|
2320
|
+
diffs++;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return diffs + lengthDiff;
|
|
2324
|
+
}
|
|
2325
|
+
function offset(token2, separator) {
|
|
2326
|
+
addFormatToken(token2, 0, 0, function() {
|
|
2327
|
+
var offset2 = this.utcOffset(), sign2 = "+";
|
|
2328
|
+
if (offset2 < 0) {
|
|
2329
|
+
offset2 = -offset2;
|
|
2330
|
+
sign2 = "-";
|
|
2331
|
+
}
|
|
2332
|
+
return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2);
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
offset("Z", ":");
|
|
2336
|
+
offset("ZZ", "");
|
|
2337
|
+
addRegexToken("Z", matchShortOffset);
|
|
2338
|
+
addRegexToken("ZZ", matchShortOffset);
|
|
2339
|
+
addParseToken(["Z", "ZZ"], function(input, array, config) {
|
|
2340
|
+
config._useUTC = true;
|
|
2341
|
+
config._tzm = offsetFromString(matchShortOffset, input);
|
|
2342
|
+
});
|
|
2343
|
+
var chunkOffset = /([\+\-]|\d\d)/gi;
|
|
2344
|
+
function offsetFromString(matcher, string) {
|
|
2345
|
+
var matches = (string || "").match(matcher), chunk, parts, minutes2;
|
|
2346
|
+
if (matches === null) {
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
chunk = matches[matches.length - 1] || [];
|
|
2350
|
+
parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
|
|
2351
|
+
minutes2 = +(parts[1] * 60) + toInt(parts[2]);
|
|
2352
|
+
return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
|
|
2353
|
+
}
|
|
2354
|
+
function cloneWithOffset(input, model) {
|
|
2355
|
+
var res, diff2;
|
|
2356
|
+
if (model._isUTC) {
|
|
2357
|
+
res = model.clone();
|
|
2358
|
+
diff2 = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
|
|
2359
|
+
res._d.setTime(res._d.valueOf() + diff2);
|
|
2360
|
+
hooks.updateOffset(res, false);
|
|
2361
|
+
return res;
|
|
2362
|
+
} else {
|
|
2363
|
+
return createLocal(input).local();
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
function getDateOffset(m) {
|
|
2367
|
+
return -Math.round(m._d.getTimezoneOffset());
|
|
2368
|
+
}
|
|
2369
|
+
hooks.updateOffset = function() {
|
|
2370
|
+
};
|
|
2371
|
+
function getSetOffset(input, keepLocalTime, keepMinutes) {
|
|
2372
|
+
var offset2 = this._offset || 0, localAdjust;
|
|
2373
|
+
if (!this.isValid()) {
|
|
2374
|
+
return input != null ? this : NaN;
|
|
2375
|
+
}
|
|
2376
|
+
if (input != null) {
|
|
2377
|
+
if (typeof input === "string") {
|
|
2378
|
+
input = offsetFromString(matchShortOffset, input);
|
|
2379
|
+
if (input === null) {
|
|
2380
|
+
return this;
|
|
2381
|
+
}
|
|
2382
|
+
} else if (Math.abs(input) < 16 && !keepMinutes) {
|
|
2383
|
+
input = input * 60;
|
|
2384
|
+
}
|
|
2385
|
+
if (!this._isUTC && keepLocalTime) {
|
|
2386
|
+
localAdjust = getDateOffset(this);
|
|
2387
|
+
}
|
|
2388
|
+
this._offset = input;
|
|
2389
|
+
this._isUTC = true;
|
|
2390
|
+
if (localAdjust != null) {
|
|
2391
|
+
this.add(localAdjust, "m");
|
|
2392
|
+
}
|
|
2393
|
+
if (offset2 !== input) {
|
|
2394
|
+
if (!keepLocalTime || this._changeInProgress) {
|
|
2395
|
+
addSubtract(
|
|
2396
|
+
this,
|
|
2397
|
+
createDuration(input - offset2, "m"),
|
|
2398
|
+
1,
|
|
2399
|
+
false
|
|
2400
|
+
);
|
|
2401
|
+
} else if (!this._changeInProgress) {
|
|
2402
|
+
this._changeInProgress = true;
|
|
2403
|
+
hooks.updateOffset(this, true);
|
|
2404
|
+
this._changeInProgress = null;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
return this;
|
|
2408
|
+
} else {
|
|
2409
|
+
return this._isUTC ? offset2 : getDateOffset(this);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
function getSetZone(input, keepLocalTime) {
|
|
2413
|
+
if (input != null) {
|
|
2414
|
+
if (typeof input !== "string") {
|
|
2415
|
+
input = -input;
|
|
2416
|
+
}
|
|
2417
|
+
this.utcOffset(input, keepLocalTime);
|
|
2418
|
+
return this;
|
|
2419
|
+
} else {
|
|
2420
|
+
return -this.utcOffset();
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
function setOffsetToUTC(keepLocalTime) {
|
|
2424
|
+
return this.utcOffset(0, keepLocalTime);
|
|
2425
|
+
}
|
|
2426
|
+
function setOffsetToLocal(keepLocalTime) {
|
|
2427
|
+
if (this._isUTC) {
|
|
2428
|
+
this.utcOffset(0, keepLocalTime);
|
|
2429
|
+
this._isUTC = false;
|
|
2430
|
+
if (keepLocalTime) {
|
|
2431
|
+
this.subtract(getDateOffset(this), "m");
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return this;
|
|
2435
|
+
}
|
|
2436
|
+
function setOffsetToParsedOffset() {
|
|
2437
|
+
if (this._tzm != null) {
|
|
2438
|
+
this.utcOffset(this._tzm, false, true);
|
|
2439
|
+
} else if (typeof this._i === "string") {
|
|
2440
|
+
var tZone = offsetFromString(matchOffset, this._i);
|
|
2441
|
+
if (tZone != null) {
|
|
2442
|
+
this.utcOffset(tZone);
|
|
2443
|
+
} else {
|
|
2444
|
+
this.utcOffset(0, true);
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
return this;
|
|
2448
|
+
}
|
|
2449
|
+
function hasAlignedHourOffset(input) {
|
|
2450
|
+
if (!this.isValid()) {
|
|
2451
|
+
return false;
|
|
2452
|
+
}
|
|
2453
|
+
input = input ? createLocal(input).utcOffset() : 0;
|
|
2454
|
+
return (this.utcOffset() - input) % 60 === 0;
|
|
2455
|
+
}
|
|
2456
|
+
function isDaylightSavingTime() {
|
|
2457
|
+
return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
|
|
2458
|
+
}
|
|
2459
|
+
function isDaylightSavingTimeShifted() {
|
|
2460
|
+
if (!isUndefined(this._isDSTShifted)) {
|
|
2461
|
+
return this._isDSTShifted;
|
|
2462
|
+
}
|
|
2463
|
+
var c = {}, other;
|
|
2464
|
+
copyConfig(c, this);
|
|
2465
|
+
c = prepareConfig(c);
|
|
2466
|
+
if (c._a) {
|
|
2467
|
+
other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
|
|
2468
|
+
this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;
|
|
2469
|
+
} else {
|
|
2470
|
+
this._isDSTShifted = false;
|
|
2471
|
+
}
|
|
2472
|
+
return this._isDSTShifted;
|
|
2473
|
+
}
|
|
2474
|
+
function isLocal() {
|
|
2475
|
+
return this.isValid() ? !this._isUTC : false;
|
|
2476
|
+
}
|
|
2477
|
+
function isUtcOffset() {
|
|
2478
|
+
return this.isValid() ? this._isUTC : false;
|
|
2479
|
+
}
|
|
2480
|
+
function isUtc() {
|
|
2481
|
+
return this.isValid() ? this._isUTC && this._offset === 0 : false;
|
|
2482
|
+
}
|
|
2483
|
+
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
|
|
2484
|
+
function createDuration(input, key) {
|
|
2485
|
+
var duration = input, match = null, sign2, ret, diffRes;
|
|
2486
|
+
if (isDuration(input)) {
|
|
2487
|
+
duration = {
|
|
2488
|
+
ms: input._milliseconds,
|
|
2489
|
+
d: input._days,
|
|
2490
|
+
M: input._months
|
|
2491
|
+
};
|
|
2492
|
+
} else if (isNumber(input) || !isNaN(+input)) {
|
|
2493
|
+
duration = {};
|
|
2494
|
+
if (key) {
|
|
2495
|
+
duration[key] = +input;
|
|
2496
|
+
} else {
|
|
2497
|
+
duration.milliseconds = +input;
|
|
2498
|
+
}
|
|
2499
|
+
} else if (match = aspNetRegex.exec(input)) {
|
|
2500
|
+
sign2 = match[1] === "-" ? -1 : 1;
|
|
2501
|
+
duration = {
|
|
2502
|
+
y: 0,
|
|
2503
|
+
d: toInt(match[DATE]) * sign2,
|
|
2504
|
+
h: toInt(match[HOUR]) * sign2,
|
|
2505
|
+
m: toInt(match[MINUTE]) * sign2,
|
|
2506
|
+
s: toInt(match[SECOND]) * sign2,
|
|
2507
|
+
ms: toInt(absRound(match[MILLISECOND] * 1e3)) * sign2
|
|
2508
|
+
// the millisecond decimal point is included in the match
|
|
2509
|
+
};
|
|
2510
|
+
} else if (match = isoRegex.exec(input)) {
|
|
2511
|
+
sign2 = match[1] === "-" ? -1 : 1;
|
|
2512
|
+
duration = {
|
|
2513
|
+
y: parseIso(match[2], sign2),
|
|
2514
|
+
M: parseIso(match[3], sign2),
|
|
2515
|
+
w: parseIso(match[4], sign2),
|
|
2516
|
+
d: parseIso(match[5], sign2),
|
|
2517
|
+
h: parseIso(match[6], sign2),
|
|
2518
|
+
m: parseIso(match[7], sign2),
|
|
2519
|
+
s: parseIso(match[8], sign2)
|
|
2520
|
+
};
|
|
2521
|
+
} else if (duration == null) {
|
|
2522
|
+
duration = {};
|
|
2523
|
+
} else if (typeof duration === "object" && ("from" in duration || "to" in duration)) {
|
|
2524
|
+
diffRes = momentsDifference(
|
|
2525
|
+
createLocal(duration.from),
|
|
2526
|
+
createLocal(duration.to)
|
|
2527
|
+
);
|
|
2528
|
+
duration = {};
|
|
2529
|
+
duration.ms = diffRes.milliseconds;
|
|
2530
|
+
duration.M = diffRes.months;
|
|
2531
|
+
}
|
|
2532
|
+
ret = new Duration(duration);
|
|
2533
|
+
if (isDuration(input) && hasOwnProp(input, "_locale")) {
|
|
2534
|
+
ret._locale = input._locale;
|
|
2535
|
+
}
|
|
2536
|
+
if (isDuration(input) && hasOwnProp(input, "_isValid")) {
|
|
2537
|
+
ret._isValid = input._isValid;
|
|
2538
|
+
}
|
|
2539
|
+
return ret;
|
|
2540
|
+
}
|
|
2541
|
+
createDuration.fn = Duration.prototype;
|
|
2542
|
+
createDuration.invalid = createInvalid$1;
|
|
2543
|
+
function parseIso(inp, sign2) {
|
|
2544
|
+
var res = inp && parseFloat(inp.replace(",", "."));
|
|
2545
|
+
return (isNaN(res) ? 0 : res) * sign2;
|
|
2546
|
+
}
|
|
2547
|
+
function positiveMomentsDifference(base, other) {
|
|
2548
|
+
var res = {};
|
|
2549
|
+
res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
|
|
2550
|
+
if (base.clone().add(res.months, "M").isAfter(other)) {
|
|
2551
|
+
--res.months;
|
|
2552
|
+
}
|
|
2553
|
+
res.milliseconds = +other - +base.clone().add(res.months, "M");
|
|
2554
|
+
return res;
|
|
2555
|
+
}
|
|
2556
|
+
function momentsDifference(base, other) {
|
|
2557
|
+
var res;
|
|
2558
|
+
if (!(base.isValid() && other.isValid())) {
|
|
2559
|
+
return { milliseconds: 0, months: 0 };
|
|
2560
|
+
}
|
|
2561
|
+
other = cloneWithOffset(other, base);
|
|
2562
|
+
if (base.isBefore(other)) {
|
|
2563
|
+
res = positiveMomentsDifference(base, other);
|
|
2564
|
+
} else {
|
|
2565
|
+
res = positiveMomentsDifference(other, base);
|
|
2566
|
+
res.milliseconds = -res.milliseconds;
|
|
2567
|
+
res.months = -res.months;
|
|
2568
|
+
}
|
|
2569
|
+
return res;
|
|
2570
|
+
}
|
|
2571
|
+
function createAdder(direction, name) {
|
|
2572
|
+
return function(val, period) {
|
|
2573
|
+
var dur, tmp;
|
|
2574
|
+
if (period !== null && !isNaN(+period)) {
|
|
2575
|
+
deprecateSimple(
|
|
2576
|
+
name,
|
|
2577
|
+
"moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
|
|
2578
|
+
);
|
|
2579
|
+
tmp = val;
|
|
2580
|
+
val = period;
|
|
2581
|
+
period = tmp;
|
|
2582
|
+
}
|
|
2583
|
+
dur = createDuration(val, period);
|
|
2584
|
+
addSubtract(this, dur, direction);
|
|
2585
|
+
return this;
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
function addSubtract(mom, duration, isAdding, updateOffset) {
|
|
2589
|
+
var milliseconds2 = duration._milliseconds, days2 = absRound(duration._days), months2 = absRound(duration._months);
|
|
2590
|
+
if (!mom.isValid()) {
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
updateOffset = updateOffset == null ? true : updateOffset;
|
|
2594
|
+
if (months2) {
|
|
2595
|
+
setMonth(mom, get(mom, "Month") + months2 * isAdding);
|
|
2596
|
+
}
|
|
2597
|
+
if (days2) {
|
|
2598
|
+
set$1(mom, "Date", get(mom, "Date") + days2 * isAdding);
|
|
2599
|
+
}
|
|
2600
|
+
if (milliseconds2) {
|
|
2601
|
+
mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
|
|
2602
|
+
}
|
|
2603
|
+
if (updateOffset) {
|
|
2604
|
+
hooks.updateOffset(mom, days2 || months2);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
var add = createAdder(1, "add"), subtract = createAdder(-1, "subtract");
|
|
2608
|
+
function isString2(input) {
|
|
2609
|
+
return typeof input === "string" || input instanceof String;
|
|
2610
|
+
}
|
|
2611
|
+
function isMomentInput(input) {
|
|
2612
|
+
return isMoment(input) || isDate(input) || isString2(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === void 0;
|
|
2613
|
+
}
|
|
2614
|
+
function isMomentInputObject(input) {
|
|
2615
|
+
var objectTest = isObject2(input) && !isObjectEmpty2(input), propertyTest = false, properties = [
|
|
2616
|
+
"years",
|
|
2617
|
+
"year",
|
|
2618
|
+
"y",
|
|
2619
|
+
"months",
|
|
2620
|
+
"month",
|
|
2621
|
+
"M",
|
|
2622
|
+
"days",
|
|
2623
|
+
"day",
|
|
2624
|
+
"d",
|
|
2625
|
+
"dates",
|
|
2626
|
+
"date",
|
|
2627
|
+
"D",
|
|
2628
|
+
"hours",
|
|
2629
|
+
"hour",
|
|
2630
|
+
"h",
|
|
2631
|
+
"minutes",
|
|
2632
|
+
"minute",
|
|
2633
|
+
"m",
|
|
2634
|
+
"seconds",
|
|
2635
|
+
"second",
|
|
2636
|
+
"s",
|
|
2637
|
+
"milliseconds",
|
|
2638
|
+
"millisecond",
|
|
2639
|
+
"ms"
|
|
2640
|
+
], i, property, propertyLen = properties.length;
|
|
2641
|
+
for (i = 0; i < propertyLen; i += 1) {
|
|
2642
|
+
property = properties[i];
|
|
2643
|
+
propertyTest = propertyTest || hasOwnProp(input, property);
|
|
2644
|
+
}
|
|
2645
|
+
return objectTest && propertyTest;
|
|
2646
|
+
}
|
|
2647
|
+
function isNumberOrStringArray(input) {
|
|
2648
|
+
var arrayTest = isArray(input), dataTypeTest = false;
|
|
2649
|
+
if (arrayTest) {
|
|
2650
|
+
dataTypeTest = input.filter(function(item) {
|
|
2651
|
+
return !isNumber(item) && isString2(input);
|
|
2652
|
+
}).length === 0;
|
|
2653
|
+
}
|
|
2654
|
+
return arrayTest && dataTypeTest;
|
|
2655
|
+
}
|
|
2656
|
+
function isCalendarSpec(input) {
|
|
2657
|
+
var objectTest = isObject2(input) && !isObjectEmpty2(input), propertyTest = false, properties = [
|
|
2658
|
+
"sameDay",
|
|
2659
|
+
"nextDay",
|
|
2660
|
+
"lastDay",
|
|
2661
|
+
"nextWeek",
|
|
2662
|
+
"lastWeek",
|
|
2663
|
+
"sameElse"
|
|
2664
|
+
], i, property;
|
|
2665
|
+
for (i = 0; i < properties.length; i += 1) {
|
|
2666
|
+
property = properties[i];
|
|
2667
|
+
propertyTest = propertyTest || hasOwnProp(input, property);
|
|
2668
|
+
}
|
|
2669
|
+
return objectTest && propertyTest;
|
|
2670
|
+
}
|
|
2671
|
+
function getCalendarFormat(myMoment, now2) {
|
|
2672
|
+
var diff2 = myMoment.diff(now2, "days", true);
|
|
2673
|
+
return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
|
|
2674
|
+
}
|
|
2675
|
+
function calendar$1(time, formats) {
|
|
2676
|
+
if (arguments.length === 1) {
|
|
2677
|
+
if (!arguments[0]) {
|
|
2678
|
+
time = void 0;
|
|
2679
|
+
formats = void 0;
|
|
2680
|
+
} else if (isMomentInput(arguments[0])) {
|
|
2681
|
+
time = arguments[0];
|
|
2682
|
+
formats = void 0;
|
|
2683
|
+
} else if (isCalendarSpec(arguments[0])) {
|
|
2684
|
+
formats = arguments[0];
|
|
2685
|
+
time = void 0;
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
var now2 = time || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction(formats[format2]) ? formats[format2].call(this, now2) : formats[format2]);
|
|
2689
|
+
return this.format(
|
|
2690
|
+
output || this.localeData().calendar(format2, this, createLocal(now2))
|
|
2691
|
+
);
|
|
2692
|
+
}
|
|
2693
|
+
function clone() {
|
|
2694
|
+
return new Moment(this);
|
|
2695
|
+
}
|
|
2696
|
+
function isAfter(input, units) {
|
|
2697
|
+
var localInput = isMoment(input) ? input : createLocal(input);
|
|
2698
|
+
if (!(this.isValid() && localInput.isValid())) {
|
|
2699
|
+
return false;
|
|
2700
|
+
}
|
|
2701
|
+
units = normalizeUnits(units) || "millisecond";
|
|
2702
|
+
if (units === "millisecond") {
|
|
2703
|
+
return this.valueOf() > localInput.valueOf();
|
|
2704
|
+
} else {
|
|
2705
|
+
return localInput.valueOf() < this.clone().startOf(units).valueOf();
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
function isBefore(input, units) {
|
|
2709
|
+
var localInput = isMoment(input) ? input : createLocal(input);
|
|
2710
|
+
if (!(this.isValid() && localInput.isValid())) {
|
|
2711
|
+
return false;
|
|
2712
|
+
}
|
|
2713
|
+
units = normalizeUnits(units) || "millisecond";
|
|
2714
|
+
if (units === "millisecond") {
|
|
2715
|
+
return this.valueOf() < localInput.valueOf();
|
|
2716
|
+
} else {
|
|
2717
|
+
return this.clone().endOf(units).valueOf() < localInput.valueOf();
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
function isBetween(from2, to2, units, inclusivity) {
|
|
2721
|
+
var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
|
|
2722
|
+
if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
|
|
2723
|
+
return false;
|
|
2724
|
+
}
|
|
2725
|
+
inclusivity = inclusivity || "()";
|
|
2726
|
+
return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
|
|
2727
|
+
}
|
|
2728
|
+
function isSame(input, units) {
|
|
2729
|
+
var localInput = isMoment(input) ? input : createLocal(input), inputMs;
|
|
2730
|
+
if (!(this.isValid() && localInput.isValid())) {
|
|
2731
|
+
return false;
|
|
2732
|
+
}
|
|
2733
|
+
units = normalizeUnits(units) || "millisecond";
|
|
2734
|
+
if (units === "millisecond") {
|
|
2735
|
+
return this.valueOf() === localInput.valueOf();
|
|
2736
|
+
} else {
|
|
2737
|
+
inputMs = localInput.valueOf();
|
|
2738
|
+
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
function isSameOrAfter(input, units) {
|
|
2742
|
+
return this.isSame(input, units) || this.isAfter(input, units);
|
|
2743
|
+
}
|
|
2744
|
+
function isSameOrBefore(input, units) {
|
|
2745
|
+
return this.isSame(input, units) || this.isBefore(input, units);
|
|
2746
|
+
}
|
|
2747
|
+
function diff(input, units, asFloat) {
|
|
2748
|
+
var that, zoneDelta, output;
|
|
2749
|
+
if (!this.isValid()) {
|
|
2750
|
+
return NaN;
|
|
2751
|
+
}
|
|
2752
|
+
that = cloneWithOffset(input, this);
|
|
2753
|
+
if (!that.isValid()) {
|
|
2754
|
+
return NaN;
|
|
2755
|
+
}
|
|
2756
|
+
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
|
|
2757
|
+
units = normalizeUnits(units);
|
|
2758
|
+
switch (units) {
|
|
2759
|
+
case "year":
|
|
2760
|
+
output = monthDiff(this, that) / 12;
|
|
2761
|
+
break;
|
|
2762
|
+
case "month":
|
|
2763
|
+
output = monthDiff(this, that);
|
|
2764
|
+
break;
|
|
2765
|
+
case "quarter":
|
|
2766
|
+
output = monthDiff(this, that) / 3;
|
|
2767
|
+
break;
|
|
2768
|
+
case "second":
|
|
2769
|
+
output = (this - that) / 1e3;
|
|
2770
|
+
break;
|
|
2771
|
+
// 1000
|
|
2772
|
+
case "minute":
|
|
2773
|
+
output = (this - that) / 6e4;
|
|
2774
|
+
break;
|
|
2775
|
+
// 1000 * 60
|
|
2776
|
+
case "hour":
|
|
2777
|
+
output = (this - that) / 36e5;
|
|
2778
|
+
break;
|
|
2779
|
+
// 1000 * 60 * 60
|
|
2780
|
+
case "day":
|
|
2781
|
+
output = (this - that - zoneDelta) / 864e5;
|
|
2782
|
+
break;
|
|
2783
|
+
// 1000 * 60 * 60 * 24, negate dst
|
|
2784
|
+
case "week":
|
|
2785
|
+
output = (this - that - zoneDelta) / 6048e5;
|
|
2786
|
+
break;
|
|
2787
|
+
// 1000 * 60 * 60 * 24 * 7, negate dst
|
|
2788
|
+
default:
|
|
2789
|
+
output = this - that;
|
|
2790
|
+
}
|
|
2791
|
+
return asFloat ? output : absFloor(output);
|
|
2792
|
+
}
|
|
2793
|
+
function monthDiff(a, b) {
|
|
2794
|
+
if (a.date() < b.date()) {
|
|
2795
|
+
return -monthDiff(b, a);
|
|
2796
|
+
}
|
|
2797
|
+
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), anchor = a.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
|
|
2798
|
+
if (b - anchor < 0) {
|
|
2799
|
+
anchor2 = a.clone().add(wholeMonthDiff - 1, "months");
|
|
2800
|
+
adjust = (b - anchor) / (anchor - anchor2);
|
|
2801
|
+
} else {
|
|
2802
|
+
anchor2 = a.clone().add(wholeMonthDiff + 1, "months");
|
|
2803
|
+
adjust = (b - anchor) / (anchor2 - anchor);
|
|
2804
|
+
}
|
|
2805
|
+
return -(wholeMonthDiff + adjust) || 0;
|
|
2806
|
+
}
|
|
2807
|
+
hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
|
|
2808
|
+
hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
|
|
2809
|
+
function toString() {
|
|
2810
|
+
return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
|
|
2811
|
+
}
|
|
2812
|
+
function toISOString(keepOffset) {
|
|
2813
|
+
if (!this.isValid()) {
|
|
2814
|
+
return null;
|
|
2815
|
+
}
|
|
2816
|
+
var utc = keepOffset !== true, m = utc ? this.clone().utc() : this;
|
|
2817
|
+
if (m.year() < 0 || m.year() > 9999) {
|
|
2818
|
+
return formatMoment(
|
|
2819
|
+
m,
|
|
2820
|
+
utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
|
|
2821
|
+
);
|
|
2822
|
+
}
|
|
2823
|
+
if (isFunction(Date.prototype.toISOString)) {
|
|
2824
|
+
if (utc) {
|
|
2825
|
+
return this.toDate().toISOString();
|
|
2826
|
+
} else {
|
|
2827
|
+
return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m, "Z"));
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
return formatMoment(
|
|
2831
|
+
m,
|
|
2832
|
+
utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
|
|
2833
|
+
);
|
|
2834
|
+
}
|
|
2835
|
+
function inspect() {
|
|
2836
|
+
if (!this.isValid()) {
|
|
2837
|
+
return "moment.invalid(/* " + this._i + " */)";
|
|
2838
|
+
}
|
|
2839
|
+
var func = "moment", zone = "", prefix, year, datetime, suffix;
|
|
2840
|
+
if (!this.isLocal()) {
|
|
2841
|
+
func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
|
|
2842
|
+
zone = "Z";
|
|
2843
|
+
}
|
|
2844
|
+
prefix = "[" + func + '("]';
|
|
2845
|
+
year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
|
|
2846
|
+
datetime = "-MM-DD[T]HH:mm:ss.SSS";
|
|
2847
|
+
suffix = zone + '[")]';
|
|
2848
|
+
return this.format(prefix + year + datetime + suffix);
|
|
2849
|
+
}
|
|
2850
|
+
function format(inputString) {
|
|
2851
|
+
if (!inputString) {
|
|
2852
|
+
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
|
|
2853
|
+
}
|
|
2854
|
+
var output = formatMoment(this, inputString);
|
|
2855
|
+
return this.localeData().postformat(output);
|
|
2856
|
+
}
|
|
2857
|
+
function from(time, withoutSuffix) {
|
|
2858
|
+
if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
|
|
2859
|
+
return createDuration({ to: this, from: time }).locale(this.locale()).humanize(!withoutSuffix);
|
|
2860
|
+
} else {
|
|
2861
|
+
return this.localeData().invalidDate();
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
function fromNow(withoutSuffix) {
|
|
2865
|
+
return this.from(createLocal(), withoutSuffix);
|
|
2866
|
+
}
|
|
2867
|
+
function to(time, withoutSuffix) {
|
|
2868
|
+
if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {
|
|
2869
|
+
return createDuration({ from: this, to: time }).locale(this.locale()).humanize(!withoutSuffix);
|
|
2870
|
+
} else {
|
|
2871
|
+
return this.localeData().invalidDate();
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
function toNow(withoutSuffix) {
|
|
2875
|
+
return this.to(createLocal(), withoutSuffix);
|
|
2876
|
+
}
|
|
2877
|
+
function locale(key) {
|
|
2878
|
+
var newLocaleData;
|
|
2879
|
+
if (key === void 0) {
|
|
2880
|
+
return this._locale._abbr;
|
|
2881
|
+
} else {
|
|
2882
|
+
newLocaleData = getLocale(key);
|
|
2883
|
+
if (newLocaleData != null) {
|
|
2884
|
+
this._locale = newLocaleData;
|
|
2885
|
+
}
|
|
2886
|
+
return this;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
var lang = deprecate(
|
|
2890
|
+
"moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
|
|
2891
|
+
function(key) {
|
|
2892
|
+
if (key === void 0) {
|
|
2893
|
+
return this.localeData();
|
|
2894
|
+
} else {
|
|
2895
|
+
return this.locale(key);
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
);
|
|
2899
|
+
function localeData() {
|
|
2900
|
+
return this._locale;
|
|
2901
|
+
}
|
|
2902
|
+
var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
|
|
2903
|
+
function mod$1(dividend, divisor) {
|
|
2904
|
+
return (dividend % divisor + divisor) % divisor;
|
|
2905
|
+
}
|
|
2906
|
+
function localStartOfDate(y, m, d) {
|
|
2907
|
+
if (y < 100 && y >= 0) {
|
|
2908
|
+
return new Date(y + 400, m, d) - MS_PER_400_YEARS;
|
|
2909
|
+
} else {
|
|
2910
|
+
return new Date(y, m, d).valueOf();
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
function utcStartOfDate(y, m, d) {
|
|
2914
|
+
if (y < 100 && y >= 0) {
|
|
2915
|
+
return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
|
|
2916
|
+
} else {
|
|
2917
|
+
return Date.UTC(y, m, d);
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
function startOf(units) {
|
|
2921
|
+
var time, startOfDate;
|
|
2922
|
+
units = normalizeUnits(units);
|
|
2923
|
+
if (units === void 0 || units === "millisecond" || !this.isValid()) {
|
|
2924
|
+
return this;
|
|
2925
|
+
}
|
|
2926
|
+
startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
|
|
2927
|
+
switch (units) {
|
|
2928
|
+
case "year":
|
|
2929
|
+
time = startOfDate(this.year(), 0, 1);
|
|
2930
|
+
break;
|
|
2931
|
+
case "quarter":
|
|
2932
|
+
time = startOfDate(
|
|
2933
|
+
this.year(),
|
|
2934
|
+
this.month() - this.month() % 3,
|
|
2935
|
+
1
|
|
2936
|
+
);
|
|
2937
|
+
break;
|
|
2938
|
+
case "month":
|
|
2939
|
+
time = startOfDate(this.year(), this.month(), 1);
|
|
2940
|
+
break;
|
|
2941
|
+
case "week":
|
|
2942
|
+
time = startOfDate(
|
|
2943
|
+
this.year(),
|
|
2944
|
+
this.month(),
|
|
2945
|
+
this.date() - this.weekday()
|
|
2946
|
+
);
|
|
2947
|
+
break;
|
|
2948
|
+
case "isoWeek":
|
|
2949
|
+
time = startOfDate(
|
|
2950
|
+
this.year(),
|
|
2951
|
+
this.month(),
|
|
2952
|
+
this.date() - (this.isoWeekday() - 1)
|
|
2953
|
+
);
|
|
2954
|
+
break;
|
|
2955
|
+
case "day":
|
|
2956
|
+
case "date":
|
|
2957
|
+
time = startOfDate(this.year(), this.month(), this.date());
|
|
2958
|
+
break;
|
|
2959
|
+
case "hour":
|
|
2960
|
+
time = this._d.valueOf();
|
|
2961
|
+
time -= mod$1(
|
|
2962
|
+
time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
|
|
2963
|
+
MS_PER_HOUR
|
|
2964
|
+
);
|
|
2965
|
+
break;
|
|
2966
|
+
case "minute":
|
|
2967
|
+
time = this._d.valueOf();
|
|
2968
|
+
time -= mod$1(time, MS_PER_MINUTE);
|
|
2969
|
+
break;
|
|
2970
|
+
case "second":
|
|
2971
|
+
time = this._d.valueOf();
|
|
2972
|
+
time -= mod$1(time, MS_PER_SECOND);
|
|
2973
|
+
break;
|
|
2974
|
+
}
|
|
2975
|
+
this._d.setTime(time);
|
|
2976
|
+
hooks.updateOffset(this, true);
|
|
2977
|
+
return this;
|
|
2978
|
+
}
|
|
2979
|
+
function endOf(units) {
|
|
2980
|
+
var time, startOfDate;
|
|
2981
|
+
units = normalizeUnits(units);
|
|
2982
|
+
if (units === void 0 || units === "millisecond" || !this.isValid()) {
|
|
2983
|
+
return this;
|
|
2984
|
+
}
|
|
2985
|
+
startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
|
|
2986
|
+
switch (units) {
|
|
2987
|
+
case "year":
|
|
2988
|
+
time = startOfDate(this.year() + 1, 0, 1) - 1;
|
|
2989
|
+
break;
|
|
2990
|
+
case "quarter":
|
|
2991
|
+
time = startOfDate(
|
|
2992
|
+
this.year(),
|
|
2993
|
+
this.month() - this.month() % 3 + 3,
|
|
2994
|
+
1
|
|
2995
|
+
) - 1;
|
|
2996
|
+
break;
|
|
2997
|
+
case "month":
|
|
2998
|
+
time = startOfDate(this.year(), this.month() + 1, 1) - 1;
|
|
2999
|
+
break;
|
|
3000
|
+
case "week":
|
|
3001
|
+
time = startOfDate(
|
|
3002
|
+
this.year(),
|
|
3003
|
+
this.month(),
|
|
3004
|
+
this.date() - this.weekday() + 7
|
|
3005
|
+
) - 1;
|
|
3006
|
+
break;
|
|
3007
|
+
case "isoWeek":
|
|
3008
|
+
time = startOfDate(
|
|
3009
|
+
this.year(),
|
|
3010
|
+
this.month(),
|
|
3011
|
+
this.date() - (this.isoWeekday() - 1) + 7
|
|
3012
|
+
) - 1;
|
|
3013
|
+
break;
|
|
3014
|
+
case "day":
|
|
3015
|
+
case "date":
|
|
3016
|
+
time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
|
|
3017
|
+
break;
|
|
3018
|
+
case "hour":
|
|
3019
|
+
time = this._d.valueOf();
|
|
3020
|
+
time += MS_PER_HOUR - mod$1(
|
|
3021
|
+
time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
|
|
3022
|
+
MS_PER_HOUR
|
|
3023
|
+
) - 1;
|
|
3024
|
+
break;
|
|
3025
|
+
case "minute":
|
|
3026
|
+
time = this._d.valueOf();
|
|
3027
|
+
time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
|
|
3028
|
+
break;
|
|
3029
|
+
case "second":
|
|
3030
|
+
time = this._d.valueOf();
|
|
3031
|
+
time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
|
|
3032
|
+
break;
|
|
3033
|
+
}
|
|
3034
|
+
this._d.setTime(time);
|
|
3035
|
+
hooks.updateOffset(this, true);
|
|
3036
|
+
return this;
|
|
3037
|
+
}
|
|
3038
|
+
function valueOf() {
|
|
3039
|
+
return this._d.valueOf() - (this._offset || 0) * 6e4;
|
|
3040
|
+
}
|
|
3041
|
+
function unix() {
|
|
3042
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
3043
|
+
}
|
|
3044
|
+
function toDate() {
|
|
3045
|
+
return new Date(this.valueOf());
|
|
3046
|
+
}
|
|
3047
|
+
function toArray() {
|
|
3048
|
+
var m = this;
|
|
3049
|
+
return [
|
|
3050
|
+
m.year(),
|
|
3051
|
+
m.month(),
|
|
3052
|
+
m.date(),
|
|
3053
|
+
m.hour(),
|
|
3054
|
+
m.minute(),
|
|
3055
|
+
m.second(),
|
|
3056
|
+
m.millisecond()
|
|
3057
|
+
];
|
|
3058
|
+
}
|
|
3059
|
+
function toObject() {
|
|
3060
|
+
var m = this;
|
|
3061
|
+
return {
|
|
3062
|
+
years: m.year(),
|
|
3063
|
+
months: m.month(),
|
|
3064
|
+
date: m.date(),
|
|
3065
|
+
hours: m.hours(),
|
|
3066
|
+
minutes: m.minutes(),
|
|
3067
|
+
seconds: m.seconds(),
|
|
3068
|
+
milliseconds: m.milliseconds()
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
function toJSON() {
|
|
3072
|
+
return this.isValid() ? this.toISOString() : null;
|
|
3073
|
+
}
|
|
3074
|
+
function isValid$2() {
|
|
3075
|
+
return isValid(this);
|
|
3076
|
+
}
|
|
3077
|
+
function parsingFlags() {
|
|
3078
|
+
return extend({}, getParsingFlags(this));
|
|
3079
|
+
}
|
|
3080
|
+
function invalidAt() {
|
|
3081
|
+
return getParsingFlags(this).overflow;
|
|
3082
|
+
}
|
|
3083
|
+
function creationData() {
|
|
3084
|
+
return {
|
|
3085
|
+
input: this._i,
|
|
3086
|
+
format: this._f,
|
|
3087
|
+
locale: this._locale,
|
|
3088
|
+
isUTC: this._isUTC,
|
|
3089
|
+
strict: this._strict
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3092
|
+
addFormatToken("N", 0, 0, "eraAbbr");
|
|
3093
|
+
addFormatToken("NN", 0, 0, "eraAbbr");
|
|
3094
|
+
addFormatToken("NNN", 0, 0, "eraAbbr");
|
|
3095
|
+
addFormatToken("NNNN", 0, 0, "eraName");
|
|
3096
|
+
addFormatToken("NNNNN", 0, 0, "eraNarrow");
|
|
3097
|
+
addFormatToken("y", ["y", 1], "yo", "eraYear");
|
|
3098
|
+
addFormatToken("y", ["yy", 2], 0, "eraYear");
|
|
3099
|
+
addFormatToken("y", ["yyy", 3], 0, "eraYear");
|
|
3100
|
+
addFormatToken("y", ["yyyy", 4], 0, "eraYear");
|
|
3101
|
+
addRegexToken("N", matchEraAbbr);
|
|
3102
|
+
addRegexToken("NN", matchEraAbbr);
|
|
3103
|
+
addRegexToken("NNN", matchEraAbbr);
|
|
3104
|
+
addRegexToken("NNNN", matchEraName);
|
|
3105
|
+
addRegexToken("NNNNN", matchEraNarrow);
|
|
3106
|
+
addParseToken(
|
|
3107
|
+
["N", "NN", "NNN", "NNNN", "NNNNN"],
|
|
3108
|
+
function(input, array, config, token2) {
|
|
3109
|
+
var era = config._locale.erasParse(input, token2, config._strict);
|
|
3110
|
+
if (era) {
|
|
3111
|
+
getParsingFlags(config).era = era;
|
|
3112
|
+
} else {
|
|
3113
|
+
getParsingFlags(config).invalidEra = input;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
);
|
|
3117
|
+
addRegexToken("y", matchUnsigned);
|
|
3118
|
+
addRegexToken("yy", matchUnsigned);
|
|
3119
|
+
addRegexToken("yyy", matchUnsigned);
|
|
3120
|
+
addRegexToken("yyyy", matchUnsigned);
|
|
3121
|
+
addRegexToken("yo", matchEraYearOrdinal);
|
|
3122
|
+
addParseToken(["y", "yy", "yyy", "yyyy"], YEAR);
|
|
3123
|
+
addParseToken(["yo"], function(input, array, config, token2) {
|
|
3124
|
+
var match;
|
|
3125
|
+
if (config._locale._eraYearOrdinalRegex) {
|
|
3126
|
+
match = input.match(config._locale._eraYearOrdinalRegex);
|
|
3127
|
+
}
|
|
3128
|
+
if (config._locale.eraYearOrdinalParse) {
|
|
3129
|
+
array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
|
|
3130
|
+
} else {
|
|
3131
|
+
array[YEAR] = parseInt(input, 10);
|
|
3132
|
+
}
|
|
3133
|
+
});
|
|
3134
|
+
function localeEras(m, format2) {
|
|
3135
|
+
var i, l, date, eras = this._eras || getLocale("en")._eras;
|
|
3136
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3137
|
+
switch (typeof eras[i].since) {
|
|
3138
|
+
case "string":
|
|
3139
|
+
date = hooks(eras[i].since).startOf("day");
|
|
3140
|
+
eras[i].since = date.valueOf();
|
|
3141
|
+
break;
|
|
3142
|
+
}
|
|
3143
|
+
switch (typeof eras[i].until) {
|
|
3144
|
+
case "undefined":
|
|
3145
|
+
eras[i].until = Infinity;
|
|
3146
|
+
break;
|
|
3147
|
+
case "string":
|
|
3148
|
+
date = hooks(eras[i].until).startOf("day").valueOf();
|
|
3149
|
+
eras[i].until = date.valueOf();
|
|
3150
|
+
break;
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
return eras;
|
|
3154
|
+
}
|
|
3155
|
+
function localeErasParse(eraName, format2, strict) {
|
|
3156
|
+
var i, l, eras = this.eras(), name, abbr, narrow;
|
|
3157
|
+
eraName = eraName.toUpperCase();
|
|
3158
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3159
|
+
name = eras[i].name.toUpperCase();
|
|
3160
|
+
abbr = eras[i].abbr.toUpperCase();
|
|
3161
|
+
narrow = eras[i].narrow.toUpperCase();
|
|
3162
|
+
if (strict) {
|
|
3163
|
+
switch (format2) {
|
|
3164
|
+
case "N":
|
|
3165
|
+
case "NN":
|
|
3166
|
+
case "NNN":
|
|
3167
|
+
if (abbr === eraName) {
|
|
3168
|
+
return eras[i];
|
|
3169
|
+
}
|
|
3170
|
+
break;
|
|
3171
|
+
case "NNNN":
|
|
3172
|
+
if (name === eraName) {
|
|
3173
|
+
return eras[i];
|
|
3174
|
+
}
|
|
3175
|
+
break;
|
|
3176
|
+
case "NNNNN":
|
|
3177
|
+
if (narrow === eraName) {
|
|
3178
|
+
return eras[i];
|
|
3179
|
+
}
|
|
3180
|
+
break;
|
|
3181
|
+
}
|
|
3182
|
+
} else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
|
|
3183
|
+
return eras[i];
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
function localeErasConvertYear(era, year) {
|
|
3188
|
+
var dir = era.since <= era.until ? 1 : -1;
|
|
3189
|
+
if (year === void 0) {
|
|
3190
|
+
return hooks(era.since).year();
|
|
3191
|
+
} else {
|
|
3192
|
+
return hooks(era.since).year() + (year - era.offset) * dir;
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
function getEraName() {
|
|
3196
|
+
var i, l, val, eras = this.localeData().eras();
|
|
3197
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3198
|
+
val = this.clone().startOf("day").valueOf();
|
|
3199
|
+
if (eras[i].since <= val && val <= eras[i].until) {
|
|
3200
|
+
return eras[i].name;
|
|
3201
|
+
}
|
|
3202
|
+
if (eras[i].until <= val && val <= eras[i].since) {
|
|
3203
|
+
return eras[i].name;
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
return "";
|
|
3207
|
+
}
|
|
3208
|
+
function getEraNarrow() {
|
|
3209
|
+
var i, l, val, eras = this.localeData().eras();
|
|
3210
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3211
|
+
val = this.clone().startOf("day").valueOf();
|
|
3212
|
+
if (eras[i].since <= val && val <= eras[i].until) {
|
|
3213
|
+
return eras[i].narrow;
|
|
3214
|
+
}
|
|
3215
|
+
if (eras[i].until <= val && val <= eras[i].since) {
|
|
3216
|
+
return eras[i].narrow;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
return "";
|
|
3220
|
+
}
|
|
3221
|
+
function getEraAbbr() {
|
|
3222
|
+
var i, l, val, eras = this.localeData().eras();
|
|
3223
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3224
|
+
val = this.clone().startOf("day").valueOf();
|
|
3225
|
+
if (eras[i].since <= val && val <= eras[i].until) {
|
|
3226
|
+
return eras[i].abbr;
|
|
3227
|
+
}
|
|
3228
|
+
if (eras[i].until <= val && val <= eras[i].since) {
|
|
3229
|
+
return eras[i].abbr;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
return "";
|
|
3233
|
+
}
|
|
3234
|
+
function getEraYear() {
|
|
3235
|
+
var i, l, dir, val, eras = this.localeData().eras();
|
|
3236
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3237
|
+
dir = eras[i].since <= eras[i].until ? 1 : -1;
|
|
3238
|
+
val = this.clone().startOf("day").valueOf();
|
|
3239
|
+
if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) {
|
|
3240
|
+
return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset;
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
return this.year();
|
|
3244
|
+
}
|
|
3245
|
+
function erasNameRegex(isStrict) {
|
|
3246
|
+
if (!hasOwnProp(this, "_erasNameRegex")) {
|
|
3247
|
+
computeErasParse.call(this);
|
|
3248
|
+
}
|
|
3249
|
+
return isStrict ? this._erasNameRegex : this._erasRegex;
|
|
3250
|
+
}
|
|
3251
|
+
function erasAbbrRegex(isStrict) {
|
|
3252
|
+
if (!hasOwnProp(this, "_erasAbbrRegex")) {
|
|
3253
|
+
computeErasParse.call(this);
|
|
3254
|
+
}
|
|
3255
|
+
return isStrict ? this._erasAbbrRegex : this._erasRegex;
|
|
3256
|
+
}
|
|
3257
|
+
function erasNarrowRegex(isStrict) {
|
|
3258
|
+
if (!hasOwnProp(this, "_erasNarrowRegex")) {
|
|
3259
|
+
computeErasParse.call(this);
|
|
3260
|
+
}
|
|
3261
|
+
return isStrict ? this._erasNarrowRegex : this._erasRegex;
|
|
3262
|
+
}
|
|
3263
|
+
function matchEraAbbr(isStrict, locale2) {
|
|
3264
|
+
return locale2.erasAbbrRegex(isStrict);
|
|
3265
|
+
}
|
|
3266
|
+
function matchEraName(isStrict, locale2) {
|
|
3267
|
+
return locale2.erasNameRegex(isStrict);
|
|
3268
|
+
}
|
|
3269
|
+
function matchEraNarrow(isStrict, locale2) {
|
|
3270
|
+
return locale2.erasNarrowRegex(isStrict);
|
|
3271
|
+
}
|
|
3272
|
+
function matchEraYearOrdinal(isStrict, locale2) {
|
|
3273
|
+
return locale2._eraYearOrdinalRegex || matchUnsigned;
|
|
3274
|
+
}
|
|
3275
|
+
function computeErasParse() {
|
|
3276
|
+
var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i, l, erasName, erasAbbr, erasNarrow, eras = this.eras();
|
|
3277
|
+
for (i = 0, l = eras.length; i < l; ++i) {
|
|
3278
|
+
erasName = regexEscape(eras[i].name);
|
|
3279
|
+
erasAbbr = regexEscape(eras[i].abbr);
|
|
3280
|
+
erasNarrow = regexEscape(eras[i].narrow);
|
|
3281
|
+
namePieces.push(erasName);
|
|
3282
|
+
abbrPieces.push(erasAbbr);
|
|
3283
|
+
narrowPieces.push(erasNarrow);
|
|
3284
|
+
mixedPieces.push(erasName);
|
|
3285
|
+
mixedPieces.push(erasAbbr);
|
|
3286
|
+
mixedPieces.push(erasNarrow);
|
|
3287
|
+
}
|
|
3288
|
+
this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
|
|
3289
|
+
this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
|
|
3290
|
+
this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
|
|
3291
|
+
this._erasNarrowRegex = new RegExp(
|
|
3292
|
+
"^(" + narrowPieces.join("|") + ")",
|
|
3293
|
+
"i"
|
|
3294
|
+
);
|
|
3295
|
+
}
|
|
3296
|
+
addFormatToken(0, ["gg", 2], 0, function() {
|
|
3297
|
+
return this.weekYear() % 100;
|
|
3298
|
+
});
|
|
3299
|
+
addFormatToken(0, ["GG", 2], 0, function() {
|
|
3300
|
+
return this.isoWeekYear() % 100;
|
|
3301
|
+
});
|
|
3302
|
+
function addWeekYearFormatToken(token2, getter) {
|
|
3303
|
+
addFormatToken(0, [token2, token2.length], 0, getter);
|
|
3304
|
+
}
|
|
3305
|
+
addWeekYearFormatToken("gggg", "weekYear");
|
|
3306
|
+
addWeekYearFormatToken("ggggg", "weekYear");
|
|
3307
|
+
addWeekYearFormatToken("GGGG", "isoWeekYear");
|
|
3308
|
+
addWeekYearFormatToken("GGGGG", "isoWeekYear");
|
|
3309
|
+
addRegexToken("G", matchSigned);
|
|
3310
|
+
addRegexToken("g", matchSigned);
|
|
3311
|
+
addRegexToken("GG", match1to2, match2);
|
|
3312
|
+
addRegexToken("gg", match1to2, match2);
|
|
3313
|
+
addRegexToken("GGGG", match1to4, match4);
|
|
3314
|
+
addRegexToken("gggg", match1to4, match4);
|
|
3315
|
+
addRegexToken("GGGGG", match1to6, match6);
|
|
3316
|
+
addRegexToken("ggggg", match1to6, match6);
|
|
3317
|
+
addWeekParseToken(
|
|
3318
|
+
["gggg", "ggggg", "GGGG", "GGGGG"],
|
|
3319
|
+
function(input, week, config, token2) {
|
|
3320
|
+
week[token2.substr(0, 2)] = toInt(input);
|
|
3321
|
+
}
|
|
3322
|
+
);
|
|
3323
|
+
addWeekParseToken(["gg", "GG"], function(input, week, config, token2) {
|
|
3324
|
+
week[token2] = hooks.parseTwoDigitYear(input);
|
|
3325
|
+
});
|
|
3326
|
+
function getSetWeekYear(input) {
|
|
3327
|
+
return getSetWeekYearHelper.call(
|
|
3328
|
+
this,
|
|
3329
|
+
input,
|
|
3330
|
+
this.week(),
|
|
3331
|
+
this.weekday() + this.localeData()._week.dow,
|
|
3332
|
+
this.localeData()._week.dow,
|
|
3333
|
+
this.localeData()._week.doy
|
|
3334
|
+
);
|
|
3335
|
+
}
|
|
3336
|
+
function getSetISOWeekYear(input) {
|
|
3337
|
+
return getSetWeekYearHelper.call(
|
|
3338
|
+
this,
|
|
3339
|
+
input,
|
|
3340
|
+
this.isoWeek(),
|
|
3341
|
+
this.isoWeekday(),
|
|
3342
|
+
1,
|
|
3343
|
+
4
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
function getISOWeeksInYear() {
|
|
3347
|
+
return weeksInYear(this.year(), 1, 4);
|
|
3348
|
+
}
|
|
3349
|
+
function getISOWeeksInISOWeekYear() {
|
|
3350
|
+
return weeksInYear(this.isoWeekYear(), 1, 4);
|
|
3351
|
+
}
|
|
3352
|
+
function getWeeksInYear() {
|
|
3353
|
+
var weekInfo = this.localeData()._week;
|
|
3354
|
+
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
|
|
3355
|
+
}
|
|
3356
|
+
function getWeeksInWeekYear() {
|
|
3357
|
+
var weekInfo = this.localeData()._week;
|
|
3358
|
+
return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
|
|
3359
|
+
}
|
|
3360
|
+
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
|
|
3361
|
+
var weeksTarget;
|
|
3362
|
+
if (input == null) {
|
|
3363
|
+
return weekOfYear(this, dow, doy).year;
|
|
3364
|
+
} else {
|
|
3365
|
+
weeksTarget = weeksInYear(input, dow, doy);
|
|
3366
|
+
if (week > weeksTarget) {
|
|
3367
|
+
week = weeksTarget;
|
|
3368
|
+
}
|
|
3369
|
+
return setWeekAll.call(this, input, week, weekday, dow, doy);
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
function setWeekAll(weekYear, week, weekday, dow, doy) {
|
|
3373
|
+
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
|
|
3374
|
+
this.year(date.getUTCFullYear());
|
|
3375
|
+
this.month(date.getUTCMonth());
|
|
3376
|
+
this.date(date.getUTCDate());
|
|
3377
|
+
return this;
|
|
3378
|
+
}
|
|
3379
|
+
addFormatToken("Q", 0, "Qo", "quarter");
|
|
3380
|
+
addRegexToken("Q", match1);
|
|
3381
|
+
addParseToken("Q", function(input, array) {
|
|
3382
|
+
array[MONTH] = (toInt(input) - 1) * 3;
|
|
3383
|
+
});
|
|
3384
|
+
function getSetQuarter(input) {
|
|
3385
|
+
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
|
|
3386
|
+
}
|
|
3387
|
+
addFormatToken("D", ["DD", 2], "Do", "date");
|
|
3388
|
+
addRegexToken("D", match1to2, match1to2NoLeadingZero);
|
|
3389
|
+
addRegexToken("DD", match1to2, match2);
|
|
3390
|
+
addRegexToken("Do", function(isStrict, locale2) {
|
|
3391
|
+
return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
|
|
3392
|
+
});
|
|
3393
|
+
addParseToken(["D", "DD"], DATE);
|
|
3394
|
+
addParseToken("Do", function(input, array) {
|
|
3395
|
+
array[DATE] = toInt(input.match(match1to2)[0]);
|
|
3396
|
+
});
|
|
3397
|
+
var getSetDayOfMonth = makeGetSet("Date", true);
|
|
3398
|
+
addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
|
|
3399
|
+
addRegexToken("DDD", match1to3);
|
|
3400
|
+
addRegexToken("DDDD", match3);
|
|
3401
|
+
addParseToken(["DDD", "DDDD"], function(input, array, config) {
|
|
3402
|
+
config._dayOfYear = toInt(input);
|
|
3403
|
+
});
|
|
3404
|
+
function getSetDayOfYear(input) {
|
|
3405
|
+
var dayOfYear = Math.round(
|
|
3406
|
+
(this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
|
|
3407
|
+
) + 1;
|
|
3408
|
+
return input == null ? dayOfYear : this.add(input - dayOfYear, "d");
|
|
3409
|
+
}
|
|
3410
|
+
addFormatToken("m", ["mm", 2], 0, "minute");
|
|
3411
|
+
addRegexToken("m", match1to2, match1to2HasZero);
|
|
3412
|
+
addRegexToken("mm", match1to2, match2);
|
|
3413
|
+
addParseToken(["m", "mm"], MINUTE);
|
|
3414
|
+
var getSetMinute = makeGetSet("Minutes", false);
|
|
3415
|
+
addFormatToken("s", ["ss", 2], 0, "second");
|
|
3416
|
+
addRegexToken("s", match1to2, match1to2HasZero);
|
|
3417
|
+
addRegexToken("ss", match1to2, match2);
|
|
3418
|
+
addParseToken(["s", "ss"], SECOND);
|
|
3419
|
+
var getSetSecond = makeGetSet("Seconds", false);
|
|
3420
|
+
addFormatToken("S", 0, 0, function() {
|
|
3421
|
+
return ~~(this.millisecond() / 100);
|
|
3422
|
+
});
|
|
3423
|
+
addFormatToken(0, ["SS", 2], 0, function() {
|
|
3424
|
+
return ~~(this.millisecond() / 10);
|
|
3425
|
+
});
|
|
3426
|
+
addFormatToken(0, ["SSS", 3], 0, "millisecond");
|
|
3427
|
+
addFormatToken(0, ["SSSS", 4], 0, function() {
|
|
3428
|
+
return this.millisecond() * 10;
|
|
3429
|
+
});
|
|
3430
|
+
addFormatToken(0, ["SSSSS", 5], 0, function() {
|
|
3431
|
+
return this.millisecond() * 100;
|
|
3432
|
+
});
|
|
3433
|
+
addFormatToken(0, ["SSSSSS", 6], 0, function() {
|
|
3434
|
+
return this.millisecond() * 1e3;
|
|
3435
|
+
});
|
|
3436
|
+
addFormatToken(0, ["SSSSSSS", 7], 0, function() {
|
|
3437
|
+
return this.millisecond() * 1e4;
|
|
3438
|
+
});
|
|
3439
|
+
addFormatToken(0, ["SSSSSSSS", 8], 0, function() {
|
|
3440
|
+
return this.millisecond() * 1e5;
|
|
3441
|
+
});
|
|
3442
|
+
addFormatToken(0, ["SSSSSSSSS", 9], 0, function() {
|
|
3443
|
+
return this.millisecond() * 1e6;
|
|
3444
|
+
});
|
|
3445
|
+
addRegexToken("S", match1to3, match1);
|
|
3446
|
+
addRegexToken("SS", match1to3, match2);
|
|
3447
|
+
addRegexToken("SSS", match1to3, match3);
|
|
3448
|
+
var token, getSetMillisecond;
|
|
3449
|
+
for (token = "SSSS"; token.length <= 9; token += "S") {
|
|
3450
|
+
addRegexToken(token, matchUnsigned);
|
|
3451
|
+
}
|
|
3452
|
+
function parseMs(input, array) {
|
|
3453
|
+
array[MILLISECOND] = toInt(("0." + input) * 1e3);
|
|
3454
|
+
}
|
|
3455
|
+
for (token = "S"; token.length <= 9; token += "S") {
|
|
3456
|
+
addParseToken(token, parseMs);
|
|
3457
|
+
}
|
|
3458
|
+
getSetMillisecond = makeGetSet("Milliseconds", false);
|
|
3459
|
+
addFormatToken("z", 0, 0, "zoneAbbr");
|
|
3460
|
+
addFormatToken("zz", 0, 0, "zoneName");
|
|
3461
|
+
function getZoneAbbr() {
|
|
3462
|
+
return this._isUTC ? "UTC" : "";
|
|
3463
|
+
}
|
|
3464
|
+
function getZoneName() {
|
|
3465
|
+
return this._isUTC ? "Coordinated Universal Time" : "";
|
|
3466
|
+
}
|
|
3467
|
+
var proto = Moment.prototype;
|
|
3468
|
+
proto.add = add;
|
|
3469
|
+
proto.calendar = calendar$1;
|
|
3470
|
+
proto.clone = clone;
|
|
3471
|
+
proto.diff = diff;
|
|
3472
|
+
proto.endOf = endOf;
|
|
3473
|
+
proto.format = format;
|
|
3474
|
+
proto.from = from;
|
|
3475
|
+
proto.fromNow = fromNow;
|
|
3476
|
+
proto.to = to;
|
|
3477
|
+
proto.toNow = toNow;
|
|
3478
|
+
proto.get = stringGet;
|
|
3479
|
+
proto.invalidAt = invalidAt;
|
|
3480
|
+
proto.isAfter = isAfter;
|
|
3481
|
+
proto.isBefore = isBefore;
|
|
3482
|
+
proto.isBetween = isBetween;
|
|
3483
|
+
proto.isSame = isSame;
|
|
3484
|
+
proto.isSameOrAfter = isSameOrAfter;
|
|
3485
|
+
proto.isSameOrBefore = isSameOrBefore;
|
|
3486
|
+
proto.isValid = isValid$2;
|
|
3487
|
+
proto.lang = lang;
|
|
3488
|
+
proto.locale = locale;
|
|
3489
|
+
proto.localeData = localeData;
|
|
3490
|
+
proto.max = prototypeMax;
|
|
3491
|
+
proto.min = prototypeMin;
|
|
3492
|
+
proto.parsingFlags = parsingFlags;
|
|
3493
|
+
proto.set = stringSet;
|
|
3494
|
+
proto.startOf = startOf;
|
|
3495
|
+
proto.subtract = subtract;
|
|
3496
|
+
proto.toArray = toArray;
|
|
3497
|
+
proto.toObject = toObject;
|
|
3498
|
+
proto.toDate = toDate;
|
|
3499
|
+
proto.toISOString = toISOString;
|
|
3500
|
+
proto.inspect = inspect;
|
|
3501
|
+
if (typeof Symbol !== "undefined" && Symbol.for != null) {
|
|
3502
|
+
proto[Symbol.for("nodejs.util.inspect.custom")] = function() {
|
|
3503
|
+
return "Moment<" + this.format() + ">";
|
|
3504
|
+
};
|
|
3505
|
+
}
|
|
3506
|
+
proto.toJSON = toJSON;
|
|
3507
|
+
proto.toString = toString;
|
|
3508
|
+
proto.unix = unix;
|
|
3509
|
+
proto.valueOf = valueOf;
|
|
3510
|
+
proto.creationData = creationData;
|
|
3511
|
+
proto.eraName = getEraName;
|
|
3512
|
+
proto.eraNarrow = getEraNarrow;
|
|
3513
|
+
proto.eraAbbr = getEraAbbr;
|
|
3514
|
+
proto.eraYear = getEraYear;
|
|
3515
|
+
proto.year = getSetYear;
|
|
3516
|
+
proto.isLeapYear = getIsLeapYear;
|
|
3517
|
+
proto.weekYear = getSetWeekYear;
|
|
3518
|
+
proto.isoWeekYear = getSetISOWeekYear;
|
|
3519
|
+
proto.quarter = proto.quarters = getSetQuarter;
|
|
3520
|
+
proto.month = getSetMonth;
|
|
3521
|
+
proto.daysInMonth = getDaysInMonth;
|
|
3522
|
+
proto.week = proto.weeks = getSetWeek;
|
|
3523
|
+
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
|
|
3524
|
+
proto.weeksInYear = getWeeksInYear;
|
|
3525
|
+
proto.weeksInWeekYear = getWeeksInWeekYear;
|
|
3526
|
+
proto.isoWeeksInYear = getISOWeeksInYear;
|
|
3527
|
+
proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
|
|
3528
|
+
proto.date = getSetDayOfMonth;
|
|
3529
|
+
proto.day = proto.days = getSetDayOfWeek;
|
|
3530
|
+
proto.weekday = getSetLocaleDayOfWeek;
|
|
3531
|
+
proto.isoWeekday = getSetISODayOfWeek;
|
|
3532
|
+
proto.dayOfYear = getSetDayOfYear;
|
|
3533
|
+
proto.hour = proto.hours = getSetHour;
|
|
3534
|
+
proto.minute = proto.minutes = getSetMinute;
|
|
3535
|
+
proto.second = proto.seconds = getSetSecond;
|
|
3536
|
+
proto.millisecond = proto.milliseconds = getSetMillisecond;
|
|
3537
|
+
proto.utcOffset = getSetOffset;
|
|
3538
|
+
proto.utc = setOffsetToUTC;
|
|
3539
|
+
proto.local = setOffsetToLocal;
|
|
3540
|
+
proto.parseZone = setOffsetToParsedOffset;
|
|
3541
|
+
proto.hasAlignedHourOffset = hasAlignedHourOffset;
|
|
3542
|
+
proto.isDST = isDaylightSavingTime;
|
|
3543
|
+
proto.isLocal = isLocal;
|
|
3544
|
+
proto.isUtcOffset = isUtcOffset;
|
|
3545
|
+
proto.isUtc = isUtc;
|
|
3546
|
+
proto.isUTC = isUtc;
|
|
3547
|
+
proto.zoneAbbr = getZoneAbbr;
|
|
3548
|
+
proto.zoneName = getZoneName;
|
|
3549
|
+
proto.dates = deprecate(
|
|
3550
|
+
"dates accessor is deprecated. Use date instead.",
|
|
3551
|
+
getSetDayOfMonth
|
|
3552
|
+
);
|
|
3553
|
+
proto.months = deprecate(
|
|
3554
|
+
"months accessor is deprecated. Use month instead",
|
|
3555
|
+
getSetMonth
|
|
3556
|
+
);
|
|
3557
|
+
proto.years = deprecate(
|
|
3558
|
+
"years accessor is deprecated. Use year instead",
|
|
3559
|
+
getSetYear
|
|
3560
|
+
);
|
|
3561
|
+
proto.zone = deprecate(
|
|
3562
|
+
"moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
|
|
3563
|
+
getSetZone
|
|
3564
|
+
);
|
|
3565
|
+
proto.isDSTShifted = deprecate(
|
|
3566
|
+
"isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
|
|
3567
|
+
isDaylightSavingTimeShifted
|
|
3568
|
+
);
|
|
3569
|
+
function createUnix(input) {
|
|
3570
|
+
return createLocal(input * 1e3);
|
|
3571
|
+
}
|
|
3572
|
+
function createInZone() {
|
|
3573
|
+
return createLocal.apply(null, arguments).parseZone();
|
|
3574
|
+
}
|
|
3575
|
+
function preParsePostFormat(string) {
|
|
3576
|
+
return string;
|
|
3577
|
+
}
|
|
3578
|
+
var proto$1 = Locale.prototype;
|
|
3579
|
+
proto$1.calendar = calendar;
|
|
3580
|
+
proto$1.longDateFormat = longDateFormat;
|
|
3581
|
+
proto$1.invalidDate = invalidDate;
|
|
3582
|
+
proto$1.ordinal = ordinal;
|
|
3583
|
+
proto$1.preparse = preParsePostFormat;
|
|
3584
|
+
proto$1.postformat = preParsePostFormat;
|
|
3585
|
+
proto$1.relativeTime = relativeTime;
|
|
3586
|
+
proto$1.pastFuture = pastFuture;
|
|
3587
|
+
proto$1.set = set;
|
|
3588
|
+
proto$1.eras = localeEras;
|
|
3589
|
+
proto$1.erasParse = localeErasParse;
|
|
3590
|
+
proto$1.erasConvertYear = localeErasConvertYear;
|
|
3591
|
+
proto$1.erasAbbrRegex = erasAbbrRegex;
|
|
3592
|
+
proto$1.erasNameRegex = erasNameRegex;
|
|
3593
|
+
proto$1.erasNarrowRegex = erasNarrowRegex;
|
|
3594
|
+
proto$1.months = localeMonths;
|
|
3595
|
+
proto$1.monthsShort = localeMonthsShort;
|
|
3596
|
+
proto$1.monthsParse = localeMonthsParse;
|
|
3597
|
+
proto$1.monthsRegex = monthsRegex;
|
|
3598
|
+
proto$1.monthsShortRegex = monthsShortRegex;
|
|
3599
|
+
proto$1.week = localeWeek;
|
|
3600
|
+
proto$1.firstDayOfYear = localeFirstDayOfYear;
|
|
3601
|
+
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
|
|
3602
|
+
proto$1.weekdays = localeWeekdays;
|
|
3603
|
+
proto$1.weekdaysMin = localeWeekdaysMin;
|
|
3604
|
+
proto$1.weekdaysShort = localeWeekdaysShort;
|
|
3605
|
+
proto$1.weekdaysParse = localeWeekdaysParse;
|
|
3606
|
+
proto$1.weekdaysRegex = weekdaysRegex;
|
|
3607
|
+
proto$1.weekdaysShortRegex = weekdaysShortRegex;
|
|
3608
|
+
proto$1.weekdaysMinRegex = weekdaysMinRegex;
|
|
3609
|
+
proto$1.isPM = localeIsPM;
|
|
3610
|
+
proto$1.meridiem = localeMeridiem;
|
|
3611
|
+
function get$1(format2, index, field, setter) {
|
|
3612
|
+
var locale2 = getLocale(), utc = createUTC().set(setter, index);
|
|
3613
|
+
return locale2[field](utc, format2);
|
|
3614
|
+
}
|
|
3615
|
+
function listMonthsImpl(format2, index, field) {
|
|
3616
|
+
if (isNumber(format2)) {
|
|
3617
|
+
index = format2;
|
|
3618
|
+
format2 = void 0;
|
|
3619
|
+
}
|
|
3620
|
+
format2 = format2 || "";
|
|
3621
|
+
if (index != null) {
|
|
3622
|
+
return get$1(format2, index, field, "month");
|
|
3623
|
+
}
|
|
3624
|
+
var i, out = [];
|
|
3625
|
+
for (i = 0; i < 12; i++) {
|
|
3626
|
+
out[i] = get$1(format2, i, field, "month");
|
|
3627
|
+
}
|
|
3628
|
+
return out;
|
|
3629
|
+
}
|
|
3630
|
+
function listWeekdaysImpl(localeSorted, format2, index, field) {
|
|
3631
|
+
if (typeof localeSorted === "boolean") {
|
|
3632
|
+
if (isNumber(format2)) {
|
|
3633
|
+
index = format2;
|
|
3634
|
+
format2 = void 0;
|
|
3635
|
+
}
|
|
3636
|
+
format2 = format2 || "";
|
|
3637
|
+
} else {
|
|
3638
|
+
format2 = localeSorted;
|
|
3639
|
+
index = format2;
|
|
3640
|
+
localeSorted = false;
|
|
3641
|
+
if (isNumber(format2)) {
|
|
3642
|
+
index = format2;
|
|
3643
|
+
format2 = void 0;
|
|
3644
|
+
}
|
|
3645
|
+
format2 = format2 || "";
|
|
3646
|
+
}
|
|
3647
|
+
var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i, out = [];
|
|
3648
|
+
if (index != null) {
|
|
3649
|
+
return get$1(format2, (index + shift) % 7, field, "day");
|
|
3650
|
+
}
|
|
3651
|
+
for (i = 0; i < 7; i++) {
|
|
3652
|
+
out[i] = get$1(format2, (i + shift) % 7, field, "day");
|
|
3653
|
+
}
|
|
3654
|
+
return out;
|
|
3655
|
+
}
|
|
3656
|
+
function listMonths(format2, index) {
|
|
3657
|
+
return listMonthsImpl(format2, index, "months");
|
|
3658
|
+
}
|
|
3659
|
+
function listMonthsShort(format2, index) {
|
|
3660
|
+
return listMonthsImpl(format2, index, "monthsShort");
|
|
3661
|
+
}
|
|
3662
|
+
function listWeekdays(localeSorted, format2, index) {
|
|
3663
|
+
return listWeekdaysImpl(localeSorted, format2, index, "weekdays");
|
|
3664
|
+
}
|
|
3665
|
+
function listWeekdaysShort(localeSorted, format2, index) {
|
|
3666
|
+
return listWeekdaysImpl(localeSorted, format2, index, "weekdaysShort");
|
|
3667
|
+
}
|
|
3668
|
+
function listWeekdaysMin(localeSorted, format2, index) {
|
|
3669
|
+
return listWeekdaysImpl(localeSorted, format2, index, "weekdaysMin");
|
|
3670
|
+
}
|
|
3671
|
+
getSetGlobalLocale("en", {
|
|
3672
|
+
eras: [
|
|
3673
|
+
{
|
|
3674
|
+
since: "0001-01-01",
|
|
3675
|
+
until: Infinity,
|
|
3676
|
+
offset: 1,
|
|
3677
|
+
name: "Anno Domini",
|
|
3678
|
+
narrow: "AD",
|
|
3679
|
+
abbr: "AD"
|
|
3680
|
+
},
|
|
3681
|
+
{
|
|
3682
|
+
since: "0000-12-31",
|
|
3683
|
+
until: -Infinity,
|
|
3684
|
+
offset: 1,
|
|
3685
|
+
name: "Before Christ",
|
|
3686
|
+
narrow: "BC",
|
|
3687
|
+
abbr: "BC"
|
|
3688
|
+
}
|
|
3689
|
+
],
|
|
3690
|
+
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
|
|
3691
|
+
ordinal: function(number) {
|
|
3692
|
+
var b = number % 10, output = toInt(number % 100 / 10) === 1 ? "th" : b === 1 ? "st" : b === 2 ? "nd" : b === 3 ? "rd" : "th";
|
|
3693
|
+
return number + output;
|
|
3694
|
+
}
|
|
3695
|
+
});
|
|
3696
|
+
hooks.lang = deprecate(
|
|
3697
|
+
"moment.lang is deprecated. Use moment.locale instead.",
|
|
3698
|
+
getSetGlobalLocale
|
|
3699
|
+
);
|
|
3700
|
+
hooks.langData = deprecate(
|
|
3701
|
+
"moment.langData is deprecated. Use moment.localeData instead.",
|
|
3702
|
+
getLocale
|
|
3703
|
+
);
|
|
3704
|
+
var mathAbs = Math.abs;
|
|
3705
|
+
function abs() {
|
|
3706
|
+
var data = this._data;
|
|
3707
|
+
this._milliseconds = mathAbs(this._milliseconds);
|
|
3708
|
+
this._days = mathAbs(this._days);
|
|
3709
|
+
this._months = mathAbs(this._months);
|
|
3710
|
+
data.milliseconds = mathAbs(data.milliseconds);
|
|
3711
|
+
data.seconds = mathAbs(data.seconds);
|
|
3712
|
+
data.minutes = mathAbs(data.minutes);
|
|
3713
|
+
data.hours = mathAbs(data.hours);
|
|
3714
|
+
data.months = mathAbs(data.months);
|
|
3715
|
+
data.years = mathAbs(data.years);
|
|
3716
|
+
return this;
|
|
3717
|
+
}
|
|
3718
|
+
function addSubtract$1(duration, input, value, direction) {
|
|
3719
|
+
var other = createDuration(input, value);
|
|
3720
|
+
duration._milliseconds += direction * other._milliseconds;
|
|
3721
|
+
duration._days += direction * other._days;
|
|
3722
|
+
duration._months += direction * other._months;
|
|
3723
|
+
return duration._bubble();
|
|
3724
|
+
}
|
|
3725
|
+
function add$1(input, value) {
|
|
3726
|
+
return addSubtract$1(this, input, value, 1);
|
|
3727
|
+
}
|
|
3728
|
+
function subtract$1(input, value) {
|
|
3729
|
+
return addSubtract$1(this, input, value, -1);
|
|
3730
|
+
}
|
|
3731
|
+
function absCeil(number) {
|
|
3732
|
+
if (number < 0) {
|
|
3733
|
+
return Math.floor(number);
|
|
3734
|
+
} else {
|
|
3735
|
+
return Math.ceil(number);
|
|
3736
|
+
}
|
|
3737
|
+
}
|
|
3738
|
+
function bubble() {
|
|
3739
|
+
var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
|
|
3740
|
+
if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
|
|
3741
|
+
milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
|
|
3742
|
+
days2 = 0;
|
|
3743
|
+
months2 = 0;
|
|
3744
|
+
}
|
|
3745
|
+
data.milliseconds = milliseconds2 % 1e3;
|
|
3746
|
+
seconds2 = absFloor(milliseconds2 / 1e3);
|
|
3747
|
+
data.seconds = seconds2 % 60;
|
|
3748
|
+
minutes2 = absFloor(seconds2 / 60);
|
|
3749
|
+
data.minutes = minutes2 % 60;
|
|
3750
|
+
hours2 = absFloor(minutes2 / 60);
|
|
3751
|
+
data.hours = hours2 % 24;
|
|
3752
|
+
days2 += absFloor(hours2 / 24);
|
|
3753
|
+
monthsFromDays = absFloor(daysToMonths(days2));
|
|
3754
|
+
months2 += monthsFromDays;
|
|
3755
|
+
days2 -= absCeil(monthsToDays(monthsFromDays));
|
|
3756
|
+
years2 = absFloor(months2 / 12);
|
|
3757
|
+
months2 %= 12;
|
|
3758
|
+
data.days = days2;
|
|
3759
|
+
data.months = months2;
|
|
3760
|
+
data.years = years2;
|
|
3761
|
+
return this;
|
|
3762
|
+
}
|
|
3763
|
+
function daysToMonths(days2) {
|
|
3764
|
+
return days2 * 4800 / 146097;
|
|
3765
|
+
}
|
|
3766
|
+
function monthsToDays(months2) {
|
|
3767
|
+
return months2 * 146097 / 4800;
|
|
3768
|
+
}
|
|
3769
|
+
function as(units) {
|
|
3770
|
+
if (!this.isValid()) {
|
|
3771
|
+
return NaN;
|
|
3772
|
+
}
|
|
3773
|
+
var days2, months2, milliseconds2 = this._milliseconds;
|
|
3774
|
+
units = normalizeUnits(units);
|
|
3775
|
+
if (units === "month" || units === "quarter" || units === "year") {
|
|
3776
|
+
days2 = this._days + milliseconds2 / 864e5;
|
|
3777
|
+
months2 = this._months + daysToMonths(days2);
|
|
3778
|
+
switch (units) {
|
|
3779
|
+
case "month":
|
|
3780
|
+
return months2;
|
|
3781
|
+
case "quarter":
|
|
3782
|
+
return months2 / 3;
|
|
3783
|
+
case "year":
|
|
3784
|
+
return months2 / 12;
|
|
3785
|
+
}
|
|
3786
|
+
} else {
|
|
3787
|
+
days2 = this._days + Math.round(monthsToDays(this._months));
|
|
3788
|
+
switch (units) {
|
|
3789
|
+
case "week":
|
|
3790
|
+
return days2 / 7 + milliseconds2 / 6048e5;
|
|
3791
|
+
case "day":
|
|
3792
|
+
return days2 + milliseconds2 / 864e5;
|
|
3793
|
+
case "hour":
|
|
3794
|
+
return days2 * 24 + milliseconds2 / 36e5;
|
|
3795
|
+
case "minute":
|
|
3796
|
+
return days2 * 1440 + milliseconds2 / 6e4;
|
|
3797
|
+
case "second":
|
|
3798
|
+
return days2 * 86400 + milliseconds2 / 1e3;
|
|
3799
|
+
// Math.floor prevents floating point math errors here
|
|
3800
|
+
case "millisecond":
|
|
3801
|
+
return Math.floor(days2 * 864e5) + milliseconds2;
|
|
3802
|
+
default:
|
|
3803
|
+
throw new Error("Unknown unit " + units);
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
function makeAs(alias) {
|
|
3808
|
+
return function() {
|
|
3809
|
+
return this.as(alias);
|
|
3810
|
+
};
|
|
3811
|
+
}
|
|
3812
|
+
var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"), valueOf$1 = asMilliseconds;
|
|
3813
|
+
function clone$1() {
|
|
3814
|
+
return createDuration(this);
|
|
3815
|
+
}
|
|
3816
|
+
function get$2(units) {
|
|
3817
|
+
units = normalizeUnits(units);
|
|
3818
|
+
return this.isValid() ? this[units + "s"]() : NaN;
|
|
3819
|
+
}
|
|
3820
|
+
function makeGetter(name) {
|
|
3821
|
+
return function() {
|
|
3822
|
+
return this.isValid() ? this._data[name] : NaN;
|
|
3823
|
+
};
|
|
3824
|
+
}
|
|
3825
|
+
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
|
|
3826
|
+
function weeks() {
|
|
3827
|
+
return absFloor(this.days() / 7);
|
|
3828
|
+
}
|
|
3829
|
+
var round = Math.round, thresholds = {
|
|
3830
|
+
ss: 44,
|
|
3831
|
+
// a few seconds to seconds
|
|
3832
|
+
s: 45,
|
|
3833
|
+
// seconds to minute
|
|
3834
|
+
m: 45,
|
|
3835
|
+
// minutes to hour
|
|
3836
|
+
h: 22,
|
|
3837
|
+
// hours to day
|
|
3838
|
+
d: 26,
|
|
3839
|
+
// days to month/week
|
|
3840
|
+
w: null,
|
|
3841
|
+
// weeks to month
|
|
3842
|
+
M: 11
|
|
3843
|
+
// months to year
|
|
3844
|
+
};
|
|
3845
|
+
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale2) {
|
|
3846
|
+
return locale2.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
|
|
3847
|
+
}
|
|
3848
|
+
function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
|
|
3849
|
+
var duration = createDuration(posNegDuration).abs(), seconds2 = round(duration.as("s")), minutes2 = round(duration.as("m")), hours2 = round(duration.as("h")), days2 = round(duration.as("d")), months2 = round(duration.as("M")), weeks2 = round(duration.as("w")), years2 = round(duration.as("y")), a = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
|
|
3850
|
+
if (thresholds2.w != null) {
|
|
3851
|
+
a = a || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2];
|
|
3852
|
+
}
|
|
3853
|
+
a = a || months2 <= 1 && ["M"] || months2 < thresholds2.M && ["MM", months2] || years2 <= 1 && ["y"] || ["yy", years2];
|
|
3854
|
+
a[2] = withoutSuffix;
|
|
3855
|
+
a[3] = +posNegDuration > 0;
|
|
3856
|
+
a[4] = locale2;
|
|
3857
|
+
return substituteTimeAgo.apply(null, a);
|
|
3858
|
+
}
|
|
3859
|
+
function getSetRelativeTimeRounding(roundingFunction) {
|
|
3860
|
+
if (roundingFunction === void 0) {
|
|
3861
|
+
return round;
|
|
3862
|
+
}
|
|
3863
|
+
if (typeof roundingFunction === "function") {
|
|
3864
|
+
round = roundingFunction;
|
|
3865
|
+
return true;
|
|
3866
|
+
}
|
|
3867
|
+
return false;
|
|
3868
|
+
}
|
|
3869
|
+
function getSetRelativeTimeThreshold(threshold, limit) {
|
|
3870
|
+
if (thresholds[threshold] === void 0) {
|
|
3871
|
+
return false;
|
|
3872
|
+
}
|
|
3873
|
+
if (limit === void 0) {
|
|
3874
|
+
return thresholds[threshold];
|
|
3875
|
+
}
|
|
3876
|
+
thresholds[threshold] = limit;
|
|
3877
|
+
if (threshold === "s") {
|
|
3878
|
+
thresholds.ss = limit - 1;
|
|
3879
|
+
}
|
|
3880
|
+
return true;
|
|
3881
|
+
}
|
|
3882
|
+
function humanize(argWithSuffix, argThresholds) {
|
|
3883
|
+
if (!this.isValid()) {
|
|
3884
|
+
return this.localeData().invalidDate();
|
|
3885
|
+
}
|
|
3886
|
+
var withSuffix = false, th = thresholds, locale2, output;
|
|
3887
|
+
if (typeof argWithSuffix === "object") {
|
|
3888
|
+
argThresholds = argWithSuffix;
|
|
3889
|
+
argWithSuffix = false;
|
|
3890
|
+
}
|
|
3891
|
+
if (typeof argWithSuffix === "boolean") {
|
|
3892
|
+
withSuffix = argWithSuffix;
|
|
3893
|
+
}
|
|
3894
|
+
if (typeof argThresholds === "object") {
|
|
3895
|
+
th = Object.assign({}, thresholds, argThresholds);
|
|
3896
|
+
if (argThresholds.s != null && argThresholds.ss == null) {
|
|
3897
|
+
th.ss = argThresholds.s - 1;
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
locale2 = this.localeData();
|
|
3901
|
+
output = relativeTime$1(this, !withSuffix, th, locale2);
|
|
3902
|
+
if (withSuffix) {
|
|
3903
|
+
output = locale2.pastFuture(+this, output);
|
|
3904
|
+
}
|
|
3905
|
+
return locale2.postformat(output);
|
|
3906
|
+
}
|
|
3907
|
+
var abs$1 = Math.abs;
|
|
3908
|
+
function sign(x) {
|
|
3909
|
+
return (x > 0) - (x < 0) || +x;
|
|
3910
|
+
}
|
|
3911
|
+
function toISOString$1() {
|
|
3912
|
+
if (!this.isValid()) {
|
|
3913
|
+
return this.localeData().invalidDate();
|
|
3914
|
+
}
|
|
3915
|
+
var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
|
|
3916
|
+
if (!total) {
|
|
3917
|
+
return "P0D";
|
|
3918
|
+
}
|
|
3919
|
+
minutes2 = absFloor(seconds2 / 60);
|
|
3920
|
+
hours2 = absFloor(minutes2 / 60);
|
|
3921
|
+
seconds2 %= 60;
|
|
3922
|
+
minutes2 %= 60;
|
|
3923
|
+
years2 = absFloor(months2 / 12);
|
|
3924
|
+
months2 %= 12;
|
|
3925
|
+
s = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : "";
|
|
3926
|
+
totalSign = total < 0 ? "-" : "";
|
|
3927
|
+
ymSign = sign(this._months) !== sign(total) ? "-" : "";
|
|
3928
|
+
daysSign = sign(this._days) !== sign(total) ? "-" : "";
|
|
3929
|
+
hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
|
|
3930
|
+
return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s + "S" : "");
|
|
3931
|
+
}
|
|
3932
|
+
var proto$2 = Duration.prototype;
|
|
3933
|
+
proto$2.isValid = isValid$1;
|
|
3934
|
+
proto$2.abs = abs;
|
|
3935
|
+
proto$2.add = add$1;
|
|
3936
|
+
proto$2.subtract = subtract$1;
|
|
3937
|
+
proto$2.as = as;
|
|
3938
|
+
proto$2.asMilliseconds = asMilliseconds;
|
|
3939
|
+
proto$2.asSeconds = asSeconds;
|
|
3940
|
+
proto$2.asMinutes = asMinutes;
|
|
3941
|
+
proto$2.asHours = asHours;
|
|
3942
|
+
proto$2.asDays = asDays;
|
|
3943
|
+
proto$2.asWeeks = asWeeks;
|
|
3944
|
+
proto$2.asMonths = asMonths;
|
|
3945
|
+
proto$2.asQuarters = asQuarters;
|
|
3946
|
+
proto$2.asYears = asYears;
|
|
3947
|
+
proto$2.valueOf = valueOf$1;
|
|
3948
|
+
proto$2._bubble = bubble;
|
|
3949
|
+
proto$2.clone = clone$1;
|
|
3950
|
+
proto$2.get = get$2;
|
|
3951
|
+
proto$2.milliseconds = milliseconds;
|
|
3952
|
+
proto$2.seconds = seconds;
|
|
3953
|
+
proto$2.minutes = minutes;
|
|
3954
|
+
proto$2.hours = hours;
|
|
3955
|
+
proto$2.days = days;
|
|
3956
|
+
proto$2.weeks = weeks;
|
|
3957
|
+
proto$2.months = months;
|
|
3958
|
+
proto$2.years = years;
|
|
3959
|
+
proto$2.humanize = humanize;
|
|
3960
|
+
proto$2.toISOString = toISOString$1;
|
|
3961
|
+
proto$2.toString = toISOString$1;
|
|
3962
|
+
proto$2.toJSON = toISOString$1;
|
|
3963
|
+
proto$2.locale = locale;
|
|
3964
|
+
proto$2.localeData = localeData;
|
|
3965
|
+
proto$2.toIsoString = deprecate(
|
|
3966
|
+
"toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
|
|
3967
|
+
toISOString$1
|
|
3968
|
+
);
|
|
3969
|
+
proto$2.lang = lang;
|
|
3970
|
+
addFormatToken("X", 0, 0, "unix");
|
|
3971
|
+
addFormatToken("x", 0, 0, "valueOf");
|
|
3972
|
+
addRegexToken("x", matchSigned);
|
|
3973
|
+
addRegexToken("X", matchTimestamp);
|
|
3974
|
+
addParseToken("X", function(input, array, config) {
|
|
3975
|
+
config._d = new Date(parseFloat(input) * 1e3);
|
|
3976
|
+
});
|
|
3977
|
+
addParseToken("x", function(input, array, config) {
|
|
3978
|
+
config._d = new Date(toInt(input));
|
|
3979
|
+
});
|
|
3980
|
+
hooks.version = "2.30.1";
|
|
3981
|
+
setHookCallback(createLocal);
|
|
3982
|
+
hooks.fn = proto;
|
|
3983
|
+
hooks.min = min;
|
|
3984
|
+
hooks.max = max;
|
|
3985
|
+
hooks.now = now;
|
|
3986
|
+
hooks.utc = createUTC;
|
|
3987
|
+
hooks.unix = createUnix;
|
|
3988
|
+
hooks.months = listMonths;
|
|
3989
|
+
hooks.isDate = isDate;
|
|
3990
|
+
hooks.locale = getSetGlobalLocale;
|
|
3991
|
+
hooks.invalid = createInvalid;
|
|
3992
|
+
hooks.duration = createDuration;
|
|
3993
|
+
hooks.isMoment = isMoment;
|
|
3994
|
+
hooks.weekdays = listWeekdays;
|
|
3995
|
+
hooks.parseZone = createInZone;
|
|
3996
|
+
hooks.localeData = getLocale;
|
|
3997
|
+
hooks.isDuration = isDuration;
|
|
3998
|
+
hooks.monthsShort = listMonthsShort;
|
|
3999
|
+
hooks.weekdaysMin = listWeekdaysMin;
|
|
4000
|
+
hooks.defineLocale = defineLocale;
|
|
4001
|
+
hooks.updateLocale = updateLocale;
|
|
4002
|
+
hooks.locales = listLocales;
|
|
4003
|
+
hooks.weekdaysShort = listWeekdaysShort;
|
|
4004
|
+
hooks.normalizeUnits = normalizeUnits;
|
|
4005
|
+
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
|
|
4006
|
+
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
|
|
4007
|
+
hooks.calendarFormat = getCalendarFormat;
|
|
4008
|
+
hooks.prototype = proto;
|
|
4009
|
+
hooks.HTML5_FMT = {
|
|
4010
|
+
DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
|
|
4011
|
+
// <input type="datetime-local" />
|
|
4012
|
+
DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
|
|
4013
|
+
// <input type="datetime-local" step="1" />
|
|
4014
|
+
DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
|
|
4015
|
+
// <input type="datetime-local" step="0.001" />
|
|
4016
|
+
DATE: "YYYY-MM-DD",
|
|
4017
|
+
// <input type="date" />
|
|
4018
|
+
TIME: "HH:mm",
|
|
4019
|
+
// <input type="time" />
|
|
4020
|
+
TIME_SECONDS: "HH:mm:ss",
|
|
4021
|
+
// <input type="time" step="1" />
|
|
4022
|
+
TIME_MS: "HH:mm:ss.SSS",
|
|
4023
|
+
// <input type="time" step="0.001" />
|
|
4024
|
+
WEEK: "GGGG-[W]WW",
|
|
4025
|
+
// <input type="week" />
|
|
4026
|
+
MONTH: "YYYY-MM"
|
|
4027
|
+
// <input type="month" />
|
|
4028
|
+
};
|
|
4029
|
+
return hooks;
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
});
|
|
4033
|
+
|
|
4034
|
+
// node_modules/void-elements/index.js
|
|
4035
|
+
var require_void_elements = __commonJS({
|
|
4036
|
+
"node_modules/void-elements/index.js"(exports2, module2) {
|
|
4037
|
+
"use strict";
|
|
4038
|
+
module2.exports = {
|
|
4039
|
+
"area": true,
|
|
4040
|
+
"base": true,
|
|
4041
|
+
"br": true,
|
|
4042
|
+
"col": true,
|
|
4043
|
+
"embed": true,
|
|
4044
|
+
"hr": true,
|
|
4045
|
+
"img": true,
|
|
4046
|
+
"input": true,
|
|
4047
|
+
"link": true,
|
|
4048
|
+
"meta": true,
|
|
4049
|
+
"param": true,
|
|
4050
|
+
"source": true,
|
|
4051
|
+
"track": true,
|
|
4052
|
+
"wbr": true
|
|
4053
|
+
};
|
|
4054
|
+
}
|
|
4055
|
+
});
|
|
4056
|
+
|
|
4057
|
+
// src/utils.ts
|
|
4058
|
+
var utils_exports = {};
|
|
4059
|
+
__export(utils_exports, {
|
|
4060
|
+
COLORS: () => COLORS,
|
|
4061
|
+
DOTS: () => DOTS,
|
|
4062
|
+
SearchType: () => SearchType,
|
|
4063
|
+
checkIsImageLink: () => checkIsImageLink,
|
|
4064
|
+
convertFloatToTime: () => convertFloatToTime,
|
|
4065
|
+
formatFileSize: () => formatFileSize,
|
|
4066
|
+
formatNumberOnly: () => formatNumberOnly,
|
|
4067
|
+
getPasswordMessage: () => getPasswordMessage,
|
|
4068
|
+
isBase64Image: () => isBase64Image,
|
|
4069
|
+
isObjectEmpty: () => isObjectEmpty,
|
|
4070
|
+
parseFormattedNumber: () => parseFormattedNumber,
|
|
4071
|
+
range: () => range,
|
|
4072
|
+
typeStyles: () => typeStyles,
|
|
4073
|
+
useFormatDate: () => useFormatDate,
|
|
4074
|
+
useFormatFloatNumber: () => useFormatFloatNumber,
|
|
4075
|
+
validateAndParseDate: () => validateAndParseDate,
|
|
4076
|
+
validateInput: () => validateInput
|
|
4077
|
+
});
|
|
4078
|
+
module.exports = __toCommonJS(utils_exports);
|
|
4079
|
+
|
|
4080
|
+
// src/utils/function.ts
|
|
4081
|
+
var import_moment = __toESM(require_moment());
|
|
4082
|
+
|
|
4083
|
+
// node_modules/react-i18next/dist/es/Trans.js
|
|
4084
|
+
var import_react3 = require("react");
|
|
4085
|
+
|
|
4086
|
+
// node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
4087
|
+
var import_react = require("react");
|
|
4088
|
+
|
|
4089
|
+
// node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
|
|
4090
|
+
var import_void_elements = __toESM(require_void_elements());
|
|
4091
|
+
|
|
4092
|
+
// node_modules/react-i18next/dist/es/utils.js
|
|
4093
|
+
var warn = (i18n, code, msg, rest) => {
|
|
4094
|
+
const args = [msg, {
|
|
4095
|
+
code,
|
|
4096
|
+
...rest || {}
|
|
4097
|
+
}];
|
|
4098
|
+
if (i18n?.services?.logger?.forward) {
|
|
4099
|
+
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
4100
|
+
}
|
|
4101
|
+
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
4102
|
+
if (i18n?.services?.logger?.warn) {
|
|
4103
|
+
i18n.services.logger.warn(...args);
|
|
4104
|
+
} else if (console?.warn) {
|
|
4105
|
+
console.warn(...args);
|
|
4106
|
+
}
|
|
4107
|
+
};
|
|
4108
|
+
var alreadyWarned = {};
|
|
4109
|
+
var warnOnce = (i18n, code, msg, rest) => {
|
|
4110
|
+
if (isString(msg) && alreadyWarned[msg]) return;
|
|
4111
|
+
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
4112
|
+
warn(i18n, code, msg, rest);
|
|
4113
|
+
};
|
|
4114
|
+
var loadedClb = (i18n, cb) => () => {
|
|
4115
|
+
if (i18n.isInitialized) {
|
|
4116
|
+
cb();
|
|
4117
|
+
} else {
|
|
4118
|
+
const initialized = () => {
|
|
4119
|
+
setTimeout(() => {
|
|
4120
|
+
i18n.off("initialized", initialized);
|
|
4121
|
+
}, 0);
|
|
4122
|
+
cb();
|
|
4123
|
+
};
|
|
4124
|
+
i18n.on("initialized", initialized);
|
|
4125
|
+
}
|
|
4126
|
+
};
|
|
4127
|
+
var loadNamespaces = (i18n, ns, cb) => {
|
|
4128
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
4129
|
+
};
|
|
4130
|
+
var loadLanguages = (i18n, lng, ns, cb) => {
|
|
4131
|
+
if (isString(ns)) ns = [ns];
|
|
4132
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
4133
|
+
ns.forEach((n) => {
|
|
4134
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
4135
|
+
});
|
|
4136
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
4137
|
+
};
|
|
4138
|
+
var hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
4139
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
4140
|
+
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
4141
|
+
languages: i18n.languages
|
|
4142
|
+
});
|
|
4143
|
+
return true;
|
|
4144
|
+
}
|
|
4145
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
4146
|
+
lng: options.lng,
|
|
4147
|
+
precheck: (i18nInstance2, loadNotPending) => {
|
|
4148
|
+
if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
4149
|
+
}
|
|
4150
|
+
});
|
|
4151
|
+
};
|
|
4152
|
+
var isString = (obj) => typeof obj === "string";
|
|
4153
|
+
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
4154
|
+
|
|
4155
|
+
// node_modules/react-i18next/dist/es/unescape.js
|
|
4156
|
+
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
4157
|
+
var htmlEntities = {
|
|
4158
|
+
"&": "&",
|
|
4159
|
+
"&": "&",
|
|
4160
|
+
"<": "<",
|
|
4161
|
+
"<": "<",
|
|
4162
|
+
">": ">",
|
|
4163
|
+
">": ">",
|
|
4164
|
+
"'": "'",
|
|
4165
|
+
"'": "'",
|
|
4166
|
+
""": '"',
|
|
4167
|
+
""": '"',
|
|
4168
|
+
" ": " ",
|
|
4169
|
+
" ": " ",
|
|
4170
|
+
"©": "\xA9",
|
|
4171
|
+
"©": "\xA9",
|
|
4172
|
+
"®": "\xAE",
|
|
4173
|
+
"®": "\xAE",
|
|
4174
|
+
"…": "\u2026",
|
|
4175
|
+
"…": "\u2026",
|
|
4176
|
+
"/": "/",
|
|
4177
|
+
"/": "/"
|
|
4178
|
+
};
|
|
4179
|
+
var unescapeHtmlEntity = (m) => htmlEntities[m];
|
|
4180
|
+
var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
4181
|
+
|
|
4182
|
+
// node_modules/react-i18next/dist/es/defaults.js
|
|
4183
|
+
var defaultOptions = {
|
|
4184
|
+
bindI18n: "languageChanged",
|
|
4185
|
+
bindI18nStore: "",
|
|
4186
|
+
transEmptyNodeValue: "",
|
|
4187
|
+
transSupportBasicHtmlNodes: true,
|
|
4188
|
+
transWrapTextNodes: "",
|
|
4189
|
+
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
4190
|
+
useSuspense: true,
|
|
4191
|
+
unescape
|
|
4192
|
+
};
|
|
4193
|
+
var getDefaults = () => defaultOptions;
|
|
4194
|
+
|
|
4195
|
+
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
4196
|
+
var i18nInstance;
|
|
4197
|
+
var getI18n = () => i18nInstance;
|
|
4198
|
+
|
|
4199
|
+
// node_modules/react-i18next/dist/es/context.js
|
|
4200
|
+
var import_react2 = require("react");
|
|
4201
|
+
var I18nContext = (0, import_react2.createContext)();
|
|
4202
|
+
var ReportNamespaces = class {
|
|
4203
|
+
constructor() {
|
|
4204
|
+
this.usedNamespaces = {};
|
|
4205
|
+
}
|
|
4206
|
+
addUsedNamespaces(namespaces) {
|
|
4207
|
+
namespaces.forEach((ns) => {
|
|
4208
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
4209
|
+
});
|
|
4210
|
+
}
|
|
4211
|
+
getUsedNamespaces() {
|
|
4212
|
+
return Object.keys(this.usedNamespaces);
|
|
4213
|
+
}
|
|
4214
|
+
};
|
|
4215
|
+
|
|
4216
|
+
// node_modules/react-i18next/dist/es/useTranslation.js
|
|
4217
|
+
var import_react4 = require("react");
|
|
4218
|
+
var usePrevious = (value, ignore) => {
|
|
4219
|
+
const ref = (0, import_react4.useRef)();
|
|
4220
|
+
(0, import_react4.useEffect)(() => {
|
|
4221
|
+
ref.current = ignore ? ref.current : value;
|
|
4222
|
+
}, [value, ignore]);
|
|
4223
|
+
return ref.current;
|
|
4224
|
+
};
|
|
4225
|
+
var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
4226
|
+
var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react4.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
4227
|
+
var useTranslation = (ns, props = {}) => {
|
|
4228
|
+
const {
|
|
4229
|
+
i18n: i18nFromProps
|
|
4230
|
+
} = props;
|
|
4231
|
+
const {
|
|
4232
|
+
i18n: i18nFromContext,
|
|
4233
|
+
defaultNS: defaultNSFromContext
|
|
4234
|
+
} = (0, import_react4.useContext)(I18nContext) || {};
|
|
4235
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
4236
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
4237
|
+
if (!i18n) {
|
|
4238
|
+
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
4239
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
4240
|
+
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
4241
|
+
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
4242
|
+
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
4243
|
+
};
|
|
4244
|
+
const retNotReady = [notReadyT, {}, false];
|
|
4245
|
+
retNotReady.t = notReadyT;
|
|
4246
|
+
retNotReady.i18n = {};
|
|
4247
|
+
retNotReady.ready = false;
|
|
4248
|
+
return retNotReady;
|
|
4249
|
+
}
|
|
4250
|
+
if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
4251
|
+
const i18nOptions = {
|
|
4252
|
+
...getDefaults(),
|
|
4253
|
+
...i18n.options.react,
|
|
4254
|
+
...props
|
|
4255
|
+
};
|
|
4256
|
+
const {
|
|
4257
|
+
useSuspense,
|
|
4258
|
+
keyPrefix
|
|
4259
|
+
} = i18nOptions;
|
|
4260
|
+
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
4261
|
+
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
4262
|
+
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
4263
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
4264
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
4265
|
+
const getT = () => memoGetT;
|
|
4266
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
4267
|
+
const [t, setT] = (0, import_react4.useState)(getT);
|
|
4268
|
+
let joinedNS = namespaces.join();
|
|
4269
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
4270
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
4271
|
+
const isMounted = (0, import_react4.useRef)(true);
|
|
4272
|
+
(0, import_react4.useEffect)(() => {
|
|
4273
|
+
const {
|
|
4274
|
+
bindI18n,
|
|
4275
|
+
bindI18nStore
|
|
4276
|
+
} = i18nOptions;
|
|
4277
|
+
isMounted.current = true;
|
|
4278
|
+
if (!ready && !useSuspense) {
|
|
4279
|
+
if (props.lng) {
|
|
4280
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
4281
|
+
if (isMounted.current) setT(getNewT);
|
|
4282
|
+
});
|
|
4283
|
+
} else {
|
|
4284
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
4285
|
+
if (isMounted.current) setT(getNewT);
|
|
4286
|
+
});
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
4290
|
+
setT(getNewT);
|
|
4291
|
+
}
|
|
4292
|
+
const boundReset = () => {
|
|
4293
|
+
if (isMounted.current) setT(getNewT);
|
|
4294
|
+
};
|
|
4295
|
+
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
4296
|
+
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
4297
|
+
return () => {
|
|
4298
|
+
isMounted.current = false;
|
|
4299
|
+
if (i18n && bindI18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
|
|
4300
|
+
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
|
|
4301
|
+
};
|
|
4302
|
+
}, [i18n, joinedNS]);
|
|
4303
|
+
(0, import_react4.useEffect)(() => {
|
|
4304
|
+
if (isMounted.current && ready) {
|
|
4305
|
+
setT(getT);
|
|
4306
|
+
}
|
|
4307
|
+
}, [i18n, keyPrefix, ready]);
|
|
4308
|
+
const ret = [t, i18n, ready];
|
|
4309
|
+
ret.t = t;
|
|
4310
|
+
ret.i18n = i18n;
|
|
4311
|
+
ret.ready = ready;
|
|
4312
|
+
if (ready) return ret;
|
|
4313
|
+
if (!ready && !useSuspense) return ret;
|
|
4314
|
+
throw new Promise((resolve) => {
|
|
4315
|
+
if (props.lng) {
|
|
4316
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
4317
|
+
} else {
|
|
4318
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
4319
|
+
}
|
|
4320
|
+
});
|
|
4321
|
+
};
|
|
4322
|
+
|
|
4323
|
+
// node_modules/react-i18next/dist/es/withTranslation.js
|
|
4324
|
+
var import_react5 = require("react");
|
|
4325
|
+
|
|
4326
|
+
// node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
4327
|
+
var import_react6 = require("react");
|
|
4328
|
+
|
|
4329
|
+
// node_modules/react-i18next/dist/es/withSSR.js
|
|
4330
|
+
var import_react8 = require("react");
|
|
4331
|
+
|
|
4332
|
+
// node_modules/react-i18next/dist/es/useSSR.js
|
|
4333
|
+
var import_react7 = require("react");
|
|
4334
|
+
|
|
4335
|
+
// src/utils/function.ts
|
|
4336
|
+
var useFormatFloatNumber = (value) => {
|
|
4337
|
+
if (value === void 0 || value === null || value === "") return "";
|
|
4338
|
+
const numValue = typeof value === "string" ? parseFloat(value.replace(/,/g, "")) : value;
|
|
4339
|
+
if (isNaN(numValue)) return "";
|
|
4340
|
+
return numValue.toLocaleString("en-US", {
|
|
4341
|
+
minimumFractionDigits: numValue % 1 === 0 ? 0 : 1,
|
|
4342
|
+
maximumFractionDigits: 20
|
|
4343
|
+
});
|
|
4344
|
+
};
|
|
4345
|
+
var useFormatDate = () => {
|
|
4346
|
+
const { t } = useTranslation();
|
|
4347
|
+
const getRelativeTime = (dateString) => {
|
|
4348
|
+
const units = [
|
|
4349
|
+
{
|
|
4350
|
+
unit: "year",
|
|
4351
|
+
seconds: 365 * 24 * 60 * 60,
|
|
4352
|
+
keyPast: "year_ago",
|
|
4353
|
+
keyFuture: "year_future"
|
|
4354
|
+
},
|
|
4355
|
+
{
|
|
4356
|
+
unit: "month",
|
|
4357
|
+
seconds: 30 * 24 * 60 * 60,
|
|
4358
|
+
keyPast: "month_ago",
|
|
4359
|
+
keyFuture: "month_future"
|
|
4360
|
+
},
|
|
4361
|
+
{
|
|
4362
|
+
unit: "day",
|
|
4363
|
+
seconds: 24 * 60 * 60,
|
|
4364
|
+
keyPast: "day_ago",
|
|
4365
|
+
keyFuture: "day_future"
|
|
4366
|
+
},
|
|
4367
|
+
{
|
|
4368
|
+
unit: "hour",
|
|
4369
|
+
seconds: 60 * 60,
|
|
4370
|
+
keyPast: "hour_ago",
|
|
4371
|
+
keyFuture: "hour_future"
|
|
4372
|
+
},
|
|
4373
|
+
{
|
|
4374
|
+
unit: "minute",
|
|
4375
|
+
seconds: 60,
|
|
4376
|
+
keyPast: "minute_ago",
|
|
4377
|
+
keyFuture: "minute_future"
|
|
4378
|
+
},
|
|
4379
|
+
{
|
|
4380
|
+
unit: "second",
|
|
4381
|
+
seconds: 1,
|
|
4382
|
+
keyPast: "second_ago",
|
|
4383
|
+
keyFuture: "second_future"
|
|
4384
|
+
}
|
|
4385
|
+
];
|
|
4386
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
4387
|
+
let year, month, day, hours = 0, minutes = 0, seconds = 0;
|
|
4388
|
+
const parts = dateString.split(/[- :]/).map(Number);
|
|
4389
|
+
if (parts[0] > 31) {
|
|
4390
|
+
;
|
|
4391
|
+
[year, month, day] = parts;
|
|
4392
|
+
} else {
|
|
4393
|
+
;
|
|
4394
|
+
[day, month, year] = parts;
|
|
4395
|
+
}
|
|
4396
|
+
if (parts.length > 3) [hours, minutes, seconds] = parts.slice(3);
|
|
4397
|
+
const givenDate = new Date(year, month - 1, day, hours, minutes, seconds);
|
|
4398
|
+
if (hours === 0 && minutes === 0 && seconds === 0) {
|
|
4399
|
+
givenDate.setHours(23, 59, 59);
|
|
4400
|
+
}
|
|
4401
|
+
const timeDifferenceInSeconds = Math.floor(
|
|
4402
|
+
(givenDate.getTime() - currentDate.getTime()) / 1e3
|
|
4403
|
+
);
|
|
4404
|
+
const isFuture = timeDifferenceInSeconds > 0;
|
|
4405
|
+
const absoluteDiff = Math.abs(timeDifferenceInSeconds);
|
|
4406
|
+
for (const { seconds: seconds2, keyPast, keyFuture } of units) {
|
|
4407
|
+
let diff = absoluteDiff / seconds2;
|
|
4408
|
+
if (diff >= 1) {
|
|
4409
|
+
diff = isFuture ? Math.ceil(diff) : Math.floor(diff);
|
|
4410
|
+
return isFuture ? `${diff} ${t(keyFuture, { count: diff })}` : `${diff} ${t(keyPast, { count: diff })}`;
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
return t("now");
|
|
4414
|
+
};
|
|
4415
|
+
return { getRelativeTime };
|
|
4416
|
+
};
|
|
4417
|
+
function validateInput(value, type) {
|
|
4418
|
+
if (type === "text") {
|
|
4419
|
+
return /^[\p{L}\s]+$/u.test(value);
|
|
4420
|
+
}
|
|
4421
|
+
if (type === "number") {
|
|
4422
|
+
return /^[0-9]+$/.test(value);
|
|
4423
|
+
}
|
|
4424
|
+
if (type === "email") {
|
|
4425
|
+
return /^[a-zA-Z0-9._]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value);
|
|
4426
|
+
}
|
|
4427
|
+
if (type === "phone") {
|
|
4428
|
+
return /^(0|\+?84)[0-9]{9}$/.test(value);
|
|
4429
|
+
}
|
|
4430
|
+
return false;
|
|
4431
|
+
}
|
|
4432
|
+
function getPasswordMessage(min, max, upcase, digit, special) {
|
|
4433
|
+
let message = `M\u1EADt kh\u1EA9u ph\u1EA3i c\xF3 t\u1EEB ${min} \u0111\u1EBFn ${max} k\xFD t\u1EF1`;
|
|
4434
|
+
if (upcase || upcase === "0") {
|
|
4435
|
+
message += `, ${upcase} ch\u1EEF in hoa`;
|
|
4436
|
+
}
|
|
4437
|
+
if (digit || digit === "0") {
|
|
4438
|
+
message += `, ${digit} s\u1ED1`;
|
|
4439
|
+
}
|
|
4440
|
+
if (special || special === "0") {
|
|
4441
|
+
message += `, ${special} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t`;
|
|
4442
|
+
}
|
|
4443
|
+
return message;
|
|
4444
|
+
}
|
|
4445
|
+
var range = (start, end) => {
|
|
4446
|
+
let length = end - start + 1;
|
|
4447
|
+
return Array.from({ length }, (_, idx) => idx + start);
|
|
4448
|
+
};
|
|
4449
|
+
var formatNumberOnly = (num) => {
|
|
4450
|
+
if (isNaN(num)) return "";
|
|
4451
|
+
return num?.toString()?.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
4452
|
+
};
|
|
4453
|
+
var parseFormattedNumber = (val) => {
|
|
4454
|
+
if (!val) return "0";
|
|
4455
|
+
const raw = val.replace(/[^\d]/g, "");
|
|
4456
|
+
return raw ? parseFloat(raw) : "";
|
|
4457
|
+
};
|
|
4458
|
+
var validateAndParseDate = (input, isDateTime = false) => {
|
|
4459
|
+
if (!input || typeof input !== "string") return null;
|
|
4460
|
+
const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
|
|
4461
|
+
const dateFormat = "YYYY-MM-DD";
|
|
4462
|
+
const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
|
|
4463
|
+
const currentDay = (0, import_moment.default)().format("DD");
|
|
4464
|
+
const currentMonth = (0, import_moment.default)().format("MM");
|
|
4465
|
+
const currentYear = (0, import_moment.default)().format("YYYY");
|
|
4466
|
+
const defaultTime = "00:00:00";
|
|
4467
|
+
const maxYear = parseInt(currentYear) + 10;
|
|
4468
|
+
const isValidDate = (day, month, year) => {
|
|
4469
|
+
const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
|
|
4470
|
+
return date.isValid();
|
|
4471
|
+
};
|
|
4472
|
+
const isValidTime = (hour, minute = "00", second = "00") => {
|
|
4473
|
+
const h = parseInt(hour, 10);
|
|
4474
|
+
const m = parseInt(minute, 10);
|
|
4475
|
+
const s = parseInt(second, 10);
|
|
4476
|
+
return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
|
|
4477
|
+
};
|
|
4478
|
+
const formatOutput = (day, month, year, time = defaultTime) => {
|
|
4479
|
+
let result = (0, import_moment.default)(
|
|
4480
|
+
`${day}-${month}-${year} ${time}`,
|
|
4481
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4482
|
+
);
|
|
4483
|
+
if (!result.isValid()) return null;
|
|
4484
|
+
if (isDateTime) {
|
|
4485
|
+
result = result.subtract(7, "hours");
|
|
4486
|
+
return result.format(dateTimeFormat);
|
|
4487
|
+
}
|
|
4488
|
+
return result.format(dateFormat);
|
|
4489
|
+
};
|
|
4490
|
+
if (isDateTime && input.match(
|
|
4491
|
+
/^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
|
|
4492
|
+
)) {
|
|
4493
|
+
const [datePart, timePart] = input.split(/\s+/);
|
|
4494
|
+
const dateParts = datePart.split(/[\/-]/);
|
|
4495
|
+
const timeParts = timePart.split(":");
|
|
4496
|
+
const day = dateParts[0].padStart(2, "0");
|
|
4497
|
+
const month = dateParts[1].padStart(2, "0");
|
|
4498
|
+
const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
|
|
4499
|
+
const hour = timeParts[0].padStart(2, "0");
|
|
4500
|
+
const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
|
|
4501
|
+
const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
|
|
4502
|
+
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
4503
|
+
let result = (0, import_moment.default)(
|
|
4504
|
+
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
4505
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4506
|
+
);
|
|
4507
|
+
if (!result.isValid()) return null;
|
|
4508
|
+
result = result.subtract(7, "hours");
|
|
4509
|
+
return result.format(dateTimeFormat);
|
|
4510
|
+
}
|
|
4511
|
+
return null;
|
|
4512
|
+
}
|
|
4513
|
+
if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
4514
|
+
const [year, month, day] = cleanInput.split("-");
|
|
4515
|
+
if (isValidDate(day, month, year)) {
|
|
4516
|
+
return formatOutput(day, month, year);
|
|
4517
|
+
}
|
|
4518
|
+
return null;
|
|
4519
|
+
}
|
|
4520
|
+
if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
|
|
4521
|
+
const [day, month, year] = cleanInput.split("/");
|
|
4522
|
+
const paddedDay = day.padStart(2, "0");
|
|
4523
|
+
const paddedMonth = month.padStart(2, "0");
|
|
4524
|
+
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
4525
|
+
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
4526
|
+
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
4527
|
+
}
|
|
4528
|
+
return null;
|
|
4529
|
+
}
|
|
4530
|
+
if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
|
|
4531
|
+
const [day, month, year] = cleanInput.split("-");
|
|
4532
|
+
const paddedDay = day.padStart(2, "0");
|
|
4533
|
+
const paddedMonth = month.padStart(2, "0");
|
|
4534
|
+
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
4535
|
+
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
4536
|
+
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
4537
|
+
}
|
|
4538
|
+
return null;
|
|
4539
|
+
}
|
|
4540
|
+
if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
|
|
4541
|
+
const [day, month] = cleanInput.split(/[\/-]/);
|
|
4542
|
+
const paddedDay = day.padStart(2, "0");
|
|
4543
|
+
const paddedMonth = month.padStart(2, "0");
|
|
4544
|
+
if (isValidDate(paddedDay, paddedMonth, currentYear)) {
|
|
4545
|
+
return formatOutput(paddedDay, paddedMonth, currentYear);
|
|
4546
|
+
}
|
|
4547
|
+
return null;
|
|
4548
|
+
}
|
|
4549
|
+
if (cleanInput.match(/^\d{4}$/)) {
|
|
4550
|
+
const num = parseInt(cleanInput, 10);
|
|
4551
|
+
if (num >= 2e3 && num <= maxYear) {
|
|
4552
|
+
if (isValidDate(currentDay, currentMonth, num.toString())) {
|
|
4553
|
+
return formatOutput(currentDay, currentMonth, num.toString());
|
|
4554
|
+
}
|
|
4555
|
+
return null;
|
|
4556
|
+
}
|
|
4557
|
+
const day = cleanInput.slice(0, 2);
|
|
4558
|
+
const month = cleanInput.slice(2, 4);
|
|
4559
|
+
if (isValidDate(day, month, currentYear)) {
|
|
4560
|
+
return formatOutput(day, month, currentYear);
|
|
4561
|
+
}
|
|
4562
|
+
return null;
|
|
4563
|
+
}
|
|
4564
|
+
if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
|
|
4565
|
+
const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
|
|
4566
|
+
let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
|
|
4567
|
+
if (isDateTime) {
|
|
4568
|
+
result = result.subtract(7, "hours");
|
|
4569
|
+
}
|
|
4570
|
+
if (result.isValid()) {
|
|
4571
|
+
return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
|
|
4572
|
+
}
|
|
4573
|
+
return null;
|
|
4574
|
+
}
|
|
4575
|
+
if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
|
|
4576
|
+
const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
|
|
4577
|
+
const day = parts[0].padStart(2, "0");
|
|
4578
|
+
const month = parts[1].padStart(2, "0");
|
|
4579
|
+
let year = parts[2];
|
|
4580
|
+
year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
|
|
4581
|
+
if (isValidDate(day, month, year)) {
|
|
4582
|
+
return formatOutput(day, month, year);
|
|
4583
|
+
}
|
|
4584
|
+
return null;
|
|
4585
|
+
}
|
|
4586
|
+
if (isDateTime) {
|
|
4587
|
+
if (cleanInput.length === 9) {
|
|
4588
|
+
const day = cleanInput.slice(0, 2);
|
|
4589
|
+
const month = cleanInput.slice(2, 4);
|
|
4590
|
+
const year = cleanInput.slice(4, 8);
|
|
4591
|
+
const hour = cleanInput.slice(8, 9).padStart(2, "0");
|
|
4592
|
+
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
4593
|
+
let result = (0, import_moment.default)(
|
|
4594
|
+
`${day}-${month}-${year} ${hour}:00:00`,
|
|
4595
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4596
|
+
);
|
|
4597
|
+
if (!result.isValid()) return null;
|
|
4598
|
+
result = result.subtract(7, "hours");
|
|
4599
|
+
return result.format(dateTimeFormat);
|
|
4600
|
+
}
|
|
4601
|
+
return null;
|
|
4602
|
+
}
|
|
4603
|
+
if (cleanInput.length === 10) {
|
|
4604
|
+
const day = cleanInput.slice(0, 2);
|
|
4605
|
+
const month = cleanInput.slice(2, 4);
|
|
4606
|
+
const year = cleanInput.slice(4, 8);
|
|
4607
|
+
const hour = cleanInput.slice(8, 10);
|
|
4608
|
+
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
4609
|
+
let result = (0, import_moment.default)(
|
|
4610
|
+
`${day}-${month}-${year} ${hour}:00:00`,
|
|
4611
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4612
|
+
);
|
|
4613
|
+
if (!result.isValid()) return null;
|
|
4614
|
+
result = result.subtract(7, "hours");
|
|
4615
|
+
return result.format(dateTimeFormat);
|
|
4616
|
+
}
|
|
4617
|
+
return null;
|
|
4618
|
+
}
|
|
4619
|
+
if (cleanInput.length === 11) {
|
|
4620
|
+
const day = cleanInput.slice(0, 2);
|
|
4621
|
+
const month = cleanInput.slice(2, 4);
|
|
4622
|
+
const year = cleanInput.slice(4, 8);
|
|
4623
|
+
const hour = cleanInput.slice(8, 10);
|
|
4624
|
+
const minute = cleanInput.slice(10, 11).padStart(2, "0");
|
|
4625
|
+
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
4626
|
+
let result = (0, import_moment.default)(
|
|
4627
|
+
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
4628
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4629
|
+
);
|
|
4630
|
+
if (!result.isValid()) return null;
|
|
4631
|
+
result = result.subtract(7, "hours");
|
|
4632
|
+
return result.format(dateTimeFormat);
|
|
4633
|
+
}
|
|
4634
|
+
return null;
|
|
4635
|
+
}
|
|
4636
|
+
if (cleanInput.length === 12) {
|
|
4637
|
+
const day = cleanInput.slice(0, 2);
|
|
4638
|
+
const month = cleanInput.slice(2, 4);
|
|
4639
|
+
const year = cleanInput.slice(4, 8);
|
|
4640
|
+
const hour = cleanInput.slice(8, 10);
|
|
4641
|
+
const minute = cleanInput.slice(10, 12);
|
|
4642
|
+
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
4643
|
+
let result = (0, import_moment.default)(
|
|
4644
|
+
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
4645
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4646
|
+
);
|
|
4647
|
+
if (!result.isValid()) return null;
|
|
4648
|
+
result = result.subtract(7, "hours");
|
|
4649
|
+
return result.format(dateTimeFormat);
|
|
4650
|
+
}
|
|
4651
|
+
return null;
|
|
4652
|
+
}
|
|
4653
|
+
if (cleanInput.length === 13) {
|
|
4654
|
+
const day = cleanInput.slice(0, 2);
|
|
4655
|
+
const month = cleanInput.slice(2, 4);
|
|
4656
|
+
const year = cleanInput.slice(4, 8);
|
|
4657
|
+
const hour = cleanInput.slice(8, 10);
|
|
4658
|
+
const minute = cleanInput.slice(10, 12);
|
|
4659
|
+
const second = cleanInput.slice(12, 13).padStart(2, "0");
|
|
4660
|
+
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
4661
|
+
let result = (0, import_moment.default)(
|
|
4662
|
+
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
4663
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4664
|
+
);
|
|
4665
|
+
if (!result.isValid()) return null;
|
|
4666
|
+
result = result.subtract(7, "hours");
|
|
4667
|
+
return result.format(dateTimeFormat);
|
|
4668
|
+
}
|
|
4669
|
+
return null;
|
|
4670
|
+
}
|
|
4671
|
+
if (cleanInput.length === 14) {
|
|
4672
|
+
const day = cleanInput.slice(0, 2);
|
|
4673
|
+
const month = cleanInput.slice(2, 4);
|
|
4674
|
+
const year = cleanInput.slice(4, 8);
|
|
4675
|
+
const hour = cleanInput.slice(8, 10);
|
|
4676
|
+
const minute = cleanInput.slice(10, 12);
|
|
4677
|
+
const second = cleanInput.slice(12, 14);
|
|
4678
|
+
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
4679
|
+
let result = (0, import_moment.default)(
|
|
4680
|
+
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
4681
|
+
"DD-MM-YYYY HH:mm:ss"
|
|
4682
|
+
);
|
|
4683
|
+
if (!result.isValid()) return null;
|
|
4684
|
+
result = result.subtract(7, "hours");
|
|
4685
|
+
return result.format(dateTimeFormat);
|
|
4686
|
+
}
|
|
4687
|
+
return null;
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
const len = cleanInput.length;
|
|
4691
|
+
if (len === 1 || len === 2) {
|
|
4692
|
+
const paddedDay = cleanInput.padStart(2, "0");
|
|
4693
|
+
if (isValidDate(paddedDay, currentMonth, currentYear)) {
|
|
4694
|
+
return formatOutput(paddedDay, currentMonth, currentYear);
|
|
4695
|
+
}
|
|
4696
|
+
return null;
|
|
4697
|
+
}
|
|
4698
|
+
if (len === 3) {
|
|
4699
|
+
const day = cleanInput.slice(0, 2);
|
|
4700
|
+
const month = cleanInput.slice(2, 3).padStart(2, "0");
|
|
4701
|
+
if (isValidDate(day, month, currentYear)) {
|
|
4702
|
+
return formatOutput(day, month, currentYear);
|
|
4703
|
+
}
|
|
4704
|
+
return null;
|
|
4705
|
+
}
|
|
4706
|
+
if (len === 6) {
|
|
4707
|
+
const day = cleanInput.slice(0, 2);
|
|
4708
|
+
const month = cleanInput.slice(2, 4);
|
|
4709
|
+
let year = cleanInput.slice(4, 6);
|
|
4710
|
+
year = `20${year}`;
|
|
4711
|
+
if (parseInt(month) > 12) {
|
|
4712
|
+
if (isValidDate(day, currentMonth, currentYear)) {
|
|
4713
|
+
return formatOutput(day, currentMonth, currentYear);
|
|
4714
|
+
}
|
|
4715
|
+
return null;
|
|
4716
|
+
}
|
|
4717
|
+
if (isValidDate(day, month, year)) {
|
|
4718
|
+
return formatOutput(day, month, year);
|
|
4719
|
+
}
|
|
4720
|
+
return null;
|
|
4721
|
+
}
|
|
4722
|
+
if (len === 7) {
|
|
4723
|
+
return null;
|
|
4724
|
+
}
|
|
4725
|
+
if (len === 8) {
|
|
4726
|
+
const day = cleanInput.slice(0, 2);
|
|
4727
|
+
const month = cleanInput.slice(2, 4);
|
|
4728
|
+
const year = cleanInput.slice(4, 8);
|
|
4729
|
+
if (isValidDate(day, month, year)) {
|
|
4730
|
+
return formatOutput(day, month, year);
|
|
4731
|
+
}
|
|
4732
|
+
return null;
|
|
4733
|
+
}
|
|
4734
|
+
if (len > 8 && !isDateTime) {
|
|
4735
|
+
return null;
|
|
4736
|
+
}
|
|
4737
|
+
return null;
|
|
4738
|
+
};
|
|
4739
|
+
var isObjectEmpty = (obj) => {
|
|
4740
|
+
return Object.keys(obj).length === 0;
|
|
4741
|
+
};
|
|
4742
|
+
var convertFloatToTime = (floatValue) => {
|
|
4743
|
+
const hours = Math.floor(floatValue);
|
|
4744
|
+
const minutes = Math.round((floatValue - hours) * 60);
|
|
4745
|
+
const formattedHours = String(hours).padStart(2, "0");
|
|
4746
|
+
const formattedMinutes = String(minutes).padStart(2, "0");
|
|
4747
|
+
return `${formattedHours}:${formattedMinutes}`;
|
|
4748
|
+
};
|
|
4749
|
+
var isBase64Image = (str) => {
|
|
4750
|
+
const base64Regex = /^data:image\/(png|jpeg|jpg|gif|webp);base64,/;
|
|
4751
|
+
if (!base64Regex.test(str)) {
|
|
4752
|
+
return false;
|
|
4753
|
+
}
|
|
4754
|
+
try {
|
|
4755
|
+
const base64Data = str.split(",")[1];
|
|
4756
|
+
return !!base64Data && atob(base64Data).length > 0;
|
|
4757
|
+
} catch (error) {
|
|
4758
|
+
return false;
|
|
4759
|
+
}
|
|
4760
|
+
};
|
|
4761
|
+
var checkIsImageLink = (url) => {
|
|
4762
|
+
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
4763
|
+
return imageExtensions.test(url) || isBase64Image(url);
|
|
4764
|
+
};
|
|
4765
|
+
var formatFileSize = (size) => {
|
|
4766
|
+
if (size < 1024) return `${size} B`;
|
|
4767
|
+
const i = Math.floor(Math.log(size) / Math.log(1024));
|
|
4768
|
+
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
|
4769
|
+
return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
|
|
4770
|
+
};
|
|
4771
|
+
|
|
4772
|
+
// src/utils/constants.ts
|
|
4773
|
+
var COLORS = [
|
|
4774
|
+
{
|
|
4775
|
+
name: "no_color",
|
|
4776
|
+
color: "RGBA(230.1375,221.3625,221.3625,1)",
|
|
4777
|
+
id: 0
|
|
4778
|
+
},
|
|
4779
|
+
{
|
|
4780
|
+
name: "red",
|
|
4781
|
+
color: "rgba(255,155.5,155.5,1)",
|
|
4782
|
+
id: 1
|
|
4783
|
+
},
|
|
4784
|
+
{
|
|
4785
|
+
name: "orange",
|
|
4786
|
+
color: "RGBA(247.0375,198.06116071,152.4625,1)",
|
|
4787
|
+
id: 2
|
|
4788
|
+
},
|
|
4789
|
+
{
|
|
4790
|
+
name: "yellow",
|
|
4791
|
+
color: "RGBA(252.88960843, 226.89175248, 135.61039157,1)",
|
|
4792
|
+
id: 3
|
|
4793
|
+
},
|
|
4794
|
+
{
|
|
4795
|
+
name: "cyan",
|
|
4796
|
+
color: "RGBA(187.45210396, 215.03675558, 248.04789604,1)",
|
|
4797
|
+
id: 4
|
|
4798
|
+
},
|
|
4799
|
+
{
|
|
4800
|
+
name: "purple",
|
|
4801
|
+
color: "RGBA(216.79194664, 167.70805336, 203.91748283,1)",
|
|
4802
|
+
id: 5
|
|
4803
|
+
},
|
|
4804
|
+
{
|
|
4805
|
+
name: "almond",
|
|
4806
|
+
color: "RGBA(247.84539474, 213.9484835, 199.65460526,1)",
|
|
4807
|
+
id: 6
|
|
4808
|
+
},
|
|
4809
|
+
{
|
|
4810
|
+
name: "teal",
|
|
4811
|
+
color: "RGBA(136.6125, 224.8875, 218.94591346,1)",
|
|
4812
|
+
id: 7
|
|
4813
|
+
},
|
|
4814
|
+
{
|
|
4815
|
+
name: "blue",
|
|
4816
|
+
color: "RGBA(150.60535714, 165.68382711, 248.89464286,1)",
|
|
4817
|
+
id: 8
|
|
4818
|
+
},
|
|
4819
|
+
{
|
|
4820
|
+
name: "raspberry",
|
|
4821
|
+
color: "RGBA(254.94583333, 157.55416667, 203.95543194,1)",
|
|
4822
|
+
id: 9
|
|
4823
|
+
},
|
|
4824
|
+
{
|
|
4825
|
+
name: "green",
|
|
4826
|
+
color: "RGBA(182.62075688, 236.87924312, 189.81831118,1)",
|
|
4827
|
+
id: 10
|
|
4828
|
+
},
|
|
4829
|
+
{
|
|
4830
|
+
name: "violet",
|
|
4831
|
+
color: "RGBA(230.11575613, 219.41069277, 252.08930723,1)",
|
|
4832
|
+
id: 11
|
|
4833
|
+
}
|
|
4834
|
+
];
|
|
4835
|
+
var DOTS = "...";
|
|
4836
|
+
var typeStyles = {
|
|
4837
|
+
primary: "bg-blue-500 text-white",
|
|
4838
|
+
secondary: "bg-lime-600 text-white",
|
|
4839
|
+
danger: "bg-[rgba(237,28,36,0.1)] text-[#F5222D]",
|
|
4840
|
+
info: "bg-[rgba(5,152,237,0.12)] text-[rgb(5,152,237)]",
|
|
4841
|
+
success: "bg-[rgba(46,181,83,0.1)] text-[rgb(46,181,83)]",
|
|
4842
|
+
warning: "bg-[rgba(237,166,28,0.1)] text-[rgb(250,140,22)]",
|
|
4843
|
+
default: "bg-[#dee2e6]",
|
|
4844
|
+
light: "bg-white text-gray-800 shadow-md"
|
|
4845
|
+
};
|
|
4846
|
+
var SearchType = {
|
|
4847
|
+
FILTER: "filter_by",
|
|
4848
|
+
SEARCH: "search_by",
|
|
4849
|
+
GROUP: "group_by"
|
|
4850
|
+
};
|
|
4851
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4852
|
+
0 && (module.exports = {
|
|
4853
|
+
COLORS,
|
|
4854
|
+
DOTS,
|
|
4855
|
+
SearchType,
|
|
4856
|
+
checkIsImageLink,
|
|
4857
|
+
convertFloatToTime,
|
|
4858
|
+
formatFileSize,
|
|
4859
|
+
formatNumberOnly,
|
|
4860
|
+
getPasswordMessage,
|
|
4861
|
+
isBase64Image,
|
|
4862
|
+
isObjectEmpty,
|
|
4863
|
+
parseFormattedNumber,
|
|
4864
|
+
range,
|
|
4865
|
+
typeStyles,
|
|
4866
|
+
useFormatDate,
|
|
4867
|
+
useFormatFloatNumber,
|
|
4868
|
+
validateAndParseDate,
|
|
4869
|
+
validateInput
|
|
4870
|
+
});
|
|
4871
|
+
/*! Bundled license information:
|
|
4872
|
+
|
|
4873
|
+
moment/moment.js:
|
|
4874
|
+
(*! moment.js *)
|
|
4875
|
+
(*! version : 2.30.1 *)
|
|
4876
|
+
(*! authors : Tim Wood, Iskren Chernev, Moment.js contributors *)
|
|
4877
|
+
(*! license : MIT *)
|
|
4878
|
+
(*! momentjs.com *)
|
|
4879
|
+
*/
|