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