@pawover/kit 0.0.0-beta.5 → 0.0.0-beta.50
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/package.json +61 -80
- package/packages/hooks/dist/alova.d.ts +31 -0
- package/packages/hooks/dist/alova.js +64 -0
- package/packages/hooks/dist/index.d.ts +1 -0
- package/packages/hooks/dist/index.js +0 -0
- package/packages/hooks/dist/metadata.json +16 -0
- package/packages/hooks/dist/react.d.ts +164 -0
- package/packages/hooks/dist/react.js +4419 -0
- package/packages/utils/dist/index.d.ts +4293 -0
- package/packages/utils/dist/index.js +1527 -0
- package/packages/utils/dist/math.d.ts +54 -0
- package/packages/utils/dist/math.js +56 -0
- package/packages/utils/dist/metadata.json +14 -0
- package/packages/utils/dist/string-CESQdidv.js +793 -0
- package/packages/utils/dist/vite.d.ts +16 -0
- package/packages/utils/dist/vite.js +26 -0
- package/packages/zod/dist/index.d.ts +58 -0
- package/packages/zod/dist/index.js +61 -0
- package/dist/enums.d.ts +0 -25
- package/dist/enums.d.ts.map +0 -1
- package/dist/enums.js +0 -25
- package/dist/enums.js.map +0 -1
- package/dist/hooks-alova.d.ts +0 -23
- package/dist/hooks-alova.d.ts.map +0 -1
- package/dist/hooks-alova.js +0 -39
- package/dist/hooks-alova.js.map +0 -1
- package/dist/hooks-react.d.ts +0 -89
- package/dist/hooks-react.d.ts.map +0 -1
- package/dist/hooks-react.js +0 -340
- package/dist/hooks-react.js.map +0 -1
- package/dist/index.d.ts +0 -2452
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1441
- package/dist/index.js.map +0 -1
- package/dist/patches-fetchEventSource.d.ts +0 -806
- package/dist/patches-fetchEventSource.d.ts.map +0 -1
- package/dist/patches-fetchEventSource.js +0 -315
- package/dist/patches-fetchEventSource.js.map +0 -1
- package/dist/vite.d.ts +0 -13
- package/dist/vite.d.ts.map +0 -1
- package/dist/vite.js +0 -23
- package/dist/vite.js.map +0 -1
- package/dist/zod.d.ts +0 -105
- package/dist/zod.d.ts.map +0 -1
- package/dist/zod.js +0 -138
- package/dist/zod.js.map +0 -1
- package/metadata.json +0 -161
|
@@ -0,0 +1,4419 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
|
|
3
|
+
/** Detect free variable `global` from Node.js. */
|
|
4
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js
|
|
7
|
+
/** Detect free variable `self`. */
|
|
8
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
9
|
+
/** Used as a reference to the global object. */
|
|
10
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js
|
|
13
|
+
/** Built-in value references. */
|
|
14
|
+
var Symbol$1 = root.Symbol;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js
|
|
17
|
+
/** Used for built-in method references. */
|
|
18
|
+
var objectProto$3 = Object.prototype;
|
|
19
|
+
/** Used to check objects for own properties. */
|
|
20
|
+
var hasOwnProperty$12 = objectProto$3.hasOwnProperty;
|
|
21
|
+
/**
|
|
22
|
+
* Used to resolve the
|
|
23
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
24
|
+
* of values.
|
|
25
|
+
*/
|
|
26
|
+
var nativeObjectToString$1 = objectProto$3.toString;
|
|
27
|
+
/** Built-in value references. */
|
|
28
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
29
|
+
/**
|
|
30
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @param {*} value The value to query.
|
|
34
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
35
|
+
*/
|
|
36
|
+
function getRawTag(value) {
|
|
37
|
+
var isOwn = hasOwnProperty$12.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
38
|
+
try {
|
|
39
|
+
value[symToStringTag$1] = void 0;
|
|
40
|
+
var unmasked = true;
|
|
41
|
+
} catch (e) {}
|
|
42
|
+
var result = nativeObjectToString$1.call(value);
|
|
43
|
+
if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
|
|
44
|
+
else delete value[symToStringTag$1];
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
|
|
49
|
+
/**
|
|
50
|
+
* Used to resolve the
|
|
51
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
52
|
+
* of values.
|
|
53
|
+
*/
|
|
54
|
+
var nativeObjectToString = Object.prototype.toString;
|
|
55
|
+
/**
|
|
56
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param {*} value The value to convert.
|
|
60
|
+
* @returns {string} Returns the converted string.
|
|
61
|
+
*/
|
|
62
|
+
function objectToString(value) {
|
|
63
|
+
return nativeObjectToString.call(value);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
|
|
67
|
+
/** `Object#toString` result references. */
|
|
68
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
69
|
+
/** Built-in value references. */
|
|
70
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
71
|
+
/**
|
|
72
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
73
|
+
*
|
|
74
|
+
* @private
|
|
75
|
+
* @param {*} value The value to query.
|
|
76
|
+
* @returns {string} Returns the `toStringTag`.
|
|
77
|
+
*/
|
|
78
|
+
function baseGetTag(value) {
|
|
79
|
+
if (value == null) return value === void 0 ? undefinedTag : nullTag;
|
|
80
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
|
|
84
|
+
/**
|
|
85
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
86
|
+
* and has a `typeof` result of "object".
|
|
87
|
+
*
|
|
88
|
+
* @static
|
|
89
|
+
* @memberOf _
|
|
90
|
+
* @since 4.0.0
|
|
91
|
+
* @category Lang
|
|
92
|
+
* @param {*} value The value to check.
|
|
93
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
94
|
+
* @example
|
|
95
|
+
*
|
|
96
|
+
* _.isObjectLike({});
|
|
97
|
+
* // => true
|
|
98
|
+
*
|
|
99
|
+
* _.isObjectLike([1, 2, 3]);
|
|
100
|
+
* // => true
|
|
101
|
+
*
|
|
102
|
+
* _.isObjectLike(_.noop);
|
|
103
|
+
* // => false
|
|
104
|
+
*
|
|
105
|
+
* _.isObjectLike(null);
|
|
106
|
+
* // => false
|
|
107
|
+
*/
|
|
108
|
+
function isObjectLike(value) {
|
|
109
|
+
return value != null && typeof value == "object";
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js
|
|
113
|
+
/**
|
|
114
|
+
* Checks if `value` is classified as an `Array` object.
|
|
115
|
+
*
|
|
116
|
+
* @static
|
|
117
|
+
* @memberOf _
|
|
118
|
+
* @since 0.1.0
|
|
119
|
+
* @category Lang
|
|
120
|
+
* @param {*} value The value to check.
|
|
121
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
122
|
+
* @example
|
|
123
|
+
*
|
|
124
|
+
* _.isArray([1, 2, 3]);
|
|
125
|
+
* // => true
|
|
126
|
+
*
|
|
127
|
+
* _.isArray(document.body.children);
|
|
128
|
+
* // => false
|
|
129
|
+
*
|
|
130
|
+
* _.isArray('abc');
|
|
131
|
+
* // => false
|
|
132
|
+
*
|
|
133
|
+
* _.isArray(_.noop);
|
|
134
|
+
* // => false
|
|
135
|
+
*/
|
|
136
|
+
var isArray = Array.isArray;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
|
|
139
|
+
/**
|
|
140
|
+
* Checks if `value` is the
|
|
141
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
142
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
143
|
+
*
|
|
144
|
+
* @static
|
|
145
|
+
* @memberOf _
|
|
146
|
+
* @since 0.1.0
|
|
147
|
+
* @category Lang
|
|
148
|
+
* @param {*} value The value to check.
|
|
149
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
150
|
+
* @example
|
|
151
|
+
*
|
|
152
|
+
* _.isObject({});
|
|
153
|
+
* // => true
|
|
154
|
+
*
|
|
155
|
+
* _.isObject([1, 2, 3]);
|
|
156
|
+
* // => true
|
|
157
|
+
*
|
|
158
|
+
* _.isObject(_.noop);
|
|
159
|
+
* // => true
|
|
160
|
+
*
|
|
161
|
+
* _.isObject(null);
|
|
162
|
+
* // => false
|
|
163
|
+
*/
|
|
164
|
+
function isObject(value) {
|
|
165
|
+
var type = typeof value;
|
|
166
|
+
return value != null && (type == "object" || type == "function");
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/identity.js
|
|
170
|
+
/**
|
|
171
|
+
* This method returns the first argument it receives.
|
|
172
|
+
*
|
|
173
|
+
* @static
|
|
174
|
+
* @since 0.1.0
|
|
175
|
+
* @memberOf _
|
|
176
|
+
* @category Util
|
|
177
|
+
* @param {*} value Any value.
|
|
178
|
+
* @returns {*} Returns `value`.
|
|
179
|
+
* @example
|
|
180
|
+
*
|
|
181
|
+
* var object = { 'a': 1 };
|
|
182
|
+
*
|
|
183
|
+
* console.log(_.identity(object) === object);
|
|
184
|
+
* // => true
|
|
185
|
+
*/
|
|
186
|
+
function identity(value) {
|
|
187
|
+
return value;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js
|
|
191
|
+
/** `Object#toString` result references. */
|
|
192
|
+
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
193
|
+
/**
|
|
194
|
+
* Checks if `value` is classified as a `Function` object.
|
|
195
|
+
*
|
|
196
|
+
* @static
|
|
197
|
+
* @memberOf _
|
|
198
|
+
* @since 0.1.0
|
|
199
|
+
* @category Lang
|
|
200
|
+
* @param {*} value The value to check.
|
|
201
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
202
|
+
* @example
|
|
203
|
+
*
|
|
204
|
+
* _.isFunction(_);
|
|
205
|
+
* // => true
|
|
206
|
+
*
|
|
207
|
+
* _.isFunction(/abc/);
|
|
208
|
+
* // => false
|
|
209
|
+
*/
|
|
210
|
+
function isFunction(value) {
|
|
211
|
+
if (!isObject(value)) return false;
|
|
212
|
+
var tag = baseGetTag(value);
|
|
213
|
+
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js
|
|
217
|
+
/** Used to detect overreaching core-js shims. */
|
|
218
|
+
var coreJsData = root["__core-js_shared__"];
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js
|
|
221
|
+
/** Used to detect methods masquerading as native. */
|
|
222
|
+
var maskSrcKey = function() {
|
|
223
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
224
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
225
|
+
}();
|
|
226
|
+
/**
|
|
227
|
+
* Checks if `func` has its source masked.
|
|
228
|
+
*
|
|
229
|
+
* @private
|
|
230
|
+
* @param {Function} func The function to check.
|
|
231
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
232
|
+
*/
|
|
233
|
+
function isMasked(func) {
|
|
234
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js
|
|
238
|
+
/** Used to resolve the decompiled source of functions. */
|
|
239
|
+
var funcToString$1 = Function.prototype.toString;
|
|
240
|
+
/**
|
|
241
|
+
* Converts `func` to its source code.
|
|
242
|
+
*
|
|
243
|
+
* @private
|
|
244
|
+
* @param {Function} func The function to convert.
|
|
245
|
+
* @returns {string} Returns the source code.
|
|
246
|
+
*/
|
|
247
|
+
function toSource(func) {
|
|
248
|
+
if (func != null) {
|
|
249
|
+
try {
|
|
250
|
+
return funcToString$1.call(func);
|
|
251
|
+
} catch (e) {}
|
|
252
|
+
try {
|
|
253
|
+
return func + "";
|
|
254
|
+
} catch (e) {}
|
|
255
|
+
}
|
|
256
|
+
return "";
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js
|
|
260
|
+
/**
|
|
261
|
+
* Used to match `RegExp`
|
|
262
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
263
|
+
*/
|
|
264
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
265
|
+
/** Used to detect host constructors (Safari). */
|
|
266
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
267
|
+
/** Used for built-in method references. */
|
|
268
|
+
var funcProto = Function.prototype, objectProto$2 = Object.prototype;
|
|
269
|
+
/** Used to resolve the decompiled source of functions. */
|
|
270
|
+
var funcToString = funcProto.toString;
|
|
271
|
+
/** Used to check objects for own properties. */
|
|
272
|
+
var hasOwnProperty$11 = objectProto$2.hasOwnProperty;
|
|
273
|
+
/** Used to detect if a method is native. */
|
|
274
|
+
var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$11).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
275
|
+
/**
|
|
276
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
277
|
+
*
|
|
278
|
+
* @private
|
|
279
|
+
* @param {*} value The value to check.
|
|
280
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
281
|
+
* else `false`.
|
|
282
|
+
*/
|
|
283
|
+
function baseIsNative(value) {
|
|
284
|
+
if (!isObject(value) || isMasked(value)) return false;
|
|
285
|
+
return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
|
|
289
|
+
/**
|
|
290
|
+
* Gets the value at `key` of `object`.
|
|
291
|
+
*
|
|
292
|
+
* @private
|
|
293
|
+
* @param {Object} [object] The object to query.
|
|
294
|
+
* @param {string} key The key of the property to get.
|
|
295
|
+
* @returns {*} Returns the property value.
|
|
296
|
+
*/
|
|
297
|
+
function getValue(object, key) {
|
|
298
|
+
return object == null ? void 0 : object[key];
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js
|
|
302
|
+
/**
|
|
303
|
+
* Gets the native function at `key` of `object`.
|
|
304
|
+
*
|
|
305
|
+
* @private
|
|
306
|
+
* @param {Object} object The object to query.
|
|
307
|
+
* @param {string} key The key of the method to get.
|
|
308
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
309
|
+
*/
|
|
310
|
+
function getNative(object, key) {
|
|
311
|
+
var value = getValue(object, key);
|
|
312
|
+
return baseIsNative(value) ? value : void 0;
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js
|
|
316
|
+
var WeakMap$1 = getNative(root, "WeakMap");
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js
|
|
319
|
+
/** Built-in value references. */
|
|
320
|
+
var objectCreate = Object.create;
|
|
321
|
+
/**
|
|
322
|
+
* The base implementation of `_.create` without support for assigning
|
|
323
|
+
* properties to the created object.
|
|
324
|
+
*
|
|
325
|
+
* @private
|
|
326
|
+
* @param {Object} proto The object to inherit from.
|
|
327
|
+
* @returns {Object} Returns the new object.
|
|
328
|
+
*/
|
|
329
|
+
var baseCreate = function() {
|
|
330
|
+
function object() {}
|
|
331
|
+
return function(proto) {
|
|
332
|
+
if (!isObject(proto)) return {};
|
|
333
|
+
if (objectCreate) return objectCreate(proto);
|
|
334
|
+
object.prototype = proto;
|
|
335
|
+
var result = new object();
|
|
336
|
+
object.prototype = void 0;
|
|
337
|
+
return result;
|
|
338
|
+
};
|
|
339
|
+
}();
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_apply.js
|
|
342
|
+
/**
|
|
343
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
344
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
345
|
+
*
|
|
346
|
+
* @private
|
|
347
|
+
* @param {Function} func The function to invoke.
|
|
348
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
349
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
350
|
+
* @returns {*} Returns the result of `func`.
|
|
351
|
+
*/
|
|
352
|
+
function apply(func, thisArg, args) {
|
|
353
|
+
switch (args.length) {
|
|
354
|
+
case 0: return func.call(thisArg);
|
|
355
|
+
case 1: return func.call(thisArg, args[0]);
|
|
356
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
357
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
358
|
+
}
|
|
359
|
+
return func.apply(thisArg, args);
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js
|
|
363
|
+
/**
|
|
364
|
+
* Copies the values of `source` to `array`.
|
|
365
|
+
*
|
|
366
|
+
* @private
|
|
367
|
+
* @param {Array} source The array to copy values from.
|
|
368
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
369
|
+
* @returns {Array} Returns `array`.
|
|
370
|
+
*/
|
|
371
|
+
function copyArray(source, array) {
|
|
372
|
+
var index = -1, length = source.length;
|
|
373
|
+
array || (array = Array(length));
|
|
374
|
+
while (++index < length) array[index] = source[index];
|
|
375
|
+
return array;
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js
|
|
379
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
380
|
+
var HOT_COUNT = 800, HOT_SPAN = 16;
|
|
381
|
+
var nativeNow = Date.now;
|
|
382
|
+
/**
|
|
383
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
384
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
385
|
+
* milliseconds.
|
|
386
|
+
*
|
|
387
|
+
* @private
|
|
388
|
+
* @param {Function} func The function to restrict.
|
|
389
|
+
* @returns {Function} Returns the new shortable function.
|
|
390
|
+
*/
|
|
391
|
+
function shortOut(func) {
|
|
392
|
+
var count = 0, lastCalled = 0;
|
|
393
|
+
return function() {
|
|
394
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
395
|
+
lastCalled = stamp;
|
|
396
|
+
if (remaining > 0) {
|
|
397
|
+
if (++count >= HOT_COUNT) return arguments[0];
|
|
398
|
+
} else count = 0;
|
|
399
|
+
return func.apply(void 0, arguments);
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/constant.js
|
|
404
|
+
/**
|
|
405
|
+
* Creates a function that returns `value`.
|
|
406
|
+
*
|
|
407
|
+
* @static
|
|
408
|
+
* @memberOf _
|
|
409
|
+
* @since 2.4.0
|
|
410
|
+
* @category Util
|
|
411
|
+
* @param {*} value The value to return from the new function.
|
|
412
|
+
* @returns {Function} Returns the new constant function.
|
|
413
|
+
* @example
|
|
414
|
+
*
|
|
415
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
416
|
+
*
|
|
417
|
+
* console.log(objects);
|
|
418
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
419
|
+
*
|
|
420
|
+
* console.log(objects[0] === objects[1]);
|
|
421
|
+
* // => true
|
|
422
|
+
*/
|
|
423
|
+
function constant(value) {
|
|
424
|
+
return function() {
|
|
425
|
+
return value;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js
|
|
430
|
+
var defineProperty = function() {
|
|
431
|
+
try {
|
|
432
|
+
var func = getNative(Object, "defineProperty");
|
|
433
|
+
func({}, "", {});
|
|
434
|
+
return func;
|
|
435
|
+
} catch (e) {}
|
|
436
|
+
}();
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js
|
|
439
|
+
/**
|
|
440
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
441
|
+
*
|
|
442
|
+
* @private
|
|
443
|
+
* @param {Function} func The function to modify.
|
|
444
|
+
* @param {Function} string The `toString` result.
|
|
445
|
+
* @returns {Function} Returns `func`.
|
|
446
|
+
*/
|
|
447
|
+
var setToString = shortOut(!defineProperty ? identity : function(func, string) {
|
|
448
|
+
return defineProperty(func, "toString", {
|
|
449
|
+
"configurable": true,
|
|
450
|
+
"enumerable": false,
|
|
451
|
+
"value": constant(string),
|
|
452
|
+
"writable": true
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js
|
|
457
|
+
/**
|
|
458
|
+
* A specialized version of `_.forEach` for arrays without support for
|
|
459
|
+
* iteratee shorthands.
|
|
460
|
+
*
|
|
461
|
+
* @private
|
|
462
|
+
* @param {Array} [array] The array to iterate over.
|
|
463
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
464
|
+
* @returns {Array} Returns `array`.
|
|
465
|
+
*/
|
|
466
|
+
function arrayEach(array, iteratee) {
|
|
467
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
468
|
+
while (++index < length) if (iteratee(array[index], index, array) === false) break;
|
|
469
|
+
return array;
|
|
470
|
+
}
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js
|
|
473
|
+
/** Used as references for various `Number` constants. */
|
|
474
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
475
|
+
/** Used to detect unsigned integer values. */
|
|
476
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
477
|
+
/**
|
|
478
|
+
* Checks if `value` is a valid array-like index.
|
|
479
|
+
*
|
|
480
|
+
* @private
|
|
481
|
+
* @param {*} value The value to check.
|
|
482
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
483
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
484
|
+
*/
|
|
485
|
+
function isIndex(value, length) {
|
|
486
|
+
var type = typeof value;
|
|
487
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
488
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
|
|
489
|
+
}
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js
|
|
492
|
+
/**
|
|
493
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
494
|
+
* value checks.
|
|
495
|
+
*
|
|
496
|
+
* @private
|
|
497
|
+
* @param {Object} object The object to modify.
|
|
498
|
+
* @param {string} key The key of the property to assign.
|
|
499
|
+
* @param {*} value The value to assign.
|
|
500
|
+
*/
|
|
501
|
+
function baseAssignValue(object, key, value) {
|
|
502
|
+
if (key == "__proto__" && defineProperty) defineProperty(object, key, {
|
|
503
|
+
"configurable": true,
|
|
504
|
+
"enumerable": true,
|
|
505
|
+
"value": value,
|
|
506
|
+
"writable": true
|
|
507
|
+
});
|
|
508
|
+
else object[key] = value;
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js
|
|
512
|
+
/**
|
|
513
|
+
* Performs a
|
|
514
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
515
|
+
* comparison between two values to determine if they are equivalent.
|
|
516
|
+
*
|
|
517
|
+
* @static
|
|
518
|
+
* @memberOf _
|
|
519
|
+
* @since 4.0.0
|
|
520
|
+
* @category Lang
|
|
521
|
+
* @param {*} value The value to compare.
|
|
522
|
+
* @param {*} other The other value to compare.
|
|
523
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
524
|
+
* @example
|
|
525
|
+
*
|
|
526
|
+
* var object = { 'a': 1 };
|
|
527
|
+
* var other = { 'a': 1 };
|
|
528
|
+
*
|
|
529
|
+
* _.eq(object, object);
|
|
530
|
+
* // => true
|
|
531
|
+
*
|
|
532
|
+
* _.eq(object, other);
|
|
533
|
+
* // => false
|
|
534
|
+
*
|
|
535
|
+
* _.eq('a', 'a');
|
|
536
|
+
* // => true
|
|
537
|
+
*
|
|
538
|
+
* _.eq('a', Object('a'));
|
|
539
|
+
* // => false
|
|
540
|
+
*
|
|
541
|
+
* _.eq(NaN, NaN);
|
|
542
|
+
* // => true
|
|
543
|
+
*/
|
|
544
|
+
function eq(value, other) {
|
|
545
|
+
return value === other || value !== value && other !== other;
|
|
546
|
+
}
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js
|
|
549
|
+
/** Used to check objects for own properties. */
|
|
550
|
+
var hasOwnProperty$10 = Object.prototype.hasOwnProperty;
|
|
551
|
+
/**
|
|
552
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
553
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
554
|
+
* for equality comparisons.
|
|
555
|
+
*
|
|
556
|
+
* @private
|
|
557
|
+
* @param {Object} object The object to modify.
|
|
558
|
+
* @param {string} key The key of the property to assign.
|
|
559
|
+
* @param {*} value The value to assign.
|
|
560
|
+
*/
|
|
561
|
+
function assignValue(object, key, value) {
|
|
562
|
+
var objValue = object[key];
|
|
563
|
+
if (!(hasOwnProperty$10.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
|
|
564
|
+
}
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js
|
|
567
|
+
/**
|
|
568
|
+
* Copies properties of `source` to `object`.
|
|
569
|
+
*
|
|
570
|
+
* @private
|
|
571
|
+
* @param {Object} source The object to copy properties from.
|
|
572
|
+
* @param {Array} props The property identifiers to copy.
|
|
573
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
574
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
575
|
+
* @returns {Object} Returns `object`.
|
|
576
|
+
*/
|
|
577
|
+
function copyObject(source, props, object, customizer) {
|
|
578
|
+
var isNew = !object;
|
|
579
|
+
object || (object = {});
|
|
580
|
+
var index = -1, length = props.length;
|
|
581
|
+
while (++index < length) {
|
|
582
|
+
var key = props[index];
|
|
583
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
584
|
+
if (newValue === void 0) newValue = source[key];
|
|
585
|
+
if (isNew) baseAssignValue(object, key, newValue);
|
|
586
|
+
else assignValue(object, key, newValue);
|
|
587
|
+
}
|
|
588
|
+
return object;
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js
|
|
592
|
+
var nativeMax = Math.max;
|
|
593
|
+
/**
|
|
594
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
595
|
+
*
|
|
596
|
+
* @private
|
|
597
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
598
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
599
|
+
* @param {Function} transform The rest array transform.
|
|
600
|
+
* @returns {Function} Returns the new function.
|
|
601
|
+
*/
|
|
602
|
+
function overRest(func, start, transform) {
|
|
603
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
604
|
+
return function() {
|
|
605
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
606
|
+
while (++index < length) array[index] = args[start + index];
|
|
607
|
+
index = -1;
|
|
608
|
+
var otherArgs = Array(start + 1);
|
|
609
|
+
while (++index < start) otherArgs[index] = args[index];
|
|
610
|
+
otherArgs[start] = transform(array);
|
|
611
|
+
return apply(func, this, otherArgs);
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js
|
|
616
|
+
/**
|
|
617
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
618
|
+
*
|
|
619
|
+
* @private
|
|
620
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
621
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
622
|
+
* @returns {Function} Returns the new function.
|
|
623
|
+
*/
|
|
624
|
+
function baseRest(func, start) {
|
|
625
|
+
return setToString(overRest(func, start, identity), func + "");
|
|
626
|
+
}
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js
|
|
629
|
+
/** Used as references for various `Number` constants. */
|
|
630
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
631
|
+
/**
|
|
632
|
+
* Checks if `value` is a valid array-like length.
|
|
633
|
+
*
|
|
634
|
+
* **Note:** This method is loosely based on
|
|
635
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
636
|
+
*
|
|
637
|
+
* @static
|
|
638
|
+
* @memberOf _
|
|
639
|
+
* @since 4.0.0
|
|
640
|
+
* @category Lang
|
|
641
|
+
* @param {*} value The value to check.
|
|
642
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
643
|
+
* @example
|
|
644
|
+
*
|
|
645
|
+
* _.isLength(3);
|
|
646
|
+
* // => true
|
|
647
|
+
*
|
|
648
|
+
* _.isLength(Number.MIN_VALUE);
|
|
649
|
+
* // => false
|
|
650
|
+
*
|
|
651
|
+
* _.isLength(Infinity);
|
|
652
|
+
* // => false
|
|
653
|
+
*
|
|
654
|
+
* _.isLength('3');
|
|
655
|
+
* // => false
|
|
656
|
+
*/
|
|
657
|
+
function isLength(value) {
|
|
658
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js
|
|
662
|
+
/**
|
|
663
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
664
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
665
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
666
|
+
*
|
|
667
|
+
* @static
|
|
668
|
+
* @memberOf _
|
|
669
|
+
* @since 4.0.0
|
|
670
|
+
* @category Lang
|
|
671
|
+
* @param {*} value The value to check.
|
|
672
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
673
|
+
* @example
|
|
674
|
+
*
|
|
675
|
+
* _.isArrayLike([1, 2, 3]);
|
|
676
|
+
* // => true
|
|
677
|
+
*
|
|
678
|
+
* _.isArrayLike(document.body.children);
|
|
679
|
+
* // => true
|
|
680
|
+
*
|
|
681
|
+
* _.isArrayLike('abc');
|
|
682
|
+
* // => true
|
|
683
|
+
*
|
|
684
|
+
* _.isArrayLike(_.noop);
|
|
685
|
+
* // => false
|
|
686
|
+
*/
|
|
687
|
+
function isArrayLike(value) {
|
|
688
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
689
|
+
}
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js
|
|
692
|
+
/**
|
|
693
|
+
* Checks if the given arguments are from an iteratee call.
|
|
694
|
+
*
|
|
695
|
+
* @private
|
|
696
|
+
* @param {*} value The potential iteratee value argument.
|
|
697
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
698
|
+
* @param {*} object The potential iteratee object argument.
|
|
699
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
700
|
+
* else `false`.
|
|
701
|
+
*/
|
|
702
|
+
function isIterateeCall(value, index, object) {
|
|
703
|
+
if (!isObject(object)) return false;
|
|
704
|
+
var type = typeof index;
|
|
705
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
|
|
706
|
+
return false;
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js
|
|
710
|
+
/**
|
|
711
|
+
* Creates a function like `_.assign`.
|
|
712
|
+
*
|
|
713
|
+
* @private
|
|
714
|
+
* @param {Function} assigner The function to assign values.
|
|
715
|
+
* @returns {Function} Returns the new assigner function.
|
|
716
|
+
*/
|
|
717
|
+
function createAssigner(assigner) {
|
|
718
|
+
return baseRest(function(object, sources) {
|
|
719
|
+
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
720
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
|
|
721
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
722
|
+
customizer = length < 3 ? void 0 : customizer;
|
|
723
|
+
length = 1;
|
|
724
|
+
}
|
|
725
|
+
object = Object(object);
|
|
726
|
+
while (++index < length) {
|
|
727
|
+
var source = sources[index];
|
|
728
|
+
if (source) assigner(object, source, index, customizer);
|
|
729
|
+
}
|
|
730
|
+
return object;
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
//#endregion
|
|
734
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js
|
|
735
|
+
/** Used for built-in method references. */
|
|
736
|
+
var objectProto$1 = Object.prototype;
|
|
737
|
+
/**
|
|
738
|
+
* Checks if `value` is likely a prototype object.
|
|
739
|
+
*
|
|
740
|
+
* @private
|
|
741
|
+
* @param {*} value The value to check.
|
|
742
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
743
|
+
*/
|
|
744
|
+
function isPrototype(value) {
|
|
745
|
+
var Ctor = value && value.constructor;
|
|
746
|
+
return value === (typeof Ctor == "function" && Ctor.prototype || objectProto$1);
|
|
747
|
+
}
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js
|
|
750
|
+
/**
|
|
751
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
752
|
+
* or max array length checks.
|
|
753
|
+
*
|
|
754
|
+
* @private
|
|
755
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
756
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
757
|
+
* @returns {Array} Returns the array of results.
|
|
758
|
+
*/
|
|
759
|
+
function baseTimes(n, iteratee) {
|
|
760
|
+
var index = -1, result = Array(n);
|
|
761
|
+
while (++index < n) result[index] = iteratee(index);
|
|
762
|
+
return result;
|
|
763
|
+
}
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js
|
|
766
|
+
/** `Object#toString` result references. */
|
|
767
|
+
var argsTag$3 = "[object Arguments]";
|
|
768
|
+
/**
|
|
769
|
+
* The base implementation of `_.isArguments`.
|
|
770
|
+
*
|
|
771
|
+
* @private
|
|
772
|
+
* @param {*} value The value to check.
|
|
773
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
774
|
+
*/
|
|
775
|
+
function baseIsArguments(value) {
|
|
776
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$3;
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js
|
|
780
|
+
/** Used for built-in method references. */
|
|
781
|
+
var objectProto = Object.prototype;
|
|
782
|
+
/** Used to check objects for own properties. */
|
|
783
|
+
var hasOwnProperty$9 = objectProto.hasOwnProperty;
|
|
784
|
+
/** Built-in value references. */
|
|
785
|
+
var propertyIsEnumerable$1 = objectProto.propertyIsEnumerable;
|
|
786
|
+
/**
|
|
787
|
+
* Checks if `value` is likely an `arguments` object.
|
|
788
|
+
*
|
|
789
|
+
* @static
|
|
790
|
+
* @memberOf _
|
|
791
|
+
* @since 0.1.0
|
|
792
|
+
* @category Lang
|
|
793
|
+
* @param {*} value The value to check.
|
|
794
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
795
|
+
* else `false`.
|
|
796
|
+
* @example
|
|
797
|
+
*
|
|
798
|
+
* _.isArguments(function() { return arguments; }());
|
|
799
|
+
* // => true
|
|
800
|
+
*
|
|
801
|
+
* _.isArguments([1, 2, 3]);
|
|
802
|
+
* // => false
|
|
803
|
+
*/
|
|
804
|
+
var isArguments = baseIsArguments(function() {
|
|
805
|
+
return arguments;
|
|
806
|
+
}()) ? baseIsArguments : function(value) {
|
|
807
|
+
return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
808
|
+
};
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js
|
|
811
|
+
/**
|
|
812
|
+
* This method returns `false`.
|
|
813
|
+
*
|
|
814
|
+
* @static
|
|
815
|
+
* @memberOf _
|
|
816
|
+
* @since 4.13.0
|
|
817
|
+
* @category Util
|
|
818
|
+
* @returns {boolean} Returns `false`.
|
|
819
|
+
* @example
|
|
820
|
+
*
|
|
821
|
+
* _.times(2, _.stubFalse);
|
|
822
|
+
* // => [false, false]
|
|
823
|
+
*/
|
|
824
|
+
function stubFalse() {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js
|
|
829
|
+
/** Detect free variable `exports`. */
|
|
830
|
+
var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
831
|
+
/** Detect free variable `module`. */
|
|
832
|
+
var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
|
|
833
|
+
/** Built-in value references. */
|
|
834
|
+
var Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? root.Buffer : void 0;
|
|
835
|
+
/**
|
|
836
|
+
* Checks if `value` is a buffer.
|
|
837
|
+
*
|
|
838
|
+
* @static
|
|
839
|
+
* @memberOf _
|
|
840
|
+
* @since 4.3.0
|
|
841
|
+
* @category Lang
|
|
842
|
+
* @param {*} value The value to check.
|
|
843
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
844
|
+
* @example
|
|
845
|
+
*
|
|
846
|
+
* _.isBuffer(new Buffer(2));
|
|
847
|
+
* // => true
|
|
848
|
+
*
|
|
849
|
+
* _.isBuffer(new Uint8Array(2));
|
|
850
|
+
* // => false
|
|
851
|
+
*/
|
|
852
|
+
var isBuffer = (Buffer$1 ? Buffer$1.isBuffer : void 0) || stubFalse;
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js
|
|
855
|
+
/** `Object#toString` result references. */
|
|
856
|
+
var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
|
|
857
|
+
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
|
|
858
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
859
|
+
var typedArrayTags = {};
|
|
860
|
+
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
|
|
861
|
+
typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
|
|
862
|
+
/**
|
|
863
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
864
|
+
*
|
|
865
|
+
* @private
|
|
866
|
+
* @param {*} value The value to check.
|
|
867
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
868
|
+
*/
|
|
869
|
+
function baseIsTypedArray(value) {
|
|
870
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
871
|
+
}
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js
|
|
874
|
+
/**
|
|
875
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
876
|
+
*
|
|
877
|
+
* @private
|
|
878
|
+
* @param {Function} func The function to cap arguments for.
|
|
879
|
+
* @returns {Function} Returns the new capped function.
|
|
880
|
+
*/
|
|
881
|
+
function baseUnary(func) {
|
|
882
|
+
return function(value) {
|
|
883
|
+
return func(value);
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
//#endregion
|
|
887
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js
|
|
888
|
+
/** Detect free variable `exports`. */
|
|
889
|
+
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
890
|
+
/** Detect free variable `module`. */
|
|
891
|
+
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
|
|
892
|
+
/** Detect free variable `process` from Node.js. */
|
|
893
|
+
var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && freeGlobal.process;
|
|
894
|
+
/** Used to access faster Node.js helpers. */
|
|
895
|
+
var nodeUtil = function() {
|
|
896
|
+
try {
|
|
897
|
+
var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
|
|
898
|
+
if (types) return types;
|
|
899
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
900
|
+
} catch (e) {}
|
|
901
|
+
}();
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js
|
|
904
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
905
|
+
/**
|
|
906
|
+
* Checks if `value` is classified as a typed array.
|
|
907
|
+
*
|
|
908
|
+
* @static
|
|
909
|
+
* @memberOf _
|
|
910
|
+
* @since 3.0.0
|
|
911
|
+
* @category Lang
|
|
912
|
+
* @param {*} value The value to check.
|
|
913
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
914
|
+
* @example
|
|
915
|
+
*
|
|
916
|
+
* _.isTypedArray(new Uint8Array);
|
|
917
|
+
* // => true
|
|
918
|
+
*
|
|
919
|
+
* _.isTypedArray([]);
|
|
920
|
+
* // => false
|
|
921
|
+
*/
|
|
922
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
923
|
+
//#endregion
|
|
924
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js
|
|
925
|
+
/** Used to check objects for own properties. */
|
|
926
|
+
var hasOwnProperty$8 = Object.prototype.hasOwnProperty;
|
|
927
|
+
/**
|
|
928
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
929
|
+
*
|
|
930
|
+
* @private
|
|
931
|
+
* @param {*} value The value to query.
|
|
932
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
933
|
+
* @returns {Array} Returns the array of property names.
|
|
934
|
+
*/
|
|
935
|
+
function arrayLikeKeys(value, inherited) {
|
|
936
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
937
|
+
for (var key in value) if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
|
|
938
|
+
return result;
|
|
939
|
+
}
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js
|
|
942
|
+
/**
|
|
943
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
944
|
+
*
|
|
945
|
+
* @private
|
|
946
|
+
* @param {Function} func The function to wrap.
|
|
947
|
+
* @param {Function} transform The argument transform.
|
|
948
|
+
* @returns {Function} Returns the new function.
|
|
949
|
+
*/
|
|
950
|
+
function overArg(func, transform) {
|
|
951
|
+
return function(arg) {
|
|
952
|
+
return func(transform(arg));
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js
|
|
957
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js
|
|
960
|
+
/** Used to check objects for own properties. */
|
|
961
|
+
var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
|
|
962
|
+
/**
|
|
963
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
964
|
+
*
|
|
965
|
+
* @private
|
|
966
|
+
* @param {Object} object The object to query.
|
|
967
|
+
* @returns {Array} Returns the array of property names.
|
|
968
|
+
*/
|
|
969
|
+
function baseKeys(object) {
|
|
970
|
+
if (!isPrototype(object)) return nativeKeys(object);
|
|
971
|
+
var result = [];
|
|
972
|
+
for (var key in Object(object)) if (hasOwnProperty$7.call(object, key) && key != "constructor") result.push(key);
|
|
973
|
+
return result;
|
|
974
|
+
}
|
|
975
|
+
//#endregion
|
|
976
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js
|
|
977
|
+
/**
|
|
978
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
979
|
+
*
|
|
980
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
981
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
982
|
+
* for more details.
|
|
983
|
+
*
|
|
984
|
+
* @static
|
|
985
|
+
* @since 0.1.0
|
|
986
|
+
* @memberOf _
|
|
987
|
+
* @category Object
|
|
988
|
+
* @param {Object} object The object to query.
|
|
989
|
+
* @returns {Array} Returns the array of property names.
|
|
990
|
+
* @example
|
|
991
|
+
*
|
|
992
|
+
* function Foo() {
|
|
993
|
+
* this.a = 1;
|
|
994
|
+
* this.b = 2;
|
|
995
|
+
* }
|
|
996
|
+
*
|
|
997
|
+
* Foo.prototype.c = 3;
|
|
998
|
+
*
|
|
999
|
+
* _.keys(new Foo);
|
|
1000
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1001
|
+
*
|
|
1002
|
+
* _.keys('hi');
|
|
1003
|
+
* // => ['0', '1']
|
|
1004
|
+
*/
|
|
1005
|
+
function keys(object) {
|
|
1006
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1007
|
+
}
|
|
1008
|
+
//#endregion
|
|
1009
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/assign.js
|
|
1010
|
+
/** Used to check objects for own properties. */
|
|
1011
|
+
var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
|
|
1012
|
+
/**
|
|
1013
|
+
* Assigns own enumerable string keyed properties of source objects to the
|
|
1014
|
+
* destination object. Source objects are applied from left to right.
|
|
1015
|
+
* Subsequent sources overwrite property assignments of previous sources.
|
|
1016
|
+
*
|
|
1017
|
+
* **Note:** This method mutates `object` and is loosely based on
|
|
1018
|
+
* [`Object.assign`](https://mdn.io/Object/assign).
|
|
1019
|
+
*
|
|
1020
|
+
* @static
|
|
1021
|
+
* @memberOf _
|
|
1022
|
+
* @since 0.10.0
|
|
1023
|
+
* @category Object
|
|
1024
|
+
* @param {Object} object The destination object.
|
|
1025
|
+
* @param {...Object} [sources] The source objects.
|
|
1026
|
+
* @returns {Object} Returns `object`.
|
|
1027
|
+
* @see _.assignIn
|
|
1028
|
+
* @example
|
|
1029
|
+
*
|
|
1030
|
+
* function Foo() {
|
|
1031
|
+
* this.a = 1;
|
|
1032
|
+
* }
|
|
1033
|
+
*
|
|
1034
|
+
* function Bar() {
|
|
1035
|
+
* this.c = 3;
|
|
1036
|
+
* }
|
|
1037
|
+
*
|
|
1038
|
+
* Foo.prototype.b = 2;
|
|
1039
|
+
* Bar.prototype.d = 4;
|
|
1040
|
+
*
|
|
1041
|
+
* _.assign({ 'a': 0 }, new Foo, new Bar);
|
|
1042
|
+
* // => { 'a': 1, 'c': 3 }
|
|
1043
|
+
*/
|
|
1044
|
+
var assign = createAssigner(function(object, source) {
|
|
1045
|
+
if (isPrototype(source) || isArrayLike(source)) {
|
|
1046
|
+
copyObject(source, keys(source), object);
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
for (var key in source) if (hasOwnProperty$6.call(source, key)) assignValue(object, key, source[key]);
|
|
1050
|
+
});
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js
|
|
1053
|
+
/**
|
|
1054
|
+
* This function is like
|
|
1055
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1056
|
+
* except that it includes inherited enumerable properties.
|
|
1057
|
+
*
|
|
1058
|
+
* @private
|
|
1059
|
+
* @param {Object} object The object to query.
|
|
1060
|
+
* @returns {Array} Returns the array of property names.
|
|
1061
|
+
*/
|
|
1062
|
+
function nativeKeysIn(object) {
|
|
1063
|
+
var result = [];
|
|
1064
|
+
if (object != null) for (var key in Object(object)) result.push(key);
|
|
1065
|
+
return result;
|
|
1066
|
+
}
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js
|
|
1069
|
+
/** Used to check objects for own properties. */
|
|
1070
|
+
var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
|
|
1071
|
+
/**
|
|
1072
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
1073
|
+
*
|
|
1074
|
+
* @private
|
|
1075
|
+
* @param {Object} object The object to query.
|
|
1076
|
+
* @returns {Array} Returns the array of property names.
|
|
1077
|
+
*/
|
|
1078
|
+
function baseKeysIn(object) {
|
|
1079
|
+
if (!isObject(object)) return nativeKeysIn(object);
|
|
1080
|
+
var isProto = isPrototype(object), result = [];
|
|
1081
|
+
for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$5.call(object, key)))) result.push(key);
|
|
1082
|
+
return result;
|
|
1083
|
+
}
|
|
1084
|
+
//#endregion
|
|
1085
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js
|
|
1086
|
+
/**
|
|
1087
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
1088
|
+
*
|
|
1089
|
+
* **Note:** Non-object values are coerced to objects.
|
|
1090
|
+
*
|
|
1091
|
+
* @static
|
|
1092
|
+
* @memberOf _
|
|
1093
|
+
* @since 3.0.0
|
|
1094
|
+
* @category Object
|
|
1095
|
+
* @param {Object} object The object to query.
|
|
1096
|
+
* @returns {Array} Returns the array of property names.
|
|
1097
|
+
* @example
|
|
1098
|
+
*
|
|
1099
|
+
* function Foo() {
|
|
1100
|
+
* this.a = 1;
|
|
1101
|
+
* this.b = 2;
|
|
1102
|
+
* }
|
|
1103
|
+
*
|
|
1104
|
+
* Foo.prototype.c = 3;
|
|
1105
|
+
*
|
|
1106
|
+
* _.keysIn(new Foo);
|
|
1107
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
1108
|
+
*/
|
|
1109
|
+
function keysIn(object) {
|
|
1110
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
1111
|
+
}
|
|
1112
|
+
//#endregion
|
|
1113
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js
|
|
1114
|
+
var nativeCreate = getNative(Object, "create");
|
|
1115
|
+
//#endregion
|
|
1116
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js
|
|
1117
|
+
/**
|
|
1118
|
+
* Removes all key-value entries from the hash.
|
|
1119
|
+
*
|
|
1120
|
+
* @private
|
|
1121
|
+
* @name clear
|
|
1122
|
+
* @memberOf Hash
|
|
1123
|
+
*/
|
|
1124
|
+
function hashClear() {
|
|
1125
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
1126
|
+
this.size = 0;
|
|
1127
|
+
}
|
|
1128
|
+
//#endregion
|
|
1129
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js
|
|
1130
|
+
/**
|
|
1131
|
+
* Removes `key` and its value from the hash.
|
|
1132
|
+
*
|
|
1133
|
+
* @private
|
|
1134
|
+
* @name delete
|
|
1135
|
+
* @memberOf Hash
|
|
1136
|
+
* @param {Object} hash The hash to modify.
|
|
1137
|
+
* @param {string} key The key of the value to remove.
|
|
1138
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1139
|
+
*/
|
|
1140
|
+
function hashDelete(key) {
|
|
1141
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1142
|
+
this.size -= result ? 1 : 0;
|
|
1143
|
+
return result;
|
|
1144
|
+
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js
|
|
1147
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1148
|
+
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
|
|
1149
|
+
/** Used to check objects for own properties. */
|
|
1150
|
+
var hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
1151
|
+
/**
|
|
1152
|
+
* Gets the hash value for `key`.
|
|
1153
|
+
*
|
|
1154
|
+
* @private
|
|
1155
|
+
* @name get
|
|
1156
|
+
* @memberOf Hash
|
|
1157
|
+
* @param {string} key The key of the value to get.
|
|
1158
|
+
* @returns {*} Returns the entry value.
|
|
1159
|
+
*/
|
|
1160
|
+
function hashGet(key) {
|
|
1161
|
+
var data = this.__data__;
|
|
1162
|
+
if (nativeCreate) {
|
|
1163
|
+
var result = data[key];
|
|
1164
|
+
return result === HASH_UNDEFINED$2 ? void 0 : result;
|
|
1165
|
+
}
|
|
1166
|
+
return hasOwnProperty$4.call(data, key) ? data[key] : void 0;
|
|
1167
|
+
}
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js
|
|
1170
|
+
/** Used to check objects for own properties. */
|
|
1171
|
+
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1172
|
+
/**
|
|
1173
|
+
* Checks if a hash value for `key` exists.
|
|
1174
|
+
*
|
|
1175
|
+
* @private
|
|
1176
|
+
* @name has
|
|
1177
|
+
* @memberOf Hash
|
|
1178
|
+
* @param {string} key The key of the entry to check.
|
|
1179
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1180
|
+
*/
|
|
1181
|
+
function hashHas(key) {
|
|
1182
|
+
var data = this.__data__;
|
|
1183
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty$3.call(data, key);
|
|
1184
|
+
}
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js
|
|
1187
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1188
|
+
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
1189
|
+
/**
|
|
1190
|
+
* Sets the hash `key` to `value`.
|
|
1191
|
+
*
|
|
1192
|
+
* @private
|
|
1193
|
+
* @name set
|
|
1194
|
+
* @memberOf Hash
|
|
1195
|
+
* @param {string} key The key of the value to set.
|
|
1196
|
+
* @param {*} value The value to set.
|
|
1197
|
+
* @returns {Object} Returns the hash instance.
|
|
1198
|
+
*/
|
|
1199
|
+
function hashSet(key, value) {
|
|
1200
|
+
var data = this.__data__;
|
|
1201
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1202
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
|
|
1203
|
+
return this;
|
|
1204
|
+
}
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js
|
|
1207
|
+
/**
|
|
1208
|
+
* Creates a hash object.
|
|
1209
|
+
*
|
|
1210
|
+
* @private
|
|
1211
|
+
* @constructor
|
|
1212
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1213
|
+
*/
|
|
1214
|
+
function Hash(entries) {
|
|
1215
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
1216
|
+
this.clear();
|
|
1217
|
+
while (++index < length) {
|
|
1218
|
+
var entry = entries[index];
|
|
1219
|
+
this.set(entry[0], entry[1]);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
Hash.prototype.clear = hashClear;
|
|
1223
|
+
Hash.prototype["delete"] = hashDelete;
|
|
1224
|
+
Hash.prototype.get = hashGet;
|
|
1225
|
+
Hash.prototype.has = hashHas;
|
|
1226
|
+
Hash.prototype.set = hashSet;
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js
|
|
1229
|
+
/**
|
|
1230
|
+
* Removes all key-value entries from the list cache.
|
|
1231
|
+
*
|
|
1232
|
+
* @private
|
|
1233
|
+
* @name clear
|
|
1234
|
+
* @memberOf ListCache
|
|
1235
|
+
*/
|
|
1236
|
+
function listCacheClear() {
|
|
1237
|
+
this.__data__ = [];
|
|
1238
|
+
this.size = 0;
|
|
1239
|
+
}
|
|
1240
|
+
//#endregion
|
|
1241
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js
|
|
1242
|
+
/**
|
|
1243
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
1244
|
+
*
|
|
1245
|
+
* @private
|
|
1246
|
+
* @param {Array} array The array to inspect.
|
|
1247
|
+
* @param {*} key The key to search for.
|
|
1248
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1249
|
+
*/
|
|
1250
|
+
function assocIndexOf(array, key) {
|
|
1251
|
+
var length = array.length;
|
|
1252
|
+
while (length--) if (eq(array[length][0], key)) return length;
|
|
1253
|
+
return -1;
|
|
1254
|
+
}
|
|
1255
|
+
//#endregion
|
|
1256
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js
|
|
1257
|
+
/** Built-in value references. */
|
|
1258
|
+
var splice = Array.prototype.splice;
|
|
1259
|
+
/**
|
|
1260
|
+
* Removes `key` and its value from the list cache.
|
|
1261
|
+
*
|
|
1262
|
+
* @private
|
|
1263
|
+
* @name delete
|
|
1264
|
+
* @memberOf ListCache
|
|
1265
|
+
* @param {string} key The key of the value to remove.
|
|
1266
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1267
|
+
*/
|
|
1268
|
+
function listCacheDelete(key) {
|
|
1269
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
1270
|
+
if (index < 0) return false;
|
|
1271
|
+
if (index == data.length - 1) data.pop();
|
|
1272
|
+
else splice.call(data, index, 1);
|
|
1273
|
+
--this.size;
|
|
1274
|
+
return true;
|
|
1275
|
+
}
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js
|
|
1278
|
+
/**
|
|
1279
|
+
* Gets the list cache value for `key`.
|
|
1280
|
+
*
|
|
1281
|
+
* @private
|
|
1282
|
+
* @name get
|
|
1283
|
+
* @memberOf ListCache
|
|
1284
|
+
* @param {string} key The key of the value to get.
|
|
1285
|
+
* @returns {*} Returns the entry value.
|
|
1286
|
+
*/
|
|
1287
|
+
function listCacheGet(key) {
|
|
1288
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
1289
|
+
return index < 0 ? void 0 : data[index][1];
|
|
1290
|
+
}
|
|
1291
|
+
//#endregion
|
|
1292
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js
|
|
1293
|
+
/**
|
|
1294
|
+
* Checks if a list cache value for `key` exists.
|
|
1295
|
+
*
|
|
1296
|
+
* @private
|
|
1297
|
+
* @name has
|
|
1298
|
+
* @memberOf ListCache
|
|
1299
|
+
* @param {string} key The key of the entry to check.
|
|
1300
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1301
|
+
*/
|
|
1302
|
+
function listCacheHas(key) {
|
|
1303
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
1304
|
+
}
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js
|
|
1307
|
+
/**
|
|
1308
|
+
* Sets the list cache `key` to `value`.
|
|
1309
|
+
*
|
|
1310
|
+
* @private
|
|
1311
|
+
* @name set
|
|
1312
|
+
* @memberOf ListCache
|
|
1313
|
+
* @param {string} key The key of the value to set.
|
|
1314
|
+
* @param {*} value The value to set.
|
|
1315
|
+
* @returns {Object} Returns the list cache instance.
|
|
1316
|
+
*/
|
|
1317
|
+
function listCacheSet(key, value) {
|
|
1318
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
1319
|
+
if (index < 0) {
|
|
1320
|
+
++this.size;
|
|
1321
|
+
data.push([key, value]);
|
|
1322
|
+
} else data[index][1] = value;
|
|
1323
|
+
return this;
|
|
1324
|
+
}
|
|
1325
|
+
//#endregion
|
|
1326
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js
|
|
1327
|
+
/**
|
|
1328
|
+
* Creates an list cache object.
|
|
1329
|
+
*
|
|
1330
|
+
* @private
|
|
1331
|
+
* @constructor
|
|
1332
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1333
|
+
*/
|
|
1334
|
+
function ListCache(entries) {
|
|
1335
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
1336
|
+
this.clear();
|
|
1337
|
+
while (++index < length) {
|
|
1338
|
+
var entry = entries[index];
|
|
1339
|
+
this.set(entry[0], entry[1]);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
ListCache.prototype.clear = listCacheClear;
|
|
1343
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
1344
|
+
ListCache.prototype.get = listCacheGet;
|
|
1345
|
+
ListCache.prototype.has = listCacheHas;
|
|
1346
|
+
ListCache.prototype.set = listCacheSet;
|
|
1347
|
+
//#endregion
|
|
1348
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js
|
|
1349
|
+
var Map$1 = getNative(root, "Map");
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js
|
|
1352
|
+
/**
|
|
1353
|
+
* Removes all key-value entries from the map.
|
|
1354
|
+
*
|
|
1355
|
+
* @private
|
|
1356
|
+
* @name clear
|
|
1357
|
+
* @memberOf MapCache
|
|
1358
|
+
*/
|
|
1359
|
+
function mapCacheClear() {
|
|
1360
|
+
this.size = 0;
|
|
1361
|
+
this.__data__ = {
|
|
1362
|
+
"hash": new Hash(),
|
|
1363
|
+
"map": new (Map$1 || ListCache)(),
|
|
1364
|
+
"string": new Hash()
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
//#endregion
|
|
1368
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js
|
|
1369
|
+
/**
|
|
1370
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1371
|
+
*
|
|
1372
|
+
* @private
|
|
1373
|
+
* @param {*} value The value to check.
|
|
1374
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1375
|
+
*/
|
|
1376
|
+
function isKeyable(value) {
|
|
1377
|
+
var type = typeof value;
|
|
1378
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
1379
|
+
}
|
|
1380
|
+
//#endregion
|
|
1381
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js
|
|
1382
|
+
/**
|
|
1383
|
+
* Gets the data for `map`.
|
|
1384
|
+
*
|
|
1385
|
+
* @private
|
|
1386
|
+
* @param {Object} map The map to query.
|
|
1387
|
+
* @param {string} key The reference key.
|
|
1388
|
+
* @returns {*} Returns the map data.
|
|
1389
|
+
*/
|
|
1390
|
+
function getMapData(map, key) {
|
|
1391
|
+
var data = map.__data__;
|
|
1392
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
1393
|
+
}
|
|
1394
|
+
//#endregion
|
|
1395
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js
|
|
1396
|
+
/**
|
|
1397
|
+
* Removes `key` and its value from the map.
|
|
1398
|
+
*
|
|
1399
|
+
* @private
|
|
1400
|
+
* @name delete
|
|
1401
|
+
* @memberOf MapCache
|
|
1402
|
+
* @param {string} key The key of the value to remove.
|
|
1403
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1404
|
+
*/
|
|
1405
|
+
function mapCacheDelete(key) {
|
|
1406
|
+
var result = getMapData(this, key)["delete"](key);
|
|
1407
|
+
this.size -= result ? 1 : 0;
|
|
1408
|
+
return result;
|
|
1409
|
+
}
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js
|
|
1412
|
+
/**
|
|
1413
|
+
* Gets the map value for `key`.
|
|
1414
|
+
*
|
|
1415
|
+
* @private
|
|
1416
|
+
* @name get
|
|
1417
|
+
* @memberOf MapCache
|
|
1418
|
+
* @param {string} key The key of the value to get.
|
|
1419
|
+
* @returns {*} Returns the entry value.
|
|
1420
|
+
*/
|
|
1421
|
+
function mapCacheGet(key) {
|
|
1422
|
+
return getMapData(this, key).get(key);
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js
|
|
1426
|
+
/**
|
|
1427
|
+
* Checks if a map value for `key` exists.
|
|
1428
|
+
*
|
|
1429
|
+
* @private
|
|
1430
|
+
* @name has
|
|
1431
|
+
* @memberOf MapCache
|
|
1432
|
+
* @param {string} key The key of the entry to check.
|
|
1433
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1434
|
+
*/
|
|
1435
|
+
function mapCacheHas(key) {
|
|
1436
|
+
return getMapData(this, key).has(key);
|
|
1437
|
+
}
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js
|
|
1440
|
+
/**
|
|
1441
|
+
* Sets the map `key` to `value`.
|
|
1442
|
+
*
|
|
1443
|
+
* @private
|
|
1444
|
+
* @name set
|
|
1445
|
+
* @memberOf MapCache
|
|
1446
|
+
* @param {string} key The key of the value to set.
|
|
1447
|
+
* @param {*} value The value to set.
|
|
1448
|
+
* @returns {Object} Returns the map cache instance.
|
|
1449
|
+
*/
|
|
1450
|
+
function mapCacheSet(key, value) {
|
|
1451
|
+
var data = getMapData(this, key), size = data.size;
|
|
1452
|
+
data.set(key, value);
|
|
1453
|
+
this.size += data.size == size ? 0 : 1;
|
|
1454
|
+
return this;
|
|
1455
|
+
}
|
|
1456
|
+
//#endregion
|
|
1457
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js
|
|
1458
|
+
/**
|
|
1459
|
+
* Creates a map cache object to store key-value pairs.
|
|
1460
|
+
*
|
|
1461
|
+
* @private
|
|
1462
|
+
* @constructor
|
|
1463
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1464
|
+
*/
|
|
1465
|
+
function MapCache(entries) {
|
|
1466
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
1467
|
+
this.clear();
|
|
1468
|
+
while (++index < length) {
|
|
1469
|
+
var entry = entries[index];
|
|
1470
|
+
this.set(entry[0], entry[1]);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
1474
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
1475
|
+
MapCache.prototype.get = mapCacheGet;
|
|
1476
|
+
MapCache.prototype.has = mapCacheHas;
|
|
1477
|
+
MapCache.prototype.set = mapCacheSet;
|
|
1478
|
+
//#endregion
|
|
1479
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js
|
|
1480
|
+
/**
|
|
1481
|
+
* Appends the elements of `values` to `array`.
|
|
1482
|
+
*
|
|
1483
|
+
* @private
|
|
1484
|
+
* @param {Array} array The array to modify.
|
|
1485
|
+
* @param {Array} values The values to append.
|
|
1486
|
+
* @returns {Array} Returns `array`.
|
|
1487
|
+
*/
|
|
1488
|
+
function arrayPush(array, values) {
|
|
1489
|
+
var index = -1, length = values.length, offset = array.length;
|
|
1490
|
+
while (++index < length) array[offset + index] = values[index];
|
|
1491
|
+
return array;
|
|
1492
|
+
}
|
|
1493
|
+
//#endregion
|
|
1494
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js
|
|
1495
|
+
/** Built-in value references. */
|
|
1496
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
1497
|
+
//#endregion
|
|
1498
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js
|
|
1499
|
+
/**
|
|
1500
|
+
* Removes all key-value entries from the stack.
|
|
1501
|
+
*
|
|
1502
|
+
* @private
|
|
1503
|
+
* @name clear
|
|
1504
|
+
* @memberOf Stack
|
|
1505
|
+
*/
|
|
1506
|
+
function stackClear() {
|
|
1507
|
+
this.__data__ = new ListCache();
|
|
1508
|
+
this.size = 0;
|
|
1509
|
+
}
|
|
1510
|
+
//#endregion
|
|
1511
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js
|
|
1512
|
+
/**
|
|
1513
|
+
* Removes `key` and its value from the stack.
|
|
1514
|
+
*
|
|
1515
|
+
* @private
|
|
1516
|
+
* @name delete
|
|
1517
|
+
* @memberOf Stack
|
|
1518
|
+
* @param {string} key The key of the value to remove.
|
|
1519
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1520
|
+
*/
|
|
1521
|
+
function stackDelete(key) {
|
|
1522
|
+
var data = this.__data__, result = data["delete"](key);
|
|
1523
|
+
this.size = data.size;
|
|
1524
|
+
return result;
|
|
1525
|
+
}
|
|
1526
|
+
//#endregion
|
|
1527
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js
|
|
1528
|
+
/**
|
|
1529
|
+
* Gets the stack value for `key`.
|
|
1530
|
+
*
|
|
1531
|
+
* @private
|
|
1532
|
+
* @name get
|
|
1533
|
+
* @memberOf Stack
|
|
1534
|
+
* @param {string} key The key of the value to get.
|
|
1535
|
+
* @returns {*} Returns the entry value.
|
|
1536
|
+
*/
|
|
1537
|
+
function stackGet(key) {
|
|
1538
|
+
return this.__data__.get(key);
|
|
1539
|
+
}
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js
|
|
1542
|
+
/**
|
|
1543
|
+
* Checks if a stack value for `key` exists.
|
|
1544
|
+
*
|
|
1545
|
+
* @private
|
|
1546
|
+
* @name has
|
|
1547
|
+
* @memberOf Stack
|
|
1548
|
+
* @param {string} key The key of the entry to check.
|
|
1549
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1550
|
+
*/
|
|
1551
|
+
function stackHas(key) {
|
|
1552
|
+
return this.__data__.has(key);
|
|
1553
|
+
}
|
|
1554
|
+
//#endregion
|
|
1555
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js
|
|
1556
|
+
/** Used as the size to enable large array optimizations. */
|
|
1557
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1558
|
+
/**
|
|
1559
|
+
* Sets the stack `key` to `value`.
|
|
1560
|
+
*
|
|
1561
|
+
* @private
|
|
1562
|
+
* @name set
|
|
1563
|
+
* @memberOf Stack
|
|
1564
|
+
* @param {string} key The key of the value to set.
|
|
1565
|
+
* @param {*} value The value to set.
|
|
1566
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1567
|
+
*/
|
|
1568
|
+
function stackSet(key, value) {
|
|
1569
|
+
var data = this.__data__;
|
|
1570
|
+
if (data instanceof ListCache) {
|
|
1571
|
+
var pairs = data.__data__;
|
|
1572
|
+
if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1573
|
+
pairs.push([key, value]);
|
|
1574
|
+
this.size = ++data.size;
|
|
1575
|
+
return this;
|
|
1576
|
+
}
|
|
1577
|
+
data = this.__data__ = new MapCache(pairs);
|
|
1578
|
+
}
|
|
1579
|
+
data.set(key, value);
|
|
1580
|
+
this.size = data.size;
|
|
1581
|
+
return this;
|
|
1582
|
+
}
|
|
1583
|
+
//#endregion
|
|
1584
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js
|
|
1585
|
+
/**
|
|
1586
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1587
|
+
*
|
|
1588
|
+
* @private
|
|
1589
|
+
* @constructor
|
|
1590
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1591
|
+
*/
|
|
1592
|
+
function Stack(entries) {
|
|
1593
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1594
|
+
this.size = data.size;
|
|
1595
|
+
}
|
|
1596
|
+
Stack.prototype.clear = stackClear;
|
|
1597
|
+
Stack.prototype["delete"] = stackDelete;
|
|
1598
|
+
Stack.prototype.get = stackGet;
|
|
1599
|
+
Stack.prototype.has = stackHas;
|
|
1600
|
+
Stack.prototype.set = stackSet;
|
|
1601
|
+
//#endregion
|
|
1602
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
|
|
1603
|
+
/**
|
|
1604
|
+
* The base implementation of `_.assign` without support for multiple sources
|
|
1605
|
+
* or `customizer` functions.
|
|
1606
|
+
*
|
|
1607
|
+
* @private
|
|
1608
|
+
* @param {Object} object The destination object.
|
|
1609
|
+
* @param {Object} source The source object.
|
|
1610
|
+
* @returns {Object} Returns `object`.
|
|
1611
|
+
*/
|
|
1612
|
+
function baseAssign(object, source) {
|
|
1613
|
+
return object && copyObject(source, keys(source), object);
|
|
1614
|
+
}
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
|
|
1617
|
+
/**
|
|
1618
|
+
* The base implementation of `_.assignIn` without support for multiple sources
|
|
1619
|
+
* or `customizer` functions.
|
|
1620
|
+
*
|
|
1621
|
+
* @private
|
|
1622
|
+
* @param {Object} object The destination object.
|
|
1623
|
+
* @param {Object} source The source object.
|
|
1624
|
+
* @returns {Object} Returns `object`.
|
|
1625
|
+
*/
|
|
1626
|
+
function baseAssignIn(object, source) {
|
|
1627
|
+
return object && copyObject(source, keysIn(source), object);
|
|
1628
|
+
}
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js
|
|
1631
|
+
/** Detect free variable `exports`. */
|
|
1632
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
|
1633
|
+
/** Detect free variable `module`. */
|
|
1634
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
1635
|
+
/** Built-in value references. */
|
|
1636
|
+
var Buffer = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
1637
|
+
/**
|
|
1638
|
+
* Creates a clone of `buffer`.
|
|
1639
|
+
*
|
|
1640
|
+
* @private
|
|
1641
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
1642
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1643
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
1644
|
+
*/
|
|
1645
|
+
function cloneBuffer(buffer, isDeep) {
|
|
1646
|
+
if (isDeep) return buffer.slice();
|
|
1647
|
+
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
1648
|
+
buffer.copy(result);
|
|
1649
|
+
return result;
|
|
1650
|
+
}
|
|
1651
|
+
//#endregion
|
|
1652
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js
|
|
1653
|
+
/**
|
|
1654
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1655
|
+
* iteratee shorthands.
|
|
1656
|
+
*
|
|
1657
|
+
* @private
|
|
1658
|
+
* @param {Array} [array] The array to iterate over.
|
|
1659
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1660
|
+
* @returns {Array} Returns the new filtered array.
|
|
1661
|
+
*/
|
|
1662
|
+
function arrayFilter(array, predicate) {
|
|
1663
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
1664
|
+
while (++index < length) {
|
|
1665
|
+
var value = array[index];
|
|
1666
|
+
if (predicate(value, index, array)) result[resIndex++] = value;
|
|
1667
|
+
}
|
|
1668
|
+
return result;
|
|
1669
|
+
}
|
|
1670
|
+
//#endregion
|
|
1671
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js
|
|
1672
|
+
/**
|
|
1673
|
+
* This method returns a new empty array.
|
|
1674
|
+
*
|
|
1675
|
+
* @static
|
|
1676
|
+
* @memberOf _
|
|
1677
|
+
* @since 4.13.0
|
|
1678
|
+
* @category Util
|
|
1679
|
+
* @returns {Array} Returns the new empty array.
|
|
1680
|
+
* @example
|
|
1681
|
+
*
|
|
1682
|
+
* var arrays = _.times(2, _.stubArray);
|
|
1683
|
+
*
|
|
1684
|
+
* console.log(arrays);
|
|
1685
|
+
* // => [[], []]
|
|
1686
|
+
*
|
|
1687
|
+
* console.log(arrays[0] === arrays[1]);
|
|
1688
|
+
* // => false
|
|
1689
|
+
*/
|
|
1690
|
+
function stubArray() {
|
|
1691
|
+
return [];
|
|
1692
|
+
}
|
|
1693
|
+
//#endregion
|
|
1694
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js
|
|
1695
|
+
/** Built-in value references. */
|
|
1696
|
+
var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1697
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1698
|
+
/**
|
|
1699
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
1700
|
+
*
|
|
1701
|
+
* @private
|
|
1702
|
+
* @param {Object} object The object to query.
|
|
1703
|
+
* @returns {Array} Returns the array of symbols.
|
|
1704
|
+
*/
|
|
1705
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1706
|
+
if (object == null) return [];
|
|
1707
|
+
object = Object(object);
|
|
1708
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1709
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
1710
|
+
});
|
|
1711
|
+
};
|
|
1712
|
+
//#endregion
|
|
1713
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
|
|
1714
|
+
/**
|
|
1715
|
+
* Copies own symbols of `source` to `object`.
|
|
1716
|
+
*
|
|
1717
|
+
* @private
|
|
1718
|
+
* @param {Object} source The object to copy symbols from.
|
|
1719
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
1720
|
+
* @returns {Object} Returns `object`.
|
|
1721
|
+
*/
|
|
1722
|
+
function copySymbols(source, object) {
|
|
1723
|
+
return copyObject(source, getSymbols(source), object);
|
|
1724
|
+
}
|
|
1725
|
+
//#endregion
|
|
1726
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
|
|
1727
|
+
/**
|
|
1728
|
+
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
1729
|
+
*
|
|
1730
|
+
* @private
|
|
1731
|
+
* @param {Object} object The object to query.
|
|
1732
|
+
* @returns {Array} Returns the array of symbols.
|
|
1733
|
+
*/
|
|
1734
|
+
var getSymbolsIn = !Object.getOwnPropertySymbols ? stubArray : function(object) {
|
|
1735
|
+
var result = [];
|
|
1736
|
+
while (object) {
|
|
1737
|
+
arrayPush(result, getSymbols(object));
|
|
1738
|
+
object = getPrototype(object);
|
|
1739
|
+
}
|
|
1740
|
+
return result;
|
|
1741
|
+
};
|
|
1742
|
+
//#endregion
|
|
1743
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
|
|
1744
|
+
/**
|
|
1745
|
+
* Copies own and inherited symbols of `source` to `object`.
|
|
1746
|
+
*
|
|
1747
|
+
* @private
|
|
1748
|
+
* @param {Object} source The object to copy symbols from.
|
|
1749
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
1750
|
+
* @returns {Object} Returns `object`.
|
|
1751
|
+
*/
|
|
1752
|
+
function copySymbolsIn(source, object) {
|
|
1753
|
+
return copyObject(source, getSymbolsIn(source), object);
|
|
1754
|
+
}
|
|
1755
|
+
//#endregion
|
|
1756
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js
|
|
1757
|
+
/**
|
|
1758
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1759
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1760
|
+
* symbols of `object`.
|
|
1761
|
+
*
|
|
1762
|
+
* @private
|
|
1763
|
+
* @param {Object} object The object to query.
|
|
1764
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1765
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1766
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1767
|
+
*/
|
|
1768
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1769
|
+
var result = keysFunc(object);
|
|
1770
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1771
|
+
}
|
|
1772
|
+
//#endregion
|
|
1773
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js
|
|
1774
|
+
/**
|
|
1775
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
1776
|
+
*
|
|
1777
|
+
* @private
|
|
1778
|
+
* @param {Object} object The object to query.
|
|
1779
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1780
|
+
*/
|
|
1781
|
+
function getAllKeys(object) {
|
|
1782
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
1783
|
+
}
|
|
1784
|
+
//#endregion
|
|
1785
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
|
|
1786
|
+
/**
|
|
1787
|
+
* Creates an array of own and inherited enumerable property names and
|
|
1788
|
+
* symbols of `object`.
|
|
1789
|
+
*
|
|
1790
|
+
* @private
|
|
1791
|
+
* @param {Object} object The object to query.
|
|
1792
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1793
|
+
*/
|
|
1794
|
+
function getAllKeysIn(object) {
|
|
1795
|
+
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
1796
|
+
}
|
|
1797
|
+
//#endregion
|
|
1798
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js
|
|
1799
|
+
var DataView = getNative(root, "DataView");
|
|
1800
|
+
//#endregion
|
|
1801
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js
|
|
1802
|
+
var Promise$1 = getNative(root, "Promise");
|
|
1803
|
+
//#endregion
|
|
1804
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Set.js
|
|
1805
|
+
var Set$1 = getNative(root, "Set");
|
|
1806
|
+
//#endregion
|
|
1807
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js
|
|
1808
|
+
/** `Object#toString` result references. */
|
|
1809
|
+
var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
|
|
1810
|
+
var dataViewTag$3 = "[object DataView]";
|
|
1811
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
1812
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
|
|
1813
|
+
/**
|
|
1814
|
+
* Gets the `toStringTag` of `value`.
|
|
1815
|
+
*
|
|
1816
|
+
* @private
|
|
1817
|
+
* @param {*} value The value to query.
|
|
1818
|
+
* @returns {string} Returns the `toStringTag`.
|
|
1819
|
+
*/
|
|
1820
|
+
var getTag = baseGetTag;
|
|
1821
|
+
if (DataView && getTag(new DataView(/* @__PURE__ */ new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) getTag = function(value) {
|
|
1822
|
+
var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
1823
|
+
if (ctorString) switch (ctorString) {
|
|
1824
|
+
case dataViewCtorString: return dataViewTag$3;
|
|
1825
|
+
case mapCtorString: return mapTag$4;
|
|
1826
|
+
case promiseCtorString: return promiseTag;
|
|
1827
|
+
case setCtorString: return setTag$4;
|
|
1828
|
+
case weakMapCtorString: return weakMapTag$1;
|
|
1829
|
+
}
|
|
1830
|
+
return result;
|
|
1831
|
+
};
|
|
1832
|
+
var _getTag_default = getTag;
|
|
1833
|
+
//#endregion
|
|
1834
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
|
|
1835
|
+
/** Used to check objects for own properties. */
|
|
1836
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1837
|
+
/**
|
|
1838
|
+
* Initializes an array clone.
|
|
1839
|
+
*
|
|
1840
|
+
* @private
|
|
1841
|
+
* @param {Array} array The array to clone.
|
|
1842
|
+
* @returns {Array} Returns the initialized clone.
|
|
1843
|
+
*/
|
|
1844
|
+
function initCloneArray(array) {
|
|
1845
|
+
var length = array.length, result = new array.constructor(length);
|
|
1846
|
+
if (length && typeof array[0] == "string" && hasOwnProperty$2.call(array, "index")) {
|
|
1847
|
+
result.index = array.index;
|
|
1848
|
+
result.input = array.input;
|
|
1849
|
+
}
|
|
1850
|
+
return result;
|
|
1851
|
+
}
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js
|
|
1854
|
+
/** Built-in value references. */
|
|
1855
|
+
var Uint8Array = root.Uint8Array;
|
|
1856
|
+
//#endregion
|
|
1857
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js
|
|
1858
|
+
/**
|
|
1859
|
+
* Creates a clone of `arrayBuffer`.
|
|
1860
|
+
*
|
|
1861
|
+
* @private
|
|
1862
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
1863
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
1864
|
+
*/
|
|
1865
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
1866
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
1867
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
1868
|
+
return result;
|
|
1869
|
+
}
|
|
1870
|
+
//#endregion
|
|
1871
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js
|
|
1872
|
+
/**
|
|
1873
|
+
* Creates a clone of `dataView`.
|
|
1874
|
+
*
|
|
1875
|
+
* @private
|
|
1876
|
+
* @param {Object} dataView The data view to clone.
|
|
1877
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1878
|
+
* @returns {Object} Returns the cloned data view.
|
|
1879
|
+
*/
|
|
1880
|
+
function cloneDataView(dataView, isDeep) {
|
|
1881
|
+
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
1882
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
1883
|
+
}
|
|
1884
|
+
//#endregion
|
|
1885
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js
|
|
1886
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
1887
|
+
var reFlags = /\w*$/;
|
|
1888
|
+
/**
|
|
1889
|
+
* Creates a clone of `regexp`.
|
|
1890
|
+
*
|
|
1891
|
+
* @private
|
|
1892
|
+
* @param {Object} regexp The regexp to clone.
|
|
1893
|
+
* @returns {Object} Returns the cloned regexp.
|
|
1894
|
+
*/
|
|
1895
|
+
function cloneRegExp(regexp) {
|
|
1896
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
1897
|
+
result.lastIndex = regexp.lastIndex;
|
|
1898
|
+
return result;
|
|
1899
|
+
}
|
|
1900
|
+
//#endregion
|
|
1901
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js
|
|
1902
|
+
/** Used to convert symbols to primitives and strings. */
|
|
1903
|
+
var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
|
|
1904
|
+
/**
|
|
1905
|
+
* Creates a clone of the `symbol` object.
|
|
1906
|
+
*
|
|
1907
|
+
* @private
|
|
1908
|
+
* @param {Object} symbol The symbol object to clone.
|
|
1909
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
1910
|
+
*/
|
|
1911
|
+
function cloneSymbol(symbol) {
|
|
1912
|
+
return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
|
|
1913
|
+
}
|
|
1914
|
+
//#endregion
|
|
1915
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js
|
|
1916
|
+
/**
|
|
1917
|
+
* Creates a clone of `typedArray`.
|
|
1918
|
+
*
|
|
1919
|
+
* @private
|
|
1920
|
+
* @param {Object} typedArray The typed array to clone.
|
|
1921
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1922
|
+
* @returns {Object} Returns the cloned typed array.
|
|
1923
|
+
*/
|
|
1924
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
1925
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
1926
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
1927
|
+
}
|
|
1928
|
+
//#endregion
|
|
1929
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js
|
|
1930
|
+
/** `Object#toString` result references. */
|
|
1931
|
+
var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
|
|
1932
|
+
var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
|
|
1933
|
+
/**
|
|
1934
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
1935
|
+
*
|
|
1936
|
+
* **Note:** This function only supports cloning values with tags of
|
|
1937
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
1938
|
+
*
|
|
1939
|
+
* @private
|
|
1940
|
+
* @param {Object} object The object to clone.
|
|
1941
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
1942
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
1943
|
+
* @returns {Object} Returns the initialized clone.
|
|
1944
|
+
*/
|
|
1945
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
1946
|
+
var Ctor = object.constructor;
|
|
1947
|
+
switch (tag) {
|
|
1948
|
+
case arrayBufferTag$2: return cloneArrayBuffer(object);
|
|
1949
|
+
case boolTag$2:
|
|
1950
|
+
case dateTag$2: return new Ctor(+object);
|
|
1951
|
+
case dataViewTag$2: return cloneDataView(object, isDeep);
|
|
1952
|
+
case float32Tag$1:
|
|
1953
|
+
case float64Tag$1:
|
|
1954
|
+
case int8Tag$1:
|
|
1955
|
+
case int16Tag$1:
|
|
1956
|
+
case int32Tag$1:
|
|
1957
|
+
case uint8Tag$1:
|
|
1958
|
+
case uint8ClampedTag$1:
|
|
1959
|
+
case uint16Tag$1:
|
|
1960
|
+
case uint32Tag$1: return cloneTypedArray(object, isDeep);
|
|
1961
|
+
case mapTag$3: return new Ctor();
|
|
1962
|
+
case numberTag$2:
|
|
1963
|
+
case stringTag$2: return new Ctor(object);
|
|
1964
|
+
case regexpTag$2: return cloneRegExp(object);
|
|
1965
|
+
case setTag$3: return new Ctor();
|
|
1966
|
+
case symbolTag$2: return cloneSymbol(object);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
//#endregion
|
|
1970
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js
|
|
1971
|
+
/**
|
|
1972
|
+
* Initializes an object clone.
|
|
1973
|
+
*
|
|
1974
|
+
* @private
|
|
1975
|
+
* @param {Object} object The object to clone.
|
|
1976
|
+
* @returns {Object} Returns the initialized clone.
|
|
1977
|
+
*/
|
|
1978
|
+
function initCloneObject(object) {
|
|
1979
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
1980
|
+
}
|
|
1981
|
+
//#endregion
|
|
1982
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
|
|
1983
|
+
/** `Object#toString` result references. */
|
|
1984
|
+
var mapTag$2 = "[object Map]";
|
|
1985
|
+
/**
|
|
1986
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
1987
|
+
*
|
|
1988
|
+
* @private
|
|
1989
|
+
* @param {*} value The value to check.
|
|
1990
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
1991
|
+
*/
|
|
1992
|
+
function baseIsMap(value) {
|
|
1993
|
+
return isObjectLike(value) && _getTag_default(value) == mapTag$2;
|
|
1994
|
+
}
|
|
1995
|
+
//#endregion
|
|
1996
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
|
|
1997
|
+
var nodeIsMap = nodeUtil && nodeUtil.isMap;
|
|
1998
|
+
/**
|
|
1999
|
+
* Checks if `value` is classified as a `Map` object.
|
|
2000
|
+
*
|
|
2001
|
+
* @static
|
|
2002
|
+
* @memberOf _
|
|
2003
|
+
* @since 4.3.0
|
|
2004
|
+
* @category Lang
|
|
2005
|
+
* @param {*} value The value to check.
|
|
2006
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2007
|
+
* @example
|
|
2008
|
+
*
|
|
2009
|
+
* _.isMap(new Map);
|
|
2010
|
+
* // => true
|
|
2011
|
+
*
|
|
2012
|
+
* _.isMap(new WeakMap);
|
|
2013
|
+
* // => false
|
|
2014
|
+
*/
|
|
2015
|
+
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
|
|
2016
|
+
//#endregion
|
|
2017
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js
|
|
2018
|
+
/** `Object#toString` result references. */
|
|
2019
|
+
var setTag$2 = "[object Set]";
|
|
2020
|
+
/**
|
|
2021
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2022
|
+
*
|
|
2023
|
+
* @private
|
|
2024
|
+
* @param {*} value The value to check.
|
|
2025
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2026
|
+
*/
|
|
2027
|
+
function baseIsSet(value) {
|
|
2028
|
+
return isObjectLike(value) && _getTag_default(value) == setTag$2;
|
|
2029
|
+
}
|
|
2030
|
+
//#endregion
|
|
2031
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
|
|
2032
|
+
var nodeIsSet = nodeUtil && nodeUtil.isSet;
|
|
2033
|
+
/**
|
|
2034
|
+
* Checks if `value` is classified as a `Set` object.
|
|
2035
|
+
*
|
|
2036
|
+
* @static
|
|
2037
|
+
* @memberOf _
|
|
2038
|
+
* @since 4.3.0
|
|
2039
|
+
* @category Lang
|
|
2040
|
+
* @param {*} value The value to check.
|
|
2041
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2042
|
+
* @example
|
|
2043
|
+
*
|
|
2044
|
+
* _.isSet(new Set);
|
|
2045
|
+
* // => true
|
|
2046
|
+
*
|
|
2047
|
+
* _.isSet(new WeakSet);
|
|
2048
|
+
* // => false
|
|
2049
|
+
*/
|
|
2050
|
+
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
2051
|
+
//#endregion
|
|
2052
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js
|
|
2053
|
+
/** Used to compose bitmasks for cloning. */
|
|
2054
|
+
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
|
|
2055
|
+
/** `Object#toString` result references. */
|
|
2056
|
+
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
|
|
2057
|
+
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
2058
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2059
|
+
var cloneableTags = {};
|
|
2060
|
+
cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2061
|
+
cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
|
|
2062
|
+
/**
|
|
2063
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2064
|
+
* traversed objects.
|
|
2065
|
+
*
|
|
2066
|
+
* @private
|
|
2067
|
+
* @param {*} value The value to clone.
|
|
2068
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2069
|
+
* 1 - Deep clone
|
|
2070
|
+
* 2 - Flatten inherited properties
|
|
2071
|
+
* 4 - Clone symbols
|
|
2072
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2073
|
+
* @param {string} [key] The key of `value`.
|
|
2074
|
+
* @param {Object} [object] The parent object of `value`.
|
|
2075
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2076
|
+
* @returns {*} Returns the cloned value.
|
|
2077
|
+
*/
|
|
2078
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2079
|
+
var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
2080
|
+
if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2081
|
+
if (result !== void 0) return result;
|
|
2082
|
+
if (!isObject(value)) return value;
|
|
2083
|
+
var isArr = isArray(value);
|
|
2084
|
+
if (isArr) {
|
|
2085
|
+
result = initCloneArray(value);
|
|
2086
|
+
if (!isDeep) return copyArray(value, result);
|
|
2087
|
+
} else {
|
|
2088
|
+
var tag = _getTag_default(value), isFunc = tag == funcTag || tag == genTag;
|
|
2089
|
+
if (isBuffer(value)) return cloneBuffer(value, isDeep);
|
|
2090
|
+
if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
|
|
2091
|
+
result = isFlat || isFunc ? {} : initCloneObject(value);
|
|
2092
|
+
if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
|
|
2093
|
+
} else {
|
|
2094
|
+
if (!cloneableTags[tag]) return object ? value : {};
|
|
2095
|
+
result = initCloneByTag(value, tag, isDeep);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
stack || (stack = new Stack());
|
|
2099
|
+
var stacked = stack.get(value);
|
|
2100
|
+
if (stacked) return stacked;
|
|
2101
|
+
stack.set(value, result);
|
|
2102
|
+
if (isSet(value)) value.forEach(function(subValue) {
|
|
2103
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2104
|
+
});
|
|
2105
|
+
else if (isMap(value)) value.forEach(function(subValue, key) {
|
|
2106
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2107
|
+
});
|
|
2108
|
+
var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
|
|
2109
|
+
arrayEach(props || value, function(subValue, key) {
|
|
2110
|
+
if (props) {
|
|
2111
|
+
key = subValue;
|
|
2112
|
+
subValue = value[key];
|
|
2113
|
+
}
|
|
2114
|
+
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2115
|
+
});
|
|
2116
|
+
return result;
|
|
2117
|
+
}
|
|
2118
|
+
//#endregion
|
|
2119
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/clone.js
|
|
2120
|
+
/** Used to compose bitmasks for cloning. */
|
|
2121
|
+
var CLONE_SYMBOLS_FLAG = 4;
|
|
2122
|
+
/**
|
|
2123
|
+
* Creates a shallow clone of `value`.
|
|
2124
|
+
*
|
|
2125
|
+
* **Note:** This method is loosely based on the
|
|
2126
|
+
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
|
|
2127
|
+
* and supports cloning arrays, array buffers, booleans, date objects, maps,
|
|
2128
|
+
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
|
|
2129
|
+
* arrays. The own enumerable properties of `arguments` objects are cloned
|
|
2130
|
+
* as plain objects. An empty object is returned for uncloneable values such
|
|
2131
|
+
* as error objects, functions, DOM nodes, and WeakMaps.
|
|
2132
|
+
*
|
|
2133
|
+
* @static
|
|
2134
|
+
* @memberOf _
|
|
2135
|
+
* @since 0.1.0
|
|
2136
|
+
* @category Lang
|
|
2137
|
+
* @param {*} value The value to clone.
|
|
2138
|
+
* @returns {*} Returns the cloned value.
|
|
2139
|
+
* @see _.cloneDeep
|
|
2140
|
+
* @example
|
|
2141
|
+
*
|
|
2142
|
+
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
|
2143
|
+
*
|
|
2144
|
+
* var shallow = _.clone(objects);
|
|
2145
|
+
* console.log(shallow[0] === objects[0]);
|
|
2146
|
+
* // => true
|
|
2147
|
+
*/
|
|
2148
|
+
function clone(value) {
|
|
2149
|
+
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
2150
|
+
}
|
|
2151
|
+
//#endregion
|
|
2152
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js
|
|
2153
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
2154
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
2155
|
+
/**
|
|
2156
|
+
* Adds `value` to the array cache.
|
|
2157
|
+
*
|
|
2158
|
+
* @private
|
|
2159
|
+
* @name add
|
|
2160
|
+
* @memberOf SetCache
|
|
2161
|
+
* @alias push
|
|
2162
|
+
* @param {*} value The value to cache.
|
|
2163
|
+
* @returns {Object} Returns the cache instance.
|
|
2164
|
+
*/
|
|
2165
|
+
function setCacheAdd(value) {
|
|
2166
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
2167
|
+
return this;
|
|
2168
|
+
}
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js
|
|
2171
|
+
/**
|
|
2172
|
+
* Checks if `value` is in the array cache.
|
|
2173
|
+
*
|
|
2174
|
+
* @private
|
|
2175
|
+
* @name has
|
|
2176
|
+
* @memberOf SetCache
|
|
2177
|
+
* @param {*} value The value to search for.
|
|
2178
|
+
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
2179
|
+
*/
|
|
2180
|
+
function setCacheHas(value) {
|
|
2181
|
+
return this.__data__.has(value);
|
|
2182
|
+
}
|
|
2183
|
+
//#endregion
|
|
2184
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js
|
|
2185
|
+
/**
|
|
2186
|
+
*
|
|
2187
|
+
* Creates an array cache object to store unique values.
|
|
2188
|
+
*
|
|
2189
|
+
* @private
|
|
2190
|
+
* @constructor
|
|
2191
|
+
* @param {Array} [values] The values to cache.
|
|
2192
|
+
*/
|
|
2193
|
+
function SetCache(values) {
|
|
2194
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
2195
|
+
this.__data__ = new MapCache();
|
|
2196
|
+
while (++index < length) this.add(values[index]);
|
|
2197
|
+
}
|
|
2198
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
2199
|
+
SetCache.prototype.has = setCacheHas;
|
|
2200
|
+
//#endregion
|
|
2201
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js
|
|
2202
|
+
/**
|
|
2203
|
+
* A specialized version of `_.some` for arrays without support for iteratee
|
|
2204
|
+
* shorthands.
|
|
2205
|
+
*
|
|
2206
|
+
* @private
|
|
2207
|
+
* @param {Array} [array] The array to iterate over.
|
|
2208
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
2209
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
2210
|
+
* else `false`.
|
|
2211
|
+
*/
|
|
2212
|
+
function arraySome(array, predicate) {
|
|
2213
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
2214
|
+
while (++index < length) if (predicate(array[index], index, array)) return true;
|
|
2215
|
+
return false;
|
|
2216
|
+
}
|
|
2217
|
+
//#endregion
|
|
2218
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js
|
|
2219
|
+
/**
|
|
2220
|
+
* Checks if a `cache` value for `key` exists.
|
|
2221
|
+
*
|
|
2222
|
+
* @private
|
|
2223
|
+
* @param {Object} cache The cache to query.
|
|
2224
|
+
* @param {string} key The key of the entry to check.
|
|
2225
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
2226
|
+
*/
|
|
2227
|
+
function cacheHas(cache, key) {
|
|
2228
|
+
return cache.has(key);
|
|
2229
|
+
}
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js
|
|
2232
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2233
|
+
var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
2234
|
+
/**
|
|
2235
|
+
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
2236
|
+
* partial deep comparisons.
|
|
2237
|
+
*
|
|
2238
|
+
* @private
|
|
2239
|
+
* @param {Array} array The array to compare.
|
|
2240
|
+
* @param {Array} other The other array to compare.
|
|
2241
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2242
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2243
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2244
|
+
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
2245
|
+
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
2246
|
+
*/
|
|
2247
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
2248
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
|
|
2249
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
|
|
2250
|
+
var arrStacked = stack.get(array);
|
|
2251
|
+
var othStacked = stack.get(other);
|
|
2252
|
+
if (arrStacked && othStacked) return arrStacked == other && othStacked == array;
|
|
2253
|
+
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
|
|
2254
|
+
stack.set(array, other);
|
|
2255
|
+
stack.set(other, array);
|
|
2256
|
+
while (++index < arrLength) {
|
|
2257
|
+
var arrValue = array[index], othValue = other[index];
|
|
2258
|
+
if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
2259
|
+
if (compared !== void 0) {
|
|
2260
|
+
if (compared) continue;
|
|
2261
|
+
result = false;
|
|
2262
|
+
break;
|
|
2263
|
+
}
|
|
2264
|
+
if (seen) {
|
|
2265
|
+
if (!arraySome(other, function(othValue, othIndex) {
|
|
2266
|
+
if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
|
|
2267
|
+
})) {
|
|
2268
|
+
result = false;
|
|
2269
|
+
break;
|
|
2270
|
+
}
|
|
2271
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
2272
|
+
result = false;
|
|
2273
|
+
break;
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
stack["delete"](array);
|
|
2277
|
+
stack["delete"](other);
|
|
2278
|
+
return result;
|
|
2279
|
+
}
|
|
2280
|
+
//#endregion
|
|
2281
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js
|
|
2282
|
+
/**
|
|
2283
|
+
* Converts `map` to its key-value pairs.
|
|
2284
|
+
*
|
|
2285
|
+
* @private
|
|
2286
|
+
* @param {Object} map The map to convert.
|
|
2287
|
+
* @returns {Array} Returns the key-value pairs.
|
|
2288
|
+
*/
|
|
2289
|
+
function mapToArray(map) {
|
|
2290
|
+
var index = -1, result = Array(map.size);
|
|
2291
|
+
map.forEach(function(value, key) {
|
|
2292
|
+
result[++index] = [key, value];
|
|
2293
|
+
});
|
|
2294
|
+
return result;
|
|
2295
|
+
}
|
|
2296
|
+
//#endregion
|
|
2297
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js
|
|
2298
|
+
/**
|
|
2299
|
+
* Converts `set` to an array of its values.
|
|
2300
|
+
*
|
|
2301
|
+
* @private
|
|
2302
|
+
* @param {Object} set The set to convert.
|
|
2303
|
+
* @returns {Array} Returns the values.
|
|
2304
|
+
*/
|
|
2305
|
+
function setToArray(set) {
|
|
2306
|
+
var index = -1, result = Array(set.size);
|
|
2307
|
+
set.forEach(function(value) {
|
|
2308
|
+
result[++index] = value;
|
|
2309
|
+
});
|
|
2310
|
+
return result;
|
|
2311
|
+
}
|
|
2312
|
+
//#endregion
|
|
2313
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js
|
|
2314
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2315
|
+
var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
2316
|
+
/** `Object#toString` result references. */
|
|
2317
|
+
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
2318
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
|
|
2319
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2320
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
2321
|
+
/**
|
|
2322
|
+
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
2323
|
+
* the same `toStringTag`.
|
|
2324
|
+
*
|
|
2325
|
+
* **Note:** This function only supports comparing values with tags of
|
|
2326
|
+
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
2327
|
+
*
|
|
2328
|
+
* @private
|
|
2329
|
+
* @param {Object} object The object to compare.
|
|
2330
|
+
* @param {Object} other The other object to compare.
|
|
2331
|
+
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
2332
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2333
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2334
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2335
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2336
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2337
|
+
*/
|
|
2338
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
2339
|
+
switch (tag) {
|
|
2340
|
+
case dataViewTag:
|
|
2341
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
|
|
2342
|
+
object = object.buffer;
|
|
2343
|
+
other = other.buffer;
|
|
2344
|
+
case arrayBufferTag:
|
|
2345
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false;
|
|
2346
|
+
return true;
|
|
2347
|
+
case boolTag:
|
|
2348
|
+
case dateTag:
|
|
2349
|
+
case numberTag: return eq(+object, +other);
|
|
2350
|
+
case errorTag: return object.name == other.name && object.message == other.message;
|
|
2351
|
+
case regexpTag:
|
|
2352
|
+
case stringTag: return object == other + "";
|
|
2353
|
+
case mapTag: var convert = mapToArray;
|
|
2354
|
+
case setTag:
|
|
2355
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
2356
|
+
convert || (convert = setToArray);
|
|
2357
|
+
if (object.size != other.size && !isPartial) return false;
|
|
2358
|
+
var stacked = stack.get(object);
|
|
2359
|
+
if (stacked) return stacked == other;
|
|
2360
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
2361
|
+
stack.set(object, other);
|
|
2362
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
2363
|
+
stack["delete"](object);
|
|
2364
|
+
return result;
|
|
2365
|
+
case symbolTag: if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
2366
|
+
}
|
|
2367
|
+
return false;
|
|
2368
|
+
}
|
|
2369
|
+
//#endregion
|
|
2370
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js
|
|
2371
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2372
|
+
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
2373
|
+
/** Used to check objects for own properties. */
|
|
2374
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
2375
|
+
/**
|
|
2376
|
+
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
2377
|
+
* partial deep comparisons.
|
|
2378
|
+
*
|
|
2379
|
+
* @private
|
|
2380
|
+
* @param {Object} object The object to compare.
|
|
2381
|
+
* @param {Object} other The other object to compare.
|
|
2382
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2383
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2384
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2385
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2386
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2387
|
+
*/
|
|
2388
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2389
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length;
|
|
2390
|
+
if (objLength != getAllKeys(other).length && !isPartial) return false;
|
|
2391
|
+
var index = objLength;
|
|
2392
|
+
while (index--) {
|
|
2393
|
+
var key = objProps[index];
|
|
2394
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) return false;
|
|
2395
|
+
}
|
|
2396
|
+
var objStacked = stack.get(object);
|
|
2397
|
+
var othStacked = stack.get(other);
|
|
2398
|
+
if (objStacked && othStacked) return objStacked == other && othStacked == object;
|
|
2399
|
+
var result = true;
|
|
2400
|
+
stack.set(object, other);
|
|
2401
|
+
stack.set(other, object);
|
|
2402
|
+
var skipCtor = isPartial;
|
|
2403
|
+
while (++index < objLength) {
|
|
2404
|
+
key = objProps[index];
|
|
2405
|
+
var objValue = object[key], othValue = other[key];
|
|
2406
|
+
if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
2407
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
2408
|
+
result = false;
|
|
2409
|
+
break;
|
|
2410
|
+
}
|
|
2411
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
2412
|
+
}
|
|
2413
|
+
if (result && !skipCtor) {
|
|
2414
|
+
var objCtor = object.constructor, othCtor = other.constructor;
|
|
2415
|
+
if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
|
|
2416
|
+
}
|
|
2417
|
+
stack["delete"](object);
|
|
2418
|
+
stack["delete"](other);
|
|
2419
|
+
return result;
|
|
2420
|
+
}
|
|
2421
|
+
//#endregion
|
|
2422
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js
|
|
2423
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2424
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
2425
|
+
/** `Object#toString` result references. */
|
|
2426
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
2427
|
+
/** Used to check objects for own properties. */
|
|
2428
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2429
|
+
/**
|
|
2430
|
+
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
2431
|
+
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
2432
|
+
* references to be compared.
|
|
2433
|
+
*
|
|
2434
|
+
* @private
|
|
2435
|
+
* @param {Object} object The object to compare.
|
|
2436
|
+
* @param {Object} other The other object to compare.
|
|
2437
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2438
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2439
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2440
|
+
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
2441
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2442
|
+
*/
|
|
2443
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2444
|
+
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : _getTag_default(object), othTag = othIsArr ? arrayTag : _getTag_default(other);
|
|
2445
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
2446
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
2447
|
+
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
2448
|
+
if (isSameTag && isBuffer(object)) {
|
|
2449
|
+
if (!isBuffer(other)) return false;
|
|
2450
|
+
objIsArr = true;
|
|
2451
|
+
objIsObj = false;
|
|
2452
|
+
}
|
|
2453
|
+
if (isSameTag && !objIsObj) {
|
|
2454
|
+
stack || (stack = new Stack());
|
|
2455
|
+
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
2456
|
+
}
|
|
2457
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
2458
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
2459
|
+
if (objIsWrapped || othIsWrapped) {
|
|
2460
|
+
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
2461
|
+
stack || (stack = new Stack());
|
|
2462
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
if (!isSameTag) return false;
|
|
2466
|
+
stack || (stack = new Stack());
|
|
2467
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
2468
|
+
}
|
|
2469
|
+
//#endregion
|
|
2470
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js
|
|
2471
|
+
/**
|
|
2472
|
+
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
2473
|
+
* and tracks traversed objects.
|
|
2474
|
+
*
|
|
2475
|
+
* @private
|
|
2476
|
+
* @param {*} value The value to compare.
|
|
2477
|
+
* @param {*} other The other value to compare.
|
|
2478
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2479
|
+
* 1 - Unordered comparison
|
|
2480
|
+
* 2 - Partial comparison
|
|
2481
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
2482
|
+
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
2483
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2484
|
+
*/
|
|
2485
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
2486
|
+
if (value === other) return true;
|
|
2487
|
+
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) return value !== value && other !== other;
|
|
2488
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
2489
|
+
}
|
|
2490
|
+
//#endregion
|
|
2491
|
+
//#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js
|
|
2492
|
+
/**
|
|
2493
|
+
* Performs a deep comparison between two values to determine if they are
|
|
2494
|
+
* equivalent.
|
|
2495
|
+
*
|
|
2496
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
2497
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
2498
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
2499
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
2500
|
+
* nodes are compared by strict equality, i.e. `===`.
|
|
2501
|
+
*
|
|
2502
|
+
* @static
|
|
2503
|
+
* @memberOf _
|
|
2504
|
+
* @since 0.1.0
|
|
2505
|
+
* @category Lang
|
|
2506
|
+
* @param {*} value The value to compare.
|
|
2507
|
+
* @param {*} other The other value to compare.
|
|
2508
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2509
|
+
* @example
|
|
2510
|
+
*
|
|
2511
|
+
* var object = { 'a': 1 };
|
|
2512
|
+
* var other = { 'a': 1 };
|
|
2513
|
+
*
|
|
2514
|
+
* _.isEqual(object, other);
|
|
2515
|
+
* // => true
|
|
2516
|
+
*
|
|
2517
|
+
* object === other;
|
|
2518
|
+
* // => false
|
|
2519
|
+
*/
|
|
2520
|
+
function isEqual(value, other) {
|
|
2521
|
+
return baseIsEqual(value, other);
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/react/useCreation.ts
|
|
2525
|
+
/**
|
|
2526
|
+
* 确保实例不会被重复创建
|
|
2527
|
+
*
|
|
2528
|
+
* @param factory
|
|
2529
|
+
* @param deps
|
|
2530
|
+
*/
|
|
2531
|
+
function useCreation(factory, deps) {
|
|
2532
|
+
const { current } = useRef({
|
|
2533
|
+
deps,
|
|
2534
|
+
result: void 0,
|
|
2535
|
+
isInitialized: false
|
|
2536
|
+
});
|
|
2537
|
+
if (current.isInitialized === false || !isEqual(current.deps, deps)) {
|
|
2538
|
+
current.deps = deps;
|
|
2539
|
+
current.result = factory();
|
|
2540
|
+
current.isInitialized = true;
|
|
2541
|
+
}
|
|
2542
|
+
return current.result;
|
|
2543
|
+
}
|
|
2544
|
+
//#endregion
|
|
2545
|
+
//#region src/react/useLatest.ts
|
|
2546
|
+
/**
|
|
2547
|
+
* 返回当前最新值的 Hook
|
|
2548
|
+
*
|
|
2549
|
+
* @param value
|
|
2550
|
+
*/
|
|
2551
|
+
function useLatest(value) {
|
|
2552
|
+
const ref = useRef(value);
|
|
2553
|
+
ref.current = value;
|
|
2554
|
+
return ref;
|
|
2555
|
+
}
|
|
2556
|
+
//#endregion
|
|
2557
|
+
//#region ../utils/dist/string-CESQdidv.js
|
|
2558
|
+
function _typeof(o) {
|
|
2559
|
+
"@babel/helpers - typeof";
|
|
2560
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
2561
|
+
return typeof o;
|
|
2562
|
+
} : function(o) {
|
|
2563
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
2564
|
+
}, _typeof(o);
|
|
2565
|
+
}
|
|
2566
|
+
function toPrimitive(t, r) {
|
|
2567
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
2568
|
+
var e = t[Symbol.toPrimitive];
|
|
2569
|
+
if (void 0 !== e) {
|
|
2570
|
+
var i = e.call(t, r || "default");
|
|
2571
|
+
if ("object" != _typeof(i)) return i;
|
|
2572
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2573
|
+
}
|
|
2574
|
+
return ("string" === r ? String : Number)(t);
|
|
2575
|
+
}
|
|
2576
|
+
function toPropertyKey(t) {
|
|
2577
|
+
var i = toPrimitive(t, "string");
|
|
2578
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
2579
|
+
}
|
|
2580
|
+
function _defineProperty(e, r, t) {
|
|
2581
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
2582
|
+
value: t,
|
|
2583
|
+
enumerable: !0,
|
|
2584
|
+
configurable: !0,
|
|
2585
|
+
writable: !0
|
|
2586
|
+
}) : e[r] = t, e;
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* 类型工具类
|
|
2590
|
+
*/
|
|
2591
|
+
var TypeUtil = class {
|
|
2592
|
+
/**
|
|
2593
|
+
* 获取值的 [[Prototype]] 标签
|
|
2594
|
+
*
|
|
2595
|
+
* @param value - 任意 JavaScript 值
|
|
2596
|
+
* @returns 标准化的类型标签字符串
|
|
2597
|
+
*/
|
|
2598
|
+
static getPrototypeString(value) {
|
|
2599
|
+
return Object.prototype.toString.call(value);
|
|
2600
|
+
}
|
|
2601
|
+
static isConstructable(fn) {
|
|
2602
|
+
try {
|
|
2603
|
+
Reflect.construct(fn, []);
|
|
2604
|
+
return true;
|
|
2605
|
+
} catch {
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* 检查 value 是否为 string 类型
|
|
2611
|
+
*
|
|
2612
|
+
* @param value 待检查值
|
|
2613
|
+
* @param checkEmpty 是否检查空字符串
|
|
2614
|
+
* @returns 是否为字符串
|
|
2615
|
+
* @example
|
|
2616
|
+
* ```ts
|
|
2617
|
+
* TypeUtil.isString("abc"); // true
|
|
2618
|
+
* TypeUtil.isString(""); // true
|
|
2619
|
+
* TypeUtil.isString("", true); // false
|
|
2620
|
+
* ```
|
|
2621
|
+
*/
|
|
2622
|
+
static isString(value, checkEmpty = false) {
|
|
2623
|
+
return typeof value === "string" && (!checkEmpty || !!value.length);
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* 检查 value 是否为 number 类型
|
|
2627
|
+
*
|
|
2628
|
+
* @param value 待检查值
|
|
2629
|
+
* @param checkNaN 是否排除 `NaN`,默认为 `true`
|
|
2630
|
+
* @returns 是否为 number
|
|
2631
|
+
* @example
|
|
2632
|
+
* ```ts
|
|
2633
|
+
* TypeUtil.isNumber(1); // true
|
|
2634
|
+
* TypeUtil.isNumber(NaN); // false (default)
|
|
2635
|
+
* TypeUtil.isNumber(NaN, false); // true
|
|
2636
|
+
* ```
|
|
2637
|
+
*/
|
|
2638
|
+
static isNumber(value, checkNaN = true) {
|
|
2639
|
+
return typeof value === "number" && (!checkNaN || !this.isNaN(value));
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* 检查 value 是否为 NaN
|
|
2643
|
+
*
|
|
2644
|
+
* @param value 待检查值
|
|
2645
|
+
* @returns 是否为 NaN
|
|
2646
|
+
*/
|
|
2647
|
+
static isNaN(value) {
|
|
2648
|
+
return Number.isNaN(value);
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* 检查 value 是否为整数
|
|
2652
|
+
*
|
|
2653
|
+
* @param value 待检查值
|
|
2654
|
+
* @param checkSafe 是否附加安全整数检查
|
|
2655
|
+
* @returns 是否为整数
|
|
2656
|
+
*/
|
|
2657
|
+
static isInteger(value, checkSafe = true) {
|
|
2658
|
+
const check = Number.isInteger(value);
|
|
2659
|
+
return checkSafe ? check && Number.isSafeInteger(value) : check;
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* 检查 value 是否为正整数
|
|
2663
|
+
* - 此函数中 `0` 不被视为正整数
|
|
2664
|
+
*
|
|
2665
|
+
* @param value 待检查值
|
|
2666
|
+
* @param checkSafe 是否附加安全整数检查
|
|
2667
|
+
*/
|
|
2668
|
+
static isPositiveInteger(value, checkSafe = true) {
|
|
2669
|
+
return this.isInteger(value, checkSafe) && value > 0;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* 检查 value 是否为负整数
|
|
2673
|
+
* - 此函数中 `0` 不被视为负整数
|
|
2674
|
+
*
|
|
2675
|
+
* @param value 待检查值
|
|
2676
|
+
* @param checkSafe 是否附加安全整数检查
|
|
2677
|
+
*/
|
|
2678
|
+
static isNegativeInteger(value, checkSafe = true) {
|
|
2679
|
+
return this.isInteger(value, checkSafe) && value < 0;
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* 检查 value 是否为 Infinity
|
|
2683
|
+
* - 排除 `NaN`
|
|
2684
|
+
*
|
|
2685
|
+
* @param value 待检查值
|
|
2686
|
+
*/
|
|
2687
|
+
static isInfinity(value) {
|
|
2688
|
+
return this.isNumber(value) && (Number.POSITIVE_INFINITY === value || Number.NEGATIVE_INFINITY === value);
|
|
2689
|
+
}
|
|
2690
|
+
/**
|
|
2691
|
+
* 检查 value 是否类似 Infinity
|
|
2692
|
+
* - 排除 `NaN`
|
|
2693
|
+
*
|
|
2694
|
+
* @param value 待检查值
|
|
2695
|
+
*/
|
|
2696
|
+
static isInfinityLike(value) {
|
|
2697
|
+
const check = this.isInfinity(value);
|
|
2698
|
+
if (check) return check;
|
|
2699
|
+
if (typeof value === "string") return [
|
|
2700
|
+
"infinity",
|
|
2701
|
+
"-infinity",
|
|
2702
|
+
"+infinity",
|
|
2703
|
+
"Infinity",
|
|
2704
|
+
"-Infinity",
|
|
2705
|
+
"+Infinity"
|
|
2706
|
+
].includes(value.trim());
|
|
2707
|
+
return false;
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* 检查 value 是否为 Boolean
|
|
2711
|
+
* @param value 待检查值
|
|
2712
|
+
* @returns 是否为 Boolean
|
|
2713
|
+
*/
|
|
2714
|
+
static isBoolean(value) {
|
|
2715
|
+
return typeof value === "boolean";
|
|
2716
|
+
}
|
|
2717
|
+
/**
|
|
2718
|
+
* 检查 value 是否为 BigInt
|
|
2719
|
+
* @param value 待检查值
|
|
2720
|
+
* @returns 是否为 BigInt
|
|
2721
|
+
*/
|
|
2722
|
+
static isBigInt(value) {
|
|
2723
|
+
return typeof value === "bigint";
|
|
2724
|
+
}
|
|
2725
|
+
/**
|
|
2726
|
+
* 检查 value 是否为 Symbol
|
|
2727
|
+
* @param value 待检查值
|
|
2728
|
+
* @returns 是否为 Symbol
|
|
2729
|
+
*/
|
|
2730
|
+
static isSymbol(value) {
|
|
2731
|
+
return typeof value === "symbol";
|
|
2732
|
+
}
|
|
2733
|
+
/**
|
|
2734
|
+
* 检查 value 是否为 undefined
|
|
2735
|
+
* @param value 待检查值
|
|
2736
|
+
* @returns 是否为 undefined
|
|
2737
|
+
*/
|
|
2738
|
+
static isUndefined(value) {
|
|
2739
|
+
return typeof value === "undefined";
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* 检查 value 是否为 null
|
|
2743
|
+
* @param value 待检查值
|
|
2744
|
+
* @returns 是否为 null
|
|
2745
|
+
*/
|
|
2746
|
+
static isNull(value) {
|
|
2747
|
+
return value === null;
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* 检查 value 是否为 Function
|
|
2751
|
+
* @param value 待检查值
|
|
2752
|
+
* @returns 是否为 Function
|
|
2753
|
+
*/
|
|
2754
|
+
static isFunction(value) {
|
|
2755
|
+
return typeof value === "function";
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* 检查 value 是否为 AsyncFunction
|
|
2759
|
+
* @param value 待检查值
|
|
2760
|
+
* @returns 是否为 AsyncFunction
|
|
2761
|
+
*/
|
|
2762
|
+
static isAsyncFunction(value) {
|
|
2763
|
+
return this.isFunction(value) && this.getPrototypeString(value) === this.PROTOTYPE_TAGS.ASYNC_FUNCTION;
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* 检查 value 是否为 GeneratorFunction
|
|
2767
|
+
* @param value 待检查值
|
|
2768
|
+
* @returns 是否为 GeneratorFunction
|
|
2769
|
+
*/
|
|
2770
|
+
static isGeneratorFunction(value) {
|
|
2771
|
+
return this.isFunction(value) && this.getPrototypeString(value) === this.PROTOTYPE_TAGS.GENERATOR_FUNCTION;
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* 检查 value 是否为 AsyncGeneratorFunction
|
|
2775
|
+
* @param value 待检查值
|
|
2776
|
+
* @returns 是否为 AsyncGeneratorFunction
|
|
2777
|
+
*/
|
|
2778
|
+
static isAsyncGeneratorFunction(value) {
|
|
2779
|
+
return this.isFunction(value) && this.getPrototypeString(value) === this.PROTOTYPE_TAGS.ASYNC_GENERATOR_FUNCTION;
|
|
2780
|
+
}
|
|
2781
|
+
/**
|
|
2782
|
+
* 检查 value 是否为 Promise
|
|
2783
|
+
* @param value 待检查值
|
|
2784
|
+
* @returns 是否为 Promise
|
|
2785
|
+
*/
|
|
2786
|
+
static isPromise(value) {
|
|
2787
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.PROMISE;
|
|
2788
|
+
}
|
|
2789
|
+
/**
|
|
2790
|
+
* 检查 value 是否为 PromiseLike
|
|
2791
|
+
* - 可识别拥有 then 方法的非 Promise 对象
|
|
2792
|
+
* @param value 待检查值
|
|
2793
|
+
* @returns 是否为 PromiseLike
|
|
2794
|
+
*/
|
|
2795
|
+
static isPromiseLike(value) {
|
|
2796
|
+
return this.isPromise(value) || this.isObject(value, false) && this.isFunction(value["then"]);
|
|
2797
|
+
}
|
|
2798
|
+
/**
|
|
2799
|
+
* 判断是否为普通对象类型
|
|
2800
|
+
* - 可选是否检查原型为 `Object.prototype`,防止原型链污染
|
|
2801
|
+
*
|
|
2802
|
+
* @param value 待检查值
|
|
2803
|
+
* @param prototypeCheck 是否进行原型检查,默认 `true`
|
|
2804
|
+
* @returns 是否为 Plain Object (当 checkPrototype=true) 或 object
|
|
2805
|
+
* @example
|
|
2806
|
+
* ```ts
|
|
2807
|
+
* TypeUtil.isObject({}); // true
|
|
2808
|
+
* TypeUtil.isObject([]); // false
|
|
2809
|
+
* TypeUtil.isObject(new Date()); // false
|
|
2810
|
+
* TypeUtil.isObject(new Date(), false); // true
|
|
2811
|
+
* TypeUtil.isObject(Object.create(null)) // false
|
|
2812
|
+
* TypeUtil.isObject(Object.create(null), false) // true
|
|
2813
|
+
* ```
|
|
2814
|
+
*/
|
|
2815
|
+
static isObject(value, prototypeCheck = true) {
|
|
2816
|
+
const check = this.getPrototypeString(value) === this.PROTOTYPE_TAGS.OBJECT;
|
|
2817
|
+
return prototypeCheck ? check && Object.getPrototypeOf(value) === Object.prototype : check;
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* 判断一个对象是否为有效的枚举
|
|
2821
|
+
* - 枚举成员不能为空
|
|
2822
|
+
* - 枚举成员的键不能具有数值名
|
|
2823
|
+
* - 枚举成员的值必须类型一致且为 `string` 或 `number` 类型
|
|
2824
|
+
* - 枚举成员的值不能重复
|
|
2825
|
+
* - 枚举成员的值必须全部为双向映射或非双向映射
|
|
2826
|
+
*
|
|
2827
|
+
* @param enumeration 待检查值
|
|
2828
|
+
* @returns [是否为有效的枚举, 是否为双向枚举]
|
|
2829
|
+
*/
|
|
2830
|
+
static isEnumeration(enumeration) {
|
|
2831
|
+
if (typeof enumeration !== "object" || enumeration === null) return [false, false];
|
|
2832
|
+
const keys = Object.keys(enumeration);
|
|
2833
|
+
if (keys.length === 0) return [false, false];
|
|
2834
|
+
const originalKeys = [];
|
|
2835
|
+
const numericKeys = [];
|
|
2836
|
+
for (const key of keys) if (/^\d+$/.test(key)) numericKeys.push(key);
|
|
2837
|
+
else originalKeys.push(key);
|
|
2838
|
+
if (originalKeys.length === 0) return [false, false];
|
|
2839
|
+
let valueType = null;
|
|
2840
|
+
const values = [];
|
|
2841
|
+
for (const key of originalKeys) {
|
|
2842
|
+
const value = enumeration[key];
|
|
2843
|
+
const type = typeof value;
|
|
2844
|
+
if (type !== "string" && type !== "number") return [false, false];
|
|
2845
|
+
if (valueType === null) valueType = type;
|
|
2846
|
+
else if (type !== valueType) return [false, false];
|
|
2847
|
+
values.push(value);
|
|
2848
|
+
}
|
|
2849
|
+
if (new Set(values).size !== values.length) return [false, false];
|
|
2850
|
+
let isBidirectional = false;
|
|
2851
|
+
if (numericKeys.length > 0) {
|
|
2852
|
+
if (numericKeys.length !== originalKeys.length) return [false, false];
|
|
2853
|
+
const reverseMappedNames = /* @__PURE__ */ new Set();
|
|
2854
|
+
for (const numKey of numericKeys) {
|
|
2855
|
+
const reverseValue = enumeration[numKey];
|
|
2856
|
+
if (typeof reverseValue !== "string") return [false, false];
|
|
2857
|
+
if (!originalKeys.includes(reverseValue)) return [false, false];
|
|
2858
|
+
reverseMappedNames.add(reverseValue);
|
|
2859
|
+
}
|
|
2860
|
+
if (reverseMappedNames.size !== originalKeys.length) return [false, false];
|
|
2861
|
+
isBidirectional = true;
|
|
2862
|
+
}
|
|
2863
|
+
return [true, isBidirectional];
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* 检查 value 是否为 Class
|
|
2867
|
+
*
|
|
2868
|
+
* @param value 待检查值
|
|
2869
|
+
* @returns 是否为 Class
|
|
2870
|
+
* @example
|
|
2871
|
+
* ```ts
|
|
2872
|
+
* class A {}
|
|
2873
|
+
* TypeUtil.isClass(A); // true
|
|
2874
|
+
* TypeUtil.isClass(() => {}); // false
|
|
2875
|
+
* ```
|
|
2876
|
+
*/
|
|
2877
|
+
static isClass(value) {
|
|
2878
|
+
return this.isFunction(value) && !this.isAsyncFunction(value) && Function.prototype.toString.call(value).startsWith("class ") && this.isConstructable(value) && value.prototype !== void 0;
|
|
2879
|
+
}
|
|
2880
|
+
/**
|
|
2881
|
+
* 检查 value 是否为数组
|
|
2882
|
+
*
|
|
2883
|
+
* @param value 待检查值
|
|
2884
|
+
* @returns 是否为数组
|
|
2885
|
+
* @example
|
|
2886
|
+
* ```ts
|
|
2887
|
+
* TypeUtil.isArray([]); // true
|
|
2888
|
+
* ```
|
|
2889
|
+
*/
|
|
2890
|
+
static isArray(value) {
|
|
2891
|
+
return Array.isArray(value);
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* 检查 value 是否为 TypedArray
|
|
2895
|
+
*
|
|
2896
|
+
* @param value 待检查值
|
|
2897
|
+
* @returns 是否为 TypedArray
|
|
2898
|
+
* @example
|
|
2899
|
+
* ```ts
|
|
2900
|
+
* TypeUtil.isTypedArray(new Int8Array()); // true
|
|
2901
|
+
* ```
|
|
2902
|
+
*/
|
|
2903
|
+
static isTypedArray(value) {
|
|
2904
|
+
return typeof value === "object" && value !== null && this.TYPED_ARRAY_TAGS.has(this.getPrototypeString(value));
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* 检查 value 是否为 Map
|
|
2908
|
+
* @param value 待检查值
|
|
2909
|
+
* @returns 是否为 Map
|
|
2910
|
+
*/
|
|
2911
|
+
static isMap(value) {
|
|
2912
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.MAP;
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* 检查 value 是否为 WeakMap
|
|
2916
|
+
* @param value 待检查值
|
|
2917
|
+
* @returns 是否为 WeakMap
|
|
2918
|
+
*/
|
|
2919
|
+
static isWeakMap(value) {
|
|
2920
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.WEAK_MAP;
|
|
2921
|
+
}
|
|
2922
|
+
/**
|
|
2923
|
+
* 检查 value 是否为 Set
|
|
2924
|
+
* @param value 待检查值
|
|
2925
|
+
* @returns 是否为 Set
|
|
2926
|
+
*/
|
|
2927
|
+
static isSet(value) {
|
|
2928
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.SET;
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* 检查 value 是否为 WeakSet
|
|
2932
|
+
* @param value 待检查值
|
|
2933
|
+
* @returns 是否为 WeakSet
|
|
2934
|
+
*/
|
|
2935
|
+
static isWeakSet(value) {
|
|
2936
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.WEAK_SET;
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* 检查 value 是否为 Blob
|
|
2940
|
+
* @param value 待检查值
|
|
2941
|
+
* @returns 是否为 Blob
|
|
2942
|
+
*/
|
|
2943
|
+
static isBlob(value) {
|
|
2944
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.BLOB;
|
|
2945
|
+
}
|
|
2946
|
+
/**
|
|
2947
|
+
* 检查 value 是否为 File
|
|
2948
|
+
* @param value 待检查值
|
|
2949
|
+
* @returns 是否为 File
|
|
2950
|
+
*/
|
|
2951
|
+
static isFile(value) {
|
|
2952
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.FILE;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* 检查 value 是否为 ReadableStream
|
|
2956
|
+
* - Uses `Object.prototype.toString` where supported (modern browsers, Node.js ≥18).
|
|
2957
|
+
* - Falls back to duck-typing in older environments.
|
|
2958
|
+
* - Resistant to basic forgery, but not 100% secure in all polyfill scenarios.
|
|
2959
|
+
* - ⚠️ Note: In older Node.js (<18) or with non-compliant polyfills, this may return false positives or negatives.
|
|
2960
|
+
*
|
|
2961
|
+
* @param value 待检查值
|
|
2962
|
+
* @returns 是否为 ReadableStream
|
|
2963
|
+
*/
|
|
2964
|
+
static isReadableStream(value) {
|
|
2965
|
+
if (this.getPrototypeString(value) === this.PROTOTYPE_TAGS.READABLE_STREAM) return true;
|
|
2966
|
+
return this.isObject(value) && this.isFunction(value["getReader"]) && this.isFunction(value["pipeThrough"]);
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* 检查 value 是否为 Window
|
|
2970
|
+
* @param value 待检查值
|
|
2971
|
+
* @returns 是否为 Window
|
|
2972
|
+
*/
|
|
2973
|
+
static isWindow(value) {
|
|
2974
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.WINDOW;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* 检查 value 是否为 HTMLIFrameElement
|
|
2978
|
+
* @param value 待检查值
|
|
2979
|
+
* @returns 是否为 HTMLIFrameElement
|
|
2980
|
+
*/
|
|
2981
|
+
static isIframe(value) {
|
|
2982
|
+
if (typeof window === "undefined") return false;
|
|
2983
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.IFRAME;
|
|
2984
|
+
}
|
|
2985
|
+
/**
|
|
2986
|
+
* 检查 value 是否为 Date 对象
|
|
2987
|
+
*
|
|
2988
|
+
* @param value 待检查值
|
|
2989
|
+
* @param invalidCheck 是否要求日期有效(非 Invalid Date)。默认 true
|
|
2990
|
+
* - true: 仅当是有效 Date 对象时返回 true(排除 new Date('invalid'))
|
|
2991
|
+
* - false: 只要 [[Prototype]] 是 Date 即返回 true(包含 Invalid Date)
|
|
2992
|
+
* @returns 是否为 Date 对象,根据 invalidCheck 返回不同语义的 Date 判定
|
|
2993
|
+
*
|
|
2994
|
+
* @example
|
|
2995
|
+
* ```ts
|
|
2996
|
+
* TypeUtil.isDate(new Date()); // true
|
|
2997
|
+
* TypeUtil.isDate(new Date('invalid')); // false
|
|
2998
|
+
* TypeUtil.isDate(new Date('invalid'), false); // true
|
|
2999
|
+
* TypeUtil.isDate(null); // false
|
|
3000
|
+
* TypeUtil.isDate({}); // false
|
|
3001
|
+
* ```
|
|
3002
|
+
*/
|
|
3003
|
+
static isDate(value, invalidCheck = true) {
|
|
3004
|
+
if (!value || typeof value !== "object") return false;
|
|
3005
|
+
if (this.getPrototypeString(value) !== this.PROTOTYPE_TAGS.DATE) return false;
|
|
3006
|
+
if (!invalidCheck) return true;
|
|
3007
|
+
try {
|
|
3008
|
+
const time = value.getTime();
|
|
3009
|
+
return typeof time === "number" && !Number.isNaN(time);
|
|
3010
|
+
} catch {
|
|
3011
|
+
return false;
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
/**
|
|
3015
|
+
* 检查 value 是否为 Error 对象
|
|
3016
|
+
* @param value 待检查值
|
|
3017
|
+
* @returns 是否为 Error
|
|
3018
|
+
*/
|
|
3019
|
+
static isError(value) {
|
|
3020
|
+
return value instanceof Error || this.getPrototypeString(value) === this.PROTOTYPE_TAGS.ERROR;
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* 检查 value 是否为 RegExp
|
|
3024
|
+
* @param value 待检查值
|
|
3025
|
+
* @returns 是否为 RegExp
|
|
3026
|
+
*/
|
|
3027
|
+
static isRegExp(value) {
|
|
3028
|
+
if (typeof value !== "object" || value === null) return false;
|
|
3029
|
+
try {
|
|
3030
|
+
const regex = value;
|
|
3031
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.REG_EXP && this.isString(regex.source) && this.isString(regex.flags) && this.isBoolean(regex.global) && this.isFunction(regex.test);
|
|
3032
|
+
} catch (error) {
|
|
3033
|
+
return false;
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* 检查 value 是否为 WebSocket
|
|
3038
|
+
* @param value 待检查值
|
|
3039
|
+
* @returns 是否为 WebSocket
|
|
3040
|
+
*/
|
|
3041
|
+
static isWebSocket(value) {
|
|
3042
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.WEB_SOCKET;
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* 检查 value 是否为 URLSearchParams
|
|
3046
|
+
* @param value 待检查值
|
|
3047
|
+
* @returns 是否为 URLSearchParams
|
|
3048
|
+
*/
|
|
3049
|
+
static isURLSearchParams(value) {
|
|
3050
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.URL_SEARCH_PARAMS;
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* 检查 value 是否为 AbortSignal
|
|
3054
|
+
* @param value 待检查值
|
|
3055
|
+
* @returns 是否为 AbortSignal
|
|
3056
|
+
*/
|
|
3057
|
+
static isAbortSignal(value) {
|
|
3058
|
+
return this.getPrototypeString(value) === this.PROTOTYPE_TAGS.ABORT_SIGNAL;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* 检查 value 是否为可迭代对象 (Iterable)
|
|
3062
|
+
* @param value 待检查值
|
|
3063
|
+
* @returns 是否为 Iterable
|
|
3064
|
+
*/
|
|
3065
|
+
static isIterable(value) {
|
|
3066
|
+
return !!value && typeof value[Symbol.iterator] === "function";
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* 检查 value 是否为 Falsy 值 (false, 0, "", null, undefined, NaN)
|
|
3070
|
+
* @param value 待检查值
|
|
3071
|
+
* @returns 是否为 Falsy
|
|
3072
|
+
*/
|
|
3073
|
+
static isFalsy(value) {
|
|
3074
|
+
if (this.isNaN(value) || this.isNull(value) || this.isUndefined(value)) return true;
|
|
3075
|
+
return value === false || value === 0 || value === 0n || value === "";
|
|
3076
|
+
}
|
|
3077
|
+
static isFalsyLike(value) {
|
|
3078
|
+
if (this.isFalsy(value)) return true;
|
|
3079
|
+
return typeof value === "string" && (value === "null" || value === "undefined" || value === "NaN" || value === "false" || value === "0" || value === "-0" || value === "0n");
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3082
|
+
_defineProperty(TypeUtil, "PROTOTYPE_TAGS", {
|
|
3083
|
+
STRING: "[object String]",
|
|
3084
|
+
NUMBER: "[object Number]",
|
|
3085
|
+
BOOLEAN: "[object Boolean]",
|
|
3086
|
+
BIGINT: "[object BigInt]",
|
|
3087
|
+
SYMBOL: "[object Symbol]",
|
|
3088
|
+
UNDEFINED: "[object Undefined]",
|
|
3089
|
+
NULL: "[object Null]",
|
|
3090
|
+
OBJECT: "[object Object]",
|
|
3091
|
+
FUNCTION: "[object Function]",
|
|
3092
|
+
GENERATOR_FUNCTION: "[object GeneratorFunction]",
|
|
3093
|
+
ASYNC_FUNCTION: "[object AsyncFunction]",
|
|
3094
|
+
ASYNC_GENERATOR_FUNCTION: "[object AsyncGeneratorFunction]",
|
|
3095
|
+
PROMISE: "[object Promise]",
|
|
3096
|
+
MAP: "[object Map]",
|
|
3097
|
+
SET: "[object Set]",
|
|
3098
|
+
WEAK_MAP: "[object WeakMap]",
|
|
3099
|
+
WEAK_SET: "[object WeakSet]",
|
|
3100
|
+
BLOB: "[object Blob]",
|
|
3101
|
+
FILE: "[object File]",
|
|
3102
|
+
READABLE_STREAM: "[object ReadableStream]",
|
|
3103
|
+
GLOBAL: "[object global]",
|
|
3104
|
+
WINDOW: "[object Window]",
|
|
3105
|
+
IFRAME: "[object HTMLIFrameElement]",
|
|
3106
|
+
DATE: "[object Date]",
|
|
3107
|
+
ERROR: "[object Error]",
|
|
3108
|
+
REG_EXP: "[object RegExp]",
|
|
3109
|
+
WEB_SOCKET: "[object WebSocket]",
|
|
3110
|
+
URL_SEARCH_PARAMS: "[object URLSearchParams]",
|
|
3111
|
+
ABORT_SIGNAL: "[object AbortSignal]"
|
|
3112
|
+
});
|
|
3113
|
+
_defineProperty(TypeUtil, "TYPED_ARRAY_TAGS", new Set([
|
|
3114
|
+
"[object Int8Array]",
|
|
3115
|
+
"[object Uint8Array]",
|
|
3116
|
+
"[object Uint8ClampedArray]",
|
|
3117
|
+
"[object Int16Array]",
|
|
3118
|
+
"[object Uint16Array]",
|
|
3119
|
+
"[object Int32Array]",
|
|
3120
|
+
"[object Uint32Array]",
|
|
3121
|
+
"[object Float32Array]",
|
|
3122
|
+
"[object Float64Array]",
|
|
3123
|
+
"[object BigInt64Array]",
|
|
3124
|
+
"[object BigUint64Array]"
|
|
3125
|
+
]));
|
|
3126
|
+
/**
|
|
3127
|
+
* 字符串工具类
|
|
3128
|
+
*/
|
|
3129
|
+
var StringUtil = class {
|
|
3130
|
+
/**
|
|
3131
|
+
* 从字符串中提取数字字符串
|
|
3132
|
+
* - 移除非数字字符,保留符号和小数点
|
|
3133
|
+
*
|
|
3134
|
+
* @param input 待处理字符串
|
|
3135
|
+
* @returns 提取出的数字字符串
|
|
3136
|
+
* @example
|
|
3137
|
+
* ```ts
|
|
3138
|
+
* StringUtil.toNumber("$1,234.56"); // "1234.56"
|
|
3139
|
+
* StringUtil.toNumber("abc-123"); // "-123"
|
|
3140
|
+
* ```
|
|
3141
|
+
*/
|
|
3142
|
+
static toNumber(input) {
|
|
3143
|
+
if (!TypeUtil.isString(input, true)) return "0";
|
|
3144
|
+
const cleaned = input.replace(/[^0-9.-]/g, "");
|
|
3145
|
+
if (!cleaned) return "0";
|
|
3146
|
+
let isDecimal = false;
|
|
3147
|
+
let signCount = 0;
|
|
3148
|
+
let firstIndex = -1;
|
|
3149
|
+
const stringList = cleaned.split("").map((s, i) => {
|
|
3150
|
+
if (s === ".") {
|
|
3151
|
+
if (isDecimal) return "";
|
|
3152
|
+
isDecimal = true;
|
|
3153
|
+
return ".";
|
|
3154
|
+
}
|
|
3155
|
+
if (s === "-") {
|
|
3156
|
+
firstIndex === -1 && signCount++;
|
|
3157
|
+
return "";
|
|
3158
|
+
}
|
|
3159
|
+
firstIndex === -1 && (firstIndex = i);
|
|
3160
|
+
return s;
|
|
3161
|
+
});
|
|
3162
|
+
const sign = signCount % 2 === 1 ? "-" : "";
|
|
3163
|
+
if (firstIndex === -1) return sign + "0";
|
|
3164
|
+
let result = stringList.join("");
|
|
3165
|
+
if (result.startsWith(".")) result = "0" + result;
|
|
3166
|
+
if (result.endsWith(".")) result = result.slice(0, -1);
|
|
3167
|
+
return sign + result;
|
|
3168
|
+
}
|
|
3169
|
+
static toLowerCase(input) {
|
|
3170
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3171
|
+
return input.toLowerCase();
|
|
3172
|
+
}
|
|
3173
|
+
static toUpperCase(input) {
|
|
3174
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3175
|
+
return input.toUpperCase();
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* 字符串首字母大小写
|
|
3179
|
+
* - 包含非西欧字母字符时,不处理
|
|
3180
|
+
* - 纯字母且全大写时,不处理
|
|
3181
|
+
* - 纯字母且非全大写时,首字母小写,其余保留
|
|
3182
|
+
* - 纯字母且非全大写时,首字母大写,其余保留
|
|
3183
|
+
*
|
|
3184
|
+
* @param input 待处理字符串
|
|
3185
|
+
* @param caseType 大小写类型
|
|
3186
|
+
* @returns 处理后的字符串
|
|
3187
|
+
* @example
|
|
3188
|
+
* ```ts
|
|
3189
|
+
* StringUtil.toInitialCase("Hello", "lower"); // "hello"
|
|
3190
|
+
* StringUtil.toInitialCase("hello", "upper"); // "Hello"
|
|
3191
|
+
* ```
|
|
3192
|
+
*/
|
|
3193
|
+
static toInitialCase(input, caseType) {
|
|
3194
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3195
|
+
return input.replace(/\S+/g, (word) => {
|
|
3196
|
+
if (/[^a-zA-Z\u00C0-\u017F]/.test(word)) return word;
|
|
3197
|
+
if (word === word.toLocaleUpperCase()) return word;
|
|
3198
|
+
if (caseType === "lower" && word[0]) return word[0].toLocaleLowerCase() + word.slice(1);
|
|
3199
|
+
if (caseType === "upper" && word[0]) return word[0].toLocaleUpperCase() + word.slice(1);
|
|
3200
|
+
return word;
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* 将路径转换为 POSIX 风格
|
|
3205
|
+
* - 统一使用正斜杠 (/)
|
|
3206
|
+
* - 可选移除 Windows 盘符 (如 C:)
|
|
3207
|
+
* - 可选移除开头的斜杠
|
|
3208
|
+
* - 规范化连续斜杠为单个斜杠
|
|
3209
|
+
*
|
|
3210
|
+
* @param input 待处理字符串
|
|
3211
|
+
* @param removeLeadingSlash 是否移除开头斜杠,默认为 `false`。如果移除了盘符,路径通常会以 / 开头,此参数可控制是否保留该 /
|
|
3212
|
+
* @returns 转换后的路径,如果输入无效则返回空字符串
|
|
3213
|
+
*
|
|
3214
|
+
* @example
|
|
3215
|
+
* ```ts
|
|
3216
|
+
* StringUtil.toPosix("C:\\Windows\\System32"); // 默认: "/Windows/System32" (移除了 C: 并标准化)
|
|
3217
|
+
*
|
|
3218
|
+
* StringUtil.toPosix("C:\\Windows\\System32", true); // 移除开头斜杠: "Windows/System32"
|
|
3219
|
+
*
|
|
3220
|
+
* StringUtil.toPosix("\\\\server\\share\\file.txt"); // UNC 路径: "/server/share/file.txt"
|
|
3221
|
+
*
|
|
3222
|
+
* StringUtil.toPosix("folder\\subfolder\\file.txt"); // 相对路径: "folder/subfolder/file.txt"
|
|
3223
|
+
* ```
|
|
3224
|
+
*/
|
|
3225
|
+
static toPosix(input, removeLeadingSlash = false) {
|
|
3226
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3227
|
+
let normalized = input.replace(/^[A-Za-z]:([\\/])?/, (_, separator) => {
|
|
3228
|
+
return separator ? "/" : "";
|
|
3229
|
+
});
|
|
3230
|
+
normalized = normalized.replace(/\\/g, "/");
|
|
3231
|
+
normalized = normalized.replace(/\/+/g, "/");
|
|
3232
|
+
if (removeLeadingSlash && normalized.startsWith("/")) normalized = normalized.substring(1);
|
|
3233
|
+
return normalized;
|
|
3234
|
+
}
|
|
3235
|
+
static toJson(input, fallback) {
|
|
3236
|
+
if (!TypeUtil.isString(input, true)) return fallback;
|
|
3237
|
+
try {
|
|
3238
|
+
return JSON.parse(input);
|
|
3239
|
+
} catch (error) {
|
|
3240
|
+
return fallback;
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
static toValues(input, valueType = "number", splitSymbol = ",") {
|
|
3244
|
+
if (!TypeUtil.isString(input, true)) return [];
|
|
3245
|
+
try {
|
|
3246
|
+
const values = input.split(splitSymbol);
|
|
3247
|
+
if (valueType === "number") return values.map((d) => Number(d));
|
|
3248
|
+
return values;
|
|
3249
|
+
} catch (error) {
|
|
3250
|
+
return [];
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
/**
|
|
3254
|
+
* 从字符串中裁切掉所有的前缀和后缀字符
|
|
3255
|
+
*
|
|
3256
|
+
* @param input 待处理字符串
|
|
3257
|
+
* @param charsToTrim 裁切字符,默认为 `" "`
|
|
3258
|
+
* @returns 裁切后的字符串
|
|
3259
|
+
* @example
|
|
3260
|
+
* ```ts
|
|
3261
|
+
* StringUtil.trim(" hello "); // "hello"
|
|
3262
|
+
* StringUtil.trim("__hello__", "_"); // "hello"
|
|
3263
|
+
* ```
|
|
3264
|
+
*/
|
|
3265
|
+
static trim(input, charsToTrim = " ") {
|
|
3266
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3267
|
+
const toTrim = charsToTrim.replace(/[\W]{1}/g, "\\$&");
|
|
3268
|
+
const regex = new RegExp(`^[${toTrim}]+|[${toTrim}]+$`, "g");
|
|
3269
|
+
return input.replace(regex, "");
|
|
3270
|
+
}
|
|
3271
|
+
/**
|
|
3272
|
+
* 截取字符串
|
|
3273
|
+
* - 支持自定义省略符,不会截断在汉字中间(因为JS字符串本身按字符处理)
|
|
3274
|
+
*
|
|
3275
|
+
* @param input 待处理字符串
|
|
3276
|
+
* @param maxLength 最大长度 (包含省略符)
|
|
3277
|
+
* @param ellipsis 省略符,默认为 `...`
|
|
3278
|
+
* @returns 截取后的字符串
|
|
3279
|
+
* @example
|
|
3280
|
+
* ```ts
|
|
3281
|
+
* StringUtil.truncate("hello world", 8); // "hello..."
|
|
3282
|
+
* ```
|
|
3283
|
+
*/
|
|
3284
|
+
static truncate(input, maxLength, ellipsis = "...") {
|
|
3285
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3286
|
+
const codePoints = Array.from(input);
|
|
3287
|
+
if (!TypeUtil.isInteger(maxLength) || maxLength < 0) return input;
|
|
3288
|
+
if (codePoints.length <= maxLength) return input;
|
|
3289
|
+
const availableLength = maxLength - ellipsis.length;
|
|
3290
|
+
if (availableLength <= 0) return "";
|
|
3291
|
+
return codePoints.slice(0, availableLength).join("") + ellipsis;
|
|
3292
|
+
}
|
|
3293
|
+
/**
|
|
3294
|
+
* 字符串模板替换
|
|
3295
|
+
* - 使用对象的属性值替换字符串中的 {{key}} 模板
|
|
3296
|
+
*
|
|
3297
|
+
* @param input 待处理字符串
|
|
3298
|
+
* @param template 模板对象
|
|
3299
|
+
* @param regex 模板匹配正则 (默认: `\{\{(.+?)\}\}`)
|
|
3300
|
+
* @returns 替换后的字符串
|
|
3301
|
+
* @example
|
|
3302
|
+
* ```ts
|
|
3303
|
+
* StringUtil.template("Hello {{name}}", { name: "World" }); // "Hello World"
|
|
3304
|
+
* ```
|
|
3305
|
+
*/
|
|
3306
|
+
static template(input, template, regex = /\{\{(.+?)\}\}/g) {
|
|
3307
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3308
|
+
regex.lastIndex = 0;
|
|
3309
|
+
let result = "";
|
|
3310
|
+
let from = 0;
|
|
3311
|
+
let match;
|
|
3312
|
+
while (match = regex.exec(input)) {
|
|
3313
|
+
const replacement = template[match[1]];
|
|
3314
|
+
const valueToInsert = replacement === null || replacement === void 0 ? match[0] : replacement;
|
|
3315
|
+
result += input.slice(from, match.index) + valueToInsert;
|
|
3316
|
+
from = regex.lastIndex;
|
|
3317
|
+
}
|
|
3318
|
+
return result + input.slice(from);
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* 字符串替换
|
|
3322
|
+
* - 替换第一个匹配项
|
|
3323
|
+
*
|
|
3324
|
+
* @param input 待处理字符串
|
|
3325
|
+
* @param search 匹配项
|
|
3326
|
+
* @param replacement 替换项
|
|
3327
|
+
* @returns 替换后的字符串
|
|
3328
|
+
* @example
|
|
3329
|
+
* ```ts
|
|
3330
|
+
* StringUtil.replace("hello world", "world", "context"); // "hello context"
|
|
3331
|
+
* ```
|
|
3332
|
+
*/
|
|
3333
|
+
static replace(input, search, replacement) {
|
|
3334
|
+
if (!TypeUtil.isString(input, true)) return "";
|
|
3335
|
+
return input.replace(search, replacement);
|
|
3336
|
+
}
|
|
3337
|
+
};
|
|
3338
|
+
//#endregion
|
|
3339
|
+
//#region ../utils/dist/index.js
|
|
3340
|
+
/**
|
|
3341
|
+
* 数组工具类
|
|
3342
|
+
*/
|
|
3343
|
+
var ArrayUtil = class {
|
|
3344
|
+
static cast(candidate, checkEmpty = true) {
|
|
3345
|
+
if (checkEmpty && (TypeUtil.isUndefined(candidate) || TypeUtil.isNull(candidate))) return [];
|
|
3346
|
+
return TypeUtil.isArray(candidate) ? [...candidate] : [candidate];
|
|
3347
|
+
}
|
|
3348
|
+
static first(initialList, fallback) {
|
|
3349
|
+
if (!TypeUtil.isArray(initialList) || initialList.length === 0) return fallback;
|
|
3350
|
+
return initialList[0];
|
|
3351
|
+
}
|
|
3352
|
+
static last(initialList, fallback) {
|
|
3353
|
+
if (!TypeUtil.isArray(initialList) || initialList.length === 0) return fallback;
|
|
3354
|
+
return initialList[initialList.length - 1];
|
|
3355
|
+
}
|
|
3356
|
+
/**
|
|
3357
|
+
* 数组竞选
|
|
3358
|
+
* - 返回在匹配函数的比较条件中获胜的最终项目,适用于更复杂的最小值/最大值计算
|
|
3359
|
+
*
|
|
3360
|
+
* @param initialList 数组
|
|
3361
|
+
* @param match 匹配函数
|
|
3362
|
+
* @returns 获胜的元素,如果数组为空或参数无效则返回 `null`
|
|
3363
|
+
* @example
|
|
3364
|
+
* ```ts
|
|
3365
|
+
* const list = [1, 10, 5];
|
|
3366
|
+
* ArrayUtil.compete(list, (a, b) => (a > b ? a : b)); // 10
|
|
3367
|
+
* ArrayUtil.compete(list, (a, b) => (a < b ? a : b)); // 1
|
|
3368
|
+
* ```
|
|
3369
|
+
*/
|
|
3370
|
+
static compete(initialList, match) {
|
|
3371
|
+
if (!TypeUtil.isArray(initialList) || initialList.length === 0 || !TypeUtil.isFunction(match)) return null;
|
|
3372
|
+
return initialList.reduce(match);
|
|
3373
|
+
}
|
|
3374
|
+
/**
|
|
3375
|
+
* 统计数组的项目出现次数
|
|
3376
|
+
* - 通过给定的标识符匹配函数,返回一个对象,其中键是回调函数返回的 key 值,每个值是一个整数,表示该 key 出现的次数
|
|
3377
|
+
*
|
|
3378
|
+
* @param initialList 初始数组
|
|
3379
|
+
* @param match 匹配函数
|
|
3380
|
+
* @returns 统计对象
|
|
3381
|
+
* @example
|
|
3382
|
+
* ```ts
|
|
3383
|
+
* const list = ["a", "b", "a", "c"];
|
|
3384
|
+
* ArrayUtil.count(list, (x) => x); // { a: 2, b: 1, c: 1 }
|
|
3385
|
+
*
|
|
3386
|
+
* const users = [{ id: 1, group: "A" }, { id: 2, group: "B" }, { id: 3, group: "A" }];
|
|
3387
|
+
* ArrayUtil.count(users, (u) => u.group); // { A: 2, B: 1 }
|
|
3388
|
+
* ```
|
|
3389
|
+
*/
|
|
3390
|
+
static count(initialList, match) {
|
|
3391
|
+
if (!TypeUtil.isArray(initialList) || !TypeUtil.isFunction(match)) return {};
|
|
3392
|
+
return initialList.reduce((prev, curr, index) => {
|
|
3393
|
+
const id = match(curr, index).toString();
|
|
3394
|
+
prev[id] = (prev[id] ?? 0) + 1;
|
|
3395
|
+
return prev;
|
|
3396
|
+
}, {});
|
|
3397
|
+
}
|
|
3398
|
+
/**
|
|
3399
|
+
* 获取数组差集
|
|
3400
|
+
* - 返回在 `initialList` 中存在,但在 `diffList` 中不存在的元素
|
|
3401
|
+
*
|
|
3402
|
+
* @param initialList 初始数组
|
|
3403
|
+
* @param diffList 对比数组
|
|
3404
|
+
* @param match 匹配函数
|
|
3405
|
+
* @returns 差集数组
|
|
3406
|
+
* @example
|
|
3407
|
+
* ```ts
|
|
3408
|
+
* ArrayUtil.difference([1, 2, 3], [2, 3, 4]); // [1]
|
|
3409
|
+
* ArrayUtil.difference([{ id: 1 }, { id: 2 }], [{ id: 2 }], (x) => x.id); // [{ id: 1 }]
|
|
3410
|
+
* ```
|
|
3411
|
+
*/
|
|
3412
|
+
static difference(initialList, diffList, match) {
|
|
3413
|
+
if (!TypeUtil.isArray(initialList) && !TypeUtil.isArray(diffList)) return [];
|
|
3414
|
+
if (!TypeUtil.isArray(initialList) || !initialList.length) return [];
|
|
3415
|
+
if (!TypeUtil.isArray(diffList) || !diffList.length) return [...initialList];
|
|
3416
|
+
if (!TypeUtil.isFunction(match)) {
|
|
3417
|
+
const arraySet = new Set(diffList);
|
|
3418
|
+
return Array.from(new Set(initialList.filter((item) => !arraySet.has(item))));
|
|
3419
|
+
}
|
|
3420
|
+
const map = /* @__PURE__ */ new Map();
|
|
3421
|
+
diffList.forEach((item, index) => {
|
|
3422
|
+
map.set(match(item, index), true);
|
|
3423
|
+
});
|
|
3424
|
+
return initialList.filter((item, index) => !map.get(match(item, index)));
|
|
3425
|
+
}
|
|
3426
|
+
static intersection(initialList, diffList, match) {
|
|
3427
|
+
if (!TypeUtil.isArray(initialList) || !TypeUtil.isArray(diffList)) return [];
|
|
3428
|
+
if (!initialList.length || !diffList.length) return [];
|
|
3429
|
+
if (!TypeUtil.isFunction(match)) {
|
|
3430
|
+
const diffSet = new Set(diffList);
|
|
3431
|
+
return initialList.filter((item) => diffSet.has(item));
|
|
3432
|
+
}
|
|
3433
|
+
const diffKeys = new Set(diffList.map((item, index) => match(item, index)));
|
|
3434
|
+
return initialList.filter((item, index) => diffKeys.has(match(item, index)));
|
|
3435
|
+
}
|
|
3436
|
+
static merge(initialList, mergeList, match) {
|
|
3437
|
+
if (!TypeUtil.isArray(initialList)) return [];
|
|
3438
|
+
if (!TypeUtil.isArray(mergeList)) return [...initialList];
|
|
3439
|
+
if (!TypeUtil.isFunction(match)) return Array.from(new Set([...initialList, ...mergeList]));
|
|
3440
|
+
const keys = /* @__PURE__ */ new Map();
|
|
3441
|
+
mergeList.forEach((item, index) => {
|
|
3442
|
+
keys.set(match(item, index), item);
|
|
3443
|
+
});
|
|
3444
|
+
return initialList.map((prevItem, index) => {
|
|
3445
|
+
const key = match(prevItem, index);
|
|
3446
|
+
return keys.has(key) ? keys.get(key) : prevItem;
|
|
3447
|
+
});
|
|
3448
|
+
}
|
|
3449
|
+
static pick(initialList, filter, mapper) {
|
|
3450
|
+
if (!TypeUtil.isArray(initialList)) return [];
|
|
3451
|
+
if (!TypeUtil.isFunction(filter)) return [...initialList];
|
|
3452
|
+
const hasMapper = TypeUtil.isFunction(mapper);
|
|
3453
|
+
return initialList.reduce((prev, curr, index) => {
|
|
3454
|
+
if (!filter(curr, index)) return prev;
|
|
3455
|
+
if (hasMapper) prev.push(mapper(curr, index));
|
|
3456
|
+
else prev.push(curr);
|
|
3457
|
+
return prev;
|
|
3458
|
+
}, []);
|
|
3459
|
+
}
|
|
3460
|
+
static replace(initialList, newItem, match) {
|
|
3461
|
+
if (!TypeUtil.isArray(initialList) || !initialList.length) return [];
|
|
3462
|
+
if (!TypeUtil.isFunction(match)) return [...initialList];
|
|
3463
|
+
for (let i = 0; i < initialList.length; i++) {
|
|
3464
|
+
const item = initialList[i];
|
|
3465
|
+
if (match(item, i)) return [
|
|
3466
|
+
...initialList.slice(0, i),
|
|
3467
|
+
newItem,
|
|
3468
|
+
...initialList.slice(i + 1, initialList.length)
|
|
3469
|
+
];
|
|
3470
|
+
}
|
|
3471
|
+
return [...initialList];
|
|
3472
|
+
}
|
|
3473
|
+
/**
|
|
3474
|
+
* 数组项替换并移动
|
|
3475
|
+
* - 在给定的数组中,替换并移动符合匹配函数结果的项目
|
|
3476
|
+
* - 只替换和移动第一个匹配项
|
|
3477
|
+
* - 未匹配时,根据 `position` 在指定位置插入 `newItem`
|
|
3478
|
+
*
|
|
3479
|
+
* @param initialList 初始数组
|
|
3480
|
+
* @param newItem 替换项
|
|
3481
|
+
* @param match 匹配函数
|
|
3482
|
+
* @param position 移动位置,可选 `start` | `end` | 索引位置, 默认为 `end`
|
|
3483
|
+
* @returns
|
|
3484
|
+
* @example
|
|
3485
|
+
* ```ts
|
|
3486
|
+
* ArrayUtil.replaceMove([1, 2, 3, 4], 5, (n) => n === 2, 0); // [5, 1, 3, 4]
|
|
3487
|
+
* ArrayUtil.replaceMove([1, 2, 3, 4], 5, (n) => n === 2, 2); // [1, 3, 5, 4]
|
|
3488
|
+
* ArrayUtil.replaceMove([1, 2, 3, 4], 5, (n) => n === 2, "start"); // [5, 1, 3, 4]
|
|
3489
|
+
* ArrayUtil.replaceMove([1, 2, 3, 4], 5, (n) => n === 2); // [1, 3, 4, 5]
|
|
3490
|
+
* ```
|
|
3491
|
+
*/
|
|
3492
|
+
static replaceMove(initialList, newItem, match, position) {
|
|
3493
|
+
if (!TypeUtil.isArray(initialList)) return [];
|
|
3494
|
+
if (!initialList.length) return [newItem];
|
|
3495
|
+
if (!TypeUtil.isFunction(match)) return [...initialList];
|
|
3496
|
+
const result = [...initialList];
|
|
3497
|
+
const matchIndex = initialList.findIndex(match);
|
|
3498
|
+
if (matchIndex !== -1) result.splice(matchIndex, 1);
|
|
3499
|
+
if (position === "start") result.unshift(newItem);
|
|
3500
|
+
else if (position === 0 || TypeUtil.isPositiveInteger(position, false)) result.splice(Math.min(position, result.length), 0, newItem);
|
|
3501
|
+
else result.push(newItem);
|
|
3502
|
+
return result;
|
|
3503
|
+
}
|
|
3504
|
+
/**
|
|
3505
|
+
* 数组切分
|
|
3506
|
+
* - 将数组以指定的长度切分后,组合在高维数组中
|
|
3507
|
+
*
|
|
3508
|
+
* @param initialList 初始数组
|
|
3509
|
+
* @param size 分割尺寸,默认 `10`
|
|
3510
|
+
* @returns 切分后的二维数组
|
|
3511
|
+
* @example
|
|
3512
|
+
* ```ts
|
|
3513
|
+
* ArrayUtil.split([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
|
|
3514
|
+
* ```
|
|
3515
|
+
*/
|
|
3516
|
+
static split(initialList, size = 10) {
|
|
3517
|
+
if (!TypeUtil.isArray(initialList)) return [];
|
|
3518
|
+
if (!TypeUtil.isPositiveInteger(size, false)) return [];
|
|
3519
|
+
const count = Math.ceil(initialList.length / size);
|
|
3520
|
+
return Array.from({ length: count }).fill(null).map((_c, i) => {
|
|
3521
|
+
return initialList.slice(i * size, i * size + size);
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
/**
|
|
3525
|
+
* 数组分组过滤
|
|
3526
|
+
* - 给定一个数组和一个条件,返回一个由两个数组组成的元组,其中第一个数组包含所有满足条件的项,第二个数组包含所有不满足条件的项
|
|
3527
|
+
*
|
|
3528
|
+
* @param initialList 初始数组
|
|
3529
|
+
* @param match 条件匹配函数
|
|
3530
|
+
* @returns [满足条件的项[], 不满足条件的项[]]
|
|
3531
|
+
* @example
|
|
3532
|
+
* ```ts
|
|
3533
|
+
* ArrayUtil.fork([1, 2, 3, 4], (n) => n % 2 === 0); // [[2, 4], [1, 3]]
|
|
3534
|
+
* ```
|
|
3535
|
+
*/
|
|
3536
|
+
static fork(initialList, match) {
|
|
3537
|
+
const forked = [[], []];
|
|
3538
|
+
if (TypeUtil.isArray(initialList)) initialList.forEach((item, index) => {
|
|
3539
|
+
forked[match(item, index) ? 0 : 1].push(item);
|
|
3540
|
+
});
|
|
3541
|
+
return forked;
|
|
3542
|
+
}
|
|
3543
|
+
/**
|
|
3544
|
+
* 数组解压
|
|
3545
|
+
* - `ArrayUtil.zip` 的反向操作
|
|
3546
|
+
*
|
|
3547
|
+
* @param arrayList 压缩后的数组
|
|
3548
|
+
* @returns 解压后的二维数组
|
|
3549
|
+
* @example
|
|
3550
|
+
* ```ts
|
|
3551
|
+
* ArrayUtil.unzip([[1, "a"], [2, "b"]]); // [[1, 2], ["a", "b"]]
|
|
3552
|
+
* ```
|
|
3553
|
+
*/
|
|
3554
|
+
static unzip(arrayList) {
|
|
3555
|
+
if (!TypeUtil.isArray(arrayList) || !arrayList.length) return [];
|
|
3556
|
+
const out = new Array(arrayList.reduce((max, arr) => Math.max(max, arr.length), 0));
|
|
3557
|
+
let index = 0;
|
|
3558
|
+
const get = (array) => array[index];
|
|
3559
|
+
for (; index < out.length; index++) out[index] = Array.from(arrayList, get);
|
|
3560
|
+
return out;
|
|
3561
|
+
}
|
|
3562
|
+
static zip(...arrays) {
|
|
3563
|
+
return this.unzip(arrays);
|
|
3564
|
+
}
|
|
3565
|
+
static zipToObject(keys, values) {
|
|
3566
|
+
const result = {};
|
|
3567
|
+
if (!TypeUtil.isArray(keys) || !keys.length) return result;
|
|
3568
|
+
const getValue = TypeUtil.isFunction(values) ? values : TypeUtil.isArray(values) ? (_k, i) => values[i] : (_k, _i) => values;
|
|
3569
|
+
return keys.reduce((acc, key, idx) => {
|
|
3570
|
+
acc[key] = getValue(key, idx);
|
|
3571
|
+
return acc;
|
|
3572
|
+
}, result);
|
|
3573
|
+
}
|
|
3574
|
+
};
|
|
3575
|
+
var _DateTimeUtil;
|
|
3576
|
+
/**
|
|
3577
|
+
* 日期工具类
|
|
3578
|
+
*/
|
|
3579
|
+
var DateTimeUtil = class {
|
|
3580
|
+
/**
|
|
3581
|
+
* 获取当前时区信息
|
|
3582
|
+
*
|
|
3583
|
+
* @returns 时区信息对象 (UTC偏移和时区名称)
|
|
3584
|
+
* @example
|
|
3585
|
+
* ```ts
|
|
3586
|
+
* DateTimeUtil.getTimeZone(); // { UTC: "UTC+8", timeZone: "Asia/Shanghai" }
|
|
3587
|
+
* ```
|
|
3588
|
+
*/
|
|
3589
|
+
static getTimeZone() {
|
|
3590
|
+
const hour = 0 - (/* @__PURE__ */ new Date()).getTimezoneOffset() / this.MINUTE_PER_HOUR;
|
|
3591
|
+
return {
|
|
3592
|
+
UTC: "UTC" + (hour >= 0 ? "+" + hour : hour),
|
|
3593
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
3594
|
+
};
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3597
|
+
_DateTimeUtil = DateTimeUtil;
|
|
3598
|
+
_defineProperty(DateTimeUtil, "MILLISECONDS_PER_SECOND", 1e3);
|
|
3599
|
+
_defineProperty(DateTimeUtil, "SECOND_PER_MINUTE", 60);
|
|
3600
|
+
_defineProperty(DateTimeUtil, "MINUTE_PER_HOUR", 60);
|
|
3601
|
+
_defineProperty(DateTimeUtil, "SECOND_PER_HOUR", _DateTimeUtil.SECOND_PER_MINUTE ** 2);
|
|
3602
|
+
_defineProperty(DateTimeUtil, "HOUR_PER_DAY", 24);
|
|
3603
|
+
_defineProperty(DateTimeUtil, "SECOND_PER_DAY", _DateTimeUtil.SECOND_PER_HOUR * _DateTimeUtil.HOUR_PER_DAY);
|
|
3604
|
+
_defineProperty(DateTimeUtil, "DAY_PER_WEEK", 7);
|
|
3605
|
+
_defineProperty(DateTimeUtil, "DAY_PER_MONTH", 30);
|
|
3606
|
+
_defineProperty(DateTimeUtil, "DAY_PER_YEAR", 365);
|
|
3607
|
+
_defineProperty(DateTimeUtil, "MONTH_PER_YEAR", 12);
|
|
3608
|
+
_defineProperty(DateTimeUtil, "WEEK_PER_YEAR", 52);
|
|
3609
|
+
_defineProperty(DateTimeUtil, "WEEK_PER_MONTH", 4);
|
|
3610
|
+
_defineProperty(DateTimeUtil, "FORMAT", {
|
|
3611
|
+
ISO_DATE: "yyyy-MM-dd",
|
|
3612
|
+
ISO_TIME: "HH:mm:ss",
|
|
3613
|
+
ISO_DATE_TIME: "yyyy-MM-dd HH:mm:ss",
|
|
3614
|
+
ISO_DATE_TIME_MS: "yyyy-MM-dd HH:mm:ss.SSS",
|
|
3615
|
+
ISO_DATETIME_TZ: "yyyy-MM-dd'T'HH:mm:ssXXX",
|
|
3616
|
+
ISO_DATETIME_TZ_MS: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
|
|
3617
|
+
US_DATE: "MM/dd/yyyy",
|
|
3618
|
+
US_DATE_TIME: "MM/dd/yyyy HH:mm:ss",
|
|
3619
|
+
US_DATE_SHORT_YEAR: "MM/dd/yy",
|
|
3620
|
+
EU_DATE: "dd/MM/yyyy",
|
|
3621
|
+
EU_DATE_TIME: "dd/MM/yyyy HH:mm:ss",
|
|
3622
|
+
CN_DATE: "yyyy年MM月dd日",
|
|
3623
|
+
CN_DATE_TIME: "yyyy年MM月dd日 HH时mm分ss秒",
|
|
3624
|
+
CN_DATE_WEEKDAY: "yyyy年MM月dd日 EEE",
|
|
3625
|
+
CN_WEEKDAY_FULL: "EEEE",
|
|
3626
|
+
SHORT_DATE: "yy-MM-dd",
|
|
3627
|
+
SHORT_DATE_SLASH: "yy/MM/dd",
|
|
3628
|
+
MONTH_DAY: "MM-dd",
|
|
3629
|
+
MONTH_DAY_CN: "MM月dd日",
|
|
3630
|
+
DATE_WITH_WEEKDAY_SHORT: "yyyy-MM-dd (EEE)",
|
|
3631
|
+
DATE_WITH_WEEKDAY_FULL: "yyyy-MM-dd (EEEE)",
|
|
3632
|
+
TIME_24: "HH:mm:ss",
|
|
3633
|
+
TIME_24_NO_SEC: "HH:mm",
|
|
3634
|
+
TIME_12: "hh:mm:ss a",
|
|
3635
|
+
TIME_12_NO_SEC: "hh:mm a",
|
|
3636
|
+
TIMESTAMP: "yyyyMMddHHmmss",
|
|
3637
|
+
TIMESTAMP_MS: "yyyyMMddHHmmssSSS",
|
|
3638
|
+
RFC2822: "EEE, dd MMM yyyy HH:mm:ss xxx",
|
|
3639
|
+
READABLE_DATE: "MMM dd, yyyy",
|
|
3640
|
+
READABLE_DATE_TIME: "MMM dd, yyyy HH:mm",
|
|
3641
|
+
COMPACT_DATETIME: "yyyyMMdd_HHmmss"
|
|
3642
|
+
});
|
|
3643
|
+
/**
|
|
3644
|
+
* 环境检查工具类
|
|
3645
|
+
*/
|
|
3646
|
+
var EnvUtil = class {
|
|
3647
|
+
static isBrowser() {
|
|
3648
|
+
return this._isBrowser;
|
|
3649
|
+
}
|
|
3650
|
+
static isWebWorker() {
|
|
3651
|
+
return this._isWebWorker;
|
|
3652
|
+
}
|
|
3653
|
+
static isReactNative() {
|
|
3654
|
+
return this._isReactNative;
|
|
3655
|
+
}
|
|
3656
|
+
/**
|
|
3657
|
+
* 检查是否在 iframe 环境中
|
|
3658
|
+
*/
|
|
3659
|
+
static isIframe() {
|
|
3660
|
+
if (typeof window === "undefined") return false;
|
|
3661
|
+
try {
|
|
3662
|
+
return window.top !== window.self;
|
|
3663
|
+
} catch (error) {
|
|
3664
|
+
if (error.name === "SecurityError") return true;
|
|
3665
|
+
return false;
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
/**
|
|
3669
|
+
* 检测当前设备是否为桌面设备
|
|
3670
|
+
*
|
|
3671
|
+
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
3672
|
+
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
3673
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3674
|
+
* @returns 是否为桌面设备
|
|
3675
|
+
* @example
|
|
3676
|
+
* ```ts
|
|
3677
|
+
* // 假设 window.innerWidth = 1920
|
|
3678
|
+
* EnvUtil.isDesktop(); // true
|
|
3679
|
+
*
|
|
3680
|
+
* // 自定义阈值
|
|
3681
|
+
* EnvUtil.isDesktop(1440, 13); // 更严格的桌面检测
|
|
3682
|
+
* ```
|
|
3683
|
+
*/
|
|
3684
|
+
static isDesktop(minWidth = 1200, minScreenSize = 10, dpi = 160) {
|
|
3685
|
+
if (typeof window === "undefined" || !TypeUtil.isPositiveInteger(minWidth) || !TypeUtil.isPositiveInteger(minScreenSize)) return false;
|
|
3686
|
+
if (window.innerWidth < minWidth) return false;
|
|
3687
|
+
try {
|
|
3688
|
+
const widthPx = window.screen.width;
|
|
3689
|
+
const heightPx = window.screen.height;
|
|
3690
|
+
const DPI = dpi * (window.devicePixelRatio || 1);
|
|
3691
|
+
const widthInch = widthPx / DPI;
|
|
3692
|
+
const heightInch = heightPx / DPI;
|
|
3693
|
+
return Math.sqrt(widthInch ** 2 + heightInch ** 2) >= minScreenSize;
|
|
3694
|
+
} catch {
|
|
3695
|
+
return true;
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
/**
|
|
3699
|
+
* 检测当前设备是否为 Windows 桌面设备
|
|
3700
|
+
*
|
|
3701
|
+
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
3702
|
+
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
3703
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3704
|
+
* @returns 是否为 Windows 桌面设备
|
|
3705
|
+
* @example
|
|
3706
|
+
* ```ts
|
|
3707
|
+
* // UA contains Windows
|
|
3708
|
+
* EnvUtil.isWindowsDesktop(); // true
|
|
3709
|
+
* ```
|
|
3710
|
+
*/
|
|
3711
|
+
static isWindowsDesktop(minWidth = 1200, minScreenSize = 10, dpi = 160) {
|
|
3712
|
+
if (typeof navigator === "undefined" || !navigator.userAgent) return false;
|
|
3713
|
+
return /Windows/i.test(navigator.userAgent) && this.isDesktop(minWidth, minScreenSize, dpi);
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* 检测当前设备是否为 macOS 桌面设备
|
|
3717
|
+
*
|
|
3718
|
+
* @param minWidth - 桌面设备最小宽度(默认 1200px)
|
|
3719
|
+
* @param minScreenSize - 桌面设备最小屏幕尺寸(默认 10英寸)
|
|
3720
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3721
|
+
* @returns 是否为 macOS 桌面设备
|
|
3722
|
+
* @example
|
|
3723
|
+
* ```ts
|
|
3724
|
+
* // UA contains Macintosh
|
|
3725
|
+
* EnvUtil.isMacOSDesktop(); // true
|
|
3726
|
+
* ```
|
|
3727
|
+
*/
|
|
3728
|
+
static isMacOSDesktop(minWidth = 1200, minScreenSize = 10, dpi = 160) {
|
|
3729
|
+
if (typeof navigator === "undefined" || !navigator.userAgent) return false;
|
|
3730
|
+
return /Macintosh/i.test(navigator.userAgent) && this.isDesktop(minWidth, minScreenSize, dpi);
|
|
3731
|
+
}
|
|
3732
|
+
/**
|
|
3733
|
+
* 检测当前设备是否为移动设备
|
|
3734
|
+
*
|
|
3735
|
+
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
3736
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3737
|
+
* @returns 是否为移动设备
|
|
3738
|
+
* @example
|
|
3739
|
+
* ```ts
|
|
3740
|
+
* // 假设 window.innerWidth = 500
|
|
3741
|
+
* EnvUtil.isMobile(); // true
|
|
3742
|
+
* ```
|
|
3743
|
+
*/
|
|
3744
|
+
static isMobile(maxWidth = 768, dpi = 160) {
|
|
3745
|
+
if (typeof window === "undefined" || !TypeUtil.isPositiveInteger(maxWidth)) return false;
|
|
3746
|
+
if (window.innerWidth >= maxWidth) return false;
|
|
3747
|
+
try {
|
|
3748
|
+
const widthPx = window.screen.width;
|
|
3749
|
+
const heightPx = window.screen.height;
|
|
3750
|
+
const DPI = dpi * (window.devicePixelRatio || 1);
|
|
3751
|
+
const widthInch = widthPx / DPI;
|
|
3752
|
+
const heightInch = heightPx / DPI;
|
|
3753
|
+
return Math.sqrt(widthInch ** 2 + heightInch ** 2) < 7;
|
|
3754
|
+
} catch {
|
|
3755
|
+
return true;
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
/**
|
|
3759
|
+
* 检测当前设备是否为IOS移动设备
|
|
3760
|
+
*
|
|
3761
|
+
* @param maxWidth - 移动设备最大宽度(默认 768px)
|
|
3762
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3763
|
+
* @returns 是否为 iOS 移动设备 (iPhone/iPod)
|
|
3764
|
+
* @example
|
|
3765
|
+
* ```ts
|
|
3766
|
+
* // UA contains iPhone
|
|
3767
|
+
* EnvUtil.isIOSMobile(); // true
|
|
3768
|
+
* ```
|
|
3769
|
+
*/
|
|
3770
|
+
static isIOSMobile(maxWidth = 768, dpi = 160) {
|
|
3771
|
+
if (typeof navigator === "undefined" || !navigator.userAgent) return false;
|
|
3772
|
+
return /iPhone|iPad|iPod/i.test(navigator.userAgent) && this.isMobile(maxWidth, dpi);
|
|
3773
|
+
}
|
|
3774
|
+
/**
|
|
3775
|
+
* 检测当前设备是否为平板
|
|
3776
|
+
*
|
|
3777
|
+
* @param minWidth - 平板最小宽度(默认 768px)
|
|
3778
|
+
* @param maxWidth - 平板最大宽度(默认 1200px)
|
|
3779
|
+
* @param dpi - 标准 DPI 基准(默认 160)
|
|
3780
|
+
* @returns 是否为平板设备
|
|
3781
|
+
* @example
|
|
3782
|
+
* ```ts
|
|
3783
|
+
* // 假设 window.innerWidth = 1000
|
|
3784
|
+
* EnvUtil.isTablet(); // true
|
|
3785
|
+
* ```
|
|
3786
|
+
*/
|
|
3787
|
+
static isTablet(minWidth = 768, maxWidth = 1200, dpi = 160) {
|
|
3788
|
+
if (typeof window === "undefined" || !TypeUtil.isPositiveInteger(minWidth) || !TypeUtil.isPositiveInteger(maxWidth)) return false;
|
|
3789
|
+
const width = window.innerWidth;
|
|
3790
|
+
const isWithinWidthRange = width >= minWidth && width <= maxWidth;
|
|
3791
|
+
try {
|
|
3792
|
+
const widthPx = window.screen.width;
|
|
3793
|
+
const heightPx = window.screen.height;
|
|
3794
|
+
const DPI = dpi * (window.devicePixelRatio || 1);
|
|
3795
|
+
const widthInch = widthPx / DPI;
|
|
3796
|
+
const heightInch = heightPx / DPI;
|
|
3797
|
+
const screenInches = Math.sqrt(widthInch ** 2 + heightInch ** 2);
|
|
3798
|
+
return isWithinWidthRange || screenInches >= 7;
|
|
3799
|
+
} catch {
|
|
3800
|
+
return isWithinWidthRange;
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
_defineProperty(EnvUtil, "_isBrowser", typeof window !== "undefined" && TypeUtil.isFunction(window?.document?.createElement));
|
|
3805
|
+
_defineProperty(EnvUtil, "_isWebWorker", typeof window === "undefined" && typeof self !== "undefined" && "importScripts" in self);
|
|
3806
|
+
_defineProperty(EnvUtil, "_isReactNative", typeof navigator !== "undefined" && navigator.product === "ReactNative");
|
|
3807
|
+
/**
|
|
3808
|
+
* MIME 工具类
|
|
3809
|
+
*/
|
|
3810
|
+
var MimeUtil = class {};
|
|
3811
|
+
_defineProperty(MimeUtil, "MIME", {
|
|
3812
|
+
/** 普通文本文件 */
|
|
3813
|
+
TEXT: "text/plain",
|
|
3814
|
+
/** 超文本标记语言文档 */
|
|
3815
|
+
HTML: "text/html",
|
|
3816
|
+
/** 层叠样式表文件 */
|
|
3817
|
+
CSS: "text/css",
|
|
3818
|
+
/** 逗号分隔值文件(表格数据) */
|
|
3819
|
+
CSV: "text/csv",
|
|
3820
|
+
/** 制表符分隔值文件 */
|
|
3821
|
+
TSV: "text/tab-separated-values",
|
|
3822
|
+
/** XML 文档 */
|
|
3823
|
+
XML: "text/xml",
|
|
3824
|
+
/** XHTML 文档(XML 严格格式的 HTML) */
|
|
3825
|
+
XHTML: "application/xhtml+xml",
|
|
3826
|
+
/** JavaScript 脚本文件(标准推荐) */
|
|
3827
|
+
JS: "text/javascript",
|
|
3828
|
+
/** Markdown 格式文档 */
|
|
3829
|
+
MARKDOWN: "text/markdown",
|
|
3830
|
+
/** 富文本格式文档(.rtf) */
|
|
3831
|
+
RTF: "application/rtf",
|
|
3832
|
+
/** iCalendar 日历格式(.ics) */
|
|
3833
|
+
CALENDAR: "text/calendar",
|
|
3834
|
+
/** JPEG 图像(.jpg/.jpeg) */
|
|
3835
|
+
JPEG: "image/jpeg",
|
|
3836
|
+
/** PNG 图像(无损压缩,支持透明) */
|
|
3837
|
+
PNG: "image/png",
|
|
3838
|
+
/** GIF 图像(支持动画) */
|
|
3839
|
+
GIF: "image/gif",
|
|
3840
|
+
/** Windows 位图(.bmp) */
|
|
3841
|
+
BMP: "image/bmp",
|
|
3842
|
+
/** SVG 向量图形(.svg) */
|
|
3843
|
+
SVG: "image/svg+xml",
|
|
3844
|
+
/** APNG 动态图像(.apng) */
|
|
3845
|
+
APNG: "image/apng",
|
|
3846
|
+
/** AVIF 图像(高效压缩) */
|
|
3847
|
+
AVIF: "image/avif",
|
|
3848
|
+
/** 图标文件格式(.ico) */
|
|
3849
|
+
ICO: "image/vnd.microsoft.icon",
|
|
3850
|
+
/** WebP 图像(高效压缩) */
|
|
3851
|
+
WEBP: "image/webp",
|
|
3852
|
+
/** MP3 音频(.mp3) */
|
|
3853
|
+
MP3: "audio/mpeg",
|
|
3854
|
+
/** AAC 音频(.aac) */
|
|
3855
|
+
AAC: "audio/aac",
|
|
3856
|
+
/** MIDI 音乐文件(.mid/.midi) */
|
|
3857
|
+
MIDI: "audio/midi",
|
|
3858
|
+
/** OGG 音频(.oga) */
|
|
3859
|
+
OGG_AUDIO: "audio/ogg",
|
|
3860
|
+
/** Opus 音频(.opus) */
|
|
3861
|
+
OPUS: "audio/opus",
|
|
3862
|
+
/** WAV 音频(.wav) */
|
|
3863
|
+
WAV: "audio/wav",
|
|
3864
|
+
/** RealAudio 音频(.ra/.ram) */
|
|
3865
|
+
REAL_AUDIO: "audio/x-pn-realaudio",
|
|
3866
|
+
/** MP4 视频(.mp4) */
|
|
3867
|
+
MP4: "video/mp4",
|
|
3868
|
+
/** MPEG 视频(.mpeg/.mpg) */
|
|
3869
|
+
MPEG: "video/mpeg",
|
|
3870
|
+
/** OGG 视频(.ogv) */
|
|
3871
|
+
OGG_VIDEO: "video/ogg",
|
|
3872
|
+
/** AVI 视频(.avi) */
|
|
3873
|
+
AVI: "video/x-msvideo",
|
|
3874
|
+
/** 3GPP 视频(.3gp) */
|
|
3875
|
+
THREE_GPP: "video/3gpp",
|
|
3876
|
+
/** 3GPP2 视频(.3g2) */
|
|
3877
|
+
THREE_GPP2: "video/3gpp2",
|
|
3878
|
+
/** WebM 视频(.webm) */
|
|
3879
|
+
WEBM: "video/webm",
|
|
3880
|
+
/** PDF 文档 */
|
|
3881
|
+
PDF: "application/pdf",
|
|
3882
|
+
/** Word 97-2003 文档(.doc) */
|
|
3883
|
+
DOC: "application/msword",
|
|
3884
|
+
/** Word 2007+ 文档(.docx) */
|
|
3885
|
+
DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
3886
|
+
/** Excel 2007+ 工作簿(.xlsx) */
|
|
3887
|
+
XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
3888
|
+
/** 启用宏的Excel工作簿(.xlsm) */
|
|
3889
|
+
XLSM: "application/vnd.ms-excel.sheet.macroEnabled.12",
|
|
3890
|
+
/** Excel模板文件(.xltx) */
|
|
3891
|
+
XLTX: "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
|
3892
|
+
/** PowerPoint 2007+ 演示文稿(.pptx) */
|
|
3893
|
+
PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3894
|
+
/** PowerPoint 97-2003 演示文稿(.ppt) */
|
|
3895
|
+
PPT: "application/vnd.ms-powerpoint",
|
|
3896
|
+
/** OpenDocument 文本文档(.odt) */
|
|
3897
|
+
ODT: "application/vnd.oasis.opendocument.text",
|
|
3898
|
+
/** OpenDocument 表格文档(.ods) */
|
|
3899
|
+
ODS: "application/vnd.oasis.opendocument.spreadsheet",
|
|
3900
|
+
/** OpenDocument 演示文稿(.odp) */
|
|
3901
|
+
ODP: "application/vnd.oasis.opendocument.presentation",
|
|
3902
|
+
/** EPUB 电子书(.epub) */
|
|
3903
|
+
EPUB: "application/epub+zip",
|
|
3904
|
+
/** Kindle 电子书(.azw) */
|
|
3905
|
+
AZW: "application/vnd.amazon.ebook",
|
|
3906
|
+
/** ZIP 压缩文件(.zip) */
|
|
3907
|
+
ZIP: "application/zip",
|
|
3908
|
+
/** GZIP 压缩文件(.gz) */
|
|
3909
|
+
GZIP: "application/gzip",
|
|
3910
|
+
/** GZIP 压缩文件(旧格式) */
|
|
3911
|
+
X_GZIP: "application/x-gzip",
|
|
3912
|
+
/** TAR 归档文件(.tar) */
|
|
3913
|
+
TAR: "application/x-tar",
|
|
3914
|
+
/** BZip 归档(.bz) */
|
|
3915
|
+
BZIP: "application/x-bzip",
|
|
3916
|
+
/** BZip2 归档(.bz2) */
|
|
3917
|
+
BZIP2: "application/x-bzip2",
|
|
3918
|
+
/** 7-Zip 压缩文件(.7z) */
|
|
3919
|
+
SEVEN_Z: "application/x-7z-compressed",
|
|
3920
|
+
/** 通用二进制数据(默认类型) */
|
|
3921
|
+
OCTET_STREAM: "application/octet-stream",
|
|
3922
|
+
/** JSON 数据格式(.json) */
|
|
3923
|
+
JSON: "application/json",
|
|
3924
|
+
/** JSON-LD 格式(.jsonld) */
|
|
3925
|
+
LD_JSON: "application/ld+json",
|
|
3926
|
+
/** Java 归档文件(.jar) */
|
|
3927
|
+
JAR: "application/java-archive",
|
|
3928
|
+
/** MS 嵌入式 OpenType 字体(.eot) */
|
|
3929
|
+
EOT: "application/vnd.ms-fontobject",
|
|
3930
|
+
/** OpenType 字体(.otf) */
|
|
3931
|
+
OTF: "font/otf",
|
|
3932
|
+
/** Excel 97-2003 工作簿(.xls) */
|
|
3933
|
+
XLS: "application/vnd.ms-excel",
|
|
3934
|
+
/** Microsoft XPS 文档(.xps) */
|
|
3935
|
+
XPS: "application/vnd.ms-xpsdocument",
|
|
3936
|
+
/** Word 启用宏文档(.docm) */
|
|
3937
|
+
DOCM: "application/vnd.ms-word.document.macroEnabled.12"
|
|
3938
|
+
});
|
|
3939
|
+
/**
|
|
3940
|
+
* 对象工具类
|
|
3941
|
+
*/
|
|
3942
|
+
var ObjectUtil = class {
|
|
3943
|
+
static keys(value) {
|
|
3944
|
+
return Object.keys(value);
|
|
3945
|
+
}
|
|
3946
|
+
static values(value) {
|
|
3947
|
+
return Object.values(value);
|
|
3948
|
+
}
|
|
3949
|
+
static entries(value) {
|
|
3950
|
+
return Object.entries(value);
|
|
3951
|
+
}
|
|
3952
|
+
/**
|
|
3953
|
+
* 映射对象条目
|
|
3954
|
+
* - 将对象的键值对映射为新的键值对
|
|
3955
|
+
*
|
|
3956
|
+
* @param plainObject 对象
|
|
3957
|
+
* @param toEntry 映射函数
|
|
3958
|
+
* @returns 映射后的新对象
|
|
3959
|
+
* @example
|
|
3960
|
+
* ```ts
|
|
3961
|
+
* const obj = { a: 1, b: 2 };
|
|
3962
|
+
* ObjectUtil.entriesMap(obj, (k, v) => [k, v * 2]); // { a: 2, b: 4 }
|
|
3963
|
+
* ```
|
|
3964
|
+
*/
|
|
3965
|
+
static entriesMap(plainObject, toEntry) {
|
|
3966
|
+
const defaultResult = {};
|
|
3967
|
+
if (!TypeUtil.isObject(plainObject)) return defaultResult;
|
|
3968
|
+
return this.entries(plainObject).reduce((acc, [key, value]) => {
|
|
3969
|
+
const [newKey, newValue] = toEntry(key, value);
|
|
3970
|
+
acc[newKey] = newValue;
|
|
3971
|
+
return acc;
|
|
3972
|
+
}, defaultResult);
|
|
3973
|
+
}
|
|
3974
|
+
static pick(obj, keys) {
|
|
3975
|
+
const result = {};
|
|
3976
|
+
if (!TypeUtil.isObject(obj)) return result;
|
|
3977
|
+
if (!TypeUtil.isArray(keys)) return obj;
|
|
3978
|
+
return keys.reduce((acc, key) => {
|
|
3979
|
+
if (key in obj) acc[key] = obj[key];
|
|
3980
|
+
return acc;
|
|
3981
|
+
}, result);
|
|
3982
|
+
}
|
|
3983
|
+
static omit(obj, keys) {
|
|
3984
|
+
const result = {};
|
|
3985
|
+
if (!TypeUtil.isObject(obj)) return result;
|
|
3986
|
+
if (!TypeUtil.isArray(keys)) return obj;
|
|
3987
|
+
const keysToOmit = new Set(keys);
|
|
3988
|
+
return Object.keys(obj).reduce((acc, key) => {
|
|
3989
|
+
if (!keysToOmit.has(key)) acc[key] = obj[key];
|
|
3990
|
+
return acc;
|
|
3991
|
+
}, result);
|
|
3992
|
+
}
|
|
3993
|
+
static invert(obj) {
|
|
3994
|
+
const result = {};
|
|
3995
|
+
if (!TypeUtil.isObject(obj)) return result;
|
|
3996
|
+
for (const [k, v] of this.entries(obj)) if (TypeUtil.isString(v) || TypeUtil.isNumber(v) || TypeUtil.isSymbol(v)) result[v] = k;
|
|
3997
|
+
return result;
|
|
3998
|
+
}
|
|
3999
|
+
static crush(obj) {
|
|
4000
|
+
if (!obj) return {};
|
|
4001
|
+
function crushReducer(crushed, value, path) {
|
|
4002
|
+
if (TypeUtil.isObject(value) || TypeUtil.isArray(value)) for (const [prop, propValue] of Object.entries(value)) crushReducer(crushed, propValue, path ? `${path}.${prop}` : prop);
|
|
4003
|
+
else crushed[path] = value;
|
|
4004
|
+
return crushed;
|
|
4005
|
+
}
|
|
4006
|
+
return crushReducer({}, obj, "");
|
|
4007
|
+
}
|
|
4008
|
+
static enumKeys(enumeration) {
|
|
4009
|
+
const [isEnum, isBidirectionalEnum] = TypeUtil.isEnumeration(enumeration);
|
|
4010
|
+
if (!isEnum) throw Error("function [enumKeys] expected parameter to be a enum, and requires at least one member");
|
|
4011
|
+
const keys = this.keys(enumeration);
|
|
4012
|
+
if (isBidirectionalEnum) return keys.splice(keys.length / 2, keys.length / 2);
|
|
4013
|
+
return keys;
|
|
4014
|
+
}
|
|
4015
|
+
static enumValues(enumeration) {
|
|
4016
|
+
const [isEnum, isBidirectionalEnum] = TypeUtil.isEnumeration(enumeration);
|
|
4017
|
+
if (!isEnum) throw Error("function [enumValues] expected parameter to be a enum, and requires at least one member");
|
|
4018
|
+
const values = this.values(enumeration);
|
|
4019
|
+
if (isBidirectionalEnum) return values.splice(values.length / 2, values.length / 2);
|
|
4020
|
+
return values;
|
|
4021
|
+
}
|
|
4022
|
+
static enumEntries(enumeration) {
|
|
4023
|
+
const [isEnum, isBidirectionalEnum] = TypeUtil.isEnumeration(enumeration);
|
|
4024
|
+
if (!isEnum) throw Error("function [enumEntries] expected parameter to be a enum, and requires at least one member");
|
|
4025
|
+
const entries = this.entries(enumeration);
|
|
4026
|
+
if (isBidirectionalEnum) return entries.splice(entries.length / 2, entries.length / 2);
|
|
4027
|
+
return entries;
|
|
4028
|
+
}
|
|
4029
|
+
};
|
|
4030
|
+
/**
|
|
4031
|
+
* 主题工具类
|
|
4032
|
+
*/
|
|
4033
|
+
var ThemeUtil = class {};
|
|
4034
|
+
_defineProperty(ThemeUtil, "THEME", {
|
|
4035
|
+
LIGHT: "light",
|
|
4036
|
+
DARK: "dark"
|
|
4037
|
+
});
|
|
4038
|
+
_defineProperty(ThemeUtil, "THEME_MODE", {
|
|
4039
|
+
LIGHT: "light",
|
|
4040
|
+
DARK: "dark",
|
|
4041
|
+
SYSTEM: "system"
|
|
4042
|
+
});
|
|
4043
|
+
/**
|
|
4044
|
+
* 验证工具类
|
|
4045
|
+
*/
|
|
4046
|
+
var ValidateUtil = class {
|
|
4047
|
+
/**
|
|
4048
|
+
* 验证是否为手机号码
|
|
4049
|
+
*/
|
|
4050
|
+
static isPhone(input) {
|
|
4051
|
+
return this._phone.test(input.toString());
|
|
4052
|
+
}
|
|
4053
|
+
/**
|
|
4054
|
+
* 验证是否为固定电话
|
|
4055
|
+
*/
|
|
4056
|
+
static isTelephone(input) {
|
|
4057
|
+
return this._telephone.test(input.toString());
|
|
4058
|
+
}
|
|
4059
|
+
/**
|
|
4060
|
+
* 验证是否为移动设备识别码
|
|
4061
|
+
*/
|
|
4062
|
+
static isIMEI(input) {
|
|
4063
|
+
return this._IMEI.test(input.toString());
|
|
4064
|
+
}
|
|
4065
|
+
/**
|
|
4066
|
+
* 验证是否为电子邮箱
|
|
4067
|
+
*/
|
|
4068
|
+
static isEmail(input) {
|
|
4069
|
+
return this._email.test(input.toString());
|
|
4070
|
+
}
|
|
4071
|
+
/**
|
|
4072
|
+
* 验证是否为 http(s) 链接
|
|
4073
|
+
*/
|
|
4074
|
+
static isHttpLink(input) {
|
|
4075
|
+
return this._link.test(input.toString());
|
|
4076
|
+
}
|
|
4077
|
+
/**
|
|
4078
|
+
* 验证是否为端口号链接
|
|
4079
|
+
*/
|
|
4080
|
+
static isPortLink(input) {
|
|
4081
|
+
return this._portLink.test(input.toString());
|
|
4082
|
+
}
|
|
4083
|
+
/**
|
|
4084
|
+
* 验证是否为迅雷链接
|
|
4085
|
+
*/
|
|
4086
|
+
static isThunderLink(input) {
|
|
4087
|
+
return this._thunderLink.test(input.toString());
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* 验证是否为统一社会信用代码
|
|
4091
|
+
*/
|
|
4092
|
+
static isUSCC(input) {
|
|
4093
|
+
return this._uscc.test(input.toString());
|
|
4094
|
+
}
|
|
4095
|
+
/**
|
|
4096
|
+
* 验证是否为统一社会信用代码 - 15位/18位/20位数字/字母
|
|
4097
|
+
*/
|
|
4098
|
+
static isUSCCS(input) {
|
|
4099
|
+
return this._usccs.test(input.toString());
|
|
4100
|
+
}
|
|
4101
|
+
/**
|
|
4102
|
+
* 验证是否为 Windows 系统文件夹路径
|
|
4103
|
+
*/
|
|
4104
|
+
static isDirPathWindows(input) {
|
|
4105
|
+
return this._dirPathWindows.test(input.toString());
|
|
4106
|
+
}
|
|
4107
|
+
/**
|
|
4108
|
+
* 验证是否为 Windows 系统文件路径
|
|
4109
|
+
*/
|
|
4110
|
+
static isFilePathWindows(input) {
|
|
4111
|
+
return this._filePathWindows.test(input.toString());
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* 验证是否为 Linux 系统文件夹路径
|
|
4115
|
+
*/
|
|
4116
|
+
static isDirPathLinux(input) {
|
|
4117
|
+
return this._dirPathLinux.test(input.toString());
|
|
4118
|
+
}
|
|
4119
|
+
/**
|
|
4120
|
+
* 验证是否为 Linux 系统文件路径
|
|
4121
|
+
*/
|
|
4122
|
+
static isFilePathLinux(input) {
|
|
4123
|
+
return this._filePathLinux.test(input.toString());
|
|
4124
|
+
}
|
|
4125
|
+
/**
|
|
4126
|
+
* 验证是否为新能源车牌号
|
|
4127
|
+
*/
|
|
4128
|
+
static isEVCarNumber(input) {
|
|
4129
|
+
return this._EVCarNumber.test(input.toString());
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* 验证是否为燃油车车牌号
|
|
4133
|
+
*/
|
|
4134
|
+
static isGVCarNumber(input) {
|
|
4135
|
+
return this._GVCarNumber.test(input.toString());
|
|
4136
|
+
}
|
|
4137
|
+
/**
|
|
4138
|
+
* 验证是否为中文姓名
|
|
4139
|
+
*/
|
|
4140
|
+
static isChineseName(input) {
|
|
4141
|
+
return this._chineseName.test(input.toString());
|
|
4142
|
+
}
|
|
4143
|
+
/**
|
|
4144
|
+
* 验证是否为中国身份证号
|
|
4145
|
+
*/
|
|
4146
|
+
static isChineseID(input) {
|
|
4147
|
+
return this._chineseId.test(input.toString());
|
|
4148
|
+
}
|
|
4149
|
+
/**
|
|
4150
|
+
* 验证是否为中国省份
|
|
4151
|
+
*/
|
|
4152
|
+
static isChineseProvince(input) {
|
|
4153
|
+
return this._chineseProvince.test(input.toString());
|
|
4154
|
+
}
|
|
4155
|
+
/**
|
|
4156
|
+
* 验证是否为中华民族
|
|
4157
|
+
*/
|
|
4158
|
+
static isChineseNation(input) {
|
|
4159
|
+
return this._chineseNation.test(input.toString());
|
|
4160
|
+
}
|
|
4161
|
+
/**
|
|
4162
|
+
* 验证是否只包含字母
|
|
4163
|
+
*/
|
|
4164
|
+
static isLetter(input) {
|
|
4165
|
+
return this._letter.test(input.toString());
|
|
4166
|
+
}
|
|
4167
|
+
/**
|
|
4168
|
+
* 验证是否只包含小写字母
|
|
4169
|
+
*/
|
|
4170
|
+
static isLetterLowercase(input) {
|
|
4171
|
+
return this._letterLowercase.test(input.toString());
|
|
4172
|
+
}
|
|
4173
|
+
/**
|
|
4174
|
+
* 验证是否只包含大写字母
|
|
4175
|
+
*/
|
|
4176
|
+
static isLetterUppercase(input) {
|
|
4177
|
+
return this._letterUppercase.test(input.toString());
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* 验证是否不包含字母
|
|
4181
|
+
*/
|
|
4182
|
+
static isLetterOmit(input) {
|
|
4183
|
+
return this._letterOmit.test(input.toString());
|
|
4184
|
+
}
|
|
4185
|
+
/**
|
|
4186
|
+
* 验证是否为数字和字母组合
|
|
4187
|
+
*/
|
|
4188
|
+
static isLetterAndNumber(input) {
|
|
4189
|
+
return this._LetterAndNumber.test(input.toString());
|
|
4190
|
+
}
|
|
4191
|
+
/**
|
|
4192
|
+
* 验证是否为有符号浮点数
|
|
4193
|
+
*/
|
|
4194
|
+
static isSignedFloat(input) {
|
|
4195
|
+
return this._signedFloat.test(input.toString());
|
|
4196
|
+
}
|
|
4197
|
+
/**
|
|
4198
|
+
* 验证是否为无符号浮点数
|
|
4199
|
+
*/
|
|
4200
|
+
static isUnsignedFloat(input) {
|
|
4201
|
+
return this._unsignedFloat.test(input.toString());
|
|
4202
|
+
}
|
|
4203
|
+
/**
|
|
4204
|
+
* 验证是否为有符号整数
|
|
4205
|
+
*/
|
|
4206
|
+
static isSignedInteger(input) {
|
|
4207
|
+
return this._signedInteger.test(input.toString());
|
|
4208
|
+
}
|
|
4209
|
+
/**
|
|
4210
|
+
* 验证是否为无符号整数
|
|
4211
|
+
*/
|
|
4212
|
+
static isUnsignedInteger(input) {
|
|
4213
|
+
return this._unsignedInteger.test(input.toString());
|
|
4214
|
+
}
|
|
4215
|
+
/**
|
|
4216
|
+
* 验证是否包含空格
|
|
4217
|
+
*/
|
|
4218
|
+
static isSpaceInclude(input) {
|
|
4219
|
+
return this._spaceInclude.test(input.toString());
|
|
4220
|
+
}
|
|
4221
|
+
/**
|
|
4222
|
+
* 验证是否以空格开头
|
|
4223
|
+
*/
|
|
4224
|
+
static isSpaceStart(input) {
|
|
4225
|
+
return this._spaceStart.test(input.toString());
|
|
4226
|
+
}
|
|
4227
|
+
/**
|
|
4228
|
+
* 验证是否以空格结尾
|
|
4229
|
+
*/
|
|
4230
|
+
static isSpaceEnd(input) {
|
|
4231
|
+
return this._spaceEnd.test(input.toString());
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* 验证是否以空格开头或结尾
|
|
4235
|
+
*/
|
|
4236
|
+
static isSpaceStartOrEnd(input) {
|
|
4237
|
+
return this.isSpaceStart(input) || this.isSpaceEnd(input);
|
|
4238
|
+
}
|
|
4239
|
+
};
|
|
4240
|
+
_defineProperty(ValidateUtil, "_phone", /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/);
|
|
4241
|
+
_defineProperty(ValidateUtil, "_telephone", /^(((0\d{2,3})-)?((\d{7,8})|(400\d{7})|(800\d{7}))(-(\d{1,4}))?)$/);
|
|
4242
|
+
_defineProperty(ValidateUtil, "_IMEI", /^\d{15,17}$/);
|
|
4243
|
+
_defineProperty(ValidateUtil, "_email", /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/i);
|
|
4244
|
+
_defineProperty(ValidateUtil, "_link", /^(https?:\/\/)?(([\w-]+(\.[\w-]+)*\.[a-z]{2,6})|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/\S*)?$/i);
|
|
4245
|
+
_defineProperty(ValidateUtil, "_portLink", /^(https?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/i);
|
|
4246
|
+
_defineProperty(ValidateUtil, "_thunderLink", /^thunderx?:\/\/[a-zA-Z\d]+=$/i);
|
|
4247
|
+
_defineProperty(ValidateUtil, "_uscc", /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/);
|
|
4248
|
+
_defineProperty(ValidateUtil, "_usccs", /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/);
|
|
4249
|
+
_defineProperty(ValidateUtil, "_dirPathWindows", /^[a-z]:\\(?:\w+\\?)*$/i);
|
|
4250
|
+
_defineProperty(ValidateUtil, "_filePathWindows", /^[a-z]:\\(?:\w+\\)*\w+\.\w+$/i);
|
|
4251
|
+
_defineProperty(ValidateUtil, "_dirPathLinux", /^\/(?:[^\\/\s]+\/)*$/);
|
|
4252
|
+
_defineProperty(ValidateUtil, "_filePathLinux", /^(\/$|\/(?:[^\\/\s]+\/)*[^\\/\s]+$)/);
|
|
4253
|
+
_defineProperty(ValidateUtil, "_EVCarNumber", /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](([DF]((?![IO])[a-zA-Z0-9](?![IO]))\d{4})|(\d{5}[DF]))$/);
|
|
4254
|
+
_defineProperty(ValidateUtil, "_GVCarNumber", /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/);
|
|
4255
|
+
_defineProperty(ValidateUtil, "_chineseName", /^[一-龢][一·-龢]*$/);
|
|
4256
|
+
_defineProperty(ValidateUtil, "_chineseId", /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))([\dX])$/i);
|
|
4257
|
+
_defineProperty(ValidateUtil, "_chineseProvince", /^安徽|澳门|北京|重庆|福建|甘肃|广东|广西|贵州|海南|河北|河南|黑龙江|湖北|湖南|吉林|江苏|江西|辽宁|内蒙古|宁夏|青海|山东|山西|陕西|上海|四川|台湾|天津|西藏|香港|新疆|云南|浙江$/);
|
|
4258
|
+
_defineProperty(ValidateUtil, "_chineseNation", /^汉族|蒙古族|回族|藏族|维吾尔族|苗族|彝族|壮族|布依族|朝鲜族|满族|侗族|瑶族|白族|土家族|哈尼族|哈萨克族|傣族|黎族|傈僳族|佤族|畲族|高山族|拉祜族|水族|东乡族|纳西族|景颇族|柯尔克孜族|土族|达斡尔族|仫佬族|羌族|布朗族|撒拉族|毛南族|仡佬族|锡伯族|阿昌族|普米族|塔吉克族|怒族|乌孜别克族|俄罗斯族|鄂温克族|德昂族|保安族|裕固族|京族|塔塔尔族|独龙族|鄂伦春族|赫哲族|门巴族|珞巴族|基诺族|其它未识别民族|外国人入中国籍$/);
|
|
4259
|
+
_defineProperty(ValidateUtil, "_letter", /^[a-z]+$/i);
|
|
4260
|
+
_defineProperty(ValidateUtil, "_letterLowercase", /^[a-z]+$/);
|
|
4261
|
+
_defineProperty(ValidateUtil, "_letterUppercase", /^[A-Z]+$/);
|
|
4262
|
+
_defineProperty(ValidateUtil, "_letterOmit", /^[^A-Z]*$/i);
|
|
4263
|
+
_defineProperty(ValidateUtil, "_LetterAndNumber", /^[A-Z0-9]+$/i);
|
|
4264
|
+
_defineProperty(ValidateUtil, "_signedFloat", /^[+-]?(\d+(\.\d+)?|\.\d+)$/);
|
|
4265
|
+
_defineProperty(ValidateUtil, "_unsignedFloat", /^\+?(\d+(\.\d+)?|\.\d+)$/);
|
|
4266
|
+
_defineProperty(ValidateUtil, "_signedInteger", /^[+-]?\d+$/);
|
|
4267
|
+
_defineProperty(ValidateUtil, "_unsignedInteger", /^\+?\d+$/);
|
|
4268
|
+
_defineProperty(ValidateUtil, "_spaceInclude", /\s/);
|
|
4269
|
+
_defineProperty(ValidateUtil, "_spaceStart", /^\s/);
|
|
4270
|
+
_defineProperty(ValidateUtil, "_spaceEnd", /\s$/);
|
|
4271
|
+
//#endregion
|
|
4272
|
+
//#region src/react/useMount.ts
|
|
4273
|
+
/**
|
|
4274
|
+
* 在组件初始化时执行的 Hook
|
|
4275
|
+
* - 即使在严格模式(React StrictMode)也只执行一次
|
|
4276
|
+
* - 自动使用最新版 effect 函数
|
|
4277
|
+
*
|
|
4278
|
+
* @param effect 副作用函数(必须为同步函数;若为异步函数,清理逻辑需自行处理)
|
|
4279
|
+
* @example
|
|
4280
|
+
* useMount(() => {
|
|
4281
|
+
* console.log('组件挂载');
|
|
4282
|
+
* return () => console.log('组件卸载');
|
|
4283
|
+
* });
|
|
4284
|
+
*
|
|
4285
|
+
* useMount(async () => {
|
|
4286
|
+
* const data = await fetchData();
|
|
4287
|
+
* // 清理逻辑需通过 ref/AbortController 自行管理
|
|
4288
|
+
* // ❌ 不要 return cleanupFn(async 函数返回 Promise,无法作为清理函数)
|
|
4289
|
+
* });
|
|
4290
|
+
*/
|
|
4291
|
+
function useMount(effect) {
|
|
4292
|
+
const isMountedRef = useRef(false);
|
|
4293
|
+
const effectRef = useLatest(effect);
|
|
4294
|
+
useEffect(() => {
|
|
4295
|
+
if (!TypeUtil.isFunction(effectRef.current)) {
|
|
4296
|
+
console.error(`hook [useMount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);
|
|
4297
|
+
return;
|
|
4298
|
+
}
|
|
4299
|
+
if (isMountedRef.current) return;
|
|
4300
|
+
isMountedRef.current = true;
|
|
4301
|
+
const cleanup = effectRef.current?.();
|
|
4302
|
+
return TypeUtil.isFunction(cleanup) && !TypeUtil.isPromise(cleanup) ? cleanup : void 0;
|
|
4303
|
+
}, [effectRef]);
|
|
4304
|
+
}
|
|
4305
|
+
//#endregion
|
|
4306
|
+
//#region src/react/useResponsive.ts
|
|
4307
|
+
/** 屏幕响应断点 token 配置 */
|
|
4308
|
+
const BREAK_POINT_TOKEN = {
|
|
4309
|
+
XS: 480,
|
|
4310
|
+
XSMax: 575,
|
|
4311
|
+
XSMin: 480,
|
|
4312
|
+
SM: 576,
|
|
4313
|
+
SMMax: 767,
|
|
4314
|
+
SMMin: 576,
|
|
4315
|
+
MD: 768,
|
|
4316
|
+
MDMax: 991,
|
|
4317
|
+
MDMin: 768,
|
|
4318
|
+
LG: 992,
|
|
4319
|
+
LGMax: 1199,
|
|
4320
|
+
LGMin: 992,
|
|
4321
|
+
XL: 1200,
|
|
4322
|
+
XLMax: 1599,
|
|
4323
|
+
XLMin: 1200,
|
|
4324
|
+
XXL: 1600,
|
|
4325
|
+
XXLMax: 1919,
|
|
4326
|
+
XXLMin: 1600,
|
|
4327
|
+
XXXL: 1920,
|
|
4328
|
+
XXXLMin: 1920
|
|
4329
|
+
};
|
|
4330
|
+
const SUBSCRIBER_SET = /* @__PURE__ */ new Set();
|
|
4331
|
+
const BREAK_POINTS = [
|
|
4332
|
+
"xxxl",
|
|
4333
|
+
"xxl",
|
|
4334
|
+
"xl",
|
|
4335
|
+
"lg",
|
|
4336
|
+
"md",
|
|
4337
|
+
"sm",
|
|
4338
|
+
"xs"
|
|
4339
|
+
];
|
|
4340
|
+
const DEFAULT_VALUES = Object.freeze(ArrayUtil.zipToObject(BREAK_POINTS, false));
|
|
4341
|
+
let responsiveValues = { ...DEFAULT_VALUES };
|
|
4342
|
+
let responsiveTokens = clone(BREAK_POINT_TOKEN);
|
|
4343
|
+
function useResponsive(options) {
|
|
4344
|
+
const { breakPointTokens = {} } = options || {};
|
|
4345
|
+
const tokens = useMemo(() => assign(BREAK_POINT_TOKEN, breakPointTokens), [breakPointTokens]);
|
|
4346
|
+
const [responsive, setResponsive] = useState(() => calculateResponsive(tokens));
|
|
4347
|
+
const current = ObjectUtil.keys(DEFAULT_VALUES).find((key) => responsive[key] === true) || "xs";
|
|
4348
|
+
useLayoutEffect(() => {
|
|
4349
|
+
responsiveTokens = tokens;
|
|
4350
|
+
window.addEventListener("resize", resizeListener);
|
|
4351
|
+
const subscriber = () => {
|
|
4352
|
+
setResponsive(responsiveValues);
|
|
4353
|
+
};
|
|
4354
|
+
SUBSCRIBER_SET.add(subscriber);
|
|
4355
|
+
return () => {
|
|
4356
|
+
SUBSCRIBER_SET.delete(subscriber);
|
|
4357
|
+
if (!SUBSCRIBER_SET.size) window.removeEventListener("resize", resizeListener);
|
|
4358
|
+
};
|
|
4359
|
+
}, [tokens]);
|
|
4360
|
+
return {
|
|
4361
|
+
responsive,
|
|
4362
|
+
current,
|
|
4363
|
+
breakPointTokens: tokens
|
|
4364
|
+
};
|
|
4365
|
+
}
|
|
4366
|
+
function resizeListener() {
|
|
4367
|
+
const newValues = calculateResponsive(responsiveTokens);
|
|
4368
|
+
if (!isEqual(responsiveValues, newValues)) {
|
|
4369
|
+
responsiveValues = newValues;
|
|
4370
|
+
for (const subscriber of SUBSCRIBER_SET) subscriber();
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
function calculateResponsive(tokens) {
|
|
4374
|
+
const config = ArrayUtil.zipToObject(BREAK_POINTS, BREAK_POINTS.map((t) => tokens[StringUtil.toUpperCase(t)]));
|
|
4375
|
+
return ObjectUtil.entriesMap(DEFAULT_VALUES, (key) => [key, window.innerWidth >= config[key]]);
|
|
4376
|
+
}
|
|
4377
|
+
//#endregion
|
|
4378
|
+
//#region src/react/useUnmount.ts
|
|
4379
|
+
/**
|
|
4380
|
+
* 在组件卸载时执行的 Hook
|
|
4381
|
+
*
|
|
4382
|
+
* @param effect 副作用函数
|
|
4383
|
+
*/
|
|
4384
|
+
function useUnmount(effect) {
|
|
4385
|
+
const effectRef = useLatest(effect);
|
|
4386
|
+
useEffect(() => () => {
|
|
4387
|
+
if (!TypeUtil.isFunction(effectRef.current)) {
|
|
4388
|
+
console.error(`hook [useUnmount] Expected parameter to be a function, but got ${typeof effectRef.current}. This effect will not execute.`);
|
|
4389
|
+
return;
|
|
4390
|
+
}
|
|
4391
|
+
effectRef.current?.();
|
|
4392
|
+
}, [effectRef]);
|
|
4393
|
+
}
|
|
4394
|
+
//#endregion
|
|
4395
|
+
//#region src/react/useTitle.ts
|
|
4396
|
+
/**
|
|
4397
|
+
* 设置页面标题
|
|
4398
|
+
* - 轻量级,适用于无路由库时设置页面标题
|
|
4399
|
+
* - 多个 `useTitle` 实例会互相干扰,需在顶层组件使用
|
|
4400
|
+
* - 无法处理 `document.title` 固有的竞态问题
|
|
4401
|
+
*
|
|
4402
|
+
* @param title 页面标题
|
|
4403
|
+
* @param options 配置选项
|
|
4404
|
+
*/
|
|
4405
|
+
function useTitle(title, options) {
|
|
4406
|
+
const titleRef = useRef(EnvUtil.isBrowser() ? document.title : "");
|
|
4407
|
+
useEffect(() => {
|
|
4408
|
+
if (!TypeUtil.isString(title)) {
|
|
4409
|
+
console.error(`hook [useTitle] Expected parameter to be a string, but got ${typeof title}. This effect will not execute.`);
|
|
4410
|
+
return;
|
|
4411
|
+
}
|
|
4412
|
+
if (EnvUtil.isBrowser()) document.title = title;
|
|
4413
|
+
}, [title]);
|
|
4414
|
+
useUnmount(() => {
|
|
4415
|
+
if (EnvUtil.isBrowser() && options?.isRestoreOnUnmount) document.title = titleRef.current;
|
|
4416
|
+
});
|
|
4417
|
+
}
|
|
4418
|
+
//#endregion
|
|
4419
|
+
export { BREAK_POINT_TOKEN, useCreation, useLatest, useMount, useResponsive, useTitle, useUnmount };
|