{"version":3,"file":"PodcastPlaylistInlineList-CPQVsLPj.mjs","names":[],"sources":["../src/components/display/playlist/PodcastPlaylistInlineList.vue","../src/components/display/playlist/PodcastPlaylistInlineList.vue"],"sourcesContent":["<template>\n  <PodcastInlineListTemplate\n    v-if=\"loading || (!loading && 0 !== allPodcasts.length)\"\n    :display-arrow=\"false\"\n    :button-text=\"noMoreButton ? undefined : t('See more')\"\n    :button-plus=\"true\"\n    :title=\"playlist?.title ?? ''\"\n    :href=\"'/main/pub/playlist/' + playlistId\"\n    :podcast-id=\"playlistId\"\n  >\n    <template #list-inline>\n      <ClassicLoading\n        class=\"loading-size\"\n        :loading-text=\"loading ? t('Loading podcasts ...') : undefined\"\n      />\n      <SwiperList\n        v-if=\"!loading\"\n        :list-object=\"allPodcasts\"\n        :size-item-overload=\"sizeItemOverload\"\n      >\n        <template #octopusSlide=\"{ option }\">\n          <PodcastItem\n            class=\"flex-shrink-0 item-phone-margin\"\n            :podcast=\"option\"\n          />\n        </template>\n      </SwiperList>\n    </template>\n  </PodcastInlineListTemplate>\n</template>\n\n<script setup lang=\"ts\">\nimport PodcastInlineListTemplate from \"../podcasts/PodcastInlineListTemplate.vue\";\nimport PodcastItem from \"../podcasts/PodcastItem.vue\";\nimport SwiperList from \"../list/SwiperList.vue\";\nimport ClassicLoading from \"../../form/ClassicLoading.vue\";\nimport { useAuthStore } from \"../../../stores/AuthStore\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { Playlist } from \"@/stores/class/general/playlist\";\nimport { onMounted, Ref, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { playlistApi } from \"../../../api/playlistApi\";\n\n//Props \nconst props = defineProps<{\n  /** ID of the playlist to display */\n  playlistId: number;\n  sizeItemOverload?: number;\n  /** When set to true, disable display of \"see more\" button */\n  noMoreButton?: boolean;\n}>();\n\n//Data \nconst loading = ref(true);\nconst totalCount = ref(0);\nconst playlist: Ref<Playlist | undefined> = ref(undefined);\nconst allPodcasts: Ref<Array<Podcast>> = ref([]);\n\n//Composables\nconst { t } = useI18n();\nconst authStore = useAuthStore();\n\n//Watch\nwatch(()=>props.playlistId, () => {\n  reset();\n  fetchContent();\n});\n\nonMounted(()=>fetchContent())\n\n//Methods\nasync function fetchContent(): Promise<void> {\n  allPodcasts.value.length = 0;\n  loading.value = true;\n\n  // Retrieve both playlist & content at the same time\n  const [playlistData, content] = await Promise.all([\n    playlistApi.get(props.playlistId),\n    playlistApi.getContentFull(props.playlistId)\n  ]);\n\n  // Update data\n  playlist.value = playlistData;\n  allPodcasts.value = content;\n\n  if (\n    !(\n      (undefined !== authStore.authOrgaId &&\n      authStore.authOrgaId === playlist.value?.organisation?.id) ||\n      authStore.isRoleAdmin\n    )\n  ) {\n    allPodcasts.value = allPodcasts.value.filter((p: Podcast | null) => {\n      return (\n        null !== p &&\n        (!p.availability || true === p.availability.visibility)\n      );\n    });\n  }\n  loading.value = false;\n}\nfunction reset(): void {\n  totalCount.value = 0;\n  allPodcasts.value.length = 0;\n}\n</script>\n","<template>\n  <PodcastInlineListTemplate\n    v-if=\"loading || (!loading && 0 !== allPodcasts.length)\"\n    :display-arrow=\"false\"\n    :button-text=\"noMoreButton ? undefined : t('See more')\"\n    :button-plus=\"true\"\n    :title=\"playlist?.title ?? ''\"\n    :href=\"'/main/pub/playlist/' + playlistId\"\n    :podcast-id=\"playlistId\"\n  >\n    <template #list-inline>\n      <ClassicLoading\n        class=\"loading-size\"\n        :loading-text=\"loading ? t('Loading podcasts ...') : undefined\"\n      />\n      <SwiperList\n        v-if=\"!loading\"\n        :list-object=\"allPodcasts\"\n        :size-item-overload=\"sizeItemOverload\"\n      >\n        <template #octopusSlide=\"{ option }\">\n          <PodcastItem\n            class=\"flex-shrink-0 item-phone-margin\"\n            :podcast=\"option\"\n          />\n        </template>\n      </SwiperList>\n    </template>\n  </PodcastInlineListTemplate>\n</template>\n\n<script setup lang=\"ts\">\nimport PodcastInlineListTemplate from \"../podcasts/PodcastInlineListTemplate.vue\";\nimport PodcastItem from \"../podcasts/PodcastItem.vue\";\nimport SwiperList from \"../list/SwiperList.vue\";\nimport ClassicLoading from \"../../form/ClassicLoading.vue\";\nimport { useAuthStore } from \"../../../stores/AuthStore\";\nimport { Podcast } from \"@/stores/class/general/podcast\";\nimport { Playlist } from \"@/stores/class/general/playlist\";\nimport { onMounted, Ref, ref, watch } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport { playlistApi } from \"../../../api/playlistApi\";\n\n//Props \nconst props = defineProps<{\n  /** ID of the playlist to display */\n  playlistId: number;\n  sizeItemOverload?: number;\n  /** When set to true, disable display of \"see more\" button */\n  noMoreButton?: boolean;\n}>();\n\n//Data \nconst loading = ref(true);\nconst totalCount = ref(0);\nconst playlist: Ref<Playlist | undefined> = ref(undefined);\nconst allPodcasts: Ref<Array<Podcast>> = ref([]);\n\n//Composables\nconst { t } = useI18n();\nconst authStore = useAuthStore();\n\n//Watch\nwatch(()=>props.playlistId, () => {\n  reset();\n  fetchContent();\n});\n\nonMounted(()=>fetchContent())\n\n//Methods\nasync function fetchContent(): Promise<void> {\n  allPodcasts.value.length = 0;\n  loading.value = true;\n\n  // Retrieve both playlist & content at the same time\n  const [playlistData, content] = await Promise.all([\n    playlistApi.get(props.playlistId),\n    playlistApi.getContentFull(props.playlistId)\n  ]);\n\n  // Update data\n  playlist.value = playlistData;\n  allPodcasts.value = content;\n\n  if (\n    !(\n      (undefined !== authStore.authOrgaId &&\n      authStore.authOrgaId === playlist.value?.organisation?.id) ||\n      authStore.isRoleAdmin\n    )\n  ) {\n    allPodcasts.value = allPodcasts.value.filter((p: Podcast | null) => {\n      return (\n        null !== p &&\n        (!p.availability || true === p.availability.visibility)\n      );\n    });\n  }\n  loading.value = false;\n}\nfunction reset(): void {\n  totalCount.value = 0;\n  allPodcasts.value.length = 0;\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,MAAM,QAAQ;EASd,MAAM,UAAU,IAAI,IAAI;EAC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