/**
* Cache for scrub BufferedSeekingInput instances
* Since scrub segments are 30s long, we can reuse the same input for many seeks
* within that time range, making scrub seeking very efficient
*/
var ScrubInputCache = class {
	constructor() {
		this.cache = /* @__PURE__ */ new Map();
		this.maxCacheSize = 5;
	}
	/**
	* Get or create BufferedSeekingInput for a scrub segment
	*/
	async getOrCreateInput(segmentId, createInputFn) {
		const cached = this.cache.get(segmentId);
		if (cached) return cached;
		const input = await createInputFn();
		if (!input) return void 0;
		this.cache.set(segmentId, input);
		if (this.cache.size > this.maxCacheSize) {
			const oldestKey = this.cache.keys().next().value;
			if (oldestKey !== void 0) this.cache.delete(oldestKey);
		}
		return input;
	}
	/**
	* Clear the entire cache (called when video changes)
	*/
	clear() {
		this.cache.clear();
	}
	/**
	* Get cache statistics
	*/
	getStats() {
		return {
			size: this.cache.size,
			segmentIds: Array.from(this.cache.keys())
		};
	}
};
export { ScrubInputCache };
