@famibee/skynovel 2.0.2 → 2.0.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.
Files changed (121) hide show
  1. package/dist/Button.js +36 -34
  2. package/dist/Button.js.map +1 -1
  3. package/dist/CallStack.js +11 -6
  4. package/dist/CallStack.js.map +1 -1
  5. package/dist/CmnInterface.js +13 -11
  6. package/dist/CmnInterface.js.map +1 -1
  7. package/dist/CmnLib.js +58 -56
  8. package/dist/CmnLib.js.map +1 -1
  9. package/dist/Config.js +9 -7
  10. package/dist/Config.js.map +1 -1
  11. package/dist/ConfigBase.js +52 -49
  12. package/dist/ConfigBase.js.map +1 -1
  13. package/dist/DebugMng.js +9 -6
  14. package/dist/DebugMng.js.map +1 -1
  15. package/dist/EventListenerCtn.js +6 -4
  16. package/dist/EventListenerCtn.js.map +1 -1
  17. package/dist/EventMng.js +522 -417
  18. package/dist/EventMng.js.map +1 -1
  19. package/dist/Grammar.js +22 -20
  20. package/dist/Grammar.js.map +1 -1
  21. package/dist/GrpLayer.js +58 -57
  22. package/dist/GrpLayer.js.map +1 -1
  23. package/dist/Layer.js +66 -64
  24. package/dist/Layer.js.map +1 -1
  25. package/dist/LayerMng.js +461 -441
  26. package/dist/LayerMng.js.map +1 -1
  27. package/dist/Main.js +69 -67
  28. package/dist/Main.js.map +1 -1
  29. package/dist/PropParser.js +23 -19
  30. package/dist/PropParser.js.map +1 -1
  31. package/dist/Reading.js +422 -418
  32. package/dist/Reading.js.map +1 -1
  33. package/dist/RubySpliter.js +4 -2
  34. package/dist/RubySpliter.js.map +1 -1
  35. package/dist/ScriptIterator.js +374 -370
  36. package/dist/ScriptIterator.js.map +1 -1
  37. package/dist/SndBuf.js +643 -622
  38. package/dist/SndBuf.js.map +1 -1
  39. package/dist/SoundMng.js +59 -60
  40. package/dist/SoundMng.js.map +1 -1
  41. package/dist/SpritesMng.js +135 -129
  42. package/dist/SpritesMng.js.map +1 -1
  43. package/dist/SysBase.js +985 -950
  44. package/dist/SysBase.js.map +1 -1
  45. package/dist/TxtLayer.js +558 -551
  46. package/dist/TxtLayer.js.map +1 -1
  47. package/dist/Variable.js +47 -45
  48. package/dist/Variable.js.map +1 -1
  49. package/dist/chunk.js +11 -9
  50. package/dist/gamepad.js +396 -660
  51. package/dist/gamepad.js.map +1 -1
  52. package/dist/pixi.js +2631 -2593
  53. package/dist/pixi.js.map +1 -1
  54. package/dist/platform.js +6 -4
  55. package/dist/platform.js.map +1 -1
  56. package/dist/rolldown-runtime.js +20 -0
  57. package/dist/web.js +418 -418
  58. package/dist/web.js.map +1 -1
  59. package/dist_app/Button.js +36 -34
  60. package/dist_app/Button.js.map +1 -1
  61. package/dist_app/CallStack.js +11 -6
  62. package/dist_app/CallStack.js.map +1 -1
  63. package/dist_app/CmnInterface.js +13 -11
  64. package/dist_app/CmnInterface.js.map +1 -1
  65. package/dist_app/CmnLib.js +58 -56
  66. package/dist_app/CmnLib.js.map +1 -1
  67. package/dist_app/Config.js +9 -7
  68. package/dist_app/Config.js.map +1 -1
  69. package/dist_app/ConfigBase.js +52 -49
  70. package/dist_app/ConfigBase.js.map +1 -1
  71. package/dist_app/DebugMng.js +9 -6
  72. package/dist_app/DebugMng.js.map +1 -1
  73. package/dist_app/EventListenerCtn.js +6 -4
  74. package/dist_app/EventListenerCtn.js.map +1 -1
  75. package/dist_app/EventMng.js +522 -417
  76. package/dist_app/EventMng.js.map +1 -1
  77. package/dist_app/Grammar.js +22 -20
  78. package/dist_app/Grammar.js.map +1 -1
  79. package/dist_app/GrpLayer.js +58 -57
  80. package/dist_app/GrpLayer.js.map +1 -1
  81. package/dist_app/Layer.js +66 -64
  82. package/dist_app/Layer.js.map +1 -1
  83. package/dist_app/LayerMng.js +461 -441
  84. package/dist_app/LayerMng.js.map +1 -1
  85. package/dist_app/Main.js +69 -67
  86. package/dist_app/Main.js.map +1 -1
  87. package/dist_app/PropParser.js +23 -19
  88. package/dist_app/PropParser.js.map +1 -1
  89. package/dist_app/Reading.js +422 -418
  90. package/dist_app/Reading.js.map +1 -1
  91. package/dist_app/RubySpliter.js +4 -2
  92. package/dist_app/RubySpliter.js.map +1 -1
  93. package/dist_app/ScriptIterator.js +374 -370
  94. package/dist_app/ScriptIterator.js.map +1 -1
  95. package/dist_app/SndBuf.js +643 -622
  96. package/dist_app/SndBuf.js.map +1 -1
  97. package/dist_app/SoundMng.js +59 -60
  98. package/dist_app/SoundMng.js.map +1 -1
  99. package/dist_app/SpritesMng.js +135 -129
  100. package/dist_app/SpritesMng.js.map +1 -1
  101. package/dist_app/SysBase.js +985 -950
  102. package/dist_app/SysBase.js.map +1 -1
  103. package/dist_app/TxtLayer.js +558 -551
  104. package/dist_app/TxtLayer.js.map +1 -1
  105. package/dist_app/Variable.js +47 -45
  106. package/dist_app/Variable.js.map +1 -1
  107. package/dist_app/app.js +62 -63
  108. package/dist_app/app.js.map +1 -1
  109. package/dist_app/appMain.js +11 -11
  110. package/dist_app/appMain.js.map +1 -1
  111. package/dist_app/chunk.js +11 -9
  112. package/dist_app/gamepad.js +396 -660
  113. package/dist_app/gamepad.js.map +1 -1
  114. package/dist_app/pixi.js +2028 -1990
  115. package/dist_app/pixi.js.map +1 -1
  116. package/dist_app/platform.js +6 -4
  117. package/dist_app/platform.js.map +1 -1
  118. package/dist_app/preload.js +1 -1
  119. package/dist_app/preload.js.map +1 -1
  120. package/dist_app/rolldown-runtime.js +20 -0
  121. package/package.json +20 -21
package/dist/SndBuf.js CHANGED
@@ -1,663 +1,664 @@
1
- import { t as __commonJSMin } from "./chunk.js";
2
- import { l as argChk_Num, s as argChk_Boolean, t as CmnLib } from "./CmnLib.js";
3
- import { n as SEARCH_PATH_ARG_EXT } from "./ConfigBase.js";
4
- import { t as Reading } from "./Reading.js";
5
- var require_howler = /* @__PURE__ */ __commonJSMin(((e) => {
1
+ import { t as e } from "./rolldown-runtime.js";
2
+ import { l as t, s as n, t as r } from "./CmnLib.js";
3
+ import { n as i } from "./ConfigBase.js";
4
+ import { t as a } from "./Reading.js";
5
+ //#region node_modules/howler/dist/howler.js
6
+ var o = /* @__PURE__ */ e(((e) => {
6
7
  (function() {
7
- var n = function() {
8
+ var t = function() {
8
9
  this.init();
9
10
  };
10
- n.prototype = {
11
+ t.prototype = {
11
12
  init: function() {
12
- var e = this || r;
13
+ var e = this || n;
13
14
  return e._counter = 1e3, e._html5AudioPool = [], e.html5PoolSize = 10, e._codecs = {}, e._howls = [], e._muted = !1, e._volume = 1, e._canPlayEvent = "canplaythrough", e._navigator = typeof window < "u" && window.navigator ? window.navigator : null, e.masterGain = null, e.noAudio = !1, e.usingWebAudio = !0, e.autoSuspend = !0, e.ctx = null, e.autoUnlock = !0, e._setup(), e;
14
15
  },
15
16
  volume: function(e) {
16
- var n = this || r;
17
- if (e = parseFloat(e), n.ctx || d(), e !== void 0 && e >= 0 && e <= 1) {
18
- if (n._volume = e, n._muted) return n;
19
- n.usingWebAudio && n.masterGain.gain.setValueAtTime(e, r.ctx.currentTime);
20
- for (var i = 0; i < n._howls.length; i++) if (!n._howls[i]._webAudio) for (var a = n._howls[i]._getSoundIds(), o = 0; o < a.length; o++) {
21
- var s = n._howls[i]._soundById(a[o]);
22
- s && s._node && (s._node.volume = s._volume * e);
17
+ var t = this || n;
18
+ if (e = parseFloat(e), t.ctx || u(), e !== void 0 && e >= 0 && e <= 1) {
19
+ if (t._volume = e, t._muted) return t;
20
+ t.usingWebAudio && t.masterGain.gain.setValueAtTime(e, n.ctx.currentTime);
21
+ for (var r = 0; r < t._howls.length; r++) if (!t._howls[r]._webAudio) for (var i = t._howls[r]._getSoundIds(), a = 0; a < i.length; a++) {
22
+ var o = t._howls[r]._soundById(i[a]);
23
+ o && o._node && (o._node.volume = o._volume * e);
23
24
  }
24
- return n;
25
+ return t;
25
26
  }
26
- return n._volume;
27
+ return t._volume;
27
28
  },
28
29
  mute: function(e) {
29
- var n = this || r;
30
- n.ctx || d(), n._muted = e, n.usingWebAudio && n.masterGain.gain.setValueAtTime(e ? 0 : n._volume, r.ctx.currentTime);
31
- for (var i = 0; i < n._howls.length; i++) if (!n._howls[i]._webAudio) for (var a = n._howls[i]._getSoundIds(), o = 0; o < a.length; o++) {
32
- var s = n._howls[i]._soundById(a[o]);
33
- s && s._node && (s._node.muted = e ? !0 : s._muted);
30
+ var t = this || n;
31
+ t.ctx || u(), t._muted = e, t.usingWebAudio && t.masterGain.gain.setValueAtTime(e ? 0 : t._volume, n.ctx.currentTime);
32
+ for (var r = 0; r < t._howls.length; r++) if (!t._howls[r]._webAudio) for (var i = t._howls[r]._getSoundIds(), a = 0; a < i.length; a++) {
33
+ var o = t._howls[r]._soundById(i[a]);
34
+ o && o._node && (o._node.muted = e ? !0 : o._muted);
34
35
  }
35
- return n;
36
+ return t;
36
37
  },
37
38
  stop: function() {
38
- for (var e = this || r, n = 0; n < e._howls.length; n++) e._howls[n].stop();
39
+ for (var e = this || n, t = 0; t < e._howls.length; t++) e._howls[t].stop();
39
40
  return e;
40
41
  },
41
42
  unload: function() {
42
- for (var e = this || r, n = e._howls.length - 1; n >= 0; n--) e._howls[n].unload();
43
- return e.usingWebAudio && e.ctx && e.ctx.close !== void 0 && (e.ctx.close(), e.ctx = null, d()), e;
43
+ for (var e = this || n, t = e._howls.length - 1; t >= 0; t--) e._howls[t].unload();
44
+ return e.usingWebAudio && e.ctx && e.ctx.close !== void 0 && (e.ctx.close(), e.ctx = null, u()), e;
44
45
  },
45
46
  codecs: function(e) {
46
- return (this || r)._codecs[e.replace(/^x-/, "")];
47
+ return (this || n)._codecs[e.replace(/^x-/, "")];
47
48
  },
48
49
  _setup: function() {
49
- var e = this || r;
50
+ var e = this || n;
50
51
  if (e.state = e.ctx && e.ctx.state || "suspended", e._autoSuspend(), !e.usingWebAudio) if (typeof Audio < "u") try {
51
- var n = new Audio();
52
- n.oncanplaythrough === void 0 && (e._canPlayEvent = "canplay");
52
+ var t = new Audio();
53
+ t.oncanplaythrough === void 0 && (e._canPlayEvent = "canplay");
53
54
  } catch {
54
55
  e.noAudio = !0;
55
56
  }
56
57
  else e.noAudio = !0;
57
58
  try {
58
- var n = new Audio();
59
- n.muted && (e.noAudio = !0);
59
+ var t = new Audio();
60
+ t.muted && (e.noAudio = !0);
60
61
  } catch {}
61
62
  return e.noAudio || e._setupCodecs(), e;
62
63
  },
63
64
  _setupCodecs: function() {
64
- var e = this || r, n = null;
65
+ var e = this || n, t = null;
65
66
  try {
66
- n = typeof Audio < "u" ? new Audio() : null;
67
+ t = typeof Audio < "u" ? new Audio() : null;
67
68
  } catch {
68
69
  return e;
69
70
  }
70
- if (!n || typeof n.canPlayType != "function") return e;
71
- var i = n.canPlayType("audio/mpeg;").replace(/^no$/, ""), a = e._navigator ? e._navigator.userAgent : "", o = a.match(/OPR\/(\d+)/g), s = o && parseInt(o[0].split("/")[1], 10) < 33, c = a.indexOf("Safari") !== -1 && a.indexOf("Chrome") === -1, l = a.match(/Version\/(.*?) /), u = c && l && parseInt(l[1], 10) < 15;
71
+ if (!t || typeof t.canPlayType != "function") return e;
72
+ var r = t.canPlayType("audio/mpeg;").replace(/^no$/, ""), i = e._navigator ? e._navigator.userAgent : "", a = i.match(/OPR\/(\d+)/g), o = a && parseInt(a[0].split("/")[1], 10) < 33, s = i.indexOf("Safari") !== -1 && i.indexOf("Chrome") === -1, c = i.match(/Version\/(.*?) /), l = s && c && parseInt(c[1], 10) < 15;
72
73
  return e._codecs = {
73
- mp3: !!(!s && (i || n.canPlayType("audio/mp3;").replace(/^no$/, ""))),
74
- mpeg: !!i,
75
- opus: !!n.canPlayType("audio/ogg; codecs=\"opus\"").replace(/^no$/, ""),
76
- ogg: !!n.canPlayType("audio/ogg; codecs=\"vorbis\"").replace(/^no$/, ""),
77
- oga: !!n.canPlayType("audio/ogg; codecs=\"vorbis\"").replace(/^no$/, ""),
78
- wav: !!(n.canPlayType("audio/wav; codecs=\"1\"") || n.canPlayType("audio/wav")).replace(/^no$/, ""),
79
- aac: !!n.canPlayType("audio/aac;").replace(/^no$/, ""),
80
- caf: !!n.canPlayType("audio/x-caf;").replace(/^no$/, ""),
81
- m4a: !!(n.canPlayType("audio/x-m4a;") || n.canPlayType("audio/m4a;") || n.canPlayType("audio/aac;")).replace(/^no$/, ""),
82
- m4b: !!(n.canPlayType("audio/x-m4b;") || n.canPlayType("audio/m4b;") || n.canPlayType("audio/aac;")).replace(/^no$/, ""),
83
- mp4: !!(n.canPlayType("audio/x-mp4;") || n.canPlayType("audio/mp4;") || n.canPlayType("audio/aac;")).replace(/^no$/, ""),
84
- weba: !!(!u && n.canPlayType("audio/webm; codecs=\"vorbis\"").replace(/^no$/, "")),
85
- webm: !!(!u && n.canPlayType("audio/webm; codecs=\"vorbis\"").replace(/^no$/, "")),
86
- dolby: !!n.canPlayType("audio/mp4; codecs=\"ec-3\"").replace(/^no$/, ""),
87
- flac: !!(n.canPlayType("audio/x-flac;") || n.canPlayType("audio/flac;")).replace(/^no$/, "")
74
+ mp3: !!(!o && (r || t.canPlayType("audio/mp3;").replace(/^no$/, ""))),
75
+ mpeg: !!r,
76
+ opus: !!t.canPlayType("audio/ogg; codecs=\"opus\"").replace(/^no$/, ""),
77
+ ogg: !!t.canPlayType("audio/ogg; codecs=\"vorbis\"").replace(/^no$/, ""),
78
+ oga: !!t.canPlayType("audio/ogg; codecs=\"vorbis\"").replace(/^no$/, ""),
79
+ wav: !!(t.canPlayType("audio/wav; codecs=\"1\"") || t.canPlayType("audio/wav")).replace(/^no$/, ""),
80
+ aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""),
81
+ caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""),
82
+ m4a: !!(t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/m4a;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
83
+ m4b: !!(t.canPlayType("audio/x-m4b;") || t.canPlayType("audio/m4b;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
84
+ mp4: !!(t.canPlayType("audio/x-mp4;") || t.canPlayType("audio/mp4;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""),
85
+ weba: !!(!l && t.canPlayType("audio/webm; codecs=\"vorbis\"").replace(/^no$/, "")),
86
+ webm: !!(!l && t.canPlayType("audio/webm; codecs=\"vorbis\"").replace(/^no$/, "")),
87
+ dolby: !!t.canPlayType("audio/mp4; codecs=\"ec-3\"").replace(/^no$/, ""),
88
+ flac: !!(t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;")).replace(/^no$/, "")
88
89
  }, e;
89
90
  },
90
91
  _unlockAudio: function() {
91
- var e = this || r;
92
+ var e = this || n;
92
93
  if (!(e._audioUnlocked || !e.ctx)) {
93
94
  e._audioUnlocked = !1, e.autoUnlock = !1, !e._mobileUnloaded && e.ctx.sampleRate !== 44100 && (e._mobileUnloaded = !0, e.unload()), e._scratchBuffer = e.ctx.createBuffer(1, 1, 22050);
94
- var n = function(r) {
95
+ var t = function(n) {
95
96
  for (; e._html5AudioPool.length < e.html5PoolSize;) try {
96
- var i = new Audio();
97
- i._unlocked = !0, e._releaseHtml5Audio(i);
97
+ var r = new Audio();
98
+ r._unlocked = !0, e._releaseHtml5Audio(r);
98
99
  } catch {
99
100
  e.noAudio = !0;
100
101
  break;
101
102
  }
102
- for (var a = 0; a < e._howls.length; a++) if (!e._howls[a]._webAudio) for (var o = e._howls[a]._getSoundIds(), s = 0; s < o.length; s++) {
103
- var c = e._howls[a]._soundById(o[s]);
104
- c && c._node && !c._node._unlocked && (c._node._unlocked = !0, c._node.load());
103
+ for (var i = 0; i < e._howls.length; i++) if (!e._howls[i]._webAudio) for (var a = e._howls[i]._getSoundIds(), o = 0; o < a.length; o++) {
104
+ var s = e._howls[i]._soundById(a[o]);
105
+ s && s._node && !s._node._unlocked && (s._node._unlocked = !0, s._node.load());
105
106
  }
106
107
  e._autoResume();
107
- var l = e.ctx.createBufferSource();
108
- l.buffer = e._scratchBuffer, l.connect(e.ctx.destination), l.start === void 0 ? l.noteOn(0) : l.start(0), typeof e.ctx.resume == "function" && e.ctx.resume(), l.onended = function() {
109
- l.disconnect(0), e._audioUnlocked = !0, document.removeEventListener("touchstart", n, !0), document.removeEventListener("touchend", n, !0), document.removeEventListener("click", n, !0), document.removeEventListener("keydown", n, !0);
110
- for (var r = 0; r < e._howls.length; r++) e._howls[r]._emit("unlock");
108
+ var c = e.ctx.createBufferSource();
109
+ c.buffer = e._scratchBuffer, c.connect(e.ctx.destination), c.start === void 0 ? c.noteOn(0) : c.start(0), typeof e.ctx.resume == "function" && e.ctx.resume(), c.onended = function() {
110
+ c.disconnect(0), e._audioUnlocked = !0, document.removeEventListener("touchstart", t, !0), document.removeEventListener("touchend", t, !0), document.removeEventListener("click", t, !0), document.removeEventListener("keydown", t, !0);
111
+ for (var n = 0; n < e._howls.length; n++) e._howls[n]._emit("unlock");
111
112
  };
112
113
  };
113
- return document.addEventListener("touchstart", n, !0), document.addEventListener("touchend", n, !0), document.addEventListener("click", n, !0), document.addEventListener("keydown", n, !0), e;
114
+ return document.addEventListener("touchstart", t, !0), document.addEventListener("touchend", t, !0), document.addEventListener("click", t, !0), document.addEventListener("keydown", t, !0), e;
114
115
  }
115
116
  },
116
117
  _obtainHtml5Audio: function() {
117
- var e = this || r;
118
+ var e = this || n;
118
119
  if (e._html5AudioPool.length) return e._html5AudioPool.pop();
119
- var n = new Audio().play();
120
- return n && typeof Promise < "u" && (n instanceof Promise || typeof n.then == "function") && n.catch(function() {
120
+ var t = new Audio().play();
121
+ return t && typeof Promise < "u" && (t instanceof Promise || typeof t.then == "function") && t.catch(function() {
121
122
  console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.");
122
123
  }), new Audio();
123
124
  },
124
125
  _releaseHtml5Audio: function(e) {
125
- var n = this || r;
126
- return e._unlocked && n._html5AudioPool.push(e), n;
126
+ var t = this || n;
127
+ return e._unlocked && t._html5AudioPool.push(e), t;
127
128
  },
128
129
  _autoSuspend: function() {
129
130
  var e = this;
130
- if (!(!e.autoSuspend || !e.ctx || e.ctx.suspend === void 0 || !r.usingWebAudio)) {
131
- for (var n = 0; n < e._howls.length; n++) if (e._howls[n]._webAudio) {
132
- for (var i = 0; i < e._howls[n]._sounds.length; i++) if (!e._howls[n]._sounds[i]._paused) return e;
131
+ if (!(!e.autoSuspend || !e.ctx || e.ctx.suspend === void 0 || !n.usingWebAudio)) {
132
+ for (var t = 0; t < e._howls.length; t++) if (e._howls[t]._webAudio) {
133
+ for (var r = 0; r < e._howls[t]._sounds.length; r++) if (!e._howls[t]._sounds[r]._paused) return e;
133
134
  }
134
135
  return e._suspendTimer && clearTimeout(e._suspendTimer), e._suspendTimer = setTimeout(function() {
135
136
  if (e.autoSuspend) {
136
137
  e._suspendTimer = null, e.state = "suspending";
137
- var n = function() {
138
+ var t = function() {
138
139
  e.state = "suspended", e._resumeAfterSuspend && (delete e._resumeAfterSuspend, e._autoResume());
139
140
  };
140
- e.ctx.suspend().then(n, n);
141
+ e.ctx.suspend().then(t, t);
141
142
  }
142
143
  }, 3e4), e;
143
144
  }
144
145
  },
145
146
  _autoResume: function() {
146
147
  var e = this;
147
- if (!(!e.ctx || e.ctx.resume === void 0 || !r.usingWebAudio)) return e.state === "running" && e.ctx.state !== "interrupted" && e._suspendTimer ? (clearTimeout(e._suspendTimer), e._suspendTimer = null) : e.state === "suspended" || e.state === "running" && e.ctx.state === "interrupted" ? (e.ctx.resume().then(function() {
148
+ if (!(!e.ctx || e.ctx.resume === void 0 || !n.usingWebAudio)) return e.state === "running" && e.ctx.state !== "interrupted" && e._suspendTimer ? (clearTimeout(e._suspendTimer), e._suspendTimer = null) : e.state === "suspended" || e.state === "running" && e.ctx.state === "interrupted" ? (e.ctx.resume().then(function() {
148
149
  e.state = "running";
149
- for (var n = 0; n < e._howls.length; n++) e._howls[n]._emit("resume");
150
+ for (var t = 0; t < e._howls.length; t++) e._howls[t]._emit("resume");
150
151
  }), e._suspendTimer &&= (clearTimeout(e._suspendTimer), null)) : e.state === "suspending" && (e._resumeAfterSuspend = !0), e;
151
152
  }
152
153
  };
153
- var r = new n(), i = function(e) {
154
- var n = this;
154
+ var n = new t(), r = function(e) {
155
+ var t = this;
155
156
  if (!e.src || e.src.length === 0) {
156
157
  console.error("An array of source files must be passed with any new Howl.");
157
158
  return;
158
159
  }
159
- n.init(e);
160
+ t.init(e);
160
161
  };
161
- i.prototype = {
162
+ r.prototype = {
162
163
  init: function(e) {
163
- var n = this;
164
- return r.ctx || d(), n._autoplay = e.autoplay || !1, n._format = typeof e.format == "string" ? [e.format] : e.format, n._html5 = e.html5 || !1, n._muted = e.mute || !1, n._loop = e.loop || !1, n._pool = e.pool || 5, n._preload = typeof e.preload == "boolean" || e.preload === "metadata" ? e.preload : !0, n._rate = e.rate || 1, n._sprite = e.sprite || {}, n._src = typeof e.src == "string" ? [e.src] : e.src, n._volume = e.volume === void 0 ? 1 : e.volume, n._xhr = {
164
+ var t = this;
165
+ return n.ctx || u(), t._autoplay = e.autoplay || !1, t._format = typeof e.format == "string" ? [e.format] : e.format, t._html5 = e.html5 || !1, t._muted = e.mute || !1, t._loop = e.loop || !1, t._pool = e.pool || 5, t._preload = typeof e.preload == "boolean" || e.preload === "metadata" ? e.preload : !0, t._rate = e.rate || 1, t._sprite = e.sprite || {}, t._src = typeof e.src == "string" ? [e.src] : e.src, t._volume = e.volume === void 0 ? 1 : e.volume, t._xhr = {
165
166
  method: e.xhr && e.xhr.method ? e.xhr.method : "GET",
166
167
  headers: e.xhr && e.xhr.headers ? e.xhr.headers : null,
167
168
  withCredentials: e.xhr && e.xhr.withCredentials ? e.xhr.withCredentials : !1
168
- }, n._duration = 0, n._state = "unloaded", n._sounds = [], n._endTimers = {}, n._queue = [], n._playLock = !1, n._onend = e.onend ? [{ fn: e.onend }] : [], n._onfade = e.onfade ? [{ fn: e.onfade }] : [], n._onload = e.onload ? [{ fn: e.onload }] : [], n._onloaderror = e.onloaderror ? [{ fn: e.onloaderror }] : [], n._onplayerror = e.onplayerror ? [{ fn: e.onplayerror }] : [], n._onpause = e.onpause ? [{ fn: e.onpause }] : [], n._onplay = e.onplay ? [{ fn: e.onplay }] : [], n._onstop = e.onstop ? [{ fn: e.onstop }] : [], n._onmute = e.onmute ? [{ fn: e.onmute }] : [], n._onvolume = e.onvolume ? [{ fn: e.onvolume }] : [], n._onrate = e.onrate ? [{ fn: e.onrate }] : [], n._onseek = e.onseek ? [{ fn: e.onseek }] : [], n._onunlock = e.onunlock ? [{ fn: e.onunlock }] : [], n._onresume = [], n._webAudio = r.usingWebAudio && !n._html5, r.ctx !== void 0 && r.ctx && r.autoUnlock && r._unlockAudio(), r._howls.push(n), n._autoplay && n._queue.push({
169
+ }, t._duration = 0, t._state = "unloaded", t._sounds = [], t._endTimers = {}, t._queue = [], t._playLock = !1, t._onend = e.onend ? [{ fn: e.onend }] : [], t._onfade = e.onfade ? [{ fn: e.onfade }] : [], t._onload = e.onload ? [{ fn: e.onload }] : [], t._onloaderror = e.onloaderror ? [{ fn: e.onloaderror }] : [], t._onplayerror = e.onplayerror ? [{ fn: e.onplayerror }] : [], t._onpause = e.onpause ? [{ fn: e.onpause }] : [], t._onplay = e.onplay ? [{ fn: e.onplay }] : [], t._onstop = e.onstop ? [{ fn: e.onstop }] : [], t._onmute = e.onmute ? [{ fn: e.onmute }] : [], t._onvolume = e.onvolume ? [{ fn: e.onvolume }] : [], t._onrate = e.onrate ? [{ fn: e.onrate }] : [], t._onseek = e.onseek ? [{ fn: e.onseek }] : [], t._onunlock = e.onunlock ? [{ fn: e.onunlock }] : [], t._onresume = [], t._webAudio = n.usingWebAudio && !t._html5, n.ctx !== void 0 && n.ctx && n.autoUnlock && n._unlockAudio(), n._howls.push(t), t._autoplay && t._queue.push({
169
170
  event: "play",
170
171
  action: function() {
171
- n.play();
172
+ t.play();
172
173
  }
173
- }), n._preload && n._preload !== "none" && n.load(), n;
174
+ }), t._preload && t._preload !== "none" && t.load(), t;
174
175
  },
175
176
  load: function() {
176
- var e = this, n = null;
177
- if (r.noAudio) {
177
+ var e = this, t = null;
178
+ if (n.noAudio) {
178
179
  e._emit("loaderror", null, "No audio support.");
179
180
  return;
180
181
  }
181
182
  typeof e._src == "string" && (e._src = [e._src]);
182
- for (var i = 0; i < e._src.length; i++) {
183
- var o, c;
184
- if (e._format && e._format[i]) o = e._format[i];
183
+ for (var r = 0; r < e._src.length; r++) {
184
+ var a, s;
185
+ if (e._format && e._format[r]) a = e._format[r];
185
186
  else {
186
- if (c = e._src[i], typeof c != "string") {
187
+ if (s = e._src[r], typeof s != "string") {
187
188
  e._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
188
189
  continue;
189
190
  }
190
- o = /^data:audio\/([^;,]+);/i.exec(c), o ||= /\.([^.]+)$/.exec(c.split("?", 1)[0]), o &&= o[1].toLowerCase();
191
+ a = /^data:audio\/([^;,]+);/i.exec(s), a ||= /\.([^.]+)$/.exec(s.split("?", 1)[0]), a &&= a[1].toLowerCase();
191
192
  }
192
- if (o || console.warn("No file extension was found. Consider using the \"format\" property or specify an extension."), o && r.codecs(o)) {
193
- n = e._src[i];
193
+ if (a || console.warn("No file extension was found. Consider using the \"format\" property or specify an extension."), a && n.codecs(a)) {
194
+ t = e._src[r];
194
195
  break;
195
196
  }
196
197
  }
197
- if (!n) {
198
+ if (!t) {
198
199
  e._emit("loaderror", null, "No codec support for selected audio sources.");
199
200
  return;
200
201
  }
201
- return e._src = n, e._state = "loading", window.location.protocol === "https:" && n.slice(0, 5) === "http:" && (e._html5 = !0, e._webAudio = !1), new a(e), e._webAudio && s(e), e;
202
+ return e._src = t, e._state = "loading", window.location.protocol === "https:" && t.slice(0, 5) === "http:" && (e._html5 = !0, e._webAudio = !1), new i(e), e._webAudio && o(e), e;
202
203
  },
203
- play: function(e, n) {
204
- var i = this, a = null;
205
- if (typeof e == "number") a = e, e = null;
206
- else if (typeof e == "string" && i._state === "loaded" && !i._sprite[e]) return null;
207
- else if (e === void 0 && (e = "__default", !i._playLock)) {
208
- for (var o = 0, s = 0; s < i._sounds.length; s++) i._sounds[s]._paused && !i._sounds[s]._ended && (o++, a = i._sounds[s]._id);
209
- o === 1 ? e = null : a = null;
204
+ play: function(e, t) {
205
+ var r = this, i = null;
206
+ if (typeof e == "number") i = e, e = null;
207
+ else if (typeof e == "string" && r._state === "loaded" && !r._sprite[e]) return null;
208
+ else if (e === void 0 && (e = "__default", !r._playLock)) {
209
+ for (var a = 0, o = 0; o < r._sounds.length; o++) r._sounds[o]._paused && !r._sounds[o]._ended && (a++, i = r._sounds[o]._id);
210
+ a === 1 ? e = null : i = null;
210
211
  }
211
- var c = a ? i._soundById(a) : i._inactiveSound();
212
- if (!c) return null;
213
- if (a && !e && (e = c._sprite || "__default"), i._state !== "loaded") {
214
- c._sprite = e, c._ended = !1;
215
- var l = c._id;
216
- return i._queue.push({
212
+ var s = i ? r._soundById(i) : r._inactiveSound();
213
+ if (!s) return null;
214
+ if (i && !e && (e = s._sprite || "__default"), r._state !== "loaded") {
215
+ s._sprite = e, s._ended = !1;
216
+ var c = s._id;
217
+ return r._queue.push({
217
218
  event: "play",
218
219
  action: function() {
219
- i.play(l);
220
+ r.play(c);
220
221
  }
221
- }), l;
222
+ }), c;
222
223
  }
223
- if (a && !c._paused) return n || i._loadQueue("play"), c._id;
224
- i._webAudio && r._autoResume();
225
- var u = Math.max(0, c._seek > 0 ? c._seek : i._sprite[e][0] / 1e3), d = Math.max(0, (i._sprite[e][0] + i._sprite[e][1]) / 1e3 - u), f = d * 1e3 / Math.abs(c._rate), p = i._sprite[e][0] / 1e3, m = (i._sprite[e][0] + i._sprite[e][1]) / 1e3;
226
- c._sprite = e, c._ended = !1;
227
- var h = function() {
228
- c._paused = !1, c._seek = u, c._start = p, c._stop = m, c._loop = !!(c._loop || i._sprite[e][2]);
224
+ if (i && !s._paused) return t || r._loadQueue("play"), s._id;
225
+ r._webAudio && n._autoResume();
226
+ var l = Math.max(0, s._seek > 0 ? s._seek : r._sprite[e][0] / 1e3), u = Math.max(0, (r._sprite[e][0] + r._sprite[e][1]) / 1e3 - l), d = u * 1e3 / Math.abs(s._rate), f = r._sprite[e][0] / 1e3, p = (r._sprite[e][0] + r._sprite[e][1]) / 1e3;
227
+ s._sprite = e, s._ended = !1;
228
+ var m = function() {
229
+ s._paused = !1, s._seek = l, s._start = f, s._stop = p, s._loop = !!(s._loop || r._sprite[e][2]);
229
230
  };
230
- if (u >= m) {
231
- i._ended(c);
231
+ if (l >= p) {
232
+ r._ended(s);
232
233
  return;
233
234
  }
234
- var g = c._node;
235
- if (i._webAudio) {
236
- var _ = function() {
237
- i._playLock = !1, h(), i._refreshBuffer(c);
238
- var e = c._muted || i._muted ? 0 : c._volume;
239
- g.gain.setValueAtTime(e, r.ctx.currentTime), c._playStart = r.ctx.currentTime, g.bufferSource.start === void 0 ? c._loop ? g.bufferSource.noteGrainOn(0, u, 86400) : g.bufferSource.noteGrainOn(0, u, d) : c._loop ? g.bufferSource.start(0, u, 86400) : g.bufferSource.start(0, u, d), f !== Infinity && (i._endTimers[c._id] = setTimeout(i._ended.bind(i, c), f)), n || setTimeout(function() {
240
- i._emit("play", c._id), i._loadQueue();
235
+ var h = s._node;
236
+ if (r._webAudio) {
237
+ var g = function() {
238
+ r._playLock = !1, m(), r._refreshBuffer(s);
239
+ var e = s._muted || r._muted ? 0 : s._volume;
240
+ h.gain.setValueAtTime(e, n.ctx.currentTime), s._playStart = n.ctx.currentTime, h.bufferSource.start === void 0 ? s._loop ? h.bufferSource.noteGrainOn(0, l, 86400) : h.bufferSource.noteGrainOn(0, l, u) : s._loop ? h.bufferSource.start(0, l, 86400) : h.bufferSource.start(0, l, u), d !== Infinity && (r._endTimers[s._id] = setTimeout(r._ended.bind(r, s), d)), t || setTimeout(function() {
241
+ r._emit("play", s._id), r._loadQueue();
241
242
  }, 0);
242
243
  };
243
- r.state === "running" && r.ctx.state !== "interrupted" ? _() : (i._playLock = !0, i.once("resume", _), i._clearTimer(c._id));
244
+ n.state === "running" && n.ctx.state !== "interrupted" ? g() : (r._playLock = !0, r.once("resume", g), r._clearTimer(s._id));
244
245
  } else {
245
- var v = function() {
246
- g.currentTime = u, g.muted = c._muted || i._muted || r._muted || g.muted, g.volume = c._volume * r.volume(), g.playbackRate = c._rate;
246
+ var _ = function() {
247
+ h.currentTime = l, h.muted = s._muted || r._muted || n._muted || h.muted, h.volume = s._volume * n.volume(), h.playbackRate = s._rate;
247
248
  try {
248
- var a = g.play();
249
- if (a && typeof Promise < "u" && (a instanceof Promise || typeof a.then == "function") ? (i._playLock = !0, h(), a.then(function() {
250
- i._playLock = !1, g._unlocked = !0, n ? i._loadQueue() : i._emit("play", c._id);
249
+ var i = h.play();
250
+ if (i && typeof Promise < "u" && (i instanceof Promise || typeof i.then == "function") ? (r._playLock = !0, m(), i.then(function() {
251
+ r._playLock = !1, h._unlocked = !0, t ? r._loadQueue() : r._emit("play", s._id);
251
252
  }).catch(function() {
252
- i._playLock = !1, i._emit("playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), c._ended = !0, c._paused = !0;
253
- })) : n || (i._playLock = !1, h(), i._emit("play", c._id)), g.playbackRate = c._rate, g.paused) {
254
- i._emit("playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
253
+ r._playLock = !1, r._emit("playerror", s._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), s._ended = !0, s._paused = !0;
254
+ })) : t || (r._playLock = !1, m(), r._emit("play", s._id)), h.playbackRate = s._rate, h.paused) {
255
+ r._emit("playerror", s._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
255
256
  return;
256
257
  }
257
- e !== "__default" || c._loop ? i._endTimers[c._id] = setTimeout(i._ended.bind(i, c), f) : (i._endTimers[c._id] = function() {
258
- i._ended(c), g.removeEventListener("ended", i._endTimers[c._id], !1);
259
- }, g.addEventListener("ended", i._endTimers[c._id], !1));
258
+ e !== "__default" || s._loop ? r._endTimers[s._id] = setTimeout(r._ended.bind(r, s), d) : (r._endTimers[s._id] = function() {
259
+ r._ended(s), h.removeEventListener("ended", r._endTimers[s._id], !1);
260
+ }, h.addEventListener("ended", r._endTimers[s._id], !1));
260
261
  } catch (e) {
261
- i._emit("playerror", c._id, e);
262
+ r._emit("playerror", s._id, e);
262
263
  }
263
264
  };
264
- g.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (g.src = i._src, g.load());
265
- var y = window && window.ejecta || !g.readyState && r._navigator.isCocoonJS;
266
- if (g.readyState >= 3 || y) v();
265
+ h.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (h.src = r._src, h.load());
266
+ var v = window && window.ejecta || !h.readyState && n._navigator.isCocoonJS;
267
+ if (h.readyState >= 3 || v) _();
267
268
  else {
268
- i._playLock = !0, i._state = "loading";
269
- var b = function() {
270
- i._state = "loaded", v(), g.removeEventListener(r._canPlayEvent, b, !1);
269
+ r._playLock = !0, r._state = "loading";
270
+ var y = function() {
271
+ r._state = "loaded", _(), h.removeEventListener(n._canPlayEvent, y, !1);
271
272
  };
272
- g.addEventListener(r._canPlayEvent, b, !1), i._clearTimer(c._id);
273
+ h.addEventListener(n._canPlayEvent, y, !1), r._clearTimer(s._id);
273
274
  }
274
275
  }
275
- return c._id;
276
+ return s._id;
276
277
  },
277
278
  pause: function(e) {
279
+ var t = this;
280
+ if (t._state !== "loaded" || t._playLock) return t._queue.push({
281
+ event: "pause",
282
+ action: function() {
283
+ t.pause(e);
284
+ }
285
+ }), t;
286
+ for (var n = t._getSoundIds(e), r = 0; r < n.length; r++) {
287
+ t._clearTimer(n[r]);
288
+ var i = t._soundById(n[r]);
289
+ if (i && !i._paused && (i._seek = t.seek(n[r]), i._rateSeek = 0, i._paused = !0, t._stopFade(n[r]), i._node)) if (t._webAudio) {
290
+ if (!i._node.bufferSource) continue;
291
+ i._node.bufferSource.stop === void 0 ? i._node.bufferSource.noteOff(0) : i._node.bufferSource.stop(0), t._cleanBuffer(i._node);
292
+ } else (!isNaN(i._node.duration) || i._node.duration === Infinity) && i._node.pause();
293
+ arguments[1] || t._emit("pause", i ? i._id : null);
294
+ }
295
+ return t;
296
+ },
297
+ stop: function(e, t) {
278
298
  var n = this;
279
299
  if (n._state !== "loaded" || n._playLock) return n._queue.push({
280
- event: "pause",
300
+ event: "stop",
281
301
  action: function() {
282
- n.pause(e);
302
+ n.stop(e);
283
303
  }
284
304
  }), n;
285
305
  for (var r = n._getSoundIds(e), i = 0; i < r.length; i++) {
286
306
  n._clearTimer(r[i]);
287
307
  var a = n._soundById(r[i]);
288
- if (a && !a._paused && (a._seek = n.seek(r[i]), a._rateSeek = 0, a._paused = !0, n._stopFade(r[i]), a._node)) if (n._webAudio) {
289
- if (!a._node.bufferSource) continue;
290
- a._node.bufferSource.stop === void 0 ? a._node.bufferSource.noteOff(0) : a._node.bufferSource.stop(0), n._cleanBuffer(a._node);
291
- } else (!isNaN(a._node.duration) || a._node.duration === Infinity) && a._node.pause();
292
- arguments[1] || n._emit("pause", a ? a._id : null);
308
+ a && (a._seek = a._start || 0, a._rateSeek = 0, a._paused = !0, a._ended = !0, n._stopFade(r[i]), a._node && (n._webAudio ? a._node.bufferSource && (a._node.bufferSource.stop === void 0 ? a._node.bufferSource.noteOff(0) : a._node.bufferSource.stop(0), n._cleanBuffer(a._node)) : (!isNaN(a._node.duration) || a._node.duration === Infinity) && (a._node.currentTime = a._start || 0, a._node.pause(), a._node.duration === Infinity && n._clearSound(a._node))), t || n._emit("stop", a._id));
293
309
  }
294
310
  return n;
295
311
  },
296
- stop: function(e, n) {
312
+ mute: function(e, t) {
297
313
  var r = this;
298
314
  if (r._state !== "loaded" || r._playLock) return r._queue.push({
299
- event: "stop",
315
+ event: "mute",
300
316
  action: function() {
301
- r.stop(e);
317
+ r.mute(e, t);
302
318
  }
303
319
  }), r;
304
- for (var i = r._getSoundIds(e), a = 0; a < i.length; a++) {
305
- r._clearTimer(i[a]);
320
+ if (t === void 0) if (typeof e == "boolean") r._muted = e;
321
+ else return r._muted;
322
+ for (var i = r._getSoundIds(t), a = 0; a < i.length; a++) {
306
323
  var o = r._soundById(i[a]);
307
- o && (o._seek = o._start || 0, o._rateSeek = 0, o._paused = !0, o._ended = !0, r._stopFade(i[a]), o._node && (r._webAudio ? o._node.bufferSource && (o._node.bufferSource.stop === void 0 ? o._node.bufferSource.noteOff(0) : o._node.bufferSource.stop(0), r._cleanBuffer(o._node)) : (!isNaN(o._node.duration) || o._node.duration === Infinity) && (o._node.currentTime = o._start || 0, o._node.pause(), o._node.duration === Infinity && r._clearSound(o._node))), n || r._emit("stop", o._id));
324
+ o && (o._muted = e, o._interval && r._stopFade(o._id), r._webAudio && o._node ? o._node.gain.setValueAtTime(e ? 0 : o._volume, n.ctx.currentTime) : o._node && (o._node.muted = n._muted ? !0 : e), r._emit("mute", o._id));
308
325
  }
309
326
  return r;
310
327
  },
311
- mute: function(e, n) {
312
- var i = this;
313
- if (i._state !== "loaded" || i._playLock) return i._queue.push({
314
- event: "mute",
315
- action: function() {
316
- i.mute(e, n);
317
- }
318
- }), i;
319
- if (n === void 0) if (typeof e == "boolean") i._muted = e;
320
- else return i._muted;
321
- for (var a = i._getSoundIds(n), o = 0; o < a.length; o++) {
322
- var s = i._soundById(a[o]);
323
- s && (s._muted = e, s._interval && i._stopFade(s._id), i._webAudio && s._node ? s._node.gain.setValueAtTime(e ? 0 : s._volume, r.ctx.currentTime) : s._node && (s._node.muted = r._muted ? !0 : e), i._emit("mute", s._id));
324
- }
325
- return i;
326
- },
327
328
  volume: function() {
328
- var e = this, n = arguments, i, a;
329
- if (n.length === 0) return e._volume;
330
- n.length === 1 || n.length === 2 && n[1] === void 0 ? e._getSoundIds().indexOf(n[0]) >= 0 ? a = parseInt(n[0], 10) : i = parseFloat(n[0]) : n.length >= 2 && (i = parseFloat(n[0]), a = parseInt(n[1], 10));
331
- var o;
332
- if (i !== void 0 && i >= 0 && i <= 1) {
329
+ var e = this, t = arguments, r, i;
330
+ if (t.length === 0) return e._volume;
331
+ t.length === 1 || t.length === 2 && t[1] === void 0 ? e._getSoundIds().indexOf(t[0]) >= 0 ? i = parseInt(t[0], 10) : r = parseFloat(t[0]) : t.length >= 2 && (r = parseFloat(t[0]), i = parseInt(t[1], 10));
332
+ var a;
333
+ if (r !== void 0 && r >= 0 && r <= 1) {
333
334
  if (e._state !== "loaded" || e._playLock) return e._queue.push({
334
335
  event: "volume",
335
336
  action: function() {
336
- e.volume.apply(e, n);
337
+ e.volume.apply(e, t);
337
338
  }
338
339
  }), e;
339
- a === void 0 && (e._volume = i), a = e._getSoundIds(a);
340
- for (var s = 0; s < a.length; s++) o = e._soundById(a[s]), o && (o._volume = i, n[2] || e._stopFade(a[s]), e._webAudio && o._node && !o._muted ? o._node.gain.setValueAtTime(i, r.ctx.currentTime) : o._node && !o._muted && (o._node.volume = i * r.volume()), e._emit("volume", o._id));
341
- } else return o = a ? e._soundById(a) : e._sounds[0], o ? o._volume : 0;
340
+ i === void 0 && (e._volume = r), i = e._getSoundIds(i);
341
+ for (var o = 0; o < i.length; o++) a = e._soundById(i[o]), a && (a._volume = r, t[2] || e._stopFade(i[o]), e._webAudio && a._node && !a._muted ? a._node.gain.setValueAtTime(r, n.ctx.currentTime) : a._node && !a._muted && (a._node.volume = r * n.volume()), e._emit("volume", a._id));
342
+ } else return a = i ? e._soundById(i) : e._sounds[0], a ? a._volume : 0;
342
343
  return e;
343
344
  },
344
- fade: function(e, n, i, a) {
345
- var o = this;
346
- if (o._state !== "loaded" || o._playLock) return o._queue.push({
345
+ fade: function(e, t, r, i) {
346
+ var a = this;
347
+ if (a._state !== "loaded" || a._playLock) return a._queue.push({
347
348
  event: "fade",
348
349
  action: function() {
349
- o.fade(e, n, i, a);
350
+ a.fade(e, t, r, i);
350
351
  }
351
- }), o;
352
- e = Math.min(Math.max(0, parseFloat(e)), 1), n = Math.min(Math.max(0, parseFloat(n)), 1), i = parseFloat(i), o.volume(e, a);
353
- for (var s = o._getSoundIds(a), c = 0; c < s.length; c++) {
354
- var l = o._soundById(s[c]);
355
- if (l) {
356
- if (a || o._stopFade(s[c]), o._webAudio && !l._muted) {
357
- var u = r.ctx.currentTime, d = u + i / 1e3;
358
- l._volume = e, l._node.gain.setValueAtTime(e, u), l._node.gain.linearRampToValueAtTime(n, d);
352
+ }), a;
353
+ e = Math.min(Math.max(0, parseFloat(e)), 1), t = Math.min(Math.max(0, parseFloat(t)), 1), r = parseFloat(r), a.volume(e, i);
354
+ for (var o = a._getSoundIds(i), s = 0; s < o.length; s++) {
355
+ var c = a._soundById(o[s]);
356
+ if (c) {
357
+ if (i || a._stopFade(o[s]), a._webAudio && !c._muted) {
358
+ var l = n.ctx.currentTime, u = l + r / 1e3;
359
+ c._volume = e, c._node.gain.setValueAtTime(e, l), c._node.gain.linearRampToValueAtTime(t, u);
359
360
  }
360
- o._startFadeInterval(l, e, n, i, s[c], a === void 0);
361
+ a._startFadeInterval(c, e, t, r, o[s], i === void 0);
361
362
  }
362
363
  }
363
- return o;
364
+ return a;
364
365
  },
365
- _startFadeInterval: function(e, n, r, i, a, o) {
366
- var s = this, c = n, l = r - n, u = Math.abs(l / .01), d = Math.max(4, u > 0 ? i / u : i), f = Date.now();
367
- e._fadeTo = r, e._interval = setInterval(function() {
368
- var a = (Date.now() - f) / i;
369
- f = Date.now(), c += l * a, c = Math.round(c * 100) / 100, c = l < 0 ? Math.max(r, c) : Math.min(r, c), s._webAudio ? e._volume = c : s.volume(c, e._id, !0), o && (s._volume = c), (r < n && c <= r || r > n && c >= r) && (clearInterval(e._interval), e._interval = null, e._fadeTo = null, s.volume(r, e._id), s._emit("fade", e._id));
370
- }, d);
366
+ _startFadeInterval: function(e, t, n, r, i, a) {
367
+ var o = this, s = t, c = n - t, l = Math.abs(c / .01), u = Math.max(4, l > 0 ? r / l : r), d = Date.now();
368
+ e._fadeTo = n, e._interval = setInterval(function() {
369
+ var i = (Date.now() - d) / r;
370
+ d = Date.now(), s += c * i, s = Math.round(s * 100) / 100, s = c < 0 ? Math.max(n, s) : Math.min(n, s), o._webAudio ? e._volume = s : o.volume(s, e._id, !0), a && (o._volume = s), (n < t && s <= n || n > t && s >= n) && (clearInterval(e._interval), e._interval = null, e._fadeTo = null, o.volume(n, e._id), o._emit("fade", e._id));
371
+ }, u);
371
372
  },
372
373
  _stopFade: function(e) {
373
- var n = this, i = n._soundById(e);
374
- return i && i._interval && (n._webAudio && i._node.gain.cancelScheduledValues(r.ctx.currentTime), clearInterval(i._interval), i._interval = null, n.volume(i._fadeTo, e), i._fadeTo = null, n._emit("fade", e)), n;
374
+ var t = this, r = t._soundById(e);
375
+ return r && r._interval && (t._webAudio && r._node.gain.cancelScheduledValues(n.ctx.currentTime), clearInterval(r._interval), r._interval = null, t.volume(r._fadeTo, e), r._fadeTo = null, t._emit("fade", e)), t;
375
376
  },
376
377
  loop: function() {
377
- var e = this, n = arguments, r, i, a;
378
- if (n.length === 0) return e._loop;
379
- if (n.length === 1) if (typeof n[0] == "boolean") r = n[0], e._loop = r;
380
- else return a = e._soundById(parseInt(n[0], 10)), a ? a._loop : !1;
381
- else n.length === 2 && (r = n[0], i = parseInt(n[1], 10));
382
- for (var o = e._getSoundIds(i), s = 0; s < o.length; s++) a = e._soundById(o[s]), a && (a._loop = r, e._webAudio && a._node && a._node.bufferSource && (a._node.bufferSource.loop = r, r && (a._node.bufferSource.loopStart = a._start || 0, a._node.bufferSource.loopEnd = a._stop, e.playing(o[s]) && (e.pause(o[s], !0), e.play(o[s], !0)))));
378
+ var e = this, t = arguments, n, r, i;
379
+ if (t.length === 0) return e._loop;
380
+ if (t.length === 1) if (typeof t[0] == "boolean") n = t[0], e._loop = n;
381
+ else return i = e._soundById(parseInt(t[0], 10)), i ? i._loop : !1;
382
+ else t.length === 2 && (n = t[0], r = parseInt(t[1], 10));
383
+ for (var a = e._getSoundIds(r), o = 0; o < a.length; o++) i = e._soundById(a[o]), i && (i._loop = n, e._webAudio && i._node && i._node.bufferSource && (i._node.bufferSource.loop = n, n && (i._node.bufferSource.loopStart = i._start || 0, i._node.bufferSource.loopEnd = i._stop, e.playing(a[o]) && (e.pause(a[o], !0), e.play(a[o], !0)))));
383
384
  return e;
384
385
  },
385
386
  rate: function() {
386
- var e = this, n = arguments, i, a;
387
- n.length === 0 ? a = e._sounds[0]._id : n.length === 1 ? e._getSoundIds().indexOf(n[0]) >= 0 ? a = parseInt(n[0], 10) : i = parseFloat(n[0]) : n.length === 2 && (i = parseFloat(n[0]), a = parseInt(n[1], 10));
388
- var o;
389
- if (typeof i == "number") {
387
+ var e = this, t = arguments, r, i;
388
+ t.length === 0 ? i = e._sounds[0]._id : t.length === 1 ? e._getSoundIds().indexOf(t[0]) >= 0 ? i = parseInt(t[0], 10) : r = parseFloat(t[0]) : t.length === 2 && (r = parseFloat(t[0]), i = parseInt(t[1], 10));
389
+ var a;
390
+ if (typeof r == "number") {
390
391
  if (e._state !== "loaded" || e._playLock) return e._queue.push({
391
392
  event: "rate",
392
393
  action: function() {
393
- e.rate.apply(e, n);
394
+ e.rate.apply(e, t);
394
395
  }
395
396
  }), e;
396
- a === void 0 && (e._rate = i), a = e._getSoundIds(a);
397
- for (var s = 0; s < a.length; s++) if (o = e._soundById(a[s]), o) {
398
- e.playing(a[s]) && (o._rateSeek = e.seek(a[s]), o._playStart = e._webAudio ? r.ctx.currentTime : o._playStart), o._rate = i, e._webAudio && o._node && o._node.bufferSource ? o._node.bufferSource.playbackRate.setValueAtTime(i, r.ctx.currentTime) : o._node && (o._node.playbackRate = i);
399
- var c = e.seek(a[s]), l = ((e._sprite[o._sprite][0] + e._sprite[o._sprite][1]) / 1e3 - c) * 1e3 / Math.abs(o._rate);
400
- (e._endTimers[a[s]] || !o._paused) && (e._clearTimer(a[s]), e._endTimers[a[s]] = setTimeout(e._ended.bind(e, o), l)), e._emit("rate", o._id);
397
+ i === void 0 && (e._rate = r), i = e._getSoundIds(i);
398
+ for (var o = 0; o < i.length; o++) if (a = e._soundById(i[o]), a) {
399
+ e.playing(i[o]) && (a._rateSeek = e.seek(i[o]), a._playStart = e._webAudio ? n.ctx.currentTime : a._playStart), a._rate = r, e._webAudio && a._node && a._node.bufferSource ? a._node.bufferSource.playbackRate.setValueAtTime(r, n.ctx.currentTime) : a._node && (a._node.playbackRate = r);
400
+ var s = e.seek(i[o]), c = ((e._sprite[a._sprite][0] + e._sprite[a._sprite][1]) / 1e3 - s) * 1e3 / Math.abs(a._rate);
401
+ (e._endTimers[i[o]] || !a._paused) && (e._clearTimer(i[o]), e._endTimers[i[o]] = setTimeout(e._ended.bind(e, a), c)), e._emit("rate", a._id);
401
402
  }
402
- } else return o = e._soundById(a), o ? o._rate : e._rate;
403
+ } else return a = e._soundById(i), a ? a._rate : e._rate;
403
404
  return e;
404
405
  },
405
406
  seek: function() {
406
- var e = this, n = arguments, i, a;
407
- if (n.length === 0 ? e._sounds.length && (a = e._sounds[0]._id) : n.length === 1 ? e._getSoundIds().indexOf(n[0]) >= 0 ? a = parseInt(n[0], 10) : e._sounds.length && (a = e._sounds[0]._id, i = parseFloat(n[0])) : n.length === 2 && (i = parseFloat(n[0]), a = parseInt(n[1], 10)), a === void 0) return 0;
408
- if (typeof i == "number" && (e._state !== "loaded" || e._playLock)) return e._queue.push({
407
+ var e = this, t = arguments, r, i;
408
+ if (t.length === 0 ? e._sounds.length && (i = e._sounds[0]._id) : t.length === 1 ? e._getSoundIds().indexOf(t[0]) >= 0 ? i = parseInt(t[0], 10) : e._sounds.length && (i = e._sounds[0]._id, r = parseFloat(t[0])) : t.length === 2 && (r = parseFloat(t[0]), i = parseInt(t[1], 10)), i === void 0) return 0;
409
+ if (typeof r == "number" && (e._state !== "loaded" || e._playLock)) return e._queue.push({
409
410
  event: "seek",
410
411
  action: function() {
411
- e.seek.apply(e, n);
412
+ e.seek.apply(e, t);
412
413
  }
413
414
  }), e;
414
- var o = e._soundById(a);
415
- if (o) if (typeof i == "number" && i >= 0) {
416
- var s = e.playing(a);
417
- s && e.pause(a, !0), o._seek = i, o._ended = !1, e._clearTimer(a), !e._webAudio && o._node && !isNaN(o._node.duration) && (o._node.currentTime = i);
418
- var c = function() {
419
- s && e.play(a, !0), e._emit("seek", a);
415
+ var a = e._soundById(i);
416
+ if (a) if (typeof r == "number" && r >= 0) {
417
+ var o = e.playing(i);
418
+ o && e.pause(i, !0), a._seek = r, a._ended = !1, e._clearTimer(i), !e._webAudio && a._node && !isNaN(a._node.duration) && (a._node.currentTime = r);
419
+ var s = function() {
420
+ o && e.play(i, !0), e._emit("seek", i);
420
421
  };
421
- if (s && !e._webAudio) {
422
- var l = function() {
423
- e._playLock ? setTimeout(l, 0) : c();
422
+ if (o && !e._webAudio) {
423
+ var c = function() {
424
+ e._playLock ? setTimeout(c, 0) : s();
424
425
  };
425
- setTimeout(l, 0);
426
- } else c();
426
+ setTimeout(c, 0);
427
+ } else s();
427
428
  } else if (e._webAudio) {
428
- var u = e.playing(a) ? r.ctx.currentTime - o._playStart : 0, d = o._rateSeek ? o._rateSeek - o._seek : 0;
429
- return o._seek + (d + u * Math.abs(o._rate));
430
- } else return o._node.currentTime;
429
+ var l = e.playing(i) ? n.ctx.currentTime - a._playStart : 0, u = a._rateSeek ? a._rateSeek - a._seek : 0;
430
+ return a._seek + (u + l * Math.abs(a._rate));
431
+ } else return a._node.currentTime;
431
432
  return e;
432
433
  },
433
434
  playing: function(e) {
434
- var n = this;
435
+ var t = this;
435
436
  if (typeof e == "number") {
436
- var r = n._soundById(e);
437
- return r ? !r._paused : !1;
437
+ var n = t._soundById(e);
438
+ return n ? !n._paused : !1;
438
439
  }
439
- for (var i = 0; i < n._sounds.length; i++) if (!n._sounds[i]._paused) return !0;
440
+ for (var r = 0; r < t._sounds.length; r++) if (!t._sounds[r]._paused) return !0;
440
441
  return !1;
441
442
  },
442
443
  duration: function(e) {
443
- var n = this, r = n._duration, i = n._soundById(e);
444
- return i && (r = n._sprite[i._sprite][1] / 1e3), r;
444
+ var t = this, n = t._duration, r = t._soundById(e);
445
+ return r && (n = t._sprite[r._sprite][1] / 1e3), n;
445
446
  },
446
447
  state: function() {
447
448
  return this._state;
448
449
  },
449
450
  unload: function() {
450
- for (var e = this, n = e._sounds, i = 0; i < n.length; i++) n[i]._paused || e.stop(n[i]._id), e._webAudio || (e._clearSound(n[i]._node), n[i]._node.removeEventListener("error", n[i]._errorFn, !1), n[i]._node.removeEventListener(r._canPlayEvent, n[i]._loadFn, !1), n[i]._node.removeEventListener("ended", n[i]._endFn, !1), r._releaseHtml5Audio(n[i]._node)), delete n[i]._node, e._clearTimer(n[i]._id);
451
- var a = r._howls.indexOf(e);
452
- a >= 0 && r._howls.splice(a, 1);
453
- var s = !0;
454
- for (i = 0; i < r._howls.length; i++) if (r._howls[i]._src === e._src || e._src.indexOf(r._howls[i]._src) >= 0) {
455
- s = !1;
451
+ for (var e = this, t = e._sounds, r = 0; r < t.length; r++) t[r]._paused || e.stop(t[r]._id), e._webAudio || (e._clearSound(t[r]._node), t[r]._node.removeEventListener("error", t[r]._errorFn, !1), t[r]._node.removeEventListener(n._canPlayEvent, t[r]._loadFn, !1), t[r]._node.removeEventListener("ended", t[r]._endFn, !1), n._releaseHtml5Audio(t[r]._node)), delete t[r]._node, e._clearTimer(t[r]._id);
452
+ var i = n._howls.indexOf(e);
453
+ i >= 0 && n._howls.splice(i, 1);
454
+ var o = !0;
455
+ for (r = 0; r < n._howls.length; r++) if (n._howls[r]._src === e._src || e._src.indexOf(n._howls[r]._src) >= 0) {
456
+ o = !1;
456
457
  break;
457
458
  }
458
- return o && s && delete o[e._src], r.noAudio = !1, e._state = "unloaded", e._sounds = [], e = null, null;
459
+ return a && o && delete a[e._src], n.noAudio = !1, e._state = "unloaded", e._sounds = [], e = null, null;
459
460
  },
460
- on: function(e, n, r, i) {
461
- var a = this, o = a["_on" + e];
462
- return typeof n == "function" && o.push(i ? {
463
- id: r,
464
- fn: n,
465
- once: i
461
+ on: function(e, t, n, r) {
462
+ var i = this, a = i["_on" + e];
463
+ return typeof t == "function" && a.push(r ? {
464
+ id: n,
465
+ fn: t,
466
+ once: r
466
467
  } : {
467
- id: r,
468
- fn: n
469
- }), a;
468
+ id: n,
469
+ fn: t
470
+ }), i;
470
471
  },
471
- off: function(e, n, r) {
472
- var i = this, a = i["_on" + e], o = 0;
473
- if (typeof n == "number" && (r = n, n = null), n || r) for (o = 0; o < a.length; o++) {
474
- var s = r === a[o].id;
475
- if (n === a[o].fn && s || !n && s) {
476
- a.splice(o, 1);
472
+ off: function(e, t, n) {
473
+ var r = this, i = r["_on" + e], a = 0;
474
+ if (typeof t == "number" && (n = t, t = null), t || n) for (a = 0; a < i.length; a++) {
475
+ var o = n === i[a].id;
476
+ if (t === i[a].fn && o || !t && o) {
477
+ i.splice(a, 1);
477
478
  break;
478
479
  }
479
480
  }
480
- else if (e) i["_on" + e] = [];
481
+ else if (e) r["_on" + e] = [];
481
482
  else {
482
- var c = Object.keys(i);
483
- for (o = 0; o < c.length; o++) c[o].indexOf("_on") === 0 && Array.isArray(i[c[o]]) && (i[c[o]] = []);
483
+ var s = Object.keys(r);
484
+ for (a = 0; a < s.length; a++) s[a].indexOf("_on") === 0 && Array.isArray(r[s[a]]) && (r[s[a]] = []);
484
485
  }
485
- return i;
486
+ return r;
486
487
  },
487
- once: function(e, n, r) {
488
- var i = this;
489
- return i.on(e, n, r, 1), i;
488
+ once: function(e, t, n) {
489
+ var r = this;
490
+ return r.on(e, t, n, 1), r;
490
491
  },
491
- _emit: function(e, n, r) {
492
- for (var i = this, a = i["_on" + e], o = a.length - 1; o >= 0; o--) (!a[o].id || a[o].id === n || e === "load") && (setTimeout(function(e) {
493
- e.call(this, n, r);
494
- }.bind(i, a[o].fn), 0), a[o].once && i.off(e, a[o].fn, a[o].id));
495
- return i._loadQueue(e), i;
492
+ _emit: function(e, t, n) {
493
+ for (var r = this, i = r["_on" + e], a = i.length - 1; a >= 0; a--) (!i[a].id || i[a].id === t || e === "load") && (setTimeout(function(e) {
494
+ e.call(this, t, n);
495
+ }.bind(r, i[a].fn), 0), i[a].once && r.off(e, i[a].fn, i[a].id));
496
+ return r._loadQueue(e), r;
496
497
  },
497
498
  _loadQueue: function(e) {
498
- var n = this;
499
- if (n._queue.length > 0) {
500
- var r = n._queue[0];
501
- r.event === e && (n._queue.shift(), n._loadQueue()), e || r.action();
499
+ var t = this;
500
+ if (t._queue.length > 0) {
501
+ var n = t._queue[0];
502
+ n.event === e && (t._queue.shift(), t._loadQueue()), e || n.action();
502
503
  }
503
- return n;
504
+ return t;
504
505
  },
505
506
  _ended: function(e) {
506
- var n = this, i = e._sprite;
507
- if (!n._webAudio && e._node && !e._node.paused && !e._node.ended && e._node.currentTime < e._stop) return setTimeout(n._ended.bind(n, e), 100), n;
508
- var a = !!(e._loop || n._sprite[i][2]);
509
- if (n._emit("end", e._id), !n._webAudio && a && n.stop(e._id, !0).play(e._id), n._webAudio && a) {
510
- n._emit("play", e._id), e._seek = e._start || 0, e._rateSeek = 0, e._playStart = r.ctx.currentTime;
511
- var o = (e._stop - e._start) * 1e3 / Math.abs(e._rate);
512
- n._endTimers[e._id] = setTimeout(n._ended.bind(n, e), o);
507
+ var t = this, r = e._sprite;
508
+ if (!t._webAudio && e._node && !e._node.paused && !e._node.ended && e._node.currentTime < e._stop) return setTimeout(t._ended.bind(t, e), 100), t;
509
+ var i = !!(e._loop || t._sprite[r][2]);
510
+ if (t._emit("end", e._id), !t._webAudio && i && t.stop(e._id, !0).play(e._id), t._webAudio && i) {
511
+ t._emit("play", e._id), e._seek = e._start || 0, e._rateSeek = 0, e._playStart = n.ctx.currentTime;
512
+ var a = (e._stop - e._start) * 1e3 / Math.abs(e._rate);
513
+ t._endTimers[e._id] = setTimeout(t._ended.bind(t, e), a);
513
514
  }
514
- return n._webAudio && !a && (e._paused = !0, e._ended = !0, e._seek = e._start || 0, e._rateSeek = 0, n._clearTimer(e._id), n._cleanBuffer(e._node), r._autoSuspend()), !n._webAudio && !a && n.stop(e._id, !0), n;
515
+ return t._webAudio && !i && (e._paused = !0, e._ended = !0, e._seek = e._start || 0, e._rateSeek = 0, t._clearTimer(e._id), t._cleanBuffer(e._node), n._autoSuspend()), !t._webAudio && !i && t.stop(e._id, !0), t;
515
516
  },
516
517
  _clearTimer: function(e) {
517
- var n = this;
518
- if (n._endTimers[e]) {
519
- if (typeof n._endTimers[e] != "function") clearTimeout(n._endTimers[e]);
518
+ var t = this;
519
+ if (t._endTimers[e]) {
520
+ if (typeof t._endTimers[e] != "function") clearTimeout(t._endTimers[e]);
520
521
  else {
521
- var r = n._soundById(e);
522
- r && r._node && r._node.removeEventListener("ended", n._endTimers[e], !1);
522
+ var n = t._soundById(e);
523
+ n && n._node && n._node.removeEventListener("ended", t._endTimers[e], !1);
523
524
  }
524
- delete n._endTimers[e];
525
+ delete t._endTimers[e];
525
526
  }
526
- return n;
527
+ return t;
527
528
  },
528
529
  _soundById: function(e) {
529
- for (var n = this, r = 0; r < n._sounds.length; r++) if (e === n._sounds[r]._id) return n._sounds[r];
530
+ for (var t = this, n = 0; n < t._sounds.length; n++) if (e === t._sounds[n]._id) return t._sounds[n];
530
531
  return null;
531
532
  },
532
533
  _inactiveSound: function() {
533
534
  var e = this;
534
535
  e._drain();
535
- for (var n = 0; n < e._sounds.length; n++) if (e._sounds[n]._ended) return e._sounds[n].reset();
536
- return new a(e);
536
+ for (var t = 0; t < e._sounds.length; t++) if (e._sounds[t]._ended) return e._sounds[t].reset();
537
+ return new i(e);
537
538
  },
538
539
  _drain: function() {
539
- var e = this, n = e._pool, r = 0, i = 0;
540
- if (!(e._sounds.length < n)) {
541
- for (i = 0; i < e._sounds.length; i++) e._sounds[i]._ended && r++;
542
- for (i = e._sounds.length - 1; i >= 0; i--) {
543
- if (r <= n) return;
544
- e._sounds[i]._ended && (e._webAudio && e._sounds[i]._node && e._sounds[i]._node.disconnect(0), e._sounds.splice(i, 1), r--);
540
+ var e = this, t = e._pool, n = 0, r = 0;
541
+ if (!(e._sounds.length < t)) {
542
+ for (r = 0; r < e._sounds.length; r++) e._sounds[r]._ended && n++;
543
+ for (r = e._sounds.length - 1; r >= 0; r--) {
544
+ if (n <= t) return;
545
+ e._sounds[r]._ended && (e._webAudio && e._sounds[r]._node && e._sounds[r]._node.disconnect(0), e._sounds.splice(r, 1), n--);
545
546
  }
546
547
  }
547
548
  },
548
549
  _getSoundIds: function(e) {
549
- var n = this;
550
+ var t = this;
550
551
  if (e === void 0) {
551
- for (var r = [], i = 0; i < n._sounds.length; i++) r.push(n._sounds[i]._id);
552
- return r;
552
+ for (var n = [], r = 0; r < t._sounds.length; r++) n.push(t._sounds[r]._id);
553
+ return n;
553
554
  } else return [e];
554
555
  },
555
556
  _refreshBuffer: function(e) {
556
- var n = this;
557
- return e._node.bufferSource = r.ctx.createBufferSource(), e._node.bufferSource.buffer = o[n._src], e._panner ? e._node.bufferSource.connect(e._panner) : e._node.bufferSource.connect(e._node), e._node.bufferSource.loop = e._loop, e._loop && (e._node.bufferSource.loopStart = e._start || 0, e._node.bufferSource.loopEnd = e._stop || 0), e._node.bufferSource.playbackRate.setValueAtTime(e._rate, r.ctx.currentTime), n;
557
+ var t = this;
558
+ return e._node.bufferSource = n.ctx.createBufferSource(), e._node.bufferSource.buffer = a[t._src], e._panner ? e._node.bufferSource.connect(e._panner) : e._node.bufferSource.connect(e._node), e._node.bufferSource.loop = e._loop, e._loop && (e._node.bufferSource.loopStart = e._start || 0, e._node.bufferSource.loopEnd = e._stop || 0), e._node.bufferSource.playbackRate.setValueAtTime(e._rate, n.ctx.currentTime), t;
558
559
  },
559
560
  _cleanBuffer: function(e) {
560
- var n = this, i = r._navigator && r._navigator.vendor.indexOf("Apple") >= 0;
561
- if (!e.bufferSource) return n;
562
- if (r._scratchBuffer && e.bufferSource && (e.bufferSource.onended = null, e.bufferSource.disconnect(0), i)) try {
563
- e.bufferSource.buffer = r._scratchBuffer;
561
+ var t = this, r = n._navigator && n._navigator.vendor.indexOf("Apple") >= 0;
562
+ if (!e.bufferSource) return t;
563
+ if (n._scratchBuffer && e.bufferSource && (e.bufferSource.onended = null, e.bufferSource.disconnect(0), r)) try {
564
+ e.bufferSource.buffer = n._scratchBuffer;
564
565
  } catch {}
565
- return e.bufferSource = null, n;
566
+ return e.bufferSource = null, t;
566
567
  },
567
568
  _clearSound: function(e) {
568
- /MSIE |Trident\//.test(r._navigator && r._navigator.userAgent) || (e.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
569
+ /MSIE |Trident\//.test(n._navigator && n._navigator.userAgent) || (e.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA");
569
570
  }
570
571
  };
571
- var a = function(e) {
572
+ var i = function(e) {
572
573
  this._parent = e, this.init();
573
574
  };
574
- a.prototype = {
575
+ i.prototype = {
575
576
  init: function() {
576
- var e = this, n = e._parent;
577
- return e._muted = n._muted, e._loop = n._loop, e._volume = n._volume, e._rate = n._rate, e._seek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++r._counter, n._sounds.push(e), e.create(), e;
577
+ var e = this, t = e._parent;
578
+ return e._muted = t._muted, e._loop = t._loop, e._volume = t._volume, e._rate = t._rate, e._seek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++n._counter, t._sounds.push(e), e.create(), e;
578
579
  },
579
580
  create: function() {
580
- var e = this, n = e._parent, i = r._muted || e._muted || e._parent._muted ? 0 : e._volume;
581
- return n._webAudio ? (e._node = r.ctx.createGain === void 0 ? r.ctx.createGainNode() : r.ctx.createGain(), e._node.gain.setValueAtTime(i, r.ctx.currentTime), e._node.paused = !0, e._node.connect(r.masterGain)) : r.noAudio || (e._node = r._obtainHtml5Audio(), e._errorFn = e._errorListener.bind(e), e._node.addEventListener("error", e._errorFn, !1), e._loadFn = e._loadListener.bind(e), e._node.addEventListener(r._canPlayEvent, e._loadFn, !1), e._endFn = e._endListener.bind(e), e._node.addEventListener("ended", e._endFn, !1), e._node.src = n._src, e._node.preload = n._preload === !0 ? "auto" : n._preload, e._node.volume = i * r.volume(), e._node.load()), e;
581
+ var e = this, t = e._parent, r = n._muted || e._muted || e._parent._muted ? 0 : e._volume;
582
+ return t._webAudio ? (e._node = n.ctx.createGain === void 0 ? n.ctx.createGainNode() : n.ctx.createGain(), e._node.gain.setValueAtTime(r, n.ctx.currentTime), e._node.paused = !0, e._node.connect(n.masterGain)) : n.noAudio || (e._node = n._obtainHtml5Audio(), e._errorFn = e._errorListener.bind(e), e._node.addEventListener("error", e._errorFn, !1), e._loadFn = e._loadListener.bind(e), e._node.addEventListener(n._canPlayEvent, e._loadFn, !1), e._endFn = e._endListener.bind(e), e._node.addEventListener("ended", e._endFn, !1), e._node.src = t._src, e._node.preload = t._preload === !0 ? "auto" : t._preload, e._node.volume = r * n.volume(), e._node.load()), e;
582
583
  },
583
584
  reset: function() {
584
- var e = this, n = e._parent;
585
- return e._muted = n._muted, e._loop = n._loop, e._volume = n._volume, e._rate = n._rate, e._seek = 0, e._rateSeek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++r._counter, e;
585
+ var e = this, t = e._parent;
586
+ return e._muted = t._muted, e._loop = t._loop, e._volume = t._volume, e._rate = t._rate, e._seek = 0, e._rateSeek = 0, e._paused = !0, e._ended = !0, e._sprite = "__default", e._id = ++n._counter, e;
586
587
  },
587
588
  _errorListener: function() {
588
589
  var e = this;
589
590
  e._parent._emit("loaderror", e._id, e._node.error ? e._node.error.code : 0), e._node.removeEventListener("error", e._errorFn, !1);
590
591
  },
591
592
  _loadListener: function() {
592
- var e = this, n = e._parent;
593
- n._duration = Math.ceil(e._node.duration * 10) / 10, Object.keys(n._sprite).length === 0 && (n._sprite = { __default: [0, n._duration * 1e3] }), n._state !== "loaded" && (n._state = "loaded", n._emit("load"), n._loadQueue()), e._node.removeEventListener(r._canPlayEvent, e._loadFn, !1);
593
+ var e = this, t = e._parent;
594
+ t._duration = Math.ceil(e._node.duration * 10) / 10, Object.keys(t._sprite).length === 0 && (t._sprite = { __default: [0, t._duration * 1e3] }), t._state !== "loaded" && (t._state = "loaded", t._emit("load"), t._loadQueue()), e._node.removeEventListener(n._canPlayEvent, e._loadFn, !1);
594
595
  },
595
596
  _endListener: function() {
596
- var e = this, n = e._parent;
597
- n._duration === Infinity && (n._duration = Math.ceil(e._node.duration * 10) / 10, n._sprite.__default[1] === Infinity && (n._sprite.__default[1] = n._duration * 1e3), n._ended(e)), e._node.removeEventListener("ended", e._endFn, !1);
597
+ var e = this, t = e._parent;
598
+ t._duration === Infinity && (t._duration = Math.ceil(e._node.duration * 10) / 10, t._sprite.__default[1] === Infinity && (t._sprite.__default[1] = t._duration * 1e3), t._ended(e)), e._node.removeEventListener("ended", e._endFn, !1);
598
599
  }
599
600
  };
600
- var o = {}, s = function(e) {
601
- var n = e._src;
602
- if (o[n]) {
603
- e._duration = o[n].duration, u(e);
601
+ var a = {}, o = function(e) {
602
+ var t = e._src;
603
+ if (a[t]) {
604
+ e._duration = a[t].duration, l(e);
604
605
  return;
605
606
  }
606
- if (/^data:[^;]+;base64,/.test(n)) {
607
- for (var r = atob(n.split(",")[1]), i = new Uint8Array(r.length), a = 0; a < r.length; ++a) i[a] = r.charCodeAt(a);
608
- l(i.buffer, e);
607
+ if (/^data:[^;]+;base64,/.test(t)) {
608
+ for (var n = atob(t.split(",")[1]), r = new Uint8Array(n.length), i = 0; i < n.length; ++i) r[i] = n.charCodeAt(i);
609
+ c(r.buffer, e);
609
610
  } else {
610
- var s = new XMLHttpRequest();
611
- s.open(e._xhr.method, n, !0), s.withCredentials = e._xhr.withCredentials, s.responseType = "arraybuffer", e._xhr.headers && Object.keys(e._xhr.headers).forEach(function(n) {
612
- s.setRequestHeader(n, e._xhr.headers[n]);
613
- }), s.onload = function() {
614
- var n = (s.status + "")[0];
615
- if (n !== "0" && n !== "2" && n !== "3") {
616
- e._emit("loaderror", null, "Failed loading audio file with status: " + s.status + ".");
611
+ var o = new XMLHttpRequest();
612
+ o.open(e._xhr.method, t, !0), o.withCredentials = e._xhr.withCredentials, o.responseType = "arraybuffer", e._xhr.headers && Object.keys(e._xhr.headers).forEach(function(t) {
613
+ o.setRequestHeader(t, e._xhr.headers[t]);
614
+ }), o.onload = function() {
615
+ var t = (o.status + "")[0];
616
+ if (t !== "0" && t !== "2" && t !== "3") {
617
+ e._emit("loaderror", null, "Failed loading audio file with status: " + o.status + ".");
617
618
  return;
618
619
  }
619
- l(s.response, e);
620
- }, s.onerror = function() {
621
- e._webAudio && (e._html5 = !0, e._webAudio = !1, e._sounds = [], delete o[n], e.load());
622
- }, c(s);
620
+ c(o.response, e);
621
+ }, o.onerror = function() {
622
+ e._webAudio && (e._html5 = !0, e._webAudio = !1, e._sounds = [], delete a[t], e.load());
623
+ }, s(o);
623
624
  }
624
- }, c = function(e) {
625
+ }, s = function(e) {
625
626
  try {
626
627
  e.send();
627
628
  } catch {
628
629
  e.onerror();
629
630
  }
630
- }, l = function(e, n) {
631
- var i = function() {
632
- n._emit("loaderror", null, "Decoding audio data failed.");
633
- }, a = function(e) {
634
- e && n._sounds.length > 0 ? (o[n._src] = e, u(n, e)) : i();
631
+ }, c = function(e, t) {
632
+ var r = function() {
633
+ t._emit("loaderror", null, "Decoding audio data failed.");
634
+ }, i = function(e) {
635
+ e && t._sounds.length > 0 ? (a[t._src] = e, l(t, e)) : r();
635
636
  };
636
- typeof Promise < "u" && r.ctx.decodeAudioData.length === 1 ? r.ctx.decodeAudioData(e).then(a).catch(i) : r.ctx.decodeAudioData(e, a, i);
637
- }, u = function(e, n) {
638
- n && !e._duration && (e._duration = n.duration), Object.keys(e._sprite).length === 0 && (e._sprite = { __default: [0, e._duration * 1e3] }), e._state !== "loaded" && (e._state = "loaded", e._emit("load"), e._loadQueue());
639
- }, d = function() {
640
- if (r.usingWebAudio) {
637
+ typeof Promise < "u" && n.ctx.decodeAudioData.length === 1 ? n.ctx.decodeAudioData(e).then(i).catch(r) : n.ctx.decodeAudioData(e, i, r);
638
+ }, l = function(e, t) {
639
+ t && !e._duration && (e._duration = t.duration), Object.keys(e._sprite).length === 0 && (e._sprite = { __default: [0, e._duration * 1e3] }), e._state !== "loaded" && (e._state = "loaded", e._emit("load"), e._loadQueue());
640
+ }, u = function() {
641
+ if (n.usingWebAudio) {
641
642
  try {
642
- typeof AudioContext < "u" ? r.ctx = new AudioContext() : typeof webkitAudioContext < "u" ? r.ctx = new webkitAudioContext() : r.usingWebAudio = !1;
643
+ typeof AudioContext < "u" ? n.ctx = new AudioContext() : typeof webkitAudioContext < "u" ? n.ctx = new webkitAudioContext() : n.usingWebAudio = !1;
643
644
  } catch {
644
- r.usingWebAudio = !1;
645
+ n.usingWebAudio = !1;
645
646
  }
646
- r.ctx || (r.usingWebAudio = !1);
647
- var e = /iP(hone|od|ad)/.test(r._navigator && r._navigator.platform), n = r._navigator && r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), i = n ? parseInt(n[1], 10) : null;
648
- if (e && i && i < 9) {
649
- var a = /safari/.test(r._navigator && r._navigator.userAgent.toLowerCase());
650
- r._navigator && !a && (r.usingWebAudio = !1);
647
+ n.ctx || (n.usingWebAudio = !1);
648
+ var e = /iP(hone|od|ad)/.test(n._navigator && n._navigator.platform), t = n._navigator && n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), r = t ? parseInt(t[1], 10) : null;
649
+ if (e && r && r < 9) {
650
+ var i = /safari/.test(n._navigator && n._navigator.userAgent.toLowerCase());
651
+ n._navigator && !i && (n.usingWebAudio = !1);
651
652
  }
652
- r.usingWebAudio && (r.masterGain = r.ctx.createGain === void 0 ? r.ctx.createGainNode() : r.ctx.createGain(), r.masterGain.gain.setValueAtTime(r._muted ? 0 : r._volume, r.ctx.currentTime), r.masterGain.connect(r.ctx.destination)), r._setup();
653
+ n.usingWebAudio && (n.masterGain = n.ctx.createGain === void 0 ? n.ctx.createGainNode() : n.ctx.createGain(), n.masterGain.gain.setValueAtTime(n._muted ? 0 : n._volume, n.ctx.currentTime), n.masterGain.connect(n.ctx.destination)), n._setup();
653
654
  }
654
655
  };
655
656
  typeof define == "function" && define.amd && define([], function() {
656
657
  return {
657
- Howler: r,
658
- Howl: i
658
+ Howler: n,
659
+ Howl: r
659
660
  };
660
- }), e !== void 0 && (e.Howler = r, e.Howl = i), typeof global < "u" ? (global.HowlerGlobal = n, global.Howler = r, global.Howl = i, global.Sound = a) : typeof window < "u" && (window.HowlerGlobal = n, window.Howler = r, window.Howl = i, window.Sound = a);
661
+ }), e !== void 0 && (e.Howler = n, e.Howl = r), typeof global < "u" ? (global.HowlerGlobal = t, global.Howler = n, global.Howl = r, global.Sound = i) : typeof window < "u" && (window.HowlerGlobal = t, window.Howler = n, window.Howl = r, window.Sound = i);
661
662
  })(), (function() {
662
663
  HowlerGlobal.prototype._pos = [
663
664
  0,
@@ -671,282 +672,290 @@ var require_howler = /* @__PURE__ */ __commonJSMin(((e) => {
671
672
  1,
672
673
  0
673
674
  ], HowlerGlobal.prototype.stereo = function(e) {
674
- var n = this;
675
- if (!n.ctx || !n.ctx.listener) return n;
676
- for (var r = n._howls.length - 1; r >= 0; r--) n._howls[r].stereo(e);
677
- return n;
678
- }, HowlerGlobal.prototype.pos = function(e, n, r) {
679
- var i = this;
680
- if (!i.ctx || !i.ctx.listener) return i;
681
- if (n = typeof n == "number" ? n : i._pos[1], r = typeof r == "number" ? r : i._pos[2], typeof e == "number") i._pos = [
675
+ var t = this;
676
+ if (!t.ctx || !t.ctx.listener) return t;
677
+ for (var n = t._howls.length - 1; n >= 0; n--) t._howls[n].stereo(e);
678
+ return t;
679
+ }, HowlerGlobal.prototype.pos = function(e, t, n) {
680
+ var r = this;
681
+ if (!r.ctx || !r.ctx.listener) return r;
682
+ if (t = typeof t == "number" ? t : r._pos[1], n = typeof n == "number" ? n : r._pos[2], typeof e == "number") r._pos = [
682
683
  e,
683
- n,
684
- r
685
- ], i.ctx.listener.positionX === void 0 ? i.ctx.listener.setPosition(i._pos[0], i._pos[1], i._pos[2]) : (i.ctx.listener.positionX.setTargetAtTime(i._pos[0], Howler.ctx.currentTime, .1), i.ctx.listener.positionY.setTargetAtTime(i._pos[1], Howler.ctx.currentTime, .1), i.ctx.listener.positionZ.setTargetAtTime(i._pos[2], Howler.ctx.currentTime, .1));
686
- else return i._pos;
687
- return i;
688
- }, HowlerGlobal.prototype.orientation = function(e, n, r, i, a, o) {
689
- var s = this;
690
- if (!s.ctx || !s.ctx.listener) return s;
691
- var c = s._orientation;
692
- if (n = typeof n == "number" ? n : c[1], r = typeof r == "number" ? r : c[2], i = typeof i == "number" ? i : c[3], a = typeof a == "number" ? a : c[4], o = typeof o == "number" ? o : c[5], typeof e == "number") s._orientation = [
684
+ t,
685
+ n
686
+ ], r.ctx.listener.positionX === void 0 ? r.ctx.listener.setPosition(r._pos[0], r._pos[1], r._pos[2]) : (r.ctx.listener.positionX.setTargetAtTime(r._pos[0], Howler.ctx.currentTime, .1), r.ctx.listener.positionY.setTargetAtTime(r._pos[1], Howler.ctx.currentTime, .1), r.ctx.listener.positionZ.setTargetAtTime(r._pos[2], Howler.ctx.currentTime, .1));
687
+ else return r._pos;
688
+ return r;
689
+ }, HowlerGlobal.prototype.orientation = function(e, t, n, r, i, a) {
690
+ var o = this;
691
+ if (!o.ctx || !o.ctx.listener) return o;
692
+ var s = o._orientation;
693
+ if (t = typeof t == "number" ? t : s[1], n = typeof n == "number" ? n : s[2], r = typeof r == "number" ? r : s[3], i = typeof i == "number" ? i : s[4], a = typeof a == "number" ? a : s[5], typeof e == "number") o._orientation = [
693
694
  e,
695
+ t,
694
696
  n,
695
697
  r,
696
698
  i,
697
- a,
698
- o
699
- ], s.ctx.listener.forwardX === void 0 ? s.ctx.listener.setOrientation(e, n, r, i, a, o) : (s.ctx.listener.forwardX.setTargetAtTime(e, Howler.ctx.currentTime, .1), s.ctx.listener.forwardY.setTargetAtTime(n, Howler.ctx.currentTime, .1), s.ctx.listener.forwardZ.setTargetAtTime(r, Howler.ctx.currentTime, .1), s.ctx.listener.upX.setTargetAtTime(i, Howler.ctx.currentTime, .1), s.ctx.listener.upY.setTargetAtTime(a, Howler.ctx.currentTime, .1), s.ctx.listener.upZ.setTargetAtTime(o, Howler.ctx.currentTime, .1));
700
- else return c;
701
- return s;
699
+ a
700
+ ], o.ctx.listener.forwardX === void 0 ? o.ctx.listener.setOrientation(e, t, n, r, i, a) : (o.ctx.listener.forwardX.setTargetAtTime(e, Howler.ctx.currentTime, .1), o.ctx.listener.forwardY.setTargetAtTime(t, Howler.ctx.currentTime, .1), o.ctx.listener.forwardZ.setTargetAtTime(n, Howler.ctx.currentTime, .1), o.ctx.listener.upX.setTargetAtTime(r, Howler.ctx.currentTime, .1), o.ctx.listener.upY.setTargetAtTime(i, Howler.ctx.currentTime, .1), o.ctx.listener.upZ.setTargetAtTime(a, Howler.ctx.currentTime, .1));
701
+ else return s;
702
+ return o;
702
703
  }, Howl.prototype.init = (function(e) {
703
- return function(n) {
704
- var r = this;
705
- return r._orientation = n.orientation || [
704
+ return function(t) {
705
+ var n = this;
706
+ return n._orientation = t.orientation || [
706
707
  1,
707
708
  0,
708
709
  0
709
- ], r._stereo = n.stereo || null, r._pos = n.pos || null, r._pannerAttr = {
710
- coneInnerAngle: n.coneInnerAngle === void 0 ? 360 : n.coneInnerAngle,
711
- coneOuterAngle: n.coneOuterAngle === void 0 ? 360 : n.coneOuterAngle,
712
- coneOuterGain: n.coneOuterGain === void 0 ? 0 : n.coneOuterGain,
713
- distanceModel: n.distanceModel === void 0 ? "inverse" : n.distanceModel,
714
- maxDistance: n.maxDistance === void 0 ? 1e4 : n.maxDistance,
715
- panningModel: n.panningModel === void 0 ? "HRTF" : n.panningModel,
716
- refDistance: n.refDistance === void 0 ? 1 : n.refDistance,
717
- rolloffFactor: n.rolloffFactor === void 0 ? 1 : n.rolloffFactor
718
- }, r._onstereo = n.onstereo ? [{ fn: n.onstereo }] : [], r._onpos = n.onpos ? [{ fn: n.onpos }] : [], r._onorientation = n.onorientation ? [{ fn: n.onorientation }] : [], e.call(this, n);
710
+ ], n._stereo = t.stereo || null, n._pos = t.pos || null, n._pannerAttr = {
711
+ coneInnerAngle: t.coneInnerAngle === void 0 ? 360 : t.coneInnerAngle,
712
+ coneOuterAngle: t.coneOuterAngle === void 0 ? 360 : t.coneOuterAngle,
713
+ coneOuterGain: t.coneOuterGain === void 0 ? 0 : t.coneOuterGain,
714
+ distanceModel: t.distanceModel === void 0 ? "inverse" : t.distanceModel,
715
+ maxDistance: t.maxDistance === void 0 ? 1e4 : t.maxDistance,
716
+ panningModel: t.panningModel === void 0 ? "HRTF" : t.panningModel,
717
+ refDistance: t.refDistance === void 0 ? 1 : t.refDistance,
718
+ rolloffFactor: t.rolloffFactor === void 0 ? 1 : t.rolloffFactor
719
+ }, n._onstereo = t.onstereo ? [{ fn: t.onstereo }] : [], n._onpos = t.onpos ? [{ fn: t.onpos }] : [], n._onorientation = t.onorientation ? [{ fn: t.onorientation }] : [], e.call(this, t);
719
720
  };
720
- })(Howl.prototype.init), Howl.prototype.stereo = function(n, r) {
721
- var i = this;
722
- if (!i._webAudio) return i;
723
- if (i._state !== "loaded") return i._queue.push({
721
+ })(Howl.prototype.init), Howl.prototype.stereo = function(t, n) {
722
+ var r = this;
723
+ if (!r._webAudio) return r;
724
+ if (r._state !== "loaded") return r._queue.push({
724
725
  event: "stereo",
725
726
  action: function() {
726
- i.stereo(n, r);
727
+ r.stereo(t, n);
727
728
  }
728
- }), i;
729
- var a = Howler.ctx.createStereoPanner === void 0 ? "spatial" : "stereo";
730
- if (r === void 0) if (typeof n == "number") i._stereo = n, i._pos = [
731
- n,
729
+ }), r;
730
+ var i = Howler.ctx.createStereoPanner === void 0 ? "spatial" : "stereo";
731
+ if (n === void 0) if (typeof t == "number") r._stereo = t, r._pos = [
732
+ t,
732
733
  0,
733
734
  0
734
735
  ];
735
- else return i._stereo;
736
- for (var o = i._getSoundIds(r), s = 0; s < o.length; s++) {
737
- var c = i._soundById(o[s]);
738
- if (c) if (typeof n == "number") c._stereo = n, c._pos = [
739
- n,
736
+ else return r._stereo;
737
+ for (var a = r._getSoundIds(n), o = 0; o < a.length; o++) {
738
+ var s = r._soundById(a[o]);
739
+ if (s) if (typeof t == "number") s._stereo = t, s._pos = [
740
+ t,
740
741
  0,
741
742
  0
742
- ], c._node && (c._pannerAttr.panningModel = "equalpower", (!c._panner || !c._panner.pan) && e(c, a), a === "spatial" ? c._panner.positionX === void 0 ? c._panner.setPosition(n, 0, 0) : (c._panner.positionX.setValueAtTime(n, Howler.ctx.currentTime), c._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime), c._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : c._panner.pan.setValueAtTime(n, Howler.ctx.currentTime)), i._emit("stereo", c._id);
743
- else return c._stereo;
743
+ ], s._node && (s._pannerAttr.panningModel = "equalpower", (!s._panner || !s._panner.pan) && e(s, i), i === "spatial" ? s._panner.positionX === void 0 ? s._panner.setPosition(t, 0, 0) : (s._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime), s._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime), s._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : s._panner.pan.setValueAtTime(t, Howler.ctx.currentTime)), r._emit("stereo", s._id);
744
+ else return s._stereo;
744
745
  }
745
- return i;
746
- }, Howl.prototype.pos = function(n, r, i, a) {
747
- var o = this;
748
- if (!o._webAudio) return o;
749
- if (o._state !== "loaded") return o._queue.push({
746
+ return r;
747
+ }, Howl.prototype.pos = function(t, n, r, i) {
748
+ var a = this;
749
+ if (!a._webAudio) return a;
750
+ if (a._state !== "loaded") return a._queue.push({
750
751
  event: "pos",
751
752
  action: function() {
752
- o.pos(n, r, i, a);
753
+ a.pos(t, n, r, i);
753
754
  }
754
- }), o;
755
- if (r = typeof r == "number" ? r : 0, i = typeof i == "number" ? i : -.5, a === void 0) if (typeof n == "number") o._pos = [
755
+ }), a;
756
+ if (n = typeof n == "number" ? n : 0, r = typeof r == "number" ? r : -.5, i === void 0) if (typeof t == "number") a._pos = [
757
+ t,
756
758
  n,
757
- r,
758
- i
759
+ r
759
760
  ];
760
- else return o._pos;
761
- for (var s = o._getSoundIds(a), c = 0; c < s.length; c++) {
762
- var l = o._soundById(s[c]);
763
- if (l) if (typeof n == "number") l._pos = [
761
+ else return a._pos;
762
+ for (var o = a._getSoundIds(i), s = 0; s < o.length; s++) {
763
+ var c = a._soundById(o[s]);
764
+ if (c) if (typeof t == "number") c._pos = [
765
+ t,
764
766
  n,
765
- r,
766
- i
767
- ], l._node && ((!l._panner || l._panner.pan) && e(l, "spatial"), l._panner.positionX === void 0 ? l._panner.setPosition(n, r, i) : (l._panner.positionX.setValueAtTime(n, Howler.ctx.currentTime), l._panner.positionY.setValueAtTime(r, Howler.ctx.currentTime), l._panner.positionZ.setValueAtTime(i, Howler.ctx.currentTime))), o._emit("pos", l._id);
768
- else return l._pos;
767
+ r
768
+ ], c._node && ((!c._panner || c._panner.pan) && e(c, "spatial"), c._panner.positionX === void 0 ? c._panner.setPosition(t, n, r) : (c._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime), c._panner.positionY.setValueAtTime(n, Howler.ctx.currentTime), c._panner.positionZ.setValueAtTime(r, Howler.ctx.currentTime))), a._emit("pos", c._id);
769
+ else return c._pos;
769
770
  }
770
- return o;
771
- }, Howl.prototype.orientation = function(n, r, i, a) {
772
- var o = this;
773
- if (!o._webAudio) return o;
774
- if (o._state !== "loaded") return o._queue.push({
771
+ return a;
772
+ }, Howl.prototype.orientation = function(t, n, r, i) {
773
+ var a = this;
774
+ if (!a._webAudio) return a;
775
+ if (a._state !== "loaded") return a._queue.push({
775
776
  event: "orientation",
776
777
  action: function() {
777
- o.orientation(n, r, i, a);
778
+ a.orientation(t, n, r, i);
778
779
  }
779
- }), o;
780
- if (r = typeof r == "number" ? r : o._orientation[1], i = typeof i == "number" ? i : o._orientation[2], a === void 0) if (typeof n == "number") o._orientation = [
780
+ }), a;
781
+ if (n = typeof n == "number" ? n : a._orientation[1], r = typeof r == "number" ? r : a._orientation[2], i === void 0) if (typeof t == "number") a._orientation = [
782
+ t,
781
783
  n,
782
- r,
783
- i
784
+ r
784
785
  ];
785
- else return o._orientation;
786
- for (var s = o._getSoundIds(a), c = 0; c < s.length; c++) {
787
- var l = o._soundById(s[c]);
788
- if (l) if (typeof n == "number") l._orientation = [
786
+ else return a._orientation;
787
+ for (var o = a._getSoundIds(i), s = 0; s < o.length; s++) {
788
+ var c = a._soundById(o[s]);
789
+ if (c) if (typeof t == "number") c._orientation = [
790
+ t,
789
791
  n,
790
- r,
791
- i
792
- ], l._node && (l._panner || (l._pos ||= o._pos || [
792
+ r
793
+ ], c._node && (c._panner || (c._pos ||= a._pos || [
793
794
  0,
794
795
  0,
795
796
  -.5
796
- ], e(l, "spatial")), l._panner.orientationX === void 0 ? l._panner.setOrientation(n, r, i) : (l._panner.orientationX.setValueAtTime(n, Howler.ctx.currentTime), l._panner.orientationY.setValueAtTime(r, Howler.ctx.currentTime), l._panner.orientationZ.setValueAtTime(i, Howler.ctx.currentTime))), o._emit("orientation", l._id);
797
- else return l._orientation;
797
+ ], e(c, "spatial")), c._panner.orientationX === void 0 ? c._panner.setOrientation(t, n, r) : (c._panner.orientationX.setValueAtTime(t, Howler.ctx.currentTime), c._panner.orientationY.setValueAtTime(n, Howler.ctx.currentTime), c._panner.orientationZ.setValueAtTime(r, Howler.ctx.currentTime))), a._emit("orientation", c._id);
798
+ else return c._orientation;
798
799
  }
799
- return o;
800
+ return a;
800
801
  }, Howl.prototype.pannerAttr = function() {
801
- var n = this, r = arguments, i, a, o;
802
- if (!n._webAudio) return n;
803
- if (r.length === 0) return n._pannerAttr;
804
- if (r.length === 1) if (typeof r[0] == "object") i = r[0], a === void 0 && (i.pannerAttr ||= {
805
- coneInnerAngle: i.coneInnerAngle,
806
- coneOuterAngle: i.coneOuterAngle,
807
- coneOuterGain: i.coneOuterGain,
808
- distanceModel: i.distanceModel,
809
- maxDistance: i.maxDistance,
810
- refDistance: i.refDistance,
811
- rolloffFactor: i.rolloffFactor,
812
- panningModel: i.panningModel
813
- }, n._pannerAttr = {
814
- coneInnerAngle: i.pannerAttr.coneInnerAngle === void 0 ? n._coneInnerAngle : i.pannerAttr.coneInnerAngle,
815
- coneOuterAngle: i.pannerAttr.coneOuterAngle === void 0 ? n._coneOuterAngle : i.pannerAttr.coneOuterAngle,
816
- coneOuterGain: i.pannerAttr.coneOuterGain === void 0 ? n._coneOuterGain : i.pannerAttr.coneOuterGain,
817
- distanceModel: i.pannerAttr.distanceModel === void 0 ? n._distanceModel : i.pannerAttr.distanceModel,
818
- maxDistance: i.pannerAttr.maxDistance === void 0 ? n._maxDistance : i.pannerAttr.maxDistance,
819
- refDistance: i.pannerAttr.refDistance === void 0 ? n._refDistance : i.pannerAttr.refDistance,
820
- rolloffFactor: i.pannerAttr.rolloffFactor === void 0 ? n._rolloffFactor : i.pannerAttr.rolloffFactor,
821
- panningModel: i.pannerAttr.panningModel === void 0 ? n._panningModel : i.pannerAttr.panningModel
802
+ var t = this, n = arguments, r, i, a;
803
+ if (!t._webAudio) return t;
804
+ if (n.length === 0) return t._pannerAttr;
805
+ if (n.length === 1) if (typeof n[0] == "object") r = n[0], i === void 0 && (r.pannerAttr ||= {
806
+ coneInnerAngle: r.coneInnerAngle,
807
+ coneOuterAngle: r.coneOuterAngle,
808
+ coneOuterGain: r.coneOuterGain,
809
+ distanceModel: r.distanceModel,
810
+ maxDistance: r.maxDistance,
811
+ refDistance: r.refDistance,
812
+ rolloffFactor: r.rolloffFactor,
813
+ panningModel: r.panningModel
814
+ }, t._pannerAttr = {
815
+ coneInnerAngle: r.pannerAttr.coneInnerAngle === void 0 ? t._coneInnerAngle : r.pannerAttr.coneInnerAngle,
816
+ coneOuterAngle: r.pannerAttr.coneOuterAngle === void 0 ? t._coneOuterAngle : r.pannerAttr.coneOuterAngle,
817
+ coneOuterGain: r.pannerAttr.coneOuterGain === void 0 ? t._coneOuterGain : r.pannerAttr.coneOuterGain,
818
+ distanceModel: r.pannerAttr.distanceModel === void 0 ? t._distanceModel : r.pannerAttr.distanceModel,
819
+ maxDistance: r.pannerAttr.maxDistance === void 0 ? t._maxDistance : r.pannerAttr.maxDistance,
820
+ refDistance: r.pannerAttr.refDistance === void 0 ? t._refDistance : r.pannerAttr.refDistance,
821
+ rolloffFactor: r.pannerAttr.rolloffFactor === void 0 ? t._rolloffFactor : r.pannerAttr.rolloffFactor,
822
+ panningModel: r.pannerAttr.panningModel === void 0 ? t._panningModel : r.pannerAttr.panningModel
822
823
  });
823
- else return o = n._soundById(parseInt(r[0], 10)), o ? o._pannerAttr : n._pannerAttr;
824
- else r.length === 2 && (i = r[0], a = parseInt(r[1], 10));
825
- for (var s = n._getSoundIds(a), c = 0; c < s.length; c++) if (o = n._soundById(s[c]), o) {
826
- var l = o._pannerAttr;
827
- l = {
828
- coneInnerAngle: i.coneInnerAngle === void 0 ? l.coneInnerAngle : i.coneInnerAngle,
829
- coneOuterAngle: i.coneOuterAngle === void 0 ? l.coneOuterAngle : i.coneOuterAngle,
830
- coneOuterGain: i.coneOuterGain === void 0 ? l.coneOuterGain : i.coneOuterGain,
831
- distanceModel: i.distanceModel === void 0 ? l.distanceModel : i.distanceModel,
832
- maxDistance: i.maxDistance === void 0 ? l.maxDistance : i.maxDistance,
833
- refDistance: i.refDistance === void 0 ? l.refDistance : i.refDistance,
834
- rolloffFactor: i.rolloffFactor === void 0 ? l.rolloffFactor : i.rolloffFactor,
835
- panningModel: i.panningModel === void 0 ? l.panningModel : i.panningModel
824
+ else return a = t._soundById(parseInt(n[0], 10)), a ? a._pannerAttr : t._pannerAttr;
825
+ else n.length === 2 && (r = n[0], i = parseInt(n[1], 10));
826
+ for (var o = t._getSoundIds(i), s = 0; s < o.length; s++) if (a = t._soundById(o[s]), a) {
827
+ var c = a._pannerAttr;
828
+ c = {
829
+ coneInnerAngle: r.coneInnerAngle === void 0 ? c.coneInnerAngle : r.coneInnerAngle,
830
+ coneOuterAngle: r.coneOuterAngle === void 0 ? c.coneOuterAngle : r.coneOuterAngle,
831
+ coneOuterGain: r.coneOuterGain === void 0 ? c.coneOuterGain : r.coneOuterGain,
832
+ distanceModel: r.distanceModel === void 0 ? c.distanceModel : r.distanceModel,
833
+ maxDistance: r.maxDistance === void 0 ? c.maxDistance : r.maxDistance,
834
+ refDistance: r.refDistance === void 0 ? c.refDistance : r.refDistance,
835
+ rolloffFactor: r.rolloffFactor === void 0 ? c.rolloffFactor : r.rolloffFactor,
836
+ panningModel: r.panningModel === void 0 ? c.panningModel : r.panningModel
836
837
  };
837
- var u = o._panner;
838
- u ||= (o._pos ||= n._pos || [
838
+ var l = a._panner;
839
+ l ||= (a._pos ||= t._pos || [
839
840
  0,
840
841
  0,
841
842
  -.5
842
- ], e(o, "spatial"), o._panner), u.coneInnerAngle = l.coneInnerAngle, u.coneOuterAngle = l.coneOuterAngle, u.coneOuterGain = l.coneOuterGain, u.distanceModel = l.distanceModel, u.maxDistance = l.maxDistance, u.refDistance = l.refDistance, u.rolloffFactor = l.rolloffFactor, u.panningModel = l.panningModel;
843
+ ], e(a, "spatial"), a._panner), l.coneInnerAngle = c.coneInnerAngle, l.coneOuterAngle = c.coneOuterAngle, l.coneOuterGain = c.coneOuterGain, l.distanceModel = c.distanceModel, l.maxDistance = c.maxDistance, l.refDistance = c.refDistance, l.rolloffFactor = c.rolloffFactor, l.panningModel = c.panningModel;
843
844
  }
844
- return n;
845
+ return t;
845
846
  }, Sound.prototype.init = (function(e) {
846
847
  return function() {
847
- var n = this, r = n._parent;
848
- n._orientation = r._orientation, n._stereo = r._stereo, n._pos = r._pos, n._pannerAttr = r._pannerAttr, e.call(this), n._stereo ? r.stereo(n._stereo) : n._pos && r.pos(n._pos[0], n._pos[1], n._pos[2], n._id);
848
+ var t = this, n = t._parent;
849
+ t._orientation = n._orientation, t._stereo = n._stereo, t._pos = n._pos, t._pannerAttr = n._pannerAttr, e.call(this), t._stereo ? n.stereo(t._stereo) : t._pos && n.pos(t._pos[0], t._pos[1], t._pos[2], t._id);
849
850
  };
850
851
  })(Sound.prototype.init), Sound.prototype.reset = (function(e) {
851
852
  return function() {
852
- var n = this, r = n._parent;
853
- return n._orientation = r._orientation, n._stereo = r._stereo, n._pos = r._pos, n._pannerAttr = r._pannerAttr, n._stereo ? r.stereo(n._stereo) : n._pos ? r.pos(n._pos[0], n._pos[1], n._pos[2], n._id) : n._panner && (n._panner.disconnect(0), n._panner = void 0, r._refreshBuffer(n)), e.call(this);
853
+ var t = this, n = t._parent;
854
+ return t._orientation = n._orientation, t._stereo = n._stereo, t._pos = n._pos, t._pannerAttr = n._pannerAttr, t._stereo ? n.stereo(t._stereo) : t._pos ? n.pos(t._pos[0], t._pos[1], t._pos[2], t._id) : t._panner && (t._panner.disconnect(0), t._panner = void 0, n._refreshBuffer(t)), e.call(this);
854
855
  };
855
856
  })(Sound.prototype.reset);
856
- var e = function(e, n) {
857
- n ||= "spatial", n === "spatial" ? (e._panner = Howler.ctx.createPanner(), e._panner.coneInnerAngle = e._pannerAttr.coneInnerAngle, e._panner.coneOuterAngle = e._pannerAttr.coneOuterAngle, e._panner.coneOuterGain = e._pannerAttr.coneOuterGain, e._panner.distanceModel = e._pannerAttr.distanceModel, e._panner.maxDistance = e._pannerAttr.maxDistance, e._panner.refDistance = e._pannerAttr.refDistance, e._panner.rolloffFactor = e._pannerAttr.rolloffFactor, e._panner.panningModel = e._pannerAttr.panningModel, e._panner.positionX === void 0 ? e._panner.setPosition(e._pos[0], e._pos[1], e._pos[2]) : (e._panner.positionX.setValueAtTime(e._pos[0], Howler.ctx.currentTime), e._panner.positionY.setValueAtTime(e._pos[1], Howler.ctx.currentTime), e._panner.positionZ.setValueAtTime(e._pos[2], Howler.ctx.currentTime)), e._panner.orientationX === void 0 ? e._panner.setOrientation(e._orientation[0], e._orientation[1], e._orientation[2]) : (e._panner.orientationX.setValueAtTime(e._orientation[0], Howler.ctx.currentTime), e._panner.orientationY.setValueAtTime(e._orientation[1], Howler.ctx.currentTime), e._panner.orientationZ.setValueAtTime(e._orientation[2], Howler.ctx.currentTime))) : (e._panner = Howler.ctx.createStereoPanner(), e._panner.pan.setValueAtTime(e._stereo, Howler.ctx.currentTime)), e._panner.connect(e._node), e._paused || e._parent.pause(e._id, !0).play(e._id, !0);
857
+ var e = function(e, t) {
858
+ t ||= "spatial", t === "spatial" ? (e._panner = Howler.ctx.createPanner(), e._panner.coneInnerAngle = e._pannerAttr.coneInnerAngle, e._panner.coneOuterAngle = e._pannerAttr.coneOuterAngle, e._panner.coneOuterGain = e._pannerAttr.coneOuterGain, e._panner.distanceModel = e._pannerAttr.distanceModel, e._panner.maxDistance = e._pannerAttr.maxDistance, e._panner.refDistance = e._pannerAttr.refDistance, e._panner.rolloffFactor = e._pannerAttr.rolloffFactor, e._panner.panningModel = e._pannerAttr.panningModel, e._panner.positionX === void 0 ? e._panner.setPosition(e._pos[0], e._pos[1], e._pos[2]) : (e._panner.positionX.setValueAtTime(e._pos[0], Howler.ctx.currentTime), e._panner.positionY.setValueAtTime(e._pos[1], Howler.ctx.currentTime), e._panner.positionZ.setValueAtTime(e._pos[2], Howler.ctx.currentTime)), e._panner.orientationX === void 0 ? e._panner.setOrientation(e._orientation[0], e._orientation[1], e._orientation[2]) : (e._panner.orientationX.setValueAtTime(e._orientation[0], Howler.ctx.currentTime), e._panner.orientationY.setValueAtTime(e._orientation[1], Howler.ctx.currentTime), e._panner.orientationZ.setValueAtTime(e._orientation[2], Howler.ctx.currentTime))) : (e._panner = Howler.ctx.createStereoPanner(), e._panner.pan.setValueAtTime(e._stereo, Howler.ctx.currentTime)), e._panner.connect(e._node), e._paused || e._parent.pause(e._id, !0).play(e._id, !0);
858
859
  };
859
860
  })();
860
- })), import_howler = require_howler();
861
- const BUF_BGM = "BGM", BUF_SE = "SE";
862
- var BUF_VOICE = "VOICE", MAX_END_MS = 999e3, val, errScript, getSndBuf, evtMng, hLP = {}, vol_mul_talking = 1;
863
- function delLoopPlay(e) {
864
- delete hLP[e];
865
- let n = "const.sn.sound." + e + ".";
866
- val.setVal_Nochk("save", n + "fn", ""), val.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(hLP)), val.flush();
861
+ })), s = o(), c = "VOICE", l = 999e3, u, d, f, p, m = {}, h = 1;
862
+ function g(e) {
863
+ delete m[e];
864
+ let t = "const.sn.sound." + e + ".";
865
+ u.setVal_Nochk("save", t + "fn", ""), u.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(m)), u.flush();
867
866
  }
868
- function getVol(e, r) {
869
- let i = argChk_Num(e, "volume", r);
870
- return i < 0 ? 0 : i > 1 ? 1 : i;
867
+ function _(e, n) {
868
+ let r = t(e, "volume", n);
869
+ return r < 0 ? 0 : r > 1 ? 1 : r;
871
870
  }
872
- function xchgbuf({ buf: e = "SE", buf2: n = "SE" }) {
873
- if (e === n) throw `[xchgbuf] buf:${e} が同じ値です`;
874
- let r = "const.sn.sound." + e + ".", i = Number(val.getVal("save:" + r + "volume")), a = String(val.getVal("save:" + r + "fn")), o = "const.sn.sound." + n + ".", s = Number(val.getVal("save:" + o + "volume")), c = String(val.getVal("save:" + o + "fn"));
875
- val.setVal_Nochk("save", r + "volume", s), val.setVal_Nochk("save", o + "volume", i), val.setVal_Nochk("save", r + "fn", c), val.setVal_Nochk("save", o + "fn", a), e in hLP != n in hLP && (e in hLP ? (delete hLP[e], hLP[n] = a) : (delete hLP[n], hLP[e] = c), val.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(hLP))), val.flush();
871
+ function v({ buf: e = "SE", buf2: t = "SE" }) {
872
+ if (e === t) throw `[xchgbuf] buf:${e} が同じ値です`;
873
+ let n = "const.sn.sound." + e + ".", r = Number(u.getVal("save:" + n + "volume")), i = String(u.getVal("save:" + n + "fn")), a = "const.sn.sound." + t + ".", o = Number(u.getVal("save:" + a + "volume")), s = String(u.getVal("save:" + a + "fn"));
874
+ u.setVal_Nochk("save", n + "volume", o), u.setVal_Nochk("save", a + "volume", r), u.setVal_Nochk("save", n + "fn", s), u.setVal_Nochk("save", a + "fn", i), e in m != t in m && (e in m ? (delete m[e], m[t] = i) : (delete m[t], m[e] = s), u.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(m))), u.flush();
876
875
  }
877
- var SndBuf = class e {
876
+ var y = class e {
877
+ hArg;
878
+ buf;
879
+ fn;
880
+ procID;
881
+ join;
882
+ start_ms;
883
+ end_ms;
884
+ ret_ms;
885
+ loop;
886
+ pan;
878
887
  static #e;
879
888
  static #t;
880
- static init(n, r, i, a, o) {
881
- hLP = {}, e.#e = n, val = r, errScript = (e, n) => i.errScript(e, n), e.#t = a, getSndBuf = o;
889
+ static init(t, n, r, i, a) {
890
+ m = {}, e.#e = t, u = n, d = (e, t) => r.errScript(e, t), e.#t = i, f = a;
882
891
  }
883
892
  static setEvtMng(e) {
884
- evtMng = e;
893
+ p = e;
885
894
  }
886
- static generate = (i, a, s) => new e(i, a, i.fn ?? "", Reading.procID, s, argChk_Num(i, "start_ms", 0), argChk_Num(i, "end_ms", MAX_END_MS), argChk_Num(i, "ret_ms", 0), argChk_Boolean(i, "loop", !1), argChk_Num(i, "pan", 0));
887
- stt = new StLoading(this);
888
- constructor(r, i, s, c, l, u, g, x, S, C) {
889
- if (this.hArg = r, this.buf = i, this.fn = s, this.procID = c, this.join = l, this.start_ms = u, this.end_ms = g, this.ret_ms = x, this.loop = S, this.pan = C, !s) throw `fnは必須です buf:${i}`;
890
- if (u < 0) throw `[${r[":タグ名"] ?? ""}] start_ms:${String(u)} が負の値です`;
891
- if (x < 0) throw `[${r[":タグ名"] ?? ""}] ret_ms:${String(x)} が負の値です`;
892
- if (0 < g) {
893
- if (g <= u) throw `[${r[":タグ名"] ?? ""}] start_ms:${String(u)} >= end_ms:${String(g)} は異常値です`;
894
- if (g <= x) throw `[${r[":タグ名"] ?? ""}] ret_ms:${String(x)} >= end_ms:${String(g)} は異常値です`;
895
+ static generate = (r, i, o) => new e(r, i, r.fn ?? "", a.procID, o, t(r, "start_ms", 0), t(r, "end_ms", l), t(r, "ret_ms", 0), n(r, "loop", !1), t(r, "pan", 0));
896
+ stt = new b(this);
897
+ constructor(n, r, o, s, p, v, y, b, S, C) {
898
+ if (this.hArg = n, this.buf = r, this.fn = o, this.procID = s, this.join = p, this.start_ms = v, this.end_ms = y, this.ret_ms = b, this.loop = S, this.pan = C, !o) throw `fnは必須です buf:${r}`;
899
+ if (v < 0) throw `[${n[":タグ名"] ?? ""}] start_ms:${String(v)} が負の値です`;
900
+ if (b < 0) throw `[${n[":タグ名"] ?? ""}] ret_ms:${String(b)} が負の値です`;
901
+ if (0 < y) {
902
+ if (y <= v) throw `[${n[":タグ名"] ?? ""}] start_ms:${String(v)} >= end_ms:${String(y)} は異常値です`;
903
+ if (y <= b) throw `[${n[":タグ名"] ?? ""}] ret_ms:${String(b)} >= end_ms:${String(y)} は異常値です`;
895
904
  }
896
- let w = "const.sn.sound." + i + ".";
897
- val.setVal_Nochk("save", w + "fn", s);
898
- let T = getVol(r, 1);
899
- val.setVal_Nochk("save", w + "volume", T);
900
- let E = T * Number(val.getVal("sys:" + w + "volume", 1, !0));
901
- switch (i) {
902
- case BUF_VOICE:
905
+ let w = "const.sn.sound." + r + ".";
906
+ u.setVal_Nochk("save", w + "fn", o);
907
+ let T = _(n, 1);
908
+ u.setVal_Nochk("save", w + "volume", T);
909
+ let E = T * Number(u.getVal("sys:" + w + "volume", 1, !0));
910
+ switch (r) {
911
+ case c:
903
912
  {
904
- if ((vol_mul_talking = Number(val.getVal("sys:sn.sound.BGM.vol_mul_talking") ?? 1)) === 1) break;
905
- let e = getSndBuf("BGM"), n = "const.sn.sound.BGM.volume";
906
- e && (e.volume = Number(val.getVal("save:" + n, 1)) * Number(val.getVal("sys:" + n, 1, !0)) * vol_mul_talking);
913
+ if ((h = Number(u.getVal("sys:sn.sound.BGM.vol_mul_talking") ?? 1)) === 1) break;
914
+ let e = f("BGM");
915
+ e && (e.volume = Number(u.getVal("save:const.sn.sound.BGM.volume", 1)) * Number(u.getVal("sys:const.sn.sound.BGM.volume", 1, !0)) * h);
907
916
  }
908
917
  break;
909
918
  case "BGM":
910
- E *= vol_mul_talking;
919
+ E *= h;
911
920
  break;
912
921
  }
913
- S ? (hLP[i] = s, val.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(hLP))) : delLoopPlay(i), val.setVal_Nochk("save", w + "start_ms", u), val.setVal_Nochk("save", w + "end_ms", g), val.setVal_Nochk("save", w + "ret_ms", x), val.setVal_Nochk("tmp", w + "playing", !0), val.flush();
922
+ S ? (m[r] = o, u.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(m))) : g(r), u.setVal_Nochk("save", w + "start_ms", v), u.setVal_Nochk("save", w + "end_ms", y), u.setVal_Nochk("save", w + "ret_ms", b), u.setVal_Nochk("tmp", w + "playing", !0), u.flush();
914
923
  let D = () => {};
915
- if (l) {
916
- let e = c + ` loaded buf:${i} fn:${s}`;
917
- Reading.beginProc(e), D = () => Reading.endProc(e);
924
+ if (p) {
925
+ let e = s + ` loaded buf:${r} fn:${o}`;
926
+ a.beginProc(e), D = () => a.endProc(e);
918
927
  }
919
- let O = e.#e.searchPath(s, SEARCH_PATH_ARG_EXT.SOUND), k = {
928
+ let O = e.#e.searchPath(o, i.SOUND), k = {
920
929
  src: O,
921
930
  volume: E,
922
931
  html5: !1,
923
932
  loop: S,
924
933
  autoplay: !0,
925
- rate: argChk_Num(r, "speed", 1),
934
+ rate: t(n, "speed", 1),
926
935
  onload: () => {
927
- D(), r.fnc?.(), this.stt = new StPlaying(this, this.#n);
936
+ D(), n.fnc?.(), this.stt = new x(this, this.#n);
928
937
  },
929
- onloaderror: (e, n) => {
930
- D(), errScript(`SndBuf ロード失敗です fn:${s} ${String(n)}`, !1);
938
+ onloaderror: (e, t) => {
939
+ D(), d(`SndBuf ロード失敗です fn:${o} ${String(t)}`, !1);
931
940
  }
932
941
  };
933
- if (S || (k.onend = () => this.stt.onend()), u > 0 || g !== MAX_END_MS || x > 0) {
942
+ if (S || (k.onend = () => this.stt.onend()), v > 0 || y !== l || b > 0) {
934
943
  k.autoplay = !1;
935
- let { 一周目: e, 二周目: n } = k.sprite = {
936
- 一周目: [u, g - u],
944
+ let { 一周目: e, 二周目: t } = k.sprite = {
945
+ 一周目: [v, y - v],
937
946
  二周目: [
938
- x,
939
- g - x,
947
+ b,
948
+ y - b,
940
949
  !0
941
950
  ]
942
- }, i = k.onload;
943
- if (k.onload = (a) => {
944
- i(a);
945
- let o = this.#n.duration() * 1e3;
946
- o <= u && errScript(`[${r[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(o)} <= ret_ms:${String(x)} は異常値です`), g < 0 ? (e[1] = o + g - u, n[1] = o + g - x) : g === MAX_END_MS && (e[1] = o - u, n[1] = o - x);
947
- let s = e[1] + u;
948
- s <= u && errScript(`[${r[":タグ名"] ?? ""}] end_ms:${String(g)}(${String(s)}) >= start_ms:${String(u)} は異常値です`), s <= x && errScript(`[${r[":タグ名"] ?? ""}] end_ms:${String(g)}(${String(s)}) <= ret_ms:${String(x)} は異常値です`), o <= u && errScript(`[${r[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(o)} <= start_ms:${String(u)} は異常値です`), g !== MAX_END_MS && o <= s && errScript(`[${r[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(o)} <= end_ms:${String(g)} は異常値です`), this.#n.play("一周目");
949
- }, S && x > 0) {
951
+ }, r = k.onload;
952
+ if (k.onload = (i) => {
953
+ r(i);
954
+ let a = this.#n.duration() * 1e3;
955
+ a <= v && d(`[${n[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(a)} <= ret_ms:${String(b)} は異常値です`), y < 0 ? (e[1] = a + y - v, t[1] = a + y - b) : y === l && (e[1] = a - v, t[1] = a - b);
956
+ let o = e[1] + v;
957
+ o <= v && d(`[${n[":タグ名"] ?? ""}] end_ms:${String(y)}(${String(o)}) >= start_ms:${String(v)} は異常値です`), o <= b && d(`[${n[":タグ名"] ?? ""}] end_ms:${String(y)}(${String(o)}) <= ret_ms:${String(b)} は異常値です`), a <= v && d(`[${n[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(a)} <= start_ms:${String(v)} は異常値です`), y !== l && a <= o && d(`[${n[":タグ名"] ?? ""}] 音声ファイル再生時間:${String(a)} <= end_ms:${String(y)} は異常値です`), this.#n.play("一周目");
958
+ }, S && b > 0) {
950
959
  delete k.loop;
951
960
  let e = () => {
952
961
  e = () => {}, this.#n.play("二周目");
@@ -958,16 +967,16 @@ var SndBuf = class e {
958
967
  this.#r(k);
959
968
  return;
960
969
  }
961
- e.#t.fetch(O).then(async (n) => {
962
- n.ok || errScript(`SndBuf ロード失敗です d1 fn:${s} ${n.statusText}`, !0);
963
- let r = await n.arrayBuffer(), i = await e.#t.decAB(r).catch((e) => errScript(`SndBuf ロード失敗です d2 fn:${s} ${String(e)}`, !1)), a = new Uint8Array(i), o = new Blob([a], { type: "music/mp3" }), c = URL.createObjectURL(o);
964
- k.src = c, k.format = "mp3", k.onplay = () => URL.revokeObjectURL(c), this.#r(k);
970
+ e.#t.fetch(O).then(async (t) => {
971
+ t.ok || d(`SndBuf ロード失敗です d1 fn:${o} ${t.statusText}`, !0);
972
+ let n = await t.arrayBuffer(), r = await e.#t.decAB(n).catch((e) => d(`SndBuf ロード失敗です d2 fn:${o} ${String(e)}`, !1)), i = new Uint8Array(r), a = new Blob([i], { type: "music/mp3" }), s = URL.createObjectURL(a);
973
+ k.src = s, k.format = "mp3", k.onplay = () => URL.revokeObjectURL(s), this.#r(k);
965
974
  });
966
975
  }
967
976
  #n;
968
977
  #r(e) {
969
- let n = this.#n = new import_howler.Howl(e);
970
- this.pan !== 0 && n.stereo(this.pan), !this.loop && CmnLib.needClick2Play() && setTimeout(() => e.onend?.(0), (n.duration() - this.start_ms - (this.end_ms <= 0 ? this.end_ms : this.end_ms === MAX_END_MS ? 0 : n.duration() - this.end_ms)) * 1e3);
978
+ let t = this.#n = new s.Howl(e);
979
+ this.pan !== 0 && t.stereo(this.pan), !this.loop && r.needClick2Play() && setTimeout(() => e.onend?.(0), (t.duration() - this.start_ms - (this.end_ms <= 0 ? this.end_ms : this.end_ms === l ? 0 : t.duration() - this.end_ms)) * 1e3);
971
980
  }
972
981
  stopse() {
973
982
  this.stt.stopse();
@@ -981,7 +990,8 @@ var SndBuf = class e {
981
990
  set volume(e) {
982
991
  this.#n.volume(e);
983
992
  }
984
- }, StLoading = class {
993
+ }, b = class {
994
+ sb;
985
995
  constructor(e) {
986
996
  this.sb = e;
987
997
  }
@@ -990,104 +1000,114 @@ var SndBuf = class e {
990
1000
  }
991
1001
  onfade() {}
992
1002
  stopse() {
993
- this.sb.stt = new StStop(this.sb);
1003
+ this.sb.stt = new T(this.sb);
994
1004
  }
995
1005
  ws = () => !1;
996
1006
  fade() {}
997
1007
  wf = () => !1;
998
- }, StPlaying = class {
999
- constructor(e, n) {
1000
- this.sb = e, this.snd = n;
1008
+ }, x = class {
1009
+ sb;
1010
+ snd;
1011
+ constructor(e, t) {
1012
+ this.sb = e, this.snd = t;
1001
1013
  }
1002
1014
  onend() {
1003
1015
  this.stopse();
1004
1016
  }
1005
1017
  onfade() {}
1006
1018
  stopse() {
1007
- this.sb.stt = new StStop(this.sb, this.snd);
1019
+ this.sb.stt = new T(this.sb, this.snd);
1008
1020
  }
1009
1021
  ws(e) {
1010
- let { sb: n } = this;
1011
- if (n.loop) return !1;
1012
- n.stt = new StWaitingStop(n, this.snd);
1013
- let i = argChk_Boolean(e, "canskip", !1), a = argChk_Boolean(e, "stop", !0) ? () => n.stt.stopse() : () => {};
1014
- return i && evtMng.isSkipping ? (a(), !1) : (Reading.beginProc(n.procID + "ws", a, !0, i ? a : void 0), !0);
1022
+ let { sb: t } = this;
1023
+ if (t.loop) return !1;
1024
+ t.stt = new S(t, this.snd);
1025
+ let r = n(e, "canskip", !1), i = n(e, "stop", !0) ? () => t.stt.stopse() : () => {};
1026
+ return r && p.isSkipping ? (i(), !1) : (a.beginProc(t.procID + "ws", i, !0, r ? i : void 0), !0);
1015
1027
  }
1016
1028
  fade(e) {
1017
- let { buf: i = "SE" } = e, a = "const.sn.sound." + i + ".volume", o = getVol(e, NaN);
1018
- val.setVal_Nochk("save", a, o);
1019
- let s = o * Number(val.getVal("sys:" + a, 1)), c = argChk_Boolean(e, "stop", o === 0);
1020
- c && delLoopPlay(i), val.flush();
1021
- let l = argChk_Num(e, "time", NaN), u = argChk_Num(e, "delay", 0), { sb: d, snd: f } = this;
1022
- if (l === 0 && u === 0 || evtMng.isSkipping) {
1023
- f.volume(s), c && (d.stt = new StStop(d, f));
1029
+ let { buf: r = "SE" } = e, i = "const.sn.sound." + r + ".volume", a = _(e, NaN);
1030
+ u.setVal_Nochk("save", i, a);
1031
+ let o = a * Number(u.getVal("sys:" + i, 1)), s = n(e, "stop", a === 0);
1032
+ s && g(r), u.flush();
1033
+ let c = t(e, "time", NaN), l = t(e, "delay", 0), { sb: d, snd: f } = this;
1034
+ if (c === 0 && l === 0 || p.isSkipping) {
1035
+ f.volume(o), s && (d.stt = new T(d, f));
1024
1036
  return;
1025
1037
  }
1026
- f.fade(f.volume(), s, l).once("fade", () => {
1027
- d.stt.onfade(), c && (d.stt = new StStop(d, f));
1028
- }), d.stt = new StFade(d, c, f);
1038
+ f.fade(f.volume(), o, c).once("fade", () => {
1039
+ d.stt.onfade(), s && (d.stt = new T(d, f));
1040
+ }), d.stt = new C(d, s, f);
1029
1041
  }
1030
1042
  wf = () => !1;
1031
- }, StWaitingStop = class {
1032
- constructor(e, n) {
1033
- this.sb = e, this.snd = n;
1043
+ }, S = class {
1044
+ sb;
1045
+ snd;
1046
+ constructor(e, t) {
1047
+ this.sb = e, this.snd = t;
1034
1048
  }
1035
1049
  onend() {
1036
1050
  this.stopse();
1037
1051
  }
1038
1052
  onfade() {}
1039
1053
  stopse() {
1040
- this.sb.stt = new StStop(this.sb, this.snd), Reading.notifyEndProc(this.sb.procID + "ws");
1054
+ this.sb.stt = new T(this.sb, this.snd), a.notifyEndProc(this.sb.procID + "ws");
1041
1055
  }
1042
1056
  ws = () => !1;
1043
1057
  fade() {}
1044
1058
  wf = () => !1;
1045
- }, StFade = class {
1046
- constructor(e, n, r) {
1047
- this.sb = e, this.stopOnFade = n, this.snd = r;
1059
+ }, C = class {
1060
+ sb;
1061
+ stopOnFade;
1062
+ snd;
1063
+ constructor(e, t, n) {
1064
+ this.sb = e, this.stopOnFade = t, this.snd = n;
1048
1065
  }
1049
1066
  onend() {
1050
1067
  this.stopse();
1051
1068
  }
1052
1069
  onfade() {
1053
- this.stopOnFade ? this.stopse() : this.sb.stt = new StPlaying(this.sb, this.snd);
1070
+ this.stopOnFade ? this.stopse() : this.sb.stt = new x(this.sb, this.snd);
1054
1071
  }
1055
1072
  stopse() {
1056
- this.sb.stt = new StStop(this.sb, this.snd);
1073
+ this.sb.stt = new T(this.sb, this.snd);
1057
1074
  }
1058
1075
  ws = () => !1;
1059
1076
  fade() {}
1060
1077
  wf(e) {
1061
- let { sb: n } = this;
1062
- n.stt = new StWaitingFade(n, this.stopOnFade, this.snd);
1063
- let i = argChk_Boolean(e, "canskip", !1);
1064
- if (i && evtMng.isSkipping) return !1;
1065
- let a = () => {};
1066
- return Reading.beginProc(n.procID + "wf", a, !0, i ? a : void 0), !0;
1078
+ let { sb: t } = this;
1079
+ t.stt = new w(t, this.stopOnFade, this.snd);
1080
+ let r = n(e, "canskip", !1);
1081
+ if (r && p.isSkipping) return !1;
1082
+ let i = () => {};
1083
+ return a.beginProc(t.procID + "wf", i, !0, r ? i : void 0), !0;
1067
1084
  }
1068
- }, StWaitingFade = class {
1069
- constructor(e, n, r) {
1070
- this.sb = e, this.stopOnFade = n, this.snd = r;
1085
+ }, w = class {
1086
+ sb;
1087
+ stopOnFade;
1088
+ snd;
1089
+ constructor(e, t, n) {
1090
+ this.sb = e, this.stopOnFade = t, this.snd = n;
1071
1091
  }
1072
1092
  onend() {
1073
1093
  this.stopse();
1074
1094
  }
1075
1095
  onfade() {
1076
- this.stopOnFade ? this.stopse() : this.sb.stt = new StPlaying(this.sb, this.snd), Reading.notifyEndProc(this.sb.procID + "wf");
1096
+ this.stopOnFade ? this.stopse() : this.sb.stt = new x(this.sb, this.snd), a.notifyEndProc(this.sb.procID + "wf");
1077
1097
  }
1078
1098
  stopse() {
1079
- this.sb.stt = new StStop(this.sb, this.snd);
1099
+ this.sb.stt = new T(this.sb, this.snd);
1080
1100
  }
1081
1101
  ws = () => !1;
1082
1102
  fade() {}
1083
1103
  wf = () => !1;
1084
- }, StStop = class {
1085
- constructor(e, n) {
1086
- e.loop && delLoopPlay(e.buf);
1087
- let r = "const.sn.sound." + e.buf + ".";
1088
- if (val.setVal_Nochk("tmp", r + "playing", !1), val.flush(), n?.unload(), e.buf !== BUF_VOICE) return;
1089
- let i = getSndBuf("BGM");
1090
- i && (i.volume = Number(val.getVal("save:" + r + "volume", 1, !0)) * Number(val.getVal("sys:" + r + "volume", 1, !0))), vol_mul_talking = 1;
1104
+ }, T = class {
1105
+ constructor(e, t) {
1106
+ e.loop && g(e.buf);
1107
+ let n = "const.sn.sound." + e.buf + ".";
1108
+ if (u.setVal_Nochk("tmp", n + "playing", !1), u.flush(), t?.unload(), e.buf !== c) return;
1109
+ let r = f("BGM");
1110
+ r && (r.volume = Number(u.getVal("save:" + n + "volume", 1, !0)) * Number(u.getVal("sys:" + n + "volume", 1, !0))), h = 1;
1091
1111
  }
1092
1112
  onend() {}
1093
1113
  onfade() {}
@@ -1096,6 +1116,7 @@ var SndBuf = class e {
1096
1116
  fade() {}
1097
1117
  wf = () => !1;
1098
1118
  };
1099
- export { require_howler as a, xchgbuf as i, BUF_SE as n, SndBuf as r, BUF_BGM as t };
1119
+ //#endregion
1120
+ export { v as n, o as r, y as t };
1100
1121
 
1101
1122
  //# sourceMappingURL=SndBuf.js.map