@cuemath/leap 3.5.41-m-2 → 3.5.41-m-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { useRef as h, useEffect as x, useCallback as i } from "react";
1
+ import { useRef as T, useEffect as x, useCallback as i } from "react";
2
2
  const R = (V, p = !0) => {
3
- const n = h(null), T = h({}), o = h({}), a = h({});
3
+ const n = T(null), h = T({}), o = T({}), s = T({});
4
4
  x(() => {
5
5
  try {
6
6
  const e = window.AudioContext || window.webkitAudioContext;
@@ -22,7 +22,7 @@ const R = (V, p = !0) => {
22
22
  }
23
23
  }, []), A = i(
24
24
  async (e) => {
25
- if (!(!n.current || T.current[e]))
25
+ if (!(!n.current || h.current[e]))
26
26
  try {
27
27
  const t = V[e];
28
28
  if (!t) throw new Error(`No URL found for sound key: ${e}`);
@@ -33,9 +33,9 @@ const R = (V, p = !0) => {
33
33
  if (!r.ok)
34
34
  throw new Error(`HTTP error! status: ${r.status}`);
35
35
  const c = await r.arrayBuffer(), u = await n.current.decodeAudioData(c);
36
- T.current[e] = u;
36
+ h.current[e] = u;
37
37
  } catch (t) {
38
- console.error(`Failed to load sound "${e}":`, t), T.current[e] = null;
38
+ console.error(`Failed to load sound "${e}":`, t), h.current[e] = null;
39
39
  }
40
40
  },
41
41
  [V]
@@ -46,16 +46,16 @@ const R = (V, p = !0) => {
46
46
  }, []), w = i(
47
47
  (e, t, r = 0.5, c = !0) => {
48
48
  if (!n.current) return;
49
- a.current[e] && (clearTimeout(a.current[e]), delete a.current[e]);
49
+ s.current[e] && (clearTimeout(s.current[e]), delete s.current[e]);
50
50
  const u = n.current.currentTime;
51
- t.gainNode.gain.cancelScheduledValues(u), t.gainNode.gain.setValueAtTime(t.gainNode.gain.value, u), t.gainNode.gain.linearRampToValueAtTime(0, u + r), c && (a.current[e] = window.setTimeout(() => {
51
+ t.gainNode.gain.cancelScheduledValues(u), t.gainNode.gain.setValueAtTime(t.gainNode.gain.value, u), t.gainNode.gain.linearRampToValueAtTime(0, u + r), c && (s.current[e] = window.setTimeout(() => {
52
52
  var l;
53
53
  try {
54
54
  t.source.stop();
55
55
  } catch (f) {
56
56
  console.warn("Error stopping sound:", f);
57
57
  }
58
- ((l = o.current[e]) == null ? void 0 : l.source) === t.source && delete o.current[e], delete a.current[e];
58
+ ((l = o.current[e]) == null ? void 0 : l.source) === t.source && delete o.current[e], delete s.current[e];
59
59
  }, r * 1e3));
60
60
  },
61
61
  []
@@ -75,35 +75,41 @@ const R = (V, p = !0) => {
75
75
  });
76
76
  return;
77
77
  }
78
- if (o.current[e] && !r)
79
- return;
78
+ if (o.current[e] && !r) {
79
+ try {
80
+ o.current[e].source.stop();
81
+ } catch (a) {
82
+ console.log(a);
83
+ }
84
+ delete o.current[e];
85
+ }
80
86
  await m(), await A(e);
81
- const f = T.current[e];
87
+ const f = h.current[e];
82
88
  if (!f) {
83
89
  console.warn(`No buffer available for sound: ${e}`);
84
90
  return;
85
91
  }
86
92
  if (o.current[e] && r) {
87
- a.current[e] && (clearTimeout(a.current[e]), delete a.current[e]), g(o.current[e].gainNode, l);
93
+ s.current[e] && (clearTimeout(s.current[e]), delete s.current[e]), g(o.current[e].gainNode, l);
88
94
  return;
89
95
  }
90
96
  if (o.current[e]) {
91
- const s = o.current[e];
97
+ const a = o.current[e];
92
98
  try {
93
- s.source.stop();
99
+ a.source.stop();
94
100
  } catch (d) {
95
101
  console.warn("Error stopping existing sound:", d);
96
102
  }
97
103
  delete o.current[e];
98
104
  }
99
105
  try {
100
- const s = n.current.createBufferSource(), d = n.current.createGain();
101
- s.buffer = f, s.loop = r, s.connect(d).connect(n.current.destination), u ? (d.gain.setValueAtTime(0, n.current.currentTime), g(d, l)) : d.gain.setValueAtTime(c, n.current.currentTime), s.start(), o.current[e] = { source: s, gainNode: d, loop: r }, r || (s.onended = () => {
106
+ const a = n.current.createBufferSource(), d = n.current.createGain();
107
+ a.buffer = f, a.loop = r, a.connect(d).connect(n.current.destination), u ? (d.gain.setValueAtTime(0, n.current.currentTime), g(d, l)) : d.gain.setValueAtTime(c, n.current.currentTime), a.start(), o.current[e] = { source: a, gainNode: d, loop: r }, r || (a.onended = () => {
102
108
  var C;
103
- ((C = o.current[e]) == null ? void 0 : C.source) === s && delete o.current[e];
109
+ ((C = o.current[e]) == null ? void 0 : C.source) === a && delete o.current[e];
104
110
  });
105
- } catch (s) {
106
- console.error(`Failed to play sound "${e}":`, s);
111
+ } catch (a) {
112
+ console.error(`Failed to play sound "${e}":`, a);
107
113
  }
108
114
  },
109
115
  [p, m, A, g]
@@ -117,7 +123,7 @@ const R = (V, p = !0) => {
117
123
  } catch (f) {
118
124
  console.warn("Error stopping sound:", f);
119
125
  }
120
- delete o.current[e], a.current[e] && (clearTimeout(a.current[e]), delete a.current[e]);
126
+ delete o.current[e], s.current[e] && (clearTimeout(s.current[e]), delete s.current[e]);
121
127
  } else
122
128
  w(e, l, u);
123
129
  },
@@ -143,7 +149,7 @@ const R = (V, p = !0) => {
143
149
  [m, g, w]
144
150
  );
145
151
  return x(() => {
146
- const e = a.current;
152
+ const e = s.current;
147
153
  return () => {
148
154
  Object.values(e).forEach((t) => {
149
155
  t && clearTimeout(t);
@@ -1 +1 @@
1
- {"version":3,"file":"use-audio-player.js","sources":["../../../../src/features/hooks/use-audio-player/use-audio-player.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { type IActiveSound, type IAudioConfig, type IAudioOptions } from './use-audio-player-types';\n\ndeclare global {\n interface Window {\n webkitAudioContext?: typeof AudioContext;\n }\n}\n\nexport const useAudioPlayer = (audioConfig: IAudioConfig, canPlayAudio: boolean = true) => {\n const audioContext = useRef<AudioContext | null>(null);\n const bufferCache = useRef<Record<string, AudioBuffer | null>>({});\n const activeSounds = useRef<Partial<Record<string, IActiveSound>>>({});\n const fadeTimeouts = useRef<Partial<Record<string, number>>>({});\n\n useEffect(() => {\n try {\n const AudioContextClass = window.AudioContext || window.webkitAudioContext;\n\n audioContext.current = new AudioContextClass();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to create AudioContext:', error);\n }\n\n return () => {\n if (audioContext.current && audioContext.current.state !== 'closed') {\n audioContext.current.close();\n }\n };\n }, []);\n\n const resumeAudioContext = useCallback(async () => {\n if (audioContext.current?.state === 'suspended') {\n try {\n await audioContext.current.resume();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to resume AudioContext:', error);\n }\n }\n }, []);\n\n const loadSound = useCallback(\n async (key: string): Promise<void> => {\n if (!audioContext.current || bufferCache.current[key]) return;\n\n try {\n const url = audioConfig[key];\n\n if (!url) throw new Error(`No URL found for sound key: ${key}`);\n\n const response = await fetch(url, {\n mode: 'cors',\n credentials: 'omit',\n });\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const audioBuffer = await audioContext.current.decodeAudioData(arrayBuffer);\n\n bufferCache.current[key] = audioBuffer;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Failed to load sound \"${key}\":`, error);\n bufferCache.current[key] = null;\n }\n },\n [audioConfig],\n );\n\n const fadeIn = useCallback((gainNode: GainNode, duration: number = 0.5) => {\n if (!audioContext.current) return;\n\n const now = audioContext.current.currentTime;\n\n gainNode.gain.cancelScheduledValues(now);\n gainNode.gain.setValueAtTime(gainNode.gain.value, now);\n gainNode.gain.linearRampToValueAtTime(1, now + duration);\n }, []);\n\n const fadeOut = useCallback(\n (key: string, sound: IActiveSound, duration: number = 0.5, shouldStop: boolean = true) => {\n if (!audioContext.current) return;\n\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n\n const now = audioContext.current.currentTime;\n\n sound.gainNode.gain.cancelScheduledValues(now);\n sound.gainNode.gain.setValueAtTime(sound.gainNode.gain.value, now);\n sound.gainNode.gain.linearRampToValueAtTime(0, now + duration);\n\n if (shouldStop) {\n fadeTimeouts.current[key] = window.setTimeout(() => {\n try {\n sound.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping sound:', error);\n }\n\n if (activeSounds.current[key]?.source === sound.source) {\n delete activeSounds.current[key];\n }\n delete fadeTimeouts.current[key];\n }, duration * 1000);\n }\n },\n [],\n );\n\n const play = useCallback(\n async (key: string, options: IAudioOptions = {}): Promise<void> => {\n const {\n loop = false,\n volume = 1,\n fadeIn: shouldFadeIn = false,\n fadeDuration = 0.5,\n } = options;\n\n if (!audioContext.current || !canPlayAudio) {\n // eslint-disable-next-line no-console\n console.warn('Cannot play sound:', {\n key,\n hasContext: !!audioContext.current,\n canPlayAudio,\n });\n\n return;\n }\n\n if (activeSounds.current[key] && !loop) {\n return;\n }\n\n await resumeAudioContext();\n await loadSound(key);\n\n const buffer = bufferCache.current[key];\n\n if (!buffer) {\n // eslint-disable-next-line no-console\n console.warn(`No buffer available for sound: ${key}`);\n\n return;\n }\n\n if (activeSounds.current[key] && loop) {\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n fadeIn(activeSounds.current[key]!.gainNode, fadeDuration);\n\n return;\n }\n\n if (activeSounds.current[key]) {\n const existingSound = activeSounds.current[key];\n\n try {\n existingSound!.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping existing sound:', error);\n }\n delete activeSounds.current[key];\n }\n\n try {\n const source = audioContext.current.createBufferSource();\n const gainNode = audioContext.current.createGain();\n\n source.buffer = buffer;\n source.loop = loop;\n source.connect(gainNode).connect(audioContext.current.destination);\n\n if (shouldFadeIn) {\n gainNode.gain.setValueAtTime(0, audioContext.current.currentTime);\n fadeIn(gainNode, fadeDuration);\n } else {\n gainNode.gain.setValueAtTime(volume, audioContext.current.currentTime);\n }\n\n source.start();\n activeSounds.current[key] = { source, gainNode, loop };\n\n if (!loop) {\n source.onended = () => {\n if (activeSounds.current[key]?.source === source) {\n delete activeSounds.current[key];\n }\n };\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Failed to play sound \"${key}\":`, error);\n }\n },\n [canPlayAudio, resumeAudioContext, loadSound, fadeIn],\n );\n\n const stop = useCallback(\n async (\n key: string,\n options: { immediately?: boolean; fadeOut?: boolean; fadeDuration?: number } = {},\n ): Promise<void> => {\n const { immediately = true, fadeOut: shouldFadeOut = false, fadeDuration = 0.5 } = options;\n\n const sound = activeSounds.current[key];\n\n if (!sound) return;\n\n if (immediately && !shouldFadeOut) {\n try {\n sound.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping sound:', error);\n }\n\n delete activeSounds.current[key];\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n } else {\n fadeOut(key, sound, fadeDuration);\n }\n },\n [fadeOut],\n );\n\n const stopAll = useCallback(\n (options: { immediately?: boolean; fadeOut?: boolean } = {}) => {\n const soundKeys = Object.keys(activeSounds.current);\n\n soundKeys.forEach(key => stop(key, options));\n },\n [stop],\n );\n\n const isPlaying = useCallback((key: string): boolean => {\n return !!activeSounds.current[key];\n }, []);\n\n const setVolume = useCallback((key: string, volume: number, duration: number = 0) => {\n const sound = activeSounds.current[key];\n\n if (!sound || !audioContext.current) return;\n\n const now = audioContext.current.currentTime;\n\n if (duration > 0) {\n sound.gainNode.gain.cancelScheduledValues(now);\n sound.gainNode.gain.setValueAtTime(sound.gainNode.gain.value, now);\n sound.gainNode.gain.linearRampToValueAtTime(volume, now + duration);\n } else {\n sound.gainNode.gain.setValueAtTime(volume, now);\n }\n }, []);\n\n const handleVisibilityChange = useCallback(\n (backgroundSounds: Set<string> = new Set(), fadeOnHide: boolean = true) => {\n if (!fadeOnHide) return;\n\n if (document.visibilityState === 'visible') {\n resumeAudioContext();\n Object.values(activeSounds.current).forEach(sound => {\n if (sound) {\n fadeIn(sound.gainNode);\n }\n });\n } else {\n Object.entries(activeSounds.current).forEach(([key, sound]) => {\n if (sound) {\n if (backgroundSounds.has(key)) {\n fadeOut(key, sound, 0.5, false);\n } else {\n fadeOut(key, sound);\n }\n }\n });\n }\n },\n [resumeAudioContext, fadeIn, fadeOut],\n );\n\n useEffect(() => {\n const timeouts = fadeTimeouts.current;\n\n return () => {\n Object.values(timeouts).forEach(id => {\n if (id) clearTimeout(id);\n });\n };\n }, []);\n\n return {\n play,\n stop,\n stopAll,\n isPlaying,\n setVolume,\n handleVisibilityChange,\n loadSound,\n resumeAudioContext,\n };\n};\n"],"names":["useAudioPlayer","audioConfig","canPlayAudio","audioContext","useRef","bufferCache","activeSounds","fadeTimeouts","useEffect","AudioContextClass","error","resumeAudioContext","useCallback","_a","loadSound","key","url","response","arrayBuffer","audioBuffer","fadeIn","gainNode","duration","now","fadeOut","sound","shouldStop","play","options","loop","volume","shouldFadeIn","fadeDuration","buffer","existingSound","source","stop","immediately","shouldFadeOut","stopAll","isPlaying","setVolume","handleVisibilityChange","backgroundSounds","fadeOnHide","timeouts","id"],"mappings":";AAUO,MAAMA,IAAiB,CAACC,GAA2BC,IAAwB,OAAS;AACnF,QAAAC,IAAeC,EAA4B,IAAI,GAC/CC,IAAcD,EAA2C,CAAA,CAAE,GAC3DE,IAAeF,EAA8C,CAAA,CAAE,GAC/DG,IAAeH,EAAwC,CAAA,CAAE;AAE/D,EAAAI,EAAU,MAAM;AACV,QAAA;AACI,YAAAC,IAAoB,OAAO,gBAAgB,OAAO;AAE3C,MAAAN,EAAA,UAAU,IAAIM;aACpBC,GAAO;AAEN,cAAA,KAAK,kCAAkCA,CAAK;AAAA,IACtD;AAEA,WAAO,MAAM;AACX,MAAIP,EAAa,WAAWA,EAAa,QAAQ,UAAU,YACzDA,EAAa,QAAQ;IACvB;AAAA,EAEJ,GAAG,CAAE,CAAA;AAEC,QAAAQ,IAAqBC,EAAY,YAAY;;AAC7C,UAAAC,IAAAV,EAAa,YAAb,gBAAAU,EAAsB,WAAU;AAC9B,UAAA;AACI,c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AECmB,IAAyB9B;AAAA,IAC7B,CAAC+B,IAAgC,oBAAI,OAAOC,IAAsB,OAAS;AACzE,MAAKA,MAED,SAAS,oBAAoB,aACZjC,KACnB,OAAO,OAAOL,EAAa,OAAO,EAAE,QAAQ,CAASmB,MAAA;AACnD,QAAIA,KACFL,EAAOK,EAAM,QAAQ;AAAA,MACvB,CACD,KAEM,OAAA,QAAQnB,EAAa,OAAO,EAAE,QAAQ,CAAC,CAACS,GAAKU,CAAK,MAAM;AAC7D,QAAIA,MACEkB,EAAiB,IAAI5B,CAAG,IAClBS,EAAAT,GAAKU,GAAO,KAAK,EAAK,IAE9BD,EAAQT,GAAKU,CAAK;AAAA,MAEtB,CACD;AAAA,IAEL;AAAA,IACA,CAACd,GAAoBS,GAAQI,CAAO;AAAA,EAAA;AAGtC,SAAAhB,EAAU,MAAM;AACd,UAAMqC,IAAWtC,EAAa;AAE9B,WAAO,MAAM;AACX,aAAO,OAAOsC,CAAQ,EAAE,QAAQ,CAAMC,MAAA;AAChC,QAAAA,kBAAiBA,CAAE;AAAA,MAAA,CACxB;AAAA,IAAA;AAAA,EAEL,GAAG,CAAE,CAAA,GAEE;AAAA,IACL,MAAAnB;AAAA,IACA,MAAAS;AAAA,IACA,SAAAG;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,WAAA5B;AAAA,IACA,oBAAAH;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-audio-player.js","sources":["../../../../src/features/hooks/use-audio-player/use-audio-player.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { type IActiveSound, type IAudioConfig, type IAudioOptions } from './use-audio-player-types';\n\ndeclare global {\n interface Window {\n webkitAudioContext?: typeof AudioContext;\n }\n}\n\nexport const useAudioPlayer = (audioConfig: IAudioConfig, canPlayAudio: boolean = true) => {\n const audioContext = useRef<AudioContext | null>(null);\n const bufferCache = useRef<Record<string, AudioBuffer | null>>({});\n const activeSounds = useRef<Partial<Record<string, IActiveSound>>>({});\n const fadeTimeouts = useRef<Partial<Record<string, number>>>({});\n\n useEffect(() => {\n try {\n const AudioContextClass = window.AudioContext || window.webkitAudioContext;\n\n audioContext.current = new AudioContextClass();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to create AudioContext:', error);\n }\n\n return () => {\n if (audioContext.current && audioContext.current.state !== 'closed') {\n audioContext.current.close();\n }\n };\n }, []);\n\n const resumeAudioContext = useCallback(async () => {\n if (audioContext.current?.state === 'suspended') {\n try {\n await audioContext.current.resume();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to resume AudioContext:', error);\n }\n }\n }, []);\n\n const loadSound = useCallback(\n async (key: string): Promise<void> => {\n if (!audioContext.current || bufferCache.current[key]) return;\n\n try {\n const url = audioConfig[key];\n\n if (!url) throw new Error(`No URL found for sound key: ${key}`);\n\n const response = await fetch(url, {\n mode: 'cors',\n credentials: 'omit',\n });\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n const arrayBuffer = await response.arrayBuffer();\n const audioBuffer = await audioContext.current.decodeAudioData(arrayBuffer);\n\n bufferCache.current[key] = audioBuffer;\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Failed to load sound \"${key}\":`, error);\n bufferCache.current[key] = null;\n }\n },\n [audioConfig],\n );\n\n const fadeIn = useCallback((gainNode: GainNode, duration: number = 0.5) => {\n if (!audioContext.current) return;\n\n const now = audioContext.current.currentTime;\n\n gainNode.gain.cancelScheduledValues(now);\n gainNode.gain.setValueAtTime(gainNode.gain.value, now);\n gainNode.gain.linearRampToValueAtTime(1, now + duration);\n }, []);\n\n const fadeOut = useCallback(\n (key: string, sound: IActiveSound, duration: number = 0.5, shouldStop: boolean = true) => {\n if (!audioContext.current) return;\n\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n\n const now = audioContext.current.currentTime;\n\n sound.gainNode.gain.cancelScheduledValues(now);\n sound.gainNode.gain.setValueAtTime(sound.gainNode.gain.value, now);\n sound.gainNode.gain.linearRampToValueAtTime(0, now + duration);\n\n if (shouldStop) {\n fadeTimeouts.current[key] = window.setTimeout(() => {\n try {\n sound.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping sound:', error);\n }\n\n if (activeSounds.current[key]?.source === sound.source) {\n delete activeSounds.current[key];\n }\n delete fadeTimeouts.current[key];\n }, duration * 1000);\n }\n },\n [],\n );\n\n const play = useCallback(\n async (key: string, options: IAudioOptions = {}): Promise<void> => {\n const {\n loop = false,\n volume = 1,\n fadeIn: shouldFadeIn = false,\n fadeDuration = 0.5,\n } = options;\n\n if (!audioContext.current || !canPlayAudio) {\n // eslint-disable-next-line no-console\n console.warn('Cannot play sound:', {\n key,\n hasContext: !!audioContext.current,\n canPlayAudio,\n });\n\n return;\n }\n\n if (activeSounds.current[key] && !loop) {\n try {\n activeSounds.current[key]!.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.log(error);\n }\n delete activeSounds.current[key];\n }\n\n await resumeAudioContext();\n await loadSound(key);\n\n const buffer = bufferCache.current[key];\n\n if (!buffer) {\n // eslint-disable-next-line no-console\n console.warn(`No buffer available for sound: ${key}`);\n\n return;\n }\n\n if (activeSounds.current[key] && loop) {\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n fadeIn(activeSounds.current[key]!.gainNode, fadeDuration);\n\n return;\n }\n\n if (activeSounds.current[key]) {\n const existingSound = activeSounds.current[key];\n\n try {\n existingSound!.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping existing sound:', error);\n }\n delete activeSounds.current[key];\n }\n\n try {\n const source = audioContext.current.createBufferSource();\n const gainNode = audioContext.current.createGain();\n\n source.buffer = buffer;\n source.loop = loop;\n source.connect(gainNode).connect(audioContext.current.destination);\n\n if (shouldFadeIn) {\n gainNode.gain.setValueAtTime(0, audioContext.current.currentTime);\n fadeIn(gainNode, fadeDuration);\n } else {\n gainNode.gain.setValueAtTime(volume, audioContext.current.currentTime);\n }\n\n source.start();\n activeSounds.current[key] = { source, gainNode, loop };\n\n if (!loop) {\n source.onended = () => {\n if (activeSounds.current[key]?.source === source) {\n delete activeSounds.current[key];\n }\n };\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(`Failed to play sound \"${key}\":`, error);\n }\n },\n [canPlayAudio, resumeAudioContext, loadSound, fadeIn],\n );\n\n const stop = useCallback(\n async (\n key: string,\n options: { immediately?: boolean; fadeOut?: boolean; fadeDuration?: number } = {},\n ): Promise<void> => {\n const { immediately = true, fadeOut: shouldFadeOut = false, fadeDuration = 0.5 } = options;\n\n const sound = activeSounds.current[key];\n\n if (!sound) return;\n\n if (immediately && !shouldFadeOut) {\n try {\n sound.source.stop();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Error stopping sound:', error);\n }\n\n delete activeSounds.current[key];\n if (fadeTimeouts.current[key]) {\n clearTimeout(fadeTimeouts.current[key]);\n delete fadeTimeouts.current[key];\n }\n } else {\n fadeOut(key, sound, fadeDuration);\n }\n },\n [fadeOut],\n );\n\n const stopAll = useCallback(\n (options: { immediately?: boolean; fadeOut?: boolean } = {}) => {\n const soundKeys = Object.keys(activeSounds.current);\n\n soundKeys.forEach(key => stop(key, options));\n },\n [stop],\n );\n\n const isPlaying = useCallback((key: string): boolean => {\n return !!activeSounds.current[key];\n }, []);\n\n const setVolume = useCallback((key: string, volume: number, duration: number = 0) => {\n const sound = activeSounds.current[key];\n\n if (!sound || !audioContext.current) return;\n\n const now = audioContext.current.currentTime;\n\n if (duration > 0) {\n sound.gainNode.gain.cancelScheduledValues(now);\n sound.gainNode.gain.setValueAtTime(sound.gainNode.gain.value, now);\n sound.gainNode.gain.linearRampToValueAtTime(volume, now + duration);\n } else {\n sound.gainNode.gain.setValueAtTime(volume, now);\n }\n }, []);\n\n const handleVisibilityChange = useCallback(\n (backgroundSounds: Set<string> = new Set(), fadeOnHide: boolean = true) => {\n if (!fadeOnHide) return;\n\n if (document.visibilityState === 'visible') {\n resumeAudioContext();\n Object.values(activeSounds.current).forEach(sound => {\n if (sound) {\n fadeIn(sound.gainNode);\n }\n });\n } else {\n Object.entries(activeSounds.current).forEach(([key, sound]) => {\n if (sound) {\n if (backgroundSounds.has(key)) {\n fadeOut(key, sound, 0.5, false);\n } else {\n fadeOut(key, sound);\n }\n }\n });\n }\n },\n [resumeAudioContext, fadeIn, fadeOut],\n );\n\n useEffect(() => {\n const timeouts = fadeTimeouts.current;\n\n return () => {\n Object.values(timeouts).forEach(id => {\n if (id) clearTimeout(id);\n });\n };\n }, []);\n\n return {\n play,\n stop,\n stopAll,\n isPlaying,\n setVolume,\n handleVisibilityChange,\n loadSound,\n resumeAudioContext,\n };\n};\n"],"names":["useAudioPlayer","audioConfig","canPlayAudio","audioContext","useRef","bufferCache","activeSounds","fadeTimeouts","useEffect","AudioContextClass","error","resumeAudioContext","useCallback","_a","loadSound","key","url","response","arrayBuffer","audioBuffer","fadeIn","gainNode","duration","now","fadeOut","sound","shouldStop","play","options","loop","volume","shouldFadeIn","fadeDuration","buffer","existingSound","source","stop","immediately","shouldFadeOut","stopAll","isPlaying","setVolume","handleVisibilityChange","backgroundSounds","fadeOnHide","timeouts","id"],"mappings":";AAUO,MAAMA,IAAiB,CAACC,GAA2BC,IAAwB,OAAS;AACnF,QAAAC,IAAeC,EAA4B,IAAI,GAC/CC,IAAcD,EAA2C,CAAA,CAAE,GAC3DE,IAAeF,EAA8C,CAAA,CAAE,GAC/DG,IAAeH,EAAwC,CAAA,CAAE;AAE/D,EAAAI,EAAU,MAAM;AACV,QAAA;AACI,YAAAC,IAAoB,OAAO,gBAAgB,OAAO;AAE3C,MAAAN,EAAA,UAAU,IAAIM;aACpBC,GAAO;AAEN,cAAA,KAAK,kCAAkCA,CAAK;AAAA,IACtD;AAEA,WAAO,MAAM;AACX,MAAIP,EAA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