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EAAM,MAAM,YAC7C,EAAU,OAAQ,EACpB,IAEF,EAAU,OAAQ,EAAI,EAkBtB,QACA,YACA,WACA,MAZa,IACR,EAAM,QAGX,EAAM,MAAM,MAAoB,iBAAP,EAAkB,OAAK,GAChD,EAAU,OAAQ,EAAK,EAQvB,KApBY,IACP,EAAM,QAGX,EAAM,MAAM,KAAmB,iBAAP,EAAkB,OAAK,GAC/C,EAAU,OAAQ,EAAK,EAkB3B,QAES","file":"/npm/@vueuse/sound@2.1.3/dist/index.mjs","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@vueuse/sound@2.1.3/dist/index.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { ref, onMounted, unref, watch } from 'vue-demi';\n\nfunction useSound(url, { volume = 1, playbackRate = 1, soundEnabled = true, interrupt = false, autoplay = false, onload, ...delegated } = {}) {\n  const HowlConstructor = ref(null);\n  const isPlaying = ref(false);\n  const duration = ref(null);\n  const sound = ref(null);\n  function handleLoad(soundId) {\n    if (typeof onload === \"function\") onload.call(this, soundId);\n    duration.value = (duration.value || sound.value?.duration() || 0) * 1e3;\n    if (autoplay === true) {\n      isPlaying.value = true;\n    }\n  }\n  onMounted(async () => {\n    await import('howler');\n    HowlConstructor.value = Howl;\n    sound.value = new HowlConstructor.value({\n      src: unref(url),\n      volume: unref(volume),\n      rate: unref(playbackRate),\n      onload: handleLoad,\n      ...delegated\n    });\n  });\n  watch(\n    () => [unref(url)],\n    () => {\n      if (HowlConstructor.value && HowlConstructor.value && sound && sound.value) {\n        sound.value = new HowlConstructor.value({\n          src: unref(url),\n          volume: unref(volume),\n          rate: unref(playbackRate),\n          onload: handleLoad,\n          ...delegated\n        });\n      }\n    }\n  );\n  watch(\n    () => [unref(volume), unref(playbackRate)],\n    () => {\n      if (sound.value) {\n        sound.value.volume(unref(volume));\n        sound.value.rate(unref(playbackRate));\n      }\n    }\n  );\n  const play = (options) => {\n    if (typeof options === \"undefined\") {\n      options = {};\n    }\n    if (!sound.value || !soundEnabled && !options.forceSoundEnabled) {\n      return;\n    }\n    if (interrupt) {\n      sound.value.stop();\n    }\n    if (options.playbackRate) {\n      sound.value.rate(options.playbackRate);\n    }\n    sound.value.play(options.id);\n    sound.value.once(\"end\", () => {\n      if (sound.value && sound.value && !sound.value.playing()) {\n        isPlaying.value = false;\n      }\n    });\n    isPlaying.value = true;\n  };\n  const stop = (id) => {\n    if (!sound.value) {\n      return;\n    }\n    sound.value.stop(typeof id === \"number\" ? id : void 0);\n    isPlaying.value = false;\n  };\n  const pause = (id) => {\n    if (!sound.value) {\n      return;\n    }\n    sound.value.pause(typeof id === \"number\" ? id : void 0);\n    isPlaying.value = false;\n  };\n  const returnedValue = {\n    play,\n    sound,\n    isPlaying,\n    duration,\n    pause,\n    stop\n  };\n  return returnedValue;\n}\n\nexport { useSound };\n"]}