import { clamp as e } from "@milaboratories/helpers";
var t = class {
	constructor(e, t, n) {
		this.api = e, this.rowHeight = t, this.resolvePrimaryKey = n;
	}
	get height() {
		return this.rowHeight + 1;
	}
	async getHeight() {
		return await this.api.count() * this.height;
	}
	async getRows(t, n) {
		let r = e(Math.floor(t / this.height), 0, Infinity), i = Math.ceil(n + 40 / this.height);
		return (await this.api.query({
			offset: r,
			limit: i
		})).map((e, t) => ({
			dataRow: e,
			index: r + t,
			primaryKey: this.resolvePrimaryKey(e, r + t),
			offset: (r + t) * (this.rowHeight + 1),
			height: this.rowHeight
		}));
	}
};
export { t as AsyncData };

//# sourceMappingURL=AsyncData.js.map