virtual-scroller 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-scroller-react.js","sources":["../node_modules/raf/index.js","../node_modules/performance-now/lib/performance-now.js","../node_modules/request-animation-frame-timeout/modules/index.js","../modules/utility/px.js","../modules/DOM/tbody.js","../modules/DOM/ItemsContainer.js","../modules/DOM/ScrollableContainer.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/ListHeightChangeWatcher.js","../modules/ItemHeights.js","../modules/utility/shallowEqual.js","../modules/utility/getStateSnapshot.js","../modules/VirtualScroller.js","../modules/getVerticalSpacing.js","../modules/getItemsDiff.js","../modules/react/VirtualScroller.js"],"sourcesContent":["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","/**\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';\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 function addTbodyStyles(tbody) {\n // `classList.add` is supported in Internet Explorer 10+.\n tbody.classList.add('VirtualScroller');\n var style = document.getElementById('VirtualScrollerStyle');\n\n if (!style) {\n style = document.createElement('style');\n style.id = 'VirtualScrollerStyle'; // CSS variables aren't supported in Internet Explorer.\n\n style.innerText = \"\\n\\t\\t\\ttbody.VirtualScroller:before {\\n\\t\\t\\t\\tcontent: '';\\n\\t\\t\\t\\tdisplay: table-row;\\n\\t\\t\\t\\theight: var(--VirtualScroller-paddingTop);\\n\\t\\t\\t}\\n\\t\\t\\ttbody.VirtualScroller:after {\\n\\t\\t\\t\\tcontent: '';\\n\\t\\t\\t\\tdisplay: table-row;\\n\\t\\t\\t\\theight: var(--VirtualScroller-paddingBottom);\\n\\t\\t\\t}\\n\\t\\t\".replace(/[\\n\\t]/g, '');\n document.head.appendChild(style);\n }\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 _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); return Constructor; }\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 /**\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 _createClass(ItemsContainer, [{\n key: \"getNthRenderedItemTopOffset\",\n value: function getNthRenderedItemTopOffset(renderedElementIndex) {\n return this.getElement().childNodes[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.getElement().childNodes[renderedElementIndex].offsetHeight\n return this.getElement().childNodes[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\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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 } }); 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); return Constructor; }\n\nvar ScrollableContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"scrollable container\" from an element.\r\n * @param {Element} scrollableContainer\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableContainer(element, getItemsContainerElement) {\n _classCallCheck(this, ScrollableContainer);\n\n this.element = element;\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.element.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.element.scrollTo) {\n this.element.scrollTo(0, scrollY);\n } else {\n this.element.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 return this.element.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.element && !precise) {\n // \treturn getScreenHeight()\n // }\n return this.element.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.element.getBoundingClientRect().top;\n var scrollableContainerBorderTopWidth = this.element.clientTop;\n var itemsContainerTop = this.getItemsContainerElement().getBoundingClientRect().top;\n return itemsContainerTop - scrollableContainerTop + this.getScrollY() - scrollableContainerBorderTopWidth;\n } // isVisible() {\n // \tconst { top, bottom } = this.element.getBoundingClientRect()\n // \treturn bottom > 0 && top < getScreenHeight()\n // }\n\n /**\r\n * Adds a \"scroll\" event listener to the \"scrollable container\".\r\n * @param {onScroll} 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(_onScroll) {\n var _this = this;\n\n this.element.addEventListener('scroll', _onScroll);\n return function () {\n return _this.element.removeEventListener('scroll', _onScroll);\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 var _this2 = this;\n\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.element`.\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 resizeObserver.observe(this.element);\n\n unobserve = function unobserve() {\n return resizeObserver.unobserve(_this2.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, window, 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","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); 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// <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.isRendered = true;\n this.watchListTopOffset();\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isRendered = 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.isRendered) {\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';\nimport ScrollableContainer, { ScrollableWindowContainer } from './ScrollableContainer';\nimport ListTopOffsetWatcher from './ListTopOffsetWatcher';\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(scrollableContainer, getItemsContainerElement) {\n if (scrollableContainer) {\n return new ScrollableContainer(scrollableContainer, 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}\nexport function reportError() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\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 log.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 new Error(['[virtual-scroller]'].concat(args).join(' '));\n }, 0);\n } else {\n var _console3;\n\n // On a server.\n (_console3 = console).error.apply(_console3, _toConsumableArray(['[virtual-scroller]'].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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); return Constructor; }\n\nimport log, { warn } from './utility/debug';\n\nvar Layout = /*#__PURE__*/function () {\n function Layout(_ref) {\n var bypass = _ref.bypass,\n estimatedItemHeight = _ref.estimatedItemHeight,\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.estimatedItemHeight = estimatedItemHeight;\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 }\n\n _createClass(Layout, [{\n key: \"getInitialLayoutValues\",\n value: function getInitialLayoutValues(_ref2) {\n var itemsCount = _ref2.itemsCount,\n columnsCount = _ref2.columnsCount;\n var firstShownItemIndex;\n var lastShownItemIndex; // If there're no items then `firstShownItemIndex` stays `undefined`.\n\n if (itemsCount > 0) {\n firstShownItemIndex = 0;\n lastShownItemIndex = this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n });\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 }\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 return this.getAverageItemHeight() || this.estimatedItemHeight || 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 // 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 warn('~ Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', columnsCount, '~');\n warn('Reset Layout');\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 // `setState()` calls are \"asynchronous\" (delayed execution).\n //\n // So, for example, the user calls `setItems()` with one set of items.\n // A `setState()` 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 `setState()` 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 `setState()` 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 MOUNTED: 'mounted',\n ACTUAL_ITEM_HEIGHTS_HAVE_BEEN_MEASURED: 'actual 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); 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';\nimport log from './utility/debug';\n\nvar Resize = /*#__PURE__*/function () {\n function Resize(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n scrollableContainer = _ref.scrollableContainer,\n onStart = _ref.onStart,\n onStop = _ref.onStop,\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 (!_this.isRendered) {\n return;\n }\n\n var prevScrollableContainerWidth = _this.scrollableContainerWidth;\n var prevScrollableContainerHeight = _this.scrollableContainerHeight;\n _this.scrollableContainerWidth = _this.scrollableContainer.getWidth();\n _this.scrollableContainerHeight = _this.scrollableContainer.getHeight();\n\n if (_this.scrollableContainerWidth === prevScrollableContainerWidth) {\n if (_this.scrollableContainerHeight === 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.scrollableContainerHeight);\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.scrollableContainerWidth);\n }\n });\n\n this.bypass = bypass;\n this.scrollableContainer = scrollableContainer;\n this.onHeightChange = onHeightChange;\n this.onWidthChange = onWidthChange;\n this.onNoChange = onNoChange;\n this.onResize = debounce(this._onResize, SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL, {\n onStart: onStart,\n onStop: onStop\n });\n }\n\n _createClass(Resize, [{\n key: \"listen\",\n value: function listen() {\n if (this.bypass) {\n return;\n }\n\n this.isRendered = true;\n this.scrollableContainerWidth = this.scrollableContainer.getWidth();\n this.scrollableContainerHeight = this.scrollableContainer.getHeight();\n this.scrollableContainerUnlistenResize = this.scrollableContainer.onResize(this.onResize);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isRendered = false;\n\n if (this.scrollableContainerUnlistenResize) {\n this.scrollableContainerUnlistenResize();\n this.scrollableContainerUnlistenResize = 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\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function}\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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); return Constructor; }\n\nimport log from './utility/debug';\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 } // 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.setState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.setState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n\n _createClass(BeforeResize, [{\n key: \"onInitialState\",\n value: function onInitialState(state) {\n if (state) {\n if (state.beforeResize) {\n if (state.beforeResize.itemHeights.length === 0) {\n state.beforeResize = undefined;\n }\n }\n\n if (state.beforeResize) {\n this._includesBeforeResizeInState = true;\n }\n }\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(prevState) {\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.setState()` call that will update\n // `beforeResize` property of `state`. Ideally, it should be updated\n // immediately, but since `this.setState()` 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.setState()` 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//# 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); 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';\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.onScrollOnStopScrolling = 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: \"listen\",\n value: function listen() {\n if (this.initialScrollPosition !== undefined) {\n this.scrollToY(this.initialScrollPosition);\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 if (this.stopReportingScrollPositionChange) {\n this.stopReportingScrollPositionChange();\n this.stopReportingScrollPositionChange = undefined;\n }\n\n if (this.stopListeningToScroll) {\n this.stopListeningToScroll();\n this.stopListeningToScroll = undefined;\n }\n\n if (this.onStopScrollingListener) {\n this.onStopScrollingListener = undefined;\n }\n\n if (this.onScrollOnStopScrolling) {\n this.onScrollOnStopScrolling = undefined;\n }\n\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.onScrollOnStopScrolling) {\n _this2.onScrollOnStopScrolling = undefined;\n\n _this2.onScroll({\n delayed: true\n });\n }\n\n if (_this2.onStopScrollingListener) {\n var onStopScrollingListener = _this2.onStopScrollingListener;\n _this2.onStopScrollingListener = undefined; // `onStopScrollingListener()` may hypothetically schedule\n // another `onStopScrolling()` listener, so set\n // `this.onStopScrollingListener` to `undefined` before\n // calling it rather than after.\n\n log('~ The user has stopped scrolling ~');\n onStopScrollingListener();\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\n }, {\n key: \"onStopScrolling\",\n value: function onStopScrolling(onStopScrollingListener) {\n this.onStopScrollingListener = onStopScrollingListener;\n\n if (!this.onStopScrollingTimer) {\n this.watchOnStopScrolling();\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); return Constructor; }\n\nvar ListHeightChangeWatcher = /*#__PURE__*/function () {\n function ListHeightChangeWatcher(_ref) {\n var itemsContainer = _ref.itemsContainer,\n getListTopOffset = _ref.getListTopOffset;\n\n _classCallCheck(this, ListHeightChangeWatcher);\n\n this.itemsContainer = itemsContainer;\n this.getListTopOffset = getListTopOffset;\n }\n /**\r\n * `<ReactVirtualScroller/>` calls this method.\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @param {number} prependedItemsCount\r\n */\n\n\n _createClass(ListHeightChangeWatcher, [{\n key: \"snapshot\",\n value: function snapshot(_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 // If the scroll position has already been captured for restoration,\n // then don't capture it the second time.\n // Capturing scroll position could happen when using `<ReactVirtualScroller/>`\n // because it calls `ListHeightChangeWatcher.snapshot()` inside `ReactVirtualScroller.render()`\n // which is followed by `<VirtualScroller/>`'s `.componentDidUpdate()`\n // that also calls `ListHeightChangeWatcher.snapshot()` with the same arguments,\n // so that second call to `ListHeightChangeWatcher.snapshot()` is ignored.\n // Calling `ListHeightChangeWatcher.snapshot()` inside `ReactVirtualScroller.render()`\n // is done to prevent scroll Y position from jumping\n // when showing the first page of the \"Previous items\".\n // See the long section of comments in `ReactVirtualScroller.render()`\n // method for more info on why is `ListHeightChangeWatcher.snapshot()` called there.\n\n\n if (this._snapshot && this._snapshot.previousItems === previousItems && this._snapshot.newItems === newItems) {\n return;\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 ListHeightChangeWatcher;\n}();\n\nexport { ListHeightChangeWatcher as default };\n//# sourceMappingURL=ListHeightChangeWatcher.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); return Constructor; }\n\nimport log, { warn, isDebug, reportError } from './utility/debug';\n\nvar ItemHeights = /*#__PURE__*/function () {\n function ItemHeights(container, getItemHeight, setItemHeight) {\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 * Is called after `.reset()`.\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: \"initialize\",\n value: function initialize(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 // Don't re-measure item heights that have been measured previously.\n // The rationale is that developers are supposed to manually call\n // `.onItemHeightChange()` every time an item's height changes.\n // If developers aren't neglecting that rule, item heights won't\n // change unexpectedly.\n // // Re-measure all shown items' heights, because an item's height\n // // might have changed since it has been measured initially.\n // // For example, if an item is a long comment with a \"Show more\" button,\n // // then the user might have clicked that \"Show more\" button.\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 the item's height right after showing it after being hidden,\n // because, if the stored item's state isn't applied properly, the item's\n // height might be incorrect when it's rendered with that state not applied,\n // and so a developer could know that there's a bug in their code.\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 was', previousHeight, 'before it was hidden, but, after showing it again, its height is', _height, '. Perhaps you forgot to persist the item\\'s state by calling `onItemStateChange(i, newState)` when it changed, and that state got lost when the item element was unmounted, which resulted in a different height when the item was shown again, but with the missing state.');\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 `.onItemHeightChange()`,\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(`\"onItemHeightChange()\" has been called for item ${i}, but that item isn't rendered.`)\n // \treturn\n // }\n // if (previousHeight === undefined) {\n // \treportError(`\"onItemHeightChange()\" 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","// 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\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); 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 { supportsTbody, BROWSER_NOT_SUPPORTED_ERROR, addTbodyStyles, setTbodyPadding } from './DOM/tbody';\nimport DOMEngine from './DOM/Engine';\nimport Layout, { LAYOUT_REASON } from './Layout';\nimport Resize from './Resize';\nimport BeforeResize from './BeforeResize';\nimport Scroll from './Scroll';\nimport ListHeightChangeWatcher from './ListHeightChangeWatcher';\nimport ItemHeights from './ItemHeights';\nimport _getItemsDiff from './getItemsDiff';\nimport getVerticalSpacing from './getVerticalSpacing';\nimport log, { warn, isDebug, reportError } from './utility/debug';\nimport shallowEqual from './utility/shallowEqual';\nimport getStateSnapshot from './utility/getStateSnapshot';\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, \"getActualColumnsCountForState\", function () {\n return _this._getColumnsCount ? _this._getColumnsCount(_this.scrollableContainer) : undefined;\n });\n\n _defineProperty(this, \"getVerticalSpacing\", function () {\n return _this.verticalSpacing || 0;\n });\n\n _defineProperty(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 _defineProperty(this, \"stop\", function () {\n _this.isRendered = false;\n\n _this.resize.stop();\n\n _this.scroll.stop();\n\n if (_this.listTopOffsetWatcher) {\n _this.listTopOffsetWatcher.stop();\n }\n\n _this.cancelLayoutTimer({});\n });\n\n _defineProperty(this, \"willUpdateState\", function (newState, prevState) {\n // Ignore setting initial state.\n if (!prevState) {\n return;\n } // This function isn't currently used.\n // Was previously used to capture scroll position in order to\n // restore it later after the new state is rendered.\n\n });\n\n _defineProperty(this, \"didUpdateState\", function (prevState) {\n var newState = _this.getState();\n\n if (_this.onStateChange) {\n if (!shallowEqual(newState, prevState)) {\n _this.onStateChange(newState, prevState);\n }\n } // Ignore setting initial state.\n\n\n if (!prevState) {\n return;\n }\n\n if (!_this.isRendered) {\n return;\n }\n\n log('~ Rendered ~');\n\n if (isDebug()) {\n log('State', getStateSnapshot(newState));\n }\n\n var layoutUpdateReason;\n\n if (_this.firstNonMeasuredItemIndex !== undefined) {\n layoutUpdateReason = LAYOUT_REASON.ACTUAL_ITEM_HEIGHTS_HAVE_BEEN_MEASURED;\n }\n\n if (_this.resetLayoutAfterResize) {\n layoutUpdateReason = LAYOUT_REASON.VIEWPORT_WIDTH_CHANGED;\n } // If `this.resetLayoutAfterResize` flag was reset after calling\n // `this.measureItemHeightsAndSpacingAndUpdateTablePadding()`\n // then there would be a bug because\n // `this.measureItemHeightsAndSpacingAndUpdateTablePadding()`\n // calls `this.setState({ verticalSpacing })` which calls\n // `this.didUpdateState()` immediately, so `this.resetLayoutAfterResize`\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.resetLayoutAfterResize` flag\n // and reset it right away to prevent any such potential bugs.\n //\n\n\n var resetLayoutAfterResize = _this.resetLayoutAfterResize; // Reset `this.firstNonMeasuredItemIndex`.\n\n _this.firstNonMeasuredItemIndex = undefined; // Reset `this.resetLayoutAfterResize` flag.\n\n _this.resetLayoutAfterResize = 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;\n\n if (resetLayoutAfterResize) {\n // Reset measured item heights on viewport width change.\n _this.itemHeights.reset(); // Reset `verticalSpacing` (will be re-measured).\n\n\n _this.verticalSpacing = undefined;\n }\n\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 `setState()` 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 `setState()` call being overwritten\n // by the second `setState()` 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 `.onRendered()`.\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(); // `newState.itemHeights` is an array of `undefined`s.\n\n\n _this.itemHeights.initialize(newState.itemHeights);\n }\n\n if (!resetLayoutAfterResize) {\n // The call to `this.onNewItemsRendered()` must precede the call to\n // `.measureItemHeights()` which is called in `.onRendered()` 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 (_this.onNewItemsRendered(itemsDiff, newState) !== 'SEAMLESS_PREPEND') {\n layoutUpdateReason = LAYOUT_REASON.ITEMS_CHANGED;\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 (newState.firstShownItemIndex !== prevState.firstShownItemIndex || newState.lastShownItemIndex !== prevState.lastShownItemIndex || newState.items !== prevState.items || resetLayoutAfterResize) {\n var verticalSpacingStateUpdate = _this.measureItemHeightsAndSpacingAndUpdateTablePadding();\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.setState()` 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(prevState);\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 (layoutUpdateReason) {\n _this.updateStateRightAfterRender({\n stateUpdate: stateUpdate,\n reason: layoutUpdateReason\n });\n } else if (stateUpdate) {\n _this.setState(stateUpdate);\n }\n });\n\n _defineProperty(this, \"updateShownItemIndexes\", function (_ref) {\n var stateUpdate = _ref.stateUpdate;\n var startedAt = Date.now(); // Get shown item indexes.\n\n var _this$getShownItemInd = _this.getShownItemIndexes(),\n firstShownItemIndex = _this$getShownItemInd.firstShownItemIndex,\n lastShownItemIndex = _this$getShownItemInd.lastShownItemIndex,\n shownItemsHeight = _this$getShownItemInd.shownItemsHeight,\n firstNonMeasuredItemIndex = _this$getShownItemInd.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.listHeightChangeWatcher.hasSnapshot()) {\n if (lastShownItemIndex < _this.listHeightChangeWatcher.getAnchorItemIndex()) {\n lastShownItemIndex = _this.listHeightChangeWatcher.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 `.onItemStateChange()` and `.onItemHeightChange(i)`.\n\n\n if (!_this.validateWillBeHiddenItemHeightsAreAccurate(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 _this.updateShownItemIndexes({\n stateUpdate: stateUpdate\n });\n } // Measure \"before\" items height.\n\n\n var beforeItemsHeight = _this.layout.getBeforeItemsHeight(firstShownItemIndex); // Measure \"after\" items height.\n\n\n var afterItemsHeight = _this.layout.getAfterItemsHeight(lastShownItemIndex, _this.getItemsCount());\n\n var layoutDuration = Date.now() - startedAt; // Debugging.\n\n log('~ Layout values ' + (_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\n _this.firstNonMeasuredItemIndex = firstNonMeasuredItemIndex; // 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 `.onItemHeightChange(i)`.\n //\n // If, for example, an item height was updated externally via `.onItemHeightChange(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 `setState()` 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.setState(_objectSpread({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, stateUpdate));\n });\n\n _defineProperty(this, \"onUpdateShownItemIndexes\", function (_ref2) {\n var reason = _ref2.reason,\n stateUpdate = _ref2.stateUpdate;\n\n // In case of \"don't do anything\".\n var skip = function skip() {\n if (stateUpdate) {\n _this.setState(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.resetLayoutAfterResize || _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\n _this.updateShownItemIndexes({\n stateUpdate: stateUpdate\n });\n });\n\n _defineProperty(this, \"updateLayout\", function () {\n return _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.MANUAL\n });\n });\n\n _defineProperty(this, \"layout\", function () {\n return _this.updateLayout();\n });\n\n var onStateChange = options.onStateChange,\n customState = options.customState,\n initialScrollPosition = options.initialScrollPosition,\n onScrollPositionChange = options.onScrollPositionChange,\n measureItemsBatchSize = options.measureItemsBatchSize,\n getScrollableContainer = options.getScrollableContainer,\n getColumnsCount = options.getColumnsCount,\n getItemId = options.getItemId,\n tbody = options.tbody,\n _useTimeoutInRenderLoop = options._useTimeoutInRenderLoop,\n _waitForScrollingToStop = options._waitForScrollingToStop;\n var getState = options.getState,\n setState = options.setState;\n var bypass = options.bypass,\n estimatedItemHeight = options.estimatedItemHeight,\n onItemInitialRender = options.onItemInitialRender,\n onItemFirstRender = options.onItemFirstRender,\n scrollableContainer = options.scrollableContainer,\n state = options.state,\n engine = options.engine;\n log('~ Initialize ~'); // If `state` is passed then use `items` from `state`\n // instead of the `items` argument.\n\n if (state) {\n items = state.items;\n } // `getScrollableContainer` option is deprecated.\n // Use `scrollableContainer` instead.\n\n\n if (!scrollableContainer && getScrollableContainer) {\n scrollableContainer = getScrollableContainer();\n } // Could support non-DOM rendering engines.\n // For example, React Native, `<canvas/>`, etc.\n\n\n if (!engine) {\n engine = DOMEngine;\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;\n this.itemsContainer = engine.createItemsContainer(getItemsContainerElement); // Remove any accidental text nodes from container (like whitespace).\n // Also guards against cases when someone accidentally tries\n // using `VirtualScroller` on a non-empty element.\n\n if (getItemsContainerElement()) {\n this.itemsContainer.clear();\n }\n\n this.scrollableContainer = engine.createScrollableContainer(scrollableContainer, 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 // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (tbody) {\n if (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 this.initialItems = items; // this.prerenderMargin = prerenderMargin\n\n this.onStateChange = onStateChange;\n this._getColumnsCount = getColumnsCount;\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 `setState()` not being\n // instanteneous: when new `items` are passed to `<VirtualScroller/>`,\n // `VirtualScroller.setState({ items })` is called, and if `onItemFirstRender(i)`\n // is called after the aforementioned `setState()` 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 }\n\n log('Items count', items.length);\n\n if (estimatedItemHeight) {\n log('Estimated item height', estimatedItemHeight);\n } // 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 // Create default `getState()`/`setState()` functions.\n\n\n if (!getState) {\n getState = function getState() {\n return _this.state;\n };\n\n setState = function setState(stateUpdate, _ref3) {\n var willUpdateState = _ref3.willUpdateState,\n didUpdateState = _ref3.didUpdateState;\n var prevState = getState(); // Because this variant of `.setState()` is \"synchronous\" (immediate),\n // it can be written like `...prevState`, and no state updates would be lost.\n // But if it was \"asynchronous\" (not immediate), then `...prevState`\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 `prevState` stale.\n\n var newState = _objectSpread(_objectSpread({}, prevState), stateUpdate);\n\n willUpdateState(newState, prevState);\n _this.state = newState; // // Is only used in tests.\n // if (this._onStateUpdate) {\n // \tthis._onStateUpdate(stateUpdate)\n // }\n\n didUpdateState(prevState);\n };\n }\n\n this.getState = getState;\n\n this.setState = function (stateUpdate) {\n if (isDebug()) {\n log('Set state', getStateSnapshot(stateUpdate));\n }\n\n setState(stateUpdate, {\n willUpdateState: _this.willUpdateState,\n didUpdateState: _this.didUpdateState\n });\n };\n\n if (state) {\n if (isDebug()) {\n log('Initial state (passed)', getStateSnapshot(state));\n }\n } // Check if the current `columnsCount` matches the one from state.\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 if (state) {\n var shouldResetLayout;\n var columnsCountForState = this.getActualColumnsCountForState();\n\n if (columnsCountForState !== state.columnsCount) {\n warn('~ Columns Count changed from', state.columnsCount || 1, 'to', columnsCountForState || 1, '~');\n shouldResetLayout = true;\n }\n\n var columnsCount = this.getActualColumnsCount();\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 shouldResetLayout = true;\n }\n\n if (shouldResetLayout) {\n warn('Reset Layout');\n state = _objectSpread(_objectSpread({}, state), this.getInitialLayoutState(state.items));\n }\n } // Reset `verticalSpacing` so that it re-measures it after the list\n // has been rendered initially. The rationale is that the `state`\n // can't be \"trusted\" in a sense that the user might have resized\n // their window after the `state` has been snapshotted, and changing\n // window width might have activated different CSS `@media()` \"queries\"\n // resulting in a potentially different vertical spacing.\n\n\n if (state) {\n state = _objectSpread(_objectSpread({}, state), {}, {\n verticalSpacing: undefined\n });\n } // Create `ItemHeights` instance.\n\n\n this.itemHeights = new ItemHeights(this.itemsContainer, function (i) {\n return _this.getState().itemHeights[i];\n }, function (i, height) {\n return _this.getState().itemHeights[i] = height;\n }); // Initialize `ItemHeights` from the initially passed `state`.\n\n if (state) {\n this.itemHeights.initialize(state.itemHeights);\n }\n\n this.layout = new Layout({\n bypass: bypass,\n estimatedItemHeight: estimatedItemHeight,\n measureItemsBatchSize: measureItemsBatchSize === undefined ? 50 : measureItemsBatchSize,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this.getPrerenderMargin();\n },\n getVerticalSpacing: function getVerticalSpacing() {\n return _this.getVerticalSpacing();\n },\n getVerticalSpacingBeforeResize: function getVerticalSpacingBeforeResize() {\n return _this.getVerticalSpacingBeforeResize();\n },\n getColumnsCount: function getColumnsCount() {\n return _this.getColumnsCount();\n },\n getColumnsCountBeforeResize: function getColumnsCountBeforeResize() {\n return _this.getState().beforeResize && _this.getState().beforeResize.columnsCount;\n },\n getItemHeight: function getItemHeight(i) {\n return _this.getState().itemHeights[i];\n },\n getItemHeightBeforeResize: function getItemHeightBeforeResize(i) {\n return _this.getState().beforeResize && _this.getState().beforeResize.itemHeights[i];\n },\n getBeforeResizeItemsCount: function getBeforeResizeItemsCount() {\n return _this.getState().beforeResize ? _this.getState().beforeResize.itemHeights.length : 0;\n },\n getAverageItemHeight: function getAverageItemHeight() {\n return _this.itemHeights.getAverage();\n },\n getMaxVisibleAreaHeight: function getMaxVisibleAreaHeight() {\n return _this.scrollableContainer && _this.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 _this.previouslyCalculatedLayout;\n }\n });\n this.resize = new Resize({\n bypass: bypass,\n scrollableContainer: this.scrollableContainer,\n onStart: function onStart() {\n log('~ Scrollable container resize started ~');\n _this.isResizing = true;\n },\n onStop: function onStop() {\n log('~ Scrollable container resize finished ~');\n _this.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 _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_SIZE_UNCHANGED\n });\n },\n onHeightChange: function onHeightChange() {\n return _this.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 _this.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 _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n delayed = _ref4.delayed;\n\n _this.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 _this.layoutTimer;\n },\n hasNonRenderedItemsAtTheTop: function hasNonRenderedItemsAtTheTop() {\n return _this.getState().firstShownItemIndex > 0;\n },\n hasNonRenderedItemsAtTheBottom: function hasNonRenderedItemsAtTheBottom() {\n return _this.getState().lastShownItemIndex < _this.getItemsCount() - 1;\n },\n getLatestLayoutVisibleArea: function getLatestLayoutVisibleArea() {\n return _this.latestLayoutVisibleArea;\n },\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this.getPrerenderMargin();\n }\n });\n this.listHeightChangeWatcher = new ListHeightChangeWatcher({\n itemsContainer: this.itemsContainer,\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer\n });\n\n if (engine.watchListTopOffset) {\n this.listTopOffsetWatcher = engine.watchListTopOffset({\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n onListTopOffsetChange: function onListTopOffsetChange(_ref5) {\n var reason = _ref5.reason;\n return _this.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 }); // 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.setState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.setState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n this.beforeResize.onInitialState(state); // `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.getInitialState()`.\n //\n\n this.verticalSpacing = state ? state.verticalSpacing : undefined; // Set initial `state`.\n\n this.setState(state || this.getInitialState(customState));\n }\n /**\r\n * Returns the initial state of the `VirtualScroller`.\r\n * @param {object} [customState] — Any additional \"custom\" state may be stored in `VirtualScroller`'s state. For example, React implementation stores item \"refs\" as \"custom\" state.\r\n * @return {object}\r\n */\n\n\n _createClass(VirtualScroller, [{\n key: \"getInitialState\",\n value: function getInitialState(customState) {\n var items = this.initialItems;\n\n var state = _objectSpread(_objectSpread(_objectSpread({}, customState), this.getInitialLayoutState(items)), {}, {\n items: items,\n itemStates: new Array(items.length)\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 key: \"getInitialLayoutState\",\n value: function getInitialLayoutState(items) {\n var itemsCount = items.length;\n\n var _this$layout$getIniti = this.layout.getInitialLayoutValues({\n itemsCount: itemsCount,\n columnsCount: this.getColumnsCount()\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 } // 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\n }, {\n key: \"getActualColumnsCount\",\n value: function getActualColumnsCount() {\n return this.getActualColumnsCountForState() || 1;\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\n }, {\n key: \"getVerticalSpacingBeforeResize\",\n value: function getVerticalSpacingBeforeResize() {\n // `beforeResize.verticalSpacing` can be `undefined`.\n // For example, if `this.setState({ verticalSpacing })` call hasn't been applied\n // before the resize happened (in case of an \"asynchronous\" state update).\n return this.getState().beforeResize && this.getState().beforeResize.verticalSpacing || 0;\n }\n }, {\n key: \"getColumnsCount\",\n value: function getColumnsCount() {\n return this.getState() && this.getState().columnsCount || 1;\n }\n }, {\n key: \"getItemsCount\",\n value: function getItemsCount() {\n return this.getState().items.length;\n }\n }, {\n key: \"getPrerenderMargin\",\n value: function getPrerenderMargin() {\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 key: \"onBeforeShowItems\",\n value: function onBeforeShowItems(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 key: \"onMount\",\n value: function onMount() {\n warn('`.onMount()` instance method name is deprecated, use `.listen()` instance method name instead.');\n this.listen();\n }\n }, {\n key: \"render\",\n value: function render() {\n warn('`.render()` instance method name is deprecated, use `.listen()` instance method name instead.');\n this.listen();\n }\n /**\r\n * Should be invoked after a \"container\" DOM Element is mounted (inserted into the DOM tree).\r\n */\n\n }, {\n key: \"listen\",\n value: function listen() {\n if (this.isRendered === false) {\n throw new Error('[virtual-scroller] Can\\'t restart a `VirtualScroller` after it has been stopped');\n }\n\n log('~ Rendered (initial) ~'); // `this.isRendered = true` should be the first statement in this function,\n // otherwise `DOMVirtualScroller` would enter an infinite re-render loop.\n\n this.isRendered = true;\n var stateUpdate = this.measureItemHeightsAndSpacingAndUpdateTablePadding();\n this.resize.listen();\n this.scroll.listen(); // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (this.tbody) {\n addTbodyStyles(this.getItemsContainerElement());\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.MOUNTED,\n stateUpdate: stateUpdate\n });\n }\n }, {\n key: \"measureItemHeightsAndSpacingAndUpdateTablePadding\",\n value: function measureItemHeightsAndSpacingAndUpdateTablePadding() {\n // Measure \"newly shown\" item heights.\n // Also re-validate already measured items' heights.\n this.itemHeights.measureItemHeights(this.getState().firstShownItemIndex, this.getState().lastShownItemIndex); // Update item vertical spacing.\n\n var verticalSpacing = this.measureVerticalSpacing(); // 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 if (this.tbody) {\n setTbodyPadding(this.getItemsContainerElement(), this.getState().beforeItemsHeight, this.getState().afterItemsHeight);\n } // Return a state update.\n\n\n if (verticalSpacing !== undefined) {\n return {\n verticalSpacing: verticalSpacing\n };\n }\n }\n }, {\n key: \"getVisibleArea\",\n value: 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 /**\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 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 }, {\n key: \"onUnmount\",\n value: function onUnmount() {\n warn('`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead.');\n this.stop();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n warn('`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead.');\n this.stop();\n }\n }, {\n key: \"cancelLayoutTimer\",\n value: function cancelLayoutTimer(_ref6) {\n var stateUpdate = _ref6.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 key: \"scheduleLayoutTimer\",\n value: function scheduleLayoutTimer(_ref7) {\n var _this2 = this;\n\n var reason = _ref7.reason,\n stateUpdate = _ref7.stateUpdate;\n this.layoutTimerStateUpdate = stateUpdate;\n this.layoutTimer = setTimeout(function () {\n _this2.layoutTimerStateUpdate = undefined;\n _this2.layoutTimer = undefined;\n\n _this2.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }, 0);\n }\n /**\r\n * Should be called right before `state` is updated.\r\n * @param {object} prevState\r\n * @param {object} newState\r\n */\n\n }, {\n key: \"onNewItemsRendered\",\n value: // 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 `setState()` 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 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$getState2 = this.getState(),\n itemHeights = _this$getState2.itemHeights,\n itemStates = _this$getState2.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 + parseInt(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 + parseInt(_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 \"didUpdateState()\" 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.listHeightChangeWatcher.hasSnapshot()) {\n if (newLayout.firstShownItemIndex === 0) {\n // Restore (adjust) scroll position.\n log('~ Restore Scroll Position ~');\n var listBottomOffsetChange = this.listHeightChangeWatcher.getListBottomOffsetChange({\n beforeItemsHeight: newLayout.beforeItemsHeight\n });\n this.listHeightChangeWatcher.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 \"didUpdateState()\" 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 \\\"didUpdateState()\\\" 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 key: \"updateStateRightAfterRender\",\n value: function updateStateRightAfterRender(_ref8) {\n var reason = _ref8.reason,\n stateUpdate = _ref8.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 // `.setState()` 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 key: \"measureVerticalSpacing\",\n value: function measureVerticalSpacing() {\n if (this.verticalSpacing === undefined) {\n var _this$getState3 = this.getState(),\n firstShownItemIndex = _this$getState3.firstShownItemIndex,\n lastShownItemIndex = _this$getState3.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 this.verticalSpacing = verticalSpacing;\n\n if (verticalSpacing !== 0) {\n return verticalSpacing;\n }\n }\n }\n }\n }, {\n key: \"remeasureItemHeight\",\n value: function remeasureItemHeight(i) {\n var _this$getState4 = this.getState(),\n firstShownItemIndex = _this$getState4.firstShownItemIndex;\n\n return this.itemHeights.remeasureItemHeight(i, firstShownItemIndex);\n }\n }, {\n key: \"onItemStateChange\",\n value: function onItemStateChange(i, newItemState) {\n if (isDebug()) {\n log('~ Item state changed ~');\n log('Item', 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; // Schedule the item state update for after the new items have been rendered.\n\n if (this.newItemsWillBeRendered) {\n if (!this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(i)] = newItemState;\n }\n }\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n log('~ Re-measure item height ~');\n log('Item', i);\n\n var _this$getState5 = this.getState(),\n itemHeights = _this$getState5.itemHeights,\n firstShownItemIndex = _this$getState5.firstShownItemIndex,\n lastShownItemIndex = _this$getState5.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 `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(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 // `.onItemHeightChange(i)` gets called.\n return warn('The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when there\\'re several `onItemHeightChange(i)` calls issued at the same time.');\n }\n\n var previousHeight = itemHeights[i];\n\n if (previousHeight === undefined) {\n return reportError(\"\\\"onItemHeightChange()\\\" has been called for item \".concat(i, \", but that item hasn't been rendered before.\"));\n }\n\n var newHeight = this.remeasureItemHeight(i);\n log('Previous height', previousHeight);\n log('New height', newHeight);\n\n if (previousHeight !== newHeight) {\n log('~ Item height has changed ~'); // Update or reset previously calculated layout.\n\n this.updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight); // Recalculate layout.\n\n this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.ITEM_HEIGHT_CHANGED\n }); // Schedule the item height update for after the new items have been rendered.\n\n if (this.newItemsWillBeRendered) {\n if (!this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(i)] = newHeight;\n }\n }\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 key: \"updatePreviouslyCalculatedLayoutOnItemHeightChange\",\n value: function updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight) {\n if (this.previouslyCalculatedLayout) {\n var heightDifference = newHeight - previousHeight;\n\n if (i < this.previouslyCalculatedLayout.firstShownItemIndex) {\n // Patch `this.previouslyCalculatedLayout`'s `.beforeItemsHeight`.\n this.previouslyCalculatedLayout.beforeItemsHeight += heightDifference;\n } else if (i > this.previouslyCalculatedLayout.lastShownItemIndex) {\n // Could patch `.afterItemsHeight` of `this.previouslyCalculatedLayout` here,\n // if `.afterItemsHeight` property existed in `this.previouslyCalculatedLayout`.\n if (this.previouslyCalculatedLayout.afterItemsHeight !== undefined) {\n this.previouslyCalculatedLayout.afterItemsHeight += heightDifference;\n }\n } else {\n // Patch `this.previouslyCalculatedLayout`'s shown items height.\n this.previouslyCalculatedLayout.shownItemsHeight += newHeight - previousHeight;\n }\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 `.onItemStateChange()` and `.onItemHeightChange(i)`.\r\n */\n\n }, {\n key: \"validateWillBeHiddenItemHeightsAreAccurate\",\n value: 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 // `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(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 = this.remeasureItemHeight(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 this.updatePreviouslyCalculatedLayoutOnItemHeightChange(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 `onItemHeightChange(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 key: \"getShownItemIndexes\",\n value: function getShownItemIndexes() {\n var itemsCount = this.getItemsCount();\n\n var _this$getVisibleArea = this.getVisibleArea(),\n visibleAreaTop = _this$getVisibleArea.top,\n visibleAreaBottom = _this$getVisibleArea.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 * 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 key: \"updateItems\",\n value:\n /**\r\n * @deprecated\r\n * `.updateItems()` has been renamed to `.setItems()`.\r\n */\n function updateItems(newItems, options) {\n return this.setItems(newItems, options);\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\n // * @param {object} [newCustomState] — If `customState` was passed to `getInitialState()`, this `newCustomState` updates it.\n var _this$getState6 = this.getState(),\n previousItems = _this$getState6.items; // Even if `newItems` are equal to `this.state.items`,\n // still perform a `setState()` call, because, if `setState()` 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 `setState({ 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$getState7 = this.getState(),\n itemStates = _this$getState7.itemStates;\n\n var _ref9 = this.resetLayoutAfterResize ? this.resetLayoutAfterResize.stateUpdate : this.getState(),\n itemHeights = _ref9.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 if (itemsDiff) {\n var _ref10 = this.resetLayoutAfterResize ? this.resetLayoutAfterResize.stateUpdate : this.getState(),\n firstShownItemIndex = _ref10.firstShownItemIndex,\n lastShownItemIndex = _ref10.lastShownItemIndex,\n beforeItemsHeight = _ref10.beforeItemsHeight,\n afterItemsHeight = _ref10.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 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 });\n\n if (prependedItemsCount > 0) {\n log('Prepend', prependedItemsCount, 'items');\n itemHeights = new Array(prependedItemsCount).concat(itemHeights);\n\n if (itemStates) {\n itemStates = new Array(prependedItemsCount).concat(itemStates);\n } // Restore scroll position after prepending items (if requested).\n\n\n if (shouldRestoreScrollPosition) {\n log('Will restore scroll position');\n this.listHeightChangeWatcher.snapshot({\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 if (this.firstNonMeasuredItemIndex !== undefined) {\n this.firstNonMeasuredItemIndex += prependedItemsCount;\n }\n } else {\n log('Reset layout'); // Reset layout because none of the prepended items have been measured.\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\n if (itemStates) {\n itemStates = itemStates.concat(new Array(appendedItemsCount));\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 = new Array(newItems.length);\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.setState()`\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.listHeightChangeWatcher` wasn't reset on `.setItems(differentItems)`\n // and if the second `this.setState()` 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.listHeightChangeWatcher.reset();\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 `didUpdateState()`.\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 `setState()` below and that call actually being applied.\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 `setState()` 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 `setState()` 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 `setState()` 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.resetLayoutAfterResize ? this.resetLayoutAfterResize.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.setState(newState);\n }\n }, {\n key: \"getItemsDiff\",\n value: function getItemsDiff(previousItems, newItems) {\n return _getItemsDiff(previousItems, newItems, this.isItemEqual);\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 `setState()` 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 key: \"shouldDiscardBeforeResizeItemHeights\",\n value: function shouldDiscardBeforeResizeItemHeights() {\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 key: \"onResize\",\n value: function onResize() {\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.listHeightChangeWatcher.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 `setState()` operation is \"asynchronous\", that is\n // when `setState()` calls aren't applied immediately, like in React.\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 `setState()` operation is \"asynchronous\", that is\n // when `setState()` 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 // 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 `setState()` 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 var newFirstShownItemIndex = Math.floor(firstShownItemIndex / newColumnsCount) * newColumnsCount;\n var newLastShownItemIndex = Math.ceil((lastShownItemIndex + 1) / newColumnsCount) * newColumnsCount - 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\" `setState()` call, and then, before that\n // `setState()` 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 var verticalSpacing = this.getVerticalSpacing();\n var columnsCount = this.getColumnsCount(); // `beforeResize` is always overwritten in `state` here.\n // (once it has started being tracked in `state`)\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.resetLayoutAfterResize` 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 `didUpdateState()`\n // function will clear this flag and perform a re-layout.\n\n\n this.resetLayoutAfterResize = {\n stateUpdate: newState\n }; // Rerender.\n\n this.setState(newState);\n }\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\nvar SLOW_LAYOUT_DURATION = 15; // in milliseconds.\n//# sourceMappingURL=VirtualScroller.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); // If next row is detected.\n\n if (itemTopOffset !== firstShownRowTopOffset) {\n // Measure inter-row spacing.\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","/**\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","var _excluded = [\"as\", \"itemComponent\", \"itemComponentProps\", \"items\", \"estimatedItemHeight\", \"bypass\", \"preserveScrollPositionOnPrependItems\", \"preserveScrollPosition\", \"initialScrollPosition\", \"onScrollPositionChange\", \"measureItemsBatchSize\", \"scrollableContainer\", \"getScrollableContainer\", \"getColumnsCount\", \"initialState\", \"initialCustomState\", \"onStateChange\", \"onItemInitialRender\", \"onItemFirstRender\", \"getItemId\", \"onMount\", \"className\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\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 _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(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); return Constructor; }\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 } }); 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 _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 React from 'react';\nimport PropTypes from 'prop-types';\nimport VirtualScrollerCore from '../VirtualScroller';\nimport { reportError } from '../utility/debug';\nimport px from '../utility/px'; // `PropTypes.elementType` is available in some version of `prop-types`.\n// https://github.com/facebook/prop-types/issues/200\n\nvar elementType = PropTypes.elementType || PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object]);\n\nvar VirtualScroller = /*#__PURE__*/function (_React$Component) {\n _inherits(VirtualScroller, _React$Component);\n\n var _super = _createSuper(VirtualScroller);\n\n // `this.state` is already reserved for `virtual-scroller`.\n // static getDerivedStateFromProps(props, state) {\n // \treturn {\n // \t\tprevProps: {\n // \t\t\titems: props.items\n // \t\t}\n // \t}\n // }\n // Handler function caches.\n // Just so that the props passed to `itemComponent`\n // are not changed on every `.render()` and so\n // `itemComponent` won't re-render if it's a `PureComponent`.\n // Item refs for `.renderItem(i)`.\n // List items are rendered with `key`s\n // so that React doesn't reuse `itemComponent`s\n // in cases when `items` are changed.\n function VirtualScroller(props) {\n var _this;\n\n _classCallCheck(this, VirtualScroller);\n\n _this = _super.call(this, props); // `this.previousItemsProperty` is only used for comparing\n // `previousItems` with `newItems` inside `render()`.\n\n _defineProperty(_assertThisInitialized(_this), \"container\", /*#__PURE__*/React.createRef());\n\n _defineProperty(_assertThisInitialized(_this), \"onItemStateChange\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"onItemHeightChange\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"itemRefs\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"itemKeyPrefixes\", []);\n\n _defineProperty(_assertThisInitialized(_this), \"updateLayout\", function () {\n return _this.virtualScroller.updateLayout();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"layout\", function () {\n return _this.updateLayout();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onItemInitialRender\", function () {\n var onItemInitialRender = _this.props.onItemInitialRender;\n\n if (onItemInitialRender) {\n onItemInitialRender.apply(void 0, arguments);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onItemFirstRender\", function () {\n var onItemFirstRender = _this.props.onItemFirstRender;\n\n if (onItemFirstRender) {\n onItemFirstRender.apply(void 0, arguments);\n }\n });\n\n _this.previousItemsProperty = props.items; // Generate unique `key` prefix for list item components.\n\n _this.generateItemKeyPrefix(); // Create `VirtualScroller` instance.\n\n\n _this.createVirtualScroller();\n\n return _this;\n }\n\n _createClass(VirtualScroller, [{\n key: \"createVirtualScroller\",\n value: function createVirtualScroller() {\n var _this2 = this;\n\n var _this$props = this.props,\n AsComponent = _this$props.as,\n items = _this$props.items,\n initialState = _this$props.initialState,\n initialCustomState = _this$props.initialCustomState,\n onStateChange = _this$props.onStateChange,\n estimatedItemHeight = _this$props.estimatedItemHeight,\n initialScrollPosition = _this$props.initialScrollPosition,\n onScrollPositionChange = _this$props.onScrollPositionChange,\n measureItemsBatchSize = _this$props.measureItemsBatchSize,\n scrollableContainer = _this$props.scrollableContainer,\n getScrollableContainer = _this$props.getScrollableContainer,\n getColumnsCount = _this$props.getColumnsCount,\n getItemId = _this$props.getItemId,\n bypass = _this$props.bypass; // Create `virtual-scroller` instance.\n\n this.virtualScroller = new VirtualScrollerCore(function () {\n return _this2.container.current;\n }, items, {\n _useTimeoutInRenderLoop: true,\n estimatedItemHeight: estimatedItemHeight,\n bypass: bypass,\n // bypassBatchSize,\n onItemInitialRender: this.onItemInitialRender,\n // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n onItemFirstRender: this.onItemFirstRender,\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n shouldUpdateLayoutOnScreenResize: this.shouldUpdateLayoutOnScreenResize,\n measureItemsBatchSize: measureItemsBatchSize,\n scrollableContainer: scrollableContainer,\n // `getScrollableContainer` property is deprecated.\n // Use `scrollableContainer` instead.\n getScrollableContainer: getScrollableContainer,\n getColumnsCount: getColumnsCount,\n getItemId: getItemId,\n tbody: AsComponent === 'tbody',\n state: initialState,\n customState: initialCustomState,\n onStateChange: onStateChange,\n getState: function getState() {\n return _this2.state;\n },\n setState: function setState(newState, _ref) {\n var willUpdateState = _ref.willUpdateState,\n didUpdateState = _ref.didUpdateState;\n _this2.willUpdateState = willUpdateState;\n _this2.didUpdateState = didUpdateState;\n\n if (_this2.state) {\n // Update existing state.\n //\n // In case of hypothetically rewriting this in React hooks,\n // it wouldn't simply be `setState({ ...prevState, ...newState })`.\n // The reason is that `setState()` would be \"asynchronous\" (not immediate),\n // and `...prevState` would be stale in cases when more than a single\n // `setState()` call is made before the state actually updates,\n // making `prevState` stale, and, as a consequence, losing some\n // of the state updates.\n // For example, the first `setState()` call updates shown item indexes,\n // and the second `setState()` call updates `verticalSpacing`:\n // if it was simply `setState({ ...prevState, ...newState })`,\n // then the second state update could overwrite the first state update,\n // resulting in incorrect items being shown/hidden.\n //\n // I guess, in hooks, it could be something like:\n //\n // const [firstShownItemIndex, setFirstShownItemIndex] = useState()\n // ...\n // const setState = useCallback((newState) => {\n // \tfor (const key in newState) {\n // \t\tswitch (key) {\n // \t\t\tcase 'firstShownItemIndex':\n // \t\t\t\tsetFirstShownItemIndex(newState[key])\n // \t\t\t\tbreak\n // \t\t\t...\n // \t\t}\n // \t}\n // \tsetFirstShownItemIndex\n // }, [])\n // const virtualScroller = new VirtualScrollerCore({\n // \tsetState,\n // \t...\n // })\n // // `getState()` function would be updated on every render.\n // virtualScroller.getState = () => ({\n // \tfirstShownItemIndex,\n // \t...\n // })\n //\n // But as long as it uses the classic `this.setState()`,\n // it's fine and simple.\n _this2.setState(newState);\n } else {\n // Set initial state.\n willUpdateState(newState);\n _this2.state = newState;\n didUpdateState();\n }\n }\n });\n } // This is a proxy for `VirtualScroller`'s `.updateLayout` instance method.\n\n }, {\n key: \"shouldUseRefs\",\n value: function shouldUseRefs() {\n // There's no way to detect if `ref` can be passed to `component`:\n // https://github.com/facebook/react/issues/16309\n // So it only uses `ref`s for `React.Component`s.\n var itemComponent = this.props.itemComponent;\n return isComponentClass(itemComponent);\n }\n /**\r\n * Returns a `key` for an `item`'s element.\r\n * @param {object} item — The item.\r\n * @param {number} i — Item's index in `items` list.\r\n * @return {any}\r\n */\n\n }, {\n key: \"getItemKey\",\n value: function getItemKey(item, i) {\n var getItemId = this.props.getItemId;\n\n if (getItemId) {\n return getItemId(item);\n }\n\n return \"\".concat(this.itemKeyPrefix, \":\").concat(i);\n }\n /**\r\n * A proxy to `VirtualScroller.getItemCoordinates(i)`.\r\n * @param {number} i\r\n * @return {object}\r\n */\n\n /*\r\n getItemCoordinates(i) {\r\n \treturn this.virtualScroller.getItemCoordinates(i)\r\n }\r\n */\n\n /**\r\n * `updateItem(i)` has been renamed to `renderItem(i)`.\r\n * @param {number} i\r\n */\n\n }, {\n key: \"updateItem\",\n value: function updateItem(i) {\n return this.renderItem(i);\n }\n /**\r\n * Re-renders an item.\r\n * @param {number} i\r\n */\n\n }, {\n key: \"renderItem\",\n value: function renderItem(i) {\n var _this3 = this;\n\n i = this.getItemIndex(i);\n\n if (i === undefined) {\n return reportError(\"Item \".concat(JSON.stringify(i), \" not found when calling \\\".renderItem()\\\"\"));\n }\n\n if (this.shouldUseRefs()) {\n // The item may be non-rendered when `.renderItem(i)` is called on it.\n // For example, when there's a \"parent comment\" having several \"replies\"\n // each of which has an autogenerated quote of the \"parent comment\"\n // and then the \"parent comment\" is updated (for example, a YouTube video\n // link gets parsed into an embedded video player) and all of its \"replies\"\n // should be updated too to show the parsed video title instead of the URL,\n // so `.renderItem(i)` is simply called on all of the \"parent post\"'s replies\n // regardless of some of those replies being rendered or not.\n if (this.itemRefs[i] && this.itemRefs[i].current) {\n var items = this.props.items; // Stores `item` here because the `i` index\n // might have changed when the callback is called,\n // or the item even may have been removed.\n\n var item = items[i];\n this.itemRefs[i].current.forceUpdate(function () {\n if (_this3._isMounted) {\n // Recalculates the `i` index here because it\n // might have changed when the callback is called,\n // or the item even may have been removed.\n var _i = items.indexOf(item);\n\n if (_i >= 0) {\n _this3.virtualScroller.onItemHeightChange(_i);\n }\n }\n });\n }\n }\n }\n }, {\n key: \"getItemIndex\",\n value: function getItemIndex(i) {\n if (typeof i === 'number') {\n return i;\n }\n\n if (_typeof(i) === 'object' && i !== null) {\n var _this$props2 = this.props,\n items = _this$props2.items,\n getItemId = _this$props2.getItemId;\n var item = i;\n i = 0;\n\n while (i < items.length) {\n if (getItemId) {\n if (getItemId(item) === getItemId(items[i])) {\n return i;\n }\n } else {\n if (item === items[i]) {\n return i;\n }\n }\n\n i++;\n }\n }\n } // Functional components can't have a `ref` assigned to them.\n // Item `ref`s are only used for calling `.renderItem(i)` instance method,\n // because `.renderItem(i)` calls `.forceUpdate()` on item `i`.\n // If a developer is not using the `.renderItem(i)` instance method\n // then `ref`s aren't required and will be omitted.\n\n }, {\n key: \"getItemRef\",\n value: function getItemRef(i) {\n if (!this.itemRefs[i]) {\n this.itemRefs[i] = /*#__PURE__*/React.createRef();\n }\n\n return this.itemRefs[i];\n }\n }, {\n key: \"getOnItemStateChange\",\n value: function getOnItemStateChange(i) {\n var _this4 = this;\n\n if (!this.onItemStateChange[i]) {\n this.onItemStateChange[i] = function (itemState) {\n return _this4.virtualScroller.onItemStateChange(i, itemState);\n };\n }\n\n return this.onItemStateChange[i];\n }\n }, {\n key: \"getOnItemHeightChange\",\n value: function getOnItemHeightChange(i) {\n var _this5 = this;\n\n if (!this.onItemHeightChange[i]) {\n this.onItemHeightChange[i] = function () {\n return _this5.virtualScroller.onItemHeightChange(i);\n };\n }\n\n return this.onItemHeightChange[i];\n }\n }, {\n key: \"generateItemKeyPrefix\",\n value: function generateItemKeyPrefix() {\n var prefix = String(Math.random()).slice(2);\n\n if (this.itemKeyPrefixes.indexOf(prefix) >= 0) {\n return this.generateItemKeyPrefix();\n }\n\n this.itemKeyPrefixes.push(prefix);\n this.itemKeyPrefix = prefix;\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var onMount = this.props.onMount; // `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 this._isMounted = true; // Start listening to scroll events.\n\n this.virtualScroller.listen();\n } // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.\n\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps, prevState) {\n if (this.state !== prevState) {\n this.willUpdateState(this.state, prevState);\n } // Returns `null` to avoid React warning:\n // \"A snapshot value (or null) must be returned. You have returned undefined\".\n\n\n return null;\n } // `componentDidUpdate()` is called immediately after React component has re-rendered.\n // That would correspond to `useLayoutEffect()` in React Hooks.\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n // If `state` did change.\n if (this.state !== prevState) {\n this.didUpdateState(prevState);\n } // If `items` property did change then update `virtual-scroller` items.\n // This could have been done in `.render()` but `.setItems()` calls\n // `.setState()` internally which would result in React throwing an error.\n\n\n var _this$props3 = this.props,\n items = _this$props3.items,\n preserveScrollPosition = _this$props3.preserveScrollPosition,\n preserveScrollPositionOnPrependItems = _this$props3.preserveScrollPositionOnPrependItems;\n\n if (items !== prevProps.items) {\n this.virtualScroller.setItems(items, {\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems || preserveScrollPosition\n });\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this._isMounted = false; // Stop listening to scroll events.\n\n this.virtualScroller.stop();\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this6 = this;\n\n var _this$props4 = this.props,\n AsComponent = _this$props4.as,\n Component = _this$props4.itemComponent,\n itemComponentProps = _this$props4.itemComponentProps,\n _items = _this$props4.items,\n estimatedItemHeight = _this$props4.estimatedItemHeight,\n bypass = _this$props4.bypass,\n preserveScrollPositionOnPrependItems = _this$props4.preserveScrollPositionOnPrependItems,\n preserveScrollPosition = _this$props4.preserveScrollPosition,\n initialScrollPosition = _this$props4.initialScrollPosition,\n onScrollPositionChange = _this$props4.onScrollPositionChange,\n measureItemsBatchSize = _this$props4.measureItemsBatchSize,\n scrollableContainer = _this$props4.scrollableContainer,\n getScrollableContainer = _this$props4.getScrollableContainer,\n getColumnsCount = _this$props4.getColumnsCount,\n initialState = _this$props4.initialState,\n initialCustomState = _this$props4.initialCustomState,\n onStateChange = _this$props4.onStateChange,\n onItemInitialRender = _this$props4.onItemInitialRender,\n onItemFirstRender = _this$props4.onItemFirstRender,\n getItemId = _this$props4.getItemId,\n onMount = _this$props4.onMount,\n className = _this$props4.className,\n rest = _objectWithoutProperties(_this$props4, _excluded);\n\n var _this$virtualScroller = this.virtualScroller.getState(),\n items = _this$virtualScroller.items,\n itemStates = _this$virtualScroller.itemStates,\n firstShownItemIndex = _this$virtualScroller.firstShownItemIndex,\n lastShownItemIndex = _this$virtualScroller.lastShownItemIndex,\n beforeItemsHeight = _this$virtualScroller.beforeItemsHeight,\n afterItemsHeight = _this$virtualScroller.afterItemsHeight; // If `items` are about to be changed then\n // store the scroll Y position for the first one\n // of the current items.\n // Previously it was being done in `componentDidUpdate()`\n // but it was later found out that it wouldn't work\n // for \"Show previous\" button because it would\n // get hidden before `componentDidUpdate()` is called.\n //\n // Consider this code example:\n //\n // const { fromIndex, items } = this.state\n // const items = allItems.slice(fromIndex)\n // return (\n // \t{fromIndex > 0 &&\n // \t\t<button onClick={this.onShowPrevious}>\n // \t\t\tShow previous\n // \t\t</button>\n // \t}\n // \t<VirtualScroller\n // \t\titems={items}\n // \t\titemComponent={ItemComponent}/>\n // )\n //\n // Consider a user clicks \"Show previous\" to show the items from the start.\n // By the time `componentDidUpdate()` is called on `<VirtualScroller/>`,\n // the \"Show previous\" button has already been hidden\n // (because there're no more \"previous\" items)\n // which results in the scroll Y position jumping forward\n // by the height of that \"Show previous\" button.\n // This is because `<VirtualScroller/>` captures scroll Y\n // position when items are prepended via `.setItems()`\n // when the \"Show previous\" button is still being shown,\n // and then restores scroll Y position in `.didUpdateState()`\n // when the \"Show previous\" button has already been hidden:\n // that's the reason for the scroll Y \"jump\".\n //\n // To prevent that, scroll Y position is captured at `render()`\n // time rather than later in `componentDidUpdate()`: this way,\n // scroll Y position is captured while the \"Show previous\" button\n // is still being shown.\n //\n\n\n var newItems = this.props.items;\n var previousItems = items; // this.virtualScroller.getState().items\n // There's one case when `newItems !== previousItems` is `true`\n // from the start: when `initialState.items` are passed.\n // To handle that single case `this.previousItemsProperty`\n // is tracked and `this.itemsPropertyHasChanged` flag is set.\n\n if (!this.itemsPropertyWasChanged) {\n this.itemsPropertyWasChanged = this.props.items !== this.previousItemsProperty;\n }\n\n this.previousItemsProperty = this.props.items;\n\n if (this.itemsPropertyWasChanged && newItems !== previousItems) {\n var itemsDiff = this.virtualScroller.getItemsDiff(previousItems, newItems);\n\n if (itemsDiff && itemsDiff.prependedItemsCount === 0 && itemsDiff.appendedItemsCount > 0) {// If it's just items that have been appended\n // then no need to re-generate the prefix\n // and to fix scroll position and to clear caches.\n } else {\n // If the items update was incremental, then it's possible\n // that some items were prepended, and so the scroll Y position\n // should be restored after rendering those new items\n // in order for the currently shown items to stay\n // on the same position on screen.\n // (only if explicitly opted into using this feature)\n //\n // If the items update wasn't incremental\n // then there's no point in restoring scroll position.\n //\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n //\n if (itemsDiff) {\n var prependedItemsCount = itemsDiff.prependedItemsCount;\n\n if (prependedItemsCount > 0) {\n if (preserveScrollPositionOnPrependItems || preserveScrollPosition) {\n if (firstShownItemIndex === 0) {\n this.virtualScroller.listHeightChangeWatcher.snapshot({\n previousItems: previousItems,\n newItems: newItems,\n prependedItemsCount: prependedItemsCount\n });\n }\n }\n }\n } // Reset the unique `key` prefix for item component keys.\n\n\n if (!getItemId) {\n this.generateItemKeyPrefix();\n } // Reset item refs.\n\n\n this.itemRefs = new Array(newItems.length);\n }\n }\n\n var tbody = this.virtualScroller.tbody;\n return /*#__PURE__*/React.createElement(AsComponent, _extends({}, rest, {\n ref: this.container,\n className: tbody ? className ? className + ' ' + 'VirtualScroller' : 'VirtualScroller' : className,\n style: {\n paddingTop: tbody ? undefined : px(beforeItemsHeight),\n paddingBottom: tbody ? undefined : px(afterItemsHeight)\n }\n }), items.map(function (item, i) {\n if (i >= firstShownItemIndex && i <= lastShownItemIndex) {\n return /*#__PURE__*/React.createElement(Component, _extends({}, itemComponentProps, {\n key: _this6.getItemKey(item, i),\n ref: _this6.shouldUseRefs() ? _this6.getItemRef(i) : undefined,\n state: itemStates && itemStates[i],\n onStateChange: _this6.getOnItemStateChange(i),\n onHeightChange: _this6.getOnItemHeightChange(i)\n }), item);\n }\n\n return null;\n }));\n }\n }]);\n\n return VirtualScroller;\n}(React.Component);\n/**\r\n * Checks if the argument is a `React.Component` class.\r\n * https://overreacted.io/how-does-react-tell-a-class-from-a-function/\r\n * @param {any} Component\r\n * @return {object} [result] Returns `undefined` if it's not a `React.Component`. Returns an empty object if it's a `React.Component` (`.isReactComponent` is an empty object).\r\n */\n\n\n_defineProperty(VirtualScroller, \"propTypes\", {\n as: elementType,\n items: PropTypes.arrayOf(PropTypes.any).isRequired,\n itemComponent: elementType.isRequired,\n itemComponentProps: PropTypes.object,\n estimatedItemHeight: PropTypes.number,\n bypass: PropTypes.bool,\n // bypassBatchSize: PropTypes.number,\n preserveScrollPositionOnPrependItems: PropTypes.bool,\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n preserveScrollPosition: PropTypes.bool,\n measureItemsBatchSize: PropTypes.number,\n scrollableContainer: PropTypes.any,\n // `getScrollableContainer` property is deprecated.\n // Use `scrollableContainer` instead.\n getScrollableContainer: PropTypes.func,\n getColumnsCount: PropTypes.func,\n getItemId: PropTypes.func,\n className: PropTypes.string,\n onMount: PropTypes.func,\n onItemInitialRender: PropTypes.func,\n // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n onItemFirstRender: PropTypes.func,\n initialScrollPosition: PropTypes.number,\n onScrollPositionChange: PropTypes.func,\n onStateChange: PropTypes.func,\n initialCustomState: PropTypes.object,\n initialState: PropTypes.shape({\n items: PropTypes.arrayOf(PropTypes.object).isRequired,\n itemStates: PropTypes.arrayOf(PropTypes.any),\n firstShownItemIndex: PropTypes.number.isRequired,\n lastShownItemIndex: PropTypes.number.isRequired,\n beforeItemsHeight: PropTypes.number.isRequired,\n afterItemsHeight: PropTypes.number.isRequired,\n itemHeights: PropTypes.arrayOf(PropTypes.number).isRequired,\n columnsCount: PropTypes.number,\n verticalSpacing: PropTypes.number\n })\n});\n\n_defineProperty(VirtualScroller, \"defaultProps\", {\n as: 'div'\n});\n\nexport { VirtualScroller as default };\n\nfunction isComponentClass(Component) {\n // return Component.prototype instanceof React.Component\n // `React.memo()` returns `.prototype === undefined` for some reason.\n return Component.prototype && Component.prototype.isReactComponent;\n}\n//# sourceMappingURL=VirtualScroller.js.map"],"names":["getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","module","process","hr","uptime","Date","getTime","call","this","root","window","global","vendors","suffix","raf","caf","i","length","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","e","round","push","handle","fn","apply","arguments","object","requestAnimationFrame","cancelAnimationFrame","cancel","delay","startedAt","animationFrame","tick","clear","clearTimeout","timeout","px","number","toFixed","BROWSER_NOT_SUPPORTED_ERROR","supportsTbody","document","documentMode","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","ItemsContainer","getElement","instance","Constructor","TypeError","_classCallCheck","protoProps","staticProps","value","renderedElementIndex","childNodes","getBoundingClientRect","top","height","firstChild","removeChild","prototype","_typeof","obj","Symbol","iterator","constructor","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_createSuper","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","Boolean","valueOf","_isNativeReflectConstruct","result","Super","_getPrototypeOf","NewTarget","_possibleConstructorReturn","self","ReferenceError","_assertThisInitialized","getPrototypeOf","_createClass","ScrollableContainer","element","getItemsContainerElement","scrollTop","scrollY","scrollTo","offsetWidth","offsetHeight","scrollableContainerTop","scrollableContainerBorderTopWidth","clientTop","getScrollY","_onScroll","_this","addEventListener","removeEventListener","_onResize","unobserve","_this2","ResizeObserver","resizeObserver","entries","observe","unlistenGlobalResize","addGlobalResizeListener","itemsContainerElement","ScrollableWindowContainer","_ScrollableContainer","subClass","superClass","create","_inherits","_super","pageYOffset","innerWidth","innerHeight","borderTopWidth","body","_onResize2","onResize","_ref","onResizeListener","fullscreenElement","contains","ListTopOffsetWatcher","getListTopOffset","onListTopOffsetChange","listTopOffset","undefined","listTopOffsetInsideScrollableContainer","start","isRendered","watchListTopOffset","watchListTopOffsetTimer","check","createItemsContainer","createScrollableContainer","scrollableContainer","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","minLen","n","toString","name","test","_unsupportedIterableToArray","_nonIterableSpread","len","arr2","log","isDebug","_console","_len","args","_key","console","concat","warn","_console2","_len2","_key2","warningsAreErrors","reportError","_len3","_key3","_console3","Error","join","error","debug","getGlobalVariable","ownKeys","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","Layout","bypass","estimatedItemHeight","measureItemsBatchSize","getPrerenderMargin","getVerticalSpacing","getVerticalSpacingBeforeResize","getColumnsCount","getColumnsCountBeforeResize","getItemHeight","getItemHeightBeforeResize","getBeforeResizeItemsCount","getAverageItemHeight","getMaxVisibleAreaHeight","getPreviouslyCalculatedLayout","_ref2","firstShownItemIndex","lastShownItemIndex","itemsCount","columnsCount","getInitialLastShownItemIndex","beforeItemsHeight","afterItemsHeight","_ref3","estimatedRowsCount","getEstimatedRowsCountForHeight","min","getEstimatedItemHeight","verticalSpacing","ceil","_ref4","_ref5","_ref6","prependedItemsCount","appendedItemsCount","shouldRestoreScrollPosition","averageItemHeight","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","onStart","onStop","onHeightChange","onWidthChange","onNoChange","prevScrollableContainerWidth","scrollableContainerWidth","prevScrollableContainerHeight","scrollableContainerHeight","getWidth","getHeight","func","interval","Promise","resolve","debounce","SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL","scrollableContainerUnlistenResize","BeforeResize","getState","state","itemHeights","_includesBeforeResizeInState","prevState","_this$getState","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","itemsContainer","onScroll","initialScrollPosition","onScrollPositionChange","isImmediateLayoutScheduled","hasNonRenderedItemsAtTheTop","hasNonRenderedItemsAtTheBottom","getLatestLayoutVisibleArea","onScrolledToTop","waitForScrollingToStop","scrollByY","scrollToY","ignoreScrollEvents","cancelOnStopScrollingTimer","forceUpdate","bottom","onScrollOnStopScrolling","watchOnStopScrolling","stopListeningToScroll","onScrollListener","stopReportingScrollPositionChange","onStopScrollingListener","onStopScrollingTimer","delayed","ON_STOP_SCROLLING_INACTIVE_PERIOD","ListHeightChangeWatcher","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","hasOwnProperty","is","x","y","shallowEqual","objA","objB","keysA","keysB","getStateSnapshot","stateSnapshot","itemStates","VirtualScroller","items","options","_getColumnsCount","getItemsContainerTopOffset","listTopOffsetWatcher","onListTopOffset","resize","stop","scroll","cancelLayoutTimer","newState","onStateChange","layoutUpdateReason","resetLayoutAfterResize","newItemsWillBeRendered","itemHeightsThatChangedWhileNewItemsWereBeingRendered","itemStatesThatChangedWhileNewItemsWereBeingRendered","stateUpdate","itemsDiff","getItemsDiff","onPrepend","initialize","onNewItemsRendered","verticalSpacingStateUpdate","measureItemHeightsAndSpacingAndUpdateTablePadding","cleanedUpBeforeResize","cleanUpBeforeResizeItemHeights","updateStateRightAfterRender","reason","setState","_this$getShownItemInd","getShownItemIndexes","shownItemsHeight","listHeightChangeWatcher","hasSnapshot","getAnchorItemIndex","validateWillBeHiddenItemHeightsAreAccurate","updateShownItemIndexes","getAfterItemsHeight","getItemsCount","layoutDuration","SLOW_LAYOUT_DURATION","getAverage","onBeforeShowItems","previouslyCalculatedLayout","skip","isResizing","cancelScheduledLayout","onUpdateShownItemIndexes","updateLayout","customState","getScrollableContainer","getItemId","tbody","_useTimeoutInRenderLoop","_waitForScrollingToStop","onItemInitialRender","onItemFirstRender","engine","DOMEngine","isItemEqual","a","b","initialItems","item","indexOf","willUpdateState","didUpdateState","shouldResetLayout","columnsCountForState","getActualColumnsCountForState","getActualColumnsCount","getInitialLayoutState","prevWidth","newWidth","layoutTimer","latestLayoutVisibleArea","getListTopOffsetInsideScrollableContainer","onInitialState","getInitialState","_this$layout$getIniti","getInitialLayoutValues","listen","classList","add","style","getElementById","createElement","innerText","replace","head","appendChild","addTbodyStyles","measureItemHeights","measureVerticalSpacing","setProperty","visibleArea","getVisibleAreaBounds","itemTopOffsetInList","getItemTopOffset","layoutTimerStateUpdate","newLayout","_i","_Object$keys","parseInt","_i2","_Object$keys2","_i3","listBottomOffsetChange","getListBottomOffsetChange","scheduleLayoutTimer","_this$getState3","renderedItemsCount","firstShownRowTopOffset","firstShownRowHeight","remeasureItemHeight","newItemState","JSON","stringify","String","_this$getState5","newHeight","updatePreviouslyCalculatedLayoutOnItemHeightChange","heightDifference","isValid","previouslyMeasuredItemHeight","actualItemHeight","_this$getVisibleArea","getVisibleArea","setItems","layoutUpdate","itemsUpdateInfo","_this$getState6","_this$getState7","_ref10","preserveScrollPositionOnPrependItems","preserveScrollPosition","getLayoutUpdateForItemsDiff","snapshot","prepend","append","shouldIncludeBeforeResizeValuesInState","shouldDiscardBeforeResizeItemHeights","isEqual","firstPreviousItemIndex","lastPreviousItemIndex","array","findInArray","offset","arePreviousItemsPreserved","_getItemsDiff","_this$newItemsWillBeR","newLastShownItemIndex","snapshotBeforeResizeItemHeights","_excluded","_extends","assign","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","elementType","PropTypes","oneOfType","string","_React$Component","React","createRef","virtualScroller","previousItemsProperty","generateItemKeyPrefix","createVirtualScroller","_this$props","AsComponent","as","initialState","initialCustomState","VirtualScrollerCore","current","shouldUpdateLayoutOnScreenResize","Component","itemComponent","isReactComponent","itemKeyPrefix","renderItem","_this3","getItemIndex","shouldUseRefs","itemRefs","_isMounted","onItemHeightChange","_this$props2","_this4","onItemStateChange","itemState","_this5","prefix","random","itemKeyPrefixes","onMount","prevProps","_this$props3","_this6","_this$props4","itemComponentProps","className","rest","_this$virtualScroller","itemsPropertyWasChanged","ref","paddingTop","paddingBottom","map","getItemKey","getItemRef","getOnItemStateChange","getOnItemHeightChange","arrayOf","any","isRequired","bool","shape"],"mappings":"8iBAOA,oFCNA,WACE,IAAIA,EAAgBC,EAAQC,EAAUC,EAAgBC,EAAcC,EAExC,oBAAhBC,aAA+C,OAAhBA,aAAyBA,YAAYC,IAC9EC,UAAiB,WACf,OAAOF,YAAYC,OAEQ,oBAAZE,SAAuC,OAAZA,SAAqBA,QAAQR,QACzEO,UAAiB,WACf,OAAQR,IAAmBI,GAAgB,KAE7CH,EAASQ,QAAQR,OAMjBE,GALAH,EAAiB,WACf,IAAIU,EAEJ,OAAe,KADfA,EAAKT,KACK,GAAWS,EAAG,OAG1BL,EAA4B,IAAnBI,QAAQE,SACjBP,EAAeD,EAAiBE,GACvBO,KAAKL,KACdC,UAAiB,WACf,OAAOI,KAAKL,MAAQL,GAEtBA,EAAWU,KAAKL,QAEhBC,UAAiB,WACf,OAAO,IAAII,MAAOC,UAAYX,GAEhCA,GAAW,IAAIU,MAAOC,aAGvBC,KAAKC,MDhCJC,EAAyB,oBAAXC,OAAyBC,EAASD,OAChDE,EAAU,CAAC,MAAO,UAClBC,EAAS,iBACTC,EAAML,EAAK,UAAYI,GACvBE,EAAMN,EAAK,SAAWI,IAAWJ,EAAK,gBAAkBI,GAEpDG,EAAI,GAAIF,GAAOE,EAAIJ,EAAQK,OAAQD,IACzCF,EAAML,EAAKG,EAAQI,GAAK,UAAYH,GACpCE,EAAMN,EAAKG,EAAQI,GAAK,SAAWH,IAC5BJ,EAAKG,EAAQI,GAAK,gBAAkBH,GAI7C,IAAIC,IAAQC,EAAK,CACf,IAAIG,EAAO,EACPC,EAAK,EACLC,EAAQ,GAGZN,EAAM,SAASO,GACb,GAAoB,IAAjBD,EAAMH,OAAc,CACrB,IAAIK,EAAO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oBd,UAAU1iB,OAC9BujB,aAAcb,UAAU2D,MAAM,CAC5B/N,MAAOoK,UAAUuD,QAAQvD,UAAU1iB,QAAQmmB,WAC3C/N,WAAYsK,UAAUuD,QAAQvD,UAAUwD,KACxCvZ,oBAAqB+V,UAAU9hB,OAAOulB,WACtCvZ,mBAAoB8V,UAAU9hB,OAAOulB,WACrCnZ,kBAAmB0V,UAAU9hB,OAAOulB,WACpClZ,iBAAkByV,UAAU9hB,OAAOulB,WACnC3T,YAAakQ,UAAUuD,QAAQvD,UAAU9hB,QAAQulB,WACjDrZ,aAAc4V,UAAU9hB,OACxB2M,gBAAiBmV,UAAU9hB,WAI/B4K,GAAgB6M,GAAiB,eAAgB,CAC/CiL,GAAI"}
1
+ {"version":3,"file":"virtual-scroller-react.js","sources":["../node_modules/raf/index.js","../node_modules/performance-now/lib/performance-now.js","../node_modules/request-animation-frame-timeout/modules/index.js","../modules/utility/px.js","../modules/DOM/tbody.js","../modules/DOM/ItemsContainer.js","../modules/DOM/ScrollableContainer.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/ListHeightChangeWatcher.js","../modules/ItemHeights.js","../modules/utility/shallowEqual.js","../modules/utility/getStateSnapshot.js","../modules/VirtualScroller.js","../modules/getVerticalSpacing.js","../modules/getItemsDiff.js","../modules/react/VirtualScroller.js"],"sourcesContent":["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","/**\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';\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 function addTbodyStyles(tbody) {\n // `classList.add` is supported in Internet Explorer 10+.\n tbody.classList.add('VirtualScroller');\n var style = document.getElementById('VirtualScrollerStyle');\n\n if (!style) {\n style = document.createElement('style');\n style.id = 'VirtualScrollerStyle'; // CSS variables aren't supported in Internet Explorer.\n\n style.innerText = \"\\n\\t\\t\\ttbody.VirtualScroller:before {\\n\\t\\t\\t\\tcontent: '';\\n\\t\\t\\t\\tdisplay: table-row;\\n\\t\\t\\t\\theight: var(--VirtualScroller-paddingTop);\\n\\t\\t\\t}\\n\\t\\t\\ttbody.VirtualScroller:after {\\n\\t\\t\\t\\tcontent: '';\\n\\t\\t\\t\\tdisplay: table-row;\\n\\t\\t\\t\\theight: var(--VirtualScroller-paddingBottom);\\n\\t\\t\\t}\\n\\t\\t\".replace(/[\\n\\t]/g, '');\n document.head.appendChild(style);\n }\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 _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); return Constructor; }\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 /**\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 _createClass(ItemsContainer, [{\n key: \"getNthRenderedItemTopOffset\",\n value: function getNthRenderedItemTopOffset(renderedElementIndex) {\n return this.getElement().childNodes[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.getElement().childNodes[renderedElementIndex].offsetHeight\n return this.getElement().childNodes[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\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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 } }); 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); return Constructor; }\n\nvar ScrollableContainer = /*#__PURE__*/function () {\n /**\r\n * Constructs a new \"scrollable container\" from an element.\r\n * @param {Element} scrollableContainer\r\n * @param {func} getItemsContainerElement — Returns items \"container\" element.\r\n */\n function ScrollableContainer(element, getItemsContainerElement) {\n _classCallCheck(this, ScrollableContainer);\n\n this.element = element;\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.element.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.element.scrollTo) {\n this.element.scrollTo(0, scrollY);\n } else {\n this.element.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 return this.element.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.element && !precise) {\n // \treturn getScreenHeight()\n // }\n return this.element.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.element.getBoundingClientRect().top;\n var scrollableContainerBorderTopWidth = this.element.clientTop;\n var itemsContainerTop = this.getItemsContainerElement().getBoundingClientRect().top;\n return itemsContainerTop - scrollableContainerTop + this.getScrollY() - scrollableContainerBorderTopWidth;\n } // isVisible() {\n // \tconst { top, bottom } = this.element.getBoundingClientRect()\n // \treturn bottom > 0 && top < getScreenHeight()\n // }\n\n /**\r\n * Adds a \"scroll\" event listener to the \"scrollable container\".\r\n * @param {onScroll} 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(_onScroll) {\n var _this = this;\n\n this.element.addEventListener('scroll', _onScroll);\n return function () {\n return _this.element.removeEventListener('scroll', _onScroll);\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 var _this2 = this;\n\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.element`.\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 resizeObserver.observe(this.element);\n\n unobserve = function unobserve() {\n return resizeObserver.unobserve(_this2.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, window, 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","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); 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// <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.isRendered = true;\n this.watchListTopOffset();\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isRendered = 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.isRendered) {\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';\nimport ScrollableContainer, { ScrollableWindowContainer } from './ScrollableContainer';\nimport ListTopOffsetWatcher from './ListTopOffsetWatcher';\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(scrollableContainer, getItemsContainerElement) {\n if (scrollableContainer) {\n return new ScrollableContainer(scrollableContainer, 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}\nexport function reportError() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\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 log.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 new Error(['[virtual-scroller]'].concat(args).join(' '));\n }, 0);\n } else {\n var _console3;\n\n // On a server.\n (_console3 = console).error.apply(_console3, _toConsumableArray(['[virtual-scroller]'].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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); return Constructor; }\n\nimport log, { warn } from './utility/debug';\n\nvar Layout = /*#__PURE__*/function () {\n function Layout(_ref) {\n var bypass = _ref.bypass,\n estimatedItemHeight = _ref.estimatedItemHeight,\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.estimatedItemHeight = estimatedItemHeight;\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 }\n\n _createClass(Layout, [{\n key: \"getInitialLayoutValues\",\n value: function getInitialLayoutValues(_ref2) {\n var itemsCount = _ref2.itemsCount,\n columnsCount = _ref2.columnsCount;\n var firstShownItemIndex;\n var lastShownItemIndex; // If there're no items then `firstShownItemIndex` stays `undefined`.\n\n if (itemsCount > 0) {\n firstShownItemIndex = 0;\n lastShownItemIndex = this.getInitialLastShownItemIndex({\n itemsCount: itemsCount,\n columnsCount: columnsCount,\n firstShownItemIndex: firstShownItemIndex\n });\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 }\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 return this.getAverageItemHeight() || this.estimatedItemHeight || 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 // 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 warn('~ Prepended items count', prependedItemsCount, 'is not divisible by Columns Count', columnsCount, '~');\n warn('Reset Layout');\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 // `setState()` calls are \"asynchronous\" (delayed execution).\n //\n // So, for example, the user calls `setItems()` with one set of items.\n // A `setState()` 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 `setState()` 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 `setState()` 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 MOUNTED: 'mounted',\n ACTUAL_ITEM_HEIGHTS_HAVE_BEEN_MEASURED: 'actual 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); 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';\nimport log from './utility/debug';\n\nvar Resize = /*#__PURE__*/function () {\n function Resize(_ref) {\n var _this = this;\n\n var bypass = _ref.bypass,\n scrollableContainer = _ref.scrollableContainer,\n onStart = _ref.onStart,\n onStop = _ref.onStop,\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 (!_this.isRendered) {\n return;\n }\n\n var prevScrollableContainerWidth = _this.scrollableContainerWidth;\n var prevScrollableContainerHeight = _this.scrollableContainerHeight;\n _this.scrollableContainerWidth = _this.scrollableContainer.getWidth();\n _this.scrollableContainerHeight = _this.scrollableContainer.getHeight();\n\n if (_this.scrollableContainerWidth === prevScrollableContainerWidth) {\n if (_this.scrollableContainerHeight === 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.scrollableContainerHeight);\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.scrollableContainerWidth);\n }\n });\n\n this.bypass = bypass;\n this.scrollableContainer = scrollableContainer;\n this.onHeightChange = onHeightChange;\n this.onWidthChange = onWidthChange;\n this.onNoChange = onNoChange;\n this.onResize = debounce(this._onResize, SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL, {\n onStart: onStart,\n onStop: onStop\n });\n }\n\n _createClass(Resize, [{\n key: \"listen\",\n value: function listen() {\n if (this.bypass) {\n return;\n }\n\n this.isRendered = true;\n this.scrollableContainerWidth = this.scrollableContainer.getWidth();\n this.scrollableContainerHeight = this.scrollableContainer.getHeight();\n this.scrollableContainerUnlistenResize = this.scrollableContainer.onResize(this.onResize);\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.isRendered = false;\n\n if (this.scrollableContainerUnlistenResize) {\n this.scrollableContainerUnlistenResize();\n this.scrollableContainerUnlistenResize = 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\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function}\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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); return Constructor; }\n\nimport log from './utility/debug';\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 } // 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.setState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.setState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n\n _createClass(BeforeResize, [{\n key: \"onInitialState\",\n value: function onInitialState(state) {\n if (state) {\n if (state.beforeResize) {\n if (state.beforeResize.itemHeights.length === 0) {\n state.beforeResize = undefined;\n }\n }\n\n if (state.beforeResize) {\n this._includesBeforeResizeInState = true;\n }\n }\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(prevState) {\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.setState()` call that will update\n // `beforeResize` property of `state`. Ideally, it should be updated\n // immediately, but since `this.setState()` 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.setState()` 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//# 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); 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';\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.onScrollOnStopScrolling = 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: \"listen\",\n value: function listen() {\n if (this.initialScrollPosition !== undefined) {\n this.scrollToY(this.initialScrollPosition);\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 if (this.stopReportingScrollPositionChange) {\n this.stopReportingScrollPositionChange();\n this.stopReportingScrollPositionChange = undefined;\n }\n\n if (this.stopListeningToScroll) {\n this.stopListeningToScroll();\n this.stopListeningToScroll = undefined;\n }\n\n if (this.onStopScrollingListener) {\n this.onStopScrollingListener = undefined;\n }\n\n if (this.onScrollOnStopScrolling) {\n this.onScrollOnStopScrolling = undefined;\n }\n\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.onScrollOnStopScrolling) {\n _this2.onScrollOnStopScrolling = undefined;\n\n _this2.onScroll({\n delayed: true\n });\n }\n\n if (_this2.onStopScrollingListener) {\n var onStopScrollingListener = _this2.onStopScrollingListener;\n _this2.onStopScrollingListener = undefined; // `onStopScrollingListener()` may hypothetically schedule\n // another `onStopScrolling()` listener, so set\n // `this.onStopScrollingListener` to `undefined` before\n // calling it rather than after.\n\n log('~ The user has stopped scrolling ~');\n onStopScrollingListener();\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\n }, {\n key: \"onStopScrolling\",\n value: function onStopScrolling(onStopScrollingListener) {\n this.onStopScrollingListener = onStopScrollingListener;\n\n if (!this.onStopScrollingTimer) {\n this.watchOnStopScrolling();\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); return Constructor; }\n\nvar ListHeightChangeWatcher = /*#__PURE__*/function () {\n function ListHeightChangeWatcher(_ref) {\n var itemsContainer = _ref.itemsContainer,\n getListTopOffset = _ref.getListTopOffset;\n\n _classCallCheck(this, ListHeightChangeWatcher);\n\n this.itemsContainer = itemsContainer;\n this.getListTopOffset = getListTopOffset;\n }\n /**\r\n * `<ReactVirtualScroller/>` calls this method.\r\n * @param {any[]} previousItems\r\n * @param {any[]} newItems\r\n * @param {number} prependedItemsCount\r\n */\n\n\n _createClass(ListHeightChangeWatcher, [{\n key: \"snapshot\",\n value: function snapshot(_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 // If the scroll position has already been captured for restoration,\n // then don't capture it the second time.\n // Capturing scroll position could happen when using `<ReactVirtualScroller/>`\n // because it calls `ListHeightChangeWatcher.snapshot()` inside `ReactVirtualScroller.render()`\n // which is followed by `<VirtualScroller/>`'s `.componentDidUpdate()`\n // that also calls `ListHeightChangeWatcher.snapshot()` with the same arguments,\n // so that second call to `ListHeightChangeWatcher.snapshot()` is ignored.\n // Calling `ListHeightChangeWatcher.snapshot()` inside `ReactVirtualScroller.render()`\n // is done to prevent scroll Y position from jumping\n // when showing the first page of the \"Previous items\".\n // See the long section of comments in `ReactVirtualScroller.render()`\n // method for more info on why is `ListHeightChangeWatcher.snapshot()` called there.\n\n\n if (this._snapshot && this._snapshot.previousItems === previousItems && this._snapshot.newItems === newItems) {\n return;\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 ListHeightChangeWatcher;\n}();\n\nexport { ListHeightChangeWatcher as default };\n//# sourceMappingURL=ListHeightChangeWatcher.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); return Constructor; }\n\nimport log, { warn, isDebug, reportError } from './utility/debug';\n\nvar ItemHeights = /*#__PURE__*/function () {\n function ItemHeights(container, getItemHeight, setItemHeight) {\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 * Is called after `.reset()`.\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: \"initialize\",\n value: function initialize(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 // `.onItemHeightChange()` every time an item's height changes.\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, '. An item\\'s height is allowed to change only in two cases: when the item\\'s \"state\" changes and the developer calls `onItemStateChange(i, newState)`, or when the item\\'s height changes for some other reason and the developer calls `onItemHeightChange(i)`. Perhaps you forgot to persist the item\\'s \"state\" by calling `onItemStateChange(i, newState)` when it changed, and that \"state\" got lost when the item element was unmounted, which resulted in a different height when the item was shown again having its \"state\" reset.'); // 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 `.onItemHeightChange()`,\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(`\"onItemHeightChange()\" has been called for item ${i}, but that item isn't rendered.`)\n // \treturn\n // }\n // if (previousHeight === undefined) {\n // \treportError(`\"onItemHeightChange()\" 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","// 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\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { 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); 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 { supportsTbody, BROWSER_NOT_SUPPORTED_ERROR, addTbodyStyles, setTbodyPadding } from './DOM/tbody';\nimport DOMEngine from './DOM/Engine';\nimport Layout, { LAYOUT_REASON } from './Layout';\nimport Resize from './Resize';\nimport BeforeResize from './BeforeResize';\nimport Scroll from './Scroll';\nimport ListHeightChangeWatcher from './ListHeightChangeWatcher';\nimport ItemHeights from './ItemHeights';\nimport _getItemsDiff from './getItemsDiff';\nimport getVerticalSpacing from './getVerticalSpacing';\nimport log, { warn, isDebug, reportError } from './utility/debug';\nimport shallowEqual from './utility/shallowEqual';\nimport getStateSnapshot from './utility/getStateSnapshot';\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, \"getActualColumnsCountForState\", function () {\n return _this._getColumnsCount ? _this._getColumnsCount(_this.scrollableContainer) : undefined;\n });\n\n _defineProperty(this, \"getVerticalSpacing\", function () {\n return _this.verticalSpacing || 0;\n });\n\n _defineProperty(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 _defineProperty(this, \"stop\", function () {\n _this.isRendered = false;\n\n _this.resize.stop();\n\n _this.scroll.stop();\n\n if (_this.listTopOffsetWatcher) {\n _this.listTopOffsetWatcher.stop();\n }\n\n _this.cancelLayoutTimer({});\n });\n\n _defineProperty(this, \"willUpdateState\", function (newState, prevState) {\n // Ignore setting initial state.\n if (!prevState) {\n return;\n } // This function isn't currently used.\n // Was previously used to capture scroll position in order to\n // restore it later after the new state is rendered.\n\n });\n\n _defineProperty(this, \"didUpdateState\", function (prevState) {\n var newState = _this.getState();\n\n if (_this.onStateChange) {\n if (!shallowEqual(newState, prevState)) {\n _this.onStateChange(newState, prevState);\n }\n } // Ignore setting initial state.\n\n\n if (!prevState) {\n return;\n }\n\n if (!_this.isRendered) {\n return;\n }\n\n log('~ Rendered ~');\n\n if (isDebug()) {\n log('State', getStateSnapshot(newState));\n }\n\n var layoutUpdateReason;\n\n if (_this.firstNonMeasuredItemIndex !== undefined) {\n layoutUpdateReason = LAYOUT_REASON.ACTUAL_ITEM_HEIGHTS_HAVE_BEEN_MEASURED;\n }\n\n if (_this.resetLayoutAfterResize) {\n layoutUpdateReason = LAYOUT_REASON.VIEWPORT_WIDTH_CHANGED;\n } // If `this.resetLayoutAfterResize` flag was reset after calling\n // `this.measureItemHeightsAndSpacingAndUpdateTablePadding()`\n // then there would be a bug because\n // `this.measureItemHeightsAndSpacingAndUpdateTablePadding()`\n // calls `this.setState({ verticalSpacing })` which calls\n // `this.didUpdateState()` immediately, so `this.resetLayoutAfterResize`\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.resetLayoutAfterResize` flag\n // and reset it right away to prevent any such potential bugs.\n //\n\n\n var resetLayoutAfterResize = _this.resetLayoutAfterResize; // Reset `this.firstNonMeasuredItemIndex`.\n\n _this.firstNonMeasuredItemIndex = undefined; // Reset `this.resetLayoutAfterResize` flag.\n\n _this.resetLayoutAfterResize = 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;\n\n if (resetLayoutAfterResize) {\n // Reset measured item heights on viewport width change.\n _this.itemHeights.reset(); // Reset `verticalSpacing` (will be re-measured).\n\n\n _this.verticalSpacing = undefined;\n }\n\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 `setState()` 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 `setState()` call being overwritten\n // by the second `setState()` 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 `.onRendered()`.\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(); // `newState.itemHeights` is an array of `undefined`s.\n\n\n _this.itemHeights.initialize(newState.itemHeights);\n }\n\n if (!resetLayoutAfterResize) {\n // The call to `this.onNewItemsRendered()` must precede the call to\n // `.measureItemHeights()` which is called in `.onRendered()` 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 (_this.onNewItemsRendered(itemsDiff, newState) !== 'SEAMLESS_PREPEND') {\n layoutUpdateReason = LAYOUT_REASON.ITEMS_CHANGED;\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 (newState.firstShownItemIndex !== prevState.firstShownItemIndex || newState.lastShownItemIndex !== prevState.lastShownItemIndex || newState.items !== prevState.items || resetLayoutAfterResize) {\n var verticalSpacingStateUpdate = _this.measureItemHeightsAndSpacingAndUpdateTablePadding();\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.setState()` 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(prevState);\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 (layoutUpdateReason) {\n _this.updateStateRightAfterRender({\n stateUpdate: stateUpdate,\n reason: layoutUpdateReason\n });\n } else if (stateUpdate) {\n _this.setState(stateUpdate);\n }\n });\n\n _defineProperty(this, \"updateShownItemIndexes\", function (_ref) {\n var stateUpdate = _ref.stateUpdate;\n var startedAt = Date.now(); // Get shown item indexes.\n\n var _this$getShownItemInd = _this.getShownItemIndexes(),\n firstShownItemIndex = _this$getShownItemInd.firstShownItemIndex,\n lastShownItemIndex = _this$getShownItemInd.lastShownItemIndex,\n shownItemsHeight = _this$getShownItemInd.shownItemsHeight,\n firstNonMeasuredItemIndex = _this$getShownItemInd.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.listHeightChangeWatcher.hasSnapshot()) {\n if (lastShownItemIndex < _this.listHeightChangeWatcher.getAnchorItemIndex()) {\n lastShownItemIndex = _this.listHeightChangeWatcher.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 `.onItemStateChange()` and `.onItemHeightChange(i)`.\n\n\n if (!_this.validateWillBeHiddenItemHeightsAreAccurate(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 _this.updateShownItemIndexes({\n stateUpdate: stateUpdate\n });\n } // Measure \"before\" items height.\n\n\n var beforeItemsHeight = _this.layout.getBeforeItemsHeight(firstShownItemIndex); // Measure \"after\" items height.\n\n\n var afterItemsHeight = _this.layout.getAfterItemsHeight(lastShownItemIndex, _this.getItemsCount());\n\n var layoutDuration = Date.now() - startedAt; // Debugging.\n\n log('~ Layout values ' + (_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\n _this.firstNonMeasuredItemIndex = firstNonMeasuredItemIndex; // 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 `.onItemHeightChange(i)`.\n //\n // If, for example, an item height was updated externally via `.onItemHeightChange(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 `setState()` 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.setState(_objectSpread({\n firstShownItemIndex: firstShownItemIndex,\n lastShownItemIndex: lastShownItemIndex,\n beforeItemsHeight: beforeItemsHeight,\n afterItemsHeight: afterItemsHeight\n }, stateUpdate));\n });\n\n _defineProperty(this, \"onUpdateShownItemIndexes\", function (_ref2) {\n var reason = _ref2.reason,\n stateUpdate = _ref2.stateUpdate;\n\n // In case of \"don't do anything\".\n var skip = function skip() {\n if (stateUpdate) {\n _this.setState(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.resetLayoutAfterResize || _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\n _this.updateShownItemIndexes({\n stateUpdate: stateUpdate\n });\n });\n\n _defineProperty(this, \"updateLayout\", function () {\n return _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.MANUAL\n });\n });\n\n _defineProperty(this, \"layout\", function () {\n return _this.updateLayout();\n });\n\n var onStateChange = options.onStateChange,\n customState = options.customState,\n initialScrollPosition = options.initialScrollPosition,\n onScrollPositionChange = options.onScrollPositionChange,\n measureItemsBatchSize = options.measureItemsBatchSize,\n getScrollableContainer = options.getScrollableContainer,\n getColumnsCount = options.getColumnsCount,\n getItemId = options.getItemId,\n tbody = options.tbody,\n _useTimeoutInRenderLoop = options._useTimeoutInRenderLoop,\n _waitForScrollingToStop = options._waitForScrollingToStop;\n var getState = options.getState,\n setState = options.setState;\n var bypass = options.bypass,\n estimatedItemHeight = options.estimatedItemHeight,\n onItemInitialRender = options.onItemInitialRender,\n onItemFirstRender = options.onItemFirstRender,\n scrollableContainer = options.scrollableContainer,\n state = options.state,\n engine = options.engine;\n log('~ Initialize ~'); // If `state` is passed then use `items` from `state`\n // instead of the `items` argument.\n\n if (state) {\n items = state.items;\n } // `getScrollableContainer` option is deprecated.\n // Use `scrollableContainer` instead.\n\n\n if (!scrollableContainer && getScrollableContainer) {\n scrollableContainer = getScrollableContainer();\n } // Could support non-DOM rendering engines.\n // For example, React Native, `<canvas/>`, etc.\n\n\n if (!engine) {\n engine = DOMEngine;\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;\n this.itemsContainer = engine.createItemsContainer(getItemsContainerElement); // Remove any accidental text nodes from container (like whitespace).\n // Also guards against cases when someone accidentally tries\n // using `VirtualScroller` on a non-empty element.\n\n if (getItemsContainerElement()) {\n this.itemsContainer.clear();\n }\n\n this.scrollableContainer = engine.createScrollableContainer(scrollableContainer, 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 // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (tbody) {\n if (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 this.initialItems = items; // this.prerenderMargin = prerenderMargin\n\n this.onStateChange = onStateChange;\n this._getColumnsCount = getColumnsCount;\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 `setState()` not being\n // instanteneous: when new `items` are passed to `<VirtualScroller/>`,\n // `VirtualScroller.setState({ items })` is called, and if `onItemFirstRender(i)`\n // is called after the aforementioned `setState()` 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 }\n\n log('Items count', items.length);\n\n if (estimatedItemHeight) {\n log('Estimated item height', estimatedItemHeight);\n } // 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 // Create default `getState()`/`setState()` functions.\n\n\n if (!getState) {\n getState = function getState() {\n return _this.state;\n };\n\n setState = function setState(stateUpdate, _ref3) {\n var willUpdateState = _ref3.willUpdateState,\n didUpdateState = _ref3.didUpdateState;\n var prevState = getState(); // Because this variant of `.setState()` is \"synchronous\" (immediate),\n // it can be written like `...prevState`, and no state updates would be lost.\n // But if it was \"asynchronous\" (not immediate), then `...prevState`\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 `prevState` stale.\n\n var newState = _objectSpread(_objectSpread({}, prevState), stateUpdate);\n\n willUpdateState(newState, prevState);\n _this.state = newState; // // Is only used in tests.\n // if (this._onStateUpdate) {\n // \tthis._onStateUpdate(stateUpdate)\n // }\n\n didUpdateState(prevState);\n };\n }\n\n this.getState = getState;\n\n this.setState = function (stateUpdate) {\n if (isDebug()) {\n log('Set state', getStateSnapshot(stateUpdate));\n }\n\n setState(stateUpdate, {\n willUpdateState: _this.willUpdateState,\n didUpdateState: _this.didUpdateState\n });\n };\n\n if (state) {\n if (isDebug()) {\n log('Initial state (passed)', getStateSnapshot(state));\n }\n } // Check if the current `columnsCount` matches the one from state.\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 if (state) {\n var shouldResetLayout;\n var columnsCountForState = this.getActualColumnsCountForState();\n\n if (columnsCountForState !== state.columnsCount) {\n warn('~ Columns Count changed from', state.columnsCount || 1, 'to', columnsCountForState || 1, '~');\n shouldResetLayout = true;\n }\n\n var columnsCount = this.getActualColumnsCount();\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 shouldResetLayout = true;\n }\n\n if (shouldResetLayout) {\n warn('Reset Layout');\n state = _objectSpread(_objectSpread({}, state), this.getInitialLayoutState(state.items));\n }\n } // Reset `verticalSpacing` so that it re-measures it after the list\n // has been rendered initially. The rationale is that the `state`\n // can't be \"trusted\" in a sense that the user might have resized\n // their window after the `state` has been snapshotted, and changing\n // window width might have activated different CSS `@media()` \"queries\"\n // resulting in a potentially different vertical spacing.\n\n\n if (state) {\n state = _objectSpread(_objectSpread({}, state), {}, {\n verticalSpacing: undefined\n });\n } // Create `ItemHeights` instance.\n\n\n this.itemHeights = new ItemHeights(this.itemsContainer, function (i) {\n return _this.getState().itemHeights[i];\n }, function (i, height) {\n return _this.getState().itemHeights[i] = height;\n }); // Initialize `ItemHeights` from the initially passed `state`.\n\n if (state) {\n this.itemHeights.initialize(state.itemHeights);\n }\n\n this.layout = new Layout({\n bypass: bypass,\n estimatedItemHeight: estimatedItemHeight,\n measureItemsBatchSize: measureItemsBatchSize === undefined ? 50 : measureItemsBatchSize,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this.getPrerenderMargin();\n },\n getVerticalSpacing: function getVerticalSpacing() {\n return _this.getVerticalSpacing();\n },\n getVerticalSpacingBeforeResize: function getVerticalSpacingBeforeResize() {\n return _this.getVerticalSpacingBeforeResize();\n },\n getColumnsCount: function getColumnsCount() {\n return _this.getColumnsCount();\n },\n getColumnsCountBeforeResize: function getColumnsCountBeforeResize() {\n return _this.getState().beforeResize && _this.getState().beforeResize.columnsCount;\n },\n getItemHeight: function getItemHeight(i) {\n return _this.getState().itemHeights[i];\n },\n getItemHeightBeforeResize: function getItemHeightBeforeResize(i) {\n return _this.getState().beforeResize && _this.getState().beforeResize.itemHeights[i];\n },\n getBeforeResizeItemsCount: function getBeforeResizeItemsCount() {\n return _this.getState().beforeResize ? _this.getState().beforeResize.itemHeights.length : 0;\n },\n getAverageItemHeight: function getAverageItemHeight() {\n return _this.itemHeights.getAverage();\n },\n getMaxVisibleAreaHeight: function getMaxVisibleAreaHeight() {\n return _this.scrollableContainer && _this.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 _this.previouslyCalculatedLayout;\n }\n });\n this.resize = new Resize({\n bypass: bypass,\n scrollableContainer: this.scrollableContainer,\n onStart: function onStart() {\n log('~ Scrollable container resize started ~');\n _this.isResizing = true;\n },\n onStop: function onStop() {\n log('~ Scrollable container resize finished ~');\n _this.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 _this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.VIEWPORT_SIZE_UNCHANGED\n });\n },\n onHeightChange: function onHeightChange() {\n return _this.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 _this.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 _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n delayed = _ref4.delayed;\n\n _this.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 _this.layoutTimer;\n },\n hasNonRenderedItemsAtTheTop: function hasNonRenderedItemsAtTheTop() {\n return _this.getState().firstShownItemIndex > 0;\n },\n hasNonRenderedItemsAtTheBottom: function hasNonRenderedItemsAtTheBottom() {\n return _this.getState().lastShownItemIndex < _this.getItemsCount() - 1;\n },\n getLatestLayoutVisibleArea: function getLatestLayoutVisibleArea() {\n return _this.latestLayoutVisibleArea;\n },\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n getPrerenderMargin: function getPrerenderMargin() {\n return _this.getPrerenderMargin();\n }\n });\n this.listHeightChangeWatcher = new ListHeightChangeWatcher({\n itemsContainer: this.itemsContainer,\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer\n });\n\n if (engine.watchListTopOffset) {\n this.listTopOffsetWatcher = engine.watchListTopOffset({\n getListTopOffset: this.getListTopOffsetInsideScrollableContainer,\n onListTopOffsetChange: function onListTopOffsetChange(_ref5) {\n var reason = _ref5.reason;\n return _this.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 }); // 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.setState({ beforeResize: undefined })` call.\n // If `VirtualScroller` state was snapshotted externally before that `this.setState()` call\n // has been applied, then \"before resize\" property might have not been cleaned up properly.\n\n this.beforeResize.onInitialState(state); // `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.getInitialState()`.\n //\n\n this.verticalSpacing = state ? state.verticalSpacing : undefined; // Set initial `state`.\n\n this.setState(state || this.getInitialState(customState));\n }\n /**\r\n * Returns the initial state of the `VirtualScroller`.\r\n * @param {object} [customState] — Any additional \"custom\" state may be stored in `VirtualScroller`'s state. For example, React implementation stores item \"refs\" as \"custom\" state.\r\n * @return {object}\r\n */\n\n\n _createClass(VirtualScroller, [{\n key: \"getInitialState\",\n value: function getInitialState(customState) {\n var items = this.initialItems;\n\n var state = _objectSpread(_objectSpread(_objectSpread({}, customState), this.getInitialLayoutState(items)), {}, {\n items: items,\n itemStates: new Array(items.length)\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 key: \"getInitialLayoutState\",\n value: function getInitialLayoutState(items) {\n var itemsCount = items.length;\n\n var _this$layout$getIniti = this.layout.getInitialLayoutValues({\n itemsCount: itemsCount,\n columnsCount: this.getActualColumnsCount()\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 } // 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\n }, {\n key: \"getActualColumnsCount\",\n value: function getActualColumnsCount() {\n return this.getActualColumnsCountForState() || 1;\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\n }, {\n key: \"getVerticalSpacingBeforeResize\",\n value: function getVerticalSpacingBeforeResize() {\n // `beforeResize.verticalSpacing` can be `undefined`.\n // For example, if `this.setState({ verticalSpacing })` call hasn't been applied\n // before the resize happened (in case of an \"asynchronous\" state update).\n return this.getState().beforeResize && this.getState().beforeResize.verticalSpacing || 0;\n }\n }, {\n key: \"getColumnsCount\",\n value: function getColumnsCount() {\n return this.getState() && this.getState().columnsCount || 1;\n }\n }, {\n key: \"getItemsCount\",\n value: function getItemsCount() {\n return this.getState().items.length;\n }\n }, {\n key: \"getPrerenderMargin\",\n value: function getPrerenderMargin() {\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 key: \"onBeforeShowItems\",\n value: function onBeforeShowItems(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 key: \"onMount\",\n value: function onMount() {\n warn('`.onMount()` instance method name is deprecated, use `.listen()` instance method name instead.');\n this.listen();\n }\n }, {\n key: \"render\",\n value: function render() {\n warn('`.render()` instance method name is deprecated, use `.listen()` instance method name instead.');\n this.listen();\n }\n /**\r\n * Should be invoked after a \"container\" DOM Element is mounted (inserted into the DOM tree).\r\n */\n\n }, {\n key: \"listen\",\n value: function listen() {\n if (this.isRendered === false) {\n throw new Error('[virtual-scroller] Can\\'t restart a `VirtualScroller` after it has been stopped');\n }\n\n log('~ Rendered (initial) ~'); // `this.isRendered = true` should be the first statement in this function,\n // otherwise `DOMVirtualScroller` would enter an infinite re-render loop.\n\n this.isRendered = true;\n var stateUpdate = this.measureItemHeightsAndSpacingAndUpdateTablePadding();\n this.resize.listen();\n this.scroll.listen(); // Work around `<tbody/>` not being able to have `padding`.\n // https://gitlab.com/catamphetamine/virtual-scroller/-/issues/1\n\n if (this.tbody) {\n addTbodyStyles(this.getItemsContainerElement());\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.MOUNTED,\n stateUpdate: stateUpdate\n });\n }\n }, {\n key: \"measureItemHeightsAndSpacingAndUpdateTablePadding\",\n value: function measureItemHeightsAndSpacingAndUpdateTablePadding() {\n // Measure \"newly shown\" item heights.\n // Also re-validate already measured items' heights.\n this.itemHeights.measureItemHeights(this.getState().firstShownItemIndex, this.getState().lastShownItemIndex); // Update item vertical spacing.\n\n var verticalSpacing = this.measureVerticalSpacing(); // 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 if (this.tbody) {\n setTbodyPadding(this.getItemsContainerElement(), this.getState().beforeItemsHeight, this.getState().afterItemsHeight);\n } // Return a state update.\n\n\n if (verticalSpacing !== undefined) {\n return {\n verticalSpacing: verticalSpacing\n };\n }\n }\n }, {\n key: \"getVisibleArea\",\n value: 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 /**\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 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 }, {\n key: \"onUnmount\",\n value: function onUnmount() {\n warn('`.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead.');\n this.stop();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n warn('`.destroy()` instance method name is deprecated, use `.stop()` instance method name instead.');\n this.stop();\n }\n }, {\n key: \"cancelLayoutTimer\",\n value: function cancelLayoutTimer(_ref6) {\n var stateUpdate = _ref6.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 key: \"scheduleLayoutTimer\",\n value: function scheduleLayoutTimer(_ref7) {\n var _this2 = this;\n\n var reason = _ref7.reason,\n stateUpdate = _ref7.stateUpdate;\n this.layoutTimerStateUpdate = stateUpdate;\n this.layoutTimer = setTimeout(function () {\n _this2.layoutTimerStateUpdate = undefined;\n _this2.layoutTimer = undefined;\n\n _this2.onUpdateShownItemIndexes({\n reason: reason,\n stateUpdate: stateUpdate\n });\n }, 0);\n }\n /**\r\n * Should be called right before `state` is updated.\r\n * @param {object} prevState\r\n * @param {object} newState\r\n */\n\n }, {\n key: \"onNewItemsRendered\",\n value: // 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 `setState()` 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 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$getState2 = this.getState(),\n itemHeights = _this$getState2.itemHeights,\n itemStates = _this$getState2.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 + parseInt(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 + parseInt(_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 \"didUpdateState()\" 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.listHeightChangeWatcher.hasSnapshot()) {\n if (newLayout.firstShownItemIndex === 0) {\n // Restore (adjust) scroll position.\n log('~ Restore Scroll Position ~');\n var listBottomOffsetChange = this.listHeightChangeWatcher.getListBottomOffsetChange({\n beforeItemsHeight: newLayout.beforeItemsHeight\n });\n this.listHeightChangeWatcher.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 \"didUpdateState()\" 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 \\\"didUpdateState()\\\" 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 key: \"updateStateRightAfterRender\",\n value: function updateStateRightAfterRender(_ref8) {\n var reason = _ref8.reason,\n stateUpdate = _ref8.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 // `.setState()` 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 key: \"measureVerticalSpacing\",\n value: function measureVerticalSpacing() {\n if (this.verticalSpacing === undefined) {\n var _this$getState3 = this.getState(),\n firstShownItemIndex = _this$getState3.firstShownItemIndex,\n lastShownItemIndex = _this$getState3.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 this.verticalSpacing = verticalSpacing;\n\n if (verticalSpacing !== 0) {\n return verticalSpacing;\n }\n }\n }\n }\n }, {\n key: \"remeasureItemHeight\",\n value: function remeasureItemHeight(i) {\n var _this$getState4 = this.getState(),\n firstShownItemIndex = _this$getState4.firstShownItemIndex;\n\n return this.itemHeights.remeasureItemHeight(i, firstShownItemIndex);\n }\n }, {\n key: \"onItemStateChange\",\n value: function onItemStateChange(i, newItemState) {\n if (isDebug()) {\n log('~ Item state changed ~');\n log('Item', 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; // Schedule the item state update for after the new items have been rendered.\n\n if (this.newItemsWillBeRendered) {\n if (!this.itemStatesThatChangedWhileNewItemsWereBeingRendered) {\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n this.itemStatesThatChangedWhileNewItemsWereBeingRendered[String(i)] = newItemState;\n }\n }\n }, {\n key: \"onItemHeightChange\",\n value: function onItemHeightChange(i) {\n log('~ Re-measure item height ~');\n log('Item', i);\n\n var _this$getState5 = this.getState(),\n itemHeights = _this$getState5.itemHeights,\n firstShownItemIndex = _this$getState5.firstShownItemIndex,\n lastShownItemIndex = _this$getState5.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 `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(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 // `.onItemHeightChange(i)` gets called.\n return warn('The item is no longer rendered. This is not necessarily a bug, and could happen, for example, when there\\'re several `onItemHeightChange(i)` calls issued at the same time.');\n }\n\n var previousHeight = itemHeights[i];\n\n if (previousHeight === undefined) {\n return reportError(\"\\\"onItemHeightChange()\\\" has been called for item \".concat(i, \", but that item hasn't been rendered before.\"));\n }\n\n var newHeight = this.remeasureItemHeight(i);\n log('Previous height', previousHeight);\n log('New height', newHeight);\n\n if (previousHeight !== newHeight) {\n log('~ Item height has changed ~'); // Update or reset previously calculated layout.\n\n this.updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight); // Recalculate layout.\n\n this.onUpdateShownItemIndexes({\n reason: LAYOUT_REASON.ITEM_HEIGHT_CHANGED\n }); // Schedule the item height update for after the new items have been rendered.\n\n if (this.newItemsWillBeRendered) {\n if (!this.itemHeightsThatChangedWhileNewItemsWereBeingRendered) {\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered = {};\n }\n\n this.itemHeightsThatChangedWhileNewItemsWereBeingRendered[String(i)] = newHeight;\n }\n }\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 key: \"updatePreviouslyCalculatedLayoutOnItemHeightChange\",\n value: function updatePreviouslyCalculatedLayoutOnItemHeightChange(i, previousHeight, newHeight) {\n if (this.previouslyCalculatedLayout) {\n var heightDifference = newHeight - previousHeight;\n\n if (i < this.previouslyCalculatedLayout.firstShownItemIndex) {\n // Patch `this.previouslyCalculatedLayout`'s `.beforeItemsHeight`.\n this.previouslyCalculatedLayout.beforeItemsHeight += heightDifference;\n } else if (i > this.previouslyCalculatedLayout.lastShownItemIndex) {\n // Could patch `.afterItemsHeight` of `this.previouslyCalculatedLayout` here,\n // if `.afterItemsHeight` property existed in `this.previouslyCalculatedLayout`.\n if (this.previouslyCalculatedLayout.afterItemsHeight !== undefined) {\n this.previouslyCalculatedLayout.afterItemsHeight += heightDifference;\n }\n } else {\n // Patch `this.previouslyCalculatedLayout`'s shown items height.\n this.previouslyCalculatedLayout.shownItemsHeight += newHeight - previousHeight;\n }\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 `.onItemStateChange()` and `.onItemHeightChange(i)`.\r\n */\n\n }, {\n key: \"validateWillBeHiddenItemHeightsAreAccurate\",\n value: 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 // `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(i)` calls. No issues so far.\n // But, as the first `.onItemHeightChange(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 `.onItemHeightChange(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 `.onItemHeightChange(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 = this.remeasureItemHeight(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 this.updatePreviouslyCalculatedLayoutOnItemHeightChange(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 `onItemHeightChange(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 key: \"getShownItemIndexes\",\n value: function getShownItemIndexes() {\n var itemsCount = this.getItemsCount();\n\n var _this$getVisibleArea = this.getVisibleArea(),\n visibleAreaTop = _this$getVisibleArea.top,\n visibleAreaBottom = _this$getVisibleArea.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 * 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 key: \"updateItems\",\n value:\n /**\r\n * @deprecated\r\n * `.updateItems()` has been renamed to `.setItems()`.\r\n */\n function updateItems(newItems, options) {\n return this.setItems(newItems, options);\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\n // * @param {object} [newCustomState] — If `customState` was passed to `getInitialState()`, this `newCustomState` updates it.\n var _this$getState6 = this.getState(),\n previousItems = _this$getState6.items; // Even if `newItems` are equal to `this.state.items`,\n // still perform a `setState()` call, because, if `setState()` 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 `setState({ 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$getState7 = this.getState(),\n itemStates = _this$getState7.itemStates;\n\n var _ref9 = this.resetLayoutAfterResize ? this.resetLayoutAfterResize.stateUpdate : this.getState(),\n itemHeights = _ref9.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 if (itemsDiff) {\n var _ref10 = this.resetLayoutAfterResize ? this.resetLayoutAfterResize.stateUpdate : this.getState(),\n firstShownItemIndex = _ref10.firstShownItemIndex,\n lastShownItemIndex = _ref10.lastShownItemIndex,\n beforeItemsHeight = _ref10.beforeItemsHeight,\n afterItemsHeight = _ref10.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 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 });\n\n if (prependedItemsCount > 0) {\n log('Prepend', prependedItemsCount, 'items');\n itemHeights = new Array(prependedItemsCount).concat(itemHeights);\n\n if (itemStates) {\n itemStates = new Array(prependedItemsCount).concat(itemStates);\n } // Restore scroll position after prepending items (if requested).\n\n\n if (shouldRestoreScrollPosition) {\n log('Will restore scroll position');\n this.listHeightChangeWatcher.snapshot({\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 if (this.firstNonMeasuredItemIndex !== undefined) {\n this.firstNonMeasuredItemIndex += prependedItemsCount;\n }\n } else {\n log('Reset layout'); // Reset layout because none of the prepended items have been measured.\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\n if (itemStates) {\n itemStates = itemStates.concat(new Array(appendedItemsCount));\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 = new Array(newItems.length);\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.setState()`\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.listHeightChangeWatcher` wasn't reset on `.setItems(differentItems)`\n // and if the second `this.setState()` 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.listHeightChangeWatcher.reset();\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 `didUpdateState()`.\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 `setState()` below and that call actually being applied.\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 `setState()` 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 `setState()` 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 `setState()` 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.resetLayoutAfterResize ? this.resetLayoutAfterResize.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.setState(newState);\n }\n }, {\n key: \"getItemsDiff\",\n value: function getItemsDiff(previousItems, newItems) {\n return _getItemsDiff(previousItems, newItems, this.isItemEqual);\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 `setState()` 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 key: \"shouldDiscardBeforeResizeItemHeights\",\n value: function shouldDiscardBeforeResizeItemHeights() {\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 key: \"onResize\",\n value: function onResize() {\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.listHeightChangeWatcher.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 `setState()` operation is \"asynchronous\", that is\n // when `setState()` calls aren't applied immediately, like in React.\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 `setState()` operation is \"asynchronous\", that is\n // when `setState()` 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 // 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 `setState()` 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 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\" `setState()` call, and then, before that\n // `setState()` 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 var verticalSpacing = this.getVerticalSpacing();\n var columnsCount = this.getColumnsCount(); // `beforeResize` is always overwritten in `state` here.\n // (once it has started being tracked in `state`)\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.resetLayoutAfterResize` 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 `didUpdateState()`\n // function will clear this flag and perform a re-layout.\n\n\n this.resetLayoutAfterResize = {\n stateUpdate: newState\n }; // Rerender.\n\n this.setState(newState);\n }\n }]);\n\n return VirtualScroller;\n}();\n\nexport { VirtualScroller as default };\nvar SLOW_LAYOUT_DURATION = 15; // in milliseconds.\n//# sourceMappingURL=VirtualScroller.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); // If next row is detected.\n\n if (itemTopOffset !== firstShownRowTopOffset) {\n // Measure inter-row spacing.\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","/**\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","var _excluded = [\"as\", \"itemComponent\", \"itemComponentProps\", \"items\", \"estimatedItemHeight\", \"bypass\", \"preserveScrollPositionOnPrependItems\", \"preserveScrollPosition\", \"initialScrollPosition\", \"onScrollPositionChange\", \"measureItemsBatchSize\", \"scrollableContainer\", \"getScrollableContainer\", \"getColumnsCount\", \"initialState\", \"initialCustomState\", \"onStateChange\", \"onItemInitialRender\", \"onItemFirstRender\", \"getItemId\", \"onMount\", \"className\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\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 _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(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); return Constructor; }\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 } }); 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 _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 React from 'react';\nimport PropTypes from 'prop-types';\nimport VirtualScrollerCore from '../VirtualScroller';\nimport { reportError } from '../utility/debug';\nimport px from '../utility/px'; // `PropTypes.elementType` is available in some version of `prop-types`.\n// https://github.com/facebook/prop-types/issues/200\n\nvar elementType = PropTypes.elementType || PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object]);\n\nvar VirtualScroller = /*#__PURE__*/function (_React$Component) {\n _inherits(VirtualScroller, _React$Component);\n\n var _super = _createSuper(VirtualScroller);\n\n // `this.state` is already reserved for `virtual-scroller`.\n // static getDerivedStateFromProps(props, state) {\n // \treturn {\n // \t\tprevProps: {\n // \t\t\titems: props.items\n // \t\t}\n // \t}\n // }\n // Handler function caches.\n // Just so that the props passed to `itemComponent`\n // are not changed on every `.render()` and so\n // `itemComponent` won't re-render if it's a `PureComponent`.\n // Item refs for `.renderItem(i)`.\n // List items are rendered with `key`s\n // so that React doesn't reuse `itemComponent`s\n // in cases when `items` are changed.\n function VirtualScroller(props) {\n var _this;\n\n _classCallCheck(this, VirtualScroller);\n\n _this = _super.call(this, props); // `this.previousItemsProperty` is only used for comparing\n // `previousItems` with `newItems` inside `render()`.\n\n _defineProperty(_assertThisInitialized(_this), \"container\", /*#__PURE__*/React.createRef());\n\n _defineProperty(_assertThisInitialized(_this), \"onItemStateChange\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"onItemHeightChange\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"itemRefs\", new Array(_this.props.items.length));\n\n _defineProperty(_assertThisInitialized(_this), \"itemKeyPrefixes\", []);\n\n _defineProperty(_assertThisInitialized(_this), \"updateLayout\", function () {\n return _this.virtualScroller.updateLayout();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"layout\", function () {\n return _this.updateLayout();\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onItemInitialRender\", function () {\n var onItemInitialRender = _this.props.onItemInitialRender;\n\n if (onItemInitialRender) {\n onItemInitialRender.apply(void 0, arguments);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onItemFirstRender\", function () {\n var onItemFirstRender = _this.props.onItemFirstRender;\n\n if (onItemFirstRender) {\n onItemFirstRender.apply(void 0, arguments);\n }\n });\n\n _this.previousItemsProperty = props.items; // Generate unique `key` prefix for list item components.\n\n _this.generateItemKeyPrefix(); // Create `VirtualScroller` instance.\n\n\n _this.createVirtualScroller();\n\n return _this;\n }\n\n _createClass(VirtualScroller, [{\n key: \"createVirtualScroller\",\n value: function createVirtualScroller() {\n var _this2 = this;\n\n var _this$props = this.props,\n AsComponent = _this$props.as,\n items = _this$props.items,\n initialState = _this$props.initialState,\n initialCustomState = _this$props.initialCustomState,\n onStateChange = _this$props.onStateChange,\n estimatedItemHeight = _this$props.estimatedItemHeight,\n initialScrollPosition = _this$props.initialScrollPosition,\n onScrollPositionChange = _this$props.onScrollPositionChange,\n measureItemsBatchSize = _this$props.measureItemsBatchSize,\n scrollableContainer = _this$props.scrollableContainer,\n getScrollableContainer = _this$props.getScrollableContainer,\n getColumnsCount = _this$props.getColumnsCount,\n getItemId = _this$props.getItemId,\n bypass = _this$props.bypass; // Create `virtual-scroller` instance.\n\n this.virtualScroller = new VirtualScrollerCore(function () {\n return _this2.container.current;\n }, items, {\n _useTimeoutInRenderLoop: true,\n estimatedItemHeight: estimatedItemHeight,\n bypass: bypass,\n // bypassBatchSize,\n onItemInitialRender: this.onItemInitialRender,\n // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n onItemFirstRender: this.onItemFirstRender,\n initialScrollPosition: initialScrollPosition,\n onScrollPositionChange: onScrollPositionChange,\n shouldUpdateLayoutOnScreenResize: this.shouldUpdateLayoutOnScreenResize,\n measureItemsBatchSize: measureItemsBatchSize,\n scrollableContainer: scrollableContainer,\n // `getScrollableContainer` property is deprecated.\n // Use `scrollableContainer` instead.\n getScrollableContainer: getScrollableContainer,\n getColumnsCount: getColumnsCount,\n getItemId: getItemId,\n tbody: AsComponent === 'tbody',\n state: initialState,\n customState: initialCustomState,\n onStateChange: onStateChange,\n getState: function getState() {\n return _this2.state;\n },\n setState: function setState(newState, _ref) {\n var willUpdateState = _ref.willUpdateState,\n didUpdateState = _ref.didUpdateState;\n _this2.willUpdateState = willUpdateState;\n _this2.didUpdateState = didUpdateState;\n\n if (_this2.state) {\n // Update existing state.\n //\n // In case of hypothetically rewriting this in React hooks,\n // it wouldn't simply be `setState({ ...prevState, ...newState })`.\n // The reason is that `setState()` would be \"asynchronous\" (not immediate),\n // and `...prevState` would be stale in cases when more than a single\n // `setState()` call is made before the state actually updates,\n // making `prevState` stale, and, as a consequence, losing some\n // of the state updates.\n // For example, the first `setState()` call updates shown item indexes,\n // and the second `setState()` call updates `verticalSpacing`:\n // if it was simply `setState({ ...prevState, ...newState })`,\n // then the second state update could overwrite the first state update,\n // resulting in incorrect items being shown/hidden.\n //\n // I guess, in hooks, it could be something like:\n //\n // const [firstShownItemIndex, setFirstShownItemIndex] = useState()\n // ...\n // const setState = useCallback((newState) => {\n // \tfor (const key in newState) {\n // \t\tswitch (key) {\n // \t\t\tcase 'firstShownItemIndex':\n // \t\t\t\tsetFirstShownItemIndex(newState[key])\n // \t\t\t\tbreak\n // \t\t\t...\n // \t\t}\n // \t}\n // \tsetFirstShownItemIndex\n // }, [])\n // const virtualScroller = new VirtualScrollerCore({\n // \tsetState,\n // \t...\n // })\n // // `getState()` function would be updated on every render.\n // virtualScroller.getState = () => ({\n // \tfirstShownItemIndex,\n // \t...\n // })\n //\n // But as long as it uses the classic `this.setState()`,\n // it's fine and simple.\n _this2.setState(newState);\n } else {\n // Set initial state.\n willUpdateState(newState);\n _this2.state = newState;\n didUpdateState();\n }\n }\n });\n } // This is a proxy for `VirtualScroller`'s `.updateLayout` instance method.\n\n }, {\n key: \"shouldUseRefs\",\n value: function shouldUseRefs() {\n // There's no way to detect if `ref` can be passed to `component`:\n // https://github.com/facebook/react/issues/16309\n // So it only uses `ref`s for `React.Component`s.\n var itemComponent = this.props.itemComponent;\n return isComponentClass(itemComponent);\n }\n /**\r\n * Returns a `key` for an `item`'s element.\r\n * @param {object} item — The item.\r\n * @param {number} i — Item's index in `items` list.\r\n * @return {any}\r\n */\n\n }, {\n key: \"getItemKey\",\n value: function getItemKey(item, i) {\n var getItemId = this.props.getItemId;\n\n if (getItemId) {\n return getItemId(item);\n }\n\n return \"\".concat(this.itemKeyPrefix, \":\").concat(i);\n }\n /**\r\n * A proxy to `VirtualScroller.getItemCoordinates(i)`.\r\n * @param {number} i\r\n * @return {object}\r\n */\n\n /*\r\n getItemCoordinates(i) {\r\n \treturn this.virtualScroller.getItemCoordinates(i)\r\n }\r\n */\n\n /**\r\n * `updateItem(i)` has been renamed to `renderItem(i)`.\r\n * @param {number} i\r\n */\n\n }, {\n key: \"updateItem\",\n value: function updateItem(i) {\n return this.renderItem(i);\n }\n /**\r\n * Re-renders an item.\r\n * @param {number} i\r\n */\n\n }, {\n key: \"renderItem\",\n value: function renderItem(i) {\n var _this3 = this;\n\n i = this.getItemIndex(i);\n\n if (i === undefined) {\n return reportError(\"Item \".concat(JSON.stringify(i), \" not found when calling \\\".renderItem()\\\"\"));\n }\n\n if (this.shouldUseRefs()) {\n // The item may be non-rendered when `.renderItem(i)` is called on it.\n // For example, when there's a \"parent comment\" having several \"replies\"\n // each of which has an autogenerated quote of the \"parent comment\"\n // and then the \"parent comment\" is updated (for example, a YouTube video\n // link gets parsed into an embedded video player) and all of its \"replies\"\n // should be updated too to show the parsed video title instead of the URL,\n // so `.renderItem(i)` is simply called on all of the \"parent post\"'s replies\n // regardless of some of those replies being rendered or not.\n if (this.itemRefs[i] && this.itemRefs[i].current) {\n var items = this.props.items; // Stores `item` here because the `i` index\n // might have changed when the callback is called,\n // or the item even may have been removed.\n\n var item = items[i];\n this.itemRefs[i].current.forceUpdate(function () {\n if (_this3._isMounted) {\n // Recalculates the `i` index here because it\n // might have changed when the callback is called,\n // or the item even may have been removed.\n var _i = items.indexOf(item);\n\n if (_i >= 0) {\n _this3.virtualScroller.onItemHeightChange(_i);\n }\n }\n });\n }\n }\n }\n }, {\n key: \"getItemIndex\",\n value: function getItemIndex(i) {\n if (typeof i === 'number') {\n return i;\n }\n\n if (_typeof(i) === 'object' && i !== null) {\n var _this$props2 = this.props,\n items = _this$props2.items,\n getItemId = _this$props2.getItemId;\n var item = i;\n i = 0;\n\n while (i < items.length) {\n if (getItemId) {\n if (getItemId(item) === getItemId(items[i])) {\n return i;\n }\n } else {\n if (item === items[i]) {\n return i;\n }\n }\n\n i++;\n }\n }\n } // Functional components can't have a `ref` assigned to them.\n // Item `ref`s are only used for calling `.renderItem(i)` instance method,\n // because `.renderItem(i)` calls `.forceUpdate()` on item `i`.\n // If a developer is not using the `.renderItem(i)` instance method\n // then `ref`s aren't required and will be omitted.\n\n }, {\n key: \"getItemRef\",\n value: function getItemRef(i) {\n if (!this.itemRefs[i]) {\n this.itemRefs[i] = /*#__PURE__*/React.createRef();\n }\n\n return this.itemRefs[i];\n }\n }, {\n key: \"getOnItemStateChange\",\n value: function getOnItemStateChange(i) {\n var _this4 = this;\n\n if (!this.onItemStateChange[i]) {\n this.onItemStateChange[i] = function (itemState) {\n return _this4.virtualScroller.onItemStateChange(i, itemState);\n };\n }\n\n return this.onItemStateChange[i];\n }\n }, {\n key: \"getOnItemHeightChange\",\n value: function getOnItemHeightChange(i) {\n var _this5 = this;\n\n if (!this.onItemHeightChange[i]) {\n this.onItemHeightChange[i] = function () {\n return _this5.virtualScroller.onItemHeightChange(i);\n };\n }\n\n return this.onItemHeightChange[i];\n }\n }, {\n key: \"generateItemKeyPrefix\",\n value: function generateItemKeyPrefix() {\n var prefix = String(Math.random()).slice(2);\n\n if (this.itemKeyPrefixes.indexOf(prefix) >= 0) {\n return this.generateItemKeyPrefix();\n }\n\n this.itemKeyPrefixes.push(prefix);\n this.itemKeyPrefix = prefix;\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var onMount = this.props.onMount; // `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 this._isMounted = true; // Start listening to scroll events.\n\n this.virtualScroller.listen();\n } // `getSnapshotBeforeUpdate()` is called right before `componentDidUpdate()`.\n\n }, {\n key: \"getSnapshotBeforeUpdate\",\n value: function getSnapshotBeforeUpdate(prevProps, prevState) {\n if (this.state !== prevState) {\n this.willUpdateState(this.state, prevState);\n } // Returns `null` to avoid React warning:\n // \"A snapshot value (or null) must be returned. You have returned undefined\".\n\n\n return null;\n } // `componentDidUpdate()` is called immediately after React component has re-rendered.\n // That would correspond to `useLayoutEffect()` in React Hooks.\n\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n // If `state` did change.\n if (this.state !== prevState) {\n this.didUpdateState(prevState);\n } // If `items` property did change then update `virtual-scroller` items.\n // This could have been done in `.render()` but `.setItems()` calls\n // `.setState()` internally which would result in React throwing an error.\n\n\n var _this$props3 = this.props,\n items = _this$props3.items,\n preserveScrollPosition = _this$props3.preserveScrollPosition,\n preserveScrollPositionOnPrependItems = _this$props3.preserveScrollPositionOnPrependItems;\n\n if (items !== prevProps.items) {\n this.virtualScroller.setItems(items, {\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n preserveScrollPositionOnPrependItems: preserveScrollPositionOnPrependItems || preserveScrollPosition\n });\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this._isMounted = false; // Stop listening to scroll events.\n\n this.virtualScroller.stop();\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this6 = this;\n\n var _this$props4 = this.props,\n AsComponent = _this$props4.as,\n Component = _this$props4.itemComponent,\n itemComponentProps = _this$props4.itemComponentProps,\n _items = _this$props4.items,\n estimatedItemHeight = _this$props4.estimatedItemHeight,\n bypass = _this$props4.bypass,\n preserveScrollPositionOnPrependItems = _this$props4.preserveScrollPositionOnPrependItems,\n preserveScrollPosition = _this$props4.preserveScrollPosition,\n initialScrollPosition = _this$props4.initialScrollPosition,\n onScrollPositionChange = _this$props4.onScrollPositionChange,\n measureItemsBatchSize = _this$props4.measureItemsBatchSize,\n scrollableContainer = _this$props4.scrollableContainer,\n getScrollableContainer = _this$props4.getScrollableContainer,\n getColumnsCount = _this$props4.getColumnsCount,\n initialState = _this$props4.initialState,\n initialCustomState = _this$props4.initialCustomState,\n onStateChange = _this$props4.onStateChange,\n onItemInitialRender = _this$props4.onItemInitialRender,\n onItemFirstRender = _this$props4.onItemFirstRender,\n getItemId = _this$props4.getItemId,\n onMount = _this$props4.onMount,\n className = _this$props4.className,\n rest = _objectWithoutProperties(_this$props4, _excluded);\n\n var _this$virtualScroller = this.virtualScroller.getState(),\n items = _this$virtualScroller.items,\n itemStates = _this$virtualScroller.itemStates,\n firstShownItemIndex = _this$virtualScroller.firstShownItemIndex,\n lastShownItemIndex = _this$virtualScroller.lastShownItemIndex,\n beforeItemsHeight = _this$virtualScroller.beforeItemsHeight,\n afterItemsHeight = _this$virtualScroller.afterItemsHeight; // If `items` are about to be changed then\n // store the scroll Y position for the first one\n // of the current items.\n // Previously it was being done in `componentDidUpdate()`\n // but it was later found out that it wouldn't work\n // for \"Show previous\" button because it would\n // get hidden before `componentDidUpdate()` is called.\n //\n // Consider this code example:\n //\n // const { fromIndex, items } = this.state\n // const items = allItems.slice(fromIndex)\n // return (\n // \t{fromIndex > 0 &&\n // \t\t<button onClick={this.onShowPrevious}>\n // \t\t\tShow previous\n // \t\t</button>\n // \t}\n // \t<VirtualScroller\n // \t\titems={items}\n // \t\titemComponent={ItemComponent}/>\n // )\n //\n // Consider a user clicks \"Show previous\" to show the items from the start.\n // By the time `componentDidUpdate()` is called on `<VirtualScroller/>`,\n // the \"Show previous\" button has already been hidden\n // (because there're no more \"previous\" items)\n // which results in the scroll Y position jumping forward\n // by the height of that \"Show previous\" button.\n // This is because `<VirtualScroller/>` captures scroll Y\n // position when items are prepended via `.setItems()`\n // when the \"Show previous\" button is still being shown,\n // and then restores scroll Y position in `.didUpdateState()`\n // when the \"Show previous\" button has already been hidden:\n // that's the reason for the scroll Y \"jump\".\n //\n // To prevent that, scroll Y position is captured at `render()`\n // time rather than later in `componentDidUpdate()`: this way,\n // scroll Y position is captured while the \"Show previous\" button\n // is still being shown.\n //\n\n\n var newItems = this.props.items;\n var previousItems = items; // this.virtualScroller.getState().items\n // There's one case when `newItems !== previousItems` is `true`\n // from the start: when `initialState.items` are passed.\n // To handle that single case `this.previousItemsProperty`\n // is tracked and `this.itemsPropertyHasChanged` flag is set.\n\n if (!this.itemsPropertyWasChanged) {\n this.itemsPropertyWasChanged = this.props.items !== this.previousItemsProperty;\n }\n\n this.previousItemsProperty = this.props.items;\n\n if (this.itemsPropertyWasChanged && newItems !== previousItems) {\n var itemsDiff = this.virtualScroller.getItemsDiff(previousItems, newItems);\n\n if (itemsDiff && itemsDiff.prependedItemsCount === 0 && itemsDiff.appendedItemsCount > 0) {// If it's just items that have been appended\n // then no need to re-generate the prefix\n // and to fix scroll position and to clear caches.\n } else {\n // If the items update was incremental, then it's possible\n // that some items were prepended, and so the scroll Y position\n // should be restored after rendering those new items\n // in order for the currently shown items to stay\n // on the same position on screen.\n // (only if explicitly opted into using this feature)\n //\n // If the items update wasn't incremental\n // then there's no point in restoring scroll position.\n //\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n //\n if (itemsDiff) {\n var prependedItemsCount = itemsDiff.prependedItemsCount;\n\n if (prependedItemsCount > 0) {\n if (preserveScrollPositionOnPrependItems || preserveScrollPosition) {\n if (firstShownItemIndex === 0) {\n this.virtualScroller.listHeightChangeWatcher.snapshot({\n previousItems: previousItems,\n newItems: newItems,\n prependedItemsCount: prependedItemsCount\n });\n }\n }\n }\n } // Reset the unique `key` prefix for item component keys.\n\n\n if (!getItemId) {\n this.generateItemKeyPrefix();\n } // Reset item refs.\n\n\n this.itemRefs = new Array(newItems.length);\n }\n }\n\n var tbody = this.virtualScroller.tbody;\n return /*#__PURE__*/React.createElement(AsComponent, _extends({}, rest, {\n ref: this.container,\n className: tbody ? className ? className + ' ' + 'VirtualScroller' : 'VirtualScroller' : className,\n style: {\n paddingTop: tbody ? undefined : px(beforeItemsHeight),\n paddingBottom: tbody ? undefined : px(afterItemsHeight)\n }\n }), items.map(function (item, i) {\n if (i >= firstShownItemIndex && i <= lastShownItemIndex) {\n return /*#__PURE__*/React.createElement(Component, _extends({}, itemComponentProps, {\n key: _this6.getItemKey(item, i),\n ref: _this6.shouldUseRefs() ? _this6.getItemRef(i) : undefined,\n state: itemStates && itemStates[i],\n onStateChange: _this6.getOnItemStateChange(i),\n onHeightChange: _this6.getOnItemHeightChange(i)\n }), item);\n }\n\n return null;\n }));\n }\n }]);\n\n return VirtualScroller;\n}(React.Component);\n/**\r\n * Checks if the argument is a `React.Component` class.\r\n * https://overreacted.io/how-does-react-tell-a-class-from-a-function/\r\n * @param {any} Component\r\n * @return {object} [result] Returns `undefined` if it's not a `React.Component`. Returns an empty object if it's a `React.Component` (`.isReactComponent` is an empty object).\r\n */\n\n\n_defineProperty(VirtualScroller, \"propTypes\", {\n as: elementType,\n items: PropTypes.arrayOf(PropTypes.any).isRequired,\n itemComponent: elementType.isRequired,\n itemComponentProps: PropTypes.object,\n estimatedItemHeight: PropTypes.number,\n bypass: PropTypes.bool,\n // bypassBatchSize: PropTypes.number,\n preserveScrollPositionOnPrependItems: PropTypes.bool,\n // `preserveScrollPosition` property name is deprecated,\n // use `preserveScrollPositionOnPrependItems` instead.\n preserveScrollPosition: PropTypes.bool,\n measureItemsBatchSize: PropTypes.number,\n scrollableContainer: PropTypes.any,\n // `getScrollableContainer` property is deprecated.\n // Use `scrollableContainer` instead.\n getScrollableContainer: PropTypes.func,\n getColumnsCount: PropTypes.func,\n getItemId: PropTypes.func,\n className: PropTypes.string,\n onMount: PropTypes.func,\n onItemInitialRender: PropTypes.func,\n // `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.\n onItemFirstRender: PropTypes.func,\n initialScrollPosition: PropTypes.number,\n onScrollPositionChange: PropTypes.func,\n onStateChange: PropTypes.func,\n initialCustomState: PropTypes.object,\n initialState: PropTypes.shape({\n items: PropTypes.arrayOf(PropTypes.object).isRequired,\n itemStates: PropTypes.arrayOf(PropTypes.any),\n firstShownItemIndex: PropTypes.number.isRequired,\n lastShownItemIndex: PropTypes.number.isRequired,\n beforeItemsHeight: PropTypes.number.isRequired,\n afterItemsHeight: PropTypes.number.isRequired,\n itemHeights: PropTypes.arrayOf(PropTypes.number).isRequired,\n columnsCount: PropTypes.number,\n verticalSpacing: PropTypes.number\n })\n});\n\n_defineProperty(VirtualScroller, \"defaultProps\", {\n as: 'div'\n});\n\nexport { VirtualScroller as default };\n\nfunction isComponentClass(Component) {\n // return Component.prototype instanceof React.Component\n // `React.memo()` returns `.prototype === undefined` for some reason.\n return Component.prototype && Component.prototype.isReactComponent;\n}\n//# sourceMappingURL=VirtualScroller.js.map"],"names":["getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","module","process","hr","uptime","Date","getTime","call","this","root","window","global","vendors","suffix","raf","caf","i","length","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","e","round","push","handle","fn","apply","arguments","object","requestAnimationFrame","cancelAnimationFrame","cancel","delay","startedAt","animationFrame","tick","clear","clearTimeout","timeout","px","number","toFixed","BROWSER_NOT_SUPPORTED_ERROR","supportsTbody","document","documentMode","_defineProperties","target","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","ItemsContainer","getElement","instance","Constructor","TypeError","_classCallCheck","protoProps","staticProps","value","renderedElementIndex","childNodes","getBoundingClientRect","top","height","firstChild","removeChild","prototype","_typeof","obj","Symbol","iterator","constructor","_setPrototypeOf","o","p","setPrototypeOf","__proto__","_createSuper","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","Boolean","valueOf","_isNativeReflectConstruct","result","Super","_getPrototypeOf","NewTarget","_possibleConstructorReturn","self","ReferenceError","_assertThisInitialized","getPrototypeOf","_createClass","ScrollableContainer","element","getItemsContainerElement","scrollTop","scrollY","scrollTo","offsetWidth","offsetHeight","scrollableContainerTop","scrollableContainerBorderTopWidth","clientTop","getScrollY","_onScroll","_this","addEventListener","removeEventListener","_onResize","unobserve","_this2","ResizeObserver","resizeObserver","entries","observe","unlistenGlobalResize","addGlobalResizeListener","itemsContainerElement","ScrollableWindowContainer","_ScrollableContainer","subClass","superClass","create","_inherits","_super","pageYOffset","innerWidth","innerHeight","borderTopWidth","body","_onResize2","onResize","_ref","onResizeListener","fullscreenElement","contains","ListTopOffsetWatcher","getListTopOffset","onListTopOffsetChange","listTopOffset","undefined","listTopOffsetInsideScrollableContainer","start","isRendered","watchListTopOffset","watchListTopOffsetTimer","check","createItemsContainer","createScrollableContainer","scrollableContainer","_toConsumableArray","arr","Array","isArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","minLen","n","toString","name","test","_unsupportedIterableToArray","_nonIterableSpread","len","arr2","log","isDebug","_console","_len","args","_key","console","concat","warn","_console2","_len2","_key2","warningsAreErrors","reportError","_len3","_key3","_console3","Error","join","error","debug","getGlobalVariable","ownKeys","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","_objectSpread","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","Layout","bypass","estimatedItemHeight","measureItemsBatchSize","getPrerenderMargin","getVerticalSpacing","getVerticalSpacingBeforeResize","getColumnsCount","getColumnsCountBeforeResize","getItemHeight","getItemHeightBeforeResize","getBeforeResizeItemsCount","getAverageItemHeight","getMaxVisibleAreaHeight","getPreviouslyCalculatedLayout","_ref2","firstShownItemIndex","lastShownItemIndex","itemsCount","columnsCount","getInitialLastShownItemIndex","beforeItemsHeight","afterItemsHeight","_ref3","estimatedRowsCount","getEstimatedRowsCountForHeight","min","getEstimatedItemHeight","verticalSpacing","ceil","_ref4","_ref5","_ref6","prependedItemsCount","appendedItemsCount","shouldRestoreScrollPosition","averageItemHeight","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","onStart","onStop","onHeightChange","onWidthChange","onNoChange","prevScrollableContainerWidth","scrollableContainerWidth","prevScrollableContainerHeight","scrollableContainerHeight","getWidth","getHeight","func","interval","Promise","resolve","debounce","SCROLLABLE_CONTAINER_RESIZE_DEBOUNCE_INTERVAL","scrollableContainerUnlistenResize","BeforeResize","getState","state","itemHeights","_includesBeforeResizeInState","prevState","_this$getState","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","itemsContainer","onScroll","initialScrollPosition","onScrollPositionChange","isImmediateLayoutScheduled","hasNonRenderedItemsAtTheTop","hasNonRenderedItemsAtTheBottom","getLatestLayoutVisibleArea","onScrolledToTop","waitForScrollingToStop","scrollByY","scrollToY","ignoreScrollEvents","cancelOnStopScrollingTimer","forceUpdate","bottom","onScrollOnStopScrolling","watchOnStopScrolling","stopListeningToScroll","onScrollListener","stopReportingScrollPositionChange","onStopScrollingListener","onStopScrollingTimer","delayed","ON_STOP_SCROLLING_INACTIVE_PERIOD","ListHeightChangeWatcher","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","hasOwnProperty","is","x","y","shallowEqual","objA","objB","keysA","keysB","getStateSnapshot","stateSnapshot","itemStates","VirtualScroller","items","options","_getColumnsCount","getItemsContainerTopOffset","listTopOffsetWatcher","onListTopOffset","resize","stop","scroll","cancelLayoutTimer","newState","onStateChange","layoutUpdateReason","resetLayoutAfterResize","newItemsWillBeRendered","itemHeightsThatChangedWhileNewItemsWereBeingRendered","itemStatesThatChangedWhileNewItemsWereBeingRendered","stateUpdate","itemsDiff","getItemsDiff","onPrepend","initialize","onNewItemsRendered","verticalSpacingStateUpdate","measureItemHeightsAndSpacingAndUpdateTablePadding","cleanedUpBeforeResize","cleanUpBeforeResizeItemHeights","updateStateRightAfterRender","reason","setState","_this$getShownItemInd","getShownItemIndexes","shownItemsHeight","listHeightChangeWatcher","hasSnapshot","getAnchorItemIndex","validateWillBeHiddenItemHeightsAreAccurate","updateShownItemIndexes","getAfterItemsHeight","getItemsCount","layoutDuration","SLOW_LAYOUT_DURATION","getAverage","onBeforeShowItems","previouslyCalculatedLayout","skip","isResizing","cancelScheduledLayout","onUpdateShownItemIndexes","updateLayout","customState","getScrollableContainer","getItemId","tbody","_useTimeoutInRenderLoop","_waitForScrollingToStop","onItemInitialRender","onItemFirstRender","engine","DOMEngine","isItemEqual","a","b","initialItems","item","indexOf","willUpdateState","didUpdateState","shouldResetLayout","columnsCountForState","getActualColumnsCountForState","getActualColumnsCount","getInitialLayoutState","prevWidth","newWidth","layoutTimer","latestLayoutVisibleArea","getListTopOffsetInsideScrollableContainer","onInitialState","getInitialState","_this$layout$getIniti","getInitialLayoutValues","listen","classList","add","style","getElementById","createElement","innerText","replace","head","appendChild","addTbodyStyles","measureItemHeights","measureVerticalSpacing","setProperty","visibleArea","getVisibleAreaBounds","itemTopOffsetInList","getItemTopOffset","layoutTimerStateUpdate","newLayout","_i","_Object$keys","parseInt","_i2","_Object$keys2","_i3","listBottomOffsetChange","getListBottomOffsetChange","scheduleLayoutTimer","_this$getState3","renderedItemsCount","firstShownRowTopOffset","firstShownRowHeight","remeasureItemHeight","newItemState","JSON","stringify","String","_this$getState5","newHeight","updatePreviouslyCalculatedLayoutOnItemHeightChange","heightDifference","isValid","previouslyMeasuredItemHeight","actualItemHeight","_this$getVisibleArea","getVisibleArea","setItems","layoutUpdate","itemsUpdateInfo","_this$getState6","_this$getState7","_ref10","preserveScrollPositionOnPrependItems","preserveScrollPosition","getLayoutUpdateForItemsDiff","snapshot","prepend","append","shouldIncludeBeforeResizeValuesInState","shouldDiscardBeforeResizeItemHeights","isEqual","firstPreviousItemIndex","lastPreviousItemIndex","array","findInArray","offset","arePreviousItemsPreserved","_getItemsDiff","_this$newItemsWillBeR","newLastShownItemIndex","snapshotBeforeResizeItemHeights","_excluded","_extends","assign","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","elementType","PropTypes","oneOfType","string","_React$Component","React","createRef","virtualScroller","previousItemsProperty","generateItemKeyPrefix","createVirtualScroller","_this$props","AsComponent","as","initialState","initialCustomState","VirtualScrollerCore","current","shouldUpdateLayoutOnScreenResize","Component","itemComponent","isReactComponent","itemKeyPrefix","renderItem","_this3","getItemIndex","shouldUseRefs","itemRefs","_isMounted","onItemHeightChange","_this$props2","_this4","onItemStateChange","itemState","_this5","prefix","random","itemKeyPrefixes","onMount","prevProps","_this$props3","_this6","_this$props4","itemComponentProps","className","rest","_this$virtualScroller","itemsPropertyWasChanged","ref","paddingTop","paddingBottom","map","getItemKey","getItemRef","getOnItemStateChange","getOnItemHeightChange","arrayOf","any","isRequired","bool","shape"],"mappings":"8iBAOA,oFCNA,WACE,IAAIA,EAAgBC,EAAQC,EAAUC,EAAgBC,EAAcC,EAExC,oBAAhBC,aAA+C,OAAhBA,aAAyBA,YAAYC,IAC9EC,UAAiB,WACf,OAAOF,YAAYC,OAEQ,oBAAZE,SAAuC,OAAZA,SAAqBA,QAAQR,QACzEO,UAAiB,WACf,OAAQR,IAAmBI,GAAgB,KAE7CH,EAASQ,QAAQR,OAMjBE,GALAH,EAAiB,WACf,IAAIU,EAEJ,OAAe,KADfA,EAAKT,KACK,GAAWS,EAAG,OAG1BL,EAA4B,IAAnBI,QAAQE,SACjBP,EAAeD,EAAiBE,GACvBO,KAAKL,KACdC,UAAiB,WACf,OAAOI,KAAKL,MAAQL,GAEtBA,EAAWU,KAAKL,QAEhBC,UAAiB,WACf,OAAO,IAAII,MAAOC,UAAYX,GAEhCA,GAAW,IAAIU,MAAOC,aAGvBC,KAAKC,MDhCJC,EAAyB,oBAAXC,OAAyBC,EAASD,OAChDE,E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