/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-d4ad2ea | Cube Dev Team */
//#region src/components/overlays/Notifications/dismissed-storage.ts
const STORAGE_KEY = "cube-ui-dismissed-notifications";
const TTL_MS = 864e5;
function readMap() {
	try {
		const raw = localStorage.getItem(STORAGE_KEY);
		if (!raw) return {};
		return JSON.parse(raw);
	} catch {
		return {};
	}
}
function writeMap(map) {
	try {
		localStorage.setItem(STORAGE_KEY, JSON.stringify(map));
	} catch {}
}
function saveDismissedId(id) {
	const map = readMap();
	map[String(id)] = Date.now();
	writeMap(map);
}
/**
* Reads the dismissed-IDs map from localStorage, removes entries older than
* 24 hours, writes the cleaned map back, and returns the remaining valid IDs.
*/
function cleanupAndGetValidIds() {
	const map = readMap();
	const now = Date.now();
	const validIds = /* @__PURE__ */ new Set();
	let changed = false;
	for (const [id, timestamp] of Object.entries(map)) if (now - timestamp > TTL_MS) {
		delete map[id];
		changed = true;
	} else validIds.add(id);
	if (changed) writeMap(map);
	return validIds;
}

//#endregion
export { cleanupAndGetValidIds, saveDismissedId };
//# sourceMappingURL=dismissed-storage.js.map