@kne/form-info 0.1.0-alpha.1 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -4
- package/dist/index.css +26 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +3976 -45
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +3989 -72
- package/dist/index.modern.js.map +1 -1
- package/package.json +7 -3
package/dist/index.modern.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import '@kne/info-page/dist/index.css';
|
|
2
2
|
import '@kne/react-form-antd/dist/index.css';
|
|
3
|
-
import { FormAntd } from '@kne/react-form-antd';
|
|
3
|
+
import { FormAntd, CancelButton, SubmitButton } from '@kne/react-form-antd';
|
|
4
4
|
export * from '@kne/react-form-antd';
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
5
|
+
import React, { forwardRef, isValidElement, useRef, createContext, useContext as useContext$1 } from 'react';
|
|
6
6
|
import InfoPage from '@kne/info-page';
|
|
7
7
|
import { useFlexBox } from '@kne/flex-box';
|
|
8
8
|
import { FormInfo as FormInfo$1, SubList, MultiField as MultiField$1, TableList as TableList$1 } from '@kne/react-form-plus';
|
|
9
|
-
import { Col, Row, Empty, Button, Divider } from 'antd';
|
|
9
|
+
import { Col, Row, Empty, Button, Divider, Modal, Flex, Steps } from 'antd';
|
|
10
|
+
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
11
|
+
import { useContext } from '@kne/global-context';
|
|
12
|
+
import useControlValue from '@kne/use-control-value';
|
|
10
13
|
|
|
11
14
|
function _extends() {
|
|
12
15
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -27,6 +30,8 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
27
30
|
return t;
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
34
|
+
|
|
30
35
|
function createCommonjsModule(fn) {
|
|
31
36
|
var module = { exports: {} };
|
|
32
37
|
return fn(module, module.exports), module.exports;
|
|
@@ -107,9 +112,9 @@ var classnames = createCommonjsModule(function (module) {
|
|
|
107
112
|
}());
|
|
108
113
|
});
|
|
109
114
|
|
|
110
|
-
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","
|
|
115
|
+
var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO"};
|
|
111
116
|
|
|
112
|
-
const _excluded$
|
|
117
|
+
const _excluded$7 = ["className", "column", "list", "gap"];
|
|
113
118
|
const FormInfo = props => {
|
|
114
119
|
const _Object$assign = Object.assign({}, {
|
|
115
120
|
column: 2,
|
|
@@ -121,7 +126,7 @@ const FormInfo = props => {
|
|
|
121
126
|
list,
|
|
122
127
|
gap
|
|
123
128
|
} = _Object$assign,
|
|
124
|
-
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$
|
|
129
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$7);
|
|
125
130
|
const isFlexBox = !(Number.isInteger(column) && column > 0);
|
|
126
131
|
const {
|
|
127
132
|
ref: flexBoxRef,
|
|
@@ -168,44 +173,54 @@ const FormInfo = props => {
|
|
|
168
173
|
}), renderColumn());
|
|
169
174
|
};
|
|
170
175
|
|
|
171
|
-
const _excluded$
|
|
172
|
-
_excluded2$
|
|
173
|
-
|
|
174
|
-
const
|
|
176
|
+
const _excluded$6 = ["className", "itemClassName", "removeIcon", "removeText", "addText", "addIcon", "important", "title"],
|
|
177
|
+
_excluded2$2 = ["id", "allowRemove", "onRemove", "index", "groupArgs"];
|
|
178
|
+
const List = p => {
|
|
179
|
+
const {
|
|
180
|
+
locale: contextLocale
|
|
181
|
+
} = useContext();
|
|
182
|
+
const locale = Object.assign({}, {
|
|
183
|
+
添加: '添加',
|
|
184
|
+
删除: '删除'
|
|
185
|
+
}, contextLocale, p.locale);
|
|
175
186
|
const _Object$assign = Object.assign({}, {
|
|
176
|
-
addText: '添加',
|
|
177
|
-
addIcon: null,
|
|
178
|
-
removeText: '删除',
|
|
179
|
-
removeIcon: null,
|
|
187
|
+
addText: locale['添加'],
|
|
188
|
+
addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
189
|
+
removeText: locale['删除'],
|
|
190
|
+
removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
|
180
191
|
empty: /*#__PURE__*/React.createElement(Empty, {
|
|
181
192
|
description: false
|
|
182
193
|
})
|
|
183
|
-
},
|
|
194
|
+
}, p, {
|
|
195
|
+
locale
|
|
196
|
+
}),
|
|
184
197
|
{
|
|
185
198
|
className,
|
|
199
|
+
itemClassName,
|
|
186
200
|
removeIcon,
|
|
187
201
|
removeText,
|
|
188
202
|
addText,
|
|
189
203
|
addIcon,
|
|
190
|
-
important
|
|
204
|
+
important,
|
|
205
|
+
title
|
|
191
206
|
} = _Object$assign,
|
|
192
|
-
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$
|
|
207
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$6);
|
|
193
208
|
return /*#__PURE__*/React.createElement(SubList, _extends({}, others, {
|
|
194
|
-
className: classnames(className, style[
|
|
209
|
+
className: classnames(className, style['list-part']),
|
|
195
210
|
listRender: _ref => {
|
|
196
211
|
let {
|
|
197
212
|
id,
|
|
198
213
|
allowRemove,
|
|
199
214
|
onRemove
|
|
200
215
|
} = _ref,
|
|
201
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded2$
|
|
216
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded2$2);
|
|
202
217
|
return /*#__PURE__*/React.createElement("div", {
|
|
203
218
|
key: id,
|
|
204
|
-
className: classnames(style[
|
|
205
|
-
[style[
|
|
219
|
+
className: classnames(style['list-item'], {
|
|
220
|
+
[style['is-important']]: important
|
|
206
221
|
})
|
|
207
222
|
}, /*#__PURE__*/React.createElement(FormInfo, _extends({}, props, {
|
|
208
|
-
className: style[
|
|
223
|
+
className: style['list-item-part'],
|
|
209
224
|
gap: 16,
|
|
210
225
|
extra: allowRemove && /*#__PURE__*/React.createElement(Button, {
|
|
211
226
|
type: "link",
|
|
@@ -216,33 +231,41 @@ const List = props => {
|
|
|
216
231
|
}, removeText)
|
|
217
232
|
})), /*#__PURE__*/React.createElement(Divider, null));
|
|
218
233
|
}
|
|
219
|
-
}), (children,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
234
|
+
}), (children, {
|
|
235
|
+
allowAdd,
|
|
236
|
+
onAdd
|
|
237
|
+
}) => {
|
|
238
|
+
return /*#__PURE__*/React.createElement(InfoPage.Part, {
|
|
239
|
+
className: itemClassName,
|
|
240
|
+
title: title,
|
|
226
241
|
extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
|
|
227
242
|
className: style['extra-btn'],
|
|
228
243
|
icon: addIcon,
|
|
229
244
|
onClick: onAdd
|
|
230
245
|
}, addText)
|
|
231
|
-
}
|
|
246
|
+
}, children);
|
|
232
247
|
});
|
|
233
248
|
};
|
|
234
249
|
|
|
235
|
-
const _excluded$
|
|
236
|
-
const MultiField =
|
|
250
|
+
const _excluded$5 = ["className", "addText", "addIcon", "removeIcon", "removeText"];
|
|
251
|
+
const MultiField = p => {
|
|
252
|
+
const {
|
|
253
|
+
locale: contextLocale
|
|
254
|
+
} = useContext();
|
|
255
|
+
const locale = Object.assign({}, {
|
|
256
|
+
添加: '添加'
|
|
257
|
+
}, contextLocale, p.locale);
|
|
237
258
|
const _Object$assign = Object.assign({}, {
|
|
238
|
-
addText: '添加',
|
|
239
|
-
addIcon: null,
|
|
240
|
-
removeIcon: null,
|
|
241
|
-
removeText:
|
|
259
|
+
addText: locale['添加'],
|
|
260
|
+
addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
261
|
+
removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
|
262
|
+
removeText: null,
|
|
242
263
|
empty: /*#__PURE__*/React.createElement(Empty, {
|
|
243
264
|
description: false
|
|
244
265
|
})
|
|
245
|
-
},
|
|
266
|
+
}, p, {
|
|
267
|
+
locale
|
|
268
|
+
}),
|
|
246
269
|
{
|
|
247
270
|
className,
|
|
248
271
|
addText,
|
|
@@ -250,27 +273,23 @@ const MultiField = props => {
|
|
|
250
273
|
removeIcon,
|
|
251
274
|
removeText
|
|
252
275
|
} = _Object$assign,
|
|
253
|
-
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$
|
|
276
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$5);
|
|
254
277
|
return /*#__PURE__*/React.createElement(MultiField$1, _extends({}, others, {
|
|
255
278
|
itemRender: (children, {
|
|
256
279
|
id,
|
|
257
|
-
index,
|
|
258
280
|
allowRemove,
|
|
259
281
|
onRemove
|
|
260
282
|
}) => {
|
|
261
283
|
return /*#__PURE__*/React.createElement("div", {
|
|
262
284
|
key: id,
|
|
263
|
-
className: classnames(
|
|
264
|
-
[style["first-item"]]: index === 0
|
|
265
|
-
})
|
|
285
|
+
className: classnames('multi-field-item', style['multi-field-item'])
|
|
266
286
|
}, children, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
267
|
-
className: classnames(style[
|
|
287
|
+
className: classnames(style['react-form__field-label'], 'react-form__field-label', 'multi-field-delete-label')
|
|
268
288
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
269
|
-
danger: true,
|
|
270
289
|
icon: removeIcon,
|
|
271
290
|
onClick: onRemove,
|
|
272
291
|
disabled: !allowRemove
|
|
273
|
-
}, removeText)));
|
|
292
|
+
}, typeof removeText === 'function' ? removeText(others.label) : removeText)));
|
|
274
293
|
}
|
|
275
294
|
}), (children, {
|
|
276
295
|
allowAdd,
|
|
@@ -278,33 +297,42 @@ const MultiField = props => {
|
|
|
278
297
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
279
298
|
className: classnames(className, 'multi-field', style['multi-field'])
|
|
280
299
|
}, children, allowAdd && /*#__PURE__*/React.createElement(Button, {
|
|
281
|
-
className: classnames(
|
|
300
|
+
className: classnames('multi-field-add-btn', style['multi-field-add-btn']),
|
|
282
301
|
type: "dashed",
|
|
283
302
|
onClick: onAdd,
|
|
284
303
|
icon: addIcon
|
|
285
304
|
}, typeof addText === 'function' ? addText(others.label) : `${addText}${others.label}`)));
|
|
286
305
|
};
|
|
287
306
|
|
|
288
|
-
const _excluded$
|
|
289
|
-
|
|
290
|
-
const
|
|
307
|
+
const _excluded$4 = ["className", "addIcon", "addText", "removeIcon", "removeText", "title"];
|
|
308
|
+
const TableList = p => {
|
|
309
|
+
const {
|
|
310
|
+
locale: contextLocale
|
|
311
|
+
} = useContext();
|
|
312
|
+
const locale = Object.assign({}, {
|
|
313
|
+
添加: '添加',
|
|
314
|
+
删除: '删除'
|
|
315
|
+
}, contextLocale, p.locale);
|
|
291
316
|
const _Object$assign = Object.assign({}, {
|
|
292
317
|
empty: /*#__PURE__*/React.createElement(Empty, {
|
|
293
318
|
description: false
|
|
294
319
|
}),
|
|
295
|
-
addIcon: null,
|
|
296
|
-
addText: '添加',
|
|
297
|
-
removeIcon: null,
|
|
298
|
-
removeText: '删除'
|
|
299
|
-
},
|
|
320
|
+
addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
321
|
+
addText: locale['添加'],
|
|
322
|
+
removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
|
|
323
|
+
removeText: locale['删除']
|
|
324
|
+
}, p, {
|
|
325
|
+
locale
|
|
326
|
+
}),
|
|
300
327
|
{
|
|
301
328
|
className,
|
|
302
329
|
addIcon,
|
|
303
330
|
addText,
|
|
304
331
|
removeIcon,
|
|
305
|
-
removeText
|
|
332
|
+
removeText,
|
|
333
|
+
title
|
|
306
334
|
} = _Object$assign,
|
|
307
|
-
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$
|
|
335
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$4);
|
|
308
336
|
return /*#__PURE__*/React.createElement(TableList$1, _extends({}, others, {
|
|
309
337
|
headerRender: (children, {
|
|
310
338
|
width
|
|
@@ -313,7 +341,7 @@ const TableList = props => {
|
|
|
313
341
|
className: style['table-list-header'],
|
|
314
342
|
wrap: false,
|
|
315
343
|
style: {
|
|
316
|
-
|
|
344
|
+
'--col-width': width
|
|
317
345
|
}
|
|
318
346
|
}, children, /*#__PURE__*/React.createElement(Col, {
|
|
319
347
|
className: style['table-options']
|
|
@@ -325,7 +353,7 @@ const TableList = props => {
|
|
|
325
353
|
}) => {
|
|
326
354
|
return /*#__PURE__*/React.createElement(Col, {
|
|
327
355
|
className: classnames({
|
|
328
|
-
[style[
|
|
356
|
+
[style['is-req']]: isReq
|
|
329
357
|
}),
|
|
330
358
|
key: id
|
|
331
359
|
}, children);
|
|
@@ -347,7 +375,7 @@ const TableList = props => {
|
|
|
347
375
|
wrap: false,
|
|
348
376
|
align: "top",
|
|
349
377
|
style: {
|
|
350
|
-
|
|
378
|
+
'--col-width': width
|
|
351
379
|
}
|
|
352
380
|
}, children, /*#__PURE__*/React.createElement(Col, {
|
|
353
381
|
className: style['table-options']
|
|
@@ -359,26 +387,25 @@ const TableList = props => {
|
|
|
359
387
|
icon: removeIcon
|
|
360
388
|
}, removeText)));
|
|
361
389
|
}
|
|
362
|
-
}), (children,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
className: classnames(className, style["table-list"]),
|
|
390
|
+
}), (children, {
|
|
391
|
+
onAdd,
|
|
392
|
+
allowAdd
|
|
393
|
+
}) => {
|
|
394
|
+
return /*#__PURE__*/React.createElement(InfoPage.Part, {
|
|
395
|
+
title: title,
|
|
396
|
+
className: classnames(className, style['table-list']),
|
|
370
397
|
extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
|
|
371
398
|
className: style['extra-btn'],
|
|
372
399
|
icon: addIcon,
|
|
373
400
|
onClick: onAdd
|
|
374
401
|
}, addText)
|
|
375
|
-
}
|
|
402
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
376
403
|
className: style['table-list-inner']
|
|
377
404
|
}, children));
|
|
378
405
|
});
|
|
379
406
|
};
|
|
380
407
|
|
|
381
|
-
const _excluded = ["className", "children"];
|
|
408
|
+
const _excluded$3 = ["className", "children"];
|
|
382
409
|
const Form = forwardRef((props, ref) => {
|
|
383
410
|
const _Object$assign = Object.assign({}, {
|
|
384
411
|
type: 'inner'
|
|
@@ -387,12 +414,3902 @@ const Form = forwardRef((props, ref) => {
|
|
|
387
414
|
className,
|
|
388
415
|
children
|
|
389
416
|
} = _Object$assign,
|
|
390
|
-
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded);
|
|
417
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$3);
|
|
391
418
|
return /*#__PURE__*/React.createElement(FormAntd, _extends({}, others, {
|
|
392
419
|
ref: ref,
|
|
393
|
-
className: classnames(className, style[
|
|
420
|
+
className: classnames(className, style['form-outer'])
|
|
394
421
|
}), /*#__PURE__*/React.createElement(InfoPage, null, children));
|
|
395
422
|
});
|
|
396
423
|
|
|
397
|
-
|
|
424
|
+
/**
|
|
425
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
426
|
+
* shorthands.
|
|
427
|
+
*
|
|
428
|
+
* @private
|
|
429
|
+
* @param {Array} [array] The array to iterate over.
|
|
430
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
431
|
+
* @returns {Array} Returns the new mapped array.
|
|
432
|
+
*/
|
|
433
|
+
function arrayMap(array, iteratee) {
|
|
434
|
+
var index = -1,
|
|
435
|
+
length = array == null ? 0 : array.length,
|
|
436
|
+
result = Array(length);
|
|
437
|
+
|
|
438
|
+
while (++index < length) {
|
|
439
|
+
result[index] = iteratee(array[index], index, array);
|
|
440
|
+
}
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
var _arrayMap = arrayMap;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Removes all key-value entries from the list cache.
|
|
448
|
+
*
|
|
449
|
+
* @private
|
|
450
|
+
* @name clear
|
|
451
|
+
* @memberOf ListCache
|
|
452
|
+
*/
|
|
453
|
+
function listCacheClear() {
|
|
454
|
+
this.__data__ = [];
|
|
455
|
+
this.size = 0;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
var _listCacheClear = listCacheClear;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Performs a
|
|
462
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
463
|
+
* comparison between two values to determine if they are equivalent.
|
|
464
|
+
*
|
|
465
|
+
* @static
|
|
466
|
+
* @memberOf _
|
|
467
|
+
* @since 4.0.0
|
|
468
|
+
* @category Lang
|
|
469
|
+
* @param {*} value The value to compare.
|
|
470
|
+
* @param {*} other The other value to compare.
|
|
471
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
472
|
+
* @example
|
|
473
|
+
*
|
|
474
|
+
* var object = { 'a': 1 };
|
|
475
|
+
* var other = { 'a': 1 };
|
|
476
|
+
*
|
|
477
|
+
* _.eq(object, object);
|
|
478
|
+
* // => true
|
|
479
|
+
*
|
|
480
|
+
* _.eq(object, other);
|
|
481
|
+
* // => false
|
|
482
|
+
*
|
|
483
|
+
* _.eq('a', 'a');
|
|
484
|
+
* // => true
|
|
485
|
+
*
|
|
486
|
+
* _.eq('a', Object('a'));
|
|
487
|
+
* // => false
|
|
488
|
+
*
|
|
489
|
+
* _.eq(NaN, NaN);
|
|
490
|
+
* // => true
|
|
491
|
+
*/
|
|
492
|
+
function eq(value, other) {
|
|
493
|
+
return value === other || (value !== value && other !== other);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
var eq_1 = eq;
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
500
|
+
*
|
|
501
|
+
* @private
|
|
502
|
+
* @param {Array} array The array to inspect.
|
|
503
|
+
* @param {*} key The key to search for.
|
|
504
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
505
|
+
*/
|
|
506
|
+
function assocIndexOf(array, key) {
|
|
507
|
+
var length = array.length;
|
|
508
|
+
while (length--) {
|
|
509
|
+
if (eq_1(array[length][0], key)) {
|
|
510
|
+
return length;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return -1;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
var _assocIndexOf = assocIndexOf;
|
|
517
|
+
|
|
518
|
+
/** Used for built-in method references. */
|
|
519
|
+
var arrayProto = Array.prototype;
|
|
520
|
+
|
|
521
|
+
/** Built-in value references. */
|
|
522
|
+
var splice = arrayProto.splice;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Removes `key` and its value from the list cache.
|
|
526
|
+
*
|
|
527
|
+
* @private
|
|
528
|
+
* @name delete
|
|
529
|
+
* @memberOf ListCache
|
|
530
|
+
* @param {string} key The key of the value to remove.
|
|
531
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
532
|
+
*/
|
|
533
|
+
function listCacheDelete(key) {
|
|
534
|
+
var data = this.__data__,
|
|
535
|
+
index = _assocIndexOf(data, key);
|
|
536
|
+
|
|
537
|
+
if (index < 0) {
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
var lastIndex = data.length - 1;
|
|
541
|
+
if (index == lastIndex) {
|
|
542
|
+
data.pop();
|
|
543
|
+
} else {
|
|
544
|
+
splice.call(data, index, 1);
|
|
545
|
+
}
|
|
546
|
+
--this.size;
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
var _listCacheDelete = listCacheDelete;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Gets the list cache value for `key`.
|
|
554
|
+
*
|
|
555
|
+
* @private
|
|
556
|
+
* @name get
|
|
557
|
+
* @memberOf ListCache
|
|
558
|
+
* @param {string} key The key of the value to get.
|
|
559
|
+
* @returns {*} Returns the entry value.
|
|
560
|
+
*/
|
|
561
|
+
function listCacheGet(key) {
|
|
562
|
+
var data = this.__data__,
|
|
563
|
+
index = _assocIndexOf(data, key);
|
|
564
|
+
|
|
565
|
+
return index < 0 ? undefined : data[index][1];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
var _listCacheGet = listCacheGet;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Checks if a list cache value for `key` exists.
|
|
572
|
+
*
|
|
573
|
+
* @private
|
|
574
|
+
* @name has
|
|
575
|
+
* @memberOf ListCache
|
|
576
|
+
* @param {string} key The key of the entry to check.
|
|
577
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
578
|
+
*/
|
|
579
|
+
function listCacheHas(key) {
|
|
580
|
+
return _assocIndexOf(this.__data__, key) > -1;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
var _listCacheHas = listCacheHas;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Sets the list cache `key` to `value`.
|
|
587
|
+
*
|
|
588
|
+
* @private
|
|
589
|
+
* @name set
|
|
590
|
+
* @memberOf ListCache
|
|
591
|
+
* @param {string} key The key of the value to set.
|
|
592
|
+
* @param {*} value The value to set.
|
|
593
|
+
* @returns {Object} Returns the list cache instance.
|
|
594
|
+
*/
|
|
595
|
+
function listCacheSet(key, value) {
|
|
596
|
+
var data = this.__data__,
|
|
597
|
+
index = _assocIndexOf(data, key);
|
|
598
|
+
|
|
599
|
+
if (index < 0) {
|
|
600
|
+
++this.size;
|
|
601
|
+
data.push([key, value]);
|
|
602
|
+
} else {
|
|
603
|
+
data[index][1] = value;
|
|
604
|
+
}
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
var _listCacheSet = listCacheSet;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Creates an list cache object.
|
|
612
|
+
*
|
|
613
|
+
* @private
|
|
614
|
+
* @constructor
|
|
615
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
616
|
+
*/
|
|
617
|
+
function ListCache(entries) {
|
|
618
|
+
var index = -1,
|
|
619
|
+
length = entries == null ? 0 : entries.length;
|
|
620
|
+
|
|
621
|
+
this.clear();
|
|
622
|
+
while (++index < length) {
|
|
623
|
+
var entry = entries[index];
|
|
624
|
+
this.set(entry[0], entry[1]);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// Add methods to `ListCache`.
|
|
629
|
+
ListCache.prototype.clear = _listCacheClear;
|
|
630
|
+
ListCache.prototype['delete'] = _listCacheDelete;
|
|
631
|
+
ListCache.prototype.get = _listCacheGet;
|
|
632
|
+
ListCache.prototype.has = _listCacheHas;
|
|
633
|
+
ListCache.prototype.set = _listCacheSet;
|
|
634
|
+
|
|
635
|
+
var _ListCache = ListCache;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Removes all key-value entries from the stack.
|
|
639
|
+
*
|
|
640
|
+
* @private
|
|
641
|
+
* @name clear
|
|
642
|
+
* @memberOf Stack
|
|
643
|
+
*/
|
|
644
|
+
function stackClear() {
|
|
645
|
+
this.__data__ = new _ListCache;
|
|
646
|
+
this.size = 0;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
var _stackClear = stackClear;
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Removes `key` and its value from the stack.
|
|
653
|
+
*
|
|
654
|
+
* @private
|
|
655
|
+
* @name delete
|
|
656
|
+
* @memberOf Stack
|
|
657
|
+
* @param {string} key The key of the value to remove.
|
|
658
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
659
|
+
*/
|
|
660
|
+
function stackDelete(key) {
|
|
661
|
+
var data = this.__data__,
|
|
662
|
+
result = data['delete'](key);
|
|
663
|
+
|
|
664
|
+
this.size = data.size;
|
|
665
|
+
return result;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
var _stackDelete = stackDelete;
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Gets the stack value for `key`.
|
|
672
|
+
*
|
|
673
|
+
* @private
|
|
674
|
+
* @name get
|
|
675
|
+
* @memberOf Stack
|
|
676
|
+
* @param {string} key The key of the value to get.
|
|
677
|
+
* @returns {*} Returns the entry value.
|
|
678
|
+
*/
|
|
679
|
+
function stackGet(key) {
|
|
680
|
+
return this.__data__.get(key);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
var _stackGet = stackGet;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Checks if a stack value for `key` exists.
|
|
687
|
+
*
|
|
688
|
+
* @private
|
|
689
|
+
* @name has
|
|
690
|
+
* @memberOf Stack
|
|
691
|
+
* @param {string} key The key of the entry to check.
|
|
692
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
693
|
+
*/
|
|
694
|
+
function stackHas(key) {
|
|
695
|
+
return this.__data__.has(key);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
var _stackHas = stackHas;
|
|
699
|
+
|
|
700
|
+
/** Detect free variable `global` from Node.js. */
|
|
701
|
+
|
|
702
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
703
|
+
|
|
704
|
+
var _freeGlobal = freeGlobal;
|
|
705
|
+
|
|
706
|
+
/** Detect free variable `self`. */
|
|
707
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
708
|
+
|
|
709
|
+
/** Used as a reference to the global object. */
|
|
710
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
711
|
+
|
|
712
|
+
var _root = root;
|
|
713
|
+
|
|
714
|
+
/** Built-in value references. */
|
|
715
|
+
var Symbol = _root.Symbol;
|
|
716
|
+
|
|
717
|
+
var _Symbol = Symbol;
|
|
718
|
+
|
|
719
|
+
/** Used for built-in method references. */
|
|
720
|
+
var objectProto$d = Object.prototype;
|
|
721
|
+
|
|
722
|
+
/** Used to check objects for own properties. */
|
|
723
|
+
var hasOwnProperty$a = objectProto$d.hasOwnProperty;
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Used to resolve the
|
|
727
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
728
|
+
* of values.
|
|
729
|
+
*/
|
|
730
|
+
var nativeObjectToString$1 = objectProto$d.toString;
|
|
731
|
+
|
|
732
|
+
/** Built-in value references. */
|
|
733
|
+
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
737
|
+
*
|
|
738
|
+
* @private
|
|
739
|
+
* @param {*} value The value to query.
|
|
740
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
741
|
+
*/
|
|
742
|
+
function getRawTag(value) {
|
|
743
|
+
var isOwn = hasOwnProperty$a.call(value, symToStringTag$1),
|
|
744
|
+
tag = value[symToStringTag$1];
|
|
745
|
+
|
|
746
|
+
try {
|
|
747
|
+
value[symToStringTag$1] = undefined;
|
|
748
|
+
var unmasked = true;
|
|
749
|
+
} catch (e) {}
|
|
750
|
+
|
|
751
|
+
var result = nativeObjectToString$1.call(value);
|
|
752
|
+
if (unmasked) {
|
|
753
|
+
if (isOwn) {
|
|
754
|
+
value[symToStringTag$1] = tag;
|
|
755
|
+
} else {
|
|
756
|
+
delete value[symToStringTag$1];
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return result;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
var _getRawTag = getRawTag;
|
|
763
|
+
|
|
764
|
+
/** Used for built-in method references. */
|
|
765
|
+
var objectProto$c = Object.prototype;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Used to resolve the
|
|
769
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
770
|
+
* of values.
|
|
771
|
+
*/
|
|
772
|
+
var nativeObjectToString = objectProto$c.toString;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
776
|
+
*
|
|
777
|
+
* @private
|
|
778
|
+
* @param {*} value The value to convert.
|
|
779
|
+
* @returns {string} Returns the converted string.
|
|
780
|
+
*/
|
|
781
|
+
function objectToString(value) {
|
|
782
|
+
return nativeObjectToString.call(value);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
var _objectToString = objectToString;
|
|
786
|
+
|
|
787
|
+
/** `Object#toString` result references. */
|
|
788
|
+
var nullTag = '[object Null]',
|
|
789
|
+
undefinedTag = '[object Undefined]';
|
|
790
|
+
|
|
791
|
+
/** Built-in value references. */
|
|
792
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
796
|
+
*
|
|
797
|
+
* @private
|
|
798
|
+
* @param {*} value The value to query.
|
|
799
|
+
* @returns {string} Returns the `toStringTag`.
|
|
800
|
+
*/
|
|
801
|
+
function baseGetTag(value) {
|
|
802
|
+
if (value == null) {
|
|
803
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
804
|
+
}
|
|
805
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
806
|
+
? _getRawTag(value)
|
|
807
|
+
: _objectToString(value);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
var _baseGetTag = baseGetTag;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Checks if `value` is the
|
|
814
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
815
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
816
|
+
*
|
|
817
|
+
* @static
|
|
818
|
+
* @memberOf _
|
|
819
|
+
* @since 0.1.0
|
|
820
|
+
* @category Lang
|
|
821
|
+
* @param {*} value The value to check.
|
|
822
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
823
|
+
* @example
|
|
824
|
+
*
|
|
825
|
+
* _.isObject({});
|
|
826
|
+
* // => true
|
|
827
|
+
*
|
|
828
|
+
* _.isObject([1, 2, 3]);
|
|
829
|
+
* // => true
|
|
830
|
+
*
|
|
831
|
+
* _.isObject(_.noop);
|
|
832
|
+
* // => true
|
|
833
|
+
*
|
|
834
|
+
* _.isObject(null);
|
|
835
|
+
* // => false
|
|
836
|
+
*/
|
|
837
|
+
function isObject(value) {
|
|
838
|
+
var type = typeof value;
|
|
839
|
+
return value != null && (type == 'object' || type == 'function');
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
var isObject_1 = isObject;
|
|
843
|
+
|
|
844
|
+
/** `Object#toString` result references. */
|
|
845
|
+
var asyncTag = '[object AsyncFunction]',
|
|
846
|
+
funcTag$2 = '[object Function]',
|
|
847
|
+
genTag$1 = '[object GeneratorFunction]',
|
|
848
|
+
proxyTag = '[object Proxy]';
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Checks if `value` is classified as a `Function` object.
|
|
852
|
+
*
|
|
853
|
+
* @static
|
|
854
|
+
* @memberOf _
|
|
855
|
+
* @since 0.1.0
|
|
856
|
+
* @category Lang
|
|
857
|
+
* @param {*} value The value to check.
|
|
858
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
859
|
+
* @example
|
|
860
|
+
*
|
|
861
|
+
* _.isFunction(_);
|
|
862
|
+
* // => true
|
|
863
|
+
*
|
|
864
|
+
* _.isFunction(/abc/);
|
|
865
|
+
* // => false
|
|
866
|
+
*/
|
|
867
|
+
function isFunction(value) {
|
|
868
|
+
if (!isObject_1(value)) {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
872
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
873
|
+
var tag = _baseGetTag(value);
|
|
874
|
+
return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
var isFunction_1 = isFunction;
|
|
878
|
+
|
|
879
|
+
/** Used to detect overreaching core-js shims. */
|
|
880
|
+
var coreJsData = _root['__core-js_shared__'];
|
|
881
|
+
|
|
882
|
+
var _coreJsData = coreJsData;
|
|
883
|
+
|
|
884
|
+
/** Used to detect methods masquerading as native. */
|
|
885
|
+
var maskSrcKey = (function() {
|
|
886
|
+
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
|
887
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
888
|
+
}());
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Checks if `func` has its source masked.
|
|
892
|
+
*
|
|
893
|
+
* @private
|
|
894
|
+
* @param {Function} func The function to check.
|
|
895
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
896
|
+
*/
|
|
897
|
+
function isMasked(func) {
|
|
898
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
var _isMasked = isMasked;
|
|
902
|
+
|
|
903
|
+
/** Used for built-in method references. */
|
|
904
|
+
var funcProto$2 = Function.prototype;
|
|
905
|
+
|
|
906
|
+
/** Used to resolve the decompiled source of functions. */
|
|
907
|
+
var funcToString$2 = funcProto$2.toString;
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Converts `func` to its source code.
|
|
911
|
+
*
|
|
912
|
+
* @private
|
|
913
|
+
* @param {Function} func The function to convert.
|
|
914
|
+
* @returns {string} Returns the source code.
|
|
915
|
+
*/
|
|
916
|
+
function toSource(func) {
|
|
917
|
+
if (func != null) {
|
|
918
|
+
try {
|
|
919
|
+
return funcToString$2.call(func);
|
|
920
|
+
} catch (e) {}
|
|
921
|
+
try {
|
|
922
|
+
return (func + '');
|
|
923
|
+
} catch (e) {}
|
|
924
|
+
}
|
|
925
|
+
return '';
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
var _toSource = toSource;
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Used to match `RegExp`
|
|
932
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
933
|
+
*/
|
|
934
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
935
|
+
|
|
936
|
+
/** Used to detect host constructors (Safari). */
|
|
937
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
938
|
+
|
|
939
|
+
/** Used for built-in method references. */
|
|
940
|
+
var funcProto$1 = Function.prototype,
|
|
941
|
+
objectProto$b = Object.prototype;
|
|
942
|
+
|
|
943
|
+
/** Used to resolve the decompiled source of functions. */
|
|
944
|
+
var funcToString$1 = funcProto$1.toString;
|
|
945
|
+
|
|
946
|
+
/** Used to check objects for own properties. */
|
|
947
|
+
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
948
|
+
|
|
949
|
+
/** Used to detect if a method is native. */
|
|
950
|
+
var reIsNative = RegExp('^' +
|
|
951
|
+
funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, '\\$&')
|
|
952
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
953
|
+
);
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
957
|
+
*
|
|
958
|
+
* @private
|
|
959
|
+
* @param {*} value The value to check.
|
|
960
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
961
|
+
* else `false`.
|
|
962
|
+
*/
|
|
963
|
+
function baseIsNative(value) {
|
|
964
|
+
if (!isObject_1(value) || _isMasked(value)) {
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
|
|
968
|
+
return pattern.test(_toSource(value));
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
var _baseIsNative = baseIsNative;
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Gets the value at `key` of `object`.
|
|
975
|
+
*
|
|
976
|
+
* @private
|
|
977
|
+
* @param {Object} [object] The object to query.
|
|
978
|
+
* @param {string} key The key of the property to get.
|
|
979
|
+
* @returns {*} Returns the property value.
|
|
980
|
+
*/
|
|
981
|
+
function getValue(object, key) {
|
|
982
|
+
return object == null ? undefined : object[key];
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
var _getValue = getValue;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Gets the native function at `key` of `object`.
|
|
989
|
+
*
|
|
990
|
+
* @private
|
|
991
|
+
* @param {Object} object The object to query.
|
|
992
|
+
* @param {string} key The key of the method to get.
|
|
993
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
994
|
+
*/
|
|
995
|
+
function getNative(object, key) {
|
|
996
|
+
var value = _getValue(object, key);
|
|
997
|
+
return _baseIsNative(value) ? value : undefined;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
var _getNative = getNative;
|
|
1001
|
+
|
|
1002
|
+
/* Built-in method references that are verified to be native. */
|
|
1003
|
+
var Map = _getNative(_root, 'Map');
|
|
1004
|
+
|
|
1005
|
+
var _Map = Map;
|
|
1006
|
+
|
|
1007
|
+
/* Built-in method references that are verified to be native. */
|
|
1008
|
+
var nativeCreate = _getNative(Object, 'create');
|
|
1009
|
+
|
|
1010
|
+
var _nativeCreate = nativeCreate;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Removes all key-value entries from the hash.
|
|
1014
|
+
*
|
|
1015
|
+
* @private
|
|
1016
|
+
* @name clear
|
|
1017
|
+
* @memberOf Hash
|
|
1018
|
+
*/
|
|
1019
|
+
function hashClear() {
|
|
1020
|
+
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1021
|
+
this.size = 0;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
var _hashClear = hashClear;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Removes `key` and its value from the hash.
|
|
1028
|
+
*
|
|
1029
|
+
* @private
|
|
1030
|
+
* @name delete
|
|
1031
|
+
* @memberOf Hash
|
|
1032
|
+
* @param {Object} hash The hash to modify.
|
|
1033
|
+
* @param {string} key The key of the value to remove.
|
|
1034
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1035
|
+
*/
|
|
1036
|
+
function hashDelete(key) {
|
|
1037
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
1038
|
+
this.size -= result ? 1 : 0;
|
|
1039
|
+
return result;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
var _hashDelete = hashDelete;
|
|
1043
|
+
|
|
1044
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1045
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1046
|
+
|
|
1047
|
+
/** Used for built-in method references. */
|
|
1048
|
+
var objectProto$a = Object.prototype;
|
|
1049
|
+
|
|
1050
|
+
/** Used to check objects for own properties. */
|
|
1051
|
+
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Gets the hash value for `key`.
|
|
1055
|
+
*
|
|
1056
|
+
* @private
|
|
1057
|
+
* @name get
|
|
1058
|
+
* @memberOf Hash
|
|
1059
|
+
* @param {string} key The key of the value to get.
|
|
1060
|
+
* @returns {*} Returns the entry value.
|
|
1061
|
+
*/
|
|
1062
|
+
function hashGet(key) {
|
|
1063
|
+
var data = this.__data__;
|
|
1064
|
+
if (_nativeCreate) {
|
|
1065
|
+
var result = data[key];
|
|
1066
|
+
return result === HASH_UNDEFINED$1 ? undefined : result;
|
|
1067
|
+
}
|
|
1068
|
+
return hasOwnProperty$8.call(data, key) ? data[key] : undefined;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
var _hashGet = hashGet;
|
|
1072
|
+
|
|
1073
|
+
/** Used for built-in method references. */
|
|
1074
|
+
var objectProto$9 = Object.prototype;
|
|
1075
|
+
|
|
1076
|
+
/** Used to check objects for own properties. */
|
|
1077
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Checks if a hash value for `key` exists.
|
|
1081
|
+
*
|
|
1082
|
+
* @private
|
|
1083
|
+
* @name has
|
|
1084
|
+
* @memberOf Hash
|
|
1085
|
+
* @param {string} key The key of the entry to check.
|
|
1086
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1087
|
+
*/
|
|
1088
|
+
function hashHas(key) {
|
|
1089
|
+
var data = this.__data__;
|
|
1090
|
+
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$7.call(data, key);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
var _hashHas = hashHas;
|
|
1094
|
+
|
|
1095
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1096
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Sets the hash `key` to `value`.
|
|
1100
|
+
*
|
|
1101
|
+
* @private
|
|
1102
|
+
* @name set
|
|
1103
|
+
* @memberOf Hash
|
|
1104
|
+
* @param {string} key The key of the value to set.
|
|
1105
|
+
* @param {*} value The value to set.
|
|
1106
|
+
* @returns {Object} Returns the hash instance.
|
|
1107
|
+
*/
|
|
1108
|
+
function hashSet(key, value) {
|
|
1109
|
+
var data = this.__data__;
|
|
1110
|
+
this.size += this.has(key) ? 0 : 1;
|
|
1111
|
+
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
1112
|
+
return this;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
var _hashSet = hashSet;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates a hash object.
|
|
1119
|
+
*
|
|
1120
|
+
* @private
|
|
1121
|
+
* @constructor
|
|
1122
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1123
|
+
*/
|
|
1124
|
+
function Hash(entries) {
|
|
1125
|
+
var index = -1,
|
|
1126
|
+
length = entries == null ? 0 : entries.length;
|
|
1127
|
+
|
|
1128
|
+
this.clear();
|
|
1129
|
+
while (++index < length) {
|
|
1130
|
+
var entry = entries[index];
|
|
1131
|
+
this.set(entry[0], entry[1]);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
// Add methods to `Hash`.
|
|
1136
|
+
Hash.prototype.clear = _hashClear;
|
|
1137
|
+
Hash.prototype['delete'] = _hashDelete;
|
|
1138
|
+
Hash.prototype.get = _hashGet;
|
|
1139
|
+
Hash.prototype.has = _hashHas;
|
|
1140
|
+
Hash.prototype.set = _hashSet;
|
|
1141
|
+
|
|
1142
|
+
var _Hash = Hash;
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Removes all key-value entries from the map.
|
|
1146
|
+
*
|
|
1147
|
+
* @private
|
|
1148
|
+
* @name clear
|
|
1149
|
+
* @memberOf MapCache
|
|
1150
|
+
*/
|
|
1151
|
+
function mapCacheClear() {
|
|
1152
|
+
this.size = 0;
|
|
1153
|
+
this.__data__ = {
|
|
1154
|
+
'hash': new _Hash,
|
|
1155
|
+
'map': new (_Map || _ListCache),
|
|
1156
|
+
'string': new _Hash
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
var _mapCacheClear = mapCacheClear;
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1164
|
+
*
|
|
1165
|
+
* @private
|
|
1166
|
+
* @param {*} value The value to check.
|
|
1167
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1168
|
+
*/
|
|
1169
|
+
function isKeyable(value) {
|
|
1170
|
+
var type = typeof value;
|
|
1171
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1172
|
+
? (value !== '__proto__')
|
|
1173
|
+
: (value === null);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
var _isKeyable = isKeyable;
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Gets the data for `map`.
|
|
1180
|
+
*
|
|
1181
|
+
* @private
|
|
1182
|
+
* @param {Object} map The map to query.
|
|
1183
|
+
* @param {string} key The reference key.
|
|
1184
|
+
* @returns {*} Returns the map data.
|
|
1185
|
+
*/
|
|
1186
|
+
function getMapData(map, key) {
|
|
1187
|
+
var data = map.__data__;
|
|
1188
|
+
return _isKeyable(key)
|
|
1189
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1190
|
+
: data.map;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
var _getMapData = getMapData;
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Removes `key` and its value from the map.
|
|
1197
|
+
*
|
|
1198
|
+
* @private
|
|
1199
|
+
* @name delete
|
|
1200
|
+
* @memberOf MapCache
|
|
1201
|
+
* @param {string} key The key of the value to remove.
|
|
1202
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1203
|
+
*/
|
|
1204
|
+
function mapCacheDelete(key) {
|
|
1205
|
+
var result = _getMapData(this, key)['delete'](key);
|
|
1206
|
+
this.size -= result ? 1 : 0;
|
|
1207
|
+
return result;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
var _mapCacheDelete = mapCacheDelete;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* Gets the map value for `key`.
|
|
1214
|
+
*
|
|
1215
|
+
* @private
|
|
1216
|
+
* @name get
|
|
1217
|
+
* @memberOf MapCache
|
|
1218
|
+
* @param {string} key The key of the value to get.
|
|
1219
|
+
* @returns {*} Returns the entry value.
|
|
1220
|
+
*/
|
|
1221
|
+
function mapCacheGet(key) {
|
|
1222
|
+
return _getMapData(this, key).get(key);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
var _mapCacheGet = mapCacheGet;
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Checks if a map value for `key` exists.
|
|
1229
|
+
*
|
|
1230
|
+
* @private
|
|
1231
|
+
* @name has
|
|
1232
|
+
* @memberOf MapCache
|
|
1233
|
+
* @param {string} key The key of the entry to check.
|
|
1234
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1235
|
+
*/
|
|
1236
|
+
function mapCacheHas(key) {
|
|
1237
|
+
return _getMapData(this, key).has(key);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
var _mapCacheHas = mapCacheHas;
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Sets the map `key` to `value`.
|
|
1244
|
+
*
|
|
1245
|
+
* @private
|
|
1246
|
+
* @name set
|
|
1247
|
+
* @memberOf MapCache
|
|
1248
|
+
* @param {string} key The key of the value to set.
|
|
1249
|
+
* @param {*} value The value to set.
|
|
1250
|
+
* @returns {Object} Returns the map cache instance.
|
|
1251
|
+
*/
|
|
1252
|
+
function mapCacheSet(key, value) {
|
|
1253
|
+
var data = _getMapData(this, key),
|
|
1254
|
+
size = data.size;
|
|
1255
|
+
|
|
1256
|
+
data.set(key, value);
|
|
1257
|
+
this.size += data.size == size ? 0 : 1;
|
|
1258
|
+
return this;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
var _mapCacheSet = mapCacheSet;
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Creates a map cache object to store key-value pairs.
|
|
1265
|
+
*
|
|
1266
|
+
* @private
|
|
1267
|
+
* @constructor
|
|
1268
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1269
|
+
*/
|
|
1270
|
+
function MapCache(entries) {
|
|
1271
|
+
var index = -1,
|
|
1272
|
+
length = entries == null ? 0 : entries.length;
|
|
1273
|
+
|
|
1274
|
+
this.clear();
|
|
1275
|
+
while (++index < length) {
|
|
1276
|
+
var entry = entries[index];
|
|
1277
|
+
this.set(entry[0], entry[1]);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
// Add methods to `MapCache`.
|
|
1282
|
+
MapCache.prototype.clear = _mapCacheClear;
|
|
1283
|
+
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1284
|
+
MapCache.prototype.get = _mapCacheGet;
|
|
1285
|
+
MapCache.prototype.has = _mapCacheHas;
|
|
1286
|
+
MapCache.prototype.set = _mapCacheSet;
|
|
1287
|
+
|
|
1288
|
+
var _MapCache = MapCache;
|
|
1289
|
+
|
|
1290
|
+
/** Used as the size to enable large array optimizations. */
|
|
1291
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Sets the stack `key` to `value`.
|
|
1295
|
+
*
|
|
1296
|
+
* @private
|
|
1297
|
+
* @name set
|
|
1298
|
+
* @memberOf Stack
|
|
1299
|
+
* @param {string} key The key of the value to set.
|
|
1300
|
+
* @param {*} value The value to set.
|
|
1301
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1302
|
+
*/
|
|
1303
|
+
function stackSet(key, value) {
|
|
1304
|
+
var data = this.__data__;
|
|
1305
|
+
if (data instanceof _ListCache) {
|
|
1306
|
+
var pairs = data.__data__;
|
|
1307
|
+
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1308
|
+
pairs.push([key, value]);
|
|
1309
|
+
this.size = ++data.size;
|
|
1310
|
+
return this;
|
|
1311
|
+
}
|
|
1312
|
+
data = this.__data__ = new _MapCache(pairs);
|
|
1313
|
+
}
|
|
1314
|
+
data.set(key, value);
|
|
1315
|
+
this.size = data.size;
|
|
1316
|
+
return this;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
var _stackSet = stackSet;
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1323
|
+
*
|
|
1324
|
+
* @private
|
|
1325
|
+
* @constructor
|
|
1326
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1327
|
+
*/
|
|
1328
|
+
function Stack(entries) {
|
|
1329
|
+
var data = this.__data__ = new _ListCache(entries);
|
|
1330
|
+
this.size = data.size;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
// Add methods to `Stack`.
|
|
1334
|
+
Stack.prototype.clear = _stackClear;
|
|
1335
|
+
Stack.prototype['delete'] = _stackDelete;
|
|
1336
|
+
Stack.prototype.get = _stackGet;
|
|
1337
|
+
Stack.prototype.has = _stackHas;
|
|
1338
|
+
Stack.prototype.set = _stackSet;
|
|
1339
|
+
|
|
1340
|
+
var _Stack = Stack;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* A specialized version of `_.forEach` for arrays without support for
|
|
1344
|
+
* iteratee shorthands.
|
|
1345
|
+
*
|
|
1346
|
+
* @private
|
|
1347
|
+
* @param {Array} [array] The array to iterate over.
|
|
1348
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1349
|
+
* @returns {Array} Returns `array`.
|
|
1350
|
+
*/
|
|
1351
|
+
function arrayEach(array, iteratee) {
|
|
1352
|
+
var index = -1,
|
|
1353
|
+
length = array == null ? 0 : array.length;
|
|
1354
|
+
|
|
1355
|
+
while (++index < length) {
|
|
1356
|
+
if (iteratee(array[index], index, array) === false) {
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
return array;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
var _arrayEach = arrayEach;
|
|
1364
|
+
|
|
1365
|
+
var defineProperty = (function() {
|
|
1366
|
+
try {
|
|
1367
|
+
var func = _getNative(Object, 'defineProperty');
|
|
1368
|
+
func({}, '', {});
|
|
1369
|
+
return func;
|
|
1370
|
+
} catch (e) {}
|
|
1371
|
+
}());
|
|
1372
|
+
|
|
1373
|
+
var _defineProperty = defineProperty;
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* The base implementation of `assignValue` and `assignMergeValue` without
|
|
1377
|
+
* value checks.
|
|
1378
|
+
*
|
|
1379
|
+
* @private
|
|
1380
|
+
* @param {Object} object The object to modify.
|
|
1381
|
+
* @param {string} key The key of the property to assign.
|
|
1382
|
+
* @param {*} value The value to assign.
|
|
1383
|
+
*/
|
|
1384
|
+
function baseAssignValue(object, key, value) {
|
|
1385
|
+
if (key == '__proto__' && _defineProperty) {
|
|
1386
|
+
_defineProperty(object, key, {
|
|
1387
|
+
'configurable': true,
|
|
1388
|
+
'enumerable': true,
|
|
1389
|
+
'value': value,
|
|
1390
|
+
'writable': true
|
|
1391
|
+
});
|
|
1392
|
+
} else {
|
|
1393
|
+
object[key] = value;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
var _baseAssignValue = baseAssignValue;
|
|
1398
|
+
|
|
1399
|
+
/** Used for built-in method references. */
|
|
1400
|
+
var objectProto$8 = Object.prototype;
|
|
1401
|
+
|
|
1402
|
+
/** Used to check objects for own properties. */
|
|
1403
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
1407
|
+
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1408
|
+
* for equality comparisons.
|
|
1409
|
+
*
|
|
1410
|
+
* @private
|
|
1411
|
+
* @param {Object} object The object to modify.
|
|
1412
|
+
* @param {string} key The key of the property to assign.
|
|
1413
|
+
* @param {*} value The value to assign.
|
|
1414
|
+
*/
|
|
1415
|
+
function assignValue(object, key, value) {
|
|
1416
|
+
var objValue = object[key];
|
|
1417
|
+
if (!(hasOwnProperty$6.call(object, key) && eq_1(objValue, value)) ||
|
|
1418
|
+
(value === undefined && !(key in object))) {
|
|
1419
|
+
_baseAssignValue(object, key, value);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
var _assignValue = assignValue;
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* Copies properties of `source` to `object`.
|
|
1427
|
+
*
|
|
1428
|
+
* @private
|
|
1429
|
+
* @param {Object} source The object to copy properties from.
|
|
1430
|
+
* @param {Array} props The property identifiers to copy.
|
|
1431
|
+
* @param {Object} [object={}] The object to copy properties to.
|
|
1432
|
+
* @param {Function} [customizer] The function to customize copied values.
|
|
1433
|
+
* @returns {Object} Returns `object`.
|
|
1434
|
+
*/
|
|
1435
|
+
function copyObject(source, props, object, customizer) {
|
|
1436
|
+
var isNew = !object;
|
|
1437
|
+
object || (object = {});
|
|
1438
|
+
|
|
1439
|
+
var index = -1,
|
|
1440
|
+
length = props.length;
|
|
1441
|
+
|
|
1442
|
+
while (++index < length) {
|
|
1443
|
+
var key = props[index];
|
|
1444
|
+
|
|
1445
|
+
var newValue = customizer
|
|
1446
|
+
? customizer(object[key], source[key], key, object, source)
|
|
1447
|
+
: undefined;
|
|
1448
|
+
|
|
1449
|
+
if (newValue === undefined) {
|
|
1450
|
+
newValue = source[key];
|
|
1451
|
+
}
|
|
1452
|
+
if (isNew) {
|
|
1453
|
+
_baseAssignValue(object, key, newValue);
|
|
1454
|
+
} else {
|
|
1455
|
+
_assignValue(object, key, newValue);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return object;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
var _copyObject = copyObject;
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
1465
|
+
* or max array length checks.
|
|
1466
|
+
*
|
|
1467
|
+
* @private
|
|
1468
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
1469
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1470
|
+
* @returns {Array} Returns the array of results.
|
|
1471
|
+
*/
|
|
1472
|
+
function baseTimes(n, iteratee) {
|
|
1473
|
+
var index = -1,
|
|
1474
|
+
result = Array(n);
|
|
1475
|
+
|
|
1476
|
+
while (++index < n) {
|
|
1477
|
+
result[index] = iteratee(index);
|
|
1478
|
+
}
|
|
1479
|
+
return result;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
var _baseTimes = baseTimes;
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
1486
|
+
* and has a `typeof` result of "object".
|
|
1487
|
+
*
|
|
1488
|
+
* @static
|
|
1489
|
+
* @memberOf _
|
|
1490
|
+
* @since 4.0.0
|
|
1491
|
+
* @category Lang
|
|
1492
|
+
* @param {*} value The value to check.
|
|
1493
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
1494
|
+
* @example
|
|
1495
|
+
*
|
|
1496
|
+
* _.isObjectLike({});
|
|
1497
|
+
* // => true
|
|
1498
|
+
*
|
|
1499
|
+
* _.isObjectLike([1, 2, 3]);
|
|
1500
|
+
* // => true
|
|
1501
|
+
*
|
|
1502
|
+
* _.isObjectLike(_.noop);
|
|
1503
|
+
* // => false
|
|
1504
|
+
*
|
|
1505
|
+
* _.isObjectLike(null);
|
|
1506
|
+
* // => false
|
|
1507
|
+
*/
|
|
1508
|
+
function isObjectLike(value) {
|
|
1509
|
+
return value != null && typeof value == 'object';
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
var isObjectLike_1 = isObjectLike;
|
|
1513
|
+
|
|
1514
|
+
/** `Object#toString` result references. */
|
|
1515
|
+
var argsTag$2 = '[object Arguments]';
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* The base implementation of `_.isArguments`.
|
|
1519
|
+
*
|
|
1520
|
+
* @private
|
|
1521
|
+
* @param {*} value The value to check.
|
|
1522
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1523
|
+
*/
|
|
1524
|
+
function baseIsArguments(value) {
|
|
1525
|
+
return isObjectLike_1(value) && _baseGetTag(value) == argsTag$2;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
var _baseIsArguments = baseIsArguments;
|
|
1529
|
+
|
|
1530
|
+
/** Used for built-in method references. */
|
|
1531
|
+
var objectProto$7 = Object.prototype;
|
|
1532
|
+
|
|
1533
|
+
/** Used to check objects for own properties. */
|
|
1534
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
1535
|
+
|
|
1536
|
+
/** Built-in value references. */
|
|
1537
|
+
var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Checks if `value` is likely an `arguments` object.
|
|
1541
|
+
*
|
|
1542
|
+
* @static
|
|
1543
|
+
* @memberOf _
|
|
1544
|
+
* @since 0.1.0
|
|
1545
|
+
* @category Lang
|
|
1546
|
+
* @param {*} value The value to check.
|
|
1547
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1548
|
+
* else `false`.
|
|
1549
|
+
* @example
|
|
1550
|
+
*
|
|
1551
|
+
* _.isArguments(function() { return arguments; }());
|
|
1552
|
+
* // => true
|
|
1553
|
+
*
|
|
1554
|
+
* _.isArguments([1, 2, 3]);
|
|
1555
|
+
* // => false
|
|
1556
|
+
*/
|
|
1557
|
+
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
|
1558
|
+
return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
|
|
1559
|
+
!propertyIsEnumerable$1.call(value, 'callee');
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
var isArguments_1 = isArguments;
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Checks if `value` is classified as an `Array` object.
|
|
1566
|
+
*
|
|
1567
|
+
* @static
|
|
1568
|
+
* @memberOf _
|
|
1569
|
+
* @since 0.1.0
|
|
1570
|
+
* @category Lang
|
|
1571
|
+
* @param {*} value The value to check.
|
|
1572
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
1573
|
+
* @example
|
|
1574
|
+
*
|
|
1575
|
+
* _.isArray([1, 2, 3]);
|
|
1576
|
+
* // => true
|
|
1577
|
+
*
|
|
1578
|
+
* _.isArray(document.body.children);
|
|
1579
|
+
* // => false
|
|
1580
|
+
*
|
|
1581
|
+
* _.isArray('abc');
|
|
1582
|
+
* // => false
|
|
1583
|
+
*
|
|
1584
|
+
* _.isArray(_.noop);
|
|
1585
|
+
* // => false
|
|
1586
|
+
*/
|
|
1587
|
+
var isArray = Array.isArray;
|
|
1588
|
+
|
|
1589
|
+
var isArray_1 = isArray;
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* This method returns `false`.
|
|
1593
|
+
*
|
|
1594
|
+
* @static
|
|
1595
|
+
* @memberOf _
|
|
1596
|
+
* @since 4.13.0
|
|
1597
|
+
* @category Util
|
|
1598
|
+
* @returns {boolean} Returns `false`.
|
|
1599
|
+
* @example
|
|
1600
|
+
*
|
|
1601
|
+
* _.times(2, _.stubFalse);
|
|
1602
|
+
* // => [false, false]
|
|
1603
|
+
*/
|
|
1604
|
+
function stubFalse() {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
var stubFalse_1 = stubFalse;
|
|
1609
|
+
|
|
1610
|
+
var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
|
1611
|
+
/** Detect free variable `exports`. */
|
|
1612
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1613
|
+
|
|
1614
|
+
/** Detect free variable `module`. */
|
|
1615
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1616
|
+
|
|
1617
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1618
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1619
|
+
|
|
1620
|
+
/** Built-in value references. */
|
|
1621
|
+
var Buffer = moduleExports ? _root.Buffer : undefined;
|
|
1622
|
+
|
|
1623
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1624
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* Checks if `value` is a buffer.
|
|
1628
|
+
*
|
|
1629
|
+
* @static
|
|
1630
|
+
* @memberOf _
|
|
1631
|
+
* @since 4.3.0
|
|
1632
|
+
* @category Lang
|
|
1633
|
+
* @param {*} value The value to check.
|
|
1634
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1635
|
+
* @example
|
|
1636
|
+
*
|
|
1637
|
+
* _.isBuffer(new Buffer(2));
|
|
1638
|
+
* // => true
|
|
1639
|
+
*
|
|
1640
|
+
* _.isBuffer(new Uint8Array(2));
|
|
1641
|
+
* // => false
|
|
1642
|
+
*/
|
|
1643
|
+
var isBuffer = nativeIsBuffer || stubFalse_1;
|
|
1644
|
+
|
|
1645
|
+
module.exports = isBuffer;
|
|
1646
|
+
});
|
|
1647
|
+
|
|
1648
|
+
/** Used as references for various `Number` constants. */
|
|
1649
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
1650
|
+
|
|
1651
|
+
/** Used to detect unsigned integer values. */
|
|
1652
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Checks if `value` is a valid array-like index.
|
|
1656
|
+
*
|
|
1657
|
+
* @private
|
|
1658
|
+
* @param {*} value The value to check.
|
|
1659
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
1660
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1661
|
+
*/
|
|
1662
|
+
function isIndex(value, length) {
|
|
1663
|
+
var type = typeof value;
|
|
1664
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
1665
|
+
|
|
1666
|
+
return !!length &&
|
|
1667
|
+
(type == 'number' ||
|
|
1668
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
1669
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
var _isIndex = isIndex;
|
|
1673
|
+
|
|
1674
|
+
/** Used as references for various `Number` constants. */
|
|
1675
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* Checks if `value` is a valid array-like length.
|
|
1679
|
+
*
|
|
1680
|
+
* **Note:** This method is loosely based on
|
|
1681
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
1682
|
+
*
|
|
1683
|
+
* @static
|
|
1684
|
+
* @memberOf _
|
|
1685
|
+
* @since 4.0.0
|
|
1686
|
+
* @category Lang
|
|
1687
|
+
* @param {*} value The value to check.
|
|
1688
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
1689
|
+
* @example
|
|
1690
|
+
*
|
|
1691
|
+
* _.isLength(3);
|
|
1692
|
+
* // => true
|
|
1693
|
+
*
|
|
1694
|
+
* _.isLength(Number.MIN_VALUE);
|
|
1695
|
+
* // => false
|
|
1696
|
+
*
|
|
1697
|
+
* _.isLength(Infinity);
|
|
1698
|
+
* // => false
|
|
1699
|
+
*
|
|
1700
|
+
* _.isLength('3');
|
|
1701
|
+
* // => false
|
|
1702
|
+
*/
|
|
1703
|
+
function isLength(value) {
|
|
1704
|
+
return typeof value == 'number' &&
|
|
1705
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
var isLength_1 = isLength;
|
|
1709
|
+
|
|
1710
|
+
/** `Object#toString` result references. */
|
|
1711
|
+
var argsTag$1 = '[object Arguments]',
|
|
1712
|
+
arrayTag$1 = '[object Array]',
|
|
1713
|
+
boolTag$2 = '[object Boolean]',
|
|
1714
|
+
dateTag$2 = '[object Date]',
|
|
1715
|
+
errorTag$1 = '[object Error]',
|
|
1716
|
+
funcTag$1 = '[object Function]',
|
|
1717
|
+
mapTag$4 = '[object Map]',
|
|
1718
|
+
numberTag$2 = '[object Number]',
|
|
1719
|
+
objectTag$3 = '[object Object]',
|
|
1720
|
+
regexpTag$2 = '[object RegExp]',
|
|
1721
|
+
setTag$4 = '[object Set]',
|
|
1722
|
+
stringTag$2 = '[object String]',
|
|
1723
|
+
weakMapTag$2 = '[object WeakMap]';
|
|
1724
|
+
|
|
1725
|
+
var arrayBufferTag$2 = '[object ArrayBuffer]',
|
|
1726
|
+
dataViewTag$3 = '[object DataView]',
|
|
1727
|
+
float32Tag$2 = '[object Float32Array]',
|
|
1728
|
+
float64Tag$2 = '[object Float64Array]',
|
|
1729
|
+
int8Tag$2 = '[object Int8Array]',
|
|
1730
|
+
int16Tag$2 = '[object Int16Array]',
|
|
1731
|
+
int32Tag$2 = '[object Int32Array]',
|
|
1732
|
+
uint8Tag$2 = '[object Uint8Array]',
|
|
1733
|
+
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
|
|
1734
|
+
uint16Tag$2 = '[object Uint16Array]',
|
|
1735
|
+
uint32Tag$2 = '[object Uint32Array]';
|
|
1736
|
+
|
|
1737
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1738
|
+
var typedArrayTags = {};
|
|
1739
|
+
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] =
|
|
1740
|
+
typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] =
|
|
1741
|
+
typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] =
|
|
1742
|
+
typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] =
|
|
1743
|
+
typedArrayTags[uint32Tag$2] = true;
|
|
1744
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1745
|
+
typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] =
|
|
1746
|
+
typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] =
|
|
1747
|
+
typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] =
|
|
1748
|
+
typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] =
|
|
1749
|
+
typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] =
|
|
1750
|
+
typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] =
|
|
1751
|
+
typedArrayTags[weakMapTag$2] = false;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1755
|
+
*
|
|
1756
|
+
* @private
|
|
1757
|
+
* @param {*} value The value to check.
|
|
1758
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1759
|
+
*/
|
|
1760
|
+
function baseIsTypedArray(value) {
|
|
1761
|
+
return isObjectLike_1(value) &&
|
|
1762
|
+
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
var _baseIsTypedArray = baseIsTypedArray;
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1769
|
+
*
|
|
1770
|
+
* @private
|
|
1771
|
+
* @param {Function} func The function to cap arguments for.
|
|
1772
|
+
* @returns {Function} Returns the new capped function.
|
|
1773
|
+
*/
|
|
1774
|
+
function baseUnary(func) {
|
|
1775
|
+
return function(value) {
|
|
1776
|
+
return func(value);
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
var _baseUnary = baseUnary;
|
|
1781
|
+
|
|
1782
|
+
var _nodeUtil = createCommonjsModule(function (module, exports) {
|
|
1783
|
+
/** Detect free variable `exports`. */
|
|
1784
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1785
|
+
|
|
1786
|
+
/** Detect free variable `module`. */
|
|
1787
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1788
|
+
|
|
1789
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1790
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1791
|
+
|
|
1792
|
+
/** Detect free variable `process` from Node.js. */
|
|
1793
|
+
var freeProcess = moduleExports && _freeGlobal.process;
|
|
1794
|
+
|
|
1795
|
+
/** Used to access faster Node.js helpers. */
|
|
1796
|
+
var nodeUtil = (function() {
|
|
1797
|
+
try {
|
|
1798
|
+
// Use `util.types` for Node.js 10+.
|
|
1799
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1800
|
+
|
|
1801
|
+
if (types) {
|
|
1802
|
+
return types;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1806
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1807
|
+
} catch (e) {}
|
|
1808
|
+
}());
|
|
1809
|
+
|
|
1810
|
+
module.exports = nodeUtil;
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
/* Node.js helper references. */
|
|
1814
|
+
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* Checks if `value` is classified as a typed array.
|
|
1818
|
+
*
|
|
1819
|
+
* @static
|
|
1820
|
+
* @memberOf _
|
|
1821
|
+
* @since 3.0.0
|
|
1822
|
+
* @category Lang
|
|
1823
|
+
* @param {*} value The value to check.
|
|
1824
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1825
|
+
* @example
|
|
1826
|
+
*
|
|
1827
|
+
* _.isTypedArray(new Uint8Array);
|
|
1828
|
+
* // => true
|
|
1829
|
+
*
|
|
1830
|
+
* _.isTypedArray([]);
|
|
1831
|
+
* // => false
|
|
1832
|
+
*/
|
|
1833
|
+
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
|
1834
|
+
|
|
1835
|
+
var isTypedArray_1 = isTypedArray;
|
|
1836
|
+
|
|
1837
|
+
/** Used for built-in method references. */
|
|
1838
|
+
var objectProto$6 = Object.prototype;
|
|
1839
|
+
|
|
1840
|
+
/** Used to check objects for own properties. */
|
|
1841
|
+
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1845
|
+
*
|
|
1846
|
+
* @private
|
|
1847
|
+
* @param {*} value The value to query.
|
|
1848
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1849
|
+
* @returns {Array} Returns the array of property names.
|
|
1850
|
+
*/
|
|
1851
|
+
function arrayLikeKeys(value, inherited) {
|
|
1852
|
+
var isArr = isArray_1(value),
|
|
1853
|
+
isArg = !isArr && isArguments_1(value),
|
|
1854
|
+
isBuff = !isArr && !isArg && isBuffer_1(value),
|
|
1855
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
|
|
1856
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1857
|
+
result = skipIndexes ? _baseTimes(value.length, String) : [],
|
|
1858
|
+
length = result.length;
|
|
1859
|
+
|
|
1860
|
+
for (var key in value) {
|
|
1861
|
+
if ((inherited || hasOwnProperty$4.call(value, key)) &&
|
|
1862
|
+
!(skipIndexes && (
|
|
1863
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1864
|
+
key == 'length' ||
|
|
1865
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1866
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1867
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1868
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1869
|
+
// Skip index properties.
|
|
1870
|
+
_isIndex(key, length)
|
|
1871
|
+
))) {
|
|
1872
|
+
result.push(key);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
return result;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
var _arrayLikeKeys = arrayLikeKeys;
|
|
1879
|
+
|
|
1880
|
+
/** Used for built-in method references. */
|
|
1881
|
+
var objectProto$5 = Object.prototype;
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* Checks if `value` is likely a prototype object.
|
|
1885
|
+
*
|
|
1886
|
+
* @private
|
|
1887
|
+
* @param {*} value The value to check.
|
|
1888
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
1889
|
+
*/
|
|
1890
|
+
function isPrototype(value) {
|
|
1891
|
+
var Ctor = value && value.constructor,
|
|
1892
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
|
|
1893
|
+
|
|
1894
|
+
return value === proto;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
var _isPrototype = isPrototype;
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1901
|
+
*
|
|
1902
|
+
* @private
|
|
1903
|
+
* @param {Function} func The function to wrap.
|
|
1904
|
+
* @param {Function} transform The argument transform.
|
|
1905
|
+
* @returns {Function} Returns the new function.
|
|
1906
|
+
*/
|
|
1907
|
+
function overArg(func, transform) {
|
|
1908
|
+
return function(arg) {
|
|
1909
|
+
return func(transform(arg));
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
var _overArg = overArg;
|
|
1914
|
+
|
|
1915
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1916
|
+
var nativeKeys = _overArg(Object.keys, Object);
|
|
1917
|
+
|
|
1918
|
+
var _nativeKeys = nativeKeys;
|
|
1919
|
+
|
|
1920
|
+
/** Used for built-in method references. */
|
|
1921
|
+
var objectProto$4 = Object.prototype;
|
|
1922
|
+
|
|
1923
|
+
/** Used to check objects for own properties. */
|
|
1924
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1928
|
+
*
|
|
1929
|
+
* @private
|
|
1930
|
+
* @param {Object} object The object to query.
|
|
1931
|
+
* @returns {Array} Returns the array of property names.
|
|
1932
|
+
*/
|
|
1933
|
+
function baseKeys(object) {
|
|
1934
|
+
if (!_isPrototype(object)) {
|
|
1935
|
+
return _nativeKeys(object);
|
|
1936
|
+
}
|
|
1937
|
+
var result = [];
|
|
1938
|
+
for (var key in Object(object)) {
|
|
1939
|
+
if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
|
|
1940
|
+
result.push(key);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
return result;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
var _baseKeys = baseKeys;
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
1950
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
1951
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
1952
|
+
*
|
|
1953
|
+
* @static
|
|
1954
|
+
* @memberOf _
|
|
1955
|
+
* @since 4.0.0
|
|
1956
|
+
* @category Lang
|
|
1957
|
+
* @param {*} value The value to check.
|
|
1958
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
1959
|
+
* @example
|
|
1960
|
+
*
|
|
1961
|
+
* _.isArrayLike([1, 2, 3]);
|
|
1962
|
+
* // => true
|
|
1963
|
+
*
|
|
1964
|
+
* _.isArrayLike(document.body.children);
|
|
1965
|
+
* // => true
|
|
1966
|
+
*
|
|
1967
|
+
* _.isArrayLike('abc');
|
|
1968
|
+
* // => true
|
|
1969
|
+
*
|
|
1970
|
+
* _.isArrayLike(_.noop);
|
|
1971
|
+
* // => false
|
|
1972
|
+
*/
|
|
1973
|
+
function isArrayLike(value) {
|
|
1974
|
+
return value != null && isLength_1(value.length) && !isFunction_1(value);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
var isArrayLike_1 = isArrayLike;
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
1981
|
+
*
|
|
1982
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
1983
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1984
|
+
* for more details.
|
|
1985
|
+
*
|
|
1986
|
+
* @static
|
|
1987
|
+
* @since 0.1.0
|
|
1988
|
+
* @memberOf _
|
|
1989
|
+
* @category Object
|
|
1990
|
+
* @param {Object} object The object to query.
|
|
1991
|
+
* @returns {Array} Returns the array of property names.
|
|
1992
|
+
* @example
|
|
1993
|
+
*
|
|
1994
|
+
* function Foo() {
|
|
1995
|
+
* this.a = 1;
|
|
1996
|
+
* this.b = 2;
|
|
1997
|
+
* }
|
|
1998
|
+
*
|
|
1999
|
+
* Foo.prototype.c = 3;
|
|
2000
|
+
*
|
|
2001
|
+
* _.keys(new Foo);
|
|
2002
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
2003
|
+
*
|
|
2004
|
+
* _.keys('hi');
|
|
2005
|
+
* // => ['0', '1']
|
|
2006
|
+
*/
|
|
2007
|
+
function keys(object) {
|
|
2008
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
var keys_1 = keys;
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* The base implementation of `_.assign` without support for multiple sources
|
|
2015
|
+
* or `customizer` functions.
|
|
2016
|
+
*
|
|
2017
|
+
* @private
|
|
2018
|
+
* @param {Object} object The destination object.
|
|
2019
|
+
* @param {Object} source The source object.
|
|
2020
|
+
* @returns {Object} Returns `object`.
|
|
2021
|
+
*/
|
|
2022
|
+
function baseAssign(object, source) {
|
|
2023
|
+
return object && _copyObject(source, keys_1(source), object);
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
var _baseAssign = baseAssign;
|
|
2027
|
+
|
|
2028
|
+
/**
|
|
2029
|
+
* This function is like
|
|
2030
|
+
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
2031
|
+
* except that it includes inherited enumerable properties.
|
|
2032
|
+
*
|
|
2033
|
+
* @private
|
|
2034
|
+
* @param {Object} object The object to query.
|
|
2035
|
+
* @returns {Array} Returns the array of property names.
|
|
2036
|
+
*/
|
|
2037
|
+
function nativeKeysIn(object) {
|
|
2038
|
+
var result = [];
|
|
2039
|
+
if (object != null) {
|
|
2040
|
+
for (var key in Object(object)) {
|
|
2041
|
+
result.push(key);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
return result;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
var _nativeKeysIn = nativeKeysIn;
|
|
2048
|
+
|
|
2049
|
+
/** Used for built-in method references. */
|
|
2050
|
+
var objectProto$3 = Object.prototype;
|
|
2051
|
+
|
|
2052
|
+
/** Used to check objects for own properties. */
|
|
2053
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
2054
|
+
|
|
2055
|
+
/**
|
|
2056
|
+
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
2057
|
+
*
|
|
2058
|
+
* @private
|
|
2059
|
+
* @param {Object} object The object to query.
|
|
2060
|
+
* @returns {Array} Returns the array of property names.
|
|
2061
|
+
*/
|
|
2062
|
+
function baseKeysIn(object) {
|
|
2063
|
+
if (!isObject_1(object)) {
|
|
2064
|
+
return _nativeKeysIn(object);
|
|
2065
|
+
}
|
|
2066
|
+
var isProto = _isPrototype(object),
|
|
2067
|
+
result = [];
|
|
2068
|
+
|
|
2069
|
+
for (var key in object) {
|
|
2070
|
+
if (!(key == 'constructor' && (isProto || !hasOwnProperty$2.call(object, key)))) {
|
|
2071
|
+
result.push(key);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
return result;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
var _baseKeysIn = baseKeysIn;
|
|
2078
|
+
|
|
2079
|
+
/**
|
|
2080
|
+
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
2081
|
+
*
|
|
2082
|
+
* **Note:** Non-object values are coerced to objects.
|
|
2083
|
+
*
|
|
2084
|
+
* @static
|
|
2085
|
+
* @memberOf _
|
|
2086
|
+
* @since 3.0.0
|
|
2087
|
+
* @category Object
|
|
2088
|
+
* @param {Object} object The object to query.
|
|
2089
|
+
* @returns {Array} Returns the array of property names.
|
|
2090
|
+
* @example
|
|
2091
|
+
*
|
|
2092
|
+
* function Foo() {
|
|
2093
|
+
* this.a = 1;
|
|
2094
|
+
* this.b = 2;
|
|
2095
|
+
* }
|
|
2096
|
+
*
|
|
2097
|
+
* Foo.prototype.c = 3;
|
|
2098
|
+
*
|
|
2099
|
+
* _.keysIn(new Foo);
|
|
2100
|
+
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
2101
|
+
*/
|
|
2102
|
+
function keysIn(object) {
|
|
2103
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
var keysIn_1 = keysIn;
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* The base implementation of `_.assignIn` without support for multiple sources
|
|
2110
|
+
* or `customizer` functions.
|
|
2111
|
+
*
|
|
2112
|
+
* @private
|
|
2113
|
+
* @param {Object} object The destination object.
|
|
2114
|
+
* @param {Object} source The source object.
|
|
2115
|
+
* @returns {Object} Returns `object`.
|
|
2116
|
+
*/
|
|
2117
|
+
function baseAssignIn(object, source) {
|
|
2118
|
+
return object && _copyObject(source, keysIn_1(source), object);
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
var _baseAssignIn = baseAssignIn;
|
|
2122
|
+
|
|
2123
|
+
var _cloneBuffer = createCommonjsModule(function (module, exports) {
|
|
2124
|
+
/** Detect free variable `exports`. */
|
|
2125
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
2126
|
+
|
|
2127
|
+
/** Detect free variable `module`. */
|
|
2128
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
2129
|
+
|
|
2130
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
2131
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2132
|
+
|
|
2133
|
+
/** Built-in value references. */
|
|
2134
|
+
var Buffer = moduleExports ? _root.Buffer : undefined,
|
|
2135
|
+
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Creates a clone of `buffer`.
|
|
2139
|
+
*
|
|
2140
|
+
* @private
|
|
2141
|
+
* @param {Buffer} buffer The buffer to clone.
|
|
2142
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2143
|
+
* @returns {Buffer} Returns the cloned buffer.
|
|
2144
|
+
*/
|
|
2145
|
+
function cloneBuffer(buffer, isDeep) {
|
|
2146
|
+
if (isDeep) {
|
|
2147
|
+
return buffer.slice();
|
|
2148
|
+
}
|
|
2149
|
+
var length = buffer.length,
|
|
2150
|
+
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
2151
|
+
|
|
2152
|
+
buffer.copy(result);
|
|
2153
|
+
return result;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
module.exports = cloneBuffer;
|
|
2157
|
+
});
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* Copies the values of `source` to `array`.
|
|
2161
|
+
*
|
|
2162
|
+
* @private
|
|
2163
|
+
* @param {Array} source The array to copy values from.
|
|
2164
|
+
* @param {Array} [array=[]] The array to copy values to.
|
|
2165
|
+
* @returns {Array} Returns `array`.
|
|
2166
|
+
*/
|
|
2167
|
+
function copyArray(source, array) {
|
|
2168
|
+
var index = -1,
|
|
2169
|
+
length = source.length;
|
|
2170
|
+
|
|
2171
|
+
array || (array = Array(length));
|
|
2172
|
+
while (++index < length) {
|
|
2173
|
+
array[index] = source[index];
|
|
2174
|
+
}
|
|
2175
|
+
return array;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
var _copyArray = copyArray;
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
2182
|
+
* iteratee shorthands.
|
|
2183
|
+
*
|
|
2184
|
+
* @private
|
|
2185
|
+
* @param {Array} [array] The array to iterate over.
|
|
2186
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
2187
|
+
* @returns {Array} Returns the new filtered array.
|
|
2188
|
+
*/
|
|
2189
|
+
function arrayFilter(array, predicate) {
|
|
2190
|
+
var index = -1,
|
|
2191
|
+
length = array == null ? 0 : array.length,
|
|
2192
|
+
resIndex = 0,
|
|
2193
|
+
result = [];
|
|
2194
|
+
|
|
2195
|
+
while (++index < length) {
|
|
2196
|
+
var value = array[index];
|
|
2197
|
+
if (predicate(value, index, array)) {
|
|
2198
|
+
result[resIndex++] = value;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
return result;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
var _arrayFilter = arrayFilter;
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* This method returns a new empty array.
|
|
2208
|
+
*
|
|
2209
|
+
* @static
|
|
2210
|
+
* @memberOf _
|
|
2211
|
+
* @since 4.13.0
|
|
2212
|
+
* @category Util
|
|
2213
|
+
* @returns {Array} Returns the new empty array.
|
|
2214
|
+
* @example
|
|
2215
|
+
*
|
|
2216
|
+
* var arrays = _.times(2, _.stubArray);
|
|
2217
|
+
*
|
|
2218
|
+
* console.log(arrays);
|
|
2219
|
+
* // => [[], []]
|
|
2220
|
+
*
|
|
2221
|
+
* console.log(arrays[0] === arrays[1]);
|
|
2222
|
+
* // => false
|
|
2223
|
+
*/
|
|
2224
|
+
function stubArray() {
|
|
2225
|
+
return [];
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
var stubArray_1 = stubArray;
|
|
2229
|
+
|
|
2230
|
+
/** Used for built-in method references. */
|
|
2231
|
+
var objectProto$2 = Object.prototype;
|
|
2232
|
+
|
|
2233
|
+
/** Built-in value references. */
|
|
2234
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
2235
|
+
|
|
2236
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2237
|
+
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
|
|
2238
|
+
|
|
2239
|
+
/**
|
|
2240
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
2241
|
+
*
|
|
2242
|
+
* @private
|
|
2243
|
+
* @param {Object} object The object to query.
|
|
2244
|
+
* @returns {Array} Returns the array of symbols.
|
|
2245
|
+
*/
|
|
2246
|
+
var getSymbols = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
|
|
2247
|
+
if (object == null) {
|
|
2248
|
+
return [];
|
|
2249
|
+
}
|
|
2250
|
+
object = Object(object);
|
|
2251
|
+
return _arrayFilter(nativeGetSymbols$1(object), function(symbol) {
|
|
2252
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
2253
|
+
});
|
|
2254
|
+
};
|
|
2255
|
+
|
|
2256
|
+
var _getSymbols = getSymbols;
|
|
2257
|
+
|
|
2258
|
+
/**
|
|
2259
|
+
* Copies own symbols of `source` to `object`.
|
|
2260
|
+
*
|
|
2261
|
+
* @private
|
|
2262
|
+
* @param {Object} source The object to copy symbols from.
|
|
2263
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
2264
|
+
* @returns {Object} Returns `object`.
|
|
2265
|
+
*/
|
|
2266
|
+
function copySymbols(source, object) {
|
|
2267
|
+
return _copyObject(source, _getSymbols(source), object);
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
var _copySymbols = copySymbols;
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* Appends the elements of `values` to `array`.
|
|
2274
|
+
*
|
|
2275
|
+
* @private
|
|
2276
|
+
* @param {Array} array The array to modify.
|
|
2277
|
+
* @param {Array} values The values to append.
|
|
2278
|
+
* @returns {Array} Returns `array`.
|
|
2279
|
+
*/
|
|
2280
|
+
function arrayPush(array, values) {
|
|
2281
|
+
var index = -1,
|
|
2282
|
+
length = values.length,
|
|
2283
|
+
offset = array.length;
|
|
2284
|
+
|
|
2285
|
+
while (++index < length) {
|
|
2286
|
+
array[offset + index] = values[index];
|
|
2287
|
+
}
|
|
2288
|
+
return array;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
var _arrayPush = arrayPush;
|
|
2292
|
+
|
|
2293
|
+
/** Built-in value references. */
|
|
2294
|
+
var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
|
2295
|
+
|
|
2296
|
+
var _getPrototype = getPrototype;
|
|
2297
|
+
|
|
2298
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2299
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
2300
|
+
|
|
2301
|
+
/**
|
|
2302
|
+
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
2303
|
+
*
|
|
2304
|
+
* @private
|
|
2305
|
+
* @param {Object} object The object to query.
|
|
2306
|
+
* @returns {Array} Returns the array of symbols.
|
|
2307
|
+
*/
|
|
2308
|
+
var getSymbolsIn = !nativeGetSymbols ? stubArray_1 : function(object) {
|
|
2309
|
+
var result = [];
|
|
2310
|
+
while (object) {
|
|
2311
|
+
_arrayPush(result, _getSymbols(object));
|
|
2312
|
+
object = _getPrototype(object);
|
|
2313
|
+
}
|
|
2314
|
+
return result;
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
var _getSymbolsIn = getSymbolsIn;
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Copies own and inherited symbols of `source` to `object`.
|
|
2321
|
+
*
|
|
2322
|
+
* @private
|
|
2323
|
+
* @param {Object} source The object to copy symbols from.
|
|
2324
|
+
* @param {Object} [object={}] The object to copy symbols to.
|
|
2325
|
+
* @returns {Object} Returns `object`.
|
|
2326
|
+
*/
|
|
2327
|
+
function copySymbolsIn(source, object) {
|
|
2328
|
+
return _copyObject(source, _getSymbolsIn(source), object);
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
var _copySymbolsIn = copySymbolsIn;
|
|
2332
|
+
|
|
2333
|
+
/**
|
|
2334
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
2335
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
2336
|
+
* symbols of `object`.
|
|
2337
|
+
*
|
|
2338
|
+
* @private
|
|
2339
|
+
* @param {Object} object The object to query.
|
|
2340
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
2341
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
2342
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2343
|
+
*/
|
|
2344
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
2345
|
+
var result = keysFunc(object);
|
|
2346
|
+
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
var _baseGetAllKeys = baseGetAllKeys;
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
2353
|
+
*
|
|
2354
|
+
* @private
|
|
2355
|
+
* @param {Object} object The object to query.
|
|
2356
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2357
|
+
*/
|
|
2358
|
+
function getAllKeys(object) {
|
|
2359
|
+
return _baseGetAllKeys(object, keys_1, _getSymbols);
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
var _getAllKeys = getAllKeys;
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* Creates an array of own and inherited enumerable property names and
|
|
2366
|
+
* symbols of `object`.
|
|
2367
|
+
*
|
|
2368
|
+
* @private
|
|
2369
|
+
* @param {Object} object The object to query.
|
|
2370
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2371
|
+
*/
|
|
2372
|
+
function getAllKeysIn(object) {
|
|
2373
|
+
return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
var _getAllKeysIn = getAllKeysIn;
|
|
2377
|
+
|
|
2378
|
+
/* Built-in method references that are verified to be native. */
|
|
2379
|
+
var DataView = _getNative(_root, 'DataView');
|
|
2380
|
+
|
|
2381
|
+
var _DataView = DataView;
|
|
2382
|
+
|
|
2383
|
+
/* Built-in method references that are verified to be native. */
|
|
2384
|
+
var Promise$1 = _getNative(_root, 'Promise');
|
|
2385
|
+
|
|
2386
|
+
var _Promise = Promise$1;
|
|
2387
|
+
|
|
2388
|
+
/* Built-in method references that are verified to be native. */
|
|
2389
|
+
var Set = _getNative(_root, 'Set');
|
|
2390
|
+
|
|
2391
|
+
var _Set = Set;
|
|
2392
|
+
|
|
2393
|
+
/* Built-in method references that are verified to be native. */
|
|
2394
|
+
var WeakMap = _getNative(_root, 'WeakMap');
|
|
2395
|
+
|
|
2396
|
+
var _WeakMap = WeakMap;
|
|
2397
|
+
|
|
2398
|
+
/** `Object#toString` result references. */
|
|
2399
|
+
var mapTag$3 = '[object Map]',
|
|
2400
|
+
objectTag$2 = '[object Object]',
|
|
2401
|
+
promiseTag = '[object Promise]',
|
|
2402
|
+
setTag$3 = '[object Set]',
|
|
2403
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
2404
|
+
|
|
2405
|
+
var dataViewTag$2 = '[object DataView]';
|
|
2406
|
+
|
|
2407
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
2408
|
+
var dataViewCtorString = _toSource(_DataView),
|
|
2409
|
+
mapCtorString = _toSource(_Map),
|
|
2410
|
+
promiseCtorString = _toSource(_Promise),
|
|
2411
|
+
setCtorString = _toSource(_Set),
|
|
2412
|
+
weakMapCtorString = _toSource(_WeakMap);
|
|
2413
|
+
|
|
2414
|
+
/**
|
|
2415
|
+
* Gets the `toStringTag` of `value`.
|
|
2416
|
+
*
|
|
2417
|
+
* @private
|
|
2418
|
+
* @param {*} value The value to query.
|
|
2419
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2420
|
+
*/
|
|
2421
|
+
var getTag = _baseGetTag;
|
|
2422
|
+
|
|
2423
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2424
|
+
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
2425
|
+
(_Map && getTag(new _Map) != mapTag$3) ||
|
|
2426
|
+
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
|
|
2427
|
+
(_Set && getTag(new _Set) != setTag$3) ||
|
|
2428
|
+
(_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
|
|
2429
|
+
getTag = function(value) {
|
|
2430
|
+
var result = _baseGetTag(value),
|
|
2431
|
+
Ctor = result == objectTag$2 ? value.constructor : undefined,
|
|
2432
|
+
ctorString = Ctor ? _toSource(Ctor) : '';
|
|
2433
|
+
|
|
2434
|
+
if (ctorString) {
|
|
2435
|
+
switch (ctorString) {
|
|
2436
|
+
case dataViewCtorString: return dataViewTag$2;
|
|
2437
|
+
case mapCtorString: return mapTag$3;
|
|
2438
|
+
case promiseCtorString: return promiseTag;
|
|
2439
|
+
case setCtorString: return setTag$3;
|
|
2440
|
+
case weakMapCtorString: return weakMapTag$1;
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
return result;
|
|
2444
|
+
};
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
var _getTag = getTag;
|
|
2448
|
+
|
|
2449
|
+
/** Used for built-in method references. */
|
|
2450
|
+
var objectProto$1 = Object.prototype;
|
|
2451
|
+
|
|
2452
|
+
/** Used to check objects for own properties. */
|
|
2453
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Initializes an array clone.
|
|
2457
|
+
*
|
|
2458
|
+
* @private
|
|
2459
|
+
* @param {Array} array The array to clone.
|
|
2460
|
+
* @returns {Array} Returns the initialized clone.
|
|
2461
|
+
*/
|
|
2462
|
+
function initCloneArray(array) {
|
|
2463
|
+
var length = array.length,
|
|
2464
|
+
result = new array.constructor(length);
|
|
2465
|
+
|
|
2466
|
+
// Add properties assigned by `RegExp#exec`.
|
|
2467
|
+
if (length && typeof array[0] == 'string' && hasOwnProperty$1.call(array, 'index')) {
|
|
2468
|
+
result.index = array.index;
|
|
2469
|
+
result.input = array.input;
|
|
2470
|
+
}
|
|
2471
|
+
return result;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
var _initCloneArray = initCloneArray;
|
|
2475
|
+
|
|
2476
|
+
/** Built-in value references. */
|
|
2477
|
+
var Uint8Array = _root.Uint8Array;
|
|
2478
|
+
|
|
2479
|
+
var _Uint8Array = Uint8Array;
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* Creates a clone of `arrayBuffer`.
|
|
2483
|
+
*
|
|
2484
|
+
* @private
|
|
2485
|
+
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
|
|
2486
|
+
* @returns {ArrayBuffer} Returns the cloned array buffer.
|
|
2487
|
+
*/
|
|
2488
|
+
function cloneArrayBuffer(arrayBuffer) {
|
|
2489
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
2490
|
+
new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
|
|
2491
|
+
return result;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
var _cloneArrayBuffer = cloneArrayBuffer;
|
|
2495
|
+
|
|
2496
|
+
/**
|
|
2497
|
+
* Creates a clone of `dataView`.
|
|
2498
|
+
*
|
|
2499
|
+
* @private
|
|
2500
|
+
* @param {Object} dataView The data view to clone.
|
|
2501
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2502
|
+
* @returns {Object} Returns the cloned data view.
|
|
2503
|
+
*/
|
|
2504
|
+
function cloneDataView(dataView, isDeep) {
|
|
2505
|
+
var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
|
2506
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
var _cloneDataView = cloneDataView;
|
|
2510
|
+
|
|
2511
|
+
/** Used to match `RegExp` flags from their coerced string values. */
|
|
2512
|
+
var reFlags = /\w*$/;
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* Creates a clone of `regexp`.
|
|
2516
|
+
*
|
|
2517
|
+
* @private
|
|
2518
|
+
* @param {Object} regexp The regexp to clone.
|
|
2519
|
+
* @returns {Object} Returns the cloned regexp.
|
|
2520
|
+
*/
|
|
2521
|
+
function cloneRegExp(regexp) {
|
|
2522
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
2523
|
+
result.lastIndex = regexp.lastIndex;
|
|
2524
|
+
return result;
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
var _cloneRegExp = cloneRegExp;
|
|
2528
|
+
|
|
2529
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2530
|
+
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
|
|
2531
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* Creates a clone of the `symbol` object.
|
|
2535
|
+
*
|
|
2536
|
+
* @private
|
|
2537
|
+
* @param {Object} symbol The symbol object to clone.
|
|
2538
|
+
* @returns {Object} Returns the cloned symbol object.
|
|
2539
|
+
*/
|
|
2540
|
+
function cloneSymbol(symbol) {
|
|
2541
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
var _cloneSymbol = cloneSymbol;
|
|
2545
|
+
|
|
2546
|
+
/**
|
|
2547
|
+
* Creates a clone of `typedArray`.
|
|
2548
|
+
*
|
|
2549
|
+
* @private
|
|
2550
|
+
* @param {Object} typedArray The typed array to clone.
|
|
2551
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2552
|
+
* @returns {Object} Returns the cloned typed array.
|
|
2553
|
+
*/
|
|
2554
|
+
function cloneTypedArray(typedArray, isDeep) {
|
|
2555
|
+
var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
2556
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
var _cloneTypedArray = cloneTypedArray;
|
|
2560
|
+
|
|
2561
|
+
/** `Object#toString` result references. */
|
|
2562
|
+
var boolTag$1 = '[object Boolean]',
|
|
2563
|
+
dateTag$1 = '[object Date]',
|
|
2564
|
+
mapTag$2 = '[object Map]',
|
|
2565
|
+
numberTag$1 = '[object Number]',
|
|
2566
|
+
regexpTag$1 = '[object RegExp]',
|
|
2567
|
+
setTag$2 = '[object Set]',
|
|
2568
|
+
stringTag$1 = '[object String]',
|
|
2569
|
+
symbolTag$2 = '[object Symbol]';
|
|
2570
|
+
|
|
2571
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
2572
|
+
dataViewTag$1 = '[object DataView]',
|
|
2573
|
+
float32Tag$1 = '[object Float32Array]',
|
|
2574
|
+
float64Tag$1 = '[object Float64Array]',
|
|
2575
|
+
int8Tag$1 = '[object Int8Array]',
|
|
2576
|
+
int16Tag$1 = '[object Int16Array]',
|
|
2577
|
+
int32Tag$1 = '[object Int32Array]',
|
|
2578
|
+
uint8Tag$1 = '[object Uint8Array]',
|
|
2579
|
+
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
|
|
2580
|
+
uint16Tag$1 = '[object Uint16Array]',
|
|
2581
|
+
uint32Tag$1 = '[object Uint32Array]';
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
* Initializes an object clone based on its `toStringTag`.
|
|
2585
|
+
*
|
|
2586
|
+
* **Note:** This function only supports cloning values with tags of
|
|
2587
|
+
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
|
|
2588
|
+
*
|
|
2589
|
+
* @private
|
|
2590
|
+
* @param {Object} object The object to clone.
|
|
2591
|
+
* @param {string} tag The `toStringTag` of the object to clone.
|
|
2592
|
+
* @param {boolean} [isDeep] Specify a deep clone.
|
|
2593
|
+
* @returns {Object} Returns the initialized clone.
|
|
2594
|
+
*/
|
|
2595
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
2596
|
+
var Ctor = object.constructor;
|
|
2597
|
+
switch (tag) {
|
|
2598
|
+
case arrayBufferTag$1:
|
|
2599
|
+
return _cloneArrayBuffer(object);
|
|
2600
|
+
|
|
2601
|
+
case boolTag$1:
|
|
2602
|
+
case dateTag$1:
|
|
2603
|
+
return new Ctor(+object);
|
|
2604
|
+
|
|
2605
|
+
case dataViewTag$1:
|
|
2606
|
+
return _cloneDataView(object, isDeep);
|
|
2607
|
+
|
|
2608
|
+
case float32Tag$1: case float64Tag$1:
|
|
2609
|
+
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2610
|
+
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2611
|
+
return _cloneTypedArray(object, isDeep);
|
|
2612
|
+
|
|
2613
|
+
case mapTag$2:
|
|
2614
|
+
return new Ctor;
|
|
2615
|
+
|
|
2616
|
+
case numberTag$1:
|
|
2617
|
+
case stringTag$1:
|
|
2618
|
+
return new Ctor(object);
|
|
2619
|
+
|
|
2620
|
+
case regexpTag$1:
|
|
2621
|
+
return _cloneRegExp(object);
|
|
2622
|
+
|
|
2623
|
+
case setTag$2:
|
|
2624
|
+
return new Ctor;
|
|
2625
|
+
|
|
2626
|
+
case symbolTag$2:
|
|
2627
|
+
return _cloneSymbol(object);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
var _initCloneByTag = initCloneByTag;
|
|
2632
|
+
|
|
2633
|
+
/** Built-in value references. */
|
|
2634
|
+
var objectCreate = Object.create;
|
|
2635
|
+
|
|
2636
|
+
/**
|
|
2637
|
+
* The base implementation of `_.create` without support for assigning
|
|
2638
|
+
* properties to the created object.
|
|
2639
|
+
*
|
|
2640
|
+
* @private
|
|
2641
|
+
* @param {Object} proto The object to inherit from.
|
|
2642
|
+
* @returns {Object} Returns the new object.
|
|
2643
|
+
*/
|
|
2644
|
+
var baseCreate = (function() {
|
|
2645
|
+
function object() {}
|
|
2646
|
+
return function(proto) {
|
|
2647
|
+
if (!isObject_1(proto)) {
|
|
2648
|
+
return {};
|
|
2649
|
+
}
|
|
2650
|
+
if (objectCreate) {
|
|
2651
|
+
return objectCreate(proto);
|
|
2652
|
+
}
|
|
2653
|
+
object.prototype = proto;
|
|
2654
|
+
var result = new object;
|
|
2655
|
+
object.prototype = undefined;
|
|
2656
|
+
return result;
|
|
2657
|
+
};
|
|
2658
|
+
}());
|
|
2659
|
+
|
|
2660
|
+
var _baseCreate = baseCreate;
|
|
2661
|
+
|
|
2662
|
+
/**
|
|
2663
|
+
* Initializes an object clone.
|
|
2664
|
+
*
|
|
2665
|
+
* @private
|
|
2666
|
+
* @param {Object} object The object to clone.
|
|
2667
|
+
* @returns {Object} Returns the initialized clone.
|
|
2668
|
+
*/
|
|
2669
|
+
function initCloneObject(object) {
|
|
2670
|
+
return (typeof object.constructor == 'function' && !_isPrototype(object))
|
|
2671
|
+
? _baseCreate(_getPrototype(object))
|
|
2672
|
+
: {};
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
var _initCloneObject = initCloneObject;
|
|
2676
|
+
|
|
2677
|
+
/** `Object#toString` result references. */
|
|
2678
|
+
var mapTag$1 = '[object Map]';
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* The base implementation of `_.isMap` without Node.js optimizations.
|
|
2682
|
+
*
|
|
2683
|
+
* @private
|
|
2684
|
+
* @param {*} value The value to check.
|
|
2685
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2686
|
+
*/
|
|
2687
|
+
function baseIsMap(value) {
|
|
2688
|
+
return isObjectLike_1(value) && _getTag(value) == mapTag$1;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
var _baseIsMap = baseIsMap;
|
|
2692
|
+
|
|
2693
|
+
/* Node.js helper references. */
|
|
2694
|
+
var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
|
|
2695
|
+
|
|
2696
|
+
/**
|
|
2697
|
+
* Checks if `value` is classified as a `Map` object.
|
|
2698
|
+
*
|
|
2699
|
+
* @static
|
|
2700
|
+
* @memberOf _
|
|
2701
|
+
* @since 4.3.0
|
|
2702
|
+
* @category Lang
|
|
2703
|
+
* @param {*} value The value to check.
|
|
2704
|
+
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
|
|
2705
|
+
* @example
|
|
2706
|
+
*
|
|
2707
|
+
* _.isMap(new Map);
|
|
2708
|
+
* // => true
|
|
2709
|
+
*
|
|
2710
|
+
* _.isMap(new WeakMap);
|
|
2711
|
+
* // => false
|
|
2712
|
+
*/
|
|
2713
|
+
var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
|
|
2714
|
+
|
|
2715
|
+
var isMap_1 = isMap;
|
|
2716
|
+
|
|
2717
|
+
/** `Object#toString` result references. */
|
|
2718
|
+
var setTag$1 = '[object Set]';
|
|
2719
|
+
|
|
2720
|
+
/**
|
|
2721
|
+
* The base implementation of `_.isSet` without Node.js optimizations.
|
|
2722
|
+
*
|
|
2723
|
+
* @private
|
|
2724
|
+
* @param {*} value The value to check.
|
|
2725
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2726
|
+
*/
|
|
2727
|
+
function baseIsSet(value) {
|
|
2728
|
+
return isObjectLike_1(value) && _getTag(value) == setTag$1;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2731
|
+
var _baseIsSet = baseIsSet;
|
|
2732
|
+
|
|
2733
|
+
/* Node.js helper references. */
|
|
2734
|
+
var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* Checks if `value` is classified as a `Set` object.
|
|
2738
|
+
*
|
|
2739
|
+
* @static
|
|
2740
|
+
* @memberOf _
|
|
2741
|
+
* @since 4.3.0
|
|
2742
|
+
* @category Lang
|
|
2743
|
+
* @param {*} value The value to check.
|
|
2744
|
+
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
|
|
2745
|
+
* @example
|
|
2746
|
+
*
|
|
2747
|
+
* _.isSet(new Set);
|
|
2748
|
+
* // => true
|
|
2749
|
+
*
|
|
2750
|
+
* _.isSet(new WeakSet);
|
|
2751
|
+
* // => false
|
|
2752
|
+
*/
|
|
2753
|
+
var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
|
|
2754
|
+
|
|
2755
|
+
var isSet_1 = isSet;
|
|
2756
|
+
|
|
2757
|
+
/** Used to compose bitmasks for cloning. */
|
|
2758
|
+
var CLONE_DEEP_FLAG$1 = 1,
|
|
2759
|
+
CLONE_FLAT_FLAG$1 = 2,
|
|
2760
|
+
CLONE_SYMBOLS_FLAG$1 = 4;
|
|
2761
|
+
|
|
2762
|
+
/** `Object#toString` result references. */
|
|
2763
|
+
var argsTag = '[object Arguments]',
|
|
2764
|
+
arrayTag = '[object Array]',
|
|
2765
|
+
boolTag = '[object Boolean]',
|
|
2766
|
+
dateTag = '[object Date]',
|
|
2767
|
+
errorTag = '[object Error]',
|
|
2768
|
+
funcTag = '[object Function]',
|
|
2769
|
+
genTag = '[object GeneratorFunction]',
|
|
2770
|
+
mapTag = '[object Map]',
|
|
2771
|
+
numberTag = '[object Number]',
|
|
2772
|
+
objectTag$1 = '[object Object]',
|
|
2773
|
+
regexpTag = '[object RegExp]',
|
|
2774
|
+
setTag = '[object Set]',
|
|
2775
|
+
stringTag = '[object String]',
|
|
2776
|
+
symbolTag$1 = '[object Symbol]',
|
|
2777
|
+
weakMapTag = '[object WeakMap]';
|
|
2778
|
+
|
|
2779
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
2780
|
+
dataViewTag = '[object DataView]',
|
|
2781
|
+
float32Tag = '[object Float32Array]',
|
|
2782
|
+
float64Tag = '[object Float64Array]',
|
|
2783
|
+
int8Tag = '[object Int8Array]',
|
|
2784
|
+
int16Tag = '[object Int16Array]',
|
|
2785
|
+
int32Tag = '[object Int32Array]',
|
|
2786
|
+
uint8Tag = '[object Uint8Array]',
|
|
2787
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
2788
|
+
uint16Tag = '[object Uint16Array]',
|
|
2789
|
+
uint32Tag = '[object Uint32Array]';
|
|
2790
|
+
|
|
2791
|
+
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
2792
|
+
var cloneableTags = {};
|
|
2793
|
+
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
|
2794
|
+
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
|
2795
|
+
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
|
2796
|
+
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
|
2797
|
+
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
|
2798
|
+
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
|
2799
|
+
cloneableTags[numberTag] = cloneableTags[objectTag$1] =
|
|
2800
|
+
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
|
2801
|
+
cloneableTags[stringTag] = cloneableTags[symbolTag$1] =
|
|
2802
|
+
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
|
2803
|
+
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
2804
|
+
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
|
2805
|
+
cloneableTags[weakMapTag] = false;
|
|
2806
|
+
|
|
2807
|
+
/**
|
|
2808
|
+
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
|
2809
|
+
* traversed objects.
|
|
2810
|
+
*
|
|
2811
|
+
* @private
|
|
2812
|
+
* @param {*} value The value to clone.
|
|
2813
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2814
|
+
* 1 - Deep clone
|
|
2815
|
+
* 2 - Flatten inherited properties
|
|
2816
|
+
* 4 - Clone symbols
|
|
2817
|
+
* @param {Function} [customizer] The function to customize cloning.
|
|
2818
|
+
* @param {string} [key] The key of `value`.
|
|
2819
|
+
* @param {Object} [object] The parent object of `value`.
|
|
2820
|
+
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
|
2821
|
+
* @returns {*} Returns the cloned value.
|
|
2822
|
+
*/
|
|
2823
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2824
|
+
var result,
|
|
2825
|
+
isDeep = bitmask & CLONE_DEEP_FLAG$1,
|
|
2826
|
+
isFlat = bitmask & CLONE_FLAT_FLAG$1,
|
|
2827
|
+
isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
2828
|
+
|
|
2829
|
+
if (customizer) {
|
|
2830
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2831
|
+
}
|
|
2832
|
+
if (result !== undefined) {
|
|
2833
|
+
return result;
|
|
2834
|
+
}
|
|
2835
|
+
if (!isObject_1(value)) {
|
|
2836
|
+
return value;
|
|
2837
|
+
}
|
|
2838
|
+
var isArr = isArray_1(value);
|
|
2839
|
+
if (isArr) {
|
|
2840
|
+
result = _initCloneArray(value);
|
|
2841
|
+
if (!isDeep) {
|
|
2842
|
+
return _copyArray(value, result);
|
|
2843
|
+
}
|
|
2844
|
+
} else {
|
|
2845
|
+
var tag = _getTag(value),
|
|
2846
|
+
isFunc = tag == funcTag || tag == genTag;
|
|
2847
|
+
|
|
2848
|
+
if (isBuffer_1(value)) {
|
|
2849
|
+
return _cloneBuffer(value, isDeep);
|
|
2850
|
+
}
|
|
2851
|
+
if (tag == objectTag$1 || tag == argsTag || (isFunc && !object)) {
|
|
2852
|
+
result = (isFlat || isFunc) ? {} : _initCloneObject(value);
|
|
2853
|
+
if (!isDeep) {
|
|
2854
|
+
return isFlat
|
|
2855
|
+
? _copySymbolsIn(value, _baseAssignIn(result, value))
|
|
2856
|
+
: _copySymbols(value, _baseAssign(result, value));
|
|
2857
|
+
}
|
|
2858
|
+
} else {
|
|
2859
|
+
if (!cloneableTags[tag]) {
|
|
2860
|
+
return object ? value : {};
|
|
2861
|
+
}
|
|
2862
|
+
result = _initCloneByTag(value, tag, isDeep);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
// Check for circular references and return its corresponding clone.
|
|
2866
|
+
stack || (stack = new _Stack);
|
|
2867
|
+
var stacked = stack.get(value);
|
|
2868
|
+
if (stacked) {
|
|
2869
|
+
return stacked;
|
|
2870
|
+
}
|
|
2871
|
+
stack.set(value, result);
|
|
2872
|
+
|
|
2873
|
+
if (isSet_1(value)) {
|
|
2874
|
+
value.forEach(function(subValue) {
|
|
2875
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2876
|
+
});
|
|
2877
|
+
} else if (isMap_1(value)) {
|
|
2878
|
+
value.forEach(function(subValue, key) {
|
|
2879
|
+
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2880
|
+
});
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2883
|
+
var keysFunc = isFull
|
|
2884
|
+
? (isFlat ? _getAllKeysIn : _getAllKeys)
|
|
2885
|
+
: (isFlat ? keysIn_1 : keys_1);
|
|
2886
|
+
|
|
2887
|
+
var props = isArr ? undefined : keysFunc(value);
|
|
2888
|
+
_arrayEach(props || value, function(subValue, key) {
|
|
2889
|
+
if (props) {
|
|
2890
|
+
key = subValue;
|
|
2891
|
+
subValue = value[key];
|
|
2892
|
+
}
|
|
2893
|
+
// Recursively populate clone (susceptible to call stack limits).
|
|
2894
|
+
_assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
|
2895
|
+
});
|
|
2896
|
+
return result;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
var _baseClone = baseClone;
|
|
2900
|
+
|
|
2901
|
+
/** `Object#toString` result references. */
|
|
2902
|
+
var symbolTag = '[object Symbol]';
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
2906
|
+
*
|
|
2907
|
+
* @static
|
|
2908
|
+
* @memberOf _
|
|
2909
|
+
* @since 4.0.0
|
|
2910
|
+
* @category Lang
|
|
2911
|
+
* @param {*} value The value to check.
|
|
2912
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
2913
|
+
* @example
|
|
2914
|
+
*
|
|
2915
|
+
* _.isSymbol(Symbol.iterator);
|
|
2916
|
+
* // => true
|
|
2917
|
+
*
|
|
2918
|
+
* _.isSymbol('abc');
|
|
2919
|
+
* // => false
|
|
2920
|
+
*/
|
|
2921
|
+
function isSymbol(value) {
|
|
2922
|
+
return typeof value == 'symbol' ||
|
|
2923
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
var isSymbol_1 = isSymbol;
|
|
2927
|
+
|
|
2928
|
+
/** Used to match property names within property paths. */
|
|
2929
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
2930
|
+
reIsPlainProp = /^\w*$/;
|
|
2931
|
+
|
|
2932
|
+
/**
|
|
2933
|
+
* Checks if `value` is a property name and not a property path.
|
|
2934
|
+
*
|
|
2935
|
+
* @private
|
|
2936
|
+
* @param {*} value The value to check.
|
|
2937
|
+
* @param {Object} [object] The object to query keys on.
|
|
2938
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
2939
|
+
*/
|
|
2940
|
+
function isKey(value, object) {
|
|
2941
|
+
if (isArray_1(value)) {
|
|
2942
|
+
return false;
|
|
2943
|
+
}
|
|
2944
|
+
var type = typeof value;
|
|
2945
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
2946
|
+
value == null || isSymbol_1(value)) {
|
|
2947
|
+
return true;
|
|
2948
|
+
}
|
|
2949
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
2950
|
+
(object != null && value in Object(object));
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
var _isKey = isKey;
|
|
2954
|
+
|
|
2955
|
+
/** Error message constants. */
|
|
2956
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2957
|
+
|
|
2958
|
+
/**
|
|
2959
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
2960
|
+
* provided, it determines the cache key for storing the result based on the
|
|
2961
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
2962
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
2963
|
+
* is invoked with the `this` binding of the memoized function.
|
|
2964
|
+
*
|
|
2965
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
2966
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
2967
|
+
* constructor with one whose instances implement the
|
|
2968
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
2969
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
2970
|
+
*
|
|
2971
|
+
* @static
|
|
2972
|
+
* @memberOf _
|
|
2973
|
+
* @since 0.1.0
|
|
2974
|
+
* @category Function
|
|
2975
|
+
* @param {Function} func The function to have its output memoized.
|
|
2976
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
2977
|
+
* @returns {Function} Returns the new memoized function.
|
|
2978
|
+
* @example
|
|
2979
|
+
*
|
|
2980
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
2981
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
2982
|
+
*
|
|
2983
|
+
* var values = _.memoize(_.values);
|
|
2984
|
+
* values(object);
|
|
2985
|
+
* // => [1, 2]
|
|
2986
|
+
*
|
|
2987
|
+
* values(other);
|
|
2988
|
+
* // => [3, 4]
|
|
2989
|
+
*
|
|
2990
|
+
* object.a = 2;
|
|
2991
|
+
* values(object);
|
|
2992
|
+
* // => [1, 2]
|
|
2993
|
+
*
|
|
2994
|
+
* // Modify the result cache.
|
|
2995
|
+
* values.cache.set(object, ['a', 'b']);
|
|
2996
|
+
* values(object);
|
|
2997
|
+
* // => ['a', 'b']
|
|
2998
|
+
*
|
|
2999
|
+
* // Replace `_.memoize.Cache`.
|
|
3000
|
+
* _.memoize.Cache = WeakMap;
|
|
3001
|
+
*/
|
|
3002
|
+
function memoize(func, resolver) {
|
|
3003
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
3004
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
3005
|
+
}
|
|
3006
|
+
var memoized = function() {
|
|
3007
|
+
var args = arguments,
|
|
3008
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
3009
|
+
cache = memoized.cache;
|
|
3010
|
+
|
|
3011
|
+
if (cache.has(key)) {
|
|
3012
|
+
return cache.get(key);
|
|
3013
|
+
}
|
|
3014
|
+
var result = func.apply(this, args);
|
|
3015
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
3016
|
+
return result;
|
|
3017
|
+
};
|
|
3018
|
+
memoized.cache = new (memoize.Cache || _MapCache);
|
|
3019
|
+
return memoized;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
// Expose `MapCache`.
|
|
3023
|
+
memoize.Cache = _MapCache;
|
|
3024
|
+
|
|
3025
|
+
var memoize_1 = memoize;
|
|
3026
|
+
|
|
3027
|
+
/** Used as the maximum memoize cache size. */
|
|
3028
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
3029
|
+
|
|
3030
|
+
/**
|
|
3031
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
3032
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
3033
|
+
*
|
|
3034
|
+
* @private
|
|
3035
|
+
* @param {Function} func The function to have its output memoized.
|
|
3036
|
+
* @returns {Function} Returns the new memoized function.
|
|
3037
|
+
*/
|
|
3038
|
+
function memoizeCapped(func) {
|
|
3039
|
+
var result = memoize_1(func, function(key) {
|
|
3040
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
3041
|
+
cache.clear();
|
|
3042
|
+
}
|
|
3043
|
+
return key;
|
|
3044
|
+
});
|
|
3045
|
+
|
|
3046
|
+
var cache = result.cache;
|
|
3047
|
+
return result;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
var _memoizeCapped = memoizeCapped;
|
|
3051
|
+
|
|
3052
|
+
/** Used to match property names within property paths. */
|
|
3053
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
3054
|
+
|
|
3055
|
+
/** Used to match backslashes in property paths. */
|
|
3056
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
3057
|
+
|
|
3058
|
+
/**
|
|
3059
|
+
* Converts `string` to a property path array.
|
|
3060
|
+
*
|
|
3061
|
+
* @private
|
|
3062
|
+
* @param {string} string The string to convert.
|
|
3063
|
+
* @returns {Array} Returns the property path array.
|
|
3064
|
+
*/
|
|
3065
|
+
var stringToPath = _memoizeCapped(function(string) {
|
|
3066
|
+
var result = [];
|
|
3067
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
3068
|
+
result.push('');
|
|
3069
|
+
}
|
|
3070
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
3071
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
3072
|
+
});
|
|
3073
|
+
return result;
|
|
3074
|
+
});
|
|
3075
|
+
|
|
3076
|
+
var _stringToPath = stringToPath;
|
|
3077
|
+
|
|
3078
|
+
/** Used as references for various `Number` constants. */
|
|
3079
|
+
var INFINITY$1 = 1 / 0;
|
|
3080
|
+
|
|
3081
|
+
/** Used to convert symbols to primitives and strings. */
|
|
3082
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
3083
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
3084
|
+
|
|
3085
|
+
/**
|
|
3086
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
3087
|
+
* values to empty strings.
|
|
3088
|
+
*
|
|
3089
|
+
* @private
|
|
3090
|
+
* @param {*} value The value to process.
|
|
3091
|
+
* @returns {string} Returns the string.
|
|
3092
|
+
*/
|
|
3093
|
+
function baseToString(value) {
|
|
3094
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
3095
|
+
if (typeof value == 'string') {
|
|
3096
|
+
return value;
|
|
3097
|
+
}
|
|
3098
|
+
if (isArray_1(value)) {
|
|
3099
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
3100
|
+
return _arrayMap(value, baseToString) + '';
|
|
3101
|
+
}
|
|
3102
|
+
if (isSymbol_1(value)) {
|
|
3103
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
3104
|
+
}
|
|
3105
|
+
var result = (value + '');
|
|
3106
|
+
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
3107
|
+
}
|
|
3108
|
+
|
|
3109
|
+
var _baseToString = baseToString;
|
|
3110
|
+
|
|
3111
|
+
/**
|
|
3112
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
3113
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
3114
|
+
*
|
|
3115
|
+
* @static
|
|
3116
|
+
* @memberOf _
|
|
3117
|
+
* @since 4.0.0
|
|
3118
|
+
* @category Lang
|
|
3119
|
+
* @param {*} value The value to convert.
|
|
3120
|
+
* @returns {string} Returns the converted string.
|
|
3121
|
+
* @example
|
|
3122
|
+
*
|
|
3123
|
+
* _.toString(null);
|
|
3124
|
+
* // => ''
|
|
3125
|
+
*
|
|
3126
|
+
* _.toString(-0);
|
|
3127
|
+
* // => '-0'
|
|
3128
|
+
*
|
|
3129
|
+
* _.toString([1, 2, 3]);
|
|
3130
|
+
* // => '1,2,3'
|
|
3131
|
+
*/
|
|
3132
|
+
function toString(value) {
|
|
3133
|
+
return value == null ? '' : _baseToString(value);
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
var toString_1 = toString;
|
|
3137
|
+
|
|
3138
|
+
/**
|
|
3139
|
+
* Casts `value` to a path array if it's not one.
|
|
3140
|
+
*
|
|
3141
|
+
* @private
|
|
3142
|
+
* @param {*} value The value to inspect.
|
|
3143
|
+
* @param {Object} [object] The object to query keys on.
|
|
3144
|
+
* @returns {Array} Returns the cast property path array.
|
|
3145
|
+
*/
|
|
3146
|
+
function castPath(value, object) {
|
|
3147
|
+
if (isArray_1(value)) {
|
|
3148
|
+
return value;
|
|
3149
|
+
}
|
|
3150
|
+
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
var _castPath = castPath;
|
|
3154
|
+
|
|
3155
|
+
/**
|
|
3156
|
+
* Gets the last element of `array`.
|
|
3157
|
+
*
|
|
3158
|
+
* @static
|
|
3159
|
+
* @memberOf _
|
|
3160
|
+
* @since 0.1.0
|
|
3161
|
+
* @category Array
|
|
3162
|
+
* @param {Array} array The array to query.
|
|
3163
|
+
* @returns {*} Returns the last element of `array`.
|
|
3164
|
+
* @example
|
|
3165
|
+
*
|
|
3166
|
+
* _.last([1, 2, 3]);
|
|
3167
|
+
* // => 3
|
|
3168
|
+
*/
|
|
3169
|
+
function last(array) {
|
|
3170
|
+
var length = array == null ? 0 : array.length;
|
|
3171
|
+
return length ? array[length - 1] : undefined;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
var last_1 = last;
|
|
3175
|
+
|
|
3176
|
+
/** Used as references for various `Number` constants. */
|
|
3177
|
+
var INFINITY = 1 / 0;
|
|
3178
|
+
|
|
3179
|
+
/**
|
|
3180
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
3181
|
+
*
|
|
3182
|
+
* @private
|
|
3183
|
+
* @param {*} value The value to inspect.
|
|
3184
|
+
* @returns {string|symbol} Returns the key.
|
|
3185
|
+
*/
|
|
3186
|
+
function toKey(value) {
|
|
3187
|
+
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
3188
|
+
return value;
|
|
3189
|
+
}
|
|
3190
|
+
var result = (value + '');
|
|
3191
|
+
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
3192
|
+
}
|
|
3193
|
+
|
|
3194
|
+
var _toKey = toKey;
|
|
3195
|
+
|
|
3196
|
+
/**
|
|
3197
|
+
* The base implementation of `_.get` without support for default values.
|
|
3198
|
+
*
|
|
3199
|
+
* @private
|
|
3200
|
+
* @param {Object} object The object to query.
|
|
3201
|
+
* @param {Array|string} path The path of the property to get.
|
|
3202
|
+
* @returns {*} Returns the resolved value.
|
|
3203
|
+
*/
|
|
3204
|
+
function baseGet(object, path) {
|
|
3205
|
+
path = _castPath(path, object);
|
|
3206
|
+
|
|
3207
|
+
var index = 0,
|
|
3208
|
+
length = path.length;
|
|
3209
|
+
|
|
3210
|
+
while (object != null && index < length) {
|
|
3211
|
+
object = object[_toKey(path[index++])];
|
|
3212
|
+
}
|
|
3213
|
+
return (index && index == length) ? object : undefined;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
var _baseGet = baseGet;
|
|
3217
|
+
|
|
3218
|
+
/**
|
|
3219
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
3220
|
+
*
|
|
3221
|
+
* @private
|
|
3222
|
+
* @param {Array} array The array to slice.
|
|
3223
|
+
* @param {number} [start=0] The start position.
|
|
3224
|
+
* @param {number} [end=array.length] The end position.
|
|
3225
|
+
* @returns {Array} Returns the slice of `array`.
|
|
3226
|
+
*/
|
|
3227
|
+
function baseSlice(array, start, end) {
|
|
3228
|
+
var index = -1,
|
|
3229
|
+
length = array.length;
|
|
3230
|
+
|
|
3231
|
+
if (start < 0) {
|
|
3232
|
+
start = -start > length ? 0 : (length + start);
|
|
3233
|
+
}
|
|
3234
|
+
end = end > length ? length : end;
|
|
3235
|
+
if (end < 0) {
|
|
3236
|
+
end += length;
|
|
3237
|
+
}
|
|
3238
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
3239
|
+
start >>>= 0;
|
|
3240
|
+
|
|
3241
|
+
var result = Array(length);
|
|
3242
|
+
while (++index < length) {
|
|
3243
|
+
result[index] = array[index + start];
|
|
3244
|
+
}
|
|
3245
|
+
return result;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
var _baseSlice = baseSlice;
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* Gets the parent value at `path` of `object`.
|
|
3252
|
+
*
|
|
3253
|
+
* @private
|
|
3254
|
+
* @param {Object} object The object to query.
|
|
3255
|
+
* @param {Array} path The path to get the parent value of.
|
|
3256
|
+
* @returns {*} Returns the parent value.
|
|
3257
|
+
*/
|
|
3258
|
+
function parent(object, path) {
|
|
3259
|
+
return path.length < 2 ? object : _baseGet(object, _baseSlice(path, 0, -1));
|
|
3260
|
+
}
|
|
3261
|
+
|
|
3262
|
+
var _parent = parent;
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
* The base implementation of `_.unset`.
|
|
3266
|
+
*
|
|
3267
|
+
* @private
|
|
3268
|
+
* @param {Object} object The object to modify.
|
|
3269
|
+
* @param {Array|string} path The property path to unset.
|
|
3270
|
+
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
|
3271
|
+
*/
|
|
3272
|
+
function baseUnset(object, path) {
|
|
3273
|
+
path = _castPath(path, object);
|
|
3274
|
+
object = _parent(object, path);
|
|
3275
|
+
return object == null || delete object[_toKey(last_1(path))];
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
var _baseUnset = baseUnset;
|
|
3279
|
+
|
|
3280
|
+
/** `Object#toString` result references. */
|
|
3281
|
+
var objectTag = '[object Object]';
|
|
3282
|
+
|
|
3283
|
+
/** Used for built-in method references. */
|
|
3284
|
+
var funcProto = Function.prototype,
|
|
3285
|
+
objectProto = Object.prototype;
|
|
3286
|
+
|
|
3287
|
+
/** Used to resolve the decompiled source of functions. */
|
|
3288
|
+
var funcToString = funcProto.toString;
|
|
3289
|
+
|
|
3290
|
+
/** Used to check objects for own properties. */
|
|
3291
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3292
|
+
|
|
3293
|
+
/** Used to infer the `Object` constructor. */
|
|
3294
|
+
var objectCtorString = funcToString.call(Object);
|
|
3295
|
+
|
|
3296
|
+
/**
|
|
3297
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
3298
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
3299
|
+
*
|
|
3300
|
+
* @static
|
|
3301
|
+
* @memberOf _
|
|
3302
|
+
* @since 0.8.0
|
|
3303
|
+
* @category Lang
|
|
3304
|
+
* @param {*} value The value to check.
|
|
3305
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
3306
|
+
* @example
|
|
3307
|
+
*
|
|
3308
|
+
* function Foo() {
|
|
3309
|
+
* this.a = 1;
|
|
3310
|
+
* }
|
|
3311
|
+
*
|
|
3312
|
+
* _.isPlainObject(new Foo);
|
|
3313
|
+
* // => false
|
|
3314
|
+
*
|
|
3315
|
+
* _.isPlainObject([1, 2, 3]);
|
|
3316
|
+
* // => false
|
|
3317
|
+
*
|
|
3318
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
3319
|
+
* // => true
|
|
3320
|
+
*
|
|
3321
|
+
* _.isPlainObject(Object.create(null));
|
|
3322
|
+
* // => true
|
|
3323
|
+
*/
|
|
3324
|
+
function isPlainObject(value) {
|
|
3325
|
+
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
|
|
3326
|
+
return false;
|
|
3327
|
+
}
|
|
3328
|
+
var proto = _getPrototype(value);
|
|
3329
|
+
if (proto === null) {
|
|
3330
|
+
return true;
|
|
3331
|
+
}
|
|
3332
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
3333
|
+
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
|
3334
|
+
funcToString.call(Ctor) == objectCtorString;
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
var isPlainObject_1 = isPlainObject;
|
|
3338
|
+
|
|
3339
|
+
/**
|
|
3340
|
+
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
|
|
3341
|
+
* objects.
|
|
3342
|
+
*
|
|
3343
|
+
* @private
|
|
3344
|
+
* @param {*} value The value to inspect.
|
|
3345
|
+
* @param {string} key The key of the property to inspect.
|
|
3346
|
+
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
|
|
3347
|
+
*/
|
|
3348
|
+
function customOmitClone(value) {
|
|
3349
|
+
return isPlainObject_1(value) ? undefined : value;
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
var _customOmitClone = customOmitClone;
|
|
3353
|
+
|
|
3354
|
+
/** Built-in value references. */
|
|
3355
|
+
var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
|
|
3356
|
+
|
|
3357
|
+
/**
|
|
3358
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
|
3359
|
+
*
|
|
3360
|
+
* @private
|
|
3361
|
+
* @param {*} value The value to check.
|
|
3362
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
|
3363
|
+
*/
|
|
3364
|
+
function isFlattenable(value) {
|
|
3365
|
+
return isArray_1(value) || isArguments_1(value) ||
|
|
3366
|
+
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
var _isFlattenable = isFlattenable;
|
|
3370
|
+
|
|
3371
|
+
/**
|
|
3372
|
+
* The base implementation of `_.flatten` with support for restricting flattening.
|
|
3373
|
+
*
|
|
3374
|
+
* @private
|
|
3375
|
+
* @param {Array} array The array to flatten.
|
|
3376
|
+
* @param {number} depth The maximum recursion depth.
|
|
3377
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
|
3378
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
|
3379
|
+
* @param {Array} [result=[]] The initial result value.
|
|
3380
|
+
* @returns {Array} Returns the new flattened array.
|
|
3381
|
+
*/
|
|
3382
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
3383
|
+
var index = -1,
|
|
3384
|
+
length = array.length;
|
|
3385
|
+
|
|
3386
|
+
predicate || (predicate = _isFlattenable);
|
|
3387
|
+
result || (result = []);
|
|
3388
|
+
|
|
3389
|
+
while (++index < length) {
|
|
3390
|
+
var value = array[index];
|
|
3391
|
+
if (depth > 0 && predicate(value)) {
|
|
3392
|
+
if (depth > 1) {
|
|
3393
|
+
// Recursively flatten arrays (susceptible to call stack limits).
|
|
3394
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
3395
|
+
} else {
|
|
3396
|
+
_arrayPush(result, value);
|
|
3397
|
+
}
|
|
3398
|
+
} else if (!isStrict) {
|
|
3399
|
+
result[result.length] = value;
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
return result;
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
var _baseFlatten = baseFlatten;
|
|
3406
|
+
|
|
3407
|
+
/**
|
|
3408
|
+
* Flattens `array` a single level deep.
|
|
3409
|
+
*
|
|
3410
|
+
* @static
|
|
3411
|
+
* @memberOf _
|
|
3412
|
+
* @since 0.1.0
|
|
3413
|
+
* @category Array
|
|
3414
|
+
* @param {Array} array The array to flatten.
|
|
3415
|
+
* @returns {Array} Returns the new flattened array.
|
|
3416
|
+
* @example
|
|
3417
|
+
*
|
|
3418
|
+
* _.flatten([1, [2, [3, [4]], 5]]);
|
|
3419
|
+
* // => [1, 2, [3, [4]], 5]
|
|
3420
|
+
*/
|
|
3421
|
+
function flatten(array) {
|
|
3422
|
+
var length = array == null ? 0 : array.length;
|
|
3423
|
+
return length ? _baseFlatten(array, 1) : [];
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
var flatten_1 = flatten;
|
|
3427
|
+
|
|
3428
|
+
/**
|
|
3429
|
+
* A faster alternative to `Function#apply`, this function invokes `func`
|
|
3430
|
+
* with the `this` binding of `thisArg` and the arguments of `args`.
|
|
3431
|
+
*
|
|
3432
|
+
* @private
|
|
3433
|
+
* @param {Function} func The function to invoke.
|
|
3434
|
+
* @param {*} thisArg The `this` binding of `func`.
|
|
3435
|
+
* @param {Array} args The arguments to invoke `func` with.
|
|
3436
|
+
* @returns {*} Returns the result of `func`.
|
|
3437
|
+
*/
|
|
3438
|
+
function apply(func, thisArg, args) {
|
|
3439
|
+
switch (args.length) {
|
|
3440
|
+
case 0: return func.call(thisArg);
|
|
3441
|
+
case 1: return func.call(thisArg, args[0]);
|
|
3442
|
+
case 2: return func.call(thisArg, args[0], args[1]);
|
|
3443
|
+
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
|
3444
|
+
}
|
|
3445
|
+
return func.apply(thisArg, args);
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
var _apply = apply;
|
|
3449
|
+
|
|
3450
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3451
|
+
var nativeMax = Math.max;
|
|
3452
|
+
|
|
3453
|
+
/**
|
|
3454
|
+
* A specialized version of `baseRest` which transforms the rest array.
|
|
3455
|
+
*
|
|
3456
|
+
* @private
|
|
3457
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3458
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
3459
|
+
* @param {Function} transform The rest array transform.
|
|
3460
|
+
* @returns {Function} Returns the new function.
|
|
3461
|
+
*/
|
|
3462
|
+
function overRest(func, start, transform) {
|
|
3463
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
|
3464
|
+
return function() {
|
|
3465
|
+
var args = arguments,
|
|
3466
|
+
index = -1,
|
|
3467
|
+
length = nativeMax(args.length - start, 0),
|
|
3468
|
+
array = Array(length);
|
|
3469
|
+
|
|
3470
|
+
while (++index < length) {
|
|
3471
|
+
array[index] = args[start + index];
|
|
3472
|
+
}
|
|
3473
|
+
index = -1;
|
|
3474
|
+
var otherArgs = Array(start + 1);
|
|
3475
|
+
while (++index < start) {
|
|
3476
|
+
otherArgs[index] = args[index];
|
|
3477
|
+
}
|
|
3478
|
+
otherArgs[start] = transform(array);
|
|
3479
|
+
return _apply(func, this, otherArgs);
|
|
3480
|
+
};
|
|
3481
|
+
}
|
|
3482
|
+
|
|
3483
|
+
var _overRest = overRest;
|
|
3484
|
+
|
|
3485
|
+
/**
|
|
3486
|
+
* Creates a function that returns `value`.
|
|
3487
|
+
*
|
|
3488
|
+
* @static
|
|
3489
|
+
* @memberOf _
|
|
3490
|
+
* @since 2.4.0
|
|
3491
|
+
* @category Util
|
|
3492
|
+
* @param {*} value The value to return from the new function.
|
|
3493
|
+
* @returns {Function} Returns the new constant function.
|
|
3494
|
+
* @example
|
|
3495
|
+
*
|
|
3496
|
+
* var objects = _.times(2, _.constant({ 'a': 1 }));
|
|
3497
|
+
*
|
|
3498
|
+
* console.log(objects);
|
|
3499
|
+
* // => [{ 'a': 1 }, { 'a': 1 }]
|
|
3500
|
+
*
|
|
3501
|
+
* console.log(objects[0] === objects[1]);
|
|
3502
|
+
* // => true
|
|
3503
|
+
*/
|
|
3504
|
+
function constant(value) {
|
|
3505
|
+
return function() {
|
|
3506
|
+
return value;
|
|
3507
|
+
};
|
|
3508
|
+
}
|
|
3509
|
+
|
|
3510
|
+
var constant_1 = constant;
|
|
3511
|
+
|
|
3512
|
+
/**
|
|
3513
|
+
* This method returns the first argument it receives.
|
|
3514
|
+
*
|
|
3515
|
+
* @static
|
|
3516
|
+
* @since 0.1.0
|
|
3517
|
+
* @memberOf _
|
|
3518
|
+
* @category Util
|
|
3519
|
+
* @param {*} value Any value.
|
|
3520
|
+
* @returns {*} Returns `value`.
|
|
3521
|
+
* @example
|
|
3522
|
+
*
|
|
3523
|
+
* var object = { 'a': 1 };
|
|
3524
|
+
*
|
|
3525
|
+
* console.log(_.identity(object) === object);
|
|
3526
|
+
* // => true
|
|
3527
|
+
*/
|
|
3528
|
+
function identity(value) {
|
|
3529
|
+
return value;
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
var identity_1 = identity;
|
|
3533
|
+
|
|
3534
|
+
/**
|
|
3535
|
+
* The base implementation of `setToString` without support for hot loop shorting.
|
|
3536
|
+
*
|
|
3537
|
+
* @private
|
|
3538
|
+
* @param {Function} func The function to modify.
|
|
3539
|
+
* @param {Function} string The `toString` result.
|
|
3540
|
+
* @returns {Function} Returns `func`.
|
|
3541
|
+
*/
|
|
3542
|
+
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
|
3543
|
+
return _defineProperty(func, 'toString', {
|
|
3544
|
+
'configurable': true,
|
|
3545
|
+
'enumerable': false,
|
|
3546
|
+
'value': constant_1(string),
|
|
3547
|
+
'writable': true
|
|
3548
|
+
});
|
|
3549
|
+
};
|
|
3550
|
+
|
|
3551
|
+
var _baseSetToString = baseSetToString;
|
|
3552
|
+
|
|
3553
|
+
/** Used to detect hot functions by number of calls within a span of milliseconds. */
|
|
3554
|
+
var HOT_COUNT = 800,
|
|
3555
|
+
HOT_SPAN = 16;
|
|
3556
|
+
|
|
3557
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3558
|
+
var nativeNow = Date.now;
|
|
3559
|
+
|
|
3560
|
+
/**
|
|
3561
|
+
* Creates a function that'll short out and invoke `identity` instead
|
|
3562
|
+
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
|
|
3563
|
+
* milliseconds.
|
|
3564
|
+
*
|
|
3565
|
+
* @private
|
|
3566
|
+
* @param {Function} func The function to restrict.
|
|
3567
|
+
* @returns {Function} Returns the new shortable function.
|
|
3568
|
+
*/
|
|
3569
|
+
function shortOut(func) {
|
|
3570
|
+
var count = 0,
|
|
3571
|
+
lastCalled = 0;
|
|
3572
|
+
|
|
3573
|
+
return function() {
|
|
3574
|
+
var stamp = nativeNow(),
|
|
3575
|
+
remaining = HOT_SPAN - (stamp - lastCalled);
|
|
3576
|
+
|
|
3577
|
+
lastCalled = stamp;
|
|
3578
|
+
if (remaining > 0) {
|
|
3579
|
+
if (++count >= HOT_COUNT) {
|
|
3580
|
+
return arguments[0];
|
|
3581
|
+
}
|
|
3582
|
+
} else {
|
|
3583
|
+
count = 0;
|
|
3584
|
+
}
|
|
3585
|
+
return func.apply(undefined, arguments);
|
|
3586
|
+
};
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
var _shortOut = shortOut;
|
|
3590
|
+
|
|
3591
|
+
/**
|
|
3592
|
+
* Sets the `toString` method of `func` to return `string`.
|
|
3593
|
+
*
|
|
3594
|
+
* @private
|
|
3595
|
+
* @param {Function} func The function to modify.
|
|
3596
|
+
* @param {Function} string The `toString` result.
|
|
3597
|
+
* @returns {Function} Returns `func`.
|
|
3598
|
+
*/
|
|
3599
|
+
var setToString = _shortOut(_baseSetToString);
|
|
3600
|
+
|
|
3601
|
+
var _setToString = setToString;
|
|
3602
|
+
|
|
3603
|
+
/**
|
|
3604
|
+
* A specialized version of `baseRest` which flattens the rest array.
|
|
3605
|
+
*
|
|
3606
|
+
* @private
|
|
3607
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
3608
|
+
* @returns {Function} Returns the new function.
|
|
3609
|
+
*/
|
|
3610
|
+
function flatRest(func) {
|
|
3611
|
+
return _setToString(_overRest(func, undefined, flatten_1), func + '');
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
var _flatRest = flatRest;
|
|
3615
|
+
|
|
3616
|
+
/** Used to compose bitmasks for cloning. */
|
|
3617
|
+
var CLONE_DEEP_FLAG = 1,
|
|
3618
|
+
CLONE_FLAT_FLAG = 2,
|
|
3619
|
+
CLONE_SYMBOLS_FLAG = 4;
|
|
3620
|
+
|
|
3621
|
+
/**
|
|
3622
|
+
* The opposite of `_.pick`; this method creates an object composed of the
|
|
3623
|
+
* own and inherited enumerable property paths of `object` that are not omitted.
|
|
3624
|
+
*
|
|
3625
|
+
* **Note:** This method is considerably slower than `_.pick`.
|
|
3626
|
+
*
|
|
3627
|
+
* @static
|
|
3628
|
+
* @since 0.1.0
|
|
3629
|
+
* @memberOf _
|
|
3630
|
+
* @category Object
|
|
3631
|
+
* @param {Object} object The source object.
|
|
3632
|
+
* @param {...(string|string[])} [paths] The property paths to omit.
|
|
3633
|
+
* @returns {Object} Returns the new object.
|
|
3634
|
+
* @example
|
|
3635
|
+
*
|
|
3636
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
3637
|
+
*
|
|
3638
|
+
* _.omit(object, ['a', 'c']);
|
|
3639
|
+
* // => { 'b': '2' }
|
|
3640
|
+
*/
|
|
3641
|
+
var omit = _flatRest(function(object, paths) {
|
|
3642
|
+
var result = {};
|
|
3643
|
+
if (object == null) {
|
|
3644
|
+
return result;
|
|
3645
|
+
}
|
|
3646
|
+
var isDeep = false;
|
|
3647
|
+
paths = _arrayMap(paths, function(path) {
|
|
3648
|
+
path = _castPath(path, object);
|
|
3649
|
+
isDeep || (isDeep = path.length > 1);
|
|
3650
|
+
return path;
|
|
3651
|
+
});
|
|
3652
|
+
_copyObject(object, _getAllKeysIn(object), result);
|
|
3653
|
+
if (isDeep) {
|
|
3654
|
+
result = _baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, _customOmitClone);
|
|
3655
|
+
}
|
|
3656
|
+
var length = paths.length;
|
|
3657
|
+
while (length--) {
|
|
3658
|
+
_baseUnset(result, paths[length]);
|
|
3659
|
+
}
|
|
3660
|
+
return result;
|
|
3661
|
+
});
|
|
3662
|
+
|
|
3663
|
+
var omit_1 = omit;
|
|
3664
|
+
|
|
3665
|
+
const _excluded$2 = ["children", "cancelText", "cancelButtonProps", "okButtonProps", "okType", "onOk", "okText"],
|
|
3666
|
+
_excluded2$1 = ["formProps", "autoClose", "children", "modalRender"],
|
|
3667
|
+
_excluded3$1 = ["formProps", "okType", "okButtonProps", "okText", "onOk", "cancelButtonProps", "cancelText", "footer", "renderModal", "modalRender", "autoClose"];
|
|
3668
|
+
const ModalFooter = props => {
|
|
3669
|
+
const {
|
|
3670
|
+
children,
|
|
3671
|
+
cancelText,
|
|
3672
|
+
cancelButtonProps,
|
|
3673
|
+
okButtonProps,
|
|
3674
|
+
okType,
|
|
3675
|
+
onOk,
|
|
3676
|
+
okText
|
|
3677
|
+
} = props,
|
|
3678
|
+
others = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
3679
|
+
const defaultFooter = /*#__PURE__*/React.createElement(Flex, {
|
|
3680
|
+
justify: "space-between",
|
|
3681
|
+
gap: 8
|
|
3682
|
+
}, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement(Flex, {
|
|
3683
|
+
gap: 8
|
|
3684
|
+
}, /*#__PURE__*/React.createElement(CancelButton, Object.assign({}, cancelButtonProps, {
|
|
3685
|
+
onClick: others.onCancel
|
|
3686
|
+
}), cancelText), /*#__PURE__*/React.createElement(SubmitButton, Object.assign({}, okButtonProps, {
|
|
3687
|
+
type: okType,
|
|
3688
|
+
onClick: onOk
|
|
3689
|
+
}), okText)));
|
|
3690
|
+
if (typeof children === 'function') {
|
|
3691
|
+
return children({
|
|
3692
|
+
defaultFooter,
|
|
3693
|
+
props: omit_1(props, ['children'])
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
if (isValidElement(children) || children === null) {
|
|
3697
|
+
return children;
|
|
3698
|
+
}
|
|
3699
|
+
return defaultFooter;
|
|
3700
|
+
};
|
|
3701
|
+
const ModalForm = props => {
|
|
3702
|
+
const {
|
|
3703
|
+
formProps,
|
|
3704
|
+
autoClose,
|
|
3705
|
+
children,
|
|
3706
|
+
modalRender
|
|
3707
|
+
} = props,
|
|
3708
|
+
others = _objectWithoutPropertiesLoose(props, _excluded2$1);
|
|
3709
|
+
const formChildren = /*#__PURE__*/React.createElement(Form, Object.assign({}, formProps, {
|
|
3710
|
+
onSubmit: async (data, ...args) => {
|
|
3711
|
+
const res = await (formProps.onSubmit == null ? void 0 : formProps.onSubmit(data, {
|
|
3712
|
+
close: others.onCancel
|
|
3713
|
+
}, ...args));
|
|
3714
|
+
if (res === false) {
|
|
3715
|
+
return;
|
|
3716
|
+
}
|
|
3717
|
+
autoClose && others.onCancel && others.onCancel();
|
|
3718
|
+
}
|
|
3719
|
+
}), children);
|
|
3720
|
+
return typeof modalRender === 'function' ? modalRender({
|
|
3721
|
+
formChildren,
|
|
3722
|
+
defaultChildren: children,
|
|
3723
|
+
props: omit_1(props, ['children'])
|
|
3724
|
+
}) : formChildren;
|
|
3725
|
+
};
|
|
3726
|
+
const FormModal = p => {
|
|
3727
|
+
const {
|
|
3728
|
+
locale: contextLocale
|
|
3729
|
+
} = useContext();
|
|
3730
|
+
const locale = Object.assign({}, {
|
|
3731
|
+
提交: '提交',
|
|
3732
|
+
取消: '取消'
|
|
3733
|
+
}, contextLocale, p.locale);
|
|
3734
|
+
const _Object$assign = Object.assign({}, {
|
|
3735
|
+
formProps: {},
|
|
3736
|
+
autoClose: true,
|
|
3737
|
+
okType: 'primary',
|
|
3738
|
+
okText: locale['提交'],
|
|
3739
|
+
cancelText: locale['取消'],
|
|
3740
|
+
renderModal: props => /*#__PURE__*/React.createElement(Modal, props)
|
|
3741
|
+
}, p, {
|
|
3742
|
+
locale
|
|
3743
|
+
}),
|
|
3744
|
+
{
|
|
3745
|
+
formProps,
|
|
3746
|
+
okType,
|
|
3747
|
+
okButtonProps,
|
|
3748
|
+
okText,
|
|
3749
|
+
onOk,
|
|
3750
|
+
cancelButtonProps,
|
|
3751
|
+
cancelText,
|
|
3752
|
+
footer,
|
|
3753
|
+
renderModal,
|
|
3754
|
+
modalRender,
|
|
3755
|
+
autoClose
|
|
3756
|
+
} = _Object$assign,
|
|
3757
|
+
others = _objectWithoutPropertiesLoose(_Object$assign, _excluded3$1);
|
|
3758
|
+
return renderModal(Object.assign({}, others, {
|
|
3759
|
+
modalRender: children => /*#__PURE__*/React.createElement(ModalForm, Object.assign({}, others, {
|
|
3760
|
+
formProps,
|
|
3761
|
+
autoClose,
|
|
3762
|
+
children,
|
|
3763
|
+
modalRender
|
|
3764
|
+
})),
|
|
3765
|
+
footer: () => {
|
|
3766
|
+
return /*#__PURE__*/React.createElement(ModalFooter, Object.assign({}, others, {
|
|
3767
|
+
children: footer,
|
|
3768
|
+
cancelText,
|
|
3769
|
+
cancelButtonProps,
|
|
3770
|
+
okButtonProps,
|
|
3771
|
+
okType,
|
|
3772
|
+
onOk,
|
|
3773
|
+
okText
|
|
3774
|
+
}));
|
|
3775
|
+
}
|
|
3776
|
+
}));
|
|
3777
|
+
};
|
|
3778
|
+
|
|
3779
|
+
const _excluded$1 = ["className", "stepsClassName", "autoStep", "onComplete", "children"];
|
|
3780
|
+
const FormSteps = p => {
|
|
3781
|
+
var _stepProps$items$curr, _stepProps$items$curr2;
|
|
3782
|
+
const _Object$assign = Object.assign({}, {
|
|
3783
|
+
autoStep: true,
|
|
3784
|
+
defaultCurrent: 0,
|
|
3785
|
+
items: [],
|
|
3786
|
+
onComplete: () => {}
|
|
3787
|
+
}, p),
|
|
3788
|
+
{
|
|
3789
|
+
className,
|
|
3790
|
+
stepsClassName,
|
|
3791
|
+
autoStep,
|
|
3792
|
+
onComplete,
|
|
3793
|
+
children
|
|
3794
|
+
} = _Object$assign,
|
|
3795
|
+
stepProps = _objectWithoutPropertiesLoose(_Object$assign, _excluded$1);
|
|
3796
|
+
const [currentStep, onStepChange] = useControlValue(stepProps, {
|
|
3797
|
+
value: 'current',
|
|
3798
|
+
defaultValue: 'defaultCurrent'
|
|
3799
|
+
});
|
|
3800
|
+
const stepCacheRef = useRef([]);
|
|
3801
|
+
const isLastStep = currentStep === stepProps.items.length - 1;
|
|
3802
|
+
const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps);
|
|
3803
|
+
const inner = /*#__PURE__*/React.createElement(Flex, {
|
|
3804
|
+
className: className,
|
|
3805
|
+
vertical: stepProps.direction !== 'vertical',
|
|
3806
|
+
gap: 24
|
|
3807
|
+
}, /*#__PURE__*/React.createElement(Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
|
|
3808
|
+
className: classnames(stepsClassName, style['steps']),
|
|
3809
|
+
items: stepProps.items.map(item => omit_1(item, ['formProps'])),
|
|
3810
|
+
current: currentStep
|
|
3811
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
3812
|
+
className: style['steps-form-inner']
|
|
3813
|
+
}, (_stepProps$items$curr2 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr2.children));
|
|
3814
|
+
return /*#__PURE__*/React.createElement(Form, Object.assign({}, currentFormProps, {
|
|
3815
|
+
onSubmit: async (data, ...args) => {
|
|
3816
|
+
if (!stepCacheRef.current[currentStep]) {
|
|
3817
|
+
stepCacheRef.current[currentStep] = {};
|
|
3818
|
+
}
|
|
3819
|
+
stepCacheRef.current[currentStep].formData = data;
|
|
3820
|
+
const res = await (currentFormProps.onSubmit == null ? void 0 : currentFormProps.onSubmit(data, {
|
|
3821
|
+
currentStep,
|
|
3822
|
+
onStepChange,
|
|
3823
|
+
stepCache: stepCacheRef.current,
|
|
3824
|
+
isLastStep
|
|
3825
|
+
}, ...args));
|
|
3826
|
+
stepCacheRef.current[currentStep].submitData = res;
|
|
3827
|
+
if (autoStep && res !== false && !isLastStep) {
|
|
3828
|
+
onStepChange(currentStep + 1);
|
|
3829
|
+
return res;
|
|
3830
|
+
}
|
|
3831
|
+
if (autoStep && res !== false) {
|
|
3832
|
+
onComplete(stepCacheRef.current);
|
|
3833
|
+
return res;
|
|
3834
|
+
}
|
|
3835
|
+
return res;
|
|
3836
|
+
}
|
|
3837
|
+
}), typeof children === 'function' ? children({
|
|
3838
|
+
children: inner,
|
|
3839
|
+
isLastStep,
|
|
3840
|
+
currentStep,
|
|
3841
|
+
onStepChange,
|
|
3842
|
+
getStepCache: () => {
|
|
3843
|
+
return stepCacheRef.current;
|
|
3844
|
+
}
|
|
3845
|
+
}) : inner);
|
|
3846
|
+
};
|
|
3847
|
+
|
|
3848
|
+
/**
|
|
3849
|
+
* This function is like `assignValue` except that it doesn't assign
|
|
3850
|
+
* `undefined` values.
|
|
3851
|
+
*
|
|
3852
|
+
* @private
|
|
3853
|
+
* @param {Object} object The object to modify.
|
|
3854
|
+
* @param {string} key The key of the property to assign.
|
|
3855
|
+
* @param {*} value The value to assign.
|
|
3856
|
+
*/
|
|
3857
|
+
function assignMergeValue(object, key, value) {
|
|
3858
|
+
if ((value !== undefined && !eq_1(object[key], value)) ||
|
|
3859
|
+
(value === undefined && !(key in object))) {
|
|
3860
|
+
_baseAssignValue(object, key, value);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
|
|
3864
|
+
var _assignMergeValue = assignMergeValue;
|
|
3865
|
+
|
|
3866
|
+
/**
|
|
3867
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
3868
|
+
*
|
|
3869
|
+
* @private
|
|
3870
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
3871
|
+
* @returns {Function} Returns the new base function.
|
|
3872
|
+
*/
|
|
3873
|
+
function createBaseFor(fromRight) {
|
|
3874
|
+
return function(object, iteratee, keysFunc) {
|
|
3875
|
+
var index = -1,
|
|
3876
|
+
iterable = Object(object),
|
|
3877
|
+
props = keysFunc(object),
|
|
3878
|
+
length = props.length;
|
|
3879
|
+
|
|
3880
|
+
while (length--) {
|
|
3881
|
+
var key = props[fromRight ? length : ++index];
|
|
3882
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
3883
|
+
break;
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
return object;
|
|
3887
|
+
};
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
var _createBaseFor = createBaseFor;
|
|
3891
|
+
|
|
3892
|
+
/**
|
|
3893
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
|
3894
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
3895
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
3896
|
+
*
|
|
3897
|
+
* @private
|
|
3898
|
+
* @param {Object} object The object to iterate over.
|
|
3899
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
3900
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
3901
|
+
* @returns {Object} Returns `object`.
|
|
3902
|
+
*/
|
|
3903
|
+
var baseFor = _createBaseFor();
|
|
3904
|
+
|
|
3905
|
+
var _baseFor = baseFor;
|
|
3906
|
+
|
|
3907
|
+
/**
|
|
3908
|
+
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
3909
|
+
* is an object.
|
|
3910
|
+
*
|
|
3911
|
+
* @static
|
|
3912
|
+
* @memberOf _
|
|
3913
|
+
* @since 4.0.0
|
|
3914
|
+
* @category Lang
|
|
3915
|
+
* @param {*} value The value to check.
|
|
3916
|
+
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
3917
|
+
* else `false`.
|
|
3918
|
+
* @example
|
|
3919
|
+
*
|
|
3920
|
+
* _.isArrayLikeObject([1, 2, 3]);
|
|
3921
|
+
* // => true
|
|
3922
|
+
*
|
|
3923
|
+
* _.isArrayLikeObject(document.body.children);
|
|
3924
|
+
* // => true
|
|
3925
|
+
*
|
|
3926
|
+
* _.isArrayLikeObject('abc');
|
|
3927
|
+
* // => false
|
|
3928
|
+
*
|
|
3929
|
+
* _.isArrayLikeObject(_.noop);
|
|
3930
|
+
* // => false
|
|
3931
|
+
*/
|
|
3932
|
+
function isArrayLikeObject(value) {
|
|
3933
|
+
return isObjectLike_1(value) && isArrayLike_1(value);
|
|
3934
|
+
}
|
|
3935
|
+
|
|
3936
|
+
var isArrayLikeObject_1 = isArrayLikeObject;
|
|
3937
|
+
|
|
3938
|
+
/**
|
|
3939
|
+
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
|
|
3940
|
+
*
|
|
3941
|
+
* @private
|
|
3942
|
+
* @param {Object} object The object to query.
|
|
3943
|
+
* @param {string} key The key of the property to get.
|
|
3944
|
+
* @returns {*} Returns the property value.
|
|
3945
|
+
*/
|
|
3946
|
+
function safeGet(object, key) {
|
|
3947
|
+
if (key === 'constructor' && typeof object[key] === 'function') {
|
|
3948
|
+
return;
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
if (key == '__proto__') {
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
return object[key];
|
|
3956
|
+
}
|
|
3957
|
+
|
|
3958
|
+
var _safeGet = safeGet;
|
|
3959
|
+
|
|
3960
|
+
/**
|
|
3961
|
+
* Converts `value` to a plain object flattening inherited enumerable string
|
|
3962
|
+
* keyed properties of `value` to own properties of the plain object.
|
|
3963
|
+
*
|
|
3964
|
+
* @static
|
|
3965
|
+
* @memberOf _
|
|
3966
|
+
* @since 3.0.0
|
|
3967
|
+
* @category Lang
|
|
3968
|
+
* @param {*} value The value to convert.
|
|
3969
|
+
* @returns {Object} Returns the converted plain object.
|
|
3970
|
+
* @example
|
|
3971
|
+
*
|
|
3972
|
+
* function Foo() {
|
|
3973
|
+
* this.b = 2;
|
|
3974
|
+
* }
|
|
3975
|
+
*
|
|
3976
|
+
* Foo.prototype.c = 3;
|
|
3977
|
+
*
|
|
3978
|
+
* _.assign({ 'a': 1 }, new Foo);
|
|
3979
|
+
* // => { 'a': 1, 'b': 2 }
|
|
3980
|
+
*
|
|
3981
|
+
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
|
|
3982
|
+
* // => { 'a': 1, 'b': 2, 'c': 3 }
|
|
3983
|
+
*/
|
|
3984
|
+
function toPlainObject(value) {
|
|
3985
|
+
return _copyObject(value, keysIn_1(value));
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
var toPlainObject_1 = toPlainObject;
|
|
3989
|
+
|
|
3990
|
+
/**
|
|
3991
|
+
* A specialized version of `baseMerge` for arrays and objects which performs
|
|
3992
|
+
* deep merges and tracks traversed objects enabling objects with circular
|
|
3993
|
+
* references to be merged.
|
|
3994
|
+
*
|
|
3995
|
+
* @private
|
|
3996
|
+
* @param {Object} object The destination object.
|
|
3997
|
+
* @param {Object} source The source object.
|
|
3998
|
+
* @param {string} key The key of the value to merge.
|
|
3999
|
+
* @param {number} srcIndex The index of `source`.
|
|
4000
|
+
* @param {Function} mergeFunc The function to merge values.
|
|
4001
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
|
4002
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
4003
|
+
* counterparts.
|
|
4004
|
+
*/
|
|
4005
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
4006
|
+
var objValue = _safeGet(object, key),
|
|
4007
|
+
srcValue = _safeGet(source, key),
|
|
4008
|
+
stacked = stack.get(srcValue);
|
|
4009
|
+
|
|
4010
|
+
if (stacked) {
|
|
4011
|
+
_assignMergeValue(object, key, stacked);
|
|
4012
|
+
return;
|
|
4013
|
+
}
|
|
4014
|
+
var newValue = customizer
|
|
4015
|
+
? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
|
4016
|
+
: undefined;
|
|
4017
|
+
|
|
4018
|
+
var isCommon = newValue === undefined;
|
|
4019
|
+
|
|
4020
|
+
if (isCommon) {
|
|
4021
|
+
var isArr = isArray_1(srcValue),
|
|
4022
|
+
isBuff = !isArr && isBuffer_1(srcValue),
|
|
4023
|
+
isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
|
|
4024
|
+
|
|
4025
|
+
newValue = srcValue;
|
|
4026
|
+
if (isArr || isBuff || isTyped) {
|
|
4027
|
+
if (isArray_1(objValue)) {
|
|
4028
|
+
newValue = objValue;
|
|
4029
|
+
}
|
|
4030
|
+
else if (isArrayLikeObject_1(objValue)) {
|
|
4031
|
+
newValue = _copyArray(objValue);
|
|
4032
|
+
}
|
|
4033
|
+
else if (isBuff) {
|
|
4034
|
+
isCommon = false;
|
|
4035
|
+
newValue = _cloneBuffer(srcValue, true);
|
|
4036
|
+
}
|
|
4037
|
+
else if (isTyped) {
|
|
4038
|
+
isCommon = false;
|
|
4039
|
+
newValue = _cloneTypedArray(srcValue, true);
|
|
4040
|
+
}
|
|
4041
|
+
else {
|
|
4042
|
+
newValue = [];
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
|
|
4046
|
+
newValue = objValue;
|
|
4047
|
+
if (isArguments_1(objValue)) {
|
|
4048
|
+
newValue = toPlainObject_1(objValue);
|
|
4049
|
+
}
|
|
4050
|
+
else if (!isObject_1(objValue) || isFunction_1(objValue)) {
|
|
4051
|
+
newValue = _initCloneObject(srcValue);
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
else {
|
|
4055
|
+
isCommon = false;
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
if (isCommon) {
|
|
4059
|
+
// Recursively merge objects and arrays (susceptible to call stack limits).
|
|
4060
|
+
stack.set(srcValue, newValue);
|
|
4061
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
4062
|
+
stack['delete'](srcValue);
|
|
4063
|
+
}
|
|
4064
|
+
_assignMergeValue(object, key, newValue);
|
|
4065
|
+
}
|
|
4066
|
+
|
|
4067
|
+
var _baseMergeDeep = baseMergeDeep;
|
|
4068
|
+
|
|
4069
|
+
/**
|
|
4070
|
+
* The base implementation of `_.merge` without support for multiple sources.
|
|
4071
|
+
*
|
|
4072
|
+
* @private
|
|
4073
|
+
* @param {Object} object The destination object.
|
|
4074
|
+
* @param {Object} source The source object.
|
|
4075
|
+
* @param {number} srcIndex The index of `source`.
|
|
4076
|
+
* @param {Function} [customizer] The function to customize merged values.
|
|
4077
|
+
* @param {Object} [stack] Tracks traversed source values and their merged
|
|
4078
|
+
* counterparts.
|
|
4079
|
+
*/
|
|
4080
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
4081
|
+
if (object === source) {
|
|
4082
|
+
return;
|
|
4083
|
+
}
|
|
4084
|
+
_baseFor(source, function(srcValue, key) {
|
|
4085
|
+
stack || (stack = new _Stack);
|
|
4086
|
+
if (isObject_1(srcValue)) {
|
|
4087
|
+
_baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
4088
|
+
}
|
|
4089
|
+
else {
|
|
4090
|
+
var newValue = customizer
|
|
4091
|
+
? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
|
4092
|
+
: undefined;
|
|
4093
|
+
|
|
4094
|
+
if (newValue === undefined) {
|
|
4095
|
+
newValue = srcValue;
|
|
4096
|
+
}
|
|
4097
|
+
_assignMergeValue(object, key, newValue);
|
|
4098
|
+
}
|
|
4099
|
+
}, keysIn_1);
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4102
|
+
var _baseMerge = baseMerge;
|
|
4103
|
+
|
|
4104
|
+
/**
|
|
4105
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
|
4106
|
+
*
|
|
4107
|
+
* @private
|
|
4108
|
+
* @param {Function} func The function to apply a rest parameter to.
|
|
4109
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
|
4110
|
+
* @returns {Function} Returns the new function.
|
|
4111
|
+
*/
|
|
4112
|
+
function baseRest(func, start) {
|
|
4113
|
+
return _setToString(_overRest(func, start, identity_1), func + '');
|
|
4114
|
+
}
|
|
4115
|
+
|
|
4116
|
+
var _baseRest = baseRest;
|
|
4117
|
+
|
|
4118
|
+
/**
|
|
4119
|
+
* Checks if the given arguments are from an iteratee call.
|
|
4120
|
+
*
|
|
4121
|
+
* @private
|
|
4122
|
+
* @param {*} value The potential iteratee value argument.
|
|
4123
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
4124
|
+
* @param {*} object The potential iteratee object argument.
|
|
4125
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
4126
|
+
* else `false`.
|
|
4127
|
+
*/
|
|
4128
|
+
function isIterateeCall(value, index, object) {
|
|
4129
|
+
if (!isObject_1(object)) {
|
|
4130
|
+
return false;
|
|
4131
|
+
}
|
|
4132
|
+
var type = typeof index;
|
|
4133
|
+
if (type == 'number'
|
|
4134
|
+
? (isArrayLike_1(object) && _isIndex(index, object.length))
|
|
4135
|
+
: (type == 'string' && index in object)
|
|
4136
|
+
) {
|
|
4137
|
+
return eq_1(object[index], value);
|
|
4138
|
+
}
|
|
4139
|
+
return false;
|
|
4140
|
+
}
|
|
4141
|
+
|
|
4142
|
+
var _isIterateeCall = isIterateeCall;
|
|
4143
|
+
|
|
4144
|
+
/**
|
|
4145
|
+
* Creates a function like `_.assign`.
|
|
4146
|
+
*
|
|
4147
|
+
* @private
|
|
4148
|
+
* @param {Function} assigner The function to assign values.
|
|
4149
|
+
* @returns {Function} Returns the new assigner function.
|
|
4150
|
+
*/
|
|
4151
|
+
function createAssigner(assigner) {
|
|
4152
|
+
return _baseRest(function(object, sources) {
|
|
4153
|
+
var index = -1,
|
|
4154
|
+
length = sources.length,
|
|
4155
|
+
customizer = length > 1 ? sources[length - 1] : undefined,
|
|
4156
|
+
guard = length > 2 ? sources[2] : undefined;
|
|
4157
|
+
|
|
4158
|
+
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
|
4159
|
+
? (length--, customizer)
|
|
4160
|
+
: undefined;
|
|
4161
|
+
|
|
4162
|
+
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
|
|
4163
|
+
customizer = length < 3 ? undefined : customizer;
|
|
4164
|
+
length = 1;
|
|
4165
|
+
}
|
|
4166
|
+
object = Object(object);
|
|
4167
|
+
while (++index < length) {
|
|
4168
|
+
var source = sources[index];
|
|
4169
|
+
if (source) {
|
|
4170
|
+
assigner(object, source, index, customizer);
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
return object;
|
|
4174
|
+
});
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
var _createAssigner = createAssigner;
|
|
4178
|
+
|
|
4179
|
+
/**
|
|
4180
|
+
* This method is like `_.assign` except that it recursively merges own and
|
|
4181
|
+
* inherited enumerable string keyed properties of source objects into the
|
|
4182
|
+
* destination object. Source properties that resolve to `undefined` are
|
|
4183
|
+
* skipped if a destination value exists. Array and plain object properties
|
|
4184
|
+
* are merged recursively. Other objects and value types are overridden by
|
|
4185
|
+
* assignment. Source objects are applied from left to right. Subsequent
|
|
4186
|
+
* sources overwrite property assignments of previous sources.
|
|
4187
|
+
*
|
|
4188
|
+
* **Note:** This method mutates `object`.
|
|
4189
|
+
*
|
|
4190
|
+
* @static
|
|
4191
|
+
* @memberOf _
|
|
4192
|
+
* @since 0.5.0
|
|
4193
|
+
* @category Object
|
|
4194
|
+
* @param {Object} object The destination object.
|
|
4195
|
+
* @param {...Object} [sources] The source objects.
|
|
4196
|
+
* @returns {Object} Returns `object`.
|
|
4197
|
+
* @example
|
|
4198
|
+
*
|
|
4199
|
+
* var object = {
|
|
4200
|
+
* 'a': [{ 'b': 2 }, { 'd': 4 }]
|
|
4201
|
+
* };
|
|
4202
|
+
*
|
|
4203
|
+
* var other = {
|
|
4204
|
+
* 'a': [{ 'c': 3 }, { 'e': 5 }]
|
|
4205
|
+
* };
|
|
4206
|
+
*
|
|
4207
|
+
* _.merge(object, other);
|
|
4208
|
+
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
|
4209
|
+
*/
|
|
4210
|
+
var merge = _createAssigner(function(object, source, srcIndex) {
|
|
4211
|
+
_baseMerge(object, source, srcIndex);
|
|
4212
|
+
});
|
|
4213
|
+
|
|
4214
|
+
var merge_1 = merge;
|
|
4215
|
+
|
|
4216
|
+
const _excluded = ["completeText", "nextText"],
|
|
4217
|
+
_excluded2 = ["modalProps", "completeText", "nextText", "className"],
|
|
4218
|
+
_excluded3 = ["children"];
|
|
4219
|
+
const childrenContext = createContext({});
|
|
4220
|
+
const {
|
|
4221
|
+
Provider
|
|
4222
|
+
} = childrenContext;
|
|
4223
|
+
const useChildrenContext = () => {
|
|
4224
|
+
return useContext$1(childrenContext);
|
|
4225
|
+
};
|
|
4226
|
+
const StepChildren = () => {
|
|
4227
|
+
const {
|
|
4228
|
+
stepChildren
|
|
4229
|
+
} = useChildrenContext();
|
|
4230
|
+
return stepChildren;
|
|
4231
|
+
};
|
|
4232
|
+
const StepFormFooter = p => {
|
|
4233
|
+
const _Object$assign = Object.assign({}, p),
|
|
4234
|
+
{
|
|
4235
|
+
completeText,
|
|
4236
|
+
nextText
|
|
4237
|
+
} = _Object$assign,
|
|
4238
|
+
props = _objectWithoutPropertiesLoose(_Object$assign, _excluded);
|
|
4239
|
+
const {
|
|
4240
|
+
isLastStep
|
|
4241
|
+
} = useChildrenContext();
|
|
4242
|
+
return /*#__PURE__*/React.createElement(ModalFooter, _extends({}, props, {
|
|
4243
|
+
okText: isLastStep ? completeText : nextText
|
|
4244
|
+
}));
|
|
4245
|
+
};
|
|
4246
|
+
const FormStepsModal = p => {
|
|
4247
|
+
const locale = Object.assign({}, {
|
|
4248
|
+
完成: '完成',
|
|
4249
|
+
下一步: '下一步'
|
|
4250
|
+
}, p.locale);
|
|
4251
|
+
const _merge = merge_1({}, {
|
|
4252
|
+
autoStep: true,
|
|
4253
|
+
modalProps: {
|
|
4254
|
+
autoClose: true
|
|
4255
|
+
},
|
|
4256
|
+
completeText: locale['完成'],
|
|
4257
|
+
nextText: locale['下一步']
|
|
4258
|
+
}, p, {
|
|
4259
|
+
locale
|
|
4260
|
+
}),
|
|
4261
|
+
{
|
|
4262
|
+
modalProps,
|
|
4263
|
+
completeText,
|
|
4264
|
+
nextText,
|
|
4265
|
+
className
|
|
4266
|
+
} = _merge,
|
|
4267
|
+
others = _objectWithoutPropertiesLoose(_merge, _excluded2);
|
|
4268
|
+
return /*#__PURE__*/React.createElement(FormModal, _extends({}, modalProps, {
|
|
4269
|
+
modalRender: ({
|
|
4270
|
+
defaultChildren
|
|
4271
|
+
}) => {
|
|
4272
|
+
return /*#__PURE__*/React.createElement(FormSteps, _extends({}, Object.assign({}, others, {
|
|
4273
|
+
items: others.items.map(item => {
|
|
4274
|
+
return Object.assign({}, item, {
|
|
4275
|
+
formProps: Object.assign({}, item.formProps, {
|
|
4276
|
+
onSubmit: (data, context, ...args) => {
|
|
4277
|
+
var _item$formProps;
|
|
4278
|
+
return (_item$formProps = item.formProps) == null || _item$formProps.onSubmit == null ? void 0 : _item$formProps.onSubmit(data, Object.assign({}, context, {
|
|
4279
|
+
close: modalProps.onCancel
|
|
4280
|
+
}), ...args);
|
|
4281
|
+
}
|
|
4282
|
+
})
|
|
4283
|
+
});
|
|
4284
|
+
})
|
|
4285
|
+
}), {
|
|
4286
|
+
className: classnames(className, style['steps-modal']),
|
|
4287
|
+
onComplete: async data => {
|
|
4288
|
+
const res = await (others.onComplete == null ? void 0 : others.onComplete(data));
|
|
4289
|
+
modalProps.autoClose && res !== false && (modalProps.onCancel == null ? void 0 : modalProps.onCancel());
|
|
4290
|
+
}
|
|
4291
|
+
}), _ref => {
|
|
4292
|
+
let {
|
|
4293
|
+
children: stepChildren
|
|
4294
|
+
} = _ref,
|
|
4295
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded3);
|
|
4296
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
4297
|
+
value: _extends({
|
|
4298
|
+
stepChildren
|
|
4299
|
+
}, props)
|
|
4300
|
+
}, defaultChildren);
|
|
4301
|
+
});
|
|
4302
|
+
},
|
|
4303
|
+
footer: ({
|
|
4304
|
+
props
|
|
4305
|
+
}) => {
|
|
4306
|
+
return /*#__PURE__*/React.createElement(StepFormFooter, _extends({}, props, {
|
|
4307
|
+
completeText: completeText,
|
|
4308
|
+
nextText: nextText
|
|
4309
|
+
}));
|
|
4310
|
+
}
|
|
4311
|
+
}), /*#__PURE__*/React.createElement(StepChildren, null));
|
|
4312
|
+
};
|
|
4313
|
+
|
|
4314
|
+
export { Form, FormModal, FormSteps, FormStepsModal, List, MultiField, List as SubList, TableList, FormInfo as default };
|
|
398
4315
|
//# sourceMappingURL=index.modern.js.map
|