import e from "short-unique-id";
//#region src/plugins/util/fn.js
var t = () => t.uid.randomUUID();
t.uid = new e({ length: 10 });
var n = async (e, { interval: t = 100, maxWait: n = 2500 } = {}) => new Promise((r, i) => {
	let a = setInterval(async () => {
		await e() && (clearInterval(a), r());
	}, t);
	setTimeout(() => {
		clearInterval(a), i(/* @__PURE__ */ Error("Waited long enough!"));
	}, n);
});
n.MAX_WAIT = 2147483647;
var r = (e) => {
	let t = Date.now();
	return globalThis.setTimeout(() => {
		e({
			didTimeout: !1,
			timeoutRemaining() {
				return Math.max(0, 50 - (Date.now() - t));
			}
		});
	}, 1);
}, i = (e) => globalThis.clearTimeout(e), a = globalThis.requestIdleCallback ? (...e) => globalThis.requestIdleCallback(...e) : r, o = globalThis.cancelIdleCallback ? (...e) => globalThis.cancelIdleCallback(...e) : i, s = (e) => {
	let t = null;
	return (n, r) => (...i) => {
		let a = n(...i);
		return a === t ? a : (e(n, r)(...i), t = a, a);
	};
};
//#endregion
export { n as a, a as i, s as n, t as r, o as t };

//# sourceMappingURL=fn-BbK27qJY.js.map