Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

virtual-scroller

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-scroller - npm Package Compare versions

Comparing version 1.6.3 to 1.6.4

2

bundle/virtual-scroller-dom.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VirtualScroller=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var t,n=(function(t){(function(){var e,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(e()-o)/1e6},n=process.hrtime,r=(e=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(t.exports=function(){return Date.now()-i},i=Date.now()):(t.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(e)}(t={exports:{}},t.exports),t.exports),i="undefined"==typeof window?e:window,r=["moz","webkit"],o="AnimationFrame",s=i["request"+o],a=i["cancel"+o]||i["cancelRequest"+o],l=0;!s&&l<r.length;l++)s=i[r[l]+"Request"+o],a=i[r[l]+"Cancel"+o]||i[r[l]+"CancelRequest"+o];if(!s||!a){var u=0,h=0,d=[];s=function(e){if(0===d.length){var t=n(),i=Math.max(0,1e3/60-(t-u));u=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout(function(){throw e},0)}},Math.round(i))}return d.push({handle:++h,callback:e,cancelled:!1}),h},a=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}var c=function(e){return s.call(i,e)};c.cancel=function(){a.apply(i,arguments)},c.polyfill=function(e){e||(e=i),e.requestAnimationFrame=s,e.cancelAnimationFrame=a};var m=c.cancel;function f(e,t){var n=Date.now(),i=c(function r(){Date.now()-n>=t?e():i=c(r)});return{clear:function(){return m(i)}}}function g(e){e&&e.clear()}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){return!t||"object"!==I(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var x=function(){function e(t){y(this,e),this.element=t}return b(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new C).onResize(e);return function(){t&&t(),r()}}}]),e}(),C=function(e){function t(){return y(this,t),p(this,v(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,x),b(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function O(e){return e.toFixed(2)+"px"}var H="[virtual-scroller] 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";function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function R(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,k(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function M(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var T=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&M(t.prototype,n),i&&M(t,i),e}();function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var L=Object.prototype.hasOwnProperty;function E(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){V(e,t,n[t])})}return e}function B(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=250,j=100,_=function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),V(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),V(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),V(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),V(this,"layout",function(){return s.updateLayout()}),V(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){R("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();R("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=z,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),V(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=N(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),V(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(E(e,t))return!0;if("object"!==P(e)||null===e||"object"!==P(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!L.call(t,n[r])||!E(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){R("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=N(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,R("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),V(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),R("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&R("Columns count",s.getColumnsCount()),R("First shown item index",t),R("Last shown item index",n),R("Before items height",o),R("After items height (actual or estimated)",a),R("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(R("Item heights",s.getState().itemHeights.slice()),R("Item states",s.getState().itemStates.slice())),i&&(R("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),V(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),V(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(R("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),V(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(g(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(R(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=f(s.onUserStoppedScrolling,j)}R("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),V(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,I=a.measureItemsBatchSize,p=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,w=a.estimatedItemHeight,b=a.onItemInitialRender,O=a.onItemFirstRender,k=a.scrollableContainer,M=a.preserveScrollPositionOfTheBottomOfTheListOnMount,B=a.state;R("~ Initialize ~"),B&&(n=B.items),!k&&p&&(k=p()),k?this.scrollableContainer=new x(k):"undefined"!=typeof window&&(this.scrollableContainer=new C),S&&(R("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(R("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(H)},0):console.error(H),y=!0)),y&&R('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=w,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===I?50:I,this._getColumnsCount=v,b?this.onItemFirstRender=b:O&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&O(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=U({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),B&&R("Initial state (passed)",B),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new T(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),M=c),M&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(B||this.getInitialState(d)),R("Items count",n.length),w&&R("Estimated item height",w)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=U({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return R("Initial state (autogenerated)",n),R("First shown item index",n.firstShownItemIndex),R("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");R("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){void 0===this.getState().verticalSpacing&&this.updateVerticalSpacing(),this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),g(this.onUserStopsScrollingTimeout),g(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",O(t)),e.style.setProperty("--VirtualScroller-paddingBottom",O(n))}(this.getContainerElement(),t,n)}},{key:"updateVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n){var l=s-(n+i);return A()&&R("Measure item vertical spacing",l),l}i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(R("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&R("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(R("~ Item state changed ~"),R("Item",e),R("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),R("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(R("~ Item height changed ~"),R("Item",e),R("Previous height",n),R("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){R("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(R("First visible row index",u),i=u*a),n+o+d+h>t)return R("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&R("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;R("Off-screen")}else R("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=f(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,f(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;R("~ Update items ~");var c=N(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(R("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(R("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var I=m/g,p=Math.ceil(f/g);s+=I*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=p*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else R("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),R("Previous items",n),R("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;R("First shown item index",r),R("Last shown item index",o),R("Before items height",s),R("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&B(t.prototype,n),i&&B(t,i),e}();function N(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}function D(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Y(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return function(){function e(t,n,i){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),W(this,"onStateChange",function(e,t){var n=e.items,i=e.firstShownItemIndex,o=e.lastShownItemIndex,s=e.beforeItemsHeight,a=e.afterItemsHeight;R("~ On state change ~"),R("Previous state",t),R("New state",e),r.tbody||(r.container.style.paddingTop=O(s),r.container.style.paddingBottom=O(a));var l=t&&n===t.items&&n.length>0;if(l){R("Incremental rerender");for(var u=t.lastShownItemIndex;u>=t.firstShownItemIndex;)u>=i&&u<=o||(R("Remove item index",u),r.unmountItem(r.container.childNodes[u-t.firstShownItemIndex])),u--}else for(R("Rerender from scratch");r.container.firstChild;)r.unmountItem(r.container.firstChild);for(var h=l,d=h&&r.container.firstChild,c=i;c<=o;){if(l&&c>=t.firstShownItemIndex&&c<=t.lastShownItemIndex)h&&(h=!1);else{var m=r.renderItem(n[c]);h?(R("Prepend item index",c),r.container.insertBefore(m,d)):(R("Append item index",c),r.container.appendChild(m))}c++}}),W(this,"onUnmount",function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),r.stop()}),W(this,"destroy",function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),r.stop()}),W(this,"stop",function(){r.virtualScroller.stop()}),this.container=t,this.renderItem=i;var s=o.onMount,a=o.onItemUnmount,l=D(o,["onMount","onItemUnmount"]);this.onItemUnmount=a,this.tbody="TBODY"===this.container.tagName,this.virtualScroller=new _(function(){return r.container},n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){W(e,t,n[t])})}return e}({},l,{tbody:this.tbody,onStateChange:this.onStateChange})),s&&s(),this.virtualScroller.listen()}var t,n,i;return t=e,(n=[{key:"unmountItem",value:function(e){this.container.removeChild(e),this.onItemUnmount&&this.onItemUnmount(e)}},{key:"onItemHeightChange",value:function(e){this.virtualScroller.onItemHeightChange(e)}},{key:"updateItems",value:function(e,t){this.setItems(e,t)}},{key:"setItems",value:function(e,t){this.virtualScroller.setItems(e,t)}},{key:"getItemCoordinates",value:function(e){return this.virtualScroller.getItemCoordinates(e)}}])&&Y(t.prototype,n),i&&Y(t,i),e}()});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VirtualScroller=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var t,n=(function(t){(function(){var e,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(e()-o)/1e6},n=process.hrtime,r=(e=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(t.exports=function(){return Date.now()-i},i=Date.now()):(t.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(e)}(t={exports:{}},t.exports),t.exports),i="undefined"==typeof window?e:window,r=["moz","webkit"],o="AnimationFrame",s=i["request"+o],a=i["cancel"+o]||i["cancelRequest"+o],l=0;!s&&l<r.length;l++)s=i[r[l]+"Request"+o],a=i[r[l]+"Cancel"+o]||i[r[l]+"CancelRequest"+o];if(!s||!a){var u=0,h=0,d=[];s=function(e){if(0===d.length){var t=n(),i=Math.max(0,1e3/60-(t-u));u=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout(function(){throw e},0)}},Math.round(i))}return d.push({handle:++h,callback:e,cancelled:!1}),h},a=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}var c=function(e){return s.call(i,e)};c.cancel=function(){a.apply(i,arguments)},c.polyfill=function(e){e||(e=i),e.requestAnimationFrame=s,e.cancelAnimationFrame=a};var m=c.cancel;function f(e,t){var n=Date.now(),i=c(function r(){Date.now()-n>=t?e():i=c(r)});return{clear:function(){return m(i)}}}function g(e){e&&e.clear()}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){return!t||"object"!==I(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var x=function(){function e(t){y(this,e),this.element=t}return b(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new C).onResize(e);return function(){t&&t(),r()}}}]),e}(),C=function(e){function t(){return y(this,t),p(this,v(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,x),b(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function O(e){return e.toFixed(2)+"px"}var H="[virtual-scroller] 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";function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function R(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,k(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function M(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var T=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&M(t.prototype,n),i&&M(t,i),e}();function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var L=Object.prototype.hasOwnProperty;function E(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){V(e,t,n[t])})}return e}function B(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=250,j=100,_=function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),V(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),V(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),V(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),V(this,"layout",function(){return s.updateLayout()}),V(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){R("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();R("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=z,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),V(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=N(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),V(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(E(e,t))return!0;if("object"!==P(e)||null===e||"object"!==P(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!L.call(t,n[r])||!E(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){R("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=N(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,R("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),V(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),R("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&R("Columns count",s.getColumnsCount()),R("First shown item index",t),R("Last shown item index",n),R("Before items height",o),R("After items height (actual or estimated)",a),R("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(R("Item heights",s.getState().itemHeights.slice()),R("Item states",s.getState().itemStates.slice())),i&&(R("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),V(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),V(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(R("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),V(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(g(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(R(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=f(s.onUserStoppedScrolling,j)}R("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),V(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,I=a.measureItemsBatchSize,p=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,w=a.estimatedItemHeight,b=a.onItemInitialRender,O=a.onItemFirstRender,k=a.scrollableContainer,M=a.preserveScrollPositionOfTheBottomOfTheListOnMount,B=a.state;R("~ Initialize ~"),B&&(n=B.items),!k&&p&&(k=p()),k?this.scrollableContainer=new x(k):"undefined"!=typeof window&&(this.scrollableContainer=new C),S&&(R("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(R("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(H)},0):console.error(H),y=!0)),y&&R('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=w,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===I?50:I,this._getColumnsCount=v,b?this.onItemFirstRender=b:O&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&O(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=U({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),B&&R("Initial state (passed)",B),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new T(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),M=c),M&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(B||this.getInitialState(d)),R("Items count",n.length),w&&R("Estimated item height",w)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=U({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return R("Initial state (autogenerated)",n),R("First shown item index",n.firstShownItemIndex),R("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");R("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){if(void 0===this.getState().verticalSpacing){R("~ Measure item vertical spacing ~");var e=this.measureVerticalSpacing();void 0===e?R("Not enough items rendered"):(R("Item vertical spacing",e),this.setState({verticalSpacing:e}))}this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),g(this.onUserStopsScrollingTimeout),g(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",O(t)),e.style.setProperty("--VirtualScroller-paddingBottom",O(n))}(this.getContainerElement(),t,n)}},{key:"measureVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n)return s-(n+i);i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(R("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&R("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(R("~ Item state changed ~"),R("Item",e),R("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),R("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(R("~ Item height changed ~"),R("Item",e),R("Previous height",n),R("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){R("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(R("First visible row index",u),i=u*a),n+o+d+h>t)return R("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&R("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;R("Off-screen")}else R("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=f(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,f(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;R("~ Update items ~");var c=N(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(R("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(R("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var I=m/g,p=Math.ceil(f/g);s+=I*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=p*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else R("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),R("Previous items",n),R("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;R("First shown item index",r),R("Last shown item index",o),R("Before items height",s),R("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&B(t.prototype,n),i&&B(t,i),e}();function N(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}function D(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Y(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}return function(){function e(t,n,i){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),W(this,"onStateChange",function(e,t){var n=e.items,i=e.firstShownItemIndex,o=e.lastShownItemIndex,s=e.beforeItemsHeight,a=e.afterItemsHeight;R("~ On state change ~"),R("Previous state",t),R("New state",e),r.tbody||(r.container.style.paddingTop=O(s),r.container.style.paddingBottom=O(a));var l=t&&n===t.items&&n.length>0;if(l){R("Incremental rerender");for(var u=t.lastShownItemIndex;u>=t.firstShownItemIndex;)u>=i&&u<=o||(R("Remove item index",u),r.unmountItem(r.container.childNodes[u-t.firstShownItemIndex])),u--}else for(R("Rerender from scratch");r.container.firstChild;)r.unmountItem(r.container.firstChild);for(var h=l,d=h&&r.container.firstChild,c=i;c<=o;){if(l&&c>=t.firstShownItemIndex&&c<=t.lastShownItemIndex)h&&(h=!1);else{var m=r.renderItem(n[c]);h?(R("Prepend item index",c),r.container.insertBefore(m,d)):(R("Append item index",c),r.container.appendChild(m))}c++}}),W(this,"onUnmount",function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),r.stop()}),W(this,"destroy",function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),r.stop()}),W(this,"stop",function(){r.virtualScroller.stop()}),this.container=t,this.renderItem=i;var s=o.onMount,a=o.onItemUnmount,l=D(o,["onMount","onItemUnmount"]);this.onItemUnmount=a,this.tbody="TBODY"===this.container.tagName,this.virtualScroller=new _(function(){return r.container},n,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){W(e,t,n[t])})}return e}({},l,{tbody:this.tbody,onStateChange:this.onStateChange})),s&&s(),this.virtualScroller.listen()}var t,n,i;return t=e,(n=[{key:"unmountItem",value:function(e){this.container.removeChild(e),this.onItemUnmount&&this.onItemUnmount(e)}},{key:"onItemHeightChange",value:function(e){this.virtualScroller.onItemHeightChange(e)}},{key:"updateItems",value:function(e,t){this.setItems(e,t)}},{key:"setItems",value:function(e,t){this.virtualScroller.setItems(e,t)}},{key:"getItemCoordinates",value:function(e){return this.virtualScroller.getItemCoordinates(e)}}])&&Y(t.prototype,n),i&&Y(t,i),e}()});
//# sourceMappingURL=virtual-scroller-dom.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).VirtualScroller=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var i,r=(function(e){(function(){var t,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-o)/1e6},n=process.hrtime,r=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(n)}(i={exports:{}},i.exports),i.exports),o="undefined"==typeof window?n:window,s=["moz","webkit"],a="AnimationFrame",l=o["request"+a],u=o["cancel"+a]||o["cancelRequest"+a],h=0;!l&&h<s.length;h++)l=o[s[h]+"Request"+a],u=o[s[h]+"Cancel"+a]||o[s[h]+"CancelRequest"+a];if(!l||!u){var d=0,c=0,m=[];l=function(e){if(0===m.length){var t=r(),n=Math.max(0,1e3/60-(t-d));d=n+t,setTimeout(function(){var e=m.slice(0);m.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(d)}catch(e){setTimeout(function(){throw e},0)}},Math.round(n))}return m.push({handle:++c,callback:e,cancelled:!1}),c},u=function(e){for(var t=0;t<m.length;t++)m[t].handle===e&&(m[t].cancelled=!0)}}var f=function(e){return l.call(o,e)};f.cancel=function(){u.apply(o,arguments)},f.polyfill=function(e){e||(e=o),e.requestAnimationFrame=l,e.cancelAnimationFrame=u};var g=f.cancel;function p(e,t){var n=Date.now(),i=f(function r(){Date.now()-n>=t?e():i=f(r)});return{clear:function(){return g(i)}}}function I(e){e&&e.clear()}function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function x(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var O=function(){function e(t){w(this,e),this.element=t}return x(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new R).onResize(e);return function(){t&&t(),r()}}}]),e}(),R=function(e){function t(){return w(this,t),S(this,y(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,O),x(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function H(e){return e.toFixed(2)+"px"}var P="[virtual-scroller] 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";function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function M(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,k(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function T(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var L=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&T(t.prototype,n),i&&T(t,i),e}();function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var U=Object.prototype.hasOwnProperty;function B(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){j(e,t,n[t])})}return e}function _(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V=250,W=100,q=function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),j(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),j(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),j(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),j(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),j(this,"layout",function(){return s.updateLayout()}),j(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){M("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();M("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=V,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),j(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=N(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),j(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(B(e,t))return!0;if("object"!==E(e)||null===e||"object"!==E(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!U.call(t,n[r])||!B(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){M("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=N(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,M("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),j(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),M("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&M("Columns count",s.getColumnsCount()),M("First shown item index",t),M("Last shown item index",n),M("Before items height",o),M("After items height (actual or estimated)",a),M("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(M("Item heights",s.getState().itemHeights.slice()),M("Item states",s.getState().itemStates.slice())),i&&(M("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),j(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),j(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(M("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),j(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(I(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(M(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=p(s.onUserStoppedScrolling,W)}M("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),j(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,f=a.measureItemsBatchSize,g=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,b=a.estimatedItemHeight,w=a.onItemInitialRender,C=a.onItemFirstRender,x=a.scrollableContainer,H=a.preserveScrollPositionOfTheBottomOfTheListOnMount,k=a.state;M("~ Initialize ~"),k&&(n=k.items),!x&&g&&(x=g()),x?this.scrollableContainer=new O(x):"undefined"!=typeof window&&(this.scrollableContainer=new R),S&&(M("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(M("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(P)},0):console.error(P),y=!0)),y&&M('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=b,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===f?50:f,this._getColumnsCount=v,w?this.onItemFirstRender=w:C&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&C(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=z({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),k&&M("Initial state (passed)",k),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new L(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),H=c),H&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(k||this.getInitialState(d)),M("Items count",n.length),b&&M("Estimated item height",b)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=z({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return M("Initial state (autogenerated)",n),M("First shown item index",n.firstShownItemIndex),M("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");M("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){void 0===this.getState().verticalSpacing&&this.updateVerticalSpacing(),this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),I(this.onUserStopsScrollingTimeout),I(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",H(t)),e.style.setProperty("--VirtualScroller-paddingBottom",H(n))}(this.getContainerElement(),t,n)}},{key:"updateVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n){var l=s-(n+i);return A()&&M("Measure item vertical spacing",l),l}i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(M("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&M("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(M("~ Item state changed ~"),M("Item",e),M("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),M("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(M("~ Item height changed ~"),M("Item",e),M("Previous height",n),M("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){M("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(M("First visible row index",u),i=u*a),n+o+d+h>t)return M("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&M("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;M("Off-screen")}else M("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=p(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,p(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;M("~ Update items ~");var c=N(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(M("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(M("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var p=m/g,I=Math.ceil(f/g);s+=p*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=I*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else M("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),M("Previous items",n),M("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;M("First shown item index",r),M("Last shown item index",o),M("Before items height",s),M("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&_(t.prototype,n),i&&_(t,i),e}();function N(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function Y(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function J(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=t.elementType||t.oneOfType([t.string,t.func,t.object]),$=function(t){function n(t){var i,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=this,o=X(n).call(this,t),i=!o||"object"!==F(o)&&"function"!=typeof o?G(r):o,Q(G(i),"container",e.createRef()),Q(G(i),"onItemStateChange",new Array(i.props.items.length)),Q(G(i),"onItemHeightChange",new Array(i.props.items.length)),Q(G(i),"itemRefs",new Array(i.props.items.length)),Q(G(i),"uniquePrefixes",[]),Q(G(i),"updateLayout",function(){return i.virtualScroller.updateLayout()}),Q(G(i),"layout",function(){return i.updateLayout()}),Q(G(i),"onItemInitialRender",function(){var e=i.props.onItemInitialRender;e&&e.apply(void 0,arguments)}),Q(G(i),"onItemFirstRender",function(){var e=i.props.onItemFirstRender;e&&e.apply(void 0,arguments)}),Q(G(i),"shouldUpdateLayoutOnWindowResize",function(){var e=i.props.shouldUpdateLayoutOnWindowResize;if(e)return e.apply(void 0,arguments)}),i.previousItemsProperty=t.items,i.generateUniquePrefix(),i.createVirtualScroller(),i}var i,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(n,e.Component),i=n,(r=[{key:"createVirtualScroller",value:function(){var e=this,t=this.props,n=t.as,i=t.items,r=t.initialState,o=t.initialCustomState,s=t.onStateChange,a=t.estimatedItemHeight,l=t.preserveScrollPositionOfTheBottomOfTheListOnMount,u=t.preserveScrollPositionAtBottomOnMount,h=t.measureItemsBatchSize,d=t.scrollableContainer,c=t.getScrollableContainer,m=t.getColumnsCount,f=t.bypass;this.virtualScroller=new q(function(){return e.container.current},i,{estimatedItemHeight:a,bypass:f,onItemInitialRender:this.onItemInitialRender,onItemFirstRender:this.onItemFirstRender,preserveScrollPositionOfTheBottomOfTheListOnMount:l,preserveScrollPositionAtBottomOnMount:u,shouldUpdateLayoutOnWindowResize:this.shouldUpdateLayoutOnWindowResize,measureItemsBatchSize:h,scrollableContainer:d,getScrollableContainer:c,getColumnsCount:m,tbody:"tbody"===n,state:r,customState:o,onStateChange:s,getState:function(){return e.state},setState:function(t,n){var i=n.willUpdateState,r=n.didUpdateState;e.willUpdateState=i,e.didUpdateState=r,e.state?e.setState(t):(i(t),e.state=t,r())}})}},{key:"shouldUseRefs",value:function(){var e,t=this.props.itemComponent;return(e=t).prototype&&e.prototype.isReactComponent}},{key:"getItemCoordinates",value:function(e){return this.virtualScroller.getItemCoordinates(e)}},{key:"updateItem",value:function(e){return this.renderItem(e)}},{key:"renderItem",value:function(e){var t=this;if(!this.shouldUseRefs())return console.error("[virtual-scroller] `.renderItem(i)` has been called but the `component` doesn't allow `ref`s. Only `component`s that're `React.Component`s support this feature.");if(this.itemRefs[e]&&this.itemRefs[e].current){var n=this.props.items,i=n[e];this.itemRefs[e].current.forceUpdate(function(){if(t._isMounted){var e=n.indexOf(i);e>=0&&t.virtualScroller.onItemHeightChange(e)}})}}},{key:"getItemRef",value:function(t){return this.itemRefs[t]||(this.itemRefs[t]=e.createRef()),this.itemRefs[t]}},{key:"getOnItemStateChange",value:function(e){var t=this;return this.onItemStateChange[e]||(this.onItemStateChange[e]=function(n){return t.virtualScroller.onItemStateChange(e,n)}),this.onItemStateChange[e]}},{key:"getOnItemHeightChange",value:function(e){var t=this;return this.onItemHeightChange[e]||(this.onItemHeightChange[e]=function(){return t.virtualScroller.onItemHeightChange(e)}),this.onItemHeightChange[e]}},{key:"generateUniquePrefix",value:function(){var e=String(Math.random()).slice(2);if(this.uniquePrefixes.indexOf(e)>=0)return this.generateUniquePrefix();this.uniquePrefixes.push(e),this.uniquePrefix=e}},{key:"componentDidMount",value:function(){var e=this.props.onMount;e&&e(),this._isMounted=!0,this.virtualScroller.listen()}},{key:"getSnapshotBeforeUpdate",value:function(e,t){return this.state!==t&&this.willUpdateState(this.state,t),null}},{key:"componentDidUpdate",value:function(e,t){this.state!==t&&this.didUpdateState(t);var n=this.props,i=n.items,r=n.preserveScrollPosition,o=n.preserveScrollPositionOnPrependItems;i!==e.items&&this.virtualScroller.setItems(i,{preserveScrollPositionOnPrependItems:o||r})}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.virtualScroller.stop()}},{key:"render",value:function(){var t=this,n=this.props,i=n.as,r=n.itemComponent,o=n.itemComponentProps,s=(n.items,n.estimatedItemHeight,n.bypass,n.preserveScrollPositionOnPrependItems),a=n.preserveScrollPosition,l=(n.preserveScrollPositionOfTheBottomOfTheListOnMount,n.preserveScrollPositionAtBottomOnMount,n.shouldUpdateLayoutOnWindowResize,n.measureItemsBatchSize,n.scrollableContainer,n.getScrollableContainer,n.getColumnsCount,n.initialState,n.initialCustomState,n.onStateChange,n.onItemInitialRender,n.onItemFirstRender,n.onMount,n.className),u=Y(n,["as","itemComponent","itemComponentProps","items","estimatedItemHeight","bypass","preserveScrollPositionOnPrependItems","preserveScrollPosition","preserveScrollPositionOfTheBottomOfTheListOnMount","preserveScrollPositionAtBottomOnMount","shouldUpdateLayoutOnWindowResize","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","initialState","initialCustomState","onStateChange","onItemInitialRender","onItemFirstRender","onMount","className"]),h=this.virtualScroller.getState(),d=h.items,c=h.itemStates,m=h.firstShownItemIndex,f=h.lastShownItemIndex,g=h.beforeItemsHeight,p=h.afterItemsHeight,I=this.props.items,v=d;if(this.itemsPropertyWasChanged||(this.itemsPropertyWasChanged=this.props.items!==this.previousItemsProperty),this.previousItemsProperty=this.props.items,this.itemsPropertyWasChanged&&I!==v){var S=N(v,I);S&&0===S.prependedItemsCount&&S.appendedItemsCount>0||(S&&(s||a)&&this.virtualScroller.captureScroll(v,I,S.prependedItemsCount),this.generateUniquePrefix(),this.onItemStateChange=new Array(I.length),this.onItemHeightChange=new Array(I.length),this.itemRefs=new Array(I.length))}var y=this.virtualScroller.tbody;return e.createElement(i,D({},u,{ref:this.container,className:y?l?l+" VirtualScroller":"VirtualScroller":l,style:{paddingTop:y?void 0:H(g),paddingBottom:y?void 0:H(p)}}),d.map(function(n,i){return i>=m&&i<=f?e.createElement(r,D({},o,{ref:t.shouldUseRefs()?t.getItemRef(i):void 0,key:"".concat(t.uniquePrefix,":").concat(i),state:c&&c[i],onStateChange:t.getOnItemStateChange(i),onHeightChange:t.getOnItemHeightChange(i)}),n):null}))}}])&&J(i.prototype,r),o&&J(i,o),n}();return Q($,"propTypes",{as:Z,items:t.arrayOf(t.object).isRequired,itemComponent:Z.isRequired,itemComponentProps:t.object,estimatedItemHeight:t.number,bypass:t.bool,preserveScrollPositionOnPrependItems:t.bool,preserveScrollPosition:t.bool,preserveScrollPositionOfTheBottomOfTheListOnMount:t.bool,preserveScrollPositionAtBottomOnMount:t.bool,shouldUpdateLayoutOnWindowResize:t.func,measureItemsBatchSize:t.number,scrollableContainer:t.any,getScrollableContainer:t.func,getColumnsCount:t.func,className:t.string,onMount:t.func,onItemInitialRender:t.func,onItemFirstRender:t.func,onStateChange:t.func,initialCustomState:t.object,initialState:t.shape({items:t.arrayOf(t.object).isRequired,itemStates:t.arrayOf(t.any),firstShownItemIndex:t.number.isRequired,lastShownItemIndex:t.number.isRequired,beforeItemsHeight:t.number.isRequired,afterItemsHeight:t.number.isRequired,itemHeights:t.arrayOf(t.number).isRequired,columnsCount:t.number,verticalSpacing:t.number})}),Q($,"defaultProps",{as:"div"}),$});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).VirtualScroller=t(e.React,e.PropTypes)}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var i,r=(function(e){(function(){var t,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-o)/1e6},n=process.hrtime,r=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(n)}(i={exports:{}},i.exports),i.exports),o="undefined"==typeof window?n:window,s=["moz","webkit"],a="AnimationFrame",l=o["request"+a],u=o["cancel"+a]||o["cancelRequest"+a],h=0;!l&&h<s.length;h++)l=o[s[h]+"Request"+a],u=o[s[h]+"Cancel"+a]||o[s[h]+"CancelRequest"+a];if(!l||!u){var d=0,c=0,m=[];l=function(e){if(0===m.length){var t=r(),n=Math.max(0,1e3/60-(t-d));d=n+t,setTimeout(function(){var e=m.slice(0);m.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(d)}catch(e){setTimeout(function(){throw e},0)}},Math.round(n))}return m.push({handle:++c,callback:e,cancelled:!1}),c},u=function(e){for(var t=0;t<m.length;t++)m[t].handle===e&&(m[t].cancelled=!0)}}var f=function(e){return l.call(o,e)};f.cancel=function(){u.apply(o,arguments)},f.polyfill=function(e){e||(e=o),e.requestAnimationFrame=l,e.cancelAnimationFrame=u};var g=f.cancel;function p(e,t){var n=Date.now(),i=f(function r(){Date.now()-n>=t?e():i=f(r)});return{clear:function(){return g(i)}}}function I(e){e&&e.clear()}function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){return!t||"object"!==v(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function x(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var O=function(){function e(t){w(this,e),this.element=t}return x(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new R).onResize(e);return function(){t&&t(),r()}}}]),e}(),R=function(e){function t(){return w(this,t),S(this,y(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,O),x(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function H(e){return e.toFixed(2)+"px"}var P="[virtual-scroller] 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";function k(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function M(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,k(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function T(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var L=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&T(t.prototype,n),i&&T(t,i),e}();function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var U=Object.prototype.hasOwnProperty;function B(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){j(e,t,n[t])})}return e}function _(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V=250,W=100,q=function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),j(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),j(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),j(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),j(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),j(this,"layout",function(){return s.updateLayout()}),j(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){M("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();M("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=V,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),j(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=N(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),j(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(B(e,t))return!0;if("object"!==E(e)||null===e||"object"!==E(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!U.call(t,n[r])||!B(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){M("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=N(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,M("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),j(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),M("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&M("Columns count",s.getColumnsCount()),M("First shown item index",t),M("Last shown item index",n),M("Before items height",o),M("After items height (actual or estimated)",a),M("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(M("Item heights",s.getState().itemHeights.slice()),M("Item states",s.getState().itemStates.slice())),i&&(M("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),j(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),j(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(M("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),j(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(I(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(M(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=p(s.onUserStoppedScrolling,W)}M("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),j(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,f=a.measureItemsBatchSize,g=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,b=a.estimatedItemHeight,w=a.onItemInitialRender,C=a.onItemFirstRender,x=a.scrollableContainer,H=a.preserveScrollPositionOfTheBottomOfTheListOnMount,k=a.state;M("~ Initialize ~"),k&&(n=k.items),!x&&g&&(x=g()),x?this.scrollableContainer=new O(x):"undefined"!=typeof window&&(this.scrollableContainer=new R),S&&(M("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(M("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(P)},0):console.error(P),y=!0)),y&&M('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=b,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===f?50:f,this._getColumnsCount=v,w?this.onItemFirstRender=w:C&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&C(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=z({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),k&&M("Initial state (passed)",k),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new L(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),H=c),H&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(k||this.getInitialState(d)),M("Items count",n.length),b&&M("Estimated item height",b)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=z({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return M("Initial state (autogenerated)",n),M("First shown item index",n.firstShownItemIndex),M("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");M("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){if(void 0===this.getState().verticalSpacing){M("~ Measure item vertical spacing ~");var e=this.measureVerticalSpacing();void 0===e?M("Not enough items rendered"):(M("Item vertical spacing",e),this.setState({verticalSpacing:e}))}this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),I(this.onUserStopsScrollingTimeout),I(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",H(t)),e.style.setProperty("--VirtualScroller-paddingBottom",H(n))}(this.getContainerElement(),t,n)}},{key:"measureVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n)return s-(n+i);i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(M("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&M("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(M("~ Item state changed ~"),M("Item",e),M("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),M("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(M("~ Item height changed ~"),M("Item",e),M("Previous height",n),M("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){M("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(M("First visible row index",u),i=u*a),n+o+d+h>t)return M("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&M("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;M("Off-screen")}else M("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=p(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,p(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;M("~ Update items ~");var c=N(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(M("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(M("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var p=m/g,I=Math.ceil(f/g);s+=p*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=I*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else M("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),M("Previous items",n),M("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;M("First shown item index",r),M("Last shown item index",o),M("Before items height",s),M("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&_(t.prototype,n),i&&_(t,i),e}();function N(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function Y(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function J(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Z=t.elementType||t.oneOfType([t.string,t.func,t.object]),$=function(t){function n(t){var i,r,o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),r=this,o=X(n).call(this,t),i=!o||"object"!==F(o)&&"function"!=typeof o?G(r):o,Q(G(i),"container",e.createRef()),Q(G(i),"onItemStateChange",new Array(i.props.items.length)),Q(G(i),"onItemHeightChange",new Array(i.props.items.length)),Q(G(i),"itemRefs",new Array(i.props.items.length)),Q(G(i),"uniquePrefixes",[]),Q(G(i),"updateLayout",function(){return i.virtualScroller.updateLayout()}),Q(G(i),"layout",function(){return i.updateLayout()}),Q(G(i),"onItemInitialRender",function(){var e=i.props.onItemInitialRender;e&&e.apply(void 0,arguments)}),Q(G(i),"onItemFirstRender",function(){var e=i.props.onItemFirstRender;e&&e.apply(void 0,arguments)}),Q(G(i),"shouldUpdateLayoutOnWindowResize",function(){var e=i.props.shouldUpdateLayoutOnWindowResize;if(e)return e.apply(void 0,arguments)}),i.previousItemsProperty=t.items,i.generateUniquePrefix(),i.createVirtualScroller(),i}var i,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(n,e.Component),i=n,(r=[{key:"createVirtualScroller",value:function(){var e=this,t=this.props,n=t.as,i=t.items,r=t.initialState,o=t.initialCustomState,s=t.onStateChange,a=t.estimatedItemHeight,l=t.preserveScrollPositionOfTheBottomOfTheListOnMount,u=t.preserveScrollPositionAtBottomOnMount,h=t.measureItemsBatchSize,d=t.scrollableContainer,c=t.getScrollableContainer,m=t.getColumnsCount,f=t.bypass;this.virtualScroller=new q(function(){return e.container.current},i,{estimatedItemHeight:a,bypass:f,onItemInitialRender:this.onItemInitialRender,onItemFirstRender:this.onItemFirstRender,preserveScrollPositionOfTheBottomOfTheListOnMount:l,preserveScrollPositionAtBottomOnMount:u,shouldUpdateLayoutOnWindowResize:this.shouldUpdateLayoutOnWindowResize,measureItemsBatchSize:h,scrollableContainer:d,getScrollableContainer:c,getColumnsCount:m,tbody:"tbody"===n,state:r,customState:o,onStateChange:s,getState:function(){return e.state},setState:function(t,n){var i=n.willUpdateState,r=n.didUpdateState;e.willUpdateState=i,e.didUpdateState=r,e.state?e.setState(t):(i(t),e.state=t,r())}})}},{key:"shouldUseRefs",value:function(){var e,t=this.props.itemComponent;return(e=t).prototype&&e.prototype.isReactComponent}},{key:"getItemCoordinates",value:function(e){return this.virtualScroller.getItemCoordinates(e)}},{key:"updateItem",value:function(e){return this.renderItem(e)}},{key:"renderItem",value:function(e){var t=this;if(!this.shouldUseRefs())return console.error("[virtual-scroller] `.renderItem(i)` has been called but the `component` doesn't allow `ref`s. Only `component`s that're `React.Component`s support this feature.");if(this.itemRefs[e]&&this.itemRefs[e].current){var n=this.props.items,i=n[e];this.itemRefs[e].current.forceUpdate(function(){if(t._isMounted){var e=n.indexOf(i);e>=0&&t.virtualScroller.onItemHeightChange(e)}})}}},{key:"getItemRef",value:function(t){return this.itemRefs[t]||(this.itemRefs[t]=e.createRef()),this.itemRefs[t]}},{key:"getOnItemStateChange",value:function(e){var t=this;return this.onItemStateChange[e]||(this.onItemStateChange[e]=function(n){return t.virtualScroller.onItemStateChange(e,n)}),this.onItemStateChange[e]}},{key:"getOnItemHeightChange",value:function(e){var t=this;return this.onItemHeightChange[e]||(this.onItemHeightChange[e]=function(){return t.virtualScroller.onItemHeightChange(e)}),this.onItemHeightChange[e]}},{key:"generateUniquePrefix",value:function(){var e=String(Math.random()).slice(2);if(this.uniquePrefixes.indexOf(e)>=0)return this.generateUniquePrefix();this.uniquePrefixes.push(e),this.uniquePrefix=e}},{key:"componentDidMount",value:function(){var e=this.props.onMount;e&&e(),this._isMounted=!0,this.virtualScroller.listen()}},{key:"getSnapshotBeforeUpdate",value:function(e,t){return this.state!==t&&this.willUpdateState(this.state,t),null}},{key:"componentDidUpdate",value:function(e,t){this.state!==t&&this.didUpdateState(t);var n=this.props,i=n.items,r=n.preserveScrollPosition,o=n.preserveScrollPositionOnPrependItems;i!==e.items&&this.virtualScroller.setItems(i,{preserveScrollPositionOnPrependItems:o||r})}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.virtualScroller.stop()}},{key:"render",value:function(){var t=this,n=this.props,i=n.as,r=n.itemComponent,o=n.itemComponentProps,s=(n.items,n.estimatedItemHeight,n.bypass,n.preserveScrollPositionOnPrependItems),a=n.preserveScrollPosition,l=(n.preserveScrollPositionOfTheBottomOfTheListOnMount,n.preserveScrollPositionAtBottomOnMount,n.shouldUpdateLayoutOnWindowResize,n.measureItemsBatchSize,n.scrollableContainer,n.getScrollableContainer,n.getColumnsCount,n.initialState,n.initialCustomState,n.onStateChange,n.onItemInitialRender,n.onItemFirstRender,n.onMount,n.className),u=Y(n,["as","itemComponent","itemComponentProps","items","estimatedItemHeight","bypass","preserveScrollPositionOnPrependItems","preserveScrollPosition","preserveScrollPositionOfTheBottomOfTheListOnMount","preserveScrollPositionAtBottomOnMount","shouldUpdateLayoutOnWindowResize","measureItemsBatchSize","scrollableContainer","getScrollableContainer","getColumnsCount","initialState","initialCustomState","onStateChange","onItemInitialRender","onItemFirstRender","onMount","className"]),h=this.virtualScroller.getState(),d=h.items,c=h.itemStates,m=h.firstShownItemIndex,f=h.lastShownItemIndex,g=h.beforeItemsHeight,p=h.afterItemsHeight,I=this.props.items,v=d;if(this.itemsPropertyWasChanged||(this.itemsPropertyWasChanged=this.props.items!==this.previousItemsProperty),this.previousItemsProperty=this.props.items,this.itemsPropertyWasChanged&&I!==v){var S=N(v,I);S&&0===S.prependedItemsCount&&S.appendedItemsCount>0||(S&&(s||a)&&this.virtualScroller.captureScroll(v,I,S.prependedItemsCount),this.generateUniquePrefix(),this.onItemStateChange=new Array(I.length),this.onItemHeightChange=new Array(I.length),this.itemRefs=new Array(I.length))}var y=this.virtualScroller.tbody;return e.createElement(i,D({},u,{ref:this.container,className:y?l?l+" VirtualScroller":"VirtualScroller":l,style:{paddingTop:y?void 0:H(g),paddingBottom:y?void 0:H(p)}}),d.map(function(n,i){return i>=m&&i<=f?e.createElement(r,D({},o,{ref:t.shouldUseRefs()?t.getItemRef(i):void 0,key:"".concat(t.uniquePrefix,":").concat(i),state:c&&c[i],onStateChange:t.getOnItemStateChange(i),onHeightChange:t.getOnItemHeightChange(i)}),n):null}))}}])&&J(i.prototype,r),o&&J(i,o),n}();return Q($,"propTypes",{as:Z,items:t.arrayOf(t.object).isRequired,itemComponent:Z.isRequired,itemComponentProps:t.object,estimatedItemHeight:t.number,bypass:t.bool,preserveScrollPositionOnPrependItems:t.bool,preserveScrollPosition:t.bool,preserveScrollPositionOfTheBottomOfTheListOnMount:t.bool,preserveScrollPositionAtBottomOnMount:t.bool,shouldUpdateLayoutOnWindowResize:t.func,measureItemsBatchSize:t.number,scrollableContainer:t.any,getScrollableContainer:t.func,getColumnsCount:t.func,className:t.string,onMount:t.func,onItemInitialRender:t.func,onItemFirstRender:t.func,onStateChange:t.func,initialCustomState:t.object,initialState:t.shape({items:t.arrayOf(t.object).isRequired,itemStates:t.arrayOf(t.any),firstShownItemIndex:t.number.isRequired,lastShownItemIndex:t.number.isRequired,beforeItemsHeight:t.number.isRequired,afterItemsHeight:t.number.isRequired,itemHeights:t.arrayOf(t.number).isRequired,columnsCount:t.number,verticalSpacing:t.number})}),Q($,"defaultProps",{as:"div"}),$});
//# sourceMappingURL=virtual-scroller-react.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VirtualScroller=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var t,n=(function(t){(function(){var e,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(e()-o)/1e6},n=process.hrtime,r=(e=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(t.exports=function(){return Date.now()-i},i=Date.now()):(t.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(e)}(t={exports:{}},t.exports),t.exports),i="undefined"==typeof window?e:window,r=["moz","webkit"],o="AnimationFrame",s=i["request"+o],a=i["cancel"+o]||i["cancelRequest"+o],l=0;!s&&l<r.length;l++)s=i[r[l]+"Request"+o],a=i[r[l]+"Cancel"+o]||i[r[l]+"CancelRequest"+o];if(!s||!a){var u=0,h=0,d=[];s=function(e){if(0===d.length){var t=n(),i=Math.max(0,1e3/60-(t-u));u=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout(function(){throw e},0)}},Math.round(i))}return d.push({handle:++h,callback:e,cancelled:!1}),h},a=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}var c=function(e){return s.call(i,e)};c.cancel=function(){a.apply(i,arguments)},c.polyfill=function(e){e||(e=i),e.requestAnimationFrame=s,e.cancelAnimationFrame=a};var m=c.cancel;function f(e,t){var n=Date.now(),i=c(function r(){Date.now()-n>=t?e():i=c(r)});return{clear:function(){return m(i)}}}function g(e){e&&e.clear()}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){return!t||"object"!==I(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var x=function(){function e(t){y(this,e),this.element=t}return b(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new C).onResize(e);return function(){t&&t(),r()}}}]),e}(),C=function(e){function t(){return y(this,t),p(this,v(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,x),b(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function H(e){return e.toFixed(2)+"px"}var k="[virtual-scroller] 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";function O(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function R(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,O(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function M(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var T=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&M(t.prototype,n),i&&M(t,i),e}();function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var E=Object.prototype.hasOwnProperty;function P(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){V(e,t,n[t])})}return e}function B(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=250,_=100;function j(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}return function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),V(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),V(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),V(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),V(this,"layout",function(){return s.updateLayout()}),V(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){R("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();R("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=z,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),V(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=j(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),V(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(P(e,t))return!0;if("object"!==L(e)||null===e||"object"!==L(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!E.call(t,n[r])||!P(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){R("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=j(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,R("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),V(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),R("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&R("Columns count",s.getColumnsCount()),R("First shown item index",t),R("Last shown item index",n),R("Before items height",o),R("After items height (actual or estimated)",a),R("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(R("Item heights",s.getState().itemHeights.slice()),R("Item states",s.getState().itemStates.slice())),i&&(R("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),V(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),V(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(R("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),V(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(g(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(R(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=f(s.onUserStoppedScrolling,_)}R("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),V(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,I=a.measureItemsBatchSize,p=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,w=a.estimatedItemHeight,b=a.onItemInitialRender,H=a.onItemFirstRender,O=a.scrollableContainer,M=a.preserveScrollPositionOfTheBottomOfTheListOnMount,B=a.state;R("~ Initialize ~"),B&&(n=B.items),!O&&p&&(O=p()),O?this.scrollableContainer=new x(O):"undefined"!=typeof window&&(this.scrollableContainer=new C),S&&(R("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(R("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(k)},0):console.error(k),y=!0)),y&&R('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=w,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===I?50:I,this._getColumnsCount=v,b?this.onItemFirstRender=b:H&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&H(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=U({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),B&&R("Initial state (passed)",B),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new T(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),M=c),M&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(B||this.getInitialState(d)),R("Items count",n.length),w&&R("Estimated item height",w)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=U({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return R("Initial state (autogenerated)",n),R("First shown item index",n.firstShownItemIndex),R("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");R("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){void 0===this.getState().verticalSpacing&&this.updateVerticalSpacing(),this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),g(this.onUserStopsScrollingTimeout),g(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",H(t)),e.style.setProperty("--VirtualScroller-paddingBottom",H(n))}(this.getContainerElement(),t,n)}},{key:"updateVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n){var l=s-(n+i);return A()&&R("Measure item vertical spacing",l),l}i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(R("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&R("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(R("~ Item state changed ~"),R("Item",e),R("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),R("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(R("~ Item height changed ~"),R("Item",e),R("Previous height",n),R("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){R("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(R("First visible row index",u),i=u*a),n+o+d+h>t)return R("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&R("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;R("Off-screen")}else R("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=f(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,f(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;R("~ Update items ~");var c=j(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(R("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(R("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var I=m/g,p=Math.ceil(f/g);s+=I*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=p*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else R("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),R("Previous items",n),R("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;R("First shown item index",r),R("Last shown item index",o),R("Before items height",s),R("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&B(t.prototype,n),i&&B(t,i),e}()});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).VirtualScroller=t()}(this,function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};for(var t,n=(function(t){(function(){var e,n,i,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(e()-o)/1e6},n=process.hrtime,r=(e=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*process.uptime(),o=r-s):Date.now?(t.exports=function(){return Date.now()-i},i=Date.now()):(t.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(e)}(t={exports:{}},t.exports),t.exports),i="undefined"==typeof window?e:window,r=["moz","webkit"],o="AnimationFrame",s=i["request"+o],a=i["cancel"+o]||i["cancelRequest"+o],l=0;!s&&l<r.length;l++)s=i[r[l]+"Request"+o],a=i[r[l]+"Cancel"+o]||i[r[l]+"CancelRequest"+o];if(!s||!a){var u=0,h=0,d=[];s=function(e){if(0===d.length){var t=n(),i=Math.max(0,1e3/60-(t-u));u=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout(function(){throw e},0)}},Math.round(i))}return d.push({handle:++h,callback:e,cancelled:!1}),h},a=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}var c=function(e){return s.call(i,e)};c.cancel=function(){a.apply(i,arguments)},c.polyfill=function(e){e||(e=i),e.requestAnimationFrame=s,e.cancelAnimationFrame=a};var m=c.cancel;function f(e,t){var n=Date.now(),i=c(function r(){Date.now()-n>=t?e():i=c(r)});return{clear:function(){return m(i)}}}function g(e){e&&e.clear()}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){return!t||"object"!==I(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(e,t){return(S=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function b(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var x=function(){function e(t){y(this,e),this.element=t}return b(e,[{key:"getScrollY",value:function(){return this.element.scrollTop}},{key:"scrollTo",value:function(e,t){this.element.scrollTo(e,t)}},{key:"getWidth",value:function(){return this.element.offsetWidth}},{key:"getHeight",value:function(){return this.element.offsetHeight}},{key:"getContentHeight",value:function(){return this.element.scrollHeight}},{key:"getTopOffset",value:function(e){var t=this.element.getBoundingClientRect().top,n=this.element.clientTop;return e.getBoundingClientRect().top-t+this.getScrollY()-n}},{key:"addScrollListener",value:function(e){var t=this;return this.element.addEventListener("scroll",e),function(){return t.element.removeEventListener("scroll",e)}}},{key:"onResize",value:function(e){var t,n=this;if("undefined"!=typeof ResizeObserver){var i=new ResizeObserver(function(t){var n=t,i=Array.isArray(n),r=0;for(n=i?n:n[Symbol.iterator]();;){if(i){if(r>=n.length)break;n[r++]}else{if((r=n.next()).done)break;r.value}return e()}});i.observe(this.element),t=function(){return i.unobserve(n.element)}}var r=(new C).onResize(e);return function(){t&&t(),r()}}}]),e}(),C=function(e){function t(){return y(this,t),p(this,v(t).call(this,window))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&S(e,t)}(t,x),b(t,[{key:"getScrollY",value:function(){return window.pageYOffset}},{key:"getWidth",value:function(){return window.innerWidth}},{key:"getHeight",value:function(){return window.innerHeight}},{key:"getContentHeight",value:function(){return document.documentElement.scrollHeight}},{key:"getTopOffset",value:function(e){var t=document.clientTop||document.body.clientTop||0;return e.getBoundingClientRect().top+this.getScrollY()-t}},{key:"onResize",value:function(e){return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}}]),t}();function H(e){return e.toFixed(2)+"px"}var k="[virtual-scroller] 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";function O(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function R(){if(A()){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,O(["[virtual-scroller]"].concat(n)))}}function A(){return"undefined"!=typeof window&&window.VirtualScrollerDebug}function M(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var T=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.getContainerElement=t,this.getState=n,this.initialize()}var t,n,i;return t=e,(n=[{key:"initialize",value:function(){this.reset(),this.getState()&&this.onStateUpdate()}},{key:"reset",value:function(){this.measuredItemsHeight=0,this.firstMeasuredItemIndex=void 0,this.lastMeasuredItemIndex=void 0}},{key:"onStateUpdate",value:function(){for(var e=0;e<this.getState().itemHeights.length;){if(void 0===this.getState().itemHeights[e]){if(void 0!==this.firstMeasuredItemIndex){this.lastMeasuredItemIndex=e-1;break}}else void 0===this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex=e),this.measuredItemsHeight+=this.getState().itemHeights[e];e++}}},{key:"_getItemHeight",value:function(e,t){var n=this.getContainerElement();if(n){var i=e-t;if(i>=0&&i<n.childNodes.length)return n.childNodes[i].getBoundingClientRect().height}}},{key:"update",value:function(e,t,n){void 0!==this.firstMeasuredItemIndex&&(e>this.lastMeasuredItemIndex+1||t<this.firstMeasuredItemIndex-1)&&this.reset();for(var i=this.firstMeasuredItemIndex,r=this.lastMeasuredItemIndex,o=!1,s=e;s<=t;){var a=this._getItemHeight(s,n);void 0!==a&&(this._set(s,a),(void 0===i||s<i)&&(this.measuredItemsHeight+=a,o||(this.firstMeasuredItemIndex=s,o=!0)),(void 0===r||s>r)&&(void 0!==r&&(this.measuredItemsHeight+=a),this.lastMeasuredItemIndex=s)),s++}}},{key:"updateItemHeight",value:function(e,t){var n=this._get(e),i=this._getItemHeight(e,t);void 0!==n&&void 0!==i&&(this._set(e,i),this.measuredItemsHeight+=i-n)}},{key:"getAverage",value:function(){return this.measuredItemsHeight?this.measuredItemsHeight/(this.lastMeasuredItemIndex-this.firstMeasuredItemIndex+1):0}},{key:"_get",value:function(e){return this.getState().itemHeights[e]}},{key:"_set",value:function(e,t){this.getState().itemHeights[e]=t}},{key:"onPrepend",value:function(e){void 0!==this.firstMeasuredItemIndex&&(this.firstMeasuredItemIndex+=e,this.lastMeasuredItemIndex+=e)}}])&&M(t.prototype,n),i&&M(t,i),e}();function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var E=Object.prototype.hasOwnProperty;function P(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){V(e,t,n[t])})}return e}function B(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var z=250,_=100;function j(e,t){var n=-1,i=-1;if(e.length>0&&(n=t.indexOf(e[0]))>=0&&function(e,t,n){var i=0;for(;i<e.length;){if(t.length<=n+i||t[n+i]!==e[i])return!1;i++}return!0}(e,t,n)&&(i=n+e.length-1),n>=0&&i>=0)return{prependedItemsCount:n,appendedItemsCount:t.length-(i+1)}}return function(){function e(t,n){var i,r,o,s=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),V(this,"updateLayout",function(){return s.onUpdateShownItemIndexes({reason:"manual"})}),V(this,"onScroll",function(){return s.onUpdateShownItemIndexes({reason:"scroll"})}),V(this,"restoreScrollPosition",function(){var e=s.getState().scrollY;void 0!==e&&s.scrollTo(0,e)}),V(this,"updateScrollPosition",function(){return s.getState().scrollY=s.getScrollY()}),V(this,"layout",function(){return s.updateLayout()}),V(this,"onResize",(i=function(e){if(s.isRendered){var t=s.shouldUpdateLayoutOnScrollableContainerResize(e);if("UPDATE_LAYOUT"===t){R("~ Scrollable container size changed, re-measure item heights. ~"),s.resized=!0;var n=s.getInitialLayoutState();R("Reset state to",n),s.setState(n)}else"UPDATE_SHOWN_ITEM_INDEXES"===t&&s.onUpdateShownItemIndexes({reason:"resize"})}},r=z,function(){for(var e=this,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];clearTimeout(o),o=setTimeout(function(){return i.apply(e,n)},r)})),V(this,"willUpdateState",function(e,t){if(t&&s.preserveScrollPositionOnPrependItems){s.preserveScrollPositionOnPrependItems=void 0;var n=t.items,i=e.items,r=j(n,i);r&&s.captureScroll(n,i,r.prependedItemsCount)}}),V(this,"didUpdateState",function(e){var t=s.getState();if(s.onStateChange&&(function(e,t){if(P(e,t))return!0;if("object"!==L(e)||null===e||"object"!==L(t)||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++)if(!E.call(t,n[r])||!P(e[n[r]],t[n[r]]))return!1;return!0}(t,e)||s.onStateChange(t,e)),e&&s.isRendered){R("~ Rendered ~"),t.firstShownItemIndex===e.firstShownItemIndex&&t.lastShownItemIndex===e.lastShownItemIndex&&t.items===e.items||s.onRendered();var n=e.items,i=t.items;if(i!==n){var r=j(n,i);if(r){var o=r.prependedItemsCount;r.appendedItemsCount;o>0&&(s.itemHeights.onPrepend(o),void 0!==s.firstSeenItemIndex&&(s.firstSeenItemIndex+=o,s.lastSeenItemIndex+=o))}else s.itemHeights.initialize(),s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0;return s.updateSeenItemIndexes(),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"update items",force:!0})}return s.resized?(s.resized=void 0,R("~ Rendered (resize) ~"),s.multiRenderLayout&&s.stopMultiRenderLayout(),s.onUpdateShownItemIndexes({reason:"resize"})):s.multiRenderLayout?s.onMultiRenderLayoutRendered():void 0}}),V(this,"updateShownItemIndexes",function(){var e=s.getShownItemIndexes(),t=e.firstShownItemIndex,n=e.lastShownItemIndex,i=e.redoLayoutAfterRender,r=s.getState().itemHeights,o=s.getBeforeItemsHeight(t,n,r),a=s.getAfterItemsHeight(t,n,r);s.updateWillBeHiddenItemHeightsAndState(t,n),R("~ Layout results "+(s.bypass?"(bypass) ":"")+"~"),s._getColumnsCount&&R("Columns count",s.getColumnsCount()),R("First shown item index",t),R("Last shown item index",n),R("Before items height",o),R("After items height (actual or estimated)",a),R("Average item height (calculated on previous render)",s.itemHeights.getAverage()),A()&&(R("Item heights",s.getState().itemHeights.slice()),R("Item states",s.getState().itemStates.slice())),i&&(R("Schedule a re-layout after the upcoming rerender"),s.redoLayoutAfterRender=!0),void 0!==s.firstSeenItemIndex&&(t>s.lastSeenItemIndex+1||n<s.firstSeenItemIndex-1)&&(s.firstSeenItemIndex=void 0,s.lastSeenItemIndex=void 0),s.onBeforeShowItems(s.getState().items,t,n,s.firstSeenItemIndex,s.lastSeenItemIndex),s.setState({firstShownItemIndex:t,lastShownItemIndex:n,beforeItemsHeight:o,afterItemsHeight:a})}),V(this,"updateShownItemIndexesRecursive",function(){s.multiRenderLayout=!0,s.updateShownItemIndexes()}),V(this,"restoreScroll",function(){var e=s.restoreScrollAfterPrepend,t=e.index,n=e.visibleAreaTop;s.restoreScrollAfterPrepend=void 0;var i=s.getItemElement(t).getBoundingClientRect().top-n;0!==i&&(R("Restore scroll position: scroll by",i),s.scrollTo(0,s.getScrollY()+i))}),V(this,"onUpdateShownItemIndexes",function(e){var t=e.reason;e.force;if(0!==s.getItemsCount()&&!s.multiRenderLayout){if(g(s.onUserStopsScrollingTimeout),"scroll"===t){var n=void 0!==s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getScrollY()<s.latestLayoutVisibleAreaTopAfterIncludingMargin&&s.getState().firstShownItemIndex>0||void 0!==s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getScrollY()+s.scrollableContainer.getHeight()>s.latestLayoutVisibleAreaBottomAfterIncludingMargin&&s.getState().lastShownItemIndex<s.getItemsCount()-1;if(R(n?"The user has scrolled far enough: force re-render":"The user hasn't scrolled too much: delay re-render"),!n)return s.onUserStopsScrollingTimeout=f(s.onUserStoppedScrolling,_)}R("~ Update layout (on ".concat(t,") ~")),s.updateShownItemIndexesRecursive()}}),V(this,"onUserStoppedScrolling",function(){s.isRendered&&s.updateLayout("stopped scrolling")});var l=a.getState,u=a.setState,h=a.onStateChange,d=a.customState,c=a.preserveScrollPositionAtBottomOnMount,m=a.shouldUpdateLayoutOnWindowResize,I=a.measureItemsBatchSize,p=a.getScrollableContainer,v=a.getColumnsCount,S=a.tbody,y=a.bypass,w=a.estimatedItemHeight,b=a.onItemInitialRender,H=a.onItemFirstRender,O=a.scrollableContainer,M=a.preserveScrollPositionOfTheBottomOfTheListOnMount,B=a.state;R("~ Initialize ~"),B&&(n=B.items),!O&&p&&(O=p()),O?this.scrollableContainer=new x(O):"undefined"!=typeof window&&(this.scrollableContainer=new C),S&&(R("~ <tbody/> detected ~"),this.tbody=!0,"undefined"!=typeof window&&window.document.documentMode&&(R("~ <tbody/> not supported ~"),"undefined"!=typeof window?setTimeout(function(){throw new Error(k)},0):console.error(k),y=!0)),y&&R('~ "bypass" mode ~'),this.bypass=y,this.initialItems=n,this.estimatedItemHeight=w,this.onStateChange=h,this._shouldUpdateLayoutOnWindowResize=m,this.measureItemsBatchSize=void 0===I?50:I,this._getColumnsCount=v,b?this.onItemFirstRender=b:H&&(this.onItemFirstRender=function(e){console.warn("[virtual-scroller] `onItemFirstRender(i)` is deprecated, use `onItemInitialRender(item)` instead.");var t=s.getState().items.indexOf(e);t>=0&&H(t)}),u?(this.getState=l,this.setState=function(e){return u(e,{willUpdateState:s.willUpdateState,didUpdateState:s.didUpdateState})}):(this.getState=function(){return s.state},this.setState=function(e){var t=s.getState(),n=U({},t,e);s.willUpdateState(n,t),s.state=n,s.didUpdateState(t)}),B&&R("Initial state (passed)",B),this.getContainerElement=t,t()&&function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(t()),this.itemHeights=new T(this.getContainerElement,this.getState),this.scrollableContainer&&(c&&(console.warn("[virtual-scroller] `preserveScrollPositionAtBottomOnMount` option/property has been renamed to `preserveScrollPositionOfTheBottomOfTheListOnMount`"),M=c),M&&(this.preserveScrollPositionOfTheBottomOfTheListOnMount={scrollableContainerContentHeight:this.scrollableContainer.getContentHeight()})),this.setState(B||this.getInitialState(d)),R("Items count",n.length),w&&R("Estimated item height",w)}var t,n,i;return t=e,(n=[{key:"getInitialState",value:function(e){var t=this.initialItems.length,n=U({},e,this.getInitialLayoutState(),{items:this.initialItems,itemStates:new Array(t)});return R("Initial state (autogenerated)",n),R("First shown item index",n.firstShownItemIndex),R("Last shown item index",n.lastShownItemIndex),n}},{key:"getInitialLayoutState",value:function(){var e,t,n=this.initialItems,i=n.length,r=this._getColumnsCount?this._getColumnsCount(this.scrollableContainer):void 0;return i>0&&(e=0,t=this.getLastShownItemIndex(e,i,r||1)),this.preserveScrollPositionOfTheBottomOfTheListOnMount&&(e=0,t=i-1),this.onBeforeShowItems(n,e,t,this.firstSeenItemIndex,this.lastSeenItemIndex),{itemHeights:new Array(i),columnsCount:r,verticalSpacing:void 0,beforeItemsHeight:0,afterItemsHeight:0,firstShownItemIndex:e,lastShownItemIndex:t,scrollY:void 0}}},{key:"getEstimatedItemHeight",value:function(){return this.itemHeights&&this.itemHeights.getAverage()||this.estimatedItemHeight||0}},{key:"getVerticalSpacing",value:function(){return this.getState()&&this.getState().verticalSpacing||0}},{key:"getColumnsCount",value:function(){return this.getState()&&this.getState().columnsCount||1}},{key:"getEstimatedItemsCount",value:function(e){return this.getEstimatedRowsCount(e)*this.getColumnsCount()}},{key:"getEstimatedRowsCount",value:function(e){return this.getEstimatedItemHeight()?Math.ceil((e+this.getVerticalSpacing())/(this.getEstimatedItemHeight()+this.getVerticalSpacing())):1}},{key:"getEstimatedItemsCountOnScreen",value:function(e){return this.getEstimatedRowsCountOnScreen()*e}},{key:"getEstimatedRowsCountOnScreen",value:function(){return this.scrollableContainer?this.getEstimatedRowsCount(2*this.getMargin()+this.scrollableContainer.getHeight()):1}},{key:"getLastShownItemIndex",value:function(e,t,n){return this.bypass?t-1:Math.min(e+(this.getEstimatedItemsCountOnScreen(n)-1),t-1)}},{key:"getItemsCount",value:function(){return this.getState().items.length}},{key:"getMargin",value:function(){return 1*this.scrollableContainer.getHeight()}},{key:"onBeforeShowItems",value:function(e,t,n,i,r){var o=this.onItemFirstRender;if(o)if(void 0===i)for(var s=t;s<=n;)o(e[s]),s++;else{if(t<i)for(var a=t,l=Math.min(n,i-1),u=a;u<=l;)o(e[u]),u++;if(n>r)for(var h=n,d=Math.max(t,r+1);d<=h;)o(e[d]),d++}}},{key:"updateSeenItemIndexes",value:function(){var e=this.firstSeenItemIndex,t=this.lastSeenItemIndex,n=this.getState(),i=n.firstShownItemIndex,r=n.lastShownItemIndex;void 0===e?(e=i,t=r):(i<e&&(e=i),r>t&&(t=r)),this.firstSeenItemIndex=e,this.lastSeenItemIndex=t}},{key:"onMount",value:function(){console.warn("[virtual-scroller] `.onMount()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"render",value:function(){console.warn("[virtual-scroller] `.render()` instance method name is deprecated, use `.listen()` instance method name instead."),this.listen()}},{key:"listen",value:function(){if(!1===this.isRendered)throw new Error("[virtual-scroller] Can't restart a `VirtualScroller` after it has been stopped");R("~ Rendered (initial) ~"),this.isRendered=!0,this.onRendered(),this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.restoreScrollPosition(),this.updateScrollPosition(),this.removeScrollPositionListener=this.scrollableContainer.addScrollListener(this.updateScrollPosition),this.bypass||(this.removeScrollListener=this.scrollableContainer.addScrollListener(this.onScroll),this.scrollableContainerUnlistenResize=this.scrollableContainer.onResize(this.onResize)),this.tbody&&function(e){e.classList.add("VirtualScroller");var t=document.getElementById("VirtualScrollerStyle");t||((t=document.createElement("style")).id="VirtualScrollerStyle",t.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,""),document.head.appendChild(t))}(this.getContainerElement()),this.preserveScrollPositionOfTheBottomOfTheListOnMount?this.scrollTo(0,this.getScrollY()+(this.scrollableContainer.getContentHeight()-this.preserveScrollPositionOfTheBottomOfTheListOnMount.scrollableContainerContentHeight)):this.onUpdateShownItemIndexes({reason:"mount"})}},{key:"onRendered",value:function(){if(void 0===this.getState().verticalSpacing){R("~ Measure item vertical spacing ~");var e=this.measureVerticalSpacing();void 0===e?R("Not enough items rendered"):(R("Item vertical spacing",e),this.setState({verticalSpacing:e}))}this.updateItemHeights(),this.tbody&&this.updateTbodyPadding()}},{key:"scrollTo",value:function(e,t){this.scrollableContainer.scrollTo(e,t)}},{key:"getScrollY",value:function(){return this.scrollableContainer.getScrollY()}},{key:"getVisibleAreaBounds",value:function(){var e=this.getScrollY();return{top:e,bottom:e+this.scrollableContainer.getHeight()}}},{key:"getHeight",value:function(){return this.getContainerElement().getBoundingClientRect().height}},{key:"getTopOffset",value:function(){return this.scrollableContainer.getTopOffset(this.getContainerElement())}},{key:"shouldUpdateLayoutOnScrollableContainerResize",value:function(e){if(e&&e.target===window){if(document.fullscreenElement&&this.getContainerElement().contains(document.fullscreenElement))return!1;if(this._shouldUpdateLayoutOnWindowResize&&!1===this._shouldUpdateLayoutOnWindowResize(e))return!1}var t=this.scrollableContainerWidth,n=this.scrollableContainerHeight;return this.scrollableContainerWidth=this.scrollableContainer.getWidth(),this.scrollableContainerHeight=this.scrollableContainer.getHeight(),this.scrollableContainerWidth===t?this.scrollableContainerHeight!==n&&"UPDATE_SHOWN_ITEM_INDEXES":"UPDATE_LAYOUT"}},{key:"onUnmount",value:function(){console.warn("[virtual-scroller] `.onUnmount()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"destroy",value:function(){console.warn("[virtual-scroller] `.destroy()` instance method name is deprecated, use `.stop()` instance method name instead."),this.stop()}},{key:"stop",value:function(){this.isRendered=!1,this.removeScrollPositionListener(),this.bypass||(this.removeScrollListener(),this.scrollableContainerUnlistenResize(),g(this.onUserStopsScrollingTimeout),g(this.watchContainerElementCoordinatesTimer))}},{key:"updateTbodyPadding",value:function(){var e=this.getState(),t=e.beforeItemsHeight,n=e.afterItemsHeight;!function(e,t,n){e.style.setProperty("--VirtualScroller-paddingTop",H(t)),e.style.setProperty("--VirtualScroller-paddingBottom",H(n))}(this.getContainerElement(),t,n)}},{key:"measureVerticalSpacing",value:function(){var e=this.getContainerElement();if(e&&e.childNodes.length>1)for(var t=e.childNodes[0].getBoundingClientRect(),n=t.top,i=t.height,r=1;r<e.childNodes.length;){var o=e.childNodes[r].getBoundingClientRect(),s=o.top,a=o.height;if(s!==n)return s-(n+i);i=Math.max(i,a),r++}}},{key:"updateItemHeights",value:function(){var e=this.getState(),t=e.firstShownItemIndex,n=e.lastShownItemIndex;void 0!==t&&(R("~ Measure item heights ~"),this.itemHeights.update(t,n,t),A()&&R("Item heights",this.getState().itemHeights.slice()))}},{key:"updateItemHeight",value:function(e){var t=this.getState().firstShownItemIndex;this.itemHeights.updateItemHeight(e,t)}},{key:"onItemStateChange",value:function(e,t){A()&&(R("~ Item state changed ~"),R("Item",e),R("Previous state\n"+JSON.stringify(this.getState().itemStates[e],null,2)),R("New state\n"+JSON.stringify(t,null,2))),this.getState().itemStates[e]=t}},{key:"onItemHeightChange",value:function(e){var t=this.getState().itemHeights,n=t[e];this.updateItemHeight(e);var i=t[e];n!==i&&(R("~ Item height changed ~"),R("Item",e),R("Previous height",n),R("New height",i),this.onUpdateShownItemIndexes({reason:"item height change"}))}},{key:"getItemCoordinates",value:function(e){for(var t=this.getState().itemHeights,n=this.getColumnsCount(),i=this.getTopOffset(),r=Math.floor(e/n),o=0;o<r;){for(var s=0,a=0;a<n;)s=Math.max(s,t[o*n+a]),a++;i+=s,i+=this.getVerticalSpacing(),o++}return{top:i,bottom:i+t[e],height:t[e]}}},{key:"_getVisibleItemIndexes",value:function(e,t,n){for(var i,r,o=0,s=this.getItemsCount(),a=this.getColumnsCount(),l=Math.ceil(s/a),u=0;u<l;){for(var h=s>(u+1)*a?this.getVerticalSpacing():0,d=0,c=0,m=void 0;c<a&&(m=u*a+c)<s;){var f=this.getState().itemHeights[m];if(void 0===f){R("Item index ".concat(m,' lies within the visible area or its "margins", but its height hasn\'t been measured yet. Mark the item as "shown", render the list, measure the item\'s height and redo the layout.')),void 0===i&&(i=u*a);var g=t-(n+o);return{firstNonMeasuredItemIndex:m,firstShownItemIndex:i,lastShownItemIndex:r=Math.min((u+this.getEstimatedRowsCount(g))*a-1,s-1)}}if(d=Math.max(d,f),void 0===i&&n+o+d>e&&(R("First visible row index",u),i=u*a),n+o+d+h>t)return R("Last visible row index",u),void 0!==i&&(r=Math.min((u+1)*a-1,s-1)),{firstShownItemIndex:i,lastShownItemIndex:r};c++}o+=d,o+=h,u++}return void 0!==i&&void 0===r&&R("Last item index (is fully visible)",r=s-1),{firstShownItemIndex:i,lastShownItemIndex:r}}},{key:"getVisibleItemIndexes",value:function(e,t,n){var i=this._getVisibleItemIndexes(e,t,n),r=i.firstNonMeasuredItemIndex,o=i.firstShownItemIndex,s=i.lastShownItemIndex,a=void 0!==r;if(this.restoreScrollAfterPrepend&&(s<this.restoreScrollAfterPrepend.index&&(s=this.restoreScrollAfterPrepend.index),a=!1),a&&this.measureItemsBatchSize){var l=this.getColumnsCount(),u=r+this.measureItemsBatchSize-1;s=Math.min(s,Math.ceil(u/l)*l-1)}return{firstShownItemIndex:o,lastShownItemIndex:s,redoLayoutAfterRender:a}}},{key:"getOffscreenListShownItemIndexes",value:function(){return{firstShownItemIndex:0,lastShownItemIndex:0,redoLayoutAfterRender:void 0===this.getState().itemHeights[0]}}},{key:"getItemIndexes",value:function(e,t,n,i){if(n+i>e&&n<t){var r=this.getVisibleItemIndexes(e,t,n);if(void 0!==r.firstShownItemIndex)return r;R("Off-screen")}else R("Off-screen")}},{key:"getBeforeItemsHeight",value:function(e,t,n){for(var i=this.getColumnsCount(),r=Math.floor(e/i),o=0,s=0;s<r;){for(var a=0,l=0;l<i;)a=Math.max(a,n[s*i+l]||this.itemHeights.getAverage()),l++;o+=a,o+=this.getVerticalSpacing(),s++}return o}},{key:"getAfterItemsHeight",value:function(e,t,n){for(var i=this.getItemsCount(),r=this.getColumnsCount(),o=Math.ceil(i/r),s=0,a=Math.floor(t/r)+1;a<o;){for(var l=0,u=0,h=void 0;u<r&&(h=a*r+u)<i;)l=Math.max(l,n[h]||this.itemHeights.getAverage()),u++;s+=this.getVerticalSpacing(),s+=l,a++}return s}},{key:"updateWillBeHiddenItemHeightsAndState",value:function(e,t){for(var n=this.getState().firstShownItemIndex;n<=this.getState().lastShownItemIndex;)n>=e&&n<=t||this.updateItemHeight(n),n++}},{key:"watchContainerElementCoordinates",value:function(){var e=this,t=Date.now();!function n(){e.isRendered&&(void 0!==e.topOffset&&e.getTopOffset()!==e.topOffset&&e.onUpdateShownItemIndexes({reason:"top offset change"}),Date.now()-t<3e3&&(e.watchContainerElementCoordinatesTimer=f(n,500)))}()}},{key:"getShownItemIndexes",value:function(){if(this.bypass)return{firstShownItemIndex:0,lastShownItemIndex:this.getItemsCount()-1};var e=this.getTopOffset();void 0===this.topOffset&&this.watchContainerElementCoordinates(),this.topOffset=e;var t=this.getVisibleAreaBounds(),n=t.top,i=t.bottom;return this.latestLayoutVisibleAreaTopAfterIncludingMargin=n-this.getMargin(),this.latestLayoutVisibleAreaBottomAfterIncludingMargin=i+this.getMargin(),this.getItemIndexes(n-this.getMargin(),i+this.getMargin(),e,this.getHeight())||this.getOffscreenListShownItemIndexes()}},{key:"onMultiRenderLayoutRendered",value:function(){var e=this;if(this.redoLayoutAfterRender)return this.redoLayoutAfterRender=void 0,f(function(){e.isRendered&&e.updateShownItemIndexesRecursive()},0);this.stopMultiRenderLayout()}},{key:"stopMultiRenderLayout",value:function(){this.multiRenderLayout=void 0,this.redoLayoutAfterRender||this.restoreScrollAfterPrepend&&this.restoreScroll()}},{key:"captureScroll",value:function(e,t,n){0!==e.length&&0!==n&&(this.getState().firstShownItemIndex>0||this.restoreScrollAfterPrepend&&this.restoreScrollAfterPrepend.previousItems===e&&this.restoreScrollAfterPrepend.nextItems===t||(this.restoreScrollAfterPrepend={previousItems:e,nextItems:t,index:n,visibleAreaTop:this.getItemElement(0).getBoundingClientRect().top}))}},{key:"updateItems",value:function(e,t){return this.setItems(e,t)}},{key:"setItems",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getState().items,i=this.getState(),r=i.firstShownItemIndex,o=i.lastShownItemIndex,s=i.beforeItemsHeight,a=i.afterItemsHeight,l=i.itemStates,u=i.itemHeights,h=this.firstSeenItemIndex,d=this.lastSeenItemIndex;R("~ Update items ~");var c=j(n,e);if(c){var m=c.prependedItemsCount,f=c.appendedItemsCount;m>0&&(R("Prepend",m,"items"),u=new Array(m).concat(u),l&&(l=new Array(m).concat(l))),f>0&&(R("Append",f,"items"),u=u.concat(new Array(f)),l&&(l=l.concat(new Array(f)))),r+=m,o+=m,void 0!==h&&(h+=m,d+=m);this.getVerticalSpacing();var g=this.getColumnsCount();if(m%g==0){var I=m/g,p=Math.ceil(f/g);s+=I*(this.itemHeights.getAverage()+this.getVerticalSpacing()),a+=p*(this.getVerticalSpacing()+this.itemHeights.getAverage())}else s=this.getBeforeItemsHeight(r,o,u),a=this.getAfterItemsHeight(r,o,u)}else R("Items have changed, and it's not a simple append and/or prepend: rerender the entire list from scratch."),R("Previous items",n),R("New items",e),h=void 0,d=void 0,u=new Array(e.length),l=new Array(e.length),0===e.length?(r=void 0,o=void 0):(r=0,o=this.getLastShownItemIndex(r,e.length,this.getColumnsCount())),s=0,a=0;R("First shown item index",r),R("Last shown item index",o),R("Before items height",s),R("After items height (actual or estimated)",a),this.onBeforeShowItems(e,r,o,h,d),this.preserveScrollPositionOnPrependItems=t.preserveScrollPositionOnPrependItems||t.preserveScrollPosition,this.setState({items:e,itemStates:l,itemHeights:u,firstShownItemIndex:r,lastShownItemIndex:o,beforeItemsHeight:s,afterItemsHeight:a})}},{key:"getItemElement",value:function(e){return this.getContainerElement().childNodes[e]}}])&&B(t.prototype,n),i&&B(t,i),e}()});
//# sourceMappingURL=virtual-scroller.js.map
<!-- `virtual-scroller`: in `.updateItems()` handle a case when `items.length` is the same, in which case find different items and if those items are rendered then maybe update them on screen and update their height, if the items are past rendered then maybe just discard all item heights past rendered, if the items are before rendered then maybe ignore and it will jump on scroll up which is kinda acceptable. -->
1.6.4 / 12.12.2020
==================
* [Fixed](https://gitlab.com/catamphetamine/read-excel-file/-/issues/10) measuring item vertical spacing.
1.6.1 / 07.12.2020

@@ -4,0 +9,0 @@ ==================

{
"name": "virtual-scroller",
"version": "1.6.3",
"version": "1.6.4",
"description": "A component for efficiently rendering large lists of variable height items",

@@ -5,0 +5,0 @@ "main": "index.commonjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc