jquery.dgtable 2.0.34 → 2.0.38

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/dist/lib.cjs.js CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  var jQuery = require('jquery');
4
4
 
5
+ function _defineProperty(e, r, t) {
6
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
7
+ value: t,
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true
11
+ }) : e[r] = t, e;
12
+ }
13
+ function _toPrimitive(t, r) {
14
+ if ("object" != typeof t || !t) return t;
15
+ var e = t[Symbol.toPrimitive];
16
+ if (void 0 !== e) {
17
+ var i = e.call(t, r);
18
+ if ("object" != typeof i) return i;
19
+ throw new TypeError("@@toPrimitive must return a primitive value.");
20
+ }
21
+ return ("string" === r ? String : Number)(t);
22
+ }
23
+ function _toPropertyKey(t) {
24
+ var i = _toPrimitive(t, "string");
25
+ return "symbol" == typeof i ? i : i + "";
26
+ }
27
+
5
28
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
29
 
7
30
  var es_symbol_description = {};
@@ -74,7 +97,7 @@ function requireFunctionBindNative () {
74
97
 
75
98
  functionBindNative = !fails(function () {
76
99
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
77
- var test = (function () { /* empty */ }).bind();
100
+ var test = function () { /* empty */ }.bind();
78
101
  // eslint-disable-next-line no-prototype-builtins -- safe
79
102
  return typeof test != 'function' || test.hasOwnProperty('prototype');
80
103
  });
@@ -553,10 +576,10 @@ function requireSharedStore () {
553
576
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
554
577
 
555
578
  (store.versions || (store.versions = [])).push({
556
- version: '3.48.0',
579
+ version: '3.50.0',
557
580
  mode: IS_PURE ? 'pure' : 'global',
558
581
  copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
559
- license: 'https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE',
582
+ license: 'https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE',
560
583
  source: 'https://github.com/zloirock/core-js'
561
584
  });
562
585
  return sharedStore.exports;
@@ -569,9 +592,11 @@ function requireShared () {
569
592
  if (hasRequiredShared) return shared;
570
593
  hasRequiredShared = 1;
571
594
  var store = requireSharedStore();
595
+ // eslint-disable-next-line es/no-object-create -- safe
596
+ var create = Object.create || Object;
572
597
 
573
598
  shared = function (key, value) {
574
- return store[key] || (store[key] = value || {});
599
+ return store[key] || (store[key] = value || create(null));
575
600
  };
576
601
  return shared;
577
602
  }
@@ -909,7 +934,7 @@ function requireFunctionName () {
909
934
 
910
935
  var EXISTS = hasOwn(FunctionPrototype, 'name');
911
936
  // additional protection from minified / mangled / dropped function names
912
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
937
+ var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
913
938
  var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
914
939
 
915
940
  functionName = {
@@ -1617,6 +1642,7 @@ function requireEs_symbol_description () {
1617
1642
  var $ = require_export();
1618
1643
  var DESCRIPTORS = requireDescriptors();
1619
1644
  var globalThis = requireGlobalThis();
1645
+ var call = requireFunctionCall();
1620
1646
  var uncurryThis = requireFunctionUncurryThis();
1621
1647
  var hasOwn = requireHasOwnProperty();
1622
1648
  var isCallable = requireIsCallable();
@@ -1646,6 +1672,14 @@ function requireEs_symbol_description () {
1646
1672
  };
1647
1673
 
1648
1674
  copyConstructorProperties(SymbolWrapper, NativeSymbol);
1675
+ // wrap Symbol.for for correct handling of empty string descriptions
1676
+ var nativeFor = SymbolWrapper['for'];
1677
+ SymbolWrapper['for'] = { 'for': function (key) {
1678
+ var stringKey = toString(key);
1679
+ var symbol = call(nativeFor, this, stringKey);
1680
+ if (stringKey === '') EmptyStringDescriptionStore[symbol] = true;
1681
+ return symbol;
1682
+ } }['for'];
1649
1683
  SymbolWrapper.prototype = SymbolPrototype;
1650
1684
  SymbolPrototype.constructor = SymbolWrapper;
1651
1685
 
@@ -1891,7 +1925,9 @@ function requireEs_array_sort () {
1891
1925
  if (y === undefined) return -1;
1892
1926
  if (x === undefined) return 1;
1893
1927
  if (comparefn !== undefined) return +comparefn(x, y) || 0;
1894
- return toString(x) > toString(y) ? 1 : -1;
1928
+ var xString = toString(x);
1929
+ var yString = toString(y);
1930
+ return xString === yString ? 0 : xString > yString ? 1 : -1;
1895
1931
  };
1896
1932
  };
1897
1933
 
@@ -2388,178 +2424,86 @@ class DomEventsSink {
2388
2424
  }
2389
2425
  }
2390
2426
 
2391
- /**
2392
- * @typedef {function(index: number):(number|undefined)} VirtualListHelper~ItemHeightEstimatorFunction
2393
- */
2394
-
2395
- /**
2396
- * @typedef {function():Element} VirtualListHelper~ItemElementCreatorFunction
2397
- */
2398
-
2399
- /**
2400
- * @typedef {function(itemEl: Element, index: number)} VirtualListHelper~ItemRenderFunction
2401
- */
2402
-
2403
- /**
2404
- * @typedef {function(itemEl: Element)} VirtualListHelper~ItemUnrenderFunction
2405
- */
2406
-
2407
- /**
2408
- * @typedef {Object} VirtualListHelper~Options
2409
- * @property {Element} list - the main element to operate inside of
2410
- * @property {Element?} [itemsParent] - the element to use as parent for the items (automatically created in virtual mode, uses parent by default in non-virtual mode)
2411
- * @property {boolean} [autoVirtualWrapperWidth=true] automatically set the width of the virtual wrapper
2412
- * @property {boolean} [hookScrollEvent=true] automatically hook scroll event as needed
2413
- * @property {number} [count=0] the item count
2414
- * @property {boolean} [virtual=true] is virtual mode on?
2415
- * @property {number} [estimatedItemHeight=20] estimated item height
2416
- * @property {number} [buffer=5] the amount of buffer items to keep on each end of the list
2417
- * @property {VirtualListHelper~ItemHeightEstimatorFunction} [itemHeightEstimatorFn] an optional function for providing item height estimations
2418
- * @property {VirtualListHelper~ItemElementCreatorFunction} [itemElementCreatorFn] an optional function for providing fresh item elements (default creates `<li />`s)
2419
- * @property {VirtualListHelper~ItemRenderFunction} [onItemRender] a function for rendering element content based on item index
2420
- * @property {VirtualListHelper~ItemUnrenderFunction} [onItemUnrender] a function for freeing resources in an item element
2421
- * @property {function(height: number)} [onScrollHeightChange] a function to be notified when scroll height changes
2422
- *
2423
- */
2424
-
2425
- /** */
2426
-
2427
2427
  const hasOwnProperty = Object.prototype.hasOwnProperty;
2428
-
2429
2428
  const hasInsertAdjacentElement = Element.prototype.insertAdjacentElement !== undefined;
2430
-
2431
2429
  function insertBefore(el, before, parent) {
2432
2430
  if (!before)
2433
2431
  parent.appendChild(el);else
2434
2432
  if (hasInsertAdjacentElement === false || el instanceof DocumentFragment)
2435
2433
  parent.insertBefore(el, before);else
2434
+
2436
2435
  before.insertAdjacentElement('beforebegin', el);
2437
2436
  }
2438
- /**
2439
- *
2440
- * @param {Element} itemEl
2441
- * @param {DocumentFragment|null} fragment
2442
- * @param {Node|undefined} before
2443
- * @param {Element} itemParent
2444
- * @returns {DocumentFragment|null}
2445
- */
2446
2437
  function insertBeforeWithFragment(itemEl, fragment, before, itemParent) {
2447
2438
  if (itemEl.parentNode !== itemParent) {
2448
2439
  if (!fragment)
2449
2440
  fragment = document.createDocumentFragment();
2450
2441
  fragment.appendChild(itemEl);
2451
- } else {
2442
+ } else
2443
+ {
2452
2444
  // insert fragment
2453
2445
  if (fragment && fragment.childNodes.length > 0) {
2454
2446
  insertBefore(fragment, before, itemParent);
2455
2447
  fragment = null;
2456
2448
  }
2457
-
2458
2449
  // insert element
2459
2450
  if (itemEl.nextSibling !== before) {
2460
2451
  insertBefore(itemEl, before, itemParent);
2461
2452
  }
2462
2453
  }
2463
-
2464
2454
  return fragment;
2465
2455
  }
2466
-
2467
2456
  const DestroyedSymbol = Symbol('destroyed');
2468
-
2469
2457
  class VirtualListHelper {
2470
- /**
2471
- * @param {VirtualListHelper~Options} opts
2472
- */
2473
2458
  constructor(opts) {var _opts$autoVirtualWrap;
2474
- /** @private */
2475
2459
  const p = this._p = {
2476
2460
  // these come from options:
2477
-
2478
2461
  list: opts.list || null,
2479
2462
  hookScrollEvent: opts.hookScrollEvent === undefined ? true : !!opts.hookScrollEvent,
2480
2463
  count: opts.count || 0,
2481
2464
  virtual: opts.virtual === undefined ? true : !!opts.virtual,
2482
2465
  userItemsParent: opts.itemsParent || null,
2483
- setVirtualWrapperWidth: (_opts$autoVirtualWrap = opts.autoVirtualWrapperWidth) !== null && _opts$autoVirtualWrap !== void 0 ? _opts$autoVirtualWrap : true,
2466
+ autoVirtualWrapperWidth: (_opts$autoVirtualWrap = opts.autoVirtualWrapperWidth) !== null && _opts$autoVirtualWrap !== void 0 ? _opts$autoVirtualWrap : true,
2484
2467
  estimatedItemHeight: 20,
2485
2468
  buffer: 5,
2486
-
2487
- /** @type VirtualListHelper~ItemHeightEstimatorFunction|null */
2488
2469
  itemHeightEstimatorFn: null,
2489
-
2490
- /** @type VirtualListHelper~ItemElementCreatorFunction|null */
2491
2470
  itemElementCreatorFn: defaultElementCreator,
2492
-
2493
- /** @type VirtualListHelper~ItemRenderFunction|null */
2494
2471
  onItemRender: null,
2495
-
2496
- /** @type VirtualListHelper~ItemUnrenderFunction|null */
2497
2472
  onItemUnrender: null,
2498
-
2499
- /** @type {function(height: number)|null} */
2500
2473
  onScrollHeightChange: null,
2501
-
2502
2474
  // internal:
2503
-
2504
- /** @type Element|null */
2505
2475
  virtualWrapper: null,
2506
-
2507
- /** @type Element|null */
2508
2476
  currentItemsParent: null,
2509
-
2510
- /** @type {(number|undefined)[]} */
2511
2477
  cachedItemHeights: [],
2512
-
2513
- /** @type {(number|undefined)[]} */
2514
2478
  cachedItemEstimatedHeights: [],
2515
-
2516
- /** @type {(number|undefined)[]} */
2517
2479
  cachedItemPositions: [],
2518
-
2519
- /** @type number */
2520
2480
  itemPositionsNeedsUpdate: 0,
2521
-
2522
- /** @type function */
2523
2481
  boundRender: this.render.bind(this),
2524
-
2525
- /** @type Element[] */
2526
2482
  existingEls: []
2527
2483
  };
2528
-
2529
2484
  p.currentItemsParent = p.userItemsParent || p.list;
2530
-
2531
2485
  this._hookEvents();
2532
-
2533
2486
  if (typeof opts.count === 'number')
2534
2487
  this.setCount(opts.count);
2535
-
2536
2488
  if (typeof opts.virtual === 'boolean')
2537
2489
  this.setVirtual(opts.virtual);
2538
-
2539
2490
  if (typeof opts.estimatedItemHeight === 'number')
2540
2491
  this.setEstimatedItemHeight(opts.estimatedItemHeight);
2541
-
2542
2492
  if (typeof opts.buffer === 'number')
2543
2493
  this.setBuffer(opts.buffer);
2544
-
2545
2494
  if (typeof opts.itemHeightEstimatorFn === 'function')
2546
2495
  this.setItemHeightEstimatorFn(opts.itemHeightEstimatorFn);
2547
-
2548
2496
  if (typeof opts.itemElementCreatorFn === 'function')
2549
2497
  this.setItemElementCreatorFn(opts.itemElementCreatorFn);
2550
-
2551
2498
  if (typeof opts.onItemRender === 'function')
2552
2499
  this.setOnItemRender(opts.onItemRender);
2553
-
2554
2500
  if (typeof opts.onItemUnrender === 'function')
2555
2501
  this.setOnItemUnrender(opts.onItemUnrender);
2556
-
2557
2502
  if (typeof opts.onScrollHeightChange === 'function')
2558
2503
  this.setOnScrollHeightChange(opts.onScrollHeightChange);
2559
2504
  }
2560
-
2561
- /**
2562
- * Clean up and free up all resources.
2505
+ /**
2506
+ * Clean up and free up all resources.
2563
2507
  */
2564
2508
  destroy() {
2565
2509
  if (this[DestroyedSymbol])
@@ -2567,252 +2511,178 @@ class VirtualListHelper {
2567
2511
  this[DestroyedSymbol] = true;
2568
2512
  this._unhookEvents().invalidate()._destroyElements();
2569
2513
  }
2570
-
2571
- /**
2572
- * Sets whether 'scroll' event on the list should be hooked automatically.
2573
- * @param {boolean} enabled
2574
- * @returns {VirtualListHelper}
2514
+ /**
2515
+ * Sets whether 'scroll' event on the list should be hooked automatically.
2575
2516
  */
2576
2517
  setHookScrollEvent(enabled) {
2577
2518
  const p = this._p;
2578
2519
  enabled = enabled === undefined ? true : !!enabled;
2579
-
2580
2520
  if (p.hookScrollEvent === enabled)
2581
2521
  return this;
2582
-
2583
2522
  p.hookScrollEvent = enabled;
2584
-
2585
2523
  this._unhookEvents()._hookEvents();
2586
-
2587
2524
  return this;
2588
2525
  }
2589
-
2590
- /**
2591
- * @returns {boolean} whether 'scroll' event on the list should be hooked automatically
2592
- */
2593
2526
  isHookScrollEventEnabled() {
2594
2527
  const p = this._p;
2595
2528
  return p.hookScrollEvent;
2596
2529
  }
2597
-
2598
- /**
2599
- * Sets the list item count. <br />
2600
- * You should probably call `render()` after this.
2601
- * @param {number} count
2602
- * @returns {VirtualListHelper}
2530
+ /**
2531
+ * Sets the list item count. <br />
2532
+ * You should probably call `render()` after this.
2603
2533
  */
2604
2534
  setCount(count) {
2605
2535
  const p = this._p;
2606
2536
  p.count = count;
2607
-
2608
2537
  return this.invalidate();
2609
2538
  }
2610
-
2611
- /**
2612
- * @returns {number} current item count
2613
- */
2614
2539
  getCount() {
2615
2540
  const p = this._p;
2616
2541
  return p.count;
2617
2542
  }
2618
-
2619
- /**
2620
- * Switches between virtual and non-virtual mode. <br />
2621
- * The list is invalidated automatically. <br />
2622
- * You should call `render()` to update the view.
2623
- * @param {boolean} enabled
2624
- * @returns {VirtualListHelper}
2543
+ /**
2544
+ * Switches between virtual and non-virtual mode. <br />
2545
+ * The list is invalidated automatically. <br />
2546
+ * You should call `render()` to update the view.
2625
2547
  */
2626
2548
  setVirtual(enabled) {
2627
2549
  const p = this._p;
2628
2550
  enabled = enabled === undefined ? true : !!enabled;
2629
-
2630
2551
  if (p.virtual === enabled)
2631
2552
  return this;
2632
-
2633
2553
  p.virtual = enabled;
2634
-
2635
2554
  this._hookEvents().invalidate()._destroyElements();
2636
-
2637
2555
  return this;
2638
2556
  }
2639
-
2640
- /**
2641
- * @returns {boolean} virtual mode
2642
- */
2643
2557
  isVirtual() {
2644
2558
  const p = this._p;
2645
2559
  return p.virtual;
2646
2560
  }
2647
-
2648
- /**
2649
- * Sets estimated item height. <br />
2650
- * No need to be accurate. <br />
2651
- * The better the estimation - the better the scrollbar behavior will be. <br />
2652
- * Applicable for virtual-mode only. <br />
2653
- * You should `invalidate` if you want this to take effect on the existing rendering.
2654
- * @param {number} height - a positive number representing estimated item height.
2655
- * @returns {VirtualListHelper}
2561
+ /**
2562
+ * Sets estimated item height to a positive number. <br />
2563
+ * No need to be accurate. <br />
2564
+ * The better the estimation - the better the scrollbar behavior will be. <br />
2565
+ * Applicable for virtual-mode only. <br />
2566
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2656
2567
  */
2657
2568
  setEstimatedItemHeight(height) {
2658
2569
  const p = this._p;
2659
2570
  p.estimatedItemHeight = Math.abs((typeof height === 'number' ? height : Number(height)) || 20);
2660
2571
  return this;
2661
2572
  }
2662
-
2663
- /**
2664
- * @returns {number} current item height estimation
2665
- */
2666
2573
  getEstimatedItemHeight() {
2667
2574
  const p = this._p;
2668
2575
  return p.estimatedItemHeight;
2669
2576
  }
2670
-
2671
- /**
2672
- * Sets whether the virtual wrapper width should be set automatically. <br />
2673
- * @param {boolean} enabled
2674
- * @returns {VirtualListHelper}
2577
+ /**
2578
+ * Sets whether the virtual wrapper width should be set automatically. <br />
2675
2579
  */
2676
2580
  setAutoVirtualWrapperWidth(enabled) {
2677
2581
  const p = this._p;
2678
2582
  p.autoVirtualWrapperWidth = enabled === undefined ? true : !!enabled;
2679
-
2680
2583
  if (p.virtualWrapper) {
2681
2584
  if (p.autoVirtualWrapperWidth !== p.virtualWrapperWidthWasSet) {
2682
2585
  p.virtualWrapper.style.width = p.autoVirtualWrapperWidth ? '100%' : '';
2683
2586
  p.virtualWrapperWidthWasSet = p.autoVirtualWrapperWidth;
2684
2587
  }
2685
2588
  }
2686
-
2687
2589
  return this;
2688
2590
  }
2689
-
2690
- /**
2691
- * @returns {boolean} whether the virtual wrapper width should be set automatically
2692
- */
2693
2591
  isAutoVirtualWrapperWidth() {
2694
2592
  const p = this._p;
2695
2593
  return p.autoVirtualWrapperWidth;
2696
2594
  }
2697
-
2698
- /**
2699
- * Sets the amount of buffer items to keep on each end of the list. <br />
2700
- * Applicable for virtual-mode only.
2701
- * @param {number} buffer - a positive value representing the count of buffer items for each end.
2702
- * @returns {VirtualListHelper}
2595
+ /**
2596
+ * The buffer is a positive count of items on each end.
2597
+ * Sets the amount of buffer items to keep on each end of the list. <br />
2598
+ * Applicable for virtual-mode only.
2703
2599
  */
2704
2600
  setBuffer(buffer) {
2705
2601
  const p = this._p;
2706
2602
  p.buffer = Math.abs(typeof buffer === 'number' ? buffer : Number(buffer) || 5);
2707
2603
  return this;
2708
2604
  }
2709
-
2710
- /**
2711
- * @returns {number} current buffer value
2712
- */
2713
2605
  getBuffer() {
2714
2606
  const p = this._p;
2715
2607
  return p.buffer;
2716
2608
  }
2717
-
2718
- /**
2719
- * The `itemHeightEstimatorFn` is an alternative to `estimatedItemHeight` to give better estimations for specific item. <br/>
2720
- * It's optional, and if it's present - it should return either a numeric height estimation,
2721
- * or `undefined` to fall back to the default estimation. <br />
2722
- * You should `invalidate` if you want this to take effect on the existing rendering.
2723
- * @param {VirtualListHelper~ItemHeightEstimatorFunction} fn
2724
- * @returns {VirtualListHelper}
2609
+ /**
2610
+ * The `itemHeightEstimatorFn` is an alternative to `estimatedItemHeight` to give better estimations for specific item. <br/>
2611
+ * It's optional, and if it's present - it should return either a numeric height estimation,
2612
+ * or `undefined` to fall back to the default estimation. <br />
2613
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2725
2614
  */
2726
2615
  setItemHeightEstimatorFn(fn) {
2727
2616
  const p = this._p;
2728
2617
  p.itemHeightEstimatorFn = fn;
2729
2618
  return this;
2730
2619
  }
2731
-
2732
- /**
2733
- * The `itemElementCreatorFn` is a function creating a basic item element, that will be possibly reused later. <br />
2734
- * It has no association with a specific item index. <br />
2735
- * You should `invalidate` if you want this to take effect on the existing rendering.
2736
- * @param {VirtualListHelper~ItemElementCreatorFunction} fn
2737
- * @returns {VirtualListHelper}
2620
+ /**
2621
+ * The `itemElementCreatorFn` is a function creating a basic item element, that will be possibly reused later. <br />
2622
+ * It has no association with a specific item index. <br />
2623
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2738
2624
  */
2739
2625
  setItemElementCreatorFn(fn) {
2740
2626
  const p = this._p;
2741
2627
  p.itemElementCreatorFn = fn || defaultElementCreator;
2742
2628
  return this;
2743
2629
  }
2744
-
2745
- /**
2746
- * The `onItemRender` is a function called for rendering the contents of an item. <br />
2747
- * It's passed an `Element` and an item index. <br />
2748
- * You should `invalidate` if you want this to take effect on the existing rendering.
2749
- * @param {VirtualListHelper~ItemRenderFunction} fn
2750
- * @returns {VirtualListHelper}
2630
+ /**
2631
+ * The `onItemRender` is a function called for rendering the contents of an item. <br />
2632
+ * It's passed an `Element` and an item index. <br />
2633
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2751
2634
  */
2752
2635
  setOnItemRender(fn) {
2753
2636
  const p = this._p;
2754
2637
  p.onItemRender = fn;
2755
2638
  return this;
2756
2639
  }
2757
-
2758
- /**
2759
- * The `onItemUnrender` is a function called for freeing resources in an item element,
2760
- * if you've attached something that needs to be explicitly freed. <br />
2761
- * It's passed an `Element` only, and has no association with a specific index,
2762
- * as by the time it's called - the indexes are probably not valid anymore.
2763
- * @param {VirtualListHelper~ItemUnrenderFunction} fn
2764
- * @returns {VirtualListHelper}
2640
+ /**
2641
+ * The `onItemUnrender` is a function called for freeing resources in an item element,
2642
+ * if you've attached something that needs to be explicitly freed. <br />
2643
+ * It's passed an `Element` only, and has no association with a specific index,
2644
+ * as by the time it's called - the indexes are probably not valid anymore.
2765
2645
  */
2766
2646
  setOnItemUnrender(fn) {
2767
2647
  const p = this._p;
2768
2648
  p.onItemUnrender = fn;
2769
2649
  return this;
2770
2650
  }
2771
-
2772
- /**
2773
- * The `onScrollHeightChange` is a function called when the scroll height changes.
2774
- * @param {function(height: number)} fn
2775
- * @returns {VirtualListHelper}
2651
+ /**
2652
+ * The `onScrollHeightChange` is a function called when the scroll height changes.
2776
2653
  */
2777
2654
  setOnScrollHeightChange(fn) {
2778
2655
  const p = this._p;
2779
2656
  p.onScrollHeightChange = fn;
2780
2657
  return this;
2781
2658
  }
2782
-
2783
- /**
2784
- * Estimates the full scroll height. This gets better as more renderings occur.
2785
- * @returns {number}
2659
+ /**
2660
+ * Estimates the full scroll height. This gets better as more renderings occur.
2786
2661
  */
2787
2662
  estimateFullHeight() {
2788
2663
  const p = this._p;
2789
-
2790
2664
  if (p.count === 0)
2791
2665
  return 0;
2792
-
2793
2666
  if (p.virtual) {
2794
2667
  return this._calculateItemPosition(p.count) || 0;
2795
- } else {
2668
+ } else
2669
+ {
2796
2670
  const existingEls = p.existingEls;
2797
2671
  if (p.count === existingEls.length) {
2798
2672
  let rect1 = existingEls[0].getBoundingClientRect();
2799
2673
  let rect2 = existingEls[existingEls.length - 1].getBoundingClientRect();
2800
2674
  return rect2.top - rect1.top + rect2.height;
2801
2675
  }
2802
-
2803
2676
  return this._calculateItemPosition(p.count) || 0;
2804
2677
  }
2805
2678
  }
2806
-
2807
- /**
2808
- * States that the cached positions/heights are invalid,
2809
- * and needs to be completely re-calculated.<br />
2810
- * You should probably call `render()` after this.
2811
- * @returns {VirtualListHelper}
2679
+ /**
2680
+ * States that the cached positions/heights are invalid,
2681
+ * and needs to be completely re-calculated.<br />
2682
+ * You should probably call `render()` after this.
2812
2683
  */
2813
2684
  invalidatePositions() {
2814
2685
  const p = this._p;
2815
-
2816
2686
  p.itemPositionsNeedsUpdate = 0;
2817
2687
  p.cachedItemHeights = [];
2818
2688
  p.cachedItemEstimatedHeights = [];
@@ -2820,40 +2690,31 @@ class VirtualListHelper {
2820
2690
  p.cachedItemHeights.length = p.count;
2821
2691
  p.cachedItemEstimatedHeights.length = p.count;
2822
2692
  p.cachedItemPositions.length = p.count;
2823
-
2824
2693
  return this;
2825
2694
  }
2826
-
2827
- /**
2828
- * States that the indexes/item count/rendered content are invalid,
2829
- * and needs to be completely re-calculated and re-rendered. <br />
2830
- * You should probably call `render()` after this.
2831
- * @returns {VirtualListHelper}
2695
+ /**
2696
+ * States that the indexes/item count/rendered content are invalid,
2697
+ * and needs to be completely re-calculated and re-rendered. <br />
2698
+ * You should probably call `render()` after this.
2832
2699
  */
2833
2700
  invalidate() {
2834
2701
  const p = this._p;
2835
-
2836
2702
  this.invalidatePositions();
2837
-
2838
2703
  if (!p.virtual) {
2839
2704
  this._destroyElements();
2840
2705
  }
2841
-
2842
2706
  for (let el of p.existingEls)
2843
2707
  delete el[ItemIndexSymbol];
2844
-
2845
2708
  return this;
2846
2709
  }
2847
-
2848
- /**
2849
- * Renders the current viewport. <br />
2850
- * Call this after making changes to the list. <br />
2851
- * In virtual mode, this is called automatically for every scroll event.
2710
+ /**
2711
+ * Renders the current viewport. <br />
2712
+ * Call this after making changes to the list. <br />
2713
+ * In virtual mode, this is called automatically for every scroll event.
2852
2714
  */
2853
2715
  render() {
2854
2716
  if (this[DestroyedSymbol])
2855
2717
  return;
2856
-
2857
2718
  const p = this._p;
2858
2719
  const list = p.list;
2859
2720
  const virtual = p.virtual;
@@ -2867,210 +2728,158 @@ class VirtualListHelper {
2867
2728
  let onItemUnrender = p.onItemUnrender;
2868
2729
  let existingEls = p.existingEls;
2869
2730
  let existingCount = existingEls.length;
2870
-
2871
2731
  if (virtual) {
2872
2732
  const originalWidth = list.clientWidth;
2873
-
2874
2733
  if (!virtualWrapper) {
2875
2734
  virtualWrapper = p.virtualWrapper = p.userItemsParent;
2876
2735
  if (!virtualWrapper) {
2877
2736
  virtualWrapper = p.virtualWrapper = document.createElement('div');
2878
2737
  list.appendChild(virtualWrapper);
2879
2738
  }
2880
-
2881
2739
  this._resetCurrentItemsParent();
2882
2740
  itemParent = p.currentItemsParent;
2883
-
2884
2741
  if (p.autoVirtualWrapperWidth) {
2885
2742
  virtualWrapper.style.width = '100%';
2886
2743
  p.virtualWrapperWidthWasSet = true;
2887
- } else {
2744
+ } else
2745
+ {
2888
2746
  p.virtualWrapperWidthWasSet = false;
2889
2747
  }
2890
2748
  }
2891
-
2892
2749
  // Mark all of them for potential reuse
2893
2750
  for (let i = 0; i < existingCount; i++) {
2894
2751
  existingEls[i][ReuseElSymbol] = true;
2895
2752
  }
2896
-
2897
2753
  // Make sure we have at least estimated positions for all items so we can translate scroll position
2898
2754
  this._calculateItemPosition(p.count - 1);
2899
-
2900
2755
  // Find existing elements index range
2901
2756
  let existingRange = this._getExistingElsRange();
2902
-
2903
2757
  // Find first visible element
2904
2758
  let firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop);
2905
2759
  let firstRenderIndex = Math.max(0, firstVisibleIndex - buffer);
2906
-
2907
2760
  // Iterate over viewport
2908
2761
  let index = firstRenderIndex;
2909
2762
  let renderPos = this._calculateItemPosition(index);
2910
2763
  let bufferEnd = buffer;
2911
-
2912
2764
  // we want to render until viewport's bottom + buffer items
2913
2765
  let maxIndexToRender = Math.max(index, binarySearchPosition(p.cachedItemPositions, visibleBottom - 1) + 1 + buffer);
2914
-
2915
2766
  let insertedItems = [];
2916
-
2917
- /** @type DocumentFragment|null */
2918
2767
  let fragment = null;
2919
-
2920
2768
  // Find the element to insert before
2921
2769
  let before = virtualWrapper.childNodes[0];
2922
-
2923
2770
  const findElementToReuse = function (index) {
2924
2771
  // Find existing element to reuse
2925
- /** @type Element|undefined */
2926
2772
  let existingEl = undefined;
2927
-
2928
2773
  if (existingRange.firstIndex !== -1 && index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
2929
2774
  existingEl = existingEls.find((x) => x[ItemIndexSymbol] === index && x[ReuseElSymbol] === true);
2930
2775
  }
2931
-
2932
2776
  if (existingEl === undefined) {
2933
2777
  existingEl = (existingRange.firstIndex < firstRenderIndex || existingRange.firstValidArrayIndex > 0 ?
2934
- existingEls.find((x) =>
2935
- (x[ItemIndexSymbol] < firstRenderIndex || false === hasOwnProperty.call(x, ItemIndexSymbol)) &&
2778
+ existingEls.find((x) => (x[ItemIndexSymbol] < firstRenderIndex || false === hasOwnProperty.call(x, ItemIndexSymbol)) &&
2936
2779
  x[ReuseElSymbol] === true) :
2937
- undefined) ||
2938
- findLast(existingEls, (x) => x[ReuseElSymbol] === true);
2780
+ undefined) || findLast(existingEls, (x) => x[ReuseElSymbol] === true);
2939
2781
  }
2940
-
2941
2782
  if (existingEl !== undefined) {
2942
2783
  delete existingEl[ReuseElSymbol];
2943
2784
  }
2944
-
2945
2785
  return existingEl;
2946
2786
  };
2947
-
2948
2787
  // First we iterate and try to add all at once in a fragment, as much as we can.
2949
2788
  // And then reflow the at once.
2950
2789
  for (; index < count && index < maxIndexToRender; index++) {
2951
2790
  let existingEl = findElementToReuse(index);
2952
-
2953
2791
  if (before && before === existingEl)
2954
2792
  before = before.nextSibling;
2955
-
2956
2793
  // Dequeue the element by reusing or creating a new one
2957
2794
  const itemEl = this._dequeueElementForIndex(existingEl, index, before, true);
2958
2795
  insertedItems.push([itemEl, index]);
2959
-
2960
2796
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
2961
2797
  }
2962
-
2963
2798
  // Insert any remaining fragment
2964
2799
  if (fragment && fragment.childNodes.length > 0) {
2965
2800
  insertBefore(fragment, before, itemParent);
2966
2801
  }
2967
-
2968
2802
  // Iterate on inserted items and reflow them
2969
2803
  for (let item of insertedItems) {
2970
2804
  const index = item[1];
2971
2805
  this._insertItemAndFlow(item[0], index, false /* inserted already */);
2972
2806
  renderPos = p.cachedItemPositions[index] + p.cachedItemHeights[index];
2973
2807
  }
2974
-
2975
2808
  // See if we still need to insert more items
2976
2809
  if (renderPos < visibleBottom) {
2977
2810
  for (; (renderPos < visibleBottom || bufferEnd-- > 0) && index < count; index++) {
2978
2811
  let existingEl = findElementToReuse(index);
2979
-
2980
2812
  if (before && before === existingEl)
2981
2813
  before = before.nextSibling;
2982
-
2983
2814
  // Dequeue the element by reusing or creating a new one
2984
2815
  this._dequeueElementForIndex(existingEl, index, before, false);
2985
-
2986
2816
  // Increment pointers
2987
2817
  renderPos = p.cachedItemPositions[index] + p.cachedItemHeights[index];
2988
2818
  }
2989
2819
  }
2990
-
2991
2820
  // Calculate up-to-date scroll height
2992
2821
  let scrollHeight = this.estimateFullHeight();
2993
2822
  let scrollHeightPx = scrollHeight + 'px';
2994
-
2995
2823
  if (virtualWrapper.style.height !== scrollHeightPx) {var _p$onScrollHeightChan;
2996
2824
  virtualWrapper.style.height = scrollHeightPx;
2997
2825
  (_p$onScrollHeightChan = p.onScrollHeightChange) === null || _p$onScrollHeightChan === void 0 || _p$onScrollHeightChan.call(p, scrollHeight);
2998
2826
  }
2999
-
3000
2827
  if (originalWidth !== list.clientWidth)
3001
2828
  this.render();
3002
- } else {// non-virtual
2829
+ } else
2830
+ {// non-virtual
3003
2831
  if (count !== existingEls.length) {
3004
2832
  for (let i = 0; i < existingCount; i++) {
3005
2833
  existingEls[i][ReuseElSymbol] = true;
3006
2834
  }
3007
-
3008
2835
  // Find the element to insert before
3009
2836
  let before = itemParent.childNodes[0];
3010
-
3011
- /** @type DocumentFragment|null */
3012
2837
  let fragment = null;
3013
-
3014
2838
  for (let index = 0; index < count; index++) {
3015
2839
  // Find existing element to reuse
3016
2840
  let existingEl = existingEls.find((x) => x[ItemIndexSymbol] === index && x[ReuseElSymbol] === true);
3017
-
3018
2841
  if (existingEl !== undefined) {
3019
2842
  delete existingEl[ReuseElSymbol];
3020
2843
  }
3021
-
3022
2844
  if (before && before === existingEl)
3023
2845
  before = before.nextSibling;
3024
-
3025
2846
  // Dequeue the element by reusing or creating a new one
3026
2847
  const itemEl = this._dequeueElementForIndex(existingEl, index, before, true);
3027
-
3028
2848
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
3029
2849
  }
3030
-
3031
2850
  // Insert any remaining fragment
3032
2851
  if (fragment && fragment.childNodes.length > 0) {
3033
2852
  insertBefore(fragment, before, itemParent);
3034
2853
  }
3035
2854
  }
3036
2855
  }
3037
-
3038
2856
  // Cleanup extra unused elements
3039
2857
  existingCount = existingEls.length; // May have changed
3040
2858
  for (let i = 0; i < existingCount; i++) {
3041
2859
  const el = existingEls[i];
3042
- if (el[ReuseElSymbol] !== true) continue;
3043
-
2860
+ if (el[ReuseElSymbol] !== true)
2861
+ continue;
3044
2862
  let parent = el.parentNode;
3045
2863
  if (parent)
3046
2864
  parent.removeChild(el);
3047
2865
  if (onItemUnrender && el[ItemIndexSymbol] !== undefined)
3048
2866
  onItemUnrender(el);
3049
2867
  existingEls.splice(i, 1);
3050
-
3051
2868
  i--;
3052
2869
  existingCount--;
3053
2870
  }
3054
2871
  }
3055
-
3056
- /**
3057
- * States that items were added at a certain position in the list. <br />
3058
- * Virtual mode: Call `render()` to update the view after making changes.
3059
- * @param {number} count
3060
- * @param {number} [atIndex=-1]
3061
- * @returns {VirtualListHelper}
2872
+ /**
2873
+ * States that items were added at a certain position in the list. <br />
2874
+ * Virtual mode: Call `render()` to update the view after making changes.
3062
2875
  */
3063
2876
  addItemsAt(count, atIndex = -1) {
3064
2877
  if (typeof count !== 'number' || count <= 0)
3065
2878
  return this;
3066
-
3067
2879
  const p = this._p;
3068
-
3069
2880
  if (atIndex < 0 || atIndex >= p.count)
3070
2881
  atIndex = p.count;
3071
-
3072
2882
  p.count += count;
3073
-
3074
2883
  if (p.virtual) {
3075
2884
  if (atIndex >= 0 && atIndex < p.count) {
3076
2885
  this._invalidateItemIndexesAt(atIndex, -1);
@@ -3081,54 +2890,36 @@ class VirtualListHelper {
3081
2890
  let existingCount = existingEls.length;
3082
2891
  if (existingCount !== p.count - count)
3083
2892
  return this;
3084
-
3085
2893
  let existingRange = this._getExistingElsRange();
3086
2894
  if (existingRange.firstValidArrayIndex === -1)
3087
2895
  return this;
3088
-
3089
2896
  const itemParent = p.currentItemsParent;
3090
-
3091
2897
  let startIndex = existingRange.firstValidArrayIndex + atIndex - existingRange.firstIndex;
3092
-
3093
2898
  this._pushItemIndexesAt(atIndex, count);
3094
-
3095
- /** @type Node|undefined */
3096
2899
  let before = existingEls[startIndex - 1] ?
3097
2900
  existingEls[startIndex - 1].nextSibling :
3098
2901
  existingEls[0];
3099
-
3100
- /** @type DocumentFragment|null */
3101
2902
  let fragment = null;
3102
-
3103
2903
  for (let index = atIndex, end = atIndex + count; index < end; index++) {
3104
2904
  const itemEl = this._dequeueElementForIndex(undefined, index, before, true);
3105
2905
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
3106
2906
  }
3107
-
3108
2907
  // Insert any remaining fragment
3109
2908
  if (fragment && fragment.childNodes.length > 0) {
3110
2909
  insertBefore(fragment, before, itemParent);
3111
2910
  }
3112
2911
  }
3113
-
3114
2912
  return this;
3115
2913
  }
3116
-
3117
- /**
3118
- * States that items were removed at a certain position in the list. <br />
3119
- * Virtual mode: Call `render()` to update the view after making changes.
3120
- * @param {number} count
3121
- * @param {number} atIndex
3122
- * @returns {VirtualListHelper}
2914
+ /**
2915
+ * States that items were removed at a certain position in the list. <br />
2916
+ * Virtual mode: Call `render()` to update the view after making changes.
3123
2917
  */
3124
2918
  removeItemsAt(count, atIndex) {
3125
2919
  const p = this._p;
3126
-
3127
2920
  if (typeof count !== 'number' || typeof atIndex !== 'number' || count <= 0 || atIndex < 0 || atIndex >= p.count)
3128
2921
  return this;
3129
-
3130
2922
  p.count -= Math.min(count, p.count - atIndex);
3131
-
3132
2923
  if (p.virtual) {
3133
2924
  this._invalidateItemIndexesAt(atIndex, -1);
3134
2925
  } else
@@ -3137,19 +2928,15 @@ class VirtualListHelper {
3137
2928
  let existingCount = existingEls.length;
3138
2929
  if (existingCount !== p.count + count)
3139
2930
  return this;
3140
-
3141
2931
  let existingRange = this._getExistingElsRange();
3142
2932
  if (existingRange.firstValidArrayIndex === -1)
3143
2933
  return this;
3144
-
3145
2934
  this._pushItemIndexesAt(atIndex + count, -count);
3146
-
3147
2935
  const onItemUnrender = p.onItemUnrender;
3148
2936
  let index = existingRange.firstValidArrayIndex + atIndex - existingRange.firstIndex;
3149
2937
  if (index < existingEls.length) {
3150
2938
  for (let i = 0; i < count; i++) {
3151
2939
  let itemEl = existingEls[index + i];
3152
-
3153
2940
  let parent = itemEl.parentNode;
3154
2941
  if (parent)
3155
2942
  parent.removeChild(itemEl);
@@ -3159,23 +2946,17 @@ class VirtualListHelper {
3159
2946
  existingEls.splice(index, count);
3160
2947
  }
3161
2948
  }
3162
-
3163
2949
  return this;
3164
2950
  }
3165
-
3166
- /**
3167
- * Mark an element for a re-render. <br />
3168
- * Virtual mode: Call `render()` to update the view after making changes. <br />
3169
- * Non-virtual mode - the element is re-rendered immediately.
3170
- * @param {number} index - the index of the element to re-render
3171
- * @returns {VirtualListHelper}
2951
+ /**
2952
+ * Mark an element for a re-render. <br />
2953
+ * Virtual mode: Call `render()` to update the view after making changes. <br />
2954
+ * Non-virtual mode - the element is re-rendered immediately.
3172
2955
  */
3173
2956
  refreshItemAt(index) {
3174
2957
  const p = this._p;
3175
-
3176
2958
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3177
2959
  return this;
3178
-
3179
2960
  if (p.virtual) {
3180
2961
  this._invalidateItemIndexesAt(index, 1);
3181
2962
  } else
@@ -3184,128 +2965,93 @@ class VirtualListHelper {
3184
2965
  let existingCount = existingEls.length;
3185
2966
  if (existingCount !== p.count)
3186
2967
  return this;
3187
-
3188
2968
  let existingRange = this._getExistingElsRange();
3189
-
3190
2969
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3191
2970
  let itemEl = existingEls[existingRange.firstValidArrayIndex + index - existingRange.firstIndex];
3192
2971
  delete itemEl[ItemIndexSymbol];
3193
2972
  this._dequeueElementForIndex(itemEl, index, itemEl.nextSibling, false);
3194
2973
  }
3195
2974
  }
3196
-
3197
2975
  return this;
3198
2976
  }
3199
-
3200
- /**
3201
- * Tests whether an item at the specified index is rendered.
3202
- * @param {number} index - the index to test
3203
- * @returns {boolean}
2977
+ /**
2978
+ * Tests whether an item at the specified index is rendered.
3204
2979
  */
3205
2980
  isItemRendered(index) {
3206
2981
  const p = this._p;
3207
-
3208
2982
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3209
2983
  return false;
3210
-
3211
2984
  let existingRange = this._getExistingElsRange();
3212
-
3213
2985
  return index >= existingRange.firstIndex && index <= existingRange.lastIndex;
3214
2986
  }
3215
-
3216
- /**
3217
- * Retrieves DOM element for the item at the specified index - if it's currently rendered.
3218
- * @param {number} index - the index to retrieve
3219
- * @returns {Element|undefined}
2987
+ /**
2988
+ * Retrieves DOM element for the item at the specified index - if it's currently rendered.
3220
2989
  */
3221
2990
  getItemElementAt(index) {
3222
2991
  const p = this._p;
3223
-
3224
2992
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3225
2993
  return undefined;
3226
-
3227
2994
  let existingEls = p.existingEls;
3228
2995
  let existingRange = this._getExistingElsRange();
3229
-
3230
2996
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3231
2997
  return existingEls[existingRange.firstValidArrayIndex + index - existingRange.firstIndex];
3232
2998
  }
3233
-
3234
2999
  return undefined;
3235
3000
  }
3236
-
3237
- /**
3238
- * Retrieves the position for the specified index. <br />
3239
- * Can be used to scroll to a specific item.
3240
- * @param {number} index
3241
- * @returns {number|undefined}
3001
+ /**
3002
+ * Retrieves the position for the specified index. <br />
3003
+ * Can be used to scroll to a specific item.
3242
3004
  */
3243
3005
  getItemPosition(index) {
3244
3006
  const p = this._p;
3245
-
3246
3007
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3247
3008
  return undefined;
3248
-
3249
3009
  if (p.virtual) {
3250
3010
  return this._calculateItemPosition(index);
3251
- } else {
3011
+ } else
3012
+ {
3252
3013
  let itemEl = this.getItemElementAt(index);
3253
3014
  if (itemEl === undefined)
3254
3015
  return undefined;
3255
-
3256
3016
  const list = p.list;
3257
3017
  return getElementOffset(itemEl).top - getElementOffset(list).top + list.scrollTop;
3258
3018
  }
3259
3019
  }
3260
-
3261
- /**
3262
- * Retrieves the item index for the specified element
3263
- * @param {Element} el
3264
- * @returns {number|undefined}
3020
+ /**
3021
+ * Retrieves the item index for the specified element
3265
3022
  */
3266
3023
  getItemIndexFromElement(el) {
3267
3024
  return el ? el[ItemIndexSymbol] : undefined;
3268
3025
  }
3269
-
3270
- /**
3271
- * Retrieves the size (or estimated size, if unknown) for the specified index. <br />
3272
- * @param {number} index
3273
- * @returns {number|undefined}
3026
+ /**
3027
+ * Retrieves the size (or estimated size, if unknown) for the specified index. <br />
3274
3028
  */
3275
3029
  getItemSize(index) {
3276
3030
  const p = this._p;
3277
-
3278
3031
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3279
3032
  return undefined;
3280
-
3281
- let height = p.cachedItemHeights[index - 1]; // already calculated
3282
-
3033
+ let height = p.cachedItemHeights[index]; // already calculated
3283
3034
  if (height === undefined) {
3284
- height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index - 1) : null; // estimated per item
3285
-
3035
+ height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index) : null; // estimated per item
3286
3036
  if (typeof height !== 'number')
3287
3037
  height = p.estimatedItemHeight; // estimated
3288
-
3289
- p.cachedItemEstimatedHeights[index - 1] = height;
3038
+ p.cachedItemEstimatedHeights[index] = height;
3290
3039
  }
3291
-
3292
3040
  return height;
3293
3041
  }
3294
-
3295
- /**
3296
- * Retrieves the number of items that fit into the current viewport.
3297
- * @returns {number}
3042
+ /**
3043
+ * Retrieves the number of items that fit into the current viewport.
3298
3044
  */
3299
3045
  getVisibleItemCount() {
3300
3046
  const p = this._p,list = p.list;
3301
-
3302
3047
  let scrollTop = list.scrollTop;
3303
3048
  let visibleHeight = list.clientHeight;
3304
3049
  let firstVisibleIndex, lastVisibleIndex;
3305
-
3050
+ if (p.count === 0 || visibleHeight === 0)
3051
+ return 0;
3306
3052
  if (p.virtual) {
3307
- firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop);
3308
- lastVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop + visibleHeight, firstVisibleIndex);
3053
+ firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop, 0, p.count - 1);
3054
+ lastVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop + visibleHeight, firstVisibleIndex, p.count - 1);
3309
3055
  } else
3310
3056
  {
3311
3057
  const retriever = (i) => {
@@ -3314,32 +3060,28 @@ class VirtualListHelper {
3314
3060
  pos = Infinity;
3315
3061
  return pos;
3316
3062
  };
3317
-
3318
3063
  firstVisibleIndex = binarySearchPositionByFn(p.count, retriever, scrollTop);
3319
3064
  lastVisibleIndex = binarySearchPositionByFn(p.count, retriever, scrollTop + visibleHeight, firstVisibleIndex);
3320
3065
  }
3321
-
3322
3066
  if (this.getItemPosition(lastVisibleIndex) === scrollTop + visibleHeight)
3323
3067
  lastVisibleIndex--;
3324
3068
  return lastVisibleIndex - firstVisibleIndex + 1;
3325
3069
  }
3326
-
3327
- /**
3328
- * Renders a temporary ghost item. Can be used for testings several aspects of a proposed element, i.e measurements.
3329
- * @param {*} ghostIndex - the value to pass as the index for the renderer function
3330
- * @param {boolean} append - whether to append the item element to the DOM
3331
- * @param {function(itemEl: Element)} ghostTester - the function that will receive the element, called synchronously.
3070
+ /**
3071
+ * The ghost index is passed directly to the renderer. The tester is called synchronously.
3072
+ * Appends the element to the DOM only when append is true.
3073
+ * Renders a temporary ghost item. Can be used for testings several aspects of a proposed element, i.e measurements.
3332
3074
  */
3333
3075
  createGhostItemElement(ghostIndex, append, ghostTester) {
3334
3076
  const p = this._p;
3335
-
3336
3077
  let itemEl = this._dequeueElementForIndex(null, ghostIndex, false, true);
3337
3078
  try {
3338
3079
  if (append) {
3339
3080
  p.currentItemsParent.appendChild(itemEl);
3340
3081
  }
3341
3082
  ghostTester(itemEl);
3342
- } finally {
3083
+ } finally
3084
+ {
3343
3085
  if (append) {
3344
3086
  let parent = itemEl.parentNode;
3345
3087
  if (parent)
@@ -3349,38 +3091,30 @@ class VirtualListHelper {
3349
3091
  p.onItemUnrender(itemEl);
3350
3092
  }
3351
3093
  }
3352
-
3353
- /**
3354
- * Reset the pointer to the current items wrapper
3355
- * @private
3094
+ /**
3095
+ * Reset the pointer to the current items wrapper
3356
3096
  */
3357
3097
  _resetCurrentItemsParent() {var _ref, _p$virtualWrapper;
3358
3098
  const p = this._p;
3359
3099
  p.currentItemsParent = (_ref = (_p$virtualWrapper = p.virtualWrapper) !== null && _p$virtualWrapper !== void 0 ? _p$virtualWrapper : p.userItemsParent) !== null && _ref !== void 0 ? _ref : p.list;
3360
3100
  }
3361
-
3362
- /**
3363
- * Destroy all created elements, for cleanup
3364
- * @returns {VirtualListHelper}
3365
- * @private
3101
+ /**
3102
+ * Destroy all created elements, for cleanup
3366
3103
  */
3367
3104
  _destroyElements() {
3368
3105
  const p = this._p;
3369
3106
  const onItemUnrender = p.onItemUnrender;
3370
3107
  const existingEls = p.existingEls;
3371
-
3372
3108
  for (let i = 0; i < existingEls.length; i++) {
3373
3109
  const el = existingEls[i];
3374
-
3375
3110
  let parent = el.parentNode;
3376
3111
  if (parent)
3377
3112
  parent.removeChild(el);
3378
- if (onItemUnrender && el[ItemIndexSymbol] !== undefined)
3113
+ // Invalidation clears index metadata, but the element still owns rendered resources.
3114
+ if (onItemUnrender)
3379
3115
  onItemUnrender(el);
3380
3116
  }
3381
-
3382
3117
  existingEls.length = 0;
3383
-
3384
3118
  if (p.virtualWrapper) {
3385
3119
  if (p.virtualWrapper !== p.userItemsParent) {
3386
3120
  if (p.virtualWrapper.parentNode) {
@@ -3390,203 +3124,135 @@ class VirtualListHelper {
3390
3124
  p.virtualWrapper = null;
3391
3125
  this._resetCurrentItemsParent();
3392
3126
  }
3393
-
3394
3127
  return this;
3395
3128
  }
3396
-
3397
- /**
3398
- * Marks (an) item(s) at specific index(es) as to be re-rendered. <br />
3399
- * Applicable for virtual mode only.
3400
- * @param {number} index
3401
- * @param {number} count
3402
- * @private
3129
+ /**
3130
+ * Marks (an) item(s) at specific index(es) as to be re-rendered. <br />
3131
+ * Applicable for virtual mode only.
3403
3132
  */
3404
3133
  _invalidateItemIndexesAt(index, count) {
3405
3134
  const p = this._p;
3406
-
3407
3135
  this._setItemPositionsNeedsUpdate(index);
3408
-
3409
3136
  let existingEls = p.existingEls;
3410
3137
  let existingCount = existingEls.length;
3411
3138
  let existingRange = this._getExistingElsRange();
3412
-
3413
3139
  if (existingRange.firstValidArrayIndex === -1)
3414
3140
  return;
3415
-
3416
3141
  if (count === -1)
3417
3142
  count = existingEls.length;
3418
-
3419
3143
  // Clean
3420
3144
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3421
- for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex,
3422
- c = 0;
3423
- i < existingCount && c < count;
3424
- i++, c++)
3145
+ for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex, c = 0; i < existingCount && c < count; i++, c++)
3425
3146
  delete existingEls[i][ItemIndexSymbol];
3426
3147
  }
3427
3148
  }
3428
-
3429
- /**
3430
- * In/decrement the item-index marker for specific item(s). <br />
3431
- * Used for inserting/removing items in the middle of the list, without re-rendering everything. <br />
3432
- * Applicable for non-virtual mode only.
3433
- * @param {number} index
3434
- * @param {number} count
3435
- * @private
3149
+ /**
3150
+ * In/decrement the item-index marker for specific item(s). <br />
3151
+ * Used for inserting/removing items in the middle of the list, without re-rendering everything. <br />
3152
+ * Applicable for non-virtual mode only.
3436
3153
  */
3437
3154
  _pushItemIndexesAt(index, count) {
3438
3155
  const p = this._p;
3439
-
3440
3156
  let existingEls = p.existingEls;
3441
3157
  let existingCount = existingEls.length;
3442
3158
  let existingRange = this._getExistingElsRange();
3443
-
3444
3159
  if (existingRange.firstValidArrayIndex === -1)
3445
3160
  return;
3446
-
3447
3161
  // Clean
3448
3162
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3449
- for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex;
3450
- i < existingCount;
3451
- i++)
3163
+ for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex; i < existingCount; i++)
3452
3164
  existingEls[i][ItemIndexSymbol] += count;
3453
3165
  }
3454
3166
  }
3455
-
3456
- /**
3457
- * Hook relevant events
3458
- * @returns {VirtualListHelper}
3459
- * @private
3167
+ /**
3168
+ * Hook relevant events
3460
3169
  */
3461
3170
  _hookEvents() {
3462
3171
  const p = this._p;
3463
-
3464
3172
  this._unhookEvents();
3465
-
3466
3173
  if (p.virtual && p.hookScrollEvent) {
3467
- p.list && p.list.addEventListener('scroll', /**@type Function*/p.boundRender);
3174
+ p.list && p.list.addEventListener('scroll', p.boundRender);
3468
3175
  }
3469
-
3470
3176
  return this;
3471
3177
  }
3472
-
3473
- /**
3474
- * Unhook previously hooked events
3475
- * @returns {VirtualListHelper}
3476
- * @private
3178
+ /**
3179
+ * Unhook previously hooked events
3477
3180
  */
3478
3181
  _unhookEvents() {
3479
3182
  const p = this._p;
3480
-
3481
- p.list && p.list.removeEventListener('scroll', /**@type Function*/p.boundRender);
3482
-
3183
+ p.list && p.list.removeEventListener('scroll', p.boundRender);
3483
3184
  return this;
3484
3185
  }
3485
-
3486
- /**
3487
- * Mark item index from which the positions are not considered valid anymore. <br />
3488
- * Applicable for virtual mode only.
3489
- * @param {number} value
3490
- * @private
3186
+ /**
3187
+ * Mark item index from which the positions are not considered valid anymore. <br />
3188
+ * Applicable for virtual mode only.
3491
3189
  */
3492
3190
  _setItemPositionsNeedsUpdate(value) {
3493
3191
  const p = this._p;
3494
-
3495
3192
  if (value < p.itemPositionsNeedsUpdate) {
3496
3193
  p.itemPositionsNeedsUpdate = value;
3497
3194
  }
3498
3195
  }
3499
-
3500
- /**
3501
- * Calculates an item's top position (and stores in the private `cachedItemPositions` array). <br />
3502
- * Allows calculating last+1 index too, to get the bottom-most position. <br />
3503
- * Applicable for non-virtual mode only.
3504
- * @param {number} index
3505
- * @returns {number|undefined}
3506
- * @private
3196
+ /**
3197
+ * Calculates an item's top position (and stores in the private `cachedItemPositions` array). <br />
3198
+ * Allows calculating last+1 index too, to get the bottom-most position. <br />
3199
+ * Applicable for non-virtual mode only.
3507
3200
  */
3508
3201
  _calculateItemPosition(index) {
3509
3202
  const p = this._p;
3510
-
3511
3203
  const cachedItemPositions = p.cachedItemPositions;
3512
-
3513
3204
  if (index >= p.itemPositionsNeedsUpdate) {
3514
3205
  const count = p.count;
3515
3206
  const cachedItemHeights = p.cachedItemHeights;
3516
3207
  const cachedItemEstimatedHeights = p.cachedItemEstimatedHeights;
3517
3208
  const estimatedItemHeight = p.estimatedItemHeight;
3518
3209
  const itemHeightEstimatorFn = p.itemHeightEstimatorFn;
3519
-
3520
3210
  if (cachedItemHeights.length !== count) {
3521
3211
  cachedItemHeights.length = count;
3522
3212
  cachedItemEstimatedHeights.length = count;
3523
3213
  cachedItemPositions.length = count;
3524
3214
  }
3525
-
3526
3215
  let fromIndex = p.itemPositionsNeedsUpdate;
3527
3216
  let toIndex = Math.min(index, count);
3528
-
3529
3217
  let pos = 0;
3530
-
3531
3218
  if (fromIndex > 0) {
3532
3219
  pos = cachedItemPositions[fromIndex - 1];
3533
3220
  }
3534
-
3535
3221
  for (let i = fromIndex; i <= toIndex; i++) {
3536
3222
  if (i === 0) {
3537
3223
  cachedItemPositions[i] = pos;
3538
3224
  continue;
3539
3225
  }
3540
-
3541
3226
  const prevIndex = i - 1;
3542
-
3543
3227
  let height = cachedItemHeights[prevIndex]; // already calculated
3544
-
3545
3228
  if (height === undefined) {
3546
3229
  height = itemHeightEstimatorFn ? itemHeightEstimatorFn(prevIndex) : null; // estimated per item
3547
-
3548
3230
  if (typeof height !== 'number')
3549
3231
  height = estimatedItemHeight; // estimated
3550
-
3551
3232
  cachedItemEstimatedHeights[prevIndex] = height;
3552
3233
  }
3553
-
3554
3234
  pos += height;
3555
3235
  cachedItemPositions[i] = pos;
3556
3236
  }
3557
-
3558
3237
  p.itemPositionsNeedsUpdate = toIndex + 1;
3559
3238
  }
3560
-
3561
3239
  // item after the last (calculate full height)
3562
3240
  if (index > 0 && index === p.count) {
3563
3241
  let height = p.cachedItemHeights[index - 1]; // already calculated
3564
-
3565
3242
  if (height === undefined) {
3566
3243
  height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index - 1) : null; // estimated per item
3567
-
3568
3244
  if (typeof height !== 'number')
3569
3245
  height = p.estimatedItemHeight; // estimated
3570
-
3571
3246
  p.cachedItemEstimatedHeights[index - 1] = height;
3572
3247
  }
3573
-
3574
3248
  return cachedItemPositions[index - 1] + height;
3575
3249
  }
3576
-
3577
3250
  return cachedItemPositions[index];
3578
3251
  }
3579
-
3580
- /**
3581
- * Create (or reuse an existing) element for an item at the specified index,
3582
- * and insert physically at specified position. <br />
3583
- * This will also update the element's position in the `existingEls` array.
3584
- * @param {Element|undefined} itemEl
3585
- * @param {number} index
3586
- * @param {Node|boolean|undefined} insertBefore
3587
- * @param {boolean|undefined} avoidDomReflow
3588
- * @returns {Element}
3589
- * @private
3252
+ /**
3253
+ * Create (or reuse an existing) element for an item at the specified index,
3254
+ * and insert physically at specified position. <br />
3255
+ * This will also update the element's position in the `existingEls` array.
3590
3256
  */
3591
3257
  _dequeueElementForIndex(itemEl, index, insertBefore, avoidDomReflow) {
3592
3258
  const p = this._p;
@@ -3597,138 +3263,111 @@ class VirtualListHelper {
3597
3263
  const onItemUnrender = p.onItemUnrender;
3598
3264
  const isNew = !itemEl;
3599
3265
  const shouldReRender = isNew || index !== itemEl[ItemIndexSymbol];
3600
-
3601
3266
  if (itemEl) {
3602
3267
  if (onItemUnrender && shouldReRender) {
3603
3268
  onItemUnrender(itemEl);
3604
3269
  }
3605
- } else {
3270
+ } else
3271
+ {
3606
3272
  itemEl = p.itemElementCreatorFn();
3607
-
3608
3273
  if (virtualWrapper && insertBefore !== false) {
3609
- (/**@type ElementCSSInlineStyle*/itemEl).style.position = 'absolute';
3610
- (/**@type ElementCSSInlineStyle*/itemEl).style.top = '0';
3611
- (/**@type ElementCSSInlineStyle*/itemEl).style.left = '0';
3612
- (/**@type ElementCSSInlineStyle*/itemEl).style.right = '0';
3274
+ itemEl.style.position = 'absolute';
3275
+ itemEl.style.top = '0';
3276
+ itemEl.style.left = '0';
3277
+ itemEl.style.right = '0';
3613
3278
  }
3614
3279
  }
3615
-
3616
3280
  // Render only if it's a new item element
3617
3281
  // OR the index of the existing element is not the same of the index to render
3618
3282
  if (shouldReRender) {
3619
3283
  itemEl.innerHTML = ''; // Basic cleanup
3620
-
3621
3284
  if (onItemRender)
3622
3285
  onItemRender(itemEl, index);
3623
3286
  }
3624
-
3625
3287
  if (insertBefore !== false) {
3626
3288
  if (!(insertBefore instanceof Node))
3627
3289
  insertBefore = null;
3628
-
3629
3290
  // Remove from existing list
3630
3291
  if (!isNew) {
3631
3292
  let i = existingEls.indexOf(itemEl);
3632
3293
  if (i !== -1)
3633
3294
  existingEls.splice(i, 1);
3634
3295
  }
3635
-
3636
3296
  // Insert into existing list
3637
- let beforeIndex = insertBefore ? existingEls.indexOf(/**@type Element*/insertBefore) : -1;
3297
+ let beforeIndex = insertBefore ? existingEls.indexOf(insertBefore) : -1;
3638
3298
  if (beforeIndex === -1) {
3639
3299
  existingEls.push(itemEl);
3640
- } else {
3300
+ } else
3301
+ {
3641
3302
  existingEls.splice(beforeIndex, 0, itemEl);
3642
3303
  }
3643
-
3644
3304
  if (!avoidDomReflow) {
3645
3305
  this._insertItemAndFlow(itemEl, index, insertBefore);
3646
3306
  }
3647
3307
  }
3648
-
3649
3308
  // Add index metadata to item
3650
3309
  itemEl[ItemIndexSymbol] = index;
3651
-
3652
3310
  return itemEl;
3653
3311
  }
3654
-
3655
- /**
3656
- * Insert item element into the DOM, set it's flow in the DOM, and update the item's position. <br />
3657
- * @param {Element|undefined} itemEl
3658
- * @param {number} index
3659
- * @param {Node|boolean|undefined} before
3660
- * @private
3312
+ /**
3313
+ * Insert item element into the DOM, set it's flow in the DOM, and update the item's position. <br />
3661
3314
  */
3662
3315
  _insertItemAndFlow(itemEl, index, before) {
3663
3316
  const p = this._p;
3664
3317
  const virtualWrapper = p.virtualWrapper;
3665
3318
  const itemParent = p.currentItemsParent;
3666
-
3667
3319
  if (before !== false) {
3668
3320
  if (!(before instanceof Node))
3669
3321
  before = null;
3670
-
3671
3322
  // Insert into DOM
3672
3323
  if (itemEl.parentNode !== itemParent ||
3673
3324
  itemEl.nextSibling !== before) {
3674
3325
  insertBefore(itemEl, before, itemParent);
3675
3326
  }
3676
3327
  }
3677
-
3678
3328
  if (virtualWrapper) {
3679
3329
  // Calculate height
3680
3330
  let itemHeight = itemEl.getBoundingClientRect().height;
3681
-
3682
3331
  // Put calculated height into cache, and invalidate positions if it's different
3683
3332
  let cachedItemHeight = p.cachedItemHeights[index];
3684
3333
  if (cachedItemHeight !== itemHeight) {
3685
3334
  p.cachedItemHeights[index] = itemHeight;
3686
3335
  }
3687
-
3688
3336
  if (cachedItemHeight !== undefined && itemHeight !== cachedItemHeight ||
3689
3337
  cachedItemHeight === undefined && itemHeight !== p.cachedItemEstimatedHeights[index]) {
3690
3338
  this._setItemPositionsNeedsUpdate(index + 1);
3691
3339
  }
3692
-
3693
3340
  // Set item top position
3694
3341
  let pos = this._calculateItemPosition(index);
3695
3342
  const supportedTransform = getSupportedTransform();
3696
-
3697
3343
  if (supportedTransform === false) {
3698
- (/**@type ElementCSSInlineStyle*/itemEl).style.top = `${pos}px`;
3699
- } else {
3700
- (/**@type ElementCSSInlineStyle*/itemEl).style[supportedTransform] = `translateY(${pos}px)`;
3344
+ itemEl.style.top = `${pos}px`;
3345
+ } else
3346
+ {
3347
+ itemEl.style[supportedTransform] = `translateY(${pos}px)`;
3701
3348
  }
3702
3349
  }
3703
3350
  }
3704
-
3705
- /**
3706
- * Fetches valid range of existingEls
3707
- * @returns {{firstIndex: (*|number), firstValidArrayIndex: number, lastValidArrayIndex: number, lastIndex: (*|number)}}
3708
- * @private
3351
+ /**
3352
+ * Fetches valid range of existingEls
3709
3353
  */
3710
3354
  _getExistingElsRange() {
3711
3355
  const p = this._p,existingEls = p.existingEls;
3712
-
3713
3356
  let firstValidArrayIndex = -1,lastValidArrayIndex = -1;
3714
-
3715
3357
  for (let i = 0, len = existingEls.length; i < len; i++) {
3716
3358
  if (false === hasOwnProperty.call(existingEls[i], ItemIndexSymbol))
3717
3359
  continue;
3718
3360
  firstValidArrayIndex = i;
3719
3361
  break;
3720
3362
  }
3721
-
3722
3363
  for (let i = existingEls.length - 1; i >= 0; i--) {
3723
3364
  if (false === hasOwnProperty.call(existingEls[i], ItemIndexSymbol))
3724
3365
  continue;
3725
3366
  lastValidArrayIndex = i;
3726
3367
  break;
3727
3368
  }
3728
-
3729
3369
  let firstIndex = firstValidArrayIndex !== -1 ? existingEls[firstValidArrayIndex][ItemIndexSymbol] : -1;
3730
3370
  let lastIndex = lastValidArrayIndex !== -1 ? existingEls[lastValidArrayIndex][ItemIndexSymbol] : -1;
3731
-
3732
3371
  return {
3733
3372
  firstValidArrayIndex: firstValidArrayIndex,
3734
3373
  lastValidArrayIndex: lastValidArrayIndex,
@@ -3737,95 +3376,64 @@ class VirtualListHelper {
3737
3376
  };
3738
3377
  }
3739
3378
  }
3740
-
3741
- /** Marks the item index associated with an item element */
3742
3379
  const ItemIndexSymbol = Symbol('index');
3743
-
3744
- /** Marks an element for reuse */
3745
3380
  const ReuseElSymbol = Symbol('reuse');
3746
-
3747
- /**
3748
- * The default element creator
3749
- * @returns {HTMLLIElement}
3381
+ /**
3382
+ * The default element creator
3750
3383
  */
3751
3384
  const defaultElementCreator = () => {
3752
3385
  return document.createElement('li');
3753
3386
  };
3754
-
3755
- /**
3756
- * Will look for the index in the `positions` array closest to the specified `pos` value (<= pos).
3757
- * @param {number[]} positions
3758
- * @param {number} pos
3759
- * @param {number} [start=0]
3760
- * @param {number} [end=-1]
3761
- * @returns {number}
3387
+ /**
3388
+ * Will look for the index in the `positions` array closest to the specified `pos` value (<= pos).
3762
3389
  */
3763
3390
  const binarySearchPosition = (positions, pos, start = 0, end = -1) => {
3764
3391
  let total = positions.length;
3765
3392
  if (end < 0)
3766
3393
  end += total;
3767
- if (end <= start) return end; // 0 or 1 length array
3768
-
3394
+ if (end <= start)
3395
+ return end; // 0 or 1 length array
3769
3396
  while (start <= end) {
3770
3397
  let mid = Math.floor(start + (end - start) / 2);
3771
3398
  let midPos = positions[mid];
3772
-
3773
3399
  if (midPos === pos || midPos <= pos && mid < total && positions[mid + 1] > pos) {
3774
3400
  while (mid > 0 && positions[mid - 1] === midPos) // avoid bugs on 0-height items
3775
3401
  mid--;
3776
-
3777
3402
  return mid;
3778
3403
  }
3779
-
3780
3404
  if (midPos < pos)
3781
3405
  start = mid + 1;else
3782
3406
 
3783
3407
  end = mid - 1;
3784
3408
  }
3785
-
3786
- return end === -1 ? 0 : total - 1;
3409
+ return end === -1 ? 0 : end;
3787
3410
  };
3788
-
3789
- /**
3790
- * Will look for the index in a virtual list of positions supplied by `total` and `fn`,
3791
- * closest to the specified `pos` value (<= pos).
3792
- * @param {number} total
3793
- * @param {function(index: number):number} fn
3794
- * @param {number} pos
3795
- * @param {number} [start=0]
3796
- * @param {number} [end=-1]
3797
- * @returns {number}
3411
+ /**
3412
+ * Will look for the index in a virtual list of positions supplied by `total` and `fn`,
3413
+ * closest to the specified `pos` value (<= pos).
3798
3414
  */
3799
3415
  const binarySearchPositionByFn = (total, fn, pos, start = 0, end = -1) => {
3800
3416
  if (end < 0)
3801
3417
  end += total;
3802
- if (end <= start) return end; // 0 or 1 length array
3803
-
3418
+ if (end <= start)
3419
+ return end; // 0 or 1 length array
3804
3420
  while (start <= end) {
3805
3421
  let mid = Math.floor(start + (end - start) / 2);
3806
3422
  let midPos = fn(mid);
3807
-
3808
3423
  if (midPos === pos || midPos <= pos && mid < total && fn(mid + 1) > pos) {
3809
3424
  while (mid > 0 && fn(mid - 1) === midPos) // avoid bugs on 0-height items
3810
3425
  mid--;
3811
-
3812
3426
  return mid;
3813
3427
  }
3814
-
3815
3428
  if (midPos < pos)
3816
3429
  start = mid + 1;else
3817
3430
 
3818
3431
  end = mid - 1;
3819
3432
  }
3820
-
3821
- return end === -1 ? 0 : fn(total - 1);
3433
+ return end === -1 ? 0 : end;
3822
3434
  };
3823
-
3824
- /**
3825
- * Finds the last item in the array for which `fn` returns a truthy value
3826
- * @param {Array} array
3827
- * @param {Function} fn
3828
- * @returns {undefined|*}
3435
+ /**
3436
+ * Finds the last item in the array for which `fn` returns a truthy value
3829
3437
  */
3830
3438
  const findLast = (array, fn) => {
3831
3439
  for (let i = array.length - 1; i >= 0; i--) {
@@ -3835,9 +3443,7 @@ const findLast = (array, fn) => {
3835
3443
  }
3836
3444
  return undefined;
3837
3445
  };
3838
-
3839
3446
  let _isTransformSupported = null;
3840
-
3841
3447
  const getSupportedTransform = () => {
3842
3448
  if (_isTransformSupported === null) {
3843
3449
  let prefixes = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform'];
@@ -3853,9 +3459,9 @@ const getSupportedTransform = () => {
3853
3459
  return _isTransformSupported;
3854
3460
  };
3855
3461
 
3856
- function u(e, t) {for (let l = 0, o = e.length; l >= 0 && l < o; l += 1) if (t(e[l], l, e)) return e[l];}function c(e) {return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;").replace(/\n/g, "<br />");}const h = Symbol("safe"),m = Symbol("hover_in"),p = Symbol("hover_out"),f = Symbol("row_click"),g = Symbol("preview_cell"),v = Symbol("cell"),C = Symbol("related_touch"),b = Symbol("original_row_index"),w = Symbol("destroyed");class y extends Array {constructor(e) {var _e$sortColumn, _e$onComparatorRequir, _e$customSortingProvi;super(), this.onComparatorRequired = null, this.customSortingProvider = null, e = e || {}, this.sortColumn = (_e$sortColumn = e.sortColumn) !== null && _e$sortColumn !== void 0 ? _e$sortColumn : [], this.onComparatorRequired = (_e$onComparatorRequir = e.onComparatorRequired) !== null && _e$onComparatorRequir !== void 0 ? _e$onComparatorRequir : null, this.customSortingProvider = (_e$customSortingProvi = e.customSortingProvider) !== null && _e$customSortingProvi !== void 0 ? _e$customSortingProvi : null;}add(e, t) {if (Array.isArray(e)) {const l = e;if ("number" == typeof t) for (let e = 0, o = l.length; e < o; e++) this.splice(t++, 0, l[e]);else for (let e = 0, t = l.length; e < t; e++) this.push(l[e]);} else {const l = e;"number" == typeof t ? this.splice(t, 0, l) : this.push(l);}}reset(e) {this.length = 0, e && this.add(e);}filteredCollection(e, t) {if (e && t) {const l = new y({ sortColumn: this.sortColumn, onComparatorRequired: this.onComparatorRequired, customSortingProvider: this.customSortingProvider });for (let o = 0, i = this.length; o < i; o++) {const i = this[o];e(i, t) && (i[b] = o, l.push(i));}return l;}return null;}sort(e) {let t;if ("function" == typeof e) return super.sort(e);if (this.sortColumn.length) {const e = [];for (let t = 0; t < this.sortColumn.length; t++) {const l = W(this.sortColumn[t], this.sortColumn[t].descending);let o = null;this.onComparatorRequired && (o = this.onComparatorRequired(this.sortColumn[t].column, this.sortColumn[t].descending, l)), o || (o = l), e.push(o.bind(this));}if (1 === e.length) t = e[0];else {const l = e.length;t = (t, o) => {let i = 0;for (let r = 0; r < l; r++) if (i = e[r](t, o), 0 !== i) return i;return i;};}const l = (e) => (e.sort(t), e);if (this.customSortingProvider) {const e = this.customSortingProvider(this, l);e !== this && this.splice(0, this.length, ...e);} else l(this);}return this;}}function W(e, t) {let l = e.comparePath;"string" == typeof l && (l = l.split("."));const o = l.length,i = o > 1,r = t ? 1 : -1,n = t ? -1 : 1;return function (e, t) {let s = e[l[0]],a = t[l[0]];if (i) for (let e = 1; e < o; e++) s = s && s[l[e]], a = a && a[l[e]];return s === a ? 0 : null == s ? r : null == a ? n : s < a ? r : n;};}class R extends Array {constructor() {super();}get(e) {for (let t = 0, l = this.length; t < l; t++) if (this[t].name === e) return this[t];return null;}indexOf(e) {const t = "string" == typeof e ? e : e.name;for (let e = 0, l = this.length; e < l; e++) if (this[e].name === t) return e;return -1;}getByOrder(e) {for (let t = 0, l = this.length; t < l; t++) if (this[t].order === e) return this[t];return null;}normalizeOrder() {const e = [];for (let t = 0; t < this.length; t++) e.push(this[t]);e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0);for (let t = 0; t < e.length; t++) e[t].order = t;return this;}getColumns() {const e = [];for (let t = 0; t < this.length; t++) e.push(this[t]);return e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0), e;}getVisibleColumns() {const e = [];for (let t = 0; t < this.length; t++) {const l = this[t];l.visible && e.push(l);}return e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0), e;}getMaxOrder() {let e = 0;for (let t = 0; t < this.length; t++) {const l = this[t];l.order > e && (e = l.order);}return e;}moveColumn(e, t) {if (e && t) {const l = e.order,o = t.order;if (l < o) for (let e = l + 1; e <= o; e++) {const t = this.getByOrder(e);t && t.order--;} else for (let e = l - 1; e >= o; e--) {const t = this.getByOrder(e);t && t.order++;}e.order = o;}return this;}}function S(e, t) {const l = t.column,o = null == t.keyword ? "" : t.keyword.toString();if (!o || !l) return true;let i = e[l];if (null == i) return false;let r = i.toString(),n = o;return t.caseSensitive || (r = r.toLowerCase(), n = n.toLowerCase()), -1 !== r.indexOf(n);}const N = { NONE: "none", AUTO: "auto", SCROLL: "scroll" },_ = document.createElement.bind(document);function x(e) {["relative", "absolute", "fixed"].includes(getComputedStyle(e).position) || (e.style.position = "relative");}function k(e) {const t = e.target;return /^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(t.tagName);}function T(e) {const t = getComputedStyle(e);return (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0);}function M(e) {const t = e.style;t["-webkit-touch-callout"] = "none", t["-webkit-user-select"] = "none", t["-moz-user-select"] = "none", t["-ms-user-select"] = "none", t["-o-user-select"] = "none", t["user-select"] = "none";}function L(e, t) {const i = e._o.tableClassName,r = _("div");r.className = e.el.className;const n = _("div");n.className = i + "-header";const s = _("div");s.className = i + "-header-row";const a = _("div");a.className = i + "-header-cell";const d = _("div");d.textContent = t, a.appendChild(d), s.appendChild(a), n.appendChild(s), r.appendChild(n), setCssProps(r, { position: "absolute", top: "-9999px", visibility: "hidden" }), document.body.appendChild(r);const u = getElementWidth(a);return r.remove(), u;}function z(e) {const t = e._o,i = e._p;let r,n = 0,s = 0;i.table && (n = i.table ? i.table.scrollTop : 0, s = i.table ? i.table.scrollLeft : 0, t.virtualTable && (r = i.table.style.display, i.table.style.display = "none"));let a = getElementWidth(e.el);i.table && (t.virtualTable && void 0 !== r && (i.table.style.display = r), i.table.scrollTop = n, i.table.scrollLeft = s, i.header && (i.header.scrollLeft = s));const d = t.tableClassName,u = _("div");u.className = e.el.className, setCssProps(u, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px" });const c = _("div");c.className = `${d}-header`, u.appendChild(c);const h = _("div");h.index = null, h.vIndex = null, h.className = `${d}-header-row`, c.appendChild(h);for (let e = 0; e < i.visibleColumns.length; e++) {const t = i.visibleColumns[e],l = _("div");l.className = `${d}-header-cell ${t.cellClasses || ""}`, l.columnName = t.name, l.appendChild(_("div")), h.appendChild(l);}document.body.appendChild(u), a -= function (e) {const t = getComputedStyle(e);return (parseFloat(t.borderLeftWidth) || 0) + (parseFloat(t.borderRightWidth) || 0);}(h);const m = h.querySelectorAll(`div.${d}-header-cell`);for (const e of m) {const t = getComputedStyle(e);if ("border-box" !== t.boxSizing) {a -= (parseFloat(t.borderRightWidth) || 0) + (parseFloat(t.borderLeftWidth) || 0) + T(e);const l = e.columnName,o = i.columns.get(l);o && (a -= o.arrowProposedWidth || 0);}}return u.remove(), Math.max(0, a);}function F(e) {const t = e._p,i = e._o.tableClassName,r = i + "-row",n = i + "-cell",s = t.visibleColumns,a = s.length,d = _("div");d.className = r, d.style.float = "left";let u = 0;for (let e = 0; e < a; e++) {var _t$actualWidth, _t$actualWidth2;const t = s[e],l = _("div");l.className = n, l.style.width = ((_t$actualWidth = t.actualWidth) !== null && _t$actualWidth !== void 0 ? _t$actualWidth : 0) + "px", t.cellClasses && (l.className += " " + t.cellClasses), l.appendChild(_("div")), d.appendChild(l), u += (_t$actualWidth2 = t.actualWidth) !== null && _t$actualWidth2 !== void 0 ? _t$actualWidth2 : 0;}const c = _("div");c.className = e.el.className, setCssProps(c, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px", float: "left", width: "1px", overflow: "hidden" });const h = _("div");h.className = i, c.appendChild(h);const m = _("div");m.className = i + "-body", m.style.width = u + 1e4 + "px", h.appendChild(m), m.appendChild(d), document.body.appendChild(c);const p = _("div");setCssProps(p, { border: "1.5px solid #000", width: "0", height: "0", position: "absolute", left: "0", top: "-9999px" }), document.body.appendChild(p);const f = parseFloat(getComputedStyle(p).borderWidth),g = Math.round(f) !== f;p.remove();let v = getElementWidth(d, true, true, true);return v -= t.scrollbarWidth || 0, g && v++, c.remove(), v;}function P(e) {const t = e._p;return !!t.table && "rtl" === getComputedStyle(t.table).direction;}function A(e) {var _e$unconvertedWidthMo;const t = null != e.unconvertedWidth ? e.unconvertedWidth : e.width,l = null != e.unconvertedWidth ? (_e$unconvertedWidthMo = e.unconvertedWidthMode) !== null && _e$unconvertedWidthMo !== void 0 ? _e$unconvertedWidthMo : e.widthMode : e.widthMode;return 0 === l ? "auto" : 2 === l ? 100 * t + "%" : 3 === l ? "rest" : t;}class H {static saveSelection(e) {const t = window.getSelection();if (!t || 0 === t.rangeCount) return null;const l = t.getRangeAt(0);if (e !== l.commonAncestorContainer && !function (e, t) {let l = e;for (; (l = (_l$parentNode = (_l = l) === null || _l === void 0 ? void 0 : _l.parentNode) !== null && _l$parentNode !== void 0 ? _l$parentNode : null) && l !== t;) {var _l$parentNode, _l;}return !!l;}(l.commonAncestorContainer, e)) return null;const o = l.cloneRange();o.selectNodeContents(e), o.setEnd(l.startContainer, l.startOffset);const i = o.toString().length;return { start: i, end: i + l.toString().length };}static restoreSelection(e, t) {let l = 0;const o = [e];let i,r = false,n = false;const s = document.createRange();for (s.setStart(e, 0), s.collapse(true); !n && (i = o.pop());) if (i.nodeType === Node.TEXT_NODE) {const e = l + i.length;!r && t.start >= l && t.start <= e && (s.setStart(i, t.start - l), r = true), r && t.end >= l && t.end <= e && (s.setEnd(i, t.end - l), n = true), l = e;} else {let e = i.childNodes.length;for (; e--;) o.push(i.childNodes[e]);}const a = window.getSelection();a && (a.removeAllRanges(), a.addRange(s));}}const E = document.createElement.bind(document);function O(e) {var _ref, _e$C, _t$changedTouches;const t = e;return (_ref = (_e$C = e[C]) !== null && _e$C !== void 0 ? _e$C : (_t$changedTouches = t.changedTouches) === null || _t$changedTouches === void 0 ? void 0 : _t$changedTouches[0]) !== null && _ref !== void 0 ? _ref : e;}function I(e) {var _t$lastResizeAreaClic;const t = e._p;if (null == t.columnResizeStartTimeout) return;clearTimeout(t.columnResizeStartTimeout), t.columnResizeStartTimeout = null;const n = (_t$lastResizeAreaClic = t.lastResizeAreaClick) === null || _t$lastResizeAreaClic === void 0 ? void 0 : _t$lastResizeAreaClic.columnName;t.lastResizeAreaClick = null, n && function (e, t) {const n = e._o,s = e._p,a = s.columns.get(t);if (!n.resizableColumns || !a || !a.resizable) return void B(e);const d = P(e);s.resizer = E("div"), s.resizer.className = n.resizerClassName, setCssProps(s.resizer, { position: "absolute", display: "block", zIndex: "-1", visibility: "hidden", width: "2px", background: "#000", opacity: "0.7" }), e.el.appendChild(s.resizer);const u = a.element,c = s.resizer.parentNode,h = getComputedStyle(c),m = getComputedStyle(u),p = getElementOffset(u),f = getElementOffset(c);f.left += parseFloat(h.borderLeftWidth) || 0, f.top += parseFloat(h.borderTopWidth) || 0, p.left -= f.left, p.top -= f.top, p.top -= parseFloat(m.borderTopWidth) || 0;const g = getElementWidth(s.resizer, true, true, true);d ? (p.left -= Math.ceil((parseFloat(m.borderLeftWidth) || 0) / 2), p.left -= Math.ceil(g / 2)) : (p.left += getElementWidth(u, true, true, true), p.left += Math.ceil((parseFloat(m.borderRightWidth) || 0) / 2), p.left -= Math.ceil(g / 2)), setCssProps(s.resizer, { "z-index": "10", visibility: "visible", left: p.left + "px", top: p.top + "px", height: getElementHeight(e.el, false, false, false) + "px" }), s.resizer.columnName = u.columnName;try {s.resizer.style.zIndex = "";} catch {}}(e, n);}function D(e, t) {const o = e._o,r = P(e);let n = t.target.closest(`div.${o.tableClassName}-header-cell,div.${o.cellPreviewClassName}`);if (!n) return null;n[v] && (n = n[v]);let s = n.previousSibling;for (; s && 1 !== s.nodeType;) s = s.previousSibling;const a = !s,d = O(t),u = (d.pageX || d.clientX || 0) - getElementOffset(n).left;if (r) {var _s$columnName, _s, _n$columnName;if (!a && getElementWidth(n, true, true, true) - u <= o.resizeAreaWidth / 2) return (_s$columnName = (_s = s) === null || _s === void 0 ? void 0 : _s.columnName) !== null && _s$columnName !== void 0 ? _s$columnName : null;if (u <= o.resizeAreaWidth / 2) return (_n$columnName = n.columnName) !== null && _n$columnName !== void 0 ? _n$columnName : null;} else {var _s$columnName2, _s2, _n$columnName2;if (!a && u <= o.resizeAreaWidth / 2) return (_s$columnName2 = (_s2 = s) === null || _s2 === void 0 ? void 0 : _s2.columnName) !== null && _s$columnName2 !== void 0 ? _s$columnName2 : null;if (getElementWidth(n, true, true, true) - u <= o.resizeAreaWidth / 2) return (_n$columnName2 = n.columnName) !== null && _n$columnName2 !== void 0 ? _n$columnName2 : null;}return null;}function B(e) {const t = e._p;return null != t.columnResizeStartTimeout && (clearTimeout(t.columnResizeStartTimeout), t.columnResizeStartTimeout = null), t.resizer && (t.resizer.remove(), t.resizer = null), t.eventsSink.remove(document, ".colresize"), e;}function $(e, t) {const l = t;if ("mousedown" === t.type && 0 !== l.button) return;const o = e._o,i = e._p,r = D(e, t);if (r) {const l = i.columns.get(r);if (!o.resizableColumns || !l || !l.resizable) return false;if (function (e, t, l) {const o = e._p,i = e._o,r = O(t),n = Date.now(),s = function (e) {return e.type.startsWith("touch") ? "touch" : "mouse";}(t),a = o.lastResizeAreaClick;if (o.lastResizeAreaClick = { columnName: l, time: n, pageX: r.pageX || r.clientX || 0, pageY: r.pageY || 0, pointerType: s }, !a || a.columnName !== l || a.pointerType !== s) return false;const d = n - a.time;return !(d < 0 || d > i.resizeAreaDoubleClickDuration) && Math.sqrt(Math.pow(o.lastResizeAreaClick.pageX - a.pageX, 2) + Math.pow(o.lastResizeAreaClick.pageY - a.pageY, 2)) <= Math.max(i.resizeAreaWidth, 12);}(e, t, l.name)) return B(e), function (e, t, l, _i$lastResizeAreaDoub) {const o = e._o,i = e._p,r = i.columns.get(l);if (!o.resizableColumns || !r || !r.resizable) return false;const n = Date.now();return ((_i$lastResizeAreaDoub = i.lastResizeAreaDoubleClick) === null || _i$lastResizeAreaDoub === void 0 ? void 0 : _i$lastResizeAreaDoub.columnName) === r.name && n - i.lastResizeAreaDoubleClick.time < 100 ? (t.preventDefault(), true) : (i.lastResizeAreaClick = null, i.lastResizeAreaDoubleClick = { columnName: r.name, time: n }, e.emit("columnresizeareadoubleclick", { name: r.name, columnName: r.name, event: t }), o.autoFitColumnOnResizeDoubleClick && e.autoFitColumn(r.name), t.preventDefault(), true);}(e, t, l.name);B(e), i.columnResizeStartTimeout = setTimeout(() => I(e), o.resizeAreaDoubleClickDuration), i.eventsSink.add(document, "mousemove.colresize", (t) => q(e, t)).add(document, "touchmove.colresize", (t) => q(e, t)).add(document, "mouseup.colresize", (t) => X(e, t)).add(document, "touchend.colresize", (t) => X(e, t)), t.preventDefault();}}function q(e, t) {const o = e._p;if (null != o.columnResizeStartTimeout && !function (e, t) {const l = e._p.lastResizeAreaClick;if (!l) return false;const o = O(t),i = o.pageX || o.clientX || 0,r = o.pageY || 0;return Math.sqrt(Math.pow(i - l.pageX, 2) + Math.pow(r - l.pageY, 2)) > 4;}(e, t)) return;if (I(e), !o.resizer) return;const r = o.columns.get(o.resizer.columnName);if (!r) return;const n = P(e),s = r.element,a = o.resizer.parentNode,d = getComputedStyle(a),u = getComputedStyle(s),c = getElementOffset(s),h = getElementOffset(a);h.left += parseFloat(d.borderLeftWidth) || 0, c.left -= h.left;const m = getElementWidth(o.resizer, true, true, true),p = "border-box" === u.boxSizing;let f = O(t).pageX - h.left,g = c.left;g -= Math.ceil(m / 2), n ? (g += getElementWidth(s, true, true, true), g -= r.ignoreMin ? 0 : e._o.minColumnWidth, p || (g -= Math.ceil((parseFloat(u.borderLeftWidth) || 0) / 2), g -= T(s)), f > g && (f = g)) : (g += r.ignoreMin ? 0 : e._o.minColumnWidth, p || (g += Math.ceil((parseFloat(u.borderRightWidth) || 0) / 2), g += T(s)), f < g && (f = g)), o.resizer.style.left = f + "px";}function X(e, t) {var _ref2, _t$C, _v$changedTouches;const o = e._o,r = e._p;if (null != r.columnResizeStartTimeout) return void B(e);if (!r.resizer) return;r.eventsSink.remove(document, ".colresize");const n = r.columns.get(r.resizer.columnName);if (!n) return r.resizer.remove(), void (r.resizer = null);const s = P(e),a = n.element,d = a.firstChild,u = r.resizer.parentNode,c = getComputedStyle(u),h = getComputedStyle(a),m = getElementOffset(a),p = getElementOffset(u);p.left += parseFloat(c.borderLeftWidth) || 0, m.left -= p.left;const f = getElementWidth(r.resizer, true, true, true),g = "border-box" === h.boxSizing,v = t;let b = ((_ref2 = (_t$C = t[C]) !== null && _t$C !== void 0 ? _t$C : (_v$changedTouches = v.changedTouches) === null || _v$changedTouches === void 0 ? void 0 : _v$changedTouches[0]) !== null && _ref2 !== void 0 ? _ref2 : t).pageX - p.left,w = m.left,y = 0;if (w -= Math.ceil(f / 2), s) {if (!g) {b += T(a);const e = getComputedStyle(d || a);b += parseFloat(e.borderLeftWidth) || 0, b += parseFloat(e.borderRightWidth) || 0, b += n.arrowProposedWidth || 0;}w += getElementWidth(a, true, true, true);const t = w - (n.ignoreMin ? 0 : e._o.minColumnWidth);b > t && (b = t), y = w - b;} else {if (!g) {b -= T(a);const e = getComputedStyle(d || a);b -= parseFloat(e.borderLeftWidth) || 0, b -= parseFloat(e.borderRightWidth) || 0, b -= n.arrowProposedWidth || 0;}const t = w + (n.ignoreMin ? 0 : e._o.minColumnWidth);b < t && (b = t), y = b - w;}r.resizer.remove(), r.resizer = null;let W = y;if (2 === n.widthMode) {let t = z(e),l = 0,i = 0;for (let e = 0; e < r.visibleColumns.length; e++) {var _o$actualWidth;const o = r.visibleColumns[e];o.name !== n.name && (2 === o.widthMode ? (l += o.width, i++) : t -= (_o$actualWidth = o.actualWidth) !== null && _o$actualWidth !== void 0 ? _o$actualWidth : 0);}if (t <= 0 && r.table && (t = r.table.clientWidth), t > Math.max(o.minColumnWidth, 1)) {if (W = y / t, i > 0) {const e = W / ((1 - W) / l);l += W, (l < 1 && o.relativeWidthGrowsToFillWidth || l > 1 && o.relativeWidthShrinksToFillWidth) && (W = e);}W *= 100, W += "%";}}e.setColumnWidth(n.name, W);}function V(e, t) {var _o$columns$get;const l = e._o,o = e._p;if (!l.resizableColumns) return;const i = D(e, t),r = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);r && (i && (_o$columns$get = o.columns.get(i)) !== null && _o$columns$get !== void 0 && _o$columns$get.resizable ? r.style.cursor = "e-resize" : r.style.cursor = "");}function j(e, t) {var _ref3, _t$C2, _n$changedTouches;const o = e._o,n = t,s = t,a = (_ref3 = (_t$C2 = t[C]) !== null && _t$C2 !== void 0 ? _t$C2 : (_n$changedTouches = n.changedTouches) === null || _n$changedTouches === void 0 ? void 0 : _n$changedTouches[0]) !== null && _ref3 !== void 0 ? _ref3 : { pageX: s.pageX, pageY: s.pageY },d = t.target.closest(`div.${o.tableClassName}-header-cell,div.${o.cellPreviewClassName}`);if (!d) return;const u = getElementOffset(d);u.width = getElementWidth(d, true, true, true), u.height = getElementHeight(d, true, true, true), e.emit("headercontextmenu", { columnName: d.columnName, pageX: a.pageX, pageY: a.pageY, bounds: u });}function Y(e, t) {if (k(t)) return;if (D(e, t)) return;const l = e._o,o = e._p,i = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!i) return;if (!l.sortableColumns) return;const r = o.columns.get(i.columnName),n = o.rows.sortColumn;if (r && r.sortable) {let t = true;const o = n.length ? n[n.length - 1] : null;o && o.column === r.name && (o.descending && l.allowCancelSort ? (t = false, n.splice(n.length - 1, 1)) : o.descending = !o.descending);const i = e;t ? i.sort(r.name, void 0, true).render() : i.sort();}}const U = Array.prototype.indexOf,G = document.createElement.bind(document);function J(e) {const t = e._p;return t.headerRow && (t.headerRow = void 0), e;}function K(e) {const t = e._o,l = e._p;if (!l.tbody) return e;if (t.virtualTable && l.virtualListHelper) {const e = l.virtualListHelper.estimateFullHeight();l._lastVirtualScrollHeight = e, l.tbody.style.height = e + "px";} else l.tbody.style.height = "";return e;}function Q(e, t) {const l = e._p;if (!l.table) return e;const o = l.table.offsetWidth - l.table.clientWidth;if (o !== l.scrollbarWidth || t) {var _l$notifyRendererOfCo;l.scrollbarWidth = o;for (let e = 0; e < l.columns.length; e++) l.columns[e].actualWidthConsideringScrollbarWidth = null;if (l.scrollbarWidth > 0 && l.visibleColumns.length > 0 && l.tbody && l.headerRow) {var _l$visibleColumns$e$a;const e = l.visibleColumns.length - 1;l.visibleColumns[e].actualWidthConsideringScrollbarWidth = ((_l$visibleColumns$e$a = l.visibleColumns[e].actualWidth) !== null && _l$visibleColumns$e$a !== void 0 ? _l$visibleColumns$e$a : 0) - l.scrollbarWidth;const t = l.visibleColumns[e].actualWidthConsideringScrollbarWidth + "px",o = l.tbody.childNodes;for (let l = 0, i = o.length; l < i; l++) {const i = o[l];1 === i.nodeType && (i.childNodes[e].style.width = t);}l.headerRow.childNodes[e].style.width = t;}ee(e), (_l$notifyRendererOfCo = l.notifyRendererOfColumnsConfig) === null || _l$notifyRendererOfCo === void 0 ? void 0 : _l$notifyRendererOfCo.call(l);}return e;}function Z(e, t) {const o = e._o,i = e._p;if (!i.tbody || !i.table || !i.headerRow) return e;const r = F(e);if (i.tbody.style.minWidth = r + "px", i.headerRow.style.minWidth = r + (i.scrollbarWidth || 0) + "px", i.eventsSink.remove(i.table, "scroll"), o.width === N.AUTO) setElementWidth(i.table, getElementWidth(i.tbody, true, true, true)), setElementWidth(e.el, getElementWidth(i.table, true, true, true));else if (o.width === N.SCROLL) {if (t) {const t = i.table ? i.table.scrollTop : 0,l = i.table ? i.table.scrollLeft : 0;!function (e) {const t = e.style.display;e.style.display = "none", e.offsetHeight, e.style.display = t;}(e.el), i.table.scrollTop = t, i.table.scrollLeft = l, i.header && (i.header.scrollLeft = l);}const l = () => function (e) {const t = e._p;t.header.scrollLeft = t.table.scrollLeft, te(e);}(e);i.eventsSink.add(i.table, "scroll", l);}return e;}function ee(e) {var _t$scrollbarWidth;const t = e._p,l = e._o;if (!t.headerRow) return;const o = l.tableClassName + "-sticky",i = t.headerRow,r = P(e);t.lastIsRtl = r;const n = (_t$scrollbarWidth = t.scrollbarWidth) !== null && _t$scrollbarWidth !== void 0 ? _t$scrollbarWidth : 0,s = t.lastDetectedWidth,a = l.maxStickyColumnRelativeWidth,d = "number" == typeof a && s ? s * a : null;let u = 0,c = 0,h = null;const m = [],p = [];let f = null,g = [],v = null,C = 0,b = [];for (let e = i.firstElementChild; e; e = e.nextElementSibling) {var _i$actualWidth, _f;const l = e.getAttribute("data-column");if (!l) continue;const i = t.columns.get(l);if (!i) continue;i.headerScrollbarCompensation = 0;let s = "start" === i.sticky || "end" === i.sticky;if (s && null !== d && C + ((_i$actualWidth = i.actualWidth) !== null && _i$actualWidth !== void 0 ? _i$actualWidth : 0) > d && (s = false), s) {var _i$actualWidth2, _i$actualWidth3, _i$stickyPos, _i$stickyPos2, _i$stickyPos3;let l = (_i$actualWidth2 = i.actualWidth) !== null && _i$actualWidth2 !== void 0 ? _i$actualWidth2 : 0;C += 0, e.className += " " + o, e.style.position = "sticky";let s,a = null;null === h && (a = getComputedStyle(e), h = a.boxSizing), "content-box" === h && (null === a && (a = getComputedStyle(e)), l += (parseFloat(a.paddingLeft) || 0) + (parseFloat(a.paddingRight) || 0) + (parseFloat(a.borderLeftWidth) || 0) + (parseFloat(a.borderRightWidth) || 0)), "start" === i.sticky ? (s = { direction: "start", absDirection: r ? "right" : "left", offset: u }, e.style[s.absDirection] = u + "px", u += l, g.length = 0, f = [e], m.push(f)) : (v = e, s = { direction: "end", absDirection: r ? "left" : "right", offset: c }, e.style[s.absDirection] = c + n + "px", e.style.width = ((_i$actualWidth3 = i.actualWidth) !== null && _i$actualWidth3 !== void 0 ? _i$actualWidth3 : 0) + "px", c += l, p.push([e, ...g]), g.length = 0), s.direction === ((_i$stickyPos = i.stickyPos) === null || _i$stickyPos === void 0 ? void 0 : _i$stickyPos.direction) && s.offset === ((_i$stickyPos2 = i.stickyPos) === null || _i$stickyPos2 === void 0 ? void 0 : _i$stickyPos2.offset) && s.absDirection === ((_i$stickyPos3 = i.stickyPos) === null || _i$stickyPos3 === void 0 ? void 0 : _i$stickyPos3.absDirection) || b.push(t.visibleColumns.indexOf(i)), i.stickyPos = s;} else i.stickyPos && b.push(t.visibleColumns.indexOf(i)), delete i.stickyPos, (_f = f) !== null && _f !== void 0 && _f.push(e), g !== null && g !== void 0 && g.push(e), "sticky" === e.style.position && (e.classList.remove(o), e.style.position = "", e.style.left = "", e.style.right = "");}v && (v.style[r ? "left" : "right"] = "0px"), t.stickiesStart = m, t.stickiesEnd = p, b.length > 0 && e.refreshAllVirtualRows(), t.lastStickyScrollLeft = void 0, te(e);}function te(e) {const t = e._p;if (!t.table || !t.headerRow || !t.tbody) return;const l = t.stickiesStart,o = t.stickiesEnd,i = t.stickiesSetStart,r = t.stickiesSetEnd,n = t.stickiesSetStart = new Set(),s = t.stickiesSetEnd = new Set();if (l !== null && l !== void 0 && l.length || o !== null && o !== void 0 && o.length) {const e = t.table.scrollLeft;if (e === t.lastStickyScrollLeft) return;t.lastStickyScrollLeft = e;const i = t.headerRow.children,r = 1.5,a = t.lastIsRtl;let d = null;const u = (e, l, o) => {if (e && e.length) {for (const t of e) {l || (d = t);const e = t[0],n = t.slice(1),s = n[0],u = n[n.length - 1];if (!e || !e.getBoundingClientRect) continue;const c = e.getBoundingClientRect(),h = l !== a;let m = false;if (s && u) {const e = s.getBoundingClientRect(),t = u.getBoundingClientRect();m = l ? a ? c.right - r > t.left && c.left + r < e.right : c.right - r > e.left && c.left + r < t.right : a ? c.left + r < e.right && c.right - r > t.left : c.left + r < t.right && c.right - r > e.left;}e.classList.toggle(h ? "is-sticky-left" : "is-sticky-right", m), m && o.add(U.call(i, e));}if (d) {var _ref4, _l$actualWidthConside, _ref5, _l$actualWidthConside2;const e = d[0],l = t.columns.get(e.getAttribute("data-column")),o = a ? "marginRight" : "marginLeft";e.style[o] = "", e.style.width = ((_ref4 = (_l$actualWidthConside = l.actualWidthConsideringScrollbarWidth) !== null && _l$actualWidthConside !== void 0 ? _l$actualWidthConside : l.actualWidth) !== null && _ref4 !== void 0 ? _ref4 : 0) + "px";let i = 0;if (t.scrollbarWidth > 0) {const l = e.getBoundingClientRect(),r = e.offsetParent.getBoundingClientRect(),n = a ? l.left - r.left : r.right - l.right;n <= t.scrollbarWidth && (i = Math.min(t.scrollbarWidth, Math.max(0, t.scrollbarWidth - n + 1)), i < t.scrollbarWidth && (e.style[o] = -i + "px"));}l.headerScrollbarCompensation = i, e.style.width = ((_ref5 = (_l$actualWidthConside2 = l.actualWidthConsideringScrollbarWidth) !== null && _l$actualWidthConside2 !== void 0 ? _l$actualWidthConside2 : l.actualWidth) !== null && _ref5 !== void 0 ? _ref5 : 0) + i + "px";}}};u(l, true, n), u(o, false, s);}const a = [],d = [];for (const e of n) (i === null || i === void 0 ? void 0 : i.has(e)) || a.push({ index: e, start: true });for (const e of s) (r === null || r === void 0 ? void 0 : r.has(e)) || a.push({ index: e, start: false });if (i) for (const e of i) n.has(e) || d.push({ index: e, start: true });if (r) for (const e of r) s.has(e) || d.push({ index: e, start: false });if (!a.length && !d.length) return;let u = t.tbody.firstElementChild;for (; u;) {const e = u.children;for (const l of d) {var _e$l$index;(_e$l$index = e[l.index]) === null || _e$l$index === void 0 || _e$l$index.classList.remove(l.start !== t.lastIsRtl ? "is-sticky-left" : "is-sticky-right");}for (const l of a) {var _e$l$index2;(_e$l$index2 = e[l.index]) === null || _e$l$index2 === void 0 || _e$l$index2.classList.add(l.start !== t.lastIsRtl ? "is-sticky-left" : "is-sticky-right");}u = u.nextElementSibling;}t.isStickyColumns = new Map();for (const e of n) t.isStickyColumns.set(e, "start");for (const e of s) t.isStickyColumns.set(e, "end");}function le(e, t) {const l = e._p,o = e._o;if (!l.headerRow || !l.tbody) return e;const i = l.headerRow.querySelectorAll(`div.${o.tableClassName}-header-cell`)[t];if (!i) return e;const r = l.columns.get(i.columnName);if (r) {var _r$headerScrollbarCom, _ref6, _r$actualWidthConside;const e = (_r$headerScrollbarCom = r.headerScrollbarCompensation) !== null && _r$headerScrollbarCom !== void 0 ? _r$headerScrollbarCom : 0;i.style.width = ((_ref6 = (_r$actualWidthConside = r.actualWidthConsideringScrollbarWidth) !== null && _r$actualWidthConside !== void 0 ? _r$actualWidthConside : r.actualWidth) !== null && _ref6 !== void 0 ? _ref6 : 0) + e + "px";const o = (r.actualWidthConsideringScrollbarWidth || r.actualWidth || 0) + "px",n = l.tbody.childNodes;for (let e = 0, l = n.length; e < l; e++) {const l = n[e];1 === l.nodeType && (l.childNodes[t].style.width = o);}}return e;}function oe(e) {const t = e._p,l = e._o;if (t.table && t.headerRow) {const e = l.tableClassName,o = scopedSelectorAll(t.headerRow, `>div.${e}-header-cell.sorted`),i = Array.prototype.slice.call(o, 0).map((e) => e.querySelector(":scope>div>.sort-arrow")).filter((e) => !!e);for (const e of i) {var _e$parentNode;const l = (_e$parentNode = e.parentNode) === null || _e$parentNode === void 0 ? void 0 : _e$parentNode.parentNode;if (l) {const e = t.columns.get(l.columnName);e && (e.arrowProposedWidth = 0);}e.remove();}for (const e of o) e.classList.remove("sorted", "desc");}return e;}function ie(e, t, l) {var _r$element$firstChild;const o = e._p,i = e._o,r = o.columns.get(t);if (!r) return false;const n = G("span");return n.className = "sort-arrow", r.element && (r.element.className += l ? " sorted desc" : " sorted", (_r$element$firstChild = r.element.firstChild) !== null && _r$element$firstChild !== void 0 && _r$element$firstChild.insertBefore(n, r.element.firstChild.firstChild)), 2 !== r.widthMode && i.adjustColumnWidthForSortArrow && (r.arrowProposedWidth = n.scrollWidth + (parseFloat(getComputedStyle(n).marginRight) || 0) + (parseFloat(getComputedStyle(n).marginLeft) || 0)), true;}function re(e, t) {const l = t.firstChild;t.addEventListener("mousedown", (t) => $(e, t)), t.addEventListener("mousemove", (t) => V(e, t)), t.addEventListener("mouseup", (t) => function (e, t) {2 === t.button && j(e, t);}(e, t)), t.addEventListener("mouseleave", (t) => function (e, t) {const l = e._o,o = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);o && (o.style.cursor = "");}(e, t)), t.addEventListener("touchstart", (t) => function (e, t) {const l = e._p;if (l.currentTouchId) return;const o = t.changedTouches[0];l.currentTouchId = o.identifier;const i = t.currentTarget,r = { x: o.pageX, y: o.pageY };let n,s = r;const a = function () {l.currentTouchId = null, l.eventsSink.remove(i, ".colheader"), clearTimeout(n);};t[C] = t.changedTouches[0], true !== $(e, t) ? (n = setTimeout(() => {a(), l.eventsSink.add(i, "touchend.colheader", (e) => {k(e) || e.preventDefault(), l.eventsSink.remove(i, ".colheader");}, { once: true }).add(i, "touchcancel.colheader", (e) => {l.eventsSink.remove(i, ".colheader");}, { once: true }), Math.sqrt(Math.pow(Math.abs(s.x - r.x), 2) + Math.pow(Math.abs(s.y - r.y), 2)) < 9 && (B(e), j(e, t));}, 500), l.eventsSink.add(i, "touchend.colheader", (t) => {const o = t,i = u(Array.from(o.changedTouches), (e) => e.identifier === l.currentTouchId);i && (a(), k(t) || t.preventDefault(), s = { x: i.pageX, y: i.pageY }, (Math.sqrt(Math.pow(Math.abs(s.x - r.x), 2) + Math.pow(Math.abs(s.y - r.y), 2)) < 9 || l.resizer) && (o[C] = i, Y(e, o)));}).add(i, "touchcancel.colheader", a).add(i, "touchmove.colheader", (t) => {const o = t,i = u(Array.from(o.changedTouches), (e) => e.identifier === l.currentTouchId);i && (s = { x: i.pageX, y: i.pageY }, l.resizer && (t.preventDefault(), o[C] = i, V(e, o)));})) : l.currentTouchId = null;}(e, t)), t.addEventListener("dragstart", (t) => function (e, t) {const l = e._o,o = e._p;if (l.movableColumns) {var _t$dataTransfer;const e = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!e) return void t.preventDefault();const i = o.columns.get(e.columnName);i && i.movable ? (e.style.opacity = "0.35", o.dragId = 161061273 * Math.random(), (_t$dataTransfer = t.dataTransfer) === null || _t$dataTransfer === void 0 ? void 0 : _t$dataTransfer.setData("text", JSON.stringify({ dragId: o.dragId, column: i.name }))) : t.preventDefault();} else t.preventDefault();}(e, t)), t.addEventListener("click", (t) => Y(e, t)), t.addEventListener("contextmenu", (e) => e.preventDefault()), l.addEventListener("dragenter", (t) => function (e, t) {const l = e._o,o = e._p;if (l.movableColumns) {var _t$dataTransfer2;let e = null;const i = (_t$dataTransfer2 = t.dataTransfer) === null || _t$dataTransfer2 === void 0 ? void 0 : _t$dataTransfer2.getData("text");if (i) try {e = JSON.parse(i);} catch {e = null;}const r = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!r) return;if (!e || o.dragId === e.dragId && r.columnName !== e.column) {const e = o.columns.get(r.columnName);e && (e.movable || e !== o.visibleColumns[0]) && r.classList.add("drag-over");}}}(e, t)), l.addEventListener("dragover", (e) => {e.preventDefault();}), l.addEventListener("dragleave", (t) => function (e, t) {const l = e._o,o = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!o) return;const i = t.relatedTarget;(i === null || i === void 0 ? void 0 : i.contains(o.firstChild)) || o.classList.remove("drag-over");}(e, t)), l.addEventListener("drop", (t) => function (e, t, _t$dataTransfer3) {t.preventDefault();const l = e._o,o = e._p,i = (_t$dataTransfer3 = t.dataTransfer) === null || _t$dataTransfer3 === void 0 ? void 0 : _t$dataTransfer3.getData("text");if (!i) return;let r;try {r = JSON.parse(i);} catch {return;}const n = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (n) {if (l.movableColumns && r.dragId === o.dragId) {const t = r.column,l = n.columnName,i = o.columns.get(t),s = o.columns.get(l);i && s && i.movable && (s.movable || s !== o.visibleColumns[0]) && e.moveColumn(t, l);}n.classList.remove("drag-over");}}(e, t));}function ne(e, t) {let l = 0;if ("string" == typeof e) {const t = e.trim().toLowerCase();if ("rest" === t) return { width: 0, mode: 3 };if ("auto" === t) return { width: 0, mode: 0 };}let o = parseFloat(e);return Number.isFinite(o) || (o = 0), o = Math.max(0, o), o > 0 && ("string" == typeof e && e.trim().endsWith("%") ? (l = 2, o /= 100) : o > 0 && o < 1 ? l = 2 : (o < t && (o = t), l = 1)), { width: o, mode: l };}function se(e, t) {var _t$allowPreview;let l = ne(t.width, t.ignoreMin ? 0 : e.minColumnWidth),o = { name: t.name, label: void 0 === t.label ? t.name : t.label, width: l.width, widthMode: l.mode, resizable: void 0 === t.resizable || t.resizable, sortable: void 0 === t.sortable || t.sortable, movable: void 0 === t.movable || t.movable, visible: void 0 === t.visible || t.visible, cellClasses: void 0 === t.cellClasses ? e.cellClasses : t.cellClasses, ignoreMin: void 0 !== t.ignoreMin && !!t.ignoreMin, sticky: void 0 === t.sticky ? null : t.sticky || null, allowPreview: !!((_t$allowPreview = t.allowPreview) !== null && _t$allowPreview !== void 0 ? _t$allowPreview : 1), dataPath: [], comparePath: [], order: 0 };const i = void 0 === t.dataPath ? o.name : t.dataPath,r = void 0 === t.comparePath ? i : t.comparePath;return o.dataPath = "string" == typeof i ? i.split(".") : i, o.comparePath = "string" == typeof r ? r.split(".") : r, o;}function ae(e) {const t = e._p;0 === t.visibleColumns.length && t.columns.length && (t.columns[0].visible = true, t.visibleColumns.push(t.columns[0]), e.emit("showcolumn", t.columns[0].name));}function de(e) {const t = e._p;if (t.filteredRows && t.filterArgs) {let l = e._o.filter || S;t.filteredRows = t.rows.filteredCollection(l, t.filterArgs);}}function ue(e, t, l) {let o = l.dataPath,i = t[o[0]];for (let e = 1; e < o.length && null != i; e++) i = i && i[o[e]];const r = e.cellFormatter;let n;if (r[h]) n = r(i, l.name, t);else try {n = r(i, l.name, t);} catch (e) {n = "[ERROR]", console.error("Failed to generate content for cell " + l.name, e);}return null == n && (n = ""), n;}const ce = Array.prototype.indexOf,he = document.createElement.bind(document);function me(e) {const t = e._p;if (t.cellPreviewCell) {var _l$rowIndex;const l = t.cellPreviewCell,o = l[v];let i;try {i = H.saveSelection(l);} catch {}t.cellPreviewCell.remove(), o && t._unbindCellHoverOut(o), t._unbindCellHoverOut(l);try {i && o && H.restoreSelection(o, i);} catch {}e.emit("cellpreviewdestroy", { el: l.firstChild, name: l.columnName, rowIndex: (_l$rowIndex = l.rowIndex) !== null && _l$rowIndex !== void 0 ? _l$rowIndex : null, rowData: null == l.rowIndex ? null : t.rows[l.rowIndex], cell: o, cellEl: o === null || o === void 0 ? void 0 : o.firstChild }), o && delete o[g], delete l[v], t.cellPreviewCell = null, t.abortCellPreview = false;} else t.abortCellPreview = true;return e;}const pe = Object.prototype.hasOwnProperty,fe = document.createElement.bind(document);class ge {constructor(e) {var _e$maxColumnsSortCoun, _e$sortedColumns;this.VERSION = ge.VERSION;const t = this._o = {},n = this._p = { eventsSink: new DomEventsSink(), mitt: { all: s = s || new Map(), on: function (e, t) {var l = s.get(e);l ? l.push(t) : s.set(e, [t]);}, off: function (e, t) {var l = s.get(e);l && (t ? l.splice(l.indexOf(t) >>> 0, 1) : s.set(e, []));}, emit: function (e, t) {var l = s.get(e);l && l.slice().map(function (e) {e(t);}), (l = s.get("*")) && l.slice().map(function (l) {l(e, t);});} }, tableSkeletonNeedsRendering: true };var s;this.el = e.el && e.el instanceof HTMLElement ? e.el : document.createElement("div"), this.el !== e.el && this.el.classList.add(e.className || "dgtable-wrapper"), n.eventsSink.add(this.el, "dragend.colresize", (e) => {return t = e, void (this._p.resizer || (t.target.style.opacity = ""));var t;}), n.isWheelScrolling = false, n.eventsSink.add(this.el, "wheel", (e) => {if (n.cellPreviewCell) {let t = false,l = e.target;for (; l && l !== n.cellPreviewCell;) {const e = getComputedStyle(l),o = e.overflowY,i = e.overflowX,r = ("auto" === o || "scroll" === o) && l.scrollHeight > l.clientHeight,n = ("auto" === i || "scroll" === i) && l.scrollWidth > l.clientWidth;if (r || n) {t = true;break;}l = l.parentElement;}if (t) return;}n.isWheelScrolling = true, me(this), n.wheelScrollTimeout && clearTimeout(n.wheelScrollTimeout), n.wheelScrollTimeout = setTimeout(() => {n.isWheelScrolling = false, n.wheelScrollTimeout = void 0;}, 100);}, { passive: true }), t.virtualTable = void 0 === e.virtualTable || !!e.virtualTable, t.estimatedRowHeight = e.estimatedRowHeight || void 0, t.rowsBufferSize = e.rowsBufferSize || 3, t.minColumnWidth = Math.max(e.minColumnWidth || 35, 0), t.maxStickyColumnRelativeWidth = e.maxStickyColumnRelativeWidth || null, t.resizeAreaWidth = e.resizeAreaWidth || 8, t.resizeAreaDoubleClickDuration = e.resizeAreaDoubleClickDuration || 300, t.autoFitColumnOnResizeDoubleClick = void 0 !== e.autoFitColumnOnResizeDoubleClick && !!e.autoFitColumnOnResizeDoubleClick, t.resizableColumns = void 0 === e.resizableColumns || !!e.resizableColumns, t.movableColumns = void 0 === e.movableColumns || !!e.movableColumns;const d = (_e$maxColumnsSortCoun = e.maxColumnsSortCount) !== null && _e$maxColumnsSortCoun !== void 0 ? _e$maxColumnsSortCoun : e.sortableColumns;t.sortableColumns = void 0 === d ? 1 : Number(d) || 1, t.adjustColumnWidthForSortArrow = void 0 === e.adjustColumnWidthForSortArrow || !!e.adjustColumnWidthForSortArrow, t.convertColumnWidthsToRelative = void 0 !== e.convertColumnWidthsToRelative && !!e.convertColumnWidthsToRelative, t.autoFillTableWidth = void 0 !== e.autoFillTableWidth && !!e.autoFillTableWidth, t.autoFillLastColumn = void 0 === e.autoFillLastColumn || !!e.autoFillLastColumn, t.allowCancelSort = void 0 === e.allowCancelSort || !!e.allowCancelSort, t.cellClasses = void 0 === e.cellClasses ? "" : e.cellClasses, t.resizerClassName = void 0 === e.resizerClassName ? "dgtable-resize" : e.resizerClassName, t.tableClassName = void 0 === e.tableClassName ? "dgtable" : e.tableClassName, t.allowCellPreview = void 0 === e.allowCellPreview || e.allowCellPreview, t.allowHeaderCellPreview = void 0 === e.allowHeaderCellPreview || e.allowHeaderCellPreview, t.cellPreviewClassName = void 0 === e.cellPreviewClassName ? "dgtable-cell-preview" : e.cellPreviewClassName, t.cellPreviewAutoBackground = void 0 === e.cellPreviewAutoBackground || e.cellPreviewAutoBackground, t.onComparatorRequired = void 0 === e.onComparatorRequired ? null : e.onComparatorRequired, t.customSortingProvider = void 0 === e.customSortingProvider ? null : e.customSortingProvider, t.width = void 0 === e.width ? N.NONE : e.width, t.relativeWidthGrowsToFillWidth = void 0 === e.relativeWidthGrowsToFillWidth || !!e.relativeWidthGrowsToFillWidth, t.relativeWidthShrinksToFillWidth = void 0 !== e.relativeWidthShrinksToFillWidth && !!e.relativeWidthShrinksToFillWidth, this.setCellFormatter(e.cellFormatter), this.setHeaderCellFormatter(e.headerCellFormatter), this.setFilter(e.filter), t.height = e.height, this.setColumns(e.columns || [], false);let u = [];const c = (_e$sortedColumns = e.sortedColumns) !== null && _e$sortedColumns !== void 0 ? _e$sortedColumns : e.sortColumn;if (c) {let e = Array.isArray(c) ? c : [c];for (let t = 0, l = e.length; t < l; t++) {var _l$descending;let l = e[t];"string" == typeof l && (l = { column: l, descending: false });let o = n.columns.get(l.column);o && u.push({ column: l.column, comparePath: o.comparePath || o.dataPath, descending: (_l$descending = l.descending) !== null && _l$descending !== void 0 ? _l$descending : false });}}n.rows = new y({ sortColumn: u }), n.rows.onComparatorRequired = (e, l, o) => {if (t.onComparatorRequired) return t.onComparatorRequired(e, l, o);}, n.rows.customSortingProvider = (e, l) => t.customSortingProvider ? t.customSortingProvider(e, l) : l(e), n.filteredRows = null, n.scrollbarWidth = 0, n._lastVirtualScrollHeight = 0, function (e) {const t = e._p,n = (t) => {let n = t.currentTarget,s = t.relatedTarget;s === n || n.contains(s) || n[g] && (s === n[g] || n[g].contains(s)) || function (e, t, _s$visibleColumns$ce$, _F$right) {const n = e._o,s = e._p;if (s.isWheelScrolling) return;const a = t.firstElementChild;if (!a) return;if (!(a.scrollWidth - a.clientWidth > 1 || a.scrollHeight - a.clientHeight > 1)) return;me(e), s.abortCellPreview = false;const d = t.parentElement;if (!d) return;const u = (_s$visibleColumns$ce$ = s.visibleColumns[ce.call(d.childNodes, t)]) === null || _s$visibleColumns$ce$ === void 0 ? void 0 : _s$visibleColumns$ce$.name,c = u ? s.columns.get(u) : null;if (!c) return;const h = d.index;if (e.emit("cellhoveroverflow", { name: u, rowIndex: h !== null && h !== void 0 ? h : null, rowData: null == h ? null : s.rows[h], cell: t, cellEl: a }), false === c.allowPreview) return;const m = he("div");m.innerHTML = t.innerHTML, m.className = n.cellPreviewClassName + " " + (c.cellClasses || "");const p = t.classList.contains(`${n.tableClassName}-header-cell`);p && (m.classList.add("header"), t.classList.contains("sortable") && m.classList.add("sortable"), m.draggable = true, re(e, m));const f = getComputedStyle(t),C = getComputedStyle(a),b = "right" === f.float,w = b ? "right" : "left",y = parseFloat(f.paddingLeft) || 0,W = parseFloat(f.paddingRight) || 0,R = parseFloat(f.paddingTop) || 0,S = parseFloat(f.paddingBottom) || 0;let N = a.scrollWidth + (t.clientWidth - a.offsetWidth);const _ = "border-box" === f.boxSizing;if (_ ? m.style.boxSizing = "border-box" : (N -= y + W, m.style.marginTop = (parseFloat(f.borderTopWidth) || 0) + "px"), !s.transparentBgColor1) {const e = document.createElement("div");document.body.appendChild(e), e.style.backgroundColor = "transparent", s.transparentBgColor1 = getComputedStyle(e).backgroundColor, e.style.backgroundColor = "rgba(0,0,0,0)", s.transparentBgColor2 = getComputedStyle(e).backgroundColor, e.remove();}const x = { "box-sizing": _ ? "border-box" : "content-box", width: N + "px", "min-height": Math.max(getElementHeight(t), /%/.test(f.minHeight) ? 0 : parseFloat(f.minHeight) || 0) + "px", "padding-left": y + "px", "padding-right": W + "px", "padding-top": R + "px", "padding-bottom": S + "px", overflow: "hidden", position: "absolute", "z-index": "-1", [w]: "0", top: "0", cursor: f.cursor };let k = f.backgroundColor;k !== s.transparentBgColor1 && k !== s.transparentBgColor2 || (k = getComputedStyle(d).backgroundColor), k !== s.transparentBgColor1 && k !== s.transparentBgColor2 || (k = "#fff"), x["background-color"] = k, setCssProps(m, x), m.firstChild && setCssProps(m.firstChild, { direction: C.direction, "white-space": C.whiteSpace, "min-height": C.minHeight, "line-height": C.lineHeight, font: C.font }), e.el.appendChild(m), p && M(m), m.rowVIndex = d.vIndex, m.rowIndex = h, m.columnName = u;try {const e = H.saveSelection(t);e && H.restoreSelection(m, e);} catch {}if (e.emit("cellpreview", { el: m.firstElementChild, name: m.columnName, rowIndex: h !== null && h !== void 0 ? h : null, rowData: null == h ? null : s.rows[h], cell: t, cellEl: a }), s.abortCellPreview) return void m.remove();null != h && m.addEventListener("click", (t) => {e.emit("rowclick", { event: t, filteredRowIndex: d.vIndex, rowIndex: h, rowEl: d, rowData: s.rows[h] });});const T = e.el,L = T === window ? document : T,z = getComputedStyle(T),F = getElementOffset(t),P = getElementOffset(T);if (b) {const e = window.innerWidth;F.right = e - (F.left + getElementWidth(t, true, true, true)), P.right = e - (P.left + getElementWidth(T, true, true, true));}F.left -= parseFloat(z.borderLeftWidth) || 0, "right" === w && void 0 !== F.right && void 0 !== P.right && (F.right -= parseFloat(z.borderRightWidth) || 0), F.top -= parseFloat(z.borderTopWidth) || 0, "left" === w ? F.left += parseFloat(f.borderLeftWidth) || 0 : void 0 !== F.right && (F.right += parseFloat(f.borderRightWidth) || 0), F.top += parseFloat(f.borderTopWidth) || parseFloat(f.borderBottomWidth) || 0, F.left -= P.left, "right" === w && void 0 !== F.right && void 0 !== P.right && (F.right -= P.right), F.top -= P.top;const A = getElementWidth(T, false, false, false) - getElementWidth(m, true, true, true),E = "left" === w ? F.left : (_F$right = F.right) !== null && _F$right !== void 0 ? _F$right : 0,O = E < 0 ? 0 : E > A ? A : E;"left" === w ? F.left = O : F.right = O;const I = getElementHeight(t, true, true, true),D = ("scrollTop" in L ? L.scrollTop : 0) + getElementHeight(T, true) - I;F.top > D && (F.top = Math.max(0, D));const B = { top: F.top + "px", "z-index": 9999 };B[w] = ("left" === w ? F.left : F.right) + "px", setCssProps(m, B), m[v] = t, s.cellPreviewCell = m, t[g] = m, s._bindCellHoverOut(t), s._bindCellHoverOut(m);}(e, n);},s = (t) => {let l = t.currentTarget[v] || t.currentTarget,o = t.relatedTarget;o === e.el || l.contains(o) || l[g] && (o === l[g] || l[g].contains(o)) || function (e) {me(e);}(e);};t._bindCellHoverIn = (e) => {e[m] || e.addEventListener("mouseover", e[m] = n);}, t._unbindCellHoverIn = (e) => {e[m] && (e.removeEventListener("mouseover", e[m]), e[m] = null);}, t._bindCellHoverOut = (e) => {e[p] || e.addEventListener("mouseout", e[p] = s);}, t._unbindCellHoverOut = (e) => {e[p] && (e.removeEventListener("mouseout", e[p]), e[p] = null);};}(this);}on(e, t) {return this[w] || this._p.mitt.on(e, t), this;}once(e, t) {if (this[w]) return this;const l = (o) => {this._p.mitt.off(e, l), t(o);};return this._p.mitt.on(e, l), this;}off(e, t) {return this[w] || (e || t ? this._p.mitt.off(e, t) : this._p.mitt.all.clear()), this;}emit(e, t) {return this[w] || this._p.mitt.emit(e, t), this;}destroy() {var _e$virtualListHelper, _e$table, _e$tbody;const e = this._p,t = this.el;if (this[w] || !e) return this;if (B(this), (_e$virtualListHelper = e.virtualListHelper) !== null && _e$virtualListHelper !== void 0 && _e$virtualListHelper.destroy(), e.virtualListHelper = null, J(this), (_e$table = e.table) !== null && _e$table !== void 0 && _e$table.remove(), (_e$tbody = e.tbody) !== null && _e$tbody !== void 0 && _e$tbody.remove(), e.workerListeners) {for (let t = 0; t < e.workerListeners.length; t++) {let l = e.workerListeners[t];l.worker.removeEventListener("message", l.listener, false);}e.workerListeners.length = 0;}e.rows.length = e.columns.length = 0, e._deferredRender && clearTimeout(e._deferredRender);for (let e in this) pe.call(this, e) && (this[e] = null);return this[w] = true, t && t.remove(), this;}close() {this.destroy();}remove() {this.destroy();}render() {const l = this._o,i = this._p;if (!this.el.offsetParent) return i._deferredRender || (i._deferredRender = setTimeout(() => {i._deferredRender = null, !this[w] && this.el.offsetParent && this.render();})), this;if (true === i.tableSkeletonNeedsRendering) {var _i$filteredRows;i.tableSkeletonNeedsRendering = false, l.width === N.AUTO && oe(this);let n = i.table && i.table.parentNode ? i.table.scrollTop : NaN,s = i.table && i.table.parentNode ? getScrollHorz(i.table) : NaN;!function (e, _t$virtualListHelper) {const t = e._p,l = e._o;(_t$virtualListHelper = t.virtualListHelper) !== null && _t$virtualListHelper !== void 0 && _t$virtualListHelper.destroy(), t.virtualListHelper = null, t.table && l.virtualTable && (t.table.remove(), t.table = void 0, t.tbody = void 0), J(e), t.currentTouchId = null, t.header && t.header.remove();const o = l.tableClassName,i = G("div"),n = G("div");i.className = `${o}-header`, n.className = `${o}-header-row`, t.header = i, t.headerRow = n, i.appendChild(n), e.el.prepend(i), x(e.el), l.width === N.SCROLL ? e.el.style.overflow = "hidden" : e.el.style.overflow = "", !l.height && l.virtualTable && (l.height = getElementHeight(e.el, true));}(this), function (e) {const t = e._p,l = e._o,i = l.tableClassName;if (l.virtualTable && !t.virtualRowHeight) {const l = () => {const e = G("div"),t = e.appendChild(G("div")),l = t.appendChild(G("div"));return e.className = `${i}-row`, t.className = `${i}-cell`, l.innerHTML = "0", e.style.visibility = "hidden", e.style.position = "absolute", e;},n = G("div");n.className = e.el.className, setCssProps(n, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px", width: "1px", overflow: "hidden" });const s = G("div");s.className = i, n.appendChild(s);const a = G("div");a.className = `${i}-body`, a.style.width = "99999px", s.appendChild(a), document.body.appendChild(n);const d = l(),u = l(),c = l();a.appendChild(d), a.appendChild(u), a.appendChild(c), t.virtualRowHeight = getElementHeight(u, true, true, true), n.remove();}if (!t.table) {var _l$height;const n = document.createDocumentFragment(),s = G("div");s.className = i, l.virtualTable && (s.className += " virtual");const a = getComputedStyle(s);let u = ((_l$height = l.height) !== null && _l$height !== void 0 ? _l$height : 0) - getElementHeight(t.header, true, true, true);"border-box" !== a.boxSizing && (u -= parseFloat(a.borderTopWidth) || 0, u -= parseFloat(a.borderBottomWidth) || 0, u -= parseFloat(a.paddingTop) || 0, u -= parseFloat(a.paddingBottom) || 0), setCssProps(s, { height: l.height ? u + "px" : "auto", display: "block", overflowY: "auto", overflowX: l.width === N.SCROLL ? "auto" : "hidden" }), n.appendChild(s);const c = G("div");c.className = l.tableClassName + "-body", c.style.minHeight = "1px", t.table = s, t.tbody = c, x(c), x(s), s.appendChild(c), e.el.appendChild(n), function (e, _t$filteredRows) {const t = e._p,l = e._o,o = l.tableClassName,i = o + "-row",r = o + "-row-alt",n = o + "-cell",s = o + "-sticky";let a = t.visibleColumns,u = a.length;t.notifyRendererOfColumnsConfig = () => {a = t.visibleColumns, u = a.length;for (let e = 0; e < u; e++) {const t = a[e];t._finalWidth = t.actualWidthConsideringScrollbarWidth || t.actualWidth;}}, t.virtualListHelper = new VirtualListHelper({ list: t.table, itemsParent: t.tbody, autoVirtualWrapperWidth: false, virtual: l.virtualTable, buffer: l.rowsBufferSize, estimatedItemHeight: l.estimatedRowHeight ? l.estimatedRowHeight : t.virtualRowHeight || 40, itemElementCreatorFn: () => G("div"), onItemRender: (o, d) => {const c = t.filteredRows || t.rows,h = !!t.filteredRows,m = t.isStickyColumns;o.className = i, d % 2 == 1 && (o.className += " " + r);const p = c[d],g = h ? p[b] : d;o.vIndex = d, o.index = g;for (let e = 0; e < u; e++) {var _i$_finalWidth;const i = a[e],r = G("div");if (r.columnName = i.name, r.setAttribute("data-column", i.name), r.className = n, r.style.width = ((_i$_finalWidth = i._finalWidth) !== null && _i$_finalWidth !== void 0 ? _i$_finalWidth : 0) + "px", i.cellClasses && (r.className += " " + i.cellClasses), i.stickyPos) {r.className += " " + s, r.style.position = "sticky", r.style[i.stickyPos.absDirection] = i.stickyPos.offset + "px";const l = m === null || m === void 0 ? void 0 : m.get(e);"start" === l && !t.lastIsRtl || "end" === l && t.lastIsRtl ? r.classList.add("is-sticky-left") : ("start" === l && t.lastIsRtl || "end" === l && !t.lastIsRtl) && r.classList.add("is-sticky-right");}t._bindCellHoverIn(r), r.appendChild(G("div")).innerHTML = ue(l, p, i), o.appendChild(r);}o.addEventListener("click", o[f] = (t) => {e.emit("rowclick", { event: t, filteredRowIndex: d, rowIndex: g, rowEl: o, rowData: p });}), e.emit("rowcreate", { filteredRowIndex: d, rowIndex: g, rowEl: o, rowData: p });}, onItemUnrender: (t) => {t[f] && t.removeEventListener("click", t[f]), function (e, t) {const l = e._p;for (let e = 0, o = t.childNodes, i = o.length; e < i; e++) l._unbindCellHoverIn(o[e]);}(e, t), e.emit("rowdestroy", t);}, onScrollHeightChange: (l) => {l > t._lastVirtualScrollHeight && !t.scrollbarWidth && Q(e), t._lastVirtualScrollHeight = l;} }), t.virtualListHelper.setCount(((_t$filteredRows = t.filteredRows) !== null && _t$filteredRows !== void 0 ? _t$filteredRows : t.rows).length), t.notifyRendererOfColumnsConfig();}(e);}}(this), this.tableWidthChanged(true, false), function (e) {const t = e._p,l = e._o,o = l.tableClassName + "-header-cell",i = t.headerRow;for (let r = 0; r < t.visibleColumns.length; r++) {const n = t.visibleColumns[r];if (n.visible) {var _n$actualWidth;const s = G("div");s.draggable = true, s.className = o, s.style.width = ((_n$actualWidth = n.actualWidth) !== null && _n$actualWidth !== void 0 ? _n$actualWidth : 0) + "px", l.sortableColumns && n.sortable && (s.className += " sortable"), s.columnName = n.name, s.setAttribute("data-column", n.name);const a = G("div");a.innerHTML = l.headerCellFormatter(n.label, n.name), s.appendChild(a), t._bindCellHoverIn(s), i.appendChild(s), t.visibleColumns[r].element = s, re(e, s), M(s);}}ee(e), e.emit("headerrowcreate", i);}(this), i.virtualListHelper.setCount(((_i$filteredRows = i.filteredRows) !== null && _i$filteredRows !== void 0 ? _i$filteredRows : i.rows).length), K(this), Q(this, true), Z(this, true);for (let e = 0; e < i.rows.sortColumn.length; e++) ie(this, i.rows.sortColumn[e].column, i.rows.sortColumn[e].descending);l.adjustColumnWidthForSortArrow && i.rows.sortColumn.length ? this.tableWidthChanged(true) : l.virtualTable || this.tableWidthChanged(), isNaN(n) || (i.table.scrollTop = n), isNaN(s) || (setScrollHorz(i.table, s), setScrollHorz(i.header, s)), ee(this), this.emit("renderskeleton");}return i.virtualListHelper.render(), this.emit("render"), this;}clearAndRender(e) {var _t$notifyRendererOfCo;let t = this._p;return t.tableSkeletonNeedsRendering = true, (_t$notifyRendererOfCo = t.notifyRendererOfColumnsConfig) !== null && _t$notifyRendererOfCo !== void 0 && _t$notifyRendererOfCo.call(t), (void 0 === e || e) && this.render(), this;}setColumns(e, t) {const l = this._p;e = e || [];let o = new R();for (let t = 0, l = 0; t < e.length; t++) {let i = e[t],r = se(this._o, i);void 0 !== i.order ? (i.order > l && (l = i.order + 1), r.order = i.order) : r.order = l++, o.push(r);}return o.normalizeOrder(), l.columns = o, l.visibleColumns = o.getVisibleColumns(), ae(this), this.clearAndRender(t), this;}addColumn(e, t, l) {const o = this._p;let i = o.columns;if (e && !i.get(e.name)) {let r = null;void 0 !== t && (r = "string" == typeof t ? i.get(t) : i.getByOrder(t));let n = se(this._o, e);n.order = r ? r.order : i.getMaxOrder() + 1;for (let e = i.getMaxOrder(), t = n.order; e >= t; e--) {let t = i.getByOrder(e);t && t.order++;}i.push(n), i.normalizeOrder(), o.visibleColumns = i.getVisibleColumns(), ae(this), this.clearAndRender(l), this.emit("addcolumn", n.name);}return this;}removeColumn(e, t) {const l = this._p;let o = l.columns,i = o.indexOf(e);return i > -1 && (o.splice(i, 1), o.normalizeOrder(), l.visibleColumns = o.getVisibleColumns(), ae(this), this.clearAndRender(t), this.emit("removecolumn", e)), this;}setColumnLabel(e, t) {let l = this._p.columns.get(e);if (l && (l.label = void 0 === t ? l.name : t, l.element)) for (let e = 0; e < l.element.firstChild.childNodes.length; e++) {let t = l.element.firstChild.childNodes[e];if (3 === t.nodeType) {t.textContent = l.label;break;}}return this;}moveColumn(e, t, l = true) {const o = this._o,i = this._p;let r,n,a = i.columns,d = l ? i.visibleColumns : a.getColumns();if ("string" == typeof e ? r = a.get(e) : "number" == typeof e && (r = d[e]), "string" == typeof t ? n = a.get(t) : "number" == typeof t && (n = d[t]), r && n && e !== t) {let e = r.order,t = n.order,l = a.moveColumn(r, n).getVisibleColumns();if (i.visibleColumns.length !== l.length || i.visibleColumns.some((e, t) => e !== l[t])) if (i.visibleColumns = l, ae(this), o.virtualTable) this.clearAndRender();else {var _ref7, _ref8;const l = scopedSelectorAll(i.headerRow, `>div.${o.tableClassName}-header-cell`);let r = e < t ? t + 1 : t,n = e;l[0].parentNode.insertBefore(l[n], l[r]);let a = i.visibleColumns[e],d = ((_ref7 = a.actualWidthConsideringScrollbarWidth || a.actualWidth) !== null && _ref7 !== void 0 ? _ref7 : 0) + "px",u = i.visibleColumns[t],c = ((_ref8 = u.actualWidthConsideringScrollbarWidth || u.actualWidth) !== null && _ref8 !== void 0 ? _ref8 : 0) + "px",h = i.tbody.childNodes;for (let l = 0, o = h.length; l < o; l++) {let o = h[l];1 === o.nodeType && (o.insertBefore(o.childNodes[n], o.childNodes[r]), o.childNodes[t].firstChild.style.width = c, o.childNodes[e].firstChild.style.width = d);}this.tableWidthChanged(true);}this.emit("movecolumn", { name: r.name, src: e, dest: t });}return this;}setColumnVisible(e, t) {const l = this._p;let o = l.columns.get(e);return t = !!t, o && !!o.visible !== t && (o.visible = t, l.visibleColumns = l.columns.getVisibleColumns(), this.emit(t ? "showcolumn" : "hidecolumn", e), ae(this), this.clearAndRender()), this;}isColumnVisible(e) {let t = this._p.columns.get(e);return !!t && t.visible;}setMinColumnWidth(e) {let t = this._o;return e = Math.max(e, 0), t.minColumnWidth !== e && (t.minColumnWidth = e, this.tableWidthChanged(true)), this;}getMinColumnWidth() {return this._o.minColumnWidth;}setMaxStickyColumnRelativeWidth(e) {let t = this._o;return e = e || null, t.maxStickyColumnRelativeWidth !== e && (t.maxStickyColumnRelativeWidth = e, this.tableWidthChanged(true)), this;}getMaxStickyColumnRelativeWidth() {return this._o.maxStickyColumnRelativeWidth;}setColumnWidth(e, t) {let l = this._p.columns.get(e);if (l) {let e = ne(t, l.ignoreMin ? 0 : this._o.minColumnWidth),o = A(l);l.width = e.width, l.widthMode = e.mode, l.unconvertedWidth = null, l.unconvertedWidthMode = null;let i = A(l);o !== i && this.tableWidthChanged(true), this.emit("columnwidth", { name: l.name, width: i, oldWidth: o });}return this;}autoFitColumn(e) {const t = this._p,l = t.filteredRows || t.rows,o = t.columns.get(e);if (!o || l.length < 1) return this;const i = this.measureAutoFitColumnWidth(o, l);return i > 0 && this.setColumnWidth(e, i), this;}measureAutoFitColumnWidth(e, t) {const i = this._o,r = i.tableClassName,n = fe("div");n.className = this.el.className, setCssProps(n, { position: "absolute", top: "-9999px", left: "0", visibility: "hidden", width: "auto", overflow: "visible" });const s = fe("div");s.className = `${r}-header`;const a = fe("div");a.className = `${r}-header-row`;const d = fe("div");d.className = `${r}-header-cell ${e.cellClasses || ""}`, d.style.width = "auto", d.appendChild(fe("div")).innerHTML = i.headerCellFormatter(e.label, e.name), a.appendChild(d), s.appendChild(a), n.appendChild(s);const u = fe("div");u.className = `${r}-body`;const c = fe("div");c.className = `${r}-row`;const h = fe("div");h.className = `${r}-cell ${e.cellClasses || ""}`, h.style.width = "auto";const m = h.appendChild(fe("div"));c.appendChild(h), u.appendChild(c), n.appendChild(u), document.body.appendChild(n);let p = getElementWidth(d, true, true, true);for (let o = 0; o < t.length; o++) m.innerHTML = ue(i, t[o], e), p = Math.max(p, getElementWidth(h, true, true, true));return n.remove(), p += e.arrowProposedWidth || 0, !e.ignoreMin && p < i.minColumnWidth && (p = i.minColumnWidth), Math.ceil(p);}getColumnWidth(e) {let t = this._p.columns.get(e);return t ? A(t) : null;}getColumnConfig(e) {let t = this._p.columns.get(e);if (t) {var _t$unconvertedWidthMo, _t$dataPath, _t$comparePath;const e = t.width,l = t.widthMode;null != t.unconvertedWidth && (t.width = t.unconvertedWidth, t.widthMode = (_t$unconvertedWidthMo = t.unconvertedWidthMode) !== null && _t$unconvertedWidthMo !== void 0 ? _t$unconvertedWidthMo : t.widthMode);const o = A(t);return null != t.unconvertedWidth && (t.width = e, t.widthMode = l), { name: t.name, label: t.label, width: o, dataPath: (_t$dataPath = t.dataPath) === null || _t$dataPath === void 0 ? void 0 : _t$dataPath.join("."), comparePath: (_t$comparePath = t.comparePath) === null || _t$comparePath === void 0 ? void 0 : _t$comparePath.join("."), resizable: t.resizable, movable: t.movable, sortable: t.sortable, visible: t.visible, cellClasses: t.cellClasses, ignoreMin: t.ignoreMin, sticky: t.sticky, order: t.order };}return null;}getColumnsConfig() {const e = this._p;let t = {};for (let l = 0; l < e.columns.length; l++) t[e.columns[l].name] = this.getColumnConfig(e.columns[l].name);return t;}setMaxColumnSortCount(e) {const t = this._p,l = this._o;if (l.sortableColumns !== e && (l.sortableColumns = e, t.table)) {const e = scopedSelectorAll(t.headerRow, `>div.${l.tableClassName}-header-cell`);for (let o = 0, i = e.length; o < i; o++) e[o].classList[l.sortableColumns > 0 && t.visibleColumns[o].sortable ? "add" : "remove"]("sortable");}return this;}getMaxColumnSortCount() {return this._o.sortableColumns;}setSortableColumns(e) {return this.setMaxColumnSortCount(e);}getSortableColumns() {return this.getMaxColumnSortCount();}setMovableColumns(e) {let t = this._o;return e = void 0 === e || !!e, t.movableColumns !== e && (t.movableColumns = e), this;}getMovableColumns() {return this._o.movableColumns;}setResizableColumns(e) {let t = this._o;return e = void 0 === e || !!e, t.resizableColumns !== e && (t.resizableColumns = e), this;}getResizableColumns() {return this._o.resizableColumns;}getConvertColumnWidthsToRelative() {return this._o.convertColumnWidthsToRelative;}setConvertColumnWidthsToRelative(e, t = true) {let l = this._o;return e = !!e, l.convertColumnWidthsToRelative !== e && (l.convertColumnWidthsToRelative = e, t && this.tableWidthChanged(true)), this;}setOnComparatorRequired(e) {let t = this._o;return t.onComparatorRequired !== e && (t.onComparatorRequired = e), this;}setCustomSortingProvider(e) {let t = this._o;return t.customSortingProvider !== e && (t.customSortingProvider = e), this;}sort(e, t, l) {const o = this._o,i = this._p;let r = i.columns.get(e),n = i.rows.sortColumn.map((e) => ({ column: e.column, descending: e.descending }));if (r) {if (l) {for (let e = 0; e < n.length; e++) if (n[e].column === r.name) {e < n.length - 1 ? n.length = 0 : (t = n[n.length - 1].descending, n.splice(n.length - 1, 1));break;}(o.sortableColumns > 0 && n.length >= o.sortableColumns || n.length >= i.visibleColumns.length) && (n.length = 0);} else n.length = 0;t = void 0 !== t && t, n.push({ column: r.name, descending: !!t });} else n.length = 0;return this.setSortedColumns(n);}resort() {const e = this._p;let t = e.columns,l = e.rows.sortColumn;if (l.length) {var _e$virtualListHelper2;for (let e = 0; e < l.length; e++) t.get(l[e].column) || l.splice(e--, 1);e.rows.sortColumn = l, l.length && (e.rows.sort(), e.filteredRows && (e.filteredRows.sortColumn = e.rows.sortColumn, e.filteredRows.onComparatorRequired = e.rows.onComparatorRequired, e.filteredRows.customSortingProvider = e.rows.customSortingProvider, e.filteredRows.sort())), (_e$virtualListHelper2 = e.virtualListHelper) === null || _e$virtualListHelper2 === void 0 ? void 0 : _e$virtualListHelper2.invalidate();let o = [];for (let e = 0; e < l.length; e++) o.push({ column: l[e].column, descending: l[e].descending });this.emit("sort", { sorts: o, resort: true });}return this;}setSortedColumns(e, t = { immediate: true, render: true }) {var _o$virtualListHelper;const l = this._o,o = this._p;let i = o.columns,r = e.filter((e) => i.get(e.column)).map((e) => {let t = i.get(e.column);return { column: t.name, comparePath: t.comparePath || t.dataPath, descending: !!e.descending };});l.sortableColumns > 0 && r.length > l.sortableColumns && (r.length = l.sortableColumns), oe(this);for (let e = 0; e < r.length; e++) ie(this, r[e].column, r[e].descending);l.adjustColumnWidthForSortArrow && !o.tableSkeletonNeedsRendering && this.tableWidthChanged(true), o.rows.sortColumn = r, r.length && t.immediate && (o.rows.sort(), o.filteredRows && (o.filteredRows.sortColumn = o.rows.sortColumn, o.filteredRows.onComparatorRequired = o.rows.onComparatorRequired, o.filteredRows.customSortingProvider = o.rows.customSortingProvider, o.filteredRows.sort()), (_o$virtualListHelper = o.virtualListHelper) !== null && _o$virtualListHelper !== void 0 && _o$virtualListHelper.invalidate(), o.virtualListHelper && t.render && o.virtualListHelper.render());let n = [];for (let e = 0; e < r.length; e++) n.push({ column: r[e].column, descending: r[e].descending });return this.emit("sort", { sorts: n }), this;}getSortedColumns() {const e = this._p;let t = [];for (let l = 0; l < e.rows.sortColumn.length; l++) {let o = e.rows.sortColumn[l];t.push({ column: o.column, descending: o.descending });}return t;}setCellFormatter(e) {if (!e) {const t = (e) => "string" == typeof e ? c(e) : e;t[h] = true, e = t;}return this._o.cellFormatter = e, this;}setHeaderCellFormatter(e) {return this._o.headerCellFormatter = e || function (e) {return "string" == typeof e ? c(e) : e;}, this;}setFilter(e) {return this._o.filter = e, this;}filter(e) {const t = this._p;let l = this._o.filter || S,o = !!t.filteredRows;return t.filteredRows && (t.filteredRows = null), t.filterArgs = null == e ? null : "object" != typeof e || Array.isArray(e) ? e : Object.assign({}, e), null !== t.filterArgs ? (t.filteredRows = t.rows.filteredCollection(l, t.filterArgs), (o || t.filteredRows) && (this.clearAndRender(), this.emit("filter", e))) : (t.filterArgs = null, t.filteredRows = null, this.clearAndRender(), this.emit("filterclear", {})), this;}clearFilter() {const e = this._p;return e.filteredRows && (e.filterArgs = null, e.filteredRows = null, this.clearAndRender(), this.emit("filterclear", {})), this;}getHtmlForRowCell(e, t) {const l = this._p;if (e < 0 || e > l.rows.length - 1) return null;let o = l.columns.get(t);if (!o) return null;let i = l.rows[e];return ue(this._o, i, o);}getHtmlForRowDataCell(e, t) {let l = this._p.columns.get(t);return l ? ue(this._o, e, l) : null;}getRowYPos(e) {return this._p.virtualListHelper.getItemPosition(e) || null;}getDataForRow(e) {const t = this._p;return e < 0 || e > t.rows.length - 1 ? null : t.rows[e];}getRowCount() {const e = this._p;return e.rows ? e.rows.length : 0;}getIndexForRow(e) {return this._p.rows.indexOf(e);}getFilteredRowCount() {const e = this._p;return (e.filteredRows || e.rows).length;}getIndexForFilteredRow(e) {const t = this._p;return (t.filteredRows || t.rows).indexOf(e);}getDataForFilteredRow(e) {const t = this._p;return e < 0 || e > (t.filteredRows || t.rows).length - 1 ? null : (t.filteredRows || t.rows)[e];}getHeaderRowElement() {return this._p.headerRow;}addRows(e, t, l, o) {let i = this._p;"boolean" == typeof t && (o = l, l = t, t = -1), "number" != typeof t && (t = -1), (t < 0 || t > i.rows.length) && (t = i.rows.length), o = void 0 === o || !!o;const r = (Array.isArray(e) ? e : [e]).length;return e && (i.rows.add(e, t), i.filteredRows || l && i.rows.sortColumn.length ? (l && i.rows.sortColumn.length ? this.resort() : de(this), i.tableSkeletonNeedsRendering = true, o && this.render()) : o && (i.virtualListHelper.addItemsAt(r, t), this._o.virtualTable ? (K(this), Q(this), this.render(), Z(this, false)) : i.tbody && (this.render(), Q(this), Z(this, true))), this.emit("addrows", { count: r, clear: false })), this;}removeRows(e, t, l) {let o = this._p;return "number" != typeof t || t <= 0 || e < 0 || e > o.rows.length - 1 || (o.rows.splice(e, t), l = void 0 === l || !!l, o.filteredRows ? (de(this), o.tableSkeletonNeedsRendering = true, l && this.render()) : l && (o.virtualListHelper.removeItemsAt(t, e), this._o.virtualTable ? (K(this), Q(this), this.render(), Z(this, false)) : (this.render(), Q(this), Z(this, true)))), this;}removeRow(e, t) {return this.removeRows(e, 1, t);}refreshRow(e, t = true) {let l = this._p;if (e < 0 || e > l.rows.length - 1) return this;let o = -1;return l.filteredRows && -1 === (o = l.filteredRows.indexOf(l.rows[e])) || (-1 === o && (o = e), l.virtualListHelper.refreshItemAt(o), t && l.virtualListHelper.render()), this;}getRowElement(e) {let t = this._p;if (e < 0 || e > t.rows.length - 1) return null;let l = -1;return t.filteredRows && -1 === (l = t.filteredRows.indexOf(t.rows[e])) ? null : (-1 === l && (l = e), t.virtualListHelper.getItemElementAt(l) || null);}refreshAllVirtualRows() {return this._p.virtualListHelper.invalidate().render(), this;}setRows(e, t) {let l = this._p;return l.rows.reset(e), t && l.rows.sortColumn.length ? this.resort() : de(this), this.clearAndRender().emit("addrows", { count: e.length, clear: true }), this;}tableWidthChanged(e, t) {let l = this._o,o = this._p,i = z(this),r = i,n = 0;if (!o.table) return this;t = void 0 === t || t;let s = 0;if (o.tbody || (t = false), t && (s = parseFloat(o.tbody.style.minWidth) || 0), r !== o.lastDetectedWidth || e) {var _o$notifyRendererOfCo;o.lastDetectedWidth = i;let e = 0,a = [],d = 0,u = 0;for (let e = 0; e < o.columns.length; e++) o.columns[e].actualWidthConsideringScrollbarWidth = null;for (let t = 0; t < o.visibleColumns.length; t++) {var _i$unconvertedWidthMo;let i = o.visibleColumns[t];if (null != i.unconvertedWidth && (i.width = i.unconvertedWidth, i.widthMode = (_i$unconvertedWidthMo = i.unconvertedWidthMode) !== null && _i$unconvertedWidthMo !== void 0 ? _i$unconvertedWidthMo : i.widthMode, i.unconvertedWidth = null, i.unconvertedWidthMode = null), 1 === i.widthMode) {let o = i.width;o += i.arrowProposedWidth || 0, !i.ignoreMin && o < l.minColumnWidth && (o = l.minColumnWidth), r -= o, e += o, o !== i.actualWidth && (i.actualWidth = o, a.push(t));} else if (0 === i.widthMode) {let o = L(this, i.label) + 20;o += i.arrowProposedWidth || 0, !i.ignoreMin && o < l.minColumnWidth && (o = l.minColumnWidth), r -= o, e += o, o !== i.actualWidth && (i.actualWidth = o, l.convertColumnWidthsToRelative || a.push(t));} else 2 === i.widthMode ? (d += i.width, n++) : 3 === i.widthMode && u++;}if (l.convertColumnWidthsToRelative) for (let t = 0; t < o.visibleColumns.length; t++) {let l = o.visibleColumns[t];if (0 === l.widthMode) {const t = l.width,o = l.widthMode;null == l.unconvertedWidth && (l.unconvertedWidth = t, l.unconvertedWidthMode = o), l.widthMode = 2, r += l.actualWidth, l.width = l.actualWidth / e, d += l.width, n++;}}if (n && (d < 1 && !u && l.relativeWidthGrowsToFillWidth || d > 1 && l.relativeWidthShrinksToFillWidth)) for (let e = 0; e < o.visibleColumns.length; e++) {let t = o.visibleColumns[e];2 === t.widthMode && (null == t.unconvertedWidth && (t.unconvertedWidth = t.width, t.unconvertedWidthMode = t.widthMode), t.width /= d);}let c = Math.max(0, r);0 === c && (c = o.table.clientWidth);let h = l.minColumnWidth / c;if (Number.isFinite(h) || (h = 0), h > 0) {let e,t = 0;for (let e = 0; e < o.visibleColumns.length; e++) {let l = o.visibleColumns[e];2 === l.widthMode && !l.ignoreMin && l.width < h && (t += h - l.width, l.width = h);}for (let l = 0; l < o.visibleColumns.length; l++) {let i = o.visibleColumns[l];2 === i.widthMode && !i.ignoreMin && i.width > h && t > 0 && (null == i.unconvertedWidth && (i.unconvertedWidth = i.width, i.unconvertedWidthMode = i.widthMode), e = Math.min(t, i.width - h), i.width -= e, t -= e);}}if (!u && l.autoFillTableWidth && r > 0) {let e = 0,t = r;for (let l = 0; l < o.visibleColumns.length; l++) {let i = o.visibleColumns[l];i.resizable || 1 !== i.widthMode || (e += i.width), 2 === i.widthMode && (t -= Math.round(c * i.width));}let l = (i - e) / (i - t - e) || NaN;for (let e = 0; e < o.visibleColumns.length && t > 0; e++) {let t = o.visibleColumns[e];if (t.resizable || 1 !== t.widthMode) if (2 === t.widthMode) null == t.unconvertedWidth && (t.unconvertedWidth = t.width, t.unconvertedWidthMode = t.widthMode), t.width *= l;else {let o = t.actualWidth * l;t.actualWidth !== o && (t.actualWidth = o, -1 === a.indexOf(e) && a.push(e));}}}for (let e = 0; e < o.visibleColumns.length; e++) {let t = o.visibleColumns[e];if (2 === t.widthMode) {let l = Math.round(c * t.width);r -= l, n--, 0 === n && 1 === r && (l++, r--), -1 === r && (l--, r++), l !== t.actualWidth && (t.actualWidth = l, a.push(e));}}if (u) {let e = Math.max(0, r),t = u;for (let i = 0; i < o.visibleColumns.length; i++) {let r = o.visibleColumns[i];if (3 === r.widthMode) {let o = Math.floor(e / t);!r.ignoreMin && o < l.minColumnWidth && (o = l.minColumnWidth), e -= o, t--, o !== r.actualWidth && (r.actualWidth = o, a.push(i));}}}if (l.autoFillLastColumn && o.visibleColumns.length) {var _l$actualWidth;let e = 0;for (let t = 0; t < o.visibleColumns.length; t++) {var _o$visibleColumns$t$a;e += (_o$visibleColumns$t$a = o.visibleColumns[t].actualWidth) !== null && _o$visibleColumns$t$a !== void 0 ? _o$visibleColumns$t$a : 0;}const t = o.visibleColumns.length - 1,l = o.visibleColumns[t],r = i - e;r > 0 && (l.actualWidth = ((_l$actualWidth = l.actualWidth) !== null && _l$actualWidth !== void 0 ? _l$actualWidth : 0) + r, -1 === a.indexOf(t) && a.push(t));}if (o.visibleColumns.length && (o.visibleColumns[o.visibleColumns.length - 1].actualWidthConsideringScrollbarWidth = o.visibleColumns[o.visibleColumns.length - 1].actualWidth - (o.scrollbarWidth || 0)), (_o$notifyRendererOfCo = o.notifyRendererOfColumnsConfig) !== null && _o$notifyRendererOfCo !== void 0 && _o$notifyRendererOfCo.call(o), t) {let e = F(this);s < e && Z(this, false);for (let e = 0; e < a.length; e++) le(this, a[e]);s > e && Z(this, false);}ee(this);}return this;}tableHeightChanged() {let e = this._o,t = this._p;if (!t.table) return this;const l = getComputedStyle(t.table);let o = getElementHeight(this.el, true) - (parseFloat(l.borderTopWidth) || 0) - (parseFloat(l.borderBottomWidth) || 0);return o !== e.height && (e.height = o, t.tbody && (t.tbody.style.height = Math.max(e.height - getElementHeight(t.header, true, true, true), 1) + "px"), e.virtualTable && this.clearAndRender()), this;}hideCellPreview() {return me(this), this;}abortCellPreview() {return this.hideCellPreview(), this;}cancelColumnResize() {return B(this), this;}getUrlForElementContent(e) {let t,l = document.getElementById(e);if (l) {let e = l.textContent;if ("function" == typeof Blob) t = new Blob([e || ""]);else {const l = window,o = l.BlobBuilder || l.WebKitBlobBuilder || l.MozBlobBuilder || l.MSBlobBuilder;if (!o) return null;const i = new o();i.append(e || ""), t = i.getBlob();}return (window.URL || window.webkitURL).createObjectURL(t);}return null;}isWorkerSupported() {return window.Worker instanceof Function;}createWebWorker(e, t, l) {if (this.isWorkerSupported()) {let o = this._p,i = new Worker(e),r = (e) => {e.data.append ? this.addRows(e.data.rows, l) : this.setRows(e.data.rows, l);};return i.addEventListener("message", r, false), o.workerListeners || (o.workerListeners = []), o.workerListeners.push({ worker: i, listener: r }), (t || void 0 === t) && i.postMessage(null), i;}return null;}unbindWebWorker(e) {let t = this._p;if (t.workerListeners) for (let l = 0; l < t.workerListeners.length; l++) t.workerListeners[l].worker === e && (e.removeEventListener("message", t.workerListeners[l].listener, false), t.workerListeners.splice(l, 1), l--);return this;}}ge.VERSION = "@@VERSION", ge.Width = N;
3462
+ function u(e, t) {for (let l = 0, i = e.length; l >= 0 && l < i; l += 1) if (t(e[l], l, e)) return e[l];}function h(e) {return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;").replace(/"/g, "&quot;").replace(/\n/g, "<br />");}const c = Symbol("safe"),m = Symbol("hover_in"),f = Symbol("hover_out"),p = Symbol("row_click"),g = Symbol("preview_cell"),v = Symbol("cell"),C = Symbol("related_touch"),b = Symbol("original_row_index"),w = Symbol("destroyed");class W extends Array {constructor(e) {var _e$sortColumn, _e$onComparatorRequir, _e$customSortingProvi;super(), _defineProperty(this, "sortColumn", void 0), _defineProperty(this, "onComparatorRequired", null), _defineProperty(this, "customSortingProvider", null), e = e || {}, this.sortColumn = (_e$sortColumn = e.sortColumn) !== null && _e$sortColumn !== void 0 ? _e$sortColumn : [], this.onComparatorRequired = (_e$onComparatorRequir = e.onComparatorRequired) !== null && _e$onComparatorRequir !== void 0 ? _e$onComparatorRequir : null, this.customSortingProvider = (_e$customSortingProvi = e.customSortingProvider) !== null && _e$customSortingProvi !== void 0 ? _e$customSortingProvi : null;}add(e, t) {if (Array.isArray(e)) {const l = e;if ("number" == typeof t) {const e = l.length,i = this.length;t = t < 0 ? Math.max(i + t, 0) : Math.min(t, i), this.length = i + e;for (let l = i - 1; l >= t; l--) this[l + e] = this[l];for (let i = 0; i < e; i++) this[t + i] = l[i];} else for (let e = 0, t = l.length; e < t; e++) this.push(l[e]);} else {const l = e;"number" == typeof t ? this.splice(t, 0, l) : this.push(l);}}reset(e) {this.length = 0, e && this.add(e);}filteredCollection(e, t) {if (e && t) {const l = new W({ sortColumn: this.sortColumn, onComparatorRequired: this.onComparatorRequired, customSortingProvider: this.customSortingProvider });for (let i = 0, o = this.length; i < o; i++) {const o = this[i];e(o, t) && (o[b] = i, l.push(o));}return l;}return null;}sort(e) {let t;if ("function" == typeof e) return super.sort(e);if (this.sortColumn.length) {const e = [];for (let t = 0; t < this.sortColumn.length; t++) {const l = y(this.sortColumn[t], this.sortColumn[t].descending);let i = null;this.onComparatorRequired && (i = this.onComparatorRequired(this.sortColumn[t].column, this.sortColumn[t].descending, l)), i || (i = l), e.push(i.bind(this));}if (1 === e.length) t = e[0];else {const l = e.length;t = (t, i) => {let o = 0;for (let r = 0; r < l; r++) if (o = e[r](t, i), 0 !== o) return o;return o;};}const l = (e) => (e.sort(t), e);if (this.customSortingProvider) {const e = this.customSortingProvider(this, l);if (e !== this) {this.length = e.length;for (let t = 0, l = e.length; t < l; t++) this[t] = e[t];}} else l(this);}return this;}}function y(e, t) {let l = e.comparePath;"string" == typeof l && (l = l.split("."));const i = l.length,o = i > 1,r = t ? 1 : -1,n = t ? -1 : 1;return function (e, t) {let s = e[l[0]],a = t[l[0]];if (o) for (let e = 1; e < i; e++) s = s && s[l[e]], a = a && a[l[e]];return s === a || null == s && null == a ? 0 : null == s ? r : null == a ? n : s < a ? r : n;};}class S extends Array {constructor() {super();}get(e) {for (let t = 0, l = this.length; t < l; t++) if (this[t].name === e) return this[t];return null;}indexOf(e) {const t = "string" == typeof e ? e : e.name;for (let e = 0, l = this.length; e < l; e++) if (this[e].name === t) return e;return -1;}getByOrder(e) {for (let t = 0, l = this.length; t < l; t++) if (this[t].order === e) return this[t];return null;}normalizeOrder() {const e = [];for (let t = 0; t < this.length; t++) e.push(this[t]);e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0);for (let t = 0; t < e.length; t++) e[t].order = t;return this;}getColumns() {const e = [];for (let t = 0; t < this.length; t++) e.push(this[t]);return e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0), e;}getVisibleColumns() {const e = [];for (let t = 0; t < this.length; t++) {const l = this[t];l.visible && e.push(l);}return e.sort((e, t) => e.order < t.order ? -1 : e.order > t.order ? 1 : 0), e;}getMaxOrder() {let e = 0;for (let t = 0; t < this.length; t++) {const l = this[t];l.order > e && (e = l.order);}return e;}moveColumn(e, t) {if (e && t) {const l = e.order,i = t.order;if (l < i) for (let e = l + 1; e <= i; e++) {const t = this.getByOrder(e);t && t.order--;} else for (let e = l - 1; e >= i; e--) {const t = this.getByOrder(e);t && t.order++;}e.order = i;}return this;}}function R(e, t) {const l = t.column,i = null == t.keyword ? "" : t.keyword.toString();if (!i || !l) return true;let o = e[l];if (null == o) return false;let r = o.toString(),n = i;return t.caseSensitive || (r = r.toLowerCase(), n = n.toLowerCase()), -1 !== r.indexOf(n);}const _ = { NONE: "none", AUTO: "auto", SCROLL: "scroll" };class x {static saveSelection(e) {const t = window.getSelection();if (!t || 0 === t.rangeCount) return null;const l = t.getRangeAt(0);if (e !== l.commonAncestorContainer && !function (e, t) {let l = e;for (; (l = (_l$parentNode = (_l = l) === null || _l === void 0 ? void 0 : _l.parentNode) !== null && _l$parentNode !== void 0 ? _l$parentNode : null) && l !== t;) {var _l$parentNode, _l;}return !!l;}(l.commonAncestorContainer, e)) return null;const i = l.cloneRange();i.selectNodeContents(e), i.setEnd(l.startContainer, l.startOffset);const o = i.toString().length;return { start: o, end: o + l.toString().length };}static restoreSelection(e, t) {let l = 0;const i = [e];let o,r = false,n = false;const s = document.createRange();for (s.setStart(e, 0), s.collapse(true); !n && (o = i.pop());) if (o.nodeType === Node.TEXT_NODE) {const e = l + o.length;!r && t.start >= l && t.start <= e && (s.setStart(o, t.start - l), r = true), r && t.end >= l && t.end <= e && (s.setEnd(o, t.end - l), n = true), l = e;} else {let e = o.childNodes.length;for (; e--;) i.push(o.childNodes[e]);}const a = window.getSelection();a && (a.removeAllRanges(), a.addRange(s));}}const N = Array.prototype.indexOf,k = document.createElement.bind(document);function z(e) {const t = e._p;if (t.cellPreviewCell) {var _l$rowIndex;const l = t.cellPreviewCell,i = l[v];let o;try {o = x.saveSelection(l);} catch {}t.cellPreviewCell.remove(), i && t._unbindCellHoverOut(i), t._unbindCellHoverOut(l);try {o && i && x.restoreSelection(i, o);} catch {}e.emit("cellpreviewdestroy", { el: l.firstChild, name: l.columnName, rowIndex: (_l$rowIndex = l.rowIndex) !== null && _l$rowIndex !== void 0 ? _l$rowIndex : null, rowData: null == l.rowIndex ? null : t.rows[l.rowIndex], cell: i, cellEl: i === null || i === void 0 ? void 0 : i.firstChild }), i && delete i[g], delete l[v], t.cellPreviewCell = null, t.abortCellPreview = false;} else t.abortCellPreview = true;return e;}const M = document.createElement.bind(document);function T(e) {var _ref, _e$C, _t$changedTouches;const t = e;return (_ref = (_e$C = e[C]) !== null && _e$C !== void 0 ? _e$C : (_t$changedTouches = t.changedTouches) === null || _t$changedTouches === void 0 ? void 0 : _t$changedTouches[0]) !== null && _ref !== void 0 ? _ref : e;}function L(e) {var _t$lastResizeAreaClic;const t = e._p;if (null == t.columnResizeStartTimeout) return;clearTimeout(t.columnResizeStartTimeout), t.columnResizeStartTimeout = null;const n = (_t$lastResizeAreaClic = t.lastResizeAreaClick) === null || _t$lastResizeAreaClic === void 0 ? void 0 : _t$lastResizeAreaClic.columnName;t.lastResizeAreaClick = null, n && function (e, t) {const n = e._o,s = e._p,a = s.columns.get(t);if (!n.resizableColumns || !a || !a.resizable) return void A(e);const d = ve(e);s.resizer = M("div"), s.resizer.className = n.resizerClassName, setCssProps(s.resizer, { position: "absolute", display: "block", zIndex: "-1", visibility: "hidden", width: "2px", background: "#000", opacity: "0.7" }), e.el.appendChild(s.resizer);const u = a.element,h = s.resizer.parentNode,c = getComputedStyle(h),m = getComputedStyle(u),f = getElementOffset(u),p = getElementOffset(h);p.left += parseFloat(c.borderLeftWidth) || 0, p.top += parseFloat(c.borderTopWidth) || 0, f.left -= p.left, f.top -= p.top, f.top -= parseFloat(m.borderTopWidth) || 0;const g = getElementWidth(s.resizer, true, true, true);d ? (f.left -= Math.ceil((parseFloat(m.borderLeftWidth) || 0) / 2), f.left -= Math.ceil(g / 2)) : (f.left += getElementWidth(u, true, true, true), f.left += Math.ceil((parseFloat(m.borderRightWidth) || 0) / 2), f.left -= Math.ceil(g / 2)), setCssProps(s.resizer, { "z-index": "10", visibility: "visible", left: f.left + "px", top: f.top + "px", height: getElementHeight(e.el, false, false, false) + "px" }), s.resizer.columnName = u.columnName;try {s.resizer.style.zIndex = "";} catch {}}(e, n);}function F(e, t) {const l = e._o,i = ve(e);let n = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!n) return null;n[v] && (n = n[v]);let s = n.previousSibling;for (; s && 1 !== s.nodeType;) s = s.previousSibling;const a = !s,d = T(t),u = (d.pageX || d.clientX || 0) - getElementOffset(n).left;if (i) {var _s$columnName, _s, _n$columnName;if (!a && getElementWidth(n, true, true, true) - u <= l.resizeAreaWidth / 2) return (_s$columnName = (_s = s) === null || _s === void 0 ? void 0 : _s.columnName) !== null && _s$columnName !== void 0 ? _s$columnName : null;if (u <= l.resizeAreaWidth / 2) return (_n$columnName = n.columnName) !== null && _n$columnName !== void 0 ? _n$columnName : null;} else {var _s$columnName2, _s2, _n$columnName2;if (!a && u <= l.resizeAreaWidth / 2) return (_s$columnName2 = (_s2 = s) === null || _s2 === void 0 ? void 0 : _s2.columnName) !== null && _s$columnName2 !== void 0 ? _s$columnName2 : null;if (getElementWidth(n, true, true, true) - u <= l.resizeAreaWidth / 2) return (_n$columnName2 = n.columnName) !== null && _n$columnName2 !== void 0 ? _n$columnName2 : null;}return null;}function A(e) {const t = e._p;return null != t.columnResizeStartTimeout && (clearTimeout(t.columnResizeStartTimeout), t.columnResizeStartTimeout = null), t.resizer && (t.resizer.remove(), t.resizer = null), t.eventsSink.remove(document, ".colresize"), e;}function P(e, t) {const l = t;if ("mousedown" === t.type && 0 !== l.button) return;const i = e._o,o = e._p,r = F(e, t);if (r) {const l = o.columns.get(r);return !!(i.resizableColumns && l && l.resizable) && (function (e, t, l) {const i = e._p,o = e._o,r = T(t),n = Date.now(),s = function (e) {return e.type.startsWith("touch") ? "touch" : "mouse";}(t),a = i.lastResizeAreaClick;if (i.lastResizeAreaClick = { columnName: l, time: n, pageX: r.pageX || r.clientX || 0, pageY: r.pageY || 0, pointerType: s }, !a || a.columnName !== l || a.pointerType !== s) return false;const d = n - a.time;return !(d < 0 || d > o.resizeAreaDoubleClickDuration) && Math.sqrt(Math.pow(i.lastResizeAreaClick.pageX - a.pageX, 2) + Math.pow(i.lastResizeAreaClick.pageY - a.pageY, 2)) <= Math.max(o.resizeAreaWidth, 12);}(e, t, l.name) ? (A(e), function (e, t, l, _o$lastResizeAreaDoub) {const i = e._o,o = e._p,r = o.columns.get(l);if (!i.resizableColumns || !r || !r.resizable) return false;const n = Date.now();return ((_o$lastResizeAreaDoub = o.lastResizeAreaDoubleClick) === null || _o$lastResizeAreaDoub === void 0 ? void 0 : _o$lastResizeAreaDoub.columnName) === r.name && n - o.lastResizeAreaDoubleClick.time < 100 ? (t.preventDefault(), true) : (o.lastResizeAreaClick = null, o.lastResizeAreaDoubleClick = { columnName: r.name, time: n }, e.emit("columnresizeareadoubleclick", { name: r.name, columnName: r.name, event: t }), i.autoFitColumnOnResizeDoubleClick && e.autoFitColumn(r.name), t.preventDefault(), true);}(e, t, l.name)) : (A(e), o.columnResizeStartTimeout = setTimeout(() => L(e), i.resizeAreaDoubleClickDuration), o.eventsSink.add(document, "mousemove.colresize", (t) => H(e, t)).add(document, "touchmove.colresize", (t) => H(e, t)).add(document, "mouseup.colresize", (t) => E(e, t)).add(document, "touchend.colresize", (t) => E(e, t)), t.preventDefault(), true));}}function H(e, t) {const l = e._p;if (null != l.columnResizeStartTimeout && !function (e, t) {const l = e._p.lastResizeAreaClick;if (!l) return false;const i = T(t),o = i.pageX || i.clientX || 0,r = i.pageY || 0;return Math.sqrt(Math.pow(o - l.pageX, 2) + Math.pow(r - l.pageY, 2)) > 4;}(e, t)) return;if (L(e), !l.resizer) return;const i = l.columns.get(l.resizer.columnName);if (!i) return;const n = ve(e),s = i.element,a = l.resizer.parentNode,d = getComputedStyle(a),u = getComputedStyle(s),h = getElementOffset(s),c = getElementOffset(a);c.left += parseFloat(d.borderLeftWidth) || 0, h.left -= c.left;const m = getElementWidth(l.resizer, true, true, true),f = "border-box" === u.boxSizing;let p = T(t).pageX - c.left,g = h.left;g -= Math.ceil(m / 2), n ? (g += getElementWidth(s, true, true, true), g -= i.ignoreMin ? 0 : e._o.minColumnWidth, f || (g -= Math.ceil((parseFloat(u.borderLeftWidth) || 0) / 2), g -= ce(s)), p > g && (p = g)) : (g += i.ignoreMin ? 0 : e._o.minColumnWidth, f || (g += Math.ceil((parseFloat(u.borderRightWidth) || 0) / 2), g += ce(s)), p < g && (p = g)), l.resizer.style.left = p + "px";}function E(e, t) {var _ref2, _t$C, _v$changedTouches;const l = e._o,i = e._p;if (null != i.columnResizeStartTimeout) return void A(e);if (!i.resizer) return;i.eventsSink.remove(document, ".colresize");const n = i.columns.get(i.resizer.columnName);if (!n) return i.resizer.remove(), void (i.resizer = null);const s = ve(e),a = n.element,d = a.firstChild,u = i.resizer.parentNode,h = getComputedStyle(u),c = getComputedStyle(a),m = getElementOffset(a),f = getElementOffset(u);f.left += parseFloat(h.borderLeftWidth) || 0, m.left -= f.left;const p = getElementWidth(i.resizer, true, true, true),g = "border-box" === c.boxSizing,v = t;let b = ((_ref2 = (_t$C = t[C]) !== null && _t$C !== void 0 ? _t$C : (_v$changedTouches = v.changedTouches) === null || _v$changedTouches === void 0 ? void 0 : _v$changedTouches[0]) !== null && _ref2 !== void 0 ? _ref2 : t).pageX - f.left,w = m.left,W = 0;if (s) {if (!g) {b += ce(a);const e = getComputedStyle(d || a);b += parseFloat(e.borderLeftWidth) || 0, b += parseFloat(e.borderRightWidth) || 0;}b += n.arrowProposedWidth || 0, w += Math.ceil(p / 2), w += getElementWidth(a, true, true, true);const t = w - (n.ignoreMin ? 0 : e._o.minColumnWidth);b > t && (b = t), W = w - b;} else {if (!g) {b -= ce(a);const e = getComputedStyle(d || a);b -= parseFloat(e.borderLeftWidth) || 0, b -= parseFloat(e.borderRightWidth) || 0;}b -= n.arrowProposedWidth || 0, w -= Math.ceil(p / 2);const t = w + (n.ignoreMin ? 0 : e._o.minColumnWidth);b < t && (b = t), W = b - w;}i.resizer.remove(), i.resizer = null;let y = W;if (2 === n.widthMode) {let t = pe(e),o = 0,r = 0;for (let e = 0; e < i.visibleColumns.length; e++) {var _l$actualWidth;const l = i.visibleColumns[e];l.name !== n.name && (2 === l.widthMode ? (o += l.width, r++) : t -= (_l$actualWidth = l.actualWidth) !== null && _l$actualWidth !== void 0 ? _l$actualWidth : 0);}if (t <= 0 && i.table && (t = i.table.clientWidth), t > Math.max(l.minColumnWidth, 1)) {if (y = W / t, r > 0) {const e = y / ((1 - y) / o);o += y, (o < 1 && l.relativeWidthGrowsToFillWidth || o > 1 && l.relativeWidthShrinksToFillWidth) && (y = e);}y *= 100, y += "%";}}e.setColumnWidth(n.name, y);}function O(e, t) {var _i$columns$get;const l = e._o,i = e._p;if (!l.resizableColumns) return;const o = F(e, t),r = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);r && (o && (_i$columns$get = i.columns.get(o)) !== null && _i$columns$get !== void 0 && _i$columns$get.resizable ? r.style.cursor = "e-resize" : r.style.cursor = "");}function I(e, t) {var _ref3, _t$C2, _n$changedTouches;const i = e._o,n = t,s = t,a = (_ref3 = (_t$C2 = t[C]) !== null && _t$C2 !== void 0 ? _t$C2 : (_n$changedTouches = n.changedTouches) === null || _n$changedTouches === void 0 ? void 0 : _n$changedTouches[0]) !== null && _ref3 !== void 0 ? _ref3 : { pageX: s.pageX, pageY: s.pageY },d = t.target.closest(`div.${i.tableClassName}-header-cell,div.${i.cellPreviewClassName}`);if (!d) return;const u = getElementOffset(d);u.width = getElementWidth(d, true, true, true), u.height = getElementHeight(d, true, true, true), e.emit("headercontextmenu", { columnName: d.columnName, pageX: a.pageX, pageY: a.pageY, bounds: u });}function D(e, t) {if (he(t)) return;if (F(e, t)) return;const l = e._o,i = e._p,o = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!o) return;if (!l.sortableColumns) return;const r = i.columns.get(o.columnName),n = i.rows.sortColumn;if (r && r.sortable) {let t = true;const i = n.length ? n[n.length - 1] : null;i && i.column === r.name && (i.descending && l.allowCancelSort ? (t = false, n.splice(n.length - 1, 1)) : i.descending = !i.descending);const o = e;t ? o.sort(r.name, void 0, true).render() : o.setSortedColumns(n.map((e) => ({ column: e.column, descending: e.descending })));}}function B(e, t) {const l = e._p,i = l.visibleColumns.findIndex((e) => e.movable),o = l.visibleColumns.findLastIndex((e) => e.movable),r = l.visibleColumns.findIndex((e) => e === t);return t.movable || -1 !== i && r >= i && r <= o;}const $ = Array.prototype.indexOf,q = document.createElement.bind(document);function X(e, t) {const l = t[p];l && (t.removeEventListener("click", l), t[p] = null, function (e, t) {const l = e._p;for (let e = 0, i = t.childNodes, o = i.length; e < o; e++) l._unbindCellHoverIn(i[e]);}(e, t), e.emit("rowdestroy", t));}function V(e) {const t = e._p.tbody;if (t) for (let l = t.firstElementChild; l; l = l.nextElementSibling) X(e, l);}function j(e) {const t = e._p,i = e._o;if (!t.table || !t.header) return e;if (!i.height) return t.table.style.height = "auto", e;const o = getComputedStyle(t.table);let r = i.height - getElementHeight(t.header, true, true, true);return "border-box" !== o.boxSizing && (r -= parseFloat(o.borderTopWidth) || 0, r -= parseFloat(o.borderBottomWidth) || 0, r -= parseFloat(o.paddingTop) || 0, r -= parseFloat(o.paddingBottom) || 0), t.table.style.height = Math.max(r, 0) + "px", e;}function Y(e) {const t = e._p;return t.headerRow && (t.headerRow = void 0), e;}function U(e) {const t = e._o,l = e._p;if (!l.tbody) return e;if (t.virtualTable && l.virtualListHelper) {const e = l.virtualListHelper.estimateFullHeight();l._lastVirtualScrollHeight = e, l.tbody.style.height = e + "px";} else l.tbody.style.height = "";return e;}function G(e, t) {const l = e._p;if (!l.table) return e;const i = l.table.offsetWidth - l.table.clientWidth;if (i !== l.scrollbarWidth || t) {var _l$notifyRendererOfCo;l.scrollbarWidth = i;for (let e = 0; e < l.columns.length; e++) l.columns[e].actualWidthConsideringScrollbarWidth = null;if (l.visibleColumns.length > 0 && l.tbody && l.headerRow) {var _t$actualWidth, _ref4, _t$actualWidthConside;const e = l.visibleColumns.length - 1,t = l.visibleColumns[e];t.actualWidthConsideringScrollbarWidth = l.scrollbarWidth > 0 ? ((_t$actualWidth = t.actualWidth) !== null && _t$actualWidth !== void 0 ? _t$actualWidth : 0) - l.scrollbarWidth : null;const i = ((_ref4 = (_t$actualWidthConside = t.actualWidthConsideringScrollbarWidth) !== null && _t$actualWidthConside !== void 0 ? _t$actualWidthConside : t.actualWidth) !== null && _ref4 !== void 0 ? _ref4 : 0) + "px",o = l.tbody.childNodes;for (let t = 0, l = o.length; t < l; t++) {const l = o[t];1 === l.nodeType && (l.childNodes[e].style.width = i);}l.headerRow.childNodes[e].style.width = i;}K(e), (_l$notifyRendererOfCo = l.notifyRendererOfColumnsConfig) === null || _l$notifyRendererOfCo === void 0 ? void 0 : _l$notifyRendererOfCo.call(l);}return e;}function J(e, t) {const l = e._o,i = e._p;if (!i.tbody || !i.table || !i.headerRow) return e;const o = ge(e);if (i.tbody.style.minWidth = o + "px", i.headerRow.style.minWidth = o + (i.scrollbarWidth || 0) + "px", i.eventsSink.remove(i.table, "scroll"), l.width === _.AUTO) setElementWidth(i.table, getElementWidth(i.tbody, true, true, true)), setElementWidth(e.el, getElementWidth(i.table, true, true, true));else if (l.width === _.SCROLL) {if (t) {const t = i.table ? i.table.scrollTop : 0,l = i.table ? i.table.scrollLeft : 0;!function (e) {const t = e.style.display;e.style.display = "none", e.offsetHeight, e.style.display = t;}(e.el), i.table.scrollTop = t, i.table.scrollLeft = l, i.header && (i.header.scrollLeft = l);}const l = () => function (e) {const t = e._p;t.header.scrollLeft = t.table.scrollLeft, Q(e);}(e);i.eventsSink.add(i.table, "scroll", l);}return e;}function K(e) {var _t$scrollbarWidth;const t = e._p,l = e._o;if (!t.headerRow) return;const i = l.tableClassName + "-sticky",o = t.headerRow,r = ve(e);t.lastIsRtl = r;const n = (_t$scrollbarWidth = t.scrollbarWidth) !== null && _t$scrollbarWidth !== void 0 ? _t$scrollbarWidth : 0,s = t.lastDetectedWidth,a = l.maxStickyColumnRelativeWidth,d = "number" == typeof a && s ? s * a : null;let u = 0,h = 0,c = null;const m = [],f = [];let p = null,g = [],v = null,C = 0,b = [];for (let e = o.firstElementChild; e; e = e.nextElementSibling) {var _o$actualWidth, _p;const l = e.getAttribute("data-column");if (!l) continue;const o = t.columns.get(l);if (!o) continue;o.headerScrollbarCompensation = 0;let s = "start" === o.sticky || "end" === o.sticky;if (s && null !== d && C + ((_o$actualWidth = o.actualWidth) !== null && _o$actualWidth !== void 0 ? _o$actualWidth : 0) > d && (s = false), s) {var _o$actualWidth2, _o$actualWidth3, _o$stickyPos, _o$stickyPos2, _o$stickyPos3;let l = (_o$actualWidth2 = o.actualWidth) !== null && _o$actualWidth2 !== void 0 ? _o$actualWidth2 : 0;C += 0, e.className += " " + i, e.style.position = "sticky";let s,a = null;null === c && (a = getComputedStyle(e), c = a.boxSizing), "content-box" === c && (null === a && (a = getComputedStyle(e)), l += (parseFloat(a.paddingLeft) || 0) + (parseFloat(a.paddingRight) || 0) + (parseFloat(a.borderLeftWidth) || 0) + (parseFloat(a.borderRightWidth) || 0)), "start" === o.sticky ? (s = { direction: "start", absDirection: r ? "right" : "left", offset: u }, e.style[s.absDirection] = u + "px", u += l, g.length = 0, p = [e], m.push(p)) : (v = e, s = { direction: "end", absDirection: r ? "left" : "right", offset: h }, e.style[s.absDirection] = h + n + "px", e.style.width = ((_o$actualWidth3 = o.actualWidth) !== null && _o$actualWidth3 !== void 0 ? _o$actualWidth3 : 0) + "px", h += l, f.push([e, ...g]), g.length = 0), s.direction === ((_o$stickyPos = o.stickyPos) === null || _o$stickyPos === void 0 ? void 0 : _o$stickyPos.direction) && s.offset === ((_o$stickyPos2 = o.stickyPos) === null || _o$stickyPos2 === void 0 ? void 0 : _o$stickyPos2.offset) && s.absDirection === ((_o$stickyPos3 = o.stickyPos) === null || _o$stickyPos3 === void 0 ? void 0 : _o$stickyPos3.absDirection) || b.push(t.visibleColumns.indexOf(o)), o.stickyPos = s;} else o.stickyPos && b.push(t.visibleColumns.indexOf(o)), delete o.stickyPos, (_p = p) !== null && _p !== void 0 && _p.push(e), g !== null && g !== void 0 && g.push(e), "sticky" === e.style.position && (e.classList.remove(i), e.style.position = "", e.style.left = "", e.style.right = "");}v && (v.style[r ? "left" : "right"] = "0px"), t.stickiesStart = m, t.stickiesEnd = f, b.length > 0 && e.refreshAllVirtualRows(), t.lastStickyScrollLeft = void 0, Q(e);}function Q(e) {const t = e._p;if (!t.table || !t.headerRow || !t.tbody) return;const l = t.stickiesStart,i = t.stickiesEnd,o = t.stickiesSetStart,r = t.stickiesSetEnd,n = t.stickiesSetStart = new Set(),s = t.stickiesSetEnd = new Set();if (l !== null && l !== void 0 && l.length || i !== null && i !== void 0 && i.length) {const e = t.table.scrollLeft;if (e === t.lastStickyScrollLeft) return;t.lastStickyScrollLeft = e;const o = t.headerRow.children,r = 1.5,a = t.lastIsRtl;let d = null;const u = (e, l, i) => {if (e && e.length) {for (const t of e) {l || (d = t);const e = t[0],n = t.slice(1),s = n[0],u = n[n.length - 1];if (!e || !e.getBoundingClientRect) continue;const h = e.getBoundingClientRect(),c = l !== a;let m = false;if (s && u) {const e = s.getBoundingClientRect(),t = u.getBoundingClientRect();m = l ? a ? h.right - r > t.left && h.left + r < e.right : h.right - r > e.left && h.left + r < t.right : a ? h.left + r < e.right && h.right - r > t.left : h.left + r < t.right && h.right - r > e.left;}e.classList.toggle(c ? "is-sticky-left" : "is-sticky-right", m), m && i.add($.call(o, e));}if (d) {var _ref5, _l$actualWidthConside, _ref6, _l$actualWidthConside2;const e = d[0],l = t.columns.get(e.getAttribute("data-column")),i = a ? "marginRight" : "marginLeft";e.style[i] = "", e.style.width = ((_ref5 = (_l$actualWidthConside = l.actualWidthConsideringScrollbarWidth) !== null && _l$actualWidthConside !== void 0 ? _l$actualWidthConside : l.actualWidth) !== null && _ref5 !== void 0 ? _ref5 : 0) + "px";let o = 0;if (t.scrollbarWidth > 0) {const l = e.getBoundingClientRect(),r = e.offsetParent.getBoundingClientRect(),n = a ? l.left - r.left : r.right - l.right;n <= t.scrollbarWidth && (o = Math.min(t.scrollbarWidth, Math.max(0, t.scrollbarWidth - n + 1)), o < t.scrollbarWidth && (e.style[i] = -o + "px"));}l.headerScrollbarCompensation = o, e.style.width = ((_ref6 = (_l$actualWidthConside2 = l.actualWidthConsideringScrollbarWidth) !== null && _l$actualWidthConside2 !== void 0 ? _l$actualWidthConside2 : l.actualWidth) !== null && _ref6 !== void 0 ? _ref6 : 0) + o + "px";}}};u(l, true, n), u(i, false, s);}const a = [],d = [];for (const e of n) (o === null || o === void 0 ? void 0 : o.has(e)) || a.push({ index: e, start: true });for (const e of s) (r === null || r === void 0 ? void 0 : r.has(e)) || a.push({ index: e, start: false });if (o) for (const e of o) n.has(e) || d.push({ index: e, start: true });if (r) for (const e of r) s.has(e) || d.push({ index: e, start: false });if (!a.length && !d.length) return;let u = t.tbody.firstElementChild;for (; u;) {const e = u.children;for (const l of d) {var _e$l$index;(_e$l$index = e[l.index]) === null || _e$l$index === void 0 || _e$l$index.classList.remove(l.start !== t.lastIsRtl ? "is-sticky-left" : "is-sticky-right");}for (const l of a) {var _e$l$index2;(_e$l$index2 = e[l.index]) === null || _e$l$index2 === void 0 || _e$l$index2.classList.add(l.start !== t.lastIsRtl ? "is-sticky-left" : "is-sticky-right");}u = u.nextElementSibling;}t.isStickyColumns = new Map();for (const e of n) t.isStickyColumns.set(e, "start");for (const e of s) t.isStickyColumns.set(e, "end");}function Z(e, t) {const l = e._p,i = e._o;if (!l.headerRow || !l.tbody) return e;const o = l.headerRow.querySelectorAll(`div.${i.tableClassName}-header-cell`)[t];if (!o) return e;const r = l.columns.get(o.columnName);if (r) {var _r$headerScrollbarCom, _ref7, _r$actualWidthConside;const e = (_r$headerScrollbarCom = r.headerScrollbarCompensation) !== null && _r$headerScrollbarCom !== void 0 ? _r$headerScrollbarCom : 0;o.style.width = ((_ref7 = (_r$actualWidthConside = r.actualWidthConsideringScrollbarWidth) !== null && _r$actualWidthConside !== void 0 ? _r$actualWidthConside : r.actualWidth) !== null && _ref7 !== void 0 ? _ref7 : 0) + e + "px";const i = (r.actualWidthConsideringScrollbarWidth || r.actualWidth || 0) + "px",n = l.tbody.childNodes;for (let e = 0, l = n.length; e < l; e++) {const l = n[e];1 === l.nodeType && (l.childNodes[t].style.width = i);}}return e;}function ee(e) {const t = e._p,l = e._o;if (t.table && t.headerRow) {const e = l.tableClassName,i = scopedSelectorAll(t.headerRow, `>div.${e}-header-cell.sorted`),o = Array.prototype.slice.call(i, 0).map((e) => e.querySelector(":scope>div>.sort-arrow")).filter((e) => !!e);for (const e of o) {var _e$parentNode;const l = (_e$parentNode = e.parentNode) === null || _e$parentNode === void 0 ? void 0 : _e$parentNode.parentNode;if (l) {const e = t.columns.get(l.columnName);e && (e.arrowProposedWidth = 0);}e.remove();}for (const e of i) e.classList.remove("sorted", "desc");}return e;}function te(e, t, l) {var _r$element$firstChild;const i = e._p,o = e._o,r = i.columns.get(t);if (!r) return false;const n = q("span");return n.className = "sort-arrow", r.element && (r.element.className += l ? " sorted desc" : " sorted", (_r$element$firstChild = r.element.firstChild) !== null && _r$element$firstChild !== void 0 && _r$element$firstChild.insertBefore(n, r.element.firstChild.firstChild)), 2 !== r.widthMode && o.adjustColumnWidthForSortArrow && (r.arrowProposedWidth = n.scrollWidth + (parseFloat(getComputedStyle(n).marginRight) || 0) + (parseFloat(getComputedStyle(n).marginLeft) || 0)), true;}function le(e, t) {t.firstChild, t.addEventListener("mousedown", (t) => P(e, t)), t.addEventListener("mousemove", (t) => O(e, t)), t.addEventListener("mouseup", (t) => function (e, t) {2 === t.button && I(e, t);}(e, t)), t.addEventListener("mouseleave", (t) => function (e, t) {const l = e._o,i = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);i && (i.style.cursor = "");}(e, t)), t.addEventListener("touchstart", (t) => function (e, t) {const l = e._p;if (l.currentTouchId) return;const i = t.changedTouches[0];l.currentTouchId = i.identifier;const o = t.currentTarget,r = { x: i.pageX, y: i.pageY };let n = r;const s = function () {l.currentTouchId = null, l.eventsSink.remove(o, ".colheader"), clearTimeout(l.tapAndHoldTimeout), l.tapAndHoldTimeout = null;};t[C] = t.changedTouches[0], true !== P(e, t) ? (l.tapAndHoldTimeout = setTimeout(() => {s(), l.eventsSink.add(o, "touchend.colheader", (e) => {he(e) || e.preventDefault(), l.eventsSink.remove(o, ".colheader");}, { once: true }).add(o, "touchcancel.colheader", (e) => {l.eventsSink.remove(o, ".colheader");}, { once: true }), Math.sqrt(Math.pow(Math.abs(n.x - r.x), 2) + Math.pow(Math.abs(n.y - r.y), 2)) < 9 && (A(e), I(e, t));}, 500), l.eventsSink.add(o, "touchend.colheader", (t) => {const i = t,o = u(Array.from(i.changedTouches), (e) => e.identifier === l.currentTouchId);o && (s(), he(t) || t.preventDefault(), n = { x: o.pageX, y: o.pageY }, (Math.sqrt(Math.pow(Math.abs(n.x - r.x), 2) + Math.pow(Math.abs(n.y - r.y), 2)) < 9 || l.resizer) && (i[C] = o, D(e, i)));}).add(o, "touchcancel.colheader", s).add(o, "touchmove.colheader", (t) => {const i = t,o = u(Array.from(i.changedTouches), (e) => e.identifier === l.currentTouchId);o && (n = { x: o.pageX, y: o.pageY }, l.resizer && (t.preventDefault(), i[C] = o, O(e, i)));})) : l.currentTouchId = null;}(e, t)), t.addEventListener("dragstart", (t) => function (e, t) {const l = e._o,i = e._p;if (l.movableColumns) {var _t$dataTransfer;const e = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!e) return void t.preventDefault();const o = i.columns.get(e.columnName);o && o.movable ? (e.style.opacity = "0.35", i.dragId = 161061273 * Math.random(), (_t$dataTransfer = t.dataTransfer) === null || _t$dataTransfer === void 0 ? void 0 : _t$dataTransfer.setData("text", JSON.stringify({ dragId: i.dragId, column: o.name }))) : t.preventDefault();} else t.preventDefault();}(e, t)), t.addEventListener("click", (t) => D(e, t)), t.addEventListener("contextmenu", (e) => e.preventDefault()), t.addEventListener("dragenter", (t) => function (e, t) {const l = e._o,i = e._p;if (l.movableColumns) {var _t$dataTransfer2;let o = null;const r = (_t$dataTransfer2 = t.dataTransfer) === null || _t$dataTransfer2 === void 0 ? void 0 : _t$dataTransfer2.getData("text");if (r) try {o = JSON.parse(r);} catch {o = null;}const n = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!n) return;if (!o || i.dragId === o.dragId && n.columnName !== o.column) {const t = i.columns.get(n.columnName);t && B(e, t) && n.classList.add("drag-over");}}}(e, t)), t.addEventListener("dragover", (e) => {e.preventDefault();}), t.addEventListener("dragleave", (t) => function (e, t) {const l = e._o,i = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (!i) return;const o = t.relatedTarget;o === i || i.contains(o) || i.classList.remove("drag-over");}(e, t)), t.addEventListener("drop", (t) => function (e, t, _t$dataTransfer3) {t.preventDefault();const l = e._o,i = e._p,o = (_t$dataTransfer3 = t.dataTransfer) === null || _t$dataTransfer3 === void 0 ? void 0 : _t$dataTransfer3.getData("text");if (!o) return;let r;try {r = JSON.parse(o);} catch {return;}const n = t.target.closest(`div.${l.tableClassName}-header-cell,div.${l.cellPreviewClassName}`);if (n) {if (l.movableColumns && r.dragId === i.dragId) {const t = r.column,l = n.columnName,o = i.columns.get(t),s = i.columns.get(l);o && s && o.movable && B(e, s) && e.moveColumn(t, l);}n.classList.remove("drag-over");}}(e, t));}function ie(e, t) {let l = 0;if ("string" == typeof e) {const t = e.trim().toLowerCase();if ("rest" === t) return { width: 0, mode: 3 };if ("auto" === t) return { width: 0, mode: 0 };}let i = parseFloat(e);return Number.isFinite(i) || (i = 0), i = Math.max(0, i), i > 0 && ("string" == typeof e && e.trim().endsWith("%") ? (l = 2, i /= 100) : i > 0 && i < 1 ? l = 2 : (i < t && (i = t), l = 1)), { width: i, mode: l };}function oe(e, t) {var _t$allowPreview;let l = ie(t.width, t.ignoreMin ? 0 : e.minColumnWidth),i = { name: t.name, label: void 0 === t.label ? t.name : t.label, width: l.width, widthMode: l.mode, resizable: void 0 === t.resizable || t.resizable, sortable: void 0 === t.sortable || t.sortable, movable: void 0 === t.movable || t.movable, visible: void 0 === t.visible || t.visible, cellClasses: void 0 === t.cellClasses ? e.cellClasses : t.cellClasses, ignoreMin: void 0 !== t.ignoreMin && !!t.ignoreMin, sticky: void 0 === t.sticky ? null : t.sticky || null, allowPreview: !!((_t$allowPreview = t.allowPreview) !== null && _t$allowPreview !== void 0 ? _t$allowPreview : true), dataPath: [], comparePath: [], order: 0 };const o = void 0 === t.dataPath ? i.name : t.dataPath,r = void 0 === t.comparePath ? o : t.comparePath;return i.dataPath = "string" == typeof o ? o.split(".") : o, i.comparePath = "string" == typeof r ? r.split(".") : r, i;}function re(e) {const t = e._p;0 === t.visibleColumns.length && t.columns.length && (t.columns[0].visible = true, t.visibleColumns.push(t.columns[0]), e.emit("showcolumn", t.columns[0].name));}function ne(e) {const t = e._p;if (t.filteredRows && t.filterArgs) {let l = e._o.filter || R;t.filteredRows = t.rows.filteredCollection(l, t.filterArgs);}}function se(e) {const t = e._p;if (!t.filteredRows) return;const l = new Set(t.filteredRows),i = new W({ sortColumn: t.rows.sortColumn, onComparatorRequired: t.rows.onComparatorRequired, customSortingProvider: t.rows.customSortingProvider });for (let e = 0, o = t.rows.length; e < o; e++) {const o = t.rows[e];l.has(o) && (o[b] = e, i.push(o));}t.filteredRows = i;}function ae(e, t, l) {let i = l.dataPath,o = t[i[0]];for (let e = 1; e < i.length && null != o; e++) o = o && o[i[e]];const r = e.cellFormatter;let n;if (r[c]) n = r(o, l.name, t);else try {n = r(o, l.name, t);} catch (e) {n = "[ERROR]", console.error("Failed to generate content for cell " + l.name, e);}return null == n && (n = ""), n;}const de = document.createElement.bind(document);function ue(e) {["relative", "absolute", "fixed"].includes(getComputedStyle(e).position) || (e.style.position = "relative");}function he(e) {const t = e.target;return /^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(t.tagName);}function ce(e) {const t = getComputedStyle(e);return (parseFloat(t.paddingLeft) || 0) + (parseFloat(t.paddingRight) || 0);}function me(e) {const t = e.style;t["-webkit-touch-callout"] = "none", t["-webkit-user-select"] = "none", t["-moz-user-select"] = "none", t["-ms-user-select"] = "none", t["-o-user-select"] = "none", t["user-select"] = "none";}function fe(e, t, l = null) {const o = e._o,n = o.tableClassName,s = de("div");s.className = e.el.className, setCssProps(s, { position: "absolute", top: "-9999px", left: "0", visibility: "hidden", width: "auto", overflow: "visible" });const a = de("div");a.className = `${n}-header`;const d = de("div");d.className = `${n}-header-row`;const u = de("div");u.className = `${n}-header-cell ${t.cellClasses || ""}`, u.style.width = "auto";const h = u.cloneNode(true),c = u.cloneNode(true);u.appendChild(de("div")).innerHTML = o.headerCellFormatter(t.label, t.name), d.appendChild(h), d.appendChild(u), d.appendChild(c), a.appendChild(d), s.appendChild(a), document.body.appendChild(s);let m = getElementWidth(u, true, true, true) + o.columnAutoWidthExtraSize;if (l) {const e = de("div");e.className = `${n}-body`;const i = de("div");i.className = `${n}-row`;const a = de("div");a.className = `${n}-cell ${t.cellClasses || ""}`, a.style.width = "auto";const d = a.appendChild(de("div"));i.appendChild(a), e.appendChild(i), s.appendChild(e);for (let e = 0; e < l.length; e++) d.innerHTML = ae(o, l[e], t), m = Math.max(m, getElementWidth(a, true, true, true));}return s.remove(), m += t.arrowProposedWidth || 0, !t.ignoreMin && m < o.minColumnWidth && (m = o.minColumnWidth), Math.ceil(m);}function pe(e) {const t = e._o,l = e._p;let o,n = 0,s = 0;l.table && (n = l.table ? l.table.scrollTop : 0, s = l.table ? l.table.scrollLeft : 0, t.virtualTable && (o = l.table.style.display, l.table.style.display = "none"));let a = getElementWidth(e.el);l.table && (t.virtualTable && void 0 !== o && (l.table.style.display = o), l.table.scrollTop = n, l.table.scrollLeft = s, l.header && (l.header.scrollLeft = s));const d = t.tableClassName,u = de("div");u.className = e.el.className, setCssProps(u, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px" });const h = de("div");h.className = `${d}-header`, u.appendChild(h);const c = de("div");c.index = null, c.vIndex = null, c.className = `${d}-header-row`, h.appendChild(c);for (let e = 0; e < l.visibleColumns.length; e++) {const t = l.visibleColumns[e],i = de("div");i.className = `${d}-header-cell ${t.cellClasses || ""}`, i.columnName = t.name, i.appendChild(de("div")), c.appendChild(i);}document.body.appendChild(u), a -= function (e) {const t = getComputedStyle(e);return (parseFloat(t.borderLeftWidth) || 0) + (parseFloat(t.borderRightWidth) || 0);}(c);const m = c.querySelectorAll(`div.${d}-header-cell`);for (const e of m) {const t = getComputedStyle(e);if ("border-box" !== t.boxSizing) {a -= (parseFloat(t.borderRightWidth) || 0) + (parseFloat(t.borderLeftWidth) || 0) + ce(e);const i = e.columnName,o = l.columns.get(i);o && (a -= o.arrowProposedWidth || 0);}}return u.remove(), Math.max(0, a);}function ge(e) {const t = e._p,l = e._o.tableClassName,o = l + "-row",n = l + "-cell",s = t.visibleColumns,a = s.length,d = de("div");d.className = o, d.style.float = "left";let u = 0;for (let e = 0; e < a; e++) {var _t$actualWidth2, _t$actualWidth3;const t = s[e],l = de("div");l.className = n, l.style.width = ((_t$actualWidth2 = t.actualWidth) !== null && _t$actualWidth2 !== void 0 ? _t$actualWidth2 : 0) + "px", t.cellClasses && (l.className += " " + t.cellClasses), l.appendChild(de("div")), d.appendChild(l), u += (_t$actualWidth3 = t.actualWidth) !== null && _t$actualWidth3 !== void 0 ? _t$actualWidth3 : 0;}const h = de("div");h.className = e.el.className, setCssProps(h, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px", float: "left", width: "1px", overflow: "hidden" });const c = de("div");c.className = l, h.appendChild(c);const m = de("div");m.className = l + "-body", m.style.width = u + 1e4 + "px", c.appendChild(m), m.appendChild(d), document.body.appendChild(h);const f = de("div");setCssProps(f, { border: "1.5px solid #000", width: "0", height: "0", position: "absolute", left: "0", top: "-9999px" }), document.body.appendChild(f);const p = parseFloat(getComputedStyle(f).borderWidth),g = Math.round(p) !== p;f.remove();let v = getElementWidth(d, true, true, true);return v -= t.scrollbarWidth || 0, g && v++, h.remove(), v;}function ve(e) {const t = e._p;return !!t.table && "rtl" === getComputedStyle(t.table).direction;}function Ce(e) {var _e$unconvertedWidthMo;const t = null != e.unconvertedWidth ? e.unconvertedWidth : e.width,l = null != e.unconvertedWidth ? (_e$unconvertedWidthMo = e.unconvertedWidthMode) !== null && _e$unconvertedWidthMo !== void 0 ? _e$unconvertedWidthMo : e.widthMode : e.widthMode;return 0 === l ? "auto" : 2 === l ? parseFloat((100 * t).toPrecision(12)) + "%" : 3 === l ? "rest" : t;}const be = Object.prototype.hasOwnProperty,we = Symbol("once_original_handler");document.createElement.bind(document);class We {constructor(e) {var _e$rowsBufferSize, _e$minColumnWidth, _e$resizeAreaWidth, _e$resizeAreaDoubleCl, _e$maxColumnsSortCoun, _e$sortedColumns;_defineProperty(this, "VERSION", void 0);_defineProperty(this, "el", void 0);_defineProperty(this, "_o", void 0);_defineProperty(this, "_p", void 0);_defineProperty(this, w, void 0);e = e || {}, this.VERSION = We.VERSION;const t = this._o = {},n = this._p = { eventsSink: new DomEventsSink(), mitt: { all: s = s || new Map(), on: function (e, t) {var l = s.get(e);l ? l.push(t) : s.set(e, [t]);}, off: function (e, t) {var l = s.get(e);l && (t ? l.splice(l.indexOf(t) >>> 0, 1) : s.set(e, []));}, emit: function (e, t) {var l = s.get(e);l && l.slice().map(function (e) {e(t);}), (l = s.get("*")) && l.slice().map(function (l) {l(e, t);});} }, tableSkeletonNeedsRendering: true };var s;if (this.el = e.el && e.el instanceof HTMLElement ? e.el : document.createElement("div"), this.el !== e.el) {const t = (e.className || "dgtable-wrapper").split(/\s+/).filter(Boolean);this.el.classList.add(...t);}n.eventsSink.add(this.el, "dragend.colresize", (e) => {return t = e, void (this._p.resizer || (t.target.style.opacity = ""));var t;}), n.isWheelScrolling = false, n.eventsSink.add(this.el, "wheel", (e) => {if (n.cellPreviewCell) {let t = false,l = e.target;for (; l && l !== n.cellPreviewCell;) {const e = getComputedStyle(l),i = e.overflowY,o = e.overflowX,r = ("auto" === i || "scroll" === i) && l.scrollHeight > l.clientHeight,n = ("auto" === o || "scroll" === o) && l.scrollWidth > l.clientWidth;if (r || n) {t = true;break;}l = l.parentElement;}if (t) return;}n.isWheelScrolling = true, z(this), n.wheelScrollTimeout && clearTimeout(n.wheelScrollTimeout), n.wheelScrollTimeout = setTimeout(() => {n.isWheelScrolling = false, n.wheelScrollTimeout = void 0;}, 100);}, { passive: true }), t.virtualTable = void 0 === e.virtualTable || !!e.virtualTable, t.estimatedRowHeight = e.estimatedRowHeight || void 0, t.rowsBufferSize = Math.max((_e$rowsBufferSize = e.rowsBufferSize) !== null && _e$rowsBufferSize !== void 0 ? _e$rowsBufferSize : 3, 0), t.minColumnWidth = Math.max((_e$minColumnWidth = e.minColumnWidth) !== null && _e$minColumnWidth !== void 0 ? _e$minColumnWidth : 35, 0), t.maxStickyColumnRelativeWidth = e.maxStickyColumnRelativeWidth || null, t.columnAutoWidthExtraSize = e.columnAutoWidthExtraSize || 0, t.resizeAreaWidth = Math.max((_e$resizeAreaWidth = e.resizeAreaWidth) !== null && _e$resizeAreaWidth !== void 0 ? _e$resizeAreaWidth : 8, 0), t.resizeAreaDoubleClickDuration = Math.max((_e$resizeAreaDoubleCl = e.resizeAreaDoubleClickDuration) !== null && _e$resizeAreaDoubleCl !== void 0 ? _e$resizeAreaDoubleCl : 300, 0), t.autoFitColumnOnResizeDoubleClick = void 0 !== e.autoFitColumnOnResizeDoubleClick && !!e.autoFitColumnOnResizeDoubleClick, t.resizableColumns = void 0 === e.resizableColumns || !!e.resizableColumns, t.movableColumns = void 0 === e.movableColumns || !!e.movableColumns;const d = (_e$maxColumnsSortCoun = e.maxColumnsSortCount) !== null && _e$maxColumnsSortCoun !== void 0 ? _e$maxColumnsSortCoun : e.sortableColumns,u = Number(d !== null && d !== void 0 ? d : 1);t.sortableColumns = Number.isFinite(u) ? Math.max(u, 0) : 1, t.adjustColumnWidthForSortArrow = void 0 === e.adjustColumnWidthForSortArrow || !!e.adjustColumnWidthForSortArrow, t.convertColumnWidthsToRelative = void 0 !== e.convertColumnWidthsToRelative && !!e.convertColumnWidthsToRelative, t.autoFillTableWidth = void 0 !== e.autoFillTableWidth && !!e.autoFillTableWidth, t.autoFillLastColumn = void 0 === e.autoFillLastColumn || !!e.autoFillLastColumn, t.allowCancelSort = void 0 === e.allowCancelSort || !!e.allowCancelSort, t.cellClasses = void 0 === e.cellClasses ? "" : e.cellClasses, t.resizerClassName = void 0 === e.resizerClassName ? "dgtable-resize" : e.resizerClassName, t.tableClassName = void 0 === e.tableClassName ? "dgtable" : e.tableClassName, t.allowCellPreview = void 0 === e.allowCellPreview || e.allowCellPreview, t.allowHeaderCellPreview = void 0 === e.allowHeaderCellPreview || e.allowHeaderCellPreview, t.cellPreviewClassName = void 0 === e.cellPreviewClassName ? "dgtable-cell-preview" : e.cellPreviewClassName, t.cellPreviewAutoBackground = void 0 === e.cellPreviewAutoBackground || e.cellPreviewAutoBackground, t.onComparatorRequired = void 0 === e.onComparatorRequired ? null : e.onComparatorRequired, t.customSortingProvider = void 0 === e.customSortingProvider ? null : e.customSortingProvider, t.width = void 0 === e.width ? _.NONE : e.width, t.relativeWidthGrowsToFillWidth = void 0 === e.relativeWidthGrowsToFillWidth || !!e.relativeWidthGrowsToFillWidth, t.relativeWidthShrinksToFillWidth = void 0 !== e.relativeWidthShrinksToFillWidth && !!e.relativeWidthShrinksToFillWidth, this.setCellFormatter(e.cellFormatter), this.setHeaderCellFormatter(e.headerCellFormatter), this.setFilter(e.filter), t.height = e.height, this.setColumns(e.columns || [], false);let h = [];const c = (_e$sortedColumns = e.sortedColumns) !== null && _e$sortedColumns !== void 0 ? _e$sortedColumns : e.sortColumn;if (c) {let e = Array.isArray(c) ? c : [c];for (let t = 0, l = e.length; t < l; t++) {var _l$descending;let l = e[t];"string" == typeof l && (l = { column: l, descending: false });let i = n.columns.get(l.column);i && h.push({ column: l.column, comparePath: i.comparePath || i.dataPath, descending: (_l$descending = l.descending) !== null && _l$descending !== void 0 ? _l$descending : false });}}n.rows = new W({ sortColumn: h }), n.rows.onComparatorRequired = (e, l, i) => {if (t.onComparatorRequired) return t.onComparatorRequired(e, l, i);}, n.rows.customSortingProvider = (e, l) => t.customSortingProvider ? t.customSortingProvider(e, l) : l(e), n.filteredRows = null, n.scrollbarWidth = 0, n._lastVirtualScrollHeight = 0, function (e) {const t = e._p,n = (t) => {let n = t.currentTarget,s = t.relatedTarget;s === n || n.contains(s) || n[g] && (s === n[g] || n[g].contains(s)) || function (e, t, _s$visibleColumns$N$c, _P$right) {const n = e._o,s = e._p;if (s.isWheelScrolling) return;const a = t.firstElementChild;if (!a) return;if (!(a.scrollWidth - a.clientWidth > 1 || a.scrollHeight - a.clientHeight > 1)) return;z(e), s.abortCellPreview = false;const d = t.parentElement;if (!d) return;const u = (_s$visibleColumns$N$c = s.visibleColumns[N.call(d.childNodes, t)]) === null || _s$visibleColumns$N$c === void 0 ? void 0 : _s$visibleColumns$N$c.name,h = u ? s.columns.get(u) : null;if (!h) return;const c = d.index;if (e.emit("cellhoveroverflow", { name: u, rowIndex: c !== null && c !== void 0 ? c : null, rowData: null == c ? null : s.rows[c], cell: t, cellEl: a }), false === h.allowPreview) return;const m = t.classList.contains(`${n.tableClassName}-header-cell`);if (m ? !n.allowHeaderCellPreview : !n.allowCellPreview) return;const f = k("div");f.innerHTML = t.innerHTML, f.className = n.cellPreviewClassName + " " + (h.cellClasses || ""), m && (f.classList.add("header"), t.classList.contains("sortable") && f.classList.add("sortable"), f.draggable = true, le(e, f));const p = getComputedStyle(t),C = getComputedStyle(a),b = "right" === p.float,w = b ? "right" : "left",W = parseFloat(p.paddingLeft) || 0,y = parseFloat(p.paddingRight) || 0,S = parseFloat(p.paddingTop) || 0,R = parseFloat(p.paddingBottom) || 0;let _ = a.scrollWidth + (t.clientWidth - a.offsetWidth);const M = "border-box" === p.boxSizing;if (M ? f.style.boxSizing = "border-box" : (_ -= W + y, f.style.marginTop = (parseFloat(p.borderTopWidth) || 0) + "px"), !s.transparentBgColor1) {const e = document.createElement("div");document.body.appendChild(e), e.style.backgroundColor = "transparent", s.transparentBgColor1 = getComputedStyle(e).backgroundColor, e.style.backgroundColor = "rgba(0,0,0,0)", s.transparentBgColor2 = getComputedStyle(e).backgroundColor, e.remove();}const T = { "box-sizing": M ? "border-box" : "content-box", width: _ + "px", "min-height": Math.max(getElementHeight(t), /%/.test(p.minHeight) ? 0 : parseFloat(p.minHeight) || 0) + "px", "padding-left": W + "px", "padding-right": y + "px", "padding-top": S + "px", "padding-bottom": R + "px", overflow: "hidden", position: "absolute", "z-index": "-1", [w]: "0", top: "0", cursor: p.cursor };if (n.cellPreviewAutoBackground) {let e = p.backgroundColor;e !== s.transparentBgColor1 && e !== s.transparentBgColor2 || (e = getComputedStyle(d).backgroundColor), e !== s.transparentBgColor1 && e !== s.transparentBgColor2 || (e = "#fff"), T["background-color"] = e;}setCssProps(f, T), f.firstChild && setCssProps(f.firstChild, { direction: C.direction, "white-space": C.whiteSpace, "min-height": C.minHeight, "line-height": C.lineHeight, font: C.font }), e.el.appendChild(f), m && me(f), f.rowVIndex = d.vIndex, f.rowIndex = c, f.columnName = u;try {const e = x.saveSelection(t);e && x.restoreSelection(f, e);} catch {}if (e.emit("cellpreview", { el: f.firstElementChild, name: f.columnName, rowIndex: c !== null && c !== void 0 ? c : null, rowData: null == c ? null : s.rows[c], cell: t, cellEl: a }), s.abortCellPreview) return void f.remove();null != c && f.addEventListener("click", (t) => {e.emit("rowclick", { event: t, filteredRowIndex: d.vIndex, rowIndex: c, rowEl: d, rowData: s.rows[c] });});const L = e.el,F = L === window ? document : L,A = getComputedStyle(L),P = getElementOffset(t),H = getElementOffset(L);if (b) {const e = window.innerWidth;P.right = e - (P.left + getElementWidth(t, true, true, true)), H.right = e - (H.left + getElementWidth(L, true, true, true));}P.left -= parseFloat(A.borderLeftWidth) || 0, "right" === w && void 0 !== P.right && void 0 !== H.right && (P.right -= parseFloat(A.borderRightWidth) || 0), P.top -= parseFloat(A.borderTopWidth) || 0, "left" === w ? P.left += parseFloat(p.borderLeftWidth) || 0 : void 0 !== P.right && (P.right += parseFloat(p.borderRightWidth) || 0), P.top += parseFloat(p.borderTopWidth) || parseFloat(p.borderBottomWidth) || 0, P.left -= H.left, "right" === w && void 0 !== P.right && void 0 !== H.right && (P.right -= H.right), P.top -= H.top;const E = getElementWidth(L, false, false, false) - getElementWidth(f, true, true, true),O = "left" === w ? P.left : (_P$right = P.right) !== null && _P$right !== void 0 ? _P$right : 0,I = Math.max(0, Math.min(E, O));"left" === w ? P.left = I : P.right = I;const D = getElementHeight(t, true, true, true),B = ("scrollTop" in F ? F.scrollTop : 0) + getElementHeight(L, true) - D;P.top > B && (P.top = Math.max(0, B));const $ = { top: P.top + "px", "z-index": 9999 };$[w] = ("left" === w ? P.left : P.right) + "px", setCssProps(f, $), f[v] = t, s.cellPreviewCell = f, t[g] = f, s._bindCellHoverOut(t), s._bindCellHoverOut(f);}(e, n);},s = (t) => {let l = t.currentTarget[v] || t.currentTarget,i = t.relatedTarget;i === e.el || l.contains(i) || l[g] && (i === l[g] || l[g].contains(i)) || function (e) {z(e);}(e);};t._bindCellHoverIn = (e) => {e[m] || e.addEventListener("mouseover", e[m] = n);}, t._unbindCellHoverIn = (e) => {e[m] && (e.removeEventListener("mouseover", e[m]), e[m] = null);}, t._bindCellHoverOut = (e) => {e[f] || e.addEventListener("mouseout", e[f] = s);}, t._unbindCellHoverOut = (e) => {e[f] && (e.removeEventListener("mouseout", e[f]), e[f] = null);};}(this);}on(e, t) {return this[w] || this._p.mitt.on(e, t), this;}once(e, t) {if (this[w]) return this;const l = (i) => {this._p.mitt.off(e, l), t(i);};return l[we] = t, this._p.mitt.on(e, l), this;}off(e, t) {if (this[w]) return this;if (e || t) {if (this._p.mitt.off(e, t), t) {var _this$_p$mitt$all$get;const l = (_this$_p$mitt$all$get = this._p.mitt.all.get(e)) !== null && _this$_p$mitt$all$get !== void 0 ? _this$_p$mitt$all$get : [];for (const i of l.slice()) i[we] === t && this._p.mitt.off(e, i);}} else this._p.mitt.all.clear();return this;}emit(e, t) {return this[w] || this._p.mitt.emit(e, t), this;}destroy() {var _e$virtualListHelper, _e$table, _e$tbody;const e = this._p,t = this.el;if (this[w] || !e) return this;if (A(this), V(this), (_e$virtualListHelper = e.virtualListHelper) !== null && _e$virtualListHelper !== void 0 && _e$virtualListHelper.destroy(), e.virtualListHelper = null, Y(this), (_e$table = e.table) !== null && _e$table !== void 0 && _e$table.remove(), (_e$tbody = e.tbody) !== null && _e$tbody !== void 0 && _e$tbody.remove(), e.workerListeners) {for (let t = 0; t < e.workerListeners.length; t++) {let l = e.workerListeners[t];l.worker.removeEventListener("message", l.listener, false);}e.workerListeners.length = 0;}e.rows.length = e.columns.length = 0, e._deferredRender && clearTimeout(e._deferredRender), e.wheelScrollTimeout && clearTimeout(e.wheelScrollTimeout), e.tapAndHoldTimeout && clearTimeout(e.tapAndHoldTimeout), e.eventsSink.remove();for (let e in this) be.call(this, e) && (this[e] = null);return this[w] = true, t && t.remove(), this;}close() {this.destroy();}remove() {this.destroy();}render() {const o = this._o,r = this._p;if (!this.el.offsetParent) return r._deferredRender || (r._deferredRender = setTimeout(() => {r._deferredRender = null, !this[w] && this.el.offsetParent && this.render();})), this;if (true === r.tableSkeletonNeedsRendering) {var _r$filteredRows;r.tableSkeletonNeedsRendering = false, o.width === _.AUTO && ee(this);let n = r.table && r.table.parentNode ? r.table.scrollTop : NaN,s = r.table && r.table.parentNode ? getScrollHorz(r.table) : NaN;!function (e, _t$virtualListHelper) {const t = e._p,i = e._o;V(e), (_t$virtualListHelper = t.virtualListHelper) !== null && _t$virtualListHelper !== void 0 && _t$virtualListHelper.destroy(), t.virtualListHelper = null, t.table && i.virtualTable && (t.table.remove(), t.table = void 0, t.tbody = void 0), Y(e), t.currentTouchId = null, t.header && t.header.remove();const o = i.tableClassName,r = q("div"),n = q("div");r.className = `${o}-header`, n.className = `${o}-header-row`, t.header = r, t.headerRow = n, r.appendChild(n), e.el.prepend(r), ue(e.el), i.width === _.SCROLL ? e.el.style.overflow = "hidden" : e.el.style.overflow = "", !i.height && i.virtualTable && (i.height = getElementHeight(e.el, true));}(this), function (e) {const t = e._p,o = e._o,r = o.tableClassName;if (o.virtualTable && !t.virtualRowHeight) {const o = () => {const e = q("div"),t = e.appendChild(q("div")),l = t.appendChild(q("div"));return e.className = `${r}-row`, t.className = `${r}-cell`, l.innerHTML = "0", e.style.visibility = "hidden", e.style.position = "absolute", e;},n = q("div");n.className = e.el.className, setCssProps(n, { "z-index": "-1", position: "absolute", left: "0", top: "-9999px", width: "1px", overflow: "hidden" });const s = q("div");s.className = r, n.appendChild(s);const a = q("div");a.className = `${r}-body`, a.style.width = "99999px", s.appendChild(a), document.body.appendChild(n);const d = o(),u = o(),h = o();a.appendChild(d), a.appendChild(u), a.appendChild(h), t.virtualRowHeight = getElementHeight(u, true, true, true), n.remove();}if (!t.table) {var _o$height;const n = document.createDocumentFragment(),s = q("div");s.className = r, o.virtualTable && (s.className += " virtual");const a = getComputedStyle(s);let d = ((_o$height = o.height) !== null && _o$height !== void 0 ? _o$height : 0) - getElementHeight(t.header, true, true, true);"border-box" !== a.boxSizing && (d -= parseFloat(a.borderTopWidth) || 0, d -= parseFloat(a.borderBottomWidth) || 0, d -= parseFloat(a.paddingTop) || 0, d -= parseFloat(a.paddingBottom) || 0), setCssProps(s, { height: o.height ? d + "px" : "auto", display: "block", overflowY: "auto", overflowX: o.width === _.SCROLL ? "auto" : "hidden" }), n.appendChild(s);const u = q("div");u.className = o.tableClassName + "-body", u.style.minHeight = "1px", t.table = s, t.tbody = u, ue(u), ue(s), s.appendChild(u), e.el.appendChild(n);}t.virtualListHelper || function (e, _t$filteredRows) {const t = e._p,l = e._o,i = l.tableClassName,o = i + "-row",r = i + "-row-alt",n = i + "-cell",s = i + "-sticky";let a = t.visibleColumns,u = a.length;t.notifyRendererOfColumnsConfig = () => {a = t.visibleColumns, u = a.length;for (let e = 0; e < u; e++) {const t = a[e];t._finalWidth = t.actualWidthConsideringScrollbarWidth || t.actualWidth;}}, t.virtualListHelper = new VirtualListHelper({ list: t.table, itemsParent: t.tbody, autoVirtualWrapperWidth: false, virtual: l.virtualTable, buffer: l.rowsBufferSize, estimatedItemHeight: l.estimatedRowHeight ? l.estimatedRowHeight : t.virtualRowHeight || 40, itemElementCreatorFn: () => q("div"), onItemRender: (i, d) => {const h = i,c = t.filteredRows || t.rows,m = !!t.filteredRows,f = t.isStickyColumns;h.className = o, d % 2 == 1 && (h.className += " " + r);const g = c[d],v = m ? g[b] : d;h.vIndex = d, h.index = v;for (let e = 0; e < u; e++) {var _i$_finalWidth;const i = a[e],o = q("div");if (o.columnName = i.name, o.setAttribute("data-column", i.name), o.className = n, o.style.width = ((_i$_finalWidth = i._finalWidth) !== null && _i$_finalWidth !== void 0 ? _i$_finalWidth : 0) + "px", i.cellClasses && (o.className += " " + i.cellClasses), i.stickyPos) {o.className += " " + s, o.style.position = "sticky", o.style[i.stickyPos.absDirection] = i.stickyPos.offset + "px";const l = f === null || f === void 0 ? void 0 : f.get(e);"start" === l && !t.lastIsRtl || "end" === l && t.lastIsRtl ? o.classList.add("is-sticky-left") : ("start" === l && t.lastIsRtl || "end" === l && !t.lastIsRtl) && o.classList.add("is-sticky-right");}t._bindCellHoverIn(o), o.appendChild(q("div")).innerHTML = ae(l, g, i), h.appendChild(o);}h.addEventListener("click", h[p] = (t) => {e.emit("rowclick", { event: t, filteredRowIndex: d, rowIndex: v, rowEl: h, rowData: g });}), e.emit("rowcreate", { filteredRowIndex: d, rowIndex: v, rowEl: h, rowData: g });}, onItemUnrender: (t) => X(e, t), onScrollHeightChange: (l) => {l > t._lastVirtualScrollHeight && !t.scrollbarWidth && G(e), t._lastVirtualScrollHeight = l;} }), t.virtualListHelper.setCount(((_t$filteredRows = t.filteredRows) !== null && _t$filteredRows !== void 0 ? _t$filteredRows : t.rows).length), t.notifyRendererOfColumnsConfig();}(e);}(this), this.tableWidthChanged(true, false), function (e) {const t = e._p,l = e._o,i = l.tableClassName + "-header-cell",o = t.headerRow;for (let r = 0; r < t.visibleColumns.length; r++) {const n = t.visibleColumns[r];if (n.visible) {var _n$actualWidth;const s = q("div");s.draggable = true, s.className = i, s.style.width = ((_n$actualWidth = n.actualWidth) !== null && _n$actualWidth !== void 0 ? _n$actualWidth : 0) + "px", l.sortableColumns && n.sortable && (s.className += " sortable"), s.columnName = n.name, s.setAttribute("data-column", n.name);const a = q("div");a.innerHTML = l.headerCellFormatter(n.label, n.name), s.appendChild(a), t._bindCellHoverIn(s), o.appendChild(s), t.visibleColumns[r].element = s, le(e, s), me(s);}}K(e), e.emit("headerrowcreate", o);}(this), r.virtualListHelper.setCount(((_r$filteredRows = r.filteredRows) !== null && _r$filteredRows !== void 0 ? _r$filteredRows : r.rows).length), U(this), G(this, true), J(this, true), j(this), G(this);for (let e = 0; e < r.rows.sortColumn.length; e++) te(this, r.rows.sortColumn[e].column, r.rows.sortColumn[e].descending);o.adjustColumnWidthForSortArrow && r.rows.sortColumn.length ? this.tableWidthChanged(true) : o.virtualTable || this.tableWidthChanged(), isNaN(n) || (r.table.scrollTop = n), isNaN(s) || (setScrollHorz(r.table, s), setScrollHorz(r.header, s)), K(this), this.emit("renderskeleton");}r.virtualListHelper.render();const n = r.scrollbarWidth;return G(this), r.scrollbarWidth !== n && J(this, false), this.emit("render"), this;}clearAndRender(e) {var _t$notifyRendererOfCo;let t = this._p;return t.tableSkeletonNeedsRendering = true, (_t$notifyRendererOfCo = t.notifyRendererOfColumnsConfig) !== null && _t$notifyRendererOfCo !== void 0 && _t$notifyRendererOfCo.call(t), (void 0 === e || e) && this.render(), this;}setColumns(e, t) {const l = this._p;e = e || [];let i = new S();for (let t = 0, l = 0; t < e.length; t++) {let o = e[t],r = oe(this._o, o);void 0 !== o.order ? (o.order > l && (l = o.order + 1), r.order = o.order) : r.order = l++, i.push(r);}return i.normalizeOrder(), l.columns = i, l.visibleColumns = i.getVisibleColumns(), re(this), this.clearAndRender(t), this;}addColumn(e, t, l) {const i = this._p;let o = i.columns;if (e && !o.get(e.name)) {let r = null;void 0 !== t && (r = "string" == typeof t ? o.get(t) : o.getByOrder(t));let n = oe(this._o, e);n.order = r ? r.order : o.getMaxOrder() + 1;for (let e = o.getMaxOrder(), t = n.order; e >= t; e--) {let t = o.getByOrder(e);t && t.order++;}o.push(n), o.normalizeOrder(), i.visibleColumns = o.getVisibleColumns(), re(this), this.clearAndRender(l), this.emit("addcolumn", n.name);}return this;}removeColumn(e, t) {const l = this._p;let i = l.columns,o = i.indexOf(e);return o > -1 && (i.splice(o, 1), i.normalizeOrder(), l.visibleColumns = i.getVisibleColumns(), re(this), this.clearAndRender(t), this.emit("removecolumn", e)), this;}setColumnLabel(e, t) {let l = this._p.columns.get(e);if (l && (l.label = void 0 === t ? l.name : t, l.element)) {const e = l.element.firstChild,t = e.querySelector(":scope > .sort-arrow");e.innerHTML = this._o.headerCellFormatter(l.label, l.name), t && e.insertBefore(t, e.firstChild);}return this;}moveColumn(e, t, l = true) {const i = this._o,o = this._p;let r,n,a = o.columns,d = l ? o.visibleColumns : a.getColumns();if ("string" == typeof e ? r = a.get(e) : "number" == typeof e && (r = d[e]), "string" == typeof t ? n = a.get(t) : "number" == typeof t && (n = d[t]), r && n && e !== t) {let e = r.order,t = n.order,l = a.moveColumn(r, n).getVisibleColumns();if (o.visibleColumns.length !== l.length || o.visibleColumns.some((e, t) => e !== l[t])) {const e = o.visibleColumns.indexOf(r),t = o.visibleColumns.indexOf(n);if (o.visibleColumns = l, re(this), !i.virtualTable && -1 !== e && -1 !== t && o.headerRow && o.tbody) {var _ref8, _ref9;const l = scopedSelectorAll(o.headerRow, `>div.${i.tableClassName}-header-cell`),r = e < t ? t + 1 : t;l[0].parentNode.insertBefore(l[e], l[r]);const n = o.visibleColumns[t],a = ((_ref8 = n.actualWidthConsideringScrollbarWidth || n.actualWidth) !== null && _ref8 !== void 0 ? _ref8 : 0) + "px",d = o.visibleColumns[e],u = ((_ref9 = d.actualWidthConsideringScrollbarWidth || d.actualWidth) !== null && _ref9 !== void 0 ? _ref9 : 0) + "px",h = o.tbody.childNodes;for (let l = 0, i = h.length; l < i; l++) {const i = h[l];1 === i.nodeType && (i.insertBefore(i.childNodes[e], i.childNodes[r]), i.childNodes[t].firstChild.style.width = a, i.childNodes[e].firstChild.style.width = u);}this.tableWidthChanged(true);} else this.clearAndRender();}this.emit("movecolumn", { name: r.name, src: e, dest: t });}return this;}setColumnVisible(e, t) {const l = this._p;let i = l.columns.get(e);return t = !!t, i && !!i.visible !== t && (i.visible = t, l.visibleColumns = l.columns.getVisibleColumns(), this.emit(t ? "showcolumn" : "hidecolumn", e), re(this), this.clearAndRender()), this;}isColumnVisible(e) {let t = this._p.columns.get(e);return !!t && t.visible;}setMinColumnWidth(e) {let t = this._o;return e = Math.max(e, 0), t.minColumnWidth !== e && (t.minColumnWidth = e, this.tableWidthChanged(true)), this;}getMinColumnWidth() {return this._o.minColumnWidth;}setColumnAutoWidthExtraSize(e) {let t = this._o;return e = Math.max(e, 0), t.columnAutoWidthExtraSize !== e && (t.columnAutoWidthExtraSize = e, this.tableWidthChanged(true)), this;}getColumnAutoWidthExtraSize() {return this._o.columnAutoWidthExtraSize;}setResizeAreaWidth(e) {let t = this._o;return e = Math.max(e, 0), t.resizeAreaWidth !== e && (t.resizeAreaWidth = e, this.tableWidthChanged(true)), this;}getResizeAreaWidth() {return this._o.resizeAreaWidth;}setResizeAreaDoubleClickDuration(e) {let t = this._o;return e = Math.max(e, 0), t.resizeAreaDoubleClickDuration !== e && (t.resizeAreaDoubleClickDuration = e, this.tableWidthChanged(true)), this;}getResizeAreaDoubleClickDuration() {return this._o.resizeAreaDoubleClickDuration;}setMaxStickyColumnRelativeWidth(e) {let t = this._o;return e = e || null, t.maxStickyColumnRelativeWidth !== e && (t.maxStickyColumnRelativeWidth = e, this.tableWidthChanged(true)), this;}getMaxStickyColumnRelativeWidth() {return this._o.maxStickyColumnRelativeWidth;}setColumnWidth(e, t) {let l = this._p.columns.get(e);if (l) {let e = ie(t, l.ignoreMin ? 0 : this._o.minColumnWidth),i = Ce(l);l.width = e.width, l.widthMode = e.mode, l.unconvertedWidth = null, l.unconvertedWidthMode = null;let o = Ce(l);i !== o && this.tableWidthChanged(true), this.emit("columnwidth", { name: l.name, width: o, oldWidth: i });}return this;}autoFitColumn(e) {const t = this._p,l = t.filteredRows || t.rows,i = t.columns.get(e);if (!i || l.length < 1) return this;const o = fe(this, i, l);return o > 0 && this.setColumnWidth(e, o), this;}getColumnWidth(e) {let t = this._p.columns.get(e);return t ? Ce(t) : null;}getColumnConfig(e) {let t = this._p.columns.get(e);if (t) {var _t$unconvertedWidthMo, _t$dataPath, _t$comparePath;const e = t.width,l = t.widthMode;null != t.unconvertedWidth && (t.width = t.unconvertedWidth, t.widthMode = (_t$unconvertedWidthMo = t.unconvertedWidthMode) !== null && _t$unconvertedWidthMo !== void 0 ? _t$unconvertedWidthMo : t.widthMode);const i = Ce(t);return null != t.unconvertedWidth && (t.width = e, t.widthMode = l), { name: t.name, label: t.label, width: i, dataPath: (_t$dataPath = t.dataPath) === null || _t$dataPath === void 0 ? void 0 : _t$dataPath.join("."), comparePath: (_t$comparePath = t.comparePath) === null || _t$comparePath === void 0 ? void 0 : _t$comparePath.join("."), resizable: t.resizable, movable: t.movable, sortable: t.sortable, visible: t.visible, cellClasses: t.cellClasses, ignoreMin: t.ignoreMin, sticky: t.sticky, order: t.order, allowPreview: t.allowPreview };}return null;}getColumnsConfig() {const e = this._p;let t = {};for (let l = 0; l < e.columns.length; l++) t[e.columns[l].name] = this.getColumnConfig(e.columns[l].name);return t;}setMaxColumnSortCount(e) {const t = this._p,l = this._o;if (l.sortableColumns !== e && (l.sortableColumns = e, t.table)) {const e = scopedSelectorAll(t.headerRow, `>div.${l.tableClassName}-header-cell`);for (let i = 0, o = e.length; i < o; i++) e[i].classList[l.sortableColumns > 0 && t.visibleColumns[i].sortable ? "add" : "remove"]("sortable");}return this;}getMaxColumnSortCount() {return this._o.sortableColumns;}setSortableColumns(e) {return this.setMaxColumnSortCount(e);}getSortableColumns() {return this.getMaxColumnSortCount();}setMovableColumns(e) {let t = this._o;return e = void 0 === e || !!e, t.movableColumns !== e && (t.movableColumns = e), this;}getMovableColumns() {return this._o.movableColumns;}setResizableColumns(e) {let t = this._o;return e = void 0 === e || !!e, t.resizableColumns !== e && (t.resizableColumns = e), this;}getResizableColumns() {return this._o.resizableColumns;}getConvertColumnWidthsToRelative() {return this._o.convertColumnWidthsToRelative;}setConvertColumnWidthsToRelative(e, t = true) {let l = this._o;return e = !!e, l.convertColumnWidthsToRelative !== e && (l.convertColumnWidthsToRelative = e, t && this.tableWidthChanged(true)), this;}setOnComparatorRequired(e) {let t = this._o;return t.onComparatorRequired !== e && (t.onComparatorRequired = e), this;}setCustomSortingProvider(e) {let t = this._o;return t.customSortingProvider !== e && (t.customSortingProvider = e), this;}sort(e, t, l) {const i = this._o,o = this._p;let r = o.columns.get(e),n = o.rows.sortColumn.map((e) => ({ column: e.column, descending: e.descending }));if (r) {if (l) {for (let e = 0; e < n.length; e++) if (n[e].column === r.name) {e < n.length - 1 ? n.length = 0 : (t = n[n.length - 1].descending, n.splice(n.length - 1, 1));break;}(i.sortableColumns > 0 && n.length >= i.sortableColumns || n.length >= o.visibleColumns.length) && (n.length = 0);} else n.length = 0;t = void 0 !== t && t, n.push({ column: r.name, descending: !!t });} else n.length = 0;return this.setSortedColumns(n);}resort() {const e = this._p;let t = e.columns,l = e.rows.sortColumn;if (l.length) {var _e$virtualListHelper2;for (let e = 0; e < l.length; e++) t.get(l[e].column) || l.splice(e--, 1);e.rows.sortColumn = l, l.length && (e.rows.sort(), se(this)), (_e$virtualListHelper2 = e.virtualListHelper) === null || _e$virtualListHelper2 === void 0 ? void 0 : _e$virtualListHelper2.invalidate();let i = [];for (let e = 0; e < l.length; e++) i.push({ column: l[e].column, descending: l[e].descending });this.emit("sort", { sorts: i, resort: true });}return this;}setSortedColumns(e, t = { immediate: true, render: true }) {var _i$virtualListHelper;const l = this._o,i = this._p;let o = i.columns,r = e.filter((e) => o.get(e.column)).map((e) => {let t = o.get(e.column);return { column: t.name, comparePath: t.comparePath || t.dataPath, descending: !!e.descending };});l.sortableColumns > 0 && r.length > l.sortableColumns && (r.length = l.sortableColumns), ee(this);for (let e = 0; e < r.length; e++) te(this, r[e].column, r[e].descending);l.adjustColumnWidthForSortArrow && !i.tableSkeletonNeedsRendering && this.tableWidthChanged(true), i.rows.sortColumn = r, r.length && t.immediate && (i.rows.sort(), se(this), (_i$virtualListHelper = i.virtualListHelper) !== null && _i$virtualListHelper !== void 0 && _i$virtualListHelper.invalidate(), i.virtualListHelper && t.render && i.virtualListHelper.render());let n = [];for (let e = 0; e < r.length; e++) n.push({ column: r[e].column, descending: r[e].descending });return this.emit("sort", { sorts: n }), this;}getSortedColumns() {const e = this._p;let t = [];for (let l = 0; l < e.rows.sortColumn.length; l++) {let i = e.rows.sortColumn[l];t.push({ column: i.column, descending: i.descending });}return t;}setCellFormatter(e) {if (!e) {const t = (e) => "string" == typeof e ? h(e) : e;t[c] = true, e = t;}return this._o.cellFormatter = e, this;}setHeaderCellFormatter(e) {return this._o.headerCellFormatter = e || function (e) {return "string" == typeof e ? h(e) : e;}, this;}setFilter(e) {return this._o.filter = e, this;}filter(e) {const t = this._p;let l = this._o.filter || R,i = !!t.filteredRows;return t.filteredRows && (t.filteredRows = null), t.filterArgs = null == e ? null : "object" != typeof e || Array.isArray(e) ? e : Object.assign({}, e), null !== t.filterArgs ? (t.filteredRows = t.rows.filteredCollection(l, t.filterArgs), (i || t.filteredRows) && (this.clearAndRender(), this.emit("filter", e))) : (t.filterArgs = null, t.filteredRows = null, this.clearAndRender(), this.emit("filterclear", {})), this;}clearFilter() {const e = this._p;return e.filteredRows && (e.filterArgs = null, e.filteredRows = null, this.clearAndRender(), this.emit("filterclear", {})), this;}getHtmlForRowCell(e, t) {const l = this._p;if (e < 0 || e > l.rows.length - 1) return null;let i = l.columns.get(t);if (!i) return null;let o = l.rows[e];return ae(this._o, o, i);}getHtmlForRowDataCell(e, t) {let l = this._p.columns.get(t);return l ? ae(this._o, e, l) : null;}getRowYPos(e) {var _t$virtualListHelper$, _t$virtualListHelper2;const t = this._p;if (e < 0 || e > t.rows.length - 1) return null;let l = e;return t.filteredRows && -1 === (l = t.filteredRows.indexOf(t.rows[e])) ? null : (_t$virtualListHelper$ = (_t$virtualListHelper2 = t.virtualListHelper) === null || _t$virtualListHelper2 === void 0 ? void 0 : _t$virtualListHelper2.getItemPosition(l)) !== null && _t$virtualListHelper$ !== void 0 ? _t$virtualListHelper$ : null;}getDataForRow(e) {const t = this._p;return e < 0 || e > t.rows.length - 1 ? null : t.rows[e];}getRowCount() {const e = this._p;return e.rows ? e.rows.length : 0;}getIndexForRow(e) {return this._p.rows.indexOf(e);}getFilteredRowCount() {const e = this._p;return (e.filteredRows || e.rows).length;}getIndexForFilteredRow(e) {const t = this._p;return (t.filteredRows || t.rows).indexOf(e);}getDataForFilteredRow(e) {const t = this._p;return e < 0 || e > (t.filteredRows || t.rows).length - 1 ? null : (t.filteredRows || t.rows)[e];}getHeaderRowElement() {return this._p.headerRow;}addRows(e, t, l, i) {let o = this._p;"boolean" == typeof t && (i = l, l = t, t = -1), "number" != typeof t && (t = -1), (t < 0 || t > o.rows.length) && (t = o.rows.length), i = void 0 === i || !!i;const r = (Array.isArray(e) ? e : [e]).length;if (e) {if (o.rows.add(e, t), o.filteredRows || l && o.rows.sortColumn.length) ne(this), l && o.rows.sortColumn.length && this.resort(), o.tableSkeletonNeedsRendering = true, i && this.render();else if (i && o.virtualListHelper) {if (o.virtualListHelper.addItemsAt(r, t), this._o.virtualTable) U(this), G(this), this.render(), J(this, false);else if (o.tbody) {for (let e = t + r, l = o.virtualListHelper.getCount(); e < l; e++) o.virtualListHelper.refreshItemAt(e);this.render(), G(this), J(this, true);}} else o.tableSkeletonNeedsRendering = true;this.emit("addrows", { count: r, clear: false });}return this;}removeRows(e, t, l) {let i = this._p;if ("number" != typeof t || t <= 0) return this;if (e < 0 || e > i.rows.length - 1) return this;if (i.rows.splice(e, t), l = void 0 === l || !!l, i.filteredRows) ne(this), i.tableSkeletonNeedsRendering = true, l && this.render();else if (l && i.virtualListHelper) {if (i.virtualListHelper.removeItemsAt(t, e), this._o.virtualTable) U(this), G(this), this.render(), J(this, false);else {for (let t = e, l = i.virtualListHelper.getCount(); t < l; t++) i.virtualListHelper.refreshItemAt(t);this.render(), G(this), J(this, true);}} else i.tableSkeletonNeedsRendering = true;return this;}removeRow(e, t) {return this.removeRows(e, 1, t);}refreshRow(e, t = true) {let l = this._p;if (e < 0 || e > l.rows.length - 1) return this;let i = -1;return l.filteredRows && -1 === (i = l.filteredRows.indexOf(l.rows[e])) ? this : (-1 === i && (i = e), l.virtualListHelper ? (l.virtualListHelper.refreshItemAt(i), t && l.virtualListHelper.render(), this) : this);}getRowElement(e) {var _t$virtualListHelper3;let t = this._p;if (e < 0 || e > t.rows.length - 1) return null;let l = -1;return t.filteredRows && -1 === (l = t.filteredRows.indexOf(t.rows[e])) ? null : (-1 === l && (l = e), ((_t$virtualListHelper3 = t.virtualListHelper) === null || _t$virtualListHelper3 === void 0 ? void 0 : _t$virtualListHelper3.getItemElementAt(l)) || null);}refreshAllVirtualRows() {var _e$virtualListHelper3;const e = this._p;return (_e$virtualListHelper3 = e.virtualListHelper) !== null && _e$virtualListHelper3 !== void 0 && _e$virtualListHelper3.invalidate().render(), this;}setRows(e, t) {let l = this._p;return l.rows.reset(e), ne(this), t && l.rows.sortColumn.length && this.resort(), this.clearAndRender().emit("addrows", { count: e.length, clear: true }), this;}tableWidthChanged(e, t) {let l = this._o,i = this._p,o = pe(this),r = o,n = 0;if (!i.table) return this;t = void 0 === t || t;let s = 0;if (i.tbody || (t = false), t && (s = parseFloat(i.tbody.style.minWidth) || 0), r !== i.lastDetectedWidth || e) {var _i$notifyRendererOfCo;i.lastDetectedWidth = o;let e = 0,a = [],d = 0,u = 0;for (let e = 0; e < i.columns.length; e++) i.columns[e].actualWidthConsideringScrollbarWidth = null;for (let t = 0; t < i.visibleColumns.length; t++) {var _o$unconvertedWidthMo;let o = i.visibleColumns[t];if (null != o.unconvertedWidth && (o.width = o.unconvertedWidth, o.widthMode = (_o$unconvertedWidthMo = o.unconvertedWidthMode) !== null && _o$unconvertedWidthMo !== void 0 ? _o$unconvertedWidthMo : o.widthMode, o.unconvertedWidth = null, o.unconvertedWidthMode = null), 1 === o.widthMode) {let i = o.width;i += o.arrowProposedWidth || 0, !o.ignoreMin && i < l.minColumnWidth && (i = l.minColumnWidth), r -= i, e += i, i !== o.actualWidth && (o.actualWidth = i, a.push(t));} else if (0 === o.widthMode) {let n = fe(this, o);o === i.visibleColumns[i.visibleColumns.length - 1] && (n += i.scrollbarWidth), r -= n, e += n, n !== o.actualWidth && (o.actualWidth = n, l.convertColumnWidthsToRelative || a.push(t));} else 2 === o.widthMode ? (d += o.width, n++) : 3 === o.widthMode && u++;}if (l.convertColumnWidthsToRelative) for (let t = 0; t < i.visibleColumns.length; t++) {let l = i.visibleColumns[t];if (0 === l.widthMode) {const t = l.width,i = l.widthMode;null == l.unconvertedWidth && (l.unconvertedWidth = t, l.unconvertedWidthMode = i), l.widthMode = 2, r += l.actualWidth, l.width = l.actualWidth / e, d += l.width, n++;}}if (n && (d < 1 && !u && l.relativeWidthGrowsToFillWidth || d > 1 && l.relativeWidthShrinksToFillWidth)) for (let e = 0; e < i.visibleColumns.length; e++) {let t = i.visibleColumns[e];2 === t.widthMode && (null == t.unconvertedWidth && (t.unconvertedWidth = t.width, t.unconvertedWidthMode = t.widthMode), t.width /= d);}let h = Math.max(0, r);0 === h && (h = i.table.clientWidth);let c = l.minColumnWidth / h;if (Number.isFinite(c) || (c = 0), c > 0) {let e,t = 0;for (let e = 0; e < i.visibleColumns.length; e++) {let l = i.visibleColumns[e];2 === l.widthMode && !l.ignoreMin && l.width < c && (t += c - l.width, l.width = c);}for (let l = 0; l < i.visibleColumns.length; l++) {let o = i.visibleColumns[l];2 === o.widthMode && !o.ignoreMin && o.width > c && t > 0 && (null == o.unconvertedWidth && (o.unconvertedWidth = o.width, o.unconvertedWidthMode = o.widthMode), e = Math.min(t, o.width - c), o.width -= e, t -= e);}}if (!u && l.autoFillTableWidth && r > 0) {let e = 0,t = r;for (let l = 0; l < i.visibleColumns.length; l++) {let o = i.visibleColumns[l];o.resizable || 1 !== o.widthMode || (e += o.width), 2 === o.widthMode && (t -= Math.round(h * o.width));}let l = (o - e) / (o - t - e) || NaN;for (let e = 0; e < i.visibleColumns.length && t > 0; e++) {let t = i.visibleColumns[e];if (t.resizable || 1 !== t.widthMode) if (2 === t.widthMode) null == t.unconvertedWidth && (t.unconvertedWidth = t.width, t.unconvertedWidthMode = t.widthMode), t.width *= l;else {let i = t.actualWidth * l;t.actualWidth !== i && (t.actualWidth = i, -1 === a.indexOf(e) && a.push(e));}}}for (let e = 0; e < i.visibleColumns.length; e++) {let t = i.visibleColumns[e];if (2 === t.widthMode) {let l = Math.round(h * t.width);r -= l, n--, 0 === n && 1 === r && (l++, r--), -1 === r && (l--, r++), l !== t.actualWidth && (t.actualWidth = l, a.push(e));}}if (u) {let e = Math.max(0, r),t = u;for (let o = 0; o < i.visibleColumns.length; o++) {let r = i.visibleColumns[o];if (3 === r.widthMode) {let i = Math.max(0, Math.floor(e / t));!r.ignoreMin && i < l.minColumnWidth && (i = l.minColumnWidth), e -= i, t--, i !== r.actualWidth && (r.actualWidth = i, a.push(o));}}}if (l.autoFillLastColumn && i.visibleColumns.length) {var _l$actualWidth2;let e = 0;for (let t = 0; t < i.visibleColumns.length; t++) {var _i$visibleColumns$t$a;e += (_i$visibleColumns$t$a = i.visibleColumns[t].actualWidth) !== null && _i$visibleColumns$t$a !== void 0 ? _i$visibleColumns$t$a : 0;}const t = i.visibleColumns.length - 1,l = i.visibleColumns[t],r = o - e;r > 0 && (l.actualWidth = ((_l$actualWidth2 = l.actualWidth) !== null && _l$actualWidth2 !== void 0 ? _l$actualWidth2 : 0) + r, -1 === a.indexOf(t) && a.push(t));}if (i.visibleColumns.length && (i.visibleColumns[i.visibleColumns.length - 1].actualWidthConsideringScrollbarWidth = i.visibleColumns[i.visibleColumns.length - 1].actualWidth - (i.scrollbarWidth || 0)), (_i$notifyRendererOfCo = i.notifyRendererOfColumnsConfig) !== null && _i$notifyRendererOfCo !== void 0 && _i$notifyRendererOfCo.call(i), t) {let e = ge(this);s < e && J(this, false);for (let e = 0; e < a.length; e++) Z(this, a[e]);s > e && J(this, false);}K(this);}return this;}tableHeightChanged() {let e = this._o;if (!this._p.table) return this;let t = getElementHeight(this.el, true);return t !== e.height && (e.height = t, j(this), e.virtualTable && this.clearAndRender()), this;}hideCellPreview() {return z(this), this;}abortCellPreview() {return this.hideCellPreview(), this;}cancelColumnResize() {return A(this), this;}getUrlForElementContent(e) {let t,l = document.getElementById(e);if (l) {let e = l.textContent;if ("function" == typeof Blob) t = new Blob([e || ""]);else {const l = window,i = l.BlobBuilder || l.WebKitBlobBuilder || l.MozBlobBuilder || l.MSBlobBuilder;if (!i) return null;const o = new i();o.append(e || ""), t = o.getBlob();}return (window.URL || window.webkitURL).createObjectURL(t);}return null;}isWorkerSupported() {return window.Worker instanceof Function;}createWebWorker(e, t, l) {if (this.isWorkerSupported()) {let i = this._p,o = new Worker(e),r = (e) => {e.data.append ? this.addRows(e.data.rows, l) : this.setRows(e.data.rows, l);};return o.addEventListener("message", r, false), i.workerListeners || (i.workerListeners = []), i.workerListeners.push({ worker: o, listener: r }), (t || void 0 === t) && o.postMessage(null), o;}return null;}unbindWebWorker(e) {let t = this._p;if (t.workerListeners) for (let l = 0; l < t.workerListeners.length; l++) t.workerListeners[l].worker === e && (e.removeEventListener("message", t.workerListeners[l].listener, false), t.workerListeners.splice(l, 1), l--);return this;}}_defineProperty(We, "VERSION", "2.0.38");_defineProperty(We, "Width", _);
3857
3463
 
3858
- class DGTableJQuery extends ge {
3464
+ class DGTableJQuery extends We {
3859
3465
  constructor(options) {
3860
3466
  super(options);
3861
3467