@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
786 lines (784 loc) • 148 kB
JavaScript
import { r as C, a0 as $t, a1 as Kt, a2 as qt, j as L, a3 as ht, a4 as Xt, a5 as Y, a6 as Yt, a7 as Jt, a8 as Zt, a9 as Qt, h as X, z as eo, D as to, e as ft, aa as oo, B as ce, l as no, x as ro, ab as io, ac as lo, k as de, F as so, d as ao, n as co, m as pt, ad as me, ae as uo, af as ho, ag as N, ah as U, ai as fo } from "./EFJ5klSL3OL5aq6z.mjs";
/**
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.6.4
*
* (C) 2025-present SheetXL Inc. & Michael T. Ford
* License: The license can be found at https://www.sheetxl.com/license.
*/
const po = C.createContext(), go = C.createContext();
function mo(o) {
return Kt("MuiTableCell", o);
}
const vo = $t("MuiTableCell", ["root", "head", "body", "footer", "sizeSmall", "sizeMedium", "paddingCheckbox", "paddingNone", "alignLeft", "alignCenter", "alignRight", "alignJustify", "stickyHeader"]), _o = ht("td", { name: "MuiTableCell", slot: "Root", overridesResolver: (o, e) => {
const { ownerState: t } = o;
return [e.root, e[t.variant], e[`size${Y(t.size)}`], t.padding !== "normal" && e[`padding${Y(t.padding)}`], t.align !== "inherit" && e[`align${Y(t.align)}`], t.stickyHeader && e.stickyHeader];
} })(Jt(({ theme: o }) => ({ ...o.typography.body2, display: "table-cell", verticalAlign: "inherit", borderBottom: o.vars ? `1px solid ${o.vars.palette.TableCell.border}` : `1px solid
${o.palette.mode === "light" ? Zt(X(o.palette.divider, 1), 0.88) : Qt(X(o.palette.divider, 1), 0.68)}`, textAlign: "left", padding: 16, variants: [{ props: { variant: "head" }, style: { color: (o.vars || o).palette.text.primary, lineHeight: o.typography.pxToRem(24), fontWeight: o.typography.fontWeightMedium } }, { props: { variant: "body" }, style: { color: (o.vars || o).palette.text.primary } }, { props: { variant: "footer" }, style: { color: (o.vars || o).palette.text.secondary, lineHeight: o.typography.pxToRem(21), fontSize: o.typography.pxToRem(12) } }, { props: { size: "small" }, style: { padding: "6px 16px", [`&.${vo.paddingCheckbox}`]: { width: 24, padding: "0 12px 0 16px", "& > *": { padding: 0 } } } }, { props: { padding: "checkbox" }, style: { width: 48, padding: "0 0 0 4px" } }, { props: { padding: "none" }, style: { padding: 0 } }, { props: { align: "left" }, style: { textAlign: "left" } }, { props: { align: "center" }, style: { textAlign: "center" } }, { props: { align: "right" }, style: { textAlign: "right", flexDirection: "row-reverse" } }, { props: { align: "justify" }, style: { textAlign: "justify" } }, { props: ({ ownerState: e }) => e.stickyHeader, style: { position: "sticky", top: 0, zIndex: 2, backgroundColor: (o.vars || o).palette.background.default } }] }))), Me = C.forwardRef(function(o, e) {
const t = qt({ props: o, name: "MuiTableCell" }), { align: n = "inherit", className: r, component: i, padding: l, scope: a, size: s, sortDirection: c, variant: d, ...h } = t, f = C.useContext(po), u = C.useContext(go), _ = u && u.variant === "head";
let g;
g = i || (_ ? "th" : "td");
let m = a;
g === "td" ? m = void 0 : !m && _ && (m = "col");
const S = d || u && u.variant, y = { ...t, align: n, component: g, padding: l || (f && f.padding ? f.padding : "normal"), size: s || (f && f.size ? f.size : "medium"), sortDirection: c, stickyHeader: S === "head" && f && f.stickyHeader, variant: S }, v = ((x) => {
const { classes: R, variant: b, align: z, padding: T, size: k, stickyHeader: O } = x, P = { root: ["root", b, O && "stickyHeader", z !== "inherit" && `align${Y(z)}`, T !== "normal" && `padding${Y(T)}`, `size${Y(k)}`] };
return Yt(P, mo, R);
})(y);
let w = null;
return c && (w = c === "asc" ? "ascending" : "descending"), L.jsx(_o, { as: g, ref: e, className: Xt(v.root, r), "aria-sort": w, scope: m, ownerState: y, ...h });
});
function G(o, e) {
if (!(o instanceof e)) throw new TypeError("Cannot call a class as a function");
}
function J(o) {
return (J = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
})(o);
}
function gt(o) {
var e = function(t) {
if (J(t) != "object" || !t) return t;
var n = t[Symbol.toPrimitive];
if (n !== void 0) {
var r = n.call(t, "string");
if (J(r) != "object") return r;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(t);
}(o);
return J(e) == "symbol" ? e : e + "";
}
function Le(o, e) {
for (var t = 0; t < e.length; t++) {
var n = e[t];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(o, gt(n.key), n);
}
}
function A(o, e, t) {
return e && Le(o.prototype, e), t && Le(o, t), Object.defineProperty(o, "prototype", { writable: !1 }), o;
}
function H(o, e) {
if (e && (J(e) == "object" || typeof e == "function")) return e;
if (e !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
return function(t) {
if (t === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}(o);
}
function I(o) {
return (I = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
})(o);
}
function W(o, e) {
if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function");
o.prototype = Object.create(e && e.prototype, { constructor: { value: o, writable: !0, configurable: !0 } }), Object.defineProperty(o, "prototype", { writable: !1 }), e && ho(o, e);
}
function p(o, e, t) {
return (e = gt(e)) in o ? Object.defineProperty(o, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : o[e] = t, o;
}
function mt() {
var o = this.constructor.getDerivedStateFromProps(this.props, this.state);
o != null && this.setState(o);
}
function vt(o) {
this.setState(function(e) {
return this.constructor.getDerivedStateFromProps(o, e) ?? null;
}.bind(this));
}
function _t(o, e) {
try {
var t = this.props, n = this.state;
this.props = o, this.state = e, this.__reactInternalSnapshotFlag = !0, this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(t, n);
} finally {
this.props = t, this.state = n;
}
}
function ae(o) {
var e = o.prototype;
if (!e || !e.isReactComponent) throw new Error("Can only polyfill class components");
if (typeof o.getDerivedStateFromProps != "function" && typeof e.getSnapshotBeforeUpdate != "function") return o;
var t = null, n = null, r = null;
if (typeof e.componentWillMount == "function" ? t = "componentWillMount" : typeof e.UNSAFE_componentWillMount == "function" && (t = "UNSAFE_componentWillMount"), typeof e.componentWillReceiveProps == "function" ? n = "componentWillReceiveProps" : typeof e.UNSAFE_componentWillReceiveProps == "function" && (n = "UNSAFE_componentWillReceiveProps"), typeof e.componentWillUpdate == "function" ? r = "componentWillUpdate" : typeof e.UNSAFE_componentWillUpdate == "function" && (r = "UNSAFE_componentWillUpdate"), t !== null || n !== null || r !== null) {
var i = o.displayName || o.name, l = typeof o.getDerivedStateFromProps == "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.
` + i + " uses " + l + " but also contains the following legacy lifecycles:" + (t !== null ? `
` + t : "") + (n !== null ? `
` + n : "") + (r !== null ? `
` + r : "") + `
The above lifecycles should be removed. Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks`);
}
if (typeof o.getDerivedStateFromProps == "function" && (e.componentWillMount = mt, e.componentWillReceiveProps = vt), typeof e.getSnapshotBeforeUpdate == "function") {
if (typeof e.componentDidUpdate != "function") throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");
e.componentWillUpdate = _t;
var a = e.componentDidUpdate;
e.componentDidUpdate = function(s, c, d) {
var h = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : d;
a.call(this, s, c, h);
};
}
return o;
}
function Ge(o, e) {
var t = Object.keys(o);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(o);
e && (n = n.filter(function(r) {
return Object.getOwnPropertyDescriptor(o, r).enumerable;
})), t.push.apply(t, n);
}
return t;
}
function Ae(o) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e] != null ? arguments[e] : {};
e % 2 ? Ge(Object(t), !0).forEach(function(n) {
p(o, n, t[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) : Ge(Object(t)).forEach(function(n) {
Object.defineProperty(o, n, Object.getOwnPropertyDescriptor(t, n));
});
}
return o;
}
function St() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (St = function() {
return !!o;
})();
}
mt.__suppressDeprecationWarning = !0, vt.__suppressDeprecationWarning = !0, _t.__suppressDeprecationWarning = !0;
var Ee = function() {
function o() {
var e, t, n, r;
G(this, o);
for (var i = arguments.length, l = new Array(i), a = 0; a < i; a++) l[a] = arguments[a];
return t = this, n = o, r = [].concat(l), n = I(n), p(e = H(t, St() ? Reflect.construct(n, r || [], I(t).constructor) : n.apply(t, r)), "state", { scrollToColumn: 0, scrollToRow: 0, instanceProps: { prevScrollToColumn: 0, prevScrollToRow: 0 } }), p(e, "_columnStartIndex", 0), p(e, "_columnStopIndex", 0), p(e, "_rowStartIndex", 0), p(e, "_rowStopIndex", 0), p(e, "_onKeyDown", function(s) {
var c = e.props, d = c.columnCount, h = c.disabled, f = c.mode, u = c.rowCount;
if (!h) {
var _ = e._getScrollState(), g = _.scrollToColumn, m = _.scrollToRow, S = e._getScrollState(), y = S.scrollToColumn, v = S.scrollToRow;
switch (s.key) {
case "ArrowDown":
v = Math.min(f === "cells" ? v + 1 : e._rowStopIndex + 1, u - 1);
break;
case "ArrowLeft":
y = Math.max(f === "cells" ? y - 1 : e._columnStartIndex - 1, 0);
break;
case "ArrowRight":
y = Math.min(f === "cells" ? y + 1 : e._columnStopIndex + 1, d - 1);
break;
case "ArrowUp":
v = Math.max(f === "cells" ? v - 1 : e._rowStartIndex - 1, 0);
}
y === g && v === m || (s.preventDefault(), e._updateScrollState({ scrollToColumn: y, scrollToRow: v }));
}
}), p(e, "_onSectionRendered", function(s) {
var c = s.columnStartIndex, d = s.columnStopIndex, h = s.rowStartIndex, f = s.rowStopIndex;
e._columnStartIndex = c, e._columnStopIndex = d, e._rowStartIndex = h, e._rowStopIndex = f;
}), e;
}
return W(o, C.PureComponent), A(o, [{ key: "setScrollIndexes", value: function(e) {
var t = e.scrollToColumn, n = e.scrollToRow;
this.setState({ scrollToRow: n, scrollToColumn: t });
} }, { key: "render", value: function() {
var e = this.props, t = e.className, n = e.children, r = this._getScrollState(), i = r.scrollToColumn, l = r.scrollToRow;
return C.createElement("div", { className: t, onKeyDown: this._onKeyDown }, n({ onSectionRendered: this._onSectionRendered, scrollToColumn: i, scrollToRow: l }));
} }, { key: "_getScrollState", value: function() {
return this.props.isControlled ? this.props : this.state;
} }, { key: "_updateScrollState", value: function(e) {
var t = e.scrollToColumn, n = e.scrollToRow, r = this.props, i = r.isControlled, l = r.onScrollToChange;
typeof l == "function" && l({ scrollToColumn: t, scrollToRow: n }), i || this.setState({ scrollToColumn: t, scrollToRow: n });
} }], [{ key: "getDerivedStateFromProps", value: function(e, t) {
return e.isControlled ? {} : e.scrollToColumn !== t.instanceProps.prevScrollToColumn || e.scrollToRow !== t.instanceProps.prevScrollToRow ? Ae(Ae({}, t), {}, { scrollToColumn: e.scrollToColumn, scrollToRow: e.scrollToRow, instanceProps: { prevScrollToColumn: e.scrollToColumn, prevScrollToRow: e.scrollToRow } }) : {};
} }]);
}();
function yt(o, e) {
var t, n, r = (t = e !== void 0 ? e : typeof window < "u" ? window : typeof self < "u" ? self : global).document !== void 0 && t.document.attachEvent;
if (!r) {
var i = (n = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || function(v) {
return t.setTimeout(v, 20);
}, function(v) {
return n(v);
}), l = function() {
var v = t.cancelAnimationFrame || t.mozCancelAnimationFrame || t.webkitCancelAnimationFrame || t.clearTimeout;
return function(w) {
return v(w);
};
}(), a = function(v) {
var w = v.__resizeTriggers__, x = w.firstElementChild, R = w.lastElementChild, b = x.firstElementChild;
R.scrollLeft = R.scrollWidth, R.scrollTop = R.scrollHeight, b.style.width = x.offsetWidth + 1 + "px", b.style.height = x.offsetHeight + 1 + "px", x.scrollLeft = x.scrollWidth, x.scrollTop = x.scrollHeight;
}, s = function(v) {
if (!(v.target.className && typeof v.target.className.indexOf == "function" && v.target.className.indexOf("contract-trigger") < 0 && v.target.className.indexOf("expand-trigger") < 0)) {
var w = this;
a(this), this.__resizeRAF__ && l(this.__resizeRAF__), this.__resizeRAF__ = i(function() {
var x;
((x = w).offsetWidth != x.__resizeLast__.width || x.offsetHeight != x.__resizeLast__.height) && (w.__resizeLast__.width = w.offsetWidth, w.__resizeLast__.height = w.offsetHeight, w.__resizeListeners__.forEach(function(R) {
R.call(w, v);
}));
});
}
}, c = !1, d = "", h = "animationstart", f = "Webkit Moz O ms".split(" "), u = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), _ = t.document.createElement("fakeelement");
if (_.style.animationName !== void 0 && (c = !0), c === !1) {
for (var g = 0; g < f.length; g++) if (_.style[f[g] + "AnimationName"] !== void 0) {
d = "-" + f[g].toLowerCase() + "-", h = u[g], c = !0;
break;
}
}
var m = "resizeanim", S = "@" + d + "keyframes " + m + " { from { opacity: 0; } to { opacity: 0; } } ", y = d + "animation: 1ms " + m + "; ";
}
return { addResizeListener: function(v, w) {
if (r) v.attachEvent("onresize", w);
else {
if (!v.__resizeTriggers__) {
var x = v.ownerDocument, R = t.getComputedStyle(v);
R && R.position == "static" && (v.style.position = "relative"), function(T) {
if (!T.getElementById("detectElementResize")) {
var k = (S || "") + ".resize-triggers { " + (y || "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', O = T.head || T.getElementsByTagName("head")[0], P = T.createElement("style");
P.id = "detectElementResize", P.type = "text/css", o != null && P.setAttribute("nonce", o), P.styleSheet ? P.styleSheet.cssText = k : P.appendChild(T.createTextNode(k)), O.appendChild(P);
}
}(x), v.__resizeLast__ = {}, v.__resizeListeners__ = [], (v.__resizeTriggers__ = x.createElement("div")).className = "resize-triggers";
var b = x.createElement("div");
b.className = "expand-trigger", b.appendChild(x.createElement("div"));
var z = x.createElement("div");
z.className = "contract-trigger", v.__resizeTriggers__.appendChild(b), v.__resizeTriggers__.appendChild(z), v.appendChild(v.__resizeTriggers__), a(v), v.addEventListener("scroll", s, !0), h && (v.__resizeTriggers__.__animationListener__ = function(T) {
T.animationName == m && a(v);
}, v.__resizeTriggers__.addEventListener(h, v.__resizeTriggers__.__animationListener__));
}
v.__resizeListeners__.push(w);
}
}, removeResizeListener: function(v, w) {
if (r) v.detachEvent("onresize", w);
else if (v.__resizeListeners__.splice(v.__resizeListeners__.indexOf(w), 1), !v.__resizeListeners__.length) {
v.removeEventListener("scroll", s, !0), v.__resizeTriggers__.__animationListener__ && (v.__resizeTriggers__.removeEventListener(h, v.__resizeTriggers__.__animationListener__), v.__resizeTriggers__.__animationListener__ = null);
try {
v.__resizeTriggers__ = !v.removeChild(v.__resizeTriggers__);
} catch {
}
}
} };
}
function He(o, e) {
var t = Object.keys(o);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(o);
e && (n = n.filter(function(r) {
return Object.getOwnPropertyDescriptor(o, r).enumerable;
})), t.push.apply(t, n);
}
return t;
}
function We(o) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e] != null ? arguments[e] : {};
e % 2 ? He(Object(t), !0).forEach(function(n) {
p(o, n, t[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) : He(Object(t)).forEach(function(n) {
Object.defineProperty(o, n, Object.getOwnPropertyDescriptor(t, n));
});
}
return o;
}
function wt() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (wt = function() {
return !!o;
})();
}
p(Ee, "defaultProps", { disabled: !1, isControlled: !1, mode: "edges", scrollToColumn: 0, scrollToRow: 0 }), ae(Ee);
var Ct = function() {
function o() {
var e, t, n, r;
G(this, o);
for (var i = arguments.length, l = new Array(i), a = 0; a < i; a++) l[a] = arguments[a];
return t = this, n = o, r = [].concat(l), n = I(n), p(e = H(t, wt() ? Reflect.construct(n, r || [], I(t).constructor) : n.apply(t, r)), "state", { height: e.props.defaultHeight || 0, width: e.props.defaultWidth || 0 }), p(e, "_parentNode", void 0), p(e, "_autoSizer", void 0), p(e, "_window", void 0), p(e, "_detectElementResize", void 0), p(e, "_onResize", function() {
var s = e.props, c = s.disableHeight, d = s.disableWidth, h = s.onResize;
if (e._parentNode) {
var f = e._parentNode.offsetHeight || 0, u = e._parentNode.offsetWidth || 0, _ = (e._window || window).getComputedStyle(e._parentNode) || {}, g = parseInt(_.paddingLeft, 10) || 0, m = parseInt(_.paddingRight, 10) || 0, S = parseInt(_.paddingTop, 10) || 0, y = parseInt(_.paddingBottom, 10) || 0, v = f - S - y, w = u - g - m;
(!c && e.state.height !== v || !d && e.state.width !== w) && (e.setState({ height: f - S - y, width: u - g - m }), h({ height: f, width: u }));
}
}), p(e, "_setRef", function(s) {
e._autoSizer = s;
}), e;
}
return W(o, C.Component), A(o, [{ key: "componentDidMount", value: function() {
var e = this.props.nonce;
this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement && (this._parentNode = this._autoSizer.parentNode, this._window = this._autoSizer.parentNode.ownerDocument.defaultView, this._detectElementResize = yt(e, this._window), this._detectElementResize.addResizeListener(this._parentNode, this._onResize), this._onResize());
} }, { key: "componentWillUnmount", value: function() {
this._detectElementResize && this._parentNode && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
} }, { key: "render", value: function() {
var e = this.props, t = e.children, n = e.className, r = e.disableHeight, i = e.disableWidth, l = e.style, a = this.state, s = a.height, c = a.width, d = { overflow: "visible" }, h = {};
return r || (d.height = 0, h.height = s), i || (d.width = 0, h.width = c), C.createElement("div", { className: n, ref: this._setRef, style: We(We({}, d), l) }, t(h));
} }]);
}();
function xt() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (xt = function() {
return !!o;
})();
}
p(Ct, "defaultProps", { onResize: function() {
}, disableHeight: !1, disableWidth: !1, style: {} });
var So = function() {
function o() {
var e, t, n, r;
G(this, o);
for (var i = arguments.length, l = new Array(i), a = 0; a < i; a++) l[a] = arguments[a];
return t = this, n = o, r = [].concat(l), n = I(n), p(e = H(t, xt() ? Reflect.construct(n, r || [], I(t).constructor) : n.apply(t, r)), "_child", C.createRef()), p(e, "_measure", function() {
var s = e.props, c = s.cache, d = s.columnIndex, h = d === void 0 ? 0 : d, f = s.parent, u = s.rowIndex, _ = u === void 0 ? e.props.index || 0 : u, g = e._getCellMeasurements(), m = g.height, S = g.width;
m === c.getHeight(_, h) && S === c.getWidth(_, h) || (c.set(_, h, S, m), f && typeof f.recomputeGridSize == "function" && f.recomputeGridSize({ columnIndex: h, rowIndex: _ }));
}), p(e, "_registerChild", function(s) {
!s || s instanceof Element || console.warn("CellMeasurer registerChild expects to be passed Element or null"), e._child.current = s, s && e._maybeMeasureCell();
}), e;
}
return W(o, C.PureComponent), A(o, [{ key: "componentDidMount", value: function() {
this._maybeMeasureCell();
} }, { key: "componentDidUpdate", value: function() {
this._maybeMeasureCell();
} }, { key: "render", value: function() {
var e = this, t = this.props.children, n = typeof t == "function" ? t({ measure: this._measure, registerChild: this._registerChild }) : t;
return n === null ? n : C.cloneElement(n, { ref: function(r) {
typeof n.ref == "function" ? n.ref(r) : n.ref && (n.ref.current = r), e._child.current = r;
} });
} }, { key: "_getCellMeasurements", value: function() {
var e = this.props.cache, t = this._child.current;
if (t && t.ownerDocument && t.ownerDocument.defaultView && t instanceof t.ownerDocument.defaultView.HTMLElement) {
var n = t.style.width, r = t.style.height;
e.hasFixedWidth() || (t.style.width = "auto"), e.hasFixedHeight() || (t.style.height = "auto");
var i = Math.ceil(t.offsetHeight), l = Math.ceil(t.offsetWidth);
return n && (t.style.width = n), r && (t.style.height = r), { height: i, width: l };
}
return { height: 0, width: 0 };
} }, { key: "_maybeMeasureCell", value: function() {
var e = this.props, t = e.cache, n = e.columnIndex, r = n === void 0 ? 0 : n, i = e.parent, l = e.rowIndex, a = l === void 0 ? this.props.index || 0 : l;
if (!t.has(a, r)) {
var s = this._getCellMeasurements(), c = s.height, d = s.width;
t.set(a, r, d, c), i && typeof i.invalidateCellSizeAfterRender == "function" && i.invalidateCellSizeAfterRender({ columnIndex: r, rowIndex: a });
}
} }]);
}();
function Z() {
var o = !(arguments.length > 0 && arguments[0] !== void 0) || arguments[0], e = {};
return function(t) {
var n = t.callback, r = t.indices, i = Object.keys(r), l = !o || i.every(function(s) {
var c = r[s];
return Array.isArray(c) ? c.length > 0 : c >= 0;
}), a = i.length !== Object.keys(e).length || i.some(function(s) {
var c = e[s], d = r[s];
return Array.isArray(d) ? c.join(",") !== d.join(",") : c !== d;
});
e = r, l && a && n(r);
};
}
p(So, "__internalCellMeasurerFlag", !1);
const yo = !(typeof window > "u" || !window.document || !window.document.createElement);
var ue;
function we(o) {
if ((!ue && ue !== 0 || o) && yo) {
var e = document.createElement("div");
e.style.position = "absolute", e.style.top = "-9999px", e.style.width = "50px", e.style.height = "50px", e.style.overflow = "scroll", document.body.appendChild(e), ue = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
}
return ue;
}
function De(o, e) {
var t = Object.keys(o);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(o);
e && (n = n.filter(function(r) {
return Object.getOwnPropertyDescriptor(o, r).enumerable;
})), t.push.apply(t, n);
}
return t;
}
function je(o) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e] != null ? arguments[e] : {};
e % 2 ? De(Object(t), !0).forEach(function(n) {
p(o, n, t[n]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(t)) : De(Object(t)).forEach(function(n) {
Object.defineProperty(o, n, Object.getOwnPropertyDescriptor(t, n));
});
}
return o;
}
function Rt() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (Rt = function() {
return !!o;
})();
}
var ee = "requested", fe = function() {
function o() {
var e, t, n, r;
G(this, o);
for (var i = arguments.length, l = new Array(i), a = 0; a < i; a++) l[a] = arguments[a];
return t = this, n = o, r = [].concat(l), n = I(n), p(e = H(t, Rt() ? Reflect.construct(n, r || [], I(t).constructor) : n.apply(t, r)), "state", { isScrolling: !1, scrollLeft: 0, scrollTop: 0 }), p(e, "_calculateSizeAndPositionDataOnNextUpdate", !1), p(e, "_onSectionRenderedMemoizer", Z()), p(e, "_onScrollMemoizer", Z(!1)), p(e, "_invokeOnSectionRenderedHelper", function() {
var s = e.props, c = s.cellLayoutManager, d = s.onSectionRendered;
e._onSectionRenderedMemoizer({ callback: d, indices: { indices: c.getLastRenderedIndices() } });
}), p(e, "_setScrollingContainerRef", function(s) {
e._scrollingContainer = s;
}), p(e, "_updateScrollPositionForScrollToCell", function() {
var s = e.props, c = s.cellLayoutManager, d = s.height, h = s.scrollToAlignment, f = s.scrollToCell, u = s.width, _ = e.state, g = _.scrollLeft, m = _.scrollTop;
if (f >= 0) {
var S = c.getScrollPositionForCell({ align: h, cellIndex: f, height: d, scrollLeft: g, scrollTop: m, width: u });
S.scrollLeft === g && S.scrollTop === m || e._setScrollPosition(S);
}
}), p(e, "_onScroll", function(s) {
if (s.target === e._scrollingContainer) {
e._enablePointerEventsAfterDelay();
var c = e.props, d = c.cellLayoutManager, h = c.height, f = c.isScrollingChange, u = c.width, _ = e._scrollbarSize, g = d.getTotalSize(), m = g.height, S = g.width, y = Math.max(0, Math.min(S - u + _, s.target.scrollLeft)), v = Math.max(0, Math.min(m - h + _, s.target.scrollTop));
if (e.state.scrollLeft !== y || e.state.scrollTop !== v) {
var w = s.cancelable ? "observed" : ee;
e.state.isScrolling || f(!0), e.setState({ isScrolling: !0, scrollLeft: y, scrollPositionChangeReason: w, scrollTop: v });
}
e._invokeOnScrollMemoizer({ scrollLeft: y, scrollTop: v, totalWidth: S, totalHeight: m });
}
}), e._scrollbarSize = we(), e._scrollbarSize === void 0 ? (e._scrollbarSizeMeasured = !1, e._scrollbarSize = 0) : e._scrollbarSizeMeasured = !0, e;
}
return W(o, C.PureComponent), A(o, [{ key: "recomputeCellSizesAndPositions", value: function() {
this._calculateSizeAndPositionDataOnNextUpdate = !0, this.forceUpdate();
} }, { key: "componentDidMount", value: function() {
var e = this.props, t = e.cellLayoutManager, n = e.scrollLeft, r = e.scrollToCell, i = e.scrollTop;
this._scrollbarSizeMeasured || (this._scrollbarSize = we(), this._scrollbarSizeMeasured = !0, this.setState({})), r >= 0 ? this._updateScrollPositionForScrollToCell() : (n >= 0 || i >= 0) && this._setScrollPosition({ scrollLeft: n, scrollTop: i }), this._invokeOnSectionRenderedHelper();
var l = t.getTotalSize(), a = l.height, s = l.width;
this._invokeOnScrollMemoizer({ scrollLeft: n || 0, scrollTop: i || 0, totalHeight: a, totalWidth: s });
} }, { key: "componentDidUpdate", value: function(e, t) {
var n = this.props, r = n.height, i = n.scrollToAlignment, l = n.scrollToCell, a = n.width, s = this.state, c = s.scrollLeft, d = s.scrollPositionChangeReason, h = s.scrollTop;
d === ee && (c >= 0 && c !== t.scrollLeft && c !== this._scrollingContainer.scrollLeft && (this._scrollingContainer.scrollLeft = c), h >= 0 && h !== t.scrollTop && h !== this._scrollingContainer.scrollTop && (this._scrollingContainer.scrollTop = h)), r === e.height && i === e.scrollToAlignment && l === e.scrollToCell && a === e.width || this._updateScrollPositionForScrollToCell(), this._invokeOnSectionRenderedHelper();
} }, { key: "componentWillUnmount", value: function() {
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId);
} }, { key: "render", value: function() {
var e = this.props, t = e.autoHeight, n = e.cellCount, r = e.cellLayoutManager, i = e.className, l = e.height, a = e.horizontalOverscanSize, s = e.id, c = e.noContentRenderer, d = e.style, h = e.verticalOverscanSize, f = e.width, u = this.state, _ = u.isScrolling, g = u.scrollLeft, m = u.scrollTop;
(this._lastRenderedCellCount !== n || this._lastRenderedCellLayoutManager !== r || this._calculateSizeAndPositionDataOnNextUpdate) && (this._lastRenderedCellCount = n, this._lastRenderedCellLayoutManager = r, this._calculateSizeAndPositionDataOnNextUpdate = !1, r.calculateSizeAndPositionData());
var S = r.getTotalSize(), y = S.height, v = S.width, w = Math.max(0, g - a), x = Math.max(0, m - h), R = Math.min(v, g + f + a), b = Math.min(y, m + l + h), z = l > 0 && f > 0 ? r.cellRenderers({ height: b - x, isScrolling: _, width: R - w, x: w, y: x }) : [], T = { boxSizing: "border-box", direction: "ltr", height: t ? "auto" : l, position: "relative", WebkitOverflowScrolling: "touch", width: f, willChange: "transform" }, k = y > l ? this._scrollbarSize : 0, O = v > f ? this._scrollbarSize : 0;
return T.overflowX = v + k <= f ? "hidden" : "auto", T.overflowY = y + O <= l ? "hidden" : "auto", C.createElement("div", { ref: this._setScrollingContainerRef, "aria-label": this.props["aria-label"], className: N("ReactVirtualized__Collection", i), id: s, onScroll: this._onScroll, role: "grid", style: je(je({}, T), d), tabIndex: 0 }, n > 0 && C.createElement("div", { className: "ReactVirtualized__Collection__innerScrollContainer", style: { height: y, maxHeight: y, maxWidth: v, overflow: "hidden", pointerEvents: _ ? "none" : "", width: v } }, z), n === 0 && c());
} }, { key: "_enablePointerEventsAfterDelay", value: function() {
var e = this;
this._disablePointerEventsTimeoutId && clearTimeout(this._disablePointerEventsTimeoutId), this._disablePointerEventsTimeoutId = setTimeout(function() {
(0, e.props.isScrollingChange)(!1), e._disablePointerEventsTimeoutId = null, e.setState({ isScrolling: !1 });
}, 150);
} }, { key: "_invokeOnScrollMemoizer", value: function(e) {
var t = this, n = e.scrollLeft, r = e.scrollTop, i = e.totalHeight, l = e.totalWidth;
this._onScrollMemoizer({ callback: function(a) {
var s = a.scrollLeft, c = a.scrollTop, d = t.props, h = d.height;
(0, d.onScroll)({ clientHeight: h, clientWidth: d.width, scrollHeight: i, scrollLeft: s, scrollTop: c, scrollWidth: l });
}, indices: { scrollLeft: n, scrollTop: r } });
} }, { key: "_setScrollPosition", value: function(e) {
var t = e.scrollLeft, n = e.scrollTop, r = { scrollPositionChangeReason: ee };
t >= 0 && (r.scrollLeft = t), n >= 0 && (r.scrollTop = n), (t >= 0 && t !== this.state.scrollLeft || n >= 0 && n !== this.state.scrollTop) && this.setState(r);
} }], [{ key: "getDerivedStateFromProps", value: function(e, t) {
return e.cellCount !== 0 || t.scrollLeft === 0 && t.scrollTop === 0 ? e.scrollLeft !== t.scrollLeft || e.scrollTop !== t.scrollTop ? { scrollLeft: e.scrollLeft != null ? e.scrollLeft : t.scrollLeft, scrollTop: e.scrollTop != null ? e.scrollTop : t.scrollTop, scrollPositionChangeReason: ee } : null : { scrollLeft: 0, scrollTop: 0, scrollPositionChangeReason: ee };
} }]);
}();
p(fe, "defaultProps", { "aria-label": "grid", horizontalOverscanSize: 0, noContentRenderer: function() {
return null;
}, onScroll: function() {
return null;
}, onSectionRendered: function() {
return null;
}, scrollToAlignment: "auto", scrollToCell: -1, style: {}, verticalOverscanSize: 0 }), fe.propTypes = {}, ae(fe);
var wo = A(function o(e) {
var t = e.height, n = e.width, r = e.x, i = e.y;
G(this, o), this.height = t, this.width = n, this.x = r, this.y = i, this._indexMap = {}, this._indices = [];
}, [{ key: "addCellIndex", value: function(o) {
var e = o.index;
this._indexMap[e] || (this._indexMap[e] = !0, this._indices.push(e));
} }, { key: "getCellIndices", value: function() {
return this._indices;
} }, { key: "toString", value: function() {
return "".concat(this.x, ",").concat(this.y, " ").concat(this.width, "x").concat(this.height);
} }]), Co = A(function o() {
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 100;
G(this, o), this._sectionSize = e, this._cellMetadata = [], this._sections = {};
}, [{ key: "getCellIndices", value: function(o) {
var e = o.height, t = o.width, n = o.x, r = o.y, i = {};
return this.getSections({ height: e, width: t, x: n, y: r }).forEach(function(l) {
return l.getCellIndices().forEach(function(a) {
i[a] = a;
});
}), Object.keys(i).map(function(l) {
return i[l];
});
} }, { key: "getCellMetadata", value: function(o) {
var e = o.index;
return this._cellMetadata[e];
} }, { key: "getSections", value: function(o) {
for (var e = o.height, t = o.width, n = o.x, r = o.y, i = Math.floor(n / this._sectionSize), l = Math.floor((n + t - 1) / this._sectionSize), a = Math.floor(r / this._sectionSize), s = Math.floor((r + e - 1) / this._sectionSize), c = [], d = i; d <= l; d++) for (var h = a; h <= s; h++) {
var f = "".concat(d, ".").concat(h);
this._sections[f] || (this._sections[f] = new wo({ height: this._sectionSize, width: this._sectionSize, x: d * this._sectionSize, y: h * this._sectionSize })), c.push(this._sections[f]);
}
return c;
} }, { key: "getTotalSectionCount", value: function() {
return Object.keys(this._sections).length;
} }, { key: "toString", value: function() {
var o = this;
return Object.keys(this._sections).map(function(e) {
return o._sections[e].toString();
});
} }, { key: "registerCell", value: function(o) {
var e = o.cellMetadatum, t = o.index;
this._cellMetadata[t] = e, this.getSections(e).forEach(function(n) {
return n.addCellIndex({ index: t });
});
} }]);
function Fe(o) {
var e = o.align, t = e === void 0 ? "auto" : e, n = o.cellOffset, r = o.cellSize, i = o.containerSize, l = o.currentOffset, a = n, s = a - i + r;
switch (t) {
case "start":
return a;
case "end":
return s;
case "center":
return a - (i - r) / 2;
default:
return Math.max(s, Math.min(a, l));
}
}
function bt() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (bt = function() {
return !!o;
})();
}
var Ne = function() {
function o(e, t) {
var n, r, i, l;
return G(this, o), r = this, l = [e, t], i = I(i = o), (n = H(r, bt() ? Reflect.construct(i, l || [], I(r).constructor) : i.apply(r, l)))._cellMetadata = [], n._lastRenderedCellIndices = [], n._cellCache = [], n._isScrollingChange = n._isScrollingChange.bind(n), n._setCollectionViewRef = n._setCollectionViewRef.bind(n), n;
}
return W(o, C.PureComponent), A(o, [{ key: "forceUpdate", value: function() {
this._collectionView !== void 0 && this._collectionView.forceUpdate();
} }, { key: "recomputeCellSizesAndPositions", value: function() {
this._cellCache = [], this._collectionView.recomputeCellSizesAndPositions();
} }, { key: "render", value: function() {
var e = U({}, (function(t) {
if (t == null) throw new TypeError("Cannot destructure " + t);
}(this.props), this.props));
return C.createElement(fe, U({ cellLayoutManager: this, isScrollingChange: this._isScrollingChange, ref: this._setCollectionViewRef }, e));
} }, { key: "calculateSizeAndPositionData", value: function() {
var e = this.props, t = function(n) {
for (var r = n.cellCount, i = n.cellSizeAndPositionGetter, l = [], a = new Co(n.sectionSize), s = 0, c = 0, d = 0; d < r; d++) {
var h = i({ index: d });
if (h.height == null || isNaN(h.height) || h.width == null || isNaN(h.width) || h.x == null || isNaN(h.x) || h.y == null || isNaN(h.y)) throw Error("Invalid metadata returned for cell ".concat(d, `:
x:`).concat(h.x, ", y:").concat(h.y, ", width:").concat(h.width, ", height:").concat(h.height));
s = Math.max(s, h.y + h.height), c = Math.max(c, h.x + h.width), l[d] = h, a.registerCell({ cellMetadatum: h, index: d });
}
return { cellMetadata: l, height: s, sectionManager: a, width: c };
}({ cellCount: e.cellCount, cellSizeAndPositionGetter: e.cellSizeAndPositionGetter, sectionSize: e.sectionSize });
this._cellMetadata = t.cellMetadata, this._sectionManager = t.sectionManager, this._height = t.height, this._width = t.width;
} }, { key: "getLastRenderedIndices", value: function() {
return this._lastRenderedCellIndices;
} }, { key: "getScrollPositionForCell", value: function(e) {
var t = e.align, n = e.cellIndex, r = e.height, i = e.scrollLeft, l = e.scrollTop, a = e.width, s = this.props.cellCount;
if (n >= 0 && n < s) {
var c = this._cellMetadata[n];
i = Fe({ align: t, cellOffset: c.x, cellSize: c.width, containerSize: a, currentOffset: i }), l = Fe({ align: t, cellOffset: c.y, cellSize: c.height, containerSize: r, currentOffset: l });
}
return { scrollLeft: i, scrollTop: l };
} }, { key: "getTotalSize", value: function() {
return { height: this._height, width: this._width };
} }, { key: "cellRenderers", value: function(e) {
var t = this, n = e.height, r = e.isScrolling, i = e.width, l = e.x, a = e.y, s = this.props, c = s.cellGroupRenderer, d = s.cellRenderer;
return this._lastRenderedCellIndices = this._sectionManager.getCellIndices({ height: n, width: i, x: l, y: a }), c({ cellCache: this._cellCache, cellRenderer: d, cellSizeAndPositionGetter: function(h) {
var f = h.index;
return t._sectionManager.getCellMetadata({ index: f });
}, indices: this._lastRenderedCellIndices, isScrolling: r });
} }, { key: "_isScrollingChange", value: function(e) {
e || (this._cellCache = []);
} }, { key: "_setCollectionViewRef", value: function(e) {
this._collectionView = e;
} }]);
}();
function zt() {
try {
var o = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch {
}
return (zt = function() {
return !!o;
})();
}
function Be(o) {
var e = o.cellCount, t = o.cellSize, n = o.computeMetadataCallback, r = o.computeMetadataCallbackProps, i = o.nextCellsCount, l = o.nextCellSize, a = o.nextScrollToIndex, s = o.scrollToIndex, c = o.updateScrollOffsetForScrollToIndex;
e === i && (typeof t != "number" && typeof l != "number" || t === l) || (n(r), s >= 0 && s === a && c());
}
function oe(o, e) {
if (o == null) return {};
var t, n, r = fo(o, e);
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(o);
for (n = 0; n < i.length; n++) t = i[n], e.indexOf(t) === -1 && {}.propertyIsEnumerable.call(o, t) && (r[t] = o[t]);
}
return r;
}
p(Ne, "defaultProps", { "aria-label": "grid", cellGroupRenderer: function(o) {
var e = o.cellCache, t = o.cellRenderer, n = o.cellSizeAndPositionGetter, r = o.indices, i = o.isScrolling;
return r.map(function(l) {
var a = n({ index: l }), s = { index: l, isScrolling: i, key: l, style: { height: a.height, left: a.x, position: "absolute", top: a.y, width: a.width } };
return i ? (l in e || (e[l] = t(s)), e[l]) : t(s);
}).filter(function(l) {
return !!l;
});
} }), Ne.propTypes = {}, function() {
function o(e, t) {
var n, r, i, l;
return G(this, o), r = this, l = [e, t], i = I(i = o), (n = H(r, zt() ? Reflect.construct(i, l || [], I(r).constructor) : i.apply(r, l)))._registerChild = n._registerChild.bind(n), n;
}
return W(o, C.PureComponent), A(o, [{ key: "componentDidUpdate", value: function(e) {
var t = this.props, n = t.columnMaxWidth, r = t.columnMinWidth, i = t.columnCount, l = t.width;
n === e.columnMaxWidth && r === e.columnMinWidth && i === e.columnCount && l === e.width || this._registeredChild && this._registeredChild.recomputeGridSize();
} }, { key: "render", value: function() {
var e = this.props, t = e.children, n = e.columnMaxWidth, r = e.columnMinWidth, i = e.columnCount, l = e.width, a = r || 1, s = n ? Math.min(n, l) : l, c = l / i;
return c = Math.max(a, c), c = Math.min(s, c), c = Math.floor(c), t({ adjustedWidth: Math.min(l, c * i), columnWidth: c, getColumnWidth: function() {
return c;
}, registerChild: this._registerChild });
} }, { key: "_registerChild", value: function(e) {
if (e && typeof e.recomputeGridSize != "function") throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");
this._registeredChild = e, this._registeredChild && this._registeredChild.recomputeGridSize();
} }]);
}().propTypes = {};
var F, xo = A(function o(e) {
var t = e.cellCount, n = e.cellSizeGetter, r = e.estimatedCellSize;
G(this, o), p(this, "_cellSizeAndPositionData", {}), p(this, "_lastMeasuredIndex", -1), p(this, "_lastBatchedIndex", -1), p(this, "_cellCount", void 0), p(this, "_cellSizeGetter", void 0), p(this, "_estimatedCellSize", void 0), this._cellSizeGetter = n, this._cellCount = t, this._estimatedCellSize = r;
}, [{ key: "areOffsetsAdjusted", value: function() {
return !1;
} }, { key: "configure", value: function(o) {
var e = o.cellCount, t = o.estimatedCellSize, n = o.cellSizeGetter;
this._cellCount = e, this._estimatedCellSize = t, this._cellSizeGetter = n;
} }, { key: "getCellCount", value: function() {
return this._cellCount;
} }, { key: "getEstimatedCellSize", value: function() {
return this._estimatedCellSize;
} }, { key: "getLastMeasuredIndex", value: function() {
return this._lastMeasuredIndex;
} }, { key: "getOffsetAdjustment", value: function() {
return 0;
} }, { key: "getSizeAndPositionOfCell", value: function(o) {
if (o < 0 || o >= this._cellCount) throw Error("Requested index ".concat(o, " is outside of range 0..").concat(this._cellCount));
if (o > this._lastMeasuredIndex) for (var e = this.getSizeAndPositionOfLastMeasuredCell(), t = e.offset + e.size, n = this._lastMeasuredIndex + 1; n <= o; n++) {
var r = this._cellSizeGetter({ index: n });
if (r === void 0 || isNaN(r)) throw Error("Invalid size returned for cell ".concat(n, " of value ").concat(r));
r === null ? (this._cellSizeAndPositionData[n] = { offset: t, size: 0 }, this._lastBatchedIndex = o) : (this._cellSizeAndPositionData[n] = { offset: t, size: r }, t += r, this._lastMeasuredIndex = o);
}
return this._cellSizeAndPositionData[o];
} }, { key: "getSizeAndPositionOfLastMeasuredCell", value: function() {
return this._lastMeasuredIndex >= 0 ? this._cellSizeAndPositionData[this._lastMeasuredIndex] : { offset: 0, size: 0 };
} }, { key: "getTotalSize", value: function() {
var o = this.getSizeAndPositionOfLastMeasuredCell();
return o.offset + o.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize;
} }, { key: "getUpdatedOffsetForIndex", value: function(o) {
var e = o.align, t = e === void 0 ? "auto" : e, n = o.containerSize, r = o.currentOffset, i = o.targetIndex;
if (n <= 0) return 0;
var l, a = this.getSizeAndPositionOfCell(i), s = a.offset, c = s - n + a.size;
switch (t) {
case "start":
l = s;
break;
case "end":
l = c;
break;
case "center":
l = s - (n - a.size) / 2;
break;
default:
l = Math.max(c, Math.min(s, r));
}
var d = this.getTotalSize();
return Math.max(0, Math.min(d - n, l));
} }, { key: "getVisibleCellRange", value: function(o) {
var e = o.containerSize, t = o.offset;
if (this.getTotalSize() === 0) return {};
var n = t + e, r = this._findNearestCell(t), i = this.getSizeAndPositionOfCell(r);
t = i.offset + i.size;
for (var l = r; t < n && l < this._cellCount - 1; ) l++, t += this.getSizeAndPositionOfCell(l).size;
return { start: r, stop: l };
} }, { key: "resetCell", value: function(o) {
this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, o - 1);
} }, { key: "_binarySearch", value: function(o, e, t) {
for (; e <= o; ) {
var n = e + Math.floor((o - e) / 2), r = this.getSizeAndPositionOfCell(n).offset;
if (r === t) return n;
r < t ? e = n + 1 : r > t && (o = n - 1);
}
return e > 0 ? e - 1 : 0;
} }, { key: "_exponentialSearch", value: function(o, e) {
for (var t = 1; o < this._cellCount && this.getSizeAndPositionOfCell(o).offset < e; ) o += t, t *= 2;
return this._binarySearch(Math.min(o, this._cellCount - 1), Math.floor(o / 2), e);
} }, { key: "_findNearestCell", value: function(o) {
if (isNaN(o)) throw Error("Invalid offset ".concat(o, " specified"));
o = Math.max(0, o);
var e = this.getSizeAndPositionOfLastMeasuredCell(), t = Math.max(0, this._lastMeasuredIndex);
return e.offset >= o ? this._binarySearch(t, 0, o) : this._exponentialSearch(t, o);
} }]), Ro = ["maxScrollSize"], Ue = A(function o(e) {
var t = e.maxScrollSize, n = t === void 0 ? typeof window < "u" && window.chrome ? 16777100 : 15e5 : t, r = oe(e, Ro);
G(this, o), p(this, "_cellSizeAndPositionManager", void 0), p(this, "_maxScrollSize", void 0), this._cellSizeAndPositionManager = new xo(r), this._maxScrollSize = n;
}, [{ key: "areOffsetsAdjusted", value: function() {
return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
} }, { key: "configure", value: function(o) {
this._cellSizeAndPositionManager.configure(o);
} }, { key: "getCellCount", value: function() {
return this._cellSizeAndPositionManager.getCellCount();
} }, { key: "getEstimatedCellSize", value: function() {
return this._cellSizeAndPositionManager.getEstimatedCellSize();
} }, { key: "getLastMeasuredIndex", value: function() {
return this._cellSizeAndPositionManager.getLastMeasuredIndex();
} }, { key: "getOffsetAdjustment", value: function(o) {
var e = o.containerSize, t = o.offset, n = this._cellSizeAndPositionManager.getTotalSize(), r = this.getTotalSize(), i = this._getOffsetPercentage({ containerSize: e, offset: t, totalSize: r });
return Math.round(i * (r - n));
} }, { key: "getSizeAndPositionOfCell", value: function(o) {
return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(o);
} }, { key: "getSizeAndPositionOfLastMeasuredCell", value: function() {
return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
} }, { key: "getTotalSize", value: function() {
return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
} }, { key: "getUpdatedOffsetForIndex", value: function(o) {
var e = o.align, t = e === void 0 ? "auto" : e, n = o.containerSize, r = o.currentOffset, i = o.targetIndex;
r = this._safeOffsetToOffset({ containerSize: n, offset: r });
var l = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({ align: t, containerSize: n, currentOffset: r, targetIndex: i });
return this._offsetToSafeOffset({ containerSize: n, offset: l });
} }, { key: "getVisibleCellRange", value: function(o) {
var e = o.containerSize, t = o.offset;
return t = this._safeOffsetToOffset({ containerSize: e, offset: t }), this._cellSizeAndPositionManager.getVisibleCellRange({ containerSize: e, offset: t });
} }, { key: "resetCell", value: function(o) {
this._cellSizeAndPositionManager.resetCell(o);
} }, { key: "_getOffsetPercentage", value: function(o) {
var e = o.containerSize, t = o.offset, n = o.totalSize;
return n <= e ? 0 : t / (n - e);
} }, { key: "_offsetToSafeOffset", value: function(o) {
var e = o.containerSize, t = o.offset, n = this._cellSizeAndPositionManager.getTotalSize(), r = this.getTotalSize();
if (n === r) return t;
var i = this._getOffsetPercentage({ containerSize: e, offset: t, totalSize: n });
return Math.round(i * (r - e));
} }, { key: "_safeOffsetToOffset", value: function(o) {
var e = o.containerSize, t = o.offset, n = this._cellSizeAndPositionManager.getTotalSize(), r = this.getTotalSize();
if (n === r) return t;
var i = this._getOffsetPercentage({ containerSize: e, offset: t, totalSize: r });
return Math.round(i * (n - e));
} }]);
function Ve(o) {
var e = o.cellSize, t = o.cellSizeAndPositionManager, n = o.previousCellsCount, r = o.previousCellSize, i = o.previousScrollToAlignment, l = o.previousScrollToIndex, a = o.previousSize, s = o.scrollOffset, c = o.scrollToAlignment, d = o.scrollToIndex, h = o.size, f = o.sizeJustIncreasedFromZero, u = o.updateScrollIndexCallback, _ = t.getCellCount(), g = d >= 0 && d < _;
g && (h !== a || f || !r || typeof e == "number" && e !== r || c !== i || d !== l) ? u(d) : !g && _ > 0 && (h < a || _ < n) && s > t.getTotalSize() - h && u(_ - 1);
}
var bo = (F = typeof window < "u" ? window : typeof self < "u" ? self : {}).requestAnimationFrame || F.webkitRequestAnimationFrame || F.mozRequestAnimationFrame || F.oRequestAnimationFrame || F.msRequestAnimationFrame || function(o) {
return F.setTimeout(o, 1e3 / 60);
}, zo = F.cancelAnimationFrame || F.