import { create } from "zustand";
import { createTeleporter } from "react-teleporter";
//#region src/stores/teleporterStore.ts
const useTeleporterStore = create((set, get) => ({
	teleporterMap: /* @__PURE__ */ new Map(),
	getTeleporter: (targetId = "", location) => {
		const mapCopy = new Map(get().teleporterMap);
		let locationMap = mapCopy.get(targetId);
		if (!locationMap) {
			locationMap = /* @__PURE__ */ new Map();
			mapCopy.set(targetId, locationMap);
		}
		if (!locationMap.has(location)) locationMap.set(location, { teleporter: createTeleporter() });
		const teleporter = locationMap.get(location).teleporter;
		set({ teleporterMap: mapCopy });
		return teleporter;
	},
	getAllTeleporters: () => {
		const result = [];
		const map = get().teleporterMap;
		for (const [targetId, locationMap] of map.entries()) for (const [location, entry] of locationMap.entries()) result.push([
			targetId,
			location,
			entry.teleporter
		]);
		return result;
	}
}));
//#endregion
export { useTeleporterStore };

//# sourceMappingURL=teleporterStore.mjs.map