virtual-scroller 1.12.2 → 1.12.4

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/CODE_OF_CONDUCT.md +78 -0
  3. package/README.md +1 -1
  4. package/bundle/index-bypass.html +2 -2
  5. package/bundle/index-grid.html +2 -2
  6. package/bundle/index-scrollableContainer.html +2 -2
  7. package/bundle/virtual-scroller-dom.js +1 -1
  8. package/bundle/virtual-scroller-dom.js.map +1 -1
  9. package/bundle/virtual-scroller-react.js +1 -1
  10. package/bundle/virtual-scroller-react.js.map +1 -1
  11. package/bundle/virtual-scroller.js +1 -1
  12. package/bundle/virtual-scroller.js.map +1 -1
  13. package/commonjs/Layout.js +10 -13
  14. package/commonjs/Layout.js.map +1 -1
  15. package/commonjs/Layout.test.js +20 -10
  16. package/commonjs/Layout.test.js.map +1 -1
  17. package/commonjs/Scroll.js +2 -1
  18. package/commonjs/Scroll.js.map +1 -1
  19. package/commonjs/{Resize.js → ScrollableContainerResizeHandler.js} +7 -7
  20. package/commonjs/ScrollableContainerResizeHandler.js.map +1 -0
  21. package/commonjs/VirtualScroller.constructor.js +5 -5
  22. package/commonjs/VirtualScroller.constructor.js.map +1 -1
  23. package/commonjs/VirtualScroller.items.js +1 -1
  24. package/commonjs/VirtualScroller.items.js.map +1 -1
  25. package/commonjs/VirtualScroller.js +67 -28
  26. package/commonjs/VirtualScroller.js.map +1 -1
  27. package/commonjs/VirtualScroller.layout.js +24 -22
  28. package/commonjs/VirtualScroller.layout.js.map +1 -1
  29. package/commonjs/{VirtualScroller.resize.js → VirtualScroller.onContainerResize.js} +2 -2
  30. package/commonjs/VirtualScroller.onContainerResize.js.map +1 -0
  31. package/commonjs/VirtualScroller.onRender.js +2 -2
  32. package/commonjs/VirtualScroller.onRender.js.map +1 -1
  33. package/commonjs/react/VirtualScroller.js +3 -0
  34. package/commonjs/react/VirtualScroller.js.map +1 -1
  35. package/commonjs/react/useEffectDontMountTwiceInStrictMode.js +83 -0
  36. package/commonjs/react/useEffectDontMountTwiceInStrictMode.js.map +1 -0
  37. package/commonjs/react/useInsertionEffectDontMountTwiceInStrictMode.js +20 -0
  38. package/commonjs/react/useInsertionEffectDontMountTwiceInStrictMode.js.map +1 -0
  39. package/commonjs/react/useLayoutEffectDontMountTwiceInStrictMode.js +20 -0
  40. package/commonjs/react/useLayoutEffectDontMountTwiceInStrictMode.js.map +1 -0
  41. package/commonjs/react/useState.js +13 -7
  42. package/commonjs/react/useState.js.map +1 -1
  43. package/commonjs/react/useStateNoStaleBug.js +59 -0
  44. package/commonjs/react/useStateNoStaleBug.js.map +1 -0
  45. package/modules/Layout.js +10 -13
  46. package/modules/Layout.js.map +1 -1
  47. package/modules/Layout.test.js +20 -10
  48. package/modules/Layout.test.js.map +1 -1
  49. package/modules/Scroll.js +2 -1
  50. package/modules/Scroll.js.map +1 -1
  51. package/modules/{Resize.js → ScrollableContainerResizeHandler.js} +7 -7
  52. package/modules/ScrollableContainerResizeHandler.js.map +1 -0
  53. package/modules/VirtualScroller.constructor.js +5 -5
  54. package/modules/VirtualScroller.constructor.js.map +1 -1
  55. package/modules/VirtualScroller.items.js +1 -1
  56. package/modules/VirtualScroller.items.js.map +1 -1
  57. package/modules/VirtualScroller.js +67 -28
  58. package/modules/VirtualScroller.js.map +1 -1
  59. package/modules/VirtualScroller.layout.js +24 -22
  60. package/modules/VirtualScroller.layout.js.map +1 -1
  61. package/modules/{VirtualScroller.resize.js → VirtualScroller.onContainerResize.js} +2 -2
  62. package/modules/VirtualScroller.onContainerResize.js.map +1 -0
  63. package/modules/VirtualScroller.onRender.js +2 -2
  64. package/modules/VirtualScroller.onRender.js.map +1 -1
  65. package/modules/react/VirtualScroller.js +3 -1
  66. package/modules/react/VirtualScroller.js.map +1 -1
  67. package/modules/react/useEffectDontMountTwiceInStrictMode.js +75 -0
  68. package/modules/react/useEffectDontMountTwiceInStrictMode.js.map +1 -0
  69. package/modules/react/useInsertionEffectDontMountTwiceInStrictMode.js +9 -0
  70. package/modules/react/useInsertionEffectDontMountTwiceInStrictMode.js.map +1 -0
  71. package/modules/react/useLayoutEffectDontMountTwiceInStrictMode.js +9 -0
  72. package/modules/react/useLayoutEffectDontMountTwiceInStrictMode.js.map +1 -0
  73. package/modules/react/useState.js +11 -8
  74. package/modules/react/useState.js.map +1 -1
  75. package/modules/react/useStateNoStaleBug.js +51 -0
  76. package/modules/react/useStateNoStaleBug.js.map +1 -0
  77. package/package.json +1 -1
  78. package/source/Layout.js +10 -13
  79. package/source/Layout.test.js +20 -10
  80. package/source/Scroll.js +1 -0
  81. package/source/{Resize.js → ScrollableContainerResizeHandler.js} +1 -1
  82. package/source/VirtualScroller.constructor.js +5 -5
  83. package/source/VirtualScroller.items.js +1 -1
  84. package/source/VirtualScroller.js +65 -25
  85. package/source/VirtualScroller.layout.js +22 -20
  86. package/source/{VirtualScroller.resize.js → VirtualScroller.onContainerResize.js} +1 -1
  87. package/source/VirtualScroller.onRender.js +2 -2
  88. package/source/react/VirtualScroller.js +3 -0
  89. package/source/react/useEffectDontMountTwiceInStrictMode.js +68 -0
  90. package/source/react/useInsertionEffectDontMountTwiceInStrictMode.js +10 -0
  91. package/source/react/useLayoutEffectDontMountTwiceInStrictMode.js +10 -0
  92. package/source/react/useState.js +8 -5
  93. package/source/react/useStateNoStaleBug.js +35 -0
  94. package/website/index-bypass.html +4 -14
  95. package/website/index-dom.html +1 -1
  96. package/website/index-grid.html +4 -4
  97. package/website/index-scrollableContainer.html +4 -4
  98. package/website/index-tbody-scrollableContainer.html +2 -0
  99. package/website/index-tbody.html +2 -0
  100. package/website/index.html +3 -3
  101. package/commonjs/Resize.js.map +0 -1
  102. package/commonjs/VirtualScroller.resize.js.map +0 -1
  103. package/modules/Resize.js.map +0 -1
  104. package/modules/VirtualScroller.resize.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroller-dom.js","sources":["../modules/utility/px.js","../modules/DOM/tbody.js","../modules/ItemNotRenderedError.js","../modules/DOM/ItemsContainer.js","../modules/ScrollableContainerNotReadyError.js","../modules/DOM/ScrollableContainer.js","../node_modules/raf/index.js","../node_modules/performance-now/lib/performance-now.js","../node_modules/request-animation-frame-timeout/modules/index.js","../modules/DOM/ListTopOffsetWatcher.js","../modules/DOM/Engine.js","../modules/utility/debug.js","../modules/Layout.js","../modules/Resize.js","../modules/utility/debounce.js","../modules/BeforeResize.js","../modules/Scroll.js","../modules/ListHeightMeasurement.js","../modules/ItemHeights.js","../modules/utility/fillArray.js","../modules/utility/getStateSnapshot.js","../modules/VirtualScroller.state.js","../modules/VirtualScroller.verticalSpacing.js","../modules/getVerticalSpacing.js","../modules/VirtualScroller.columns.js","../modules/VirtualScroller.layout.js","../modules/utility/shallowEqual.js","../modules/VirtualScroller.onRender.js","../modules/VirtualScroller.resize.js","../modules/VirtualScroller.items.js","../modules/getItemsDiff.js","../modules/VirtualScroller.constructor.js","../modules/VirtualScroller.js","../modules/DOM/VirtualScroller.js"],"sourcesContent":["/**\r\n * Rounds coordinates upto 4th decimal place (after dot) and appends \"px\".\r\n * Small numbers could be printed as `\"1.2345e-50\"` unless rounded:\r\n * that would be invalid \"px\" value in CSS.\r\n * @param {number}\r\n * @return {string}\r\n */\nexport default function px(number) {\n // Fractional pixels are used on \"retina\" screens.\n return (number % 1 === 0 ? number : number.toFixed(2)) + 'px';\n}\n//# sourceMappingURL=px.js.map","// A workaround for `<tbody/>` not being able to have `padding`.\n// https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\nimport px from '../utility/px.js';\nexport var BROWSER_NOT_SUPPORTED_ERROR = 'It looks like you\\'re using Internet Explorer which doesn\\'t support CSS variables required for a <tbody/> container. VirtualScroller has been switched into \"bypass\" mode (render all items). See: https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1';\nexport function supportsTbody() {\n // Detect Internet Explorer.\n // https://stackoverflow.com/questions/19999388/check-if-user-is-using-ie\n // `documentMode` is an IE-only property.\n // Supports IE 9-11. Maybe even IE 8.\n // http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n if (typeof window !== 'undefined' && window.document.documentMode) {\n // CSS variables aren't supported in Internet Explorer.\n return false;\n }\n\n return true;\n}\nexport var TBODY_CLASS_NAME = 'VirtualScroller';\nvar STYLE_ELEMENT_ID = 'VirtualScrollerStyle';\nexport function hasTbodyStyles(tbody) {\n return tbody.classList.contains(TBODY_CLASS_NAME) && Boolean(document.getElementById(STYLE_ELEMENT_ID));\n}\nexport function addTbodyStyles(tbody) {\n // `classList.add` is supported in Internet Explorer 10+.\n tbody.classList.add(TBODY_CLASS_NAME); // Create a `<style/>` element.\n\n var style = document.createElement('style');\n style.id = STYLE_ELEMENT_ID; // CSS variables aren't supported in Internet Explorer.\n\n style.innerText = \"\\n\\t\\ttbody.\".concat(TBODY_CLASS_NAME, \":before {\\n\\t\\t\\tcontent: '';\\n\\t\\t\\tdisplay: table-row;\\n\\t\\t\\theight: var(--VirtualScroller-paddingTop);\\n\\t\\t}\\n\\t\\ttbody.\").concat(TBODY_CLASS_NAME, \":after {\\n\\t\\t\\tcontent: '';\\n\\t\\t\\tdisplay: table-row;\\n\\t\\t\\theight: var(--VirtualScroller-paddingBottom);\\n\\t\\t}\\n\\t\").replace(/[\\n\\t]/g, '');\n document.head.appendChild(style);\n}\nexport function setTbodyPadding(tbody, beforeItemsHeight, afterItemsHeight) {\n // CSS variables aren't supported in Internet Explorer.\n tbody.style.setProperty('--VirtualScroller-paddingTop', px(beforeItemsHeight));\n tbody.style.setProperty('--VirtualScroller-paddingBottom', px(afterItemsHeight));\n}\n//# sourceMappingURL=tbody.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar ItemNotRenderedError = /*#__PURE__*/function (_Error) {\n _inherits(ItemNotRenderedError, _Error);\n\n var _super = _createSuper(ItemNotRenderedError);\n\n function ItemNotRenderedError(_ref) {\n var renderedElementIndex = _ref.renderedElementIndex,\n renderedElementsCount = _ref.renderedElementsCount,\n message = _ref.message;\n\n _classCallCheck(this, ItemNotRenderedError);\n\n return _super.call(this, message || getDefaultMessage({\n renderedElementIndex: renderedElementIndex,\n renderedElementsCount: renderedElementsCount\n }));\n }\n\n return _createClass(ItemNotRenderedError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexport { ItemNotRenderedError as default };\n\nfunction getDefaultMessage(_ref2) {\n var renderedElementIndex = _ref2.renderedElementIndex,\n renderedElementsCount = _ref2.renderedElementsCount;\n return \"Element with index \".concat(renderedElementIndex, \" was not found in the list of Rendered Item Elements in the Items Container of Virtual Scroller. There're only \").concat(renderedElementsCount, \" Elements there.\");\n}\n//# sourceMappingURL=ItemNotRenderedError.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport ItemNotRenderedError from '../ItemNotRenderedError.js';\n\nvar ItemsContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"container\" from an element.\r\n * @param {function} getElement\r\n */\n function ItemsContainer(getElement) {\n _classCallCheck(this, ItemsContainer);\n\n this.getElement = getElement;\n }\n\n _createClass(ItemsContainer, [{\n key: \"_getNthRenderedItemElement\",\n value: function _getNthRenderedItemElement(renderedElementIndex) {\n var childNodes = this.getElement().childNodes;\n\n if (renderedElementIndex > childNodes.length - 1) {\n // console.log('~ Items Container Contents ~')\n // console.log(this.getElement().innerHTML)\n throw new ItemNotRenderedError({\n renderedElementIndex: renderedElementIndex,\n renderedElementsCount: childNodes.length\n });\n }\n\n return childNodes[renderedElementIndex];\n }\n /**\r\n * Returns an item element's \"top offset\", relative to the items `container`'s top edge.\r\n * @param {number} renderedElementIndex — An index of an item relative to the \"first shown item index\". For example, if the list is showing items from index 8 to index 12 then `renderedElementIndex = 0` would mean the item at index `8`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getNthRenderedItemTopOffset\",\n value: function getNthRenderedItemTopOffset(renderedElementIndex) {\n return this._getNthRenderedItemElement(renderedElementIndex).getBoundingClientRect().top - this.getElement().getBoundingClientRect().top;\n }\n /**\r\n * Returns an item element's height.\r\n * @param {number} renderedElementIndex — An index of an item relative to the \"first shown item index\". For example, if the list is showing items from index 8 to index 12 then `renderedElementIndex = 0` would mean the item at index `8`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getNthRenderedItemHeight\",\n value: function getNthRenderedItemHeight(renderedElementIndex) {\n // `offsetHeight` is not precise enough (doesn't return fractional pixels).\n // return this._getNthRenderedItemElement(renderedElementIndex).offsetHeight\n return this._getNthRenderedItemElement(renderedElementIndex).getBoundingClientRect().height;\n }\n /**\r\n * Returns items container height.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n // `offsetHeight` is not precise enough (doesn't return fractional pixels).\n // return this.getElement().offsetHeight\n return this.getElement().getBoundingClientRect().height;\n }\n /**\r\n * Removes all item elements of an items container.\r\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n while (this.getElement().firstChild) {\n this.getElement().removeChild(this.getElement().firstChild);\n }\n }\n }]);\n\n return ItemsContainer;\n}();\n\nexport { ItemsContainer as default };\n//# sourceMappingURL=ItemsContainer.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar ScrollableContainerNotReadyError = /*#__PURE__*/function (_Error) {\n _inherits(ScrollableContainerNotReadyError, _Error);\n\n var _super = _createSuper(ScrollableContainerNotReadyError);\n\n function ScrollableContainerNotReadyError() {\n _classCallCheck(this, ScrollableContainerNotReadyError);\n\n return _super.call(this, '[virtual-scroller] Scrollable container not found');\n }\n\n return _createClass(ScrollableContainerNotReadyError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexport { ScrollableContainerNotReadyError as default };\n//# sourceMappingURL=ScrollableContainerNotReadyError.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport ScrollableContainerNotReadyError from '../ScrollableContainerNotReadyError.js';\n\nvar ScrollableContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"scrollable container\" from an element.\r\n * @param {func} getElement — Returns the scrollable container element.\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableContainer(getElement, getItemsContainerElement) {\n _classCallCheck(this, ScrollableContainer);\n\n this.getElement = getElement;\n this.getItemsContainerElement = getItemsContainerElement;\n }\n /**\r\n * Returns the current scroll position.\r\n * @return {number}\r\n */\n\n\n _createClass(ScrollableContainer, [{\n key: \"getScrollY\",\n value: function getScrollY() {\n return this.getElement().scrollTop;\n }\n /**\r\n * Scrolls to a specific position.\r\n * @param {number} scrollY\r\n */\n\n }, {\n key: \"scrollToY\",\n value: function scrollToY(scrollY) {\n // IE 11 doesn't seem to have a `.scrollTo()` method.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/10\n // https://stackoverflow.com/questions/39908825/window-scrollto-is-not-working-in-internet-explorer-11\n if (this.getElement().scrollTo) {\n this.getElement().scrollTo(0, scrollY);\n } else {\n this.getElement().scrollTop = scrollY;\n }\n }\n /**\r\n * Returns \"scrollable container\" width,\r\n * i.e. the available width for its content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getWidth\",\n value: function getWidth() {\n if (!this.getElement()) {\n throw new ScrollableContainerNotReadyError();\n }\n\n return this.getElement().offsetWidth;\n }\n /**\r\n * Returns the height of the \"scrollable container\" itself.\r\n * Not to be confused with the height of \"scrollable container\"'s content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n if (!this.getElement()) {\n throw new ScrollableContainerNotReadyError();\n } // if (!this.getElement() && !precise) {\n // \treturn getScreenHeight()\n // }\n\n\n return this.getElement().offsetHeight;\n }\n /**\r\n * Returns a \"top offset\" of an items container element\r\n * relative to the \"scrollable container\"'s top edge.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getItemsContainerTopOffset\",\n value: function getItemsContainerTopOffset() {\n var scrollableContainerTop = this.getElement().getBoundingClientRect().top;\n var scrollableContainerBorderTopWidth = this.getElement().clientTop;\n var itemsContainerTop = this.getItemsContainerElement().getBoundingClientRect().top;\n return itemsContainerTop - scrollableContainerTop + this.getScrollY() - scrollableContainerBorderTopWidth;\n } // isVisible() {\n // \tconst { top, bottom } = this.getElement().getBoundingClientRect()\n // \treturn bottom > 0 && top < getScreenHeight()\n // }\n\n /**\r\n * Adds a \"scroll\" event listener to the \"scrollable container\".\r\n * @param {onScrollListener} Should be called whenever the scroll position inside the \"scrollable container\" (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onScroll\",\n value: function onScroll(onScrollListener) {\n var element = this.getElement();\n element.addEventListener('scroll', onScrollListener);\n return function () {\n return element.removeEventListener('scroll', onScrollListener);\n };\n }\n /**\r\n * Adds a \"resize\" event listener to the \"scrollable container\".\r\n * @param {onResize} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onResize\",\n value: function onResize(_onResize) {\n // Watches \"scrollable container\"'s dimensions via a `ResizeObserver`.\n // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver\n // https://web.dev/resize-observer/\n var unobserve;\n\n if (typeof ResizeObserver !== 'undefined') {\n var resizeObserver = new ResizeObserver(function (entries) {\n // \"one entry per observed element\".\n // https://web.dev/resize-observer/\n // `entry.target === this.getElement()`.\n var entry = entries[0]; // // If `entry.contentBoxSize` property is supported by the web browser.\n // if (entry.contentBoxSize) {\n // \t// https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentBoxSize\n // \tconst width = entry.contentBoxSize.inlineSize\n // \tconst height = entry.contentBoxSize.blockSize\n // }\n\n _onResize();\n });\n var element = this.getElement();\n resizeObserver.observe(element);\n\n unobserve = function unobserve() {\n return resizeObserver.unobserve(element);\n };\n } // I guess, if window is resized, `onResize()` will be triggered twice:\n // once for window resize, and once for the scrollable container resize.\n // But `onResize()` also has an internal check: if the container size\n // hasn't changed since the previous time `onResize()` has been called,\n // then `onResize()` doesn't do anything, so, I guess, there shouldn't be\n // any \"performance implications\" of running the listener twice in such case.\n\n\n var unlistenGlobalResize = addGlobalResizeListener(_onResize, {\n itemsContainerElement: this.getItemsContainerElement()\n });\n return function () {\n if (unobserve) {\n unobserve();\n }\n\n unlistenGlobalResize();\n };\n }\n }]);\n\n return ScrollableContainer;\n}();\n\nexport { ScrollableContainer as default };\nexport var ScrollableWindowContainer = /*#__PURE__*/function (_ScrollableContainer) {\n _inherits(ScrollableWindowContainer, _ScrollableContainer);\n\n var _super = _createSuper(ScrollableWindowContainer);\n\n /**\r\n * Constructs a new window \"scrollable container\".\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableWindowContainer(getItemsContainerElement) {\n _classCallCheck(this, ScrollableWindowContainer);\n\n return _super.call(this, function () {\n return window;\n }, getItemsContainerElement);\n }\n /**\r\n * Returns the current scroll position.\r\n * @return {number}\r\n */\n\n\n _createClass(ScrollableWindowContainer, [{\n key: \"getScrollY\",\n value: function getScrollY() {\n // `window.scrollY` is not supported by Internet Explorer.\n return window.pageYOffset;\n }\n /**\r\n * Returns \"scrollable container\" width,\r\n * i.e. the available width for its content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getWidth\",\n value: function getWidth() {\n // https://javascript.info/size-and-scroll-window\n // `<!DOCTYPE html>` may be required in order for this to work correctly.\n // Includes scrollbar (if any).\n // Correctly reflects page zoom in iOS Safari.\n // (scales screen width accordingly).\n // But, includes scrollbar (if any).\n return window.innerWidth;\n }\n /**\r\n * Returns the height of the \"scrollable container\" itself.\r\n * Not to be confused with the height of \"scrollable container\"'s content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n // https://javascript.info/size-and-scroll-window\n // `<!DOCTYPE html>` is required in order for this to work correctly.\n // Without it, the returned height would be the height of the entire document.\n // Includes scrollbar (if any).\n // Supports iOS Safari's dynamically shown/hidden\n // top URL bar and bottom actions bar.\n // https://codesandbox.io/s/elegant-fog-iddrh\n // Tested in IE 11.\n // It also correctly reflects page zoom in iOS Safari.\n // (scales screen height accordingly).\n // But, includes scrollbar (if any).\n return window.innerHeight;\n }\n /**\r\n * Returns a \"top offset\" of an items container element\r\n * relative to the \"scrollable container\"'s top edge.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getItemsContainerTopOffset\",\n value: function getItemsContainerTopOffset() {\n var borderTopWidth = document.clientTop || document.body.clientTop || 0;\n return this.getItemsContainerElement().getBoundingClientRect().top + this.getScrollY() - borderTopWidth;\n }\n /**\r\n * Adds a \"resize\" event listener to the \"scrollable container\".\r\n * @param {onScroll} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onResize\",\n value: function onResize(_onResize2) {\n return addGlobalResizeListener(_onResize2, {\n itemsContainerElement: this.getItemsContainerElement()\n });\n } // isVisible() {\n // \treturn true\n // }\n\n }]);\n\n return ScrollableWindowContainer;\n}(ScrollableContainer);\n/**\r\n * Adds a \"resize\" event listener to the `window`.\r\n * @param {onResize} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @param {Element} options.itemsContainerElement — The items \"container\" element, which is not the same as the \"scrollable container\" element. For example, \"scrollable container\" could be resized while the list element retaining its size. One such example is a user entering fullscreen mode on an HTML5 `<video/>` element: in that case, a \"resize\" event is triggered on a window, and window dimensions change to the user's screen size, but such \"resize\" event can be ignored because the list isn't visible until the user exits fullscreen mode.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\nfunction addGlobalResizeListener(onResize, _ref) {\n var itemsContainerElement = _ref.itemsContainerElement;\n\n var onResizeListener = function onResizeListener() {\n // By default, `VirtualScroller` always performs a re-layout\n // on window `resize` event. But browsers (Chrome, Firefox)\n // [trigger](https://developer.mozilla.org/en-US/docs/Web/API/Window/fullScreen#Notes)\n // window `resize` event also when a user switches into fullscreen mode:\n // for example, when a user is watching a video and double-clicks on it\n // to maximize it. And also when the user goes out of the fullscreen mode.\n // Each such fullscreen mode entering/exiting will trigger window `resize`\n // event that will it turn trigger a re-layout of `VirtualScroller`,\n // resulting in bad user experience. To prevent that, such cases are filtered out.\n // Some other workaround:\n // https://stackoverflow.com/questions/23770449/embedded-youtube-video-fullscreen-or-causing-resize\n if (document.fullscreenElement) {\n // If the fullscreened element doesn't contain the list\n // (and is not the list itself), then the layout hasn't been affected,\n // so don't perform a re-layout.\n //\n // For example, suppose there's a list of items, and some item contains a video.\n // If, upon clicking such video, it plays inline, and the user enters\n // fullscreen mode while playing such inline video, then the layout won't be\n // affected, and so such `resize` event should be ignored: when\n // `document.fullscreenElement` is in a separate \"branch\" relative to the\n // `container`.\n //\n // Another scenario: suppose that upon click, the video doesn't play inline,\n // but instead a \"Slideshow\" component is open, with the video shown at the\n // center of the screen in an overlay. If then the user enters fullscreen mode,\n // the layout wouldn't be affected too, so such `resize` event should also be\n // ignored: when `document.fullscreenElement` is inside the `container`.\n //\n if (document.fullscreenElement.contains(itemsContainerElement)) {// The element is either the `container`'s ancestor,\n // Or is the `container` itself.\n // (`a.contains(b)` includes the `a === b` case).\n // So the `resize` event will affect the `container`'s dimensions.\n } else {\n // The element is either inside the `container`,\n // Or is in a separate tree.\n // So the `resize` event won't affect the `container`'s dimensions.\n return;\n }\n }\n\n onResize();\n };\n\n window.addEventListener('resize', onResizeListener);\n return function () {\n return window.removeEventListener('resize', onResizeListener);\n };\n}\n//# sourceMappingURL=ScrollableContainer.js.map","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","import requestAnimationFrame from 'raf';\nvar cancelAnimationFrame = requestAnimationFrame.cancel;\nexport function setTimeout(callback, delay) {\n var startedAt = Date.now();\n var animationFrame = requestAnimationFrame(tick);\n\n function tick() {\n if (Date.now() - startedAt >= delay) {\n callback();\n } else {\n animationFrame = requestAnimationFrame(tick);\n }\n }\n\n return {\n clear: function clear() {\n return cancelAnimationFrame(animationFrame);\n }\n };\n}\nexport function clearTimeout(timeout) {\n if (timeout) {\n timeout.clear();\n }\n}\n//# sourceMappingURL=index.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'; // Refreshing two times every seconds seems reasonable.\n\nvar WATCH_LIST_TOP_OFFSET_INTERVAL = 500; // Refreshing for 3 seconds after the initial page load seems reasonable.\n\nvar WATCH_LIST_TOP_OFFSET_MAX_DURATION = 3000; // `VirtualScroller` calls `this.layout.layOut()` on mount,\n// but if the page styles are applied after `VirtualScroller` mounts\n// (for example, if styles are applied via javascript, like Webpack does)\n// then the list might not render correctly and it will only show the first item.\n// The reason is that in that case calling `.getListTopOffset()` on mount\n// returns \"incorrect\" `top` position because the styles haven't been applied yet.\n//\n// For example, consider a page:\n//\n// <div class=\"page\">\n// <nav class=\"sidebar\">...</nav>\n// <main>...</main>\n// </div>\n//\n// The sidebar is styled as `position: fixed`, but, until\n// the page styles have been applied, it's gonna be a regular `<div/>`\n// meaning that `<main/>` will be rendered below the sidebar\n// and will appear offscreen, and so it will only render the first item.\n//\n// Then, the page styles are loaded and applied, and the sidebar\n// is now `position: fixed`, so `<main/>` is now rendered at the top of the page,\n// but `VirtualScroller`'s `.render()` has already been called\n// and it won't re-render until the user scrolls or the window is resized.\n//\n// This type of a bug doesn't seem to occur in production, but it can appear\n// in development mode when using Webpack. The workaround `VirtualScroller`\n// implements for such cases is calling `.getListTopOffset()`\n// on the list container DOM element periodically (every second) to check\n// if the `top` coordinate has changed as a result of CSS being applied:\n// if it has then it recalculates the shown item indexes.\n//\n// Maybe this bug could occur in production when using Webpack chunks.\n// That depends on how a style of a chunk is added to the page:\n// if it's added via `javascript` after the page has been rendered\n// then this workaround will also work for that case.\n//\n// Another example would be a page having a really tall expanded \"accordion\"\n// section, below which a `VirtualScroller` list resides. If the user un-expands\n// such expanded \"accordion\" section, the list would become visible but\n// it wouldn't get re-rendered because no `scroll` event has occured,\n// and the list only re-renders automatically on `scroll` events.\n// To work around such cases, call `virtualScroller.updateLayout()` method manually.\n// The workaround below could be extended to refresh the list's top coordinate\n// indefinitely and at higher intervals, but why waste CPU time on that.\n// There doesn't seem to be any DOM API for tracking an element's top position.\n// There is `IntersectionObserver` API but it doesn't exactly do that.\n//\n\nvar ListTopOffsetWatcher = /*#__PURE__*/function () {\n function ListTopOffsetWatcher(_ref) {\n var getListTopOffset = _ref.getListTopOffset,\n onListTopOffsetChange = _ref.onListTopOffsetChange;\n\n _classCallCheck(this, ListTopOffsetWatcher);\n\n this.getListTopOffset = getListTopOffset;\n this.onListTopOffsetChange = onListTopOffsetChange;\n }\n\n _createClass(ListTopOffsetWatcher, [{\n key: \"onListTopOffset\",\n value: function onListTopOffset(listTopOffset) {\n if (this.listTopOffsetInsideScrollableContainer === undefined) {\n // Start periodical checks of the list's top offset\n // in order to perform a re-layout in case it changes.\n // See the comments in `ListTopOffsetWatcher.js` file\n // on why can the list's top offset change, and in which circumstances.\n this.start();\n }\n\n this.listTopOffsetInsideScrollableContainer = listTopOffset;\n }\n }, {\n key: \"start\",\n value: function start() {\n this._isActive = true;\n this.watchListTopOffset();\n }\n }, {\n key: \"isStarted\",\n value: function isStarted() {\n return this._isActive;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this._isActive = false;\n\n if (this.watchListTopOffsetTimer) {\n clearTimeout(this.watchListTopOffsetTimer);\n this.watchListTopOffsetTimer = undefined;\n }\n }\n }, {\n key: \"watchListTopOffset\",\n value: function watchListTopOffset() {\n var _this = this;\n\n var startedAt = Date.now();\n\n var check = function check() {\n // If `VirtualScroller` has been unmounted\n // while `setTimeout()` was waiting, then exit.\n if (!_this._isActive) {\n return;\n } // Skip comparing `top` coordinate of the list\n // when this function is called for the first time.\n\n\n if (_this.listTopOffsetInsideScrollableContainer !== undefined) {\n // Calling `this.getListTopOffset()` on an element\n // runs about 0.003 milliseconds on a modern desktop CPU,\n // so I guess it's fine calling it twice a second.\n if (_this.getListTopOffset() !== _this.listTopOffsetInsideScrollableContainer) {\n _this.onListTopOffsetChange();\n }\n } // Compare `top` coordinate of the list twice a second\n // to find out if it has changed as a result of loading CSS styles.\n // The total duration of 3 seconds would be enough for any styles to load, I guess.\n // There could be other cases changing the `top` coordinate\n // of the list (like collapsing an \"accordeon\" panel above the list\n // without scrolling the page), but those cases should be handled\n // by manually calling `.updateLayout()` instance method on `VirtualScroller` instance.\n\n\n if (Date.now() - startedAt < WATCH_LIST_TOP_OFFSET_MAX_DURATION) {\n _this.watchListTopOffsetTimer = setTimeout(check, WATCH_LIST_TOP_OFFSET_INTERVAL);\n }\n }; // Run the cycle.\n\n\n check();\n }\n }]);\n\n return ListTopOffsetWatcher;\n}();\n\nexport { ListTopOffsetWatcher as default };\n//# sourceMappingURL=ListTopOffsetWatcher.js.map","import ItemsContainer from './ItemsContainer.js';\nimport ScrollableContainer, { ScrollableWindowContainer } from './ScrollableContainer.js';\nimport ListTopOffsetWatcher from './ListTopOffsetWatcher.js';\nexport default {\n createItemsContainer: function createItemsContainer(getItemsContainerElement) {\n return new ItemsContainer(getItemsContainerElement);\n },\n // Creates a `scrollableContainer`.\n // On client side, `scrollableContainer` is always created.\n // On server side, `scrollableContainer` is not created (and not used).\n createScrollableContainer: function createScrollableContainer(getScrollableContainerElement, getItemsContainerElement) {\n if (getScrollableContainerElement) {\n return new ScrollableContainer(getScrollableContainerElement, getItemsContainerElement);\n } else if (typeof window !== 'undefined') {\n return new ScrollableWindowContainer(getItemsContainerElement);\n }\n },\n watchListTopOffset: function watchListTopOffset(_ref) {\n var getListTopOffset = _ref.getListTopOffset,\n onListTopOffsetChange = _ref.onListTopOffsetChange;\n return new ListTopOffsetWatcher({\n getListTopOffset: getListTopOffset,\n onListTopOffsetChange: onListTopOffsetChange\n });\n }\n};\n//# sourceMappingURL=Engine.js.map","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nexport default function log() {\n if (isDebug()) {\n var _console;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n (_console = console).log.apply(_console, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n }\n}\nexport function warn() {\n if (isWarn()) {\n var _console2;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n if (warningsAreErrors()) {\n return reportError.apply(this, args);\n }\n\n (_console2 = console).warn.apply(_console2, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n }\n}\n\nfunction error() {\n var _console3;\n\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n (_console3 = console).error.apply(_console3, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n}\n\nexport function reportError() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n var createError = function createError() {\n return new Error(['[virtual-scroller]'].concat(args).join(' '));\n };\n\n if (typeof window !== 'undefined') {\n // In a web browser.\n // Output a debug message immediately so that it's known\n // at which point did the error occur between other debug logs.\n error.apply(this, ['ERROR'].concat(args));\n setTimeout(function () {\n // Throw an error in a timeout so that it doesn't interrupt the application's flow.\n // At the same time, by throwing a client-side error, such error could be spotted\n // in some error monitoring software like `sentry.io`, while also being visible\n // in the console.\n // The `.join(' ')` part doesn't support stringifying JSON objects,\n // but those don't seem to be used in any of the error messages.\n throw createError();\n }, 0);\n } else {\n // In Node.js.\n // If tests are being run, throw in case of any errors.\n var catchError = getGlobalVariable('VirtualScrollerCatchError');\n\n if (catchError) {\n return catchError(createError());\n }\n\n if (getGlobalVariable('VirtualScrollerThrowErrors')) {\n throw createError();\n } // Print the error in the console.\n\n\n error.apply(this, ['ERROR'].concat(args));\n }\n}\nexport function isDebug() {\n var debug = getDebug();\n\n if (debug !== undefined) {\n return debug === true || debug === 'debug';\n }\n}\nexport function isWarn() {\n // const debug = getDebug()\n // return debug === undefined\n // \t|| debug === true\n // \t|| debug === 'debug'\n // \t|| debug === 'warn'\n //\n return true;\n}\n\nfunction getDebug() {\n return getGlobalVariable('VirtualScrollerDebug');\n}\n\nfunction warningsAreErrors() {\n return getGlobalVariable('VirtualScrollerWarningsAreErrors');\n}\n\nfunction getGlobalVariable(name) {\n if (typeof window !== 'undefined') {\n return window[name];\n } else if (typeof global !== 'undefined') {\n return global[name];\n }\n}\n//# sourceMappingURL=debug.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log, { warn } from './utility/debug.js';\nimport ScrollableContainerNotReadyError from './ScrollableContainerNotReadyError.js';\n\nvar Layout = /*#__PURE__*/function () {\n function Layout(_ref) {\n var bypass = _ref.bypass,\n getInitialEstimatedItemHeight = _ref.getInitialEstimatedItemHeight,\n getInitialEstimatedVisibleItemRowsCount = _ref.getInitialEstimatedVisibleItemRowsCount,\n measureItemsBatchSize = _ref.measureItemsBatchSize,\n getPrerenderMargin = _ref.getPrerenderMargin,\n getVerticalSpacing = _ref.getVerticalSpacing,\n getVerticalSpacingBeforeResize = _ref.getVerticalSpacingBeforeResize,\n getColumnsCount = _ref.getColumnsCount,\n getColumnsCountBeforeResize = _ref.getColumnsCountBeforeResize,\n getItemHeight = _ref.getItemHeight,\n getItemHeightBeforeResize = _ref.getItemHeightBeforeResize,\n getBeforeResizeItemsCount = _ref.getBeforeResizeItemsCount,\n getAverageItemHeight = _ref.getAverageItemHeight,\n getMaxVisibleAreaHeight = _ref.getMaxVisibleAreaHeight,\n getPreviouslyCalculatedLayout = _ref.getPreviouslyCalculatedLayout;\n\n _classCallCheck(this, Layout);\n\n this.bypass = bypass;\n this.getInitialEstimatedItemHeight = getInitialEstimatedItemHeight;\n this.getInitialEstimatedVisibleItemRowsCount = getInitialEstimatedVisibleItemRowsCount;\n this.measureItemsBatchSize = measureItemsBatchSize;\n this.getPrerenderMargin = getPrerenderMargin;\n this.getVerticalSpacing = getVerticalSpacing;\n this.getVerticalSpacingBeforeResize = getVerticalSpacingBeforeResize;\n this.getColumnsCount = getColumnsCount;\n this.getColumnsCountBeforeResize = getColumnsCountBeforeResize;\n this.getItemHeight = getItemHeight;\n this.getItemHeightBeforeResize = getItemHeightBeforeResize;\n this.getBeforeResizeItemsCount = getBeforeResizeItemsCount;\n this.getAverageItemHeight = getAverageItemHeight;\n this.getMaxVisibleAreaHeight = getMaxVisibleAreaHeight; //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n\n this.getPreviouslyCalculatedLayout = getPreviouslyCalculatedLayout;\n } // React `<VirtualScroller/>` component attempts to create the initial state\n // before the component tree has mounted. This could result in an inability to\n // calculate some initial layout values like `columnsCount` or `lastShownItemIndex`.\n // Such errors aren't considered critical because layout will be re-calculated\n // after the component mounts. The workaround is to use some sane default values\n // until the scrollable container has mounted.\n\n\n _createClass(Layout, [{\n key: \"getInitialLayoutValueWithFallback\",\n value: function getInitialLayoutValueWithFallback(name, getValue, defaultValue) {\n try {\n return getValue();\n } catch (error) {\n if (error instanceof ScrollableContainerNotReadyError) {\n log('Couldn\\'t calculate', name, 'before scrollable container is ready. Default to', defaultValue);\n return defaultValue;\n } else {\n throw error;\n }\n }\n }\n }, {\n key: \"getInitialLayoutValues\",\n value: function getInitialLayoutValues(_ref2) {\n var _this = this;\n\n var itemsCount = _ref2.itemsCount,\n columnsCount = _ref2.columnsCount,\n beforeStart = _ref2.beforeStart;\n var firstShownItemIndex;\n var lastShownItemIndex; // If there're no items then `firstShownItemIndex` stays `undefined`.\n\n if (itemsCount > 0) {\n var getLastShownItemIndex = function getLastShownItemIndex() {\n return _this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n });\n };\n\n firstShownItemIndex = 0;\n lastShownItemIndex = beforeStart ? this.getInitialLayoutValueWithFallback('lastShownItemIndex', getLastShownItemIndex, 0) : getLastShownItemIndex();\n }\n\n return {\n beforeItemsHeight: 0,\n afterItemsHeight: 0,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n }, {\n key: \"getInitialLastShownItemIndex\",\n value: function getInitialLastShownItemIndex(_ref3) {\n var itemsCount = _ref3.itemsCount,\n columnsCount = _ref3.columnsCount,\n firstShownItemIndex = _ref3.firstShownItemIndex;\n\n if (this.bypass) {\n return itemsCount - 1;\n } // On server side, at initialization time,\n // `scrollableContainer` is `undefined`,\n // so default to `1` estimated rows count.\n\n\n var estimatedRowsCount = 1;\n\n if (this.getMaxVisibleAreaHeight()) {\n estimatedRowsCount = this.getEstimatedRowsCountForHeight(this.getMaxVisibleAreaHeight() + this.getPrerenderMargin());\n } else if (this.getInitialEstimatedVisibleItemRowsCount) {\n estimatedRowsCount = this.getInitialEstimatedVisibleItemRowsCount();\n\n if (isNaN(estimatedRowsCount)) {\n throw new Error('[virtual-scroller] `getEstimatedVisibleItemRowsCount()` must return a number');\n }\n }\n\n return Math.min(firstShownItemIndex + (estimatedRowsCount * columnsCount - 1), itemsCount - 1);\n }\n }, {\n key: \"getEstimatedRowsCountForHeight\",\n value: function getEstimatedRowsCountForHeight(height) {\n var estimatedItemHeight = this.getEstimatedItemHeight();\n var verticalSpacing = this.getVerticalSpacing();\n\n if (estimatedItemHeight) {\n return Math.ceil((height + verticalSpacing) / (estimatedItemHeight + verticalSpacing));\n } else {\n // If no items have been rendered yet, and no `estimatedItemHeight` option\n // has been passed, then default to `1` estimated rows count in any `height`.\n return 1;\n }\n }\n /**\r\n * Returns estimated list item height.\r\n * (depends on which items have been previously rendered and measured).\r\n * @return {number}\r\n */\n\n }, {\n key: \"getEstimatedItemHeight\",\n value: function getEstimatedItemHeight() {\n var averageItemHeight = this.getAverageItemHeight();\n\n if (averageItemHeight) {\n return averageItemHeight;\n }\n\n if (this.getInitialEstimatedItemHeight) {\n var estimatedItemHeight = this.getInitialEstimatedItemHeight();\n\n if (isNaN(estimatedItemHeight)) {\n throw new Error('[virtual-scroller] `getInitialEstimatedItemHeight()` must return a number');\n }\n\n return estimatedItemHeight;\n }\n\n return 0;\n }\n }, {\n key: \"getLayoutUpdateForItemsDiff\",\n value: function getLayoutUpdateForItemsDiff(_ref4, _ref5, _ref6) {\n var firstShownItemIndex = _ref4.firstShownItemIndex,\n lastShownItemIndex = _ref4.lastShownItemIndex,\n beforeItemsHeight = _ref4.beforeItemsHeight,\n afterItemsHeight = _ref4.afterItemsHeight;\n var prependedItemsCount = _ref5.prependedItemsCount,\n appendedItemsCount = _ref5.appendedItemsCount;\n var itemsCount = _ref6.itemsCount,\n columnsCount = _ref6.columnsCount,\n shouldRestoreScrollPosition = _ref6.shouldRestoreScrollPosition,\n onResetGridLayout = _ref6.onResetGridLayout;\n // const layoutUpdate = {}\n // If the layout stays the same, then simply increase\n // the top and bottom margins proportionally to the amount\n // of the items added.\n var averageItemHeight = this.getAverageItemHeight();\n var verticalSpacing = this.getVerticalSpacing();\n\n if (appendedItemsCount > 0) {\n var appendedRowsCount = Math.ceil(appendedItemsCount / columnsCount);\n var addedHeightAfter = appendedRowsCount * (verticalSpacing + averageItemHeight);\n afterItemsHeight += addedHeightAfter; // layoutUpdate = {\n // \t...layoutUpdate,\n // \tafterItemsHeight\n // }\n }\n\n if (prependedItemsCount > 0) {\n var prependedRowsCount = Math.ceil(prependedItemsCount / columnsCount);\n var addedHeightBefore = prependedRowsCount * (averageItemHeight + verticalSpacing);\n firstShownItemIndex += prependedItemsCount;\n lastShownItemIndex += prependedItemsCount;\n beforeItemsHeight += addedHeightBefore; // If the currently shown items position on screen should be preserved\n // when prepending new items, then it means that:\n // * The current scroll position should be snapshotted.\n // * The current list height should be snapshotted.\n // * All prepended items should be shown so that their height could be\n // measured after they're rendered. Based on the prepended items' height,\n // the scroll position will be restored so that there's no \"jump of content\".\n\n if (shouldRestoreScrollPosition) {\n firstShownItemIndex = 0;\n beforeItemsHeight = 0;\n }\n\n if (prependedItemsCount % columnsCount > 0) {\n // Rows will be rebalanced as a result of prepending new items,\n // and row heights can change as a result, so re-layout items\n // after they've been measured (after the upcoming re-render).\n //\n // For example, consider a web page where item rows are `display: flex`.\n // Suppose there're 3 columns and it shows items from 4 to 6.\n //\n // ------------------------------------------\n // | Apples are | Bananas | Cranberries |\n // | green | | |\n // ------------------------------------------\n // | Dates | Elderberry | Figs are |\n // | | | tasty |\n // ------------------------------------------\n //\n // Now, 1 item gets prepended. As a result, all existing rows will have\n // a different set of items, which means that the row heights will change.\n //\n // ------------------------------------------\n // | Zucchini | Apples are | Bananas |\n // | | green | |\n // ------------------------------------------\n // | Cranberries | Dates | Elderberry |\n // ------------------------------------------\n // | Figs |\n // | are tasty |\n // ---------------\n //\n // As it can be seen above, the second row's height has changed from 2 to 1.\n // Not only that, but `itemHeights` have changed as well, so if you thought\n // that the library could easily recalculate row heights using `Math.max()` — \n // turns out it's not always the case.\n //\n // There could be an explicit opt-in option for automatically recalculating\n // row heights, but I don't want to write code for such an extremely rare\n // use case. Instead, use the `getColumnsCount()` parameter function when\n // fetching previous items.\n onResetGridLayout();\n warn('~ Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', columnsCount, '~');\n warn('Layout reset required');\n var shownItemsCountBeforeItemsUpdate = lastShownItemIndex - firstShownItemIndex + 1;\n firstShownItemIndex = 0;\n beforeItemsHeight = 0;\n\n if (!shouldRestoreScrollPosition) {\n // Limit shown items count if too many items have been prepended.\n if (prependedItemsCount > shownItemsCountBeforeItemsUpdate) {\n lastShownItemIndex = this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n }); // Approximate `afterItemsHeight` calculation.\n\n var afterItemsCount = itemsCount - (lastShownItemIndex + 1);\n afterItemsHeight = Math.ceil(afterItemsCount / columnsCount) * (verticalSpacing + averageItemHeight); // layoutUpdate = {\n // \t...layoutUpdate,\n // \tafterItemsHeight\n // }\n }\n }\n } // layoutUpdate = {\n // \t...layoutUpdate,\n // \tbeforeItemsHeight,\n // \tfirstShownItemIndex,\n // \tlastShownItemIndex\n // }\n\n } // return layoutUpdate\n // Overwrite all four props in all scenarios.\n // The reason is that only this way subsequent `setItems()` calls\n // will be truly \"stateless\" when a chain of `setItems()` calls\n // could be replaced with just the last one in a scenario when\n // `updateState()` calls are \"asynchronous\" (delayed execution).\n //\n // So, for example, the user calls `setItems()` with one set of items.\n // A `updateState()` call has been dispatched but the `state` hasn't been updated yet.\n // Then the user calls `setItems()` with another set of items.\n // If this function only returned a minimal set of properties that actually change,\n // the other layout properties of the second `setItems()` call wouldn't overwrite the ones\n // scheduled for update during the first `setItems()` call, resulting in an inconsistent `state`.\n //\n // For example, the first `setItems()` call does a `updateState()` call where it updates\n // `afterItemsHeight`, and then the second `setItems()` call only updates `beforeItemsHeight`\n // and `firstShownItemIndex` and `lastShownItemIndex`. If the second `setItems()` call was to\n // overwrite any effects of the pending-but-not-yet-applied first `setItems()` call, it would\n // have to call `updateState()` with an `afterItemsHeight` property too, even though it hasn't change.\n // That would be just to revert the change to `afterItemsHeight` state property already scheduled\n // by the first `setItems()` call.\n //\n\n\n return {\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n } // If an item that hasn't been shown (and measured) yet is encountered\n // then show such item and then retry after it has been measured.\n\n }, {\n key: \"getItemNotMeasuredIndexes\",\n value: function getItemNotMeasuredIndexes(i, _ref7) {\n var itemsCount = _ref7.itemsCount,\n firstShownItemIndex = _ref7.firstShownItemIndex,\n nonMeasuredAreaHeight = _ref7.nonMeasuredAreaHeight,\n indexOfTheFirstItemInTheRow = _ref7.indexOfTheFirstItemInTheRow;\n log('Item index', i, 'height is required for calculations but hasn\\'t been measured yet. Mark the item as \"shown\", rerender the list, measure the item\\'s height and redo the layout.');\n var columnsCount = this.getColumnsCount();\n var itemsCountToRenderForMeasurement = Math.min(this.getEstimatedRowsCountForHeight(nonMeasuredAreaHeight) * columnsCount, this.measureItemsBatchSize || Infinity);\n\n if (firstShownItemIndex === undefined) {\n firstShownItemIndex = indexOfTheFirstItemInTheRow;\n }\n\n var lastShownItemIndex = Math.min(indexOfTheFirstItemInTheRow + itemsCountToRenderForMeasurement - 1, // Guard against index overflow.\n itemsCount - 1);\n return {\n firstNonMeasuredItemIndex: i,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n /**\r\n * Finds the indexes of the currently visible items.\r\n * @return {object} `{ firstShownItemIndex: number, lastShownItemIndex: number, firstNonMeasuredItemIndex: number? }`\r\n */\n\n }, {\n key: \"getShownItemIndexes\",\n value: function getShownItemIndexes(_ref8) {\n var itemsCount = _ref8.itemsCount,\n visibleAreaTop = _ref8.visibleAreaTop,\n visibleAreaBottom = _ref8.visibleAreaBottom;\n\n var indexes = this._getShownItemIndex({\n itemsCount: itemsCount,\n fromIndex: 0,\n visibleAreaTop: visibleAreaTop,\n visibleAreaBottom: visibleAreaBottom,\n findFirstShownItemIndex: true\n });\n\n if (indexes === null) {\n return this.getNonVisibleListShownItemIndexes();\n }\n\n if (indexes.firstNonMeasuredItemIndex !== undefined) {\n return indexes;\n }\n\n var _indexes = indexes,\n firstShownItemIndex = _indexes.firstShownItemIndex,\n beforeItemsHeight = _indexes.beforeItemsHeight;\n indexes = this._getShownItemIndex({\n itemsCount: itemsCount,\n fromIndex: firstShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n visibleAreaTop: visibleAreaTop,\n visibleAreaBottom: visibleAreaBottom,\n findLastShownItemIndex: true\n });\n\n if (indexes === null) {\n return this.getNonVisibleListShownItemIndexes();\n }\n\n if (indexes.firstNonMeasuredItemIndex !== undefined) {\n return indexes;\n }\n\n var _indexes2 = indexes,\n lastShownItemIndex = _indexes2.lastShownItemIndex;\n return {\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n }, {\n key: \"_getShownItemIndex\",\n value: function _getShownItemIndex(parameters) {\n var beforeResize = parameters.beforeResize,\n itemsCount = parameters.itemsCount,\n visibleAreaTop = parameters.visibleAreaTop,\n visibleAreaBottom = parameters.visibleAreaBottom,\n findFirstShownItemIndex = parameters.findFirstShownItemIndex,\n findLastShownItemIndex = parameters.findLastShownItemIndex;\n var fromIndex = parameters.fromIndex,\n beforeItemsHeight = parameters.beforeItemsHeight; // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n //\n // If someone would attempt to use a \"previously calculated layout\" here\n // then `shownItemsHeight` would also have to be returned from this function:\n // the total height of all shown items including vertical spacing between them.\n //\n // If \"previously calculated layout\" would be used then it would first find\n // `firstShownItemIndex` and then find `lastShownItemIndex` as part of two\n // separate calls of this function, each with or without `backwards` flag,\n // depending on whether `visibleAreaTop` and `visibleAreBottom` have shifted up or down.\n\n var firstShownItemIndex;\n var lastShownItemIndex; // It's not always required to pass `beforeItemsHeight` parameter:\n // when `fromIndex` is `0`, it's also assumed to be `0`.\n\n if (fromIndex === 0) {\n beforeItemsHeight = 0;\n }\n\n if (beforeItemsHeight === undefined) {\n throw new Error('[virtual-scroller] `beforeItemsHeight` not passed to `Layout.getShownItemIndexes()` when starting from index ' + fromIndex);\n } // const backwards = false\n // while (backwards ? i >= 0 : i < itemsCount) {}\n\n\n if (!beforeResize) {\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n\n if (beforeResizeItemsCount > fromIndex) {\n // First search for the item in \"before resize\" items.\n var _this$_getShownItemIn = this._getShownItemIndex(_objectSpread(_objectSpread({}, parameters), {}, {\n beforeResize: true,\n itemsCount: beforeResizeItemsCount\n })),\n notFound = _this$_getShownItemIn.notFound,\n beforeResizeItemsHeight = _this$_getShownItemIn.beforeItemsHeight,\n _firstShownItemIndex = _this$_getShownItemIn.firstShownItemIndex,\n _lastShownItemIndex = _this$_getShownItemIn.lastShownItemIndex; // If the item was not found in \"before resize\" items\n // then search in regular items skipping \"before resize\" ones.\n\n\n if (notFound) {\n beforeItemsHeight = beforeResizeItemsHeight;\n fromIndex += beforeResizeItemsCount;\n } else {\n // If the item was found in \"before resize\" items\n // then return the result.\n // Rebalance first / last shown item indexes based on\n // the current columns count, if required.\n var _columnsCount = this.getColumnsCount();\n\n return {\n firstShownItemIndex: _firstShownItemIndex === undefined ? undefined : Math.floor(_firstShownItemIndex / _columnsCount) * _columnsCount,\n lastShownItemIndex: _lastShownItemIndex === undefined ? undefined : Math.floor(_lastShownItemIndex / _columnsCount) * _columnsCount,\n beforeItemsHeight: beforeResizeItemsHeight\n };\n }\n }\n }\n\n var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();\n var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();\n var i = fromIndex;\n\n while (i < itemsCount) {\n var currentRowFirstItemIndex = i;\n var hasMoreRows = itemsCount > currentRowFirstItemIndex + columnsCount;\n var verticalSpacingAfterCurrentRow = hasMoreRows ? verticalSpacing : 0;\n var currentRowHeight = 0; // Calculate current row height.\n\n var columnIndex = 0;\n\n while (columnIndex < columnsCount && i < itemsCount) {\n var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i); // If this item hasn't been measured yet (or re-measured after a resize)\n // then mark it as the first non-measured one.\n //\n // Can't happen by definition when `beforeResize` parameter is `true`.\n //\n\n if (itemHeight === undefined) {\n return this.getItemNotMeasuredIndexes(i, {\n itemsCount: itemsCount,\n firstShownItemIndex: findLastShownItemIndex ? fromIndex : undefined,\n indexOfTheFirstItemInTheRow: currentRowFirstItemIndex,\n nonMeasuredAreaHeight: visibleAreaBottom + this.getPrerenderMargin() - beforeItemsHeight\n });\n }\n\n currentRowHeight = Math.max(currentRowHeight, itemHeight);\n columnIndex++;\n i++;\n }\n\n var itemsHeightFromFirstRowToThisRow = beforeItemsHeight + currentRowHeight;\n var rowStepsIntoVisibleAreaTop = itemsHeightFromFirstRowToThisRow > visibleAreaTop - this.getPrerenderMargin();\n var rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder = itemsHeightFromFirstRowToThisRow + verticalSpacingAfterCurrentRow >= visibleAreaBottom + this.getPrerenderMargin(); // if (backwards) {\n // \tif (findFirstShownItemIndex) {\n // \t\tif (rowStepsOutOfVisibleAreaTop) {\n // \t\t\treturn {\n // \t\t\t\tfirstShownItemIndex: currentRowFirstItemIndex + columnsCount\n // \t\t\t}\n // \t\t}\n // \t} else if (findLastShownItemIndex) {\n // \t\tif (rowStepsIntoVisibleAreaBottom) {\n // \t\t\treturn {\n // \t\t\t\tlastShownItemIndex: currentRowFirstItemIndex + columnsCount - 1\n // \t\t\t}\n // \t\t}\n // \t}\n // }\n\n if (findFirstShownItemIndex) {\n if (rowStepsIntoVisibleAreaTop) {\n // If item is the first one visible in the viewport\n // then start showing items from this row.\n return {\n firstShownItemIndex: currentRowFirstItemIndex,\n beforeItemsHeight: beforeItemsHeight\n };\n }\n } else if (findLastShownItemIndex) {\n if (rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder) {\n return {\n lastShownItemIndex: Math.min( // The index of the last item in the current row.\n currentRowFirstItemIndex + columnsCount - 1, // Guards against index overflow.\n itemsCount - 1)\n };\n }\n }\n\n beforeItemsHeight += currentRowHeight + verticalSpacingAfterCurrentRow; // if (backwards) {\n // \t// Set `i` to be the first item of the current row.\n // \ti -= columnsCount\n // \tconst prevoiusRowIsBeforeResize = i - 1 < this.getBeforeResizeItemsCount()\n // \tconst previousRowColumnsCount = prevoiusRowIsBeforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount()\n // \t// Set `i` to be the first item of the previous row.\n // \ti -= previousRowColumnsCount\n // }\n } // if (backwards) {\n // \tif (findFirstShownItemIndex) {\n // \t\twarn('The list is supposed to be visible but no visible item has been found (while traversing backwards)')\n // \t\treturn null\n // \t} else if (findLastShownItemIndex) {\n // \t\treturn {\n // \t\t\tfirstShownItemIndex: 0\n // \t\t}\n // \t}\n // }\n\n\n if (beforeResize) {\n return {\n notFound: true,\n beforeItemsHeight: beforeItemsHeight\n };\n } // This case isn't supposed to happen but it could hypothetically happen\n // because the list height is measured from the user's screen and\n // not necessarily can be trusted.\n\n\n if (findFirstShownItemIndex) {\n warn('The list is supposed to be visible but no visible item has been found');\n return null;\n } else if (findLastShownItemIndex) {\n return {\n lastShownItemIndex: itemsCount - 1\n };\n }\n }\n }, {\n key: \"getNonVisibleListShownItemIndexes\",\n value: function getNonVisibleListShownItemIndexes() {\n var layout = {\n firstShownItemIndex: 0,\n lastShownItemIndex: 0\n };\n\n if (this.getItemHeight(0) === undefined) {\n layout.firstNonMeasuredItemIndex = 0;\n }\n\n return layout;\n }\n /**\r\n * Measures \"before\" items height.\r\n * @param {number} beforeItemsCount — Basically, first shown item index.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getBeforeItemsHeight\",\n value: function getBeforeItemsHeight(beforeItemsCount) {\n var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n beforeResize = _ref9.beforeResize;\n\n // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n var beforeItemsHeight = 0;\n var i = 0;\n\n if (!beforeResize) {\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n\n if (beforeResizeItemsCount > 0) {\n // First add all \"before resize\" item heights.\n beforeItemsHeight = this.getBeforeItemsHeight( // `firstShownItemIndex` (called `beforeItemsCount`) could be greater than\n // `beforeResizeItemsCount` when the user scrolls down.\n // `firstShownItemIndex` (called `beforeItemsCount`) could be less than\n // `beforeResizeItemsCount` when the user scrolls up.\n Math.min(beforeItemsCount, beforeResizeItemsCount), {\n beforeResize: true\n });\n i = beforeResizeItemsCount;\n }\n }\n\n var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();\n var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();\n\n while (i < beforeItemsCount) {\n var currentRowFirstItemIndex = i;\n var rowHeight = 0;\n var columnIndex = 0; // Not checking for `itemsCount` overflow here because `i = beforeItemsCount`\n // can only start at the start of a row, meaning that when calculating\n // \"before items height\" it's not supposed to add item heights from the\n // last row of items because in that case it would have to iterate from\n // `i === beforeItemsCount` and that condition is already checked above.\n // while (i < itemsCount) {\n\n while (columnIndex < columnsCount) {\n var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i);\n\n if (itemHeight === undefined) {\n // `itemHeight` can only be `undefined` when not `beforeResize`.\n // Use the current \"average item height\" as a substitute.\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n }\n\n beforeItemsHeight += rowHeight;\n beforeItemsHeight += verticalSpacing;\n }\n\n return beforeItemsHeight;\n }\n /**\r\n * Measures \"after\" items height.\r\n * @param {number} lastShownItemIndex — Last shown item index.\r\n * @param {number} itemsCount — Items count.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getAfterItemsHeight\",\n value: function getAfterItemsHeight(lastShownItemIndex, itemsCount) {\n // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n var columnsCount = this.getColumnsCount();\n var lastShownRowIndex = Math.floor(lastShownItemIndex / columnsCount);\n var afterItemsHeight = 0;\n var i = lastShownItemIndex + 1;\n\n while (i < itemsCount) {\n var rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < columnsCount && i < itemsCount) {\n var itemHeight = this.getItemHeight(i);\n\n if (itemHeight === undefined) {\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n } // Add all \"after\" items height.\n\n\n afterItemsHeight += this.getVerticalSpacing();\n afterItemsHeight += rowHeight;\n }\n\n return afterItemsHeight;\n }\n /**\r\n * Returns the items's top offset relative to the top edge of the first item.\r\n * @param {number} i — Item index\r\n * @return {[number]} Returns `undefined` if any of the previous items haven't been rendered yet.\r\n */\n\n }, {\n key: \"getItemTopOffset\",\n value: function getItemTopOffset(i) {\n var topOffsetInsideScrollableContainer = 0;\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n var beforeResizeRowsCount = beforeResizeItemsCount === 0 ? 0 : Math.ceil(beforeResizeItemsCount / this.getColumnsCountBeforeResize());\n var maxBeforeResizeRowsCount = i < beforeResizeItemsCount ? Math.floor(i / this.getColumnsCountBeforeResize()) : beforeResizeRowsCount;\n var beforeResizeRowIndex = 0;\n\n while (beforeResizeRowIndex < maxBeforeResizeRowsCount) {\n var rowHeight = this.getItemHeightBeforeResize(beforeResizeRowIndex * this.getColumnsCountBeforeResize());\n topOffsetInsideScrollableContainer += rowHeight;\n topOffsetInsideScrollableContainer += this.getVerticalSpacingBeforeResize();\n beforeResizeRowIndex++;\n }\n\n var itemRowIndex = Math.floor((i - beforeResizeItemsCount) / this.getColumnsCount());\n var rowIndex = 0;\n\n while (rowIndex < itemRowIndex) {\n var _rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < this.getColumnsCount()) {\n var itemHeight = this.getItemHeight(beforeResizeItemsCount + rowIndex * this.getColumnsCount() + columnIndex);\n\n if (itemHeight === undefined) {\n return;\n }\n\n _rowHeight = Math.max(_rowHeight, itemHeight);\n columnIndex++;\n }\n\n topOffsetInsideScrollableContainer += _rowHeight;\n topOffsetInsideScrollableContainer += this.getVerticalSpacing();\n rowIndex++;\n }\n\n return topOffsetInsideScrollableContainer;\n }\n }]);\n\n return Layout;\n}();\n\nexport { Layout as default };\nexport var LAYOUT_REASON = {\n SCROLL: 'scroll',\n STOPPED_SCROLLING: 'stopped scrolling',\n MANUAL: 'manual',\n STARTED: 'started',\n NON_MEASURED_ITEMS_HAVE_BEEN_MEASURED: 'non-measured item heights have been measured',\n VIEWPORT_WIDTH_CHANGED: 'viewport width changed',\n VIEWPORT_HEIGHT_CHANGED: 'viewport height changed',\n VIEWPORT_SIZE_UNCHANGED: 'viewport size unchanged',\n ITEM_HEIGHT_CHANGED: 'item height changed',\n ITEMS_CHANGED: 'items changed',\n TOP_OFFSET_CHANGED: 'list top offset changed'\n};\n//# sourceMappingURL=Layout.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport debounce from './utility/debounce.js';\nimport log from './utility/debug.js';\n\nvar Resize = /*#__PURE__*/function () {\n function Resize(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n getWidth = _ref.getWidth,\n getHeight = _ref.getHeight,\n listenForResize = _ref.listenForResize,\n onResizeStart = _ref.onResizeStart,\n onResizeStop = _ref.onResizeStop,\n onHeightChange = _ref.onHeightChange,\n onWidthChange = _ref.onWidthChange,\n onNoChange = _ref.onNoChange;\n\n _classCallCheck(this, Resize);\n\n _defineProperty(this, \"_onResize\", function () {\n // If `VirtualScroller` has been unmounted\n // while `debounce()`'s `setTimeout()` was waiting, then exit.\n // If the `VirtualScroller` gets restarted later, it will detect\n // that `state.scrollableContainerWidth` doesn't match the actual\n // scrollable container width, and will call `this.onResize()`.\n if (!_this.isActive) {\n return;\n }\n\n var prevScrollableContainerWidth = _this.width;\n var prevScrollableContainerHeight = _this.height;\n _this.width = _this.getWidth();\n _this.height = _this.getHeight();\n\n if (_this.width === prevScrollableContainerWidth) {\n if (_this.height === prevScrollableContainerHeight) {\n // The dimensions of the container didn't change,\n // so there's no need to re-layout anything.\n _this.onNoChange();\n } else {\n // Scrollable container height has changed,\n // so just recalculate shown item indexes.\n // No need to perform a re-layout from scratch.\n _this.onHeightChange(prevScrollableContainerHeight, _this.height);\n }\n } else {\n // Reset item heights, because if scrollable container's width (or height)\n // has changed, then the list width (or height) most likely also has changed,\n // and also some CSS `@media()` rules might have been added or removed.\n // So re-render the list entirely.\n _this.onWidthChange(prevScrollableContainerWidth, _this.width);\n }\n });\n\n this.bypass = bypass;\n this.onHeightChange = onHeightChange;\n this.onWidthChange = onWidthChange;\n this.onNoChange = onNoChange;\n this.getWidth = getWidth;\n this.getHeight = getHeight;\n this.listenForResize = listenForResize;\n this.onResize = debounce(this._onResize, SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL, {\n onStart: onResizeStart,\n onStop: onResizeStop\n });\n }\n\n _createClass(Resize, [{\n key: \"start\",\n value: function start() {\n this.isActive = true;\n\n if (this.bypass) {\n return;\n }\n\n this.width = this.getWidth();\n this.height = this.getHeight();\n this.unlistenResize = this.listenForResize(this.onResize);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isActive = false;\n this.width = undefined;\n this.height = undefined;\n\n if (this.unlistenResize) {\n this.unlistenResize();\n this.unlistenResize = undefined;\n }\n }\n /**\r\n * On scrollable container resize.\r\n */\n\n }]);\n\n return Resize;\n}();\n\nexport { Resize as default };\nvar SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL = 250;\n//# sourceMappingURL=Resize.js.map","// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\n/**\r\n * Same as `lodash`'s `debounce()` for functions with no arguments.\r\n * @param {function} func — The function.\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function} A function that returns a `Promise` which resolves when the underlying (original) function gets executed.\r\n */\n\nexport default function debounce(func, interval) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n onStart = _ref.onStart,\n onStop = _ref.onStop;\n\n var timeout;\n return function () {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return new Promise(function (resolve) {\n if (timeout) {\n clearTimeout(timeout);\n } else {\n if (onStart) {\n onStart();\n }\n }\n\n timeout = setTimeout(function () {\n timeout = undefined;\n\n if (onStop) {\n onStop();\n }\n\n func.apply(_this, args);\n resolve();\n }, interval);\n });\n };\n}\n//# sourceMappingURL=debounce.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log from './utility/debug.js';\n\nvar BeforeResize = /*#__PURE__*/function () {\n function BeforeResize(_ref) {\n var getState = _ref.getState,\n getVerticalSpacing = _ref.getVerticalSpacing,\n getColumnsCount = _ref.getColumnsCount;\n\n _classCallCheck(this, BeforeResize);\n\n this.getState = getState;\n this.getVerticalSpacing = getVerticalSpacing;\n this.getColumnsCount = getColumnsCount;\n }\n\n _createClass(BeforeResize, [{\n key: \"initializeFromState\",\n value: function initializeFromState(state) {\n this._includesBeforeResizeInState = Boolean(state.beforeResize);\n } // Cleans up \"before resize\" item heights and adjusts the scroll position accordingly.\n //\n // Hypothetically, it could also wait for the user to stop scrolling and only then\n // adjust the scroll position. The rationale is that if `window.scrollTo()` is called\n // while the user is scrolling, the user would occasionally experience \"lost\" mouse wheel\n // events when scrolling with a mouse wheel.\n //\n // Seems like Twitter's website waits for the user to stop scrolling before applying\n // the scroll position correction after a window resize. This library could do that too,\n // but that would require rewriting \"before items height\" top padding calculation\n // so that it doesn't re-calculate it on every re-render and instead does so incrementally,\n // and then, when the user stops, it re-calculates it from scratch removing the error\n // and adjusting the scroll position accordingly so that there's no \"jump of content\".\n //\n // But, seems like it works fine as it is and there's no need to rewrite anything.\n //\n\n }, {\n key: \"cleanUpBeforeResizeItemHeights\",\n value: function cleanUpBeforeResizeItemHeights() {\n var _this$getState = this.getState(),\n firstShownItemIndex = _this$getState.firstShownItemIndex,\n lastShownItemIndex = _this$getState.lastShownItemIndex,\n itemHeights = _this$getState.itemHeights,\n beforeResize = _this$getState.beforeResize; // If there're \"before resize\" properties in `state`\n // then it means that the corresponding items are waiting to be\n // re-measured after container resize. Since the resize,\n // some of those non-re-measured items might have just been measured,\n // so see if that's true, and if it is, remove those now-obsolete\n // \"before resize\" item heights and ajust the scroll position\n // so that there's no \"content jumping\".\n\n\n if (beforeResize) {\n // If the user has scrolled up to reveal a previously hidden item\n // that has not yet been re-measured after a previous resize.\n if (firstShownItemIndex < beforeResize.itemHeights.length) {\n log('~ Clean up \"before resize\" item heights and correct scroll position ~'); // Some of the \"before\" items have been un-hidden and re-measured.\n // Un-hiding those items would result in a \"jump of content\"\n // because \"before resize\" heights of those un-hidden items\n // could (and most likely will) be different from the current ones,\n // or because \"before resize\" columns count is different from\n // the current one.\n // To prevent a \"jump of content\", calculate the scroll position\n // difference and adjust the scroll position.\n // The height of the item rows that have transitioned\n // from hidden to shown.\n\n var newlyShownItemRowsHeight = 0; // Some of the `itemHeights` between the current `firstShownItemIndex` and\n // the previous `firstShownItemIndex` could stay `undefined` if the user\n // scrolled \"abruptly\": for example, by using a `window.scrollTo()` call.\n // In that case, the items below the visible ones won't be rendered and measured.\n // In such case, limit the items being iterated over to the current `lastShownItemIndex`\n // rather than the previous `firstShownItemIndex`.\n\n var prevFirstReMeasuredItemsRowIndex = Math.floor(beforeResize.itemHeights.length / this.getColumnsCount());\n var newlyShownItemsToIndex = Math.min(prevFirstReMeasuredItemsRowIndex * this.getColumnsCount() - 1, lastShownItemIndex);\n var i = firstShownItemIndex;\n\n while (i <= newlyShownItemsToIndex) {\n // Calculate newly shown row height.\n var rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < this.getColumnsCount() && i <= newlyShownItemsToIndex) {\n var itemHeight = itemHeights[i];\n\n if (itemHeight === undefined) {\n // `itemHeight` can only be `undefined` when not `beforeResize`.\n // Use the current \"average item height\" as a substitute.\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n } // Append to the total \"newly shown item rows height\".\n\n\n newlyShownItemRowsHeight += rowHeight;\n newlyShownItemRowsHeight += this.getVerticalSpacing();\n } // The height of the \"before resize\" item rows\n // that will be \"cleaned up\" in this function call.\n\n\n var cleanedUpBeforeResizeItemRowsHeight = 0; // Some of the `beforeResize` item rows might have been skipped if the user\n // scrolled up \"abruptly\": for example, by using a `window.scrollTo()` call.\n // In that case, the \"before resize\" items below the bottom border of the screen\n // shouldn't be accounted for when calculating the scrollbar adjustment shift\n // because items after `lastShownItemIndex` aren't participating in the calculation\n // of `newlyShownItemRowsHeight`.\n\n var maxParticipatingBeforeResizeItemsCount = Math.min(beforeResize.itemHeights.length, lastShownItemIndex + 1);\n var participatingBeforeResizeItemRowsCount = Math.ceil(maxParticipatingBeforeResizeItemsCount / beforeResize.columnsCount);\n var firstCleanedUpBeforeResizeItemsRowIndex = firstShownItemIndex === 0 ? 0 : Math.floor((firstShownItemIndex - 1) / beforeResize.columnsCount) + 1;\n var k = firstCleanedUpBeforeResizeItemsRowIndex;\n\n while (k < participatingBeforeResizeItemRowsCount) {\n var _rowHeight = beforeResize.itemHeights[k * beforeResize.columnsCount];\n cleanedUpBeforeResizeItemRowsHeight += _rowHeight;\n cleanedUpBeforeResizeItemRowsHeight += beforeResize.verticalSpacing;\n k++;\n } // Schedule an asynchronous `this.updateState()` call that will update\n // `beforeResize` property of `state`. Ideally, it should be updated\n // immediately, but since `this.updateState()` calls are asynchronous,\n // the code updates just the underlying `beforeResize.itemHeights`\n // array immediately instead, which is still a hack but still a lesser one.\n\n\n if (firstShownItemIndex === 0) {\n log('Drop all \"before resize\" item heights');\n } else {\n var firstDroppedBeforeResizeItemIndex = firstShownItemIndex;\n var lastDroppedBeforeResizeItemIndex = beforeResize.itemHeights.length - 1;\n\n if (firstDroppedBeforeResizeItemIndex === lastDroppedBeforeResizeItemIndex) {\n log('For item index', firstDroppedBeforeResizeItemIndex, '— drop \"before resize\" height', beforeResize.itemHeights[firstDroppedBeforeResizeItemIndex]);\n } else {\n log('For item indexes from', firstDroppedBeforeResizeItemIndex, 'to', lastDroppedBeforeResizeItemIndex, '— drop \"before resize\" heights', beforeResize.itemHeights.slice(firstDroppedBeforeResizeItemIndex));\n }\n } // Immediately update `beforeResize.itemHeights`\n // so that the component isn't left in an inconsistent state\n // before a `this.updateState()` call below is applied.\n\n\n beforeResize.itemHeights.splice(firstShownItemIndex, beforeResize.itemHeights.length - firstShownItemIndex); // Return the \"scroll by\" amount that would correct the scroll position.\n // Also return a state update.\n\n return {\n scrollBy: newlyShownItemRowsHeight - cleanedUpBeforeResizeItemRowsHeight,\n beforeResize: firstShownItemIndex === 0 ? undefined : _objectSpread({}, beforeResize)\n };\n }\n }\n } // Snapshots \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no \"content jumping\".\n //\n // `newFirstShownItemIndex` is `> 0`.\n //\n\n }, {\n key: \"snapshotBeforeResizeItemHeights\",\n value: function snapshotBeforeResizeItemHeights(_ref2) {\n var firstShownItemIndex = _ref2.firstShownItemIndex,\n newFirstShownItemIndex = _ref2.newFirstShownItemIndex,\n newColumnsCount = _ref2.newColumnsCount;\n var columnsCount = this.getColumnsCount();\n var verticalSpacing = this.getVerticalSpacing();\n this._includesBeforeResizeInState = true;\n\n var _this$getState2 = this.getState(),\n prevBeforeResize = _this$getState2.beforeResize,\n itemHeights = _this$getState2.itemHeights;\n\n var prevBeforeResizeItemsCount = prevBeforeResize ? prevBeforeResize.itemHeights.length : 0; // If there already are \"before resize\" values in `state`\n // then it means that those should be merged with the new ones.\n //\n // `beforeResize.itemHeights` could be empty in an edge case\n // when there's a pending state update that sets `beforeResize`\n // to `undefined`, and in that case empty `beforeResize.itemHeights`\n // signals about that type of a situation.\n //\n\n if (prevBeforeResizeItemsCount > 0) {\n // Because the \"previous\" before resize values might have been captured\n // for a window width corresponding to a layout with a different columns count\n // and different vertical spacing, re-calculate those item heights as if\n // they corresponded to the current columns count and current vertical spacing,\n // since \"previous\" and \"new\" before resize item heights are gonna be merged.\n if (prevBeforeResize.columnsCount !== columnsCount || prevBeforeResize.verticalSpacing !== verticalSpacing) {\n var prevBeforeResizeBeforeItemsHeight = 0;\n var prevBeforeResizeItemRowsCount = Math.ceil(prevBeforeResizeItemsCount / prevBeforeResize.columnsCount);\n var rowIndex = 0;\n\n while (rowIndex < prevBeforeResizeItemRowsCount) {\n // Since all \"before resize\" item heights are equal within a row,\n // the height of the first \"before resize\" item in a row is that row's height.\n var rowHeight = prevBeforeResize.itemHeights[rowIndex * prevBeforeResize.columnsCount];\n prevBeforeResizeBeforeItemsHeight += rowHeight;\n prevBeforeResizeBeforeItemsHeight += prevBeforeResize.verticalSpacing;\n rowIndex++;\n }\n\n var newBeforeResizeAdditionalBeforeItemsHeight = 0;\n var i = firstShownItemIndex;\n\n while (i < newFirstShownItemIndex) {\n var _rowHeight2 = 0;\n var k = 0;\n\n while (k < columnsCount && i < newFirstShownItemIndex) {\n _rowHeight2 = Math.max(_rowHeight2, itemHeights[i]);\n k++;\n i++;\n }\n\n newBeforeResizeAdditionalBeforeItemsHeight += _rowHeight2;\n newBeforeResizeAdditionalBeforeItemsHeight += verticalSpacing;\n }\n\n var newBeforeResizeBeforeItemsHeight = prevBeforeResizeBeforeItemsHeight + newBeforeResizeAdditionalBeforeItemsHeight;\n var newBeforeResizeBeforeItemRowsCount = Math.ceil(newFirstShownItemIndex / columnsCount);\n return new Array(newFirstShownItemIndex).fill( // Re-calculate \"before resize\" item heights so that \"previous\" and \"new\" ones\n // correspond to the same (new) columns count.\n // Also don't occasionally set item heights to `< 0`.\n Math.max(0, newBeforeResizeBeforeItemsHeight / newBeforeResizeBeforeItemRowsCount - verticalSpacing));\n } else {\n // Add new item heights to the previously snapshotted ones.\n return prevBeforeResize.itemHeights.concat(equalizeItemHeights(itemHeights, newFirstShownItemIndex, columnsCount).slice(prevBeforeResize.itemHeights.length));\n }\n } else {\n return equalizeItemHeights(itemHeights, newFirstShownItemIndex, columnsCount);\n }\n }\n }, {\n key: \"shouldIncludeBeforeResizeValuesInState\",\n value: function shouldIncludeBeforeResizeValuesInState() {\n return this._includesBeforeResizeInState;\n }\n }]);\n\n return BeforeResize;\n}(); // Equalizes all item heights within a given row, for each row.\n//\n// The reason is that `beforeResize.itemHeights` is not necessarily divisible by\n// `beforeResize.columnsCount`, which would result in varying last row height\n// as items get removed from `beforeResize.itemHeights` as the user scrolls up.\n//\n// By equalizing all item heights within a given row, for each row, such \"jumping\"\n// last \"before resize\" row height is prevented when the user scrolls up.\n//\n\n\nexport { BeforeResize as default };\n\nfunction equalizeItemHeights(itemHeights, maxItemsCount, columnsCount) {\n itemHeights = itemHeights.slice(0, Math.ceil(maxItemsCount / columnsCount) * columnsCount);\n var rowIndex = 0;\n\n while (rowIndex * columnsCount < maxItemsCount) {\n // Calculate row height.\n var rowHeight = 0;\n var k = 0;\n\n while (k < columnsCount) {\n rowHeight = Math.max(rowHeight, itemHeights[rowIndex * columnsCount + k]);\n k++;\n } // Equalize all item heights within the row.\n\n\n k = 0;\n\n while (k < columnsCount) {\n itemHeights[rowIndex * columnsCount + k] = rowHeight;\n k++;\n } // Proceed with the next row.\n\n\n rowIndex++;\n }\n\n return itemHeights.slice(0, maxItemsCount);\n}\n\nexport function cleanUpBeforeResizeState(state) {\n if (state.beforeResize) {\n if (state.beforeResize.itemHeights.length === 0) {\n state.beforeResize = undefined;\n }\n }\n\n return state;\n}\n//# sourceMappingURL=BeforeResize.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\nimport log from './utility/debug.js';\n\nvar Scroll = /*#__PURE__*/function () {\n function Scroll(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n scrollableContainer = _ref.scrollableContainer,\n itemsContainer = _ref.itemsContainer,\n onScroll = _ref.onScroll,\n initialScrollPosition = _ref.initialScrollPosition,\n onScrollPositionChange = _ref.onScrollPositionChange,\n isImmediateLayoutScheduled = _ref.isImmediateLayoutScheduled,\n hasNonRenderedItemsAtTheTop = _ref.hasNonRenderedItemsAtTheTop,\n hasNonRenderedItemsAtTheBottom = _ref.hasNonRenderedItemsAtTheBottom,\n getLatestLayoutVisibleArea = _ref.getLatestLayoutVisibleArea,\n getListTopOffset = _ref.getListTopOffset,\n getPrerenderMargin = _ref.getPrerenderMargin,\n onScrolledToTop = _ref.onScrolledToTop,\n waitForScrollingToStop = _ref.waitForScrollingToStop;\n\n _classCallCheck(this, Scroll);\n\n _defineProperty(this, \"scrollByY\", function (scrollByY) {\n _this.scrollToY(_this.getScrollY() + scrollByY);\n });\n\n _defineProperty(this, \"onScrollListener\", function () {\n if (_this.onScrollPositionChange) {\n _this.onScrollPositionChange(_this.getScrollY());\n } // If the user has scrolled up to the top of the items container.\n // (this option isn't currently used)\n\n\n if (_this.onScrolledToTop) {\n if (_this.getScrollY() < _this.getListTopOffset()) {\n _this.onScrolledToTop();\n }\n }\n\n if (_this.bypass) {\n return;\n }\n\n if (_this.ignoreScrollEvents) {\n return;\n } // Prefer not performing a re-layout while the user is scrolling (if possible).\n // If the user doesn't scroll too far and then stops for a moment,\n // then a mid-scroll re-layout could be delayed until such a brief stop:\n // presumably, this results in better (smoother) scrolling performance,\n // delaying the work to when it doesn't introduce any stutter or \"jank\".\n // Reset `this.onStopScrollingTimer` (will be re-created below).\n\n\n _this.cancelOnStopScrollingTimer(); // See if the latest \"layout\" (the currently rendered set of items)\n // is still sufficient in order to show all the items that're\n // currently inside the viewport. If there're some non-rendered items\n // that're visible in the current viewport, then those items\n // should be rendered \"immediately\" rather than waiting until\n // the user stops scrolling.\n\n\n var forceUpdate = // If the items have been rendered at least once\n _this.getLatestLayoutVisibleArea() && ( // If the user has scrolled up past the \"prerender margin\"\n // and there're some non-rendered items at the top,\n // then force a re-layout.\n //\n // (during these calculations we assume that the list's top coordinate\n // hasn't changed since previous layout; even if that's not exactly true,\n // the items will be re-layout when the user stops scrolling anyway)\n //\n _this.getScrollY() < _this.getLatestLayoutVisibleArea().top - _this.getPrerenderMargin() && _this.hasNonRenderedItemsAtTheTop() || // If the user has scrolled down past the \"prerender margin\"\n // and there're any non-rendered items left at the end,\n // then force a re-layout.\n //\n // (during these calculations we assume that the list's top coordinate\n // hasn't changed since previous layout; even if that's not exactly true,\n // the items will be re-layout when the user stops scrolling anyway)\n //\n _this.getScrollY() + _this.scrollableContainer.getHeight() > _this.getLatestLayoutVisibleArea().bottom + _this.getPrerenderMargin() && _this.hasNonRenderedItemsAtTheBottom());\n\n if (forceUpdate) {\n log('The user has scrolled far enough: perform a re-layout');\n } else {\n log('The user is scrolling: perform a re-layout when they stop scrolling');\n }\n\n if (forceUpdate || _this.waitForScrollingToStop === false) {\n return _this.onScroll();\n } // If a re-layout is already scheduled at the next \"frame\",\n // don't schedule a \"re-layout when user stops scrolling\" timer.\n\n\n if (_this.isImmediateLayoutScheduled()) {\n return;\n }\n\n _this.shouldCallOnScrollListenerWhenStopsScrolling = true;\n\n _this.watchOnStopScrolling();\n });\n\n this.bypass = bypass;\n this.scrollableContainer = scrollableContainer;\n this.itemsContainer = itemsContainer;\n this.onScroll = onScroll;\n this.initialScrollPosition = initialScrollPosition;\n this.onScrollPositionChange = onScrollPositionChange;\n this.isImmediateLayoutScheduled = isImmediateLayoutScheduled;\n this.hasNonRenderedItemsAtTheTop = hasNonRenderedItemsAtTheTop;\n this.hasNonRenderedItemsAtTheBottom = hasNonRenderedItemsAtTheBottom;\n this.getLatestLayoutVisibleArea = getLatestLayoutVisibleArea;\n this.getListTopOffset = getListTopOffset;\n this.getPrerenderMargin = getPrerenderMargin;\n this.onScrolledToTop = onScrolledToTop;\n this.waitForScrollingToStop = waitForScrollingToStop;\n }\n\n _createClass(Scroll, [{\n key: \"start\",\n value: function start() {\n if (this.initialScrollPosition !== undefined) {\n this.scrollToY(this.initialScrollPosition);\n this.initialScrollPosition = undefined;\n }\n\n if (this.onScrollPositionChange) {\n this.onScrollPositionChange(this.getScrollY());\n }\n\n this.stopListeningToScroll = this.scrollableContainer.onScroll(this.onScrollListener);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.stopListeningToScroll();\n this.stopListeningToScroll = undefined; // this.onStopScrollingListener = undefined\n\n this.shouldCallOnScrollListenerWhenStopsScrolling = undefined;\n this.cancelOnStopScrollingTimer();\n }\n }, {\n key: \"scrollToY\",\n value: function scrollToY(scrollY) {\n this.ignoreScrollEvents = true;\n this.scrollableContainer.scrollToY(scrollY);\n this.ignoreScrollEvents = undefined;\n }\n }, {\n key: \"getScrollY\",\n value: function getScrollY() {\n return this.scrollableContainer.getScrollY();\n }\n }, {\n key: \"cancelOnStopScrollingTimer\",\n value: function cancelOnStopScrollingTimer() {\n if (this.onStopScrollingTimer) {\n clearTimeout(this.onStopScrollingTimer);\n this.onStopScrollingTimer = undefined;\n }\n }\n }, {\n key: \"cancelScheduledLayout\",\n value: function cancelScheduledLayout() {\n // Cancel a \"re-layout when user stops scrolling\" timer.\n this.cancelOnStopScrollingTimer();\n }\n }, {\n key: \"watchOnStopScrolling\",\n value: function watchOnStopScrolling() {\n var _this2 = this;\n\n this.onStopScrollingTimer = setTimeout(function () {\n _this2.onStopScrollingTimer = undefined;\n\n if (_this2.shouldCallOnScrollListenerWhenStopsScrolling) {\n _this2.shouldCallOnScrollListenerWhenStopsScrolling = undefined;\n\n _this2.onScroll({\n delayed: true\n });\n } // `onStopScrolling()` feature is not currently used.\n // if (this.onStopScrollingListener) {\n // \tconst onStopScrollingListener = this.onStopScrollingListener\n // \tthis.onStopScrollingListener = undefined\n // \t// `onStopScrollingListener()` may hypothetically schedule\n // \t// another `onStopScrolling()` listener, so set\n // \t// `this.onStopScrollingListener` to `undefined` before\n // \t// calling it rather than after.\n // \tlog('~ The user has stopped scrolling ~')\n // \tonStopScrollingListener()\n // }\n\n }, // \"scroll\" events are usually dispatched every 16 milliseconds\n // for 60fps refresh rate, so waiting for 100 milliseconds feels\n // reasonable: that would be about 6 frames of inactivity period,\n // which could mean that either the user has stopped scrolling\n // (for a moment) or the browser is lagging and stuttering\n // (skipping frames due to high load).\n // If the user continues scrolling then this timeout is constantly\n // refreshed (cancelled and then re-created).\n ON_STOP_SCROLLING_INACTIVE_PERIOD);\n } // (this function isn't currently used)\n // onStopScrolling(onStopScrollingListener) {\n // \tthis.onStopScrollingListener = onStopScrollingListener\n // \tif (!this.onStopScrollingTimer) {\n // \t\tthis.watchOnStopScrolling()\n // \t}\n // }\n\n /**\r\n * Returns visible area coordinates relative to the scrollable container.\r\n * @return {object} `{ top: number, bottom: number }`\r\n */\n\n }, {\n key: \"getVisibleAreaBounds\",\n value: function getVisibleAreaBounds() {\n var scrollY = this.getScrollY();\n return {\n // The first pixel of the screen.\n top: scrollY,\n // The pixel after the last pixel of the screen.\n bottom: scrollY + this.scrollableContainer.getHeight()\n };\n }\n }]);\n\n return Scroll;\n}();\n\nexport { Scroll as default };\nvar ON_STOP_SCROLLING_INACTIVE_PERIOD = 100;\n//# sourceMappingURL=Scroll.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nvar ListHeightMeasurement = /*#__PURE__*/function () {\n function ListHeightMeasurement(_ref) {\n var itemsContainer = _ref.itemsContainer,\n getListTopOffset = _ref.getListTopOffset;\n\n _classCallCheck(this, ListHeightMeasurement);\n\n this.itemsContainer = itemsContainer;\n this.getListTopOffset = getListTopOffset;\n }\n /**\r\n * Snapshots the list height while `previousItems` are still rendered,\r\n * before rendering `newItems`. The list height will be re-measured\r\n * after the new items have been rendered, yielding the list height difference\r\n * which is gonna be the amount to scroll vertically in order to restore\r\n * the previous scroll position. Is only used when prepending items.\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @param {number} prependedItemsCount\r\n */\n\n\n _createClass(ListHeightMeasurement, [{\n key: \"snapshotListHeightBeforeAddingNewItems\",\n value: function snapshotListHeightBeforeAddingNewItems(_ref2) {\n var previousItems = _ref2.previousItems,\n newItems = _ref2.newItems,\n prependedItemsCount = _ref2.prependedItemsCount;\n\n // If there were no items in the list\n // then there's no point in restoring scroll position.\n if (previousItems.length === 0) {\n return;\n } // If no items were prepended then no need to restore scroll position.\n\n\n if (prependedItemsCount === 0) {\n return;\n } // The first item is supposed to be shown when the user clicks\n // \"Show previous items\" button. If it isn't shown though,\n // could still calculate the first item's top position using\n // the values from `itemHeights` and `verticalSpacing`.\n // But that would be a weird non-realistic scenario.\n // if (firstShownItemIndex > 0) {\n // \tlet i = firstShownItemIndex - 1\n // \twhile (i >= 0) {\n // \t\tfirstItemTopOffset += itemHeights[i] + verticalSpacing\n // \t\ti--\n // \t}\n // }\n // This part is longer relevant: <ReactVirtualScroller/> no longer calls\n // this function two times consequtively.\n //\n // // If the scroll position has already been captured for restoration,\n // // then don't capture it the second time.\n // if (this._snapshot &&\n // \tthis._snapshot.previousItems === previousItems &&\n // \tthis._snapshot.newItems === newItems) {\n // \treturn\n // }\n\n\n this._snapshot = {\n previousItems: previousItems,\n newItems: newItems,\n itemIndex: prependedItemsCount,\n itemTopOffset: this.itemsContainer.getNthRenderedItemTopOffset(0),\n // Snapshot list top offset inside the scrollable container too\n // because it's common to hide the \"Show previous items\" button\n // when the user has browsed to the top of the list, which causes\n // the list's top position to shift upwards due to the button\n // no longer being rendered. Tracking list top offset doesn't\n // fit here that well, but it makes sense in real-world applications.\n listTopOffset: this.getListTopOffset()\n };\n }\n }, {\n key: \"getAnchorItemIndex\",\n value: function getAnchorItemIndex() {\n return this._snapshot.itemIndex;\n }\n }, {\n key: \"hasSnapshot\",\n value: function hasSnapshot() {\n return this._snapshot !== undefined;\n }\n }, {\n key: \"getListBottomOffsetChange\",\n value: function getListBottomOffsetChange() {\n var _this$_snapshot = this._snapshot,\n itemIndex = _this$_snapshot.itemIndex,\n itemTopOffset = _this$_snapshot.itemTopOffset,\n listTopOffset = _this$_snapshot.listTopOffset; // `firstShownItemIndex` is supposed to be `0` at this point,\n // so `renderedElementIndex` would be the same as the `itemIndex`.\n\n var itemTopOffsetNew = this.itemsContainer.getNthRenderedItemTopOffset(itemIndex);\n var listTopOffsetNew = this.getListTopOffset();\n return itemTopOffsetNew - itemTopOffset + (listTopOffsetNew - listTopOffset);\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this._snapshot = undefined;\n }\n }]);\n\n return ListHeightMeasurement;\n}();\n\nexport { ListHeightMeasurement as default };\n//# sourceMappingURL=ListHeightMeasurement.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\n\nvar ItemHeights = /*#__PURE__*/function () {\n function ItemHeights(_ref) {\n var container = _ref.container,\n itemHeights = _ref.itemHeights,\n getItemHeight = _ref.getItemHeight,\n setItemHeight = _ref.setItemHeight;\n\n _classCallCheck(this, ItemHeights);\n\n this.container = container;\n this._get = getItemHeight;\n this._set = setItemHeight;\n this.reset();\n }\n\n _createClass(ItemHeights, [{\n key: \"reset\",\n value: function reset() {\n this.measuredItemsHeight = 0; // \"First measured item index\" variable was introduced\n // because it's not always `0`: when `virtualScroller.setItems()`\n // is called, some items might get prepended, in which case\n // `this.lastMeasuredItemIndex` is updated. If there was no\n // `this.firstMeasuredItemIndex`, then the average item height\n // calculated in `.getAverage()` would be incorrect in the timeframe\n // between `.setItems()` is called and those changes have been rendered.\n // And in that timeframe, `.getAverage()` is used to calculate the \"layout\":\n // stuff like \"before/after items height\" and \"estimated items count on screen\".\n\n this.firstMeasuredItemIndex = undefined;\n this.lastMeasuredItemIndex = undefined;\n }\n /**\r\n * Can only be called after a `.reset()` (including new instance creation).\r\n * Initializes `this.measuredItemsHeight`, `this.firstMeasuredItemIndex`\r\n * and `this.lastMeasuredItemIndex` instance variables from `VirtualScroller` `state`.\r\n * These instance variables are used when calculating \"average\" item height:\r\n * the \"average\" item height is simply `this.measuredItemsHeight` divided by\r\n * `this.lastMeasuredItemIndex` minus `this.firstMeasuredItemIndex` plus 1.\r\n */\n\n }, {\n key: \"readItemHeightsFromState\",\n value: function readItemHeightsFromState(_ref2) {\n var itemHeights = _ref2.itemHeights;\n var i = 0;\n\n while (i < itemHeights.length) {\n if (itemHeights[i] === undefined) {\n if (this.firstMeasuredItemIndex !== undefined) {\n this.lastMeasuredItemIndex = i - 1;\n break;\n }\n } else {\n if (this.firstMeasuredItemIndex === undefined) {\n this.firstMeasuredItemIndex = i;\n }\n\n this.measuredItemsHeight += itemHeights[i];\n }\n\n i++;\n }\n } // Seems to be no longer used.\n // getItemHeight(i, firstShownItemIndex) {\n // \tif (this._get(i)) {\n // \t\treturn this._get(i)\n // \t}\n // \tconst itemHeight = this._measureItemHeight(i, firstShownItemIndex)\n // \tif (itemHeight) {\n // \t\tthis._set(i, itemHeight)\n // \t\treturn itemHeight\n // \t}\n // \treturn this.getAverage()\n // }\n\n }, {\n key: \"_measureItemHeight\",\n value: function _measureItemHeight(i, firstShownItemIndex) {\n return this.container.getNthRenderedItemHeight(i - firstShownItemIndex);\n }\n /**\r\n * Measures item heights:\r\n *\r\n * * For the items that haven't been previously measured,\r\n * measures them for the first time.\r\n *\r\n * * For the items that have been previoulsy measured,\r\n * validate that their previously measured height\r\n * is still equal to their current height.\r\n * The unequalness may not necessarily be caused by\r\n * incorrect use of `virtual-scroller`: there are\r\n * also some valid use cases when such unequalness\r\n * could happen (see the comments in the code).\r\n *\r\n * @param {number} firstShownItemIndex\r\n * @param {number} lastShownItemIndex\r\n * @return {number[]} The indexes of the items that have not previously been measured and have been measured now.\r\n */\n\n }, {\n key: \"measureItemHeights\",\n value: function measureItemHeights(firstShownItemIndex, lastShownItemIndex) {\n log('~ Measure item heights ~'); // If no items are rendered, don't measure anything.\n\n if (firstShownItemIndex === undefined) {\n return;\n } // Reset `this.measuredItemsHeight` if it's not a \"continuous\" measured items list:\n // if a group of items has been measured previously, and now it has rendered a completely\n // different group of items, and there's a non-measured \"gap\" between those two groups,\n // then reset `this.measuredItemsHeight` and \"first measured\"/\"last measured\" item indexes.\n // For example, this could happen when `.setItems()` prepends a lot of new items.\n\n\n if (this.firstMeasuredItemIndex !== undefined) {\n if (firstShownItemIndex > this.lastMeasuredItemIndex + 1 || lastShownItemIndex < this.firstMeasuredItemIndex - 1) {\n // Reset.\n log('Non-measured items gap detected. Reset first and last measured item indexes.');\n this.reset();\n }\n }\n\n var nonPreviouslyMeasuredItemIndexes = [];\n var previousFirstMeasuredItemIndex = this.firstMeasuredItemIndex;\n var previousLastMeasuredItemIndex = this.lastMeasuredItemIndex;\n var firstMeasuredItemIndexHasBeenUpdated = false;\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n // Measure item heights that haven't been measured previously.\n // Don't re-measure item heights that have been measured previously.\n // The rationale is that developers are supposed to manually call\n // `.onItemHeightDidChange()` immediately every time an item's height has changed.\n // If developers don't neglect that rule, item heights won't\n // change unexpectedly.\n if (this._get(i) === undefined) {\n nonPreviouslyMeasuredItemIndexes.push(i);\n\n var height = this._measureItemHeight(i, firstShownItemIndex);\n\n log('Item index', i, 'height', height);\n\n this._set(i, height); // Update average item height calculation variables\n // related to the previously measured items\n // that're above the items currently being shown.\n // It is known to be a \"continuous\" measured items list,\n // because the code at the start of this function checks that.\n\n\n if (previousFirstMeasuredItemIndex === undefined || i < previousFirstMeasuredItemIndex) {\n this.measuredItemsHeight += height; // Update first measured item index.\n\n if (!firstMeasuredItemIndexHasBeenUpdated) {\n // log('Set first measured item index', i)\n this.firstMeasuredItemIndex = i;\n firstMeasuredItemIndexHasBeenUpdated = true;\n }\n } // Update average item height calculation variables\n // related to the previously measured items\n // that're below the items currently being shown.\n // It is known to be a \"continuous\" measured items list,\n // because the code at the start of this function checks that.\n\n\n if (previousLastMeasuredItemIndex === undefined || i > previousLastMeasuredItemIndex) {\n // If `previousLastMeasuredItemIndex` is `undefined`\n // then `previousFirstMeasuredItemIndex` is also `undefined`\n // which means that the item's `height` has already been added\n // to `this.measuredItemsHeight` in the code above,\n // so this condition guards against counting the item's `height`\n // twice in `this.measuredItemsHeight`.\n if (previousLastMeasuredItemIndex !== undefined) {\n // Add newly shown item height.\n this.measuredItemsHeight += height;\n } // Update last measured item index.\n\n\n this.lastMeasuredItemIndex = i;\n }\n } else {\n // Validate that the item's height didn't change since it was last measured.\n // If it did, then display a warning and update the item's height\n // as an attempt to fix things.\n // If an item's height changes unexpectedly then it means that there'll\n // likely be \"content jumping\".\n var previousHeight = this._get(i);\n\n var _height = this._measureItemHeight(i, firstShownItemIndex);\n\n if (previousHeight !== _height) {\n warn('Item index', i, 'height changed unexpectedly: it was', previousHeight, 'before, but now it is', _height, '. Whenever an item\\'s height changes for whatever reason, a developer must call `onItemHeightDidChange(i)` right after that change. If you are calling `onItemHeightDidChange(i)` correctly, then there\\'re several other possible causes. For example, perhaps you forgot to persist the item\\'s \"state\" by calling `setItemState(i, newState)` when that \"state\" did change, and so the item\\'s \"state\" got lost when the item element was unmounted, which resulted in a different item height when the item was shown again with no previous \"state\". Or perhaps you\\'re running your application in \"devleopment\" mode and `VirtualScroller` has initially rendered the list before your CSS styles or custom fonts have loaded, resulting in different item height measurements \"before\" and \"after\" the page has fully loaded.'); // Update the item's height as an attempt to fix things.\n\n this._set(i, _height);\n }\n }\n\n i++;\n } // // Update average item height.\n // this.updateAverageItemHeight()\n\n\n return nonPreviouslyMeasuredItemIndexes;\n }\n /**\r\n * Re-measures item height.\r\n * @param {number} i — Item index.\r\n * @param {number} firstShownItemIndex\r\n */\n\n }, {\n key: \"remeasureItemHeight\",\n value: function remeasureItemHeight(i, firstShownItemIndex) {\n var previousHeight = this._get(i);\n\n var height = this._measureItemHeight(i, firstShownItemIndex); // // Because this function is called from `.onItemHeightDidChange()`,\n // // there're no guarantees in which circumstances a developer calls it,\n // // and for which item indexes.\n // // Therefore, to guard against cases of incorrect usage,\n // // this function won't crash anything if the item isn't rendered\n // // or hasn't been previously rendered.\n // if (height !== undefined) {\n // \treportError(`\"onItemHeightDidChange()\" has been called for item ${i}, but that item isn't currently rendered.`)\n // \treturn\n // }\n // if (previousHeight === undefined) {\n // \treportError(`\"onItemHeightDidChange()\" has been called for item ${i}, but that item hasn't been rendered before.`)\n // \treturn\n // }\n\n\n this._set(i, height);\n\n this.measuredItemsHeight += height - previousHeight;\n return height;\n } // /**\n // * \"Average\" item height is stored as an instance variable.\n // * For example, for caching, so that it isn't calculated every time it's requested.\n // * But that would be negligible performance gain, not really worth the extra code.\n // * Another thing it's stored for as an instance variable is\n // * keeping \"previous\" \"average\" item height, because it can be more precise\n // * than the newly calculated \"average\" item height, provided it had\n // * more \"samples\" (measured items). The newly calculated average item height\n // * could get less samples in a scenario when the scroll somehow jumps\n // * from one position to some other distant position: in that case previous\n // * \"total measured items height\" is discarded and the new one is initialized.\n // * Could such situation happen in real life? I guess, it's unlikely.\n // * So I'm commenting out this code, but still keeping it just in case.\n // */\n // updateAverageItemHeight() {\n // \tthis.averageItemHeightSamplesCount = this.lastMeasuredItemIndex - this.firstMeasuredItemIndex + 1\n // \tthis.averageItemHeight = this.measuredItemsHeight / this.averageItemHeightSamplesCount\n // }\n //\n // /**\n // * Public API: is called by `VirtualScroller`.\n // * @return {number}\n // */\n // getAverage() {\n // \t// Previously measured average item height might still be\n // \t// more precise if it contains more measured items (\"samples\").\n // \tif (this.previousAverageItemHeight) {\n // \t\tif (this.previousAverageItemHeightSamplesCount > this.averageItemHeightSamplesCount) {\n // \t\t\treturn this.previousAverageItemHeight\n // \t\t}\n // \t}\n // \treturn this.averageItemHeight || 0\n // }\n\n /**\r\n * Public API: is called by `VirtualScroller`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getAverage\",\n value: function getAverage() {\n if (this.lastMeasuredItemIndex === undefined) {\n return 0;\n }\n\n return this.measuredItemsHeight / (this.lastMeasuredItemIndex - this.firstMeasuredItemIndex + 1);\n }\n }, {\n key: \"onPrepend\",\n value: function onPrepend(count) {\n if (this.firstMeasuredItemIndex !== undefined) {\n this.firstMeasuredItemIndex += count;\n this.lastMeasuredItemIndex += count;\n }\n }\n }]);\n\n return ItemHeights;\n}();\n\nexport { ItemHeights as default };\n//# sourceMappingURL=ItemHeights.js.map","export default function fillArray(array, getItem) {\n var i = 0;\n\n while (i < array.length) {\n array[i] = getItem(i);\n i++;\n }\n\n return array;\n}\n//# sourceMappingURL=fillArray.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// Creates a snapshot of a `state` or a partial update of a `state`.\n// Is only used for logging state snapshots for later debug.\n//\n// When `state` is output to the browser console via `console.log()`,\n// it is explorable in real time. That also means that if that `state`\n// is modified later, the user will see the modified state, not the\n// original one. In the current implementation, `state` is not strictly\n// \"immutable\": things like individual item heights (including \"before resize\" ones)\n// or states are updated in-place — `state.itemHeights[i] = newItemHeight` or\n// `state.itemStates[i] = newItemState`. That's because those `state` properties\n// are the ones that don’t affect the presentation, so there's no need to re-render\n// the list when those do change — updating those properties is just an effect of\n// some change rather than cause for one.\n//\n// So, when outputting `state` via `console.log()` for debug, it makes sense to\n// snapshot it so that the developer, while debugging later, sees the correct\n// item heights or item states.\n//\nexport default function getStateSnapshot(state) {\n var stateSnapshot = _objectSpread({}, state);\n\n if (state.itemHeights) {\n stateSnapshot.itemHeights = state.itemHeights.slice();\n }\n\n if (state.itemStates) {\n stateSnapshot.itemStates = state.itemStates.slice();\n }\n\n if (state.beforeResize) {\n stateSnapshot.beforeResize = _objectSpread({}, state.beforeResize);\n stateSnapshot.beforeResize.itemHeights = state.beforeResize.itemHeights.slice();\n }\n\n return stateSnapshot;\n}\n//# sourceMappingURL=getStateSnapshot.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport fillArray from './utility/fillArray.js';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport { cleanUpBeforeResizeState } from './BeforeResize.js';\nimport getStateSnapshot from './utility/getStateSnapshot.js'; // There're three main places where state is updated:\n//\n// * On scroll.\n// * On window resize.\n// * On set new items.\n//\n// State updates may be \"asynchronous\" (like in React), in which case the\n// corresponding operation is \"pending\" until the state update is applied.\n//\n// If there's a \"pending\" window resize or a \"pending\" update of the set of items,\n// then \"on scroll\" updates aren't dispatched.\n//\n// If there's a \"pending\" on scroll update and the window is resize or a new set\n// of items is set, then that \"pending\" on scroll update gets overwritten.\n//\n// If there's a \"pending\" update of the set of items, then window resize handler\n// sees that \"pending\" update and dispatches its own state update so that the\n// \"pending\" state update originating from `setItems()` is not lost.\n//\n// If there's a \"pending\" window resize, and a new set of items is set,\n// then the state update of the window resize handler gets overwritten.\n\nexport default function createStateHelpers(_ref) {\n var _this = this;\n\n var initialState = _ref.state,\n getInitialItemState = _ref.getInitialItemState,\n onStateChange = _ref.onStateChange,\n render = _ref.render,\n initialItems = _ref.items;\n this.onStateChange = onStateChange;\n this._render = render;\n this.getInitialItemState = getInitialItemState;\n\n this._setItemState = function (i, newItemState) {\n if (isDebug()) {\n log('~ Item state changed ~');\n log('Item index', i); // Uses `JSON.stringify()` here instead of just outputting the JSON objects as is\n // because outputting JSON objects as is would show different results later when\n // the developer inspects those in the web browser console if those state objects\n // get modified in between they've been output to the console and the developer\n // decided to inspect them.\n\n log('Previous state' + '\\n' + JSON.stringify(_this.getState().itemStates[i], null, 2));\n log('New state' + '\\n' + JSON.stringify(newItemState, null, 2));\n }\n\n _this.getState().itemStates[i] = newItemState; // If there was a request for `setState()` with new `items`, then the changes\n // to `currentState.itemStates[]` made above would be overwritten when that\n // pending `setState()` call gets applied.\n // To fix that, the updates to current `itemStates[]` are noted in\n // `this.itemStatesThatChangedWhileNewItemsWereBeingRendered` variable.\n // That variable is then checked when the `setState()` call with the new `items`\n // has been updated.\n\n if (_this.newItemsWillBeRendered) {\n if (!_this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n _this.itemStatesThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n _this.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(i)] = newItemState;\n }\n };\n\n this.getState = function () {\n return _this._getState();\n };\n\n this.updateState = function (stateUpdate) {\n if (isDebug()) {\n log('~ Set state ~');\n log(getStateSnapshot(stateUpdate));\n } // Ensure that a non-initial `stateUpdate` can only contain an `items`\n // property when it comes from a `setItems()` call.\n\n\n if (stateUpdate.items) {\n if (!_this._isSettingNewItems) {\n reportError('A `stateUpdate` can only contain `items` property as a result of calling `.setItems()`');\n }\n }\n\n _this._isSettingNewItems = undefined;\n _this.waitingForRender = true; // Store previous `state`.\n\n _this.previousState = _this.getState(); // If it's the first call to `this.updateState()` then initialize\n // the most recent `setState()` value to be the current state.\n\n if (!_this.mostRecentSetStateValue) {\n _this.mostRecentSetStateValue = _this.getState();\n } // Accumulates all \"pending\" state updates until they have been applied.\n\n\n _this.mostRecentSetStateValue = _objectSpread(_objectSpread({}, _this.mostRecentSetStateValue), stateUpdate); // Update `state`.\n\n _this._setState(_this.mostRecentSetStateValue, stateUpdate);\n };\n\n this.getInitialState = function () {\n if (initialState) {\n return getRestoredState.call(_this, initialState);\n }\n\n return getInitialStateFromScratch.call(_this, {\n getInitialItemState: getInitialItemState\n });\n };\n\n this.useState = function (_ref2) {\n var getState = _ref2.getState,\n setState = _ref2.setState,\n updateState = _ref2.updateState;\n\n if (_this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` has already been started');\n }\n\n if (_this._getState) {\n throw new Error('[virtual-scroller] Custom state storage has already been configured');\n }\n\n if (render) {\n throw new Error('[virtual-scroller] Creating a `VirtualScroller` class instance with a `render()` parameter implies using the default (internal) state storage');\n }\n\n if (setState && updateState) {\n throw new Error('[virtual-scroller] When using a custom state storage, one must supply either `setState()` or `updateState()` function but not both');\n }\n\n if (!getState || !(setState || updateState)) {\n throw new Error('[virtual-scroller] When using a custom state storage, one must supply both `getState()` and `setState()`/`updateState()` functions');\n }\n\n _this._usesCustomStateStorage = true;\n _this._getState = getState;\n\n _this._setState = function (newState, stateUpdate) {\n if (setState) {\n setState(newState);\n } else {\n updateState(stateUpdate);\n }\n };\n };\n\n this.useDefaultStateStorage = function () {\n if (!render) {\n throw new Error('[virtual-scroller] When using the default (internal) state management, one must supply a `render(state, prevState)` function parameter');\n } // Create default `getState()`/`setState()` functions.\n\n\n _this._getState = defaultGetState.bind(_this);\n _this._setState = defaultSetState.bind(_this); // When `state` is stored externally, a developer is responsible for\n // initializing it with the initial value.\n // Otherwise, if default state management is used, set the initial state now.\n\n var setInitialState = defaultSetInitialState.bind(_this);\n setInitialState(_this.getInitialState());\n };\n\n function defaultGetState() {\n return this.state;\n }\n\n function defaultSetInitialState(newState) {\n this.state = newState;\n }\n\n function defaultSetState(newState, stateUpdate) {\n // // Because the default state updates are \"synchronous\" (immediate),\n // // the `...stateUpdate` could be applied over `...this.state`,\n // // and no state updates would be lost.\n // // But if it was \"asynchronous\" (not immediate), then `...this.state`\n // // wouldn't work in all cases, because it could be stale in cases\n // // when more than a single `setState()` call is made before\n // // the state actually updates, making some properties of `this.state` stale.\n // this.state = {\n // \t...this.state,\n // \t...stateUpdate\n // }\n this.state = newState;\n render(this.state, this.previousState);\n this.onRender();\n }\n /**\r\n * Returns the initial state of the `VirtualScroller` \"from scratch\".\r\n * (i.e. not from a previously saved one).\r\n * @param {function} [options.getInitialItemState] — Gets initial item state.\r\n * @return {object}\r\n */\n\n\n function getInitialStateFromScratch(_ref3) {\n var getInitialItemState = _ref3.getInitialItemState;\n var items = initialItems;\n\n var state = _objectSpread(_objectSpread({}, getInitialLayoutState.call(this, items, {\n beforeStart: true\n })), {}, {\n items: items,\n itemStates: fillArray(new Array(items.length), function (i) {\n return getInitialItemState(items[i]);\n })\n });\n\n if (isDebug()) {\n log('Initial state (autogenerated)', getStateSnapshot(state));\n }\n\n log('First shown item index', state.firstShownItemIndex);\n log('Last shown item index', state.lastShownItemIndex);\n return state;\n }\n\n function getRestoredState(state) {\n if (isDebug()) {\n log('Restore state', getStateSnapshot(state));\n } // Possibly clean up \"before resize\" property in state.\n // \"Before resize\" state property is cleaned up when all \"before resize\" item heights\n // have been re-measured in an asynchronous `this.updateState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.updateState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n\n state = cleanUpBeforeResizeState(state); // Reset `verticalSpacing` so that it re-measures it after the list\n // has been rendered initially. The rationale is that a previously captured\n // inter-item vertical spacing can't be \"trusted\" in a sense that the user\n // might have resized the window after the previous `state` has been snapshotted.\n // If the user has resized the window, then changing window width might have\n // activated different CSS `@media()` \"queries\" resulting in a potentially different\n // vertical spacing when the `VirtualScroller` is re-created with such previously\n // snapshotted state.\n\n state = _objectSpread(_objectSpread({}, state), {}, {\n verticalSpacing: undefined\n }); // `this.verticalSpacing` acts as a \"true\" source for vertical spacing value.\n // Vertical spacing is also stored in `state` but `state` updates could be\n // \"asynchronous\" (not applied immediately) and `this.onUpdateShownItemIndexes()`\n // requires vertical spacing to be correct at any time, without any delays.\n // So, vertical spacing is also duplicated in `state`, but the \"true\" source\n // is still `this.verticalSpacing`.\n //\n // `this.verticalSpacing` must be initialized before calling `this.getInitialStateFromScratch()`\n // because `this.getInitialStateFromScratch()` uses `this.verticalSpacing` in its calculations.\n //\n // With the code above, `state.verticalSpacing` is always gonna be `undefined`,\n // so commented out this code. It's safer to just re-measure vertical spacing\n // from scratch when `VirtualScroller` is mounted.\n //\n // this.verticalSpacing = state ? state.verticalSpacing : undefined\n // Check if the actual `columnsCount` on the screen matches the one from state.\n\n if (isStateColumnsCountMismatch(state, {\n columnsCount: this.getActualColumnsCount()\n })) {\n warn('Reset Layout');\n state = _objectSpread(_objectSpread({}, state), getInitialLayoutState.call(this, state.items, {\n beforeStart: false\n }));\n }\n\n return state;\n }\n\n function getInitialLayoutState(items, _ref4) {\n var _this2 = this;\n\n var beforeStart = _ref4.beforeStart;\n var itemsCount = items.length;\n\n var getColumnsCount = function getColumnsCount() {\n return _this2.getActualColumnsCount();\n };\n\n var columnsCount = beforeStart ? this.layout.getInitialLayoutValueWithFallback('columnsCount', getColumnsCount, 1) : getColumnsCount();\n\n var _this$layout$getIniti = this.layout.getInitialLayoutValues({\n itemsCount: itemsCount,\n columnsCount: this.getActualColumnsCount(),\n beforeStart: beforeStart\n }),\n firstShownItemIndex = _this$layout$getIniti.firstShownItemIndex,\n lastShownItemIndex = _this$layout$getIniti.lastShownItemIndex,\n beforeItemsHeight = _this$layout$getIniti.beforeItemsHeight,\n afterItemsHeight = _this$layout$getIniti.afterItemsHeight;\n\n var itemHeights = new Array(itemsCount); // Optionally preload items to be rendered.\n\n this.onBeforeShowItems(items, itemHeights, firstShownItemIndex, lastShownItemIndex);\n return {\n itemHeights: itemHeights,\n columnsCount: this.getActualColumnsCountForState(),\n verticalSpacing: this.verticalSpacing,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n };\n } // Checks if the actual `columnsCount` on the screen matches the one from state.\n //\n // For example, a developer might snapshot `VirtualScroller` state\n // when the user navigates from the page containing the list\n // in order to later restore the list's state when the user goes \"Back\".\n // But, the user might have also resized the window while being on that\n // \"other\" page, and when they come \"Back\", their snapshotted state\n // no longer qualifies. Well, it does qualify, but only partially.\n // For example, `itemStates` are still valid, but first and last shown\n // item indexes aren't.\n //\n\n\n function isStateColumnsCountMismatch(state, _ref5) {\n var columnsCount = _ref5.columnsCount;\n var stateColumnsCount = state.columnsCount || 1;\n\n if (stateColumnsCount !== columnsCount) {\n warn('~ Columns Count changed from', stateColumnsCount, 'to', columnsCount, '~');\n return true;\n }\n\n var firstShownItemIndex = Math.floor(state.firstShownItemIndex / columnsCount) * columnsCount;\n\n if (firstShownItemIndex !== state.firstShownItemIndex) {\n warn('~ First Shown Item Index', state.firstShownItemIndex, 'is not divisible by Columns Count', columnsCount, '~');\n return true;\n }\n }\n}\n//# sourceMappingURL=VirtualScroller.state.js.map","import log from './utility/debug.js';\nimport getVerticalSpacing from './getVerticalSpacing.js';\nexport default function createVerticalSpacingHelpers() {\n var _this = this;\n\n // Bind to `this` in order to prevent bugs when this function is passed by reference\n // and then called with its `this` being unintentionally `window` resulting in\n // the `if` condition being \"falsy\".\n this.getVerticalSpacing = function () {\n return _this.verticalSpacing || 0;\n };\n\n this.getVerticalSpacingBeforeResize = function () {\n // `beforeResize.verticalSpacing` can be `undefined`.\n // For example, if `this.updateState({ verticalSpacing })` call hasn't been applied\n // before the resize happened (in case of an \"asynchronous\" state update).\n var _this$getState = _this.getState(),\n beforeResize = _this$getState.beforeResize;\n\n return beforeResize && beforeResize.verticalSpacing || 0;\n };\n /**\r\n * Measures item vertical spacing, if not measured.\r\n * @return {object} [stateUpdate]\r\n */\n\n\n this.measureVerticalSpacingIfNotMeasured = function () {\n if (_this.verticalSpacing === undefined) {\n _this.verticalSpacing = measureVerticalSpacing.call(_this);\n return _this.verticalSpacing;\n }\n };\n\n function measureVerticalSpacing() {\n var _this$getState2 = this.getState(),\n firstShownItemIndex = _this$getState2.firstShownItemIndex,\n lastShownItemIndex = _this$getState2.lastShownItemIndex;\n\n log('~ Measure item vertical spacing ~');\n var verticalSpacing = getVerticalSpacing({\n itemsContainer: this.itemsContainer,\n renderedItemsCount: lastShownItemIndex - firstShownItemIndex + 1\n });\n\n if (verticalSpacing === undefined) {\n log('Not enough items rendered to measure vertical spacing');\n } else {\n log('Item vertical spacing', verticalSpacing);\n return verticalSpacing;\n }\n }\n}\n//# sourceMappingURL=VirtualScroller.verticalSpacing.js.map","export default function getVerticalSpacing(_ref) {\n var itemsContainer = _ref.itemsContainer,\n renderedItemsCount = _ref.renderedItemsCount;\n\n if (renderedItemsCount > 1) {\n var firstShownRowTopOffset = itemsContainer.getNthRenderedItemTopOffset(0);\n var firstShownRowHeight = itemsContainer.getNthRenderedItemHeight(0);\n var i = 1;\n\n while (i < renderedItemsCount) {\n var itemTopOffset = itemsContainer.getNthRenderedItemTopOffset(i);\n var itemHeight = itemsContainer.getNthRenderedItemHeight(i); // See if the item is on the next row.\n // Simply checking for `itemTopOffset !== firstShownRowTopOffset` wouldn't work\n // because items in a row aren't required to be aligned to the top border.\n\n if (itemTopOffset >= firstShownRowTopOffset + firstShownRowHeight) {\n // Measure inter-row spacing.\n // Can't be \"negative\" with the current `if` condition.\n return itemTopOffset - (firstShownRowTopOffset + firstShownRowHeight);\n } // A row height is the maximum of its item heights.\n\n\n firstShownRowHeight = Math.max(firstShownRowHeight, itemHeight);\n i++;\n }\n }\n}\n//# sourceMappingURL=getVerticalSpacing.js.map","export default function createColumnsHelpers(_ref) {\n var _this = this;\n\n var getColumnsCount = _ref.getColumnsCount;\n\n if (getColumnsCount) {\n var scrollableContainerArgument = {\n getWidth: function getWidth() {\n return _this.scrollableContainer.getWidth();\n }\n };\n\n this.getActualColumnsCountForState = function () {\n var columnsCount = getColumnsCount(scrollableContainerArgument); // `columnsCount: 1` is effectively same as `columnsCount: undefined`\n // from the code's point of view. This makes one less property in `state`\n // which makes `state` a bit less cluttered (easier for inspection).\n\n if (columnsCount !== 1) {\n return columnsCount;\n }\n };\n } else {\n this.getActualColumnsCountForState = function () {\n return undefined;\n };\n }\n\n this.getActualColumnsCount = function () {\n return _this.getActualColumnsCountForState() || 1;\n };\n\n this.getColumnsCount = function () {\n return _this.getState() && _this.getState().columnsCount || 1;\n };\n}\n//# sourceMappingURL=VirtualScroller.columns.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport ItemNotRenderedError from './ItemNotRenderedError.js';\nexport default function () {\n var _this = this;\n\n this.onUpdateShownItemIndexes = function (_ref) {\n var reason = _ref.reason,\n stateUpdate = _ref.stateUpdate;\n\n // In case of \"don't do anything\".\n var skip = function skip() {\n if (stateUpdate) {\n _this.updateState(stateUpdate);\n }\n }; // If new `items` have been set and are waiting to be applied,\n // or if the viewport width has changed requiring a re-layout,\n // then temporarily stop all other updates like \"on scroll\" updates.\n // This prevents `state` being inconsistent, because, for example,\n // both `setItems()` and this function could update `VirtualScroller` state\n // and having them operate in parallel could result in incorrectly calculated\n // `beforeItemsHeight` / `afterItemsHeight` / `firstShownItemIndex` /\n // `lastShownItemIndex`, because, when operating in parallel, this function\n // would have different `items` than the `setItems()` function, so their\n // results could diverge.\n\n\n if (_this.newItemsWillBeRendered || _this.widthHasChanged || _this._isResizing) {\n return skip();\n } // If there're no items then there's no need to re-layout anything.\n\n\n if (_this.getItemsCount() === 0) {\n return skip();\n } // Cancel a \"re-layout when user stops scrolling\" timer.\n\n\n _this.scroll.cancelScheduledLayout(); // Cancel a re-layout that is scheduled to run at the next \"frame\",\n // because a re-layout will be performed right now.\n\n\n stateUpdate = _this.cancelLayoutTimer({\n stateUpdate: stateUpdate\n }); // Perform a re-layout.\n\n log(\"~ Update Layout (on \".concat(reason, \") ~\"));\n updateShownItemIndexes.call(_this, {\n stateUpdate: stateUpdate\n });\n };\n /**\r\n * Updates the \"from\" and \"to\" shown item indexes.\r\n * If the list is visible and some of the items being shown are new\r\n * and are required to be measured first, then\r\n * `firstNonMeasuredItemIndex` is defined.\r\n * If the list is visible and all items being shown have been encountered\r\n * (and measured) before, then `firstNonMeasuredItemIndex` is `undefined`.\r\n *\r\n * The `stateUpdate` parameter is just an optional \"additional\" state update.\r\n */\n\n\n function updateShownItemIndexes(_ref2) {\n var stateUpdate = _ref2.stateUpdate;\n var startedAt = Date.now(); // Get shown item indexes.\n\n var _getShownItemIndexes$ = getShownItemIndexes.call(this),\n firstShownItemIndex = _getShownItemIndexes$.firstShownItemIndex,\n lastShownItemIndex = _getShownItemIndexes$.lastShownItemIndex,\n shownItemsHeight = _getShownItemIndexes$.shownItemsHeight,\n firstNonMeasuredItemIndex = _getShownItemIndexes$.firstNonMeasuredItemIndex; // If scroll position is scheduled to be restored after render,\n // then the \"anchor\" item must be rendered, and all of the prepended\n // items before it, all in a single pass. This way, all of the\n // prepended items' heights could be measured right after the render\n // has finished, and the scroll position can then be immediately restored.\n\n\n if (this.listHeightMeasurement.hasSnapshot()) {\n if (lastShownItemIndex < this.listHeightMeasurement.getAnchorItemIndex()) {\n lastShownItemIndex = this.listHeightMeasurement.getAnchorItemIndex();\n } // `firstShownItemIndex` is always `0` when prepending items.\n // And `lastShownItemIndex` always covers all prepended items in this case.\n // None of the prepended items have been rendered before,\n // so their heights are unknown. The code at the start of this function\n // did therefore set `firstNonMeasuredItemIndex` to non-`undefined`\n // in order to render just the first prepended item in order to\n // measure it, and only then make a decision on how many other\n // prepended items to render. But since we've instructed the code\n // to show all of the prepended items at once, there's no need to\n // \"redo layout after render\". Additionally, if layout was re-done\n // after render, then there would be a short interval of visual\n // \"jitter\" due to the scroll position not being restored because it'd\n // wait for the second layout to finish instead of being restored\n // right after the first one.\n\n\n firstNonMeasuredItemIndex = undefined;\n } // Validate the heights of items to be hidden on next render.\n // For example, a user could click a \"Show more\" button,\n // or an \"Expand YouTube video\" button, which would result\n // in the actual height of the list item being different\n // from what has been initially measured in `this.itemHeights[i]`,\n // if the developer didn't call `.setItemState(i, newState)` and `.onItemHeightDidChange(i)`.\n\n\n if (!validateWillBeHiddenItemHeightsAreAccurate.call(this, firstShownItemIndex, lastShownItemIndex)) {\n log('~ Because some of the will-be-hidden item heights (listed above) have changed since they\\'ve last been measured, redo layout. ~'); // Redo layout, now with the correct item heights.\n\n return updateShownItemIndexes.call(this, {\n stateUpdate: stateUpdate\n });\n } // Measure \"before\" items height.\n\n\n var beforeItemsHeight = this.layout.getBeforeItemsHeight(firstShownItemIndex); // Measure \"after\" items height.\n\n var afterItemsHeight = this.layout.getAfterItemsHeight(lastShownItemIndex, this.getItemsCount());\n var layoutDuration = Date.now() - startedAt; // Debugging.\n\n log('~ Calculated Layout' + (this.bypass ? ' (bypass)' : '') + ' ~');\n\n if (layoutDuration < SLOW_LAYOUT_DURATION) {// log('Calculated in', layoutDuration, 'ms')\n } else {\n warn('Layout calculated in', layoutDuration, 'ms');\n }\n\n if (this.getColumnsCount()) {\n log('Columns count', this.getColumnsCount());\n }\n\n log('First shown item index', firstShownItemIndex);\n log('Last shown item index', lastShownItemIndex);\n log('Before items height', beforeItemsHeight);\n log('After items height (actual or estimated)', afterItemsHeight);\n log('Average item height (used for estimated after items height calculation)', this.itemHeights.getAverage());\n\n if (isDebug()) {\n log('Item heights', this.getState().itemHeights.slice());\n log('Item states', this.getState().itemStates.slice());\n } // Optionally preload items to be rendered.\n\n\n this.onBeforeShowItems(this.getState().items, this.getState().itemHeights, firstShownItemIndex, lastShownItemIndex); // Set `this.firstNonMeasuredItemIndex`.\n\n this.firstNonMeasuredItemIndex = firstNonMeasuredItemIndex; // if (firstNonMeasuredItemIndex !== undefined) {\n // \tlog('Non-measured item index that will be measured at next layout', firstNonMeasuredItemIndex)\n // }\n // Set \"previously calculated layout\".\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n // Currently, this feature is not used, and `shownItemsHeight` property\n // is not returned at all, so don't set any \"previously calculated layout\".\n //\n\n if (shownItemsHeight === undefined) {\n this.previouslyCalculatedLayout = undefined;\n } else {\n // If \"previously calculated layout\" feature would be implmeneted,\n // then this code would set \"previously calculate layout\" instance variable.\n //\n // What for would this instance variable be used?\n //\n // Instead of using a `this.previouslyCalculatedLayout` instance variable,\n // this code could use `this.getState()` because it reflects what's currently on screen,\n // but there's a single edge case when it could go out of sync —\n // updating item heights externally via `.onItemHeightDidChange(i)`.\n //\n // If, for example, an item height was updated externally via `.onItemHeightDidChange(i)`\n // then `this.getState().itemHeights` would get updated immediately but\n // `this.getState().beforeItemsHeight` or `this.getState().afterItemsHeight`\n // would still correspond to the previous item height, so those would be \"stale\".\n // On the other hand, same values in `this.previouslyCalculatedLayout` instance variable\n // can also be updated immediately, so they won't go out of sync with the updated item height.\n // That seems the only edge case when using a separate `this.previouslyCalculatedLayout`\n // instance variable instead of using `this.getState()` would theoretically be justified.\n //\n this.previouslyCalculatedLayout = {\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n shownItemsHeight: shownItemsHeight\n };\n } // Update `VirtualScroller` state.\n // `VirtualScroller` automatically re-renders on state updates.\n //\n // All `state` properties updated here should be overwritten in\n // the implementation of `setItems()` and `onResize()` methods\n // so that the `state` is not left in an inconsistent state\n // whenever there're concurrent `updateState()` updates that could\n // possibly conflict with one another — instead, those state updates\n // should overwrite each other in terms of priority.\n // These \"on scroll\" updates have the lowest priority compared to\n // the state updates originating from `setItems()` and `onResize()` methods.\n //\n\n\n this.updateState(_objectSpread({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, stateUpdate));\n }\n\n function getVisibleArea() {\n var visibleArea = this.scroll.getVisibleAreaBounds();\n this.latestLayoutVisibleArea = visibleArea; // Subtract the top offset of the list inside the scrollable container.\n\n var listTopOffsetInsideScrollableContainer = this.getListTopOffsetInsideScrollableContainer();\n return {\n top: visibleArea.top - listTopOffsetInsideScrollableContainer,\n bottom: visibleArea.bottom - listTopOffsetInsideScrollableContainer\n };\n }\n\n function getShownItemIndexes() {\n var itemsCount = this.getItemsCount();\n\n var _getVisibleArea$call = getVisibleArea.call(this),\n visibleAreaTop = _getVisibleArea$call.top,\n visibleAreaBottom = _getVisibleArea$call.bottom;\n\n if (this.bypass) {\n return {\n firstShownItemIndex: 0,\n lastShownItemIndex: itemsCount - 1 // shownItemsHeight: this.getState().itemHeights.reduce((sum, itemHeight) => sum + itemHeight, 0)\n\n };\n } // Find the indexes of the items that are currently visible\n // (or close to being visible) in the scrollable container.\n // For scrollable containers other than the main screen, it could also\n // check the visibility of such scrollable container itself, because it\n // might be not visible.\n // If such kind of an optimization would hypothetically be implemented,\n // then it would also require listening for \"scroll\" events on the screen.\n // Overall, I suppose that such \"actual visibility\" feature would be\n // a very minor optimization and not something I'd deal with.\n\n\n var isVisible = visibleAreaTop < this.itemsContainer.getHeight() && visibleAreaBottom > 0;\n\n if (!isVisible) {\n log('The entire list is off-screen. No items are visible.');\n return this.layout.getNonVisibleListShownItemIndexes();\n } // Get shown item indexes.\n\n\n return this.layout.getShownItemIndexes({\n itemsCount: this.getItemsCount(),\n visibleAreaTop: visibleAreaTop,\n visibleAreaBottom: visibleAreaBottom\n });\n }\n /**\r\n * Validates the heights of items to be hidden on next render.\r\n * For example, a user could click a \"Show more\" button,\r\n * or an \"Expand YouTube video\" button, which would result\r\n * in the actual height of the list item being different\r\n * from what has been initially measured in `this.itemHeights[i]`,\r\n * if the developer didn't call `.setItemState(i, newState)` and `.onItemHeightDidChange(i)`.\r\n */\n\n\n function validateWillBeHiddenItemHeightsAreAccurate(firstShownItemIndex, lastShownItemIndex) {\n var isValid = true;\n var i = this.getState().firstShownItemIndex;\n\n while (i <= this.getState().lastShownItemIndex) {\n if (i >= firstShownItemIndex && i <= lastShownItemIndex) {// The item's still visible.\n } else {\n // The item will be hidden. Re-measure its height.\n // The rationale is that there could be a situation when an item's\n // height has changed, and the developer has properly added an\n // `.onItemHeightDidChange(i)` call to notify `VirtualScroller`\n // about that change, but at the same time that wouldn't work.\n // For example, suppose there's a list of several items on a page,\n // and those items are in \"minimized\" state (having height 100px).\n // Then, a user clicks an \"Expand all items\" button, and all items\n // in the list are expanded (expanded item height is gonna be 700px).\n // `VirtualScroller` demands that `.onItemHeightDidChange(i)` is called\n // in such cases, and the developer has properly added the code to do that.\n // So, if there were 10 \"minimized\" items visible on a page, then there\n // will be 10 individual `.onItemHeightDidChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightDidChange(i)` call executes, it immediately\n // (\"synchronously\") triggers a re-layout, and that re-layout finds out\n // that now, because the first item is big, it occupies most of the screen\n // space, and only the first 3 items are visible on screen instead of 10,\n // and so it leaves the first 3 items mounted and unmounts the rest 7.\n // Then, after `VirtualScroller` has rerendered, the code returns to\n // where it was executing, and calls `.onItemHeightDidChange(i)` for the\n // second item. It also triggers an immediate re-layout that finds out\n // that only the first 2 items are visible on screen, and it unmounts\n // the third one too. After that, it calls `.onItemHeightDidChange(i)`\n // for the third item, but that item is no longer rendered, so its height\n // can't be measured, and the same's for all the rest of the original 10 items.\n // So, even though the developer has written their code properly, the\n // `VirtualScroller` still ends up having incorrect `itemHeights[]`:\n // `[700px, 700px, 100px, 100px, 100px, 100px, 100px, 100px, 100px, 100px]`\n // while it should have been `700px` for all of them.\n // To work around such issues, every item's height is re-measured before it\n // gets hidden.\n var previouslyMeasuredItemHeight = this.getState().itemHeights[i];\n var actualItemHeight = remeasureItemHeight.call(this, i);\n\n if (actualItemHeight !== previouslyMeasuredItemHeight) {\n if (isValid) {\n log('~ Validate will-be-hidden item heights. ~'); // Update or reset previously calculated layout.\n\n updatePreviouslyCalculatedLayoutOnItemHeightChange.call(this, i, previouslyMeasuredItemHeight, actualItemHeight);\n }\n\n isValid = false;\n warn('Item index', i, 'is no longer visible and will be unmounted. Its height has changed from', previouslyMeasuredItemHeight, 'to', actualItemHeight, 'since it was last measured. This is not necessarily a bug, and could happen, for example, on screen width change, or when there\\'re several `onItemHeightDidChange(i)` calls issued at the same time, and the first one triggers a re-layout before the rest of them have had a chance to be executed.');\n }\n }\n\n i++;\n }\n\n return isValid;\n }\n\n function remeasureItemHeight(i) {\n var _this$getState = this.getState(),\n firstShownItemIndex = _this$getState.firstShownItemIndex;\n\n return this.itemHeights.remeasureItemHeight(i, firstShownItemIndex);\n } // Updates the snapshot of the current layout when an item's height changes.\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n\n\n function updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight) {\n var prevLayout = this.previouslyCalculatedLayout;\n\n if (prevLayout) {\n var heightDifference = newHeight - previousHeight;\n\n if (i < prevLayout.firstShownItemIndex) {\n // Patch `prevLayout`'s `.beforeItemsHeight`.\n prevLayout.beforeItemsHeight += heightDifference;\n } else if (i > prevLayout.lastShownItemIndex) {\n // Could patch `.afterItemsHeight` of `prevLayout` here,\n // if `.afterItemsHeight` property existed in `prevLayout`.\n if (prevLayout.afterItemsHeight !== undefined) {\n prevLayout.afterItemsHeight += heightDifference;\n }\n } else {\n // Patch `prevLayout`'s shown items height.\n prevLayout.shownItemsHeight += newHeight - previousHeight;\n }\n }\n }\n /**\r\n * Returns the list's top offset relative to the scrollable container's top edge.\r\n * @return {number}\r\n */\n\n\n this.getListTopOffsetInsideScrollableContainer = function () {\n var listTopOffset = _this.scrollableContainer.getItemsContainerTopOffset();\n\n if (_this.listTopOffsetWatcher) {\n _this.listTopOffsetWatcher.onListTopOffset(listTopOffset);\n }\n\n return listTopOffset;\n };\n\n this._onItemHeightDidChange = function (i) {\n log('~ On Item Height Did Change was called ~');\n log('Item index', i);\n\n var _this$getState2 = _this.getState(),\n itemHeights = _this$getState2.itemHeights,\n firstShownItemIndex = _this$getState2.firstShownItemIndex,\n lastShownItemIndex = _this$getState2.lastShownItemIndex; // Check if the item is still rendered.\n\n\n if (!(i >= firstShownItemIndex && i <= lastShownItemIndex)) {\n // There could be valid cases when an item is no longer rendered\n // by the time `.onItemHeightDidChange(i)` gets called.\n // For example, suppose there's a list of several items on a page,\n // and those items are in \"minimized\" state (having height 100px).\n // Then, a user clicks an \"Expand all items\" button, and all items\n // in the list are expanded (expanded item height is gonna be 700px).\n // `VirtualScroller` demands that `.onItemHeightDidChange(i)` is called\n // in such cases, and the developer has properly added the code to do that.\n // So, if there were 10 \"minimized\" items visible on a page, then there\n // will be 10 individual `.onItemHeightDidChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightDidChange(i)` call executes, it immediately\n // (\"synchronously\") triggers a re-layout, and that re-layout finds out\n // that now, because the first item is big, it occupies most of the screen\n // space, and only the first 3 items are visible on screen instead of 10,\n // and so it leaves the first 3 items mounted and unmounts the rest 7.\n // Then, after `VirtualScroller` has rerendered, the code returns to\n // where it was executing, and calls `.onItemHeightDidChange(i)` for the\n // second item. It also triggers an immediate re-layout that finds out\n // that only the first 2 items are visible on screen, and it unmounts\n // the third one too. After that, it calls `.onItemHeightDidChange(i)`\n // for the third item, but that item is no longer rendered, so its height\n // can't be measured, and the same's for all the rest of the original 10 items.\n // So, even though the developer has written their code properly, there're\n // still situations when the item could be no longer rendered by the time\n // `.onItemHeightDidChange(i)` gets called.\n return warn('The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when when a developer calls `onItemHeightDidChange(i)` while looping through a batch of items.');\n }\n\n var previousHeight = itemHeights[i];\n\n if (previousHeight === undefined) {\n return reportError(\"\\\"onItemHeightDidChange()\\\" has been called for item index \".concat(i, \" but the item hasn't been rendered before.\"));\n }\n\n log('~ Re-measure item height ~');\n var newHeight;\n\n try {\n newHeight = remeasureItemHeight.call(_this, i);\n } catch (error) {\n // Successfully finishing an `onItemHeightDidChange(i)` call is not considered\n // critical for `VirtualScroller`'s operation, so such errors could be ignored.\n if (error instanceof ItemNotRenderedError) {\n return reportError(\"\\\"onItemHeightDidChange()\\\" has been called for item index \".concat(i, \" but the item is not currently rendered and can't be measured. The exact error was: \").concat(error.message));\n }\n }\n\n log('Previous height', previousHeight);\n log('New height', newHeight);\n\n if (previousHeight !== newHeight) {\n log('~ Item height has changed. Should update layout. ~'); // Update or reset a previously calculated layout\n // so that the \"diff\"s based on that layout in the future\n // produce correct results.\n\n updatePreviouslyCalculatedLayoutOnItemHeightChange.call(_this, i, previousHeight, newHeight); // Recalculate layout.\n //\n // If the `VirtualScroller` is already waiting for a state update to be rendered,\n // delay `onItemHeightDidChange(i)`'s re-layout until that state update is rendered.\n // The reason is that React `<VirtualScroller/>`'s `onHeightDidChange()` is meant to\n // be called inside `useLayoutEffect()` hook. Due to how React is implemented internally,\n // that might happen in the middle of the currently pending `setState()` operation\n // being applied, resulting in weird \"race condition\" bugs.\n //\n\n if (_this.waitingForRender) {\n log('~ Another state update is already waiting to be rendered. Delay the layout update until then. ~');\n _this.updateLayoutAfterRenderBecauseItemHeightChanged = true;\n } else {\n _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.ITEM_HEIGHT_CHANGED\n });\n } // If there was a request for `setState()` with new `items`, then the changes\n // to `currentState.itemHeights[]` made above in a `remeasureItemHeight()` call\n // would be overwritten when that pending `setState()` call gets applied.\n // To fix that, the updates to current `itemHeights[]` are noted in\n // `this.itemHeightsThatChangedWhileNewItemsWereBeingRendered` variable.\n // That variable is then checked when the `setState()` call with the new `items`\n // has been updated.\n\n\n if (_this.newItemsWillBeRendered) {\n if (!_this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n _this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n _this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(i)] = newHeight;\n }\n }\n };\n\n this.getPrerenderMargin = function () {\n // The list component renders not only the items that're currently visible\n // but also the items that lie within some extra vertical margin (called\n // \"prerender margin\") on top and bottom for future scrolling: this way,\n // there'll be significantly less layout recalculations as the user scrolls,\n // because now it doesn't have to recalculate layout on each scroll event.\n // By default, the \"prerender margin\" is equal to the screen height:\n // this seems to be the optimal value for \"Page Up\" / \"Page Down\" navigation\n // and optimized mouse wheel scrolling (a user is unlikely to continuously\n // scroll past the screen height, because they'd stop to read through\n // the newly visible items first, and when they do stop scrolling, that's\n // when layout gets recalculated).\n var renderAheadMarginRatio = 1; // in scrollable container heights.\n\n return _this.scrollableContainer.getHeight() * renderAheadMarginRatio;\n };\n /**\r\n * Calls `onItemFirstRender()` for items that haven't been\r\n * \"seen\" previously.\r\n * @param {any[]} items\r\n * @param {number[]} itemHeights\r\n * @param {number} firstShownItemIndex\r\n * @param {number} lastShownItemIndex\r\n */\n\n\n this.onBeforeShowItems = function (items, itemHeights, firstShownItemIndex, lastShownItemIndex) {\n if (_this.onItemInitialRender) {\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n if (itemHeights[i] === undefined) {\n _this.onItemInitialRender(items[i]);\n }\n\n i++;\n }\n }\n };\n\n this.measureItemHeightsAndSpacing = function () {\n // Measure \"newly shown\" item heights.\n // Also re-validate already measured items' heights.\n _this.itemHeights.measureItemHeights(_this.getState().firstShownItemIndex, _this.getState().lastShownItemIndex); // Measure item vertical spacing, if required.\n\n\n var verticalSpacing = _this.measureVerticalSpacingIfNotMeasured(); // Return a state update if vertical spacing has been measured.\n // Doesn't set `verticalSpacing: 0` in `state` because it is effectively\n // same as `verticalSpacing: undefined` in terms code behavior and calculations.\n // Not having `verticalSpacing: 0` in `state` just makes the `state` object\n // a bit more cleaner and a bit less cluttered (easier for inspection).\n\n\n if (verticalSpacing && verticalSpacing !== 0) {\n // Return a state update.\n // Sets `verticalSpacing` property in `state`.\n return {\n verticalSpacing: verticalSpacing\n };\n }\n };\n\n this.cancelLayoutTimer = function (_ref3) {\n var stateUpdate = _ref3.stateUpdate;\n\n if (_this.layoutTimer) {\n clearTimeout(_this.layoutTimer);\n _this.layoutTimer = undefined; // Merge state updates.\n\n if (stateUpdate || _this.layoutTimerStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, _this.layoutTimerStateUpdate), stateUpdate);\n _this.layoutTimerStateUpdate = undefined;\n return stateUpdate;\n }\n } else {\n return stateUpdate;\n }\n };\n\n this.scheduleLayoutTimer = function (_ref4) {\n var reason = _ref4.reason,\n stateUpdate = _ref4.stateUpdate;\n _this.layoutTimerStateUpdate = stateUpdate;\n _this.layoutTimer = setTimeout(function () {\n _this.layoutTimerStateUpdate = undefined;\n _this.layoutTimer = undefined;\n\n _this.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }, 0);\n };\n}\nvar SLOW_LAYOUT_DURATION = 15; // in milliseconds.\n//# sourceMappingURL=VirtualScroller.layout.js.map","// https://github.com/lodash/lodash/issues/2340\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\n\n/**\r\n * Copyright (c) 2013-present, Facebook, Inc.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * @providesModule shallowEqual\r\n * @typechecks\r\n * @flow\r\n */\n\n/*eslint-disable no-self-compare */\n'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\r\n * inlined Object.is polyfill to avoid requiring consumers ship their own\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\r\n */\n\nfunction is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n/**\r\n * Performs equality by iterating through keys on an object and returning false\r\n * when any key has values which are not strictly equal between the arguments.\r\n * Returns true when the values of all keys are strictly equal.\r\n */\n\n\nexport default function shallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n\n if (_typeof(objA) !== 'object' || objA === null || _typeof(objB) !== 'object' || objB === null) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n } // Test for A's keys different from B.\n\n\n for (var i = 0; i < keysA.length; i++) {\n if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n\n return true;\n}\n//# sourceMappingURL=shallowEqual.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport log, { warn, reportError, isDebug } from './utility/debug.js';\nimport getStateSnapshot from './utility/getStateSnapshot.js';\nimport shallowEqual from './utility/shallowEqual.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport { setTbodyPadding } from './DOM/tbody.js';\nexport default function () {\n var _this = this;\n\n /**\r\n * Should be called right after updates to `state` have been rendered.\r\n * @param {object} newState\r\n * @param {object} [prevState]\r\n */\n this._onRender = function (newState, prevState) {\n _this.waitingForRender = false;\n log('~ Rendered ~');\n\n if (isDebug()) {\n log('State', getStateSnapshot(newState));\n }\n\n if (_this.onStateChange) {\n if (!shallowEqual(newState, prevState)) {\n _this.onStateChange(newState);\n }\n } // Update `<tbody/>` `padding`.\n // (`<tbody/>` is different in a way that it can't have `margin`, only `padding`).\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n\n if (_this.tbody) {\n setTbodyPadding(_this.getItemsContainerElement(), newState.beforeItemsHeight, newState.afterItemsHeight);\n } // `this.mostRecentlySetState` checks that state management behavior is correct:\n // that in situations when there're multiple new states waiting to be set,\n // only the latest one gets applied.\n // It keeps the code simpler and prevents possible race condition bugs.\n // For example, `VirtualScroller` keeps track of its latest requested\n // state update in different instance variable flags which assume that\n // only that latest requested state update gets actually applied.\n //\n // This check should also be performed for the initial render in order to\n // guarantee that no potentially incorrect state update goes unnoticed.\n // Incorrect state updates could happen when `VirtualScroller` state\n // is managed externally by passing `getState()`/`updateState()` options.\n //\n // Perform the check only when `this.mostRecentSetStateValue` is defined.\n // `this.mostRecentSetStateValue` is normally gonna be `undefined` at the initial render\n // because the initial state is not set by calling `this.updateState()`.\n // At the same time, it is possible that the initial render is delayed\n // for whatever reason, and `this.updateState()` gets called before the initial render,\n // so `this.mostRecentSetStateValue` could also be defined at the initial render,\n // in which case the check should be performed.\n //\n\n\n if (_this.mostRecentSetStateValue) {\n // \"Shallow equality\" is used here instead of \"strict equality\"\n // because a developer might choose to supply an `updateState()` function\n // rather than a `setState()` function, in which case the `updateState()` function\n // would construct its own state object.\n if (!shallowEqual(newState, _this.mostRecentSetStateValue)) {\n warn('The most recent state that was set', getStateSnapshot(_this.mostRecentSetStateValue));\n reportError('The state that has been rendered is not the most recent one that was set');\n }\n } // `this.resetStateUpdateFlags()` must be called before calling\n // `this.measureItemHeightsAndSpacing()`.\n\n\n var _resetStateUpdateFlag = resetStateUpdateFlags.call(_this),\n nonMeasuredItemsHaveBeenRendered = _resetStateUpdateFlag.nonMeasuredItemsHaveBeenRendered,\n itemHeightHasChanged = _resetStateUpdateFlag.itemHeightHasChanged,\n widthHasChanged = _resetStateUpdateFlag.widthHasChanged;\n\n var layoutUpdateReason;\n\n if (itemHeightHasChanged) {\n layoutUpdateReason = LAYOUT_REASON.ITEM_HEIGHT_CHANGED;\n }\n\n if (!prevState) {\n if (!layoutUpdateReason) {\n return;\n }\n } // If the `VirtualScroller`, while calculating layout parameters, encounters\n // a not-shown item with a non-measured height, it calls `updateState()` just to\n // render that item first, and then, after the list has been re-rendered, it measures\n // the item's height and then proceeds with calculating the correct layout parameters.\n\n\n if (nonMeasuredItemsHaveBeenRendered) {\n layoutUpdateReason = LAYOUT_REASON.NON_MEASURED_ITEMS_HAVE_BEEN_MEASURED;\n } // If scrollable container width has changed, and it has been re-rendered,\n // then it's time to measure the new item heights and then perform a re-layout\n // with the correctly calculated layout parameters.\n //\n // A re-layout is required because the layout parameters calculated on resize\n // are approximate ones, and the exact item heights aren't known at that point.\n // So on resize, it calls `updateState()` just to re-render the `VirtualScroller`.\n // After it has been re-rendered, it will measure item heights and then calculate\n // correct layout parameters.\n //\n\n\n if (widthHasChanged) {\n layoutUpdateReason = LAYOUT_REASON.VIEWPORT_WIDTH_CHANGED; // Reset measured item heights on viewport width change.\n\n _this.itemHeights.reset(); // Reset `verticalSpacing` (will be re-measured).\n\n\n _this.verticalSpacing = undefined;\n }\n\n if (prevState) {\n var previousItems = prevState.items;\n var newItems = newState.items; // Even if `this.newItemsWillBeRendered` flag is `true`,\n // `newItems` could still be equal to `previousItems`.\n // For example, when `updateState()` calls don't update `state` immediately\n // and a developer first calls `setItems(newItems)` and then calls `setItems(oldItems)`:\n // in that case, `this.newItemsWillBeRendered` flag will be `true` but the actual `items`\n // in state wouldn't have changed due to the first `updateState()` call being overwritten\n // by the second `updateState()` call (that's called \"batching state updates\" in React).\n\n if (newItems !== previousItems) {\n var itemsDiff = _this.getItemsDiff(previousItems, newItems);\n\n if (itemsDiff) {\n // The call to `.onPrepend()` must precede the call to `.measureItemHeights()`\n // which is called in `.onRender()`.\n // `this.itemHeights.onPrepend()` updates `firstMeasuredItemIndex`\n // and `lastMeasuredItemIndex` of `this.itemHeights`.\n var prependedItemsCount = itemsDiff.prependedItemsCount;\n\n _this.itemHeights.onPrepend(prependedItemsCount);\n } else {\n _this.itemHeights.reset();\n }\n\n if (!widthHasChanged) {\n // The call to `this.onNewItemsRendered()` must precede the call to\n // `.measureItemHeights()` which is called in `.onRender()` because\n // `this.onNewItemsRendered()` updates `firstMeasuredItemIndex` and\n // `lastMeasuredItemIndex` of `this.itemHeights` in case of a prepend.\n //\n // If after prepending items the scroll position\n // should be \"restored\" so that there's no \"jump\" of content\n // then it means that all previous items have just been rendered\n // in a single pass, and there's no need to update layout again.\n //\n if (onNewItemsRendered.call(_this, itemsDiff, newState) !== 'SEAMLESS_PREPEND') {\n layoutUpdateReason = LAYOUT_REASON.ITEMS_CHANGED;\n }\n }\n }\n }\n\n var stateUpdate; // Re-measure item heights.\n // Also, measure vertical spacing (if not measured) and fix `<table/>` padding.\n //\n // This block should go after `if (newItems !== previousItems) {}`\n // because `this.itemHeights` can get `.reset()` there, which would\n // discard all the measurements done here, and having currently shown\n // item height measurements is required.\n //\n\n if (prevState && (newState.firstShownItemIndex !== prevState.firstShownItemIndex || newState.lastShownItemIndex !== prevState.lastShownItemIndex || newState.items !== prevState.items) || widthHasChanged) {\n var verticalSpacingStateUpdate = _this.measureItemHeightsAndSpacing();\n\n if (verticalSpacingStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), verticalSpacingStateUpdate);\n }\n } // Clean up \"before resize\" item heights and adjust the scroll position accordingly.\n // Calling `this.beforeResize.cleanUpBeforeResizeItemHeights()` might trigger\n // a `this.updateState()` call but that wouldn't matter because `beforeResize`\n // properties have already been modified directly in `state` (a hacky technique)\n\n\n var cleanedUpBeforeResize = _this.beforeResize.cleanUpBeforeResizeItemHeights();\n\n if (cleanedUpBeforeResize !== undefined) {\n var scrollBy = cleanedUpBeforeResize.scrollBy,\n beforeResize = cleanedUpBeforeResize.beforeResize;\n log('Correct scroll position by', scrollBy);\n\n _this.scroll.scrollByY(scrollBy);\n\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), {}, {\n beforeResize: beforeResize\n });\n }\n\n if (!_this._isActive) {\n _this._stoppedStateUpdate = stateUpdate;\n return;\n }\n\n if (layoutUpdateReason) {\n updateStateRightAfterRender.call(_this, {\n stateUpdate: stateUpdate,\n reason: layoutUpdateReason\n });\n } else if (stateUpdate) {\n _this.updateState(stateUpdate);\n } else {\n log('~ Finished Layout ~');\n }\n }; // After a new set of items has been rendered:\n //\n // * Restores scroll position when using `preserveScrollPositionOnPrependItems`\n // and items have been prepended.\n //\n // * Applies any \"pending\" `itemHeights` updates — those ones that happened\n // while an asynchronous `updateState()` call in `setItems()` was pending.\n //\n // * Either creates or resets the snapshot of the current layout.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n\n\n function onNewItemsRendered(itemsDiff, newLayout) {\n // If it's an \"incremental\" update.\n if (itemsDiff) {\n var prependedItemsCount = itemsDiff.prependedItemsCount,\n appendedItemsCount = itemsDiff.appendedItemsCount;\n\n var _this$getState = this.getState(),\n itemHeights = _this$getState.itemHeights,\n itemStates = _this$getState.itemStates; // See if any items' heights changed while new items were being rendered.\n\n\n if (this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n for (var _i = 0, _Object$keys = Object.keys(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered); _i < _Object$keys.length; _i++) {\n var i = _Object$keys[_i];\n itemHeights[prependedItemsCount + Number(i)] = this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[i];\n }\n } // See if any items' states changed while new items were being rendered.\n\n\n if (this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n for (var _i2 = 0, _Object$keys2 = Object.keys(this.itemStatesThatChangedWhileNewItemsWereBeingRendered); _i2 < _Object$keys2.length; _i2++) {\n var _i3 = _Object$keys2[_i2];\n itemStates[prependedItemsCount + Number(_i3)] = this.itemStatesThatChangedWhileNewItemsWereBeingRendered[_i3];\n }\n }\n\n if (prependedItemsCount === 0) {\n // Adjust `this.previouslyCalculatedLayout`.\n if (this.previouslyCalculatedLayout) {\n if (this.previouslyCalculatedLayout.firstShownItemIndex === newLayout.firstShownItemIndex && this.previouslyCalculatedLayout.lastShownItemIndex === newLayout.lastShownItemIndex) {// `this.previouslyCalculatedLayout` stays the same.\n // `firstShownItemIndex` / `lastShownItemIndex` didn't get changed in `setItems()`,\n // so `beforeItemsHeight` and `shownItemsHeight` also stayed the same.\n } else {\n warn('Unexpected (non-matching) \"firstShownItemIndex\" or \"lastShownItemIndex\" encountered in \"onRender()\" after appending items');\n warn('Previously calculated layout', this.previouslyCalculatedLayout);\n warn('New layout', newLayout);\n this.previouslyCalculatedLayout = undefined;\n }\n }\n\n return 'SEAMLESS_APPEND';\n } else {\n if (this.listHeightMeasurement.hasSnapshot()) {\n if (newLayout.firstShownItemIndex === 0) {\n // Restore (adjust) scroll position.\n log('~ Restore Scroll Position ~');\n var listBottomOffsetChange = this.listHeightMeasurement.getListBottomOffsetChange({\n beforeItemsHeight: newLayout.beforeItemsHeight\n });\n this.listHeightMeasurement.reset();\n\n if (listBottomOffsetChange) {\n log('Scroll down by', listBottomOffsetChange);\n this.scroll.scrollByY(listBottomOffsetChange);\n } else {\n log('Scroll position hasn\\'t changed');\n } // Create new `this.previouslyCalculatedLayout`.\n\n\n if (this.previouslyCalculatedLayout) {\n if (this.previouslyCalculatedLayout.firstShownItemIndex === 0 && this.previouslyCalculatedLayout.lastShownItemIndex === newLayout.lastShownItemIndex - prependedItemsCount) {\n this.previouslyCalculatedLayout = {\n beforeItemsHeight: 0,\n shownItemsHeight: this.previouslyCalculatedLayout.shownItemsHeight + listBottomOffsetChange,\n firstShownItemIndex: 0,\n lastShownItemIndex: newLayout.lastShownItemIndex\n };\n } else {\n warn('Unexpected (non-matching) \"firstShownItemIndex\" or \"lastShownItemIndex\" encountered in \"onRender()\" after prepending items');\n warn('Previously calculated layout', this.previouslyCalculatedLayout);\n warn('New layout', newLayout);\n this.previouslyCalculatedLayout = undefined;\n }\n }\n\n return 'SEAMLESS_PREPEND';\n } else {\n warn(\"Unexpected \\\"firstShownItemIndex\\\" \".concat(newLayout.firstShownItemIndex, \" encountered in \\\"onRender()\\\" after prepending items. Expected 0.\"));\n }\n }\n }\n } // Reset `this.previouslyCalculatedLayout` in any case other than\n // SEAMLESS_PREPEND or SEAMLESS_APPEND.\n\n\n this.previouslyCalculatedLayout = undefined;\n }\n\n function updateStateRightAfterRender(_ref) {\n var reason = _ref.reason,\n stateUpdate = _ref.stateUpdate;\n\n // In React, `setTimeout()` is used to prevent a React error:\n // \"Maximum update depth exceeded.\n // This can happen when a component repeatedly calls\n // `.updateState()` inside `componentWillUpdate()` or `componentDidUpdate()`.\n // React limits the number of nested updates to prevent infinite loops.\"\n if (this._useTimeoutInRenderLoop) {\n // Cancel a previously scheduled re-layout.\n stateUpdate = this.cancelLayoutTimer({\n stateUpdate: stateUpdate\n }); // Schedule a new re-layout.\n\n this.scheduleLayoutTimer({\n reason: reason,\n stateUpdate: stateUpdate\n });\n } else {\n this.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }\n }\n\n function resetStateUpdateFlags() {\n // Read and reset `this.widthHasChanged` flag.\n //\n // If `this.widthHasChanged` flag was reset after calling\n // `this.measureWidthHeightsAndSpacingAndUpdateTablePadding()`\n // then there would be a bug because\n // `this.measureWidthHeightsAndSpacingAndUpdateTablePadding()`\n // calls `this.updateState({ verticalSpacing })` which calls\n // `this.onRender()` immediately, so `this.widthHasChanged`\n // flag wouldn't be reset by that time and would trigger things\n // like `this.itemHeights.reset()` a second time.\n //\n // So, instead read the value of `this.widthHasChanged` flag\n // and reset it right away to prevent any such potential bugs.\n //\n var widthHasChanged = Boolean(this.widthHasChanged); //\n // Reset `this.widthHasChanged` flag.\n\n this.widthHasChanged = undefined; // Read `this.firstNonMeasuredItemIndex` flag.\n\n var nonMeasuredItemsHaveBeenRendered = this.firstNonMeasuredItemIndex !== undefined;\n\n if (nonMeasuredItemsHaveBeenRendered) {\n log('Non-measured item index', this.firstNonMeasuredItemIndex);\n } // Reset `this.firstNonMeasuredItemIndex` flag.\n\n\n this.firstNonMeasuredItemIndex = undefined; // Reset `this.newItemsWillBeRendered` flag.\n\n this.newItemsWillBeRendered = undefined; // Reset `this.itemHeightsThatChangedWhileNewItemsWereBeingRendered`.\n\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = undefined; // Reset `this.itemStatesThatChangedWhileNewItemsWereBeingRendered`.\n\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered = undefined; // Reset `this.updateLayoutAfterRenderBecauseItemHeightChanged`.\n\n var itemHeightHasChanged = this.updateLayoutAfterRenderBecauseItemHeightChanged;\n this.updateLayoutAfterRenderBecauseItemHeightChanged = undefined;\n return {\n nonMeasuredItemsHaveBeenRendered: nonMeasuredItemsHaveBeenRendered,\n itemHeightHasChanged: itemHeightHasChanged,\n widthHasChanged: widthHasChanged\n };\n }\n}\n//# sourceMappingURL=VirtualScroller.onRender.js.map","import log from './utility/debug.js';\nexport default function () {\n var _this = this;\n\n this.onResize = function () {\n // Reset \"previously calculated layout\".\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n _this.previouslyCalculatedLayout = undefined; // Cancel any potential scheduled scroll position restoration.\n\n _this.listHeightMeasurement.reset(); // Get the most recent items count.\n // If there're a \"pending\" `setItems()` call then use the items count from that call\n // instead of using the count of currently shown `items` from `state`.\n // A `setItems()` call is \"pending\" when `updateState()` operation is \"asynchronous\", that is\n // when `updateState()` calls aren't applied immediately, like in React.\n\n\n var itemsCount = _this.newItemsWillBeRendered ? _this.newItemsWillBeRendered.count : _this.getState().itemHeights.length; // If layout values have been calculated as a result of a \"pending\" `setItems()` call,\n // then don't discard those new layout values and use them instead of the ones from `state`.\n //\n // A `setItems()` call is \"pending\" when `updateState()` operation is \"asynchronous\", that is\n // when `updateState()` calls aren't applied immediately, like in React.\n //\n\n var layout = _this.newItemsWillBeRendered ? _this.newItemsWillBeRendered.layout : _this.getState(); // Update `VirtualScroller` state.\n\n var newState = {\n scrollableContainerWidth: _this.scrollableContainer.getWidth(),\n // This state update should also overwrite all the `state` properties\n // that are also updated in the \"on scroll\" handler (`getShownItemIndexes()`):\n //\n // * `firstShownItemIndex`\n // * `lastShownItemIndex`\n // * `beforeItemsHeight`\n // * `afterItemsHeight`\n //\n // That's because this `updateState()` update has a higher priority\n // than that of the \"on scroll\" handler, so it should overwrite\n // any potential state changes dispatched by the \"on scroll\" handler.\n //\n // All these properties might have changed, but they're not\n // recalculated here becase they'll be recalculated after\n // this new state is applied (rendered).\n //\n firstShownItemIndex: layout.firstShownItemIndex,\n lastShownItemIndex: layout.lastShownItemIndex,\n beforeItemsHeight: layout.beforeItemsHeight,\n afterItemsHeight: layout.afterItemsHeight,\n // Reset item heights, because if scrollable container's width (or height)\n // has changed, then the list width (or height) most likely also has changed,\n // and also some CSS `@media()` rules might have been added or removed.\n // So re-render the list entirely.\n itemHeights: new Array(itemsCount),\n columnsCount: _this.getActualColumnsCountForState(),\n // Re-measure vertical spacing after render because new CSS styles\n // might be applied for the new window width.\n verticalSpacing: undefined\n };\n var firstShownItemIndex = layout.firstShownItemIndex,\n lastShownItemIndex = layout.lastShownItemIndex; // Get the `columnsCount` for the new window width.\n\n var newColumnsCount = _this.getActualColumnsCount(); // Re-calculate `firstShownItemIndex` and `lastShownItemIndex`\n // based on the new `columnsCount` so that the whole row is visible.\n\n\n var newFirstShownItemIndex = Math.floor(firstShownItemIndex / newColumnsCount) * newColumnsCount;\n var newLastShownItemIndex = Math.min(Math.ceil((lastShownItemIndex + 1) / newColumnsCount) * newColumnsCount, itemsCount) - 1; // Potentially update `firstShownItemIndex` if it needs to be adjusted in order to\n // correspond to the new `columnsCount`.\n\n if (newFirstShownItemIndex !== firstShownItemIndex) {\n log('Columns Count changed from', _this.getState().columnsCount || 1, 'to', newColumnsCount);\n log('First Shown Item Index needs to change from', firstShownItemIndex, 'to', newFirstShownItemIndex);\n } // Always rewrite `firstShownItemIndex` and `lastShownItemIndex`\n // as part of the `state` update, even if it hasn't been modified.\n //\n // The reason is that there could be two subsequent `onResize()` calls:\n // the first one could be user resizing the window to half of its width,\n // resulting in an \"asynchronous\" `updateState()` call, and then, before that\n // `updateState()` call is applied, a second resize event happens when the user\n // has resized the window back to its original width, meaning that the\n // `columnsCount` is back to its original value.\n // In that case, the final `newFirstShownItemIndex` will be equal to the\n // original `firstShownItemIndex` that was in `state` before the user\n // has started resizing the window, so, in the end, `state.firstShownItemIndex`\n // property wouldn't have changed, but it still has to be part of the final\n // state update in order to overwrite the previous update of `firstShownItemIndex`\n // property that has been scheduled to be applied in state after the first resize\n // happened.\n //\n\n\n newState.firstShownItemIndex = newFirstShownItemIndex;\n newState.lastShownItemIndex = newLastShownItemIndex;\n\n var verticalSpacing = _this.getVerticalSpacing();\n\n var columnsCount = _this.getColumnsCount(); // `beforeResize` is always overwritten in `state` here.\n // (once it has started being tracked in `state`)\n\n\n if (_this.shouldDiscardBeforeResizeItemHeights() || newFirstShownItemIndex === 0) {\n if (_this.beforeResize.shouldIncludeBeforeResizeValuesInState()) {\n newState.beforeResize = undefined;\n }\n } // Snapshot \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no \"content jumping\".\n else {\n // Keep \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no\n // \"content jumping\". These \"before resize\" values will be discarded\n // when (if) the user scrolls back to the top of the list.\n newState.beforeResize = {\n verticalSpacing: verticalSpacing,\n columnsCount: columnsCount,\n itemHeights: _this.beforeResize.snapshotBeforeResizeItemHeights({\n firstShownItemIndex: firstShownItemIndex,\n newFirstShownItemIndex: newFirstShownItemIndex,\n newColumnsCount: newColumnsCount\n })\n };\n } // `this.widthHasChanged` tells `VirtualScroller` that it should\n // temporarily stop other updates (like \"on scroll\" updates) and wait\n // for the new `state` to be applied, after which the `onRender()`\n // function will clear this flag and perform a re-layout.\n //\n // A re-layout is required because the layout parameters calculated above\n // are approximate ones, and the exact item heights aren't known at this point.\n // So the `updateState()` call below is just to re-render the `VirtualScroller`.\n // After it has been re-rendered, it will measure item heights and then calculate\n // correct layout parameters.\n //\n\n\n _this.widthHasChanged = {\n stateUpdate: newState\n }; // Rerender.\n\n _this.updateState(newState);\n }; // Returns whether \"before resize\" item heights should be discarded\n // as a result of calling `setItems()` with a new set of items\n // when an asynchronous `updateState()` call inside that function\n // hasn't been applied yet.\n //\n // If `setItems()` update was an \"incremental\" one and no items\n // have been prepended, then `firstShownItemIndex` is preserved,\n // and all items' heights before it should be kept in order to\n // preserve the top offset of the first shown item so that there's\n // no \"content jumping\".\n //\n // If `setItems()` update was an \"incremental\" one but there're\n // some prepended items, then it means that now there're new items\n // with unknown heights at the top, so the top offset of the first\n // shown item won't be preserved because there're no \"before resize\"\n // heights of those items.\n //\n // If `setItems()` update was not an \"incremental\" one, then don't\n // attempt to restore previous item heights after a potential window\n // width change because all item heights have been reset.\n //\n\n\n this.shouldDiscardBeforeResizeItemHeights = function () {\n if (_this.newItemsWillBeRendered) {\n var _this$newItemsWillBeR = _this.newItemsWillBeRendered,\n prepend = _this$newItemsWillBeR.prepend,\n replace = _this$newItemsWillBeR.replace;\n return prepend || replace;\n }\n };\n}\n//# sourceMappingURL=VirtualScroller.resize.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport log, { isDebug } from './utility/debug.js';\nimport getItemsDiff from './getItemsDiff.js';\nimport fillArray from './utility/fillArray.js';\nexport default function () {\n var _this = this;\n\n this.getItemsCount = function () {\n return _this.getState().items.length;\n };\n /**\r\n * Updates `items`. For example, can prepend or append new items to the list.\r\n * @param {any[]} newItems\r\n * @param {boolean} [options.preserveScrollPositionOnPrependItems] — Set to `true` to enable \"restore scroll position after prepending items\" feature (could be useful when implementing \"Show previous items\" button).\r\n */\n\n\n this._setItems = function (newItems) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var _this$getState = _this.getState(),\n previousItems = _this$getState.items; // Even if `newItems` are equal to `this.state.items`,\n // still perform a `updateState()` call, because, if `updateState()` calls\n // were \"asynchronous\", there could be a situation when a developer\n // first calls `setItems(newItems)` and then `setItems(oldItems)`:\n // if this function did `return` `if (newItems === this.state.items)`\n // then `updateState({ items: newItems })` would be scheduled as part of\n // `setItems(newItems)` call, but the subsequent `setItems(oldItems)` call\n // wouldn't do anything resulting in `newItems` being set as a result,\n // and that wouldn't be what the developer intended.\n\n\n var _this$getState2 = _this.getState(),\n itemStates = _this$getState2.itemStates;\n\n var _ref = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate : _this.getState(),\n itemHeights = _ref.itemHeights;\n\n log('~ Update items ~');\n var layoutUpdate;\n var itemsUpdateInfo; // Compare the new items to the current items.\n\n var itemsDiff = _this.getItemsDiff(previousItems, newItems); // See if it's an \"incremental\" items update.\n\n\n if (itemsDiff) {\n var _ref2 = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate : _this.getState(),\n firstShownItemIndex = _ref2.firstShownItemIndex,\n lastShownItemIndex = _ref2.lastShownItemIndex,\n beforeItemsHeight = _ref2.beforeItemsHeight,\n afterItemsHeight = _ref2.afterItemsHeight;\n\n var shouldRestoreScrollPosition = firstShownItemIndex === 0 && ( // `preserveScrollPosition` option name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n options.preserveScrollPositionOnPrependItems || options.preserveScrollPosition);\n var prependedItemsCount = itemsDiff.prependedItemsCount,\n appendedItemsCount = itemsDiff.appendedItemsCount;\n var shouldResetGridLayout;\n layoutUpdate = _this.layout.getLayoutUpdateForItemsDiff({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, {\n prependedItemsCount: prependedItemsCount,\n appendedItemsCount: appendedItemsCount\n }, {\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount(),\n shouldRestoreScrollPosition: shouldRestoreScrollPosition,\n onResetGridLayout: function onResetGridLayout() {\n return shouldResetGridLayout = true;\n }\n });\n\n if (prependedItemsCount > 0) {\n log('Prepend', prependedItemsCount, 'items');\n itemHeights = new Array(prependedItemsCount).concat(itemHeights);\n itemStates = fillArray(new Array(prependedItemsCount), function (i) {\n return _this.getInitialItemState(newItems[i]);\n }).concat(itemStates); // Restore scroll position after prepending items (if requested).\n\n if (shouldRestoreScrollPosition) {\n log('Will restore scroll position');\n\n _this.listHeightMeasurement.snapshotListHeightBeforeAddingNewItems({\n previousItems: previousItems,\n newItems: newItems,\n prependedItemsCount: prependedItemsCount\n }); // \"Seamless prepend\" scenario doesn't result in a re-layout,\n // so if any \"non measured item\" is currently pending,\n // it doesn't get reset and will be handled after `state` is updated.\n\n\n if (_this.firstNonMeasuredItemIndex !== undefined) {\n _this.firstNonMeasuredItemIndex += prependedItemsCount;\n }\n } else {\n log('Reset layout');\n\n if (shouldResetGridLayout) {\n log('Reason: Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', _this.getActualColumnsCount()); // Reset item heights because the whole grid is going to be rebalanced\n // and re-rendered in a different configuration.\n\n itemHeights = new Array(newItems.length);\n } else {\n // Reset layout because none of the prepended items have been measured.\n log('Reason: Prepended items\\' heights are unknown');\n }\n\n layoutUpdate = _this.layout.getInitialLayoutValues({\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount()\n }); // Unschedule a potentially scheduled layout update\n // after measuring a previously non-measured item\n // because the list will be re-layout anyway\n // due to the new items being set.\n\n _this.firstNonMeasuredItemIndex = undefined;\n }\n }\n\n if (appendedItemsCount > 0) {\n log('Append', appendedItemsCount, 'items');\n itemHeights = itemHeights.concat(new Array(appendedItemsCount));\n itemStates = itemStates.concat(fillArray(new Array(appendedItemsCount), function (i) {\n return _this.getInitialItemState(newItems[prependedItemsCount + previousItems.length + i]);\n }));\n }\n\n itemsUpdateInfo = {\n prepend: prependedItemsCount > 0,\n append: appendedItemsCount > 0\n };\n } else {\n log('Items have changed, and', itemsDiff ? 'a re-layout from scratch has been requested.' : 'it\\'s not a simple append and/or prepend.', 'Rerender the entire list from scratch.');\n log('Previous items', previousItems);\n log('New items', newItems); // Reset item heights and item states.\n\n itemHeights = new Array(newItems.length);\n itemStates = fillArray(new Array(newItems.length), function (i) {\n return _this.getInitialItemState(newItems[i]);\n });\n layoutUpdate = _this.layout.getInitialLayoutValues({\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount()\n }); // Unschedule a potentially scheduled layout update\n // after measuring a previously non-measured item\n // because the list will be re-layout from scratch\n // due to the new items being set.\n\n _this.firstNonMeasuredItemIndex = undefined; // Also reset any potential pending scroll position restoration.\n // For example, imagine a developer first called `.setItems(incrementalItemsUpdate)`\n // and then called `.setItems(differentItems)` and there was no state update\n // in between those two calls. This could happen because state updates aren't\n // required to be \"synchronous\". On other words, calling `this.updateState()`\n // doesn't necessarily mean that the state is applied immediately.\n // Imagine also that such \"delayed\" state updates could be batched,\n // like they do in React inside event handlers (though that doesn't apply to this case):\n // https://github.com/facebook/react/issues/10231#issuecomment-316644950\n // If `this.listHeightMeasurement` wasn't reset on `.setItems(differentItems)`\n // and if the second `this.updateState()` call overwrites the first one\n // then it would attempt to restore scroll position in a situation when\n // it should no longer do that. Hence the reset here.\n\n _this.listHeightMeasurement.reset();\n\n itemsUpdateInfo = {\n replace: true\n };\n }\n\n log('~ Update state ~'); // const layoutValuesAfterUpdate = {\n // \t...this.getState(),\n // \t...layoutUpdate\n // }\n // `layoutUpdate` is equivalent to `layoutValuesAfterUpdate` because\n // `layoutUpdate` contains all the relevant properties.\n\n log('First shown item index', layoutUpdate.firstShownItemIndex);\n log('Last shown item index', layoutUpdate.lastShownItemIndex);\n log('Before items height', layoutUpdate.beforeItemsHeight);\n log('After items height (actual or estimated)', layoutUpdate.afterItemsHeight); // Optionally preload items to be rendered.\n //\n // `layoutUpdate` is equivalent to `layoutValuesAfterUpdate` because\n // `layoutUpdate` contains all the relevant properties.\n //\n\n _this.onBeforeShowItems(newItems, itemHeights, layoutUpdate.firstShownItemIndex, layoutUpdate.lastShownItemIndex); // `this.newItemsWillBeRendered` signals that new `items` are being rendered,\n // and that `VirtualScroller` should temporarily stop all other updates.\n //\n // `this.newItemsWillBeRendered` is cleared in `onRender()`.\n //\n // The values in `this.newItemsWillBeRendered` are used, for example,\n // in `.onResize()` handler in order to not break state consistency when\n // state updates are \"asynchronous\" (delayed) and there's a window resize event\n // in between calling `updateState()` below and that call actually being applied.\n //\n\n\n _this.newItemsWillBeRendered = _objectSpread(_objectSpread({}, itemsUpdateInfo), {}, {\n count: newItems.length,\n // `layoutUpdate` now contains all layout-related properties, even if those that\n // didn't change. So `firstShownItemIndex` is always in `this.newItemsWillBeRendered`.\n layout: layoutUpdate\n }); // `layoutUpdate` now contains all layout-related properties, even if those that\n // didn't change. So this part is no longer relevant.\n //\n // // If `firstShownItemIndex` is gonna be modified as a result of setting new items\n // // then keep that \"new\" `firstShownItemIndex` in order for it to be used by\n // // `onResize()` handler when it calculates \"new\" `firstShownItemIndex`\n // // based on the new columns count (corresponding to the new window width).\n // if (layoutUpdate.firstShownItemIndex !== undefined) {\n // \tthis.newItemsWillBeRendered = {\n // \t\t...this.newItemsWillBeRendered,\n // \t\tfirstShownItemIndex: layoutUpdate.firstShownItemIndex\n // \t}\n // }\n // Update `VirtualScroller` state.\n //\n // This state update should overwrite all the `state` properties\n // that are also updated in the \"on scroll\" handler (`getShownItemIndexes()`):\n //\n // * `firstShownItemIndex`\n // * `lastShownItemIndex`\n // * `beforeItemsHeight`\n // * `afterItemsHeight`\n //\n // That's because this `updateState()` update has a higher priority\n // than that of the \"on scroll\" handler, so it should overwrite\n // any potential state changes dispatched by the \"on scroll\" handler.\n //\n\n var newState = _objectSpread(_objectSpread({}, layoutUpdate), {}, {\n items: newItems,\n itemStates: itemStates,\n itemHeights: itemHeights\n }); // Introduced `shouldIncludeBeforeResizeValuesInState()` getter just to prevent\n // cluttering `state` with `beforeResize: undefined` property if `beforeResize`\n // hasn't ever been set in `state` previously.\n\n\n if (_this.beforeResize.shouldIncludeBeforeResizeValuesInState()) {\n if (_this.shouldDiscardBeforeResizeItemHeights()) {\n // Reset \"before resize\" item heights because now there're new items prepended\n // with unknown heights, or completely new items with unknown heights, so\n // `beforeItemsHeight` value won't be preserved anyway.\n newState.beforeResize = undefined;\n } else {\n // Overwrite `beforeResize` property in `state` even if it wasn't modified\n // because state updates could be \"asynchronous\" and in that case there could be\n // some previous `updateState()` call from some previous `setItems()` call that\n // hasn't yet been applied, and that previous call might have scheduled setting\n // `state.beforeResize` property to `undefined` in order to reset it, but this\n // next `updateState()` call might not require resetting `state.beforeResize` property\n // so it should undo resetting it by simply overwriting it with its normal value.\n newState.beforeResize = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate.beforeResize : _this.getState().beforeResize;\n }\n } // `newState` should also overwrite all `state` properties that're updated in `onResize()`\n // because `setItems()`'s state updates always overwrite `onResize()`'s state updates.\n // (The least-priority ones are `onScroll()` state updates, but those're simply skipped\n // if there's a pending `setItems()` or `onResize()` update).\n //\n // `state` property exceptions:\n //\n // `verticalSpacing` property is not updated here because it's fine setting it to\n // `undefined` in `onResize()` — it will simply be re-measured after the component re-renders.\n //\n // `columnsCount` property is also not updated here because by definition it's only\n // updated in `onResize()`.\n // Render.\n\n\n _this._isSettingNewItems = true;\n\n _this.updateState(newState);\n };\n\n this.getItemsDiff = function (previousItems, newItems) {\n return getItemsDiff(previousItems, newItems, _this.isItemEqual);\n };\n}\n//# sourceMappingURL=VirtualScroller.items.js.map","/**\r\n * Checks whether it's an \"incremental\" items update, and returns the \"diff\".\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @return {object} [diff]\r\n */\nexport default function getItemsDiff(previousItems, newItems, isEqual) {\n var firstPreviousItemIndex = -1;\n var lastPreviousItemIndex = -1;\n\n if (previousItems.length > 0) {\n firstPreviousItemIndex = findInArray(newItems, previousItems[0], isEqual);\n\n if (firstPreviousItemIndex >= 0) {\n if (arePreviousItemsPreserved(previousItems, newItems, firstPreviousItemIndex, isEqual)) {\n lastPreviousItemIndex = firstPreviousItemIndex + previousItems.length - 1;\n }\n }\n }\n\n var isIncrementalUpdate = firstPreviousItemIndex >= 0 && lastPreviousItemIndex >= 0;\n\n if (isIncrementalUpdate) {\n return {\n prependedItemsCount: firstPreviousItemIndex,\n appendedItemsCount: newItems.length - (lastPreviousItemIndex + 1)\n };\n }\n}\n\nfunction arePreviousItemsPreserved(previousItems, newItems, offset, isEqual) {\n // Check each item of the `previousItems` to determine\n // whether it's an \"incremental\" items update.\n // (an update when items are prepended or appended)\n var i = 0;\n\n while (i < previousItems.length) {\n if (newItems.length <= offset + i || !isEqual(newItems[offset + i], previousItems[i])) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\n\nfunction findInArray(array, element, isEqual) {\n var i = 0;\n\n while (i < array.length) {\n if (isEqual(array[i], element)) {\n return i;\n }\n\n i++;\n }\n\n return -1;\n}\n//# sourceMappingURL=getItemsDiff.js.map","import { supportsTbody, BROWSER_NOT_SUPPORTED_ERROR } from './DOM/tbody.js';\nimport DOMEngine from './DOM/Engine.js';\nimport Layout, { LAYOUT_REASON } from './Layout.js';\nimport Resize from './Resize.js';\nimport BeforeResize from './BeforeResize.js';\nimport Scroll from './Scroll.js';\nimport ListHeightMeasurement from './ListHeightMeasurement.js';\nimport ItemHeights from './ItemHeights.js';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport createStateHelpers from './VirtualScroller.state.js';\nimport createVerticalSpacingHelpers from './VirtualScroller.verticalSpacing.js';\nimport createColumnsHelpers from './VirtualScroller.columns.js';\nimport createLayoutHelpers from './VirtualScroller.layout.js';\nimport createOnRenderHelpers from './VirtualScroller.onRender.js';\nimport createResizeHelpers from './VirtualScroller.resize.js';\nimport createItemsHelpers from './VirtualScroller.items.js';\n/**\r\n * @param {function} getItemsContainerElement — Returns the container DOM `Element`.\r\n * @param {any[]} items — The list of items.\r\n * @param {Object} [options] — See README.md.\r\n * @return {VirtualScroller}\r\n */\n\nexport default function VirtualScrollerConstructor(getItemsContainerElement, items) {\n var _this = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var render = options.render,\n state = options.state,\n _options$getInitialIt = options.getInitialItemState,\n getInitialItemState = _options$getInitialIt === void 0 ? function () {} : _options$getInitialIt,\n onStateChange = options.onStateChange,\n initialScrollPosition = options.initialScrollPosition,\n onScrollPositionChange = options.onScrollPositionChange,\n scrollableContainer = options.scrollableContainer,\n _options$measureItems = options.measureItemsBatchSize,\n measureItemsBatchSize = _options$measureItems === void 0 ? 50 : _options$measureItems,\n getColumnsCount = options.getColumnsCount,\n getItemId = options.getItemId,\n tbody = options.tbody,\n estimatedItemHeight = options.estimatedItemHeight,\n getEstimatedVisibleItemRowsCount = options.getEstimatedVisibleItemRowsCount,\n onItemInitialRender = options.onItemInitialRender,\n onItemFirstRender = options.onItemFirstRender,\n _useTimeoutInRenderLoop = options._useTimeoutInRenderLoop,\n _waitForScrollingToStop = options._waitForScrollingToStop,\n engine = options.engine;\n var bypass = options.bypass,\n getEstimatedItemHeight = options.getEstimatedItemHeight,\n getScrollableContainer = options.getScrollableContainer;\n log('~ Initialize ~'); // Could support non-DOM rendering engines.\n // For example, React Native, `<canvas/>`, etc.\n\n this.engine = engine || DOMEngine;\n\n if (!getEstimatedItemHeight && typeof estimatedItemHeight === 'number') {\n getEstimatedItemHeight = function getEstimatedItemHeight() {\n return estimatedItemHeight;\n };\n } // `scrollableContainer` option is deprecated.\n // Use `getScrollableContainer()` option instead.\n\n\n if (!getScrollableContainer && scrollableContainer) {\n getScrollableContainer = function getScrollableContainer() {\n return scrollableContainer;\n };\n } // Sometimes, when `new VirtualScroller()` instance is created,\n // `getItemsContainerElement()` might not be ready to return the \"container\" DOM Element yet\n // (for example, because it's not rendered yet). That's the reason why it's a getter function.\n // For example, in React `<VirtualScroller/>` component, a `VirtualScroller`\n // instance is created in the React component's `constructor()`, and at that time\n // the container Element is not yet available. The container Element is available\n // in `componentDidMount()`, but `componentDidMount()` is not executed on server,\n // which would mean that React `<VirtualScroller/>` wouldn't render at all\n // on server side, while with the `getItemsContainerElement()` approach, on server side,\n // it still \"renders\" a list with a predefined amount of items in it by default.\n // (`initiallyRenderedItemsCount`, or `1`).\n\n\n this.getItemsContainerElement = getItemsContainerElement; // if (prerenderMargin === undefined) {\n // \t// Renders items which are outside of the screen by this \"prerender margin\".\n // \t// Is the screen height by default: seems to be the optimal value\n // \t// for \"Page Up\" / \"Page Down\" navigation and optimized mouse wheel scrolling.\n // \tprerenderMargin = this.scrollableContainer ? this.scrollableContainer.getHeight() : 0\n // }\n\n if (options.getState || options.setState) {\n throw new Error('[virtual-scroller] `getState`/`setState` options usage has changed in the new version. See the readme for more details.');\n } // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n\n if (tbody) {\n if (this.engine !== DOMEngine) {\n throw new Error('[virtual-scroller] `tbody` option is only supported for DOM rendering engine');\n }\n\n log('~ <tbody/> detected ~');\n this.tbody = true;\n\n if (!supportsTbody()) {\n log('~ <tbody/> not supported ~');\n reportError(BROWSER_NOT_SUPPORTED_ERROR);\n bypass = true;\n }\n }\n\n if (bypass) {\n log('~ \"bypass\" mode ~');\n } // In `bypass` mode, `VirtualScroller` doesn't wait\n // for the user to scroll down to render all items:\n // instead, it renders all items right away, as if\n // the list is rendered without using `VirtualScroller`.\n // It was added just to measure how much is the\n // performance difference between using a `VirtualScroller`\n // and not using a `VirtualScroller`.\n // It turned out that unmounting large React component trees\n // is a very long process, so `VirtualScroller` does seem to\n // make sense when used in a React application.\n\n\n this.bypass = bypass; // this.bypassBatchSize = bypassBatchSize || 10\n // Using `setTimeout()` in render loop is a workaround\n // for avoiding a React error message:\n // \"Maximum update depth exceeded.\n // This can happen when a component repeatedly calls\n // `.setState()` inside `componentWillUpdate()` or `componentDidUpdate()`.\n // React limits the number of nested updates to prevent infinite loops.\"\n\n this._useTimeoutInRenderLoop = _useTimeoutInRenderLoop;\n\n if (getItemId) {\n this.isItemEqual = function (a, b) {\n return getItemId(a) === getItemId(b);\n };\n } else {\n this.isItemEqual = function (a, b) {\n return a === b;\n };\n }\n\n if (onItemInitialRender) {\n this.onItemInitialRender = onItemInitialRender;\n } // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n else if (onItemFirstRender) {\n this.onItemInitialRender = function (item) {\n warn('`onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.');\n\n var _this$getState = _this.getState(),\n items = _this$getState.items;\n\n var i = items.indexOf(item); // The `item` could also be non-found due to the inconsistency bug:\n // The reason is that `i` can be non-consistent with the `items`\n // passed to `<VirtualScroller/>` in React due to `updateState()` not being\n // instanteneous: when new `items` are passed to `<VirtualScroller/>`,\n // `VirtualScroller.updateState({ items })` is called, and if `onItemFirstRender(i)`\n // is called after the aforementioned `updateState()` is called but before it finishes,\n // `i` would point to an index in \"previous\" `items` while the application\n // would assume that `i` points to an index in the \"new\" `items`,\n // resulting in an incorrect item being assumed by the application\n // or even in an \"array index out of bounds\" error.\n\n if (i >= 0) {\n onItemFirstRender(i);\n }\n };\n } // If initial `state` is passed then use `items` from `state`\n // instead of the `items` argument.\n\n\n if (state) {\n items = state.items;\n }\n\n log('Items count', items.length);\n\n if (getEstimatedItemHeight) {\n log('Estimated item height', getEstimatedItemHeight());\n }\n\n createStateHelpers.call(this, {\n state: state,\n getInitialItemState: getInitialItemState,\n onStateChange: onStateChange,\n render: render,\n items: items\n });\n createVerticalSpacingHelpers.call(this);\n createColumnsHelpers.call(this, {\n getColumnsCount: getColumnsCount\n });\n createLayoutHelpers.call(this);\n createOnRenderHelpers.call(this);\n createResizeHelpers.call(this);\n createItemsHelpers.call(this);\n createHelpers.call(this, {\n getScrollableContainer: getScrollableContainer,\n getEstimatedItemHeight: getEstimatedItemHeight,\n getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize: measureItemsBatchSize,\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n waitForScrollingToStop: _waitForScrollingToStop\n });\n\n if (state) {\n // Initialize `ItemHeights` from previously measured `state.itemHeights`.\n this.itemHeights.readItemHeightsFromState(state); // Initialize some `BeforeResize` internal flags from a previously saved state.\n\n this.beforeResize.initializeFromState(state);\n }\n}\n\nfunction createHelpers(_ref) {\n var _this2 = this;\n\n var getScrollableContainer = _ref.getScrollableContainer,\n getEstimatedItemHeight = _ref.getEstimatedItemHeight,\n getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize = _ref.measureItemsBatchSize,\n initialScrollPosition = _ref.initialScrollPosition,\n onScrollPositionChange = _ref.onScrollPositionChange,\n waitForScrollingToStop = _ref.waitForScrollingToStop;\n this.itemsContainer = this.engine.createItemsContainer(this.getItemsContainerElement); // If the items \"container\" element is mounted at this stage,\n // remove any accidental text nodes from it (like whitespace).\n //\n // Also, this guards against cases when someone accidentally tries\n // using `VirtualScroller` on a non-empty element.\n //\n\n if (this.getItemsContainerElement()) {\n this.itemsContainer.clear();\n }\n\n this.scrollableContainer = this.engine.createScrollableContainer(getScrollableContainer, this.getItemsContainerElement); // Create `ItemHeights` instance.\n\n this.itemHeights = new ItemHeights({\n container: this.itemsContainer,\n getItemHeight: function getItemHeight(i) {\n return _this2.getState().itemHeights[i];\n },\n setItemHeight: function setItemHeight(i, height) {\n return _this2.getState().itemHeights[i] = height;\n }\n });\n this.layout = new Layout({\n bypass: this.bypass,\n getInitialEstimatedItemHeight: getEstimatedItemHeight,\n getInitialEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize: measureItemsBatchSize,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this2.getPrerenderMargin();\n },\n getVerticalSpacing: function getVerticalSpacing() {\n return _this2.getVerticalSpacing();\n },\n getVerticalSpacingBeforeResize: function getVerticalSpacingBeforeResize() {\n return _this2.getVerticalSpacingBeforeResize();\n },\n getColumnsCount: function getColumnsCount() {\n return _this2.getColumnsCount();\n },\n getColumnsCountBeforeResize: function getColumnsCountBeforeResize() {\n return _this2.getState().beforeResize && _this2.getState().beforeResize.columnsCount;\n },\n getItemHeight: function getItemHeight(i) {\n return _this2.getState().itemHeights[i];\n },\n getItemHeightBeforeResize: function getItemHeightBeforeResize(i) {\n return _this2.getState().beforeResize && _this2.getState().beforeResize.itemHeights[i];\n },\n getBeforeResizeItemsCount: function getBeforeResizeItemsCount() {\n return _this2.getState().beforeResize ? _this2.getState().beforeResize.itemHeights.length : 0;\n },\n getAverageItemHeight: function getAverageItemHeight() {\n return _this2.itemHeights.getAverage();\n },\n // `this.scrollableContainer` is gonna be `undefined` during server-side rendering.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/30\n getMaxVisibleAreaHeight: function getMaxVisibleAreaHeight() {\n return _this2.scrollableContainer && _this2.scrollableContainer.getHeight();\n },\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n getPreviouslyCalculatedLayout: function getPreviouslyCalculatedLayout() {\n return _this2.previouslyCalculatedLayout;\n }\n });\n this.resize = new Resize({\n bypass: this.bypass,\n getWidth: function getWidth() {\n return _this2.scrollableContainer.getWidth();\n },\n getHeight: function getHeight() {\n return _this2.scrollableContainer.getHeight();\n },\n listenForResize: function listenForResize(listener) {\n return _this2.scrollableContainer.onResize(listener);\n },\n onResizeStart: function onResizeStart() {\n log('~ Scrollable container resize started ~');\n _this2._isResizing = true;\n },\n onResizeStop: function onResizeStop() {\n log('~ Scrollable container resize finished ~');\n _this2._isResizing = undefined;\n },\n onNoChange: function onNoChange() {\n // There might have been some missed `this.onUpdateShownItemIndexes()` calls\n // due to setting `this._isResizing` flag to `true` during the resize.\n // So, update shown item indexes just in case.\n _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_SIZE_UNCHANGED\n });\n },\n onHeightChange: function onHeightChange() {\n return _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_HEIGHT_CHANGED\n });\n },\n onWidthChange: function onWidthChange(prevWidth, newWidth) {\n log('~ Scrollable container width changed from', prevWidth, 'to', newWidth, '~');\n\n _this2.onResize();\n }\n });\n this.scroll = new Scroll({\n bypass: this.bypass,\n scrollableContainer: this.scrollableContainer,\n itemsContainer: this.itemsContainer,\n waitForScrollingToStop: waitForScrollingToStop,\n onScroll: function onScroll() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n delayed = _ref2.delayed;\n\n _this2.onUpdateShownItemIndexes({\n reason: delayed ? LAYOUT_REASON.STOPPED_SCROLLING : LAYOUT_REASON.SCROLL\n });\n },\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n isImmediateLayoutScheduled: function isImmediateLayoutScheduled() {\n return Boolean(_this2.layoutTimer);\n },\n hasNonRenderedItemsAtTheTop: function hasNonRenderedItemsAtTheTop() {\n return _this2.getState().firstShownItemIndex > 0;\n },\n hasNonRenderedItemsAtTheBottom: function hasNonRenderedItemsAtTheBottom() {\n return _this2.getState().lastShownItemIndex < _this2.getItemsCount() - 1;\n },\n getLatestLayoutVisibleArea: function getLatestLayoutVisibleArea() {\n return _this2.latestLayoutVisibleArea;\n },\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this2.getPrerenderMargin();\n }\n });\n this.listHeightMeasurement = new ListHeightMeasurement({\n itemsContainer: this.itemsContainer,\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer\n });\n\n if (this.engine.watchListTopOffset) {\n this.listTopOffsetWatcher = this.engine.watchListTopOffset({\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n onListTopOffsetChange: function onListTopOffsetChange(_ref3) {\n var reason = _ref3.reason;\n return _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.TOP_OFFSET_CHANGED\n });\n }\n });\n }\n\n this.beforeResize = new BeforeResize({\n getState: this.getState,\n getVerticalSpacing: this.getVerticalSpacing,\n getColumnsCount: this.getColumnsCount\n });\n}\n//# sourceMappingURL=VirtualScroller.constructor.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport VirtualScrollerConstructor from './VirtualScroller.constructor.js';\nimport { hasTbodyStyles, addTbodyStyles } from './DOM/tbody.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport log, { warn } from './utility/debug.js';\n\nvar VirtualScroller = /*#__PURE__*/function () {\n /**\r\n * @param {function} getItemsContainerElement — Returns the container DOM `Element`.\r\n * @param {any[]} items — The list of items.\r\n * @param {Object} [options] — See README.md.\r\n * @return {VirtualScroller}\r\n */\n function VirtualScroller(getItemsContainerElement, items) {\n var _this = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n _classCallCheck(this, VirtualScroller);\n\n _defineProperty(this, \"stop\", function () {\n if (!_this._isActive) {\n throw new Error('[virtual-scroller] Can\\'t stop a `VirtualScroller` that hasn\\'t been started');\n }\n\n _this._isActive = false;\n log('~ Stop ~');\n\n _this.resize.stop();\n\n _this.scroll.stop(); // Stop `ListTopOffsetWatcher` if it has been started.\n // There seems to be no need to restart `ListTopOffsetWatcher`.\n // It's mainly a hacky workaround for development mode anyway.\n\n\n if (_this.listTopOffsetWatcher && _this.listTopOffsetWatcher.isStarted()) {\n _this.listTopOffsetWatcher.stop();\n } // Cancel any scheduled layout.\n\n\n _this.cancelLayoutTimer({});\n });\n\n _defineProperty(this, \"updateLayout\", function () {\n _this.hasToBeStarted();\n\n _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.MANUAL\n });\n });\n\n _defineProperty(this, \"onRender\", function () {\n _this._onRender(_this.getState(), _this.previousState);\n });\n\n VirtualScrollerConstructor.call(this, getItemsContainerElement, items, options);\n }\n /**\r\n * Should be invoked after a \"container\" DOM Element is mounted (inserted into the DOM tree).\r\n */\n\n\n _createClass(VirtualScroller, [{\n key: \"start\",\n value: function start() {\n if (this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` has already been started');\n } // If has been stopped previously.\n\n\n var isRestart = this._isActive === false;\n\n if (!isRestart) {\n this.waitingForRender = true; // If no custom state storage has been configured, use the default one.\n // Also sets the initial state.\n\n if (!this._usesCustomStateStorage) {\n this.useDefaultStateStorage();\n } // If `render()` function parameter was passed,\n // perform an initial render.\n\n\n if (this._render) {\n this._render(this.getState());\n }\n }\n\n log('~ Start ~'); // `this._isActive = true` should be placed somewhere at the start of this function.\n\n this._isActive = true; // Reset `ListHeightMeasurement` just in case it has some \"leftover\" state.\n\n this.listHeightMeasurement.reset(); // Reset `_isResizing` flag just in case it has some \"leftover\" value.\n\n this._isResizing = undefined; // Reset `_isSettingNewItems` flag just in case it has some \"leftover\" value.\n\n this._isSettingNewItems = undefined; // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (this.tbody) {\n if (!hasTbodyStyles(this.getItemsContainerElement())) {\n addTbodyStyles(this.getItemsContainerElement());\n }\n } // If there was a pending state update that didn't get applied\n // because of stopping the `VirtualScroller`, apply that state update now.\n //\n // The pending state update won't get applied if the scrollable container width\n // has changed but that's ok because that state update currently could only contain:\n // * `scrollableContainerWidth`\n // * `verticalSpacing`\n // * `beforeResize`\n // All of those get rewritten in `onResize()` anyway.\n //\n\n\n var stateUpdate = this._stoppedStateUpdate;\n this._stoppedStateUpdate = undefined; // Reset `this.verticalSpacing` so that it re-measures it in cases when\n // the `VirtualScroller` was previously stopped and is now being restarted.\n // The rationale is that a previously captured inter-item vertical spacing\n // can't be \"trusted\" in a sense that the user might have resized the window\n // after the previous `state` has been snapshotted.\n // If the user has resized the window, then changing window width might have\n // activated different CSS `@media()` \"queries\" resulting in a potentially different\n // vertical spacing after the restart.\n // If it's not a restart then `this.verticalSpacing` is `undefined` anyway.\n\n this.verticalSpacing = undefined;\n var verticalSpacingStateUpdate = this.measureItemHeightsAndSpacing();\n\n if (verticalSpacingStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), verticalSpacingStateUpdate);\n }\n\n this.resize.start();\n this.scroll.start(); // If `scrollableContainerWidth` hasn't been measured yet,\n // measure it and write it to state.\n\n if (this.getState().scrollableContainerWidth === undefined) {\n var scrollableContainerWidth = this.scrollableContainer.getWidth();\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), {}, {\n scrollableContainerWidth: scrollableContainerWidth\n });\n } else {\n // Reset layout:\n // * If the scrollable container width has changed while stopped.\n // * If the restored state was calculated for another scrollable container width.\n var newWidth = this.scrollableContainer.getWidth();\n var prevWidth = this.getState().scrollableContainerWidth;\n\n if (newWidth !== prevWidth) {\n log('~ Scrollable container width changed from', prevWidth, 'to', newWidth, '~'); // `stateUpdate` doesn't get passed to `this.onResize()`, and, therefore,\n // won't be applied. But that's ok because currently it could only contain:\n // * `scrollableContainerWidth`\n // * `verticalSpacing`\n // * `beforeResize`\n // All of those get rewritten in `onResize()` anyway.\n\n return this.onResize();\n }\n } // If the `VirtualScroller` uses custom (external) state storage, then\n // check if the columns count has changed between calling `.getInitialState()`\n // and `.start()`. If it has, perform a re-layout \"from scratch\".\n\n\n if (this._usesCustomStateStorage) {\n var columnsCount = this.getActualColumnsCount();\n var columnsCountFromState = this.getState().columnsCount || 1;\n\n if (columnsCount !== columnsCountFromState) {\n return this.onResize();\n }\n } // Re-calculate layout and re-render the list.\n // Do that even if when an initial `state` parameter, containing layout values,\n // has been passed. The reason is that the `state` parameter can't be \"trusted\"\n // in a way that it could have been snapshotted for another window width and\n // the user might have resized their window since then.\n\n\n this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.STARTED,\n stateUpdate: stateUpdate\n });\n } // Could be passed as a \"callback\" parameter, so bind it to `this`.\n\n }, {\n key: \"hasToBeStarted\",\n value: function hasToBeStarted() {\n if (!this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` hasn\\'t been started');\n }\n } // Bind it to `this` because this function could hypothetically be passed\n // as a \"callback\" parameter.\n\n }, {\n key: \"getItemScrollPosition\",\n value:\n /**\r\n * Returns the items's top offset relative to the scrollable container's top edge.\r\n * @param {number} i — Item index\r\n * @return {[number]} Returns the item's scroll Y position. Returns `undefined` if any of the previous items haven't been rendered yet.\r\n */\n function getItemScrollPosition(i) {\n var itemTopOffsetInList = this.layout.getItemTopOffset(i);\n\n if (itemTopOffsetInList === undefined) {\n return;\n }\n\n return this.getListTopOffsetInsideScrollableContainer() + itemTopOffsetInList;\n }\n /**\r\n * @deprecated\r\n * `.onItemHeightChange()` has been renamed to `.onItemHeightDidChange()`.\r\n */\n\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n warn('`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`');\n this.onItemHeightDidChange(i);\n }\n /**\r\n * Forces a re-measure of an item's height.\r\n * @param {number} i — Item index\r\n */\n\n }, {\n key: \"onItemHeightDidChange\",\n value: function onItemHeightDidChange(i) {\n this.hasToBeStarted();\n\n this._onItemHeightDidChange(i);\n }\n /**\r\n * Updates an item's state in `state.itemStates[]`.\r\n * @param {number} i — Item index\r\n * @param {any} i — Item's new state\r\n */\n\n }, {\n key: \"setItemState\",\n value: function setItemState(i, newItemState) {\n this.hasToBeStarted();\n\n this._setItemState(i, newItemState);\n } // (deprecated)\n // Use `.setItemState()` method name instead.\n\n }, {\n key: \"onItemStateChange\",\n value: function onItemStateChange(i, newItemState) {\n this.setItemState(i, newItemState);\n }\n /**\r\n * Updates `items`. For example, can prepend or append new items to the list.\r\n * @param {any[]} newItems\r\n * @param {boolean} [options.preserveScrollPositionOnPrependItems] — Set to `true` to enable \"restore scroll position after prepending items\" feature (could be useful when implementing \"Show previous items\" button).\r\n */\n\n }, {\n key: \"setItems\",\n value: function setItems(newItems) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.hasToBeStarted();\n return this._setItems(newItems, options);\n }\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\n//# sourceMappingURL=VirtualScroller.js.map","var _excluded = [\"onMount\", \"onItemUnmount\"];\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport VirtualScrollerCore from '../VirtualScroller.js';\nimport log, { warn } from '../utility/debug.js';\nimport px from '../utility/px.js';\n\nvar VirtualScroller = /*#__PURE__*/function () {\n function VirtualScroller(itemsContainerElement, _items, renderItem) {\n var _this = this;\n\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n _classCallCheck(this, VirtualScroller);\n\n _defineProperty(this, \"render\", function (state, prevState) {\n var items = state.items,\n firstShownItemIndex = state.firstShownItemIndex,\n lastShownItemIndex = state.lastShownItemIndex,\n beforeItemsHeight = state.beforeItemsHeight,\n afterItemsHeight = state.afterItemsHeight; // log('~ On state change ~')\n // log('Previous state', prevState)\n // log('New state', state)\n // Set container padding top and bottom.\n // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n // `this.virtualScroller` hasn't been initialized yet at this stage,\n // so using `this.tbody` instead of `this.virtualScroller.tbody`.\n\n if (!_this.tbody) {\n _this.container.style.paddingTop = px(beforeItemsHeight);\n _this.container.style.paddingBottom = px(afterItemsHeight);\n } // Perform an intelligent \"diff\" re-render if the `items` are the same.\n\n\n var diffRender = prevState && items === prevState.items && items.length > 0; // Remove no longer visible items from the DOM.\n\n if (diffRender) {\n // Decrement instead of increment here because\n // `this.container.removeChild()` changes indexes.\n var _i = prevState.lastShownItemIndex;\n\n while (_i >= prevState.firstShownItemIndex) {\n if (_i >= firstShownItemIndex && _i <= lastShownItemIndex) {// The item is still visible.\n } else {\n log('DOM: Remove element for item index', _i); // The item is no longer visible. Remove it.\n\n _this.unmountItem(_this.container.childNodes[_i - prevState.firstShownItemIndex]);\n }\n\n _i--;\n }\n } else {\n log('DOM: Rerender the list from scratch');\n\n while (_this.container.firstChild) {\n _this.unmountItem(_this.container.firstChild);\n }\n } // Add newly visible items to the DOM.\n\n\n var shouldPrependItems = diffRender;\n var prependBeforeItemElement = shouldPrependItems && _this.container.firstChild;\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n if (diffRender && i >= prevState.firstShownItemIndex && i <= prevState.lastShownItemIndex) {\n // The item is already being rendered.\n // Next items will be appended rather than prepended.\n if (shouldPrependItems) {\n shouldPrependItems = false;\n }\n } else {\n var item = _this.renderItem(items[i]);\n\n if (shouldPrependItems) {\n log('DOM: Prepend element for item index', i); // Append `item` to `this.container` before the retained items.\n\n _this.container.insertBefore(item, prependBeforeItemElement);\n } else {\n log('DOM: Append element for item index', i); // Append `item` to `this.container`.\n\n _this.container.appendChild(item);\n }\n }\n\n i++;\n }\n });\n\n _defineProperty(this, \"onUnmount\", function () {\n warn('`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead.');\n\n _this.stop();\n });\n\n _defineProperty(this, \"destroy\", function () {\n warn('`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead.');\n\n _this.stop();\n });\n\n _defineProperty(this, \"stop\", function () {\n _this.virtualScroller.stop();\n });\n\n _defineProperty(this, \"start\", function () {\n _this.virtualScroller.start();\n });\n\n this.container = itemsContainerElement;\n this.renderItem = renderItem;\n\n var onMount = options.onMount,\n onItemUnmount = options.onItemUnmount,\n restOptions = _objectWithoutProperties(options, _excluded);\n\n this.onItemUnmount = onItemUnmount;\n this.tbody = this.container.tagName === 'TBODY';\n this.virtualScroller = new VirtualScrollerCore(function () {\n return _this.container;\n }, _items, _objectSpread(_objectSpread({}, restOptions), {}, {\n render: this.render,\n tbody: this.tbody\n }));\n this.start(); // `onMount()` option is deprecated due to no longer being used.\n // If someone thinks there's a valid use case for it, create an issue.\n\n if (onMount) {\n onMount();\n }\n }\n\n _createClass(VirtualScroller, [{\n key: \"unmountItem\",\n value: function unmountItem(itemElement) {\n this.container.removeChild(itemElement);\n\n if (this.onItemUnmount) {\n this.onItemUnmount(itemElement);\n }\n }\n /**\r\n * @deprecated\r\n * `.onItemHeightChange()` has been renamed to `.onItemHeightDidChange()`.\r\n */\n\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n warn('`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`');\n this.onItemHeightDidChange(i);\n }\n }, {\n key: \"onItemHeightDidChange\",\n value: function onItemHeightDidChange(i) {\n this.virtualScroller.onItemHeightDidChange(i);\n }\n }, {\n key: \"setItemState\",\n value: function setItemState(i, newState) {\n this.virtualScroller.setItemState(i, newState);\n }\n /**\r\n * @deprecated\r\n * `.updateItems()` has been renamed to `.setItems()`.\r\n */\n\n }, {\n key: \"updateItems\",\n value: function updateItems(newItems, options) {\n warn('`.updateItems()` method was renamed to `.setItems(i)`');\n this.setItems(newItems, options);\n }\n }, {\n key: \"setItems\",\n value: function setItems(newItems, options) {\n this.virtualScroller.setItems(newItems, options);\n }\n /*\r\n getItemCoordinates(i) {\r\n return this.virtualScroller.getItemCoordinates(i)\r\n }\r\n */\n\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\n//# sourceMappingURL=VirtualScroller.js.map"],"names":["px","number","toFixed","BROWSER_NOT_SUPPORTED_ERROR","supportsTbody","window","document","documentMode","TBODY_CLASS_NAME","STYLE_ELEMENT_ID","_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_possibleConstructorReturn","self","call","TypeError","ReferenceError","_assertThisInitialized","_wrapNativeSuper","Class","_cache","Map","undefined","fn","Function","toString","indexOf","has","get","set","Wrapper","_construct","arguments","_getPrototypeOf","this","create","value","_setPrototypeOf","Parent","args","_isNativeReflectConstruct","Reflect","construct","a","push","apply","instance","bind","sham","Proxy","Boolean","valueOf","e","o","p","setPrototypeOf","__proto__","getPrototypeOf","ItemNotRenderedError","_Error","subClass","superClass","_inherits","Derived","hasNativeReflectConstruct","Constructor","protoProps","staticProps","_super","result","Super","NewTarget","_ref","renderedElementIndex","renderedElementsCount","message","_classCallCheck","_ref2","concat","getDefaultMessage","Error","ItemsContainer","getElement","childNodes","_getNthRenderedItemElement","getBoundingClientRect","top","height","firstChild","removeChild","ScrollableContainerNotReadyError","_createSuper","_createClass","ScrollableContainer","getItemsContainerElement","scrollTop","scrollY","scrollTo","offsetWidth","offsetHeight","scrollableContainerTop","scrollableContainerBorderTopWidth","clientTop","getScrollY","onScrollListener","element","addEventListener","removeEventListener","_onResize","unobserve","ResizeObserver","resizeObserver","entries","observe","unlistenGlobalResize","addGlobalResizeListener","itemsContainerElement","ScrollableWindowContainer","_ScrollableContainer","pageYOffset","innerWidth","innerHeight","borderTopWidth","body","_onResize2","onResize","onResizeListener","fullscreenElement","contains","getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","module","exports","process","hr","uptime","Date","getTime","root","global","vendors","suffix","raf","caf","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","round","handle","raf_1","object","requestAnimationFrame","cancelAnimationFrame","cancel","delay","startedAt","animationFrame","tick","clear","clearTimeout","timeout","ListTopOffsetWatcher","getListTopOffset","onListTopOffsetChange","listTopOffset","listTopOffsetInsideScrollableContainer","start","_isActive","watchListTopOffset","watchListTopOffsetTimer","_this","check","DOMEngine","createItemsContainer","createScrollableContainer","getScrollableContainerElement","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","minLen","n","name","test","_unsupportedIterableToArray","_nonIterableSpread","len","arr2","log","isDebug","_console","_len","_key","console","warn","_console2","_len2","_key2","warningsAreErrors","reportError","error","_console3","_len3","_key3","_len4","_key4","createError","join","catchError","getGlobalVariable","debug","ownKeys","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","Layout","bypass","getInitialEstimatedItemHeight","getInitialEstimatedVisibleItemRowsCount","measureItemsBatchSize","getPrerenderMargin","getVerticalSpacing","getVerticalSpacingBeforeResize","getColumnsCount","getColumnsCountBeforeResize","getItemHeight","getItemHeightBeforeResize","getBeforeResizeItemsCount","getAverageItemHeight","getMaxVisibleAreaHeight","getPreviouslyCalculatedLayout","getValue","defaultValue","firstShownItemIndex","lastShownItemIndex","itemsCount","columnsCount","beforeStart","getLastShownItemIndex","getInitialLastShownItemIndex","getInitialLayoutValueWithFallback","beforeItemsHeight","afterItemsHeight","_ref3","estimatedRowsCount","getEstimatedRowsCountForHeight","isNaN","min","estimatedItemHeight","getEstimatedItemHeight","verticalSpacing","ceil","averageItemHeight","_ref4","_ref5","_ref6","prependedItemsCount","appendedItemsCount","shouldRestoreScrollPosition","onResetGridLayout","shownItemsCountBeforeItemsUpdate","afterItemsCount","_ref7","nonMeasuredAreaHeight","indexOfTheFirstItemInTheRow","itemsCountToRenderForMeasurement","Infinity","firstNonMeasuredItemIndex","_ref8","visibleAreaTop","visibleAreaBottom","indexes","_getShownItemIndex","fromIndex","findFirstShownItemIndex","getNonVisibleListShownItemIndexes","_indexes","findLastShownItemIndex","parameters","beforeResize","beforeResizeItemsCount","_this$_getShownItemIn","notFound","beforeResizeItemsHeight","_firstShownItemIndex","_lastShownItemIndex","_columnsCount","floor","currentRowFirstItemIndex","verticalSpacingAfterCurrentRow","currentRowHeight","columnIndex","itemHeight","getItemNotMeasuredIndexes","itemsHeightFromFirstRowToThisRow","rowStepsIntoVisibleAreaTop","rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder","layout","beforeItemsCount","_ref9","getBeforeItemsHeight","rowHeight","topOffsetInsideScrollableContainer","beforeResizeRowsCount","maxBeforeResizeRowsCount","beforeResizeRowIndex","itemRowIndex","rowIndex","_rowHeight","LAYOUT_REASON","Resize","getWidth","getHeight","listenForResize","onResizeStart","onResizeStop","onHeightChange","onWidthChange","onNoChange","isActive","prevScrollableContainerWidth","width","prevScrollableContainerHeight","func","interval","onStart","onStop","Promise","resolve","debounce","SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL","unlistenResize","BeforeResize","getState","state","_includesBeforeResizeInState","_this$getState","itemHeights","newlyShownItemRowsHeight","prevFirstReMeasuredItemsRowIndex","newlyShownItemsToIndex","cleanedUpBeforeResizeItemRowsHeight","maxParticipatingBeforeResizeItemsCount","participatingBeforeResizeItemRowsCount","k","firstDroppedBeforeResizeItemIndex","lastDroppedBeforeResizeItemIndex","splice","scrollBy","newFirstShownItemIndex","newColumnsCount","_this$getState2","prevBeforeResize","prevBeforeResizeItemsCount","prevBeforeResizeBeforeItemsHeight","prevBeforeResizeItemRowsCount","newBeforeResizeAdditionalBeforeItemsHeight","_rowHeight2","newBeforeResizeBeforeItemsHeight","newBeforeResizeBeforeItemRowsCount","fill","equalizeItemHeights","maxItemsCount","Scroll","scrollableContainer","itemsContainer","onScroll","initialScrollPosition","onScrollPositionChange","isImmediateLayoutScheduled","hasNonRenderedItemsAtTheTop","hasNonRenderedItemsAtTheBottom","getLatestLayoutVisibleArea","onScrolledToTop","waitForScrollingToStop","scrollByY","scrollToY","ignoreScrollEvents","cancelOnStopScrollingTimer","forceUpdate","bottom","shouldCallOnScrollListenerWhenStopsScrolling","watchOnStopScrolling","stopListeningToScroll","onStopScrollingTimer","_this2","delayed","ON_STOP_SCROLLING_INACTIVE_PERIOD","ListHeightMeasurement","previousItems","newItems","_snapshot","itemIndex","itemTopOffset","getNthRenderedItemTopOffset","_this$_snapshot","ItemHeights","container","setItemHeight","_get","_set","reset","measuredItemsHeight","firstMeasuredItemIndex","lastMeasuredItemIndex","getNthRenderedItemHeight","nonPreviouslyMeasuredItemIndexes","previousFirstMeasuredItemIndex","previousLastMeasuredItemIndex","firstMeasuredItemIndexHasBeenUpdated","_measureItemHeight","previousHeight","_height","count","fillArray","array","getItem","getStateSnapshot","stateSnapshot","itemStates","createStateHelpers","initialState","getInitialItemState","onStateChange","render","initialItems","items","defaultGetState","defaultSetInitialState","newState","defaultSetState","stateUpdate","previousState","onRender","getInitialStateFromScratch","getInitialLayoutState","getRestoredState","stateColumnsCount","isStateColumnsCountMismatch","cleanUpBeforeResizeState","getActualColumnsCount","_this$layout$getIniti","getInitialLayoutValues","onBeforeShowItems","getActualColumnsCountForState","_render","_setItemState","newItemState","JSON","stringify","newItemsWillBeRendered","itemStatesThatChangedWhileNewItemsWereBeingRendered","String","_getState","updateState","_isSettingNewItems","waitingForRender","mostRecentSetStateValue","_setState","getInitialState","useState","setState","_usesCustomStateStorage","useDefaultStateStorage","setInitialState","createVerticalSpacingHelpers","measureVerticalSpacing","renderedItemsCount","firstShownRowTopOffset","firstShownRowHeight","measureVerticalSpacingIfNotMeasured","createColumnsHelpers","scrollableContainerArgument","createLayoutHelpers","updateShownItemIndexes","_getShownItemIndexes$","getShownItemIndexes","shownItemsHeight","listHeightMeasurement","hasSnapshot","getAnchorItemIndex","validateWillBeHiddenItemHeightsAreAccurate","getAfterItemsHeight","getItemsCount","layoutDuration","SLOW_LAYOUT_DURATION","getAverage","previouslyCalculatedLayout","getVisibleArea","visibleArea","scroll","getVisibleAreaBounds","latestLayoutVisibleArea","getListTopOffsetInsideScrollableContainer","_getVisibleArea$call","isValid","previouslyMeasuredItemHeight","actualItemHeight","remeasureItemHeight","updatePreviouslyCalculatedLayoutOnItemHeightChange","newHeight","prevLayout","heightDifference","onUpdateShownItemIndexes","reason","skip","widthHasChanged","_isResizing","cancelScheduledLayout","cancelLayoutTimer","getItemsContainerTopOffset","listTopOffsetWatcher","onListTopOffset","_onItemHeightDidChange","updateLayoutAfterRenderBecauseItemHeightChanged","itemHeightsThatChangedWhileNewItemsWereBeingRendered","onItemInitialRender","measureItemHeightsAndSpacing","measureItemHeights","layoutTimer","layoutTimerStateUpdate","scheduleLayoutTimer","hasOwnProperty","is","x","y","shallowEqual","objA","objB","keysA","keysB","createOnRenderHelpers","onNewItemsRendered","itemsDiff","newLayout","_i","_Object$keys","Number","_i2","_Object$keys2","_i3","listBottomOffsetChange","getListBottomOffsetChange","updateStateRightAfterRender","_useTimeoutInRenderLoop","resetStateUpdateFlags","nonMeasuredItemsHaveBeenRendered","itemHeightHasChanged","_onRender","prevState","tbody","style","setProperty","layoutUpdateReason","_resetStateUpdateFlag","getItemsDiff","onPrepend","verticalSpacingStateUpdate","cleanedUpBeforeResize","cleanUpBeforeResizeItemHeights","_stoppedStateUpdate","createResizeHelpers","scrollableContainerWidth","newLastShownItemIndex","shouldDiscardBeforeResizeItemHeights","shouldIncludeBeforeResizeValuesInState","snapshotBeforeResizeItemHeights","_this$newItemsWillBeR","prepend","replace","createItemsHelpers","_setItems","layoutUpdate","itemsUpdateInfo","options","shouldResetGridLayout","preserveScrollPositionOnPrependItems","preserveScrollPosition","getLayoutUpdateForItemsDiff","snapshotListHeightBeforeAddingNewItems","append","isEqual","firstPreviousItemIndex","lastPreviousItemIndex","findInArray","offset","arePreviousItemsPreserved","isItemEqual","VirtualScrollerConstructor","_options$getInitialIt","_options$measureItems","getItemId","getEstimatedVisibleItemRowsCount","onItemFirstRender","_waitForScrollingToStop","engine","getScrollableContainer","b","item","createHelpers","readItemHeightsFromState","initializeFromState","resize","listener","prevWidth","newWidth","VirtualScroller","stop","isStarted","hasToBeStarted","classList","getElementById","add","createElement","innerText","head","appendChild","addTbodyStyles","itemTopOffsetInList","getItemTopOffset","onItemHeightDidChange","setItemState","_excluded","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","_items","renderItem","paddingTop","paddingBottom","diffRender","unmountItem","shouldPrependItems","prependBeforeItemElement","insertBefore","virtualScroller","onMount","onItemUnmount","restOptions","tagName","VirtualScrollerCore","itemElement","setItems"],"mappings":"gPAOe,SAASA,EAAGC,GAEzB,OAAQA,EAAS,GAAM,EAAIA,EAASA,EAAOC,QAAQ,IAAM,KCNpD,IAAIC,EAA8B,oQAClC,SAASC,IAMd,MAAsB,oBAAXC,SAA0BA,OAAOC,SAASC,aAOhD,IAAIC,EAAmB,kBAC1BC,EAAmB,uBClBvB,SAASC,EAAQC,GAAkC,OAAOD,EAAU,mBAAqBE,QAAU,iBAAmBA,OAAOC,SAAW,SAAUF,GAAO,cAAcA,GAAS,SAAUA,GAAO,OAAOA,GAAO,mBAAqBC,QAAUD,EAAIG,cAAgBF,QAAUD,IAAQC,OAAOG,UAAY,gBAAkBJ,GAAQD,EAAQC,GAEzU,SAASK,EAAkBC,EAAQC,GAAS,IAAK,IAAIC,EAA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AAK0nB,gBAAkB,IAAIK,IAAoB,WAC7C,OAAOxe,EAAMkP,YACZwO,EAAQpa,GAAcA,GAAc,GAAIgb,GAAc,GAAI,CAC3DzN,OAAQpa,KAAKoa,OACb8H,MAAOliB,KAAKkiB,SAEdliB,KAAKmJ,QAGDwe,GACFA,IAlIN,IAAsB5lB,EAAaC,EAAYC,EA4L7C,OA5LoBF,EAsIP2jB,EAtIoB1jB,EAsIH,CAAC,CAC7BvD,IAAK,cACLyB,MAAO,SAAqB8nB,GAC1BhoB,KAAKyY,UAAUlV,YAAYykB,GAEvBhoB,KAAK4nB,eACP5nB,KAAK4nB,cAAcI,KAQtB,CACDvpB,IAAK,qBACLyB,MAAO,SAA4BjC,GACjCmN,GAAK,8EACLpL,KAAKwmB,sBAAsBvoB,KAE5B,CACDQ,IAAK,wBACLyB,MAAO,SAA+BjC,GACpC+B,KAAK0nB,gBAAgBlB,sBAAsBvoB,KAE5C,CACDQ,IAAK,eACLyB,MAAO,SAAsBjC,EAAGwc,GAC9Bza,KAAK0nB,gBAAgBjB,aAAaxoB,EAAGwc,KAOtC,CACDhc,IAAK,cACLyB,MAAO,SAAqBgY,EAAUwL,GACpCtY,GAAK,yDACLpL,KAAKioB,SAAS/P,EAAUwL,KAEzB,CACDjlB,IAAK,WACLyB,MAAO,SAAkBgY,EAAUwL,GACjC1jB,KAAK0nB,gBAAgBO,SAAS/P,EAAUwL,MAlLoB1hB,GAAYlE,GAAkBiE,EAAYlE,UAAWmE,GAAiBC,GAAanE,GAAkBiE,EAAaE,GAAc1D,OAAOC,eAAeuD,EAAa,YAAa,CAAEzD,UAAU,IA4LrPonB,EApL0B"}
1
+ {"version":3,"file":"virtual-scroller-dom.js","sources":["../modules/utility/px.js","../modules/DOM/tbody.js","../modules/ItemNotRenderedError.js","../modules/DOM/ItemsContainer.js","../modules/ScrollableContainerNotReadyError.js","../modules/DOM/ScrollableContainer.js","../node_modules/raf/index.js","../node_modules/performance-now/lib/performance-now.js","../node_modules/request-animation-frame-timeout/modules/index.js","../modules/DOM/ListTopOffsetWatcher.js","../modules/DOM/Engine.js","../modules/utility/debug.js","../modules/Layout.js","../modules/ScrollableContainerResizeHandler.js","../modules/utility/debounce.js","../modules/BeforeResize.js","../modules/Scroll.js","../modules/ListHeightMeasurement.js","../modules/ItemHeights.js","../modules/utility/fillArray.js","../modules/utility/getStateSnapshot.js","../modules/VirtualScroller.state.js","../modules/VirtualScroller.verticalSpacing.js","../modules/getVerticalSpacing.js","../modules/VirtualScroller.columns.js","../modules/VirtualScroller.layout.js","../modules/utility/shallowEqual.js","../modules/VirtualScroller.onRender.js","../modules/VirtualScroller.onContainerResize.js","../modules/VirtualScroller.items.js","../modules/getItemsDiff.js","../modules/VirtualScroller.constructor.js","../modules/VirtualScroller.js","../modules/DOM/VirtualScroller.js"],"sourcesContent":["/**\r\n * Rounds coordinates upto 4th decimal place (after dot) and appends \"px\".\r\n * Small numbers could be printed as `\"1.2345e-50\"` unless rounded:\r\n * that would be invalid \"px\" value in CSS.\r\n * @param {number}\r\n * @return {string}\r\n */\nexport default function px(number) {\n // Fractional pixels are used on \"retina\" screens.\n return (number % 1 === 0 ? number : number.toFixed(2)) + 'px';\n}\n//# sourceMappingURL=px.js.map","// A workaround for `<tbody/>` not being able to have `padding`.\n// https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\nimport px from '../utility/px.js';\nexport var BROWSER_NOT_SUPPORTED_ERROR = 'It looks like you\\'re using Internet Explorer which doesn\\'t support CSS variables required for a <tbody/> container. VirtualScroller has been switched into \"bypass\" mode (render all items). See: https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1';\nexport function supportsTbody() {\n // Detect Internet Explorer.\n // https://stackoverflow.com/questions/19999388/check-if-user-is-using-ie\n // `documentMode` is an IE-only property.\n // Supports IE 9-11. Maybe even IE 8.\n // http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n if (typeof window !== 'undefined' && window.document.documentMode) {\n // CSS variables aren't supported in Internet Explorer.\n return false;\n }\n\n return true;\n}\nexport var TBODY_CLASS_NAME = 'VirtualScroller';\nvar STYLE_ELEMENT_ID = 'VirtualScrollerStyle';\nexport function hasTbodyStyles(tbody) {\n return tbody.classList.contains(TBODY_CLASS_NAME) && Boolean(document.getElementById(STYLE_ELEMENT_ID));\n}\nexport function addTbodyStyles(tbody) {\n // `classList.add` is supported in Internet Explorer 10+.\n tbody.classList.add(TBODY_CLASS_NAME); // Create a `<style/>` element.\n\n var style = document.createElement('style');\n style.id = STYLE_ELEMENT_ID; // CSS variables aren't supported in Internet Explorer.\n\n style.innerText = \"\\n\\t\\ttbody.\".concat(TBODY_CLASS_NAME, \":before {\\n\\t\\t\\tcontent: '';\\n\\t\\t\\tdisplay: table-row;\\n\\t\\t\\theight: var(--VirtualScroller-paddingTop);\\n\\t\\t}\\n\\t\\ttbody.\").concat(TBODY_CLASS_NAME, \":after {\\n\\t\\t\\tcontent: '';\\n\\t\\t\\tdisplay: table-row;\\n\\t\\t\\theight: var(--VirtualScroller-paddingBottom);\\n\\t\\t}\\n\\t\").replace(/[\\n\\t]/g, '');\n document.head.appendChild(style);\n}\nexport function setTbodyPadding(tbody, beforeItemsHeight, afterItemsHeight) {\n // CSS variables aren't supported in Internet Explorer.\n tbody.style.setProperty('--VirtualScroller-paddingTop', px(beforeItemsHeight));\n tbody.style.setProperty('--VirtualScroller-paddingBottom', px(afterItemsHeight));\n}\n//# sourceMappingURL=tbody.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar ItemNotRenderedError = /*#__PURE__*/function (_Error) {\n _inherits(ItemNotRenderedError, _Error);\n\n var _super = _createSuper(ItemNotRenderedError);\n\n function ItemNotRenderedError(_ref) {\n var renderedElementIndex = _ref.renderedElementIndex,\n renderedElementsCount = _ref.renderedElementsCount,\n message = _ref.message;\n\n _classCallCheck(this, ItemNotRenderedError);\n\n return _super.call(this, message || getDefaultMessage({\n renderedElementIndex: renderedElementIndex,\n renderedElementsCount: renderedElementsCount\n }));\n }\n\n return _createClass(ItemNotRenderedError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexport { ItemNotRenderedError as default };\n\nfunction getDefaultMessage(_ref2) {\n var renderedElementIndex = _ref2.renderedElementIndex,\n renderedElementsCount = _ref2.renderedElementsCount;\n return \"Element with index \".concat(renderedElementIndex, \" was not found in the list of Rendered Item Elements in the Items Container of Virtual Scroller. There're only \").concat(renderedElementsCount, \" Elements there.\");\n}\n//# sourceMappingURL=ItemNotRenderedError.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport ItemNotRenderedError from '../ItemNotRenderedError.js';\n\nvar ItemsContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"container\" from an element.\r\n * @param {function} getElement\r\n */\n function ItemsContainer(getElement) {\n _classCallCheck(this, ItemsContainer);\n\n this.getElement = getElement;\n }\n\n _createClass(ItemsContainer, [{\n key: \"_getNthRenderedItemElement\",\n value: function _getNthRenderedItemElement(renderedElementIndex) {\n var childNodes = this.getElement().childNodes;\n\n if (renderedElementIndex > childNodes.length - 1) {\n // console.log('~ Items Container Contents ~')\n // console.log(this.getElement().innerHTML)\n throw new ItemNotRenderedError({\n renderedElementIndex: renderedElementIndex,\n renderedElementsCount: childNodes.length\n });\n }\n\n return childNodes[renderedElementIndex];\n }\n /**\r\n * Returns an item element's \"top offset\", relative to the items `container`'s top edge.\r\n * @param {number} renderedElementIndex — An index of an item relative to the \"first shown item index\". For example, if the list is showing items from index 8 to index 12 then `renderedElementIndex = 0` would mean the item at index `8`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getNthRenderedItemTopOffset\",\n value: function getNthRenderedItemTopOffset(renderedElementIndex) {\n return this._getNthRenderedItemElement(renderedElementIndex).getBoundingClientRect().top - this.getElement().getBoundingClientRect().top;\n }\n /**\r\n * Returns an item element's height.\r\n * @param {number} renderedElementIndex — An index of an item relative to the \"first shown item index\". For example, if the list is showing items from index 8 to index 12 then `renderedElementIndex = 0` would mean the item at index `8`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getNthRenderedItemHeight\",\n value: function getNthRenderedItemHeight(renderedElementIndex) {\n // `offsetHeight` is not precise enough (doesn't return fractional pixels).\n // return this._getNthRenderedItemElement(renderedElementIndex).offsetHeight\n return this._getNthRenderedItemElement(renderedElementIndex).getBoundingClientRect().height;\n }\n /**\r\n * Returns items container height.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n // `offsetHeight` is not precise enough (doesn't return fractional pixels).\n // return this.getElement().offsetHeight\n return this.getElement().getBoundingClientRect().height;\n }\n /**\r\n * Removes all item elements of an items container.\r\n */\n\n }, {\n key: \"clear\",\n value: function clear() {\n while (this.getElement().firstChild) {\n this.getElement().removeChild(this.getElement().firstChild);\n }\n }\n }]);\n\n return ItemsContainer;\n}();\n\nexport { ItemsContainer as default };\n//# sourceMappingURL=ItemsContainer.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nvar ScrollableContainerNotReadyError = /*#__PURE__*/function (_Error) {\n _inherits(ScrollableContainerNotReadyError, _Error);\n\n var _super = _createSuper(ScrollableContainerNotReadyError);\n\n function ScrollableContainerNotReadyError() {\n _classCallCheck(this, ScrollableContainerNotReadyError);\n\n return _super.call(this, '[virtual-scroller] Scrollable container not found');\n }\n\n return _createClass(ScrollableContainerNotReadyError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexport { ScrollableContainerNotReadyError as default };\n//# sourceMappingURL=ScrollableContainerNotReadyError.js.map","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport ScrollableContainerNotReadyError from '../ScrollableContainerNotReadyError.js';\n\nvar ScrollableContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"scrollable container\" from an element.\r\n * @param {func} getElement — Returns the scrollable container element.\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableContainer(getElement, getItemsContainerElement) {\n _classCallCheck(this, ScrollableContainer);\n\n this.getElement = getElement;\n this.getItemsContainerElement = getItemsContainerElement;\n }\n /**\r\n * Returns the current scroll position.\r\n * @return {number}\r\n */\n\n\n _createClass(ScrollableContainer, [{\n key: \"getScrollY\",\n value: function getScrollY() {\n return this.getElement().scrollTop;\n }\n /**\r\n * Scrolls to a specific position.\r\n * @param {number} scrollY\r\n */\n\n }, {\n key: \"scrollToY\",\n value: function scrollToY(scrollY) {\n // IE 11 doesn't seem to have a `.scrollTo()` method.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/10\n // https://stackoverflow.com/questions/39908825/window-scrollto-is-not-working-in-internet-explorer-11\n if (this.getElement().scrollTo) {\n this.getElement().scrollTo(0, scrollY);\n } else {\n this.getElement().scrollTop = scrollY;\n }\n }\n /**\r\n * Returns \"scrollable container\" width,\r\n * i.e. the available width for its content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getWidth\",\n value: function getWidth() {\n if (!this.getElement()) {\n throw new ScrollableContainerNotReadyError();\n }\n\n return this.getElement().offsetWidth;\n }\n /**\r\n * Returns the height of the \"scrollable container\" itself.\r\n * Not to be confused with the height of \"scrollable container\"'s content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n if (!this.getElement()) {\n throw new ScrollableContainerNotReadyError();\n } // if (!this.getElement() && !precise) {\n // \treturn getScreenHeight()\n // }\n\n\n return this.getElement().offsetHeight;\n }\n /**\r\n * Returns a \"top offset\" of an items container element\r\n * relative to the \"scrollable container\"'s top edge.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getItemsContainerTopOffset\",\n value: function getItemsContainerTopOffset() {\n var scrollableContainerTop = this.getElement().getBoundingClientRect().top;\n var scrollableContainerBorderTopWidth = this.getElement().clientTop;\n var itemsContainerTop = this.getItemsContainerElement().getBoundingClientRect().top;\n return itemsContainerTop - scrollableContainerTop + this.getScrollY() - scrollableContainerBorderTopWidth;\n } // isVisible() {\n // \tconst { top, bottom } = this.getElement().getBoundingClientRect()\n // \treturn bottom > 0 && top < getScreenHeight()\n // }\n\n /**\r\n * Adds a \"scroll\" event listener to the \"scrollable container\".\r\n * @param {onScrollListener} Should be called whenever the scroll position inside the \"scrollable container\" (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onScroll\",\n value: function onScroll(onScrollListener) {\n var element = this.getElement();\n element.addEventListener('scroll', onScrollListener);\n return function () {\n return element.removeEventListener('scroll', onScrollListener);\n };\n }\n /**\r\n * Adds a \"resize\" event listener to the \"scrollable container\".\r\n * @param {onResize} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onResize\",\n value: function onResize(_onResize) {\n // Watches \"scrollable container\"'s dimensions via a `ResizeObserver`.\n // https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver\n // https://web.dev/resize-observer/\n var unobserve;\n\n if (typeof ResizeObserver !== 'undefined') {\n var resizeObserver = new ResizeObserver(function (entries) {\n // \"one entry per observed element\".\n // https://web.dev/resize-observer/\n // `entry.target === this.getElement()`.\n var entry = entries[0]; // // If `entry.contentBoxSize` property is supported by the web browser.\n // if (entry.contentBoxSize) {\n // \t// https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentBoxSize\n // \tconst width = entry.contentBoxSize.inlineSize\n // \tconst height = entry.contentBoxSize.blockSize\n // }\n\n _onResize();\n });\n var element = this.getElement();\n resizeObserver.observe(element);\n\n unobserve = function unobserve() {\n return resizeObserver.unobserve(element);\n };\n } // I guess, if window is resized, `onResize()` will be triggered twice:\n // once for window resize, and once for the scrollable container resize.\n // But `onResize()` also has an internal check: if the container size\n // hasn't changed since the previous time `onResize()` has been called,\n // then `onResize()` doesn't do anything, so, I guess, there shouldn't be\n // any \"performance implications\" of running the listener twice in such case.\n\n\n var unlistenGlobalResize = addGlobalResizeListener(_onResize, {\n itemsContainerElement: this.getItemsContainerElement()\n });\n return function () {\n if (unobserve) {\n unobserve();\n }\n\n unlistenGlobalResize();\n };\n }\n }]);\n\n return ScrollableContainer;\n}();\n\nexport { ScrollableContainer as default };\nexport var ScrollableWindowContainer = /*#__PURE__*/function (_ScrollableContainer) {\n _inherits(ScrollableWindowContainer, _ScrollableContainer);\n\n var _super = _createSuper(ScrollableWindowContainer);\n\n /**\r\n * Constructs a new window \"scrollable container\".\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableWindowContainer(getItemsContainerElement) {\n _classCallCheck(this, ScrollableWindowContainer);\n\n return _super.call(this, function () {\n return window;\n }, getItemsContainerElement);\n }\n /**\r\n * Returns the current scroll position.\r\n * @return {number}\r\n */\n\n\n _createClass(ScrollableWindowContainer, [{\n key: \"getScrollY\",\n value: function getScrollY() {\n // `window.scrollY` is not supported by Internet Explorer.\n return window.pageYOffset;\n }\n /**\r\n * Returns \"scrollable container\" width,\r\n * i.e. the available width for its content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getWidth\",\n value: function getWidth() {\n // https://javascript.info/size-and-scroll-window\n // `<!DOCTYPE html>` may be required in order for this to work correctly.\n // Includes scrollbar (if any).\n // Correctly reflects page zoom in iOS Safari.\n // (scales screen width accordingly).\n // But, includes scrollbar (if any).\n return window.innerWidth;\n }\n /**\r\n * Returns the height of the \"scrollable container\" itself.\r\n * Not to be confused with the height of \"scrollable container\"'s content.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getHeight\",\n value: function getHeight() {\n // https://javascript.info/size-and-scroll-window\n // `<!DOCTYPE html>` is required in order for this to work correctly.\n // Without it, the returned height would be the height of the entire document.\n // Includes scrollbar (if any).\n // Supports iOS Safari's dynamically shown/hidden\n // top URL bar and bottom actions bar.\n // https://codesandbox.io/s/elegant-fog-iddrh\n // Tested in IE 11.\n // It also correctly reflects page zoom in iOS Safari.\n // (scales screen height accordingly).\n // But, includes scrollbar (if any).\n return window.innerHeight;\n }\n /**\r\n * Returns a \"top offset\" of an items container element\r\n * relative to the \"scrollable container\"'s top edge.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getItemsContainerTopOffset\",\n value: function getItemsContainerTopOffset() {\n var borderTopWidth = document.clientTop || document.body.clientTop || 0;\n return this.getItemsContainerElement().getBoundingClientRect().top + this.getScrollY() - borderTopWidth;\n }\n /**\r\n * Adds a \"resize\" event listener to the \"scrollable container\".\r\n * @param {onScroll} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\n }, {\n key: \"onResize\",\n value: function onResize(_onResize2) {\n return addGlobalResizeListener(_onResize2, {\n itemsContainerElement: this.getItemsContainerElement()\n });\n } // isVisible() {\n // \treturn true\n // }\n\n }]);\n\n return ScrollableWindowContainer;\n}(ScrollableContainer);\n/**\r\n * Adds a \"resize\" event listener to the `window`.\r\n * @param {onResize} Should be called whenever the \"scrollable container\"'s width or height (potentially) changes.\r\n * @param {Element} options.itemsContainerElement — The items \"container\" element, which is not the same as the \"scrollable container\" element. For example, \"scrollable container\" could be resized while the list element retaining its size. One such example is a user entering fullscreen mode on an HTML5 `<video/>` element: in that case, a \"resize\" event is triggered on a window, and window dimensions change to the user's screen size, but such \"resize\" event can be ignored because the list isn't visible until the user exits fullscreen mode.\r\n * @return {function} Returns a function that stops listening.\r\n */\n\nfunction addGlobalResizeListener(onResize, _ref) {\n var itemsContainerElement = _ref.itemsContainerElement;\n\n var onResizeListener = function onResizeListener() {\n // By default, `VirtualScroller` always performs a re-layout\n // on window `resize` event. But browsers (Chrome, Firefox)\n // [trigger](https://developer.mozilla.org/en-US/docs/Web/API/Window/fullScreen#Notes)\n // window `resize` event also when a user switches into fullscreen mode:\n // for example, when a user is watching a video and double-clicks on it\n // to maximize it. And also when the user goes out of the fullscreen mode.\n // Each such fullscreen mode entering/exiting will trigger window `resize`\n // event that will it turn trigger a re-layout of `VirtualScroller`,\n // resulting in bad user experience. To prevent that, such cases are filtered out.\n // Some other workaround:\n // https://stackoverflow.com/questions/23770449/embedded-youtube-video-fullscreen-or-causing-resize\n if (document.fullscreenElement) {\n // If the fullscreened element doesn't contain the list\n // (and is not the list itself), then the layout hasn't been affected,\n // so don't perform a re-layout.\n //\n // For example, suppose there's a list of items, and some item contains a video.\n // If, upon clicking such video, it plays inline, and the user enters\n // fullscreen mode while playing such inline video, then the layout won't be\n // affected, and so such `resize` event should be ignored: when\n // `document.fullscreenElement` is in a separate \"branch\" relative to the\n // `container`.\n //\n // Another scenario: suppose that upon click, the video doesn't play inline,\n // but instead a \"Slideshow\" component is open, with the video shown at the\n // center of the screen in an overlay. If then the user enters fullscreen mode,\n // the layout wouldn't be affected too, so such `resize` event should also be\n // ignored: when `document.fullscreenElement` is inside the `container`.\n //\n if (document.fullscreenElement.contains(itemsContainerElement)) {// The element is either the `container`'s ancestor,\n // Or is the `container` itself.\n // (`a.contains(b)` includes the `a === b` case).\n // So the `resize` event will affect the `container`'s dimensions.\n } else {\n // The element is either inside the `container`,\n // Or is in a separate tree.\n // So the `resize` event won't affect the `container`'s dimensions.\n return;\n }\n }\n\n onResize();\n };\n\n window.addEventListener('resize', onResizeListener);\n return function () {\n return window.removeEventListener('resize', onResizeListener);\n };\n}\n//# sourceMappingURL=ScrollableContainer.js.map","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","import requestAnimationFrame from 'raf';\nvar cancelAnimationFrame = requestAnimationFrame.cancel;\nexport function setTimeout(callback, delay) {\n var startedAt = Date.now();\n var animationFrame = requestAnimationFrame(tick);\n\n function tick() {\n if (Date.now() - startedAt >= delay) {\n callback();\n } else {\n animationFrame = requestAnimationFrame(tick);\n }\n }\n\n return {\n clear: function clear() {\n return cancelAnimationFrame(animationFrame);\n }\n };\n}\nexport function clearTimeout(timeout) {\n if (timeout) {\n timeout.clear();\n }\n}\n//# sourceMappingURL=index.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'; // Refreshing two times every seconds seems reasonable.\n\nvar WATCH_LIST_TOP_OFFSET_INTERVAL = 500; // Refreshing for 3 seconds after the initial page load seems reasonable.\n\nvar WATCH_LIST_TOP_OFFSET_MAX_DURATION = 3000; // `VirtualScroller` calls `this.layout.layOut()` on mount,\n// but if the page styles are applied after `VirtualScroller` mounts\n// (for example, if styles are applied via javascript, like Webpack does)\n// then the list might not render correctly and it will only show the first item.\n// The reason is that in that case calling `.getListTopOffset()` on mount\n// returns \"incorrect\" `top` position because the styles haven't been applied yet.\n//\n// For example, consider a page:\n//\n// <div class=\"page\">\n// <nav class=\"sidebar\">...</nav>\n// <main>...</main>\n// </div>\n//\n// The sidebar is styled as `position: fixed`, but, until\n// the page styles have been applied, it's gonna be a regular `<div/>`\n// meaning that `<main/>` will be rendered below the sidebar\n// and will appear offscreen, and so it will only render the first item.\n//\n// Then, the page styles are loaded and applied, and the sidebar\n// is now `position: fixed`, so `<main/>` is now rendered at the top of the page,\n// but `VirtualScroller`'s `.render()` has already been called\n// and it won't re-render until the user scrolls or the window is resized.\n//\n// This type of a bug doesn't seem to occur in production, but it can appear\n// in development mode when using Webpack. The workaround `VirtualScroller`\n// implements for such cases is calling `.getListTopOffset()`\n// on the list container DOM element periodically (every second) to check\n// if the `top` coordinate has changed as a result of CSS being applied:\n// if it has then it recalculates the shown item indexes.\n//\n// Maybe this bug could occur in production when using Webpack chunks.\n// That depends on how a style of a chunk is added to the page:\n// if it's added via `javascript` after the page has been rendered\n// then this workaround will also work for that case.\n//\n// Another example would be a page having a really tall expanded \"accordion\"\n// section, below which a `VirtualScroller` list resides. If the user un-expands\n// such expanded \"accordion\" section, the list would become visible but\n// it wouldn't get re-rendered because no `scroll` event has occured,\n// and the list only re-renders automatically on `scroll` events.\n// To work around such cases, call `virtualScroller.updateLayout()` method manually.\n// The workaround below could be extended to refresh the list's top coordinate\n// indefinitely and at higher intervals, but why waste CPU time on that.\n// There doesn't seem to be any DOM API for tracking an element's top position.\n// There is `IntersectionObserver` API but it doesn't exactly do that.\n//\n\nvar ListTopOffsetWatcher = /*#__PURE__*/function () {\n function ListTopOffsetWatcher(_ref) {\n var getListTopOffset = _ref.getListTopOffset,\n onListTopOffsetChange = _ref.onListTopOffsetChange;\n\n _classCallCheck(this, ListTopOffsetWatcher);\n\n this.getListTopOffset = getListTopOffset;\n this.onListTopOffsetChange = onListTopOffsetChange;\n }\n\n _createClass(ListTopOffsetWatcher, [{\n key: \"onListTopOffset\",\n value: function onListTopOffset(listTopOffset) {\n if (this.listTopOffsetInsideScrollableContainer === undefined) {\n // Start periodical checks of the list's top offset\n // in order to perform a re-layout in case it changes.\n // See the comments in `ListTopOffsetWatcher.js` file\n // on why can the list's top offset change, and in which circumstances.\n this.start();\n }\n\n this.listTopOffsetInsideScrollableContainer = listTopOffset;\n }\n }, {\n key: \"start\",\n value: function start() {\n this._isActive = true;\n this.watchListTopOffset();\n }\n }, {\n key: \"isStarted\",\n value: function isStarted() {\n return this._isActive;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this._isActive = false;\n\n if (this.watchListTopOffsetTimer) {\n clearTimeout(this.watchListTopOffsetTimer);\n this.watchListTopOffsetTimer = undefined;\n }\n }\n }, {\n key: \"watchListTopOffset\",\n value: function watchListTopOffset() {\n var _this = this;\n\n var startedAt = Date.now();\n\n var check = function check() {\n // If `VirtualScroller` has been unmounted\n // while `setTimeout()` was waiting, then exit.\n if (!_this._isActive) {\n return;\n } // Skip comparing `top` coordinate of the list\n // when this function is called for the first time.\n\n\n if (_this.listTopOffsetInsideScrollableContainer !== undefined) {\n // Calling `this.getListTopOffset()` on an element\n // runs about 0.003 milliseconds on a modern desktop CPU,\n // so I guess it's fine calling it twice a second.\n if (_this.getListTopOffset() !== _this.listTopOffsetInsideScrollableContainer) {\n _this.onListTopOffsetChange();\n }\n } // Compare `top` coordinate of the list twice a second\n // to find out if it has changed as a result of loading CSS styles.\n // The total duration of 3 seconds would be enough for any styles to load, I guess.\n // There could be other cases changing the `top` coordinate\n // of the list (like collapsing an \"accordeon\" panel above the list\n // without scrolling the page), but those cases should be handled\n // by manually calling `.updateLayout()` instance method on `VirtualScroller` instance.\n\n\n if (Date.now() - startedAt < WATCH_LIST_TOP_OFFSET_MAX_DURATION) {\n _this.watchListTopOffsetTimer = setTimeout(check, WATCH_LIST_TOP_OFFSET_INTERVAL);\n }\n }; // Run the cycle.\n\n\n check();\n }\n }]);\n\n return ListTopOffsetWatcher;\n}();\n\nexport { ListTopOffsetWatcher as default };\n//# sourceMappingURL=ListTopOffsetWatcher.js.map","import ItemsContainer from './ItemsContainer.js';\nimport ScrollableContainer, { ScrollableWindowContainer } from './ScrollableContainer.js';\nimport ListTopOffsetWatcher from './ListTopOffsetWatcher.js';\nexport default {\n createItemsContainer: function createItemsContainer(getItemsContainerElement) {\n return new ItemsContainer(getItemsContainerElement);\n },\n // Creates a `scrollableContainer`.\n // On client side, `scrollableContainer` is always created.\n // On server side, `scrollableContainer` is not created (and not used).\n createScrollableContainer: function createScrollableContainer(getScrollableContainerElement, getItemsContainerElement) {\n if (getScrollableContainerElement) {\n return new ScrollableContainer(getScrollableContainerElement, getItemsContainerElement);\n } else if (typeof window !== 'undefined') {\n return new ScrollableWindowContainer(getItemsContainerElement);\n }\n },\n watchListTopOffset: function watchListTopOffset(_ref) {\n var getListTopOffset = _ref.getListTopOffset,\n onListTopOffsetChange = _ref.onListTopOffsetChange;\n return new ListTopOffsetWatcher({\n getListTopOffset: getListTopOffset,\n onListTopOffsetChange: onListTopOffsetChange\n });\n }\n};\n//# sourceMappingURL=Engine.js.map","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nexport default function log() {\n if (isDebug()) {\n var _console;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n (_console = console).log.apply(_console, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n }\n}\nexport function warn() {\n if (isWarn()) {\n var _console2;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n if (warningsAreErrors()) {\n return reportError.apply(this, args);\n }\n\n (_console2 = console).warn.apply(_console2, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n }\n}\n\nfunction error() {\n var _console3;\n\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n (_console3 = console).error.apply(_console3, _toConsumableArray(['[virtual-scroller]'].concat(args)));\n}\n\nexport function reportError() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n var createError = function createError() {\n return new Error(['[virtual-scroller]'].concat(args).join(' '));\n };\n\n if (typeof window !== 'undefined') {\n // In a web browser.\n // Output a debug message immediately so that it's known\n // at which point did the error occur between other debug logs.\n error.apply(this, ['ERROR'].concat(args));\n setTimeout(function () {\n // Throw an error in a timeout so that it doesn't interrupt the application's flow.\n // At the same time, by throwing a client-side error, such error could be spotted\n // in some error monitoring software like `sentry.io`, while also being visible\n // in the console.\n // The `.join(' ')` part doesn't support stringifying JSON objects,\n // but those don't seem to be used in any of the error messages.\n throw createError();\n }, 0);\n } else {\n // In Node.js.\n // If tests are being run, throw in case of any errors.\n var catchError = getGlobalVariable('VirtualScrollerCatchError');\n\n if (catchError) {\n return catchError(createError());\n }\n\n if (getGlobalVariable('VirtualScrollerThrowErrors')) {\n throw createError();\n } // Print the error in the console.\n\n\n error.apply(this, ['ERROR'].concat(args));\n }\n}\nexport function isDebug() {\n var debug = getDebug();\n\n if (debug !== undefined) {\n return debug === true || debug === 'debug';\n }\n}\nexport function isWarn() {\n // const debug = getDebug()\n // return debug === undefined\n // \t|| debug === true\n // \t|| debug === 'debug'\n // \t|| debug === 'warn'\n //\n return true;\n}\n\nfunction getDebug() {\n return getGlobalVariable('VirtualScrollerDebug');\n}\n\nfunction warningsAreErrors() {\n return getGlobalVariable('VirtualScrollerWarningsAreErrors');\n}\n\nfunction getGlobalVariable(name) {\n if (typeof window !== 'undefined') {\n return window[name];\n } else if (typeof global !== 'undefined') {\n return global[name];\n }\n}\n//# sourceMappingURL=debug.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log, { warn } from './utility/debug.js';\nimport ScrollableContainerNotReadyError from './ScrollableContainerNotReadyError.js';\n\nvar Layout = /*#__PURE__*/function () {\n function Layout(_ref) {\n var bypass = _ref.bypass,\n getInitialEstimatedItemHeight = _ref.getInitialEstimatedItemHeight,\n getInitialEstimatedVisibleItemRowsCount = _ref.getInitialEstimatedVisibleItemRowsCount,\n measureItemsBatchSize = _ref.measureItemsBatchSize,\n getPrerenderMargin = _ref.getPrerenderMargin,\n getVerticalSpacing = _ref.getVerticalSpacing,\n getVerticalSpacingBeforeResize = _ref.getVerticalSpacingBeforeResize,\n getColumnsCount = _ref.getColumnsCount,\n getColumnsCountBeforeResize = _ref.getColumnsCountBeforeResize,\n getItemHeight = _ref.getItemHeight,\n getItemHeightBeforeResize = _ref.getItemHeightBeforeResize,\n getBeforeResizeItemsCount = _ref.getBeforeResizeItemsCount,\n getAverageItemHeight = _ref.getAverageItemHeight,\n getMaxVisibleAreaHeight = _ref.getMaxVisibleAreaHeight,\n getPreviouslyCalculatedLayout = _ref.getPreviouslyCalculatedLayout;\n\n _classCallCheck(this, Layout);\n\n this.bypass = bypass;\n this.getInitialEstimatedItemHeight = getInitialEstimatedItemHeight;\n this.getInitialEstimatedVisibleItemRowsCount = getInitialEstimatedVisibleItemRowsCount;\n this.measureItemsBatchSize = measureItemsBatchSize;\n this.getPrerenderMargin = getPrerenderMargin;\n this.getVerticalSpacing = getVerticalSpacing;\n this.getVerticalSpacingBeforeResize = getVerticalSpacingBeforeResize;\n this.getColumnsCount = getColumnsCount;\n this.getColumnsCountBeforeResize = getColumnsCountBeforeResize;\n this.getItemHeight = getItemHeight;\n this.getItemHeightBeforeResize = getItemHeightBeforeResize;\n this.getBeforeResizeItemsCount = getBeforeResizeItemsCount;\n this.getAverageItemHeight = getAverageItemHeight;\n this.getMaxVisibleAreaHeight = getMaxVisibleAreaHeight; //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n\n this.getPreviouslyCalculatedLayout = getPreviouslyCalculatedLayout;\n } // React `<VirtualScroller/>` component attempts to create the initial state\n // before the component tree has mounted. This could result in an inability to\n // calculate some initial layout values like `columnsCount` or `lastShownItemIndex`.\n // Such errors aren't considered critical because layout will be re-calculated\n // after the component mounts. The workaround is to use some sane default values\n // until the scrollable container has mounted.\n\n\n _createClass(Layout, [{\n key: \"getInitialLayoutValueWithFallback\",\n value: function getInitialLayoutValueWithFallback(name, getValue, defaultValue) {\n try {\n return getValue();\n } catch (error) {\n if (error instanceof ScrollableContainerNotReadyError) {\n log(\"Scrollable container size is not known at this point, so \\\"\".concat(name, \"\\\" can't be calculated yet. Default to\"), defaultValue);\n return defaultValue;\n } else {\n throw error;\n }\n }\n }\n }, {\n key: \"getInitialLayoutValues\",\n value: function getInitialLayoutValues(_ref2) {\n var _this = this;\n\n var itemsCount = _ref2.itemsCount,\n columnsCount = _ref2.columnsCount,\n beforeStart = _ref2.beforeStart;\n var firstShownItemIndex;\n var lastShownItemIndex; // If there're no items then `firstShownItemIndex` stays `undefined`.\n\n if (itemsCount > 0) {\n var getLastShownItemIndex = function getLastShownItemIndex() {\n return _this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n });\n };\n\n firstShownItemIndex = 0;\n lastShownItemIndex = beforeStart ? this.getInitialLayoutValueWithFallback('lastShownItemIndex', getLastShownItemIndex, 0) : getLastShownItemIndex();\n }\n\n return {\n beforeItemsHeight: 0,\n afterItemsHeight: 0,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n }, {\n key: \"getInitialLastShownItemIndex\",\n value: function getInitialLastShownItemIndex(_ref3) {\n var itemsCount = _ref3.itemsCount,\n columnsCount = _ref3.columnsCount,\n firstShownItemIndex = _ref3.firstShownItemIndex;\n\n if (this.bypass) {\n return itemsCount - 1;\n } // On server side, at initialization time,\n // `scrollableContainer` is `undefined`,\n // so default to `1` estimated rows count.\n\n\n var estimatedRowsCount = 1;\n\n if (this.getMaxVisibleAreaHeight()) {\n estimatedRowsCount = this.getEstimatedRowsCountForHeight(this.getMaxVisibleAreaHeight() + this.getPrerenderMargin());\n } else if (this.getInitialEstimatedVisibleItemRowsCount) {\n estimatedRowsCount = this.getInitialEstimatedVisibleItemRowsCount();\n\n if (isNaN(estimatedRowsCount)) {\n throw new Error('[virtual-scroller] `getEstimatedVisibleItemRowsCount()` must return a number');\n }\n }\n\n return Math.min(firstShownItemIndex + (estimatedRowsCount * columnsCount - 1), itemsCount - 1);\n }\n }, {\n key: \"getEstimatedRowsCountForHeight\",\n value: function getEstimatedRowsCountForHeight(height) {\n var estimatedItemHeight = this.getEstimatedItemHeight();\n var verticalSpacing = this.getVerticalSpacing();\n\n if (estimatedItemHeight) {\n return Math.ceil((height + verticalSpacing) / (estimatedItemHeight + verticalSpacing));\n } else {\n // If no items have been rendered yet, and no `estimatedItemHeight` option\n // has been passed, then default to `1` estimated rows count in any `height`.\n return 1;\n }\n }\n /**\r\n * Returns estimated list item height.\r\n * (depends on which items have been previously rendered and measured).\r\n * @return {number}\r\n */\n\n }, {\n key: \"getEstimatedItemHeight\",\n value: function getEstimatedItemHeight() {\n var averageItemHeight = this.getAverageItemHeight();\n\n if (averageItemHeight) {\n return averageItemHeight;\n }\n\n if (this.getInitialEstimatedItemHeight) {\n var estimatedItemHeight = this.getInitialEstimatedItemHeight();\n\n if (isNaN(estimatedItemHeight)) {\n throw new Error('[virtual-scroller] `getInitialEstimatedItemHeight()` must return a number');\n }\n\n return estimatedItemHeight;\n }\n\n return 0;\n }\n }, {\n key: \"getLayoutUpdateForItemsDiff\",\n value: function getLayoutUpdateForItemsDiff(_ref4, _ref5, _ref6) {\n var firstShownItemIndex = _ref4.firstShownItemIndex,\n lastShownItemIndex = _ref4.lastShownItemIndex,\n beforeItemsHeight = _ref4.beforeItemsHeight,\n afterItemsHeight = _ref4.afterItemsHeight;\n var prependedItemsCount = _ref5.prependedItemsCount,\n appendedItemsCount = _ref5.appendedItemsCount;\n var itemsCount = _ref6.itemsCount,\n columnsCount = _ref6.columnsCount,\n shouldRestoreScrollPosition = _ref6.shouldRestoreScrollPosition,\n onResetGridLayout = _ref6.onResetGridLayout;\n // const layoutUpdate = {}\n // If the layout stays the same, then simply increase\n // the top and bottom margins proportionally to the amount\n // of the items added.\n var averageItemHeight = this.getAverageItemHeight();\n var verticalSpacing = this.getVerticalSpacing();\n\n if (appendedItemsCount > 0) {\n var appendedRowsCount = Math.ceil(appendedItemsCount / columnsCount);\n var addedHeightAfter = appendedRowsCount * (verticalSpacing + averageItemHeight);\n afterItemsHeight += addedHeightAfter; // layoutUpdate = {\n // \t...layoutUpdate,\n // \tafterItemsHeight\n // }\n }\n\n if (prependedItemsCount > 0) {\n var prependedRowsCount = Math.ceil(prependedItemsCount / columnsCount);\n var addedHeightBefore = prependedRowsCount * (averageItemHeight + verticalSpacing);\n firstShownItemIndex += prependedItemsCount;\n lastShownItemIndex += prependedItemsCount;\n beforeItemsHeight += addedHeightBefore; // If the currently shown items position on screen should be preserved\n // when prepending new items, then it means that:\n // * The current scroll position should be snapshotted.\n // * The current list height should be snapshotted.\n // * All prepended items should be shown so that their height could be\n // measured after they're rendered. Based on the prepended items' height,\n // the scroll position will be restored so that there's no \"jump of content\".\n\n if (shouldRestoreScrollPosition) {\n firstShownItemIndex = 0;\n beforeItemsHeight = 0;\n }\n\n if (prependedItemsCount % columnsCount > 0) {\n // Rows will be rebalanced as a result of prepending new items,\n // and row heights can change as a result, so re-layout items\n // after they've been measured (after the upcoming re-render).\n //\n // For example, consider a web page where item rows are `display: flex`.\n // Suppose there're 3 columns and it shows items from 4 to 6.\n //\n // ------------------------------------------\n // | Apples are | Bananas | Cranberries |\n // | green | | |\n // ------------------------------------------\n // | Dates | Elderberry | Figs are |\n // | | | tasty |\n // ------------------------------------------\n //\n // Now, 1 item gets prepended. As a result, all existing rows will have\n // a different set of items, which means that the row heights will change.\n //\n // ------------------------------------------\n // | Zucchini | Apples are | Bananas |\n // | | green | |\n // ------------------------------------------\n // | Cranberries | Dates | Elderberry |\n // ------------------------------------------\n // | Figs |\n // | are tasty |\n // ---------------\n //\n // As it can be seen above, the second row's height has changed from 2 to 1.\n // Not only that, but `itemHeights` have changed as well, so if you thought\n // that the library could easily recalculate row heights using `Math.max()` — \n // turns out it's not always the case.\n //\n // There could be an explicit opt-in option for automatically recalculating\n // row heights, but I don't want to write code for such an extremely rare\n // use case. Instead, use the `getColumnsCount()` parameter function when\n // fetching previous items.\n onResetGridLayout();\n warn('~ Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', columnsCount, '~');\n warn('Layout reset required');\n var shownItemsCountBeforeItemsUpdate = lastShownItemIndex - firstShownItemIndex + 1;\n firstShownItemIndex = 0;\n beforeItemsHeight = 0;\n\n if (!shouldRestoreScrollPosition) {\n // Limit shown items count if too many items have been prepended.\n if (prependedItemsCount > shownItemsCountBeforeItemsUpdate) {\n lastShownItemIndex = this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n }); // Approximate `afterItemsHeight` calculation.\n\n var afterItemsCount = itemsCount - (lastShownItemIndex + 1);\n afterItemsHeight = Math.ceil(afterItemsCount / columnsCount) * (verticalSpacing + averageItemHeight); // layoutUpdate = {\n // \t...layoutUpdate,\n // \tafterItemsHeight\n // }\n }\n }\n } // layoutUpdate = {\n // \t...layoutUpdate,\n // \tbeforeItemsHeight,\n // \tfirstShownItemIndex,\n // \tlastShownItemIndex\n // }\n\n } // return layoutUpdate\n // Overwrite all four props in all scenarios.\n // The reason is that only this way subsequent `setItems()` calls\n // will be truly \"stateless\" when a chain of `setItems()` calls\n // could be replaced with just the last one in a scenario when\n // `updateState()` calls are \"asynchronous\" (delayed execution).\n //\n // So, for example, the user calls `setItems()` with one set of items.\n // A `updateState()` call has been dispatched but the `state` hasn't been updated yet.\n // Then the user calls `setItems()` with another set of items.\n // If this function only returned a minimal set of properties that actually change,\n // the other layout properties of the second `setItems()` call wouldn't overwrite the ones\n // scheduled for update during the first `setItems()` call, resulting in an inconsistent `state`.\n //\n // For example, the first `setItems()` call does a `updateState()` call where it updates\n // `afterItemsHeight`, and then the second `setItems()` call only updates `beforeItemsHeight`\n // and `firstShownItemIndex` and `lastShownItemIndex`. If the second `setItems()` call was to\n // overwrite any effects of the pending-but-not-yet-applied first `setItems()` call, it would\n // have to call `updateState()` with an `afterItemsHeight` property too, even though it hasn't change.\n // That would be just to revert the change to `afterItemsHeight` state property already scheduled\n // by the first `setItems()` call.\n //\n\n\n return {\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n } // If an item that hasn't been shown (and measured) yet is encountered\n // then show such item and then retry after it has been measured.\n\n }, {\n key: \"getItemNotMeasuredIndexes\",\n value: function getItemNotMeasuredIndexes(i, _ref7) {\n var itemsCount = _ref7.itemsCount,\n firstShownItemIndex = _ref7.firstShownItemIndex,\n nonMeasuredAreaHeight = _ref7.nonMeasuredAreaHeight,\n indexOfTheFirstItemInTheRow = _ref7.indexOfTheFirstItemInTheRow;\n log('Item index', i, 'height is required for calculations but hasn\\'t been measured yet. Mark the item as \"shown\", rerender the list, measure the item\\'s height and redo the layout.');\n var columnsCount = this.getColumnsCount();\n var itemsCountToRenderForMeasurement = Math.min(this.getEstimatedRowsCountForHeight(nonMeasuredAreaHeight) * columnsCount, this.measureItemsBatchSize || Infinity);\n\n if (firstShownItemIndex === undefined) {\n firstShownItemIndex = indexOfTheFirstItemInTheRow;\n }\n\n var lastShownItemIndex = Math.min(indexOfTheFirstItemInTheRow + itemsCountToRenderForMeasurement - 1, // Guard against index overflow.\n itemsCount - 1);\n return {\n firstNonMeasuredItemIndex: i,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n /**\r\n * Finds the indexes of the currently visible items.\r\n * @return {object} `{ firstShownItemIndex: number, lastShownItemIndex: number, firstNonMeasuredItemIndex: number? }`\r\n */\n\n }, {\n key: \"getShownItemIndexes\",\n value: function getShownItemIndexes(_ref8) {\n var itemsCount = _ref8.itemsCount,\n visibleAreaInsideTheList = _ref8.visibleAreaInsideTheList;\n\n var indexes = this._getShownItemIndex({\n itemsCount: itemsCount,\n fromIndex: 0,\n visibleAreaInsideTheList: visibleAreaInsideTheList,\n findFirstShownItemIndex: true\n });\n\n if (indexes === null) {\n return this.getNonVisibleListShownItemIndexes();\n }\n\n if (indexes.firstNonMeasuredItemIndex !== undefined) {\n return indexes;\n }\n\n var _indexes = indexes,\n firstShownItemIndex = _indexes.firstShownItemIndex,\n beforeItemsHeight = _indexes.beforeItemsHeight;\n indexes = this._getShownItemIndex({\n itemsCount: itemsCount,\n fromIndex: firstShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n visibleAreaInsideTheList: visibleAreaInsideTheList,\n findLastShownItemIndex: true\n });\n\n if (indexes === null) {\n return this.getNonVisibleListShownItemIndexes();\n }\n\n if (indexes.firstNonMeasuredItemIndex !== undefined) {\n return indexes;\n }\n\n var _indexes2 = indexes,\n lastShownItemIndex = _indexes2.lastShownItemIndex;\n return {\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex\n };\n }\n }, {\n key: \"_getShownItemIndex\",\n value: function _getShownItemIndex(parameters) {\n var beforeResize = parameters.beforeResize,\n itemsCount = parameters.itemsCount,\n visibleAreaInsideTheList = parameters.visibleAreaInsideTheList,\n findFirstShownItemIndex = parameters.findFirstShownItemIndex,\n findLastShownItemIndex = parameters.findLastShownItemIndex;\n var fromIndex = parameters.fromIndex,\n beforeItemsHeight = parameters.beforeItemsHeight; // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n //\n // If someone would attempt to use a \"previously calculated layout\" here\n // then `shownItemsHeight` would also have to be returned from this function:\n // the total height of all shown items including vertical spacing between them.\n //\n // If \"previously calculated layout\" would be used then it would first find\n // `firstShownItemIndex` and then find `lastShownItemIndex` as part of two\n // separate calls of this function, each with or without `backwards` flag,\n // depending on whether `visibleAreaInsideTheList.top` and `visibleAreaInsideTheList.top`\n // have shifted up or down.\n\n var firstShownItemIndex;\n var lastShownItemIndex; // It's not always required to pass `beforeItemsHeight` parameter:\n // when `fromIndex` is `0`, it's also assumed to be `0`.\n\n if (fromIndex === 0) {\n beforeItemsHeight = 0;\n }\n\n if (beforeItemsHeight === undefined) {\n throw new Error('[virtual-scroller] `beforeItemsHeight` not passed to `Layout.getShownItemIndexes()` when starting from index ' + fromIndex);\n } // const backwards = false\n // while (backwards ? i >= 0 : i < itemsCount) {}\n\n\n if (!beforeResize) {\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n\n if (beforeResizeItemsCount > fromIndex) {\n // First search for the item in \"before resize\" items.\n var _this$_getShownItemIn = this._getShownItemIndex(_objectSpread(_objectSpread({}, parameters), {}, {\n beforeResize: true,\n itemsCount: beforeResizeItemsCount\n })),\n notFound = _this$_getShownItemIn.notFound,\n beforeResizeItemsHeight = _this$_getShownItemIn.beforeItemsHeight,\n _firstShownItemIndex = _this$_getShownItemIn.firstShownItemIndex,\n _lastShownItemIndex = _this$_getShownItemIn.lastShownItemIndex; // If the item was not found in \"before resize\" items\n // then search in regular items skipping \"before resize\" ones.\n\n\n if (notFound) {\n beforeItemsHeight = beforeResizeItemsHeight;\n fromIndex += beforeResizeItemsCount;\n } else {\n // If the item was found in \"before resize\" items\n // then return the result.\n // Rebalance first / last shown item indexes based on\n // the current columns count, if required.\n var _columnsCount = this.getColumnsCount();\n\n return {\n firstShownItemIndex: _firstShownItemIndex === undefined ? undefined : Math.floor(_firstShownItemIndex / _columnsCount) * _columnsCount,\n lastShownItemIndex: _lastShownItemIndex === undefined ? undefined : Math.floor(_lastShownItemIndex / _columnsCount) * _columnsCount,\n beforeItemsHeight: beforeResizeItemsHeight\n };\n }\n }\n }\n\n var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();\n var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();\n var i = fromIndex;\n\n while (i < itemsCount) {\n var currentRowFirstItemIndex = i;\n var hasMoreRows = itemsCount > currentRowFirstItemIndex + columnsCount;\n var verticalSpacingAfterCurrentRow = hasMoreRows ? verticalSpacing : 0;\n var currentRowHeight = 0; // Calculate current row height.\n\n var columnIndex = 0;\n\n while (columnIndex < columnsCount && i < itemsCount) {\n var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i); // If this item hasn't been measured yet (or re-measured after a resize)\n // then mark it as the first non-measured one.\n //\n // Can't happen by definition when `beforeResize` parameter is `true`.\n //\n\n if (itemHeight === undefined) {\n return this.getItemNotMeasuredIndexes(i, {\n itemsCount: itemsCount,\n firstShownItemIndex: findLastShownItemIndex ? fromIndex : undefined,\n indexOfTheFirstItemInTheRow: currentRowFirstItemIndex,\n nonMeasuredAreaHeight: visibleAreaInsideTheList.bottom + this.getPrerenderMargin() - beforeItemsHeight\n });\n }\n\n currentRowHeight = Math.max(currentRowHeight, itemHeight);\n columnIndex++;\n i++;\n }\n\n var itemsHeightFromFirstRowToThisRow = beforeItemsHeight + currentRowHeight;\n var rowStepsIntoVisibleAreaTop = itemsHeightFromFirstRowToThisRow > visibleAreaInsideTheList.top - this.getPrerenderMargin();\n var rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder = itemsHeightFromFirstRowToThisRow + verticalSpacingAfterCurrentRow >= visibleAreaInsideTheList.bottom + this.getPrerenderMargin(); // if (backwards) {\n // \tif (findFirstShownItemIndex) {\n // \t\tif (rowStepsOutOfVisibleAreaTop) {\n // \t\t\treturn {\n // \t\t\t\tfirstShownItemIndex: currentRowFirstItemIndex + columnsCount\n // \t\t\t}\n // \t\t}\n // \t} else if (findLastShownItemIndex) {\n // \t\tif (rowStepsIntoVisibleAreaBottom) {\n // \t\t\treturn {\n // \t\t\t\tlastShownItemIndex: currentRowFirstItemIndex + columnsCount - 1\n // \t\t\t}\n // \t\t}\n // \t}\n // }\n\n if (findFirstShownItemIndex) {\n if (rowStepsIntoVisibleAreaTop) {\n // If item is the first one visible in the viewport\n // then start showing items from this row.\n return {\n firstShownItemIndex: currentRowFirstItemIndex,\n beforeItemsHeight: beforeItemsHeight\n };\n }\n } else if (findLastShownItemIndex) {\n if (rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder) {\n return {\n lastShownItemIndex: Math.min( // The index of the last item in the current row.\n currentRowFirstItemIndex + columnsCount - 1, // Guards against index overflow.\n itemsCount - 1)\n };\n }\n }\n\n beforeItemsHeight += currentRowHeight + verticalSpacingAfterCurrentRow; // if (backwards) {\n // \t// Set `i` to be the first item of the current row.\n // \ti -= columnsCount\n // \tconst prevoiusRowIsBeforeResize = i - 1 < this.getBeforeResizeItemsCount()\n // \tconst previousRowColumnsCount = prevoiusRowIsBeforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount()\n // \t// Set `i` to be the first item of the previous row.\n // \ti -= previousRowColumnsCount\n // }\n } // if (backwards) {\n // \tif (findFirstShownItemIndex) {\n // \t\twarn('The list is supposed to be visible but no visible item has been found (while traversing backwards)')\n // \t\treturn null\n // \t} else if (findLastShownItemIndex) {\n // \t\treturn {\n // \t\t\tfirstShownItemIndex: 0\n // \t\t}\n // \t}\n // }\n\n\n if (beforeResize) {\n return {\n notFound: true,\n beforeItemsHeight: beforeItemsHeight\n };\n } // This case isn't supposed to happen but it could hypothetically happen\n // because the list height is measured from the user's screen and\n // not necessarily can be trusted.\n\n\n if (findFirstShownItemIndex) {\n warn('The list is supposed to be visible but no visible item has been found');\n return null;\n } else if (findLastShownItemIndex) {\n return {\n lastShownItemIndex: itemsCount - 1\n };\n }\n }\n }, {\n key: \"getNonVisibleListShownItemIndexes\",\n value: function getNonVisibleListShownItemIndexes() {\n var layout = {\n firstShownItemIndex: 0,\n lastShownItemIndex: 0\n };\n\n if (this.getItemHeight(0) === undefined) {\n layout.firstNonMeasuredItemIndex = 0;\n }\n\n return layout;\n }\n /**\r\n * Measures \"before\" items height.\r\n * @param {number} beforeItemsCount — Basically, first shown item index.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getBeforeItemsHeight\",\n value: function getBeforeItemsHeight(beforeItemsCount) {\n var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n beforeResize = _ref9.beforeResize;\n\n // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n var beforeItemsHeight = 0;\n var i = 0;\n\n if (!beforeResize) {\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n\n if (beforeResizeItemsCount > 0) {\n // First add all \"before resize\" item heights.\n beforeItemsHeight = this.getBeforeItemsHeight( // `firstShownItemIndex` (called `beforeItemsCount`) could be greater than\n // `beforeResizeItemsCount` when the user scrolls down.\n // `firstShownItemIndex` (called `beforeItemsCount`) could be less than\n // `beforeResizeItemsCount` when the user scrolls up.\n Math.min(beforeItemsCount, beforeResizeItemsCount), {\n beforeResize: true\n });\n i = beforeResizeItemsCount;\n }\n }\n\n var columnsCount = beforeResize ? this.getColumnsCountBeforeResize() : this.getColumnsCount();\n var verticalSpacing = beforeResize ? this.getVerticalSpacingBeforeResize() : this.getVerticalSpacing();\n\n while (i < beforeItemsCount) {\n var currentRowFirstItemIndex = i;\n var rowHeight = 0;\n var columnIndex = 0; // Not checking for `itemsCount` overflow here because `i = beforeItemsCount`\n // can only start at the start of a row, meaning that when calculating\n // \"before items height\" it's not supposed to add item heights from the\n // last row of items because in that case it would have to iterate from\n // `i === beforeItemsCount` and that condition is already checked above.\n // while (i < itemsCount) {\n\n while (columnIndex < columnsCount) {\n var itemHeight = beforeResize ? this.getItemHeightBeforeResize(i) : this.getItemHeight(i);\n\n if (itemHeight === undefined) {\n // `itemHeight` can only be `undefined` when not `beforeResize`.\n // Use the current \"average item height\" as a substitute.\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n }\n\n beforeItemsHeight += rowHeight;\n beforeItemsHeight += verticalSpacing;\n }\n\n return beforeItemsHeight;\n }\n /**\r\n * Measures \"after\" items height.\r\n * @param {number} lastShownItemIndex — Last shown item index.\r\n * @param {number} itemsCount — Items count.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getAfterItemsHeight\",\n value: function getAfterItemsHeight(lastShownItemIndex, itemsCount) {\n // This function could potentially also use `this.getPreviouslyCalculatedLayout()`\n // in order to skip calculating visible item indexes from scratch\n // and instead just calculate the difference from a \"previously calculated layout\".\n //\n // I did a simple test in a web browser and found out that running the following\n // piece of code is less than 10 milliseconds:\n //\n // var startedAt = Date.now()\n // var i = 0\n // while (i < 1000000) {\n // i++\n // }\n // console.log(Date.now() - startedAt)\n //\n // Which becomes negligible in my project's use case (a couple thousands items max).\n var columnsCount = this.getColumnsCount();\n var lastShownRowIndex = Math.floor(lastShownItemIndex / columnsCount);\n var afterItemsHeight = 0;\n var i = lastShownItemIndex + 1;\n\n while (i < itemsCount) {\n var rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < columnsCount && i < itemsCount) {\n var itemHeight = this.getItemHeight(i);\n\n if (itemHeight === undefined) {\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n } // Add all \"after\" items height.\n\n\n afterItemsHeight += this.getVerticalSpacing();\n afterItemsHeight += rowHeight;\n }\n\n return afterItemsHeight;\n }\n /**\r\n * Returns the items's top offset relative to the top edge of the first item.\r\n * @param {number} i — Item index\r\n * @return {[number]} Returns `undefined` if any of the previous items haven't been rendered yet.\r\n */\n\n }, {\n key: \"getItemTopOffset\",\n value: function getItemTopOffset(i) {\n var topOffsetInsideScrollableContainer = 0;\n var beforeResizeItemsCount = this.getBeforeResizeItemsCount();\n var beforeResizeRowsCount = beforeResizeItemsCount === 0 ? 0 : Math.ceil(beforeResizeItemsCount / this.getColumnsCountBeforeResize());\n var maxBeforeResizeRowsCount = i < beforeResizeItemsCount ? Math.floor(i / this.getColumnsCountBeforeResize()) : beforeResizeRowsCount;\n var beforeResizeRowIndex = 0;\n\n while (beforeResizeRowIndex < maxBeforeResizeRowsCount) {\n var rowHeight = this.getItemHeightBeforeResize(beforeResizeRowIndex * this.getColumnsCountBeforeResize());\n topOffsetInsideScrollableContainer += rowHeight;\n topOffsetInsideScrollableContainer += this.getVerticalSpacingBeforeResize();\n beforeResizeRowIndex++;\n }\n\n var itemRowIndex = Math.floor((i - beforeResizeItemsCount) / this.getColumnsCount());\n var rowIndex = 0;\n\n while (rowIndex < itemRowIndex) {\n var _rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < this.getColumnsCount()) {\n var itemHeight = this.getItemHeight(beforeResizeItemsCount + rowIndex * this.getColumnsCount() + columnIndex);\n\n if (itemHeight === undefined) {\n return;\n }\n\n _rowHeight = Math.max(_rowHeight, itemHeight);\n columnIndex++;\n }\n\n topOffsetInsideScrollableContainer += _rowHeight;\n topOffsetInsideScrollableContainer += this.getVerticalSpacing();\n rowIndex++;\n }\n\n return topOffsetInsideScrollableContainer;\n }\n }]);\n\n return Layout;\n}();\n\nexport { Layout as default };\nexport var LAYOUT_REASON = {\n SCROLL: 'scroll',\n STOPPED_SCROLLING: 'stopped scrolling',\n MANUAL: 'manual',\n STARTED: 'started',\n NON_MEASURED_ITEMS_HAVE_BEEN_MEASURED: 'non-measured item heights have been measured',\n VIEWPORT_WIDTH_CHANGED: 'viewport width changed',\n VIEWPORT_HEIGHT_CHANGED: 'viewport height changed',\n VIEWPORT_SIZE_UNCHANGED: 'viewport size unchanged',\n ITEM_HEIGHT_CHANGED: 'item height changed',\n ITEMS_CHANGED: 'items changed',\n TOP_OFFSET_CHANGED: 'list top offset changed'\n};\n//# sourceMappingURL=Layout.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport debounce from './utility/debounce.js';\nimport log from './utility/debug.js';\n\nvar ScrollableContainerResizeHandler = /*#__PURE__*/function () {\n function ScrollableContainerResizeHandler(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n getWidth = _ref.getWidth,\n getHeight = _ref.getHeight,\n listenForResize = _ref.listenForResize,\n onResizeStart = _ref.onResizeStart,\n onResizeStop = _ref.onResizeStop,\n onHeightChange = _ref.onHeightChange,\n onWidthChange = _ref.onWidthChange,\n onNoChange = _ref.onNoChange;\n\n _classCallCheck(this, ScrollableContainerResizeHandler);\n\n _defineProperty(this, \"_onResize\", function () {\n // If `VirtualScroller` has been unmounted\n // while `debounce()`'s `setTimeout()` was waiting, then exit.\n // If the `VirtualScroller` gets restarted later, it will detect\n // that `state.scrollableContainerWidth` doesn't match the actual\n // scrollable container width, and will call `this.onResize()`.\n if (!_this.isActive) {\n return;\n }\n\n var prevScrollableContainerWidth = _this.width;\n var prevScrollableContainerHeight = _this.height;\n _this.width = _this.getWidth();\n _this.height = _this.getHeight();\n\n if (_this.width === prevScrollableContainerWidth) {\n if (_this.height === prevScrollableContainerHeight) {\n // The dimensions of the container didn't change,\n // so there's no need to re-layout anything.\n _this.onNoChange();\n } else {\n // Scrollable container height has changed,\n // so just recalculate shown item indexes.\n // No need to perform a re-layout from scratch.\n _this.onHeightChange(prevScrollableContainerHeight, _this.height);\n }\n } else {\n // Reset item heights, because if scrollable container's width (or height)\n // has changed, then the list width (or height) most likely also has changed,\n // and also some CSS `@media()` rules might have been added or removed.\n // So re-render the list entirely.\n _this.onWidthChange(prevScrollableContainerWidth, _this.width);\n }\n });\n\n this.bypass = bypass;\n this.onHeightChange = onHeightChange;\n this.onWidthChange = onWidthChange;\n this.onNoChange = onNoChange;\n this.getWidth = getWidth;\n this.getHeight = getHeight;\n this.listenForResize = listenForResize;\n this.onResize = debounce(this._onResize, SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL, {\n onStart: onResizeStart,\n onStop: onResizeStop\n });\n }\n\n _createClass(ScrollableContainerResizeHandler, [{\n key: \"start\",\n value: function start() {\n this.isActive = true;\n\n if (this.bypass) {\n return;\n }\n\n this.width = this.getWidth();\n this.height = this.getHeight();\n this.unlistenResize = this.listenForResize(this.onResize);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isActive = false;\n this.width = undefined;\n this.height = undefined;\n\n if (this.unlistenResize) {\n this.unlistenResize();\n this.unlistenResize = undefined;\n }\n }\n /**\r\n * On scrollable container resize.\r\n */\n\n }]);\n\n return ScrollableContainerResizeHandler;\n}();\n\nexport { ScrollableContainerResizeHandler as default };\nvar SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL = 250;\n//# sourceMappingURL=ScrollableContainerResizeHandler.js.map","// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\n/**\r\n * Same as `lodash`'s `debounce()` for functions with no arguments.\r\n * @param {function} func — The function.\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function} A function that returns a `Promise` which resolves when the underlying (original) function gets executed.\r\n */\n\nexport default function debounce(func, interval) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n onStart = _ref.onStart,\n onStop = _ref.onStop;\n\n var timeout;\n return function () {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return new Promise(function (resolve) {\n if (timeout) {\n clearTimeout(timeout);\n } else {\n if (onStart) {\n onStart();\n }\n }\n\n timeout = setTimeout(function () {\n timeout = undefined;\n\n if (onStop) {\n onStop();\n }\n\n func.apply(_this, args);\n resolve();\n }, interval);\n });\n };\n}\n//# sourceMappingURL=debounce.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log from './utility/debug.js';\n\nvar BeforeResize = /*#__PURE__*/function () {\n function BeforeResize(_ref) {\n var getState = _ref.getState,\n getVerticalSpacing = _ref.getVerticalSpacing,\n getColumnsCount = _ref.getColumnsCount;\n\n _classCallCheck(this, BeforeResize);\n\n this.getState = getState;\n this.getVerticalSpacing = getVerticalSpacing;\n this.getColumnsCount = getColumnsCount;\n }\n\n _createClass(BeforeResize, [{\n key: \"initializeFromState\",\n value: function initializeFromState(state) {\n this._includesBeforeResizeInState = Boolean(state.beforeResize);\n } // Cleans up \"before resize\" item heights and adjusts the scroll position accordingly.\n //\n // Hypothetically, it could also wait for the user to stop scrolling and only then\n // adjust the scroll position. The rationale is that if `window.scrollTo()` is called\n // while the user is scrolling, the user would occasionally experience \"lost\" mouse wheel\n // events when scrolling with a mouse wheel.\n //\n // Seems like Twitter's website waits for the user to stop scrolling before applying\n // the scroll position correction after a window resize. This library could do that too,\n // but that would require rewriting \"before items height\" top padding calculation\n // so that it doesn't re-calculate it on every re-render and instead does so incrementally,\n // and then, when the user stops, it re-calculates it from scratch removing the error\n // and adjusting the scroll position accordingly so that there's no \"jump of content\".\n //\n // But, seems like it works fine as it is and there's no need to rewrite anything.\n //\n\n }, {\n key: \"cleanUpBeforeResizeItemHeights\",\n value: function cleanUpBeforeResizeItemHeights() {\n var _this$getState = this.getState(),\n firstShownItemIndex = _this$getState.firstShownItemIndex,\n lastShownItemIndex = _this$getState.lastShownItemIndex,\n itemHeights = _this$getState.itemHeights,\n beforeResize = _this$getState.beforeResize; // If there're \"before resize\" properties in `state`\n // then it means that the corresponding items are waiting to be\n // re-measured after container resize. Since the resize,\n // some of those non-re-measured items might have just been measured,\n // so see if that's true, and if it is, remove those now-obsolete\n // \"before resize\" item heights and ajust the scroll position\n // so that there's no \"content jumping\".\n\n\n if (beforeResize) {\n // If the user has scrolled up to reveal a previously hidden item\n // that has not yet been re-measured after a previous resize.\n if (firstShownItemIndex < beforeResize.itemHeights.length) {\n log('~ Clean up \"before resize\" item heights and correct scroll position ~'); // Some of the \"before\" items have been un-hidden and re-measured.\n // Un-hiding those items would result in a \"jump of content\"\n // because \"before resize\" heights of those un-hidden items\n // could (and most likely will) be different from the current ones,\n // or because \"before resize\" columns count is different from\n // the current one.\n // To prevent a \"jump of content\", calculate the scroll position\n // difference and adjust the scroll position.\n // The height of the item rows that have transitioned\n // from hidden to shown.\n\n var newlyShownItemRowsHeight = 0; // Some of the `itemHeights` between the current `firstShownItemIndex` and\n // the previous `firstShownItemIndex` could stay `undefined` if the user\n // scrolled \"abruptly\": for example, by using a `window.scrollTo()` call.\n // In that case, the items below the visible ones won't be rendered and measured.\n // In such case, limit the items being iterated over to the current `lastShownItemIndex`\n // rather than the previous `firstShownItemIndex`.\n\n var prevFirstReMeasuredItemsRowIndex = Math.floor(beforeResize.itemHeights.length / this.getColumnsCount());\n var newlyShownItemsToIndex = Math.min(prevFirstReMeasuredItemsRowIndex * this.getColumnsCount() - 1, lastShownItemIndex);\n var i = firstShownItemIndex;\n\n while (i <= newlyShownItemsToIndex) {\n // Calculate newly shown row height.\n var rowHeight = 0;\n var columnIndex = 0;\n\n while (columnIndex < this.getColumnsCount() && i <= newlyShownItemsToIndex) {\n var itemHeight = itemHeights[i];\n\n if (itemHeight === undefined) {\n // `itemHeight` can only be `undefined` when not `beforeResize`.\n // Use the current \"average item height\" as a substitute.\n itemHeight = this.getAverageItemHeight();\n }\n\n rowHeight = Math.max(rowHeight, itemHeight);\n i++;\n columnIndex++;\n } // Append to the total \"newly shown item rows height\".\n\n\n newlyShownItemRowsHeight += rowHeight;\n newlyShownItemRowsHeight += this.getVerticalSpacing();\n } // The height of the \"before resize\" item rows\n // that will be \"cleaned up\" in this function call.\n\n\n var cleanedUpBeforeResizeItemRowsHeight = 0; // Some of the `beforeResize` item rows might have been skipped if the user\n // scrolled up \"abruptly\": for example, by using a `window.scrollTo()` call.\n // In that case, the \"before resize\" items below the bottom border of the screen\n // shouldn't be accounted for when calculating the scrollbar adjustment shift\n // because items after `lastShownItemIndex` aren't participating in the calculation\n // of `newlyShownItemRowsHeight`.\n\n var maxParticipatingBeforeResizeItemsCount = Math.min(beforeResize.itemHeights.length, lastShownItemIndex + 1);\n var participatingBeforeResizeItemRowsCount = Math.ceil(maxParticipatingBeforeResizeItemsCount / beforeResize.columnsCount);\n var firstCleanedUpBeforeResizeItemsRowIndex = firstShownItemIndex === 0 ? 0 : Math.floor((firstShownItemIndex - 1) / beforeResize.columnsCount) + 1;\n var k = firstCleanedUpBeforeResizeItemsRowIndex;\n\n while (k < participatingBeforeResizeItemRowsCount) {\n var _rowHeight = beforeResize.itemHeights[k * beforeResize.columnsCount];\n cleanedUpBeforeResizeItemRowsHeight += _rowHeight;\n cleanedUpBeforeResizeItemRowsHeight += beforeResize.verticalSpacing;\n k++;\n } // Schedule an asynchronous `this.updateState()` call that will update\n // `beforeResize` property of `state`. Ideally, it should be updated\n // immediately, but since `this.updateState()` calls are asynchronous,\n // the code updates just the underlying `beforeResize.itemHeights`\n // array immediately instead, which is still a hack but still a lesser one.\n\n\n if (firstShownItemIndex === 0) {\n log('Drop all \"before resize\" item heights');\n } else {\n var firstDroppedBeforeResizeItemIndex = firstShownItemIndex;\n var lastDroppedBeforeResizeItemIndex = beforeResize.itemHeights.length - 1;\n\n if (firstDroppedBeforeResizeItemIndex === lastDroppedBeforeResizeItemIndex) {\n log('For item index', firstDroppedBeforeResizeItemIndex, '— drop \"before resize\" height', beforeResize.itemHeights[firstDroppedBeforeResizeItemIndex]);\n } else {\n log('For item indexes from', firstDroppedBeforeResizeItemIndex, 'to', lastDroppedBeforeResizeItemIndex, '— drop \"before resize\" heights', beforeResize.itemHeights.slice(firstDroppedBeforeResizeItemIndex));\n }\n } // Immediately update `beforeResize.itemHeights`\n // so that the component isn't left in an inconsistent state\n // before a `this.updateState()` call below is applied.\n\n\n beforeResize.itemHeights.splice(firstShownItemIndex, beforeResize.itemHeights.length - firstShownItemIndex); // Return the \"scroll by\" amount that would correct the scroll position.\n // Also return a state update.\n\n return {\n scrollBy: newlyShownItemRowsHeight - cleanedUpBeforeResizeItemRowsHeight,\n beforeResize: firstShownItemIndex === 0 ? undefined : _objectSpread({}, beforeResize)\n };\n }\n }\n } // Snapshots \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no \"content jumping\".\n //\n // `newFirstShownItemIndex` is `> 0`.\n //\n\n }, {\n key: \"snapshotBeforeResizeItemHeights\",\n value: function snapshotBeforeResizeItemHeights(_ref2) {\n var firstShownItemIndex = _ref2.firstShownItemIndex,\n newFirstShownItemIndex = _ref2.newFirstShownItemIndex,\n newColumnsCount = _ref2.newColumnsCount;\n var columnsCount = this.getColumnsCount();\n var verticalSpacing = this.getVerticalSpacing();\n this._includesBeforeResizeInState = true;\n\n var _this$getState2 = this.getState(),\n prevBeforeResize = _this$getState2.beforeResize,\n itemHeights = _this$getState2.itemHeights;\n\n var prevBeforeResizeItemsCount = prevBeforeResize ? prevBeforeResize.itemHeights.length : 0; // If there already are \"before resize\" values in `state`\n // then it means that those should be merged with the new ones.\n //\n // `beforeResize.itemHeights` could be empty in an edge case\n // when there's a pending state update that sets `beforeResize`\n // to `undefined`, and in that case empty `beforeResize.itemHeights`\n // signals about that type of a situation.\n //\n\n if (prevBeforeResizeItemsCount > 0) {\n // Because the \"previous\" before resize values might have been captured\n // for a window width corresponding to a layout with a different columns count\n // and different vertical spacing, re-calculate those item heights as if\n // they corresponded to the current columns count and current vertical spacing,\n // since \"previous\" and \"new\" before resize item heights are gonna be merged.\n if (prevBeforeResize.columnsCount !== columnsCount || prevBeforeResize.verticalSpacing !== verticalSpacing) {\n var prevBeforeResizeBeforeItemsHeight = 0;\n var prevBeforeResizeItemRowsCount = Math.ceil(prevBeforeResizeItemsCount / prevBeforeResize.columnsCount);\n var rowIndex = 0;\n\n while (rowIndex < prevBeforeResizeItemRowsCount) {\n // Since all \"before resize\" item heights are equal within a row,\n // the height of the first \"before resize\" item in a row is that row's height.\n var rowHeight = prevBeforeResize.itemHeights[rowIndex * prevBeforeResize.columnsCount];\n prevBeforeResizeBeforeItemsHeight += rowHeight;\n prevBeforeResizeBeforeItemsHeight += prevBeforeResize.verticalSpacing;\n rowIndex++;\n }\n\n var newBeforeResizeAdditionalBeforeItemsHeight = 0;\n var i = firstShownItemIndex;\n\n while (i < newFirstShownItemIndex) {\n var _rowHeight2 = 0;\n var k = 0;\n\n while (k < columnsCount && i < newFirstShownItemIndex) {\n _rowHeight2 = Math.max(_rowHeight2, itemHeights[i]);\n k++;\n i++;\n }\n\n newBeforeResizeAdditionalBeforeItemsHeight += _rowHeight2;\n newBeforeResizeAdditionalBeforeItemsHeight += verticalSpacing;\n }\n\n var newBeforeResizeBeforeItemsHeight = prevBeforeResizeBeforeItemsHeight + newBeforeResizeAdditionalBeforeItemsHeight;\n var newBeforeResizeBeforeItemRowsCount = Math.ceil(newFirstShownItemIndex / columnsCount);\n return new Array(newFirstShownItemIndex).fill( // Re-calculate \"before resize\" item heights so that \"previous\" and \"new\" ones\n // correspond to the same (new) columns count.\n // Also don't occasionally set item heights to `< 0`.\n Math.max(0, newBeforeResizeBeforeItemsHeight / newBeforeResizeBeforeItemRowsCount - verticalSpacing));\n } else {\n // Add new item heights to the previously snapshotted ones.\n return prevBeforeResize.itemHeights.concat(equalizeItemHeights(itemHeights, newFirstShownItemIndex, columnsCount).slice(prevBeforeResize.itemHeights.length));\n }\n } else {\n return equalizeItemHeights(itemHeights, newFirstShownItemIndex, columnsCount);\n }\n }\n }, {\n key: \"shouldIncludeBeforeResizeValuesInState\",\n value: function shouldIncludeBeforeResizeValuesInState() {\n return this._includesBeforeResizeInState;\n }\n }]);\n\n return BeforeResize;\n}(); // Equalizes all item heights within a given row, for each row.\n//\n// The reason is that `beforeResize.itemHeights` is not necessarily divisible by\n// `beforeResize.columnsCount`, which would result in varying last row height\n// as items get removed from `beforeResize.itemHeights` as the user scrolls up.\n//\n// By equalizing all item heights within a given row, for each row, such \"jumping\"\n// last \"before resize\" row height is prevented when the user scrolls up.\n//\n\n\nexport { BeforeResize as default };\n\nfunction equalizeItemHeights(itemHeights, maxItemsCount, columnsCount) {\n itemHeights = itemHeights.slice(0, Math.ceil(maxItemsCount / columnsCount) * columnsCount);\n var rowIndex = 0;\n\n while (rowIndex * columnsCount < maxItemsCount) {\n // Calculate row height.\n var rowHeight = 0;\n var k = 0;\n\n while (k < columnsCount) {\n rowHeight = Math.max(rowHeight, itemHeights[rowIndex * columnsCount + k]);\n k++;\n } // Equalize all item heights within the row.\n\n\n k = 0;\n\n while (k < columnsCount) {\n itemHeights[rowIndex * columnsCount + k] = rowHeight;\n k++;\n } // Proceed with the next row.\n\n\n rowIndex++;\n }\n\n return itemHeights.slice(0, maxItemsCount);\n}\n\nexport function cleanUpBeforeResizeState(state) {\n if (state.beforeResize) {\n if (state.beforeResize.itemHeights.length === 0) {\n state.beforeResize = undefined;\n }\n }\n\n return state;\n}\n//# sourceMappingURL=BeforeResize.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\nimport log from './utility/debug.js';\n\nvar Scroll = /*#__PURE__*/function () {\n function Scroll(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n scrollableContainer = _ref.scrollableContainer,\n itemsContainer = _ref.itemsContainer,\n onScroll = _ref.onScroll,\n initialScrollPosition = _ref.initialScrollPosition,\n onScrollPositionChange = _ref.onScrollPositionChange,\n isImmediateLayoutScheduled = _ref.isImmediateLayoutScheduled,\n hasNonRenderedItemsAtTheTop = _ref.hasNonRenderedItemsAtTheTop,\n hasNonRenderedItemsAtTheBottom = _ref.hasNonRenderedItemsAtTheBottom,\n getLatestLayoutVisibleArea = _ref.getLatestLayoutVisibleArea,\n getListTopOffset = _ref.getListTopOffset,\n getPrerenderMargin = _ref.getPrerenderMargin,\n onScrolledToTop = _ref.onScrolledToTop,\n waitForScrollingToStop = _ref.waitForScrollingToStop;\n\n _classCallCheck(this, Scroll);\n\n _defineProperty(this, \"scrollByY\", function (scrollByY) {\n _this.scrollToY(_this.getScrollY() + scrollByY);\n });\n\n _defineProperty(this, \"onScrollListener\", function () {\n if (_this.onScrollPositionChange) {\n _this.onScrollPositionChange(_this.getScrollY());\n } // If the user has scrolled up to the top of the items container.\n // (this option isn't currently used)\n\n\n if (_this.onScrolledToTop) {\n if (_this.getScrollY() < _this.getListTopOffset()) {\n _this.onScrolledToTop();\n }\n }\n\n if (_this.bypass) {\n return;\n }\n\n if (_this.ignoreScrollEvents) {\n return;\n } // Prefer not performing a re-layout while the user is scrolling (if possible).\n // If the user doesn't scroll too far and then stops for a moment,\n // then a mid-scroll re-layout could be delayed until such a brief stop:\n // presumably, this results in better (smoother) scrolling performance,\n // delaying the work to when it doesn't introduce any stutter or \"jank\".\n // Reset `this.onStopScrollingTimer` (will be re-created below).\n\n\n _this.cancelOnStopScrollingTimer(); // See if the latest \"layout\" (the currently rendered set of items)\n // is still sufficient in order to show all the items that're\n // currently inside the viewport. If there're some non-rendered items\n // that're visible in the current viewport, then those items\n // should be rendered \"immediately\" rather than waiting until\n // the user stops scrolling.\n\n\n var forceUpdate = // If the items have been rendered at least once\n _this.getLatestLayoutVisibleArea() && ( // If the user has scrolled up past the \"prerender margin\"\n // and there're some non-rendered items at the top,\n // then force a re-layout.\n //\n // (during these calculations we assume that the list's top coordinate\n // hasn't changed since previous layout; even if that's not exactly true,\n // the items will be re-layout when the user stops scrolling anyway)\n //\n _this.getScrollY() < _this.getLatestLayoutVisibleArea().top - _this.getPrerenderMargin() && _this.hasNonRenderedItemsAtTheTop() || // If the user has scrolled down past the \"prerender margin\"\n // and there're any non-rendered items left at the end,\n // then force a re-layout.\n //\n // (during these calculations we assume that the list's top coordinate\n // hasn't changed since previous layout; even if that's not exactly true,\n // the items will be re-layout when the user stops scrolling anyway)\n //\n _this.getScrollY() + _this.scrollableContainer.getHeight() > _this.getLatestLayoutVisibleArea().bottom + _this.getPrerenderMargin() && _this.hasNonRenderedItemsAtTheBottom());\n\n if (forceUpdate) {\n log('The user has scrolled far enough: perform a re-layout');\n } else {\n log('The user is scrolling: perform a re-layout when they stop scrolling');\n }\n\n if (forceUpdate || _this.waitForScrollingToStop === false) {\n return _this.onScroll();\n } // If a re-layout is already scheduled at the next \"frame\",\n // don't schedule a \"re-layout when user stops scrolling\" timer.\n\n\n if (_this.isImmediateLayoutScheduled()) {\n return;\n }\n\n _this.shouldCallOnScrollListenerWhenStopsScrolling = true;\n\n _this.watchOnStopScrolling();\n });\n\n this.bypass = bypass;\n this.scrollableContainer = scrollableContainer;\n this.itemsContainer = itemsContainer;\n this.onScroll = onScroll;\n this.initialScrollPosition = initialScrollPosition;\n this.onScrollPositionChange = onScrollPositionChange;\n this.isImmediateLayoutScheduled = isImmediateLayoutScheduled;\n this.hasNonRenderedItemsAtTheTop = hasNonRenderedItemsAtTheTop;\n this.hasNonRenderedItemsAtTheBottom = hasNonRenderedItemsAtTheBottom;\n this.getLatestLayoutVisibleArea = getLatestLayoutVisibleArea;\n this.getListTopOffset = getListTopOffset;\n this.getPrerenderMargin = getPrerenderMargin;\n this.onScrolledToTop = onScrolledToTop;\n this.waitForScrollingToStop = waitForScrollingToStop;\n }\n\n _createClass(Scroll, [{\n key: \"start\",\n value: function start() {\n if (this.initialScrollPosition !== undefined) {\n this.scrollToY(this.initialScrollPosition); // Don't restore this scroll position on restart.\n\n this.initialScrollPosition = undefined;\n }\n\n if (this.onScrollPositionChange) {\n this.onScrollPositionChange(this.getScrollY());\n }\n\n this.stopListeningToScroll = this.scrollableContainer.onScroll(this.onScrollListener);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.stopListeningToScroll();\n this.stopListeningToScroll = undefined; // this.onStopScrollingListener = undefined\n\n this.shouldCallOnScrollListenerWhenStopsScrolling = undefined;\n this.cancelOnStopScrollingTimer();\n }\n }, {\n key: \"scrollToY\",\n value: function scrollToY(scrollY) {\n this.ignoreScrollEvents = true;\n this.scrollableContainer.scrollToY(scrollY);\n this.ignoreScrollEvents = undefined;\n }\n }, {\n key: \"getScrollY\",\n value: function getScrollY() {\n return this.scrollableContainer.getScrollY();\n }\n }, {\n key: \"cancelOnStopScrollingTimer\",\n value: function cancelOnStopScrollingTimer() {\n if (this.onStopScrollingTimer) {\n clearTimeout(this.onStopScrollingTimer);\n this.onStopScrollingTimer = undefined;\n }\n }\n }, {\n key: \"cancelScheduledLayout\",\n value: function cancelScheduledLayout() {\n // Cancel a \"re-layout when user stops scrolling\" timer.\n this.cancelOnStopScrollingTimer();\n }\n }, {\n key: \"watchOnStopScrolling\",\n value: function watchOnStopScrolling() {\n var _this2 = this;\n\n this.onStopScrollingTimer = setTimeout(function () {\n _this2.onStopScrollingTimer = undefined;\n\n if (_this2.shouldCallOnScrollListenerWhenStopsScrolling) {\n _this2.shouldCallOnScrollListenerWhenStopsScrolling = undefined;\n\n _this2.onScroll({\n delayed: true\n });\n } // `onStopScrolling()` feature is not currently used.\n // if (this.onStopScrollingListener) {\n // \tconst onStopScrollingListener = this.onStopScrollingListener\n // \tthis.onStopScrollingListener = undefined\n // \t// `onStopScrollingListener()` may hypothetically schedule\n // \t// another `onStopScrolling()` listener, so set\n // \t// `this.onStopScrollingListener` to `undefined` before\n // \t// calling it rather than after.\n // \tlog('~ The user has stopped scrolling ~')\n // \tonStopScrollingListener()\n // }\n\n }, // \"scroll\" events are usually dispatched every 16 milliseconds\n // for 60fps refresh rate, so waiting for 100 milliseconds feels\n // reasonable: that would be about 6 frames of inactivity period,\n // which could mean that either the user has stopped scrolling\n // (for a moment) or the browser is lagging and stuttering\n // (skipping frames due to high load).\n // If the user continues scrolling then this timeout is constantly\n // refreshed (cancelled and then re-created).\n ON_STOP_SCROLLING_INACTIVE_PERIOD);\n } // (this function isn't currently used)\n // onStopScrolling(onStopScrollingListener) {\n // \tthis.onStopScrollingListener = onStopScrollingListener\n // \tif (!this.onStopScrollingTimer) {\n // \t\tthis.watchOnStopScrolling()\n // \t}\n // }\n\n /**\r\n * Returns visible area coordinates relative to the scrollable container.\r\n * @return {object} `{ top: number, bottom: number }`\r\n */\n\n }, {\n key: \"getVisibleAreaBounds\",\n value: function getVisibleAreaBounds() {\n var scrollY = this.getScrollY();\n return {\n // The first pixel of the screen.\n top: scrollY,\n // The pixel after the last pixel of the screen.\n bottom: scrollY + this.scrollableContainer.getHeight()\n };\n }\n }]);\n\n return Scroll;\n}();\n\nexport { Scroll as default };\nvar ON_STOP_SCROLLING_INACTIVE_PERIOD = 100;\n//# sourceMappingURL=Scroll.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nvar ListHeightMeasurement = /*#__PURE__*/function () {\n function ListHeightMeasurement(_ref) {\n var itemsContainer = _ref.itemsContainer,\n getListTopOffset = _ref.getListTopOffset;\n\n _classCallCheck(this, ListHeightMeasurement);\n\n this.itemsContainer = itemsContainer;\n this.getListTopOffset = getListTopOffset;\n }\n /**\r\n * Snapshots the list height while `previousItems` are still rendered,\r\n * before rendering `newItems`. The list height will be re-measured\r\n * after the new items have been rendered, yielding the list height difference\r\n * which is gonna be the amount to scroll vertically in order to restore\r\n * the previous scroll position. Is only used when prepending items.\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @param {number} prependedItemsCount\r\n */\n\n\n _createClass(ListHeightMeasurement, [{\n key: \"snapshotListHeightBeforeAddingNewItems\",\n value: function snapshotListHeightBeforeAddingNewItems(_ref2) {\n var previousItems = _ref2.previousItems,\n newItems = _ref2.newItems,\n prependedItemsCount = _ref2.prependedItemsCount;\n\n // If there were no items in the list\n // then there's no point in restoring scroll position.\n if (previousItems.length === 0) {\n return;\n } // If no items were prepended then no need to restore scroll position.\n\n\n if (prependedItemsCount === 0) {\n return;\n } // The first item is supposed to be shown when the user clicks\n // \"Show previous items\" button. If it isn't shown though,\n // could still calculate the first item's top position using\n // the values from `itemHeights` and `verticalSpacing`.\n // But that would be a weird non-realistic scenario.\n // if (firstShownItemIndex > 0) {\n // \tlet i = firstShownItemIndex - 1\n // \twhile (i >= 0) {\n // \t\tfirstItemTopOffset += itemHeights[i] + verticalSpacing\n // \t\ti--\n // \t}\n // }\n // This part is longer relevant: <ReactVirtualScroller/> no longer calls\n // this function two times consequtively.\n //\n // // If the scroll position has already been captured for restoration,\n // // then don't capture it the second time.\n // if (this._snapshot &&\n // \tthis._snapshot.previousItems === previousItems &&\n // \tthis._snapshot.newItems === newItems) {\n // \treturn\n // }\n\n\n this._snapshot = {\n previousItems: previousItems,\n newItems: newItems,\n itemIndex: prependedItemsCount,\n itemTopOffset: this.itemsContainer.getNthRenderedItemTopOffset(0),\n // Snapshot list top offset inside the scrollable container too\n // because it's common to hide the \"Show previous items\" button\n // when the user has browsed to the top of the list, which causes\n // the list's top position to shift upwards due to the button\n // no longer being rendered. Tracking list top offset doesn't\n // fit here that well, but it makes sense in real-world applications.\n listTopOffset: this.getListTopOffset()\n };\n }\n }, {\n key: \"getAnchorItemIndex\",\n value: function getAnchorItemIndex() {\n return this._snapshot.itemIndex;\n }\n }, {\n key: \"hasSnapshot\",\n value: function hasSnapshot() {\n return this._snapshot !== undefined;\n }\n }, {\n key: \"getListBottomOffsetChange\",\n value: function getListBottomOffsetChange() {\n var _this$_snapshot = this._snapshot,\n itemIndex = _this$_snapshot.itemIndex,\n itemTopOffset = _this$_snapshot.itemTopOffset,\n listTopOffset = _this$_snapshot.listTopOffset; // `firstShownItemIndex` is supposed to be `0` at this point,\n // so `renderedElementIndex` would be the same as the `itemIndex`.\n\n var itemTopOffsetNew = this.itemsContainer.getNthRenderedItemTopOffset(itemIndex);\n var listTopOffsetNew = this.getListTopOffset();\n return itemTopOffsetNew - itemTopOffset + (listTopOffsetNew - listTopOffset);\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this._snapshot = undefined;\n }\n }]);\n\n return ListHeightMeasurement;\n}();\n\nexport { ListHeightMeasurement as default };\n//# sourceMappingURL=ListHeightMeasurement.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\n\nvar ItemHeights = /*#__PURE__*/function () {\n function ItemHeights(_ref) {\n var container = _ref.container,\n itemHeights = _ref.itemHeights,\n getItemHeight = _ref.getItemHeight,\n setItemHeight = _ref.setItemHeight;\n\n _classCallCheck(this, ItemHeights);\n\n this.container = container;\n this._get = getItemHeight;\n this._set = setItemHeight;\n this.reset();\n }\n\n _createClass(ItemHeights, [{\n key: \"reset\",\n value: function reset() {\n this.measuredItemsHeight = 0; // \"First measured item index\" variable was introduced\n // because it's not always `0`: when `virtualScroller.setItems()`\n // is called, some items might get prepended, in which case\n // `this.lastMeasuredItemIndex` is updated. If there was no\n // `this.firstMeasuredItemIndex`, then the average item height\n // calculated in `.getAverage()` would be incorrect in the timeframe\n // between `.setItems()` is called and those changes have been rendered.\n // And in that timeframe, `.getAverage()` is used to calculate the \"layout\":\n // stuff like \"before/after items height\" and \"estimated items count on screen\".\n\n this.firstMeasuredItemIndex = undefined;\n this.lastMeasuredItemIndex = undefined;\n }\n /**\r\n * Can only be called after a `.reset()` (including new instance creation).\r\n * Initializes `this.measuredItemsHeight`, `this.firstMeasuredItemIndex`\r\n * and `this.lastMeasuredItemIndex` instance variables from `VirtualScroller` `state`.\r\n * These instance variables are used when calculating \"average\" item height:\r\n * the \"average\" item height is simply `this.measuredItemsHeight` divided by\r\n * `this.lastMeasuredItemIndex` minus `this.firstMeasuredItemIndex` plus 1.\r\n */\n\n }, {\n key: \"readItemHeightsFromState\",\n value: function readItemHeightsFromState(_ref2) {\n var itemHeights = _ref2.itemHeights;\n var i = 0;\n\n while (i < itemHeights.length) {\n if (itemHeights[i] === undefined) {\n if (this.firstMeasuredItemIndex !== undefined) {\n this.lastMeasuredItemIndex = i - 1;\n break;\n }\n } else {\n if (this.firstMeasuredItemIndex === undefined) {\n this.firstMeasuredItemIndex = i;\n }\n\n this.measuredItemsHeight += itemHeights[i];\n }\n\n i++;\n }\n } // Seems to be no longer used.\n // getItemHeight(i, firstShownItemIndex) {\n // \tif (this._get(i)) {\n // \t\treturn this._get(i)\n // \t}\n // \tconst itemHeight = this._measureItemHeight(i, firstShownItemIndex)\n // \tif (itemHeight) {\n // \t\tthis._set(i, itemHeight)\n // \t\treturn itemHeight\n // \t}\n // \treturn this.getAverage()\n // }\n\n }, {\n key: \"_measureItemHeight\",\n value: function _measureItemHeight(i, firstShownItemIndex) {\n return this.container.getNthRenderedItemHeight(i - firstShownItemIndex);\n }\n /**\r\n * Measures item heights:\r\n *\r\n * * For the items that haven't been previously measured,\r\n * measures them for the first time.\r\n *\r\n * * For the items that have been previoulsy measured,\r\n * validate that their previously measured height\r\n * is still equal to their current height.\r\n * The unequalness may not necessarily be caused by\r\n * incorrect use of `virtual-scroller`: there are\r\n * also some valid use cases when such unequalness\r\n * could happen (see the comments in the code).\r\n *\r\n * @param {number} firstShownItemIndex\r\n * @param {number} lastShownItemIndex\r\n * @return {number[]} The indexes of the items that have not previously been measured and have been measured now.\r\n */\n\n }, {\n key: \"measureItemHeights\",\n value: function measureItemHeights(firstShownItemIndex, lastShownItemIndex) {\n log('~ Measure item heights ~'); // If no items are rendered, don't measure anything.\n\n if (firstShownItemIndex === undefined) {\n return;\n } // Reset `this.measuredItemsHeight` if it's not a \"continuous\" measured items list:\n // if a group of items has been measured previously, and now it has rendered a completely\n // different group of items, and there's a non-measured \"gap\" between those two groups,\n // then reset `this.measuredItemsHeight` and \"first measured\"/\"last measured\" item indexes.\n // For example, this could happen when `.setItems()` prepends a lot of new items.\n\n\n if (this.firstMeasuredItemIndex !== undefined) {\n if (firstShownItemIndex > this.lastMeasuredItemIndex + 1 || lastShownItemIndex < this.firstMeasuredItemIndex - 1) {\n // Reset.\n log('Non-measured items gap detected. Reset first and last measured item indexes.');\n this.reset();\n }\n }\n\n var nonPreviouslyMeasuredItemIndexes = [];\n var previousFirstMeasuredItemIndex = this.firstMeasuredItemIndex;\n var previousLastMeasuredItemIndex = this.lastMeasuredItemIndex;\n var firstMeasuredItemIndexHasBeenUpdated = false;\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n // Measure item heights that haven't been measured previously.\n // Don't re-measure item heights that have been measured previously.\n // The rationale is that developers are supposed to manually call\n // `.onItemHeightDidChange()` immediately every time an item's height has changed.\n // If developers don't neglect that rule, item heights won't\n // change unexpectedly.\n if (this._get(i) === undefined) {\n nonPreviouslyMeasuredItemIndexes.push(i);\n\n var height = this._measureItemHeight(i, firstShownItemIndex);\n\n log('Item index', i, 'height', height);\n\n this._set(i, height); // Update average item height calculation variables\n // related to the previously measured items\n // that're above the items currently being shown.\n // It is known to be a \"continuous\" measured items list,\n // because the code at the start of this function checks that.\n\n\n if (previousFirstMeasuredItemIndex === undefined || i < previousFirstMeasuredItemIndex) {\n this.measuredItemsHeight += height; // Update first measured item index.\n\n if (!firstMeasuredItemIndexHasBeenUpdated) {\n // log('Set first measured item index', i)\n this.firstMeasuredItemIndex = i;\n firstMeasuredItemIndexHasBeenUpdated = true;\n }\n } // Update average item height calculation variables\n // related to the previously measured items\n // that're below the items currently being shown.\n // It is known to be a \"continuous\" measured items list,\n // because the code at the start of this function checks that.\n\n\n if (previousLastMeasuredItemIndex === undefined || i > previousLastMeasuredItemIndex) {\n // If `previousLastMeasuredItemIndex` is `undefined`\n // then `previousFirstMeasuredItemIndex` is also `undefined`\n // which means that the item's `height` has already been added\n // to `this.measuredItemsHeight` in the code above,\n // so this condition guards against counting the item's `height`\n // twice in `this.measuredItemsHeight`.\n if (previousLastMeasuredItemIndex !== undefined) {\n // Add newly shown item height.\n this.measuredItemsHeight += height;\n } // Update last measured item index.\n\n\n this.lastMeasuredItemIndex = i;\n }\n } else {\n // Validate that the item's height didn't change since it was last measured.\n // If it did, then display a warning and update the item's height\n // as an attempt to fix things.\n // If an item's height changes unexpectedly then it means that there'll\n // likely be \"content jumping\".\n var previousHeight = this._get(i);\n\n var _height = this._measureItemHeight(i, firstShownItemIndex);\n\n if (previousHeight !== _height) {\n warn('Item index', i, 'height changed unexpectedly: it was', previousHeight, 'before, but now it is', _height, '. Whenever an item\\'s height changes for whatever reason, a developer must call `onItemHeightDidChange(i)` right after that change. If you are calling `onItemHeightDidChange(i)` correctly, then there\\'re several other possible causes. For example, perhaps you forgot to persist the item\\'s \"state\" by calling `setItemState(i, newState)` when that \"state\" did change, and so the item\\'s \"state\" got lost when the item element was unmounted, which resulted in a different item height when the item was shown again with no previous \"state\". Or perhaps you\\'re running your application in \"devleopment\" mode and `VirtualScroller` has initially rendered the list before your CSS styles or custom fonts have loaded, resulting in different item height measurements \"before\" and \"after\" the page has fully loaded.'); // Update the item's height as an attempt to fix things.\n\n this._set(i, _height);\n }\n }\n\n i++;\n } // // Update average item height.\n // this.updateAverageItemHeight()\n\n\n return nonPreviouslyMeasuredItemIndexes;\n }\n /**\r\n * Re-measures item height.\r\n * @param {number} i — Item index.\r\n * @param {number} firstShownItemIndex\r\n */\n\n }, {\n key: \"remeasureItemHeight\",\n value: function remeasureItemHeight(i, firstShownItemIndex) {\n var previousHeight = this._get(i);\n\n var height = this._measureItemHeight(i, firstShownItemIndex); // // Because this function is called from `.onItemHeightDidChange()`,\n // // there're no guarantees in which circumstances a developer calls it,\n // // and for which item indexes.\n // // Therefore, to guard against cases of incorrect usage,\n // // this function won't crash anything if the item isn't rendered\n // // or hasn't been previously rendered.\n // if (height !== undefined) {\n // \treportError(`\"onItemHeightDidChange()\" has been called for item ${i}, but that item isn't currently rendered.`)\n // \treturn\n // }\n // if (previousHeight === undefined) {\n // \treportError(`\"onItemHeightDidChange()\" has been called for item ${i}, but that item hasn't been rendered before.`)\n // \treturn\n // }\n\n\n this._set(i, height);\n\n this.measuredItemsHeight += height - previousHeight;\n return height;\n } // /**\n // * \"Average\" item height is stored as an instance variable.\n // * For example, for caching, so that it isn't calculated every time it's requested.\n // * But that would be negligible performance gain, not really worth the extra code.\n // * Another thing it's stored for as an instance variable is\n // * keeping \"previous\" \"average\" item height, because it can be more precise\n // * than the newly calculated \"average\" item height, provided it had\n // * more \"samples\" (measured items). The newly calculated average item height\n // * could get less samples in a scenario when the scroll somehow jumps\n // * from one position to some other distant position: in that case previous\n // * \"total measured items height\" is discarded and the new one is initialized.\n // * Could such situation happen in real life? I guess, it's unlikely.\n // * So I'm commenting out this code, but still keeping it just in case.\n // */\n // updateAverageItemHeight() {\n // \tthis.averageItemHeightSamplesCount = this.lastMeasuredItemIndex - this.firstMeasuredItemIndex + 1\n // \tthis.averageItemHeight = this.measuredItemsHeight / this.averageItemHeightSamplesCount\n // }\n //\n // /**\n // * Public API: is called by `VirtualScroller`.\n // * @return {number}\n // */\n // getAverage() {\n // \t// Previously measured average item height might still be\n // \t// more precise if it contains more measured items (\"samples\").\n // \tif (this.previousAverageItemHeight) {\n // \t\tif (this.previousAverageItemHeightSamplesCount > this.averageItemHeightSamplesCount) {\n // \t\t\treturn this.previousAverageItemHeight\n // \t\t}\n // \t}\n // \treturn this.averageItemHeight || 0\n // }\n\n /**\r\n * Public API: is called by `VirtualScroller`.\r\n * @return {number}\r\n */\n\n }, {\n key: \"getAverage\",\n value: function getAverage() {\n if (this.lastMeasuredItemIndex === undefined) {\n return 0;\n }\n\n return this.measuredItemsHeight / (this.lastMeasuredItemIndex - this.firstMeasuredItemIndex + 1);\n }\n }, {\n key: \"onPrepend\",\n value: function onPrepend(count) {\n if (this.firstMeasuredItemIndex !== undefined) {\n this.firstMeasuredItemIndex += count;\n this.lastMeasuredItemIndex += count;\n }\n }\n }]);\n\n return ItemHeights;\n}();\n\nexport { ItemHeights as default };\n//# sourceMappingURL=ItemHeights.js.map","export default function fillArray(array, getItem) {\n var i = 0;\n\n while (i < array.length) {\n array[i] = getItem(i);\n i++;\n }\n\n return array;\n}\n//# sourceMappingURL=fillArray.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// Creates a snapshot of a `state` or a partial update of a `state`.\n// Is only used for logging state snapshots for later debug.\n//\n// When `state` is output to the browser console via `console.log()`,\n// it is explorable in real time. That also means that if that `state`\n// is modified later, the user will see the modified state, not the\n// original one. In the current implementation, `state` is not strictly\n// \"immutable\": things like individual item heights (including \"before resize\" ones)\n// or states are updated in-place — `state.itemHeights[i] = newItemHeight` or\n// `state.itemStates[i] = newItemState`. That's because those `state` properties\n// are the ones that don’t affect the presentation, so there's no need to re-render\n// the list when those do change — updating those properties is just an effect of\n// some change rather than cause for one.\n//\n// So, when outputting `state` via `console.log()` for debug, it makes sense to\n// snapshot it so that the developer, while debugging later, sees the correct\n// item heights or item states.\n//\nexport default function getStateSnapshot(state) {\n var stateSnapshot = _objectSpread({}, state);\n\n if (state.itemHeights) {\n stateSnapshot.itemHeights = state.itemHeights.slice();\n }\n\n if (state.itemStates) {\n stateSnapshot.itemStates = state.itemStates.slice();\n }\n\n if (state.beforeResize) {\n stateSnapshot.beforeResize = _objectSpread({}, state.beforeResize);\n stateSnapshot.beforeResize.itemHeights = state.beforeResize.itemHeights.slice();\n }\n\n return stateSnapshot;\n}\n//# sourceMappingURL=getStateSnapshot.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport fillArray from './utility/fillArray.js';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport { cleanUpBeforeResizeState } from './BeforeResize.js';\nimport getStateSnapshot from './utility/getStateSnapshot.js'; // There're three main places where state is updated:\n//\n// * On scroll.\n// * On window resize.\n// * On set new items.\n//\n// State updates may be \"asynchronous\" (like in React), in which case the\n// corresponding operation is \"pending\" until the state update is applied.\n//\n// If there's a \"pending\" window resize or a \"pending\" update of the set of items,\n// then \"on scroll\" updates aren't dispatched.\n//\n// If there's a \"pending\" on scroll update and the window is resize or a new set\n// of items is set, then that \"pending\" on scroll update gets overwritten.\n//\n// If there's a \"pending\" update of the set of items, then window resize handler\n// sees that \"pending\" update and dispatches its own state update so that the\n// \"pending\" state update originating from `setItems()` is not lost.\n//\n// If there's a \"pending\" window resize, and a new set of items is set,\n// then the state update of the window resize handler gets overwritten.\n\nexport default function createStateHelpers(_ref) {\n var _this = this;\n\n var initialState = _ref.state,\n getInitialItemState = _ref.getInitialItemState,\n onStateChange = _ref.onStateChange,\n render = _ref.render,\n initialItems = _ref.items;\n this.onStateChange = onStateChange;\n this._render = render;\n this.getInitialItemState = getInitialItemState;\n\n this._setItemState = function (i, newItemState) {\n if (isDebug()) {\n log('~ Item state changed ~');\n log('Item index', i); // Uses `JSON.stringify()` here instead of just outputting the JSON objects as is\n // because outputting JSON objects as is would show different results later when\n // the developer inspects those in the web browser console if those state objects\n // get modified in between they've been output to the console and the developer\n // decided to inspect them.\n\n log('Previous state' + '\\n' + JSON.stringify(_this.getState().itemStates[i], null, 2));\n log('New state' + '\\n' + JSON.stringify(newItemState, null, 2));\n }\n\n _this.getState().itemStates[i] = newItemState; // If there was a request for `setState()` with new `items`, then the changes\n // to `currentState.itemStates[]` made above would be overwritten when that\n // pending `setState()` call gets applied.\n // To fix that, the updates to current `itemStates[]` are noted in\n // `this.itemStatesThatChangedWhileNewItemsWereBeingRendered` variable.\n // That variable is then checked when the `setState()` call with the new `items`\n // has been updated.\n\n if (_this.newItemsWillBeRendered) {\n if (!_this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n _this.itemStatesThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n _this.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(i)] = newItemState;\n }\n };\n\n this.getState = function () {\n return _this._getState();\n };\n\n this.updateState = function (stateUpdate) {\n if (isDebug()) {\n log('~ Set state ~');\n log(getStateSnapshot(stateUpdate));\n } // Ensure that a non-initial `stateUpdate` can only contain an `items`\n // property when it comes from a `setItems()` call.\n\n\n if (stateUpdate.items) {\n if (!_this._isSettingNewItems) {\n reportError('A `stateUpdate` can only contain `items` property as a result of calling `.setItems()`');\n }\n }\n\n _this._isSettingNewItems = undefined;\n _this.waitingForRender = true; // Store previous `state`.\n\n _this.previousState = _this.getState(); // If it's the first call to `this.updateState()` then initialize\n // the most recent `setState()` value to be the current state.\n\n if (!_this.mostRecentSetStateValue) {\n _this.mostRecentSetStateValue = _this.getState();\n } // Accumulates all \"pending\" state updates until they have been applied.\n\n\n _this.mostRecentSetStateValue = _objectSpread(_objectSpread({}, _this.mostRecentSetStateValue), stateUpdate); // Update `state`.\n\n _this._setState(_this.mostRecentSetStateValue, stateUpdate);\n };\n\n this.getInitialState = function () {\n if (initialState) {\n return getRestoredState.call(_this, initialState);\n }\n\n return getInitialStateFromScratch.call(_this, {\n getInitialItemState: getInitialItemState\n });\n };\n\n this.useState = function (_ref2) {\n var getState = _ref2.getState,\n setState = _ref2.setState,\n updateState = _ref2.updateState;\n\n if (_this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` has already been started');\n }\n\n if (_this._getState) {\n throw new Error('[virtual-scroller] Custom state storage has already been configured');\n }\n\n if (render) {\n throw new Error('[virtual-scroller] Creating a `VirtualScroller` class instance with a `render()` parameter implies using the default (internal) state storage');\n }\n\n if (setState && updateState) {\n throw new Error('[virtual-scroller] When using a custom state storage, one must supply either `setState()` or `updateState()` function but not both');\n }\n\n if (!getState || !(setState || updateState)) {\n throw new Error('[virtual-scroller] When using a custom state storage, one must supply both `getState()` and `setState()`/`updateState()` functions');\n }\n\n _this._usesCustomStateStorage = true;\n _this._getState = getState;\n\n _this._setState = function (newState, stateUpdate) {\n if (setState) {\n setState(newState);\n } else {\n updateState(stateUpdate);\n }\n };\n };\n\n this.useDefaultStateStorage = function () {\n if (!render) {\n throw new Error('[virtual-scroller] When using the default (internal) state management, one must supply a `render(state, prevState)` function parameter');\n } // Create default `getState()`/`setState()` functions.\n\n\n _this._getState = defaultGetState.bind(_this);\n _this._setState = defaultSetState.bind(_this); // When `state` is stored externally, a developer is responsible for\n // initializing it with the initial value.\n // Otherwise, if default state management is used, set the initial state now.\n\n var setInitialState = defaultSetInitialState.bind(_this);\n setInitialState(_this.getInitialState());\n };\n\n function defaultGetState() {\n return this.state;\n }\n\n function defaultSetInitialState(newState) {\n this.state = newState;\n }\n\n function defaultSetState(newState, stateUpdate) {\n // // Because the default state updates are \"synchronous\" (immediate),\n // // the `...stateUpdate` could be applied over `...this.state`,\n // // and no state updates would be lost.\n // // But if it was \"asynchronous\" (not immediate), then `...this.state`\n // // wouldn't work in all cases, because it could be stale in cases\n // // when more than a single `setState()` call is made before\n // // the state actually updates, making some properties of `this.state` stale.\n // this.state = {\n // \t...this.state,\n // \t...stateUpdate\n // }\n this.state = newState;\n render(this.state, this.previousState);\n this.onRender();\n }\n /**\r\n * Returns the initial state of the `VirtualScroller` \"from scratch\".\r\n * (i.e. not from a previously saved one).\r\n * @param {function} [options.getInitialItemState] — Gets initial item state.\r\n * @return {object}\r\n */\n\n\n function getInitialStateFromScratch(_ref3) {\n var getInitialItemState = _ref3.getInitialItemState;\n var items = initialItems;\n\n var state = _objectSpread(_objectSpread({}, getInitialLayoutState.call(this, items, {\n beforeStart: true\n })), {}, {\n items: items,\n itemStates: fillArray(new Array(items.length), function (i) {\n return getInitialItemState(items[i]);\n })\n });\n\n if (isDebug()) {\n log('Initial state (autogenerated)', getStateSnapshot(state));\n }\n\n log('First shown item index', state.firstShownItemIndex);\n log('Last shown item index', state.lastShownItemIndex);\n return state;\n }\n\n function getRestoredState(state) {\n if (isDebug()) {\n log('Restore state', getStateSnapshot(state));\n } // Possibly clean up \"before resize\" property in state.\n // \"Before resize\" state property is cleaned up when all \"before resize\" item heights\n // have been re-measured in an asynchronous `this.updateState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.updateState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n\n state = cleanUpBeforeResizeState(state); // Reset `verticalSpacing` so that it re-measures it after the list\n // has been rendered initially. The rationale is that a previously captured\n // inter-item vertical spacing can't be \"trusted\" in a sense that the user\n // might have resized the window after the previous `state` has been snapshotted.\n // If the user has resized the window, then changing window width might have\n // activated different CSS `@media()` \"queries\" resulting in a potentially different\n // vertical spacing when the `VirtualScroller` is re-created with such previously\n // snapshotted state.\n\n state = _objectSpread(_objectSpread({}, state), {}, {\n verticalSpacing: undefined\n }); // `this.verticalSpacing` acts as a \"true\" source for vertical spacing value.\n // Vertical spacing is also stored in `state` but `state` updates could be\n // \"asynchronous\" (not applied immediately) and `this.onUpdateShownItemIndexes()`\n // requires vertical spacing to be correct at any time, without any delays.\n // So, vertical spacing is also duplicated in `state`, but the \"true\" source\n // is still `this.verticalSpacing`.\n //\n // `this.verticalSpacing` must be initialized before calling `this.getInitialStateFromScratch()`\n // because `this.getInitialStateFromScratch()` uses `this.verticalSpacing` in its calculations.\n //\n // With the code above, `state.verticalSpacing` is always gonna be `undefined`,\n // so commented out this code. It's safer to just re-measure vertical spacing\n // from scratch when `VirtualScroller` is mounted.\n //\n // this.verticalSpacing = state ? state.verticalSpacing : undefined\n // Check if the actual `columnsCount` on the screen matches the one from state.\n\n if (isStateColumnsCountMismatch(state, {\n columnsCount: this.getActualColumnsCount()\n })) {\n warn('Reset Layout');\n state = _objectSpread(_objectSpread({}, state), getInitialLayoutState.call(this, state.items, {\n beforeStart: false\n }));\n }\n\n return state;\n }\n\n function getInitialLayoutState(items, _ref4) {\n var _this2 = this;\n\n var beforeStart = _ref4.beforeStart;\n var itemsCount = items.length;\n\n var getColumnsCount = function getColumnsCount() {\n return _this2.getActualColumnsCount();\n };\n\n var columnsCount = beforeStart ? this.layout.getInitialLayoutValueWithFallback('columnsCount', getColumnsCount, 1) : getColumnsCount();\n\n var _this$layout$getIniti = this.layout.getInitialLayoutValues({\n itemsCount: itemsCount,\n columnsCount: this.getActualColumnsCount(),\n beforeStart: beforeStart\n }),\n firstShownItemIndex = _this$layout$getIniti.firstShownItemIndex,\n lastShownItemIndex = _this$layout$getIniti.lastShownItemIndex,\n beforeItemsHeight = _this$layout$getIniti.beforeItemsHeight,\n afterItemsHeight = _this$layout$getIniti.afterItemsHeight;\n\n var itemHeights = new Array(itemsCount); // Optionally preload items to be rendered.\n\n this.onBeforeShowItems(items, itemHeights, firstShownItemIndex, lastShownItemIndex);\n return {\n itemHeights: itemHeights,\n columnsCount: this.getActualColumnsCountForState(),\n verticalSpacing: this.verticalSpacing,\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n };\n } // Checks if the actual `columnsCount` on the screen matches the one from state.\n //\n // For example, a developer might snapshot `VirtualScroller` state\n // when the user navigates from the page containing the list\n // in order to later restore the list's state when the user goes \"Back\".\n // But, the user might have also resized the window while being on that\n // \"other\" page, and when they come \"Back\", their snapshotted state\n // no longer qualifies. Well, it does qualify, but only partially.\n // For example, `itemStates` are still valid, but first and last shown\n // item indexes aren't.\n //\n\n\n function isStateColumnsCountMismatch(state, _ref5) {\n var columnsCount = _ref5.columnsCount;\n var stateColumnsCount = state.columnsCount || 1;\n\n if (stateColumnsCount !== columnsCount) {\n warn('~ Columns Count changed from', stateColumnsCount, 'to', columnsCount, '~');\n return true;\n }\n\n var firstShownItemIndex = Math.floor(state.firstShownItemIndex / columnsCount) * columnsCount;\n\n if (firstShownItemIndex !== state.firstShownItemIndex) {\n warn('~ First Shown Item Index', state.firstShownItemIndex, 'is not divisible by Columns Count', columnsCount, '~');\n return true;\n }\n }\n}\n//# sourceMappingURL=VirtualScroller.state.js.map","import log from './utility/debug.js';\nimport getVerticalSpacing from './getVerticalSpacing.js';\nexport default function createVerticalSpacingHelpers() {\n var _this = this;\n\n // Bind to `this` in order to prevent bugs when this function is passed by reference\n // and then called with its `this` being unintentionally `window` resulting in\n // the `if` condition being \"falsy\".\n this.getVerticalSpacing = function () {\n return _this.verticalSpacing || 0;\n };\n\n this.getVerticalSpacingBeforeResize = function () {\n // `beforeResize.verticalSpacing` can be `undefined`.\n // For example, if `this.updateState({ verticalSpacing })` call hasn't been applied\n // before the resize happened (in case of an \"asynchronous\" state update).\n var _this$getState = _this.getState(),\n beforeResize = _this$getState.beforeResize;\n\n return beforeResize && beforeResize.verticalSpacing || 0;\n };\n /**\r\n * Measures item vertical spacing, if not measured.\r\n * @return {object} [stateUpdate]\r\n */\n\n\n this.measureVerticalSpacingIfNotMeasured = function () {\n if (_this.verticalSpacing === undefined) {\n _this.verticalSpacing = measureVerticalSpacing.call(_this);\n return _this.verticalSpacing;\n }\n };\n\n function measureVerticalSpacing() {\n var _this$getState2 = this.getState(),\n firstShownItemIndex = _this$getState2.firstShownItemIndex,\n lastShownItemIndex = _this$getState2.lastShownItemIndex;\n\n log('~ Measure item vertical spacing ~');\n var verticalSpacing = getVerticalSpacing({\n itemsContainer: this.itemsContainer,\n renderedItemsCount: lastShownItemIndex - firstShownItemIndex + 1\n });\n\n if (verticalSpacing === undefined) {\n log('Not enough items rendered to measure vertical spacing');\n } else {\n log('Item vertical spacing', verticalSpacing);\n return verticalSpacing;\n }\n }\n}\n//# sourceMappingURL=VirtualScroller.verticalSpacing.js.map","export default function getVerticalSpacing(_ref) {\n var itemsContainer = _ref.itemsContainer,\n renderedItemsCount = _ref.renderedItemsCount;\n\n if (renderedItemsCount > 1) {\n var firstShownRowTopOffset = itemsContainer.getNthRenderedItemTopOffset(0);\n var firstShownRowHeight = itemsContainer.getNthRenderedItemHeight(0);\n var i = 1;\n\n while (i < renderedItemsCount) {\n var itemTopOffset = itemsContainer.getNthRenderedItemTopOffset(i);\n var itemHeight = itemsContainer.getNthRenderedItemHeight(i); // See if the item is on the next row.\n // Simply checking for `itemTopOffset !== firstShownRowTopOffset` wouldn't work\n // because items in a row aren't required to be aligned to the top border.\n\n if (itemTopOffset >= firstShownRowTopOffset + firstShownRowHeight) {\n // Measure inter-row spacing.\n // Can't be \"negative\" with the current `if` condition.\n return itemTopOffset - (firstShownRowTopOffset + firstShownRowHeight);\n } // A row height is the maximum of its item heights.\n\n\n firstShownRowHeight = Math.max(firstShownRowHeight, itemHeight);\n i++;\n }\n }\n}\n//# sourceMappingURL=getVerticalSpacing.js.map","export default function createColumnsHelpers(_ref) {\n var _this = this;\n\n var getColumnsCount = _ref.getColumnsCount;\n\n if (getColumnsCount) {\n var scrollableContainerArgument = {\n getWidth: function getWidth() {\n return _this.scrollableContainer.getWidth();\n }\n };\n\n this.getActualColumnsCountForState = function () {\n var columnsCount = getColumnsCount(scrollableContainerArgument); // `columnsCount: 1` is effectively same as `columnsCount: undefined`\n // from the code's point of view. This makes one less property in `state`\n // which makes `state` a bit less cluttered (easier for inspection).\n\n if (columnsCount !== 1) {\n return columnsCount;\n }\n };\n } else {\n this.getActualColumnsCountForState = function () {\n return undefined;\n };\n }\n\n this.getActualColumnsCount = function () {\n return _this.getActualColumnsCountForState() || 1;\n };\n\n this.getColumnsCount = function () {\n return _this.getState() && _this.getState().columnsCount || 1;\n };\n}\n//# sourceMappingURL=VirtualScroller.columns.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\n// https://github.com/bvaughn/react-virtualized/issues/722\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport ItemNotRenderedError from './ItemNotRenderedError.js';\nexport default function () {\n var _this = this;\n\n this.onUpdateShownItemIndexes = function (_ref) {\n var reason = _ref.reason,\n stateUpdate = _ref.stateUpdate;\n\n // In case of \"don't do anything\".\n var skip = function skip() {\n if (stateUpdate) {\n _this.updateState(stateUpdate);\n }\n }; // If new `items` have been set and are waiting to be applied,\n // or if the viewport width has changed requiring a re-layout,\n // then temporarily stop all other updates like \"on scroll\" updates.\n // This prevents `state` being inconsistent, because, for example,\n // both `setItems()` and this function could update `VirtualScroller` state\n // and having them operate in parallel could result in incorrectly calculated\n // `beforeItemsHeight` / `afterItemsHeight` / `firstShownItemIndex` /\n // `lastShownItemIndex`, because, when operating in parallel, this function\n // would have different `items` than the `setItems()` function, so their\n // results could diverge.\n\n\n if (_this.newItemsWillBeRendered || _this.widthHasChanged || _this._isResizing) {\n return skip();\n } // If there're no items then there's no need to re-layout anything.\n\n\n if (_this.getItemsCount() === 0) {\n return skip();\n } // Cancel a \"re-layout when user stops scrolling\" timer.\n\n\n _this.scroll.cancelScheduledLayout(); // Cancel a re-layout that is scheduled to run at the next \"frame\",\n // because a re-layout will be performed right now.\n\n\n stateUpdate = _this.cancelLayoutTimer({\n stateUpdate: stateUpdate\n }); // Perform a re-layout.\n\n log(\"~ Update Layout (on \".concat(reason, \") ~\"));\n updateShownItemIndexes.call(_this, {\n stateUpdate: stateUpdate\n });\n };\n /**\r\n * Updates the \"from\" and \"to\" shown item indexes.\r\n * If the list is visible and some of the items being shown are new\r\n * and are required to be measured first, then\r\n * `firstNonMeasuredItemIndex` is defined.\r\n * If the list is visible and all items being shown have been encountered\r\n * (and measured) before, then `firstNonMeasuredItemIndex` is `undefined`.\r\n *\r\n * The `stateUpdate` parameter is just an optional \"additional\" state update.\r\n */\n\n\n function updateShownItemIndexes(_ref2) {\n var stateUpdate = _ref2.stateUpdate;\n var startedAt = Date.now(); // Get shown item indexes.\n\n var _getShownItemIndexes$ = getShownItemIndexes.call(this),\n firstShownItemIndex = _getShownItemIndexes$.firstShownItemIndex,\n lastShownItemIndex = _getShownItemIndexes$.lastShownItemIndex,\n shownItemsHeight = _getShownItemIndexes$.shownItemsHeight,\n firstNonMeasuredItemIndex = _getShownItemIndexes$.firstNonMeasuredItemIndex; // If scroll position is scheduled to be restored after render,\n // then the \"anchor\" item must be rendered, and all of the prepended\n // items before it, all in a single pass. This way, all of the\n // prepended items' heights could be measured right after the render\n // has finished, and the scroll position can then be immediately restored.\n\n\n if (this.listHeightMeasurement.hasSnapshot()) {\n if (lastShownItemIndex < this.listHeightMeasurement.getAnchorItemIndex()) {\n lastShownItemIndex = this.listHeightMeasurement.getAnchorItemIndex();\n } // `firstShownItemIndex` is always `0` when prepending items.\n // And `lastShownItemIndex` always covers all prepended items in this case.\n // None of the prepended items have been rendered before,\n // so their heights are unknown. The code at the start of this function\n // did therefore set `firstNonMeasuredItemIndex` to non-`undefined`\n // in order to render just the first prepended item in order to\n // measure it, and only then make a decision on how many other\n // prepended items to render. But since we've instructed the code\n // to show all of the prepended items at once, there's no need to\n // \"redo layout after render\". Additionally, if layout was re-done\n // after render, then there would be a short interval of visual\n // \"jitter\" due to the scroll position not being restored because it'd\n // wait for the second layout to finish instead of being restored\n // right after the first one.\n\n\n firstNonMeasuredItemIndex = undefined;\n } // Validate the heights of items to be hidden on next render.\n // For example, a user could click a \"Show more\" button,\n // or an \"Expand YouTube video\" button, which would result\n // in the actual height of the list item being different\n // from what has been initially measured in `this.itemHeights[i]`,\n // if the developer didn't call `.setItemState(i, newState)` and `.onItemHeightDidChange(i)`.\n\n\n if (!validateWillBeHiddenItemHeightsAreAccurate.call(this, firstShownItemIndex, lastShownItemIndex)) {\n log('~ Because some of the will-be-hidden item heights (listed above) have changed since they\\'ve last been measured, redo layout. ~'); // Redo layout, now with the correct item heights.\n\n return updateShownItemIndexes.call(this, {\n stateUpdate: stateUpdate\n });\n } // Measure \"before\" items height.\n\n\n var beforeItemsHeight = this.layout.getBeforeItemsHeight(firstShownItemIndex); // Measure \"after\" items height.\n\n var afterItemsHeight = this.layout.getAfterItemsHeight(lastShownItemIndex, this.getItemsCount());\n var layoutDuration = Date.now() - startedAt; // Debugging.\n\n log('~ Calculated Layout' + (this.bypass ? ' (bypass)' : '') + ' ~');\n\n if (layoutDuration < SLOW_LAYOUT_DURATION) {// log('Calculated in', layoutDuration, 'ms')\n } else {\n warn('Layout calculated in', layoutDuration, 'ms');\n }\n\n if (this.getColumnsCount()) {\n log('Columns count', this.getColumnsCount());\n }\n\n log('First shown item index', firstShownItemIndex);\n log('Last shown item index', lastShownItemIndex);\n log('Before items height', beforeItemsHeight);\n log('After items height (actual or estimated)', afterItemsHeight);\n log('Average item height (used for estimated after items height calculation)', this.itemHeights.getAverage());\n\n if (isDebug()) {\n log('Item heights', this.getState().itemHeights.slice());\n log('Item states', this.getState().itemStates.slice());\n } // Optionally preload items to be rendered.\n\n\n this.onBeforeShowItems(this.getState().items, this.getState().itemHeights, firstShownItemIndex, lastShownItemIndex); // Set `this.firstNonMeasuredItemIndex`.\n\n this.firstNonMeasuredItemIndex = firstNonMeasuredItemIndex; // if (firstNonMeasuredItemIndex !== undefined) {\n // \tlog('Non-measured item index that will be measured at next layout', firstNonMeasuredItemIndex)\n // }\n // Set \"previously calculated layout\".\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n // Currently, this feature is not used, and `shownItemsHeight` property\n // is not returned at all, so don't set any \"previously calculated layout\".\n //\n\n if (shownItemsHeight === undefined) {\n this.previouslyCalculatedLayout = undefined;\n } else {\n // If \"previously calculated layout\" feature would be implmeneted,\n // then this code would set \"previously calculate layout\" instance variable.\n //\n // What for would this instance variable be used?\n //\n // Instead of using a `this.previouslyCalculatedLayout` instance variable,\n // this code could use `this.getState()` because it reflects what's currently on screen,\n // but there's a single edge case when it could go out of sync —\n // updating item heights externally via `.onItemHeightDidChange(i)`.\n //\n // If, for example, an item height was updated externally via `.onItemHeightDidChange(i)`\n // then `this.getState().itemHeights` would get updated immediately but\n // `this.getState().beforeItemsHeight` or `this.getState().afterItemsHeight`\n // would still correspond to the previous item height, so those would be \"stale\".\n // On the other hand, same values in `this.previouslyCalculatedLayout` instance variable\n // can also be updated immediately, so they won't go out of sync with the updated item height.\n // That seems the only edge case when using a separate `this.previouslyCalculatedLayout`\n // instance variable instead of using `this.getState()` would theoretically be justified.\n //\n this.previouslyCalculatedLayout = {\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n shownItemsHeight: shownItemsHeight\n };\n } // Update `VirtualScroller` state.\n // `VirtualScroller` automatically re-renders on state updates.\n //\n // All `state` properties updated here should be overwritten in\n // the implementation of `setItems()` and `onResize()` methods\n // so that the `state` is not left in an inconsistent state\n // whenever there're concurrent `updateState()` updates that could\n // possibly conflict with one another — instead, those state updates\n // should overwrite each other in terms of priority.\n // These \"on scroll\" updates have the lowest priority compared to\n // the state updates originating from `setItems()` and `onResize()` methods.\n //\n\n\n this.updateState(_objectSpread({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, stateUpdate));\n }\n\n function getCoordinatesOfVisibleAreaInsideTheList() {\n var visibleAreaBounds = this.scroll.getVisibleAreaBounds();\n this.latestLayoutVisibleArea = visibleAreaBounds; // Subtract the top offset of the list inside the scrollable container.\n\n var listTopOffsetInsideScrollableContainer = this.getListTopOffsetInsideScrollableContainer();\n return {\n top: visibleAreaBounds.top - listTopOffsetInsideScrollableContainer,\n bottom: visibleAreaBounds.bottom - listTopOffsetInsideScrollableContainer\n };\n }\n\n function getShownItemIndexes() {\n var itemsCount = this.getItemsCount();\n var visibleAreaInsideTheList = getCoordinatesOfVisibleAreaInsideTheList.call(this);\n\n if (this.bypass) {\n return {\n firstShownItemIndex: 0,\n lastShownItemIndex: itemsCount - 1 // shownItemsHeight: this.getState().itemHeights.reduce((sum, itemHeight) => sum + itemHeight, 0)\n\n };\n } // Find the indexes of the items that are currently visible\n // (or close to being visible) in the scrollable container.\n // For scrollable containers other than the main screen, it could also\n // check the visibility of such scrollable container itself, because it\n // might be not visible.\n // If such kind of an optimization would hypothetically be implemented,\n // then it would also require listening for \"scroll\" events on the screen.\n // Overall, I suppose that such \"actual visibility\" feature would be\n // a very minor optimization and not something I'd deal with.\n\n\n var isVisible = visibleAreaInsideTheList.top < this.itemsContainer.getHeight() + this.layout.getPrerenderMargin() && visibleAreaInsideTheList.bottom > 0 - this.layout.getPrerenderMargin();\n\n if (!isVisible) {\n log('The entire list is off-screen. No items are visible.');\n return this.layout.getNonVisibleListShownItemIndexes();\n } // Get shown item indexes.\n\n\n return this.layout.getShownItemIndexes({\n itemsCount: this.getItemsCount(),\n visibleAreaInsideTheList: visibleAreaInsideTheList\n });\n }\n /**\r\n * Validates the heights of items to be hidden on next render.\r\n * For example, a user could click a \"Show more\" button,\r\n * or an \"Expand YouTube video\" button, which would result\r\n * in the actual height of the list item being different\r\n * from what has been initially measured in `this.itemHeights[i]`,\r\n * if the developer didn't call `.setItemState(i, newState)` and `.onItemHeightDidChange(i)`.\r\n */\n\n\n function validateWillBeHiddenItemHeightsAreAccurate(firstShownItemIndex, lastShownItemIndex) {\n var isValid = true;\n var i = this.getState().firstShownItemIndex;\n\n while (i <= this.getState().lastShownItemIndex) {\n if (i >= firstShownItemIndex && i <= lastShownItemIndex) {// The item's still visible.\n } else {\n // The item will be hidden. Re-measure its height.\n // The rationale is that there could be a situation when an item's\n // height has changed, and the developer has properly added an\n // `.onItemHeightDidChange(i)` call to notify `VirtualScroller`\n // about that change, but at the same time that wouldn't work.\n // For example, suppose there's a list of several items on a page,\n // and those items are in \"minimized\" state (having height 100px).\n // Then, a user clicks an \"Expand all items\" button, and all items\n // in the list are expanded (expanded item height is gonna be 700px).\n // `VirtualScroller` demands that `.onItemHeightDidChange(i)` is called\n // in such cases, and the developer has properly added the code to do that.\n // So, if there were 10 \"minimized\" items visible on a page, then there\n // will be 10 individual `.onItemHeightDidChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightDidChange(i)` call executes, it immediately\n // (\"synchronously\") triggers a re-layout, and that re-layout finds out\n // that now, because the first item is big, it occupies most of the screen\n // space, and only the first 3 items are visible on screen instead of 10,\n // and so it leaves the first 3 items mounted and unmounts the rest 7.\n // Then, after `VirtualScroller` has rerendered, the code returns to\n // where it was executing, and calls `.onItemHeightDidChange(i)` for the\n // second item. It also triggers an immediate re-layout that finds out\n // that only the first 2 items are visible on screen, and it unmounts\n // the third one too. After that, it calls `.onItemHeightDidChange(i)`\n // for the third item, but that item is no longer rendered, so its height\n // can't be measured, and the same's for all the rest of the original 10 items.\n // So, even though the developer has written their code properly, the\n // `VirtualScroller` still ends up having incorrect `itemHeights[]`:\n // `[700px, 700px, 100px, 100px, 100px, 100px, 100px, 100px, 100px, 100px]`\n // while it should have been `700px` for all of them.\n // To work around such issues, every item's height is re-measured before it\n // gets hidden.\n var previouslyMeasuredItemHeight = this.getState().itemHeights[i];\n var actualItemHeight = remeasureItemHeight.call(this, i);\n\n if (actualItemHeight !== previouslyMeasuredItemHeight) {\n if (isValid) {\n log('~ Validate will-be-hidden item heights. ~'); // Update or reset previously calculated layout.\n\n updatePreviouslyCalculatedLayoutOnItemHeightChange.call(this, i, previouslyMeasuredItemHeight, actualItemHeight);\n }\n\n isValid = false;\n warn('Item index', i, 'is no longer visible and will be unmounted. Its height has changed from', previouslyMeasuredItemHeight, 'to', actualItemHeight, 'since it was last measured. This is not necessarily a bug, and could happen, for example, on screen width change, or when there\\'re several `onItemHeightDidChange(i)` calls issued at the same time, and the first one triggers a re-layout before the rest of them have had a chance to be executed.');\n }\n }\n\n i++;\n }\n\n return isValid;\n }\n\n function remeasureItemHeight(i) {\n var _this$getState = this.getState(),\n firstShownItemIndex = _this$getState.firstShownItemIndex;\n\n return this.itemHeights.remeasureItemHeight(i, firstShownItemIndex);\n } // Updates the snapshot of the current layout when an item's height changes.\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n\n\n function updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight) {\n var prevLayout = this.previouslyCalculatedLayout;\n\n if (prevLayout) {\n var heightDifference = newHeight - previousHeight;\n\n if (i < prevLayout.firstShownItemIndex) {\n // Patch `prevLayout`'s `.beforeItemsHeight`.\n prevLayout.beforeItemsHeight += heightDifference;\n } else if (i > prevLayout.lastShownItemIndex) {\n // Could patch `.afterItemsHeight` of `prevLayout` here,\n // if `.afterItemsHeight` property existed in `prevLayout`.\n if (prevLayout.afterItemsHeight !== undefined) {\n prevLayout.afterItemsHeight += heightDifference;\n }\n } else {\n // Patch `prevLayout`'s shown items height.\n prevLayout.shownItemsHeight += newHeight - previousHeight;\n }\n }\n }\n /**\r\n * Returns the list's top offset relative to the scrollable container's top edge.\r\n * @return {number}\r\n */\n\n\n this.getListTopOffsetInsideScrollableContainer = function () {\n var listTopOffset = _this.scrollableContainer.getItemsContainerTopOffset();\n\n if (_this.listTopOffsetWatcher) {\n _this.listTopOffsetWatcher.onListTopOffset(listTopOffset);\n }\n\n return listTopOffset;\n };\n\n this._onItemHeightDidChange = function (i) {\n log('~ On Item Height Did Change was called ~');\n log('Item index', i);\n\n var _this$getState2 = _this.getState(),\n itemHeights = _this$getState2.itemHeights,\n firstShownItemIndex = _this$getState2.firstShownItemIndex,\n lastShownItemIndex = _this$getState2.lastShownItemIndex; // Check if the item is still rendered.\n\n\n if (!(i >= firstShownItemIndex && i <= lastShownItemIndex)) {\n // There could be valid cases when an item is no longer rendered\n // by the time `.onItemHeightDidChange(i)` gets called.\n // For example, suppose there's a list of several items on a page,\n // and those items are in \"minimized\" state (having height 100px).\n // Then, a user clicks an \"Expand all items\" button, and all items\n // in the list are expanded (expanded item height is gonna be 700px).\n // `VirtualScroller` demands that `.onItemHeightDidChange(i)` is called\n // in such cases, and the developer has properly added the code to do that.\n // So, if there were 10 \"minimized\" items visible on a page, then there\n // will be 10 individual `.onItemHeightDidChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightDidChange(i)` call executes, it immediately\n // (\"synchronously\") triggers a re-layout, and that re-layout finds out\n // that now, because the first item is big, it occupies most of the screen\n // space, and only the first 3 items are visible on screen instead of 10,\n // and so it leaves the first 3 items mounted and unmounts the rest 7.\n // Then, after `VirtualScroller` has rerendered, the code returns to\n // where it was executing, and calls `.onItemHeightDidChange(i)` for the\n // second item. It also triggers an immediate re-layout that finds out\n // that only the first 2 items are visible on screen, and it unmounts\n // the third one too. After that, it calls `.onItemHeightDidChange(i)`\n // for the third item, but that item is no longer rendered, so its height\n // can't be measured, and the same's for all the rest of the original 10 items.\n // So, even though the developer has written their code properly, there're\n // still situations when the item could be no longer rendered by the time\n // `.onItemHeightDidChange(i)` gets called.\n return warn('The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when when a developer calls `onItemHeightDidChange(i)` while looping through a batch of items.');\n }\n\n var previousHeight = itemHeights[i];\n\n if (previousHeight === undefined) {\n return reportError(\"\\\"onItemHeightDidChange()\\\" has been called for item index \".concat(i, \" but the item hasn't been rendered before.\"));\n }\n\n log('~ Re-measure item height ~');\n var newHeight;\n\n try {\n newHeight = remeasureItemHeight.call(_this, i);\n } catch (error) {\n // Successfully finishing an `onItemHeightDidChange(i)` call is not considered\n // critical for `VirtualScroller`'s operation, so such errors could be ignored.\n if (error instanceof ItemNotRenderedError) {\n return reportError(\"\\\"onItemHeightDidChange()\\\" has been called for item index \".concat(i, \" but the item is not currently rendered and can't be measured. The exact error was: \").concat(error.message));\n }\n }\n\n log('Previous height', previousHeight);\n log('New height', newHeight);\n\n if (previousHeight !== newHeight) {\n log('~ Item height has changed. Should update layout. ~'); // Update or reset a previously calculated layout with the new item height\n // so that the potential future \"diff\"s based on that \"previously calculated\" layout\n // would be correct.\n //\n // The \"previously calculated layout\" feature is not currently used\n // so this function call doesn't really affect anything.\n //\n\n updatePreviouslyCalculatedLayoutOnItemHeightChange.call(_this, i, previousHeight, newHeight); // Recalculate layout.\n //\n // If the `VirtualScroller` is already waiting for a state update to be rendered,\n // delay `onItemHeightDidChange(i)`'s re-layout until that state update is rendered.\n // The reason is that React `<VirtualScroller/>`'s `onHeightDidChange()` is meant to\n // be called inside `useLayoutEffect()` hook. Due to how React is implemented internally,\n // that might happen in the middle of the currently pending `setState()` operation\n // being applied, resulting in weird \"race condition\" bugs.\n //\n\n if (_this._isActive) {\n if (_this.waitingForRender) {\n log('~ Another state update is already waiting to be rendered. Delay the layout update until then. ~');\n _this.updateLayoutAfterRenderBecauseItemHeightChanged = true;\n } else {\n _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.ITEM_HEIGHT_CHANGED\n });\n }\n } // If there was a request for `setState()` with new `items`, then the changes\n // to `currentState.itemHeights[]` made above in a `remeasureItemHeight()` call\n // would be overwritten when that pending `setState()` call gets applied.\n // To fix that, the updates to current `itemHeights[]` are noted in\n // `this.itemHeightsThatChangedWhileNewItemsWereBeingRendered` variable.\n // That variable is then checked when the `setState()` call with the new `items`\n // has been updated.\n\n\n if (_this.newItemsWillBeRendered) {\n if (!_this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n _this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n _this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(i)] = newHeight;\n }\n }\n };\n\n this.getPrerenderMargin = function () {\n // The list component renders not only the items that're currently visible\n // but also the items that lie within some extra vertical margin (called\n // \"prerender margin\") on top and bottom for future scrolling: this way,\n // there'll be significantly less layout recalculations as the user scrolls,\n // because now it doesn't have to recalculate layout on each scroll event.\n // By default, the \"prerender margin\" is equal to the screen height:\n // this seems to be the optimal value for \"Page Up\" / \"Page Down\" navigation\n // and optimized mouse wheel scrolling (a user is unlikely to continuously\n // scroll past the screen height, because they'd stop to read through\n // the newly visible items first, and when they do stop scrolling, that's\n // when layout gets recalculated).\n var renderAheadMarginRatio = 1; // in scrollable container heights.\n\n return _this.scrollableContainer.getHeight() * renderAheadMarginRatio;\n };\n /**\r\n * Calls `onItemFirstRender()` for items that haven't been\r\n * \"seen\" previously.\r\n * @param {any[]} items\r\n * @param {number[]} itemHeights\r\n * @param {number} firstShownItemIndex\r\n * @param {number} lastShownItemIndex\r\n */\n\n\n this.onBeforeShowItems = function (items, itemHeights, firstShownItemIndex, lastShownItemIndex) {\n if (_this.onItemInitialRender) {\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n if (itemHeights[i] === undefined) {\n _this.onItemInitialRender(items[i]);\n }\n\n i++;\n }\n }\n };\n\n this.measureItemHeightsAndSpacing = function () {\n // Measure \"newly shown\" item heights.\n // Also re-validate already measured items' heights.\n _this.itemHeights.measureItemHeights(_this.getState().firstShownItemIndex, _this.getState().lastShownItemIndex); // Measure item vertical spacing, if required.\n\n\n var verticalSpacing = _this.measureVerticalSpacingIfNotMeasured(); // Return a state update if vertical spacing has been measured.\n // Doesn't set `verticalSpacing: 0` in `state` because it is effectively\n // same as `verticalSpacing: undefined` in terms code behavior and calculations.\n // Not having `verticalSpacing: 0` in `state` just makes the `state` object\n // a bit more cleaner and a bit less cluttered (easier for inspection).\n\n\n if (verticalSpacing && verticalSpacing !== 0) {\n // Return a state update.\n // Sets `verticalSpacing` property in `state`.\n return {\n verticalSpacing: verticalSpacing\n };\n }\n };\n\n this.cancelLayoutTimer = function (_ref3) {\n var stateUpdate = _ref3.stateUpdate;\n\n if (_this.layoutTimer) {\n clearTimeout(_this.layoutTimer);\n _this.layoutTimer = undefined; // Merge state updates.\n\n if (stateUpdate || _this.layoutTimerStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, _this.layoutTimerStateUpdate), stateUpdate);\n _this.layoutTimerStateUpdate = undefined;\n return stateUpdate;\n }\n } else {\n return stateUpdate;\n }\n };\n\n this.scheduleLayoutTimer = function (_ref4) {\n var reason = _ref4.reason,\n stateUpdate = _ref4.stateUpdate;\n _this.layoutTimerStateUpdate = stateUpdate;\n _this.layoutTimer = setTimeout(function () {\n _this.layoutTimerStateUpdate = undefined;\n _this.layoutTimer = undefined;\n\n _this.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }, 0);\n };\n}\nvar SLOW_LAYOUT_DURATION = 15; // in milliseconds.\n//# sourceMappingURL=VirtualScroller.layout.js.map","// https://github.com/lodash/lodash/issues/2340\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\n\n/**\r\n * Copyright (c) 2013-present, Facebook, Inc.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * @providesModule shallowEqual\r\n * @typechecks\r\n * @flow\r\n */\n\n/*eslint-disable no-self-compare */\n'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\r\n * inlined Object.is polyfill to avoid requiring consumers ship their own\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\r\n */\n\nfunction is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n // Added the nonzero y check to make Flow happy, but it is redundant\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n}\n/**\r\n * Performs equality by iterating through keys on an object and returning false\r\n * when any key has values which are not strictly equal between the arguments.\r\n * Returns true when the values of all keys are strictly equal.\r\n */\n\n\nexport default function shallowEqual(objA, objB) {\n if (is(objA, objB)) {\n return true;\n }\n\n if (_typeof(objA) !== 'object' || objA === null || _typeof(objB) !== 'object' || objB === null) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n } // Test for A's keys different from B.\n\n\n for (var i = 0; i < keysA.length; i++) {\n if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false;\n }\n }\n\n return true;\n}\n//# sourceMappingURL=shallowEqual.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport log, { warn, reportError, isDebug } from './utility/debug.js';\nimport getStateSnapshot from './utility/getStateSnapshot.js';\nimport shallowEqual from './utility/shallowEqual.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport { setTbodyPadding } from './DOM/tbody.js';\nexport default function () {\n var _this = this;\n\n /**\r\n * Should be called right after updates to `state` have been rendered.\r\n * @param {object} newState\r\n * @param {object} [prevState]\r\n */\n this._onRender = function (newState, prevState) {\n _this.waitingForRender = false;\n log('~ Rendered ~');\n\n if (isDebug()) {\n log('State', getStateSnapshot(newState));\n }\n\n if (_this.onStateChange) {\n if (!shallowEqual(newState, prevState)) {\n _this.onStateChange(newState);\n }\n } // Update `<tbody/>` `padding`.\n // (`<tbody/>` is different in a way that it can't have `margin`, only `padding`).\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n\n if (_this.tbody) {\n setTbodyPadding(_this.getItemsContainerElement(), newState.beforeItemsHeight, newState.afterItemsHeight);\n } // `this.mostRecentlySetState` checks that state management behavior is correct:\n // that in situations when there're multiple new states waiting to be set,\n // only the latest one gets applied.\n // It keeps the code simpler and prevents possible race condition bugs.\n // For example, `VirtualScroller` keeps track of its latest requested\n // state update in different instance variable flags which assume that\n // only that latest requested state update gets actually applied.\n //\n // This check should also be performed for the initial render in order to\n // guarantee that no potentially incorrect state update goes unnoticed.\n // Incorrect state updates could happen when `VirtualScroller` state\n // is managed externally by passing `getState()`/`updateState()` options.\n //\n // Perform the check only when `this.mostRecentSetStateValue` is defined.\n // `this.mostRecentSetStateValue` is normally gonna be `undefined` at the initial render\n // because the initial state is not set by calling `this.updateState()`.\n // At the same time, it is possible that the initial render is delayed\n // for whatever reason, and `this.updateState()` gets called before the initial render,\n // so `this.mostRecentSetStateValue` could also be defined at the initial render,\n // in which case the check should be performed.\n //\n\n\n if (_this.mostRecentSetStateValue) {\n // \"Shallow equality\" is used here instead of \"strict equality\"\n // because a developer might choose to supply an `updateState()` function\n // rather than a `setState()` function, in which case the `updateState()` function\n // would construct its own state object.\n if (!shallowEqual(newState, _this.mostRecentSetStateValue)) {\n warn('The most recent state that was set', getStateSnapshot(_this.mostRecentSetStateValue));\n reportError('`VirtualScroller` has been rendered with a `state` that is not equal to the most recently set one');\n }\n } // `this.resetStateUpdateFlags()` must be called before calling\n // `this.measureItemHeightsAndSpacing()`.\n\n\n var _resetStateUpdateFlag = resetStateUpdateFlags.call(_this),\n nonMeasuredItemsHaveBeenRendered = _resetStateUpdateFlag.nonMeasuredItemsHaveBeenRendered,\n itemHeightHasChanged = _resetStateUpdateFlag.itemHeightHasChanged,\n widthHasChanged = _resetStateUpdateFlag.widthHasChanged;\n\n var layoutUpdateReason;\n\n if (itemHeightHasChanged) {\n layoutUpdateReason = LAYOUT_REASON.ITEM_HEIGHT_CHANGED;\n }\n\n if (!prevState) {\n if (!layoutUpdateReason) {\n return;\n }\n } // If the `VirtualScroller`, while calculating layout parameters, encounters\n // a not-shown item with a non-measured height, it calls `updateState()` just to\n // render that item first, and then, after the list has been re-rendered, it measures\n // the item's height and then proceeds with calculating the correct layout parameters.\n\n\n if (nonMeasuredItemsHaveBeenRendered) {\n layoutUpdateReason = LAYOUT_REASON.NON_MEASURED_ITEMS_HAVE_BEEN_MEASURED;\n } // If scrollable container width has changed, and it has been re-rendered,\n // then it's time to measure the new item heights and then perform a re-layout\n // with the correctly calculated layout parameters.\n //\n // A re-layout is required because the layout parameters calculated on resize\n // are approximate ones, and the exact item heights aren't known at that point.\n // So on resize, it calls `updateState()` just to re-render the `VirtualScroller`.\n // After it has been re-rendered, it will measure item heights and then calculate\n // correct layout parameters.\n //\n\n\n if (widthHasChanged) {\n layoutUpdateReason = LAYOUT_REASON.VIEWPORT_WIDTH_CHANGED; // Reset measured item heights on viewport width change.\n\n _this.itemHeights.reset(); // Reset `verticalSpacing` (will be re-measured).\n\n\n _this.verticalSpacing = undefined;\n }\n\n if (prevState) {\n var previousItems = prevState.items;\n var newItems = newState.items; // Even if `this.newItemsWillBeRendered` flag is `true`,\n // `newItems` could still be equal to `previousItems`.\n // For example, when `updateState()` calls don't update `state` immediately\n // and a developer first calls `setItems(newItems)` and then calls `setItems(oldItems)`:\n // in that case, `this.newItemsWillBeRendered` flag will be `true` but the actual `items`\n // in state wouldn't have changed due to the first `updateState()` call being overwritten\n // by the second `updateState()` call (that's called \"batching state updates\" in React).\n\n if (newItems !== previousItems) {\n var itemsDiff = _this.getItemsDiff(previousItems, newItems);\n\n if (itemsDiff) {\n // The call to `.onPrepend()` must precede the call to `.measureItemHeights()`\n // which is called in `.onRender()`.\n // `this.itemHeights.onPrepend()` updates `firstMeasuredItemIndex`\n // and `lastMeasuredItemIndex` of `this.itemHeights`.\n var prependedItemsCount = itemsDiff.prependedItemsCount;\n\n _this.itemHeights.onPrepend(prependedItemsCount);\n } else {\n _this.itemHeights.reset();\n }\n\n if (!widthHasChanged) {\n // The call to `this.onNewItemsRendered()` must precede the call to\n // `.measureItemHeights()` which is called in `.onRender()` because\n // `this.onNewItemsRendered()` updates `firstMeasuredItemIndex` and\n // `lastMeasuredItemIndex` of `this.itemHeights` in case of a prepend.\n //\n // If after prepending items the scroll position\n // should be \"restored\" so that there's no \"jump\" of content\n // then it means that all previous items have just been rendered\n // in a single pass, and there's no need to update layout again.\n //\n if (onNewItemsRendered.call(_this, itemsDiff, newState) !== 'SEAMLESS_PREPEND') {\n layoutUpdateReason = LAYOUT_REASON.ITEMS_CHANGED;\n }\n }\n }\n }\n\n var stateUpdate; // Re-measure item heights.\n // Also, measure vertical spacing (if not measured) and fix `<table/>` padding.\n //\n // This block should go after `if (newItems !== previousItems) {}`\n // because `this.itemHeights` can get `.reset()` there, which would\n // discard all the measurements done here, and having currently shown\n // item height measurements is required.\n //\n\n if (prevState && (newState.firstShownItemIndex !== prevState.firstShownItemIndex || newState.lastShownItemIndex !== prevState.lastShownItemIndex || newState.items !== prevState.items) || widthHasChanged) {\n var verticalSpacingStateUpdate = _this.measureItemHeightsAndSpacing();\n\n if (verticalSpacingStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), verticalSpacingStateUpdate);\n }\n } // Clean up \"before resize\" item heights and adjust the scroll position accordingly.\n // Calling `this.beforeResize.cleanUpBeforeResizeItemHeights()` might trigger\n // a `this.updateState()` call but that wouldn't matter because `beforeResize`\n // properties have already been modified directly in `state` (a hacky technique)\n\n\n var cleanedUpBeforeResize = _this.beforeResize.cleanUpBeforeResizeItemHeights();\n\n if (cleanedUpBeforeResize !== undefined) {\n var scrollBy = cleanedUpBeforeResize.scrollBy,\n beforeResize = cleanedUpBeforeResize.beforeResize;\n log('Correct scroll position by', scrollBy);\n\n _this.scroll.scrollByY(scrollBy);\n\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), {}, {\n beforeResize: beforeResize\n });\n }\n\n if (!_this._isActive) {\n _this._afterRenderStateUpdateThatWasStopped = stateUpdate;\n return;\n }\n\n if (layoutUpdateReason) {\n updateStateRightAfterRender.call(_this, {\n stateUpdate: stateUpdate,\n reason: layoutUpdateReason\n });\n } else if (stateUpdate) {\n _this.updateState(stateUpdate);\n } else {\n log('~ Finished Layout ~');\n }\n }; // After a new set of items has been rendered:\n //\n // * Restores scroll position when using `preserveScrollPositionOnPrependItems`\n // and items have been prepended.\n //\n // * Applies any \"pending\" `itemHeights` updates — those ones that happened\n // while an asynchronous `updateState()` call in `setItems()` was pending.\n //\n // * Either creates or resets the snapshot of the current layout.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n\n\n function onNewItemsRendered(itemsDiff, newLayout) {\n // If it's an \"incremental\" update.\n if (itemsDiff) {\n var prependedItemsCount = itemsDiff.prependedItemsCount,\n appendedItemsCount = itemsDiff.appendedItemsCount;\n\n var _this$getState = this.getState(),\n itemHeights = _this$getState.itemHeights,\n itemStates = _this$getState.itemStates; // See if any items' heights changed while new items were being rendered.\n\n\n if (this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n for (var _i = 0, _Object$keys = Object.keys(this.itemHeightsThatChangedWhileNewItemsWereBeingRendered); _i < _Object$keys.length; _i++) {\n var i = _Object$keys[_i];\n itemHeights[prependedItemsCount + Number(i)] = this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[i];\n }\n } // See if any items' states changed while new items were being rendered.\n\n\n if (this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n for (var _i2 = 0, _Object$keys2 = Object.keys(this.itemStatesThatChangedWhileNewItemsWereBeingRendered); _i2 < _Object$keys2.length; _i2++) {\n var _i3 = _Object$keys2[_i2];\n itemStates[prependedItemsCount + Number(_i3)] = this.itemStatesThatChangedWhileNewItemsWereBeingRendered[_i3];\n }\n }\n\n if (prependedItemsCount === 0) {\n // Adjust `this.previouslyCalculatedLayout`.\n if (this.previouslyCalculatedLayout) {\n if (this.previouslyCalculatedLayout.firstShownItemIndex === newLayout.firstShownItemIndex && this.previouslyCalculatedLayout.lastShownItemIndex === newLayout.lastShownItemIndex) {// `this.previouslyCalculatedLayout` stays the same.\n // `firstShownItemIndex` / `lastShownItemIndex` didn't get changed in `setItems()`,\n // so `beforeItemsHeight` and `shownItemsHeight` also stayed the same.\n } else {\n warn('Unexpected (non-matching) \"firstShownItemIndex\" or \"lastShownItemIndex\" encountered in \"onRender()\" after appending items');\n warn('Previously calculated layout', this.previouslyCalculatedLayout);\n warn('New layout', newLayout);\n this.previouslyCalculatedLayout = undefined;\n }\n }\n\n return 'SEAMLESS_APPEND';\n } else {\n if (this.listHeightMeasurement.hasSnapshot()) {\n if (newLayout.firstShownItemIndex === 0) {\n // Restore (adjust) scroll position.\n log('~ Restore Scroll Position ~');\n var listBottomOffsetChange = this.listHeightMeasurement.getListBottomOffsetChange({\n beforeItemsHeight: newLayout.beforeItemsHeight\n });\n this.listHeightMeasurement.reset();\n\n if (listBottomOffsetChange) {\n log('Scroll down by', listBottomOffsetChange);\n this.scroll.scrollByY(listBottomOffsetChange);\n } else {\n log('Scroll position hasn\\'t changed');\n } // Create new `this.previouslyCalculatedLayout`.\n\n\n if (this.previouslyCalculatedLayout) {\n if (this.previouslyCalculatedLayout.firstShownItemIndex === 0 && this.previouslyCalculatedLayout.lastShownItemIndex === newLayout.lastShownItemIndex - prependedItemsCount) {\n this.previouslyCalculatedLayout = {\n beforeItemsHeight: 0,\n shownItemsHeight: this.previouslyCalculatedLayout.shownItemsHeight + listBottomOffsetChange,\n firstShownItemIndex: 0,\n lastShownItemIndex: newLayout.lastShownItemIndex\n };\n } else {\n warn('Unexpected (non-matching) \"firstShownItemIndex\" or \"lastShownItemIndex\" encountered in \"onRender()\" after prepending items');\n warn('Previously calculated layout', this.previouslyCalculatedLayout);\n warn('New layout', newLayout);\n this.previouslyCalculatedLayout = undefined;\n }\n }\n\n return 'SEAMLESS_PREPEND';\n } else {\n warn(\"Unexpected \\\"firstShownItemIndex\\\" \".concat(newLayout.firstShownItemIndex, \" encountered in \\\"onRender()\\\" after prepending items. Expected 0.\"));\n }\n }\n }\n } // Reset `this.previouslyCalculatedLayout` in any case other than\n // SEAMLESS_PREPEND or SEAMLESS_APPEND.\n\n\n this.previouslyCalculatedLayout = undefined;\n }\n\n function updateStateRightAfterRender(_ref) {\n var reason = _ref.reason,\n stateUpdate = _ref.stateUpdate;\n\n // In React, `setTimeout()` is used to prevent a React error:\n // \"Maximum update depth exceeded.\n // This can happen when a component repeatedly calls\n // `.updateState()` inside `componentWillUpdate()` or `componentDidUpdate()`.\n // React limits the number of nested updates to prevent infinite loops.\"\n if (this._useTimeoutInRenderLoop) {\n // Cancel a previously scheduled re-layout.\n stateUpdate = this.cancelLayoutTimer({\n stateUpdate: stateUpdate\n }); // Schedule a new re-layout.\n\n this.scheduleLayoutTimer({\n reason: reason,\n stateUpdate: stateUpdate\n });\n } else {\n this.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }\n }\n\n function resetStateUpdateFlags() {\n // Read and reset `this.widthHasChanged` flag.\n //\n // If `this.widthHasChanged` flag was reset after calling\n // `this.measureWidthHeightsAndSpacingAndUpdateTablePadding()`\n // then there would be a bug because\n // `this.measureWidthHeightsAndSpacingAndUpdateTablePadding()`\n // calls `this.updateState({ verticalSpacing })` which calls\n // `this.onRender()` immediately, so `this.widthHasChanged`\n // flag wouldn't be reset by that time and would trigger things\n // like `this.itemHeights.reset()` a second time.\n //\n // So, instead read the value of `this.widthHasChanged` flag\n // and reset it right away to prevent any such potential bugs.\n //\n var widthHasChanged = Boolean(this.widthHasChanged); //\n // Reset `this.widthHasChanged` flag.\n\n this.widthHasChanged = undefined; // Read `this.firstNonMeasuredItemIndex` flag.\n\n var nonMeasuredItemsHaveBeenRendered = this.firstNonMeasuredItemIndex !== undefined;\n\n if (nonMeasuredItemsHaveBeenRendered) {\n log('Non-measured item index', this.firstNonMeasuredItemIndex);\n } // Reset `this.firstNonMeasuredItemIndex` flag.\n\n\n this.firstNonMeasuredItemIndex = undefined; // Reset `this.newItemsWillBeRendered` flag.\n\n this.newItemsWillBeRendered = undefined; // Reset `this.itemHeightsThatChangedWhileNewItemsWereBeingRendered`.\n\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = undefined; // Reset `this.itemStatesThatChangedWhileNewItemsWereBeingRendered`.\n\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered = undefined; // Reset `this.updateLayoutAfterRenderBecauseItemHeightChanged`.\n\n var itemHeightHasChanged = this.updateLayoutAfterRenderBecauseItemHeightChanged;\n this.updateLayoutAfterRenderBecauseItemHeightChanged = undefined;\n return {\n nonMeasuredItemsHaveBeenRendered: nonMeasuredItemsHaveBeenRendered,\n itemHeightHasChanged: itemHeightHasChanged,\n widthHasChanged: widthHasChanged\n };\n }\n}\n//# sourceMappingURL=VirtualScroller.onRender.js.map","import log from './utility/debug.js';\nexport default function () {\n var _this = this;\n\n this.onContainerResize = function () {\n // Reset \"previously calculated layout\".\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n _this.previouslyCalculatedLayout = undefined; // Cancel any potential scheduled scroll position restoration.\n\n _this.listHeightMeasurement.reset(); // Get the most recent items count.\n // If there're a \"pending\" `setItems()` call then use the items count from that call\n // instead of using the count of currently shown `items` from `state`.\n // A `setItems()` call is \"pending\" when `updateState()` operation is \"asynchronous\", that is\n // when `updateState()` calls aren't applied immediately, like in React.\n\n\n var itemsCount = _this.newItemsWillBeRendered ? _this.newItemsWillBeRendered.count : _this.getState().itemHeights.length; // If layout values have been calculated as a result of a \"pending\" `setItems()` call,\n // then don't discard those new layout values and use them instead of the ones from `state`.\n //\n // A `setItems()` call is \"pending\" when `updateState()` operation is \"asynchronous\", that is\n // when `updateState()` calls aren't applied immediately, like in React.\n //\n\n var layout = _this.newItemsWillBeRendered ? _this.newItemsWillBeRendered.layout : _this.getState(); // Update `VirtualScroller` state.\n\n var newState = {\n scrollableContainerWidth: _this.scrollableContainer.getWidth(),\n // This state update should also overwrite all the `state` properties\n // that are also updated in the \"on scroll\" handler (`getShownItemIndexes()`):\n //\n // * `firstShownItemIndex`\n // * `lastShownItemIndex`\n // * `beforeItemsHeight`\n // * `afterItemsHeight`\n //\n // That's because this `updateState()` update has a higher priority\n // than that of the \"on scroll\" handler, so it should overwrite\n // any potential state changes dispatched by the \"on scroll\" handler.\n //\n // All these properties might have changed, but they're not\n // recalculated here becase they'll be recalculated after\n // this new state is applied (rendered).\n //\n firstShownItemIndex: layout.firstShownItemIndex,\n lastShownItemIndex: layout.lastShownItemIndex,\n beforeItemsHeight: layout.beforeItemsHeight,\n afterItemsHeight: layout.afterItemsHeight,\n // Reset item heights, because if scrollable container's width (or height)\n // has changed, then the list width (or height) most likely also has changed,\n // and also some CSS `@media()` rules might have been added or removed.\n // So re-render the list entirely.\n itemHeights: new Array(itemsCount),\n columnsCount: _this.getActualColumnsCountForState(),\n // Re-measure vertical spacing after render because new CSS styles\n // might be applied for the new window width.\n verticalSpacing: undefined\n };\n var firstShownItemIndex = layout.firstShownItemIndex,\n lastShownItemIndex = layout.lastShownItemIndex; // Get the `columnsCount` for the new window width.\n\n var newColumnsCount = _this.getActualColumnsCount(); // Re-calculate `firstShownItemIndex` and `lastShownItemIndex`\n // based on the new `columnsCount` so that the whole row is visible.\n\n\n var newFirstShownItemIndex = Math.floor(firstShownItemIndex / newColumnsCount) * newColumnsCount;\n var newLastShownItemIndex = Math.min(Math.ceil((lastShownItemIndex + 1) / newColumnsCount) * newColumnsCount, itemsCount) - 1; // Potentially update `firstShownItemIndex` if it needs to be adjusted in order to\n // correspond to the new `columnsCount`.\n\n if (newFirstShownItemIndex !== firstShownItemIndex) {\n log('Columns Count changed from', _this.getState().columnsCount || 1, 'to', newColumnsCount);\n log('First Shown Item Index needs to change from', firstShownItemIndex, 'to', newFirstShownItemIndex);\n } // Always rewrite `firstShownItemIndex` and `lastShownItemIndex`\n // as part of the `state` update, even if it hasn't been modified.\n //\n // The reason is that there could be two subsequent `onResize()` calls:\n // the first one could be user resizing the window to half of its width,\n // resulting in an \"asynchronous\" `updateState()` call, and then, before that\n // `updateState()` call is applied, a second resize event happens when the user\n // has resized the window back to its original width, meaning that the\n // `columnsCount` is back to its original value.\n // In that case, the final `newFirstShownItemIndex` will be equal to the\n // original `firstShownItemIndex` that was in `state` before the user\n // has started resizing the window, so, in the end, `state.firstShownItemIndex`\n // property wouldn't have changed, but it still has to be part of the final\n // state update in order to overwrite the previous update of `firstShownItemIndex`\n // property that has been scheduled to be applied in state after the first resize\n // happened.\n //\n\n\n newState.firstShownItemIndex = newFirstShownItemIndex;\n newState.lastShownItemIndex = newLastShownItemIndex;\n\n var verticalSpacing = _this.getVerticalSpacing();\n\n var columnsCount = _this.getColumnsCount(); // `beforeResize` is always overwritten in `state` here.\n // (once it has started being tracked in `state`)\n\n\n if (_this.shouldDiscardBeforeResizeItemHeights() || newFirstShownItemIndex === 0) {\n if (_this.beforeResize.shouldIncludeBeforeResizeValuesInState()) {\n newState.beforeResize = undefined;\n }\n } // Snapshot \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no \"content jumping\".\n else {\n // Keep \"before resize\" values in order to preserve the currently\n // shown items' vertical position on screen so that there's no\n // \"content jumping\". These \"before resize\" values will be discarded\n // when (if) the user scrolls back to the top of the list.\n newState.beforeResize = {\n verticalSpacing: verticalSpacing,\n columnsCount: columnsCount,\n itemHeights: _this.beforeResize.snapshotBeforeResizeItemHeights({\n firstShownItemIndex: firstShownItemIndex,\n newFirstShownItemIndex: newFirstShownItemIndex,\n newColumnsCount: newColumnsCount\n })\n };\n } // `this.widthHasChanged` tells `VirtualScroller` that it should\n // temporarily stop other updates (like \"on scroll\" updates) and wait\n // for the new `state` to be applied, after which the `onRender()`\n // function will clear this flag and perform a re-layout.\n //\n // A re-layout is required because the layout parameters calculated above\n // are approximate ones, and the exact item heights aren't known at this point.\n // So the `updateState()` call below is just to re-render the `VirtualScroller`.\n // After it has been re-rendered, it will measure item heights and then calculate\n // correct layout parameters.\n //\n\n\n _this.widthHasChanged = {\n stateUpdate: newState\n }; // Rerender.\n\n _this.updateState(newState);\n }; // Returns whether \"before resize\" item heights should be discarded\n // as a result of calling `setItems()` with a new set of items\n // when an asynchronous `updateState()` call inside that function\n // hasn't been applied yet.\n //\n // If `setItems()` update was an \"incremental\" one and no items\n // have been prepended, then `firstShownItemIndex` is preserved,\n // and all items' heights before it should be kept in order to\n // preserve the top offset of the first shown item so that there's\n // no \"content jumping\".\n //\n // If `setItems()` update was an \"incremental\" one but there're\n // some prepended items, then it means that now there're new items\n // with unknown heights at the top, so the top offset of the first\n // shown item won't be preserved because there're no \"before resize\"\n // heights of those items.\n //\n // If `setItems()` update was not an \"incremental\" one, then don't\n // attempt to restore previous item heights after a potential window\n // width change because all item heights have been reset.\n //\n\n\n this.shouldDiscardBeforeResizeItemHeights = function () {\n if (_this.newItemsWillBeRendered) {\n var _this$newItemsWillBeR = _this.newItemsWillBeRendered,\n prepend = _this$newItemsWillBeR.prepend,\n replace = _this$newItemsWillBeR.replace;\n return prepend || replace;\n }\n };\n}\n//# sourceMappingURL=VirtualScroller.onContainerResize.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport log, { isDebug } from './utility/debug.js';\nimport getItemsDiff from './getItemsDiff.js';\nimport fillArray from './utility/fillArray.js';\nexport default function () {\n var _this = this;\n\n this.getItemsCount = function () {\n return _this.getState().items.length;\n };\n /**\r\n * Updates `items`. For example, can prepend or append new items to the list.\r\n * @param {any[]} newItems\r\n * @param {boolean} [options.preserveScrollPositionOnPrependItems] — Set to `true` to enable \"restore scroll position after prepending items\" feature (could be useful when implementing \"Show previous items\" button).\r\n */\n\n\n this._setItems = function (newItems) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var _this$getState = _this.getState(),\n previousItems = _this$getState.items; // Even if `newItems` are equal to `this.state.items`,\n // still perform a `updateState()` call, because, if `updateState()` calls\n // were \"asynchronous\", there could be a situation when a developer\n // first calls `setItems(newItems)` and then `setItems(oldItems)`:\n // if this function did `return` `if (newItems === this.state.items)`\n // then `updateState({ items: newItems })` would be scheduled as part of\n // `setItems(newItems)` call, but the subsequent `setItems(oldItems)` call\n // wouldn't do anything resulting in `newItems` being set as a result,\n // and that wouldn't be what the developer intended.\n\n\n var _this$getState2 = _this.getState(),\n itemStates = _this$getState2.itemStates;\n\n var _ref = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate : _this.getState(),\n itemHeights = _ref.itemHeights;\n\n log('~ Update items ~');\n var layoutUpdate;\n var itemsUpdateInfo; // Compare the new items to the current items.\n\n var itemsDiff = _this.getItemsDiff(previousItems, newItems); // See if it's an \"incremental\" items update.\n\n\n if (itemsDiff) {\n var _ref2 = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate : _this.getState(),\n firstShownItemIndex = _ref2.firstShownItemIndex,\n lastShownItemIndex = _ref2.lastShownItemIndex,\n beforeItemsHeight = _ref2.beforeItemsHeight,\n afterItemsHeight = _ref2.afterItemsHeight;\n\n var shouldRestoreScrollPosition = firstShownItemIndex === 0 && ( // `preserveScrollPosition` option name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n options.preserveScrollPositionOnPrependItems || options.preserveScrollPosition);\n var prependedItemsCount = itemsDiff.prependedItemsCount,\n appendedItemsCount = itemsDiff.appendedItemsCount;\n var shouldResetGridLayout;\n layoutUpdate = _this.layout.getLayoutUpdateForItemsDiff({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, {\n prependedItemsCount: prependedItemsCount,\n appendedItemsCount: appendedItemsCount\n }, {\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount(),\n shouldRestoreScrollPosition: shouldRestoreScrollPosition,\n onResetGridLayout: function onResetGridLayout() {\n return shouldResetGridLayout = true;\n }\n });\n\n if (prependedItemsCount > 0) {\n log('Prepend', prependedItemsCount, 'items');\n itemHeights = new Array(prependedItemsCount).concat(itemHeights);\n itemStates = fillArray(new Array(prependedItemsCount), function (i) {\n return _this.getInitialItemState(newItems[i]);\n }).concat(itemStates); // Restore scroll position after prepending items (if requested).\n\n if (shouldRestoreScrollPosition) {\n log('Will restore scroll position');\n\n _this.listHeightMeasurement.snapshotListHeightBeforeAddingNewItems({\n previousItems: previousItems,\n newItems: newItems,\n prependedItemsCount: prependedItemsCount\n }); // \"Seamless prepend\" scenario doesn't result in a re-layout,\n // so if any \"non measured item\" is currently pending,\n // it doesn't get reset and will be handled after `state` is updated.\n\n\n if (_this.firstNonMeasuredItemIndex !== undefined) {\n _this.firstNonMeasuredItemIndex += prependedItemsCount;\n }\n } else {\n log('Reset layout');\n\n if (shouldResetGridLayout) {\n log('Reason: Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', _this.getActualColumnsCount()); // Reset item heights because the whole grid is going to be rebalanced\n // and re-rendered in a different configuration.\n\n itemHeights = new Array(newItems.length);\n } else {\n // Reset layout because none of the prepended items have been measured.\n log('Reason: Prepended items\\' heights are unknown');\n }\n\n layoutUpdate = _this.layout.getInitialLayoutValues({\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount()\n }); // Unschedule a potentially scheduled layout update\n // after measuring a previously non-measured item\n // because the list will be re-layout anyway\n // due to the new items being set.\n\n _this.firstNonMeasuredItemIndex = undefined;\n }\n }\n\n if (appendedItemsCount > 0) {\n log('Append', appendedItemsCount, 'items');\n itemHeights = itemHeights.concat(new Array(appendedItemsCount));\n itemStates = itemStates.concat(fillArray(new Array(appendedItemsCount), function (i) {\n return _this.getInitialItemState(newItems[prependedItemsCount + previousItems.length + i]);\n }));\n }\n\n itemsUpdateInfo = {\n prepend: prependedItemsCount > 0,\n append: appendedItemsCount > 0\n };\n } else {\n log('Items have changed, and', itemsDiff ? 'a re-layout from scratch has been requested.' : 'it\\'s not a simple append and/or prepend.', 'Rerender the entire list from scratch.');\n log('Previous items', previousItems);\n log('New items', newItems); // Reset item heights and item states.\n\n itemHeights = new Array(newItems.length);\n itemStates = fillArray(new Array(newItems.length), function (i) {\n return _this.getInitialItemState(newItems[i]);\n });\n layoutUpdate = _this.layout.getInitialLayoutValues({\n itemsCount: newItems.length,\n columnsCount: _this.getActualColumnsCount()\n }); // Unschedule a potentially scheduled layout update\n // after measuring a previously non-measured item\n // because the list will be re-layout from scratch\n // due to the new items being set.\n\n _this.firstNonMeasuredItemIndex = undefined; // Also reset any potential pending scroll position restoration.\n // For example, imagine a developer first called `.setItems(incrementalItemsUpdate)`\n // and then called `.setItems(differentItems)` and there was no state update\n // in between those two calls. This could happen because state updates aren't\n // required to be \"synchronous\". On other words, calling `this.updateState()`\n // doesn't necessarily mean that the state is applied immediately.\n // Imagine also that such \"delayed\" state updates could be batched,\n // like they do in React inside event handlers (though that doesn't apply to this case):\n // https://github.com/facebook/react/issues/10231#issuecomment-316644950\n // If `this.listHeightMeasurement` wasn't reset on `.setItems(differentItems)`\n // and if the second `this.updateState()` call overwrites the first one\n // then it would attempt to restore scroll position in a situation when\n // it should no longer do that. Hence the reset here.\n\n _this.listHeightMeasurement.reset();\n\n itemsUpdateInfo = {\n replace: true\n };\n }\n\n log('~ Update state ~'); // const layoutValuesAfterUpdate = {\n // \t...this.getState(),\n // \t...layoutUpdate\n // }\n // `layoutUpdate` is equivalent to `layoutValuesAfterUpdate` because\n // `layoutUpdate` contains all the relevant properties.\n\n log('First shown item index', layoutUpdate.firstShownItemIndex);\n log('Last shown item index', layoutUpdate.lastShownItemIndex);\n log('Before items height', layoutUpdate.beforeItemsHeight);\n log('After items height (actual or estimated)', layoutUpdate.afterItemsHeight); // Optionally preload items to be rendered.\n //\n // `layoutUpdate` is equivalent to `layoutValuesAfterUpdate` because\n // `layoutUpdate` contains all the relevant properties.\n //\n\n _this.onBeforeShowItems(newItems, itemHeights, layoutUpdate.firstShownItemIndex, layoutUpdate.lastShownItemIndex); // `this.newItemsWillBeRendered` signals that new `items` are being rendered,\n // and that `VirtualScroller` should temporarily stop all other updates.\n //\n // `this.newItemsWillBeRendered` is cleared in `onRender()`.\n //\n // The values in `this.newItemsWillBeRendered` are used, for example,\n // in `.onContainerResize()` handler in order to not break state consistency when\n // state updates are \"asynchronous\" (delayed) and there's a window resize event\n // in between calling `updateState()` below and that call actually being applied.\n //\n\n\n _this.newItemsWillBeRendered = _objectSpread(_objectSpread({}, itemsUpdateInfo), {}, {\n count: newItems.length,\n // `layoutUpdate` now contains all layout-related properties, even if those that\n // didn't change. So `firstShownItemIndex` is always in `this.newItemsWillBeRendered`.\n layout: layoutUpdate\n }); // `layoutUpdate` now contains all layout-related properties, even if those that\n // didn't change. So this part is no longer relevant.\n //\n // // If `firstShownItemIndex` is gonna be modified as a result of setting new items\n // // then keep that \"new\" `firstShownItemIndex` in order for it to be used by\n // // `onResize()` handler when it calculates \"new\" `firstShownItemIndex`\n // // based on the new columns count (corresponding to the new window width).\n // if (layoutUpdate.firstShownItemIndex !== undefined) {\n // \tthis.newItemsWillBeRendered = {\n // \t\t...this.newItemsWillBeRendered,\n // \t\tfirstShownItemIndex: layoutUpdate.firstShownItemIndex\n // \t}\n // }\n // Update `VirtualScroller` state.\n //\n // This state update should overwrite all the `state` properties\n // that are also updated in the \"on scroll\" handler (`getShownItemIndexes()`):\n //\n // * `firstShownItemIndex`\n // * `lastShownItemIndex`\n // * `beforeItemsHeight`\n // * `afterItemsHeight`\n //\n // That's because this `updateState()` update has a higher priority\n // than that of the \"on scroll\" handler, so it should overwrite\n // any potential state changes dispatched by the \"on scroll\" handler.\n //\n\n var newState = _objectSpread(_objectSpread({}, layoutUpdate), {}, {\n items: newItems,\n itemStates: itemStates,\n itemHeights: itemHeights\n }); // Introduced `shouldIncludeBeforeResizeValuesInState()` getter just to prevent\n // cluttering `state` with `beforeResize: undefined` property if `beforeResize`\n // hasn't ever been set in `state` previously.\n\n\n if (_this.beforeResize.shouldIncludeBeforeResizeValuesInState()) {\n if (_this.shouldDiscardBeforeResizeItemHeights()) {\n // Reset \"before resize\" item heights because now there're new items prepended\n // with unknown heights, or completely new items with unknown heights, so\n // `beforeItemsHeight` value won't be preserved anyway.\n newState.beforeResize = undefined;\n } else {\n // Overwrite `beforeResize` property in `state` even if it wasn't modified\n // because state updates could be \"asynchronous\" and in that case there could be\n // some previous `updateState()` call from some previous `setItems()` call that\n // hasn't yet been applied, and that previous call might have scheduled setting\n // `state.beforeResize` property to `undefined` in order to reset it, but this\n // next `updateState()` call might not require resetting `state.beforeResize` property\n // so it should undo resetting it by simply overwriting it with its normal value.\n newState.beforeResize = _this.widthHasChanged ? _this.widthHasChanged.stateUpdate.beforeResize : _this.getState().beforeResize;\n }\n } // `newState` should also overwrite all `state` properties that're updated in `onResize()`\n // because `setItems()`'s state updates always overwrite `onResize()`'s state updates.\n // (The least-priority ones are `onScroll()` state updates, but those're simply skipped\n // if there's a pending `setItems()` or `onResize()` update).\n //\n // `state` property exceptions:\n //\n // `verticalSpacing` property is not updated here because it's fine setting it to\n // `undefined` in `onResize()` — it will simply be re-measured after the component re-renders.\n //\n // `columnsCount` property is also not updated here because by definition it's only\n // updated in `onResize()`.\n // Render.\n\n\n _this._isSettingNewItems = true;\n\n _this.updateState(newState);\n };\n\n this.getItemsDiff = function (previousItems, newItems) {\n return getItemsDiff(previousItems, newItems, _this.isItemEqual);\n };\n}\n//# sourceMappingURL=VirtualScroller.items.js.map","/**\r\n * Checks whether it's an \"incremental\" items update, and returns the \"diff\".\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @return {object} [diff]\r\n */\nexport default function getItemsDiff(previousItems, newItems, isEqual) {\n var firstPreviousItemIndex = -1;\n var lastPreviousItemIndex = -1;\n\n if (previousItems.length > 0) {\n firstPreviousItemIndex = findInArray(newItems, previousItems[0], isEqual);\n\n if (firstPreviousItemIndex >= 0) {\n if (arePreviousItemsPreserved(previousItems, newItems, firstPreviousItemIndex, isEqual)) {\n lastPreviousItemIndex = firstPreviousItemIndex + previousItems.length - 1;\n }\n }\n }\n\n var isIncrementalUpdate = firstPreviousItemIndex >= 0 && lastPreviousItemIndex >= 0;\n\n if (isIncrementalUpdate) {\n return {\n prependedItemsCount: firstPreviousItemIndex,\n appendedItemsCount: newItems.length - (lastPreviousItemIndex + 1)\n };\n }\n}\n\nfunction arePreviousItemsPreserved(previousItems, newItems, offset, isEqual) {\n // Check each item of the `previousItems` to determine\n // whether it's an \"incremental\" items update.\n // (an update when items are prepended or appended)\n var i = 0;\n\n while (i < previousItems.length) {\n if (newItems.length <= offset + i || !isEqual(newItems[offset + i], previousItems[i])) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\n\nfunction findInArray(array, element, isEqual) {\n var i = 0;\n\n while (i < array.length) {\n if (isEqual(array[i], element)) {\n return i;\n }\n\n i++;\n }\n\n return -1;\n}\n//# sourceMappingURL=getItemsDiff.js.map","import { supportsTbody, BROWSER_NOT_SUPPORTED_ERROR } from './DOM/tbody.js';\nimport DOMEngine from './DOM/Engine.js';\nimport Layout, { LAYOUT_REASON } from './Layout.js';\nimport ScrollableContainerResizeHandler from './ScrollableContainerResizeHandler.js';\nimport BeforeResize from './BeforeResize.js';\nimport Scroll from './Scroll.js';\nimport ListHeightMeasurement from './ListHeightMeasurement.js';\nimport ItemHeights from './ItemHeights.js';\nimport log, { warn, isDebug, reportError } from './utility/debug.js';\nimport createStateHelpers from './VirtualScroller.state.js';\nimport createVerticalSpacingHelpers from './VirtualScroller.verticalSpacing.js';\nimport createColumnsHelpers from './VirtualScroller.columns.js';\nimport createLayoutHelpers from './VirtualScroller.layout.js';\nimport createOnRenderHelpers from './VirtualScroller.onRender.js';\nimport createScrollableContainerResizeHelpers from './VirtualScroller.onContainerResize.js';\nimport createItemsHelpers from './VirtualScroller.items.js';\n/**\r\n * @param {function} getItemsContainerElement — Returns the container DOM `Element`.\r\n * @param {any[]} items — The list of items.\r\n * @param {Object} [options] — See README.md.\r\n * @return {VirtualScroller}\r\n */\n\nexport default function VirtualScrollerConstructor(getItemsContainerElement, items) {\n var _this = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var render = options.render,\n state = options.state,\n _options$getInitialIt = options.getInitialItemState,\n getInitialItemState = _options$getInitialIt === void 0 ? function () {} : _options$getInitialIt,\n onStateChange = options.onStateChange,\n initialScrollPosition = options.initialScrollPosition,\n onScrollPositionChange = options.onScrollPositionChange,\n scrollableContainer = options.scrollableContainer,\n _options$measureItems = options.measureItemsBatchSize,\n measureItemsBatchSize = _options$measureItems === void 0 ? 50 : _options$measureItems,\n getColumnsCount = options.getColumnsCount,\n getItemId = options.getItemId,\n tbody = options.tbody,\n estimatedItemHeight = options.estimatedItemHeight,\n getEstimatedVisibleItemRowsCount = options.getEstimatedVisibleItemRowsCount,\n onItemInitialRender = options.onItemInitialRender,\n onItemFirstRender = options.onItemFirstRender,\n _useTimeoutInRenderLoop = options._useTimeoutInRenderLoop,\n _waitForScrollingToStop = options._waitForScrollingToStop,\n engine = options.engine;\n var bypass = options.bypass,\n getEstimatedItemHeight = options.getEstimatedItemHeight,\n getScrollableContainer = options.getScrollableContainer;\n log('~ Initialize ~'); // Could support non-DOM rendering engines.\n // For example, React Native, `<canvas/>`, etc.\n\n this.engine = engine || DOMEngine;\n\n if (!getEstimatedItemHeight && typeof estimatedItemHeight === 'number') {\n getEstimatedItemHeight = function getEstimatedItemHeight() {\n return estimatedItemHeight;\n };\n } // `scrollableContainer` option is deprecated.\n // Use `getScrollableContainer()` option instead.\n\n\n if (!getScrollableContainer && scrollableContainer) {\n getScrollableContainer = function getScrollableContainer() {\n return scrollableContainer;\n };\n } // Sometimes, when `new VirtualScroller()` instance is created,\n // `getItemsContainerElement()` might not be ready to return the \"container\" DOM Element yet\n // (for example, because it's not rendered yet). That's the reason why it's a getter function.\n // For example, in React `<VirtualScroller/>` component, a `VirtualScroller`\n // instance is created in the React component's `constructor()`, and at that time\n // the container Element is not yet available. The container Element is available\n // in `componentDidMount()`, but `componentDidMount()` is not executed on server,\n // which would mean that React `<VirtualScroller/>` wouldn't render at all\n // on server side, while with the `getItemsContainerElement()` approach, on server side,\n // it still \"renders\" a list with a predefined amount of items in it by default.\n // (`initiallyRenderedItemsCount`, or `1`).\n\n\n this.getItemsContainerElement = getItemsContainerElement; // if (prerenderMargin === undefined) {\n // \t// Renders items which are outside of the screen by this \"prerender margin\".\n // \t// Is the screen height by default: seems to be the optimal value\n // \t// for \"Page Up\" / \"Page Down\" navigation and optimized mouse wheel scrolling.\n // \tprerenderMargin = this.scrollableContainer ? this.scrollableContainer.getHeight() : 0\n // }\n\n if (options.getState || options.setState) {\n throw new Error('[virtual-scroller] `getState`/`setState` options usage has changed in the new version. See the readme for more details.');\n } // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n\n if (tbody) {\n if (this.engine !== DOMEngine) {\n throw new Error('[virtual-scroller] `tbody` option is only supported for DOM rendering engine');\n }\n\n log('~ <tbody/> detected ~');\n this.tbody = true;\n\n if (!supportsTbody()) {\n log('~ <tbody/> not supported ~');\n reportError(BROWSER_NOT_SUPPORTED_ERROR);\n bypass = true;\n }\n }\n\n if (bypass) {\n log('~ \"bypass\" mode ~');\n } // In `bypass` mode, `VirtualScroller` doesn't wait\n // for the user to scroll down to render all items:\n // instead, it renders all items right away, as if\n // the list is rendered without using `VirtualScroller`.\n // It was added just to measure how much is the\n // performance difference between using a `VirtualScroller`\n // and not using a `VirtualScroller`.\n // It turned out that unmounting large React component trees\n // is a very long process, so `VirtualScroller` does seem to\n // make sense when used in a React application.\n\n\n this.bypass = bypass; // this.bypassBatchSize = bypassBatchSize || 10\n // Using `setTimeout()` in render loop is a workaround\n // for avoiding a React error message:\n // \"Maximum update depth exceeded.\n // This can happen when a component repeatedly calls\n // `.setState()` inside `componentWillUpdate()` or `componentDidUpdate()`.\n // React limits the number of nested updates to prevent infinite loops.\"\n\n this._useTimeoutInRenderLoop = _useTimeoutInRenderLoop;\n\n if (getItemId) {\n this.isItemEqual = function (a, b) {\n return getItemId(a) === getItemId(b);\n };\n } else {\n this.isItemEqual = function (a, b) {\n return a === b;\n };\n }\n\n if (onItemInitialRender) {\n this.onItemInitialRender = onItemInitialRender;\n } // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n else if (onItemFirstRender) {\n this.onItemInitialRender = function (item) {\n warn('`onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.');\n\n var _this$getState = _this.getState(),\n items = _this$getState.items;\n\n var i = items.indexOf(item); // The `item` could also be non-found due to the inconsistency bug:\n // The reason is that `i` can be non-consistent with the `items`\n // passed to `<VirtualScroller/>` in React due to `updateState()` not being\n // instanteneous: when new `items` are passed to `<VirtualScroller/>`,\n // `VirtualScroller.updateState({ items })` is called, and if `onItemFirstRender(i)`\n // is called after the aforementioned `updateState()` is called but before it finishes,\n // `i` would point to an index in \"previous\" `items` while the application\n // would assume that `i` points to an index in the \"new\" `items`,\n // resulting in an incorrect item being assumed by the application\n // or even in an \"array index out of bounds\" error.\n\n if (i >= 0) {\n onItemFirstRender(i);\n }\n };\n } // If initial `state` is passed then use `items` from `state`\n // instead of the `items` argument.\n\n\n if (state) {\n items = state.items;\n }\n\n log('Items count', items.length);\n\n if (getEstimatedItemHeight) {\n log('Estimated item height', getEstimatedItemHeight());\n }\n\n createStateHelpers.call(this, {\n state: state,\n getInitialItemState: getInitialItemState,\n onStateChange: onStateChange,\n render: render,\n items: items\n });\n createVerticalSpacingHelpers.call(this);\n createColumnsHelpers.call(this, {\n getColumnsCount: getColumnsCount\n });\n createLayoutHelpers.call(this);\n createOnRenderHelpers.call(this);\n createScrollableContainerResizeHelpers.call(this);\n createItemsHelpers.call(this);\n createHelpers.call(this, {\n getScrollableContainer: getScrollableContainer,\n getEstimatedItemHeight: getEstimatedItemHeight,\n getEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize: measureItemsBatchSize,\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n waitForScrollingToStop: _waitForScrollingToStop\n });\n\n if (state) {\n // Initialize `ItemHeights` from previously measured `state.itemHeights`.\n this.itemHeights.readItemHeightsFromState(state); // Initialize some `BeforeResize` internal flags from a previously saved state.\n\n this.beforeResize.initializeFromState(state);\n }\n}\n\nfunction createHelpers(_ref) {\n var _this2 = this;\n\n var getScrollableContainer = _ref.getScrollableContainer,\n getEstimatedItemHeight = _ref.getEstimatedItemHeight,\n getEstimatedVisibleItemRowsCount = _ref.getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize = _ref.measureItemsBatchSize,\n initialScrollPosition = _ref.initialScrollPosition,\n onScrollPositionChange = _ref.onScrollPositionChange,\n waitForScrollingToStop = _ref.waitForScrollingToStop;\n this.itemsContainer = this.engine.createItemsContainer(this.getItemsContainerElement); // If the items \"container\" element is mounted at this stage,\n // remove any accidental text nodes from it (like whitespace).\n //\n // Also, this guards against cases when someone accidentally tries\n // using `VirtualScroller` on a non-empty element.\n //\n\n if (this.getItemsContainerElement()) {\n this.itemsContainer.clear();\n }\n\n this.scrollableContainer = this.engine.createScrollableContainer(getScrollableContainer, this.getItemsContainerElement); // Create `ItemHeights` instance.\n\n this.itemHeights = new ItemHeights({\n container: this.itemsContainer,\n getItemHeight: function getItemHeight(i) {\n return _this2.getState().itemHeights[i];\n },\n setItemHeight: function setItemHeight(i, height) {\n return _this2.getState().itemHeights[i] = height;\n }\n });\n this.layout = new Layout({\n bypass: this.bypass,\n getInitialEstimatedItemHeight: getEstimatedItemHeight,\n getInitialEstimatedVisibleItemRowsCount: getEstimatedVisibleItemRowsCount,\n measureItemsBatchSize: measureItemsBatchSize,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this2.getPrerenderMargin();\n },\n getVerticalSpacing: function getVerticalSpacing() {\n return _this2.getVerticalSpacing();\n },\n getVerticalSpacingBeforeResize: function getVerticalSpacingBeforeResize() {\n return _this2.getVerticalSpacingBeforeResize();\n },\n getColumnsCount: function getColumnsCount() {\n return _this2.getColumnsCount();\n },\n getColumnsCountBeforeResize: function getColumnsCountBeforeResize() {\n return _this2.getState().beforeResize && _this2.getState().beforeResize.columnsCount;\n },\n getItemHeight: function getItemHeight(i) {\n return _this2.getState().itemHeights[i];\n },\n getItemHeightBeforeResize: function getItemHeightBeforeResize(i) {\n return _this2.getState().beforeResize && _this2.getState().beforeResize.itemHeights[i];\n },\n getBeforeResizeItemsCount: function getBeforeResizeItemsCount() {\n return _this2.getState().beforeResize ? _this2.getState().beforeResize.itemHeights.length : 0;\n },\n getAverageItemHeight: function getAverageItemHeight() {\n return _this2.itemHeights.getAverage();\n },\n // `this.scrollableContainer` is gonna be `undefined` during server-side rendering.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/30\n getMaxVisibleAreaHeight: function getMaxVisibleAreaHeight() {\n return _this2.scrollableContainer && _this2.scrollableContainer.getHeight();\n },\n //\n // The \"previously calculated layout\" feature is not currently used.\n //\n // The current layout snapshot could be stored as a \"previously calculated layout\" variable\n // so that it could theoretically be used when calculating new layout incrementally\n // rather than from scratch, which would be an optimization.\n //\n getPreviouslyCalculatedLayout: function getPreviouslyCalculatedLayout() {\n return _this2.previouslyCalculatedLayout;\n }\n });\n this.scrollableContainerResizeHandler = new ScrollableContainerResizeHandler({\n bypass: this.bypass,\n getWidth: function getWidth() {\n return _this2.scrollableContainer.getWidth();\n },\n getHeight: function getHeight() {\n return _this2.scrollableContainer.getHeight();\n },\n listenForResize: function listenForResize(listener) {\n return _this2.scrollableContainer.onResize(listener);\n },\n onResizeStart: function onResizeStart() {\n log('~ Scrollable container resize started ~');\n _this2._isResizing = true;\n },\n onResizeStop: function onResizeStop() {\n log('~ Scrollable container resize finished ~');\n _this2._isResizing = undefined;\n },\n onNoChange: function onNoChange() {\n // There might have been some missed `this.onUpdateShownItemIndexes()` calls\n // due to setting `this._isResizing` flag to `true` during the resize.\n // So, update shown item indexes just in case.\n _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_SIZE_UNCHANGED\n });\n },\n onHeightChange: function onHeightChange() {\n return _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_HEIGHT_CHANGED\n });\n },\n onWidthChange: function onWidthChange(prevWidth, newWidth) {\n log('~ Scrollable container width changed from', prevWidth, 'to', newWidth, '~');\n\n _this2.onContainerResize();\n }\n });\n this.scroll = new Scroll({\n bypass: this.bypass,\n scrollableContainer: this.scrollableContainer,\n itemsContainer: this.itemsContainer,\n waitForScrollingToStop: waitForScrollingToStop,\n onScroll: function onScroll() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n delayed = _ref2.delayed;\n\n _this2.onUpdateShownItemIndexes({\n reason: delayed ? LAYOUT_REASON.STOPPED_SCROLLING : LAYOUT_REASON.SCROLL\n });\n },\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n isImmediateLayoutScheduled: function isImmediateLayoutScheduled() {\n return Boolean(_this2.layoutTimer);\n },\n hasNonRenderedItemsAtTheTop: function hasNonRenderedItemsAtTheTop() {\n return _this2.getState().firstShownItemIndex > 0;\n },\n hasNonRenderedItemsAtTheBottom: function hasNonRenderedItemsAtTheBottom() {\n return _this2.getState().lastShownItemIndex < _this2.getItemsCount() - 1;\n },\n getLatestLayoutVisibleArea: function getLatestLayoutVisibleArea() {\n return _this2.latestLayoutVisibleArea;\n },\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this2.getPrerenderMargin();\n }\n });\n this.listHeightMeasurement = new ListHeightMeasurement({\n itemsContainer: this.itemsContainer,\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer\n });\n\n if (this.engine.watchListTopOffset) {\n this.listTopOffsetWatcher = this.engine.watchListTopOffset({\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n onListTopOffsetChange: function onListTopOffsetChange(_ref3) {\n var reason = _ref3.reason;\n return _this2.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.TOP_OFFSET_CHANGED\n });\n }\n });\n }\n\n this.beforeResize = new BeforeResize({\n getState: this.getState,\n getVerticalSpacing: this.getVerticalSpacing,\n getColumnsCount: this.getColumnsCount\n });\n}\n//# sourceMappingURL=VirtualScroller.constructor.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport VirtualScrollerConstructor from './VirtualScroller.constructor.js';\nimport { hasTbodyStyles, addTbodyStyles } from './DOM/tbody.js';\nimport { LAYOUT_REASON } from './Layout.js';\nimport log, { warn } from './utility/debug.js';\n\nvar VirtualScroller = /*#__PURE__*/function () {\n /**\r\n * @param {function} getItemsContainerElement — Returns the container DOM `Element`.\r\n * @param {any[]} items — The list of items.\r\n * @param {Object} [options] — See README.md.\r\n * @return {VirtualScroller}\r\n */\n function VirtualScroller(getItemsContainerElement, items) {\n var _this = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n _classCallCheck(this, VirtualScroller);\n\n _defineProperty(this, \"stop\", function () {\n if (!_this._isActive) {\n throw new Error('[virtual-scroller] Can\\'t stop a `VirtualScroller` that hasn\\'t been started');\n }\n\n _this._isActive = false;\n log('~ Stop ~');\n\n _this.scrollableContainerResizeHandler.stop();\n\n _this.scroll.stop(); // Stop `ListTopOffsetWatcher` if it has been started.\n // There seems to be no need to restart `ListTopOffsetWatcher`.\n // It's mainly a hacky workaround for development mode anyway.\n\n\n if (_this.listTopOffsetWatcher && _this.listTopOffsetWatcher.isStarted()) {\n _this.listTopOffsetWatcher.stop();\n } // Cancel any scheduled layout.\n\n\n _this.cancelLayoutTimer({});\n });\n\n _defineProperty(this, \"updateLayout\", function () {\n _this.hasToBeStarted();\n\n _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.MANUAL\n });\n });\n\n _defineProperty(this, \"onRender\", function () {\n _this._onRender(_this.getState(), _this.previousState);\n });\n\n VirtualScrollerConstructor.call(this, getItemsContainerElement, items, options);\n }\n /**\r\n * Should be invoked after a \"container\" DOM Element is mounted (inserted into the DOM tree).\r\n */\n\n\n _createClass(VirtualScroller, [{\n key: \"start\",\n value: function start() {\n if (this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` has already been started');\n } // If has been stopped previously.\n\n\n var isRestart = this._isActive === false;\n\n if (!isRestart) {\n this.waitingForRender = true; // If no custom state storage has been configured, use the default one.\n // Also sets the initial state.\n\n if (!this._usesCustomStateStorage) {\n this.useDefaultStateStorage();\n } // If `render()` function parameter was passed,\n // perform an initial render.\n\n\n if (this._render) {\n this._render(this.getState());\n }\n }\n\n if (isRestart) {\n log('~ Start (restart) ~');\n } else {\n log('~ Start ~');\n } // `this._isActive = true` should be placed somewhere at the start of this function.\n\n\n this._isActive = true; // Reset `ListHeightMeasurement` just in case it has some \"leftover\" state.\n\n this.listHeightMeasurement.reset(); // Reset `_isResizing` flag just in case it has some \"leftover\" value.\n\n this._isResizing = undefined; // Reset `_isSettingNewItems` flag just in case it has some \"leftover\" value.\n\n this._isSettingNewItems = undefined; // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (this.tbody) {\n if (!hasTbodyStyles(this.getItemsContainerElement())) {\n addTbodyStyles(this.getItemsContainerElement());\n }\n } // If there was a pending \"after render\" state update that didn't get applied\n // because the `VirtualScroller` got stopped, then apply that pending \"after render\"\n // state update now. Such state update could include properties like:\n // * A `verticalSpacing` that has been measured in `onRender()`.\n // * A cleaned-up `beforeResize` object that was cleaned-up in `onRender()`.\n\n\n var stateUpdate = this._afterRenderStateUpdateThatWasStopped;\n this._afterRenderStateUpdateThatWasStopped = undefined; // Reset `this.verticalSpacing` so that it re-measures it in cases when\n // the `VirtualScroller` was previously stopped and is now being restarted.\n // The rationale is that a previously captured inter-item vertical spacing\n // can't be \"trusted\" in a sense that the user might have resized the window\n // after the previous `state` has been snapshotted.\n // If the user has resized the window, then changing window width might have\n // activated different CSS `@media()` \"queries\" resulting in a potentially different\n // vertical spacing after the restart.\n // If it's not a restart then `this.verticalSpacing` is `undefined` anyway.\n\n this.verticalSpacing = undefined;\n var verticalSpacingStateUpdate = this.measureItemHeightsAndSpacing();\n\n if (verticalSpacingStateUpdate) {\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), verticalSpacingStateUpdate);\n }\n\n this.scrollableContainerResizeHandler.start();\n this.scroll.start(); // If `scrollableContainerWidth` hasn't been measured yet,\n // measure it and write it to state.\n\n if (this.getState().scrollableContainerWidth === undefined) {\n var scrollableContainerWidth = this.scrollableContainer.getWidth();\n stateUpdate = _objectSpread(_objectSpread({}, stateUpdate), {}, {\n scrollableContainerWidth: scrollableContainerWidth\n });\n } else {\n // Reset layout:\n // * If the scrollable container width has changed while stopped.\n // * If the restored state was calculated for another scrollable container width.\n var newWidth = this.scrollableContainer.getWidth();\n var prevWidth = this.getState().scrollableContainerWidth;\n\n if (newWidth !== prevWidth) {\n log('~ Scrollable container width changed from', prevWidth, 'to', newWidth, '~'); // The pending state update (if present) won't be applied in this case.\n // That's ok because such state update could currently only originate in\n // `this.onContainerResize()` function. Therefore, alling `this.onContainerResize()` again\n // would rewrite all those `stateUpdate` properties anyway, so they're not passed.\n\n return this.onContainerResize();\n }\n } // If the `VirtualScroller` uses custom (external) state storage, then\n // check if the columns count has changed between calling `.getInitialState()`\n // and `.start()`. If it has, perform a re-layout \"from scratch\".\n\n\n if (this._usesCustomStateStorage) {\n var columnsCount = this.getActualColumnsCount();\n var columnsCountFromState = this.getState().columnsCount || 1;\n\n if (columnsCount !== columnsCountFromState) {\n return this.onContainerResize();\n }\n } // Re-calculate layout and re-render the list.\n // Do that even if when an initial `state` parameter, containing layout values,\n // has been passed. The reason is that the `state` parameter can't be \"trusted\"\n // in a way that it could have been snapshotted for another window width and\n // the user might have resized their window since then.\n\n\n this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.STARTED,\n stateUpdate: stateUpdate\n });\n } // Could be passed as a \"callback\" parameter, so bind it to `this`.\n\n }, {\n key: \"hasToBeStarted\",\n value: function hasToBeStarted() {\n if (!this._isActive) {\n throw new Error('[virtual-scroller] `VirtualScroller` hasn\\'t been started');\n }\n } // Bind it to `this` because this function could hypothetically be passed\n // as a \"callback\" parameter.\n\n }, {\n key: \"getItemScrollPosition\",\n value:\n /**\r\n * Returns the items's top offset relative to the scrollable container's top edge.\r\n * @param {number} i — Item index\r\n * @return {[number]} Returns the item's scroll Y position. Returns `undefined` if any of the previous items haven't been rendered yet.\r\n */\n function getItemScrollPosition(i) {\n var itemTopOffsetInList = this.layout.getItemTopOffset(i);\n\n if (itemTopOffsetInList === undefined) {\n return;\n }\n\n return this.getListTopOffsetInsideScrollableContainer() + itemTopOffsetInList;\n }\n /**\r\n * @deprecated\r\n * `.onItemHeightChange()` has been renamed to `.onItemHeightDidChange()`.\r\n */\n\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n warn('`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`');\n this.onItemHeightDidChange(i);\n }\n /**\r\n * Forces a re-measure of an item's height.\r\n * @param {number} i — Item index\r\n */\n\n }, {\n key: \"onItemHeightDidChange\",\n value: function onItemHeightDidChange(i) {\n // See the comments in the `setItemState()` function below for the rationale\n // on why the `hasToBeStarted()` check was commented out.\n // this.hasToBeStarted()\n this._onItemHeightDidChange(i);\n }\n /**\r\n * Updates an item's state in `state.itemStates[]`.\r\n * @param {number} i — Item index\r\n * @param {any} i — Item's new state\r\n */\n\n }, {\n key: \"setItemState\",\n value: function setItemState(i, newItemState) {\n // There is an issue in React 18.2.0 when `useInsertionEffect()` doesn't run twice\n // on mount unlike `useLayoutEffect()` in \"strict\" mode. That causes a bug in a React\n // implementation of the `virtual-scroller`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/33\n // https://github.com/facebook/react/issues/26320\n // A workaround for that bug is ignoring the second-initial run of the effects at mount.\n //\n // But in that case, if an `ItemComponent` calls `setItemState()` in `useLayoutEffect()`,\n // it could result in a bug.\n //\n // Consider a type of `useLayoutEffect()` that skips the initial mount:\n // `useLayoutEffectSkipInitialMount()`.\n // Suppose that effect is written in such a way that it only skips the first call of itself.\n // In that case, if React is run in \"strict\" mode, the effect will no longer work as expected\n // and it won't actually skip the initial mount and will be executed during the second initial run.\n // But the `VirtualScroller` itself has already implemented a workaround that prevents\n // its hooks from running twice on mount. This means that `useVirtualScrollerStartStop()`\n // of the React component would have already stopped the `VirtualScroller` by the time\n // `ItemComponent`'s incorrectly-behaving `useLayoutEffectSkipInitialMount()` effect is run,\n // resulting in an error: \"`VirtualScroller` hasn't been started\".\n //\n // The log when not in \"strict\" mode would be:\n //\n // * `useLayoutEffect()` is run in `ItemComponent` — skips the initial run.\n // * `useLayoutEffect()` is run in `useVirtualScrollerStartStop()`. It starts the `VirtualScroller`.\n // * Some dependency property gets updated inside `ItemComponent`.\n // * `useLayoutEffect()` is run in `ItemComponent` — no longer skips. Calls `setItemState()`.\n // * The `VirtualScroller` is started so it handles `setState()` correctly.\n //\n // The log when in \"strict\" mode would be:\n //\n // * `useLayoutEffect()` is run in `ItemComponent` — skips the initial run.\n // * `useLayoutEffect()` is run in `useVirtualScrollerStartStop()`. It starts the `VirtualScroller`.\n // * `useLayoutEffect()` is unmounted in `useVirtualScrollerStartStop()`. It stops the `VirtualScroller`.\n // * `useLayoutEffect()` is unmounted in `ItemComponent` — does nothing.\n // * `useLayoutEffect()` is run the second time in `ItemComponent` — no longer skips. Calls `setItemState()`.\n // * The `VirtualScroller` is stopped so it throws an error: \"`VirtualScroller` hasn't been started\".\n //\n // For that reason, the requirement of the `VirtualScroller` to be started was commented out.\n // Commenting it out wouldn't result in any potential bugs because the code would work correctly\n // in both cases.\n // this.hasToBeStarted()\n this._setItemState(i, newItemState);\n } // (deprecated)\n // Use `.setItemState()` method name instead.\n\n }, {\n key: \"onItemStateChange\",\n value: function onItemStateChange(i, newItemState) {\n this.setItemState(i, newItemState);\n }\n /**\r\n * Updates `items`. For example, can prepend or append new items to the list.\r\n * @param {any[]} newItems\r\n * @param {boolean} [options.preserveScrollPositionOnPrependItems] — Set to `true` to enable \"restore scroll position after prepending items\" feature (could be useful when implementing \"Show previous items\" button).\r\n */\n\n }, {\n key: \"setItems\",\n value: function setItems(newItems) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.hasToBeStarted();\n return this._setItems(newItems, options);\n }\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\n//# sourceMappingURL=VirtualScroller.js.map","var _excluded = [\"onMount\", \"onItemUnmount\"];\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport VirtualScrollerCore from '../VirtualScroller.js';\nimport log, { warn } from '../utility/debug.js';\nimport px from '../utility/px.js';\n\nvar VirtualScroller = /*#__PURE__*/function () {\n function VirtualScroller(itemsContainerElement, _items, renderItem) {\n var _this = this;\n\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n _classCallCheck(this, VirtualScroller);\n\n _defineProperty(this, \"render\", function (state, prevState) {\n var items = state.items,\n firstShownItemIndex = state.firstShownItemIndex,\n lastShownItemIndex = state.lastShownItemIndex,\n beforeItemsHeight = state.beforeItemsHeight,\n afterItemsHeight = state.afterItemsHeight; // log('~ On state change ~')\n // log('Previous state', prevState)\n // log('New state', state)\n // Set container padding top and bottom.\n // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n // `this.virtualScroller` hasn't been initialized yet at this stage,\n // so using `this.tbody` instead of `this.virtualScroller.tbody`.\n\n if (!_this.tbody) {\n _this.container.style.paddingTop = px(beforeItemsHeight);\n _this.container.style.paddingBottom = px(afterItemsHeight);\n } // Perform an intelligent \"diff\" re-render if the `items` are the same.\n\n\n var diffRender = prevState && items === prevState.items && items.length > 0; // Remove no longer visible items from the DOM.\n\n if (diffRender) {\n // Decrement instead of increment here because\n // `this.container.removeChild()` changes indexes.\n var _i = prevState.lastShownItemIndex;\n\n while (_i >= prevState.firstShownItemIndex) {\n if (_i >= firstShownItemIndex && _i <= lastShownItemIndex) {// The item is still visible.\n } else {\n log('DOM: Remove element for item index', _i); // The item is no longer visible. Remove it.\n\n _this.unmountItem(_this.container.childNodes[_i - prevState.firstShownItemIndex]);\n }\n\n _i--;\n }\n } else {\n log('DOM: Rerender the list from scratch');\n\n while (_this.container.firstChild) {\n _this.unmountItem(_this.container.firstChild);\n }\n } // Add newly visible items to the DOM.\n\n\n var shouldPrependItems = diffRender;\n var prependBeforeItemElement = shouldPrependItems && _this.container.firstChild;\n var i = firstShownItemIndex;\n\n while (i <= lastShownItemIndex) {\n if (diffRender && i >= prevState.firstShownItemIndex && i <= prevState.lastShownItemIndex) {\n // The item is already being rendered.\n // Next items will be appended rather than prepended.\n if (shouldPrependItems) {\n shouldPrependItems = false;\n }\n } else {\n var item = _this.renderItem(items[i]);\n\n if (shouldPrependItems) {\n log('DOM: Prepend element for item index', i); // Append `item` to `this.container` before the retained items.\n\n _this.container.insertBefore(item, prependBeforeItemElement);\n } else {\n log('DOM: Append element for item index', i); // Append `item` to `this.container`.\n\n _this.container.appendChild(item);\n }\n }\n\n i++;\n }\n });\n\n _defineProperty(this, \"onUnmount\", function () {\n warn('`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead.');\n\n _this.stop();\n });\n\n _defineProperty(this, \"destroy\", function () {\n warn('`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead.');\n\n _this.stop();\n });\n\n _defineProperty(this, \"stop\", function () {\n _this.virtualScroller.stop();\n });\n\n _defineProperty(this, \"start\", function () {\n _this.virtualScroller.start();\n });\n\n this.container = itemsContainerElement;\n this.renderItem = renderItem;\n\n var onMount = options.onMount,\n onItemUnmount = options.onItemUnmount,\n restOptions = _objectWithoutProperties(options, _excluded);\n\n this.onItemUnmount = onItemUnmount;\n this.tbody = this.container.tagName === 'TBODY';\n this.virtualScroller = new VirtualScrollerCore(function () {\n return _this.container;\n }, _items, _objectSpread(_objectSpread({}, restOptions), {}, {\n render: this.render,\n tbody: this.tbody\n }));\n this.start(); // `onMount()` option is deprecated due to no longer being used.\n // If someone thinks there's a valid use case for it, create an issue.\n\n if (onMount) {\n onMount();\n }\n }\n\n _createClass(VirtualScroller, [{\n key: \"unmountItem\",\n value: function unmountItem(itemElement) {\n this.container.removeChild(itemElement);\n\n if (this.onItemUnmount) {\n this.onItemUnmount(itemElement);\n }\n }\n /**\r\n * @deprecated\r\n * `.onItemHeightChange()` has been renamed to `.onItemHeightDidChange()`.\r\n */\n\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n warn('`.onItemHeightChange(i)` method was renamed to `.onItemHeightDidChange(i)`');\n this.onItemHeightDidChange(i);\n }\n }, {\n key: \"onItemHeightDidChange\",\n value: function onItemHeightDidChange(i) {\n this.virtualScroller.onItemHeightDidChange(i);\n }\n }, {\n key: \"setItemState\",\n value: function setItemState(i, newState) {\n this.virtualScroller.setItemState(i, newState);\n }\n /**\r\n * @deprecated\r\n * `.updateItems()` has been renamed to `.setItems()`.\r\n */\n\n }, {\n key: \"updateItems\",\n value: function updateItems(newItems, options) {\n warn('`.updateItems()` method was renamed to `.setItems(i)`');\n this.setItems(newItems, options);\n }\n }, {\n key: \"setItems\",\n value: function setItems(newItems, options) {\n this.virtualScroller.setItems(newItems, options);\n }\n /*\r\n getItemCoordinates(i) {\r\n return this.virtualScroller.getItemCoordinates(i)\r\n }\r\n */\n\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\n//# sourceMappingURL=VirtualScroller.js.map"],"names":["px","number","toFixed","BROWSER_NOT_SUPPORTED_ERROR","supportsTbody","window","document","documentMode","TBODY_CLASS_NAME","STYLE_ELEMENT_ID","_typeof","obj","Symbol","iterator","constructor","prototype","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_possibleConstructorReturn","self","call","TypeError","ReferenceError","_assertThisInitialized","_wrapNativeSuper","Class","_cache","Map","undefined","fn","Function","toString","indexOf","has","get","set","Wrapper","_construct","arguments","_getPrototypeOf","this","create","value","_setPrototypeOf","Parent","args","_isNativeReflectConstruct","Reflect","construct","a","push","apply","instance","bind","sham","Proxy","Boolean","valueOf","e","o","p","setPrototypeOf","__proto__","getPrototypeOf","ItemNotRenderedError","_Error","subClass","superClass","_inherits","Derived","hasNativeReflectConstruct","Constructor","protoProps","staticProps","_super","result","Super","NewTarget","_ref","renderedElementIndex","renderedElementsCount","message","_classCallCheck","_ref2","concat","getDefaultMessage","Error","ItemsContainer","getElement","childNodes","_getNthRenderedItemElement","getBoundingClientRect","top","height","firstChild","removeChild","ScrollableContainerNotReadyError","_createSuper","_createClass","ScrollableContainer","getItemsContainerElement","scrollTop","scrollY","scrollTo","offsetWidth","offsetHeight","scrollableContainerTop","scrollableContainerBorderTopWidth","clientTop","getScrollY","onScrollListener","element","addEventListener","removeEventListener","_onResize","unobserve","ResizeObserver","resizeObserver","entries","observe","unlistenGlobalResize","addGlobalResizeListener","itemsContainerElement","ScrollableWindowContainer","_ScrollableContainer","pageYOffset","innerWidth","innerHeight","borderTopWidth","body","_onResize2","onResize","onResizeListener","fullscreenElement","contains","getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","module","exports","process","hr","uptime","Date","getTime","root","global","vendors","suffix","raf","caf","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","round","handle","raf_1","object","requestAnimationFrame","cancelAnimationFrame","cancel","delay","startedAt","animationFrame","tick","clear","clearTimeout","timeout","ListTopOffsetWatcher","getListTopOffset","onListTopOffsetChange","listTopOffset","listTopOffsetInsideScrollableContainer","start","_isActive","watchListTopOffset","watchListTopOffsetTimer","_this","check","DOMEngine","createItemsContainer","createScrollableContainer","getScrollableContainerElement","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","minLen","n","name","test","_unsupportedIterableToArray","_nonIterableSpread","len","arr2","log","isDebug","_console","_len","_key","console","warn","_console2","_len2","_key2","warningsAreErrors","reportError","error","_console3","_len3","_key3","_len4","_key4","createError","join","catchError","getGlobalVariable","debug","ownKeys","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","Layout","bypass","getInitialEstimatedItemHeight","getInitialEstimatedVisibleItemRowsCount","measureItemsBatchSize","getPrerenderMargin","getVerticalSpacing","getVerticalSpacingBeforeResize","getColumnsCount","getColumnsCountBeforeResize","getItemHeight","getItemHeightBeforeResize","getBeforeResizeItemsCount","getAverageItemHeight","getMaxVisibleAreaHeight","getPreviouslyCalculatedLayout","getValue","defaultValue","firstShownItemIndex","lastShownItemIndex","itemsCount","columnsCount","beforeStart","getLastShownItemIndex","getInitialLastShownItemIndex","getInitialLayoutValueWithFallback","beforeItemsHeight","afterItemsHeight","_ref3","estimatedRowsCount","getEstimatedRowsCountForHeight","isNaN","min","estimatedItemHeight","getEstimatedItemHeight","verticalSpacing","ceil","averageItemHeight","_ref4","_ref5","_ref6","prependedItemsCount","appendedItemsCount","shouldRestoreScrollPosition","onResetGridLayout","shownItemsCountBeforeItemsUpdate","afterItemsCount","_ref7","nonMeasuredAreaHeight","indexOfTheFirstItemInTheRow","itemsCountToRenderForMeasurement","Infinity","firstNonMeasuredItemIndex","_ref8","visibleAreaInsideTheList","indexes","_getShownItemIndex","fromIndex","findFirstShownItemIndex","getNonVisibleListShownItemIndexes","_indexes","findLastShownItemIndex","parameters","beforeResize","beforeResizeItemsCount","_this$_getShownItemIn","notFound","beforeResizeItemsHeight","_firstShownItemIndex","_lastShownItemIndex","_columnsCount","floor","currentRowFirstItemIndex","verticalSpacingAfterCurrentRow","currentRowHeight","columnIndex","itemHeight","getItemNotMeasuredIndexes","bottom","itemsHeightFromFirstRowToThisRow","rowStepsIntoVisibleAreaTop","rowStepsOutOfVisibleAreaBottomOrIsAtTheBorder","layout","beforeItemsCount","_ref9","getBeforeItemsHeight","rowHeight","topOffsetInsideScrollableContainer","beforeResizeRowsCount","maxBeforeResizeRowsCount","beforeResizeRowIndex","itemRowIndex","rowIndex","_rowHeight","LAYOUT_REASON","ScrollableContainerResizeHandler","getWidth","getHeight","listenForResize","onResizeStart","onResizeStop","onHeightChange","onWidthChange","onNoChange","isActive","prevScrollableContainerWidth","width","prevScrollableContainerHeight","func","interval","onStart","onStop","Promise","resolve","debounce","SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL","unlistenResize","BeforeResize","getState","state","_includesBeforeResizeInState","_this$getState","itemHeights","newlyShownItemRowsHeight","prevFirstReMeasuredItemsRowIndex","newlyShownItemsToIndex","cleanedUpBeforeResizeItemRowsHeight","maxParticipatingBeforeResizeItemsCount","participatingBeforeResizeItemRowsCount","k","firstDroppedBeforeResizeItemIndex","lastDroppedBeforeResizeItemIndex","splice","scrollBy","newFirstShownItemIndex","newColumnsCount","_this$getState2","prevBeforeResize","prevBeforeResizeItemsCount","prevBeforeResizeBeforeItemsHeight","prevBeforeResizeItemRowsCount","newBeforeResizeAdditionalBeforeItemsHeight","_rowHeight2","newBeforeResizeBeforeItemsHeight","newBeforeResizeBeforeItemRowsCount","fill","equalizeItemHeights","maxItemsCount","Scroll","scrollableContainer","itemsContainer","onScroll","initialScrollPosition","onScrollPositionChange","isImmediateLayoutScheduled","hasNonRenderedItemsAtTheTop","hasNonRenderedItemsAtTheBottom","getLatestLayoutVisibleArea","onScrolledToTop","waitForScrollingToStop","scrollByY","scrollToY","ignoreScrollEvents","cancelOnStopScrollingTimer","forceUpdate","shouldCallOnScrollListenerWhenStopsScrolling","watchOnStopScrolling","stopListeningToScroll","onStopScrollingTimer","_this2","delayed","ON_STOP_SCROLLING_INACTIVE_PERIOD","ListHeightMeasurement","previousItems","newItems","_snapshot","itemIndex","itemTopOffset","getNthRenderedItemTopOffset","_this$_snapshot","ItemHeights","container","setItemHeight","_get","_set","reset","measuredItemsHeight","firstMeasuredItemIndex","lastMeasuredItemIndex","getNthRenderedItemHeight","nonPreviouslyMeasuredItemIndexes","previousFirstMeasuredItemIndex","previousLastMeasuredItemIndex","firstMeasuredItemIndexHasBeenUpdated","_measureItemHeight","previousHeight","_height","count","fillArray","array","getItem","getStateSnapshot","stateSnapshot","itemStates","createStateHelpers","initialState","getInitialItemState","onStateChange","render","initialItems","items","defaultGetState","defaultSetInitialState","newState","defaultSetState","stateUpdate","previousState","onRender","getInitialStateFromScratch","getInitialLayoutState","getRestoredState","stateColumnsCount","isStateColumnsCountMismatch","cleanUpBeforeResizeState","getActualColumnsCount","_this$layout$getIniti","getInitialLayoutValues","onBeforeShowItems","getActualColumnsCountForState","_render","_setItemState","newItemState","JSON","stringify","newItemsWillBeRendered","itemStatesThatChangedWhileNewItemsWereBeingRendered","String","_getState","updateState","_isSettingNewItems","waitingForRender","mostRecentSetStateValue","_setState","getInitialState","useState","setState","_usesCustomStateStorage","useDefaultStateStorage","setInitialState","createVerticalSpacingHelpers","measureVerticalSpacing","renderedItemsCount","firstShownRowTopOffset","firstShownRowHeight","measureVerticalSpacingIfNotMeasured","createColumnsHelpers","scrollableContainerArgument","createLayoutHelpers","updateShownItemIndexes","_getShownItemIndexes$","getShownItemIndexes","shownItemsHeight","listHeightMeasurement","hasSnapshot","getAnchorItemIndex","validateWillBeHiddenItemHeightsAreAccurate","getAfterItemsHeight","getItemsCount","layoutDuration","SLOW_LAYOUT_DURATION","getAverage","previouslyCalculatedLayout","getCoordinatesOfVisibleAreaInsideTheList","visibleAreaBounds","scroll","getVisibleAreaBounds","latestLayoutVisibleArea","getListTopOffsetInsideScrollableContainer","isValid","previouslyMeasuredItemHeight","actualItemHeight","remeasureItemHeight","updatePreviouslyCalculatedLayoutOnItemHeightChange","newHeight","prevLayout","heightDifference","onUpdateShownItemIndexes","reason","skip","widthHasChanged","_isResizing","cancelScheduledLayout","cancelLayoutTimer","getItemsContainerTopOffset","listTopOffsetWatcher","onListTopOffset","_onItemHeightDidChange","updateLayoutAfterRenderBecauseItemHeightChanged","itemHeightsThatChangedWhileNewItemsWereBeingRendered","onItemInitialRender","measureItemHeightsAndSpacing","measureItemHeights","layoutTimer","layoutTimerStateUpdate","scheduleLayoutTimer","hasOwnProperty","is","x","y","shallowEqual","objA","objB","keysA","keysB","createOnRenderHelpers","onNewItemsRendered","itemsDiff","newLayout","_i","_Object$keys","Number","_i2","_Object$keys2","_i3","listBottomOffsetChange","getListBottomOffsetChange","updateStateRightAfterRender","_useTimeoutInRenderLoop","resetStateUpdateFlags","nonMeasuredItemsHaveBeenRendered","itemHeightHasChanged","_onRender","prevState","tbody","style","setProperty","layoutUpdateReason","_resetStateUpdateFlag","getItemsDiff","onPrepend","verticalSpacingStateUpdate","cleanedUpBeforeResize","cleanUpBeforeResizeItemHeights","_afterRenderStateUpdateThatWasStopped","createScrollableContainerResizeHelpers","onContainerResize","scrollableContainerWidth","newLastShownItemIndex","shouldDiscardBeforeResizeItemHeights","shouldIncludeBeforeResizeValuesInState","snapshotBeforeResizeItemHeights","_this$newItemsWillBeR","prepend","replace","createItemsHelpers","_setItems","layoutUpdate","itemsUpdateInfo","options","shouldResetGridLayout","preserveScrollPositionOnPrependItems","preserveScrollPosition","getLayoutUpdateForItemsDiff","snapshotListHeightBeforeAddingNewItems","append","isEqual","firstPreviousItemIndex","lastPreviousItemIndex","findInArray","offset","arePreviousItemsPreserved","isItemEqual","VirtualScrollerConstructor","_options$getInitialIt","_options$measureItems","getItemId","getEstimatedVisibleItemRowsCount","onItemFirstRender","_waitForScrollingToStop","engine","getScrollableContainer","b","item","createHelpers","readItemHeightsFromState","initializeFromState","scrollableContainerResizeHandler","listener","prevWidth","newWidth","VirtualScroller","stop","isStarted","hasToBeStarted","isRestart","classList","getElementById","add","createElement","innerText","head","appendChild","addTbodyStyles","itemTopOffsetInList","getItemTopOffset","onItemHeightDidChange","setItemState","_excluded","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","_items","renderItem","paddingTop","paddingBottom","diffRender","unmountItem","shouldPrependItems","prependBeforeItemElement","insertBefore","virtualScroller","onMount","onItemUnmount","restOptions","tagName","VirtualScrollerCore","itemElement","setItems"],"mappings":"gPAOe,SAASA,EAAG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