@vertexvis/ui 0.1.1-canary.4 → 0.1.1-canary.5

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.
@@ -1,2188 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-6a92256c.js');
4
- const tslib_es6 = require('./tslib.es6-838fd860.js');
5
- const index$1 = require('./index-e1b40fa6.js');
6
- const dom = require('./dom-a2c535e3.js');
7
- const slots = require('./slots-fb5ac359.js');
8
-
9
- /**
10
- * A module for defining functional schemas to map between different types. This
11
- * module is useful for parsing to or from JSON/protobufs to domain types.
12
- *
13
- * Mappers support greedy validation, so all validation errors are aggregated
14
- * and reported vs failing on the first invalid input.
15
- *
16
- * @example
17
- *
18
- * ```ts
19
- * import { Mapper as M } from '@vertexvis/utils';
20
- *
21
- * interface Address {
22
- * address: string;
23
- * city: string;
24
- * state: string;
25
- * zip: string;
26
- * }
27
- *
28
- * interface Person {
29
- * name: string;
30
- * addresses: Address[];
31
- * }
32
- *
33
- * type AddressJson = Partial<Address>;
34
- * type PersonJson = {
35
- * name?: string;
36
- * addresses?: AddressJson[];
37
- * }
38
- *
39
- * const mapAddress: M.Func<AddressJson, Address> = M.defineMapper(
40
- * M.read(
41
- * M.requireProp('address'),
42
- * M.requireProp('city'),
43
- * M.requireProp('state'),
44
- * M.requireProp('zip')
45
- * ),
46
- * ([address, city, state, zip]) => ({
47
- * address, city, state, zip
48
- * })
49
- * );
50
- *
51
- * const mapPerson: M.Func<PersonJson, Person> = M.defineMapper(
52
- * M.read(
53
- * M.requireProp('name'),
54
- * M.mapProp(
55
- * 'addresses',
56
- * M.compose(M.required('addresses'), M.mapArray(mapAddress))
57
- * )
58
- * ),
59
- * ([name, addresses]) => ({ name, addresses })
60
- * );
61
- *
62
- * const person = mapPerson({
63
- * name: 'John',
64
- * addresses: [{ address: '123', city: 'Ames', state: 'IA', zip: '50010' }]
65
- * });
66
- *
67
- * const invalidPerson = mapPerson({
68
- * addresses: [{ city: 'Ames', state: 'IA', zip: '50010' }]
69
- * });
70
- * ```
71
- * // {
72
- * // errors: ["Name is required.", "Address is required."]
73
- * // }
74
- *
75
- * @module
76
- */
77
- /**
78
- * An error that is thrown when validation of a schema fails.
79
- *
80
- * @see {@link ifInvalidThrow} - for throwing errors on invalid input.
81
- */
82
- /** @class */ ((function (_super) {
83
- tslib_es6.__extends(MapperValidationError, _super);
84
- function MapperValidationError(errors) {
85
- var _this = _super.call(this, 'Validation error mapping object.') || this;
86
- _this.errors = errors;
87
- Object.setPrototypeOf(_this, MapperValidationError.prototype);
88
- return _this;
89
- }
90
- return MapperValidationError;
91
- })(Error));
92
-
93
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
94
-
95
- var lodash_isequal = {exports: {}};
96
-
97
- /**
98
- * Lodash (Custom Build) <https://lodash.com/>
99
- * Build: `lodash modularize exports="npm" -o ./`
100
- * Copyright JS Foundation and other contributors <https://js.foundation/>
101
- * Released under MIT license <https://lodash.com/license>
102
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
103
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
104
- */
105
-
106
- (function (module, exports) {
107
- /** Used as the size to enable large array optimizations. */
108
- var LARGE_ARRAY_SIZE = 200;
109
-
110
- /** Used to stand-in for `undefined` hash values. */
111
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
112
-
113
- /** Used to compose bitmasks for value comparisons. */
114
- var COMPARE_PARTIAL_FLAG = 1,
115
- COMPARE_UNORDERED_FLAG = 2;
116
-
117
- /** Used as references for various `Number` constants. */
118
- var MAX_SAFE_INTEGER = 9007199254740991;
119
-
120
- /** `Object#toString` result references. */
121
- var argsTag = '[object Arguments]',
122
- arrayTag = '[object Array]',
123
- asyncTag = '[object AsyncFunction]',
124
- boolTag = '[object Boolean]',
125
- dateTag = '[object Date]',
126
- errorTag = '[object Error]',
127
- funcTag = '[object Function]',
128
- genTag = '[object GeneratorFunction]',
129
- mapTag = '[object Map]',
130
- numberTag = '[object Number]',
131
- nullTag = '[object Null]',
132
- objectTag = '[object Object]',
133
- promiseTag = '[object Promise]',
134
- proxyTag = '[object Proxy]',
135
- regexpTag = '[object RegExp]',
136
- setTag = '[object Set]',
137
- stringTag = '[object String]',
138
- symbolTag = '[object Symbol]',
139
- undefinedTag = '[object Undefined]',
140
- weakMapTag = '[object WeakMap]';
141
-
142
- var arrayBufferTag = '[object ArrayBuffer]',
143
- dataViewTag = '[object DataView]',
144
- float32Tag = '[object Float32Array]',
145
- float64Tag = '[object Float64Array]',
146
- int8Tag = '[object Int8Array]',
147
- int16Tag = '[object Int16Array]',
148
- int32Tag = '[object Int32Array]',
149
- uint8Tag = '[object Uint8Array]',
150
- uint8ClampedTag = '[object Uint8ClampedArray]',
151
- uint16Tag = '[object Uint16Array]',
152
- uint32Tag = '[object Uint32Array]';
153
-
154
- /**
155
- * Used to match `RegExp`
156
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
157
- */
158
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
159
-
160
- /** Used to detect host constructors (Safari). */
161
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
162
-
163
- /** Used to detect unsigned integer values. */
164
- var reIsUint = /^(?:0|[1-9]\d*)$/;
165
-
166
- /** Used to identify `toStringTag` values of typed arrays. */
167
- var typedArrayTags = {};
168
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
169
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
170
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
171
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
172
- typedArrayTags[uint32Tag] = true;
173
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
174
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
175
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
176
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
177
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
178
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
179
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
180
- typedArrayTags[weakMapTag] = false;
181
-
182
- /** Detect free variable `global` from Node.js. */
183
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
184
-
185
- /** Detect free variable `self`. */
186
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
187
-
188
- /** Used as a reference to the global object. */
189
- var root = freeGlobal || freeSelf || Function('return this')();
190
-
191
- /** Detect free variable `exports`. */
192
- var freeExports = exports && !exports.nodeType && exports;
193
-
194
- /** Detect free variable `module`. */
195
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
196
-
197
- /** Detect the popular CommonJS extension `module.exports`. */
198
- var moduleExports = freeModule && freeModule.exports === freeExports;
199
-
200
- /** Detect free variable `process` from Node.js. */
201
- var freeProcess = moduleExports && freeGlobal.process;
202
-
203
- /** Used to access faster Node.js helpers. */
204
- var nodeUtil = (function() {
205
- try {
206
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
207
- } catch (e) {}
208
- }());
209
-
210
- /* Node.js helper references. */
211
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
212
-
213
- /**
214
- * A specialized version of `_.filter` for arrays without support for
215
- * iteratee shorthands.
216
- *
217
- * @private
218
- * @param {Array} [array] The array to iterate over.
219
- * @param {Function} predicate The function invoked per iteration.
220
- * @returns {Array} Returns the new filtered array.
221
- */
222
- function arrayFilter(array, predicate) {
223
- var index = -1,
224
- length = array == null ? 0 : array.length,
225
- resIndex = 0,
226
- result = [];
227
-
228
- while (++index < length) {
229
- var value = array[index];
230
- if (predicate(value, index, array)) {
231
- result[resIndex++] = value;
232
- }
233
- }
234
- return result;
235
- }
236
-
237
- /**
238
- * Appends the elements of `values` to `array`.
239
- *
240
- * @private
241
- * @param {Array} array The array to modify.
242
- * @param {Array} values The values to append.
243
- * @returns {Array} Returns `array`.
244
- */
245
- function arrayPush(array, values) {
246
- var index = -1,
247
- length = values.length,
248
- offset = array.length;
249
-
250
- while (++index < length) {
251
- array[offset + index] = values[index];
252
- }
253
- return array;
254
- }
255
-
256
- /**
257
- * A specialized version of `_.some` for arrays without support for iteratee
258
- * shorthands.
259
- *
260
- * @private
261
- * @param {Array} [array] The array to iterate over.
262
- * @param {Function} predicate The function invoked per iteration.
263
- * @returns {boolean} Returns `true` if any element passes the predicate check,
264
- * else `false`.
265
- */
266
- function arraySome(array, predicate) {
267
- var index = -1,
268
- length = array == null ? 0 : array.length;
269
-
270
- while (++index < length) {
271
- if (predicate(array[index], index, array)) {
272
- return true;
273
- }
274
- }
275
- return false;
276
- }
277
-
278
- /**
279
- * The base implementation of `_.times` without support for iteratee shorthands
280
- * or max array length checks.
281
- *
282
- * @private
283
- * @param {number} n The number of times to invoke `iteratee`.
284
- * @param {Function} iteratee The function invoked per iteration.
285
- * @returns {Array} Returns the array of results.
286
- */
287
- function baseTimes(n, iteratee) {
288
- var index = -1,
289
- result = Array(n);
290
-
291
- while (++index < n) {
292
- result[index] = iteratee(index);
293
- }
294
- return result;
295
- }
296
-
297
- /**
298
- * The base implementation of `_.unary` without support for storing metadata.
299
- *
300
- * @private
301
- * @param {Function} func The function to cap arguments for.
302
- * @returns {Function} Returns the new capped function.
303
- */
304
- function baseUnary(func) {
305
- return function(value) {
306
- return func(value);
307
- };
308
- }
309
-
310
- /**
311
- * Checks if a `cache` value for `key` exists.
312
- *
313
- * @private
314
- * @param {Object} cache The cache to query.
315
- * @param {string} key The key of the entry to check.
316
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
317
- */
318
- function cacheHas(cache, key) {
319
- return cache.has(key);
320
- }
321
-
322
- /**
323
- * Gets the value at `key` of `object`.
324
- *
325
- * @private
326
- * @param {Object} [object] The object to query.
327
- * @param {string} key The key of the property to get.
328
- * @returns {*} Returns the property value.
329
- */
330
- function getValue(object, key) {
331
- return object == null ? undefined : object[key];
332
- }
333
-
334
- /**
335
- * Converts `map` to its key-value pairs.
336
- *
337
- * @private
338
- * @param {Object} map The map to convert.
339
- * @returns {Array} Returns the key-value pairs.
340
- */
341
- function mapToArray(map) {
342
- var index = -1,
343
- result = Array(map.size);
344
-
345
- map.forEach(function(value, key) {
346
- result[++index] = [key, value];
347
- });
348
- return result;
349
- }
350
-
351
- /**
352
- * Creates a unary function that invokes `func` with its argument transformed.
353
- *
354
- * @private
355
- * @param {Function} func The function to wrap.
356
- * @param {Function} transform The argument transform.
357
- * @returns {Function} Returns the new function.
358
- */
359
- function overArg(func, transform) {
360
- return function(arg) {
361
- return func(transform(arg));
362
- };
363
- }
364
-
365
- /**
366
- * Converts `set` to an array of its values.
367
- *
368
- * @private
369
- * @param {Object} set The set to convert.
370
- * @returns {Array} Returns the values.
371
- */
372
- function setToArray(set) {
373
- var index = -1,
374
- result = Array(set.size);
375
-
376
- set.forEach(function(value) {
377
- result[++index] = value;
378
- });
379
- return result;
380
- }
381
-
382
- /** Used for built-in method references. */
383
- var arrayProto = Array.prototype,
384
- funcProto = Function.prototype,
385
- objectProto = Object.prototype;
386
-
387
- /** Used to detect overreaching core-js shims. */
388
- var coreJsData = root['__core-js_shared__'];
389
-
390
- /** Used to resolve the decompiled source of functions. */
391
- var funcToString = funcProto.toString;
392
-
393
- /** Used to check objects for own properties. */
394
- var hasOwnProperty = objectProto.hasOwnProperty;
395
-
396
- /** Used to detect methods masquerading as native. */
397
- var maskSrcKey = (function() {
398
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
399
- return uid ? ('Symbol(src)_1.' + uid) : '';
400
- }());
401
-
402
- /**
403
- * Used to resolve the
404
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
405
- * of values.
406
- */
407
- var nativeObjectToString = objectProto.toString;
408
-
409
- /** Used to detect if a method is native. */
410
- var reIsNative = RegExp('^' +
411
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
412
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
413
- );
414
-
415
- /** Built-in value references. */
416
- var Buffer = moduleExports ? root.Buffer : undefined,
417
- Symbol = root.Symbol,
418
- Uint8Array = root.Uint8Array,
419
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
420
- splice = arrayProto.splice,
421
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
422
-
423
- /* Built-in method references for those with the same name as other `lodash` methods. */
424
- var nativeGetSymbols = Object.getOwnPropertySymbols,
425
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
426
- nativeKeys = overArg(Object.keys, Object);
427
-
428
- /* Built-in method references that are verified to be native. */
429
- var DataView = getNative(root, 'DataView'),
430
- Map = getNative(root, 'Map'),
431
- Promise = getNative(root, 'Promise'),
432
- Set = getNative(root, 'Set'),
433
- WeakMap = getNative(root, 'WeakMap'),
434
- nativeCreate = getNative(Object, 'create');
435
-
436
- /** Used to detect maps, sets, and weakmaps. */
437
- var dataViewCtorString = toSource(DataView),
438
- mapCtorString = toSource(Map),
439
- promiseCtorString = toSource(Promise),
440
- setCtorString = toSource(Set),
441
- weakMapCtorString = toSource(WeakMap);
442
-
443
- /** Used to convert symbols to primitives and strings. */
444
- var symbolProto = Symbol ? Symbol.prototype : undefined,
445
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
446
-
447
- /**
448
- * Creates a hash object.
449
- *
450
- * @private
451
- * @constructor
452
- * @param {Array} [entries] The key-value pairs to cache.
453
- */
454
- function Hash(entries) {
455
- var index = -1,
456
- length = entries == null ? 0 : entries.length;
457
-
458
- this.clear();
459
- while (++index < length) {
460
- var entry = entries[index];
461
- this.set(entry[0], entry[1]);
462
- }
463
- }
464
-
465
- /**
466
- * Removes all key-value entries from the hash.
467
- *
468
- * @private
469
- * @name clear
470
- * @memberOf Hash
471
- */
472
- function hashClear() {
473
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
474
- this.size = 0;
475
- }
476
-
477
- /**
478
- * Removes `key` and its value from the hash.
479
- *
480
- * @private
481
- * @name delete
482
- * @memberOf Hash
483
- * @param {Object} hash The hash to modify.
484
- * @param {string} key The key of the value to remove.
485
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
486
- */
487
- function hashDelete(key) {
488
- var result = this.has(key) && delete this.__data__[key];
489
- this.size -= result ? 1 : 0;
490
- return result;
491
- }
492
-
493
- /**
494
- * Gets the hash value for `key`.
495
- *
496
- * @private
497
- * @name get
498
- * @memberOf Hash
499
- * @param {string} key The key of the value to get.
500
- * @returns {*} Returns the entry value.
501
- */
502
- function hashGet(key) {
503
- var data = this.__data__;
504
- if (nativeCreate) {
505
- var result = data[key];
506
- return result === HASH_UNDEFINED ? undefined : result;
507
- }
508
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
509
- }
510
-
511
- /**
512
- * Checks if a hash value for `key` exists.
513
- *
514
- * @private
515
- * @name has
516
- * @memberOf Hash
517
- * @param {string} key The key of the entry to check.
518
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
519
- */
520
- function hashHas(key) {
521
- var data = this.__data__;
522
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
523
- }
524
-
525
- /**
526
- * Sets the hash `key` to `value`.
527
- *
528
- * @private
529
- * @name set
530
- * @memberOf Hash
531
- * @param {string} key The key of the value to set.
532
- * @param {*} value The value to set.
533
- * @returns {Object} Returns the hash instance.
534
- */
535
- function hashSet(key, value) {
536
- var data = this.__data__;
537
- this.size += this.has(key) ? 0 : 1;
538
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
539
- return this;
540
- }
541
-
542
- // Add methods to `Hash`.
543
- Hash.prototype.clear = hashClear;
544
- Hash.prototype['delete'] = hashDelete;
545
- Hash.prototype.get = hashGet;
546
- Hash.prototype.has = hashHas;
547
- Hash.prototype.set = hashSet;
548
-
549
- /**
550
- * Creates an list cache object.
551
- *
552
- * @private
553
- * @constructor
554
- * @param {Array} [entries] The key-value pairs to cache.
555
- */
556
- function ListCache(entries) {
557
- var index = -1,
558
- length = entries == null ? 0 : entries.length;
559
-
560
- this.clear();
561
- while (++index < length) {
562
- var entry = entries[index];
563
- this.set(entry[0], entry[1]);
564
- }
565
- }
566
-
567
- /**
568
- * Removes all key-value entries from the list cache.
569
- *
570
- * @private
571
- * @name clear
572
- * @memberOf ListCache
573
- */
574
- function listCacheClear() {
575
- this.__data__ = [];
576
- this.size = 0;
577
- }
578
-
579
- /**
580
- * Removes `key` and its value from the list cache.
581
- *
582
- * @private
583
- * @name delete
584
- * @memberOf ListCache
585
- * @param {string} key The key of the value to remove.
586
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
587
- */
588
- function listCacheDelete(key) {
589
- var data = this.__data__,
590
- index = assocIndexOf(data, key);
591
-
592
- if (index < 0) {
593
- return false;
594
- }
595
- var lastIndex = data.length - 1;
596
- if (index == lastIndex) {
597
- data.pop();
598
- } else {
599
- splice.call(data, index, 1);
600
- }
601
- --this.size;
602
- return true;
603
- }
604
-
605
- /**
606
- * Gets the list cache value for `key`.
607
- *
608
- * @private
609
- * @name get
610
- * @memberOf ListCache
611
- * @param {string} key The key of the value to get.
612
- * @returns {*} Returns the entry value.
613
- */
614
- function listCacheGet(key) {
615
- var data = this.__data__,
616
- index = assocIndexOf(data, key);
617
-
618
- return index < 0 ? undefined : data[index][1];
619
- }
620
-
621
- /**
622
- * Checks if a list cache value for `key` exists.
623
- *
624
- * @private
625
- * @name has
626
- * @memberOf ListCache
627
- * @param {string} key The key of the entry to check.
628
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
629
- */
630
- function listCacheHas(key) {
631
- return assocIndexOf(this.__data__, key) > -1;
632
- }
633
-
634
- /**
635
- * Sets the list cache `key` to `value`.
636
- *
637
- * @private
638
- * @name set
639
- * @memberOf ListCache
640
- * @param {string} key The key of the value to set.
641
- * @param {*} value The value to set.
642
- * @returns {Object} Returns the list cache instance.
643
- */
644
- function listCacheSet(key, value) {
645
- var data = this.__data__,
646
- index = assocIndexOf(data, key);
647
-
648
- if (index < 0) {
649
- ++this.size;
650
- data.push([key, value]);
651
- } else {
652
- data[index][1] = value;
653
- }
654
- return this;
655
- }
656
-
657
- // Add methods to `ListCache`.
658
- ListCache.prototype.clear = listCacheClear;
659
- ListCache.prototype['delete'] = listCacheDelete;
660
- ListCache.prototype.get = listCacheGet;
661
- ListCache.prototype.has = listCacheHas;
662
- ListCache.prototype.set = listCacheSet;
663
-
664
- /**
665
- * Creates a map cache object to store key-value pairs.
666
- *
667
- * @private
668
- * @constructor
669
- * @param {Array} [entries] The key-value pairs to cache.
670
- */
671
- function MapCache(entries) {
672
- var index = -1,
673
- length = entries == null ? 0 : entries.length;
674
-
675
- this.clear();
676
- while (++index < length) {
677
- var entry = entries[index];
678
- this.set(entry[0], entry[1]);
679
- }
680
- }
681
-
682
- /**
683
- * Removes all key-value entries from the map.
684
- *
685
- * @private
686
- * @name clear
687
- * @memberOf MapCache
688
- */
689
- function mapCacheClear() {
690
- this.size = 0;
691
- this.__data__ = {
692
- 'hash': new Hash,
693
- 'map': new (Map || ListCache),
694
- 'string': new Hash
695
- };
696
- }
697
-
698
- /**
699
- * Removes `key` and its value from the map.
700
- *
701
- * @private
702
- * @name delete
703
- * @memberOf MapCache
704
- * @param {string} key The key of the value to remove.
705
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
706
- */
707
- function mapCacheDelete(key) {
708
- var result = getMapData(this, key)['delete'](key);
709
- this.size -= result ? 1 : 0;
710
- return result;
711
- }
712
-
713
- /**
714
- * Gets the map value for `key`.
715
- *
716
- * @private
717
- * @name get
718
- * @memberOf MapCache
719
- * @param {string} key The key of the value to get.
720
- * @returns {*} Returns the entry value.
721
- */
722
- function mapCacheGet(key) {
723
- return getMapData(this, key).get(key);
724
- }
725
-
726
- /**
727
- * Checks if a map value for `key` exists.
728
- *
729
- * @private
730
- * @name has
731
- * @memberOf MapCache
732
- * @param {string} key The key of the entry to check.
733
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
734
- */
735
- function mapCacheHas(key) {
736
- return getMapData(this, key).has(key);
737
- }
738
-
739
- /**
740
- * Sets the map `key` to `value`.
741
- *
742
- * @private
743
- * @name set
744
- * @memberOf MapCache
745
- * @param {string} key The key of the value to set.
746
- * @param {*} value The value to set.
747
- * @returns {Object} Returns the map cache instance.
748
- */
749
- function mapCacheSet(key, value) {
750
- var data = getMapData(this, key),
751
- size = data.size;
752
-
753
- data.set(key, value);
754
- this.size += data.size == size ? 0 : 1;
755
- return this;
756
- }
757
-
758
- // Add methods to `MapCache`.
759
- MapCache.prototype.clear = mapCacheClear;
760
- MapCache.prototype['delete'] = mapCacheDelete;
761
- MapCache.prototype.get = mapCacheGet;
762
- MapCache.prototype.has = mapCacheHas;
763
- MapCache.prototype.set = mapCacheSet;
764
-
765
- /**
766
- *
767
- * Creates an array cache object to store unique values.
768
- *
769
- * @private
770
- * @constructor
771
- * @param {Array} [values] The values to cache.
772
- */
773
- function SetCache(values) {
774
- var index = -1,
775
- length = values == null ? 0 : values.length;
776
-
777
- this.__data__ = new MapCache;
778
- while (++index < length) {
779
- this.add(values[index]);
780
- }
781
- }
782
-
783
- /**
784
- * Adds `value` to the array cache.
785
- *
786
- * @private
787
- * @name add
788
- * @memberOf SetCache
789
- * @alias push
790
- * @param {*} value The value to cache.
791
- * @returns {Object} Returns the cache instance.
792
- */
793
- function setCacheAdd(value) {
794
- this.__data__.set(value, HASH_UNDEFINED);
795
- return this;
796
- }
797
-
798
- /**
799
- * Checks if `value` is in the array cache.
800
- *
801
- * @private
802
- * @name has
803
- * @memberOf SetCache
804
- * @param {*} value The value to search for.
805
- * @returns {number} Returns `true` if `value` is found, else `false`.
806
- */
807
- function setCacheHas(value) {
808
- return this.__data__.has(value);
809
- }
810
-
811
- // Add methods to `SetCache`.
812
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
813
- SetCache.prototype.has = setCacheHas;
814
-
815
- /**
816
- * Creates a stack cache object to store key-value pairs.
817
- *
818
- * @private
819
- * @constructor
820
- * @param {Array} [entries] The key-value pairs to cache.
821
- */
822
- function Stack(entries) {
823
- var data = this.__data__ = new ListCache(entries);
824
- this.size = data.size;
825
- }
826
-
827
- /**
828
- * Removes all key-value entries from the stack.
829
- *
830
- * @private
831
- * @name clear
832
- * @memberOf Stack
833
- */
834
- function stackClear() {
835
- this.__data__ = new ListCache;
836
- this.size = 0;
837
- }
838
-
839
- /**
840
- * Removes `key` and its value from the stack.
841
- *
842
- * @private
843
- * @name delete
844
- * @memberOf Stack
845
- * @param {string} key The key of the value to remove.
846
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
847
- */
848
- function stackDelete(key) {
849
- var data = this.__data__,
850
- result = data['delete'](key);
851
-
852
- this.size = data.size;
853
- return result;
854
- }
855
-
856
- /**
857
- * Gets the stack value for `key`.
858
- *
859
- * @private
860
- * @name get
861
- * @memberOf Stack
862
- * @param {string} key The key of the value to get.
863
- * @returns {*} Returns the entry value.
864
- */
865
- function stackGet(key) {
866
- return this.__data__.get(key);
867
- }
868
-
869
- /**
870
- * Checks if a stack value for `key` exists.
871
- *
872
- * @private
873
- * @name has
874
- * @memberOf Stack
875
- * @param {string} key The key of the entry to check.
876
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
877
- */
878
- function stackHas(key) {
879
- return this.__data__.has(key);
880
- }
881
-
882
- /**
883
- * Sets the stack `key` to `value`.
884
- *
885
- * @private
886
- * @name set
887
- * @memberOf Stack
888
- * @param {string} key The key of the value to set.
889
- * @param {*} value The value to set.
890
- * @returns {Object} Returns the stack cache instance.
891
- */
892
- function stackSet(key, value) {
893
- var data = this.__data__;
894
- if (data instanceof ListCache) {
895
- var pairs = data.__data__;
896
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
897
- pairs.push([key, value]);
898
- this.size = ++data.size;
899
- return this;
900
- }
901
- data = this.__data__ = new MapCache(pairs);
902
- }
903
- data.set(key, value);
904
- this.size = data.size;
905
- return this;
906
- }
907
-
908
- // Add methods to `Stack`.
909
- Stack.prototype.clear = stackClear;
910
- Stack.prototype['delete'] = stackDelete;
911
- Stack.prototype.get = stackGet;
912
- Stack.prototype.has = stackHas;
913
- Stack.prototype.set = stackSet;
914
-
915
- /**
916
- * Creates an array of the enumerable property names of the array-like `value`.
917
- *
918
- * @private
919
- * @param {*} value The value to query.
920
- * @param {boolean} inherited Specify returning inherited property names.
921
- * @returns {Array} Returns the array of property names.
922
- */
923
- function arrayLikeKeys(value, inherited) {
924
- var isArr = isArray(value),
925
- isArg = !isArr && isArguments(value),
926
- isBuff = !isArr && !isArg && isBuffer(value),
927
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
928
- skipIndexes = isArr || isArg || isBuff || isType,
929
- result = skipIndexes ? baseTimes(value.length, String) : [],
930
- length = result.length;
931
-
932
- for (var key in value) {
933
- if ((inherited || hasOwnProperty.call(value, key)) &&
934
- !(skipIndexes && (
935
- // Safari 9 has enumerable `arguments.length` in strict mode.
936
- key == 'length' ||
937
- // Node.js 0.10 has enumerable non-index properties on buffers.
938
- (isBuff && (key == 'offset' || key == 'parent')) ||
939
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
940
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
941
- // Skip index properties.
942
- isIndex(key, length)
943
- ))) {
944
- result.push(key);
945
- }
946
- }
947
- return result;
948
- }
949
-
950
- /**
951
- * Gets the index at which the `key` is found in `array` of key-value pairs.
952
- *
953
- * @private
954
- * @param {Array} array The array to inspect.
955
- * @param {*} key The key to search for.
956
- * @returns {number} Returns the index of the matched value, else `-1`.
957
- */
958
- function assocIndexOf(array, key) {
959
- var length = array.length;
960
- while (length--) {
961
- if (eq(array[length][0], key)) {
962
- return length;
963
- }
964
- }
965
- return -1;
966
- }
967
-
968
- /**
969
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
970
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
971
- * symbols of `object`.
972
- *
973
- * @private
974
- * @param {Object} object The object to query.
975
- * @param {Function} keysFunc The function to get the keys of `object`.
976
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
977
- * @returns {Array} Returns the array of property names and symbols.
978
- */
979
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
980
- var result = keysFunc(object);
981
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
982
- }
983
-
984
- /**
985
- * The base implementation of `getTag` without fallbacks for buggy environments.
986
- *
987
- * @private
988
- * @param {*} value The value to query.
989
- * @returns {string} Returns the `toStringTag`.
990
- */
991
- function baseGetTag(value) {
992
- if (value == null) {
993
- return value === undefined ? undefinedTag : nullTag;
994
- }
995
- return (symToStringTag && symToStringTag in Object(value))
996
- ? getRawTag(value)
997
- : objectToString(value);
998
- }
999
-
1000
- /**
1001
- * The base implementation of `_.isArguments`.
1002
- *
1003
- * @private
1004
- * @param {*} value The value to check.
1005
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1006
- */
1007
- function baseIsArguments(value) {
1008
- return isObjectLike(value) && baseGetTag(value) == argsTag;
1009
- }
1010
-
1011
- /**
1012
- * The base implementation of `_.isEqual` which supports partial comparisons
1013
- * and tracks traversed objects.
1014
- *
1015
- * @private
1016
- * @param {*} value The value to compare.
1017
- * @param {*} other The other value to compare.
1018
- * @param {boolean} bitmask The bitmask flags.
1019
- * 1 - Unordered comparison
1020
- * 2 - Partial comparison
1021
- * @param {Function} [customizer] The function to customize comparisons.
1022
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1023
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1024
- */
1025
- function baseIsEqual(value, other, bitmask, customizer, stack) {
1026
- if (value === other) {
1027
- return true;
1028
- }
1029
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1030
- return value !== value && other !== other;
1031
- }
1032
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1033
- }
1034
-
1035
- /**
1036
- * A specialized version of `baseIsEqual` for arrays and objects which performs
1037
- * deep comparisons and tracks traversed objects enabling objects with circular
1038
- * references to be compared.
1039
- *
1040
- * @private
1041
- * @param {Object} object The object to compare.
1042
- * @param {Object} other The other object to compare.
1043
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1044
- * @param {Function} customizer The function to customize comparisons.
1045
- * @param {Function} equalFunc The function to determine equivalents of values.
1046
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1047
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1048
- */
1049
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1050
- var objIsArr = isArray(object),
1051
- othIsArr = isArray(other),
1052
- objTag = objIsArr ? arrayTag : getTag(object),
1053
- othTag = othIsArr ? arrayTag : getTag(other);
1054
-
1055
- objTag = objTag == argsTag ? objectTag : objTag;
1056
- othTag = othTag == argsTag ? objectTag : othTag;
1057
-
1058
- var objIsObj = objTag == objectTag,
1059
- othIsObj = othTag == objectTag,
1060
- isSameTag = objTag == othTag;
1061
-
1062
- if (isSameTag && isBuffer(object)) {
1063
- if (!isBuffer(other)) {
1064
- return false;
1065
- }
1066
- objIsArr = true;
1067
- objIsObj = false;
1068
- }
1069
- if (isSameTag && !objIsObj) {
1070
- stack || (stack = new Stack);
1071
- return (objIsArr || isTypedArray(object))
1072
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1073
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1074
- }
1075
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1076
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1077
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1078
-
1079
- if (objIsWrapped || othIsWrapped) {
1080
- var objUnwrapped = objIsWrapped ? object.value() : object,
1081
- othUnwrapped = othIsWrapped ? other.value() : other;
1082
-
1083
- stack || (stack = new Stack);
1084
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1085
- }
1086
- }
1087
- if (!isSameTag) {
1088
- return false;
1089
- }
1090
- stack || (stack = new Stack);
1091
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1092
- }
1093
-
1094
- /**
1095
- * The base implementation of `_.isNative` without bad shim checks.
1096
- *
1097
- * @private
1098
- * @param {*} value The value to check.
1099
- * @returns {boolean} Returns `true` if `value` is a native function,
1100
- * else `false`.
1101
- */
1102
- function baseIsNative(value) {
1103
- if (!isObject(value) || isMasked(value)) {
1104
- return false;
1105
- }
1106
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1107
- return pattern.test(toSource(value));
1108
- }
1109
-
1110
- /**
1111
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1112
- *
1113
- * @private
1114
- * @param {*} value The value to check.
1115
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1116
- */
1117
- function baseIsTypedArray(value) {
1118
- return isObjectLike(value) &&
1119
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1120
- }
1121
-
1122
- /**
1123
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1124
- *
1125
- * @private
1126
- * @param {Object} object The object to query.
1127
- * @returns {Array} Returns the array of property names.
1128
- */
1129
- function baseKeys(object) {
1130
- if (!isPrototype(object)) {
1131
- return nativeKeys(object);
1132
- }
1133
- var result = [];
1134
- for (var key in Object(object)) {
1135
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
1136
- result.push(key);
1137
- }
1138
- }
1139
- return result;
1140
- }
1141
-
1142
- /**
1143
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1144
- * partial deep comparisons.
1145
- *
1146
- * @private
1147
- * @param {Array} array The array to compare.
1148
- * @param {Array} other The other array to compare.
1149
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1150
- * @param {Function} customizer The function to customize comparisons.
1151
- * @param {Function} equalFunc The function to determine equivalents of values.
1152
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1153
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1154
- */
1155
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1156
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1157
- arrLength = array.length,
1158
- othLength = other.length;
1159
-
1160
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1161
- return false;
1162
- }
1163
- // Assume cyclic values are equal.
1164
- var stacked = stack.get(array);
1165
- if (stacked && stack.get(other)) {
1166
- return stacked == other;
1167
- }
1168
- var index = -1,
1169
- result = true,
1170
- seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1171
-
1172
- stack.set(array, other);
1173
- stack.set(other, array);
1174
-
1175
- // Ignore non-index properties.
1176
- while (++index < arrLength) {
1177
- var arrValue = array[index],
1178
- othValue = other[index];
1179
-
1180
- if (customizer) {
1181
- var compared = isPartial
1182
- ? customizer(othValue, arrValue, index, other, array, stack)
1183
- : customizer(arrValue, othValue, index, array, other, stack);
1184
- }
1185
- if (compared !== undefined) {
1186
- if (compared) {
1187
- continue;
1188
- }
1189
- result = false;
1190
- break;
1191
- }
1192
- // Recursively compare arrays (susceptible to call stack limits).
1193
- if (seen) {
1194
- if (!arraySome(other, function(othValue, othIndex) {
1195
- if (!cacheHas(seen, othIndex) &&
1196
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1197
- return seen.push(othIndex);
1198
- }
1199
- })) {
1200
- result = false;
1201
- break;
1202
- }
1203
- } else if (!(
1204
- arrValue === othValue ||
1205
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1206
- )) {
1207
- result = false;
1208
- break;
1209
- }
1210
- }
1211
- stack['delete'](array);
1212
- stack['delete'](other);
1213
- return result;
1214
- }
1215
-
1216
- /**
1217
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1218
- * the same `toStringTag`.
1219
- *
1220
- * **Note:** This function only supports comparing values with tags of
1221
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1222
- *
1223
- * @private
1224
- * @param {Object} object The object to compare.
1225
- * @param {Object} other The other object to compare.
1226
- * @param {string} tag The `toStringTag` of the objects to compare.
1227
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1228
- * @param {Function} customizer The function to customize comparisons.
1229
- * @param {Function} equalFunc The function to determine equivalents of values.
1230
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1231
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1232
- */
1233
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1234
- switch (tag) {
1235
- case dataViewTag:
1236
- if ((object.byteLength != other.byteLength) ||
1237
- (object.byteOffset != other.byteOffset)) {
1238
- return false;
1239
- }
1240
- object = object.buffer;
1241
- other = other.buffer;
1242
-
1243
- case arrayBufferTag:
1244
- if ((object.byteLength != other.byteLength) ||
1245
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1246
- return false;
1247
- }
1248
- return true;
1249
-
1250
- case boolTag:
1251
- case dateTag:
1252
- case numberTag:
1253
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1254
- // Invalid dates are coerced to `NaN`.
1255
- return eq(+object, +other);
1256
-
1257
- case errorTag:
1258
- return object.name == other.name && object.message == other.message;
1259
-
1260
- case regexpTag:
1261
- case stringTag:
1262
- // Coerce regexes to strings and treat strings, primitives and objects,
1263
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1264
- // for more details.
1265
- return object == (other + '');
1266
-
1267
- case mapTag:
1268
- var convert = mapToArray;
1269
-
1270
- case setTag:
1271
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1272
- convert || (convert = setToArray);
1273
-
1274
- if (object.size != other.size && !isPartial) {
1275
- return false;
1276
- }
1277
- // Assume cyclic values are equal.
1278
- var stacked = stack.get(object);
1279
- if (stacked) {
1280
- return stacked == other;
1281
- }
1282
- bitmask |= COMPARE_UNORDERED_FLAG;
1283
-
1284
- // Recursively compare objects (susceptible to call stack limits).
1285
- stack.set(object, other);
1286
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1287
- stack['delete'](object);
1288
- return result;
1289
-
1290
- case symbolTag:
1291
- if (symbolValueOf) {
1292
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1293
- }
1294
- }
1295
- return false;
1296
- }
1297
-
1298
- /**
1299
- * A specialized version of `baseIsEqualDeep` for objects with support for
1300
- * partial deep comparisons.
1301
- *
1302
- * @private
1303
- * @param {Object} object The object to compare.
1304
- * @param {Object} other The other object to compare.
1305
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1306
- * @param {Function} customizer The function to customize comparisons.
1307
- * @param {Function} equalFunc The function to determine equivalents of values.
1308
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1309
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1310
- */
1311
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1312
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1313
- objProps = getAllKeys(object),
1314
- objLength = objProps.length,
1315
- othProps = getAllKeys(other),
1316
- othLength = othProps.length;
1317
-
1318
- if (objLength != othLength && !isPartial) {
1319
- return false;
1320
- }
1321
- var index = objLength;
1322
- while (index--) {
1323
- var key = objProps[index];
1324
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1325
- return false;
1326
- }
1327
- }
1328
- // Assume cyclic values are equal.
1329
- var stacked = stack.get(object);
1330
- if (stacked && stack.get(other)) {
1331
- return stacked == other;
1332
- }
1333
- var result = true;
1334
- stack.set(object, other);
1335
- stack.set(other, object);
1336
-
1337
- var skipCtor = isPartial;
1338
- while (++index < objLength) {
1339
- key = objProps[index];
1340
- var objValue = object[key],
1341
- othValue = other[key];
1342
-
1343
- if (customizer) {
1344
- var compared = isPartial
1345
- ? customizer(othValue, objValue, key, other, object, stack)
1346
- : customizer(objValue, othValue, key, object, other, stack);
1347
- }
1348
- // Recursively compare objects (susceptible to call stack limits).
1349
- if (!(compared === undefined
1350
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1351
- : compared
1352
- )) {
1353
- result = false;
1354
- break;
1355
- }
1356
- skipCtor || (skipCtor = key == 'constructor');
1357
- }
1358
- if (result && !skipCtor) {
1359
- var objCtor = object.constructor,
1360
- othCtor = other.constructor;
1361
-
1362
- // Non `Object` object instances with different constructors are not equal.
1363
- if (objCtor != othCtor &&
1364
- ('constructor' in object && 'constructor' in other) &&
1365
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1366
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1367
- result = false;
1368
- }
1369
- }
1370
- stack['delete'](object);
1371
- stack['delete'](other);
1372
- return result;
1373
- }
1374
-
1375
- /**
1376
- * Creates an array of own enumerable property names and symbols of `object`.
1377
- *
1378
- * @private
1379
- * @param {Object} object The object to query.
1380
- * @returns {Array} Returns the array of property names and symbols.
1381
- */
1382
- function getAllKeys(object) {
1383
- return baseGetAllKeys(object, keys, getSymbols);
1384
- }
1385
-
1386
- /**
1387
- * Gets the data for `map`.
1388
- *
1389
- * @private
1390
- * @param {Object} map The map to query.
1391
- * @param {string} key The reference key.
1392
- * @returns {*} Returns the map data.
1393
- */
1394
- function getMapData(map, key) {
1395
- var data = map.__data__;
1396
- return isKeyable(key)
1397
- ? data[typeof key == 'string' ? 'string' : 'hash']
1398
- : data.map;
1399
- }
1400
-
1401
- /**
1402
- * Gets the native function at `key` of `object`.
1403
- *
1404
- * @private
1405
- * @param {Object} object The object to query.
1406
- * @param {string} key The key of the method to get.
1407
- * @returns {*} Returns the function if it's native, else `undefined`.
1408
- */
1409
- function getNative(object, key) {
1410
- var value = getValue(object, key);
1411
- return baseIsNative(value) ? value : undefined;
1412
- }
1413
-
1414
- /**
1415
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1416
- *
1417
- * @private
1418
- * @param {*} value The value to query.
1419
- * @returns {string} Returns the raw `toStringTag`.
1420
- */
1421
- function getRawTag(value) {
1422
- var isOwn = hasOwnProperty.call(value, symToStringTag),
1423
- tag = value[symToStringTag];
1424
-
1425
- try {
1426
- value[symToStringTag] = undefined;
1427
- var unmasked = true;
1428
- } catch (e) {}
1429
-
1430
- var result = nativeObjectToString.call(value);
1431
- if (unmasked) {
1432
- if (isOwn) {
1433
- value[symToStringTag] = tag;
1434
- } else {
1435
- delete value[symToStringTag];
1436
- }
1437
- }
1438
- return result;
1439
- }
1440
-
1441
- /**
1442
- * Creates an array of the own enumerable symbols of `object`.
1443
- *
1444
- * @private
1445
- * @param {Object} object The object to query.
1446
- * @returns {Array} Returns the array of symbols.
1447
- */
1448
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1449
- if (object == null) {
1450
- return [];
1451
- }
1452
- object = Object(object);
1453
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1454
- return propertyIsEnumerable.call(object, symbol);
1455
- });
1456
- };
1457
-
1458
- /**
1459
- * Gets the `toStringTag` of `value`.
1460
- *
1461
- * @private
1462
- * @param {*} value The value to query.
1463
- * @returns {string} Returns the `toStringTag`.
1464
- */
1465
- var getTag = baseGetTag;
1466
-
1467
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1468
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1469
- (Map && getTag(new Map) != mapTag) ||
1470
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
1471
- (Set && getTag(new Set) != setTag) ||
1472
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1473
- getTag = function(value) {
1474
- var result = baseGetTag(value),
1475
- Ctor = result == objectTag ? value.constructor : undefined,
1476
- ctorString = Ctor ? toSource(Ctor) : '';
1477
-
1478
- if (ctorString) {
1479
- switch (ctorString) {
1480
- case dataViewCtorString: return dataViewTag;
1481
- case mapCtorString: return mapTag;
1482
- case promiseCtorString: return promiseTag;
1483
- case setCtorString: return setTag;
1484
- case weakMapCtorString: return weakMapTag;
1485
- }
1486
- }
1487
- return result;
1488
- };
1489
- }
1490
-
1491
- /**
1492
- * Checks if `value` is a valid array-like index.
1493
- *
1494
- * @private
1495
- * @param {*} value The value to check.
1496
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1497
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1498
- */
1499
- function isIndex(value, length) {
1500
- length = length == null ? MAX_SAFE_INTEGER : length;
1501
- return !!length &&
1502
- (typeof value == 'number' || reIsUint.test(value)) &&
1503
- (value > -1 && value % 1 == 0 && value < length);
1504
- }
1505
-
1506
- /**
1507
- * Checks if `value` is suitable for use as unique object key.
1508
- *
1509
- * @private
1510
- * @param {*} value The value to check.
1511
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1512
- */
1513
- function isKeyable(value) {
1514
- var type = typeof value;
1515
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1516
- ? (value !== '__proto__')
1517
- : (value === null);
1518
- }
1519
-
1520
- /**
1521
- * Checks if `func` has its source masked.
1522
- *
1523
- * @private
1524
- * @param {Function} func The function to check.
1525
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1526
- */
1527
- function isMasked(func) {
1528
- return !!maskSrcKey && (maskSrcKey in func);
1529
- }
1530
-
1531
- /**
1532
- * Checks if `value` is likely a prototype object.
1533
- *
1534
- * @private
1535
- * @param {*} value The value to check.
1536
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1537
- */
1538
- function isPrototype(value) {
1539
- var Ctor = value && value.constructor,
1540
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1541
-
1542
- return value === proto;
1543
- }
1544
-
1545
- /**
1546
- * Converts `value` to a string using `Object.prototype.toString`.
1547
- *
1548
- * @private
1549
- * @param {*} value The value to convert.
1550
- * @returns {string} Returns the converted string.
1551
- */
1552
- function objectToString(value) {
1553
- return nativeObjectToString.call(value);
1554
- }
1555
-
1556
- /**
1557
- * Converts `func` to its source code.
1558
- *
1559
- * @private
1560
- * @param {Function} func The function to convert.
1561
- * @returns {string} Returns the source code.
1562
- */
1563
- function toSource(func) {
1564
- if (func != null) {
1565
- try {
1566
- return funcToString.call(func);
1567
- } catch (e) {}
1568
- try {
1569
- return (func + '');
1570
- } catch (e) {}
1571
- }
1572
- return '';
1573
- }
1574
-
1575
- /**
1576
- * Performs a
1577
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1578
- * comparison between two values to determine if they are equivalent.
1579
- *
1580
- * @static
1581
- * @memberOf _
1582
- * @since 4.0.0
1583
- * @category Lang
1584
- * @param {*} value The value to compare.
1585
- * @param {*} other The other value to compare.
1586
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1587
- * @example
1588
- *
1589
- * var object = { 'a': 1 };
1590
- * var other = { 'a': 1 };
1591
- *
1592
- * _.eq(object, object);
1593
- * // => true
1594
- *
1595
- * _.eq(object, other);
1596
- * // => false
1597
- *
1598
- * _.eq('a', 'a');
1599
- * // => true
1600
- *
1601
- * _.eq('a', Object('a'));
1602
- * // => false
1603
- *
1604
- * _.eq(NaN, NaN);
1605
- * // => true
1606
- */
1607
- function eq(value, other) {
1608
- return value === other || (value !== value && other !== other);
1609
- }
1610
-
1611
- /**
1612
- * Checks if `value` is likely an `arguments` object.
1613
- *
1614
- * @static
1615
- * @memberOf _
1616
- * @since 0.1.0
1617
- * @category Lang
1618
- * @param {*} value The value to check.
1619
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1620
- * else `false`.
1621
- * @example
1622
- *
1623
- * _.isArguments(function() { return arguments; }());
1624
- * // => true
1625
- *
1626
- * _.isArguments([1, 2, 3]);
1627
- * // => false
1628
- */
1629
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1630
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1631
- !propertyIsEnumerable.call(value, 'callee');
1632
- };
1633
-
1634
- /**
1635
- * Checks if `value` is classified as an `Array` object.
1636
- *
1637
- * @static
1638
- * @memberOf _
1639
- * @since 0.1.0
1640
- * @category Lang
1641
- * @param {*} value The value to check.
1642
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1643
- * @example
1644
- *
1645
- * _.isArray([1, 2, 3]);
1646
- * // => true
1647
- *
1648
- * _.isArray(document.body.children);
1649
- * // => false
1650
- *
1651
- * _.isArray('abc');
1652
- * // => false
1653
- *
1654
- * _.isArray(_.noop);
1655
- * // => false
1656
- */
1657
- var isArray = Array.isArray;
1658
-
1659
- /**
1660
- * Checks if `value` is array-like. A value is considered array-like if it's
1661
- * not a function and has a `value.length` that's an integer greater than or
1662
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1663
- *
1664
- * @static
1665
- * @memberOf _
1666
- * @since 4.0.0
1667
- * @category Lang
1668
- * @param {*} value The value to check.
1669
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1670
- * @example
1671
- *
1672
- * _.isArrayLike([1, 2, 3]);
1673
- * // => true
1674
- *
1675
- * _.isArrayLike(document.body.children);
1676
- * // => true
1677
- *
1678
- * _.isArrayLike('abc');
1679
- * // => true
1680
- *
1681
- * _.isArrayLike(_.noop);
1682
- * // => false
1683
- */
1684
- function isArrayLike(value) {
1685
- return value != null && isLength(value.length) && !isFunction(value);
1686
- }
1687
-
1688
- /**
1689
- * Checks if `value` is a buffer.
1690
- *
1691
- * @static
1692
- * @memberOf _
1693
- * @since 4.3.0
1694
- * @category Lang
1695
- * @param {*} value The value to check.
1696
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1697
- * @example
1698
- *
1699
- * _.isBuffer(new Buffer(2));
1700
- * // => true
1701
- *
1702
- * _.isBuffer(new Uint8Array(2));
1703
- * // => false
1704
- */
1705
- var isBuffer = nativeIsBuffer || stubFalse;
1706
-
1707
- /**
1708
- * Performs a deep comparison between two values to determine if they are
1709
- * equivalent.
1710
- *
1711
- * **Note:** This method supports comparing arrays, array buffers, booleans,
1712
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
1713
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
1714
- * by their own, not inherited, enumerable properties. Functions and DOM
1715
- * nodes are compared by strict equality, i.e. `===`.
1716
- *
1717
- * @static
1718
- * @memberOf _
1719
- * @since 0.1.0
1720
- * @category Lang
1721
- * @param {*} value The value to compare.
1722
- * @param {*} other The other value to compare.
1723
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1724
- * @example
1725
- *
1726
- * var object = { 'a': 1 };
1727
- * var other = { 'a': 1 };
1728
- *
1729
- * _.isEqual(object, other);
1730
- * // => true
1731
- *
1732
- * object === other;
1733
- * // => false
1734
- */
1735
- function isEqual(value, other) {
1736
- return baseIsEqual(value, other);
1737
- }
1738
-
1739
- /**
1740
- * Checks if `value` is classified as a `Function` object.
1741
- *
1742
- * @static
1743
- * @memberOf _
1744
- * @since 0.1.0
1745
- * @category Lang
1746
- * @param {*} value The value to check.
1747
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1748
- * @example
1749
- *
1750
- * _.isFunction(_);
1751
- * // => true
1752
- *
1753
- * _.isFunction(/abc/);
1754
- * // => false
1755
- */
1756
- function isFunction(value) {
1757
- if (!isObject(value)) {
1758
- return false;
1759
- }
1760
- // The use of `Object#toString` avoids issues with the `typeof` operator
1761
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
1762
- var tag = baseGetTag(value);
1763
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1764
- }
1765
-
1766
- /**
1767
- * Checks if `value` is a valid array-like length.
1768
- *
1769
- * **Note:** This method is loosely based on
1770
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1771
- *
1772
- * @static
1773
- * @memberOf _
1774
- * @since 4.0.0
1775
- * @category Lang
1776
- * @param {*} value The value to check.
1777
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1778
- * @example
1779
- *
1780
- * _.isLength(3);
1781
- * // => true
1782
- *
1783
- * _.isLength(Number.MIN_VALUE);
1784
- * // => false
1785
- *
1786
- * _.isLength(Infinity);
1787
- * // => false
1788
- *
1789
- * _.isLength('3');
1790
- * // => false
1791
- */
1792
- function isLength(value) {
1793
- return typeof value == 'number' &&
1794
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1795
- }
1796
-
1797
- /**
1798
- * Checks if `value` is the
1799
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1800
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1801
- *
1802
- * @static
1803
- * @memberOf _
1804
- * @since 0.1.0
1805
- * @category Lang
1806
- * @param {*} value The value to check.
1807
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1808
- * @example
1809
- *
1810
- * _.isObject({});
1811
- * // => true
1812
- *
1813
- * _.isObject([1, 2, 3]);
1814
- * // => true
1815
- *
1816
- * _.isObject(_.noop);
1817
- * // => true
1818
- *
1819
- * _.isObject(null);
1820
- * // => false
1821
- */
1822
- function isObject(value) {
1823
- var type = typeof value;
1824
- return value != null && (type == 'object' || type == 'function');
1825
- }
1826
-
1827
- /**
1828
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1829
- * and has a `typeof` result of "object".
1830
- *
1831
- * @static
1832
- * @memberOf _
1833
- * @since 4.0.0
1834
- * @category Lang
1835
- * @param {*} value The value to check.
1836
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1837
- * @example
1838
- *
1839
- * _.isObjectLike({});
1840
- * // => true
1841
- *
1842
- * _.isObjectLike([1, 2, 3]);
1843
- * // => true
1844
- *
1845
- * _.isObjectLike(_.noop);
1846
- * // => false
1847
- *
1848
- * _.isObjectLike(null);
1849
- * // => false
1850
- */
1851
- function isObjectLike(value) {
1852
- return value != null && typeof value == 'object';
1853
- }
1854
-
1855
- /**
1856
- * Checks if `value` is classified as a typed array.
1857
- *
1858
- * @static
1859
- * @memberOf _
1860
- * @since 3.0.0
1861
- * @category Lang
1862
- * @param {*} value The value to check.
1863
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1864
- * @example
1865
- *
1866
- * _.isTypedArray(new Uint8Array);
1867
- * // => true
1868
- *
1869
- * _.isTypedArray([]);
1870
- * // => false
1871
- */
1872
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1873
-
1874
- /**
1875
- * Creates an array of the own enumerable property names of `object`.
1876
- *
1877
- * **Note:** Non-object values are coerced to objects. See the
1878
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1879
- * for more details.
1880
- *
1881
- * @static
1882
- * @since 0.1.0
1883
- * @memberOf _
1884
- * @category Object
1885
- * @param {Object} object The object to query.
1886
- * @returns {Array} Returns the array of property names.
1887
- * @example
1888
- *
1889
- * function Foo() {
1890
- * this.a = 1;
1891
- * this.b = 2;
1892
- * }
1893
- *
1894
- * Foo.prototype.c = 3;
1895
- *
1896
- * _.keys(new Foo);
1897
- * // => ['a', 'b'] (iteration order is not guaranteed)
1898
- *
1899
- * _.keys('hi');
1900
- * // => ['0', '1']
1901
- */
1902
- function keys(object) {
1903
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1904
- }
1905
-
1906
- /**
1907
- * This method returns a new empty array.
1908
- *
1909
- * @static
1910
- * @memberOf _
1911
- * @since 4.13.0
1912
- * @category Util
1913
- * @returns {Array} Returns the new empty array.
1914
- * @example
1915
- *
1916
- * var arrays = _.times(2, _.stubArray);
1917
- *
1918
- * console.log(arrays);
1919
- * // => [[], []]
1920
- *
1921
- * console.log(arrays[0] === arrays[1]);
1922
- * // => false
1923
- */
1924
- function stubArray() {
1925
- return [];
1926
- }
1927
-
1928
- /**
1929
- * This method returns `false`.
1930
- *
1931
- * @static
1932
- * @memberOf _
1933
- * @since 4.13.0
1934
- * @category Util
1935
- * @returns {boolean} Returns `false`.
1936
- * @example
1937
- *
1938
- * _.times(2, _.stubFalse);
1939
- * // => [false, false]
1940
- */
1941
- function stubFalse() {
1942
- return false;
1943
- }
1944
-
1945
- module.exports = isEqual;
1946
- }(lodash_isequal, lodash_isequal.exports));
1947
-
1948
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
1949
- // require the crypto API and do not support built-in fallback to lower quality random number
1950
- // generators (like Math.random()).
1951
- var getRandomValues;
1952
- var rnds8 = new Uint8Array(16);
1953
- function rng() {
1954
- // lazy load so that environments that need to polyfill have a chance to do so
1955
- if (!getRandomValues) {
1956
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
1957
- // find the complete implementation of crypto (msCrypto) on IE11.
1958
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
1959
-
1960
- if (!getRandomValues) {
1961
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
1962
- }
1963
- }
1964
-
1965
- return getRandomValues(rnds8);
1966
- }
1967
-
1968
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
1969
-
1970
- function validate(uuid) {
1971
- return typeof uuid === 'string' && REGEX.test(uuid);
1972
- }
1973
-
1974
- /**
1975
- * Convert array of 16 byte values to UUID string format of the form:
1976
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
1977
- */
1978
-
1979
- var byteToHex = [];
1980
-
1981
- for (var i = 0; i < 256; ++i) {
1982
- byteToHex.push((i + 0x100).toString(16).substr(1));
1983
- }
1984
-
1985
- function stringify(arr) {
1986
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1987
- // Note: Be careful editing this code! It's been tuned for performance
1988
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
1989
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
1990
- // of the following:
1991
- // - One or more input array values don't map to a hex octet (leading to
1992
- // "undefined" in the uuid)
1993
- // - Invalid input values for the RFC `version` or `variant` fields
1994
-
1995
- if (!validate(uuid)) {
1996
- throw TypeError('Stringified UUID is invalid');
1997
- }
1998
-
1999
- return uuid;
2000
- }
2001
-
2002
- function v4(options, buf, offset) {
2003
- options = options || {};
2004
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2005
-
2006
- rnds[6] = rnds[6] & 0x0f | 0x40;
2007
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
2008
-
2009
- if (buf) {
2010
- offset = offset || 0;
2011
-
2012
- for (var i = 0; i < 16; ++i) {
2013
- buf[offset + i] = rnds[i];
2014
- }
2015
-
2016
- return buf;
2017
- }
2018
-
2019
- return stringify(rnds);
2020
- }
2021
-
2022
- function create() {
2023
- return v4();
2024
- }
2025
- function fromMsbLsb(msb, lsb) {
2026
- function digits(val, ds) {
2027
- var hi = BigInt(1) << (ds * BigInt(4));
2028
- return (hi | (val & (hi - BigInt(1)))).toString(16).substring(1);
2029
- }
2030
- var msbB = typeof msb === 'string' ? BigInt(msb) : msb;
2031
- var lsbB = typeof lsb === 'string' ? BigInt(lsb) : lsb;
2032
- var sec1 = digits(msbB >> BigInt(32), BigInt(8));
2033
- var sec2 = digits(msbB >> BigInt(16), BigInt(4));
2034
- var sec3 = digits(msbB, BigInt(4));
2035
- var sec4 = digits(lsbB >> BigInt(48), BigInt(4));
2036
- var sec5 = digits(lsbB, BigInt(12));
2037
- return "".concat(sec1, "-").concat(sec2, "-").concat(sec3, "-").concat(sec4, "-").concat(sec5);
2038
- }
2039
- function toMsbLsb(id) {
2040
- var _a = tslib_es6.__read(id.split('-'), 5), c1 = _a[0], c2 = _a[1], c3 = _a[2], c4 = _a[3], c5 = _a[4];
2041
- if (c1 == null || c2 == null || c3 == null || c4 == null || c5 == null) {
2042
- throw new Error("Invalid UUID string ".concat(id));
2043
- }
2044
- var msb = BigInt.asIntN(64, BigInt("0x".concat(c1 + c2 + c3)));
2045
- var lsb = BigInt.asIntN(64, BigInt("0x".concat(c4 + c5)));
2046
- return { msb: msb.toString(), lsb: lsb.toString() };
2047
- }
2048
-
2049
- var uuid = /*#__PURE__*/Object.freeze({
2050
- __proto__: null,
2051
- create: create,
2052
- fromMsbLsb: fromMsbLsb,
2053
- toMsbLsb: toMsbLsb
2054
- });
2055
-
2056
- const tooltipCss = ":host{--tooltip-width:auto;--tooltip-white-space:normal;display:flex}.popover{width:100%;height:100%}.target{display:flex;width:100%;height:100%}.content-hidden{display:none}.tooltip{display:flex;justify-content:center;text-align:center;width:var(--tooltip-width);font-family:var(--vertex-ui-font-family);font-size:var(--vertex-ui-text-xxs);background-color:var(--vertex-ui-neutral-700);color:var(--vertex-ui-white);padding:0.25rem 0.5rem;border-radius:4px;pointer-events:none;white-space:var(--tooltip-white-space);user-select:none}.tooltip.hidden{display:none}";
2057
-
2058
- const TOOLTIP_OPEN_DELAY = 500;
2059
- const Tooltip = class {
2060
- constructor(hostRef) {
2061
- index.registerInstance(this, hostRef);
2062
- this.pointerEntered = false;
2063
- this.content = undefined;
2064
- this.disabled = undefined;
2065
- this.placement = 'bottom';
2066
- this.delay = TOOLTIP_OPEN_DELAY;
2067
- this.animated = true;
2068
- this.open = false;
2069
- this.handlePointerEnter = this.handlePointerEnter.bind(this);
2070
- this.handlePointerLeave = this.handlePointerLeave.bind(this);
2071
- this.handleContentChange = this.handleContentChange.bind(this);
2072
- this.handleDisabledChange = this.handleDisabledChange.bind(this);
2073
- this.tooltipId = `vertex-tooltip-${uuid.create()}`;
2074
- }
2075
- disconnectedCallback() {
2076
- this.removeElement();
2077
- this.clearOpenTimeout();
2078
- this.pointerEntered = false;
2079
- }
2080
- handleContentChange() {
2081
- if (this.internalContentElement != null) {
2082
- this.updateContentElementChildren(this.internalContentElement);
2083
- }
2084
- }
2085
- handleDisabledChange() {
2086
- if (this.internalContentElement != null) {
2087
- this.updateContentElementClass(this.internalContentElement);
2088
- }
2089
- if (!this.disabled && this.pointerEntered) {
2090
- this.handlePointerEnter();
2091
- }
2092
- }
2093
- render() {
2094
- return (index.h(index.Host, null, index.h("div", { class: "target", ref: (el) => {
2095
- this.targetElement = el;
2096
- }, onPointerEnter: this.handlePointerEnter, onPointerLeave: this.handlePointerLeave }, index.h("slot", null)), index.h("div", { class: "content-hidden", ref: (el) => {
2097
- this.contentElement = el;
2098
- } }, index.h("slot", { name: "content", onSlotchange: this.handleContentChange }))));
2099
- }
2100
- addElement() {
2101
- if (this.targetElement != null) {
2102
- const popover = this.createPopoverElement(this.targetElement);
2103
- const content = this.createContentElement();
2104
- this.updateContentElementChildren(content);
2105
- popover.appendChild(content);
2106
- this.hostElement.ownerDocument.body.appendChild(popover);
2107
- }
2108
- }
2109
- removeElement() {
2110
- const popover = this.hostElement.ownerDocument.getElementById(this.tooltipId);
2111
- if (popover != null) {
2112
- popover.remove();
2113
- }
2114
- this.internalContentElement = undefined;
2115
- }
2116
- createPopoverElement(anchorElement) {
2117
- const popover = this.hostElement.ownerDocument.createElement('vertex-popover');
2118
- popover.id = this.tooltipId;
2119
- popover.setAttribute('class', 'vertex-tooltip-popover');
2120
- popover.open = this.open;
2121
- popover.resizeBehavior = 'fixed';
2122
- popover.backdrop = false;
2123
- popover.placement = this.placement;
2124
- popover.animated = this.animated;
2125
- popover.anchorBounds = dom.getBoundingClientRect(anchorElement);
2126
- return popover;
2127
- }
2128
- createContentElement() {
2129
- this.internalContentElement =
2130
- this.hostElement.ownerDocument.createElement('div');
2131
- this.internalContentElement.setAttribute('class', index$1.classnames('vertex-tooltip-content', {
2132
- hidden: !this.open || this.disabled,
2133
- }));
2134
- return this.internalContentElement;
2135
- }
2136
- updateContentElementClass(element) {
2137
- element.setAttribute('class', index$1.classnames('vertex-tooltip-content', {
2138
- hidden: !this.open || this.disabled,
2139
- }));
2140
- }
2141
- updateContentElementChildren(element) {
2142
- var _a;
2143
- this.displayedSlottedContent =
2144
- (_a = slots.getSlottedContent(this.contentElement)) !== null && _a !== void 0 ? _a : this.displayedSlottedContent;
2145
- if (this.content != null) {
2146
- element.innerText = this.content;
2147
- }
2148
- else if (this.displayedSlottedContent != null) {
2149
- element.appendChild(this.displayedSlottedContent);
2150
- }
2151
- }
2152
- handlePointerEnter() {
2153
- if (this.openTimeout == null && !this.disabled) {
2154
- this.createOpenTimeout();
2155
- }
2156
- else if (this.openTimeout == null) {
2157
- this.pointerEntered = true;
2158
- }
2159
- }
2160
- handlePointerLeave() {
2161
- this.clearOpenTimeout();
2162
- this.removeElement();
2163
- this.open = false;
2164
- this.pointerEntered = false;
2165
- }
2166
- createOpenTimeout() {
2167
- this.openTimeout = setTimeout(() => {
2168
- this.open = true;
2169
- this.openTimeout = undefined;
2170
- this.addElement();
2171
- }, this.delay);
2172
- this.pointerEntered = false;
2173
- }
2174
- clearOpenTimeout() {
2175
- if (this.openTimeout != null) {
2176
- clearTimeout(this.openTimeout);
2177
- this.openTimeout = undefined;
2178
- }
2179
- }
2180
- get hostElement() { return index.getElement(this); }
2181
- static get watchers() { return {
2182
- "content": ["handleContentChange"],
2183
- "disabled": ["handleDisabledChange"]
2184
- }; }
2185
- };
2186
- Tooltip.style = tooltipCss;
2187
-
2188
- exports.Tooltip = Tooltip;