@kne/react-pdf-sign 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +346 -0
- package/dist/index.css +64 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +2770 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +2744 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/locale/en-US.js +12 -0
- package/dist/locale/en-US.js.map +1 -0
- package/dist/locale/en-US.modern.js +12 -0
- package/dist/locale/en-US.modern.js.map +1 -0
- package/dist/locale/zh-CN.js +12 -0
- package/dist/locale/zh-CN.js.map +1 -0
- package/dist/locale/zh-CN.modern.js +12 -0
- package/dist/locale/zh-CN.modern.js.map +1 -0
- package/package.json +105 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2770 @@
|
|
|
1
|
+
var reactPdf = require('react-pdf');
|
|
2
|
+
var react = require('react');
|
|
3
|
+
var globalContext = require('@kne/global-context');
|
|
4
|
+
var useResize = require('@kne/use-resize');
|
|
5
|
+
var classnames = require('classnames');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var icons = require('@ant-design/icons');
|
|
8
|
+
require('react-pdf/dist/Page/TextLayer.css');
|
|
9
|
+
require('react-pdf/dist/Page/AnnotationLayer.css');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
var reactKonva = require('react-konva');
|
|
12
|
+
var useControlValue = require('@kne/use-control-value');
|
|
13
|
+
var useRefCallback = require('@kne/use-ref-callback');
|
|
14
|
+
var useImage = require('use-image');
|
|
15
|
+
var reactIntl = require('@kne/react-intl');
|
|
16
|
+
var pdfLib = require('pdf-lib');
|
|
17
|
+
var SignatureCanvas = require('react-signature-canvas');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
var useResize__default = /*#__PURE__*/_interopDefaultLegacy(useResize);
|
|
22
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
23
|
+
var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
|
|
24
|
+
var useRefCallback__default = /*#__PURE__*/_interopDefaultLegacy(useRefCallback);
|
|
25
|
+
var useImage__default = /*#__PURE__*/_interopDefaultLegacy(useImage);
|
|
26
|
+
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
27
|
+
|
|
28
|
+
function _extends() {
|
|
29
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
30
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
31
|
+
var t = arguments[e];
|
|
32
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
33
|
+
}
|
|
34
|
+
return n;
|
|
35
|
+
}, _extends.apply(null, arguments);
|
|
36
|
+
}
|
|
37
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
38
|
+
if (null == r) return {};
|
|
39
|
+
var t = {};
|
|
40
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
41
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
42
|
+
t[n] = r[n];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
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"};
|
|
48
|
+
|
|
49
|
+
const _excluded$3 = ["numPages"];
|
|
50
|
+
const PDFViewer = _ref => {
|
|
51
|
+
var _apis$file;
|
|
52
|
+
let {
|
|
53
|
+
className,
|
|
54
|
+
defaultPage,
|
|
55
|
+
apis: propsApis,
|
|
56
|
+
pdfjsUrl: pdfjsUrlProps,
|
|
57
|
+
url,
|
|
58
|
+
maxWidth = 1200,
|
|
59
|
+
children
|
|
60
|
+
} = _ref;
|
|
61
|
+
const {
|
|
62
|
+
apis: baseApis
|
|
63
|
+
} = globalContext.usePreset();
|
|
64
|
+
const apis = Object.assign({}, baseApis, propsApis);
|
|
65
|
+
const pdfjsUrl = pdfjsUrlProps || ((_apis$file = apis.file) == null ? void 0 : _apis$file.pdfjsUrl) || 'https://cdn.jsdelivr.net/npm/pdfjs-dist@5.4.296';
|
|
66
|
+
reactPdf.pdfjs.GlobalWorkerOptions.workerSrc = pdfjsUrl + '/build/pdf.worker.min.mjs';
|
|
67
|
+
const documentProps = react.useMemo(() => {
|
|
68
|
+
return {
|
|
69
|
+
file: url,
|
|
70
|
+
options: {
|
|
71
|
+
standardFontDataUrl: pdfjsUrl + '/standard_fonts/',
|
|
72
|
+
cMapUrl: pdfjsUrl + '/cmaps/',
|
|
73
|
+
cMapPacked: true
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, [pdfjsUrl, url]);
|
|
77
|
+
const [width, setWidth] = react.useState(maxWidth);
|
|
78
|
+
const [size, setSize] = react.useState(null);
|
|
79
|
+
const [pageSize, setPageSize] = react.useState(0);
|
|
80
|
+
const [currentPage, setCurrentPage] = react.useState(defaultPage || 1);
|
|
81
|
+
const ref = useResize__default["default"](() => {
|
|
82
|
+
if (ref.current && ref.current.clientWidth) {
|
|
83
|
+
setWidth(Math.min(ref.current.clientWidth, maxWidth));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
87
|
+
ref: ref,
|
|
88
|
+
className: classnames__default["default"](className, style['pdf-view-container'], 'pdf-view-container'),
|
|
89
|
+
style: {
|
|
90
|
+
maxWidth: maxWidth
|
|
91
|
+
},
|
|
92
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
93
|
+
className: classnames__default["default"](style['pdf-view'], 'pdf-view'),
|
|
94
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Document, _extends({}, Object.assign({}, documentProps), {
|
|
95
|
+
loading: /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
|
|
96
|
+
justify: "center",
|
|
97
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {})
|
|
98
|
+
}),
|
|
99
|
+
onLoadSuccess: _ref2 => {
|
|
100
|
+
let {
|
|
101
|
+
numPages
|
|
102
|
+
} = _ref2;
|
|
103
|
+
_objectWithoutPropertiesLoose(_ref2, _excluded$3);
|
|
104
|
+
setPageSize(numPages);
|
|
105
|
+
if (!Number.isInteger(defaultPage)) {
|
|
106
|
+
setCurrentPage(numPages);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Page, {
|
|
110
|
+
width: width,
|
|
111
|
+
pageNumber: currentPage,
|
|
112
|
+
renderTextLayer: true,
|
|
113
|
+
onLoadSuccess: page => {
|
|
114
|
+
setSize({
|
|
115
|
+
width: Math.round(page.width),
|
|
116
|
+
height: Math.round(page.height),
|
|
117
|
+
originalWidth: page.originalWidth,
|
|
118
|
+
originalHeight: page.originalHeight
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}))
|
|
123
|
+
}), size && children && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
124
|
+
className: classnames__default["default"](style['pdf-view-children'], 'pdf-view-children'),
|
|
125
|
+
children: typeof children === 'function' ? children({
|
|
126
|
+
size,
|
|
127
|
+
currentPage,
|
|
128
|
+
pageSize
|
|
129
|
+
}) : children
|
|
130
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
131
|
+
className: classnames__default["default"](style['pdf-view-page-control'], 'pdf-view-page-control'),
|
|
132
|
+
children: [currentPage > 1 && /*#__PURE__*/jsxRuntime.jsx(icons.LeftOutlined, {
|
|
133
|
+
className: classnames__default["default"](style['pdf-view-page-control-left'], 'pdf-view-page-control-left'),
|
|
134
|
+
onClick: () => {
|
|
135
|
+
setCurrentPage(currentPage - 1);
|
|
136
|
+
}
|
|
137
|
+
}), currentPage < pageSize && /*#__PURE__*/jsxRuntime.jsx(icons.RightOutlined, {
|
|
138
|
+
className: classnames__default["default"](style['pdf-view-page-control-right'], 'pdf-view-page-control-right'),
|
|
139
|
+
onClick: () => {
|
|
140
|
+
setCurrentPage(currentPage + 1);
|
|
141
|
+
}
|
|
142
|
+
}), pageSize ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
143
|
+
className: classnames__default["default"](style['pdf-view-page-control-current'], 'pdf-view-page-control-current'),
|
|
144
|
+
children: [currentPage, "/", pageSize]
|
|
145
|
+
}) : null]
|
|
146
|
+
})]
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const locale$1 = {
|
|
151
|
+
locationLayerPlaceholder: '签名区域',
|
|
152
|
+
loadingError: 'PDF尚未加载成功,请稍后重试',
|
|
153
|
+
signatureDefaultTitle: '签名',
|
|
154
|
+
signatureConfirmText: '确认',
|
|
155
|
+
signatureCancelText: '取消',
|
|
156
|
+
signatureEmptyError: '签名内容不能为空',
|
|
157
|
+
signatureSuccess: '签名成功'
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const locale = {
|
|
161
|
+
locationLayerPlaceholder: 'Signature Area',
|
|
162
|
+
loadingError: 'PDF is not loaded successfully, please try again later',
|
|
163
|
+
signatureDefaultTitle: 'Signature',
|
|
164
|
+
signatureConfirmText: 'Confirm',
|
|
165
|
+
signatureCancelText: 'Cancel',
|
|
166
|
+
signatureEmptyError: 'Signature content cannot be empty',
|
|
167
|
+
signatureSuccess: 'Signature Success'
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const withLocale = reactIntl.createWithIntlProvider({
|
|
171
|
+
defaultLocale: 'zh-CN',
|
|
172
|
+
messages: {
|
|
173
|
+
'zh-CN': locale$1,
|
|
174
|
+
'en-US': locale
|
|
175
|
+
},
|
|
176
|
+
namespace: 'react-pdf-sign'
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const _excluded$2 = ["width", "height", "padding", "stageWidth", "stageHeight", "placeholder", "signature"];
|
|
180
|
+
const LocationLayer = withLocale(p => {
|
|
181
|
+
const {
|
|
182
|
+
formatMessage
|
|
183
|
+
} = reactIntl.useIntl();
|
|
184
|
+
const {
|
|
185
|
+
width = 200,
|
|
186
|
+
height = 50,
|
|
187
|
+
padding = 8,
|
|
188
|
+
stageWidth,
|
|
189
|
+
stageHeight,
|
|
190
|
+
placeholder = formatMessage({
|
|
191
|
+
id: 'locationLayerPlaceholder'
|
|
192
|
+
}),
|
|
193
|
+
signature
|
|
194
|
+
} = p,
|
|
195
|
+
props = _objectWithoutPropertiesLoose(p, _excluded$2);
|
|
196
|
+
const [value, setValue] = useControlValue__default["default"](props);
|
|
197
|
+
const [isInit, setIsInit] = react.useState(false);
|
|
198
|
+
const [signatureImage] = useImage__default["default"](signature);
|
|
199
|
+
const groupRef = react.useRef();
|
|
200
|
+
const signRef = react.useRef();
|
|
201
|
+
const transformerRef = react.useRef();
|
|
202
|
+
const computedSignLocation = () => {
|
|
203
|
+
const absolutePosition = signRef.current.absolutePosition();
|
|
204
|
+
const size = signRef.current.getClientRect();
|
|
205
|
+
setValue({
|
|
206
|
+
size: {
|
|
207
|
+
width: Math.round(size.width),
|
|
208
|
+
height: Math.round(size.height),
|
|
209
|
+
x: Math.round(absolutePosition.x),
|
|
210
|
+
y: Math.round(absolutePosition.y)
|
|
211
|
+
},
|
|
212
|
+
scaleX: Number(transformerRef.current.attrs.scaleX.toFixed(2)),
|
|
213
|
+
scaleY: Number(transformerRef.current.attrs.scaleY.toFixed(2)),
|
|
214
|
+
x: Math.round(groupRef.current.attrs.x),
|
|
215
|
+
y: Math.round(groupRef.current.attrs.y)
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const initValue = useRefCallback__default["default"](() => {
|
|
219
|
+
if (['scaleX', 'scaleY', 'x', 'y', 'size'].some(name => !Object.assign({}, value).hasOwnProperty(name))) {
|
|
220
|
+
setValue({
|
|
221
|
+
scaleX: 1,
|
|
222
|
+
scaleY: 1,
|
|
223
|
+
x: Math.round((stageWidth - width) / 2),
|
|
224
|
+
y: Math.round((stageHeight - height) / 2),
|
|
225
|
+
size: {
|
|
226
|
+
width,
|
|
227
|
+
height,
|
|
228
|
+
x: Math.round((stageWidth - width) / 2),
|
|
229
|
+
y: Math.round((stageHeight - height) / 2)
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
setIsInit(true);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
const themeColor = react.useMemo(() => {
|
|
236
|
+
const el = document.createElement('div');
|
|
237
|
+
el.style.color = 'var(--primary-color)';
|
|
238
|
+
document.body.appendChild(el);
|
|
239
|
+
const color = window.getComputedStyle(el).color;
|
|
240
|
+
document.body.removeChild(el);
|
|
241
|
+
return color;
|
|
242
|
+
}, []);
|
|
243
|
+
react.useEffect(() => {
|
|
244
|
+
initValue();
|
|
245
|
+
}, []);
|
|
246
|
+
react.useEffect(() => {
|
|
247
|
+
if (isInit) {
|
|
248
|
+
transformerRef.current.nodes([groupRef.current]);
|
|
249
|
+
}
|
|
250
|
+
}, [isInit]);
|
|
251
|
+
if (!(isInit && value)) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactKonva.Stage, {
|
|
255
|
+
width: stageWidth,
|
|
256
|
+
height: stageHeight,
|
|
257
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(reactKonva.Layer, {
|
|
258
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(reactKonva.Group, {
|
|
259
|
+
x: value.x,
|
|
260
|
+
y: value.y,
|
|
261
|
+
draggable: true,
|
|
262
|
+
ref: groupRef,
|
|
263
|
+
onDragEnd: computedSignLocation,
|
|
264
|
+
onTransformEnd: computedSignLocation,
|
|
265
|
+
children: [signatureImage ? /*#__PURE__*/jsxRuntime.jsx(reactKonva.Image, {
|
|
266
|
+
width: width,
|
|
267
|
+
height: height,
|
|
268
|
+
image: signatureImage,
|
|
269
|
+
cornerRadius: 8,
|
|
270
|
+
ref: signRef
|
|
271
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(reactKonva.Rect, {
|
|
272
|
+
width: width,
|
|
273
|
+
height: height,
|
|
274
|
+
fill: "#f0f0f0",
|
|
275
|
+
cornerRadius: 8,
|
|
276
|
+
ref: signRef
|
|
277
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactKonva.Text, {
|
|
278
|
+
text: signatureImage ? '' : placeholder,
|
|
279
|
+
fontSize: 16,
|
|
280
|
+
fill: "#666666",
|
|
281
|
+
fontFamily: "Arial",
|
|
282
|
+
align: "center",
|
|
283
|
+
verticalAlign: "middle",
|
|
284
|
+
width: width,
|
|
285
|
+
height: height
|
|
286
|
+
})]
|
|
287
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactKonva.Transformer, {
|
|
288
|
+
scaleX: value.scaleX,
|
|
289
|
+
scaleY: value.scaleY,
|
|
290
|
+
centeredScaling: true,
|
|
291
|
+
ref: transformerRef,
|
|
292
|
+
keepRatio: true,
|
|
293
|
+
flipEnabled: false,
|
|
294
|
+
rotateEnabled: false,
|
|
295
|
+
borderStroke: themeColor,
|
|
296
|
+
rotateAnchorStroke: themeColor,
|
|
297
|
+
anchorStroke: themeColor,
|
|
298
|
+
padding: padding,
|
|
299
|
+
enabledAnchors: ['top-left', 'top-right', 'bottom-left', 'bottom-right']
|
|
300
|
+
})]
|
|
301
|
+
})
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Removes all key-value entries from the list cache.
|
|
307
|
+
*
|
|
308
|
+
* @private
|
|
309
|
+
* @name clear
|
|
310
|
+
* @memberOf ListCache
|
|
311
|
+
*/
|
|
312
|
+
function listCacheClear() {
|
|
313
|
+
this.__data__ = [];
|
|
314
|
+
this.size = 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
var _listCacheClear = listCacheClear;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Performs a
|
|
321
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
322
|
+
* comparison between two values to determine if they are equivalent.
|
|
323
|
+
*
|
|
324
|
+
* @static
|
|
325
|
+
* @memberOf _
|
|
326
|
+
* @since 4.0.0
|
|
327
|
+
* @category Lang
|
|
328
|
+
* @param {*} value The value to compare.
|
|
329
|
+
* @param {*} other The other value to compare.
|
|
330
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
331
|
+
* @example
|
|
332
|
+
*
|
|
333
|
+
* var object = { 'a': 1 };
|
|
334
|
+
* var other = { 'a': 1 };
|
|
335
|
+
*
|
|
336
|
+
* _.eq(object, object);
|
|
337
|
+
* // => true
|
|
338
|
+
*
|
|
339
|
+
* _.eq(object, other);
|
|
340
|
+
* // => false
|
|
341
|
+
*
|
|
342
|
+
* _.eq('a', 'a');
|
|
343
|
+
* // => true
|
|
344
|
+
*
|
|
345
|
+
* _.eq('a', Object('a'));
|
|
346
|
+
* // => false
|
|
347
|
+
*
|
|
348
|
+
* _.eq(NaN, NaN);
|
|
349
|
+
* // => true
|
|
350
|
+
*/
|
|
351
|
+
function eq(value, other) {
|
|
352
|
+
return value === other || (value !== value && other !== other);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
var eq_1 = eq;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
359
|
+
*
|
|
360
|
+
* @private
|
|
361
|
+
* @param {Array} array The array to inspect.
|
|
362
|
+
* @param {*} key The key to search for.
|
|
363
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
364
|
+
*/
|
|
365
|
+
function assocIndexOf(array, key) {
|
|
366
|
+
var length = array.length;
|
|
367
|
+
while (length--) {
|
|
368
|
+
if (eq_1(array[length][0], key)) {
|
|
369
|
+
return length;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return -1;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
var _assocIndexOf = assocIndexOf;
|
|
376
|
+
|
|
377
|
+
/** Used for built-in method references. */
|
|
378
|
+
var arrayProto = Array.prototype;
|
|
379
|
+
|
|
380
|
+
/** Built-in value references. */
|
|
381
|
+
var splice = arrayProto.splice;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Removes `key` and its value from the list cache.
|
|
385
|
+
*
|
|
386
|
+
* @private
|
|
387
|
+
* @name delete
|
|
388
|
+
* @memberOf ListCache
|
|
389
|
+
* @param {string} key The key of the value to remove.
|
|
390
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
391
|
+
*/
|
|
392
|
+
function listCacheDelete(key) {
|
|
393
|
+
var data = this.__data__,
|
|
394
|
+
index = _assocIndexOf(data, key);
|
|
395
|
+
|
|
396
|
+
if (index < 0) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
var lastIndex = data.length - 1;
|
|
400
|
+
if (index == lastIndex) {
|
|
401
|
+
data.pop();
|
|
402
|
+
} else {
|
|
403
|
+
splice.call(data, index, 1);
|
|
404
|
+
}
|
|
405
|
+
--this.size;
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var _listCacheDelete = listCacheDelete;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Gets the list cache value for `key`.
|
|
413
|
+
*
|
|
414
|
+
* @private
|
|
415
|
+
* @name get
|
|
416
|
+
* @memberOf ListCache
|
|
417
|
+
* @param {string} key The key of the value to get.
|
|
418
|
+
* @returns {*} Returns the entry value.
|
|
419
|
+
*/
|
|
420
|
+
function listCacheGet(key) {
|
|
421
|
+
var data = this.__data__,
|
|
422
|
+
index = _assocIndexOf(data, key);
|
|
423
|
+
|
|
424
|
+
return index < 0 ? undefined : data[index][1];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
var _listCacheGet = listCacheGet;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Checks if a list cache value for `key` exists.
|
|
431
|
+
*
|
|
432
|
+
* @private
|
|
433
|
+
* @name has
|
|
434
|
+
* @memberOf ListCache
|
|
435
|
+
* @param {string} key The key of the entry to check.
|
|
436
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
437
|
+
*/
|
|
438
|
+
function listCacheHas(key) {
|
|
439
|
+
return _assocIndexOf(this.__data__, key) > -1;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
var _listCacheHas = listCacheHas;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Sets the list cache `key` to `value`.
|
|
446
|
+
*
|
|
447
|
+
* @private
|
|
448
|
+
* @name set
|
|
449
|
+
* @memberOf ListCache
|
|
450
|
+
* @param {string} key The key of the value to set.
|
|
451
|
+
* @param {*} value The value to set.
|
|
452
|
+
* @returns {Object} Returns the list cache instance.
|
|
453
|
+
*/
|
|
454
|
+
function listCacheSet(key, value) {
|
|
455
|
+
var data = this.__data__,
|
|
456
|
+
index = _assocIndexOf(data, key);
|
|
457
|
+
|
|
458
|
+
if (index < 0) {
|
|
459
|
+
++this.size;
|
|
460
|
+
data.push([key, value]);
|
|
461
|
+
} else {
|
|
462
|
+
data[index][1] = value;
|
|
463
|
+
}
|
|
464
|
+
return this;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
var _listCacheSet = listCacheSet;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Creates an list cache object.
|
|
471
|
+
*
|
|
472
|
+
* @private
|
|
473
|
+
* @constructor
|
|
474
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
475
|
+
*/
|
|
476
|
+
function ListCache(entries) {
|
|
477
|
+
var index = -1,
|
|
478
|
+
length = entries == null ? 0 : entries.length;
|
|
479
|
+
|
|
480
|
+
this.clear();
|
|
481
|
+
while (++index < length) {
|
|
482
|
+
var entry = entries[index];
|
|
483
|
+
this.set(entry[0], entry[1]);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Add methods to `ListCache`.
|
|
488
|
+
ListCache.prototype.clear = _listCacheClear;
|
|
489
|
+
ListCache.prototype['delete'] = _listCacheDelete;
|
|
490
|
+
ListCache.prototype.get = _listCacheGet;
|
|
491
|
+
ListCache.prototype.has = _listCacheHas;
|
|
492
|
+
ListCache.prototype.set = _listCacheSet;
|
|
493
|
+
|
|
494
|
+
var _ListCache = ListCache;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Removes all key-value entries from the stack.
|
|
498
|
+
*
|
|
499
|
+
* @private
|
|
500
|
+
* @name clear
|
|
501
|
+
* @memberOf Stack
|
|
502
|
+
*/
|
|
503
|
+
function stackClear() {
|
|
504
|
+
this.__data__ = new _ListCache;
|
|
505
|
+
this.size = 0;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
var _stackClear = stackClear;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Removes `key` and its value from the stack.
|
|
512
|
+
*
|
|
513
|
+
* @private
|
|
514
|
+
* @name delete
|
|
515
|
+
* @memberOf Stack
|
|
516
|
+
* @param {string} key The key of the value to remove.
|
|
517
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
518
|
+
*/
|
|
519
|
+
function stackDelete(key) {
|
|
520
|
+
var data = this.__data__,
|
|
521
|
+
result = data['delete'](key);
|
|
522
|
+
|
|
523
|
+
this.size = data.size;
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
var _stackDelete = stackDelete;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Gets the stack value for `key`.
|
|
531
|
+
*
|
|
532
|
+
* @private
|
|
533
|
+
* @name get
|
|
534
|
+
* @memberOf Stack
|
|
535
|
+
* @param {string} key The key of the value to get.
|
|
536
|
+
* @returns {*} Returns the entry value.
|
|
537
|
+
*/
|
|
538
|
+
function stackGet(key) {
|
|
539
|
+
return this.__data__.get(key);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
var _stackGet = stackGet;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Checks if a stack value for `key` exists.
|
|
546
|
+
*
|
|
547
|
+
* @private
|
|
548
|
+
* @name has
|
|
549
|
+
* @memberOf Stack
|
|
550
|
+
* @param {string} key The key of the entry to check.
|
|
551
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
552
|
+
*/
|
|
553
|
+
function stackHas(key) {
|
|
554
|
+
return this.__data__.has(key);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
var _stackHas = stackHas;
|
|
558
|
+
|
|
559
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
560
|
+
|
|
561
|
+
function createCommonjsModule(fn) {
|
|
562
|
+
var module = { exports: {} };
|
|
563
|
+
return fn(module, module.exports), module.exports;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** Detect free variable `global` from Node.js. */
|
|
567
|
+
|
|
568
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
569
|
+
|
|
570
|
+
var _freeGlobal = freeGlobal;
|
|
571
|
+
|
|
572
|
+
/** Detect free variable `self`. */
|
|
573
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
574
|
+
|
|
575
|
+
/** Used as a reference to the global object. */
|
|
576
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
577
|
+
|
|
578
|
+
var _root = root;
|
|
579
|
+
|
|
580
|
+
/** Built-in value references. */
|
|
581
|
+
var Symbol = _root.Symbol;
|
|
582
|
+
|
|
583
|
+
var _Symbol = Symbol;
|
|
584
|
+
|
|
585
|
+
/** Used for built-in method references. */
|
|
586
|
+
var objectProto$b = Object.prototype;
|
|
587
|
+
|
|
588
|
+
/** Used to check objects for own properties. */
|
|
589
|
+
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Used to resolve the
|
|
593
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
594
|
+
* of values.
|
|
595
|
+
*/
|
|
596
|
+
var nativeObjectToString$1 = objectProto$b.toString;
|
|
597
|
+
|
|
598
|
+
/** Built-in value references. */
|
|
599
|
+
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
603
|
+
*
|
|
604
|
+
* @private
|
|
605
|
+
* @param {*} value The value to query.
|
|
606
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
607
|
+
*/
|
|
608
|
+
function getRawTag(value) {
|
|
609
|
+
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
610
|
+
tag = value[symToStringTag$1];
|
|
611
|
+
|
|
612
|
+
try {
|
|
613
|
+
value[symToStringTag$1] = undefined;
|
|
614
|
+
var unmasked = true;
|
|
615
|
+
} catch (e) {}
|
|
616
|
+
|
|
617
|
+
var result = nativeObjectToString$1.call(value);
|
|
618
|
+
if (unmasked) {
|
|
619
|
+
if (isOwn) {
|
|
620
|
+
value[symToStringTag$1] = tag;
|
|
621
|
+
} else {
|
|
622
|
+
delete value[symToStringTag$1];
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
return result;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
var _getRawTag = getRawTag;
|
|
629
|
+
|
|
630
|
+
/** Used for built-in method references. */
|
|
631
|
+
var objectProto$a = Object.prototype;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Used to resolve the
|
|
635
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
636
|
+
* of values.
|
|
637
|
+
*/
|
|
638
|
+
var nativeObjectToString = objectProto$a.toString;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
642
|
+
*
|
|
643
|
+
* @private
|
|
644
|
+
* @param {*} value The value to convert.
|
|
645
|
+
* @returns {string} Returns the converted string.
|
|
646
|
+
*/
|
|
647
|
+
function objectToString(value) {
|
|
648
|
+
return nativeObjectToString.call(value);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
var _objectToString = objectToString;
|
|
652
|
+
|
|
653
|
+
/** `Object#toString` result references. */
|
|
654
|
+
var nullTag = '[object Null]',
|
|
655
|
+
undefinedTag = '[object Undefined]';
|
|
656
|
+
|
|
657
|
+
/** Built-in value references. */
|
|
658
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
662
|
+
*
|
|
663
|
+
* @private
|
|
664
|
+
* @param {*} value The value to query.
|
|
665
|
+
* @returns {string} Returns the `toStringTag`.
|
|
666
|
+
*/
|
|
667
|
+
function baseGetTag(value) {
|
|
668
|
+
if (value == null) {
|
|
669
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
670
|
+
}
|
|
671
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
672
|
+
? _getRawTag(value)
|
|
673
|
+
: _objectToString(value);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
var _baseGetTag = baseGetTag;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Checks if `value` is the
|
|
680
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
681
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
682
|
+
*
|
|
683
|
+
* @static
|
|
684
|
+
* @memberOf _
|
|
685
|
+
* @since 0.1.0
|
|
686
|
+
* @category Lang
|
|
687
|
+
* @param {*} value The value to check.
|
|
688
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
689
|
+
* @example
|
|
690
|
+
*
|
|
691
|
+
* _.isObject({});
|
|
692
|
+
* // => true
|
|
693
|
+
*
|
|
694
|
+
* _.isObject([1, 2, 3]);
|
|
695
|
+
* // => true
|
|
696
|
+
*
|
|
697
|
+
* _.isObject(_.noop);
|
|
698
|
+
* // => true
|
|
699
|
+
*
|
|
700
|
+
* _.isObject(null);
|
|
701
|
+
* // => false
|
|
702
|
+
*/
|
|
703
|
+
function isObject(value) {
|
|
704
|
+
var type = typeof value;
|
|
705
|
+
return value != null && (type == 'object' || type == 'function');
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
var isObject_1 = isObject;
|
|
709
|
+
|
|
710
|
+
/** `Object#toString` result references. */
|
|
711
|
+
var asyncTag = '[object AsyncFunction]',
|
|
712
|
+
funcTag$1 = '[object Function]',
|
|
713
|
+
genTag = '[object GeneratorFunction]',
|
|
714
|
+
proxyTag = '[object Proxy]';
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Checks if `value` is classified as a `Function` object.
|
|
718
|
+
*
|
|
719
|
+
* @static
|
|
720
|
+
* @memberOf _
|
|
721
|
+
* @since 0.1.0
|
|
722
|
+
* @category Lang
|
|
723
|
+
* @param {*} value The value to check.
|
|
724
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
725
|
+
* @example
|
|
726
|
+
*
|
|
727
|
+
* _.isFunction(_);
|
|
728
|
+
* // => true
|
|
729
|
+
*
|
|
730
|
+
* _.isFunction(/abc/);
|
|
731
|
+
* // => false
|
|
732
|
+
*/
|
|
733
|
+
function isFunction(value) {
|
|
734
|
+
if (!isObject_1(value)) {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
738
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
739
|
+
var tag = _baseGetTag(value);
|
|
740
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
var isFunction_1 = isFunction;
|
|
744
|
+
|
|
745
|
+
/** Used to detect overreaching core-js shims. */
|
|
746
|
+
var coreJsData = _root['__core-js_shared__'];
|
|
747
|
+
|
|
748
|
+
var _coreJsData = coreJsData;
|
|
749
|
+
|
|
750
|
+
/** Used to detect methods masquerading as native. */
|
|
751
|
+
var maskSrcKey = (function() {
|
|
752
|
+
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
|
753
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
754
|
+
}());
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Checks if `func` has its source masked.
|
|
758
|
+
*
|
|
759
|
+
* @private
|
|
760
|
+
* @param {Function} func The function to check.
|
|
761
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
762
|
+
*/
|
|
763
|
+
function isMasked(func) {
|
|
764
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
var _isMasked = isMasked;
|
|
768
|
+
|
|
769
|
+
/** Used for built-in method references. */
|
|
770
|
+
var funcProto$1 = Function.prototype;
|
|
771
|
+
|
|
772
|
+
/** Used to resolve the decompiled source of functions. */
|
|
773
|
+
var funcToString$1 = funcProto$1.toString;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Converts `func` to its source code.
|
|
777
|
+
*
|
|
778
|
+
* @private
|
|
779
|
+
* @param {Function} func The function to convert.
|
|
780
|
+
* @returns {string} Returns the source code.
|
|
781
|
+
*/
|
|
782
|
+
function toSource(func) {
|
|
783
|
+
if (func != null) {
|
|
784
|
+
try {
|
|
785
|
+
return funcToString$1.call(func);
|
|
786
|
+
} catch (e) {}
|
|
787
|
+
try {
|
|
788
|
+
return (func + '');
|
|
789
|
+
} catch (e) {}
|
|
790
|
+
}
|
|
791
|
+
return '';
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
var _toSource = toSource;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Used to match `RegExp`
|
|
798
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
799
|
+
*/
|
|
800
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
801
|
+
|
|
802
|
+
/** Used to detect host constructors (Safari). */
|
|
803
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
804
|
+
|
|
805
|
+
/** Used for built-in method references. */
|
|
806
|
+
var funcProto = Function.prototype,
|
|
807
|
+
objectProto$9 = Object.prototype;
|
|
808
|
+
|
|
809
|
+
/** Used to resolve the decompiled source of functions. */
|
|
810
|
+
var funcToString = funcProto.toString;
|
|
811
|
+
|
|
812
|
+
/** Used to check objects for own properties. */
|
|
813
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
814
|
+
|
|
815
|
+
/** Used to detect if a method is native. */
|
|
816
|
+
var reIsNative = RegExp('^' +
|
|
817
|
+
funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
|
|
818
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
823
|
+
*
|
|
824
|
+
* @private
|
|
825
|
+
* @param {*} value The value to check.
|
|
826
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
827
|
+
* else `false`.
|
|
828
|
+
*/
|
|
829
|
+
function baseIsNative(value) {
|
|
830
|
+
if (!isObject_1(value) || _isMasked(value)) {
|
|
831
|
+
return false;
|
|
832
|
+
}
|
|
833
|
+
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
|
|
834
|
+
return pattern.test(_toSource(value));
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
var _baseIsNative = baseIsNative;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Gets the value at `key` of `object`.
|
|
841
|
+
*
|
|
842
|
+
* @private
|
|
843
|
+
* @param {Object} [object] The object to query.
|
|
844
|
+
* @param {string} key The key of the property to get.
|
|
845
|
+
* @returns {*} Returns the property value.
|
|
846
|
+
*/
|
|
847
|
+
function getValue(object, key) {
|
|
848
|
+
return object == null ? undefined : object[key];
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
var _getValue = getValue;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Gets the native function at `key` of `object`.
|
|
855
|
+
*
|
|
856
|
+
* @private
|
|
857
|
+
* @param {Object} object The object to query.
|
|
858
|
+
* @param {string} key The key of the method to get.
|
|
859
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
860
|
+
*/
|
|
861
|
+
function getNative(object, key) {
|
|
862
|
+
var value = _getValue(object, key);
|
|
863
|
+
return _baseIsNative(value) ? value : undefined;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
var _getNative = getNative;
|
|
867
|
+
|
|
868
|
+
/* Built-in method references that are verified to be native. */
|
|
869
|
+
var Map = _getNative(_root, 'Map');
|
|
870
|
+
|
|
871
|
+
var _Map = Map;
|
|
872
|
+
|
|
873
|
+
/* Built-in method references that are verified to be native. */
|
|
874
|
+
var nativeCreate = _getNative(Object, 'create');
|
|
875
|
+
|
|
876
|
+
var _nativeCreate = nativeCreate;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Removes all key-value entries from the hash.
|
|
880
|
+
*
|
|
881
|
+
* @private
|
|
882
|
+
* @name clear
|
|
883
|
+
* @memberOf Hash
|
|
884
|
+
*/
|
|
885
|
+
function hashClear() {
|
|
886
|
+
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
887
|
+
this.size = 0;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
var _hashClear = hashClear;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Removes `key` and its value from the hash.
|
|
894
|
+
*
|
|
895
|
+
* @private
|
|
896
|
+
* @name delete
|
|
897
|
+
* @memberOf Hash
|
|
898
|
+
* @param {Object} hash The hash to modify.
|
|
899
|
+
* @param {string} key The key of the value to remove.
|
|
900
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
901
|
+
*/
|
|
902
|
+
function hashDelete(key) {
|
|
903
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
904
|
+
this.size -= result ? 1 : 0;
|
|
905
|
+
return result;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
var _hashDelete = hashDelete;
|
|
909
|
+
|
|
910
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
911
|
+
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
912
|
+
|
|
913
|
+
/** Used for built-in method references. */
|
|
914
|
+
var objectProto$8 = Object.prototype;
|
|
915
|
+
|
|
916
|
+
/** Used to check objects for own properties. */
|
|
917
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Gets the hash value for `key`.
|
|
921
|
+
*
|
|
922
|
+
* @private
|
|
923
|
+
* @name get
|
|
924
|
+
* @memberOf Hash
|
|
925
|
+
* @param {string} key The key of the value to get.
|
|
926
|
+
* @returns {*} Returns the entry value.
|
|
927
|
+
*/
|
|
928
|
+
function hashGet(key) {
|
|
929
|
+
var data = this.__data__;
|
|
930
|
+
if (_nativeCreate) {
|
|
931
|
+
var result = data[key];
|
|
932
|
+
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
933
|
+
}
|
|
934
|
+
return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
var _hashGet = hashGet;
|
|
938
|
+
|
|
939
|
+
/** Used for built-in method references. */
|
|
940
|
+
var objectProto$7 = Object.prototype;
|
|
941
|
+
|
|
942
|
+
/** Used to check objects for own properties. */
|
|
943
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Checks if a hash value for `key` exists.
|
|
947
|
+
*
|
|
948
|
+
* @private
|
|
949
|
+
* @name has
|
|
950
|
+
* @memberOf Hash
|
|
951
|
+
* @param {string} key The key of the entry to check.
|
|
952
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
953
|
+
*/
|
|
954
|
+
function hashHas(key) {
|
|
955
|
+
var data = this.__data__;
|
|
956
|
+
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
var _hashHas = hashHas;
|
|
960
|
+
|
|
961
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
962
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Sets the hash `key` to `value`.
|
|
966
|
+
*
|
|
967
|
+
* @private
|
|
968
|
+
* @name set
|
|
969
|
+
* @memberOf Hash
|
|
970
|
+
* @param {string} key The key of the value to set.
|
|
971
|
+
* @param {*} value The value to set.
|
|
972
|
+
* @returns {Object} Returns the hash instance.
|
|
973
|
+
*/
|
|
974
|
+
function hashSet(key, value) {
|
|
975
|
+
var data = this.__data__;
|
|
976
|
+
this.size += this.has(key) ? 0 : 1;
|
|
977
|
+
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
978
|
+
return this;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
var _hashSet = hashSet;
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Creates a hash object.
|
|
985
|
+
*
|
|
986
|
+
* @private
|
|
987
|
+
* @constructor
|
|
988
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
989
|
+
*/
|
|
990
|
+
function Hash(entries) {
|
|
991
|
+
var index = -1,
|
|
992
|
+
length = entries == null ? 0 : entries.length;
|
|
993
|
+
|
|
994
|
+
this.clear();
|
|
995
|
+
while (++index < length) {
|
|
996
|
+
var entry = entries[index];
|
|
997
|
+
this.set(entry[0], entry[1]);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// Add methods to `Hash`.
|
|
1002
|
+
Hash.prototype.clear = _hashClear;
|
|
1003
|
+
Hash.prototype['delete'] = _hashDelete;
|
|
1004
|
+
Hash.prototype.get = _hashGet;
|
|
1005
|
+
Hash.prototype.has = _hashHas;
|
|
1006
|
+
Hash.prototype.set = _hashSet;
|
|
1007
|
+
|
|
1008
|
+
var _Hash = Hash;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Removes all key-value entries from the map.
|
|
1012
|
+
*
|
|
1013
|
+
* @private
|
|
1014
|
+
* @name clear
|
|
1015
|
+
* @memberOf MapCache
|
|
1016
|
+
*/
|
|
1017
|
+
function mapCacheClear() {
|
|
1018
|
+
this.size = 0;
|
|
1019
|
+
this.__data__ = {
|
|
1020
|
+
'hash': new _Hash,
|
|
1021
|
+
'map': new (_Map || _ListCache),
|
|
1022
|
+
'string': new _Hash
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
var _mapCacheClear = mapCacheClear;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
1030
|
+
*
|
|
1031
|
+
* @private
|
|
1032
|
+
* @param {*} value The value to check.
|
|
1033
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
1034
|
+
*/
|
|
1035
|
+
function isKeyable(value) {
|
|
1036
|
+
var type = typeof value;
|
|
1037
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
1038
|
+
? (value !== '__proto__')
|
|
1039
|
+
: (value === null);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
var _isKeyable = isKeyable;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Gets the data for `map`.
|
|
1046
|
+
*
|
|
1047
|
+
* @private
|
|
1048
|
+
* @param {Object} map The map to query.
|
|
1049
|
+
* @param {string} key The reference key.
|
|
1050
|
+
* @returns {*} Returns the map data.
|
|
1051
|
+
*/
|
|
1052
|
+
function getMapData(map, key) {
|
|
1053
|
+
var data = map.__data__;
|
|
1054
|
+
return _isKeyable(key)
|
|
1055
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1056
|
+
: data.map;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
var _getMapData = getMapData;
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Removes `key` and its value from the map.
|
|
1063
|
+
*
|
|
1064
|
+
* @private
|
|
1065
|
+
* @name delete
|
|
1066
|
+
* @memberOf MapCache
|
|
1067
|
+
* @param {string} key The key of the value to remove.
|
|
1068
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1069
|
+
*/
|
|
1070
|
+
function mapCacheDelete(key) {
|
|
1071
|
+
var result = _getMapData(this, key)['delete'](key);
|
|
1072
|
+
this.size -= result ? 1 : 0;
|
|
1073
|
+
return result;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
var _mapCacheDelete = mapCacheDelete;
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Gets the map value for `key`.
|
|
1080
|
+
*
|
|
1081
|
+
* @private
|
|
1082
|
+
* @name get
|
|
1083
|
+
* @memberOf MapCache
|
|
1084
|
+
* @param {string} key The key of the value to get.
|
|
1085
|
+
* @returns {*} Returns the entry value.
|
|
1086
|
+
*/
|
|
1087
|
+
function mapCacheGet(key) {
|
|
1088
|
+
return _getMapData(this, key).get(key);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
var _mapCacheGet = mapCacheGet;
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Checks if a map value for `key` exists.
|
|
1095
|
+
*
|
|
1096
|
+
* @private
|
|
1097
|
+
* @name has
|
|
1098
|
+
* @memberOf MapCache
|
|
1099
|
+
* @param {string} key The key of the entry to check.
|
|
1100
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1101
|
+
*/
|
|
1102
|
+
function mapCacheHas(key) {
|
|
1103
|
+
return _getMapData(this, key).has(key);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
var _mapCacheHas = mapCacheHas;
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Sets the map `key` to `value`.
|
|
1110
|
+
*
|
|
1111
|
+
* @private
|
|
1112
|
+
* @name set
|
|
1113
|
+
* @memberOf MapCache
|
|
1114
|
+
* @param {string} key The key of the value to set.
|
|
1115
|
+
* @param {*} value The value to set.
|
|
1116
|
+
* @returns {Object} Returns the map cache instance.
|
|
1117
|
+
*/
|
|
1118
|
+
function mapCacheSet(key, value) {
|
|
1119
|
+
var data = _getMapData(this, key),
|
|
1120
|
+
size = data.size;
|
|
1121
|
+
|
|
1122
|
+
data.set(key, value);
|
|
1123
|
+
this.size += data.size == size ? 0 : 1;
|
|
1124
|
+
return this;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
var _mapCacheSet = mapCacheSet;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Creates a map cache object to store key-value pairs.
|
|
1131
|
+
*
|
|
1132
|
+
* @private
|
|
1133
|
+
* @constructor
|
|
1134
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1135
|
+
*/
|
|
1136
|
+
function MapCache(entries) {
|
|
1137
|
+
var index = -1,
|
|
1138
|
+
length = entries == null ? 0 : entries.length;
|
|
1139
|
+
|
|
1140
|
+
this.clear();
|
|
1141
|
+
while (++index < length) {
|
|
1142
|
+
var entry = entries[index];
|
|
1143
|
+
this.set(entry[0], entry[1]);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
// Add methods to `MapCache`.
|
|
1148
|
+
MapCache.prototype.clear = _mapCacheClear;
|
|
1149
|
+
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1150
|
+
MapCache.prototype.get = _mapCacheGet;
|
|
1151
|
+
MapCache.prototype.has = _mapCacheHas;
|
|
1152
|
+
MapCache.prototype.set = _mapCacheSet;
|
|
1153
|
+
|
|
1154
|
+
var _MapCache = MapCache;
|
|
1155
|
+
|
|
1156
|
+
/** Used as the size to enable large array optimizations. */
|
|
1157
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Sets the stack `key` to `value`.
|
|
1161
|
+
*
|
|
1162
|
+
* @private
|
|
1163
|
+
* @name set
|
|
1164
|
+
* @memberOf Stack
|
|
1165
|
+
* @param {string} key The key of the value to set.
|
|
1166
|
+
* @param {*} value The value to set.
|
|
1167
|
+
* @returns {Object} Returns the stack cache instance.
|
|
1168
|
+
*/
|
|
1169
|
+
function stackSet(key, value) {
|
|
1170
|
+
var data = this.__data__;
|
|
1171
|
+
if (data instanceof _ListCache) {
|
|
1172
|
+
var pairs = data.__data__;
|
|
1173
|
+
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1174
|
+
pairs.push([key, value]);
|
|
1175
|
+
this.size = ++data.size;
|
|
1176
|
+
return this;
|
|
1177
|
+
}
|
|
1178
|
+
data = this.__data__ = new _MapCache(pairs);
|
|
1179
|
+
}
|
|
1180
|
+
data.set(key, value);
|
|
1181
|
+
this.size = data.size;
|
|
1182
|
+
return this;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
var _stackSet = stackSet;
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Creates a stack cache object to store key-value pairs.
|
|
1189
|
+
*
|
|
1190
|
+
* @private
|
|
1191
|
+
* @constructor
|
|
1192
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
1193
|
+
*/
|
|
1194
|
+
function Stack(entries) {
|
|
1195
|
+
var data = this.__data__ = new _ListCache(entries);
|
|
1196
|
+
this.size = data.size;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
// Add methods to `Stack`.
|
|
1200
|
+
Stack.prototype.clear = _stackClear;
|
|
1201
|
+
Stack.prototype['delete'] = _stackDelete;
|
|
1202
|
+
Stack.prototype.get = _stackGet;
|
|
1203
|
+
Stack.prototype.has = _stackHas;
|
|
1204
|
+
Stack.prototype.set = _stackSet;
|
|
1205
|
+
|
|
1206
|
+
var _Stack = Stack;
|
|
1207
|
+
|
|
1208
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
1209
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Adds `value` to the array cache.
|
|
1213
|
+
*
|
|
1214
|
+
* @private
|
|
1215
|
+
* @name add
|
|
1216
|
+
* @memberOf SetCache
|
|
1217
|
+
* @alias push
|
|
1218
|
+
* @param {*} value The value to cache.
|
|
1219
|
+
* @returns {Object} Returns the cache instance.
|
|
1220
|
+
*/
|
|
1221
|
+
function setCacheAdd(value) {
|
|
1222
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
1223
|
+
return this;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
var _setCacheAdd = setCacheAdd;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Checks if `value` is in the array cache.
|
|
1230
|
+
*
|
|
1231
|
+
* @private
|
|
1232
|
+
* @name has
|
|
1233
|
+
* @memberOf SetCache
|
|
1234
|
+
* @param {*} value The value to search for.
|
|
1235
|
+
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
1236
|
+
*/
|
|
1237
|
+
function setCacheHas(value) {
|
|
1238
|
+
return this.__data__.has(value);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
var _setCacheHas = setCacheHas;
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
*
|
|
1245
|
+
* Creates an array cache object to store unique values.
|
|
1246
|
+
*
|
|
1247
|
+
* @private
|
|
1248
|
+
* @constructor
|
|
1249
|
+
* @param {Array} [values] The values to cache.
|
|
1250
|
+
*/
|
|
1251
|
+
function SetCache(values) {
|
|
1252
|
+
var index = -1,
|
|
1253
|
+
length = values == null ? 0 : values.length;
|
|
1254
|
+
|
|
1255
|
+
this.__data__ = new _MapCache;
|
|
1256
|
+
while (++index < length) {
|
|
1257
|
+
this.add(values[index]);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
// Add methods to `SetCache`.
|
|
1262
|
+
SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
|
|
1263
|
+
SetCache.prototype.has = _setCacheHas;
|
|
1264
|
+
|
|
1265
|
+
var _SetCache = SetCache;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* A specialized version of `_.some` for arrays without support for iteratee
|
|
1269
|
+
* shorthands.
|
|
1270
|
+
*
|
|
1271
|
+
* @private
|
|
1272
|
+
* @param {Array} [array] The array to iterate over.
|
|
1273
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1274
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
1275
|
+
* else `false`.
|
|
1276
|
+
*/
|
|
1277
|
+
function arraySome(array, predicate) {
|
|
1278
|
+
var index = -1,
|
|
1279
|
+
length = array == null ? 0 : array.length;
|
|
1280
|
+
|
|
1281
|
+
while (++index < length) {
|
|
1282
|
+
if (predicate(array[index], index, array)) {
|
|
1283
|
+
return true;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return false;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
var _arraySome = arraySome;
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Checks if a `cache` value for `key` exists.
|
|
1293
|
+
*
|
|
1294
|
+
* @private
|
|
1295
|
+
* @param {Object} cache The cache to query.
|
|
1296
|
+
* @param {string} key The key of the entry to check.
|
|
1297
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1298
|
+
*/
|
|
1299
|
+
function cacheHas(cache, key) {
|
|
1300
|
+
return cache.has(key);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
var _cacheHas = cacheHas;
|
|
1304
|
+
|
|
1305
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
1306
|
+
var COMPARE_PARTIAL_FLAG$3 = 1,
|
|
1307
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
1311
|
+
* partial deep comparisons.
|
|
1312
|
+
*
|
|
1313
|
+
* @private
|
|
1314
|
+
* @param {Array} array The array to compare.
|
|
1315
|
+
* @param {Array} other The other array to compare.
|
|
1316
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1317
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
1318
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1319
|
+
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
1320
|
+
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
1321
|
+
*/
|
|
1322
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
1323
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
1324
|
+
arrLength = array.length,
|
|
1325
|
+
othLength = other.length;
|
|
1326
|
+
|
|
1327
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1328
|
+
return false;
|
|
1329
|
+
}
|
|
1330
|
+
// Check that cyclic values are equal.
|
|
1331
|
+
var arrStacked = stack.get(array);
|
|
1332
|
+
var othStacked = stack.get(other);
|
|
1333
|
+
if (arrStacked && othStacked) {
|
|
1334
|
+
return arrStacked == other && othStacked == array;
|
|
1335
|
+
}
|
|
1336
|
+
var index = -1,
|
|
1337
|
+
result = true,
|
|
1338
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new _SetCache : undefined;
|
|
1339
|
+
|
|
1340
|
+
stack.set(array, other);
|
|
1341
|
+
stack.set(other, array);
|
|
1342
|
+
|
|
1343
|
+
// Ignore non-index properties.
|
|
1344
|
+
while (++index < arrLength) {
|
|
1345
|
+
var arrValue = array[index],
|
|
1346
|
+
othValue = other[index];
|
|
1347
|
+
|
|
1348
|
+
if (customizer) {
|
|
1349
|
+
var compared = isPartial
|
|
1350
|
+
? customizer(othValue, arrValue, index, other, array, stack)
|
|
1351
|
+
: customizer(arrValue, othValue, index, array, other, stack);
|
|
1352
|
+
}
|
|
1353
|
+
if (compared !== undefined) {
|
|
1354
|
+
if (compared) {
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
result = false;
|
|
1358
|
+
break;
|
|
1359
|
+
}
|
|
1360
|
+
// Recursively compare arrays (susceptible to call stack limits).
|
|
1361
|
+
if (seen) {
|
|
1362
|
+
if (!_arraySome(other, function(othValue, othIndex) {
|
|
1363
|
+
if (!_cacheHas(seen, othIndex) &&
|
|
1364
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
1365
|
+
return seen.push(othIndex);
|
|
1366
|
+
}
|
|
1367
|
+
})) {
|
|
1368
|
+
result = false;
|
|
1369
|
+
break;
|
|
1370
|
+
}
|
|
1371
|
+
} else if (!(
|
|
1372
|
+
arrValue === othValue ||
|
|
1373
|
+
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
1374
|
+
)) {
|
|
1375
|
+
result = false;
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
stack['delete'](array);
|
|
1380
|
+
stack['delete'](other);
|
|
1381
|
+
return result;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
var _equalArrays = equalArrays;
|
|
1385
|
+
|
|
1386
|
+
/** Built-in value references. */
|
|
1387
|
+
var Uint8Array$1 = _root.Uint8Array;
|
|
1388
|
+
|
|
1389
|
+
var _Uint8Array = Uint8Array$1;
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Converts `map` to its key-value pairs.
|
|
1393
|
+
*
|
|
1394
|
+
* @private
|
|
1395
|
+
* @param {Object} map The map to convert.
|
|
1396
|
+
* @returns {Array} Returns the key-value pairs.
|
|
1397
|
+
*/
|
|
1398
|
+
function mapToArray(map) {
|
|
1399
|
+
var index = -1,
|
|
1400
|
+
result = Array(map.size);
|
|
1401
|
+
|
|
1402
|
+
map.forEach(function(value, key) {
|
|
1403
|
+
result[++index] = [key, value];
|
|
1404
|
+
});
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
var _mapToArray = mapToArray;
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Converts `set` to an array of its values.
|
|
1412
|
+
*
|
|
1413
|
+
* @private
|
|
1414
|
+
* @param {Object} set The set to convert.
|
|
1415
|
+
* @returns {Array} Returns the values.
|
|
1416
|
+
*/
|
|
1417
|
+
function setToArray(set) {
|
|
1418
|
+
var index = -1,
|
|
1419
|
+
result = Array(set.size);
|
|
1420
|
+
|
|
1421
|
+
set.forEach(function(value) {
|
|
1422
|
+
result[++index] = value;
|
|
1423
|
+
});
|
|
1424
|
+
return result;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
var _setToArray = setToArray;
|
|
1428
|
+
|
|
1429
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
1430
|
+
var COMPARE_PARTIAL_FLAG$2 = 1,
|
|
1431
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
1432
|
+
|
|
1433
|
+
/** `Object#toString` result references. */
|
|
1434
|
+
var boolTag$1 = '[object Boolean]',
|
|
1435
|
+
dateTag$1 = '[object Date]',
|
|
1436
|
+
errorTag$1 = '[object Error]',
|
|
1437
|
+
mapTag$2 = '[object Map]',
|
|
1438
|
+
numberTag$1 = '[object Number]',
|
|
1439
|
+
regexpTag$1 = '[object RegExp]',
|
|
1440
|
+
setTag$2 = '[object Set]',
|
|
1441
|
+
stringTag$1 = '[object String]',
|
|
1442
|
+
symbolTag = '[object Symbol]';
|
|
1443
|
+
|
|
1444
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
1445
|
+
dataViewTag$2 = '[object DataView]';
|
|
1446
|
+
|
|
1447
|
+
/** Used to convert symbols to primitives and strings. */
|
|
1448
|
+
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
1449
|
+
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
1453
|
+
* the same `toStringTag`.
|
|
1454
|
+
*
|
|
1455
|
+
* **Note:** This function only supports comparing values with tags of
|
|
1456
|
+
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
1457
|
+
*
|
|
1458
|
+
* @private
|
|
1459
|
+
* @param {Object} object The object to compare.
|
|
1460
|
+
* @param {Object} other The other object to compare.
|
|
1461
|
+
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
1462
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1463
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
1464
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1465
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
1466
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1467
|
+
*/
|
|
1468
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1469
|
+
switch (tag) {
|
|
1470
|
+
case dataViewTag$2:
|
|
1471
|
+
if ((object.byteLength != other.byteLength) ||
|
|
1472
|
+
(object.byteOffset != other.byteOffset)) {
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
object = object.buffer;
|
|
1476
|
+
other = other.buffer;
|
|
1477
|
+
|
|
1478
|
+
case arrayBufferTag$1:
|
|
1479
|
+
if ((object.byteLength != other.byteLength) ||
|
|
1480
|
+
!equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
return true;
|
|
1484
|
+
|
|
1485
|
+
case boolTag$1:
|
|
1486
|
+
case dateTag$1:
|
|
1487
|
+
case numberTag$1:
|
|
1488
|
+
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
1489
|
+
// Invalid dates are coerced to `NaN`.
|
|
1490
|
+
return eq_1(+object, +other);
|
|
1491
|
+
|
|
1492
|
+
case errorTag$1:
|
|
1493
|
+
return object.name == other.name && object.message == other.message;
|
|
1494
|
+
|
|
1495
|
+
case regexpTag$1:
|
|
1496
|
+
case stringTag$1:
|
|
1497
|
+
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
1498
|
+
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
1499
|
+
// for more details.
|
|
1500
|
+
return object == (other + '');
|
|
1501
|
+
|
|
1502
|
+
case mapTag$2:
|
|
1503
|
+
var convert = _mapToArray;
|
|
1504
|
+
|
|
1505
|
+
case setTag$2:
|
|
1506
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
|
|
1507
|
+
convert || (convert = _setToArray);
|
|
1508
|
+
|
|
1509
|
+
if (object.size != other.size && !isPartial) {
|
|
1510
|
+
return false;
|
|
1511
|
+
}
|
|
1512
|
+
// Assume cyclic values are equal.
|
|
1513
|
+
var stacked = stack.get(object);
|
|
1514
|
+
if (stacked) {
|
|
1515
|
+
return stacked == other;
|
|
1516
|
+
}
|
|
1517
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
1518
|
+
|
|
1519
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
1520
|
+
stack.set(object, other);
|
|
1521
|
+
var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1522
|
+
stack['delete'](object);
|
|
1523
|
+
return result;
|
|
1524
|
+
|
|
1525
|
+
case symbolTag:
|
|
1526
|
+
if (symbolValueOf) {
|
|
1527
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
return false;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
var _equalByTag = equalByTag;
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Appends the elements of `values` to `array`.
|
|
1537
|
+
*
|
|
1538
|
+
* @private
|
|
1539
|
+
* @param {Array} array The array to modify.
|
|
1540
|
+
* @param {Array} values The values to append.
|
|
1541
|
+
* @returns {Array} Returns `array`.
|
|
1542
|
+
*/
|
|
1543
|
+
function arrayPush(array, values) {
|
|
1544
|
+
var index = -1,
|
|
1545
|
+
length = values.length,
|
|
1546
|
+
offset = array.length;
|
|
1547
|
+
|
|
1548
|
+
while (++index < length) {
|
|
1549
|
+
array[offset + index] = values[index];
|
|
1550
|
+
}
|
|
1551
|
+
return array;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
var _arrayPush = arrayPush;
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Checks if `value` is classified as an `Array` object.
|
|
1558
|
+
*
|
|
1559
|
+
* @static
|
|
1560
|
+
* @memberOf _
|
|
1561
|
+
* @since 0.1.0
|
|
1562
|
+
* @category Lang
|
|
1563
|
+
* @param {*} value The value to check.
|
|
1564
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
1565
|
+
* @example
|
|
1566
|
+
*
|
|
1567
|
+
* _.isArray([1, 2, 3]);
|
|
1568
|
+
* // => true
|
|
1569
|
+
*
|
|
1570
|
+
* _.isArray(document.body.children);
|
|
1571
|
+
* // => false
|
|
1572
|
+
*
|
|
1573
|
+
* _.isArray('abc');
|
|
1574
|
+
* // => false
|
|
1575
|
+
*
|
|
1576
|
+
* _.isArray(_.noop);
|
|
1577
|
+
* // => false
|
|
1578
|
+
*/
|
|
1579
|
+
var isArray = Array.isArray;
|
|
1580
|
+
|
|
1581
|
+
var isArray_1 = isArray;
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1585
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1586
|
+
* symbols of `object`.
|
|
1587
|
+
*
|
|
1588
|
+
* @private
|
|
1589
|
+
* @param {Object} object The object to query.
|
|
1590
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1591
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1592
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1593
|
+
*/
|
|
1594
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1595
|
+
var result = keysFunc(object);
|
|
1596
|
+
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
var _baseGetAllKeys = baseGetAllKeys;
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1603
|
+
* iteratee shorthands.
|
|
1604
|
+
*
|
|
1605
|
+
* @private
|
|
1606
|
+
* @param {Array} [array] The array to iterate over.
|
|
1607
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1608
|
+
* @returns {Array} Returns the new filtered array.
|
|
1609
|
+
*/
|
|
1610
|
+
function arrayFilter(array, predicate) {
|
|
1611
|
+
var index = -1,
|
|
1612
|
+
length = array == null ? 0 : array.length,
|
|
1613
|
+
resIndex = 0,
|
|
1614
|
+
result = [];
|
|
1615
|
+
|
|
1616
|
+
while (++index < length) {
|
|
1617
|
+
var value = array[index];
|
|
1618
|
+
if (predicate(value, index, array)) {
|
|
1619
|
+
result[resIndex++] = value;
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
return result;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
var _arrayFilter = arrayFilter;
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* This method returns a new empty array.
|
|
1629
|
+
*
|
|
1630
|
+
* @static
|
|
1631
|
+
* @memberOf _
|
|
1632
|
+
* @since 4.13.0
|
|
1633
|
+
* @category Util
|
|
1634
|
+
* @returns {Array} Returns the new empty array.
|
|
1635
|
+
* @example
|
|
1636
|
+
*
|
|
1637
|
+
* var arrays = _.times(2, _.stubArray);
|
|
1638
|
+
*
|
|
1639
|
+
* console.log(arrays);
|
|
1640
|
+
* // => [[], []]
|
|
1641
|
+
*
|
|
1642
|
+
* console.log(arrays[0] === arrays[1]);
|
|
1643
|
+
* // => false
|
|
1644
|
+
*/
|
|
1645
|
+
function stubArray() {
|
|
1646
|
+
return [];
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
var stubArray_1 = stubArray;
|
|
1650
|
+
|
|
1651
|
+
/** Used for built-in method references. */
|
|
1652
|
+
var objectProto$6 = Object.prototype;
|
|
1653
|
+
|
|
1654
|
+
/** Built-in value references. */
|
|
1655
|
+
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
1656
|
+
|
|
1657
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1658
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
1662
|
+
*
|
|
1663
|
+
* @private
|
|
1664
|
+
* @param {Object} object The object to query.
|
|
1665
|
+
* @returns {Array} Returns the array of symbols.
|
|
1666
|
+
*/
|
|
1667
|
+
var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
|
|
1668
|
+
if (object == null) {
|
|
1669
|
+
return [];
|
|
1670
|
+
}
|
|
1671
|
+
object = Object(object);
|
|
1672
|
+
return _arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1673
|
+
return propertyIsEnumerable$1.call(object, symbol);
|
|
1674
|
+
});
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
var _getSymbols = getSymbols;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
1681
|
+
* or max array length checks.
|
|
1682
|
+
*
|
|
1683
|
+
* @private
|
|
1684
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
1685
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1686
|
+
* @returns {Array} Returns the array of results.
|
|
1687
|
+
*/
|
|
1688
|
+
function baseTimes(n, iteratee) {
|
|
1689
|
+
var index = -1,
|
|
1690
|
+
result = Array(n);
|
|
1691
|
+
|
|
1692
|
+
while (++index < n) {
|
|
1693
|
+
result[index] = iteratee(index);
|
|
1694
|
+
}
|
|
1695
|
+
return result;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
var _baseTimes = baseTimes;
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
1702
|
+
* and has a `typeof` result of "object".
|
|
1703
|
+
*
|
|
1704
|
+
* @static
|
|
1705
|
+
* @memberOf _
|
|
1706
|
+
* @since 4.0.0
|
|
1707
|
+
* @category Lang
|
|
1708
|
+
* @param {*} value The value to check.
|
|
1709
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
1710
|
+
* @example
|
|
1711
|
+
*
|
|
1712
|
+
* _.isObjectLike({});
|
|
1713
|
+
* // => true
|
|
1714
|
+
*
|
|
1715
|
+
* _.isObjectLike([1, 2, 3]);
|
|
1716
|
+
* // => true
|
|
1717
|
+
*
|
|
1718
|
+
* _.isObjectLike(_.noop);
|
|
1719
|
+
* // => false
|
|
1720
|
+
*
|
|
1721
|
+
* _.isObjectLike(null);
|
|
1722
|
+
* // => false
|
|
1723
|
+
*/
|
|
1724
|
+
function isObjectLike(value) {
|
|
1725
|
+
return value != null && typeof value == 'object';
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
var isObjectLike_1 = isObjectLike;
|
|
1729
|
+
|
|
1730
|
+
/** `Object#toString` result references. */
|
|
1731
|
+
var argsTag$2 = '[object Arguments]';
|
|
1732
|
+
|
|
1733
|
+
/**
|
|
1734
|
+
* The base implementation of `_.isArguments`.
|
|
1735
|
+
*
|
|
1736
|
+
* @private
|
|
1737
|
+
* @param {*} value The value to check.
|
|
1738
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1739
|
+
*/
|
|
1740
|
+
function baseIsArguments(value) {
|
|
1741
|
+
return isObjectLike_1(value) && _baseGetTag(value) == argsTag$2;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
var _baseIsArguments = baseIsArguments;
|
|
1745
|
+
|
|
1746
|
+
/** Used for built-in method references. */
|
|
1747
|
+
var objectProto$5 = Object.prototype;
|
|
1748
|
+
|
|
1749
|
+
/** Used to check objects for own properties. */
|
|
1750
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1751
|
+
|
|
1752
|
+
/** Built-in value references. */
|
|
1753
|
+
var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* Checks if `value` is likely an `arguments` object.
|
|
1757
|
+
*
|
|
1758
|
+
* @static
|
|
1759
|
+
* @memberOf _
|
|
1760
|
+
* @since 0.1.0
|
|
1761
|
+
* @category Lang
|
|
1762
|
+
* @param {*} value The value to check.
|
|
1763
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1764
|
+
* else `false`.
|
|
1765
|
+
* @example
|
|
1766
|
+
*
|
|
1767
|
+
* _.isArguments(function() { return arguments; }());
|
|
1768
|
+
* // => true
|
|
1769
|
+
*
|
|
1770
|
+
* _.isArguments([1, 2, 3]);
|
|
1771
|
+
* // => false
|
|
1772
|
+
*/
|
|
1773
|
+
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
|
1774
|
+
return isObjectLike_1(value) && hasOwnProperty$4.call(value, 'callee') &&
|
|
1775
|
+
!propertyIsEnumerable.call(value, 'callee');
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
var isArguments_1 = isArguments;
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* This method returns `false`.
|
|
1782
|
+
*
|
|
1783
|
+
* @static
|
|
1784
|
+
* @memberOf _
|
|
1785
|
+
* @since 4.13.0
|
|
1786
|
+
* @category Util
|
|
1787
|
+
* @returns {boolean} Returns `false`.
|
|
1788
|
+
* @example
|
|
1789
|
+
*
|
|
1790
|
+
* _.times(2, _.stubFalse);
|
|
1791
|
+
* // => [false, false]
|
|
1792
|
+
*/
|
|
1793
|
+
function stubFalse() {
|
|
1794
|
+
return false;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
var stubFalse_1 = stubFalse;
|
|
1798
|
+
|
|
1799
|
+
var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
|
1800
|
+
/** Detect free variable `exports`. */
|
|
1801
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1802
|
+
|
|
1803
|
+
/** Detect free variable `module`. */
|
|
1804
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1805
|
+
|
|
1806
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1807
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1808
|
+
|
|
1809
|
+
/** Built-in value references. */
|
|
1810
|
+
var Buffer = moduleExports ? _root.Buffer : undefined;
|
|
1811
|
+
|
|
1812
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1813
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Checks if `value` is a buffer.
|
|
1817
|
+
*
|
|
1818
|
+
* @static
|
|
1819
|
+
* @memberOf _
|
|
1820
|
+
* @since 4.3.0
|
|
1821
|
+
* @category Lang
|
|
1822
|
+
* @param {*} value The value to check.
|
|
1823
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1824
|
+
* @example
|
|
1825
|
+
*
|
|
1826
|
+
* _.isBuffer(new Buffer(2));
|
|
1827
|
+
* // => true
|
|
1828
|
+
*
|
|
1829
|
+
* _.isBuffer(new Uint8Array(2));
|
|
1830
|
+
* // => false
|
|
1831
|
+
*/
|
|
1832
|
+
var isBuffer = nativeIsBuffer || stubFalse_1;
|
|
1833
|
+
|
|
1834
|
+
module.exports = isBuffer;
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
/** Used as references for various `Number` constants. */
|
|
1838
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
1839
|
+
|
|
1840
|
+
/** Used to detect unsigned integer values. */
|
|
1841
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* Checks if `value` is a valid array-like index.
|
|
1845
|
+
*
|
|
1846
|
+
* @private
|
|
1847
|
+
* @param {*} value The value to check.
|
|
1848
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
1849
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1850
|
+
*/
|
|
1851
|
+
function isIndex(value, length) {
|
|
1852
|
+
var type = typeof value;
|
|
1853
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
1854
|
+
|
|
1855
|
+
return !!length &&
|
|
1856
|
+
(type == 'number' ||
|
|
1857
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
1858
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
var _isIndex = isIndex;
|
|
1862
|
+
|
|
1863
|
+
/** Used as references for various `Number` constants. */
|
|
1864
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* Checks if `value` is a valid array-like length.
|
|
1868
|
+
*
|
|
1869
|
+
* **Note:** This method is loosely based on
|
|
1870
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
1871
|
+
*
|
|
1872
|
+
* @static
|
|
1873
|
+
* @memberOf _
|
|
1874
|
+
* @since 4.0.0
|
|
1875
|
+
* @category Lang
|
|
1876
|
+
* @param {*} value The value to check.
|
|
1877
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
1878
|
+
* @example
|
|
1879
|
+
*
|
|
1880
|
+
* _.isLength(3);
|
|
1881
|
+
* // => true
|
|
1882
|
+
*
|
|
1883
|
+
* _.isLength(Number.MIN_VALUE);
|
|
1884
|
+
* // => false
|
|
1885
|
+
*
|
|
1886
|
+
* _.isLength(Infinity);
|
|
1887
|
+
* // => false
|
|
1888
|
+
*
|
|
1889
|
+
* _.isLength('3');
|
|
1890
|
+
* // => false
|
|
1891
|
+
*/
|
|
1892
|
+
function isLength(value) {
|
|
1893
|
+
return typeof value == 'number' &&
|
|
1894
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
var isLength_1 = isLength;
|
|
1898
|
+
|
|
1899
|
+
/** `Object#toString` result references. */
|
|
1900
|
+
var argsTag$1 = '[object Arguments]',
|
|
1901
|
+
arrayTag$1 = '[object Array]',
|
|
1902
|
+
boolTag = '[object Boolean]',
|
|
1903
|
+
dateTag = '[object Date]',
|
|
1904
|
+
errorTag = '[object Error]',
|
|
1905
|
+
funcTag = '[object Function]',
|
|
1906
|
+
mapTag$1 = '[object Map]',
|
|
1907
|
+
numberTag = '[object Number]',
|
|
1908
|
+
objectTag$2 = '[object Object]',
|
|
1909
|
+
regexpTag = '[object RegExp]',
|
|
1910
|
+
setTag$1 = '[object Set]',
|
|
1911
|
+
stringTag = '[object String]',
|
|
1912
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
1913
|
+
|
|
1914
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
1915
|
+
dataViewTag$1 = '[object DataView]',
|
|
1916
|
+
float32Tag = '[object Float32Array]',
|
|
1917
|
+
float64Tag = '[object Float64Array]',
|
|
1918
|
+
int8Tag = '[object Int8Array]',
|
|
1919
|
+
int16Tag = '[object Int16Array]',
|
|
1920
|
+
int32Tag = '[object Int32Array]',
|
|
1921
|
+
uint8Tag = '[object Uint8Array]',
|
|
1922
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
1923
|
+
uint16Tag = '[object Uint16Array]',
|
|
1924
|
+
uint32Tag = '[object Uint32Array]';
|
|
1925
|
+
|
|
1926
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1927
|
+
var typedArrayTags = {};
|
|
1928
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
1929
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
1930
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
1931
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
1932
|
+
typedArrayTags[uint32Tag] = true;
|
|
1933
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1934
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
1935
|
+
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
|
|
1936
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
1937
|
+
typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
|
|
1938
|
+
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
|
|
1939
|
+
typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
|
|
1940
|
+
typedArrayTags[weakMapTag$1] = false;
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1944
|
+
*
|
|
1945
|
+
* @private
|
|
1946
|
+
* @param {*} value The value to check.
|
|
1947
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1948
|
+
*/
|
|
1949
|
+
function baseIsTypedArray(value) {
|
|
1950
|
+
return isObjectLike_1(value) &&
|
|
1951
|
+
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
var _baseIsTypedArray = baseIsTypedArray;
|
|
1955
|
+
|
|
1956
|
+
/**
|
|
1957
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1958
|
+
*
|
|
1959
|
+
* @private
|
|
1960
|
+
* @param {Function} func The function to cap arguments for.
|
|
1961
|
+
* @returns {Function} Returns the new capped function.
|
|
1962
|
+
*/
|
|
1963
|
+
function baseUnary(func) {
|
|
1964
|
+
return function(value) {
|
|
1965
|
+
return func(value);
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
var _baseUnary = baseUnary;
|
|
1970
|
+
|
|
1971
|
+
var _nodeUtil = createCommonjsModule(function (module, exports) {
|
|
1972
|
+
/** Detect free variable `exports`. */
|
|
1973
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
1974
|
+
|
|
1975
|
+
/** Detect free variable `module`. */
|
|
1976
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
1977
|
+
|
|
1978
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1979
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1980
|
+
|
|
1981
|
+
/** Detect free variable `process` from Node.js. */
|
|
1982
|
+
var freeProcess = moduleExports && _freeGlobal.process;
|
|
1983
|
+
|
|
1984
|
+
/** Used to access faster Node.js helpers. */
|
|
1985
|
+
var nodeUtil = (function() {
|
|
1986
|
+
try {
|
|
1987
|
+
// Use `util.types` for Node.js 10+.
|
|
1988
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1989
|
+
|
|
1990
|
+
if (types) {
|
|
1991
|
+
return types;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1995
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1996
|
+
} catch (e) {}
|
|
1997
|
+
}());
|
|
1998
|
+
|
|
1999
|
+
module.exports = nodeUtil;
|
|
2000
|
+
});
|
|
2001
|
+
|
|
2002
|
+
/* Node.js helper references. */
|
|
2003
|
+
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Checks if `value` is classified as a typed array.
|
|
2007
|
+
*
|
|
2008
|
+
* @static
|
|
2009
|
+
* @memberOf _
|
|
2010
|
+
* @since 3.0.0
|
|
2011
|
+
* @category Lang
|
|
2012
|
+
* @param {*} value The value to check.
|
|
2013
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
2014
|
+
* @example
|
|
2015
|
+
*
|
|
2016
|
+
* _.isTypedArray(new Uint8Array);
|
|
2017
|
+
* // => true
|
|
2018
|
+
*
|
|
2019
|
+
* _.isTypedArray([]);
|
|
2020
|
+
* // => false
|
|
2021
|
+
*/
|
|
2022
|
+
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
|
2023
|
+
|
|
2024
|
+
var isTypedArray_1 = isTypedArray;
|
|
2025
|
+
|
|
2026
|
+
/** Used for built-in method references. */
|
|
2027
|
+
var objectProto$4 = Object.prototype;
|
|
2028
|
+
|
|
2029
|
+
/** Used to check objects for own properties. */
|
|
2030
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
2034
|
+
*
|
|
2035
|
+
* @private
|
|
2036
|
+
* @param {*} value The value to query.
|
|
2037
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
2038
|
+
* @returns {Array} Returns the array of property names.
|
|
2039
|
+
*/
|
|
2040
|
+
function arrayLikeKeys(value, inherited) {
|
|
2041
|
+
var isArr = isArray_1(value),
|
|
2042
|
+
isArg = !isArr && isArguments_1(value),
|
|
2043
|
+
isBuff = !isArr && !isArg && isBuffer_1(value),
|
|
2044
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
|
|
2045
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
2046
|
+
result = skipIndexes ? _baseTimes(value.length, String) : [],
|
|
2047
|
+
length = result.length;
|
|
2048
|
+
|
|
2049
|
+
for (var key in value) {
|
|
2050
|
+
if ((inherited || hasOwnProperty$3.call(value, key)) &&
|
|
2051
|
+
!(skipIndexes && (
|
|
2052
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2053
|
+
key == 'length' ||
|
|
2054
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2055
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
2056
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2057
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
2058
|
+
// Skip index properties.
|
|
2059
|
+
_isIndex(key, length)
|
|
2060
|
+
))) {
|
|
2061
|
+
result.push(key);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
return result;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
var _arrayLikeKeys = arrayLikeKeys;
|
|
2068
|
+
|
|
2069
|
+
/** Used for built-in method references. */
|
|
2070
|
+
var objectProto$3 = Object.prototype;
|
|
2071
|
+
|
|
2072
|
+
/**
|
|
2073
|
+
* Checks if `value` is likely a prototype object.
|
|
2074
|
+
*
|
|
2075
|
+
* @private
|
|
2076
|
+
* @param {*} value The value to check.
|
|
2077
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
2078
|
+
*/
|
|
2079
|
+
function isPrototype(value) {
|
|
2080
|
+
var Ctor = value && value.constructor,
|
|
2081
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
|
|
2082
|
+
|
|
2083
|
+
return value === proto;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
var _isPrototype = isPrototype;
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
2090
|
+
*
|
|
2091
|
+
* @private
|
|
2092
|
+
* @param {Function} func The function to wrap.
|
|
2093
|
+
* @param {Function} transform The argument transform.
|
|
2094
|
+
* @returns {Function} Returns the new function.
|
|
2095
|
+
*/
|
|
2096
|
+
function overArg(func, transform) {
|
|
2097
|
+
return function(arg) {
|
|
2098
|
+
return func(transform(arg));
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
var _overArg = overArg;
|
|
2103
|
+
|
|
2104
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2105
|
+
var nativeKeys = _overArg(Object.keys, Object);
|
|
2106
|
+
|
|
2107
|
+
var _nativeKeys = nativeKeys;
|
|
2108
|
+
|
|
2109
|
+
/** Used for built-in method references. */
|
|
2110
|
+
var objectProto$2 = Object.prototype;
|
|
2111
|
+
|
|
2112
|
+
/** Used to check objects for own properties. */
|
|
2113
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
2117
|
+
*
|
|
2118
|
+
* @private
|
|
2119
|
+
* @param {Object} object The object to query.
|
|
2120
|
+
* @returns {Array} Returns the array of property names.
|
|
2121
|
+
*/
|
|
2122
|
+
function baseKeys(object) {
|
|
2123
|
+
if (!_isPrototype(object)) {
|
|
2124
|
+
return _nativeKeys(object);
|
|
2125
|
+
}
|
|
2126
|
+
var result = [];
|
|
2127
|
+
for (var key in Object(object)) {
|
|
2128
|
+
if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
|
|
2129
|
+
result.push(key);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
return result;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
var _baseKeys = baseKeys;
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
2139
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
2140
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
2141
|
+
*
|
|
2142
|
+
* @static
|
|
2143
|
+
* @memberOf _
|
|
2144
|
+
* @since 4.0.0
|
|
2145
|
+
* @category Lang
|
|
2146
|
+
* @param {*} value The value to check.
|
|
2147
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
2148
|
+
* @example
|
|
2149
|
+
*
|
|
2150
|
+
* _.isArrayLike([1, 2, 3]);
|
|
2151
|
+
* // => true
|
|
2152
|
+
*
|
|
2153
|
+
* _.isArrayLike(document.body.children);
|
|
2154
|
+
* // => true
|
|
2155
|
+
*
|
|
2156
|
+
* _.isArrayLike('abc');
|
|
2157
|
+
* // => true
|
|
2158
|
+
*
|
|
2159
|
+
* _.isArrayLike(_.noop);
|
|
2160
|
+
* // => false
|
|
2161
|
+
*/
|
|
2162
|
+
function isArrayLike(value) {
|
|
2163
|
+
return value != null && isLength_1(value.length) && !isFunction_1(value);
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
var isArrayLike_1 = isArrayLike;
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
2170
|
+
*
|
|
2171
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
2172
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
2173
|
+
* for more details.
|
|
2174
|
+
*
|
|
2175
|
+
* @static
|
|
2176
|
+
* @since 0.1.0
|
|
2177
|
+
* @memberOf _
|
|
2178
|
+
* @category Object
|
|
2179
|
+
* @param {Object} object The object to query.
|
|
2180
|
+
* @returns {Array} Returns the array of property names.
|
|
2181
|
+
* @example
|
|
2182
|
+
*
|
|
2183
|
+
* function Foo() {
|
|
2184
|
+
* this.a = 1;
|
|
2185
|
+
* this.b = 2;
|
|
2186
|
+
* }
|
|
2187
|
+
*
|
|
2188
|
+
* Foo.prototype.c = 3;
|
|
2189
|
+
*
|
|
2190
|
+
* _.keys(new Foo);
|
|
2191
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
2192
|
+
*
|
|
2193
|
+
* _.keys('hi');
|
|
2194
|
+
* // => ['0', '1']
|
|
2195
|
+
*/
|
|
2196
|
+
function keys(object) {
|
|
2197
|
+
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
var keys_1 = keys;
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
2204
|
+
*
|
|
2205
|
+
* @private
|
|
2206
|
+
* @param {Object} object The object to query.
|
|
2207
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
2208
|
+
*/
|
|
2209
|
+
function getAllKeys(object) {
|
|
2210
|
+
return _baseGetAllKeys(object, keys_1, _getSymbols);
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
var _getAllKeys = getAllKeys;
|
|
2214
|
+
|
|
2215
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2216
|
+
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
2217
|
+
|
|
2218
|
+
/** Used for built-in method references. */
|
|
2219
|
+
var objectProto$1 = Object.prototype;
|
|
2220
|
+
|
|
2221
|
+
/** Used to check objects for own properties. */
|
|
2222
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
2226
|
+
* partial deep comparisons.
|
|
2227
|
+
*
|
|
2228
|
+
* @private
|
|
2229
|
+
* @param {Object} object The object to compare.
|
|
2230
|
+
* @param {Object} other The other object to compare.
|
|
2231
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2232
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2233
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2234
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2235
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2236
|
+
*/
|
|
2237
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2238
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
|
|
2239
|
+
objProps = _getAllKeys(object),
|
|
2240
|
+
objLength = objProps.length,
|
|
2241
|
+
othProps = _getAllKeys(other),
|
|
2242
|
+
othLength = othProps.length;
|
|
2243
|
+
|
|
2244
|
+
if (objLength != othLength && !isPartial) {
|
|
2245
|
+
return false;
|
|
2246
|
+
}
|
|
2247
|
+
var index = objLength;
|
|
2248
|
+
while (index--) {
|
|
2249
|
+
var key = objProps[index];
|
|
2250
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
2251
|
+
return false;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
// Check that cyclic values are equal.
|
|
2255
|
+
var objStacked = stack.get(object);
|
|
2256
|
+
var othStacked = stack.get(other);
|
|
2257
|
+
if (objStacked && othStacked) {
|
|
2258
|
+
return objStacked == other && othStacked == object;
|
|
2259
|
+
}
|
|
2260
|
+
var result = true;
|
|
2261
|
+
stack.set(object, other);
|
|
2262
|
+
stack.set(other, object);
|
|
2263
|
+
|
|
2264
|
+
var skipCtor = isPartial;
|
|
2265
|
+
while (++index < objLength) {
|
|
2266
|
+
key = objProps[index];
|
|
2267
|
+
var objValue = object[key],
|
|
2268
|
+
othValue = other[key];
|
|
2269
|
+
|
|
2270
|
+
if (customizer) {
|
|
2271
|
+
var compared = isPartial
|
|
2272
|
+
? customizer(othValue, objValue, key, other, object, stack)
|
|
2273
|
+
: customizer(objValue, othValue, key, object, other, stack);
|
|
2274
|
+
}
|
|
2275
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
2276
|
+
if (!(compared === undefined
|
|
2277
|
+
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
2278
|
+
: compared
|
|
2279
|
+
)) {
|
|
2280
|
+
result = false;
|
|
2281
|
+
break;
|
|
2282
|
+
}
|
|
2283
|
+
skipCtor || (skipCtor = key == 'constructor');
|
|
2284
|
+
}
|
|
2285
|
+
if (result && !skipCtor) {
|
|
2286
|
+
var objCtor = object.constructor,
|
|
2287
|
+
othCtor = other.constructor;
|
|
2288
|
+
|
|
2289
|
+
// Non `Object` object instances with different constructors are not equal.
|
|
2290
|
+
if (objCtor != othCtor &&
|
|
2291
|
+
('constructor' in object && 'constructor' in other) &&
|
|
2292
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
2293
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
2294
|
+
result = false;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
stack['delete'](object);
|
|
2298
|
+
stack['delete'](other);
|
|
2299
|
+
return result;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
var _equalObjects = equalObjects;
|
|
2303
|
+
|
|
2304
|
+
/* Built-in method references that are verified to be native. */
|
|
2305
|
+
var DataView = _getNative(_root, 'DataView');
|
|
2306
|
+
|
|
2307
|
+
var _DataView = DataView;
|
|
2308
|
+
|
|
2309
|
+
/* Built-in method references that are verified to be native. */
|
|
2310
|
+
var Promise$1 = _getNative(_root, 'Promise');
|
|
2311
|
+
|
|
2312
|
+
var _Promise = Promise$1;
|
|
2313
|
+
|
|
2314
|
+
/* Built-in method references that are verified to be native. */
|
|
2315
|
+
var Set = _getNative(_root, 'Set');
|
|
2316
|
+
|
|
2317
|
+
var _Set = Set;
|
|
2318
|
+
|
|
2319
|
+
/* Built-in method references that are verified to be native. */
|
|
2320
|
+
var WeakMap = _getNative(_root, 'WeakMap');
|
|
2321
|
+
|
|
2322
|
+
var _WeakMap = WeakMap;
|
|
2323
|
+
|
|
2324
|
+
/** `Object#toString` result references. */
|
|
2325
|
+
var mapTag = '[object Map]',
|
|
2326
|
+
objectTag$1 = '[object Object]',
|
|
2327
|
+
promiseTag = '[object Promise]',
|
|
2328
|
+
setTag = '[object Set]',
|
|
2329
|
+
weakMapTag = '[object WeakMap]';
|
|
2330
|
+
|
|
2331
|
+
var dataViewTag = '[object DataView]';
|
|
2332
|
+
|
|
2333
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
2334
|
+
var dataViewCtorString = _toSource(_DataView),
|
|
2335
|
+
mapCtorString = _toSource(_Map),
|
|
2336
|
+
promiseCtorString = _toSource(_Promise),
|
|
2337
|
+
setCtorString = _toSource(_Set),
|
|
2338
|
+
weakMapCtorString = _toSource(_WeakMap);
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Gets the `toStringTag` of `value`.
|
|
2342
|
+
*
|
|
2343
|
+
* @private
|
|
2344
|
+
* @param {*} value The value to query.
|
|
2345
|
+
* @returns {string} Returns the `toStringTag`.
|
|
2346
|
+
*/
|
|
2347
|
+
var getTag = _baseGetTag;
|
|
2348
|
+
|
|
2349
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2350
|
+
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
2351
|
+
(_Map && getTag(new _Map) != mapTag) ||
|
|
2352
|
+
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
|
|
2353
|
+
(_Set && getTag(new _Set) != setTag) ||
|
|
2354
|
+
(_WeakMap && getTag(new _WeakMap) != weakMapTag)) {
|
|
2355
|
+
getTag = function(value) {
|
|
2356
|
+
var result = _baseGetTag(value),
|
|
2357
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
2358
|
+
ctorString = Ctor ? _toSource(Ctor) : '';
|
|
2359
|
+
|
|
2360
|
+
if (ctorString) {
|
|
2361
|
+
switch (ctorString) {
|
|
2362
|
+
case dataViewCtorString: return dataViewTag;
|
|
2363
|
+
case mapCtorString: return mapTag;
|
|
2364
|
+
case promiseCtorString: return promiseTag;
|
|
2365
|
+
case setCtorString: return setTag;
|
|
2366
|
+
case weakMapCtorString: return weakMapTag;
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
return result;
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
var _getTag = getTag;
|
|
2374
|
+
|
|
2375
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2376
|
+
var COMPARE_PARTIAL_FLAG = 1;
|
|
2377
|
+
|
|
2378
|
+
/** `Object#toString` result references. */
|
|
2379
|
+
var argsTag = '[object Arguments]',
|
|
2380
|
+
arrayTag = '[object Array]',
|
|
2381
|
+
objectTag = '[object Object]';
|
|
2382
|
+
|
|
2383
|
+
/** Used for built-in method references. */
|
|
2384
|
+
var objectProto = Object.prototype;
|
|
2385
|
+
|
|
2386
|
+
/** Used to check objects for own properties. */
|
|
2387
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
2391
|
+
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
2392
|
+
* references to be compared.
|
|
2393
|
+
*
|
|
2394
|
+
* @private
|
|
2395
|
+
* @param {Object} object The object to compare.
|
|
2396
|
+
* @param {Object} other The other object to compare.
|
|
2397
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
2398
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
2399
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2400
|
+
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
2401
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2402
|
+
*/
|
|
2403
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
2404
|
+
var objIsArr = isArray_1(object),
|
|
2405
|
+
othIsArr = isArray_1(other),
|
|
2406
|
+
objTag = objIsArr ? arrayTag : _getTag(object),
|
|
2407
|
+
othTag = othIsArr ? arrayTag : _getTag(other);
|
|
2408
|
+
|
|
2409
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
2410
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
2411
|
+
|
|
2412
|
+
var objIsObj = objTag == objectTag,
|
|
2413
|
+
othIsObj = othTag == objectTag,
|
|
2414
|
+
isSameTag = objTag == othTag;
|
|
2415
|
+
|
|
2416
|
+
if (isSameTag && isBuffer_1(object)) {
|
|
2417
|
+
if (!isBuffer_1(other)) {
|
|
2418
|
+
return false;
|
|
2419
|
+
}
|
|
2420
|
+
objIsArr = true;
|
|
2421
|
+
objIsObj = false;
|
|
2422
|
+
}
|
|
2423
|
+
if (isSameTag && !objIsObj) {
|
|
2424
|
+
stack || (stack = new _Stack);
|
|
2425
|
+
return (objIsArr || isTypedArray_1(object))
|
|
2426
|
+
? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
2427
|
+
: _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
2428
|
+
}
|
|
2429
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
2430
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
2431
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
2432
|
+
|
|
2433
|
+
if (objIsWrapped || othIsWrapped) {
|
|
2434
|
+
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
2435
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
2436
|
+
|
|
2437
|
+
stack || (stack = new _Stack);
|
|
2438
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
if (!isSameTag) {
|
|
2442
|
+
return false;
|
|
2443
|
+
}
|
|
2444
|
+
stack || (stack = new _Stack);
|
|
2445
|
+
return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
var _baseIsEqualDeep = baseIsEqualDeep;
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
2452
|
+
* and tracks traversed objects.
|
|
2453
|
+
*
|
|
2454
|
+
* @private
|
|
2455
|
+
* @param {*} value The value to compare.
|
|
2456
|
+
* @param {*} other The other value to compare.
|
|
2457
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
2458
|
+
* 1 - Unordered comparison
|
|
2459
|
+
* 2 - Partial comparison
|
|
2460
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
2461
|
+
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
2462
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2463
|
+
*/
|
|
2464
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
2465
|
+
if (value === other) {
|
|
2466
|
+
return true;
|
|
2467
|
+
}
|
|
2468
|
+
if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
|
|
2469
|
+
return value !== value && other !== other;
|
|
2470
|
+
}
|
|
2471
|
+
return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
var _baseIsEqual = baseIsEqual;
|
|
2475
|
+
|
|
2476
|
+
/**
|
|
2477
|
+
* Performs a deep comparison between two values to determine if they are
|
|
2478
|
+
* equivalent.
|
|
2479
|
+
*
|
|
2480
|
+
* **Note:** This method supports comparing arrays, array buffers, booleans,
|
|
2481
|
+
* date objects, error objects, maps, numbers, `Object` objects, regexes,
|
|
2482
|
+
* sets, strings, symbols, and typed arrays. `Object` objects are compared
|
|
2483
|
+
* by their own, not inherited, enumerable properties. Functions and DOM
|
|
2484
|
+
* nodes are compared by strict equality, i.e. `===`.
|
|
2485
|
+
*
|
|
2486
|
+
* @static
|
|
2487
|
+
* @memberOf _
|
|
2488
|
+
* @since 0.1.0
|
|
2489
|
+
* @category Lang
|
|
2490
|
+
* @param {*} value The value to compare.
|
|
2491
|
+
* @param {*} other The other value to compare.
|
|
2492
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
2493
|
+
* @example
|
|
2494
|
+
*
|
|
2495
|
+
* var object = { 'a': 1 };
|
|
2496
|
+
* var other = { 'a': 1 };
|
|
2497
|
+
*
|
|
2498
|
+
* _.isEqual(object, other);
|
|
2499
|
+
* // => true
|
|
2500
|
+
*
|
|
2501
|
+
* object === other;
|
|
2502
|
+
* // => false
|
|
2503
|
+
*/
|
|
2504
|
+
function isEqual(value, other) {
|
|
2505
|
+
return _baseIsEqual(value, other);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
var isEqual_1 = isEqual;
|
|
2509
|
+
|
|
2510
|
+
const _excluded$1 = ["placeholder", "signature", "url", "width", "height", "padding", "filename"];
|
|
2511
|
+
const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
2512
|
+
let {
|
|
2513
|
+
placeholder,
|
|
2514
|
+
signature,
|
|
2515
|
+
url,
|
|
2516
|
+
width,
|
|
2517
|
+
height,
|
|
2518
|
+
padding,
|
|
2519
|
+
filename = 'signed-document.pdf'
|
|
2520
|
+
} = _ref,
|
|
2521
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
2522
|
+
const [location, setLocation] = react.useState({});
|
|
2523
|
+
const [pdfProps, setPdfProps] = react.useState(null);
|
|
2524
|
+
const {
|
|
2525
|
+
formatMessage
|
|
2526
|
+
} = reactIntl.useIntl();
|
|
2527
|
+
const pdfSignature = react.useMemo(() => {
|
|
2528
|
+
if (!pdfProps) {
|
|
2529
|
+
return null;
|
|
2530
|
+
}
|
|
2531
|
+
const {
|
|
2532
|
+
size,
|
|
2533
|
+
currentPage
|
|
2534
|
+
} = pdfProps;
|
|
2535
|
+
const scaleX = size.width / size.originalWidth;
|
|
2536
|
+
const scaleY = size.height / size.originalHeight;
|
|
2537
|
+
const pdfX = Math.round(location.size.x / scaleX);
|
|
2538
|
+
const pdfY = Math.round(size.originalHeight - location.size.y / scaleY);
|
|
2539
|
+
return {
|
|
2540
|
+
x: pdfX,
|
|
2541
|
+
y: pdfY - location.size.height,
|
|
2542
|
+
page: currentPage,
|
|
2543
|
+
pageWidth: size.originalWidth,
|
|
2544
|
+
pageHeight: size.originalHeight,
|
|
2545
|
+
width: location.size.width,
|
|
2546
|
+
height: location.size.height,
|
|
2547
|
+
signature,
|
|
2548
|
+
url
|
|
2549
|
+
};
|
|
2550
|
+
}, [pdfProps, location, signature, url]);
|
|
2551
|
+
const signPdf = react.useCallback(function () {
|
|
2552
|
+
try {
|
|
2553
|
+
if (!pdfProps) {
|
|
2554
|
+
throw new Error(formatMessage({
|
|
2555
|
+
id: 'loadingError'
|
|
2556
|
+
}));
|
|
2557
|
+
}
|
|
2558
|
+
const {
|
|
2559
|
+
x,
|
|
2560
|
+
y,
|
|
2561
|
+
page,
|
|
2562
|
+
width,
|
|
2563
|
+
height,
|
|
2564
|
+
signature,
|
|
2565
|
+
url
|
|
2566
|
+
} = pdfSignature;
|
|
2567
|
+
return Promise.resolve(window.fetch(url)).then(function (response) {
|
|
2568
|
+
return Promise.resolve(response.arrayBuffer()).then(function (pdfBytes) {
|
|
2569
|
+
return Promise.resolve(pdfLib.PDFDocument.load(pdfBytes)).then(function (pdfDoc) {
|
|
2570
|
+
const pdfPage = pdfDoc.getPage(page - 1);
|
|
2571
|
+
return Promise.resolve(window.fetch(signature).then(res => res.arrayBuffer())).then(function (signatureBytes) {
|
|
2572
|
+
return Promise.resolve(pdfDoc.embedPng(signatureBytes)).then(function (signatureImageEmbed) {
|
|
2573
|
+
pdfPage.drawImage(signatureImageEmbed, {
|
|
2574
|
+
x,
|
|
2575
|
+
y,
|
|
2576
|
+
width,
|
|
2577
|
+
height
|
|
2578
|
+
});
|
|
2579
|
+
return Promise.resolve(pdfDoc.save()).then(function (modifiedPdfBytes) {
|
|
2580
|
+
return new window.File([modifiedPdfBytes], filename, {
|
|
2581
|
+
type: 'application/pdf'
|
|
2582
|
+
});
|
|
2583
|
+
});
|
|
2584
|
+
});
|
|
2585
|
+
});
|
|
2586
|
+
});
|
|
2587
|
+
});
|
|
2588
|
+
});
|
|
2589
|
+
} catch (e) {
|
|
2590
|
+
return Promise.reject(e);
|
|
2591
|
+
}
|
|
2592
|
+
}, [pdfSignature]);
|
|
2593
|
+
react.useImperativeHandle(ref, () => ({
|
|
2594
|
+
getLocation: () => location,
|
|
2595
|
+
setLocation: value => setLocation(value),
|
|
2596
|
+
getPdfSignature: () => pdfSignature,
|
|
2597
|
+
sign: () => signPdf()
|
|
2598
|
+
}));
|
|
2599
|
+
return /*#__PURE__*/jsxRuntime.jsx(PDFViewer, _extends({}, props, {
|
|
2600
|
+
url: url,
|
|
2601
|
+
children: _ref2 => {
|
|
2602
|
+
let {
|
|
2603
|
+
size,
|
|
2604
|
+
currentPage
|
|
2605
|
+
} = _ref2;
|
|
2606
|
+
setTimeout(() => {
|
|
2607
|
+
if (!isEqual_1({
|
|
2608
|
+
size,
|
|
2609
|
+
currentPage
|
|
2610
|
+
}, pdfProps)) {
|
|
2611
|
+
setPdfProps({
|
|
2612
|
+
size,
|
|
2613
|
+
currentPage
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
}, 0);
|
|
2617
|
+
return /*#__PURE__*/jsxRuntime.jsx(LocationLayer, {
|
|
2618
|
+
stageWidth: size.width,
|
|
2619
|
+
stageHeight: size.height,
|
|
2620
|
+
width: width,
|
|
2621
|
+
height: height,
|
|
2622
|
+
padding: padding,
|
|
2623
|
+
placeholder: placeholder,
|
|
2624
|
+
signature: signature,
|
|
2625
|
+
value: location,
|
|
2626
|
+
onChange: setLocation
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
}));
|
|
2630
|
+
}));
|
|
2631
|
+
|
|
2632
|
+
const _excluded = ["filename", "onSuccess"];
|
|
2633
|
+
const dataURLtoBlob = dataURL => {
|
|
2634
|
+
let arr = dataURL.split(',');
|
|
2635
|
+
// 注意base64的最后面中括号和引号是不转译的
|
|
2636
|
+
let _arr = arr[1].substring(0, arr[1].length - 2);
|
|
2637
|
+
let mime = arr[0].match(/:(.*?);/)[1],
|
|
2638
|
+
bstr = atob(_arr),
|
|
2639
|
+
n = bstr.length,
|
|
2640
|
+
u8arr = new Uint8Array(n);
|
|
2641
|
+
while (n--) {
|
|
2642
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
2643
|
+
}
|
|
2644
|
+
return new Blob([u8arr], {
|
|
2645
|
+
type: mime
|
|
2646
|
+
});
|
|
2647
|
+
};
|
|
2648
|
+
const Signature = withLocale(_ref => {
|
|
2649
|
+
let {
|
|
2650
|
+
onClose,
|
|
2651
|
+
onSuccess,
|
|
2652
|
+
filename,
|
|
2653
|
+
width,
|
|
2654
|
+
height
|
|
2655
|
+
} = _ref;
|
|
2656
|
+
const {
|
|
2657
|
+
formatMessage
|
|
2658
|
+
} = reactIntl.useIntl();
|
|
2659
|
+
const {
|
|
2660
|
+
message
|
|
2661
|
+
} = antd.App.useApp();
|
|
2662
|
+
const signatureCanvasRef = react.useRef(null);
|
|
2663
|
+
return /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
2664
|
+
vertical: true,
|
|
2665
|
+
gap: 12,
|
|
2666
|
+
className: classnames__default["default"](style['signature-modal-content'], 'signature-modal-content'),
|
|
2667
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2668
|
+
className: classnames__default["default"](style['signature-container'], 'signature-container'),
|
|
2669
|
+
style: {
|
|
2670
|
+
width: '368px',
|
|
2671
|
+
height: Math.round(height * 368 / width) + "px"
|
|
2672
|
+
},
|
|
2673
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SignatureCanvas__default["default"], {
|
|
2674
|
+
ref: signatureCanvasRef,
|
|
2675
|
+
canvasProps: {
|
|
2676
|
+
className: classnames__default["default"](style['signature-canvas'], 'signature-canvas')
|
|
2677
|
+
}
|
|
2678
|
+
})
|
|
2679
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
|
|
2680
|
+
justify: "flex-end",
|
|
2681
|
+
align: "center",
|
|
2682
|
+
gap: 10,
|
|
2683
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2684
|
+
onClick: () => {
|
|
2685
|
+
onClose();
|
|
2686
|
+
},
|
|
2687
|
+
children: formatMessage({
|
|
2688
|
+
id: 'signatureCancelText'
|
|
2689
|
+
})
|
|
2690
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
2691
|
+
type: "primary",
|
|
2692
|
+
onClick: () => {
|
|
2693
|
+
if (signatureCanvasRef.current.isEmpty()) {
|
|
2694
|
+
message.error(formatMessage({
|
|
2695
|
+
id: 'signatureEmptyError'
|
|
2696
|
+
}));
|
|
2697
|
+
return;
|
|
2698
|
+
}
|
|
2699
|
+
const file = new window.File([dataURLtoBlob(signatureCanvasRef.current.toDataURL('image/png'))], filename, {
|
|
2700
|
+
type: 'image/png'
|
|
2701
|
+
});
|
|
2702
|
+
onClose();
|
|
2703
|
+
onSuccess(file);
|
|
2704
|
+
},
|
|
2705
|
+
children: formatMessage({
|
|
2706
|
+
id: 'signatureConfirmText'
|
|
2707
|
+
})
|
|
2708
|
+
})]
|
|
2709
|
+
})]
|
|
2710
|
+
});
|
|
2711
|
+
});
|
|
2712
|
+
const Title = withLocale(() => {
|
|
2713
|
+
const {
|
|
2714
|
+
formatMessage
|
|
2715
|
+
} = reactIntl.useIntl();
|
|
2716
|
+
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2717
|
+
children: formatMessage({
|
|
2718
|
+
id: 'signatureDefaultTitle'
|
|
2719
|
+
})
|
|
2720
|
+
});
|
|
2721
|
+
});
|
|
2722
|
+
const useSignature = props => {
|
|
2723
|
+
const {
|
|
2724
|
+
width,
|
|
2725
|
+
height
|
|
2726
|
+
} = Object.assign({}, {
|
|
2727
|
+
width: 200,
|
|
2728
|
+
height: 50
|
|
2729
|
+
}, props);
|
|
2730
|
+
const {
|
|
2731
|
+
modal,
|
|
2732
|
+
message
|
|
2733
|
+
} = antd.App.useApp();
|
|
2734
|
+
react.useRef(null);
|
|
2735
|
+
return props => {
|
|
2736
|
+
const _Object$assign = Object.assign({}, props),
|
|
2737
|
+
{
|
|
2738
|
+
filename = 'signature.png',
|
|
2739
|
+
onSuccess
|
|
2740
|
+
} = _Object$assign,
|
|
2741
|
+
modalProps = _objectWithoutPropertiesLoose(_Object$assign, _excluded);
|
|
2742
|
+
const modalApi = modal.info(Object.assign({}, {
|
|
2743
|
+
title: /*#__PURE__*/jsxRuntime.jsx(Title, {}),
|
|
2744
|
+
icon: null,
|
|
2745
|
+
footer: null,
|
|
2746
|
+
wrapClassName: style['signature-modal'],
|
|
2747
|
+
classNames: {
|
|
2748
|
+
content: style['signature-modal']
|
|
2749
|
+
}
|
|
2750
|
+
}, modalProps, {
|
|
2751
|
+
content: /*#__PURE__*/jsxRuntime.jsx(Signature, {
|
|
2752
|
+
width: width,
|
|
2753
|
+
height: height,
|
|
2754
|
+
filename: filename,
|
|
2755
|
+
onSuccess: onSuccess,
|
|
2756
|
+
onClose: () => {
|
|
2757
|
+
modalApi.destroy();
|
|
2758
|
+
}
|
|
2759
|
+
})
|
|
2760
|
+
}));
|
|
2761
|
+
return modalApi;
|
|
2762
|
+
};
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
exports.LocationLayer = LocationLayer;
|
|
2766
|
+
exports.PDFSign = PDFSign;
|
|
2767
|
+
exports.PDFViewer = PDFViewer;
|
|
2768
|
+
exports["default"] = PDFSign;
|
|
2769
|
+
exports.useSignature = useSignature;
|
|
2770
|
+
//# sourceMappingURL=index.js.map
|