// ============================================================ // Module ID: 40293 // ============================================================ ;(window.__modules__ = window.__modules__ || {})[40293] = (function (t, n, i) { var r, e, u; ("undefined" != typeof globalThis ? globalThis : "undefined" != typeof self && self, (e = [i(15152), i(7552)]), (r = function (n, i) { "use strict"; var r, e, u; function s() { if ("function" != typeof WeakMap) return null; var t = new WeakMap(); return ( (s = function () { return t; }), t ); } function o(t) { return ( (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t; } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; }), o(t) ); } function _(t, n) { for (var i = 0; i < n.length; i++) { var r = n[i]; ((r.enumerable = r.enumerable || !1), (r.configurable = !0), "value" in r && (r.writable = !0), Object.defineProperty(t, r.key, r)); } } function a(t, n, i) { return (n && _(t.prototype, n), i && _(t, i), t); } function h(t, n) { return ( (h = Object.setPrototypeOf || function (t, n) { return ((t.__proto__ = n), t); }), h(t, n) ); } function c(t) { var n = (function () { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return (Date.prototype.toString.call(Reflect.construct(Date, [], function () {})), !0); } catch (t) { return !1; } })(); return function () { var i, r = l(t); if (n) { var e = l(this).constructor; i = Reflect.construct(r, arguments, e); } else i = r.apply(this, arguments); return (function (t, n) { return !n || ("object" !== o(n) && "function" != typeof n) ? (function (t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t; })(t) : n; })(this, i); }; } function l(t) { return ( (l = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }), l(t) ); } function f(t, n) { var i = Object.keys(t); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(t); (n && (r = r.filter(function (n) { return Object.getOwnPropertyDescriptor(t, n).enumerable; })), i.push.apply(i, r)); } return i; } function v(t) { for (var n = 1; n < arguments.length; n++) { var i = null != arguments[n] ? arguments[n] : {}; n % 2 ? f(Object(i), !0).forEach(function (n) { w(t, n, i[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : f(Object(i)).forEach(function (n) { Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n)); }); } return t; } function w(t, n, i) { return ( n in t ? Object.defineProperty(t, n, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : (t[n] = i), t ); } ((n = (u = n) && u.__esModule ? u : { default: u }), (i = (function (t) { if (t && t.__esModule) return t; if (null === t || ("object" !== o(t) && "function" != typeof t)) return { default: t }; var n = s(); if (n && n.has(t)) return n.get(t); var i = {}, r = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var e in t) if (Object.prototype.hasOwnProperty.call(t, e)) { var u = r ? Object.getOwnPropertyDescriptor(t, e) : null; u && (u.get || u.set) ? Object.defineProperty(i, e, u) : (i[e] = t[e]); } return ((i.default = t), n && n.set(t, i), i); })(i))); var p = { x: "clientWidth", y: "clientHeight" }, d = { x: "clientTop", y: "clientLeft" }, g = { x: "innerWidth", y: "innerHeight" }, m = { x: "offsetWidth", y: "offsetHeight" }, y = { x: "offsetLeft", y: "offsetTop" }, k = { x: "overflowX", y: "overflowY" }, b = { x: "scrollWidth", y: "scrollHeight" }, q = { x: "scrollLeft", y: "scrollTop" }, $ = { x: "width", y: "height" }, j = function () {}, x = !!(function () { if ("undefined" == typeof window) return !1; var t = !1; try { document.createElement("div").addEventListener("test", j, { get passive() { return ((t = !0), !1); }, }); } catch (t) {} return t; })() && { passive: !0 }, z = function (t, n) { var i = t.length, r = t.minSize, e = t.type, u = n.from, s = n.size, o = n.itemsPerRow, _ = (s = Math.max(s, r)) % o; return ( _ && (s += o - _), s > i && (s = i), (_ = (u = "simple" !== e && u ? Math.max(Math.min(u, i - s), 0) : 0) % o) && ((u -= _), (s += _)), u === n.from && s == n.size ? n : v(v({}, n), {}, { from: u, size: s }) ); }; t.exports = ((e = r = (function (t) { !(function (t, n) { if ("function" != typeof n && null !== n) throw new TypeError("Super expression must either be null or a function"); ((t.prototype = Object.create(n && n.prototype, { constructor: { value: t, writable: !0, configurable: !0 }, })), n && h(t, n)); })(r, t); var n = c(r); function r(t) { var i; return ( (function (t, n) { if (!(t instanceof n)) throw new TypeError("Cannot call a class as a function"); })(this, r), ((i = n.call(this, t)).state = z(t, { itemsPerRow: 1, from: t.initialIndex, size: 0 })), (i.cache = {}), (i.cachedScrollPosition = null), (i.prevPrevState = {}), (i.unstable = !1), (i.updateCounter = 0), i ); } return ( a(r, null, [ { key: "getDerivedStateFromProps", value: function (t, n) { var i = z(t, n); return i === n ? null : i; }, }, ]), a(r, [ { key: "componentDidMount", value: function () { ((this.updateFrameAndClearCache = this.updateFrameAndClearCache.bind(this)), window.addEventListener("resize", this.updateFrameAndClearCache), this.updateFrame(this.scrollTo.bind(this, this.props.initialIndex))); }, }, { key: "componentDidUpdate", value: function (t) { var n = this; if ((this.props.axis !== t.axis && this.clearSizeCache(), !this.unstable)) { if (++this.updateCounter > 40) return ( (this.unstable = !0), console.error("ReactList failed to reach a stable state.") ); (this.updateCounterTimeoutId || (this.updateCounterTimeoutId = setTimeout(function () { ((n.updateCounter = 0), delete n.updateCounterTimeoutId); }, 0)), this.updateFrame()); } }, }, { key: "maybeSetState", value: function (t, n) { if ( (function (t, n) { for (var i in n) if (t[i] !== n[i]) return !1; return !0; })(this.state, t) ) return n(); this.setState(t, n); }, }, { key: "componentWillUnmount", value: function () { (window.removeEventListener("resize", this.updateFrameAndClearCache), this.scrollParent.removeEventListener("scroll", this.updateFrameAndClearCache, x), this.scrollParent.removeEventListener("mousewheel", j, x)); }, }, { key: "getOffset", value: function (t) { var n = this.props.axis, i = t[d[n]] || 0, r = y[n]; do { i += t[r] || 0; } while ((t = t.offsetParent)); return i; }, }, { key: "getEl", value: function () { return this.el || this.items; }, }, { key: "getScrollPosition", value: function () { if ("number" == typeof this.cachedScrollPosition) return this.cachedScrollPosition; var t = this.scrollParent, n = this.props.axis, i = q[n], r = t === window ? document.body[i] || document.documentElement[i] : t[i], e = this.getScrollSize() - this.props.scrollParentViewportSizeGetter(this), u = Math.max(0, Math.min(r, e)), s = this.getEl(); return ( (this.cachedScrollPosition = this.getOffset(t) + u - this.getOffset(s)), this.cachedScrollPosition ); }, }, { key: "setScroll", value: function (t) { var n = this.scrollParent, i = this.props.axis; if (((t += this.getOffset(this.getEl())), n === window)) return window.scrollTo(0, t); ((t -= this.getOffset(this.scrollParent)), (n[q[i]] = t)); }, }, { key: "getScrollSize", value: function () { var t = this.scrollParent, n = document, i = n.body, r = n.documentElement, e = b[this.props.axis]; return t === window ? Math.max(i[e], r[e]) : t[e]; }, }, { key: "hasDeterminateSize", value: function () { var t = this.props, n = t.itemSizeGetter; return "uniform" === t.type || n; }, }, { key: "getStartAndEnd", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.props.threshold, n = this.getScrollPosition(), i = Math.max(0, n - t), r = n + this.props.scrollParentViewportSizeGetter(this) + t; return ( this.hasDeterminateSize() && (r = Math.min(r, this.getSpaceBefore(this.props.length))), { start: i, end: r } ); }, }, { key: "getItemSizeAndItemsPerRow", value: function () { var t = this.props, n = t.axis, i = t.useStaticSize, r = this.state, e = r.itemSize, u = r.itemsPerRow; if (i && e && u) return { itemSize: e, itemsPerRow: u }; var s = this.items.children; if (!s.length) return {}; var o = s[0], _ = o[m[n]], a = Math.abs(_ - e); if (((isNaN(a) || a >= 1) && (e = _), !e)) return {}; for (var h = y[n], c = o[h], l = s[(u = 1)]; l && l[h] === c; l = s[u]) ++u; return { itemSize: e, itemsPerRow: u }; }, }, { key: "clearSizeCache", value: function () { this.cachedScrollPosition = null; }, }, { key: "updateFrameAndClearCache", value: function (t) { return (this.clearSizeCache(), this.updateFrame(t)); }, }, { key: "updateFrame", value: function (t) { switch ((this.updateScrollParent(), "function" != typeof t && (t = j), this.props.type)) { case "simple": return this.updateSimpleFrame(t); case "variable": return this.updateVariableFrame(t); case "uniform": return this.updateUniformFrame(t); } }, }, { key: "updateScrollParent", value: function () { var t = this.scrollParent; ((this.scrollParent = this.props.scrollParentGetter(this)), t !== this.scrollParent && (t && (t.removeEventListener("scroll", this.updateFrameAndClearCache), t.removeEventListener("mousewheel", j)), this.clearSizeCache(), this.scrollParent.addEventListener("scroll", this.updateFrameAndClearCache, x), this.scrollParent.addEventListener("mousewheel", j, x))); }, }, { key: "updateSimpleFrame", value: function (t) { var n = this.getStartAndEnd().end, i = this.items.children, r = 0; if (i.length) { var e = this.props.axis, u = i[0], s = i[i.length - 1]; r = this.getOffset(s) + s[m[e]] - this.getOffset(u); } if (r > n) return t(); var o = this.props, _ = o.pageSize, a = o.length, h = Math.min(this.state.size + _, a); this.maybeSetState({ size: h }, t); }, }, { key: "updateVariableFrame", value: function (t) { this.props.itemSizeGetter || this.cacheSizes(); for ( var n = this.getStartAndEnd(), i = n.start, r = n.end, e = this.props, u = e.length, s = e.pageSize, o = 0, _ = 0, a = 0, h = u - 1; _ < h; ) { var c = this.getSizeOfItem(_); if (null == c || o + c > i) break; ((o += c), ++_); } for (var l = u - _; a < l && o < r;) { var f = this.getSizeOfItem(_ + a); if (null == f) { a = Math.min(a + s, l); break; } ((o += f), ++a); } this.maybeSetState(z(this.props, { from: _, itemsPerRow: 1, size: a }), t); }, }, { key: "updateUniformFrame", value: function (t) { var n = this.getItemSizeAndItemsPerRow(), i = n.itemSize, r = n.itemsPerRow; if (!i || !r) return t(); var e = this.getStartAndEnd(), u = e.start, s = e.end, o = z(this.props, { from: Math.floor(u / i) * r, size: (Math.ceil((s - u) / i) + 1) * r, itemsPerRow: r, }), _ = o.from, a = o.size; return this.maybeSetState({ itemsPerRow: r, from: _, itemSize: i, size: a }, t); }, }, { key: "getSpaceBefore", value: function (t) { var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; if (null != n[t]) return n[t]; var i = this.state, r = i.itemSize, e = i.itemsPerRow; if (r) return (n[t] = Math.floor(t / e) * r); for (var u = t; u > 0 && null == n[--u];); for (var s = n[u] || 0, o = u; o < t; ++o) { n[o] = s; var _ = this.getSizeOfItem(o); if (null == _) break; s += _; } return (n[t] = s); }, }, { key: "cacheSizes", value: function () { for ( var t = this.cache, n = this.state.from, i = this.items.children, r = m[this.props.axis], e = 0, u = i.length; e < u; ++e ) t[n + e] = i[e][r]; }, }, { key: "getSizeOfItem", value: function (t) { var n = this.cache, i = this.items, r = this.props, e = r.axis, u = r.itemSizeGetter, s = r.itemSizeEstimator, o = r.type, _ = this.state, a = _.from, h = _.itemSize, c = _.size; if (h) return h; if (u) return u(t); if (t in n) return n[t]; if ("simple" === o && t >= a && t < a + c && i) { var l = i.children[t - a]; if (l) return l[m[e]]; } return s ? s(t, n) : void 0; }, }, { key: "scrollTo", value: function (t) { null != t && this.setScroll(this.getSpaceBefore(t)); }, }, { key: "scrollAround", value: function (t) { var n = this.getScrollPosition(), i = this.getSpaceBefore(t), r = i - this.props.scrollParentViewportSizeGetter(this) + this.getSizeOfItem(t), e = Math.min(r, i), u = Math.max(r, i); return n <= e ? this.setScroll(e) : n > u ? this.setScroll(u) : void 0; }, }, { key: "getVisibleRange", value: function () { for ( var t, n, i = this.state, r = i.from, e = i.size, u = this.getStartAndEnd(0), s = u.start, o = u.end, _ = {}, a = r; a < r + e; ++a ) { var h = this.getSpaceBefore(a, _), c = h + this.getSizeOfItem(a); (null == t && c > s && (t = a), null != t && h < o && (n = a)); } return [t, n]; }, }, { key: "renderItems", value: function () { for ( var t = this, n = this.props, i = n.itemRenderer, r = n.itemsRenderer, e = this.state, u = e.from, s = e.size, o = [], _ = 0; _ < s; ++_ ) o.push(i(u + _, _)); return r(o, function (n) { return (t.items = n); }); }, }, { key: "render", value: function () { var t = this, n = this.props, r = n.axis, e = n.length, u = n.type, s = n.useTranslate3d, o = this.state, _ = o.from, a = o.itemsPerRow, h = this.renderItems(); if ("simple" === u) return h; var c = { position: "relative" }, l = {}, f = Math.ceil(e / a) * a, v = this.getSpaceBefore(f, l); v && ((c[$[r]] = v), "x" === r && (c.overflowX = "hidden")); var w = this.getSpaceBefore(_, l), p = "x" === r ? w : 0, d = "y" === r ? w : 0, g = s ? "translate3d(".concat(p, "px, ").concat(d, "px, 0)") : "translate(".concat(p, "px, ").concat(d, "px)"), m = { msTransform: g, WebkitTransform: g, transform: g }; return i.default.createElement( "div", { style: c, ref: function (n) { return (t.el = n); }, }, i.default.createElement("div", { style: m }, h), ); }, }, ]), r ); })(i.Component)), w(r, "displayName", "ReactList"), w(r, "propTypes", { axis: n.default.oneOf(["x", "y"]), initialIndex: n.default.number, itemRenderer: n.default.func, itemSizeEstimator: n.default.func, itemSizeGetter: n.default.func, itemsRenderer: n.default.func, length: n.default.number, minSize: n.default.number, pageSize: n.default.number, scrollParentGetter: n.default.func, scrollParentViewportSizeGetter: n.default.func, threshold: n.default.number, type: n.default.oneOf(["simple", "variable", "uniform"]), useStaticSize: n.default.bool, useTranslate3d: n.default.bool, }), w(r, "defaultProps", { axis: "y", itemRenderer: function (t, n) { return i.default.createElement("div", { key: n }, t); }, itemsRenderer: function (t, n) { return i.default.createElement("div", { ref: n }, t); }, length: 0, minSize: 1, pageSize: 10, scrollParentGetter: function (t) { for (var n = t.props.axis, i = t.getEl(), r = k[n]; (i = i.parentElement);) switch (window.getComputedStyle(i)[r]) { case "auto": case "scroll": case "overlay": return i; } return window; }, scrollParentViewportSizeGetter: function (t) { var n = t.props.axis, i = t.scrollParent; return i === window ? window[g[n]] : i[p[n]]; }, threshold: 100, type: "simple", useStaticSize: !1, useTranslate3d: !1, }), e); }), void 0 === (u = r.apply(n, e)) || (t.exports = u)); });