{"version":3,"file":"ChapteringModal-BCPmvaRT.mjs","names":[],"sources":["../src/components/misc/player/chaptering/ChapteringModal.vue","../src/components/misc/player/chaptering/ChapteringModal.vue"],"sourcesContent":["<template>\n  <ClassicModal\n    id-modal=\"chaptering-modal\"\n    :title-modal=\"t('Chaptering')\"\n    @close=\"closePopup\"\n  >\n    <template #body>\n      <div class=\"d-flex flex-column\">\n        <button\n          v-for=\"(chapter, index) in playerStore.playerChapteringPercent\"\n          :key=\"chapter\"\n          class=\"btn d-flex flex-nowrap align-items-center p-2 mt-1 c-hand text-truncate mb-1\"\n          :class=\"actualChapter === index ? 'chapter-selected' : 'border'\"\n          @click=\"goToChapter(index)\"\n        >\n          <div class=\"d-flex align-items-center me-auto\">\n            <WaveformIcon v-if=\"actualChapter === index\" />\n            <div v-else>{{ index + 1 }}</div>\n            <div class=\"ms-2\">{{ \"- \" + chapter.title }}</div>\n          </div>\n          <div>{{ chapter.startDisplay }}</div>\n        </button>\n      </div>\n    </template>\n    <template #footer>\n      <button class=\"btn m-1\" @click=\"closePopup\">\n        {{ t(\"Close\") }}\n      </button>\n    </template>\n  </ClassicModal>\n</template>\n\n<script setup lang=\"ts\">\nimport WaveformIcon from \"vue-material-design-icons/Waveform.vue\";\nimport { usePlayerStore } from \"../../../../stores/PlayerStore\";\nimport ClassicModal from \"../../modal/ClassicModal.vue\";\nimport { onMounted, Ref, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\n\n//Props \ndefineProps({\n  actualChapter: { default: -1, type: Number }\n})\n\n//Emits\nconst emit = defineEmits([\"close\"]);\n\n//Data \nconst audioPlayer : Ref<HTMLAudioElement | null>= ref(null);\n\n//Composables\nconst { t } = useI18n();\nconst playerStore = usePlayerStore();\n\n\nonMounted(()=>{\n  audioPlayer.value = document.querySelector(\"#audio-player\");\n})\n\n//Methods\nfunction closePopup(): void {\n  emit(\"close\");\n}\nfunction goToChapter(index: number) {\n  if (!playerStore.playerChapteringPercent || !audioPlayer.value) {\n    return;\n  }\n  const seekTime =\n  playerStore.playerTotal *\n    (playerStore.playerChapteringPercent[index].startPercent / 100);\n  playerStore.playerUpdateSeekTime(seekTime);\n  if (0 === seekTime) {\n    playerStore.playerUpdateElapsed(0);\n  }\n  audioPlayer.value.currentTime = seekTime;\n}\n</script>\n<style lang=\"scss\">\n\n.octopus-app .chapter-selected {\n  border: var(--octopus-primary) 3px solid;\n}\n</style>\n","<template>\n  <ClassicModal\n    id-modal=\"chaptering-modal\"\n    :title-modal=\"t('Chaptering')\"\n    @close=\"closePopup\"\n  >\n    <template #body>\n      <div class=\"d-flex flex-column\">\n        <button\n          v-for=\"(chapter, index) in playerStore.playerChapteringPercent\"\n          :key=\"chapter\"\n          class=\"btn d-flex flex-nowrap align-items-center p-2 mt-1 c-hand text-truncate mb-1\"\n          :class=\"actualChapter === index ? 'chapter-selected' : 'border'\"\n          @click=\"goToChapter(index)\"\n        >\n          <div class=\"d-flex align-items-center me-auto\">\n            <WaveformIcon v-if=\"actualChapter === index\" />\n            <div v-else>{{ index + 1 }}</div>\n            <div class=\"ms-2\">{{ \"- \" + chapter.title }}</div>\n          </div>\n          <div>{{ chapter.startDisplay }}</div>\n        </button>\n      </div>\n    </template>\n    <template #footer>\n      <button class=\"btn m-1\" @click=\"closePopup\">\n        {{ t(\"Close\") }}\n      </button>\n    </template>\n  </ClassicModal>\n</template>\n\n<script setup lang=\"ts\">\nimport WaveformIcon from \"vue-material-design-icons/Waveform.vue\";\nimport { usePlayerStore } from \"../../../../stores/PlayerStore\";\nimport ClassicModal from \"../../modal/ClassicModal.vue\";\nimport { onMounted, Ref, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\n\n//Props \ndefineProps({\n  actualChapter: { default: -1, type: Number }\n})\n\n//Emits\nconst emit = defineEmits([\"close\"]);\n\n//Data \nconst audioPlayer : Ref<HTMLAudioElement | null>= ref(null);\n\n//Composables\nconst { t } = useI18n();\nconst playerStore = usePlayerStore();\n\n\nonMounted(()=>{\n  audioPlayer.value = document.querySelector(\"#audio-player\");\n})\n\n//Methods\nfunction closePopup(): void {\n  emit(\"close\");\n}\nfunction goToChapter(index: number) {\n  if (!playerStore.playerChapteringPercent || !audioPlayer.value) {\n    return;\n  }\n  const seekTime =\n  playerStore.playerTotal *\n    (playerStore.playerChapteringPercent[index].startPercent / 100);\n  playerStore.playerUpdateSeekTime(seekTime);\n  if (0 === seekTime) {\n    playerStore.playerUpdateElapsed(0);\n  }\n  audioPlayer.value.currentTime = seekTime;\n}\n</script>\n<style lang=\"scss\">\n\n.octopus-app .chapter-selected {\n  border: var(--octopus-primary) 3px solid;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;EA6CA,MAAM,OAAO;EAGb,MAAM,cAA4C,IAAI,IAAI;EAG1D,MAAM,EAAE,MAAM,QAAQ;EACtB,MAAM,cAAc,eAAe;EAGnC,gBAAc;GACZ,YAAY,QAAQ,SAAS,cAAc,eAAe;EAC5D,CAAC;EAGD,SAAS,aAAmB;GAC1B,KAAK,OAAO;EACd;EACA,SAAS,YAAY,OAAe;GAClC,IAAI,CAAC,YAAY,2BAA2B,CAAC,YAAY,OACvD;GAEF,MAAM,WACN,YAAY,eACT,YAAY,wBAAwB,OAAO,eAAe;GAC7D,YAAY,qBAAqB,QAAQ;GACzC,IAAI,MAAM,UACR,YAAY,oBAAoB,CAAC;GAEnC,YAAY,MAAM,cAAc;EAClC;;;;;;;;;;;;;;;;;;;;mBCpEW,OAAM,qBAAoB;;mBAQtB,OAAM,oCAAmC;;mBAGvC,OAAM,OAAM;;qBAjB3B,YA4Be,OAAA,iBAAA;EA3Bb,YAAS;EACR,eAAa,OAAA,EAAC,YAAA;EACd,SAAO,OAAA;;EAEG,MAAI,cAgBP,CAfN,mBAeM,OAfN,YAeM,EAAA,UAAA,IAAA,GAdJ,mBAaS,UAAA,MAAA,WAZoB,OAAA,YAAY,0BAA/B,SAAS,UAAK;uBADxB,mBAaS,UAAA;IAXN,KAAK;IACN,OAAK,eAAA,CAAC,gFACE,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