import { i as defineStore, r as ref, c as computed } from "./vendor-3ab3e533.js"; import { r as router } from "./GenericMountStory.vue2-2bb5633d.js"; const useStoryStore = defineStore("story", () => { const stories = ref([]); function setStories(value) { stories.value = value; } const currentStory = computed(() => stories.value.find((s) => s.id === router.currentRoute.value.params.storyId)); const currentVariant = computed(() => { var _a; return (_a = currentStory.value) == null ? void 0 : _a.variants.find((v) => v.id === router.currentRoute.value.query.variantId); }); const maps = computed(() => { const storyMap = /* @__PURE__ */ new Map(); const variantMap = /* @__PURE__ */ new Map(); for (const story of stories.value) { storyMap.set(story.id, story); for (const variant of story.variants) { variantMap.set(`${story.id}:${variant.id}`, variant); } } return { stories: storyMap, variants: variantMap }; }); function getStoryById(id) { return maps.value.stories.get(id); } function getVariantById(idWithStoryId) { return maps.value.variants.get(idWithStoryId); } return { stories, setStories, currentStory, currentVariant, getStoryById, getVariantById }; }); export { useStoryStore as u };