@krainovsd/js-helpers 0.2.2
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 +23 -0
- package/lib/cjs/index.cjs +2914 -0
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/esm/index.js +2909 -0
- package/lib/esm/index.js.map +1 -0
- package/package.json +79 -0
- package/tmp/constants/api.d.ts +4 -0
- package/tmp/constants/colors.d.ts +6 -0
- package/tmp/constants/date.d.ts +8 -0
- package/tmp/constants/environment.d.ts +6 -0
- package/tmp/constants/fields.d.ts +8 -0
- package/tmp/constants/index.d.ts +5 -0
- package/tmp/index.d.ts +4 -0
- package/tmp/lib/api/core.d.ts +19 -0
- package/tmp/lib/api/index.d.ts +1 -0
- package/tmp/lib/api/middlewares/auth-middleware.d.ts +2 -0
- package/tmp/lib/api/middlewares/console-middleware.d.ts +2 -0
- package/tmp/lib/api/middlewares/index.d.ts +2 -0
- package/tmp/lib/api/token-request.d.ts +2 -0
- package/tmp/lib/browser/download-file.d.ts +7 -0
- package/tmp/lib/browser/download-json.d.ts +1 -0
- package/tmp/lib/browser/index.d.ts +3 -0
- package/tmp/lib/browser/read-file.d.ts +1 -0
- package/tmp/lib/colors/get-color-format.d.ts +1 -0
- package/tmp/lib/colors/index.d.ts +6 -0
- package/tmp/lib/colors/take-opacity-colors.d.ts +1 -0
- package/tmp/lib/colors/transform-hex-to-rgb.d.ts +1 -0
- package/tmp/lib/colors/transform-rgb-to-rgba.d.ts +1 -0
- package/tmp/lib/colors/transform-rgba-to-rgb.d.ts +1 -0
- package/tmp/lib/colors/transform-to-color.d.ts +2 -0
- package/tmp/lib/date/date-difference.d.ts +2 -0
- package/tmp/lib/date/date-format.d.ts +1 -0
- package/tmp/lib/date/get-date-by-rules.d.ts +2 -0
- package/tmp/lib/date/get-today.d.ts +4 -0
- package/tmp/lib/date/get-tomorrow.d.ts +1 -0
- package/tmp/lib/date/get-yesterday.d.ts +1 -0
- package/tmp/lib/date/index.d.ts +9 -0
- package/tmp/lib/date/is-today.d.ts +2 -0
- package/tmp/lib/date/is-tomorrow.d.ts +2 -0
- package/tmp/lib/date/is-yesterday.d.ts +2 -0
- package/tmp/lib/index.d.ts +5 -0
- package/tmp/lib/typings/check-type.d.ts +1 -0
- package/tmp/lib/typings/index.d.ts +11 -0
- package/tmp/lib/typings/is-array.d.ts +1 -0
- package/tmp/lib/typings/is-boolean.d.ts +1 -0
- package/tmp/lib/typings/is-date.d.ts +1 -0
- package/tmp/lib/typings/is-id.d.ts +1 -0
- package/tmp/lib/typings/is-null.d.ts +1 -0
- package/tmp/lib/typings/is-nullable.d.ts +1 -0
- package/tmp/lib/typings/is-number.d.ts +1 -0
- package/tmp/lib/typings/is-object.d.ts +1 -0
- package/tmp/lib/typings/is-string.d.ts +1 -0
- package/tmp/lib/typings/is-undefined.d.ts +1 -0
- package/tmp/lib/utils/array-to-map-by-key.d.ts +1 -0
- package/tmp/lib/utils/build-query-string.d.ts +2 -0
- package/tmp/lib/utils/create-url-with-params.d.ts +7 -0
- package/tmp/lib/utils/field-view-format.d.ts +2 -0
- package/tmp/lib/utils/get-by-path.d.ts +1 -0
- package/tmp/lib/utils/get-file-name-from-header.d.ts +1 -0
- package/tmp/lib/utils/index.d.ts +16 -0
- package/tmp/lib/utils/json-parse.d.ts +1 -0
- package/tmp/lib/utils/limit-stream-of-requests.d.ts +14 -0
- package/tmp/lib/utils/random-number.d.ts +1 -0
- package/tmp/lib/utils/random-string.d.ts +1 -0
- package/tmp/lib/utils/set-by-path.d.ts +1 -0
- package/tmp/lib/utils/sync-object-values.d.ts +1 -0
- package/tmp/lib/utils/transform-to-number.d.ts +1 -0
- package/tmp/lib/utils/trim-url.d.ts +1 -0
- package/tmp/lib/utils/wait-until.d.ts +1 -0
- package/tmp/lib/utils/wait.d.ts +1 -0
- package/tmp/libs.d.ts +2 -0
- package/tmp/types/api.d.ts +33 -0
- package/tmp/types/colors.d.ts +3 -0
- package/tmp/types/common.d.ts +2 -0
- package/tmp/types/date.d.ts +7 -0
- package/tmp/types/fields.d.ts +3 -0
- package/tmp/types/index.d.ts +5 -0
|
@@ -0,0 +1,2914 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const DATE_TYPES = {
|
|
6
|
+
Days: "days",
|
|
7
|
+
Months: "months",
|
|
8
|
+
Years: "years",
|
|
9
|
+
Seconds: "seconds",
|
|
10
|
+
Minutes: "minutes",
|
|
11
|
+
Hours: "hours",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const API_MIDDLEWARES = {
|
|
15
|
+
Auth: "auth",
|
|
16
|
+
Logger: "logger",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/* eslint-disable no-restricted-globals */
|
|
20
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
21
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
22
|
+
const IS_JEST = typeof process != "undefined" && process.env.JEST_WORKER_ID !== undefined;
|
|
23
|
+
const IS_BUN = typeof process !== "undefined" && process.versions != null && process.versions.bun != null;
|
|
24
|
+
const IS_DENO = // @ts-expect-error
|
|
25
|
+
typeof Deno !== "undefined" &&
|
|
26
|
+
// @ts-expect-error
|
|
27
|
+
typeof Deno.version !== "undefined" &&
|
|
28
|
+
// @ts-expect-error
|
|
29
|
+
typeof Deno.version.deno !== "undefined";
|
|
30
|
+
const IS_NODE = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
31
|
+
const IS_WEB_WORKER = typeof self === "object" &&
|
|
32
|
+
self.constructor &&
|
|
33
|
+
self.constructor.name === "DedicatedWorkerGlobalScope";
|
|
34
|
+
const IS_BROWSER = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
35
|
+
|
|
36
|
+
const COLOR_FORMATS = {
|
|
37
|
+
Hex: "HEX",
|
|
38
|
+
Rgb: "RGB",
|
|
39
|
+
Rgba: "RGBA",
|
|
40
|
+
Hsl: "HSL",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const FIELD_TYPES = {
|
|
44
|
+
Date: "date",
|
|
45
|
+
Time: "time",
|
|
46
|
+
DateTime: "dateTime",
|
|
47
|
+
String: "string",
|
|
48
|
+
Number: "number",
|
|
49
|
+
Array: "array",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const index$6 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
53
|
+
__proto__: null,
|
|
54
|
+
API_MIDDLEWARES,
|
|
55
|
+
COLOR_FORMATS,
|
|
56
|
+
DATE_TYPES,
|
|
57
|
+
FIELD_TYPES,
|
|
58
|
+
IS_BROWSER,
|
|
59
|
+
IS_BUN,
|
|
60
|
+
IS_DENO,
|
|
61
|
+
IS_JEST,
|
|
62
|
+
IS_NODE,
|
|
63
|
+
IS_WEB_WORKER
|
|
64
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
65
|
+
|
|
66
|
+
const waitUntil = (condition, checkInterval = 100) => {
|
|
67
|
+
return new Promise((resolve) => {
|
|
68
|
+
const interval = setInterval(() => {
|
|
69
|
+
if (condition())
|
|
70
|
+
return;
|
|
71
|
+
clearInterval(interval);
|
|
72
|
+
resolve(true);
|
|
73
|
+
}, checkInterval);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
78
|
+
|
|
79
|
+
function getDefaultExportFromCjs (x) {
|
|
80
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Checks if `value` is classified as an `Array` object.
|
|
85
|
+
*
|
|
86
|
+
* @static
|
|
87
|
+
* @memberOf _
|
|
88
|
+
* @since 0.1.0
|
|
89
|
+
* @category Lang
|
|
90
|
+
* @param {*} value The value to check.
|
|
91
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
92
|
+
* @example
|
|
93
|
+
*
|
|
94
|
+
* _.isArray([1, 2, 3]);
|
|
95
|
+
* // => true
|
|
96
|
+
*
|
|
97
|
+
* _.isArray(document.body.children);
|
|
98
|
+
* // => false
|
|
99
|
+
*
|
|
100
|
+
* _.isArray('abc');
|
|
101
|
+
* // => false
|
|
102
|
+
*
|
|
103
|
+
* _.isArray(_.noop);
|
|
104
|
+
* // => false
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
var isArray_1;
|
|
108
|
+
var hasRequiredIsArray;
|
|
109
|
+
|
|
110
|
+
function requireIsArray () {
|
|
111
|
+
if (hasRequiredIsArray) return isArray_1;
|
|
112
|
+
hasRequiredIsArray = 1;
|
|
113
|
+
var isArray = Array.isArray;
|
|
114
|
+
|
|
115
|
+
isArray_1 = isArray;
|
|
116
|
+
return isArray_1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Detect free variable `global` from Node.js. */
|
|
120
|
+
|
|
121
|
+
var _freeGlobal;
|
|
122
|
+
var hasRequired_freeGlobal;
|
|
123
|
+
|
|
124
|
+
function require_freeGlobal () {
|
|
125
|
+
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
126
|
+
hasRequired_freeGlobal = 1;
|
|
127
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
128
|
+
|
|
129
|
+
_freeGlobal = freeGlobal;
|
|
130
|
+
return _freeGlobal;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var _root;
|
|
134
|
+
var hasRequired_root;
|
|
135
|
+
|
|
136
|
+
function require_root () {
|
|
137
|
+
if (hasRequired_root) return _root;
|
|
138
|
+
hasRequired_root = 1;
|
|
139
|
+
var freeGlobal = require_freeGlobal();
|
|
140
|
+
|
|
141
|
+
/** Detect free variable `self`. */
|
|
142
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
143
|
+
|
|
144
|
+
/** Used as a reference to the global object. */
|
|
145
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
146
|
+
|
|
147
|
+
_root = root;
|
|
148
|
+
return _root;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
var _Symbol;
|
|
152
|
+
var hasRequired_Symbol;
|
|
153
|
+
|
|
154
|
+
function require_Symbol () {
|
|
155
|
+
if (hasRequired_Symbol) return _Symbol;
|
|
156
|
+
hasRequired_Symbol = 1;
|
|
157
|
+
var root = require_root();
|
|
158
|
+
|
|
159
|
+
/** Built-in value references. */
|
|
160
|
+
var Symbol = root.Symbol;
|
|
161
|
+
|
|
162
|
+
_Symbol = Symbol;
|
|
163
|
+
return _Symbol;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var _getRawTag;
|
|
167
|
+
var hasRequired_getRawTag;
|
|
168
|
+
|
|
169
|
+
function require_getRawTag () {
|
|
170
|
+
if (hasRequired_getRawTag) return _getRawTag;
|
|
171
|
+
hasRequired_getRawTag = 1;
|
|
172
|
+
var Symbol = require_Symbol();
|
|
173
|
+
|
|
174
|
+
/** Used for built-in method references. */
|
|
175
|
+
var objectProto = Object.prototype;
|
|
176
|
+
|
|
177
|
+
/** Used to check objects for own properties. */
|
|
178
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Used to resolve the
|
|
182
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
183
|
+
* of values.
|
|
184
|
+
*/
|
|
185
|
+
var nativeObjectToString = objectProto.toString;
|
|
186
|
+
|
|
187
|
+
/** Built-in value references. */
|
|
188
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
192
|
+
*
|
|
193
|
+
* @private
|
|
194
|
+
* @param {*} value The value to query.
|
|
195
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
196
|
+
*/
|
|
197
|
+
function getRawTag(value) {
|
|
198
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
199
|
+
tag = value[symToStringTag];
|
|
200
|
+
|
|
201
|
+
try {
|
|
202
|
+
value[symToStringTag] = undefined;
|
|
203
|
+
var unmasked = true;
|
|
204
|
+
} catch (e) {}
|
|
205
|
+
|
|
206
|
+
var result = nativeObjectToString.call(value);
|
|
207
|
+
if (unmasked) {
|
|
208
|
+
if (isOwn) {
|
|
209
|
+
value[symToStringTag] = tag;
|
|
210
|
+
} else {
|
|
211
|
+
delete value[symToStringTag];
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
_getRawTag = getRawTag;
|
|
218
|
+
return _getRawTag;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** Used for built-in method references. */
|
|
222
|
+
|
|
223
|
+
var _objectToString;
|
|
224
|
+
var hasRequired_objectToString;
|
|
225
|
+
|
|
226
|
+
function require_objectToString () {
|
|
227
|
+
if (hasRequired_objectToString) return _objectToString;
|
|
228
|
+
hasRequired_objectToString = 1;
|
|
229
|
+
var objectProto = Object.prototype;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Used to resolve the
|
|
233
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
234
|
+
* of values.
|
|
235
|
+
*/
|
|
236
|
+
var nativeObjectToString = objectProto.toString;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
240
|
+
*
|
|
241
|
+
* @private
|
|
242
|
+
* @param {*} value The value to convert.
|
|
243
|
+
* @returns {string} Returns the converted string.
|
|
244
|
+
*/
|
|
245
|
+
function objectToString(value) {
|
|
246
|
+
return nativeObjectToString.call(value);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
_objectToString = objectToString;
|
|
250
|
+
return _objectToString;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var _baseGetTag;
|
|
254
|
+
var hasRequired_baseGetTag;
|
|
255
|
+
|
|
256
|
+
function require_baseGetTag () {
|
|
257
|
+
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
258
|
+
hasRequired_baseGetTag = 1;
|
|
259
|
+
var Symbol = require_Symbol(),
|
|
260
|
+
getRawTag = require_getRawTag(),
|
|
261
|
+
objectToString = require_objectToString();
|
|
262
|
+
|
|
263
|
+
/** `Object#toString` result references. */
|
|
264
|
+
var nullTag = '[object Null]',
|
|
265
|
+
undefinedTag = '[object Undefined]';
|
|
266
|
+
|
|
267
|
+
/** Built-in value references. */
|
|
268
|
+
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
272
|
+
*
|
|
273
|
+
* @private
|
|
274
|
+
* @param {*} value The value to query.
|
|
275
|
+
* @returns {string} Returns the `toStringTag`.
|
|
276
|
+
*/
|
|
277
|
+
function baseGetTag(value) {
|
|
278
|
+
if (value == null) {
|
|
279
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
280
|
+
}
|
|
281
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
282
|
+
? getRawTag(value)
|
|
283
|
+
: objectToString(value);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
_baseGetTag = baseGetTag;
|
|
287
|
+
return _baseGetTag;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
292
|
+
* and has a `typeof` result of "object".
|
|
293
|
+
*
|
|
294
|
+
* @static
|
|
295
|
+
* @memberOf _
|
|
296
|
+
* @since 4.0.0
|
|
297
|
+
* @category Lang
|
|
298
|
+
* @param {*} value The value to check.
|
|
299
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
300
|
+
* @example
|
|
301
|
+
*
|
|
302
|
+
* _.isObjectLike({});
|
|
303
|
+
* // => true
|
|
304
|
+
*
|
|
305
|
+
* _.isObjectLike([1, 2, 3]);
|
|
306
|
+
* // => true
|
|
307
|
+
*
|
|
308
|
+
* _.isObjectLike(_.noop);
|
|
309
|
+
* // => false
|
|
310
|
+
*
|
|
311
|
+
* _.isObjectLike(null);
|
|
312
|
+
* // => false
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
var isObjectLike_1;
|
|
316
|
+
var hasRequiredIsObjectLike;
|
|
317
|
+
|
|
318
|
+
function requireIsObjectLike () {
|
|
319
|
+
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
320
|
+
hasRequiredIsObjectLike = 1;
|
|
321
|
+
function isObjectLike(value) {
|
|
322
|
+
return value != null && typeof value == 'object';
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
isObjectLike_1 = isObjectLike;
|
|
326
|
+
return isObjectLike_1;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
var isSymbol_1;
|
|
330
|
+
var hasRequiredIsSymbol;
|
|
331
|
+
|
|
332
|
+
function requireIsSymbol () {
|
|
333
|
+
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
334
|
+
hasRequiredIsSymbol = 1;
|
|
335
|
+
var baseGetTag = require_baseGetTag(),
|
|
336
|
+
isObjectLike = requireIsObjectLike();
|
|
337
|
+
|
|
338
|
+
/** `Object#toString` result references. */
|
|
339
|
+
var symbolTag = '[object Symbol]';
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
343
|
+
*
|
|
344
|
+
* @static
|
|
345
|
+
* @memberOf _
|
|
346
|
+
* @since 4.0.0
|
|
347
|
+
* @category Lang
|
|
348
|
+
* @param {*} value The value to check.
|
|
349
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
350
|
+
* @example
|
|
351
|
+
*
|
|
352
|
+
* _.isSymbol(Symbol.iterator);
|
|
353
|
+
* // => true
|
|
354
|
+
*
|
|
355
|
+
* _.isSymbol('abc');
|
|
356
|
+
* // => false
|
|
357
|
+
*/
|
|
358
|
+
function isSymbol(value) {
|
|
359
|
+
return typeof value == 'symbol' ||
|
|
360
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
isSymbol_1 = isSymbol;
|
|
364
|
+
return isSymbol_1;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
var _isKey;
|
|
368
|
+
var hasRequired_isKey;
|
|
369
|
+
|
|
370
|
+
function require_isKey () {
|
|
371
|
+
if (hasRequired_isKey) return _isKey;
|
|
372
|
+
hasRequired_isKey = 1;
|
|
373
|
+
var isArray = requireIsArray(),
|
|
374
|
+
isSymbol = requireIsSymbol();
|
|
375
|
+
|
|
376
|
+
/** Used to match property names within property paths. */
|
|
377
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
378
|
+
reIsPlainProp = /^\w*$/;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Checks if `value` is a property name and not a property path.
|
|
382
|
+
*
|
|
383
|
+
* @private
|
|
384
|
+
* @param {*} value The value to check.
|
|
385
|
+
* @param {Object} [object] The object to query keys on.
|
|
386
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
387
|
+
*/
|
|
388
|
+
function isKey(value, object) {
|
|
389
|
+
if (isArray(value)) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
var type = typeof value;
|
|
393
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
394
|
+
value == null || isSymbol(value)) {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
398
|
+
(object != null && value in Object(object));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
_isKey = isKey;
|
|
402
|
+
return _isKey;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Checks if `value` is the
|
|
407
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
408
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
409
|
+
*
|
|
410
|
+
* @static
|
|
411
|
+
* @memberOf _
|
|
412
|
+
* @since 0.1.0
|
|
413
|
+
* @category Lang
|
|
414
|
+
* @param {*} value The value to check.
|
|
415
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
416
|
+
* @example
|
|
417
|
+
*
|
|
418
|
+
* _.isObject({});
|
|
419
|
+
* // => true
|
|
420
|
+
*
|
|
421
|
+
* _.isObject([1, 2, 3]);
|
|
422
|
+
* // => true
|
|
423
|
+
*
|
|
424
|
+
* _.isObject(_.noop);
|
|
425
|
+
* // => true
|
|
426
|
+
*
|
|
427
|
+
* _.isObject(null);
|
|
428
|
+
* // => false
|
|
429
|
+
*/
|
|
430
|
+
|
|
431
|
+
var isObject_1;
|
|
432
|
+
var hasRequiredIsObject;
|
|
433
|
+
|
|
434
|
+
function requireIsObject () {
|
|
435
|
+
if (hasRequiredIsObject) return isObject_1;
|
|
436
|
+
hasRequiredIsObject = 1;
|
|
437
|
+
function isObject(value) {
|
|
438
|
+
var type = typeof value;
|
|
439
|
+
return value != null && (type == 'object' || type == 'function');
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
isObject_1 = isObject;
|
|
443
|
+
return isObject_1;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
var isFunction_1;
|
|
447
|
+
var hasRequiredIsFunction;
|
|
448
|
+
|
|
449
|
+
function requireIsFunction () {
|
|
450
|
+
if (hasRequiredIsFunction) return isFunction_1;
|
|
451
|
+
hasRequiredIsFunction = 1;
|
|
452
|
+
var baseGetTag = require_baseGetTag(),
|
|
453
|
+
isObject = requireIsObject();
|
|
454
|
+
|
|
455
|
+
/** `Object#toString` result references. */
|
|
456
|
+
var asyncTag = '[object AsyncFunction]',
|
|
457
|
+
funcTag = '[object Function]',
|
|
458
|
+
genTag = '[object GeneratorFunction]',
|
|
459
|
+
proxyTag = '[object Proxy]';
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Checks if `value` is classified as a `Function` object.
|
|
463
|
+
*
|
|
464
|
+
* @static
|
|
465
|
+
* @memberOf _
|
|
466
|
+
* @since 0.1.0
|
|
467
|
+
* @category Lang
|
|
468
|
+
* @param {*} value The value to check.
|
|
469
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
470
|
+
* @example
|
|
471
|
+
*
|
|
472
|
+
* _.isFunction(_);
|
|
473
|
+
* // => true
|
|
474
|
+
*
|
|
475
|
+
* _.isFunction(/abc/);
|
|
476
|
+
* // => false
|
|
477
|
+
*/
|
|
478
|
+
function isFunction(value) {
|
|
479
|
+
if (!isObject(value)) {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
483
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
484
|
+
var tag = baseGetTag(value);
|
|
485
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
isFunction_1 = isFunction;
|
|
489
|
+
return isFunction_1;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
var _coreJsData;
|
|
493
|
+
var hasRequired_coreJsData;
|
|
494
|
+
|
|
495
|
+
function require_coreJsData () {
|
|
496
|
+
if (hasRequired_coreJsData) return _coreJsData;
|
|
497
|
+
hasRequired_coreJsData = 1;
|
|
498
|
+
var root = require_root();
|
|
499
|
+
|
|
500
|
+
/** Used to detect overreaching core-js shims. */
|
|
501
|
+
var coreJsData = root['__core-js_shared__'];
|
|
502
|
+
|
|
503
|
+
_coreJsData = coreJsData;
|
|
504
|
+
return _coreJsData;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
var _isMasked;
|
|
508
|
+
var hasRequired_isMasked;
|
|
509
|
+
|
|
510
|
+
function require_isMasked () {
|
|
511
|
+
if (hasRequired_isMasked) return _isMasked;
|
|
512
|
+
hasRequired_isMasked = 1;
|
|
513
|
+
var coreJsData = require_coreJsData();
|
|
514
|
+
|
|
515
|
+
/** Used to detect methods masquerading as native. */
|
|
516
|
+
var maskSrcKey = (function() {
|
|
517
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
518
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
519
|
+
}());
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Checks if `func` has its source masked.
|
|
523
|
+
*
|
|
524
|
+
* @private
|
|
525
|
+
* @param {Function} func The function to check.
|
|
526
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
527
|
+
*/
|
|
528
|
+
function isMasked(func) {
|
|
529
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
_isMasked = isMasked;
|
|
533
|
+
return _isMasked;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Used for built-in method references. */
|
|
537
|
+
|
|
538
|
+
var _toSource;
|
|
539
|
+
var hasRequired_toSource;
|
|
540
|
+
|
|
541
|
+
function require_toSource () {
|
|
542
|
+
if (hasRequired_toSource) return _toSource;
|
|
543
|
+
hasRequired_toSource = 1;
|
|
544
|
+
var funcProto = Function.prototype;
|
|
545
|
+
|
|
546
|
+
/** Used to resolve the decompiled source of functions. */
|
|
547
|
+
var funcToString = funcProto.toString;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Converts `func` to its source code.
|
|
551
|
+
*
|
|
552
|
+
* @private
|
|
553
|
+
* @param {Function} func The function to convert.
|
|
554
|
+
* @returns {string} Returns the source code.
|
|
555
|
+
*/
|
|
556
|
+
function toSource(func) {
|
|
557
|
+
if (func != null) {
|
|
558
|
+
try {
|
|
559
|
+
return funcToString.call(func);
|
|
560
|
+
} catch (e) {}
|
|
561
|
+
try {
|
|
562
|
+
return (func + '');
|
|
563
|
+
} catch (e) {}
|
|
564
|
+
}
|
|
565
|
+
return '';
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
_toSource = toSource;
|
|
569
|
+
return _toSource;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
var _baseIsNative;
|
|
573
|
+
var hasRequired_baseIsNative;
|
|
574
|
+
|
|
575
|
+
function require_baseIsNative () {
|
|
576
|
+
if (hasRequired_baseIsNative) return _baseIsNative;
|
|
577
|
+
hasRequired_baseIsNative = 1;
|
|
578
|
+
var isFunction = requireIsFunction(),
|
|
579
|
+
isMasked = require_isMasked(),
|
|
580
|
+
isObject = requireIsObject(),
|
|
581
|
+
toSource = require_toSource();
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Used to match `RegExp`
|
|
585
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
586
|
+
*/
|
|
587
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
588
|
+
|
|
589
|
+
/** Used to detect host constructors (Safari). */
|
|
590
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
591
|
+
|
|
592
|
+
/** Used for built-in method references. */
|
|
593
|
+
var funcProto = Function.prototype,
|
|
594
|
+
objectProto = Object.prototype;
|
|
595
|
+
|
|
596
|
+
/** Used to resolve the decompiled source of functions. */
|
|
597
|
+
var funcToString = funcProto.toString;
|
|
598
|
+
|
|
599
|
+
/** Used to check objects for own properties. */
|
|
600
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
601
|
+
|
|
602
|
+
/** Used to detect if a method is native. */
|
|
603
|
+
var reIsNative = RegExp('^' +
|
|
604
|
+
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
605
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
606
|
+
);
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
610
|
+
*
|
|
611
|
+
* @private
|
|
612
|
+
* @param {*} value The value to check.
|
|
613
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
614
|
+
* else `false`.
|
|
615
|
+
*/
|
|
616
|
+
function baseIsNative(value) {
|
|
617
|
+
if (!isObject(value) || isMasked(value)) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
621
|
+
return pattern.test(toSource(value));
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
_baseIsNative = baseIsNative;
|
|
625
|
+
return _baseIsNative;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Gets the value at `key` of `object`.
|
|
630
|
+
*
|
|
631
|
+
* @private
|
|
632
|
+
* @param {Object} [object] The object to query.
|
|
633
|
+
* @param {string} key The key of the property to get.
|
|
634
|
+
* @returns {*} Returns the property value.
|
|
635
|
+
*/
|
|
636
|
+
|
|
637
|
+
var _getValue;
|
|
638
|
+
var hasRequired_getValue;
|
|
639
|
+
|
|
640
|
+
function require_getValue () {
|
|
641
|
+
if (hasRequired_getValue) return _getValue;
|
|
642
|
+
hasRequired_getValue = 1;
|
|
643
|
+
function getValue(object, key) {
|
|
644
|
+
return object == null ? undefined : object[key];
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
_getValue = getValue;
|
|
648
|
+
return _getValue;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
var _getNative;
|
|
652
|
+
var hasRequired_getNative;
|
|
653
|
+
|
|
654
|
+
function require_getNative () {
|
|
655
|
+
if (hasRequired_getNative) return _getNative;
|
|
656
|
+
hasRequired_getNative = 1;
|
|
657
|
+
var baseIsNative = require_baseIsNative(),
|
|
658
|
+
getValue = require_getValue();
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Gets the native function at `key` of `object`.
|
|
662
|
+
*
|
|
663
|
+
* @private
|
|
664
|
+
* @param {Object} object The object to query.
|
|
665
|
+
* @param {string} key The key of the method to get.
|
|
666
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
667
|
+
*/
|
|
668
|
+
function getNative(object, key) {
|
|
669
|
+
var value = getValue(object, key);
|
|
670
|
+
return baseIsNative(value) ? value : undefined;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
_getNative = getNative;
|
|
674
|
+
return _getNative;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
var _nativeCreate;
|
|
678
|
+
var hasRequired_nativeCreate;
|
|
679
|
+
|
|
680
|
+
function require_nativeCreate () {
|
|
681
|
+
if (hasRequired_nativeCreate) return _nativeCreate;
|
|
682
|
+
hasRequired_nativeCreate = 1;
|
|
683
|
+
var getNative = require_getNative();
|
|
684
|
+
|
|
685
|
+
/* Built-in method references that are verified to be native. */
|
|
686
|
+
var nativeCreate = getNative(Object, 'create');
|
|
687
|
+
|
|
688
|
+
_nativeCreate = nativeCreate;
|
|
689
|
+
return _nativeCreate;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
var _hashClear;
|
|
693
|
+
var hasRequired_hashClear;
|
|
694
|
+
|
|
695
|
+
function require_hashClear () {
|
|
696
|
+
if (hasRequired_hashClear) return _hashClear;
|
|
697
|
+
hasRequired_hashClear = 1;
|
|
698
|
+
var nativeCreate = require_nativeCreate();
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Removes all key-value entries from the hash.
|
|
702
|
+
*
|
|
703
|
+
* @private
|
|
704
|
+
* @name clear
|
|
705
|
+
* @memberOf Hash
|
|
706
|
+
*/
|
|
707
|
+
function hashClear() {
|
|
708
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
709
|
+
this.size = 0;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
_hashClear = hashClear;
|
|
713
|
+
return _hashClear;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Removes `key` and its value from the hash.
|
|
718
|
+
*
|
|
719
|
+
* @private
|
|
720
|
+
* @name delete
|
|
721
|
+
* @memberOf Hash
|
|
722
|
+
* @param {Object} hash The hash to modify.
|
|
723
|
+
* @param {string} key The key of the value to remove.
|
|
724
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
725
|
+
*/
|
|
726
|
+
|
|
727
|
+
var _hashDelete;
|
|
728
|
+
var hasRequired_hashDelete;
|
|
729
|
+
|
|
730
|
+
function require_hashDelete () {
|
|
731
|
+
if (hasRequired_hashDelete) return _hashDelete;
|
|
732
|
+
hasRequired_hashDelete = 1;
|
|
733
|
+
function hashDelete(key) {
|
|
734
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
735
|
+
this.size -= result ? 1 : 0;
|
|
736
|
+
return result;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
_hashDelete = hashDelete;
|
|
740
|
+
return _hashDelete;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
var _hashGet;
|
|
744
|
+
var hasRequired_hashGet;
|
|
745
|
+
|
|
746
|
+
function require_hashGet () {
|
|
747
|
+
if (hasRequired_hashGet) return _hashGet;
|
|
748
|
+
hasRequired_hashGet = 1;
|
|
749
|
+
var nativeCreate = require_nativeCreate();
|
|
750
|
+
|
|
751
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
752
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
753
|
+
|
|
754
|
+
/** Used for built-in method references. */
|
|
755
|
+
var objectProto = Object.prototype;
|
|
756
|
+
|
|
757
|
+
/** Used to check objects for own properties. */
|
|
758
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Gets the hash value for `key`.
|
|
762
|
+
*
|
|
763
|
+
* @private
|
|
764
|
+
* @name get
|
|
765
|
+
* @memberOf Hash
|
|
766
|
+
* @param {string} key The key of the value to get.
|
|
767
|
+
* @returns {*} Returns the entry value.
|
|
768
|
+
*/
|
|
769
|
+
function hashGet(key) {
|
|
770
|
+
var data = this.__data__;
|
|
771
|
+
if (nativeCreate) {
|
|
772
|
+
var result = data[key];
|
|
773
|
+
return result === HASH_UNDEFINED ? undefined : result;
|
|
774
|
+
}
|
|
775
|
+
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
_hashGet = hashGet;
|
|
779
|
+
return _hashGet;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
var _hashHas;
|
|
783
|
+
var hasRequired_hashHas;
|
|
784
|
+
|
|
785
|
+
function require_hashHas () {
|
|
786
|
+
if (hasRequired_hashHas) return _hashHas;
|
|
787
|
+
hasRequired_hashHas = 1;
|
|
788
|
+
var nativeCreate = require_nativeCreate();
|
|
789
|
+
|
|
790
|
+
/** Used for built-in method references. */
|
|
791
|
+
var objectProto = Object.prototype;
|
|
792
|
+
|
|
793
|
+
/** Used to check objects for own properties. */
|
|
794
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Checks if a hash value for `key` exists.
|
|
798
|
+
*
|
|
799
|
+
* @private
|
|
800
|
+
* @name has
|
|
801
|
+
* @memberOf Hash
|
|
802
|
+
* @param {string} key The key of the entry to check.
|
|
803
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
804
|
+
*/
|
|
805
|
+
function hashHas(key) {
|
|
806
|
+
var data = this.__data__;
|
|
807
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
_hashHas = hashHas;
|
|
811
|
+
return _hashHas;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
var _hashSet;
|
|
815
|
+
var hasRequired_hashSet;
|
|
816
|
+
|
|
817
|
+
function require_hashSet () {
|
|
818
|
+
if (hasRequired_hashSet) return _hashSet;
|
|
819
|
+
hasRequired_hashSet = 1;
|
|
820
|
+
var nativeCreate = require_nativeCreate();
|
|
821
|
+
|
|
822
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
823
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Sets the hash `key` to `value`.
|
|
827
|
+
*
|
|
828
|
+
* @private
|
|
829
|
+
* @name set
|
|
830
|
+
* @memberOf Hash
|
|
831
|
+
* @param {string} key The key of the value to set.
|
|
832
|
+
* @param {*} value The value to set.
|
|
833
|
+
* @returns {Object} Returns the hash instance.
|
|
834
|
+
*/
|
|
835
|
+
function hashSet(key, value) {
|
|
836
|
+
var data = this.__data__;
|
|
837
|
+
this.size += this.has(key) ? 0 : 1;
|
|
838
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
839
|
+
return this;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
_hashSet = hashSet;
|
|
843
|
+
return _hashSet;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
var _Hash;
|
|
847
|
+
var hasRequired_Hash;
|
|
848
|
+
|
|
849
|
+
function require_Hash () {
|
|
850
|
+
if (hasRequired_Hash) return _Hash;
|
|
851
|
+
hasRequired_Hash = 1;
|
|
852
|
+
var hashClear = require_hashClear(),
|
|
853
|
+
hashDelete = require_hashDelete(),
|
|
854
|
+
hashGet = require_hashGet(),
|
|
855
|
+
hashHas = require_hashHas(),
|
|
856
|
+
hashSet = require_hashSet();
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* Creates a hash object.
|
|
860
|
+
*
|
|
861
|
+
* @private
|
|
862
|
+
* @constructor
|
|
863
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
864
|
+
*/
|
|
865
|
+
function Hash(entries) {
|
|
866
|
+
var index = -1,
|
|
867
|
+
length = entries == null ? 0 : entries.length;
|
|
868
|
+
|
|
869
|
+
this.clear();
|
|
870
|
+
while (++index < length) {
|
|
871
|
+
var entry = entries[index];
|
|
872
|
+
this.set(entry[0], entry[1]);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// Add methods to `Hash`.
|
|
877
|
+
Hash.prototype.clear = hashClear;
|
|
878
|
+
Hash.prototype['delete'] = hashDelete;
|
|
879
|
+
Hash.prototype.get = hashGet;
|
|
880
|
+
Hash.prototype.has = hashHas;
|
|
881
|
+
Hash.prototype.set = hashSet;
|
|
882
|
+
|
|
883
|
+
_Hash = Hash;
|
|
884
|
+
return _Hash;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Removes all key-value entries from the list cache.
|
|
889
|
+
*
|
|
890
|
+
* @private
|
|
891
|
+
* @name clear
|
|
892
|
+
* @memberOf ListCache
|
|
893
|
+
*/
|
|
894
|
+
|
|
895
|
+
var _listCacheClear;
|
|
896
|
+
var hasRequired_listCacheClear;
|
|
897
|
+
|
|
898
|
+
function require_listCacheClear () {
|
|
899
|
+
if (hasRequired_listCacheClear) return _listCacheClear;
|
|
900
|
+
hasRequired_listCacheClear = 1;
|
|
901
|
+
function listCacheClear() {
|
|
902
|
+
this.__data__ = [];
|
|
903
|
+
this.size = 0;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
_listCacheClear = listCacheClear;
|
|
907
|
+
return _listCacheClear;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Performs a
|
|
912
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
913
|
+
* comparison between two values to determine if they are equivalent.
|
|
914
|
+
*
|
|
915
|
+
* @static
|
|
916
|
+
* @memberOf _
|
|
917
|
+
* @since 4.0.0
|
|
918
|
+
* @category Lang
|
|
919
|
+
* @param {*} value The value to compare.
|
|
920
|
+
* @param {*} other The other value to compare.
|
|
921
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
922
|
+
* @example
|
|
923
|
+
*
|
|
924
|
+
* var object = { 'a': 1 };
|
|
925
|
+
* var other = { 'a': 1 };
|
|
926
|
+
*
|
|
927
|
+
* _.eq(object, object);
|
|
928
|
+
* // => true
|
|
929
|
+
*
|
|
930
|
+
* _.eq(object, other);
|
|
931
|
+
* // => false
|
|
932
|
+
*
|
|
933
|
+
* _.eq('a', 'a');
|
|
934
|
+
* // => true
|
|
935
|
+
*
|
|
936
|
+
* _.eq('a', Object('a'));
|
|
937
|
+
* // => false
|
|
938
|
+
*
|
|
939
|
+
* _.eq(NaN, NaN);
|
|
940
|
+
* // => true
|
|
941
|
+
*/
|
|
942
|
+
|
|
943
|
+
var eq_1;
|
|
944
|
+
var hasRequiredEq;
|
|
945
|
+
|
|
946
|
+
function requireEq () {
|
|
947
|
+
if (hasRequiredEq) return eq_1;
|
|
948
|
+
hasRequiredEq = 1;
|
|
949
|
+
function eq(value, other) {
|
|
950
|
+
return value === other || (value !== value && other !== other);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
eq_1 = eq;
|
|
954
|
+
return eq_1;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
var _assocIndexOf;
|
|
958
|
+
var hasRequired_assocIndexOf;
|
|
959
|
+
|
|
960
|
+
function require_assocIndexOf () {
|
|
961
|
+
if (hasRequired_assocIndexOf) return _assocIndexOf;
|
|
962
|
+
hasRequired_assocIndexOf = 1;
|
|
963
|
+
var eq = requireEq();
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
967
|
+
*
|
|
968
|
+
* @private
|
|
969
|
+
* @param {Array} array The array to inspect.
|
|
970
|
+
* @param {*} key The key to search for.
|
|
971
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
972
|
+
*/
|
|
973
|
+
function assocIndexOf(array, key) {
|
|
974
|
+
var length = array.length;
|
|
975
|
+
while (length--) {
|
|
976
|
+
if (eq(array[length][0], key)) {
|
|
977
|
+
return length;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
return -1;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
_assocIndexOf = assocIndexOf;
|
|
984
|
+
return _assocIndexOf;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
var _listCacheDelete;
|
|
988
|
+
var hasRequired_listCacheDelete;
|
|
989
|
+
|
|
990
|
+
function require_listCacheDelete () {
|
|
991
|
+
if (hasRequired_listCacheDelete) return _listCacheDelete;
|
|
992
|
+
hasRequired_listCacheDelete = 1;
|
|
993
|
+
var assocIndexOf = require_assocIndexOf();
|
|
994
|
+
|
|
995
|
+
/** Used for built-in method references. */
|
|
996
|
+
var arrayProto = Array.prototype;
|
|
997
|
+
|
|
998
|
+
/** Built-in value references. */
|
|
999
|
+
var splice = arrayProto.splice;
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Removes `key` and its value from the list cache.
|
|
1003
|
+
*
|
|
1004
|
+
* @private
|
|
1005
|
+
* @name delete
|
|
1006
|
+
* @memberOf ListCache
|
|
1007
|
+
* @param {string} key The key of the value to remove.
|
|
1008
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1009
|
+
*/
|
|
1010
|
+
function listCacheDelete(key) {
|
|
1011
|
+
var data = this.__data__,
|
|
1012
|
+
index = assocIndexOf(data, key);
|
|
1013
|
+
|
|
1014
|
+
if (index < 0) {
|
|
1015
|
+
return false;
|
|
1016
|
+
}
|
|
1017
|
+
var lastIndex = data.length - 1;
|
|
1018
|
+
if (index == lastIndex) {
|
|
1019
|
+
data.pop();
|
|
1020
|
+
} else {
|
|
1021
|
+
splice.call(data, index, 1);
|
|
1022
|
+
}
|
|
1023
|
+
--this.size;
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
_listCacheDelete = listCacheDelete;
|
|
1028
|
+
return _listCacheDelete;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var _listCacheGet;
|
|
1032
|
+
var hasRequired_listCacheGet;
|
|
1033
|
+
|
|
1034
|
+
function require_listCacheGet () {
|
|
1035
|
+
if (hasRequired_listCacheGet) return _listCacheGet;
|
|
1036
|
+
hasRequired_listCacheGet = 1;
|
|
1037
|
+
var assocIndexOf = require_assocIndexOf();
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Gets the list cache value for `key`.
|
|
1041
|
+
*
|
|
1042
|
+
* @private
|
|
1043
|
+
* @name get
|
|
1044
|
+
* @memberOf ListCache
|
|
1045
|
+
* @param {string} key The key of the value to get.
|
|
1046
|
+
* @returns {*} Returns the entry value.
|
|
1047
|
+
*/
|
|
1048
|
+
function listCacheGet(key) {
|
|
1049
|
+
var data = this.__data__,
|
|
1050
|
+
index = assocIndexOf(data, key);
|
|
1051
|
+
|
|
1052
|
+
return index < 0 ? undefined : data[index][1];
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
_listCacheGet = listCacheGet;
|
|
1056
|
+
return _listCacheGet;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
var _listCacheHas;
|
|
1060
|
+
var hasRequired_listCacheHas;
|
|
1061
|
+
|
|
1062
|
+
function require_listCacheHas () {
|
|
1063
|
+
if (hasRequired_listCacheHas) return _listCacheHas;
|
|
1064
|
+
hasRequired_listCacheHas = 1;
|
|
1065
|
+
var assocIndexOf = require_assocIndexOf();
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Checks if a list cache value for `key` exists.
|
|
1069
|
+
*
|
|
1070
|
+
* @private
|
|
1071
|
+
* @name has
|
|
1072
|
+
* @memberOf ListCache
|
|
1073
|
+
* @param {string} key The key of the entry to check.
|
|
1074
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1075
|
+
*/
|
|
1076
|
+
function listCacheHas(key) {
|
|
1077
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
_listCacheHas = listCacheHas;
|
|
1081
|
+
return _listCacheHas;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
var _listCacheSet;
|
|
1085
|
+
var hasRequired_listCacheSet;
|
|
1086
|
+
|
|
1087
|
+
function require_listCacheSet () {
|
|
1088
|
+
if (hasRequired_listCacheSet) return _listCacheSet;
|
|
1089
|
+
hasRequired_listCacheSet = 1;
|
|
1090
|
+
var assocIndexOf = require_assocIndexOf();
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Sets the list cache `key` to `value`.
|
|
1094
|
+
*
|
|
1095
|
+
* @private
|
|
1096
|
+
* @name set
|
|
1097
|
+
* @memberOf ListCache
|
|
1098
|
+
* @param {string} key The key of the value to set.
|
|
1099
|
+
* @param {*} value The value to set.
|
|
1100
|
+
* @returns {Object} Returns the list cache instance.
|
|
1101
|
+
*/
|
|
1102
|
+
function listCacheSet(key, value) {
|
|
1103
|
+
var data = this.__data__,
|
|
1104
|
+
index = assocIndexOf(data, key);
|
|
1105
|
+
|
|
1106
|
+
if (index < 0) {
|
|
1107
|
+
++this.size;
|
|
1108
|
+
data.push([key, value]);
|
|
1109
|
+
} else {
|
|
1110
|
+
data[index][1] = value;
|
|
1111
|
+
}
|
|
1112
|
+
return this;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
_listCacheSet = listCacheSet;
|
|
1116
|
+
return _listCacheSet;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
var _ListCache;
|
|
1120
|
+
var hasRequired_ListCache;
|
|
1121
|
+
|
|
1122
|
+
function require_ListCache () {
|
|
1123
|
+
if (hasRequired_ListCache) return _ListCache;
|
|
1124
|
+
hasRequired_ListCache = 1;
|
|
1125
|
+
var listCacheClear = require_listCacheClear(),
|
|
1126
|
+
listCacheDelete = require_listCacheDelete(),
|
|
1127
|
+
listCacheGet = require_listCacheGet(),
|
|
1128
|
+
listCacheHas = require_listCacheHas(),
|
|
1129
|
+
listCacheSet = require_listCacheSet();
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Creates an list cache object.
|
|
1133
|
+
*
|
|
1134
|
+
* @private
|
|
1135
|
+
* @constructor
|
|
1136
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1137
|
+
*/
|
|
1138
|
+
function ListCache(entries) {
|
|
1139
|
+
var index = -1,
|
|
1140
|
+
length = entries == null ? 0 : entries.length;
|
|
1141
|
+
|
|
1142
|
+
this.clear();
|
|
1143
|
+
while (++index < length) {
|
|
1144
|
+
var entry = entries[index];
|
|
1145
|
+
this.set(entry[0], entry[1]);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// Add methods to `ListCache`.
|
|
1150
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1151
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
1152
|
+
ListCache.prototype.get = listCacheGet;
|
|
1153
|
+
ListCache.prototype.has = listCacheHas;
|
|
1154
|
+
ListCache.prototype.set = listCacheSet;
|
|
1155
|
+
|
|
1156
|
+
_ListCache = ListCache;
|
|
1157
|
+
return _ListCache;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
var _Map;
|
|
1161
|
+
var hasRequired_Map;
|
|
1162
|
+
|
|
1163
|
+
function require_Map () {
|
|
1164
|
+
if (hasRequired_Map) return _Map;
|
|
1165
|
+
hasRequired_Map = 1;
|
|
1166
|
+
var getNative = require_getNative(),
|
|
1167
|
+
root = require_root();
|
|
1168
|
+
|
|
1169
|
+
/* Built-in method references that are verified to be native. */
|
|
1170
|
+
var Map = getNative(root, 'Map');
|
|
1171
|
+
|
|
1172
|
+
_Map = Map;
|
|
1173
|
+
return _Map;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
var _mapCacheClear;
|
|
1177
|
+
var hasRequired_mapCacheClear;
|
|
1178
|
+
|
|
1179
|
+
function require_mapCacheClear () {
|
|
1180
|
+
if (hasRequired_mapCacheClear) return _mapCacheClear;
|
|
1181
|
+
hasRequired_mapCacheClear = 1;
|
|
1182
|
+
var Hash = require_Hash(),
|
|
1183
|
+
ListCache = require_ListCache(),
|
|
1184
|
+
Map = require_Map();
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Removes all key-value entries from the map.
|
|
1188
|
+
*
|
|
1189
|
+
* @private
|
|
1190
|
+
* @name clear
|
|
1191
|
+
* @memberOf MapCache
|
|
1192
|
+
*/
|
|
1193
|
+
function mapCacheClear() {
|
|
1194
|
+
this.size = 0;
|
|
1195
|
+
this.__data__ = {
|
|
1196
|
+
'hash': new Hash,
|
|
1197
|
+
'map': new (Map || ListCache),
|
|
1198
|
+
'string': new Hash
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
_mapCacheClear = mapCacheClear;
|
|
1203
|
+
return _mapCacheClear;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1208
|
+
*
|
|
1209
|
+
* @private
|
|
1210
|
+
* @param {*} value The value to check.
|
|
1211
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1212
|
+
*/
|
|
1213
|
+
|
|
1214
|
+
var _isKeyable;
|
|
1215
|
+
var hasRequired_isKeyable;
|
|
1216
|
+
|
|
1217
|
+
function require_isKeyable () {
|
|
1218
|
+
if (hasRequired_isKeyable) return _isKeyable;
|
|
1219
|
+
hasRequired_isKeyable = 1;
|
|
1220
|
+
function isKeyable(value) {
|
|
1221
|
+
var type = typeof value;
|
|
1222
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1223
|
+
? (value !== '__proto__')
|
|
1224
|
+
: (value === null);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
_isKeyable = isKeyable;
|
|
1228
|
+
return _isKeyable;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
var _getMapData;
|
|
1232
|
+
var hasRequired_getMapData;
|
|
1233
|
+
|
|
1234
|
+
function require_getMapData () {
|
|
1235
|
+
if (hasRequired_getMapData) return _getMapData;
|
|
1236
|
+
hasRequired_getMapData = 1;
|
|
1237
|
+
var isKeyable = require_isKeyable();
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Gets the data for `map`.
|
|
1241
|
+
*
|
|
1242
|
+
* @private
|
|
1243
|
+
* @param {Object} map The map to query.
|
|
1244
|
+
* @param {string} key The reference key.
|
|
1245
|
+
* @returns {*} Returns the map data.
|
|
1246
|
+
*/
|
|
1247
|
+
function getMapData(map, key) {
|
|
1248
|
+
var data = map.__data__;
|
|
1249
|
+
return isKeyable(key)
|
|
1250
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1251
|
+
: data.map;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
_getMapData = getMapData;
|
|
1255
|
+
return _getMapData;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
var _mapCacheDelete;
|
|
1259
|
+
var hasRequired_mapCacheDelete;
|
|
1260
|
+
|
|
1261
|
+
function require_mapCacheDelete () {
|
|
1262
|
+
if (hasRequired_mapCacheDelete) return _mapCacheDelete;
|
|
1263
|
+
hasRequired_mapCacheDelete = 1;
|
|
1264
|
+
var getMapData = require_getMapData();
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Removes `key` and its value from the map.
|
|
1268
|
+
*
|
|
1269
|
+
* @private
|
|
1270
|
+
* @name delete
|
|
1271
|
+
* @memberOf MapCache
|
|
1272
|
+
* @param {string} key The key of the value to remove.
|
|
1273
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1274
|
+
*/
|
|
1275
|
+
function mapCacheDelete(key) {
|
|
1276
|
+
var result = getMapData(this, key)['delete'](key);
|
|
1277
|
+
this.size -= result ? 1 : 0;
|
|
1278
|
+
return result;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
_mapCacheDelete = mapCacheDelete;
|
|
1282
|
+
return _mapCacheDelete;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
var _mapCacheGet;
|
|
1286
|
+
var hasRequired_mapCacheGet;
|
|
1287
|
+
|
|
1288
|
+
function require_mapCacheGet () {
|
|
1289
|
+
if (hasRequired_mapCacheGet) return _mapCacheGet;
|
|
1290
|
+
hasRequired_mapCacheGet = 1;
|
|
1291
|
+
var getMapData = require_getMapData();
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Gets the map value for `key`.
|
|
1295
|
+
*
|
|
1296
|
+
* @private
|
|
1297
|
+
* @name get
|
|
1298
|
+
* @memberOf MapCache
|
|
1299
|
+
* @param {string} key The key of the value to get.
|
|
1300
|
+
* @returns {*} Returns the entry value.
|
|
1301
|
+
*/
|
|
1302
|
+
function mapCacheGet(key) {
|
|
1303
|
+
return getMapData(this, key).get(key);
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
_mapCacheGet = mapCacheGet;
|
|
1307
|
+
return _mapCacheGet;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
var _mapCacheHas;
|
|
1311
|
+
var hasRequired_mapCacheHas;
|
|
1312
|
+
|
|
1313
|
+
function require_mapCacheHas () {
|
|
1314
|
+
if (hasRequired_mapCacheHas) return _mapCacheHas;
|
|
1315
|
+
hasRequired_mapCacheHas = 1;
|
|
1316
|
+
var getMapData = require_getMapData();
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Checks if a map value for `key` exists.
|
|
1320
|
+
*
|
|
1321
|
+
* @private
|
|
1322
|
+
* @name has
|
|
1323
|
+
* @memberOf MapCache
|
|
1324
|
+
* @param {string} key The key of the entry to check.
|
|
1325
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1326
|
+
*/
|
|
1327
|
+
function mapCacheHas(key) {
|
|
1328
|
+
return getMapData(this, key).has(key);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
_mapCacheHas = mapCacheHas;
|
|
1332
|
+
return _mapCacheHas;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
var _mapCacheSet;
|
|
1336
|
+
var hasRequired_mapCacheSet;
|
|
1337
|
+
|
|
1338
|
+
function require_mapCacheSet () {
|
|
1339
|
+
if (hasRequired_mapCacheSet) return _mapCacheSet;
|
|
1340
|
+
hasRequired_mapCacheSet = 1;
|
|
1341
|
+
var getMapData = require_getMapData();
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Sets the map `key` to `value`.
|
|
1345
|
+
*
|
|
1346
|
+
* @private
|
|
1347
|
+
* @name set
|
|
1348
|
+
* @memberOf MapCache
|
|
1349
|
+
* @param {string} key The key of the value to set.
|
|
1350
|
+
* @param {*} value The value to set.
|
|
1351
|
+
* @returns {Object} Returns the map cache instance.
|
|
1352
|
+
*/
|
|
1353
|
+
function mapCacheSet(key, value) {
|
|
1354
|
+
var data = getMapData(this, key),
|
|
1355
|
+
size = data.size;
|
|
1356
|
+
|
|
1357
|
+
data.set(key, value);
|
|
1358
|
+
this.size += data.size == size ? 0 : 1;
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
_mapCacheSet = mapCacheSet;
|
|
1363
|
+
return _mapCacheSet;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
var _MapCache;
|
|
1367
|
+
var hasRequired_MapCache;
|
|
1368
|
+
|
|
1369
|
+
function require_MapCache () {
|
|
1370
|
+
if (hasRequired_MapCache) return _MapCache;
|
|
1371
|
+
hasRequired_MapCache = 1;
|
|
1372
|
+
var mapCacheClear = require_mapCacheClear(),
|
|
1373
|
+
mapCacheDelete = require_mapCacheDelete(),
|
|
1374
|
+
mapCacheGet = require_mapCacheGet(),
|
|
1375
|
+
mapCacheHas = require_mapCacheHas(),
|
|
1376
|
+
mapCacheSet = require_mapCacheSet();
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* Creates a map cache object to store key-value pairs.
|
|
1380
|
+
*
|
|
1381
|
+
* @private
|
|
1382
|
+
* @constructor
|
|
1383
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1384
|
+
*/
|
|
1385
|
+
function MapCache(entries) {
|
|
1386
|
+
var index = -1,
|
|
1387
|
+
length = entries == null ? 0 : entries.length;
|
|
1388
|
+
|
|
1389
|
+
this.clear();
|
|
1390
|
+
while (++index < length) {
|
|
1391
|
+
var entry = entries[index];
|
|
1392
|
+
this.set(entry[0], entry[1]);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
// Add methods to `MapCache`.
|
|
1397
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1398
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
1399
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1400
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1401
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1402
|
+
|
|
1403
|
+
_MapCache = MapCache;
|
|
1404
|
+
return _MapCache;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
var memoize_1;
|
|
1408
|
+
var hasRequiredMemoize;
|
|
1409
|
+
|
|
1410
|
+
function requireMemoize () {
|
|
1411
|
+
if (hasRequiredMemoize) return memoize_1;
|
|
1412
|
+
hasRequiredMemoize = 1;
|
|
1413
|
+
var MapCache = require_MapCache();
|
|
1414
|
+
|
|
1415
|
+
/** Error message constants. */
|
|
1416
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1420
|
+
* provided, it determines the cache key for storing the result based on the
|
|
1421
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
1422
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
1423
|
+
* is invoked with the `this` binding of the memoized function.
|
|
1424
|
+
*
|
|
1425
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1426
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1427
|
+
* constructor with one whose instances implement the
|
|
1428
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1429
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1430
|
+
*
|
|
1431
|
+
* @static
|
|
1432
|
+
* @memberOf _
|
|
1433
|
+
* @since 0.1.0
|
|
1434
|
+
* @category Function
|
|
1435
|
+
* @param {Function} func The function to have its output memoized.
|
|
1436
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1437
|
+
* @returns {Function} Returns the new memoized function.
|
|
1438
|
+
* @example
|
|
1439
|
+
*
|
|
1440
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
1441
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
1442
|
+
*
|
|
1443
|
+
* var values = _.memoize(_.values);
|
|
1444
|
+
* values(object);
|
|
1445
|
+
* // => [1, 2]
|
|
1446
|
+
*
|
|
1447
|
+
* values(other);
|
|
1448
|
+
* // => [3, 4]
|
|
1449
|
+
*
|
|
1450
|
+
* object.a = 2;
|
|
1451
|
+
* values(object);
|
|
1452
|
+
* // => [1, 2]
|
|
1453
|
+
*
|
|
1454
|
+
* // Modify the result cache.
|
|
1455
|
+
* values.cache.set(object, ['a', 'b']);
|
|
1456
|
+
* values(object);
|
|
1457
|
+
* // => ['a', 'b']
|
|
1458
|
+
*
|
|
1459
|
+
* // Replace `_.memoize.Cache`.
|
|
1460
|
+
* _.memoize.Cache = WeakMap;
|
|
1461
|
+
*/
|
|
1462
|
+
function memoize(func, resolver) {
|
|
1463
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1464
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1465
|
+
}
|
|
1466
|
+
var memoized = function() {
|
|
1467
|
+
var args = arguments,
|
|
1468
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1469
|
+
cache = memoized.cache;
|
|
1470
|
+
|
|
1471
|
+
if (cache.has(key)) {
|
|
1472
|
+
return cache.get(key);
|
|
1473
|
+
}
|
|
1474
|
+
var result = func.apply(this, args);
|
|
1475
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
1476
|
+
return result;
|
|
1477
|
+
};
|
|
1478
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
1479
|
+
return memoized;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
// Expose `MapCache`.
|
|
1483
|
+
memoize.Cache = MapCache;
|
|
1484
|
+
|
|
1485
|
+
memoize_1 = memoize;
|
|
1486
|
+
return memoize_1;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
var _memoizeCapped;
|
|
1490
|
+
var hasRequired_memoizeCapped;
|
|
1491
|
+
|
|
1492
|
+
function require_memoizeCapped () {
|
|
1493
|
+
if (hasRequired_memoizeCapped) return _memoizeCapped;
|
|
1494
|
+
hasRequired_memoizeCapped = 1;
|
|
1495
|
+
var memoize = requireMemoize();
|
|
1496
|
+
|
|
1497
|
+
/** Used as the maximum memoize cache size. */
|
|
1498
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1502
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1503
|
+
*
|
|
1504
|
+
* @private
|
|
1505
|
+
* @param {Function} func The function to have its output memoized.
|
|
1506
|
+
* @returns {Function} Returns the new memoized function.
|
|
1507
|
+
*/
|
|
1508
|
+
function memoizeCapped(func) {
|
|
1509
|
+
var result = memoize(func, function(key) {
|
|
1510
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1511
|
+
cache.clear();
|
|
1512
|
+
}
|
|
1513
|
+
return key;
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
var cache = result.cache;
|
|
1517
|
+
return result;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
_memoizeCapped = memoizeCapped;
|
|
1521
|
+
return _memoizeCapped;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
var _stringToPath;
|
|
1525
|
+
var hasRequired_stringToPath;
|
|
1526
|
+
|
|
1527
|
+
function require_stringToPath () {
|
|
1528
|
+
if (hasRequired_stringToPath) return _stringToPath;
|
|
1529
|
+
hasRequired_stringToPath = 1;
|
|
1530
|
+
var memoizeCapped = require_memoizeCapped();
|
|
1531
|
+
|
|
1532
|
+
/** Used to match property names within property paths. */
|
|
1533
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1534
|
+
|
|
1535
|
+
/** Used to match backslashes in property paths. */
|
|
1536
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* Converts `string` to a property path array.
|
|
1540
|
+
*
|
|
1541
|
+
* @private
|
|
1542
|
+
* @param {string} string The string to convert.
|
|
1543
|
+
* @returns {Array} Returns the property path array.
|
|
1544
|
+
*/
|
|
1545
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
1546
|
+
var result = [];
|
|
1547
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1548
|
+
result.push('');
|
|
1549
|
+
}
|
|
1550
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1551
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1552
|
+
});
|
|
1553
|
+
return result;
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
_stringToPath = stringToPath;
|
|
1557
|
+
return _stringToPath;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
1562
|
+
* shorthands.
|
|
1563
|
+
*
|
|
1564
|
+
* @private
|
|
1565
|
+
* @param {Array} [array] The array to iterate over.
|
|
1566
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1567
|
+
* @returns {Array} Returns the new mapped array.
|
|
1568
|
+
*/
|
|
1569
|
+
|
|
1570
|
+
var _arrayMap;
|
|
1571
|
+
var hasRequired_arrayMap;
|
|
1572
|
+
|
|
1573
|
+
function require_arrayMap () {
|
|
1574
|
+
if (hasRequired_arrayMap) return _arrayMap;
|
|
1575
|
+
hasRequired_arrayMap = 1;
|
|
1576
|
+
function arrayMap(array, iteratee) {
|
|
1577
|
+
var index = -1,
|
|
1578
|
+
length = array == null ? 0 : array.length,
|
|
1579
|
+
result = Array(length);
|
|
1580
|
+
|
|
1581
|
+
while (++index < length) {
|
|
1582
|
+
result[index] = iteratee(array[index], index, array);
|
|
1583
|
+
}
|
|
1584
|
+
return result;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
_arrayMap = arrayMap;
|
|
1588
|
+
return _arrayMap;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
var _baseToString;
|
|
1592
|
+
var hasRequired_baseToString;
|
|
1593
|
+
|
|
1594
|
+
function require_baseToString () {
|
|
1595
|
+
if (hasRequired_baseToString) return _baseToString;
|
|
1596
|
+
hasRequired_baseToString = 1;
|
|
1597
|
+
var Symbol = require_Symbol(),
|
|
1598
|
+
arrayMap = require_arrayMap(),
|
|
1599
|
+
isArray = requireIsArray(),
|
|
1600
|
+
isSymbol = requireIsSymbol();
|
|
1601
|
+
|
|
1602
|
+
/** Used as references for various `Number` constants. */
|
|
1603
|
+
var INFINITY = 1 / 0;
|
|
1604
|
+
|
|
1605
|
+
/** Used to convert symbols to primitives and strings. */
|
|
1606
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
1607
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1611
|
+
* values to empty strings.
|
|
1612
|
+
*
|
|
1613
|
+
* @private
|
|
1614
|
+
* @param {*} value The value to process.
|
|
1615
|
+
* @returns {string} Returns the string.
|
|
1616
|
+
*/
|
|
1617
|
+
function baseToString(value) {
|
|
1618
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
1619
|
+
if (typeof value == 'string') {
|
|
1620
|
+
return value;
|
|
1621
|
+
}
|
|
1622
|
+
if (isArray(value)) {
|
|
1623
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
1624
|
+
return arrayMap(value, baseToString) + '';
|
|
1625
|
+
}
|
|
1626
|
+
if (isSymbol(value)) {
|
|
1627
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
1628
|
+
}
|
|
1629
|
+
var result = (value + '');
|
|
1630
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
_baseToString = baseToString;
|
|
1634
|
+
return _baseToString;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
var toString_1;
|
|
1638
|
+
var hasRequiredToString;
|
|
1639
|
+
|
|
1640
|
+
function requireToString () {
|
|
1641
|
+
if (hasRequiredToString) return toString_1;
|
|
1642
|
+
hasRequiredToString = 1;
|
|
1643
|
+
var baseToString = require_baseToString();
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
1647
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
1648
|
+
*
|
|
1649
|
+
* @static
|
|
1650
|
+
* @memberOf _
|
|
1651
|
+
* @since 4.0.0
|
|
1652
|
+
* @category Lang
|
|
1653
|
+
* @param {*} value The value to convert.
|
|
1654
|
+
* @returns {string} Returns the converted string.
|
|
1655
|
+
* @example
|
|
1656
|
+
*
|
|
1657
|
+
* _.toString(null);
|
|
1658
|
+
* // => ''
|
|
1659
|
+
*
|
|
1660
|
+
* _.toString(-0);
|
|
1661
|
+
* // => '-0'
|
|
1662
|
+
*
|
|
1663
|
+
* _.toString([1, 2, 3]);
|
|
1664
|
+
* // => '1,2,3'
|
|
1665
|
+
*/
|
|
1666
|
+
function toString(value) {
|
|
1667
|
+
return value == null ? '' : baseToString(value);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
toString_1 = toString;
|
|
1671
|
+
return toString_1;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
var _castPath;
|
|
1675
|
+
var hasRequired_castPath;
|
|
1676
|
+
|
|
1677
|
+
function require_castPath () {
|
|
1678
|
+
if (hasRequired_castPath) return _castPath;
|
|
1679
|
+
hasRequired_castPath = 1;
|
|
1680
|
+
var isArray = requireIsArray(),
|
|
1681
|
+
isKey = require_isKey(),
|
|
1682
|
+
stringToPath = require_stringToPath(),
|
|
1683
|
+
toString = requireToString();
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* Casts `value` to a path array if it's not one.
|
|
1687
|
+
*
|
|
1688
|
+
* @private
|
|
1689
|
+
* @param {*} value The value to inspect.
|
|
1690
|
+
* @param {Object} [object] The object to query keys on.
|
|
1691
|
+
* @returns {Array} Returns the cast property path array.
|
|
1692
|
+
*/
|
|
1693
|
+
function castPath(value, object) {
|
|
1694
|
+
if (isArray(value)) {
|
|
1695
|
+
return value;
|
|
1696
|
+
}
|
|
1697
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
_castPath = castPath;
|
|
1701
|
+
return _castPath;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
var _toKey;
|
|
1705
|
+
var hasRequired_toKey;
|
|
1706
|
+
|
|
1707
|
+
function require_toKey () {
|
|
1708
|
+
if (hasRequired_toKey) return _toKey;
|
|
1709
|
+
hasRequired_toKey = 1;
|
|
1710
|
+
var isSymbol = requireIsSymbol();
|
|
1711
|
+
|
|
1712
|
+
/** Used as references for various `Number` constants. */
|
|
1713
|
+
var INFINITY = 1 / 0;
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
1717
|
+
*
|
|
1718
|
+
* @private
|
|
1719
|
+
* @param {*} value The value to inspect.
|
|
1720
|
+
* @returns {string|symbol} Returns the key.
|
|
1721
|
+
*/
|
|
1722
|
+
function toKey(value) {
|
|
1723
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
1724
|
+
return value;
|
|
1725
|
+
}
|
|
1726
|
+
var result = (value + '');
|
|
1727
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
_toKey = toKey;
|
|
1731
|
+
return _toKey;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
var _baseGet;
|
|
1735
|
+
var hasRequired_baseGet;
|
|
1736
|
+
|
|
1737
|
+
function require_baseGet () {
|
|
1738
|
+
if (hasRequired_baseGet) return _baseGet;
|
|
1739
|
+
hasRequired_baseGet = 1;
|
|
1740
|
+
var castPath = require_castPath(),
|
|
1741
|
+
toKey = require_toKey();
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* The base implementation of `_.get` without support for default values.
|
|
1745
|
+
*
|
|
1746
|
+
* @private
|
|
1747
|
+
* @param {Object} object The object to query.
|
|
1748
|
+
* @param {Array|string} path The path of the property to get.
|
|
1749
|
+
* @returns {*} Returns the resolved value.
|
|
1750
|
+
*/
|
|
1751
|
+
function baseGet(object, path) {
|
|
1752
|
+
path = castPath(path, object);
|
|
1753
|
+
|
|
1754
|
+
var index = 0,
|
|
1755
|
+
length = path.length;
|
|
1756
|
+
|
|
1757
|
+
while (object != null && index < length) {
|
|
1758
|
+
object = object[toKey(path[index++])];
|
|
1759
|
+
}
|
|
1760
|
+
return (index && index == length) ? object : undefined;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
_baseGet = baseGet;
|
|
1764
|
+
return _baseGet;
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
var get_1;
|
|
1768
|
+
var hasRequiredGet;
|
|
1769
|
+
|
|
1770
|
+
function requireGet () {
|
|
1771
|
+
if (hasRequiredGet) return get_1;
|
|
1772
|
+
hasRequiredGet = 1;
|
|
1773
|
+
var baseGet = require_baseGet();
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
1777
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
1778
|
+
*
|
|
1779
|
+
* @static
|
|
1780
|
+
* @memberOf _
|
|
1781
|
+
* @since 3.7.0
|
|
1782
|
+
* @category Object
|
|
1783
|
+
* @param {Object} object The object to query.
|
|
1784
|
+
* @param {Array|string} path The path of the property to get.
|
|
1785
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
1786
|
+
* @returns {*} Returns the resolved value.
|
|
1787
|
+
* @example
|
|
1788
|
+
*
|
|
1789
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
1790
|
+
*
|
|
1791
|
+
* _.get(object, 'a[0].b.c');
|
|
1792
|
+
* // => 3
|
|
1793
|
+
*
|
|
1794
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
1795
|
+
* // => 3
|
|
1796
|
+
*
|
|
1797
|
+
* _.get(object, 'a.b.c', 'default');
|
|
1798
|
+
* // => 'default'
|
|
1799
|
+
*/
|
|
1800
|
+
function get(object, path, defaultValue) {
|
|
1801
|
+
var result = object == null ? undefined : baseGet(object, path);
|
|
1802
|
+
return result === undefined ? defaultValue : result;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
get_1 = get;
|
|
1806
|
+
return get_1;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
var getExports = requireGet();
|
|
1810
|
+
const get = /*@__PURE__*/getDefaultExportFromCjs(getExports);
|
|
1811
|
+
|
|
1812
|
+
function checkType(value, condition) {
|
|
1813
|
+
if (condition) {
|
|
1814
|
+
return true;
|
|
1815
|
+
}
|
|
1816
|
+
return false;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
function isArray(value) {
|
|
1820
|
+
return Boolean(value && Array.isArray(value));
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
function isBoolean(value) {
|
|
1824
|
+
return typeof value === "boolean";
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
function isNumber(value) {
|
|
1828
|
+
return typeof value === "number" && !Number.isNaN(value);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
function isString(value) {
|
|
1832
|
+
return typeof value === "string";
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
function isId(value) {
|
|
1836
|
+
return isNumber(value) || isString(value);
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
function isNull(value) {
|
|
1840
|
+
return value === null;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function isNullable(value) {
|
|
1844
|
+
return typeof value === "undefined" || value === null;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
function isObject(value) {
|
|
1848
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
function isUndefined(value) {
|
|
1852
|
+
return typeof value === "undefined";
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
function isDate(value) {
|
|
1856
|
+
if (value instanceof Date)
|
|
1857
|
+
return !Number.isNaN(value.valueOf());
|
|
1858
|
+
return false;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
const index$5 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1862
|
+
__proto__: null,
|
|
1863
|
+
checkType,
|
|
1864
|
+
isArray,
|
|
1865
|
+
isBoolean,
|
|
1866
|
+
isDate,
|
|
1867
|
+
isId,
|
|
1868
|
+
isNull,
|
|
1869
|
+
isNullable,
|
|
1870
|
+
isNumber,
|
|
1871
|
+
isObject,
|
|
1872
|
+
isString,
|
|
1873
|
+
isUndefined
|
|
1874
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1875
|
+
|
|
1876
|
+
function getByPath(data, path, defaultValue = undefined) {
|
|
1877
|
+
if ((!isObject(data) && !isArray(data)) || !isString(path))
|
|
1878
|
+
return defaultValue;
|
|
1879
|
+
return get(data, path, defaultValue);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
var dayjs_min$1 = {exports: {}};
|
|
1883
|
+
|
|
1884
|
+
var dayjs_min = dayjs_min$1.exports;
|
|
1885
|
+
|
|
1886
|
+
var hasRequiredDayjs_min;
|
|
1887
|
+
|
|
1888
|
+
function requireDayjs_min () {
|
|
1889
|
+
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
1890
|
+
hasRequiredDayjs_min = 1;
|
|
1891
|
+
(function (module, exports) {
|
|
1892
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
1893
|
+
} (dayjs_min$1));
|
|
1894
|
+
return dayjs_min$1.exports;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
var dayjs_minExports = requireDayjs_min();
|
|
1898
|
+
const dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
1899
|
+
|
|
1900
|
+
function dateDifference(type, firstDate, secondDate = new Date(), float = false) {
|
|
1901
|
+
const first = dayjs(firstDate);
|
|
1902
|
+
return first.diff(secondDate, type, float);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
function getDateByRules(rules, date = new Date()) {
|
|
1906
|
+
let result = new Date(date);
|
|
1907
|
+
for (const rule of rules) {
|
|
1908
|
+
result = getDate(rule.increment, rule.type, result);
|
|
1909
|
+
}
|
|
1910
|
+
return result;
|
|
1911
|
+
}
|
|
1912
|
+
function getDate(increment, type, date = new Date()) {
|
|
1913
|
+
const result = new Date(date);
|
|
1914
|
+
switch (type) {
|
|
1915
|
+
case DATE_TYPES.Days: {
|
|
1916
|
+
result.setDate(result.getDate() + increment);
|
|
1917
|
+
return result;
|
|
1918
|
+
}
|
|
1919
|
+
case DATE_TYPES.Months: {
|
|
1920
|
+
result.setMonth(result.getMonth() + increment);
|
|
1921
|
+
return result;
|
|
1922
|
+
}
|
|
1923
|
+
case DATE_TYPES.Years: {
|
|
1924
|
+
result.setFullYear(result.getFullYear() + increment);
|
|
1925
|
+
return result;
|
|
1926
|
+
}
|
|
1927
|
+
case DATE_TYPES.Seconds: {
|
|
1928
|
+
result.setSeconds(result.getSeconds() + increment);
|
|
1929
|
+
return result;
|
|
1930
|
+
}
|
|
1931
|
+
case DATE_TYPES.Minutes: {
|
|
1932
|
+
result.setMinutes(result.getMinutes() + increment);
|
|
1933
|
+
return result;
|
|
1934
|
+
}
|
|
1935
|
+
case DATE_TYPES.Hours: {
|
|
1936
|
+
result.setHours(result.getHours() + increment);
|
|
1937
|
+
return result;
|
|
1938
|
+
}
|
|
1939
|
+
default:
|
|
1940
|
+
return result;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
function getToday() {
|
|
1945
|
+
const startToday = new Date();
|
|
1946
|
+
startToday.setHours(0, 0, 0, 0);
|
|
1947
|
+
const endToday = new Date();
|
|
1948
|
+
endToday.setHours(23, 59, 59, 999);
|
|
1949
|
+
return { startToday, endToday };
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
function getTomorrow() {
|
|
1953
|
+
const tomorrow = new Date();
|
|
1954
|
+
tomorrow.setHours(0, 0, 0, 0);
|
|
1955
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
1956
|
+
return tomorrow;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
function getYesterday() {
|
|
1960
|
+
const yesterday = new Date();
|
|
1961
|
+
yesterday.setHours(0, 0, 0, 0);
|
|
1962
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
1963
|
+
return yesterday;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
var isToday$2 = {exports: {}};
|
|
1967
|
+
|
|
1968
|
+
var isToday$1 = isToday$2.exports;
|
|
1969
|
+
|
|
1970
|
+
var hasRequiredIsToday;
|
|
1971
|
+
|
|
1972
|
+
function requireIsToday () {
|
|
1973
|
+
if (hasRequiredIsToday) return isToday$2.exports;
|
|
1974
|
+
hasRequiredIsToday = 1;
|
|
1975
|
+
(function (module, exports) {
|
|
1976
|
+
!function(e,o){module.exports=o();}(isToday$1,(function(){return function(e,o,t){o.prototype.isToday=function(){var e="YYYY-MM-DD",o=t();return this.format(e)===o.format(e)};}}));
|
|
1977
|
+
} (isToday$2));
|
|
1978
|
+
return isToday$2.exports;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
var isTodayExports = requireIsToday();
|
|
1982
|
+
const todayPlugin = /*@__PURE__*/getDefaultExportFromCjs(isTodayExports);
|
|
1983
|
+
|
|
1984
|
+
dayjs.extend(todayPlugin);
|
|
1985
|
+
function isToday(date) {
|
|
1986
|
+
try {
|
|
1987
|
+
return dayjs(date).isToday();
|
|
1988
|
+
}
|
|
1989
|
+
catch {
|
|
1990
|
+
return false;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
var isTomorrow$2 = {exports: {}};
|
|
1995
|
+
|
|
1996
|
+
var isTomorrow$1 = isTomorrow$2.exports;
|
|
1997
|
+
|
|
1998
|
+
var hasRequiredIsTomorrow;
|
|
1999
|
+
|
|
2000
|
+
function requireIsTomorrow () {
|
|
2001
|
+
if (hasRequiredIsTomorrow) return isTomorrow$2.exports;
|
|
2002
|
+
hasRequiredIsTomorrow = 1;
|
|
2003
|
+
(function (module, exports) {
|
|
2004
|
+
!function(o,e){module.exports=e();}(isTomorrow$1,(function(){return function(o,e,t){e.prototype.isTomorrow=function(){var o="YYYY-MM-DD",e=t().add(1,"day");return this.format(o)===e.format(o)};}}));
|
|
2005
|
+
} (isTomorrow$2));
|
|
2006
|
+
return isTomorrow$2.exports;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
var isTomorrowExports = requireIsTomorrow();
|
|
2010
|
+
const tomorrowPlugin = /*@__PURE__*/getDefaultExportFromCjs(isTomorrowExports);
|
|
2011
|
+
|
|
2012
|
+
dayjs.extend(tomorrowPlugin);
|
|
2013
|
+
function isTomorrow(date) {
|
|
2014
|
+
try {
|
|
2015
|
+
return dayjs(date).isTomorrow();
|
|
2016
|
+
}
|
|
2017
|
+
catch {
|
|
2018
|
+
return false;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
var isYesterday$2 = {exports: {}};
|
|
2023
|
+
|
|
2024
|
+
var isYesterday$1 = isYesterday$2.exports;
|
|
2025
|
+
|
|
2026
|
+
var hasRequiredIsYesterday;
|
|
2027
|
+
|
|
2028
|
+
function requireIsYesterday () {
|
|
2029
|
+
if (hasRequiredIsYesterday) return isYesterday$2.exports;
|
|
2030
|
+
hasRequiredIsYesterday = 1;
|
|
2031
|
+
(function (module, exports) {
|
|
2032
|
+
!function(e,t){module.exports=t();}(isYesterday$1,(function(){return function(e,t,n){t.prototype.isYesterday=function(){var e="YYYY-MM-DD",t=n().subtract(1,"day");return this.format(e)===t.format(e)};}}));
|
|
2033
|
+
} (isYesterday$2));
|
|
2034
|
+
return isYesterday$2.exports;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
var isYesterdayExports = requireIsYesterday();
|
|
2038
|
+
const yesterdayPlugin = /*@__PURE__*/getDefaultExportFromCjs(isYesterdayExports);
|
|
2039
|
+
|
|
2040
|
+
dayjs.extend(yesterdayPlugin);
|
|
2041
|
+
function isYesterday(date) {
|
|
2042
|
+
try {
|
|
2043
|
+
return dayjs(date).isYesterday();
|
|
2044
|
+
}
|
|
2045
|
+
catch {
|
|
2046
|
+
return false;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
function dateFormat(date, format) {
|
|
2051
|
+
const correctDate = new Date(date);
|
|
2052
|
+
if (!isDate(correctDate))
|
|
2053
|
+
return "";
|
|
2054
|
+
return dayjs(correctDate).format(format);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
const index$4 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2058
|
+
__proto__: null,
|
|
2059
|
+
dateDifference,
|
|
2060
|
+
dateFormat,
|
|
2061
|
+
getDateByRules,
|
|
2062
|
+
getToday,
|
|
2063
|
+
getTomorrow,
|
|
2064
|
+
getYesterday,
|
|
2065
|
+
isToday,
|
|
2066
|
+
isTomorrow,
|
|
2067
|
+
isYesterday
|
|
2068
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2069
|
+
|
|
2070
|
+
function transformToNumber(value) {
|
|
2071
|
+
let result;
|
|
2072
|
+
if (isString(value))
|
|
2073
|
+
result = parseInt(value, 10);
|
|
2074
|
+
else
|
|
2075
|
+
result = Number(value);
|
|
2076
|
+
return Number.isNaN(result) ? 0 : result;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
function fieldViewFormat(field, type = "string") {
|
|
2080
|
+
switch (type) {
|
|
2081
|
+
case FIELD_TYPES.Array: {
|
|
2082
|
+
return isArray(field) ? field.join(", ") : "";
|
|
2083
|
+
}
|
|
2084
|
+
case FIELD_TYPES.Date: {
|
|
2085
|
+
return isString(field) || isNumber(field) || isDate(field)
|
|
2086
|
+
? dateFormat(field, "DD.MM.YYYY")
|
|
2087
|
+
: "";
|
|
2088
|
+
}
|
|
2089
|
+
case FIELD_TYPES.DateTime: {
|
|
2090
|
+
return isString(field) || isNumber(field) || isDate(field)
|
|
2091
|
+
? dateFormat(field, "DD.MM.YYYY HH:mm")
|
|
2092
|
+
: "";
|
|
2093
|
+
}
|
|
2094
|
+
case FIELD_TYPES.Number: {
|
|
2095
|
+
return isString(field) || isNumber(field) || isBoolean(field)
|
|
2096
|
+
? String(transformToNumber(field))
|
|
2097
|
+
: "";
|
|
2098
|
+
}
|
|
2099
|
+
case FIELD_TYPES.String: {
|
|
2100
|
+
return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
|
|
2101
|
+
}
|
|
2102
|
+
case FIELD_TYPES.Time: {
|
|
2103
|
+
return isString(field) || isNumber(field) || isDate(field) ? dateFormat(field, "HH:mm") : "";
|
|
2104
|
+
}
|
|
2105
|
+
default: {
|
|
2106
|
+
return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
var _defineProperty;
|
|
2112
|
+
var hasRequired_defineProperty;
|
|
2113
|
+
|
|
2114
|
+
function require_defineProperty () {
|
|
2115
|
+
if (hasRequired_defineProperty) return _defineProperty;
|
|
2116
|
+
hasRequired_defineProperty = 1;
|
|
2117
|
+
var getNative = require_getNative();
|
|
2118
|
+
|
|
2119
|
+
var defineProperty = (function() {
|
|
2120
|
+
try {
|
|
2121
|
+
var func = getNative(Object, 'defineProperty');
|
|
2122
|
+
func({}, '', {});
|
|
2123
|
+
return func;
|
|
2124
|
+
} catch (e) {}
|
|
2125
|
+
}());
|
|
2126
|
+
|
|
2127
|
+
_defineProperty = defineProperty;
|
|
2128
|
+
return _defineProperty;
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
var _baseAssignValue;
|
|
2132
|
+
var hasRequired_baseAssignValue;
|
|
2133
|
+
|
|
2134
|
+
function require_baseAssignValue () {
|
|
2135
|
+
if (hasRequired_baseAssignValue) return _baseAssignValue;
|
|
2136
|
+
hasRequired_baseAssignValue = 1;
|
|
2137
|
+
var defineProperty = require_defineProperty();
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
2141
|
+
* value checks.
|
|
2142
|
+
*
|
|
2143
|
+
* @private
|
|
2144
|
+
* @param {Object} object The object to modify.
|
|
2145
|
+
* @param {string} key The key of the property to assign.
|
|
2146
|
+
* @param {*} value The value to assign.
|
|
2147
|
+
*/
|
|
2148
|
+
function baseAssignValue(object, key, value) {
|
|
2149
|
+
if (key == '__proto__' && defineProperty) {
|
|
2150
|
+
defineProperty(object, key, {
|
|
2151
|
+
'configurable': true,
|
|
2152
|
+
'enumerable': true,
|
|
2153
|
+
'value': value,
|
|
2154
|
+
'writable': true
|
|
2155
|
+
});
|
|
2156
|
+
} else {
|
|
2157
|
+
object[key] = value;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
_baseAssignValue = baseAssignValue;
|
|
2162
|
+
return _baseAssignValue;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
var _assignValue;
|
|
2166
|
+
var hasRequired_assignValue;
|
|
2167
|
+
|
|
2168
|
+
function require_assignValue () {
|
|
2169
|
+
if (hasRequired_assignValue) return _assignValue;
|
|
2170
|
+
hasRequired_assignValue = 1;
|
|
2171
|
+
var baseAssignValue = require_baseAssignValue(),
|
|
2172
|
+
eq = requireEq();
|
|
2173
|
+
|
|
2174
|
+
/** Used for built-in method references. */
|
|
2175
|
+
var objectProto = Object.prototype;
|
|
2176
|
+
|
|
2177
|
+
/** Used to check objects for own properties. */
|
|
2178
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
2182
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
2183
|
+
* for equality comparisons.
|
|
2184
|
+
*
|
|
2185
|
+
* @private
|
|
2186
|
+
* @param {Object} object The object to modify.
|
|
2187
|
+
* @param {string} key The key of the property to assign.
|
|
2188
|
+
* @param {*} value The value to assign.
|
|
2189
|
+
*/
|
|
2190
|
+
function assignValue(object, key, value) {
|
|
2191
|
+
var objValue = object[key];
|
|
2192
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
|
2193
|
+
(value === undefined && !(key in object))) {
|
|
2194
|
+
baseAssignValue(object, key, value);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
_assignValue = assignValue;
|
|
2199
|
+
return _assignValue;
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
/** Used as references for various `Number` constants. */
|
|
2203
|
+
|
|
2204
|
+
var _isIndex;
|
|
2205
|
+
var hasRequired_isIndex;
|
|
2206
|
+
|
|
2207
|
+
function require_isIndex () {
|
|
2208
|
+
if (hasRequired_isIndex) return _isIndex;
|
|
2209
|
+
hasRequired_isIndex = 1;
|
|
2210
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
2211
|
+
|
|
2212
|
+
/** Used to detect unsigned integer values. */
|
|
2213
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Checks if `value` is a valid array-like index.
|
|
2217
|
+
*
|
|
2218
|
+
* @private
|
|
2219
|
+
* @param {*} value The value to check.
|
|
2220
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
2221
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
2222
|
+
*/
|
|
2223
|
+
function isIndex(value, length) {
|
|
2224
|
+
var type = typeof value;
|
|
2225
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
2226
|
+
|
|
2227
|
+
return !!length &&
|
|
2228
|
+
(type == 'number' ||
|
|
2229
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
2230
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
_isIndex = isIndex;
|
|
2234
|
+
return _isIndex;
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
var _baseSet;
|
|
2238
|
+
var hasRequired_baseSet;
|
|
2239
|
+
|
|
2240
|
+
function require_baseSet () {
|
|
2241
|
+
if (hasRequired_baseSet) return _baseSet;
|
|
2242
|
+
hasRequired_baseSet = 1;
|
|
2243
|
+
var assignValue = require_assignValue(),
|
|
2244
|
+
castPath = require_castPath(),
|
|
2245
|
+
isIndex = require_isIndex(),
|
|
2246
|
+
isObject = requireIsObject(),
|
|
2247
|
+
toKey = require_toKey();
|
|
2248
|
+
|
|
2249
|
+
/**
|
|
2250
|
+
* The base implementation of `_.set`.
|
|
2251
|
+
*
|
|
2252
|
+
* @private
|
|
2253
|
+
* @param {Object} object The object to modify.
|
|
2254
|
+
* @param {Array|string} path The path of the property to set.
|
|
2255
|
+
* @param {*} value The value to set.
|
|
2256
|
+
* @param {Function} [customizer] The function to customize path creation.
|
|
2257
|
+
* @returns {Object} Returns `object`.
|
|
2258
|
+
*/
|
|
2259
|
+
function baseSet(object, path, value, customizer) {
|
|
2260
|
+
if (!isObject(object)) {
|
|
2261
|
+
return object;
|
|
2262
|
+
}
|
|
2263
|
+
path = castPath(path, object);
|
|
2264
|
+
|
|
2265
|
+
var index = -1,
|
|
2266
|
+
length = path.length,
|
|
2267
|
+
lastIndex = length - 1,
|
|
2268
|
+
nested = object;
|
|
2269
|
+
|
|
2270
|
+
while (nested != null && ++index < length) {
|
|
2271
|
+
var key = toKey(path[index]),
|
|
2272
|
+
newValue = value;
|
|
2273
|
+
|
|
2274
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
2275
|
+
return object;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
if (index != lastIndex) {
|
|
2279
|
+
var objValue = nested[key];
|
|
2280
|
+
newValue = customizer ? customizer(objValue, key, nested) : undefined;
|
|
2281
|
+
if (newValue === undefined) {
|
|
2282
|
+
newValue = isObject(objValue)
|
|
2283
|
+
? objValue
|
|
2284
|
+
: (isIndex(path[index + 1]) ? [] : {});
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
assignValue(nested, key, newValue);
|
|
2288
|
+
nested = nested[key];
|
|
2289
|
+
}
|
|
2290
|
+
return object;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
_baseSet = baseSet;
|
|
2294
|
+
return _baseSet;
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
var set_1;
|
|
2298
|
+
var hasRequiredSet;
|
|
2299
|
+
|
|
2300
|
+
function requireSet () {
|
|
2301
|
+
if (hasRequiredSet) return set_1;
|
|
2302
|
+
hasRequiredSet = 1;
|
|
2303
|
+
var baseSet = require_baseSet();
|
|
2304
|
+
|
|
2305
|
+
/**
|
|
2306
|
+
* Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
|
|
2307
|
+
* it's created. Arrays are created for missing index properties while objects
|
|
2308
|
+
* are created for all other missing properties. Use `_.setWith` to customize
|
|
2309
|
+
* `path` creation.
|
|
2310
|
+
*
|
|
2311
|
+
* **Note:** This method mutates `object`.
|
|
2312
|
+
*
|
|
2313
|
+
* @static
|
|
2314
|
+
* @memberOf _
|
|
2315
|
+
* @since 3.7.0
|
|
2316
|
+
* @category Object
|
|
2317
|
+
* @param {Object} object The object to modify.
|
|
2318
|
+
* @param {Array|string} path The path of the property to set.
|
|
2319
|
+
* @param {*} value The value to set.
|
|
2320
|
+
* @returns {Object} Returns `object`.
|
|
2321
|
+
* @example
|
|
2322
|
+
*
|
|
2323
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2324
|
+
*
|
|
2325
|
+
* _.set(object, 'a[0].b.c', 4);
|
|
2326
|
+
* console.log(object.a[0].b.c);
|
|
2327
|
+
* // => 4
|
|
2328
|
+
*
|
|
2329
|
+
* _.set(object, ['x', '0', 'y', 'z'], 5);
|
|
2330
|
+
* console.log(object.x[0].y.z);
|
|
2331
|
+
* // => 5
|
|
2332
|
+
*/
|
|
2333
|
+
function set(object, path, value) {
|
|
2334
|
+
return object == null ? object : baseSet(object, path, value);
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
set_1 = set;
|
|
2338
|
+
return set_1;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
var setExports = requireSet();
|
|
2342
|
+
const set = /*@__PURE__*/getDefaultExportFromCjs(setExports);
|
|
2343
|
+
|
|
2344
|
+
function setByPath(data, path, value) {
|
|
2345
|
+
try {
|
|
2346
|
+
if (!isObject(data) && !isArray(data))
|
|
2347
|
+
throw new Error("bad data");
|
|
2348
|
+
set(data, path, value);
|
|
2349
|
+
}
|
|
2350
|
+
catch (error) {
|
|
2351
|
+
// eslint-disable-next-line no-console
|
|
2352
|
+
console.warn(error);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
function jsonParse(json) {
|
|
2357
|
+
if (!isString(json))
|
|
2358
|
+
return null;
|
|
2359
|
+
try {
|
|
2360
|
+
return JSON.parse(json);
|
|
2361
|
+
}
|
|
2362
|
+
catch {
|
|
2363
|
+
return null;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2368
|
+
function randomString(length = 10, allowCharacters = characters) {
|
|
2369
|
+
let result = "";
|
|
2370
|
+
let counter = 0;
|
|
2371
|
+
while (counter < length) {
|
|
2372
|
+
result += allowCharacters.charAt(Math.floor(Math.random() * allowCharacters.length));
|
|
2373
|
+
counter += 1;
|
|
2374
|
+
}
|
|
2375
|
+
return result;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
function wait(delay) {
|
|
2379
|
+
return new Promise((resolve) => {
|
|
2380
|
+
setTimeout(() => {
|
|
2381
|
+
resolve(true);
|
|
2382
|
+
}, delay);
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
function buildQueryString(params) {
|
|
2387
|
+
const queryString = [];
|
|
2388
|
+
for (const [key, value] of Object.entries(params)) {
|
|
2389
|
+
if (isObject(value) || value == undefined)
|
|
2390
|
+
continue;
|
|
2391
|
+
if (isArray(value)) {
|
|
2392
|
+
for (const item of value) {
|
|
2393
|
+
if (item != undefined && !isObject(item))
|
|
2394
|
+
queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
else {
|
|
2398
|
+
queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
return queryString.join("&");
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
function createURLWithParams(options) {
|
|
2405
|
+
const url = options.baseURL.replace(/\/$/, "").replace(/\?$/, "");
|
|
2406
|
+
if (!options.params) {
|
|
2407
|
+
return url;
|
|
2408
|
+
}
|
|
2409
|
+
const queryString = buildQueryString(options.params);
|
|
2410
|
+
return `${url}?${queryString}`;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
function trimUrl(url) {
|
|
2414
|
+
return url.replace(/^\//, "").replace(/\/$/, "");
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
function arrayToMapByKey(array, key) {
|
|
2418
|
+
const map = {};
|
|
2419
|
+
for (const item of array) {
|
|
2420
|
+
const keyValue = item[key];
|
|
2421
|
+
if (isId(keyValue))
|
|
2422
|
+
map[keyValue] = item;
|
|
2423
|
+
}
|
|
2424
|
+
return map;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
function syncObjectValues(oldObj, newObj, exception = []) {
|
|
2428
|
+
for (const field in newObj) {
|
|
2429
|
+
if (exception.includes(field))
|
|
2430
|
+
continue;
|
|
2431
|
+
const oldValue = getByPath(oldObj, field, undefined);
|
|
2432
|
+
const newValue = getByPath(newObj, field, undefined);
|
|
2433
|
+
if (isUndefined(oldValue) || isUndefined(newValue))
|
|
2434
|
+
continue;
|
|
2435
|
+
if (oldValue === newValue)
|
|
2436
|
+
continue;
|
|
2437
|
+
setByPath(oldObj, field, newValue);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
function randomNumber(min, max) {
|
|
2442
|
+
min = Math.ceil(min);
|
|
2443
|
+
max = Math.floor(max);
|
|
2444
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
const filenameVariables = ["filename=", "filename*=UTF-8''"];
|
|
2448
|
+
function getFileNameFromHeader(header) {
|
|
2449
|
+
const name = header
|
|
2450
|
+
.split(";")
|
|
2451
|
+
.find((info) => ~info.indexOf(filenameVariables[0]) || ~info.indexOf(filenameVariables[1]))
|
|
2452
|
+
?.replace(filenameVariables[0], "")
|
|
2453
|
+
?.replace(filenameVariables[1], "")
|
|
2454
|
+
?.replace(/"/g, "")
|
|
2455
|
+
?.trim();
|
|
2456
|
+
return name ? decodeURI(name) : null;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGetter, refetchAfterError, resultCb, collectResult, maxTryCount = 3, }) {
|
|
2460
|
+
let isStopped = false;
|
|
2461
|
+
return {
|
|
2462
|
+
cancel: () => {
|
|
2463
|
+
isStopped = true;
|
|
2464
|
+
},
|
|
2465
|
+
promise: new Promise((resolve) => {
|
|
2466
|
+
let currentRequests = 0;
|
|
2467
|
+
let currentResponses = 0;
|
|
2468
|
+
const results = [];
|
|
2469
|
+
for (let i = 0; i < maxCountInParallel; i++) {
|
|
2470
|
+
request(promiseGetter(++currentRequests), currentRequests);
|
|
2471
|
+
}
|
|
2472
|
+
function request(promise, position, tryCount = 1) {
|
|
2473
|
+
if (isStopped)
|
|
2474
|
+
return void resolve(results);
|
|
2475
|
+
if (currentResponses === countRequests)
|
|
2476
|
+
return void resolve(results);
|
|
2477
|
+
if (position > countRequests || promise == undefined)
|
|
2478
|
+
return;
|
|
2479
|
+
promise
|
|
2480
|
+
.then((result) => {
|
|
2481
|
+
if (isStopped)
|
|
2482
|
+
return void resolve(results);
|
|
2483
|
+
if (collectResult)
|
|
2484
|
+
results.push(result);
|
|
2485
|
+
if (resultCb)
|
|
2486
|
+
resultCb(result);
|
|
2487
|
+
currentResponses++;
|
|
2488
|
+
request(promiseGetter(++currentRequests), currentRequests);
|
|
2489
|
+
})
|
|
2490
|
+
.catch(() => {
|
|
2491
|
+
if (isStopped)
|
|
2492
|
+
return void resolve(results);
|
|
2493
|
+
if (refetchAfterError && maxTryCount > tryCount) {
|
|
2494
|
+
void wait(1000).then(() => request(promiseGetter(position), position, tryCount + 1));
|
|
2495
|
+
}
|
|
2496
|
+
else {
|
|
2497
|
+
currentResponses++;
|
|
2498
|
+
request(promiseGetter(++currentRequests), currentRequests);
|
|
2499
|
+
}
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
}),
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
const index$3 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2507
|
+
__proto__: null,
|
|
2508
|
+
arrayToMapByKey,
|
|
2509
|
+
buildQueryString,
|
|
2510
|
+
createURLWithParams,
|
|
2511
|
+
fieldViewFormat,
|
|
2512
|
+
getByPath,
|
|
2513
|
+
getFileNameFromHeader,
|
|
2514
|
+
jsonParse,
|
|
2515
|
+
limitStreamOfRequests,
|
|
2516
|
+
randomNumber,
|
|
2517
|
+
randomString,
|
|
2518
|
+
setByPath,
|
|
2519
|
+
syncObjectValues,
|
|
2520
|
+
transformToNumber,
|
|
2521
|
+
trimUrl,
|
|
2522
|
+
wait,
|
|
2523
|
+
waitUntil
|
|
2524
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2525
|
+
|
|
2526
|
+
function downloadFile({ data, fileName, mimeType }) {
|
|
2527
|
+
if (!IS_BROWSER && !IS_JEST)
|
|
2528
|
+
return null;
|
|
2529
|
+
const name = getFileNameFromHeader(fileName);
|
|
2530
|
+
if (!name)
|
|
2531
|
+
throw new Error("Bad filename");
|
|
2532
|
+
const blob = new Blob([data], {
|
|
2533
|
+
type: mimeType,
|
|
2534
|
+
});
|
|
2535
|
+
const downloadUrl = window.URL.createObjectURL(blob);
|
|
2536
|
+
const link = document.createElement("a");
|
|
2537
|
+
link.style.display = "none";
|
|
2538
|
+
link.download = name;
|
|
2539
|
+
link.href = downloadUrl;
|
|
2540
|
+
document.body.appendChild(link);
|
|
2541
|
+
link.click();
|
|
2542
|
+
document.body.removeChild(link);
|
|
2543
|
+
link.remove();
|
|
2544
|
+
window.URL.revokeObjectURL(downloadUrl);
|
|
2545
|
+
return null;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
function downloadJson(data, name) {
|
|
2549
|
+
if (!IS_BROWSER && !IS_JEST)
|
|
2550
|
+
return null;
|
|
2551
|
+
const url = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(data))}`;
|
|
2552
|
+
const link = document.createElement("a");
|
|
2553
|
+
link.style.display = "none";
|
|
2554
|
+
link.download = name;
|
|
2555
|
+
link.href = url;
|
|
2556
|
+
document.body.appendChild(link);
|
|
2557
|
+
link.click();
|
|
2558
|
+
document.body.removeChild(link);
|
|
2559
|
+
link.remove();
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
function readFile(file) {
|
|
2563
|
+
return new Promise((resolve) => {
|
|
2564
|
+
if (!IS_BROWSER && !IS_JEST) {
|
|
2565
|
+
resolve(null);
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
const reader = new FileReader();
|
|
2569
|
+
reader.readAsText(file);
|
|
2570
|
+
reader.onload = () => {
|
|
2571
|
+
resolve(reader.result);
|
|
2572
|
+
};
|
|
2573
|
+
reader.onerror = () => {
|
|
2574
|
+
resolve(null);
|
|
2575
|
+
};
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
const index$2 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2580
|
+
__proto__: null,
|
|
2581
|
+
downloadFile,
|
|
2582
|
+
downloadJson,
|
|
2583
|
+
readFile
|
|
2584
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2585
|
+
|
|
2586
|
+
const tokenRequest = async (options) => {
|
|
2587
|
+
try {
|
|
2588
|
+
const response = await fetch(options.authTokenUrl, {
|
|
2589
|
+
method: "GET",
|
|
2590
|
+
});
|
|
2591
|
+
if (!response.ok) {
|
|
2592
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
2593
|
+
}
|
|
2594
|
+
const result = (await response.json());
|
|
2595
|
+
const { expiresToken, token } = transformData(result, options.pathToToken, options.pathToExpires);
|
|
2596
|
+
localStorage.setItem(options.storageExpiresTokenName, expiresToken);
|
|
2597
|
+
localStorage.setItem(options.storageTokenName, token);
|
|
2598
|
+
return token;
|
|
2599
|
+
}
|
|
2600
|
+
catch (error) {
|
|
2601
|
+
// eslint-disable-next-line no-console
|
|
2602
|
+
console.log(error);
|
|
2603
|
+
window.location.replace(options.authRedirectUrl);
|
|
2604
|
+
return null;
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
function transformData(data, pathToToken, pathToExpires) {
|
|
2608
|
+
if (!isObject(data))
|
|
2609
|
+
throw new Error("Bad response data");
|
|
2610
|
+
const token = getByPath(data, pathToToken);
|
|
2611
|
+
const expiresToken = getByPath(data, pathToExpires);
|
|
2612
|
+
if ((!isString(expiresToken) && !isNumber(expiresToken)) || !isString(token))
|
|
2613
|
+
throw new Error("Bad response data");
|
|
2614
|
+
return {
|
|
2615
|
+
expiresToken: String(expiresToken),
|
|
2616
|
+
token,
|
|
2617
|
+
};
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
let isFetchingAccessToken = false;
|
|
2621
|
+
const generateAuthMiddleWare = (options) => async (request) => {
|
|
2622
|
+
if (!options.authRedirectUrl ||
|
|
2623
|
+
!options.authRedirectUrl ||
|
|
2624
|
+
!options.storageExpiresTokenName ||
|
|
2625
|
+
!options.storageTokenName ||
|
|
2626
|
+
!options.pathToExpires ||
|
|
2627
|
+
!options.pathToToken) {
|
|
2628
|
+
// eslint-disable-next-line no-console
|
|
2629
|
+
console.error("Auth middleware hasn't required options");
|
|
2630
|
+
return;
|
|
2631
|
+
}
|
|
2632
|
+
const isSameOrigin = !request.path.includes("http") && !request.path.includes("https");
|
|
2633
|
+
if (request.token && !isSameOrigin) {
|
|
2634
|
+
request.headers = {
|
|
2635
|
+
...request.headers,
|
|
2636
|
+
Authorization: `Bearer ${request.token}`,
|
|
2637
|
+
};
|
|
2638
|
+
return;
|
|
2639
|
+
}
|
|
2640
|
+
if (isFetchingAccessToken)
|
|
2641
|
+
await waitUntil(() => isFetchingAccessToken);
|
|
2642
|
+
const expires = localStorage.getItem(options.storageExpiresTokenName);
|
|
2643
|
+
let token = localStorage.getItem(options.storageTokenName);
|
|
2644
|
+
if (!expires || Date.now() > +expires || !token) {
|
|
2645
|
+
isFetchingAccessToken = true;
|
|
2646
|
+
token = await tokenRequest(options);
|
|
2647
|
+
isFetchingAccessToken = false;
|
|
2648
|
+
}
|
|
2649
|
+
if (!isSameOrigin)
|
|
2650
|
+
request.headers = {
|
|
2651
|
+
...request.headers,
|
|
2652
|
+
Authorization: `Bearer ${token}`,
|
|
2653
|
+
};
|
|
2654
|
+
};
|
|
2655
|
+
|
|
2656
|
+
const consoleMiddleware = (response) => {
|
|
2657
|
+
return new Promise((resolve) => {
|
|
2658
|
+
// eslint-disable-next-line no-console
|
|
2659
|
+
console.log(response);
|
|
2660
|
+
resolve(true);
|
|
2661
|
+
});
|
|
2662
|
+
};
|
|
2663
|
+
|
|
2664
|
+
function generateMiddlewares(activeMiddlewares, middlewareOptions) {
|
|
2665
|
+
const selectedMiddlewares = [];
|
|
2666
|
+
for (const key of activeMiddlewares) {
|
|
2667
|
+
switch (key) {
|
|
2668
|
+
case API_MIDDLEWARES.Auth: {
|
|
2669
|
+
if (middlewareOptions.auth && (IS_BROWSER || IS_JEST))
|
|
2670
|
+
selectedMiddlewares.push(generateAuthMiddleWare(middlewareOptions.auth));
|
|
2671
|
+
continue;
|
|
2672
|
+
}
|
|
2673
|
+
case API_MIDDLEWARES.Logger: {
|
|
2674
|
+
selectedMiddlewares.push(consoleMiddleware);
|
|
2675
|
+
continue;
|
|
2676
|
+
}
|
|
2677
|
+
default: {
|
|
2678
|
+
continue;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
return function executeMiddlewares(request) {
|
|
2683
|
+
return new Promise((resolve) => {
|
|
2684
|
+
void (async () => {
|
|
2685
|
+
for (const middleware of selectedMiddlewares) {
|
|
2686
|
+
// eslint-disable-next-line no-await-in-loop
|
|
2687
|
+
await middleware(request);
|
|
2688
|
+
}
|
|
2689
|
+
resolve(1);
|
|
2690
|
+
})();
|
|
2691
|
+
});
|
|
2692
|
+
};
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
class ResponseError extends Error {
|
|
2696
|
+
status;
|
|
2697
|
+
description;
|
|
2698
|
+
constructor({ message, status, description }) {
|
|
2699
|
+
super(message);
|
|
2700
|
+
this.status = status;
|
|
2701
|
+
this.description = description;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
function generateRequestsInstance(activeMiddlewares, middlewareOptions) {
|
|
2705
|
+
const executeMiddlewares = generateMiddlewares(activeMiddlewares || [], middlewareOptions || {});
|
|
2706
|
+
async function handleRequest(request, responseWithStatus) {
|
|
2707
|
+
if (request.delay) {
|
|
2708
|
+
await wait(request.delay);
|
|
2709
|
+
}
|
|
2710
|
+
if (request.mock) {
|
|
2711
|
+
const transformedResult = request.transformIncomingData
|
|
2712
|
+
? request.transformIncomingData(request.mock)
|
|
2713
|
+
: request.mock;
|
|
2714
|
+
return responseWithStatus ? { data: transformedResult, status: 200 } : transformedResult;
|
|
2715
|
+
}
|
|
2716
|
+
await executeMiddlewares(request);
|
|
2717
|
+
const { method, body, path, params, headers } = request;
|
|
2718
|
+
const trimedPath = path.replace(/^\//, "").replace(/\/$/, "");
|
|
2719
|
+
const fullPath = trimedPath.includes("http") || trimedPath.includes("https")
|
|
2720
|
+
? trimedPath
|
|
2721
|
+
: `${window.location.origin}/${trimedPath}`;
|
|
2722
|
+
const url = createURLWithParams({ baseURL: fullPath, params });
|
|
2723
|
+
let preparedBody = body;
|
|
2724
|
+
if (body && !(preparedBody instanceof FormData)) {
|
|
2725
|
+
if (request.transformOutcomingData) {
|
|
2726
|
+
preparedBody = request.transformOutcomingData(body);
|
|
2727
|
+
}
|
|
2728
|
+
if (isObject(body) || isArray(body))
|
|
2729
|
+
preparedBody = JSON.stringify(preparedBody);
|
|
2730
|
+
}
|
|
2731
|
+
let response;
|
|
2732
|
+
if (IS_BROWSER || IS_JEST) {
|
|
2733
|
+
response = await fetch(url, {
|
|
2734
|
+
method,
|
|
2735
|
+
body: preparedBody,
|
|
2736
|
+
headers: {
|
|
2737
|
+
...(body instanceof FormData
|
|
2738
|
+
? {}
|
|
2739
|
+
: { "Content-Type": "application/json; charset=UTF-8" }),
|
|
2740
|
+
...headers,
|
|
2741
|
+
},
|
|
2742
|
+
signal: request.signal,
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
if (IS_NODE && !IS_JEST) {
|
|
2746
|
+
const nodeFetch = (await import('node-fetch')).default;
|
|
2747
|
+
response = await nodeFetch(url, {
|
|
2748
|
+
method,
|
|
2749
|
+
body: preparedBody,
|
|
2750
|
+
headers: {
|
|
2751
|
+
...(body instanceof FormData
|
|
2752
|
+
? {}
|
|
2753
|
+
: { "Content-Type": "application/json; charset=UTF-8" }),
|
|
2754
|
+
...headers,
|
|
2755
|
+
},
|
|
2756
|
+
signal: request.signal,
|
|
2757
|
+
});
|
|
2758
|
+
}
|
|
2759
|
+
if (!response) {
|
|
2760
|
+
throw new Error("hasn't response");
|
|
2761
|
+
}
|
|
2762
|
+
if (!response.ok) {
|
|
2763
|
+
throw new ResponseError({
|
|
2764
|
+
status: response.status,
|
|
2765
|
+
message: `HTTP error! Status: ${response.status}`,
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
if (request.downloadFile) {
|
|
2769
|
+
const data = await response.blob();
|
|
2770
|
+
const mimeType = response.headers.get("content-type");
|
|
2771
|
+
const fileName = response.headers.get("content-disposition");
|
|
2772
|
+
if (!mimeType || !fileName)
|
|
2773
|
+
throw new Error("Download Error! Empty info!");
|
|
2774
|
+
if (IS_BROWSER)
|
|
2775
|
+
downloadFile({
|
|
2776
|
+
data,
|
|
2777
|
+
fileName,
|
|
2778
|
+
mimeType,
|
|
2779
|
+
});
|
|
2780
|
+
return responseWithStatus
|
|
2781
|
+
? {
|
|
2782
|
+
data: data,
|
|
2783
|
+
status: response.status,
|
|
2784
|
+
}
|
|
2785
|
+
: data;
|
|
2786
|
+
}
|
|
2787
|
+
if (request.withoutResponse)
|
|
2788
|
+
return responseWithStatus ? { data: true, status: response.status } : true;
|
|
2789
|
+
const result = (await response.json());
|
|
2790
|
+
const transformedResult = request.transformIncomingData
|
|
2791
|
+
? request.transformIncomingData(result)
|
|
2792
|
+
: result;
|
|
2793
|
+
return responseWithStatus
|
|
2794
|
+
? { data: transformedResult, status: response.status }
|
|
2795
|
+
: transformedResult;
|
|
2796
|
+
}
|
|
2797
|
+
async function requestApi(request) {
|
|
2798
|
+
return handleRequest(request, false);
|
|
2799
|
+
}
|
|
2800
|
+
async function requestApiWithStatus(request) {
|
|
2801
|
+
return handleRequest(request, true);
|
|
2802
|
+
}
|
|
2803
|
+
return {
|
|
2804
|
+
requestApi,
|
|
2805
|
+
requestApiWithStatus,
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
const index$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2810
|
+
__proto__: null,
|
|
2811
|
+
ResponseError,
|
|
2812
|
+
generateRequestsInstance
|
|
2813
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2814
|
+
|
|
2815
|
+
function getColorFormat(color) {
|
|
2816
|
+
if (color.startsWith("#")) {
|
|
2817
|
+
return COLOR_FORMATS.Hex;
|
|
2818
|
+
}
|
|
2819
|
+
if (color.startsWith("rgba")) {
|
|
2820
|
+
return COLOR_FORMATS.Rgba;
|
|
2821
|
+
}
|
|
2822
|
+
if (color.startsWith("rgb")) {
|
|
2823
|
+
return COLOR_FORMATS.Rgb;
|
|
2824
|
+
}
|
|
2825
|
+
if (color.startsWith("hsl")) {
|
|
2826
|
+
return COLOR_FORMATS.Hsl;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
function transformHEXtoRGB(hex) {
|
|
2831
|
+
return `rgb(${hex.match(/\w\w/g)?.map((x) => +`0x${x}`)})`;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
function transformRGBtoRGBA(rgb, opacity) {
|
|
2835
|
+
const code = rgb.match(/\d+/g);
|
|
2836
|
+
code?.push(String(opacity / 100));
|
|
2837
|
+
return `rgba(${code?.join(",")})`;
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
function transformRGBAtoRGB(rgba) {
|
|
2841
|
+
const code = rgba.match(/\d+/g);
|
|
2842
|
+
code?.splice(3);
|
|
2843
|
+
return `rgb(${code?.join(",")})`;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
function takeOpacityColors(color, opacities) {
|
|
2847
|
+
let rgbColor = color;
|
|
2848
|
+
if (!rgbColor)
|
|
2849
|
+
return [];
|
|
2850
|
+
if (getColorFormat(rgbColor) === COLOR_FORMATS.Hex) {
|
|
2851
|
+
rgbColor = transformHEXtoRGB(rgbColor);
|
|
2852
|
+
}
|
|
2853
|
+
else if (getColorFormat(rgbColor) === COLOR_FORMATS.Rgba) {
|
|
2854
|
+
rgbColor = transformRGBAtoRGB(rgbColor);
|
|
2855
|
+
}
|
|
2856
|
+
if (getColorFormat(rgbColor) !== COLOR_FORMATS.Rgb)
|
|
2857
|
+
return [];
|
|
2858
|
+
return [...opacities.map((opacity) => transformRGBtoRGBA(rgbColor, opacity))];
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
function transformToColor(currentColor, defaultColor = "black", defaultFormat = COLOR_FORMATS.Hex) {
|
|
2862
|
+
if (!isString(currentColor))
|
|
2863
|
+
return defaultColor;
|
|
2864
|
+
let correctColor = currentColor;
|
|
2865
|
+
if (!getColorFormat(correctColor)) {
|
|
2866
|
+
switch (defaultFormat) {
|
|
2867
|
+
case COLOR_FORMATS.Hex: {
|
|
2868
|
+
correctColor = `#${correctColor}`;
|
|
2869
|
+
break;
|
|
2870
|
+
}
|
|
2871
|
+
case COLOR_FORMATS.Rgb: {
|
|
2872
|
+
correctColor = `rgb(${correctColor})`;
|
|
2873
|
+
break;
|
|
2874
|
+
}
|
|
2875
|
+
case COLOR_FORMATS.Rgba: {
|
|
2876
|
+
correctColor = `rgba(${correctColor})`;
|
|
2877
|
+
break;
|
|
2878
|
+
}
|
|
2879
|
+
case COLOR_FORMATS.Hsl: {
|
|
2880
|
+
correctColor = `hsl(${correctColor})`;
|
|
2881
|
+
break;
|
|
2882
|
+
}
|
|
2883
|
+
default: {
|
|
2884
|
+
correctColor = `#${correctColor}`;
|
|
2885
|
+
break;
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
return correctColor;
|
|
2890
|
+
}
|
|
2891
|
+
|
|
2892
|
+
const index = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2893
|
+
__proto__: null,
|
|
2894
|
+
getColorFormat,
|
|
2895
|
+
takeOpacityColors,
|
|
2896
|
+
transformHEXtoRGB,
|
|
2897
|
+
transformRGBAtoRGB,
|
|
2898
|
+
transformRGBtoRGBA,
|
|
2899
|
+
transformToColor
|
|
2900
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2901
|
+
|
|
2902
|
+
const libs = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
2903
|
+
__proto__: null,
|
|
2904
|
+
api: index$1,
|
|
2905
|
+
browser: index$2,
|
|
2906
|
+
colors: index,
|
|
2907
|
+
constants: index$6,
|
|
2908
|
+
date: index$4,
|
|
2909
|
+
utils: index$3
|
|
2910
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
2911
|
+
|
|
2912
|
+
exports.helpers = libs;
|
|
2913
|
+
exports.typings = index$5;
|
|
2914
|
+
//# sourceMappingURL=index.cjs.map
|