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.es6.js CHANGED
@@ -1,5 +1,28 @@
1
1
  import jQuery from 'jquery';
2
2
 
3
+ function _defineProperty(e, r, t) {
4
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5
+ value: t,
6
+ enumerable: true,
7
+ configurable: true,
8
+ writable: true
9
+ }) : e[r] = t, e;
10
+ }
11
+ function _toPrimitive(t, r) {
12
+ if ("object" != typeof t || !t) return t;
13
+ var e = t[Symbol.toPrimitive];
14
+ if (void 0 !== e) {
15
+ var i = e.call(t, r);
16
+ if ("object" != typeof i) return i;
17
+ throw new TypeError("@@toPrimitive must return a primitive value.");
18
+ }
19
+ return ("string" === r ? String : Number)(t);
20
+ }
21
+ function _toPropertyKey(t) {
22
+ var i = _toPrimitive(t, "string");
23
+ return "symbol" == typeof i ? i : i + "";
24
+ }
25
+
3
26
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
27
 
5
28
  var es_symbol_description = {};
@@ -72,7 +95,7 @@ function requireFunctionBindNative () {
72
95
 
73
96
  functionBindNative = !fails(function () {
74
97
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
75
- var test = (function () { /* empty */ }).bind();
98
+ var test = function () { /* empty */ }.bind();
76
99
  // eslint-disable-next-line no-prototype-builtins -- safe
77
100
  return typeof test != 'function' || test.hasOwnProperty('prototype');
78
101
  });
@@ -551,10 +574,10 @@ function requireSharedStore () {
551
574
  var store = sharedStore.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
552
575
 
553
576
  (store.versions || (store.versions = [])).push({
554
- version: '3.48.0',
577
+ version: '3.50.0',
555
578
  mode: IS_PURE ? 'pure' : 'global',
556
579
  copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
557
- license: 'https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE',
580
+ license: 'https://github.com/zloirock/core-js/blob/v3.50.0/LICENSE',
558
581
  source: 'https://github.com/zloirock/core-js'
559
582
  });
560
583
  return sharedStore.exports;
@@ -567,9 +590,11 @@ function requireShared () {
567
590
  if (hasRequiredShared) return shared;
568
591
  hasRequiredShared = 1;
569
592
  var store = requireSharedStore();
593
+ // eslint-disable-next-line es/no-object-create -- safe
594
+ var create = Object.create || Object;
570
595
 
571
596
  shared = function (key, value) {
572
- return store[key] || (store[key] = value || {});
597
+ return store[key] || (store[key] = value || create(null));
573
598
  };
574
599
  return shared;
575
600
  }
@@ -907,7 +932,7 @@ function requireFunctionName () {
907
932
 
908
933
  var EXISTS = hasOwn(FunctionPrototype, 'name');
909
934
  // additional protection from minified / mangled / dropped function names
910
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
935
+ var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
911
936
  var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
912
937
 
913
938
  functionName = {
@@ -1615,6 +1640,7 @@ function requireEs_symbol_description () {
1615
1640
  var $ = require_export();
1616
1641
  var DESCRIPTORS = requireDescriptors();
1617
1642
  var globalThis = requireGlobalThis();
1643
+ var call = requireFunctionCall();
1618
1644
  var uncurryThis = requireFunctionUncurryThis();
1619
1645
  var hasOwn = requireHasOwnProperty();
1620
1646
  var isCallable = requireIsCallable();
@@ -1644,6 +1670,14 @@ function requireEs_symbol_description () {
1644
1670
  };
1645
1671
 
1646
1672
  copyConstructorProperties(SymbolWrapper, NativeSymbol);
1673
+ // wrap Symbol.for for correct handling of empty string descriptions
1674
+ var nativeFor = SymbolWrapper['for'];
1675
+ SymbolWrapper['for'] = { 'for': function (key) {
1676
+ var stringKey = toString(key);
1677
+ var symbol = call(nativeFor, this, stringKey);
1678
+ if (stringKey === '') EmptyStringDescriptionStore[symbol] = true;
1679
+ return symbol;
1680
+ } }['for'];
1647
1681
  SymbolWrapper.prototype = SymbolPrototype;
1648
1682
  SymbolPrototype.constructor = SymbolWrapper;
1649
1683
 
@@ -1889,7 +1923,9 @@ function requireEs_array_sort () {
1889
1923
  if (y === undefined) return -1;
1890
1924
  if (x === undefined) return 1;
1891
1925
  if (comparefn !== undefined) return +comparefn(x, y) || 0;
1892
- return toString(x) > toString(y) ? 1 : -1;
1926
+ var xString = toString(x);
1927
+ var yString = toString(y);
1928
+ return xString === yString ? 0 : xString > yString ? 1 : -1;
1893
1929
  };
1894
1930
  };
1895
1931
 
@@ -2386,178 +2422,86 @@ class DomEventsSink {
2386
2422
  }
2387
2423
  }
2388
2424
 
2389
- /**
2390
- * @typedef {function(index: number):(number|undefined)} VirtualListHelper~ItemHeightEstimatorFunction
2391
- */
2392
-
2393
- /**
2394
- * @typedef {function():Element} VirtualListHelper~ItemElementCreatorFunction
2395
- */
2396
-
2397
- /**
2398
- * @typedef {function(itemEl: Element, index: number)} VirtualListHelper~ItemRenderFunction
2399
- */
2400
-
2401
- /**
2402
- * @typedef {function(itemEl: Element)} VirtualListHelper~ItemUnrenderFunction
2403
- */
2404
-
2405
- /**
2406
- * @typedef {Object} VirtualListHelper~Options
2407
- * @property {Element} list - the main element to operate inside of
2408
- * @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)
2409
- * @property {boolean} [autoVirtualWrapperWidth=true] automatically set the width of the virtual wrapper
2410
- * @property {boolean} [hookScrollEvent=true] automatically hook scroll event as needed
2411
- * @property {number} [count=0] the item count
2412
- * @property {boolean} [virtual=true] is virtual mode on?
2413
- * @property {number} [estimatedItemHeight=20] estimated item height
2414
- * @property {number} [buffer=5] the amount of buffer items to keep on each end of the list
2415
- * @property {VirtualListHelper~ItemHeightEstimatorFunction} [itemHeightEstimatorFn] an optional function for providing item height estimations
2416
- * @property {VirtualListHelper~ItemElementCreatorFunction} [itemElementCreatorFn] an optional function for providing fresh item elements (default creates `<li />`s)
2417
- * @property {VirtualListHelper~ItemRenderFunction} [onItemRender] a function for rendering element content based on item index
2418
- * @property {VirtualListHelper~ItemUnrenderFunction} [onItemUnrender] a function for freeing resources in an item element
2419
- * @property {function(height: number)} [onScrollHeightChange] a function to be notified when scroll height changes
2420
- *
2421
- */
2422
-
2423
- /** */
2424
-
2425
2425
  const hasOwnProperty = Object.prototype.hasOwnProperty;
2426
-
2427
2426
  const hasInsertAdjacentElement = Element.prototype.insertAdjacentElement !== undefined;
2428
-
2429
2427
  function insertBefore(el, before, parent) {
2430
2428
  if (!before)
2431
2429
  parent.appendChild(el);else
2432
2430
  if (hasInsertAdjacentElement === false || el instanceof DocumentFragment)
2433
2431
  parent.insertBefore(el, before);else
2432
+
2434
2433
  before.insertAdjacentElement('beforebegin', el);
2435
2434
  }
2436
- /**
2437
- *
2438
- * @param {Element} itemEl
2439
- * @param {DocumentFragment|null} fragment
2440
- * @param {Node|undefined} before
2441
- * @param {Element} itemParent
2442
- * @returns {DocumentFragment|null}
2443
- */
2444
2435
  function insertBeforeWithFragment(itemEl, fragment, before, itemParent) {
2445
2436
  if (itemEl.parentNode !== itemParent) {
2446
2437
  if (!fragment)
2447
2438
  fragment = document.createDocumentFragment();
2448
2439
  fragment.appendChild(itemEl);
2449
- } else {
2440
+ } else
2441
+ {
2450
2442
  // insert fragment
2451
2443
  if (fragment && fragment.childNodes.length > 0) {
2452
2444
  insertBefore(fragment, before, itemParent);
2453
2445
  fragment = null;
2454
2446
  }
2455
-
2456
2447
  // insert element
2457
2448
  if (itemEl.nextSibling !== before) {
2458
2449
  insertBefore(itemEl, before, itemParent);
2459
2450
  }
2460
2451
  }
2461
-
2462
2452
  return fragment;
2463
2453
  }
2464
-
2465
2454
  const DestroyedSymbol = Symbol('destroyed');
2466
-
2467
2455
  class VirtualListHelper {
2468
- /**
2469
- * @param {VirtualListHelper~Options} opts
2470
- */
2471
2456
  constructor(opts) {var _opts$autoVirtualWrap;
2472
- /** @private */
2473
2457
  const p = this._p = {
2474
2458
  // these come from options:
2475
-
2476
2459
  list: opts.list || null,
2477
2460
  hookScrollEvent: opts.hookScrollEvent === undefined ? true : !!opts.hookScrollEvent,
2478
2461
  count: opts.count || 0,
2479
2462
  virtual: opts.virtual === undefined ? true : !!opts.virtual,
2480
2463
  userItemsParent: opts.itemsParent || null,
2481
- setVirtualWrapperWidth: (_opts$autoVirtualWrap = opts.autoVirtualWrapperWidth) !== null && _opts$autoVirtualWrap !== void 0 ? _opts$autoVirtualWrap : true,
2464
+ autoVirtualWrapperWidth: (_opts$autoVirtualWrap = opts.autoVirtualWrapperWidth) !== null && _opts$autoVirtualWrap !== void 0 ? _opts$autoVirtualWrap : true,
2482
2465
  estimatedItemHeight: 20,
2483
2466
  buffer: 5,
2484
-
2485
- /** @type VirtualListHelper~ItemHeightEstimatorFunction|null */
2486
2467
  itemHeightEstimatorFn: null,
2487
-
2488
- /** @type VirtualListHelper~ItemElementCreatorFunction|null */
2489
2468
  itemElementCreatorFn: defaultElementCreator,
2490
-
2491
- /** @type VirtualListHelper~ItemRenderFunction|null */
2492
2469
  onItemRender: null,
2493
-
2494
- /** @type VirtualListHelper~ItemUnrenderFunction|null */
2495
2470
  onItemUnrender: null,
2496
-
2497
- /** @type {function(height: number)|null} */
2498
2471
  onScrollHeightChange: null,
2499
-
2500
2472
  // internal:
2501
-
2502
- /** @type Element|null */
2503
2473
  virtualWrapper: null,
2504
-
2505
- /** @type Element|null */
2506
2474
  currentItemsParent: null,
2507
-
2508
- /** @type {(number|undefined)[]} */
2509
2475
  cachedItemHeights: [],
2510
-
2511
- /** @type {(number|undefined)[]} */
2512
2476
  cachedItemEstimatedHeights: [],
2513
-
2514
- /** @type {(number|undefined)[]} */
2515
2477
  cachedItemPositions: [],
2516
-
2517
- /** @type number */
2518
2478
  itemPositionsNeedsUpdate: 0,
2519
-
2520
- /** @type function */
2521
2479
  boundRender: this.render.bind(this),
2522
-
2523
- /** @type Element[] */
2524
2480
  existingEls: []
2525
2481
  };
2526
-
2527
2482
  p.currentItemsParent = p.userItemsParent || p.list;
2528
-
2529
2483
  this._hookEvents();
2530
-
2531
2484
  if (typeof opts.count === 'number')
2532
2485
  this.setCount(opts.count);
2533
-
2534
2486
  if (typeof opts.virtual === 'boolean')
2535
2487
  this.setVirtual(opts.virtual);
2536
-
2537
2488
  if (typeof opts.estimatedItemHeight === 'number')
2538
2489
  this.setEstimatedItemHeight(opts.estimatedItemHeight);
2539
-
2540
2490
  if (typeof opts.buffer === 'number')
2541
2491
  this.setBuffer(opts.buffer);
2542
-
2543
2492
  if (typeof opts.itemHeightEstimatorFn === 'function')
2544
2493
  this.setItemHeightEstimatorFn(opts.itemHeightEstimatorFn);
2545
-
2546
2494
  if (typeof opts.itemElementCreatorFn === 'function')
2547
2495
  this.setItemElementCreatorFn(opts.itemElementCreatorFn);
2548
-
2549
2496
  if (typeof opts.onItemRender === 'function')
2550
2497
  this.setOnItemRender(opts.onItemRender);
2551
-
2552
2498
  if (typeof opts.onItemUnrender === 'function')
2553
2499
  this.setOnItemUnrender(opts.onItemUnrender);
2554
-
2555
2500
  if (typeof opts.onScrollHeightChange === 'function')
2556
2501
  this.setOnScrollHeightChange(opts.onScrollHeightChange);
2557
2502
  }
2558
-
2559
- /**
2560
- * Clean up and free up all resources.
2503
+ /**
2504
+ * Clean up and free up all resources.
2561
2505
  */
2562
2506
  destroy() {
2563
2507
  if (this[DestroyedSymbol])
@@ -2565,252 +2509,178 @@ class VirtualListHelper {
2565
2509
  this[DestroyedSymbol] = true;
2566
2510
  this._unhookEvents().invalidate()._destroyElements();
2567
2511
  }
2568
-
2569
- /**
2570
- * Sets whether 'scroll' event on the list should be hooked automatically.
2571
- * @param {boolean} enabled
2572
- * @returns {VirtualListHelper}
2512
+ /**
2513
+ * Sets whether 'scroll' event on the list should be hooked automatically.
2573
2514
  */
2574
2515
  setHookScrollEvent(enabled) {
2575
2516
  const p = this._p;
2576
2517
  enabled = enabled === undefined ? true : !!enabled;
2577
-
2578
2518
  if (p.hookScrollEvent === enabled)
2579
2519
  return this;
2580
-
2581
2520
  p.hookScrollEvent = enabled;
2582
-
2583
2521
  this._unhookEvents()._hookEvents();
2584
-
2585
2522
  return this;
2586
2523
  }
2587
-
2588
- /**
2589
- * @returns {boolean} whether 'scroll' event on the list should be hooked automatically
2590
- */
2591
2524
  isHookScrollEventEnabled() {
2592
2525
  const p = this._p;
2593
2526
  return p.hookScrollEvent;
2594
2527
  }
2595
-
2596
- /**
2597
- * Sets the list item count. <br />
2598
- * You should probably call `render()` after this.
2599
- * @param {number} count
2600
- * @returns {VirtualListHelper}
2528
+ /**
2529
+ * Sets the list item count. <br />
2530
+ * You should probably call `render()` after this.
2601
2531
  */
2602
2532
  setCount(count) {
2603
2533
  const p = this._p;
2604
2534
  p.count = count;
2605
-
2606
2535
  return this.invalidate();
2607
2536
  }
2608
-
2609
- /**
2610
- * @returns {number} current item count
2611
- */
2612
2537
  getCount() {
2613
2538
  const p = this._p;
2614
2539
  return p.count;
2615
2540
  }
2616
-
2617
- /**
2618
- * Switches between virtual and non-virtual mode. <br />
2619
- * The list is invalidated automatically. <br />
2620
- * You should call `render()` to update the view.
2621
- * @param {boolean} enabled
2622
- * @returns {VirtualListHelper}
2541
+ /**
2542
+ * Switches between virtual and non-virtual mode. <br />
2543
+ * The list is invalidated automatically. <br />
2544
+ * You should call `render()` to update the view.
2623
2545
  */
2624
2546
  setVirtual(enabled) {
2625
2547
  const p = this._p;
2626
2548
  enabled = enabled === undefined ? true : !!enabled;
2627
-
2628
2549
  if (p.virtual === enabled)
2629
2550
  return this;
2630
-
2631
2551
  p.virtual = enabled;
2632
-
2633
2552
  this._hookEvents().invalidate()._destroyElements();
2634
-
2635
2553
  return this;
2636
2554
  }
2637
-
2638
- /**
2639
- * @returns {boolean} virtual mode
2640
- */
2641
2555
  isVirtual() {
2642
2556
  const p = this._p;
2643
2557
  return p.virtual;
2644
2558
  }
2645
-
2646
- /**
2647
- * Sets estimated item height. <br />
2648
- * No need to be accurate. <br />
2649
- * The better the estimation - the better the scrollbar behavior will be. <br />
2650
- * Applicable for virtual-mode only. <br />
2651
- * You should `invalidate` if you want this to take effect on the existing rendering.
2652
- * @param {number} height - a positive number representing estimated item height.
2653
- * @returns {VirtualListHelper}
2559
+ /**
2560
+ * Sets estimated item height to a positive number. <br />
2561
+ * No need to be accurate. <br />
2562
+ * The better the estimation - the better the scrollbar behavior will be. <br />
2563
+ * Applicable for virtual-mode only. <br />
2564
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2654
2565
  */
2655
2566
  setEstimatedItemHeight(height) {
2656
2567
  const p = this._p;
2657
2568
  p.estimatedItemHeight = Math.abs((typeof height === 'number' ? height : Number(height)) || 20);
2658
2569
  return this;
2659
2570
  }
2660
-
2661
- /**
2662
- * @returns {number} current item height estimation
2663
- */
2664
2571
  getEstimatedItemHeight() {
2665
2572
  const p = this._p;
2666
2573
  return p.estimatedItemHeight;
2667
2574
  }
2668
-
2669
- /**
2670
- * Sets whether the virtual wrapper width should be set automatically. <br />
2671
- * @param {boolean} enabled
2672
- * @returns {VirtualListHelper}
2575
+ /**
2576
+ * Sets whether the virtual wrapper width should be set automatically. <br />
2673
2577
  */
2674
2578
  setAutoVirtualWrapperWidth(enabled) {
2675
2579
  const p = this._p;
2676
2580
  p.autoVirtualWrapperWidth = enabled === undefined ? true : !!enabled;
2677
-
2678
2581
  if (p.virtualWrapper) {
2679
2582
  if (p.autoVirtualWrapperWidth !== p.virtualWrapperWidthWasSet) {
2680
2583
  p.virtualWrapper.style.width = p.autoVirtualWrapperWidth ? '100%' : '';
2681
2584
  p.virtualWrapperWidthWasSet = p.autoVirtualWrapperWidth;
2682
2585
  }
2683
2586
  }
2684
-
2685
2587
  return this;
2686
2588
  }
2687
-
2688
- /**
2689
- * @returns {boolean} whether the virtual wrapper width should be set automatically
2690
- */
2691
2589
  isAutoVirtualWrapperWidth() {
2692
2590
  const p = this._p;
2693
2591
  return p.autoVirtualWrapperWidth;
2694
2592
  }
2695
-
2696
- /**
2697
- * Sets the amount of buffer items to keep on each end of the list. <br />
2698
- * Applicable for virtual-mode only.
2699
- * @param {number} buffer - a positive value representing the count of buffer items for each end.
2700
- * @returns {VirtualListHelper}
2593
+ /**
2594
+ * The buffer is a positive count of items on each end.
2595
+ * Sets the amount of buffer items to keep on each end of the list. <br />
2596
+ * Applicable for virtual-mode only.
2701
2597
  */
2702
2598
  setBuffer(buffer) {
2703
2599
  const p = this._p;
2704
2600
  p.buffer = Math.abs(typeof buffer === 'number' ? buffer : Number(buffer) || 5);
2705
2601
  return this;
2706
2602
  }
2707
-
2708
- /**
2709
- * @returns {number} current buffer value
2710
- */
2711
2603
  getBuffer() {
2712
2604
  const p = this._p;
2713
2605
  return p.buffer;
2714
2606
  }
2715
-
2716
- /**
2717
- * The `itemHeightEstimatorFn` is an alternative to `estimatedItemHeight` to give better estimations for specific item. <br/>
2718
- * It's optional, and if it's present - it should return either a numeric height estimation,
2719
- * or `undefined` to fall back to the default estimation. <br />
2720
- * You should `invalidate` if you want this to take effect on the existing rendering.
2721
- * @param {VirtualListHelper~ItemHeightEstimatorFunction} fn
2722
- * @returns {VirtualListHelper}
2607
+ /**
2608
+ * The `itemHeightEstimatorFn` is an alternative to `estimatedItemHeight` to give better estimations for specific item. <br/>
2609
+ * It's optional, and if it's present - it should return either a numeric height estimation,
2610
+ * or `undefined` to fall back to the default estimation. <br />
2611
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2723
2612
  */
2724
2613
  setItemHeightEstimatorFn(fn) {
2725
2614
  const p = this._p;
2726
2615
  p.itemHeightEstimatorFn = fn;
2727
2616
  return this;
2728
2617
  }
2729
-
2730
- /**
2731
- * The `itemElementCreatorFn` is a function creating a basic item element, that will be possibly reused later. <br />
2732
- * It has no association with a specific item index. <br />
2733
- * You should `invalidate` if you want this to take effect on the existing rendering.
2734
- * @param {VirtualListHelper~ItemElementCreatorFunction} fn
2735
- * @returns {VirtualListHelper}
2618
+ /**
2619
+ * The `itemElementCreatorFn` is a function creating a basic item element, that will be possibly reused later. <br />
2620
+ * It has no association with a specific item index. <br />
2621
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2736
2622
  */
2737
2623
  setItemElementCreatorFn(fn) {
2738
2624
  const p = this._p;
2739
2625
  p.itemElementCreatorFn = fn || defaultElementCreator;
2740
2626
  return this;
2741
2627
  }
2742
-
2743
- /**
2744
- * The `onItemRender` is a function called for rendering the contents of an item. <br />
2745
- * It's passed an `Element` and an item index. <br />
2746
- * You should `invalidate` if you want this to take effect on the existing rendering.
2747
- * @param {VirtualListHelper~ItemRenderFunction} fn
2748
- * @returns {VirtualListHelper}
2628
+ /**
2629
+ * The `onItemRender` is a function called for rendering the contents of an item. <br />
2630
+ * It's passed an `Element` and an item index. <br />
2631
+ * You should `invalidate` if you want this to take effect on the existing rendering.
2749
2632
  */
2750
2633
  setOnItemRender(fn) {
2751
2634
  const p = this._p;
2752
2635
  p.onItemRender = fn;
2753
2636
  return this;
2754
2637
  }
2755
-
2756
- /**
2757
- * The `onItemUnrender` is a function called for freeing resources in an item element,
2758
- * if you've attached something that needs to be explicitly freed. <br />
2759
- * It's passed an `Element` only, and has no association with a specific index,
2760
- * as by the time it's called - the indexes are probably not valid anymore.
2761
- * @param {VirtualListHelper~ItemUnrenderFunction} fn
2762
- * @returns {VirtualListHelper}
2638
+ /**
2639
+ * The `onItemUnrender` is a function called for freeing resources in an item element,
2640
+ * if you've attached something that needs to be explicitly freed. <br />
2641
+ * It's passed an `Element` only, and has no association with a specific index,
2642
+ * as by the time it's called - the indexes are probably not valid anymore.
2763
2643
  */
2764
2644
  setOnItemUnrender(fn) {
2765
2645
  const p = this._p;
2766
2646
  p.onItemUnrender = fn;
2767
2647
  return this;
2768
2648
  }
2769
-
2770
- /**
2771
- * The `onScrollHeightChange` is a function called when the scroll height changes.
2772
- * @param {function(height: number)} fn
2773
- * @returns {VirtualListHelper}
2649
+ /**
2650
+ * The `onScrollHeightChange` is a function called when the scroll height changes.
2774
2651
  */
2775
2652
  setOnScrollHeightChange(fn) {
2776
2653
  const p = this._p;
2777
2654
  p.onScrollHeightChange = fn;
2778
2655
  return this;
2779
2656
  }
2780
-
2781
- /**
2782
- * Estimates the full scroll height. This gets better as more renderings occur.
2783
- * @returns {number}
2657
+ /**
2658
+ * Estimates the full scroll height. This gets better as more renderings occur.
2784
2659
  */
2785
2660
  estimateFullHeight() {
2786
2661
  const p = this._p;
2787
-
2788
2662
  if (p.count === 0)
2789
2663
  return 0;
2790
-
2791
2664
  if (p.virtual) {
2792
2665
  return this._calculateItemPosition(p.count) || 0;
2793
- } else {
2666
+ } else
2667
+ {
2794
2668
  const existingEls = p.existingEls;
2795
2669
  if (p.count === existingEls.length) {
2796
2670
  let rect1 = existingEls[0].getBoundingClientRect();
2797
2671
  let rect2 = existingEls[existingEls.length - 1].getBoundingClientRect();
2798
2672
  return rect2.top - rect1.top + rect2.height;
2799
2673
  }
2800
-
2801
2674
  return this._calculateItemPosition(p.count) || 0;
2802
2675
  }
2803
2676
  }
2804
-
2805
- /**
2806
- * States that the cached positions/heights are invalid,
2807
- * and needs to be completely re-calculated.<br />
2808
- * You should probably call `render()` after this.
2809
- * @returns {VirtualListHelper}
2677
+ /**
2678
+ * States that the cached positions/heights are invalid,
2679
+ * and needs to be completely re-calculated.<br />
2680
+ * You should probably call `render()` after this.
2810
2681
  */
2811
2682
  invalidatePositions() {
2812
2683
  const p = this._p;
2813
-
2814
2684
  p.itemPositionsNeedsUpdate = 0;
2815
2685
  p.cachedItemHeights = [];
2816
2686
  p.cachedItemEstimatedHeights = [];
@@ -2818,40 +2688,31 @@ class VirtualListHelper {
2818
2688
  p.cachedItemHeights.length = p.count;
2819
2689
  p.cachedItemEstimatedHeights.length = p.count;
2820
2690
  p.cachedItemPositions.length = p.count;
2821
-
2822
2691
  return this;
2823
2692
  }
2824
-
2825
- /**
2826
- * States that the indexes/item count/rendered content are invalid,
2827
- * and needs to be completely re-calculated and re-rendered. <br />
2828
- * You should probably call `render()` after this.
2829
- * @returns {VirtualListHelper}
2693
+ /**
2694
+ * States that the indexes/item count/rendered content are invalid,
2695
+ * and needs to be completely re-calculated and re-rendered. <br />
2696
+ * You should probably call `render()` after this.
2830
2697
  */
2831
2698
  invalidate() {
2832
2699
  const p = this._p;
2833
-
2834
2700
  this.invalidatePositions();
2835
-
2836
2701
  if (!p.virtual) {
2837
2702
  this._destroyElements();
2838
2703
  }
2839
-
2840
2704
  for (let el of p.existingEls)
2841
2705
  delete el[ItemIndexSymbol];
2842
-
2843
2706
  return this;
2844
2707
  }
2845
-
2846
- /**
2847
- * Renders the current viewport. <br />
2848
- * Call this after making changes to the list. <br />
2849
- * In virtual mode, this is called automatically for every scroll event.
2708
+ /**
2709
+ * Renders the current viewport. <br />
2710
+ * Call this after making changes to the list. <br />
2711
+ * In virtual mode, this is called automatically for every scroll event.
2850
2712
  */
2851
2713
  render() {
2852
2714
  if (this[DestroyedSymbol])
2853
2715
  return;
2854
-
2855
2716
  const p = this._p;
2856
2717
  const list = p.list;
2857
2718
  const virtual = p.virtual;
@@ -2865,210 +2726,158 @@ class VirtualListHelper {
2865
2726
  let onItemUnrender = p.onItemUnrender;
2866
2727
  let existingEls = p.existingEls;
2867
2728
  let existingCount = existingEls.length;
2868
-
2869
2729
  if (virtual) {
2870
2730
  const originalWidth = list.clientWidth;
2871
-
2872
2731
  if (!virtualWrapper) {
2873
2732
  virtualWrapper = p.virtualWrapper = p.userItemsParent;
2874
2733
  if (!virtualWrapper) {
2875
2734
  virtualWrapper = p.virtualWrapper = document.createElement('div');
2876
2735
  list.appendChild(virtualWrapper);
2877
2736
  }
2878
-
2879
2737
  this._resetCurrentItemsParent();
2880
2738
  itemParent = p.currentItemsParent;
2881
-
2882
2739
  if (p.autoVirtualWrapperWidth) {
2883
2740
  virtualWrapper.style.width = '100%';
2884
2741
  p.virtualWrapperWidthWasSet = true;
2885
- } else {
2742
+ } else
2743
+ {
2886
2744
  p.virtualWrapperWidthWasSet = false;
2887
2745
  }
2888
2746
  }
2889
-
2890
2747
  // Mark all of them for potential reuse
2891
2748
  for (let i = 0; i < existingCount; i++) {
2892
2749
  existingEls[i][ReuseElSymbol] = true;
2893
2750
  }
2894
-
2895
2751
  // Make sure we have at least estimated positions for all items so we can translate scroll position
2896
2752
  this._calculateItemPosition(p.count - 1);
2897
-
2898
2753
  // Find existing elements index range
2899
2754
  let existingRange = this._getExistingElsRange();
2900
-
2901
2755
  // Find first visible element
2902
2756
  let firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop);
2903
2757
  let firstRenderIndex = Math.max(0, firstVisibleIndex - buffer);
2904
-
2905
2758
  // Iterate over viewport
2906
2759
  let index = firstRenderIndex;
2907
2760
  let renderPos = this._calculateItemPosition(index);
2908
2761
  let bufferEnd = buffer;
2909
-
2910
2762
  // we want to render until viewport's bottom + buffer items
2911
2763
  let maxIndexToRender = Math.max(index, binarySearchPosition(p.cachedItemPositions, visibleBottom - 1) + 1 + buffer);
2912
-
2913
2764
  let insertedItems = [];
2914
-
2915
- /** @type DocumentFragment|null */
2916
2765
  let fragment = null;
2917
-
2918
2766
  // Find the element to insert before
2919
2767
  let before = virtualWrapper.childNodes[0];
2920
-
2921
2768
  const findElementToReuse = function (index) {
2922
2769
  // Find existing element to reuse
2923
- /** @type Element|undefined */
2924
2770
  let existingEl = undefined;
2925
-
2926
2771
  if (existingRange.firstIndex !== -1 && index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
2927
2772
  existingEl = existingEls.find((x) => x[ItemIndexSymbol] === index && x[ReuseElSymbol] === true);
2928
2773
  }
2929
-
2930
2774
  if (existingEl === undefined) {
2931
2775
  existingEl = (existingRange.firstIndex < firstRenderIndex || existingRange.firstValidArrayIndex > 0 ?
2932
- existingEls.find((x) =>
2933
- (x[ItemIndexSymbol] < firstRenderIndex || false === hasOwnProperty.call(x, ItemIndexSymbol)) &&
2776
+ existingEls.find((x) => (x[ItemIndexSymbol] < firstRenderIndex || false === hasOwnProperty.call(x, ItemIndexSymbol)) &&
2934
2777
  x[ReuseElSymbol] === true) :
2935
- undefined) ||
2936
- findLast(existingEls, (x) => x[ReuseElSymbol] === true);
2778
+ undefined) || findLast(existingEls, (x) => x[ReuseElSymbol] === true);
2937
2779
  }
2938
-
2939
2780
  if (existingEl !== undefined) {
2940
2781
  delete existingEl[ReuseElSymbol];
2941
2782
  }
2942
-
2943
2783
  return existingEl;
2944
2784
  };
2945
-
2946
2785
  // First we iterate and try to add all at once in a fragment, as much as we can.
2947
2786
  // And then reflow the at once.
2948
2787
  for (; index < count && index < maxIndexToRender; index++) {
2949
2788
  let existingEl = findElementToReuse(index);
2950
-
2951
2789
  if (before && before === existingEl)
2952
2790
  before = before.nextSibling;
2953
-
2954
2791
  // Dequeue the element by reusing or creating a new one
2955
2792
  const itemEl = this._dequeueElementForIndex(existingEl, index, before, true);
2956
2793
  insertedItems.push([itemEl, index]);
2957
-
2958
2794
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
2959
2795
  }
2960
-
2961
2796
  // Insert any remaining fragment
2962
2797
  if (fragment && fragment.childNodes.length > 0) {
2963
2798
  insertBefore(fragment, before, itemParent);
2964
2799
  }
2965
-
2966
2800
  // Iterate on inserted items and reflow them
2967
2801
  for (let item of insertedItems) {
2968
2802
  const index = item[1];
2969
2803
  this._insertItemAndFlow(item[0], index, false /* inserted already */);
2970
2804
  renderPos = p.cachedItemPositions[index] + p.cachedItemHeights[index];
2971
2805
  }
2972
-
2973
2806
  // See if we still need to insert more items
2974
2807
  if (renderPos < visibleBottom) {
2975
2808
  for (; (renderPos < visibleBottom || bufferEnd-- > 0) && index < count; index++) {
2976
2809
  let existingEl = findElementToReuse(index);
2977
-
2978
2810
  if (before && before === existingEl)
2979
2811
  before = before.nextSibling;
2980
-
2981
2812
  // Dequeue the element by reusing or creating a new one
2982
2813
  this._dequeueElementForIndex(existingEl, index, before, false);
2983
-
2984
2814
  // Increment pointers
2985
2815
  renderPos = p.cachedItemPositions[index] + p.cachedItemHeights[index];
2986
2816
  }
2987
2817
  }
2988
-
2989
2818
  // Calculate up-to-date scroll height
2990
2819
  let scrollHeight = this.estimateFullHeight();
2991
2820
  let scrollHeightPx = scrollHeight + 'px';
2992
-
2993
2821
  if (virtualWrapper.style.height !== scrollHeightPx) {var _p$onScrollHeightChan;
2994
2822
  virtualWrapper.style.height = scrollHeightPx;
2995
2823
  (_p$onScrollHeightChan = p.onScrollHeightChange) === null || _p$onScrollHeightChan === void 0 || _p$onScrollHeightChan.call(p, scrollHeight);
2996
2824
  }
2997
-
2998
2825
  if (originalWidth !== list.clientWidth)
2999
2826
  this.render();
3000
- } else {// non-virtual
2827
+ } else
2828
+ {// non-virtual
3001
2829
  if (count !== existingEls.length) {
3002
2830
  for (let i = 0; i < existingCount; i++) {
3003
2831
  existingEls[i][ReuseElSymbol] = true;
3004
2832
  }
3005
-
3006
2833
  // Find the element to insert before
3007
2834
  let before = itemParent.childNodes[0];
3008
-
3009
- /** @type DocumentFragment|null */
3010
2835
  let fragment = null;
3011
-
3012
2836
  for (let index = 0; index < count; index++) {
3013
2837
  // Find existing element to reuse
3014
2838
  let existingEl = existingEls.find((x) => x[ItemIndexSymbol] === index && x[ReuseElSymbol] === true);
3015
-
3016
2839
  if (existingEl !== undefined) {
3017
2840
  delete existingEl[ReuseElSymbol];
3018
2841
  }
3019
-
3020
2842
  if (before && before === existingEl)
3021
2843
  before = before.nextSibling;
3022
-
3023
2844
  // Dequeue the element by reusing or creating a new one
3024
2845
  const itemEl = this._dequeueElementForIndex(existingEl, index, before, true);
3025
-
3026
2846
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
3027
2847
  }
3028
-
3029
2848
  // Insert any remaining fragment
3030
2849
  if (fragment && fragment.childNodes.length > 0) {
3031
2850
  insertBefore(fragment, before, itemParent);
3032
2851
  }
3033
2852
  }
3034
2853
  }
3035
-
3036
2854
  // Cleanup extra unused elements
3037
2855
  existingCount = existingEls.length; // May have changed
3038
2856
  for (let i = 0; i < existingCount; i++) {
3039
2857
  const el = existingEls[i];
3040
- if (el[ReuseElSymbol] !== true) continue;
3041
-
2858
+ if (el[ReuseElSymbol] !== true)
2859
+ continue;
3042
2860
  let parent = el.parentNode;
3043
2861
  if (parent)
3044
2862
  parent.removeChild(el);
3045
2863
  if (onItemUnrender && el[ItemIndexSymbol] !== undefined)
3046
2864
  onItemUnrender(el);
3047
2865
  existingEls.splice(i, 1);
3048
-
3049
2866
  i--;
3050
2867
  existingCount--;
3051
2868
  }
3052
2869
  }
3053
-
3054
- /**
3055
- * States that items were added at a certain position in the list. <br />
3056
- * Virtual mode: Call `render()` to update the view after making changes.
3057
- * @param {number} count
3058
- * @param {number} [atIndex=-1]
3059
- * @returns {VirtualListHelper}
2870
+ /**
2871
+ * States that items were added at a certain position in the list. <br />
2872
+ * Virtual mode: Call `render()` to update the view after making changes.
3060
2873
  */
3061
2874
  addItemsAt(count, atIndex = -1) {
3062
2875
  if (typeof count !== 'number' || count <= 0)
3063
2876
  return this;
3064
-
3065
2877
  const p = this._p;
3066
-
3067
2878
  if (atIndex < 0 || atIndex >= p.count)
3068
2879
  atIndex = p.count;
3069
-
3070
2880
  p.count += count;
3071
-
3072
2881
  if (p.virtual) {
3073
2882
  if (atIndex >= 0 && atIndex < p.count) {
3074
2883
  this._invalidateItemIndexesAt(atIndex, -1);
@@ -3079,54 +2888,36 @@ class VirtualListHelper {
3079
2888
  let existingCount = existingEls.length;
3080
2889
  if (existingCount !== p.count - count)
3081
2890
  return this;
3082
-
3083
2891
  let existingRange = this._getExistingElsRange();
3084
2892
  if (existingRange.firstValidArrayIndex === -1)
3085
2893
  return this;
3086
-
3087
2894
  const itemParent = p.currentItemsParent;
3088
-
3089
2895
  let startIndex = existingRange.firstValidArrayIndex + atIndex - existingRange.firstIndex;
3090
-
3091
2896
  this._pushItemIndexesAt(atIndex, count);
3092
-
3093
- /** @type Node|undefined */
3094
2897
  let before = existingEls[startIndex - 1] ?
3095
2898
  existingEls[startIndex - 1].nextSibling :
3096
2899
  existingEls[0];
3097
-
3098
- /** @type DocumentFragment|null */
3099
2900
  let fragment = null;
3100
-
3101
2901
  for (let index = atIndex, end = atIndex + count; index < end; index++) {
3102
2902
  const itemEl = this._dequeueElementForIndex(undefined, index, before, true);
3103
2903
  fragment = insertBeforeWithFragment(itemEl, fragment, before, itemParent);
3104
2904
  }
3105
-
3106
2905
  // Insert any remaining fragment
3107
2906
  if (fragment && fragment.childNodes.length > 0) {
3108
2907
  insertBefore(fragment, before, itemParent);
3109
2908
  }
3110
2909
  }
3111
-
3112
2910
  return this;
3113
2911
  }
3114
-
3115
- /**
3116
- * States that items were removed at a certain position in the list. <br />
3117
- * Virtual mode: Call `render()` to update the view after making changes.
3118
- * @param {number} count
3119
- * @param {number} atIndex
3120
- * @returns {VirtualListHelper}
2912
+ /**
2913
+ * States that items were removed at a certain position in the list. <br />
2914
+ * Virtual mode: Call `render()` to update the view after making changes.
3121
2915
  */
3122
2916
  removeItemsAt(count, atIndex) {
3123
2917
  const p = this._p;
3124
-
3125
2918
  if (typeof count !== 'number' || typeof atIndex !== 'number' || count <= 0 || atIndex < 0 || atIndex >= p.count)
3126
2919
  return this;
3127
-
3128
2920
  p.count -= Math.min(count, p.count - atIndex);
3129
-
3130
2921
  if (p.virtual) {
3131
2922
  this._invalidateItemIndexesAt(atIndex, -1);
3132
2923
  } else
@@ -3135,19 +2926,15 @@ class VirtualListHelper {
3135
2926
  let existingCount = existingEls.length;
3136
2927
  if (existingCount !== p.count + count)
3137
2928
  return this;
3138
-
3139
2929
  let existingRange = this._getExistingElsRange();
3140
2930
  if (existingRange.firstValidArrayIndex === -1)
3141
2931
  return this;
3142
-
3143
2932
  this._pushItemIndexesAt(atIndex + count, -count);
3144
-
3145
2933
  const onItemUnrender = p.onItemUnrender;
3146
2934
  let index = existingRange.firstValidArrayIndex + atIndex - existingRange.firstIndex;
3147
2935
  if (index < existingEls.length) {
3148
2936
  for (let i = 0; i < count; i++) {
3149
2937
  let itemEl = existingEls[index + i];
3150
-
3151
2938
  let parent = itemEl.parentNode;
3152
2939
  if (parent)
3153
2940
  parent.removeChild(itemEl);
@@ -3157,23 +2944,17 @@ class VirtualListHelper {
3157
2944
  existingEls.splice(index, count);
3158
2945
  }
3159
2946
  }
3160
-
3161
2947
  return this;
3162
2948
  }
3163
-
3164
- /**
3165
- * Mark an element for a re-render. <br />
3166
- * Virtual mode: Call `render()` to update the view after making changes. <br />
3167
- * Non-virtual mode - the element is re-rendered immediately.
3168
- * @param {number} index - the index of the element to re-render
3169
- * @returns {VirtualListHelper}
2949
+ /**
2950
+ * Mark an element for a re-render. <br />
2951
+ * Virtual mode: Call `render()` to update the view after making changes. <br />
2952
+ * Non-virtual mode - the element is re-rendered immediately.
3170
2953
  */
3171
2954
  refreshItemAt(index) {
3172
2955
  const p = this._p;
3173
-
3174
2956
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3175
2957
  return this;
3176
-
3177
2958
  if (p.virtual) {
3178
2959
  this._invalidateItemIndexesAt(index, 1);
3179
2960
  } else
@@ -3182,128 +2963,93 @@ class VirtualListHelper {
3182
2963
  let existingCount = existingEls.length;
3183
2964
  if (existingCount !== p.count)
3184
2965
  return this;
3185
-
3186
2966
  let existingRange = this._getExistingElsRange();
3187
-
3188
2967
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3189
2968
  let itemEl = existingEls[existingRange.firstValidArrayIndex + index - existingRange.firstIndex];
3190
2969
  delete itemEl[ItemIndexSymbol];
3191
2970
  this._dequeueElementForIndex(itemEl, index, itemEl.nextSibling, false);
3192
2971
  }
3193
2972
  }
3194
-
3195
2973
  return this;
3196
2974
  }
3197
-
3198
- /**
3199
- * Tests whether an item at the specified index is rendered.
3200
- * @param {number} index - the index to test
3201
- * @returns {boolean}
2975
+ /**
2976
+ * Tests whether an item at the specified index is rendered.
3202
2977
  */
3203
2978
  isItemRendered(index) {
3204
2979
  const p = this._p;
3205
-
3206
2980
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3207
2981
  return false;
3208
-
3209
2982
  let existingRange = this._getExistingElsRange();
3210
-
3211
2983
  return index >= existingRange.firstIndex && index <= existingRange.lastIndex;
3212
2984
  }
3213
-
3214
- /**
3215
- * Retrieves DOM element for the item at the specified index - if it's currently rendered.
3216
- * @param {number} index - the index to retrieve
3217
- * @returns {Element|undefined}
2985
+ /**
2986
+ * Retrieves DOM element for the item at the specified index - if it's currently rendered.
3218
2987
  */
3219
2988
  getItemElementAt(index) {
3220
2989
  const p = this._p;
3221
-
3222
2990
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3223
2991
  return undefined;
3224
-
3225
2992
  let existingEls = p.existingEls;
3226
2993
  let existingRange = this._getExistingElsRange();
3227
-
3228
2994
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3229
2995
  return existingEls[existingRange.firstValidArrayIndex + index - existingRange.firstIndex];
3230
2996
  }
3231
-
3232
2997
  return undefined;
3233
2998
  }
3234
-
3235
- /**
3236
- * Retrieves the position for the specified index. <br />
3237
- * Can be used to scroll to a specific item.
3238
- * @param {number} index
3239
- * @returns {number|undefined}
2999
+ /**
3000
+ * Retrieves the position for the specified index. <br />
3001
+ * Can be used to scroll to a specific item.
3240
3002
  */
3241
3003
  getItemPosition(index) {
3242
3004
  const p = this._p;
3243
-
3244
3005
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3245
3006
  return undefined;
3246
-
3247
3007
  if (p.virtual) {
3248
3008
  return this._calculateItemPosition(index);
3249
- } else {
3009
+ } else
3010
+ {
3250
3011
  let itemEl = this.getItemElementAt(index);
3251
3012
  if (itemEl === undefined)
3252
3013
  return undefined;
3253
-
3254
3014
  const list = p.list;
3255
3015
  return getElementOffset(itemEl).top - getElementOffset(list).top + list.scrollTop;
3256
3016
  }
3257
3017
  }
3258
-
3259
- /**
3260
- * Retrieves the item index for the specified element
3261
- * @param {Element} el
3262
- * @returns {number|undefined}
3018
+ /**
3019
+ * Retrieves the item index for the specified element
3263
3020
  */
3264
3021
  getItemIndexFromElement(el) {
3265
3022
  return el ? el[ItemIndexSymbol] : undefined;
3266
3023
  }
3267
-
3268
- /**
3269
- * Retrieves the size (or estimated size, if unknown) for the specified index. <br />
3270
- * @param {number} index
3271
- * @returns {number|undefined}
3024
+ /**
3025
+ * Retrieves the size (or estimated size, if unknown) for the specified index. <br />
3272
3026
  */
3273
3027
  getItemSize(index) {
3274
3028
  const p = this._p;
3275
-
3276
3029
  if (typeof index !== 'number' || index < 0 || index >= p.count)
3277
3030
  return undefined;
3278
-
3279
- let height = p.cachedItemHeights[index - 1]; // already calculated
3280
-
3031
+ let height = p.cachedItemHeights[index]; // already calculated
3281
3032
  if (height === undefined) {
3282
- height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index - 1) : null; // estimated per item
3283
-
3033
+ height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index) : null; // estimated per item
3284
3034
  if (typeof height !== 'number')
3285
3035
  height = p.estimatedItemHeight; // estimated
3286
-
3287
- p.cachedItemEstimatedHeights[index - 1] = height;
3036
+ p.cachedItemEstimatedHeights[index] = height;
3288
3037
  }
3289
-
3290
3038
  return height;
3291
3039
  }
3292
-
3293
- /**
3294
- * Retrieves the number of items that fit into the current viewport.
3295
- * @returns {number}
3040
+ /**
3041
+ * Retrieves the number of items that fit into the current viewport.
3296
3042
  */
3297
3043
  getVisibleItemCount() {
3298
3044
  const p = this._p,list = p.list;
3299
-
3300
3045
  let scrollTop = list.scrollTop;
3301
3046
  let visibleHeight = list.clientHeight;
3302
3047
  let firstVisibleIndex, lastVisibleIndex;
3303
-
3048
+ if (p.count === 0 || visibleHeight === 0)
3049
+ return 0;
3304
3050
  if (p.virtual) {
3305
- firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop);
3306
- lastVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop + visibleHeight, firstVisibleIndex);
3051
+ firstVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop, 0, p.count - 1);
3052
+ lastVisibleIndex = binarySearchPosition(p.cachedItemPositions, scrollTop + visibleHeight, firstVisibleIndex, p.count - 1);
3307
3053
  } else
3308
3054
  {
3309
3055
  const retriever = (i) => {
@@ -3312,32 +3058,28 @@ class VirtualListHelper {
3312
3058
  pos = Infinity;
3313
3059
  return pos;
3314
3060
  };
3315
-
3316
3061
  firstVisibleIndex = binarySearchPositionByFn(p.count, retriever, scrollTop);
3317
3062
  lastVisibleIndex = binarySearchPositionByFn(p.count, retriever, scrollTop + visibleHeight, firstVisibleIndex);
3318
3063
  }
3319
-
3320
3064
  if (this.getItemPosition(lastVisibleIndex) === scrollTop + visibleHeight)
3321
3065
  lastVisibleIndex--;
3322
3066
  return lastVisibleIndex - firstVisibleIndex + 1;
3323
3067
  }
3324
-
3325
- /**
3326
- * Renders a temporary ghost item. Can be used for testings several aspects of a proposed element, i.e measurements.
3327
- * @param {*} ghostIndex - the value to pass as the index for the renderer function
3328
- * @param {boolean} append - whether to append the item element to the DOM
3329
- * @param {function(itemEl: Element)} ghostTester - the function that will receive the element, called synchronously.
3068
+ /**
3069
+ * The ghost index is passed directly to the renderer. The tester is called synchronously.
3070
+ * Appends the element to the DOM only when append is true.
3071
+ * Renders a temporary ghost item. Can be used for testings several aspects of a proposed element, i.e measurements.
3330
3072
  */
3331
3073
  createGhostItemElement(ghostIndex, append, ghostTester) {
3332
3074
  const p = this._p;
3333
-
3334
3075
  let itemEl = this._dequeueElementForIndex(null, ghostIndex, false, true);
3335
3076
  try {
3336
3077
  if (append) {
3337
3078
  p.currentItemsParent.appendChild(itemEl);
3338
3079
  }
3339
3080
  ghostTester(itemEl);
3340
- } finally {
3081
+ } finally
3082
+ {
3341
3083
  if (append) {
3342
3084
  let parent = itemEl.parentNode;
3343
3085
  if (parent)
@@ -3347,38 +3089,30 @@ class VirtualListHelper {
3347
3089
  p.onItemUnrender(itemEl);
3348
3090
  }
3349
3091
  }
3350
-
3351
- /**
3352
- * Reset the pointer to the current items wrapper
3353
- * @private
3092
+ /**
3093
+ * Reset the pointer to the current items wrapper
3354
3094
  */
3355
3095
  _resetCurrentItemsParent() {var _ref, _p$virtualWrapper;
3356
3096
  const p = this._p;
3357
3097
  p.currentItemsParent = (_ref = (_p$virtualWrapper = p.virtualWrapper) !== null && _p$virtualWrapper !== void 0 ? _p$virtualWrapper : p.userItemsParent) !== null && _ref !== void 0 ? _ref : p.list;
3358
3098
  }
3359
-
3360
- /**
3361
- * Destroy all created elements, for cleanup
3362
- * @returns {VirtualListHelper}
3363
- * @private
3099
+ /**
3100
+ * Destroy all created elements, for cleanup
3364
3101
  */
3365
3102
  _destroyElements() {
3366
3103
  const p = this._p;
3367
3104
  const onItemUnrender = p.onItemUnrender;
3368
3105
  const existingEls = p.existingEls;
3369
-
3370
3106
  for (let i = 0; i < existingEls.length; i++) {
3371
3107
  const el = existingEls[i];
3372
-
3373
3108
  let parent = el.parentNode;
3374
3109
  if (parent)
3375
3110
  parent.removeChild(el);
3376
- if (onItemUnrender && el[ItemIndexSymbol] !== undefined)
3111
+ // Invalidation clears index metadata, but the element still owns rendered resources.
3112
+ if (onItemUnrender)
3377
3113
  onItemUnrender(el);
3378
3114
  }
3379
-
3380
3115
  existingEls.length = 0;
3381
-
3382
3116
  if (p.virtualWrapper) {
3383
3117
  if (p.virtualWrapper !== p.userItemsParent) {
3384
3118
  if (p.virtualWrapper.parentNode) {
@@ -3388,203 +3122,135 @@ class VirtualListHelper {
3388
3122
  p.virtualWrapper = null;
3389
3123
  this._resetCurrentItemsParent();
3390
3124
  }
3391
-
3392
3125
  return this;
3393
3126
  }
3394
-
3395
- /**
3396
- * Marks (an) item(s) at specific index(es) as to be re-rendered. <br />
3397
- * Applicable for virtual mode only.
3398
- * @param {number} index
3399
- * @param {number} count
3400
- * @private
3127
+ /**
3128
+ * Marks (an) item(s) at specific index(es) as to be re-rendered. <br />
3129
+ * Applicable for virtual mode only.
3401
3130
  */
3402
3131
  _invalidateItemIndexesAt(index, count) {
3403
3132
  const p = this._p;
3404
-
3405
3133
  this._setItemPositionsNeedsUpdate(index);
3406
-
3407
3134
  let existingEls = p.existingEls;
3408
3135
  let existingCount = existingEls.length;
3409
3136
  let existingRange = this._getExistingElsRange();
3410
-
3411
3137
  if (existingRange.firstValidArrayIndex === -1)
3412
3138
  return;
3413
-
3414
3139
  if (count === -1)
3415
3140
  count = existingEls.length;
3416
-
3417
3141
  // Clean
3418
3142
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3419
- for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex,
3420
- c = 0;
3421
- i < existingCount && c < count;
3422
- i++, c++)
3143
+ for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex, c = 0; i < existingCount && c < count; i++, c++)
3423
3144
  delete existingEls[i][ItemIndexSymbol];
3424
3145
  }
3425
3146
  }
3426
-
3427
- /**
3428
- * In/decrement the item-index marker for specific item(s). <br />
3429
- * Used for inserting/removing items in the middle of the list, without re-rendering everything. <br />
3430
- * Applicable for non-virtual mode only.
3431
- * @param {number} index
3432
- * @param {number} count
3433
- * @private
3147
+ /**
3148
+ * In/decrement the item-index marker for specific item(s). <br />
3149
+ * Used for inserting/removing items in the middle of the list, without re-rendering everything. <br />
3150
+ * Applicable for non-virtual mode only.
3434
3151
  */
3435
3152
  _pushItemIndexesAt(index, count) {
3436
3153
  const p = this._p;
3437
-
3438
3154
  let existingEls = p.existingEls;
3439
3155
  let existingCount = existingEls.length;
3440
3156
  let existingRange = this._getExistingElsRange();
3441
-
3442
3157
  if (existingRange.firstValidArrayIndex === -1)
3443
3158
  return;
3444
-
3445
3159
  // Clean
3446
3160
  if (index >= existingRange.firstIndex && index <= existingRange.lastIndex) {
3447
- for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex;
3448
- i < existingCount;
3449
- i++)
3161
+ for (let i = existingRange.firstValidArrayIndex + index - existingRange.firstIndex; i < existingCount; i++)
3450
3162
  existingEls[i][ItemIndexSymbol] += count;
3451
3163
  }
3452
3164
  }
3453
-
3454
- /**
3455
- * Hook relevant events
3456
- * @returns {VirtualListHelper}
3457
- * @private
3165
+ /**
3166
+ * Hook relevant events
3458
3167
  */
3459
3168
  _hookEvents() {
3460
3169
  const p = this._p;
3461
-
3462
3170
  this._unhookEvents();
3463
-
3464
3171
  if (p.virtual && p.hookScrollEvent) {
3465
- p.list && p.list.addEventListener('scroll', /**@type Function*/p.boundRender);
3172
+ p.list && p.list.addEventListener('scroll', p.boundRender);
3466
3173
  }
3467
-
3468
3174
  return this;
3469
3175
  }
3470
-
3471
- /**
3472
- * Unhook previously hooked events
3473
- * @returns {VirtualListHelper}
3474
- * @private
3176
+ /**
3177
+ * Unhook previously hooked events
3475
3178
  */
3476
3179
  _unhookEvents() {
3477
3180
  const p = this._p;
3478
-
3479
- p.list && p.list.removeEventListener('scroll', /**@type Function*/p.boundRender);
3480
-
3181
+ p.list && p.list.removeEventListener('scroll', p.boundRender);
3481
3182
  return this;
3482
3183
  }
3483
-
3484
- /**
3485
- * Mark item index from which the positions are not considered valid anymore. <br />
3486
- * Applicable for virtual mode only.
3487
- * @param {number} value
3488
- * @private
3184
+ /**
3185
+ * Mark item index from which the positions are not considered valid anymore. <br />
3186
+ * Applicable for virtual mode only.
3489
3187
  */
3490
3188
  _setItemPositionsNeedsUpdate(value) {
3491
3189
  const p = this._p;
3492
-
3493
3190
  if (value < p.itemPositionsNeedsUpdate) {
3494
3191
  p.itemPositionsNeedsUpdate = value;
3495
3192
  }
3496
3193
  }
3497
-
3498
- /**
3499
- * Calculates an item's top position (and stores in the private `cachedItemPositions` array). <br />
3500
- * Allows calculating last+1 index too, to get the bottom-most position. <br />
3501
- * Applicable for non-virtual mode only.
3502
- * @param {number} index
3503
- * @returns {number|undefined}
3504
- * @private
3194
+ /**
3195
+ * Calculates an item's top position (and stores in the private `cachedItemPositions` array). <br />
3196
+ * Allows calculating last+1 index too, to get the bottom-most position. <br />
3197
+ * Applicable for non-virtual mode only.
3505
3198
  */
3506
3199
  _calculateItemPosition(index) {
3507
3200
  const p = this._p;
3508
-
3509
3201
  const cachedItemPositions = p.cachedItemPositions;
3510
-
3511
3202
  if (index >= p.itemPositionsNeedsUpdate) {
3512
3203
  const count = p.count;
3513
3204
  const cachedItemHeights = p.cachedItemHeights;
3514
3205
  const cachedItemEstimatedHeights = p.cachedItemEstimatedHeights;
3515
3206
  const estimatedItemHeight = p.estimatedItemHeight;
3516
3207
  const itemHeightEstimatorFn = p.itemHeightEstimatorFn;
3517
-
3518
3208
  if (cachedItemHeights.length !== count) {
3519
3209
  cachedItemHeights.length = count;
3520
3210
  cachedItemEstimatedHeights.length = count;
3521
3211
  cachedItemPositions.length = count;
3522
3212
  }
3523
-
3524
3213
  let fromIndex = p.itemPositionsNeedsUpdate;
3525
3214
  let toIndex = Math.min(index, count);
3526
-
3527
3215
  let pos = 0;
3528
-
3529
3216
  if (fromIndex > 0) {
3530
3217
  pos = cachedItemPositions[fromIndex - 1];
3531
3218
  }
3532
-
3533
3219
  for (let i = fromIndex; i <= toIndex; i++) {
3534
3220
  if (i === 0) {
3535
3221
  cachedItemPositions[i] = pos;
3536
3222
  continue;
3537
3223
  }
3538
-
3539
3224
  const prevIndex = i - 1;
3540
-
3541
3225
  let height = cachedItemHeights[prevIndex]; // already calculated
3542
-
3543
3226
  if (height === undefined) {
3544
3227
  height = itemHeightEstimatorFn ? itemHeightEstimatorFn(prevIndex) : null; // estimated per item
3545
-
3546
3228
  if (typeof height !== 'number')
3547
3229
  height = estimatedItemHeight; // estimated
3548
-
3549
3230
  cachedItemEstimatedHeights[prevIndex] = height;
3550
3231
  }
3551
-
3552
3232
  pos += height;
3553
3233
  cachedItemPositions[i] = pos;
3554
3234
  }
3555
-
3556
3235
  p.itemPositionsNeedsUpdate = toIndex + 1;
3557
3236
  }
3558
-
3559
3237
  // item after the last (calculate full height)
3560
3238
  if (index > 0 && index === p.count) {
3561
3239
  let height = p.cachedItemHeights[index - 1]; // already calculated
3562
-
3563
3240
  if (height === undefined) {
3564
3241
  height = p.itemHeightEstimatorFn ? p.itemHeightEstimatorFn(index - 1) : null; // estimated per item
3565
-
3566
3242
  if (typeof height !== 'number')
3567
3243
  height = p.estimatedItemHeight; // estimated
3568
-
3569
3244
  p.cachedItemEstimatedHeights[index - 1] = height;
3570
3245
  }
3571
-
3572
3246
  return cachedItemPositions[index - 1] + height;
3573
3247
  }
3574
-
3575
3248
  return cachedItemPositions[index];
3576
3249
  }
3577
-
3578
- /**
3579
- * Create (or reuse an existing) element for an item at the specified index,
3580
- * and insert physically at specified position. <br />
3581
- * This will also update the element's position in the `existingEls` array.
3582
- * @param {Element|undefined} itemEl
3583
- * @param {number} index
3584
- * @param {Node|boolean|undefined} insertBefore
3585
- * @param {boolean|undefined} avoidDomReflow
3586
- * @returns {Element}
3587
- * @private
3250
+ /**
3251
+ * Create (or reuse an existing) element for an item at the specified index,
3252
+ * and insert physically at specified position. <br />
3253
+ * This will also update the element's position in the `existingEls` array.
3588
3254
  */
3589
3255
  _dequeueElementForIndex(itemEl, index, insertBefore, avoidDomReflow) {
3590
3256
  const p = this._p;
@@ -3595,138 +3261,111 @@ class VirtualListHelper {
3595
3261
  const onItemUnrender = p.onItemUnrender;
3596
3262
  const isNew = !itemEl;
3597
3263
  const shouldReRender = isNew || index !== itemEl[ItemIndexSymbol];
3598
-
3599
3264
  if (itemEl) {
3600
3265
  if (onItemUnrender && shouldReRender) {
3601
3266
  onItemUnrender(itemEl);
3602
3267
  }
3603
- } else {
3268
+ } else
3269
+ {
3604
3270
  itemEl = p.itemElementCreatorFn();
3605
-
3606
3271
  if (virtualWrapper && insertBefore !== false) {
3607
- (/**@type ElementCSSInlineStyle*/itemEl).style.position = 'absolute';
3608
- (/**@type ElementCSSInlineStyle*/itemEl).style.top = '0';
3609
- (/**@type ElementCSSInlineStyle*/itemEl).style.left = '0';
3610
- (/**@type ElementCSSInlineStyle*/itemEl).style.right = '0';
3272
+ itemEl.style.position = 'absolute';
3273
+ itemEl.style.top = '0';
3274
+ itemEl.style.left = '0';
3275
+ itemEl.style.right = '0';
3611
3276
  }
3612
3277
  }
3613
-
3614
3278
  // Render only if it's a new item element
3615
3279
  // OR the index of the existing element is not the same of the index to render
3616
3280
  if (shouldReRender) {
3617
3281
  itemEl.innerHTML = ''; // Basic cleanup
3618
-
3619
3282
  if (onItemRender)
3620
3283
  onItemRender(itemEl, index);
3621
3284
  }
3622
-
3623
3285
  if (insertBefore !== false) {
3624
3286
  if (!(insertBefore instanceof Node))
3625
3287
  insertBefore = null;
3626
-
3627
3288
  // Remove from existing list
3628
3289
  if (!isNew) {
3629
3290
  let i = existingEls.indexOf(itemEl);
3630
3291
  if (i !== -1)
3631
3292
  existingEls.splice(i, 1);
3632
3293
  }
3633
-
3634
3294
  // Insert into existing list
3635
- let beforeIndex = insertBefore ? existingEls.indexOf(/**@type Element*/insertBefore) : -1;
3295
+ let beforeIndex = insertBefore ? existingEls.indexOf(insertBefore) : -1;
3636
3296
  if (beforeIndex === -1) {
3637
3297
  existingEls.push(itemEl);
3638
- } else {
3298
+ } else
3299
+ {
3639
3300
  existingEls.splice(beforeIndex, 0, itemEl);
3640
3301
  }
3641
-
3642
3302
  if (!avoidDomReflow) {
3643
3303
  this._insertItemAndFlow(itemEl, index, insertBefore);
3644
3304
  }
3645
3305
  }
3646
-
3647
3306
  // Add index metadata to item
3648
3307
  itemEl[ItemIndexSymbol] = index;
3649
-
3650
3308
  return itemEl;
3651
3309
  }
3652
-
3653
- /**
3654
- * Insert item element into the DOM, set it's flow in the DOM, and update the item's position. <br />
3655
- * @param {Element|undefined} itemEl
3656
- * @param {number} index
3657
- * @param {Node|boolean|undefined} before
3658
- * @private
3310
+ /**
3311
+ * Insert item element into the DOM, set it's flow in the DOM, and update the item's position. <br />
3659
3312
  */
3660
3313
  _insertItemAndFlow(itemEl, index, before) {
3661
3314
  const p = this._p;
3662
3315
  const virtualWrapper = p.virtualWrapper;
3663
3316
  const itemParent = p.currentItemsParent;
3664
-
3665
3317
  if (before !== false) {
3666
3318
  if (!(before instanceof Node))
3667
3319
  before = null;
3668
-
3669
3320
  // Insert into DOM
3670
3321
  if (itemEl.parentNode !== itemParent ||
3671
3322
  itemEl.nextSibling !== before) {
3672
3323
  insertBefore(itemEl, before, itemParent);
3673
3324
  }
3674
3325
  }
3675
-
3676
3326
  if (virtualWrapper) {
3677
3327
  // Calculate height
3678
3328
  let itemHeight = itemEl.getBoundingClientRect().height;
3679
-
3680
3329
  // Put calculated height into cache, and invalidate positions if it's different
3681
3330
  let cachedItemHeight = p.cachedItemHeights[index];
3682
3331
  if (cachedItemHeight !== itemHeight) {
3683
3332
  p.cachedItemHeights[index] = itemHeight;
3684
3333
  }
3685
-
3686
3334
  if (cachedItemHeight !== undefined && itemHeight !== cachedItemHeight ||
3687
3335
  cachedItemHeight === undefined && itemHeight !== p.cachedItemEstimatedHeights[index]) {
3688
3336
  this._setItemPositionsNeedsUpdate(index + 1);
3689
3337
  }
3690
-
3691
3338
  // Set item top position
3692
3339
  let pos = this._calculateItemPosition(index);
3693
3340
  const supportedTransform = getSupportedTransform();
3694
-
3695
3341
  if (supportedTransform === false) {
3696
- (/**@type ElementCSSInlineStyle*/itemEl).style.top = `${pos}px`;
3697
- } else {
3698
- (/**@type ElementCSSInlineStyle*/itemEl).style[supportedTransform] = `translateY(${pos}px)`;
3342
+ itemEl.style.top = `${pos}px`;
3343
+ } else
3344
+ {
3345
+ itemEl.style[supportedTransform] = `translateY(${pos}px)`;
3699
3346
  }
3700
3347
  }
3701
3348
  }
3702
-
3703
- /**
3704
- * Fetches valid range of existingEls
3705
- * @returns {{firstIndex: (*|number), firstValidArrayIndex: number, lastValidArrayIndex: number, lastIndex: (*|number)}}
3706
- * @private
3349
+ /**
3350
+ * Fetches valid range of existingEls
3707
3351
  */
3708
3352
  _getExistingElsRange() {
3709
3353
  const p = this._p,existingEls = p.existingEls;
3710
-
3711
3354
  let firstValidArrayIndex = -1,lastValidArrayIndex = -1;
3712
-
3713
3355
  for (let i = 0, len = existingEls.length; i < len; i++) {
3714
3356
  if (false === hasOwnProperty.call(existingEls[i], ItemIndexSymbol))
3715
3357
  continue;
3716
3358
  firstValidArrayIndex = i;
3717
3359
  break;
3718
3360
  }
3719
-
3720
3361
  for (let i = existingEls.length - 1; i >= 0; i--) {
3721
3362
  if (false === hasOwnProperty.call(existingEls[i], ItemIndexSymbol))
3722
3363
  continue;
3723
3364
  lastValidArrayIndex = i;
3724
3365
  break;
3725
3366
  }
3726
-
3727
3367
  let firstIndex = firstValidArrayIndex !== -1 ? existingEls[firstValidArrayIndex][ItemIndexSymbol] : -1;
3728
3368
  let lastIndex = lastValidArrayIndex !== -1 ? existingEls[lastValidArrayIndex][ItemIndexSymbol] : -1;
3729
-
3730
3369
  return {
3731
3370
  firstValidArrayIndex: firstValidArrayIndex,
3732
3371
  lastValidArrayIndex: lastValidArrayIndex,
@@ -3735,95 +3374,64 @@ class VirtualListHelper {
3735
3374
  };
3736
3375
  }
3737
3376
  }
3738
-
3739
- /** Marks the item index associated with an item element */
3740
3377
  const ItemIndexSymbol = Symbol('index');
3741
-
3742
- /** Marks an element for reuse */
3743
3378
  const ReuseElSymbol = Symbol('reuse');
3744
-
3745
- /**
3746
- * The default element creator
3747
- * @returns {HTMLLIElement}
3379
+ /**
3380
+ * The default element creator
3748
3381
  */
3749
3382
  const defaultElementCreator = () => {
3750
3383
  return document.createElement('li');
3751
3384
  };
3752
-
3753
- /**
3754
- * Will look for the index in the `positions` array closest to the specified `pos` value (<= pos).
3755
- * @param {number[]} positions
3756
- * @param {number} pos
3757
- * @param {number} [start=0]
3758
- * @param {number} [end=-1]
3759
- * @returns {number}
3385
+ /**
3386
+ * Will look for the index in the `positions` array closest to the specified `pos` value (<= pos).
3760
3387
  */
3761
3388
  const binarySearchPosition = (positions, pos, start = 0, end = -1) => {
3762
3389
  let total = positions.length;
3763
3390
  if (end < 0)
3764
3391
  end += total;
3765
- if (end <= start) return end; // 0 or 1 length array
3766
-
3392
+ if (end <= start)
3393
+ return end; // 0 or 1 length array
3767
3394
  while (start <= end) {
3768
3395
  let mid = Math.floor(start + (end - start) / 2);
3769
3396
  let midPos = positions[mid];
3770
-
3771
3397
  if (midPos === pos || midPos <= pos && mid < total && positions[mid + 1] > pos) {
3772
3398
  while (mid > 0 && positions[mid - 1] === midPos) // avoid bugs on 0-height items
3773
3399
  mid--;
3774
-
3775
3400
  return mid;
3776
3401
  }
3777
-
3778
3402
  if (midPos < pos)
3779
3403
  start = mid + 1;else
3780
3404
 
3781
3405
  end = mid - 1;
3782
3406
  }
3783
-
3784
- return end === -1 ? 0 : total - 1;
3407
+ return end === -1 ? 0 : end;
3785
3408
  };
3786
-
3787
- /**
3788
- * Will look for the index in a virtual list of positions supplied by `total` and `fn`,
3789
- * closest to the specified `pos` value (<= pos).
3790
- * @param {number} total
3791
- * @param {function(index: number):number} fn
3792
- * @param {number} pos
3793
- * @param {number} [start=0]
3794
- * @param {number} [end=-1]
3795
- * @returns {number}
3409
+ /**
3410
+ * Will look for the index in a virtual list of positions supplied by `total` and `fn`,
3411
+ * closest to the specified `pos` value (<= pos).
3796
3412
  */
3797
3413
  const binarySearchPositionByFn = (total, fn, pos, start = 0, end = -1) => {
3798
3414
  if (end < 0)
3799
3415
  end += total;
3800
- if (end <= start) return end; // 0 or 1 length array
3801
-
3416
+ if (end <= start)
3417
+ return end; // 0 or 1 length array
3802
3418
  while (start <= end) {
3803
3419
  let mid = Math.floor(start + (end - start) / 2);
3804
3420
  let midPos = fn(mid);
3805
-
3806
3421
  if (midPos === pos || midPos <= pos && mid < total && fn(mid + 1) > pos) {
3807
3422
  while (mid > 0 && fn(mid - 1) === midPos) // avoid bugs on 0-height items
3808
3423
  mid--;
3809
-
3810
3424
  return mid;
3811
3425
  }
3812
-
3813
3426
  if (midPos < pos)
3814
3427
  start = mid + 1;else
3815
3428
 
3816
3429
  end = mid - 1;
3817
3430
  }
3818
-
3819
- return end === -1 ? 0 : fn(total - 1);
3431
+ return end === -1 ? 0 : end;
3820
3432
  };
3821
-
3822
- /**
3823
- * Finds the last item in the array for which `fn` returns a truthy value
3824
- * @param {Array} array
3825
- * @param {Function} fn
3826
- * @returns {undefined|*}
3433
+ /**
3434
+ * Finds the last item in the array for which `fn` returns a truthy value
3827
3435
  */
3828
3436
  const findLast = (array, fn) => {
3829
3437
  for (let i = array.length - 1; i >= 0; i--) {
@@ -3833,9 +3441,7 @@ const findLast = (array, fn) => {
3833
3441
  }
3834
3442
  return undefined;
3835
3443
  };
3836
-
3837
3444
  let _isTransformSupported = null;
3838
-
3839
3445
  const getSupportedTransform = () => {
3840
3446
  if (_isTransformSupported === null) {
3841
3447
  let prefixes = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform'];
@@ -3851,9 +3457,9 @@ const getSupportedTransform = () => {
3851
3457
  return _isTransformSupported;
3852
3458
  };
3853
3459
 
3854
- 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;
3460
+ 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", _);
3855
3461
 
3856
- class DGTableJQuery extends ge {
3462
+ class DGTableJQuery extends We {
3857
3463
  constructor(options) {
3858
3464
  super(options);
3859
3465