@clockworkdog/cogs-client 3.0.0-alpha.10 → 3.0.0-alpha.13
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.
- package/dist/browser/index.mjs +522 -489
- package/dist/browser/index.umd.js +5 -5
- package/dist/state-based/MediaClipManager.d.ts +2 -1
- package/dist/state-based/MediaClipManager.js +31 -11
- package/dist/state-based/MediaPreloader.js +8 -1
- package/dist/state-based/SurfaceManager.d.ts +2 -1
- package/dist/state-based/SurfaceManager.js +6 -4
- package/dist/utils/getStateAtTime.js +5 -0
- package/package.json +2 -2
package/dist/browser/index.mjs
CHANGED
|
@@ -13,15 +13,15 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
var
|
|
17
|
-
return
|
|
16
|
+
var Se = function(e, t) {
|
|
17
|
+
return Se = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
|
|
18
18
|
n.__proto__ = o;
|
|
19
19
|
} || function(n, o) {
|
|
20
20
|
for (var i in o) o.hasOwnProperty(i) && (n[i] = o[i]);
|
|
21
|
-
},
|
|
21
|
+
}, Se(e, t);
|
|
22
22
|
};
|
|
23
23
|
function Et(e, t) {
|
|
24
|
-
|
|
24
|
+
Se(e, t);
|
|
25
25
|
function n() {
|
|
26
26
|
this.constructor = e;
|
|
27
27
|
}
|
|
@@ -38,16 +38,16 @@ function on(e) {
|
|
|
38
38
|
function rn(e, t) {
|
|
39
39
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
40
40
|
if (!n) return e;
|
|
41
|
-
var o = n.call(e), i, a = [],
|
|
41
|
+
var o = n.call(e), i, a = [], u;
|
|
42
42
|
try {
|
|
43
43
|
for (; (t === void 0 || t-- > 0) && !(i = o.next()).done; ) a.push(i.value);
|
|
44
44
|
} catch (l) {
|
|
45
|
-
|
|
45
|
+
u = { error: l };
|
|
46
46
|
} finally {
|
|
47
47
|
try {
|
|
48
48
|
i && !i.done && (n = o.return) && n.call(o);
|
|
49
49
|
} finally {
|
|
50
|
-
if (
|
|
50
|
+
if (u) throw u.error;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
return a;
|
|
@@ -118,7 +118,7 @@ var cn = function() {
|
|
|
118
118
|
close: []
|
|
119
119
|
}, this._retryCount = -1, this._shouldReconnect = !0, this._connectLock = !1, this._binaryType = "blob", this._closeCalled = !1, this._messageQueue = [], this.onclose = null, this.onerror = null, this.onmessage = null, this.onopen = null, this._handleOpen = function(a) {
|
|
120
120
|
i._debug("open event");
|
|
121
|
-
var
|
|
121
|
+
var u = i._options.minUptime, l = u === void 0 ? M.minUptime : u;
|
|
122
122
|
clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
|
|
123
123
|
return i._acceptOpen();
|
|
124
124
|
}, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(p) {
|
|
@@ -127,16 +127,16 @@ var cn = function() {
|
|
|
127
127
|
return i._callEventListener(a, p);
|
|
128
128
|
});
|
|
129
129
|
}, this._handleMessage = function(a) {
|
|
130
|
-
i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(
|
|
131
|
-
return i._callEventListener(a,
|
|
130
|
+
i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(u) {
|
|
131
|
+
return i._callEventListener(a, u);
|
|
132
132
|
});
|
|
133
133
|
}, this._handleError = function(a) {
|
|
134
|
-
i._debug("error event", a.message), i._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), i.onerror && i.onerror(a), i._debug("exec error listeners"), i._listeners.error.forEach(function(
|
|
135
|
-
return i._callEventListener(a,
|
|
134
|
+
i._debug("error event", a.message), i._disconnect(void 0, a.message === "TIMEOUT" ? "timeout" : void 0), i.onerror && i.onerror(a), i._debug("exec error listeners"), i._listeners.error.forEach(function(u) {
|
|
135
|
+
return i._callEventListener(a, u);
|
|
136
136
|
}), i._connect();
|
|
137
137
|
}, this._handleClose = function(a) {
|
|
138
|
-
i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(a), i._listeners.close.forEach(function(
|
|
139
|
-
return i._callEventListener(a,
|
|
138
|
+
i._debug("close event"), i._clearTimeouts(), i._shouldReconnect && i._connect(), i.onclose && i.onclose(a), i._listeners.close.forEach(function(u) {
|
|
139
|
+
return i._callEventListener(a, u);
|
|
140
140
|
});
|
|
141
141
|
}, this._url = t, this._protocols = n, this._options = o, this._options.startClosed && (this._shouldReconnect = !1), this._connect();
|
|
142
142
|
}
|
|
@@ -285,15 +285,15 @@ var cn = function() {
|
|
|
285
285
|
var n, o, i = this._listeners[t.type];
|
|
286
286
|
if (i)
|
|
287
287
|
try {
|
|
288
|
-
for (var a = on(i),
|
|
289
|
-
var l =
|
|
288
|
+
for (var a = on(i), u = a.next(); !u.done; u = a.next()) {
|
|
289
|
+
var l = u.value;
|
|
290
290
|
this._callEventListener(t, l);
|
|
291
291
|
}
|
|
292
292
|
} catch (p) {
|
|
293
293
|
n = { error: p };
|
|
294
294
|
} finally {
|
|
295
295
|
try {
|
|
296
|
-
|
|
296
|
+
u && !u.done && (o = a.return) && o.call(a);
|
|
297
297
|
} finally {
|
|
298
298
|
if (n) throw n.error;
|
|
299
299
|
}
|
|
@@ -308,7 +308,7 @@ var cn = function() {
|
|
|
308
308
|
t[n] = arguments[n];
|
|
309
309
|
this._options.debug && console.log.apply(console, sn(["RWS>"], t));
|
|
310
310
|
}, e.prototype._getNextDelay = function() {
|
|
311
|
-
var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? M.minReconnectionDelay : i,
|
|
311
|
+
var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? M.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? M.minReconnectionDelay : i, u = t.maxReconnectionDelay, l = u === void 0 ? M.maxReconnectionDelay : u, p = 0;
|
|
312
312
|
return this._retryCount > 0 && (p = a * Math.pow(o, this._retryCount - 1), p > l && (p = l)), this._debug("next delay", p), p;
|
|
313
313
|
}, e.prototype._wait = function() {
|
|
314
314
|
var t = this;
|
|
@@ -330,7 +330,7 @@ var cn = function() {
|
|
|
330
330
|
var t = this;
|
|
331
331
|
if (!(this._connectLock || !this._shouldReconnect)) {
|
|
332
332
|
this._connectLock = !0;
|
|
333
|
-
var n = this._options, o = n.maxRetries, i = o === void 0 ? M.maxRetries : o, a = n.connectionTimeout,
|
|
333
|
+
var n = this._options, o = n.maxRetries, i = o === void 0 ? M.maxRetries : o, a = n.connectionTimeout, u = a === void 0 ? M.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? cn() : l;
|
|
334
334
|
if (this._retryCount >= i) {
|
|
335
335
|
this._debug("max retries reached", this._retryCount, ">=", i);
|
|
336
336
|
return;
|
|
@@ -342,7 +342,7 @@ var cn = function() {
|
|
|
342
342
|
}).then(function(h) {
|
|
343
343
|
t._closeCalled || (t._debug("connect", { url: h, protocols: t._protocols }), t._ws = t._protocols ? new p(h, t._protocols) : new p(h), t._ws.binaryType = t._binaryType, t._connectLock = !1, t._addListeners(), t._connectTimeout = setTimeout(function() {
|
|
344
344
|
return t._handleTimeout();
|
|
345
|
-
},
|
|
345
|
+
}, u));
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
}, e.prototype._handleTimeout = function() {
|
|
@@ -368,10 +368,10 @@ var cn = function() {
|
|
|
368
368
|
}, e;
|
|
369
369
|
}()
|
|
370
370
|
);
|
|
371
|
-
const
|
|
371
|
+
const At = 12095;
|
|
372
372
|
function pn(e) {
|
|
373
373
|
const t = typeof window < "u" ? window.location : void 0, n = `/assets/${encodeURIComponent(e)}`;
|
|
374
|
-
return `${t?.protocol}//${t?.hostname}:${
|
|
374
|
+
return `${t?.protocol}//${t?.hostname}:${At}${n}`;
|
|
375
375
|
}
|
|
376
376
|
async function ka(e) {
|
|
377
377
|
const t = await fetch(e);
|
|
@@ -440,16 +440,16 @@ function mn() {
|
|
|
440
440
|
const vn = 5, gn = 1e4;
|
|
441
441
|
function yn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = vn, syncRequestTimeout: i = gn }) {
|
|
442
442
|
const a = {};
|
|
443
|
-
async function
|
|
443
|
+
async function u() {
|
|
444
444
|
const y = [];
|
|
445
445
|
for (let s = 0; s < o; s++) {
|
|
446
|
-
const
|
|
446
|
+
const c = new Promise((d) => {
|
|
447
447
|
const f = mn(), v = Date.now(), _ = performance.now();
|
|
448
448
|
t({ timesync: { id: f } });
|
|
449
449
|
const w = (k, E) => d({ sentAt: _, receivedAt: k, serverNow: E, clientNow: v });
|
|
450
450
|
a[f] = { complete: w }, setTimeout(() => d(null), i);
|
|
451
451
|
});
|
|
452
|
-
y.push(
|
|
452
|
+
y.push(c), await c;
|
|
453
453
|
}
|
|
454
454
|
const g = (await Promise.all(y)).filter((s) => s !== null), r = bn(g);
|
|
455
455
|
isNaN(r) || n(Date.now() + r);
|
|
@@ -458,8 +458,8 @@ function yn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = vn, sy
|
|
|
458
458
|
const g = performance.now(), r = a[y.timesync.id];
|
|
459
459
|
r && r.complete(g, y.timesync.now);
|
|
460
460
|
};
|
|
461
|
-
|
|
462
|
-
const p = setInterval(
|
|
461
|
+
u();
|
|
462
|
+
const p = setInterval(u, e);
|
|
463
463
|
return {
|
|
464
464
|
receive: l,
|
|
465
465
|
destroy: () => {
|
|
@@ -474,12 +474,12 @@ function bn(e) {
|
|
|
474
474
|
}).reduce((t, n) => t + n, 0) / e.length;
|
|
475
475
|
}
|
|
476
476
|
class Ea {
|
|
477
|
-
constructor(t, { hostname: n = document.location.hostname, port: o =
|
|
477
|
+
constructor(t, { hostname: n = document.location.hostname, port: o = At } = {}, i, a) {
|
|
478
478
|
this.manifest = t, this.currentState = { ...i }, this.store = new fn(a ?? {});
|
|
479
|
-
const { useReconnectingWebsocket:
|
|
479
|
+
const { useReconnectingWebsocket: u, path: l, pathParams: p } = wn(document.location.href);
|
|
480
480
|
this.urlParams = new URLSearchParams(p), this.urlParams.set("screenWidth", window.screen.width.toString()), this.urlParams.set("screenHeight", window.screen.height.toString()), this.urlParams.set("screenPixelRatio", window.devicePixelRatio.toString());
|
|
481
481
|
const h = `ws://${n}:${o}${l}?${this.urlParams}`;
|
|
482
|
-
this.websocket =
|
|
482
|
+
this.websocket = u ? new dn(h) : new WebSocket(h);
|
|
483
483
|
let y;
|
|
484
484
|
this.websocket.onopen = () => {
|
|
485
485
|
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new kn()), this.setState(this.currentState), y = yn({
|
|
@@ -505,9 +505,9 @@ class Ea {
|
|
|
505
505
|
const r = JSON.parse(g);
|
|
506
506
|
try {
|
|
507
507
|
if (r.config)
|
|
508
|
-
this.currentConfig = r.config, this.dispatchEvent(new
|
|
508
|
+
this.currentConfig = r.config, this.dispatchEvent(new An(this.currentConfig));
|
|
509
509
|
else if (r.updates)
|
|
510
|
-
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new
|
|
510
|
+
this.currentState = { ...this.currentState, ...r.updates }, this.dispatchEvent(new Sn(r.updates));
|
|
511
511
|
else if (r.event && r.event.key)
|
|
512
512
|
this.dispatchEvent(
|
|
513
513
|
new Tn(r.event.key, r.event.value)
|
|
@@ -527,8 +527,8 @@ class Ea {
|
|
|
527
527
|
break;
|
|
528
528
|
case "media_config_update":
|
|
529
529
|
this._mediaConfig = s;
|
|
530
|
-
for (const
|
|
531
|
-
s[
|
|
530
|
+
for (const c of ["preferOptimizedAudio", "preferOptimizedVideo", "preferOptimizedImages"])
|
|
531
|
+
s[c] ? this.urlParams.set(c, "true") : this.urlParams.delete(c);
|
|
532
532
|
this.dispatchEvent(new zn(s));
|
|
533
533
|
break;
|
|
534
534
|
case "data_store_items":
|
|
@@ -656,7 +656,7 @@ class Ea {
|
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
function wn(e) {
|
|
659
|
-
const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true", a = n.get("display") ?? "",
|
|
659
|
+
const t = new URL(e), n = new URLSearchParams(t.searchParams), o = n.get("local_id"), i = n.get("simulator") === "true", a = n.get("display") ?? "", u = t.pathname.startsWith("/plugin/") ? decodeURIComponent(t.pathname.split("/")[2]) : void 0;
|
|
660
660
|
if (o) {
|
|
661
661
|
const l = n.get("t") ?? "";
|
|
662
662
|
return n.delete("local_id"), {
|
|
@@ -677,9 +677,9 @@ function wn(e) {
|
|
|
677
677
|
path: `/display/${encodeURIComponent(a)}/${encodeURIComponent(l)}`
|
|
678
678
|
};
|
|
679
679
|
} else {
|
|
680
|
-
if (
|
|
680
|
+
if (u)
|
|
681
681
|
return {
|
|
682
|
-
path: `/plugin/${encodeURIComponent(
|
|
682
|
+
path: `/plugin/${encodeURIComponent(u)}`,
|
|
683
683
|
useReconnectingWebsocket: !0
|
|
684
684
|
};
|
|
685
685
|
{
|
|
@@ -709,13 +709,13 @@ class Cn extends Event {
|
|
|
709
709
|
}
|
|
710
710
|
_cogsConnectionEventType = "message";
|
|
711
711
|
}
|
|
712
|
-
class
|
|
712
|
+
class An extends Event {
|
|
713
713
|
constructor(t) {
|
|
714
714
|
super("config"), this.config = t;
|
|
715
715
|
}
|
|
716
716
|
_cogsConnectionEventType = "config";
|
|
717
717
|
}
|
|
718
|
-
class
|
|
718
|
+
class Sn extends Event {
|
|
719
719
|
constructor(t) {
|
|
720
720
|
super("state"), this.state = t;
|
|
721
721
|
}
|
|
@@ -745,14 +745,14 @@ function m(e, t, n) {
|
|
|
745
745
|
if (l._zod || Object.defineProperty(l, "_zod", {
|
|
746
746
|
value: {
|
|
747
747
|
def: p,
|
|
748
|
-
constr:
|
|
748
|
+
constr: u,
|
|
749
749
|
traits: /* @__PURE__ */ new Set()
|
|
750
750
|
},
|
|
751
751
|
enumerable: !1
|
|
752
752
|
}), l._zod.traits.has(e))
|
|
753
753
|
return;
|
|
754
754
|
l._zod.traits.add(e), t(l, p);
|
|
755
|
-
const h =
|
|
755
|
+
const h = u.prototype, y = Object.keys(h);
|
|
756
756
|
for (let g = 0; g < y.length; g++) {
|
|
757
757
|
const r = y[g];
|
|
758
758
|
r in l || (l[r] = h[r].bind(l));
|
|
@@ -762,7 +762,7 @@ function m(e, t, n) {
|
|
|
762
762
|
class a extends i {
|
|
763
763
|
}
|
|
764
764
|
Object.defineProperty(a, "name", { value: e });
|
|
765
|
-
function
|
|
765
|
+
function u(l) {
|
|
766
766
|
var p;
|
|
767
767
|
const h = n?.Parent ? new a() : this;
|
|
768
768
|
o(h, l), (p = h._zod).deferred ?? (p.deferred = []);
|
|
@@ -770,16 +770,16 @@ function m(e, t, n) {
|
|
|
770
770
|
y();
|
|
771
771
|
return h;
|
|
772
772
|
}
|
|
773
|
-
return Object.defineProperty(
|
|
773
|
+
return Object.defineProperty(u, "init", { value: o }), Object.defineProperty(u, Symbol.hasInstance, {
|
|
774
774
|
value: (l) => n?.Parent && l instanceof n.Parent ? !0 : l?._zod?.traits?.has(e)
|
|
775
|
-
}), Object.defineProperty(
|
|
775
|
+
}), Object.defineProperty(u, "name", { value: e }), u;
|
|
776
776
|
}
|
|
777
777
|
class K extends Error {
|
|
778
778
|
constructor() {
|
|
779
779
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
class
|
|
782
|
+
class St extends Error {
|
|
783
783
|
constructor(t) {
|
|
784
784
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
785
785
|
}
|
|
@@ -819,8 +819,8 @@ function $n(e, t) {
|
|
|
819
819
|
const p = o.match(/\d?e-(\d?)/);
|
|
820
820
|
p?.[1] && (i = Number.parseInt(p[1]));
|
|
821
821
|
}
|
|
822
|
-
const a = n > i ? n : i,
|
|
823
|
-
return
|
|
822
|
+
const a = n > i ? n : i, u = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
|
|
823
|
+
return u % l / 10 ** a;
|
|
824
824
|
}
|
|
825
825
|
const Ke = Symbol("evaluating");
|
|
826
826
|
function C(e, t, n) {
|
|
@@ -996,20 +996,20 @@ function Fn(e, t, n) {
|
|
|
996
996
|
get shape() {
|
|
997
997
|
const i = t._zod.def.shape, a = { ...i };
|
|
998
998
|
if (n)
|
|
999
|
-
for (const
|
|
1000
|
-
if (!(
|
|
1001
|
-
throw new Error(`Unrecognized key: "${
|
|
1002
|
-
n[
|
|
999
|
+
for (const u in n) {
|
|
1000
|
+
if (!(u in i))
|
|
1001
|
+
throw new Error(`Unrecognized key: "${u}"`);
|
|
1002
|
+
n[u] && (a[u] = e ? new e({
|
|
1003
1003
|
type: "optional",
|
|
1004
|
-
innerType: i[
|
|
1005
|
-
}) : i[
|
|
1004
|
+
innerType: i[u]
|
|
1005
|
+
}) : i[u]);
|
|
1006
1006
|
}
|
|
1007
1007
|
else
|
|
1008
|
-
for (const
|
|
1009
|
-
a[
|
|
1008
|
+
for (const u in i)
|
|
1009
|
+
a[u] = e ? new e({
|
|
1010
1010
|
type: "optional",
|
|
1011
|
-
innerType: i[
|
|
1012
|
-
}) : i[
|
|
1011
|
+
innerType: i[u]
|
|
1012
|
+
}) : i[u];
|
|
1013
1013
|
return V(this, "shape", a), a;
|
|
1014
1014
|
},
|
|
1015
1015
|
checks: []
|
|
@@ -1021,19 +1021,19 @@ function Vn(e, t, n) {
|
|
|
1021
1021
|
get shape() {
|
|
1022
1022
|
const i = t._zod.def.shape, a = { ...i };
|
|
1023
1023
|
if (n)
|
|
1024
|
-
for (const
|
|
1025
|
-
if (!(
|
|
1026
|
-
throw new Error(`Unrecognized key: "${
|
|
1027
|
-
n[
|
|
1024
|
+
for (const u in n) {
|
|
1025
|
+
if (!(u in a))
|
|
1026
|
+
throw new Error(`Unrecognized key: "${u}"`);
|
|
1027
|
+
n[u] && (a[u] = new e({
|
|
1028
1028
|
type: "nonoptional",
|
|
1029
|
-
innerType: i[
|
|
1029
|
+
innerType: i[u]
|
|
1030
1030
|
}));
|
|
1031
1031
|
}
|
|
1032
1032
|
else
|
|
1033
|
-
for (const
|
|
1034
|
-
a[
|
|
1033
|
+
for (const u in i)
|
|
1034
|
+
a[u] = new e({
|
|
1035
1035
|
type: "nonoptional",
|
|
1036
|
-
innerType: i[
|
|
1036
|
+
innerType: i[u]
|
|
1037
1037
|
});
|
|
1038
1038
|
return V(this, "shape", a), a;
|
|
1039
1039
|
},
|
|
@@ -1100,7 +1100,7 @@ function Gn(e, t = (n) => n.message) {
|
|
|
1100
1100
|
const n = { _errors: [] }, o = (i) => {
|
|
1101
1101
|
for (const a of i.issues)
|
|
1102
1102
|
if (a.code === "invalid_union" && a.errors.length)
|
|
1103
|
-
a.errors.map((
|
|
1103
|
+
a.errors.map((u) => o({ issues: u }));
|
|
1104
1104
|
else if (a.code === "invalid_key")
|
|
1105
1105
|
o({ issues: a.issues });
|
|
1106
1106
|
else if (a.code === "invalid_element")
|
|
@@ -1108,46 +1108,46 @@ function Gn(e, t = (n) => n.message) {
|
|
|
1108
1108
|
else if (a.path.length === 0)
|
|
1109
1109
|
n._errors.push(t(a));
|
|
1110
1110
|
else {
|
|
1111
|
-
let
|
|
1111
|
+
let u = n, l = 0;
|
|
1112
1112
|
for (; l < a.path.length; ) {
|
|
1113
1113
|
const p = a.path[l];
|
|
1114
|
-
l === a.path.length - 1 ? (
|
|
1114
|
+
l === a.path.length - 1 ? (u[p] = u[p] || { _errors: [] }, u[p]._errors.push(t(a))) : u[p] = u[p] || { _errors: [] }, u = u[p], l++;
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
1117
|
};
|
|
1118
1118
|
return o(e), n;
|
|
1119
1119
|
}
|
|
1120
1120
|
const Le = (e) => (t, n, o, i) => {
|
|
1121
|
-
const a = o ? Object.assign(o, { async: !1 }) : { async: !1 },
|
|
1122
|
-
if (
|
|
1121
|
+
const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, u = t._zod.run({ value: n, issues: [] }, a);
|
|
1122
|
+
if (u instanceof Promise)
|
|
1123
1123
|
throw new K();
|
|
1124
|
-
if (
|
|
1125
|
-
const l = new (i?.Err ?? e)(
|
|
1124
|
+
if (u.issues.length) {
|
|
1125
|
+
const l = new (i?.Err ?? e)(u.issues.map((p) => N(p, a, j())));
|
|
1126
1126
|
throw zt(l, i?.callee), l;
|
|
1127
1127
|
}
|
|
1128
|
-
return
|
|
1128
|
+
return u.value;
|
|
1129
1129
|
}, Re = (e) => async (t, n, o, i) => {
|
|
1130
1130
|
const a = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1131
|
-
let
|
|
1132
|
-
if (
|
|
1133
|
-
const l = new (i?.Err ?? e)(
|
|
1131
|
+
let u = t._zod.run({ value: n, issues: [] }, a);
|
|
1132
|
+
if (u instanceof Promise && (u = await u), u.issues.length) {
|
|
1133
|
+
const l = new (i?.Err ?? e)(u.issues.map((p) => N(p, a, j())));
|
|
1134
1134
|
throw zt(l, i?.callee), l;
|
|
1135
1135
|
}
|
|
1136
|
-
return
|
|
1136
|
+
return u.value;
|
|
1137
1137
|
}, _e = (e) => (t, n, o) => {
|
|
1138
1138
|
const i = o ? { ...o, async: !1 } : { async: !1 }, a = t._zod.run({ value: n, issues: [] }, i);
|
|
1139
1139
|
if (a instanceof Promise)
|
|
1140
1140
|
throw new K();
|
|
1141
1141
|
return a.issues.length ? {
|
|
1142
1142
|
success: !1,
|
|
1143
|
-
error: new (e ?? $t)(a.issues.map((
|
|
1143
|
+
error: new (e ?? $t)(a.issues.map((u) => N(u, i, j())))
|
|
1144
1144
|
} : { success: !0, data: a.value };
|
|
1145
1145
|
}, Wn = /* @__PURE__ */ _e(Pt), me = (e) => async (t, n, o) => {
|
|
1146
1146
|
const i = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1147
1147
|
let a = t._zod.run({ value: n, issues: [] }, i);
|
|
1148
1148
|
return a instanceof Promise && (a = await a), a.issues.length ? {
|
|
1149
1149
|
success: !1,
|
|
1150
|
-
error: new e(a.issues.map((
|
|
1150
|
+
error: new e(a.issues.map((u) => N(u, i, j())))
|
|
1151
1151
|
} : { success: !0, data: a.value };
|
|
1152
1152
|
}, qn = /* @__PURE__ */ me(Pt), Kn = (e) => (t, n, o) => {
|
|
1153
1153
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
@@ -1182,7 +1182,7 @@ function ko(e) {
|
|
|
1182
1182
|
const Eo = (e) => {
|
|
1183
1183
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1184
1184
|
return new RegExp(`^${t}$`);
|
|
1185
|
-
}, Co = /^-?\d+$/,
|
|
1185
|
+
}, Co = /^-?\d+$/, Ao = /^-?\d+(?:\.\d+)?/, So = /^null$/i, To = /^[^A-Z]*$/, zo = /^[^a-z]*$/, $ = /* @__PURE__ */ m("$ZodCheck", (e, t) => {
|
|
1186
1186
|
var n;
|
|
1187
1187
|
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
1188
1188
|
}), Rt = {
|
|
@@ -1242,14 +1242,14 @@ const Eo = (e) => {
|
|
|
1242
1242
|
}), Oo = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
|
|
1243
1243
|
$.init(e, t), t.format = t.format || "float64";
|
|
1244
1244
|
const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] = Rn[t.format];
|
|
1245
|
-
e._zod.onattach.push((
|
|
1246
|
-
const l =
|
|
1245
|
+
e._zod.onattach.push((u) => {
|
|
1246
|
+
const l = u._zod.bag;
|
|
1247
1247
|
l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern = Co);
|
|
1248
|
-
}), e._zod.check = (
|
|
1249
|
-
const l =
|
|
1248
|
+
}), e._zod.check = (u) => {
|
|
1249
|
+
const l = u.value;
|
|
1250
1250
|
if (n) {
|
|
1251
1251
|
if (!Number.isInteger(l)) {
|
|
1252
|
-
|
|
1252
|
+
u.issues.push({
|
|
1253
1253
|
expected: o,
|
|
1254
1254
|
format: t.format,
|
|
1255
1255
|
code: "invalid_type",
|
|
@@ -1260,7 +1260,7 @@ const Eo = (e) => {
|
|
|
1260
1260
|
return;
|
|
1261
1261
|
}
|
|
1262
1262
|
if (!Number.isSafeInteger(l)) {
|
|
1263
|
-
l > 0 ?
|
|
1263
|
+
l > 0 ? u.issues.push({
|
|
1264
1264
|
input: l,
|
|
1265
1265
|
code: "too_big",
|
|
1266
1266
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
@@ -1268,7 +1268,7 @@ const Eo = (e) => {
|
|
|
1268
1268
|
inst: e,
|
|
1269
1269
|
origin: o,
|
|
1270
1270
|
continue: !t.abort
|
|
1271
|
-
}) :
|
|
1271
|
+
}) : u.issues.push({
|
|
1272
1272
|
input: l,
|
|
1273
1273
|
code: "too_small",
|
|
1274
1274
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
@@ -1280,7 +1280,7 @@ const Eo = (e) => {
|
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
l < i &&
|
|
1283
|
+
l < i && u.issues.push({
|
|
1284
1284
|
origin: "number",
|
|
1285
1285
|
input: l,
|
|
1286
1286
|
code: "too_small",
|
|
@@ -1288,7 +1288,7 @@ const Eo = (e) => {
|
|
|
1288
1288
|
inclusive: !0,
|
|
1289
1289
|
inst: e,
|
|
1290
1290
|
continue: !t.abort
|
|
1291
|
-
}), l > a &&
|
|
1291
|
+
}), l > a && u.issues.push({
|
|
1292
1292
|
origin: "number",
|
|
1293
1293
|
input: l,
|
|
1294
1294
|
code: "too_big",
|
|
@@ -1308,9 +1308,9 @@ const Eo = (e) => {
|
|
|
1308
1308
|
const i = o.value;
|
|
1309
1309
|
if (i.length <= t.maximum)
|
|
1310
1310
|
return;
|
|
1311
|
-
const
|
|
1311
|
+
const u = xe(i);
|
|
1312
1312
|
o.issues.push({
|
|
1313
|
-
origin:
|
|
1313
|
+
origin: u,
|
|
1314
1314
|
code: "too_big",
|
|
1315
1315
|
maximum: t.maximum,
|
|
1316
1316
|
inclusive: !0,
|
|
@@ -1331,9 +1331,9 @@ const Eo = (e) => {
|
|
|
1331
1331
|
const i = o.value;
|
|
1332
1332
|
if (i.length >= t.minimum)
|
|
1333
1333
|
return;
|
|
1334
|
-
const
|
|
1334
|
+
const u = xe(i);
|
|
1335
1335
|
o.issues.push({
|
|
1336
|
-
origin:
|
|
1336
|
+
origin: u,
|
|
1337
1337
|
code: "too_small",
|
|
1338
1338
|
minimum: t.minimum,
|
|
1339
1339
|
inclusive: !0,
|
|
@@ -1354,9 +1354,9 @@ const Eo = (e) => {
|
|
|
1354
1354
|
const i = o.value, a = i.length;
|
|
1355
1355
|
if (a === t.length)
|
|
1356
1356
|
return;
|
|
1357
|
-
const
|
|
1357
|
+
const u = xe(i), l = a > t.length;
|
|
1358
1358
|
o.issues.push({
|
|
1359
|
-
origin:
|
|
1359
|
+
origin: u,
|
|
1360
1360
|
...l ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
1361
1361
|
inclusive: !0,
|
|
1362
1362
|
exact: !0,
|
|
@@ -1467,9 +1467,9 @@ class Mo {
|
|
|
1467
1467
|
return;
|
|
1468
1468
|
}
|
|
1469
1469
|
const o = t.split(`
|
|
1470
|
-
`).filter((
|
|
1471
|
-
for (const
|
|
1472
|
-
this.content.push(
|
|
1470
|
+
`).filter((u) => u), i = Math.min(...o.map((u) => u.length - u.trimStart().length)), a = o.map((u) => u.slice(i)).map((u) => " ".repeat(this.indent * 2) + u);
|
|
1471
|
+
for (const u of a)
|
|
1472
|
+
this.content.push(u);
|
|
1473
1473
|
}
|
|
1474
1474
|
compile() {
|
|
1475
1475
|
const t = Function, n = this?.args, i = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
|
|
@@ -1481,7 +1481,7 @@ const Fo = {
|
|
|
1481
1481
|
major: 4,
|
|
1482
1482
|
minor: 1,
|
|
1483
1483
|
patch: 13
|
|
1484
|
-
},
|
|
1484
|
+
}, A = /* @__PURE__ */ m("$ZodType", (e, t) => {
|
|
1485
1485
|
var n;
|
|
1486
1486
|
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Fo;
|
|
1487
1487
|
const o = [...e._zod.def.checks ?? []];
|
|
@@ -1494,31 +1494,31 @@ const Fo = {
|
|
|
1494
1494
|
e._zod.run = e._zod.parse;
|
|
1495
1495
|
});
|
|
1496
1496
|
else {
|
|
1497
|
-
const i = (
|
|
1498
|
-
let h = q(
|
|
1497
|
+
const i = (u, l, p) => {
|
|
1498
|
+
let h = q(u), y;
|
|
1499
1499
|
for (const g of l) {
|
|
1500
1500
|
if (g._zod.def.when) {
|
|
1501
|
-
if (!g._zod.def.when(
|
|
1501
|
+
if (!g._zod.def.when(u))
|
|
1502
1502
|
continue;
|
|
1503
1503
|
} else if (h)
|
|
1504
1504
|
continue;
|
|
1505
|
-
const r =
|
|
1505
|
+
const r = u.issues.length, s = g._zod.check(u);
|
|
1506
1506
|
if (s instanceof Promise && p?.async === !1)
|
|
1507
1507
|
throw new K();
|
|
1508
1508
|
if (y || s instanceof Promise)
|
|
1509
1509
|
y = (y ?? Promise.resolve()).then(async () => {
|
|
1510
|
-
await s,
|
|
1510
|
+
await s, u.issues.length !== r && (h || (h = q(u, r)));
|
|
1511
1511
|
});
|
|
1512
1512
|
else {
|
|
1513
|
-
if (
|
|
1513
|
+
if (u.issues.length === r)
|
|
1514
1514
|
continue;
|
|
1515
|
-
h || (h = q(
|
|
1515
|
+
h || (h = q(u, r));
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
return y ? y.then(() =>
|
|
1519
|
-
}, a = (
|
|
1520
|
-
if (q(
|
|
1521
|
-
return
|
|
1518
|
+
return y ? y.then(() => u) : u;
|
|
1519
|
+
}, a = (u, l, p) => {
|
|
1520
|
+
if (q(u))
|
|
1521
|
+
return u.aborted = !0, u;
|
|
1522
1522
|
const h = i(l, o, p);
|
|
1523
1523
|
if (h instanceof Promise) {
|
|
1524
1524
|
if (p.async === !1)
|
|
@@ -1527,14 +1527,14 @@ const Fo = {
|
|
|
1527
1527
|
}
|
|
1528
1528
|
return e._zod.parse(h, p);
|
|
1529
1529
|
};
|
|
1530
|
-
e._zod.run = (
|
|
1530
|
+
e._zod.run = (u, l) => {
|
|
1531
1531
|
if (l.skipChecks)
|
|
1532
|
-
return e._zod.parse(
|
|
1532
|
+
return e._zod.parse(u, l);
|
|
1533
1533
|
if (l.direction === "backward") {
|
|
1534
|
-
const h = e._zod.parse({ value:
|
|
1535
|
-
return h instanceof Promise ? h.then((y) => a(y,
|
|
1534
|
+
const h = e._zod.parse({ value: u.value, issues: [] }, { ...l, skipChecks: !0 });
|
|
1535
|
+
return h instanceof Promise ? h.then((y) => a(y, u, l)) : a(h, u, l);
|
|
1536
1536
|
}
|
|
1537
|
-
const p = e._zod.parse(
|
|
1537
|
+
const p = e._zod.parse(u, l);
|
|
1538
1538
|
if (p instanceof Promise) {
|
|
1539
1539
|
if (l.async === !1)
|
|
1540
1540
|
throw new K();
|
|
@@ -1549,14 +1549,14 @@ const Fo = {
|
|
|
1549
1549
|
const a = Wn(e, i);
|
|
1550
1550
|
return a.success ? { value: a.data } : { issues: a.error?.issues };
|
|
1551
1551
|
} catch {
|
|
1552
|
-
return qn(e, i).then((
|
|
1552
|
+
return qn(e, i).then((u) => u.success ? { value: u.data } : { issues: u.error?.issues });
|
|
1553
1553
|
}
|
|
1554
1554
|
},
|
|
1555
1555
|
vendor: "zod",
|
|
1556
1556
|
version: 1
|
|
1557
1557
|
};
|
|
1558
1558
|
}), je = /* @__PURE__ */ m("$ZodString", (e, t) => {
|
|
1559
|
-
|
|
1559
|
+
A.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Eo(e._zod.bag), e._zod.parse = (n, o) => {
|
|
1560
1560
|
if (t.coerce)
|
|
1561
1561
|
try {
|
|
1562
1562
|
n.value = String(n.value);
|
|
@@ -1674,10 +1674,10 @@ const Fo = {
|
|
|
1674
1674
|
const [i, a] = o;
|
|
1675
1675
|
if (!a)
|
|
1676
1676
|
throw new Error();
|
|
1677
|
-
const
|
|
1678
|
-
if (`${
|
|
1677
|
+
const u = Number(a);
|
|
1678
|
+
if (`${u}` !== a)
|
|
1679
1679
|
throw new Error();
|
|
1680
|
-
if (
|
|
1680
|
+
if (u < 0 || u > 128)
|
|
1681
1681
|
throw new Error();
|
|
1682
1682
|
new URL(`http://[${i}]`);
|
|
1683
1683
|
} catch {
|
|
@@ -1757,7 +1757,7 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1757
1757
|
});
|
|
1758
1758
|
};
|
|
1759
1759
|
}), Ut = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
|
|
1760
|
-
|
|
1760
|
+
A.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Ao, e._zod.parse = (n, o) => {
|
|
1761
1761
|
if (t.coerce)
|
|
1762
1762
|
try {
|
|
1763
1763
|
n.value = Number(n.value);
|
|
@@ -1778,7 +1778,7 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1778
1778
|
}), hr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
|
|
1779
1779
|
Oo.init(e, t), Ut.init(e, t);
|
|
1780
1780
|
}), _r = /* @__PURE__ */ m("$ZodNull", (e, t) => {
|
|
1781
|
-
|
|
1781
|
+
A.init(e, t), e._zod.pattern = So, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, o) => {
|
|
1782
1782
|
const i = n.value;
|
|
1783
1783
|
return i === null || n.issues.push({
|
|
1784
1784
|
expected: "null",
|
|
@@ -1788,9 +1788,9 @@ const fr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1788
1788
|
}), n;
|
|
1789
1789
|
};
|
|
1790
1790
|
}), mr = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
|
|
1791
|
-
|
|
1791
|
+
A.init(e, t), e._zod.parse = (n) => n;
|
|
1792
1792
|
}), vr = /* @__PURE__ */ m("$ZodNever", (e, t) => {
|
|
1793
|
-
|
|
1793
|
+
A.init(e, t), e._zod.parse = (n, o) => (n.issues.push({
|
|
1794
1794
|
expected: "never",
|
|
1795
1795
|
code: "invalid_type",
|
|
1796
1796
|
input: n.value,
|
|
@@ -1801,7 +1801,7 @@ function Qe(e, t, n) {
|
|
|
1801
1801
|
e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
|
|
1802
1802
|
}
|
|
1803
1803
|
const gr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
1804
|
-
|
|
1804
|
+
A.init(e, t), e._zod.parse = (n, o) => {
|
|
1805
1805
|
const i = n.value;
|
|
1806
1806
|
if (!Array.isArray(i))
|
|
1807
1807
|
return n.issues.push({
|
|
@@ -1812,12 +1812,12 @@ const gr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
|
1812
1812
|
}), n;
|
|
1813
1813
|
n.value = Array(i.length);
|
|
1814
1814
|
const a = [];
|
|
1815
|
-
for (let
|
|
1816
|
-
const l = i[
|
|
1815
|
+
for (let u = 0; u < i.length; u++) {
|
|
1816
|
+
const l = i[u], p = t.element._zod.run({
|
|
1817
1817
|
value: l,
|
|
1818
1818
|
issues: []
|
|
1819
1819
|
}, o);
|
|
1820
|
-
p instanceof Promise ? a.push(p.then((h) => Qe(h, n,
|
|
1820
|
+
p instanceof Promise ? a.push(p.then((h) => Qe(h, n, u))) : Qe(p, n, u);
|
|
1821
1821
|
}
|
|
1822
1822
|
return a.length ? Promise.all(a).then(() => n) : n;
|
|
1823
1823
|
};
|
|
@@ -1840,26 +1840,26 @@ function Mt(e) {
|
|
|
1840
1840
|
};
|
|
1841
1841
|
}
|
|
1842
1842
|
function Ft(e, t, n, o, i, a) {
|
|
1843
|
-
const
|
|
1843
|
+
const u = [], l = i.keySet, p = i.catchall._zod, h = p.def.type;
|
|
1844
1844
|
for (const y in t) {
|
|
1845
1845
|
if (l.has(y))
|
|
1846
1846
|
continue;
|
|
1847
1847
|
if (h === "never") {
|
|
1848
|
-
|
|
1848
|
+
u.push(y);
|
|
1849
1849
|
continue;
|
|
1850
1850
|
}
|
|
1851
1851
|
const g = p.run({ value: t[y], issues: [] }, o);
|
|
1852
1852
|
g instanceof Promise ? e.push(g.then((r) => fe(r, n, y, t))) : fe(g, n, y, t);
|
|
1853
1853
|
}
|
|
1854
|
-
return
|
|
1854
|
+
return u.length && n.issues.push({
|
|
1855
1855
|
code: "unrecognized_keys",
|
|
1856
|
-
keys:
|
|
1856
|
+
keys: u,
|
|
1857
1857
|
input: t,
|
|
1858
1858
|
inst: a
|
|
1859
1859
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1860
1860
|
}
|
|
1861
1861
|
const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
1862
|
-
if (
|
|
1862
|
+
if (A.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1863
1863
|
const l = t.shape;
|
|
1864
1864
|
Object.defineProperty(t, "shape", {
|
|
1865
1865
|
get: () => {
|
|
@@ -1884,9 +1884,9 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1884
1884
|
return p;
|
|
1885
1885
|
});
|
|
1886
1886
|
const i = pe, a = t.catchall;
|
|
1887
|
-
let
|
|
1887
|
+
let u;
|
|
1888
1888
|
e._zod.parse = (l, p) => {
|
|
1889
|
-
|
|
1889
|
+
u ?? (u = o.value);
|
|
1890
1890
|
const h = l.value;
|
|
1891
1891
|
if (!i(h))
|
|
1892
1892
|
return l.issues.push({
|
|
@@ -1896,27 +1896,27 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1896
1896
|
inst: e
|
|
1897
1897
|
}), l;
|
|
1898
1898
|
l.value = {};
|
|
1899
|
-
const y = [], g =
|
|
1900
|
-
for (const r of
|
|
1901
|
-
const
|
|
1902
|
-
|
|
1899
|
+
const y = [], g = u.shape;
|
|
1900
|
+
for (const r of u.keys) {
|
|
1901
|
+
const c = g[r]._zod.run({ value: h[r], issues: [] }, p);
|
|
1902
|
+
c instanceof Promise ? y.push(c.then((d) => fe(d, l, r, h))) : fe(c, l, r, h);
|
|
1903
1903
|
}
|
|
1904
1904
|
return a ? Ft(y, h, l, p, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
|
|
1905
1905
|
};
|
|
1906
1906
|
}), br = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
|
|
1907
1907
|
yr.init(e, t);
|
|
1908
1908
|
const n = e._zod.parse, o = $e(() => Mt(t)), i = (r) => {
|
|
1909
|
-
const s = new Mo(["shape", "payload", "ctx"]),
|
|
1909
|
+
const s = new Mo(["shape", "payload", "ctx"]), c = o.value, d = (w) => {
|
|
1910
1910
|
const k = He(w);
|
|
1911
1911
|
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1912
1912
|
};
|
|
1913
1913
|
s.write("const input = payload.value;");
|
|
1914
1914
|
const f = /* @__PURE__ */ Object.create(null);
|
|
1915
1915
|
let v = 0;
|
|
1916
|
-
for (const w of
|
|
1916
|
+
for (const w of c.keys)
|
|
1917
1917
|
f[w] = `key_${v++}`;
|
|
1918
1918
|
s.write("const newResult = {};");
|
|
1919
|
-
for (const w of
|
|
1919
|
+
for (const w of c.keys) {
|
|
1920
1920
|
const k = f[w], E = He(w);
|
|
1921
1921
|
s.write(`const ${k} = ${d(w)};`), s.write(`
|
|
1922
1922
|
if (${k}.issues.length) {
|
|
@@ -1942,15 +1942,15 @@ const yr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1942
1942
|
return (w, k) => _(r, w, k);
|
|
1943
1943
|
};
|
|
1944
1944
|
let a;
|
|
1945
|
-
const
|
|
1945
|
+
const u = pe, l = !Tt.jitless, h = l && Zn.value, y = t.catchall;
|
|
1946
1946
|
let g;
|
|
1947
1947
|
e._zod.parse = (r, s) => {
|
|
1948
1948
|
g ?? (g = o.value);
|
|
1949
|
-
const
|
|
1950
|
-
return c
|
|
1949
|
+
const c = r.value;
|
|
1950
|
+
return u(c) ? l && h && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Ft([], c, r, s, g, e) : r) : n(r, s) : (r.issues.push({
|
|
1951
1951
|
expected: "object",
|
|
1952
1952
|
code: "invalid_type",
|
|
1953
|
-
input:
|
|
1953
|
+
input: c,
|
|
1954
1954
|
inst: e
|
|
1955
1955
|
}), r);
|
|
1956
1956
|
};
|
|
@@ -1964,11 +1964,11 @@ function Ye(e, t, n, o) {
|
|
|
1964
1964
|
code: "invalid_union",
|
|
1965
1965
|
input: t.value,
|
|
1966
1966
|
inst: n,
|
|
1967
|
-
errors: e.map((a) => a.issues.map((
|
|
1967
|
+
errors: e.map((a) => a.issues.map((u) => N(u, o, j())))
|
|
1968
1968
|
}), t);
|
|
1969
1969
|
}
|
|
1970
1970
|
const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
1971
|
-
|
|
1971
|
+
A.init(e, t), C(e._zod, "optin", () => t.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), C(e._zod, "optout", () => t.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), C(e._zod, "values", () => {
|
|
1972
1972
|
if (t.options.every((i) => i._zod.values))
|
|
1973
1973
|
return new Set(t.options.flatMap((i) => Array.from(i._zod.values)));
|
|
1974
1974
|
}), C(e._zod, "pattern", () => {
|
|
@@ -1981,7 +1981,7 @@ const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1981
1981
|
e._zod.parse = (i, a) => {
|
|
1982
1982
|
if (n)
|
|
1983
1983
|
return o(i, a);
|
|
1984
|
-
let
|
|
1984
|
+
let u = !1;
|
|
1985
1985
|
const l = [];
|
|
1986
1986
|
for (const p of t.options) {
|
|
1987
1987
|
const h = p._zod.run({
|
|
@@ -1989,19 +1989,19 @@ const wr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1989
1989
|
issues: []
|
|
1990
1990
|
}, a);
|
|
1991
1991
|
if (h instanceof Promise)
|
|
1992
|
-
l.push(h),
|
|
1992
|
+
l.push(h), u = !0;
|
|
1993
1993
|
else {
|
|
1994
1994
|
if (h.issues.length === 0)
|
|
1995
1995
|
return h;
|
|
1996
1996
|
l.push(h);
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
|
-
return
|
|
1999
|
+
return u ? Promise.all(l).then((p) => Ye(p, i, e, a)) : Ye(l, i, e, a);
|
|
2000
2000
|
};
|
|
2001
2001
|
}), kr = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
|
|
2002
|
-
|
|
2003
|
-
const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o),
|
|
2004
|
-
return a instanceof Promise ||
|
|
2002
|
+
A.init(e, t), e._zod.parse = (n, o) => {
|
|
2003
|
+
const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o), u = t.right._zod.run({ value: i, issues: [] }, o);
|
|
2004
|
+
return a instanceof Promise || u instanceof Promise ? Promise.all([a, u]).then(([p, h]) => Xe(n, p, h)) : Xe(n, a, u);
|
|
2005
2005
|
};
|
|
2006
2006
|
});
|
|
2007
2007
|
function ze(e, t) {
|
|
@@ -2012,13 +2012,13 @@ function ze(e, t) {
|
|
|
2012
2012
|
if (H(e) && H(t)) {
|
|
2013
2013
|
const n = Object.keys(t), o = Object.keys(e).filter((a) => n.indexOf(a) !== -1), i = { ...e, ...t };
|
|
2014
2014
|
for (const a of o) {
|
|
2015
|
-
const
|
|
2016
|
-
if (!
|
|
2015
|
+
const u = ze(e[a], t[a]);
|
|
2016
|
+
if (!u.valid)
|
|
2017
2017
|
return {
|
|
2018
2018
|
valid: !1,
|
|
2019
|
-
mergeErrorPath: [a, ...
|
|
2019
|
+
mergeErrorPath: [a, ...u.mergeErrorPath]
|
|
2020
2020
|
};
|
|
2021
|
-
i[a] =
|
|
2021
|
+
i[a] = u.data;
|
|
2022
2022
|
}
|
|
2023
2023
|
return { valid: !0, data: i };
|
|
2024
2024
|
}
|
|
@@ -2027,13 +2027,13 @@ function ze(e, t) {
|
|
|
2027
2027
|
return { valid: !1, mergeErrorPath: [] };
|
|
2028
2028
|
const n = [];
|
|
2029
2029
|
for (let o = 0; o < e.length; o++) {
|
|
2030
|
-
const i = e[o], a = t[o],
|
|
2031
|
-
if (!
|
|
2030
|
+
const i = e[o], a = t[o], u = ze(i, a);
|
|
2031
|
+
if (!u.valid)
|
|
2032
2032
|
return {
|
|
2033
2033
|
valid: !1,
|
|
2034
|
-
mergeErrorPath: [o, ...
|
|
2034
|
+
mergeErrorPath: [o, ...u.mergeErrorPath]
|
|
2035
2035
|
};
|
|
2036
|
-
n.push(
|
|
2036
|
+
n.push(u.data);
|
|
2037
2037
|
}
|
|
2038
2038
|
return { valid: !0, data: n };
|
|
2039
2039
|
}
|
|
@@ -2048,7 +2048,7 @@ function Xe(e, t, n) {
|
|
|
2048
2048
|
return e.value = o.data, e;
|
|
2049
2049
|
}
|
|
2050
2050
|
const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
2051
|
-
|
|
2051
|
+
A.init(e, t);
|
|
2052
2052
|
const n = t.items;
|
|
2053
2053
|
e._zod.parse = (o, i) => {
|
|
2054
2054
|
const a = o.value;
|
|
@@ -2060,7 +2060,7 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2060
2060
|
code: "invalid_type"
|
|
2061
2061
|
}), o;
|
|
2062
2062
|
o.value = [];
|
|
2063
|
-
const
|
|
2063
|
+
const u = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), p = l === -1 ? 0 : n.length - l;
|
|
2064
2064
|
if (!t.rest) {
|
|
2065
2065
|
const y = a.length > n.length, g = a.length < p - 1;
|
|
2066
2066
|
if (y || g)
|
|
@@ -2079,7 +2079,7 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2079
2079
|
value: a[h],
|
|
2080
2080
|
issues: []
|
|
2081
2081
|
}, i);
|
|
2082
|
-
g instanceof Promise ?
|
|
2082
|
+
g instanceof Promise ? u.push(g.then((r) => ae(r, o, h))) : ae(g, o, h);
|
|
2083
2083
|
}
|
|
2084
2084
|
if (t.rest) {
|
|
2085
2085
|
const y = a.slice(n.length);
|
|
@@ -2089,17 +2089,17 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2089
2089
|
value: g,
|
|
2090
2090
|
issues: []
|
|
2091
2091
|
}, i);
|
|
2092
|
-
r instanceof Promise ?
|
|
2092
|
+
r instanceof Promise ? u.push(r.then((s) => ae(s, o, h))) : ae(r, o, h);
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
|
-
return
|
|
2095
|
+
return u.length ? Promise.all(u).then(() => o) : o;
|
|
2096
2096
|
};
|
|
2097
2097
|
});
|
|
2098
2098
|
function ae(e, t, n) {
|
|
2099
2099
|
e.issues.length && t.issues.push(...F(n, e.issues)), t.value[n] = e.value;
|
|
2100
2100
|
}
|
|
2101
2101
|
const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
2102
|
-
|
|
2102
|
+
A.init(e, t), e._zod.parse = (n, o) => {
|
|
2103
2103
|
const i = n.value;
|
|
2104
2104
|
if (!H(i))
|
|
2105
2105
|
return n.issues.push({
|
|
@@ -2108,11 +2108,11 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2108
2108
|
input: i,
|
|
2109
2109
|
inst: e
|
|
2110
2110
|
}), n;
|
|
2111
|
-
const a = [],
|
|
2112
|
-
if (
|
|
2111
|
+
const a = [], u = t.keyType._zod.values;
|
|
2112
|
+
if (u) {
|
|
2113
2113
|
n.value = {};
|
|
2114
2114
|
const l = /* @__PURE__ */ new Set();
|
|
2115
|
-
for (const h of
|
|
2115
|
+
for (const h of u)
|
|
2116
2116
|
if (typeof h == "string" || typeof h == "number" || typeof h == "symbol") {
|
|
2117
2117
|
l.add(typeof h == "number" ? h.toString() : h);
|
|
2118
2118
|
const y = t.valueType._zod.run({ value: i[h], issues: [] }, o);
|
|
@@ -2156,20 +2156,20 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2156
2156
|
}
|
|
2157
2157
|
return a.length ? Promise.all(a).then(() => n) : n;
|
|
2158
2158
|
};
|
|
2159
|
-
}),
|
|
2160
|
-
|
|
2159
|
+
}), Ar = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
|
|
2160
|
+
A.init(e, t);
|
|
2161
2161
|
const n = On(t.entries), o = new Set(n);
|
|
2162
2162
|
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) => xn.has(typeof i)).map((i) => typeof i == "string" ? J(i) : i.toString()).join("|")})$`), e._zod.parse = (i, a) => {
|
|
2163
|
-
const
|
|
2164
|
-
return o.has(
|
|
2163
|
+
const u = i.value;
|
|
2164
|
+
return o.has(u) || i.issues.push({
|
|
2165
2165
|
code: "invalid_value",
|
|
2166
2166
|
values: n,
|
|
2167
|
-
input:
|
|
2167
|
+
input: u,
|
|
2168
2168
|
inst: e
|
|
2169
2169
|
}), i;
|
|
2170
2170
|
};
|
|
2171
|
-
}),
|
|
2172
|
-
if (
|
|
2171
|
+
}), Sr = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
|
|
2172
|
+
if (A.init(e, t), t.values.length === 0)
|
|
2173
2173
|
throw new Error("Cannot create literal schema with no valid values");
|
|
2174
2174
|
const n = new Set(t.values);
|
|
2175
2175
|
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((o) => typeof o == "string" ? J(o) : o ? J(o.toString()) : String(o)).join("|")})$`), e._zod.parse = (o, i) => {
|
|
@@ -2182,12 +2182,12 @@ const Cr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2182
2182
|
}), o;
|
|
2183
2183
|
};
|
|
2184
2184
|
}), Tr = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
|
|
2185
|
-
|
|
2185
|
+
A.init(e, t), e._zod.parse = (n, o) => {
|
|
2186
2186
|
if (o.direction === "backward")
|
|
2187
|
-
throw new
|
|
2187
|
+
throw new St(e.constructor.name);
|
|
2188
2188
|
const i = t.transform(n.value, n);
|
|
2189
2189
|
if (o.async)
|
|
2190
|
-
return (i instanceof Promise ? i : Promise.resolve(i)).then((
|
|
2190
|
+
return (i instanceof Promise ? i : Promise.resolve(i)).then((u) => (n.value = u, n));
|
|
2191
2191
|
if (i instanceof Promise)
|
|
2192
2192
|
throw new K();
|
|
2193
2193
|
return n.value = i, n;
|
|
@@ -2197,7 +2197,7 @@ function et(e, t) {
|
|
|
2197
2197
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
2198
2198
|
}
|
|
2199
2199
|
const zr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
|
|
2200
|
-
|
|
2200
|
+
A.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), C(e._zod, "pattern", () => {
|
|
2201
2201
|
const n = t.innerType._zod.pattern;
|
|
2202
2202
|
return n ? new RegExp(`^(${Ze(n.source)})?$`) : void 0;
|
|
2203
2203
|
}), e._zod.parse = (n, o) => {
|
|
@@ -2208,12 +2208,12 @@ const zr = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
|
|
|
2208
2208
|
return n.value === void 0 ? n : t.innerType._zod.run(n, o);
|
|
2209
2209
|
};
|
|
2210
2210
|
}), Ir = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
|
|
2211
|
-
|
|
2211
|
+
A.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "pattern", () => {
|
|
2212
2212
|
const n = t.innerType._zod.pattern;
|
|
2213
2213
|
return n ? new RegExp(`^(${Ze(n.source)}|null)$`) : void 0;
|
|
2214
2214
|
}), C(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o);
|
|
2215
2215
|
}), Or = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
|
|
2216
|
-
|
|
2216
|
+
A.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
|
|
2217
2217
|
if (o.direction === "backward")
|
|
2218
2218
|
return t.innerType._zod.run(n, o);
|
|
2219
2219
|
if (n.value === void 0)
|
|
@@ -2226,9 +2226,9 @@ function tt(e, t) {
|
|
|
2226
2226
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2227
2227
|
}
|
|
2228
2228
|
const $r = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
|
|
2229
|
-
|
|
2229
|
+
A.init(e, t), e._zod.optin = "optional", C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (o.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o));
|
|
2230
2230
|
}), Pr = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
|
|
2231
|
-
|
|
2231
|
+
A.init(e, t), C(e._zod, "values", () => {
|
|
2232
2232
|
const n = t.innerType._zod.values;
|
|
2233
2233
|
return n ? new Set([...n].filter((o) => o !== void 0)) : void 0;
|
|
2234
2234
|
}), e._zod.parse = (n, o) => {
|
|
@@ -2245,14 +2245,14 @@ function nt(e, t) {
|
|
|
2245
2245
|
}), e;
|
|
2246
2246
|
}
|
|
2247
2247
|
const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
2248
|
-
|
|
2248
|
+
A.init(e, t), C(e._zod, "optin", () => t.innerType._zod.optin), C(e._zod, "optout", () => t.innerType._zod.optout), C(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => {
|
|
2249
2249
|
if (o.direction === "backward")
|
|
2250
2250
|
return t.innerType._zod.run(n, o);
|
|
2251
2251
|
const i = t.innerType._zod.run(n, o);
|
|
2252
2252
|
return i instanceof Promise ? i.then((a) => (n.value = a.value, a.issues.length && (n.value = t.catchValue({
|
|
2253
2253
|
...n,
|
|
2254
2254
|
error: {
|
|
2255
|
-
issues: a.issues.map((
|
|
2255
|
+
issues: a.issues.map((u) => N(u, o, j()))
|
|
2256
2256
|
},
|
|
2257
2257
|
input: n.value
|
|
2258
2258
|
}), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
@@ -2264,10 +2264,10 @@ const Zr = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
|
2264
2264
|
}), n.issues = []), n);
|
|
2265
2265
|
};
|
|
2266
2266
|
}), xr = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
|
|
2267
|
-
|
|
2267
|
+
A.init(e, t), C(e._zod, "values", () => t.in._zod.values), C(e._zod, "optin", () => t.in._zod.optin), C(e._zod, "optout", () => t.out._zod.optout), C(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => {
|
|
2268
2268
|
if (o.direction === "backward") {
|
|
2269
2269
|
const a = t.out._zod.run(n, o);
|
|
2270
|
-
return a instanceof Promise ? a.then((
|
|
2270
|
+
return a instanceof Promise ? a.then((u) => ue(u, t.in, o)) : ue(a, t.in, o);
|
|
2271
2271
|
}
|
|
2272
2272
|
const i = t.in._zod.run(n, o);
|
|
2273
2273
|
return i instanceof Promise ? i.then((a) => ue(a, t.out, o)) : ue(i, t.out, o);
|
|
@@ -2277,7 +2277,7 @@ function ue(e, t, n) {
|
|
|
2277
2277
|
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
2278
2278
|
}
|
|
2279
2279
|
const Lr = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
|
|
2280
|
-
|
|
2280
|
+
A.init(e, t), C(e._zod, "propValues", () => t.innerType._zod.propValues), C(e._zod, "values", () => t.innerType._zod.values), C(e._zod, "optin", () => t.innerType?._zod?.optin), C(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, o) => {
|
|
2281
2281
|
if (o.direction === "backward")
|
|
2282
2282
|
return t.innerType._zod.run(n, o);
|
|
2283
2283
|
const i = t.innerType._zod.run(n, o);
|
|
@@ -2288,7 +2288,7 @@ function ot(e) {
|
|
|
2288
2288
|
return e.value = Object.freeze(e.value), e;
|
|
2289
2289
|
}
|
|
2290
2290
|
const Rr = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
|
|
2291
|
-
$.init(e, t),
|
|
2291
|
+
$.init(e, t), A.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => {
|
|
2292
2292
|
const o = n.value, i = t.fn(o);
|
|
2293
2293
|
if (i instanceof Promise)
|
|
2294
2294
|
return i.then((a) => rt(a, n, o, e));
|
|
@@ -2747,10 +2747,10 @@ function Ei() {
|
|
|
2747
2747
|
function Ci() {
|
|
2748
2748
|
return ee((e) => e.toLowerCase());
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function Ai() {
|
|
2751
2751
|
return ee((e) => e.toUpperCase());
|
|
2752
2752
|
}
|
|
2753
|
-
function
|
|
2753
|
+
function Si() {
|
|
2754
2754
|
return ee((e) => Pn(e));
|
|
2755
2755
|
}
|
|
2756
2756
|
function Ti(e, t, n) {
|
|
@@ -2844,7 +2844,7 @@ const Di = (e, t) => {
|
|
|
2844
2844
|
});
|
|
2845
2845
|
}, Z = /* @__PURE__ */ m("ZodError", Di, {
|
|
2846
2846
|
Parent: Error
|
|
2847
|
-
}), Ui = /* @__PURE__ */ Le(Z), Mi = /* @__PURE__ */ Re(Z), Fi = /* @__PURE__ */ _e(Z), Vi = /* @__PURE__ */ me(Z), Bi = /* @__PURE__ */ Kn(Z), Gi = /* @__PURE__ */ Hn(Z), Wi = /* @__PURE__ */ Jn(Z), qi = /* @__PURE__ */ Qn(Z), Ki = /* @__PURE__ */ Yn(Z), Hi = /* @__PURE__ */ Xn(Z), Ji = /* @__PURE__ */ eo(Z), Qi = /* @__PURE__ */ to(Z), I = /* @__PURE__ */ m("ZodType", (e, t) => (
|
|
2847
|
+
}), Ui = /* @__PURE__ */ Le(Z), Mi = /* @__PURE__ */ Re(Z), Fi = /* @__PURE__ */ _e(Z), Vi = /* @__PURE__ */ me(Z), Bi = /* @__PURE__ */ Kn(Z), Gi = /* @__PURE__ */ Hn(Z), Wi = /* @__PURE__ */ Jn(Z), qi = /* @__PURE__ */ Qn(Z), Ki = /* @__PURE__ */ Yn(Z), Hi = /* @__PURE__ */ Xn(Z), Ji = /* @__PURE__ */ eo(Z), Qi = /* @__PURE__ */ to(Z), I = /* @__PURE__ */ m("ZodType", (e, t) => (A.init(e, t), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(B(t, {
|
|
2848
2848
|
checks: [
|
|
2849
2849
|
...t.checks ?? [],
|
|
2850
2850
|
...n.map((o) => typeof o == "function" ? { _zod: { check: o, def: { check: "custom" }, onattach: [] } } : o)
|
|
@@ -2865,7 +2865,7 @@ const Di = (e, t) => {
|
|
|
2865
2865
|
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Gt = /* @__PURE__ */ m("_ZodString", (e, t) => {
|
|
2866
2866
|
je.init(e, t), I.init(e, t);
|
|
2867
2867
|
const n = e._zod.bag;
|
|
2868
|
-
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(mi(...o)), e.includes = (...o) => e.check(yi(...o)), e.startsWith = (...o) => e.check(bi(...o)), e.endsWith = (...o) => e.check(wi(...o)), e.min = (...o) => e.check(he(...o)), e.max = (...o) => e.check(Vt(...o)), e.length = (...o) => e.check(Bt(...o)), e.nonempty = (...o) => e.check(he(1, ...o)), e.lowercase = (o) => e.check(vi(o)), e.uppercase = (o) => e.check(gi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(ki(...o)), e.toLowerCase = () => e.check(Ci()), e.toUpperCase = () => e.check(
|
|
2868
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(mi(...o)), e.includes = (...o) => e.check(yi(...o)), e.startsWith = (...o) => e.check(bi(...o)), e.endsWith = (...o) => e.check(wi(...o)), e.min = (...o) => e.check(he(...o)), e.max = (...o) => e.check(Vt(...o)), e.length = (...o) => e.check(Bt(...o)), e.nonempty = (...o) => e.check(he(1, ...o)), e.lowercase = (o) => e.check(vi(o)), e.uppercase = (o) => e.check(gi(o)), e.trim = () => e.check(Ei()), e.normalize = (...o) => e.check(ki(...o)), e.toLowerCase = () => e.check(Ci()), e.toUpperCase = () => e.check(Ai()), e.slugify = () => e.check(Si());
|
|
2869
2869
|
}), Yi = /* @__PURE__ */ m("ZodString", (e, t) => {
|
|
2870
2870
|
je.init(e, t), Gt.init(e, t), e.email = (n) => e.check(Ur(Xi, n)), e.url = (n) => e.check(Gr(es, n)), e.jwt = (n) => e.check(si(_s, n)), e.emoji = (n) => e.check(Wr(ts, n)), e.guid = (n) => e.check(st(lt, n)), e.uuid = (n) => e.check(Mr(le, n)), e.uuidv4 = (n) => e.check(Fr(le, n)), e.uuidv6 = (n) => e.check(Vr(le, n)), e.uuidv7 = (n) => e.check(Br(le, n)), e.nanoid = (n) => e.check(qr(ns, n)), e.guid = (n) => e.check(st(lt, n)), e.cuid = (n) => e.check(Kr(os, n)), e.cuid2 = (n) => e.check(Hr(rs, n)), e.ulid = (n) => e.check(Jr(is, n)), e.base64 = (n) => e.check(oi(ps, n)), e.base64url = (n) => e.check(ri(fs, n)), e.xid = (n) => e.check(Qr(ss, n)), e.ksuid = (n) => e.check(Yr(as, n)), e.ipv4 = (n) => e.check(Xr(us, n)), e.ipv6 = (n) => e.check(ei(cs, n)), e.cidrv4 = (n) => e.check(ti(ls, n)), e.cidrv6 = (n) => e.check(ni(ds, n)), e.e164 = (n) => e.check(ii(hs, n)), e.datetime = (n) => e.check(Pi(n)), e.date = (n) => e.check(xi(n)), e.time = (n) => e.check(Ri(n)), e.duration = (n) => e.check(Ni(n));
|
|
2871
2871
|
});
|
|
@@ -2961,21 +2961,21 @@ function T(e, t) {
|
|
|
2961
2961
|
};
|
|
2962
2962
|
return new Cs(n);
|
|
2963
2963
|
}
|
|
2964
|
-
const
|
|
2964
|
+
const As = /* @__PURE__ */ m("ZodUnion", (e, t) => {
|
|
2965
2965
|
wr.init(e, t), I.init(e, t), e.options = t.options;
|
|
2966
2966
|
});
|
|
2967
2967
|
function G(e, t) {
|
|
2968
|
-
return new
|
|
2968
|
+
return new As({
|
|
2969
2969
|
type: "union",
|
|
2970
2970
|
options: e,
|
|
2971
2971
|
...b(t)
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
const
|
|
2974
|
+
const Ss = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
|
|
2975
2975
|
kr.init(e, t), I.init(e, t);
|
|
2976
2976
|
});
|
|
2977
2977
|
function Ts(e, t) {
|
|
2978
|
-
return new
|
|
2978
|
+
return new Ss({
|
|
2979
2979
|
type: "intersection",
|
|
2980
2980
|
left: e,
|
|
2981
2981
|
right: t
|
|
@@ -2988,7 +2988,7 @@ const zs = /* @__PURE__ */ m("ZodTuple", (e, t) => {
|
|
|
2988
2988
|
});
|
|
2989
2989
|
});
|
|
2990
2990
|
function L(e, t, n) {
|
|
2991
|
-
const o = t instanceof
|
|
2991
|
+
const o = t instanceof A, i = o ? n : t, a = o ? t : null;
|
|
2992
2992
|
return new zs({
|
|
2993
2993
|
type: "tuple",
|
|
2994
2994
|
items: e,
|
|
@@ -3008,15 +3008,15 @@ function Os(e, t, n) {
|
|
|
3008
3008
|
});
|
|
3009
3009
|
}
|
|
3010
3010
|
const Ie = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
3011
|
-
|
|
3011
|
+
Ar.init(e, t), I.init(e, t), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
3012
3012
|
const n = new Set(Object.keys(t.entries));
|
|
3013
3013
|
e.extract = (o, i) => {
|
|
3014
3014
|
const a = {};
|
|
3015
|
-
for (const
|
|
3016
|
-
if (n.has(
|
|
3017
|
-
a[
|
|
3015
|
+
for (const u of o)
|
|
3016
|
+
if (n.has(u))
|
|
3017
|
+
a[u] = t.entries[u];
|
|
3018
3018
|
else
|
|
3019
|
-
throw new Error(`Key ${
|
|
3019
|
+
throw new Error(`Key ${u} not found in enum`);
|
|
3020
3020
|
return new Ie({
|
|
3021
3021
|
...t,
|
|
3022
3022
|
checks: [],
|
|
@@ -3025,11 +3025,11 @@ const Ie = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3025
3025
|
});
|
|
3026
3026
|
}, e.exclude = (o, i) => {
|
|
3027
3027
|
const a = { ...t.entries };
|
|
3028
|
-
for (const
|
|
3029
|
-
if (n.has(
|
|
3030
|
-
delete a[
|
|
3028
|
+
for (const u of o)
|
|
3029
|
+
if (n.has(u))
|
|
3030
|
+
delete a[u];
|
|
3031
3031
|
else
|
|
3032
|
-
throw new Error(`Key ${
|
|
3032
|
+
throw new Error(`Key ${u} not found in enum`);
|
|
3033
3033
|
return new Ie({
|
|
3034
3034
|
...t,
|
|
3035
3035
|
checks: [],
|
|
@@ -3047,7 +3047,7 @@ function $s(e, t) {
|
|
|
3047
3047
|
});
|
|
3048
3048
|
}
|
|
3049
3049
|
const Ps = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
|
|
3050
|
-
|
|
3050
|
+
Sr.init(e, t), I.init(e, t), e.values = new Set(t.values), Object.defineProperty(e, "value", {
|
|
3051
3051
|
get() {
|
|
3052
3052
|
if (t.values.length > 1)
|
|
3053
3053
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -3065,13 +3065,13 @@ function R(e, t) {
|
|
|
3065
3065
|
const Zs = /* @__PURE__ */ m("ZodTransform", (e, t) => {
|
|
3066
3066
|
Tr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
|
|
3067
3067
|
if (o.direction === "backward")
|
|
3068
|
-
throw new
|
|
3068
|
+
throw new St(e.constructor.name);
|
|
3069
3069
|
n.addIssue = (a) => {
|
|
3070
3070
|
if (typeof a == "string")
|
|
3071
3071
|
n.issues.push(re(a, n.value, t));
|
|
3072
3072
|
else {
|
|
3073
|
-
const
|
|
3074
|
-
|
|
3073
|
+
const u = a;
|
|
3074
|
+
u.fatal && (u.continue = !1), u.code ?? (u.code = "custom"), u.input ?? (u.input = n.value), u.inst ?? (u.inst = e), n.issues.push(re(u));
|
|
3075
3075
|
}
|
|
3076
3076
|
};
|
|
3077
3077
|
const i = t.transform(n.value, n);
|
|
@@ -3300,8 +3300,8 @@ function ua() {
|
|
|
3300
3300
|
if (r = parseFloat(r), s.ctx || g(), r !== void 0 && r >= 0 && r <= 1) {
|
|
3301
3301
|
if (s._volume = r, s._muted) return s;
|
|
3302
3302
|
s.usingWebAudio && s.masterGain.gain.setValueAtTime(r, o.ctx.currentTime);
|
|
3303
|
-
for (var
|
|
3304
|
-
var v = s._howls[
|
|
3303
|
+
for (var c = 0; c < s._howls.length; c++) if (!s._howls[c]._webAudio) for (var d = s._howls[c]._getSoundIds(), f = 0; f < d.length; f++) {
|
|
3304
|
+
var v = s._howls[c]._soundById(d[f]);
|
|
3305
3305
|
v && v._node && (v._node.volume = v._volume * r);
|
|
3306
3306
|
}
|
|
3307
3307
|
return s;
|
|
@@ -3310,8 +3310,8 @@ function ua() {
|
|
|
3310
3310
|
}, mute: function(r) {
|
|
3311
3311
|
var s = this || o;
|
|
3312
3312
|
s.ctx || g(), s._muted = r, s.usingWebAudio && s.masterGain.gain.setValueAtTime(r ? 0 : s._volume, o.ctx.currentTime);
|
|
3313
|
-
for (var
|
|
3314
|
-
var v = s._howls[
|
|
3313
|
+
for (var c = 0; c < s._howls.length; c++) if (!s._howls[c]._webAudio) for (var d = s._howls[c]._getSoundIds(), f = 0; f < d.length; f++) {
|
|
3314
|
+
var v = s._howls[c]._soundById(d[f]);
|
|
3315
3315
|
v && v._node && (v._node.muted = !!r || v._muted);
|
|
3316
3316
|
}
|
|
3317
3317
|
return s;
|
|
@@ -3346,13 +3346,13 @@ function ua() {
|
|
|
3346
3346
|
return r;
|
|
3347
3347
|
}
|
|
3348
3348
|
if (!s || typeof s.canPlayType != "function") return r;
|
|
3349
|
-
var
|
|
3350
|
-
return r._codecs = { mp3: !(f || !
|
|
3349
|
+
var c = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), f = d && parseInt(d[0].split("/")[1], 10) < 33;
|
|
3350
|
+
return r._codecs = { mp3: !(f || !c && !s.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!c, opus: !!s.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), ogg: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), oga: !!s.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), wav: !!(s.canPlayType('audio/wav; codecs="1"') || s.canPlayType("audio/wav")).replace(/^no$/, ""), aac: !!s.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!s.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!(s.canPlayType("audio/x-m4a;") || s.canPlayType("audio/m4a;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), m4b: !!(s.canPlayType("audio/x-m4b;") || s.canPlayType("audio/m4b;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), mp4: !!(s.canPlayType("audio/x-mp4;") || s.canPlayType("audio/mp4;") || s.canPlayType("audio/aac;")).replace(/^no$/, ""), weba: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), webm: !!s.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), dolby: !!s.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), flac: !!(s.canPlayType("audio/x-flac;") || s.canPlayType("audio/flac;")).replace(/^no$/, "") }, r;
|
|
3351
3351
|
}, _unlockAudio: function() {
|
|
3352
3352
|
var r = this || o;
|
|
3353
3353
|
if (!r._audioUnlocked && r.ctx) {
|
|
3354
3354
|
r._audioUnlocked = !1, r.autoUnlock = !1, r._mobileUnloaded || r.ctx.sampleRate === 44100 || (r._mobileUnloaded = !0, r.unload()), r._scratchBuffer = r.ctx.createBuffer(1, 1, 22050);
|
|
3355
|
-
var s = function(
|
|
3355
|
+
var s = function(c) {
|
|
3356
3356
|
for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
|
|
3357
3357
|
var d = new Audio();
|
|
3358
3358
|
d._unlocked = !0, r._releaseHtml5Audio(d);
|
|
@@ -3387,7 +3387,7 @@ function ua() {
|
|
|
3387
3387
|
var r = this;
|
|
3388
3388
|
if (r.autoSuspend && r.ctx && r.ctx.suspend !== void 0 && o.usingWebAudio) {
|
|
3389
3389
|
for (var s = 0; s < r._howls.length; s++) if (r._howls[s]._webAudio) {
|
|
3390
|
-
for (var
|
|
3390
|
+
for (var c = 0; c < r._howls[s]._sounds.length; c++) if (!r._howls[s]._sounds[c]._paused) return r;
|
|
3391
3391
|
}
|
|
3392
3392
|
return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
|
|
3393
3393
|
if (r.autoSuspend) {
|
|
@@ -3420,85 +3420,85 @@ function ua() {
|
|
|
3420
3420
|
var r = this, s = null;
|
|
3421
3421
|
if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
|
|
3422
3422
|
typeof r._src == "string" && (r._src = [r._src]);
|
|
3423
|
-
for (var
|
|
3423
|
+
for (var c = 0; c < r._src.length; c++) {
|
|
3424
3424
|
var d, f;
|
|
3425
|
-
if (r._format && r._format[
|
|
3425
|
+
if (r._format && r._format[c]) d = r._format[c];
|
|
3426
3426
|
else {
|
|
3427
|
-
if (typeof (f = r._src[
|
|
3427
|
+
if (typeof (f = r._src[c]) != "string") {
|
|
3428
3428
|
r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
|
|
3429
3429
|
continue;
|
|
3430
3430
|
}
|
|
3431
3431
|
d = /^data:audio\/([^;,]+);/i.exec(f), d || (d = /\.([^.]+)$/.exec(f.split("?", 1)[0])), d && (d = d[1].toLowerCase());
|
|
3432
3432
|
}
|
|
3433
3433
|
if (d || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), d && o.codecs(d)) {
|
|
3434
|
-
s = r._src[
|
|
3434
|
+
s = r._src[c];
|
|
3435
3435
|
break;
|
|
3436
3436
|
}
|
|
3437
3437
|
}
|
|
3438
3438
|
return s ? (r._src = s, r._state = "loading", window.location.protocol === "https:" && s.slice(0, 5) === "http:" && (r._html5 = !0, r._webAudio = !1), new a(r), r._webAudio && l(r), r) : void r._emit("loaderror", null, "No codec support for selected audio sources.");
|
|
3439
3439
|
}, play: function(r, s) {
|
|
3440
|
-
var
|
|
3440
|
+
var c = this, d = null;
|
|
3441
3441
|
if (typeof r == "number") d = r, r = null;
|
|
3442
3442
|
else {
|
|
3443
|
-
if (typeof r == "string" &&
|
|
3444
|
-
if (r === void 0 && (r = "__default", !
|
|
3445
|
-
for (var f = 0, v = 0; v <
|
|
3443
|
+
if (typeof r == "string" && c._state === "loaded" && !c._sprite[r]) return null;
|
|
3444
|
+
if (r === void 0 && (r = "__default", !c._playLock)) {
|
|
3445
|
+
for (var f = 0, v = 0; v < c._sounds.length; v++) c._sounds[v]._paused && !c._sounds[v]._ended && (f++, d = c._sounds[v]._id);
|
|
3446
3446
|
f === 1 ? r = null : d = null;
|
|
3447
3447
|
}
|
|
3448
3448
|
}
|
|
3449
|
-
var _ = d ?
|
|
3449
|
+
var _ = d ? c._soundById(d) : c._inactiveSound();
|
|
3450
3450
|
if (!_) return null;
|
|
3451
|
-
if (d && !r && (r = _._sprite || "__default"),
|
|
3451
|
+
if (d && !r && (r = _._sprite || "__default"), c._state !== "loaded") {
|
|
3452
3452
|
_._sprite = r, _._ended = !1;
|
|
3453
3453
|
var w = _._id;
|
|
3454
|
-
return
|
|
3455
|
-
|
|
3454
|
+
return c._queue.push({ event: "play", action: function() {
|
|
3455
|
+
c.play(w);
|
|
3456
3456
|
} }), w;
|
|
3457
3457
|
}
|
|
3458
|
-
if (d && !_._paused) return s ||
|
|
3459
|
-
|
|
3460
|
-
var k = Math.max(0, _._seek > 0 ? _._seek :
|
|
3458
|
+
if (d && !_._paused) return s || c._loadQueue("play"), _._id;
|
|
3459
|
+
c._webAudio && o._autoResume();
|
|
3460
|
+
var k = Math.max(0, _._seek > 0 ? _._seek : c._sprite[r][0] / 1e3), E = Math.max(0, (c._sprite[r][0] + c._sprite[r][1]) / 1e3 - k), x = 1e3 * E / Math.abs(_._rate), U = c._sprite[r][0] / 1e3, ie = (c._sprite[r][0] + c._sprite[r][1]) / 1e3;
|
|
3461
3461
|
_._sprite = r, _._ended = !1;
|
|
3462
3462
|
var ye = function() {
|
|
3463
|
-
_._paused = !1, _._seek = k, _._start = U, _._stop = ie, _._loop = !(!_._loop && !
|
|
3463
|
+
_._paused = !1, _._seek = k, _._start = U, _._stop = ie, _._loop = !(!_._loop && !c._sprite[r][2]);
|
|
3464
3464
|
};
|
|
3465
|
-
if (k >= ie) return void
|
|
3466
|
-
var
|
|
3467
|
-
if (
|
|
3465
|
+
if (k >= ie) return void c._ended(_);
|
|
3466
|
+
var S = _._node;
|
|
3467
|
+
if (c._webAudio) {
|
|
3468
3468
|
var Ve = function() {
|
|
3469
|
-
|
|
3470
|
-
var W = _._muted ||
|
|
3471
|
-
|
|
3472
|
-
|
|
3469
|
+
c._playLock = !1, ye(), c._refreshBuffer(_);
|
|
3470
|
+
var W = _._muted || c._muted ? 0 : _._volume;
|
|
3471
|
+
S.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, S.bufferSource.start === void 0 ? _._loop ? S.bufferSource.noteGrainOn(0, k, 86400) : S.bufferSource.noteGrainOn(0, k, E) : _._loop ? S.bufferSource.start(0, k, 86400) : S.bufferSource.start(0, k, E), x !== 1 / 0 && (c._endTimers[_._id] = setTimeout(c._ended.bind(c, _), x)), s || setTimeout(function() {
|
|
3472
|
+
c._emit("play", _._id), c._loadQueue();
|
|
3473
3473
|
}, 0);
|
|
3474
3474
|
};
|
|
3475
|
-
o.state === "running" && o.ctx.state !== "interrupted" ? Ve() : (
|
|
3475
|
+
o.state === "running" && o.ctx.state !== "interrupted" ? Ve() : (c._playLock = !0, c.once("resume", Ve), c._clearTimer(_._id));
|
|
3476
3476
|
} else {
|
|
3477
3477
|
var Be = function() {
|
|
3478
|
-
|
|
3478
|
+
S.currentTime = k, S.muted = _._muted || c._muted || o._muted || S.muted, S.volume = _._volume * o.volume(), S.playbackRate = _._rate;
|
|
3479
3479
|
try {
|
|
3480
|
-
var W =
|
|
3481
|
-
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (
|
|
3482
|
-
|
|
3480
|
+
var W = S.play();
|
|
3481
|
+
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (c._playLock = !0, ye(), W.then(function() {
|
|
3482
|
+
c._playLock = !1, S._unlocked = !0, s || (c._emit("play", _._id), c._loadQueue());
|
|
3483
3483
|
}).catch(function() {
|
|
3484
|
-
|
|
3485
|
-
})) : s || (
|
|
3486
|
-
r !== "__default" || _._loop ?
|
|
3487
|
-
|
|
3488
|
-
},
|
|
3484
|
+
c._playLock = !1, c._emit("playerror", _._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."), _._ended = !0, _._paused = !0;
|
|
3485
|
+
})) : s || (c._playLock = !1, ye(), c._emit("play", _._id), c._loadQueue()), S.playbackRate = _._rate, S.paused) return void c._emit("playerror", _._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.");
|
|
3486
|
+
r !== "__default" || _._loop ? c._endTimers[_._id] = setTimeout(c._ended.bind(c, _), x) : (c._endTimers[_._id] = function() {
|
|
3487
|
+
c._ended(_), S.removeEventListener("ended", c._endTimers[_._id], !1);
|
|
3488
|
+
}, S.addEventListener("ended", c._endTimers[_._id], !1));
|
|
3489
3489
|
} catch (nn) {
|
|
3490
|
-
|
|
3490
|
+
c._emit("playerror", _._id, nn);
|
|
3491
3491
|
}
|
|
3492
3492
|
};
|
|
3493
|
-
|
|
3494
|
-
var tn = window && window.ejecta || !
|
|
3495
|
-
if (
|
|
3493
|
+
S.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (S.src = c._src, S.load());
|
|
3494
|
+
var tn = window && window.ejecta || !S.readyState && o._navigator.isCocoonJS;
|
|
3495
|
+
if (S.readyState >= 3 || tn) Be();
|
|
3496
3496
|
else {
|
|
3497
|
-
|
|
3497
|
+
c._playLock = !0;
|
|
3498
3498
|
var Ge = function() {
|
|
3499
|
-
Be(),
|
|
3499
|
+
Be(), S.removeEventListener(o._canPlayEvent, Ge, !1);
|
|
3500
3500
|
};
|
|
3501
|
-
|
|
3501
|
+
S.addEventListener(o._canPlayEvent, Ge, !1), c._clearTimer(_._id);
|
|
3502
3502
|
}
|
|
3503
3503
|
}
|
|
3504
3504
|
return _._id;
|
|
@@ -3507,10 +3507,10 @@ function ua() {
|
|
|
3507
3507
|
if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
|
|
3508
3508
|
s.pause(r);
|
|
3509
3509
|
} }), s;
|
|
3510
|
-
for (var
|
|
3511
|
-
s._clearTimer(
|
|
3512
|
-
var f = s._soundById(
|
|
3513
|
-
if (f && !f._paused && (f._seek = s.seek(
|
|
3510
|
+
for (var c = s._getSoundIds(r), d = 0; d < c.length; d++) {
|
|
3511
|
+
s._clearTimer(c[d]);
|
|
3512
|
+
var f = s._soundById(c[d]);
|
|
3513
|
+
if (f && !f._paused && (f._seek = s.seek(c[d]), f._rateSeek = 0, f._paused = !0, s._stopFade(c[d]), f._node)) if (s._webAudio) {
|
|
3514
3514
|
if (!f._node.bufferSource) continue;
|
|
3515
3515
|
f._node.bufferSource.stop === void 0 ? f._node.bufferSource.noteOff(0) : f._node.bufferSource.stop(0), s._cleanBuffer(f._node);
|
|
3516
3516
|
} else isNaN(f._node.duration) && f._node.duration !== 1 / 0 || f._node.pause();
|
|
@@ -3518,159 +3518,159 @@ function ua() {
|
|
|
3518
3518
|
}
|
|
3519
3519
|
return s;
|
|
3520
3520
|
}, stop: function(r, s) {
|
|
3521
|
-
var
|
|
3522
|
-
if (
|
|
3523
|
-
|
|
3524
|
-
} }),
|
|
3525
|
-
for (var d =
|
|
3526
|
-
|
|
3527
|
-
var v =
|
|
3528
|
-
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0,
|
|
3521
|
+
var c = this;
|
|
3522
|
+
if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "stop", action: function() {
|
|
3523
|
+
c.stop(r, s);
|
|
3524
|
+
} }), c;
|
|
3525
|
+
for (var d = c._getSoundIds(r), f = 0; f < d.length; f++) {
|
|
3526
|
+
c._clearTimer(d[f]);
|
|
3527
|
+
var v = c._soundById(d[f]);
|
|
3528
|
+
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, c._stopFade(d[f]), v._node && (c._webAudio ? v._node.bufferSource && (v._node.bufferSource.stop === void 0 ? v._node.bufferSource.noteOff(0) : v._node.bufferSource.stop(0), c._cleanBuffer(v._node)) : isNaN(v._node.duration) && v._node.duration !== 1 / 0 || (v._node.currentTime = v._start || 0, v._node.pause(), v._node.duration === 1 / 0 && c._clearSound(v._node))), s || c._emit("stop", v._id));
|
|
3529
3529
|
}
|
|
3530
|
-
return
|
|
3530
|
+
return c;
|
|
3531
3531
|
}, mute: function(r, s) {
|
|
3532
|
-
var
|
|
3533
|
-
if (
|
|
3534
|
-
|
|
3535
|
-
} }),
|
|
3532
|
+
var c = this;
|
|
3533
|
+
if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "mute", action: function() {
|
|
3534
|
+
c.mute(r, s);
|
|
3535
|
+
} }), c;
|
|
3536
3536
|
if (s === void 0) {
|
|
3537
|
-
if (typeof r != "boolean") return
|
|
3538
|
-
|
|
3537
|
+
if (typeof r != "boolean") return c._muted;
|
|
3538
|
+
c._muted = r;
|
|
3539
3539
|
}
|
|
3540
|
-
for (var d =
|
|
3541
|
-
var v =
|
|
3542
|
-
v && (v._muted = r, v._interval &&
|
|
3540
|
+
for (var d = c._getSoundIds(s), f = 0; f < d.length; f++) {
|
|
3541
|
+
var v = c._soundById(d[f]);
|
|
3542
|
+
v && (v._muted = r, v._interval && c._stopFade(v._id), c._webAudio && v._node ? v._node.gain.setValueAtTime(r ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || r), c._emit("mute", v._id));
|
|
3543
3543
|
}
|
|
3544
|
-
return
|
|
3544
|
+
return c;
|
|
3545
3545
|
}, volume: function() {
|
|
3546
|
-
var r, s,
|
|
3547
|
-
if (d.length === 0) return
|
|
3548
|
-
d.length === 1 || d.length === 2 && d[1] === void 0 ?
|
|
3546
|
+
var r, s, c = this, d = arguments;
|
|
3547
|
+
if (d.length === 0) return c._volume;
|
|
3548
|
+
d.length === 1 || d.length === 2 && d[1] === void 0 ? c._getSoundIds().indexOf(d[0]) >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]) : d.length >= 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3549
3549
|
var f;
|
|
3550
|
-
if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ?
|
|
3551
|
-
if (
|
|
3552
|
-
|
|
3553
|
-
} }),
|
|
3554
|
-
s === void 0 && (
|
|
3555
|
-
for (var v = 0; v < s.length; v++) (f =
|
|
3556
|
-
return
|
|
3557
|
-
}, fade: function(r, s,
|
|
3550
|
+
if (!(r !== void 0 && r >= 0 && r <= 1)) return f = s ? c._soundById(s) : c._sounds[0], f ? f._volume : 0;
|
|
3551
|
+
if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "volume", action: function() {
|
|
3552
|
+
c.volume.apply(c, d);
|
|
3553
|
+
} }), c;
|
|
3554
|
+
s === void 0 && (c._volume = r), s = c._getSoundIds(s);
|
|
3555
|
+
for (var v = 0; v < s.length; v++) (f = c._soundById(s[v])) && (f._volume = r, d[2] || c._stopFade(s[v]), c._webAudio && f._node && !f._muted ? f._node.gain.setValueAtTime(r, o.ctx.currentTime) : f._node && !f._muted && (f._node.volume = r * o.volume()), c._emit("volume", f._id));
|
|
3556
|
+
return c;
|
|
3557
|
+
}, fade: function(r, s, c, d) {
|
|
3558
3558
|
var f = this;
|
|
3559
3559
|
if (f._state !== "loaded" || f._playLock) return f._queue.push({ event: "fade", action: function() {
|
|
3560
|
-
f.fade(r, s,
|
|
3560
|
+
f.fade(r, s, c, d);
|
|
3561
3561
|
} }), f;
|
|
3562
|
-
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1),
|
|
3562
|
+
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), c = parseFloat(c), f.volume(r, d);
|
|
3563
3563
|
for (var v = f._getSoundIds(d), _ = 0; _ < v.length; _++) {
|
|
3564
3564
|
var w = f._soundById(v[_]);
|
|
3565
3565
|
if (w) {
|
|
3566
3566
|
if (d || f._stopFade(v[_]), f._webAudio && !w._muted) {
|
|
3567
|
-
var k = o.ctx.currentTime, E = k +
|
|
3567
|
+
var k = o.ctx.currentTime, E = k + c / 1e3;
|
|
3568
3568
|
w._volume = r, w._node.gain.setValueAtTime(r, k), w._node.gain.linearRampToValueAtTime(s, E);
|
|
3569
3569
|
}
|
|
3570
|
-
f._startFadeInterval(w, r, s,
|
|
3570
|
+
f._startFadeInterval(w, r, s, c, v[_], d === void 0);
|
|
3571
3571
|
}
|
|
3572
3572
|
}
|
|
3573
3573
|
return f;
|
|
3574
|
-
}, _startFadeInterval: function(r, s,
|
|
3575
|
-
var _ = this, w = s, k =
|
|
3576
|
-
r._fadeTo =
|
|
3574
|
+
}, _startFadeInterval: function(r, s, c, d, f, v) {
|
|
3575
|
+
var _ = this, w = s, k = c - s, E = Math.abs(k / 0.01), x = Math.max(4, E > 0 ? d / E : d), U = Date.now();
|
|
3576
|
+
r._fadeTo = c, r._interval = setInterval(function() {
|
|
3577
3577
|
var ie = (Date.now() - U) / d;
|
|
3578
|
-
U = Date.now(), w += k * ie, w = Math.round(100 * w) / 100, w = k < 0 ? Math.max(
|
|
3578
|
+
U = Date.now(), w += k * ie, w = Math.round(100 * w) / 100, w = k < 0 ? Math.max(c, w) : Math.min(c, w), _._webAudio ? r._volume = w : _.volume(w, r._id, !0), v && (_._volume = w), (c < s && w <= c || c > s && w >= c) && (clearInterval(r._interval), r._interval = null, r._fadeTo = null, _.volume(c, r._id), _._emit("fade", r._id));
|
|
3579
3579
|
}, x);
|
|
3580
3580
|
}, _stopFade: function(r) {
|
|
3581
|
-
var s = this,
|
|
3582
|
-
return
|
|
3581
|
+
var s = this, c = s._soundById(r);
|
|
3582
|
+
return c && c._interval && (s._webAudio && c._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(c._interval), c._interval = null, s.volume(c._fadeTo, r), c._fadeTo = null, s._emit("fade", r)), s;
|
|
3583
3583
|
}, loop: function() {
|
|
3584
|
-
var r, s,
|
|
3584
|
+
var r, s, c, d = this, f = arguments;
|
|
3585
3585
|
if (f.length === 0) return d._loop;
|
|
3586
3586
|
if (f.length === 1) {
|
|
3587
|
-
if (typeof f[0] != "boolean") return !!(
|
|
3587
|
+
if (typeof f[0] != "boolean") return !!(c = d._soundById(parseInt(f[0], 10))) && c._loop;
|
|
3588
3588
|
r = f[0], d._loop = r;
|
|
3589
3589
|
} else f.length === 2 && (r = f[0], s = parseInt(f[1], 10));
|
|
3590
|
-
for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (
|
|
3590
|
+
for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (c = d._soundById(v[_])) && (c._loop = r, d._webAudio && c._node && c._node.bufferSource && (c._node.bufferSource.loop = r, r && (c._node.bufferSource.loopStart = c._start || 0, c._node.bufferSource.loopEnd = c._stop)));
|
|
3591
3591
|
return d;
|
|
3592
3592
|
}, rate: function() {
|
|
3593
|
-
var r, s,
|
|
3594
|
-
if (d.length === 0) s =
|
|
3593
|
+
var r, s, c = this, d = arguments;
|
|
3594
|
+
if (d.length === 0) s = c._sounds[0]._id;
|
|
3595
3595
|
else if (d.length === 1) {
|
|
3596
|
-
var f =
|
|
3596
|
+
var f = c._getSoundIds(), v = f.indexOf(d[0]);
|
|
3597
3597
|
v >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]);
|
|
3598
3598
|
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3599
3599
|
var _;
|
|
3600
|
-
if (typeof r != "number") return _ =
|
|
3601
|
-
if (
|
|
3602
|
-
|
|
3603
|
-
} }),
|
|
3604
|
-
s === void 0 && (
|
|
3605
|
-
for (var w = 0; w < s.length; w++) if (_ =
|
|
3606
|
-
|
|
3607
|
-
var k =
|
|
3608
|
-
!
|
|
3600
|
+
if (typeof r != "number") return _ = c._soundById(s), _ ? _._rate : c._rate;
|
|
3601
|
+
if (c._state !== "loaded" || c._playLock) return c._queue.push({ event: "rate", action: function() {
|
|
3602
|
+
c.rate.apply(c, d);
|
|
3603
|
+
} }), c;
|
|
3604
|
+
s === void 0 && (c._rate = r), s = c._getSoundIds(s);
|
|
3605
|
+
for (var w = 0; w < s.length; w++) if (_ = c._soundById(s[w])) {
|
|
3606
|
+
c.playing(s[w]) && (_._rateSeek = c.seek(s[w]), _._playStart = c._webAudio ? o.ctx.currentTime : _._playStart), _._rate = r, c._webAudio && _._node && _._node.bufferSource ? _._node.bufferSource.playbackRate.setValueAtTime(r, o.ctx.currentTime) : _._node && (_._node.playbackRate = r);
|
|
3607
|
+
var k = c.seek(s[w]), E = (c._sprite[_._sprite][0] + c._sprite[_._sprite][1]) / 1e3 - k, x = 1e3 * E / Math.abs(_._rate);
|
|
3608
|
+
!c._endTimers[s[w]] && _._paused || (c._clearTimer(s[w]), c._endTimers[s[w]] = setTimeout(c._ended.bind(c, _), x)), c._emit("rate", _._id);
|
|
3609
3609
|
}
|
|
3610
|
-
return
|
|
3610
|
+
return c;
|
|
3611
3611
|
}, seek: function() {
|
|
3612
|
-
var r, s,
|
|
3613
|
-
if (d.length === 0) s =
|
|
3612
|
+
var r, s, c = this, d = arguments;
|
|
3613
|
+
if (d.length === 0) s = c._sounds[0]._id;
|
|
3614
3614
|
else if (d.length === 1) {
|
|
3615
|
-
var f =
|
|
3616
|
-
v >= 0 ? s = parseInt(d[0], 10) :
|
|
3615
|
+
var f = c._getSoundIds(), v = f.indexOf(d[0]);
|
|
3616
|
+
v >= 0 ? s = parseInt(d[0], 10) : c._sounds.length && (s = c._sounds[0]._id, r = parseFloat(d[0]));
|
|
3617
3617
|
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3618
|
-
if (s === void 0) return
|
|
3619
|
-
if (typeof r == "number" && (
|
|
3620
|
-
|
|
3621
|
-
} }),
|
|
3622
|
-
var _ =
|
|
3618
|
+
if (s === void 0) return c;
|
|
3619
|
+
if (typeof r == "number" && (c._state !== "loaded" || c._playLock)) return c._queue.push({ event: "seek", action: function() {
|
|
3620
|
+
c.seek.apply(c, d);
|
|
3621
|
+
} }), c;
|
|
3622
|
+
var _ = c._soundById(s);
|
|
3623
3623
|
if (_) {
|
|
3624
3624
|
if (!(typeof r == "number" && r >= 0)) {
|
|
3625
|
-
if (
|
|
3626
|
-
var w =
|
|
3625
|
+
if (c._webAudio) {
|
|
3626
|
+
var w = c.playing(s) ? o.ctx.currentTime - _._playStart : 0, k = _._rateSeek ? _._rateSeek - _._seek : 0;
|
|
3627
3627
|
return _._seek + (k + w * Math.abs(_._rate));
|
|
3628
3628
|
}
|
|
3629
3629
|
return _._node.currentTime;
|
|
3630
3630
|
}
|
|
3631
|
-
var E =
|
|
3632
|
-
E &&
|
|
3631
|
+
var E = c.playing(s);
|
|
3632
|
+
E && c.pause(s, !0), _._seek = r, _._ended = !1, c._clearTimer(s), c._webAudio || !_._node || isNaN(_._node.duration) || (_._node.currentTime = r);
|
|
3633
3633
|
var x = function() {
|
|
3634
|
-
|
|
3634
|
+
c._emit("seek", s), E && c.play(s, !0);
|
|
3635
3635
|
};
|
|
3636
|
-
if (E && !
|
|
3636
|
+
if (E && !c._webAudio) {
|
|
3637
3637
|
var U = function() {
|
|
3638
|
-
|
|
3638
|
+
c._playLock ? setTimeout(U, 0) : x();
|
|
3639
3639
|
};
|
|
3640
3640
|
setTimeout(U, 0);
|
|
3641
3641
|
} else x();
|
|
3642
3642
|
}
|
|
3643
|
-
return
|
|
3643
|
+
return c;
|
|
3644
3644
|
}, playing: function(r) {
|
|
3645
3645
|
var s = this;
|
|
3646
3646
|
if (typeof r == "number") {
|
|
3647
|
-
var
|
|
3648
|
-
return !!
|
|
3647
|
+
var c = s._soundById(r);
|
|
3648
|
+
return !!c && !c._paused;
|
|
3649
3649
|
}
|
|
3650
3650
|
for (var d = 0; d < s._sounds.length; d++) if (!s._sounds[d]._paused) return !0;
|
|
3651
3651
|
return !1;
|
|
3652
3652
|
}, duration: function(r) {
|
|
3653
|
-
var s = this,
|
|
3654
|
-
return d && (
|
|
3653
|
+
var s = this, c = s._duration, d = s._soundById(r);
|
|
3654
|
+
return d && (c = s._sprite[d._sprite][1] / 1e3), c;
|
|
3655
3655
|
}, state: function() {
|
|
3656
3656
|
return this._state;
|
|
3657
3657
|
}, unload: function() {
|
|
3658
|
-
for (var r = this, s = r._sounds,
|
|
3658
|
+
for (var r = this, s = r._sounds, c = 0; c < s.length; c++) s[c]._paused || r.stop(s[c]._id), r._webAudio || (r._clearSound(s[c]._node), s[c]._node.removeEventListener("error", s[c]._errorFn, !1), s[c]._node.removeEventListener(o._canPlayEvent, s[c]._loadFn, !1), s[c]._node.removeEventListener("ended", s[c]._endFn, !1), o._releaseHtml5Audio(s[c]._node)), delete s[c]._node, r._clearTimer(s[c]._id);
|
|
3659
3659
|
var d = o._howls.indexOf(r);
|
|
3660
3660
|
d >= 0 && o._howls.splice(d, 1);
|
|
3661
3661
|
var f = !0;
|
|
3662
|
-
for (
|
|
3662
|
+
for (c = 0; c < o._howls.length; c++) if (o._howls[c]._src === r._src || r._src.indexOf(o._howls[c]._src) >= 0) {
|
|
3663
3663
|
f = !1;
|
|
3664
3664
|
break;
|
|
3665
3665
|
}
|
|
3666
|
-
return
|
|
3667
|
-
}, on: function(r, s,
|
|
3666
|
+
return u && f && delete u[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
|
|
3667
|
+
}, on: function(r, s, c, d) {
|
|
3668
3668
|
var f = this, v = f["_on" + r];
|
|
3669
|
-
return typeof s == "function" && v.push(d ? { id:
|
|
3670
|
-
}, off: function(r, s,
|
|
3669
|
+
return typeof s == "function" && v.push(d ? { id: c, fn: s, once: d } : { id: c, fn: s }), f;
|
|
3670
|
+
}, off: function(r, s, c) {
|
|
3671
3671
|
var d = this, f = d["_on" + r], v = 0;
|
|
3672
|
-
if (typeof s == "number" && (
|
|
3673
|
-
var _ =
|
|
3672
|
+
if (typeof s == "number" && (c = s, s = null), s || c) for (v = 0; v < f.length; v++) {
|
|
3673
|
+
var _ = c === f[v].id;
|
|
3674
3674
|
if (s === f[v].fn && _ || !s && _) {
|
|
3675
3675
|
f.splice(v, 1);
|
|
3676
3676
|
break;
|
|
@@ -3682,25 +3682,25 @@ function ua() {
|
|
|
3682
3682
|
for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(d[w[v]]) && (d[w[v]] = []);
|
|
3683
3683
|
}
|
|
3684
3684
|
return d;
|
|
3685
|
-
}, once: function(r, s,
|
|
3685
|
+
}, once: function(r, s, c) {
|
|
3686
3686
|
var d = this;
|
|
3687
|
-
return d.on(r, s,
|
|
3688
|
-
}, _emit: function(r, s,
|
|
3687
|
+
return d.on(r, s, c, 1), d;
|
|
3688
|
+
}, _emit: function(r, s, c) {
|
|
3689
3689
|
for (var d = this, f = d["_on" + r], v = f.length - 1; v >= 0; v--) f[v].id && f[v].id !== s && r !== "load" || (setTimeout((function(_) {
|
|
3690
|
-
_.call(this, s,
|
|
3690
|
+
_.call(this, s, c);
|
|
3691
3691
|
}).bind(d, f[v].fn), 0), f[v].once && d.off(r, f[v].fn, f[v].id));
|
|
3692
3692
|
return d._loadQueue(r), d;
|
|
3693
3693
|
}, _loadQueue: function(r) {
|
|
3694
3694
|
var s = this;
|
|
3695
3695
|
if (s._queue.length > 0) {
|
|
3696
|
-
var
|
|
3697
|
-
|
|
3696
|
+
var c = s._queue[0];
|
|
3697
|
+
c.event === r && (s._queue.shift(), s._loadQueue()), r || c.action();
|
|
3698
3698
|
}
|
|
3699
3699
|
return s;
|
|
3700
3700
|
}, _ended: function(r) {
|
|
3701
|
-
var s = this,
|
|
3701
|
+
var s = this, c = r._sprite;
|
|
3702
3702
|
if (!s._webAudio && r._node && !r._node.paused && !r._node.ended && r._node.currentTime < r._stop) return setTimeout(s._ended.bind(s, r), 100), s;
|
|
3703
|
-
var d = !(!r._loop && !s._sprite[
|
|
3703
|
+
var d = !(!r._loop && !s._sprite[c][2]);
|
|
3704
3704
|
if (s._emit("end", r._id), !s._webAudio && d && s.stop(r._id, !0).play(r._id), s._webAudio && d) {
|
|
3705
3705
|
s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
|
|
3706
3706
|
var f = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
|
|
@@ -3712,14 +3712,14 @@ function ua() {
|
|
|
3712
3712
|
if (s._endTimers[r]) {
|
|
3713
3713
|
if (typeof s._endTimers[r] != "function") clearTimeout(s._endTimers[r]);
|
|
3714
3714
|
else {
|
|
3715
|
-
var
|
|
3716
|
-
|
|
3715
|
+
var c = s._soundById(r);
|
|
3716
|
+
c && c._node && c._node.removeEventListener("ended", s._endTimers[r], !1);
|
|
3717
3717
|
}
|
|
3718
3718
|
delete s._endTimers[r];
|
|
3719
3719
|
}
|
|
3720
3720
|
return s;
|
|
3721
3721
|
}, _soundById: function(r) {
|
|
3722
|
-
for (var s = this,
|
|
3722
|
+
for (var s = this, c = 0; c < s._sounds.length; c++) if (r === s._sounds[c]._id) return s._sounds[c];
|
|
3723
3723
|
return null;
|
|
3724
3724
|
}, _inactiveSound: function() {
|
|
3725
3725
|
var r = this;
|
|
@@ -3727,27 +3727,27 @@ function ua() {
|
|
|
3727
3727
|
for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
|
|
3728
3728
|
return new a(r);
|
|
3729
3729
|
}, _drain: function() {
|
|
3730
|
-
var r = this, s = r._pool,
|
|
3730
|
+
var r = this, s = r._pool, c = 0, d = 0;
|
|
3731
3731
|
if (!(r._sounds.length < s)) {
|
|
3732
|
-
for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended &&
|
|
3732
|
+
for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended && c++;
|
|
3733
3733
|
for (d = r._sounds.length - 1; d >= 0; d--) {
|
|
3734
|
-
if (
|
|
3735
|
-
r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1),
|
|
3734
|
+
if (c <= s) return;
|
|
3735
|
+
r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1), c--);
|
|
3736
3736
|
}
|
|
3737
3737
|
}
|
|
3738
3738
|
}, _getSoundIds: function(r) {
|
|
3739
3739
|
var s = this;
|
|
3740
3740
|
if (r === void 0) {
|
|
3741
|
-
for (var
|
|
3742
|
-
return
|
|
3741
|
+
for (var c = [], d = 0; d < s._sounds.length; d++) c.push(s._sounds[d]._id);
|
|
3742
|
+
return c;
|
|
3743
3743
|
}
|
|
3744
3744
|
return [r];
|
|
3745
3745
|
}, _refreshBuffer: function(r) {
|
|
3746
3746
|
var s = this;
|
|
3747
|
-
return r._node.bufferSource = o.ctx.createBufferSource(), r._node.bufferSource.buffer =
|
|
3747
|
+
return r._node.bufferSource = o.ctx.createBufferSource(), r._node.bufferSource.buffer = u[s._src], r._panner ? r._node.bufferSource.connect(r._panner) : r._node.bufferSource.connect(r._node), r._node.bufferSource.loop = r._loop, r._loop && (r._node.bufferSource.loopStart = r._start || 0, r._node.bufferSource.loopEnd = r._stop || 0), r._node.bufferSource.playbackRate.setValueAtTime(r._rate, o.ctx.currentTime), s;
|
|
3748
3748
|
}, _cleanBuffer: function(r) {
|
|
3749
|
-
var s = this,
|
|
3750
|
-
if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0),
|
|
3749
|
+
var s = this, c = o._navigator && o._navigator.vendor.indexOf("Apple") >= 0;
|
|
3750
|
+
if (o._scratchBuffer && r.bufferSource && (r.bufferSource.onended = null, r.bufferSource.disconnect(0), c)) try {
|
|
3751
3751
|
r.bufferSource.buffer = o._scratchBuffer;
|
|
3752
3752
|
} catch {
|
|
3753
3753
|
}
|
|
@@ -3762,8 +3762,8 @@ function ua() {
|
|
|
3762
3762
|
var r = this, s = r._parent;
|
|
3763
3763
|
return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, s._sounds.push(r), r.create(), r;
|
|
3764
3764
|
}, create: function() {
|
|
3765
|
-
var r = this, s = r._parent,
|
|
3766
|
-
return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(
|
|
3765
|
+
var r = this, s = r._parent, c = o._muted || r._muted || r._parent._muted ? 0 : r._volume;
|
|
3766
|
+
return s._webAudio ? (r._node = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), r._node.gain.setValueAtTime(c, o.ctx.currentTime), r._node.paused = !0, r._node.connect(o.masterGain)) : o.noAudio || (r._node = o._obtainHtml5Audio(), r._errorFn = r._errorListener.bind(r), r._node.addEventListener("error", r._errorFn, !1), r._loadFn = r._loadListener.bind(r), r._node.addEventListener(o._canPlayEvent, r._loadFn, !1), r._endFn = r._endListener.bind(r), r._node.addEventListener("ended", r._endFn, !1), r._node.src = s._src, r._node.preload = s._preload === !0 ? "auto" : s._preload, r._node.volume = c * o.volume(), r._node.load()), r;
|
|
3767
3767
|
}, reset: function() {
|
|
3768
3768
|
var r = this, s = r._parent;
|
|
3769
3769
|
return r._muted = s._muted, r._loop = s._loop, r._volume = s._volume, r._rate = s._rate, r._seek = 0, r._rateSeek = 0, r._paused = !0, r._ended = !0, r._sprite = "__default", r._id = ++o._counter, r;
|
|
@@ -3777,11 +3777,11 @@ function ua() {
|
|
|
3777
3777
|
var r = this, s = r._parent;
|
|
3778
3778
|
s._duration === 1 / 0 && (s._duration = Math.ceil(10 * r._node.duration) / 10, s._sprite.__default[1] === 1 / 0 && (s._sprite.__default[1] = 1e3 * s._duration), s._ended(r)), r._node.removeEventListener("ended", r._endFn, !1);
|
|
3779
3779
|
} };
|
|
3780
|
-
var
|
|
3780
|
+
var u = {}, l = function(r) {
|
|
3781
3781
|
var s = r._src;
|
|
3782
|
-
if (
|
|
3782
|
+
if (u[s]) return r._duration = u[s].duration, void y(r);
|
|
3783
3783
|
if (/^data:[^;]+;base64,/.test(s)) {
|
|
3784
|
-
for (var
|
|
3784
|
+
for (var c = atob(s.split(",")[1]), d = new Uint8Array(c.length), f = 0; f < c.length; ++f) d[f] = c.charCodeAt(f);
|
|
3785
3785
|
h(d.buffer, r);
|
|
3786
3786
|
} else {
|
|
3787
3787
|
var v = new XMLHttpRequest();
|
|
@@ -3792,7 +3792,7 @@ function ua() {
|
|
|
3792
3792
|
if (_ !== "0" && _ !== "2" && _ !== "3") return void r._emit("loaderror", null, "Failed loading audio file with status: " + v.status + ".");
|
|
3793
3793
|
h(v.response, r);
|
|
3794
3794
|
}, v.onerror = function() {
|
|
3795
|
-
r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete
|
|
3795
|
+
r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete u[s], r.load());
|
|
3796
3796
|
}, p(v);
|
|
3797
3797
|
}
|
|
3798
3798
|
}, p = function(r) {
|
|
@@ -3802,12 +3802,12 @@ function ua() {
|
|
|
3802
3802
|
r.onerror();
|
|
3803
3803
|
}
|
|
3804
3804
|
}, h = function(r, s) {
|
|
3805
|
-
var
|
|
3805
|
+
var c = function() {
|
|
3806
3806
|
s._emit("loaderror", null, "Decoding audio data failed.");
|
|
3807
3807
|
}, d = function(f) {
|
|
3808
|
-
f && s._sounds.length > 0 ? (
|
|
3808
|
+
f && s._sounds.length > 0 ? (u[s._src] = f, y(s, f)) : c();
|
|
3809
3809
|
};
|
|
3810
|
-
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(
|
|
3810
|
+
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(c) : o.ctx.decodeAudioData(r, d, c);
|
|
3811
3811
|
}, y = function(r, s) {
|
|
3812
3812
|
s && !r._duration && (r._duration = s.duration), Object.keys(r._sprite).length === 0 && (r._sprite = { __default: [0, 1e3 * r._duration] }), r._state !== "loaded" && (r._state = "loaded", r._emit("load"), r._loadQueue());
|
|
3813
3813
|
}, g = function() {
|
|
@@ -3818,8 +3818,8 @@ function ua() {
|
|
|
3818
3818
|
o.usingWebAudio = !1;
|
|
3819
3819
|
}
|
|
3820
3820
|
o.ctx || (o.usingWebAudio = !1);
|
|
3821
|
-
var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),
|
|
3822
|
-
if (r &&
|
|
3821
|
+
var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), c = s ? parseInt(s[1], 10) : null;
|
|
3822
|
+
if (r && c && c < 9) {
|
|
3823
3823
|
var d = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
|
|
3824
3824
|
o._navigator && !d && (o.usingWebAudio = !1);
|
|
3825
3825
|
}
|
|
@@ -3832,7 +3832,7 @@ function ua() {
|
|
|
3832
3832
|
}
|
|
3833
3833
|
var vt = ua();
|
|
3834
3834
|
const ca = typeof navigator < "u" && typeof navigator.standalone < "u";
|
|
3835
|
-
class
|
|
3835
|
+
class Aa {
|
|
3836
3836
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3837
3837
|
constructor(t) {
|
|
3838
3838
|
this.cogsConnection = t, this.addEventListener("audioClipState", ({ detail: o }) => {
|
|
@@ -3867,9 +3867,9 @@ class Sa {
|
|
|
3867
3867
|
});
|
|
3868
3868
|
const n = () => {
|
|
3869
3869
|
const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
|
|
3870
|
-
const
|
|
3870
|
+
const u = Object.values(a.activeClips), l = u.some(
|
|
3871
3871
|
({ state: p }) => p.type === "playing" || p.type === "pausing" || p.type === "stopping" || p.type === "play_requested" || p.type === "pause_requested" || p.type === "stop_requested"
|
|
3872
|
-
) ? "playing" :
|
|
3872
|
+
) ? "playing" : u.some(({ state: p }) => p.type === "paused") ? "paused" : "stopped";
|
|
3873
3873
|
return [i, l];
|
|
3874
3874
|
});
|
|
3875
3875
|
t.sendInitialMediaClipStates({ mediaType: "audio", files: o });
|
|
@@ -3884,21 +3884,21 @@ class Sa {
|
|
|
3884
3884
|
this.globalVolume = t, vt.Howler.volume(t), this.notifyStateListeners();
|
|
3885
3885
|
}
|
|
3886
3886
|
playAudioClip(t, { playId: n, volume: o, fade: i, loop: a }) {
|
|
3887
|
-
t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (
|
|
3888
|
-
const l = Object.entries(
|
|
3887
|
+
t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (u) => {
|
|
3888
|
+
const l = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), p = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
|
|
3889
3889
|
l.forEach((g) => {
|
|
3890
|
-
|
|
3890
|
+
u.player.play(g);
|
|
3891
3891
|
});
|
|
3892
|
-
const h = Object.entries(
|
|
3892
|
+
const h = Object.entries(u.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || p.length > 0 || h.length > 0 ? [] : [u.player.play()];
|
|
3893
3893
|
return p.forEach((g) => {
|
|
3894
|
-
|
|
3894
|
+
u.player.off("fade", void 0, g), u.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(u.player, o, i * 1e3, g) : Ce(u.player, o, g);
|
|
3895
3895
|
}), [...l, ...h, ...y].forEach((g) => {
|
|
3896
|
-
|
|
3897
|
-
Ee(
|
|
3898
|
-
}),
|
|
3896
|
+
u.player.loop(a, g), u.player.off("play", void 0, g), u.player.off("pause", void 0, g), u.player.off("fade", void 0, g), u.player.off("end", void 0, g), u.player.off("stop", void 0, g), u.player.once("play", () => {
|
|
3897
|
+
Ee(u.player, this.sinkId);
|
|
3898
|
+
}), u.player.once("stop", () => this.handleStoppedClip(t, n, g), g), u.player.on(
|
|
3899
3899
|
"end",
|
|
3900
3900
|
() => {
|
|
3901
|
-
|
|
3901
|
+
u.activeClips[g]?.loop || this.handleStoppedClip(t, n, g);
|
|
3902
3902
|
},
|
|
3903
3903
|
g
|
|
3904
3904
|
);
|
|
@@ -3908,48 +3908,48 @@ class Sa {
|
|
|
3908
3908
|
loop: a,
|
|
3909
3909
|
volume: o
|
|
3910
3910
|
};
|
|
3911
|
-
|
|
3911
|
+
u.player.once(
|
|
3912
3912
|
"play",
|
|
3913
3913
|
() => {
|
|
3914
|
-
const s =
|
|
3915
|
-
s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (
|
|
3914
|
+
const s = u.activeClips[g]?.state;
|
|
3915
|
+
s?.type === "pause_requested" ? this.pauseAudioClip(t, { fade: s.fade }, g, !0) : s?.type === "stop_requested" ? this.stopAudioClip(t, { fade: s.fade }, g, !0) : this.updateActiveAudioClip(t, g, (c) => ({ ...c, state: { type: "playing" } }));
|
|
3916
3916
|
},
|
|
3917
3917
|
g
|
|
3918
|
-
), ne(i) ? (
|
|
3918
|
+
), ne(i) ? (u.player.volume(0, g), u.player.mute(!1, g), u.player.once(
|
|
3919
3919
|
"play",
|
|
3920
3920
|
() => {
|
|
3921
|
-
oe(
|
|
3921
|
+
oe(u.player, o, i * 1e3, g);
|
|
3922
3922
|
},
|
|
3923
3923
|
g
|
|
3924
|
-
)) : Ce(
|
|
3925
|
-
}),
|
|
3924
|
+
)) : Ce(u.player, o, g), u.activeClips = { ...u.activeClips, [g]: r };
|
|
3925
|
+
}), u;
|
|
3926
3926
|
}), this.notifyClipStateListeners(n, t, "playing");
|
|
3927
3927
|
}
|
|
3928
3928
|
pauseAudioClip(t, { fade: n }, o, i) {
|
|
3929
3929
|
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
3930
|
-
Object.entries(a.activeClips).map(([
|
|
3931
|
-
const p = parseInt(
|
|
3930
|
+
Object.entries(a.activeClips).map(([u, l]) => {
|
|
3931
|
+
const p = parseInt(u);
|
|
3932
3932
|
return (o === void 0 || o === p) && (i && l.state.type === "pause_requested" || l.state.type === "playing" || l.state.type === "pausing" ? ne(n) ? (a.player.once(
|
|
3933
3933
|
"fade",
|
|
3934
3934
|
(h) => {
|
|
3935
3935
|
a.player.pause(h), this.updateActiveAudioClip(t, h, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
|
|
3936
3936
|
},
|
|
3937
3937
|
p
|
|
3938
|
-
), oe(a.player, 0, n * 1e3, p), l.state = { type: "pausing" }) : (a.player.pause(p), l.state = { type: "paused" }, this.notifyClipStateListeners(l.playId, t, "paused")) : (l.state.type === "play_requested" || l.state.type === "pause_requested") && (l.state = { type: "pause_requested", fade: n })), [
|
|
3938
|
+
), oe(a.player, 0, n * 1e3, p), l.state = { type: "pausing" }) : (a.player.pause(p), l.state = { type: "paused" }, this.notifyClipStateListeners(l.playId, t, "paused")) : (l.state.type === "play_requested" || l.state.type === "pause_requested") && (l.state = { type: "pause_requested", fade: n })), [u, l];
|
|
3939
3939
|
})
|
|
3940
3940
|
), a));
|
|
3941
3941
|
}
|
|
3942
3942
|
stopAudioClip(t, { fade: n }, o, i) {
|
|
3943
3943
|
la("Stop audio clip", { activeClips: this.audioClipPlayers[t]?.activeClips }), Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
3944
|
-
Object.entries(a.activeClips).map(([
|
|
3945
|
-
const p = parseInt(
|
|
3944
|
+
Object.entries(a.activeClips).map(([u, l]) => {
|
|
3945
|
+
const p = parseInt(u);
|
|
3946
3946
|
return (o === void 0 || o === p) && (i && l.state.type === "stop_requested" || l.state.type === "playing" || l.state.type === "pausing" || l.state.type === "paused" || l.state.type === "stopping" ? ne(n) && l.state.type !== "paused" ? (a.player.off("fade", p), oe(a.player, 0, n * 1e3, p), a.player.once(
|
|
3947
3947
|
"fade",
|
|
3948
3948
|
(h) => {
|
|
3949
3949
|
a.player.loop(!1, h), a.player.stop(h);
|
|
3950
3950
|
},
|
|
3951
3951
|
p
|
|
3952
|
-
), l.state = { type: "stopping" }) : (a.player.loop(!1, p), a.player.stop(p)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [
|
|
3952
|
+
), l.state = { type: "stopping" }) : (a.player.loop(!1, p), a.player.stop(p)) : (l.state.type === "play_requested" || l.state.type === "pause_requested" || l.state.type === "stop_requested") && (l.state = { type: "stop_requested", fade: n })), [u, l];
|
|
3953
3953
|
})
|
|
3954
3954
|
), a));
|
|
3955
3955
|
}
|
|
@@ -3964,12 +3964,12 @@ class Sa {
|
|
|
3964
3964
|
return;
|
|
3965
3965
|
}
|
|
3966
3966
|
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (i) => (i.activeClips = Object.fromEntries(
|
|
3967
|
-
Object.entries(i.activeClips).map(([a,
|
|
3968
|
-
if (
|
|
3967
|
+
Object.entries(i.activeClips).map(([a, u]) => {
|
|
3968
|
+
if (u.state.type !== "pausing" && u.state.type !== "stopping") {
|
|
3969
3969
|
const l = parseInt(a);
|
|
3970
|
-
return ne(o) ? oe(i.player, n, o * 1e3, l) : Ce(i.player, n, l), [a, { ...
|
|
3970
|
+
return ne(o) ? oe(i.player, n, o * 1e3, l) : Ce(i.player, n, l), [a, { ...u, volume: n }];
|
|
3971
3971
|
} else
|
|
3972
|
-
return [a,
|
|
3972
|
+
return [a, u];
|
|
3973
3973
|
})
|
|
3974
3974
|
), i));
|
|
3975
3975
|
}
|
|
@@ -4014,9 +4014,9 @@ class Sa {
|
|
|
4014
4014
|
}
|
|
4015
4015
|
notifyStateListeners() {
|
|
4016
4016
|
const t = Object.entries(this.audioClipPlayers).reduce(
|
|
4017
|
-
(i, [a,
|
|
4018
|
-
config: { preload:
|
|
4019
|
-
activeClips:
|
|
4017
|
+
(i, [a, u]) => (i[a] = {
|
|
4018
|
+
config: { preload: u.config.preload, ephemeral: u.config.ephemeral },
|
|
4019
|
+
activeClips: u.activeClips
|
|
4020
4020
|
}, i),
|
|
4021
4021
|
{}
|
|
4022
4022
|
), n = Object.values(this.audioClipPlayers).some(
|
|
@@ -4081,7 +4081,7 @@ function oe(e, t, n, o) {
|
|
|
4081
4081
|
e.fade(e.volume(o), t, n, o);
|
|
4082
4082
|
}
|
|
4083
4083
|
var Oe = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Oe || {});
|
|
4084
|
-
class
|
|
4084
|
+
class Sa {
|
|
4085
4085
|
constructor(t, n = document.body) {
|
|
4086
4086
|
this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
|
|
4087
4087
|
t.sendMediaClipState(i);
|
|
@@ -4117,8 +4117,8 @@ class Aa {
|
|
|
4117
4117
|
}
|
|
4118
4118
|
});
|
|
4119
4119
|
const o = () => {
|
|
4120
|
-
const i = Object.entries(this.videoClipPlayers).map(([a,
|
|
4121
|
-
const l =
|
|
4120
|
+
const i = Object.entries(this.videoClipPlayers).map(([a, u]) => {
|
|
4121
|
+
const l = u.videoElement.paused ? u.videoElement.currentTime === 0 || u.videoElement.currentTime === u.videoElement.duration ? "paused" : "stopped" : "playing";
|
|
4122
4122
|
return [a, l];
|
|
4123
4123
|
});
|
|
4124
4124
|
t.sendInitialMediaClipStates({ mediaType: "video", files: i });
|
|
@@ -4146,7 +4146,7 @@ class Aa {
|
|
|
4146
4146
|
}), this.globalVolume = t, this.notifyStateListeners();
|
|
4147
4147
|
}
|
|
4148
4148
|
playVideoClip(t, { playId: n, volume: o, loop: i, fit: a }) {
|
|
4149
|
-
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (
|
|
4149
|
+
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (u) => (u.videoElement.load(), u)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (u) => (u.volume = o, de(u.videoElement, o * this.globalVolume), u.videoElement.loop = i, u.videoElement.style.objectFit = a, u.videoElement.currentTime === u.videoElement.duration && (u.videoElement.currentTime = 0), u.videoElement.play(), this.activeClip || (u.videoElement.style.display = "block"), u));
|
|
4150
4150
|
}
|
|
4151
4151
|
pauseVideoClip() {
|
|
4152
4152
|
if (this.pendingClip && (this.pendingClip.actionOncePlaying = "pause"), this.activeClip) {
|
|
@@ -4282,52 +4282,53 @@ function de(e, t) {
|
|
|
4282
4282
|
e.volume = t, e.muted = t === 0;
|
|
4283
4283
|
}
|
|
4284
4284
|
function Ue(e, t) {
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4285
|
+
if (!e.keyframes.filter((o) => o[1] === null).some((o) => o[0] <= t))
|
|
4286
|
+
switch (e.type) {
|
|
4287
|
+
case "image": {
|
|
4288
|
+
if (e.keyframes[0][0] > t)
|
|
4289
|
+
return;
|
|
4290
|
+
const i = e.keyframes.filter((u) => u[1] !== null), a = Ae(i, t);
|
|
4291
|
+
return { ...Ht, ...a };
|
|
4292
|
+
}
|
|
4293
|
+
case "audio": {
|
|
4294
|
+
const o = e.keyframes.filter((u) => u[1] !== null), i = bt(o, t);
|
|
4295
|
+
if (!i)
|
|
4296
|
+
return;
|
|
4297
|
+
const a = Ae(o, t);
|
|
4298
|
+
return { ...De, ...a, ...i };
|
|
4299
|
+
}
|
|
4300
|
+
case "video": {
|
|
4301
|
+
const o = e.keyframes.filter((u) => u[1] !== null), i = bt(o, t);
|
|
4302
|
+
if (!i)
|
|
4303
|
+
return;
|
|
4304
|
+
const a = Ae(o, t);
|
|
4305
|
+
return { ...Jt, ...a, ...i };
|
|
4306
|
+
}
|
|
4305
4307
|
}
|
|
4306
|
-
}
|
|
4307
4308
|
}
|
|
4308
|
-
function
|
|
4309
|
+
function Ae(e, t) {
|
|
4309
4310
|
const n = {};
|
|
4310
4311
|
for (const [i, a] of e)
|
|
4311
|
-
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([
|
|
4312
|
-
n[
|
|
4313
|
-
}), Object.entries(a.set ?? {}).forEach(([
|
|
4314
|
-
n[
|
|
4315
|
-
})) : Object.entries(a.lerp ?? {}).forEach(([
|
|
4316
|
-
n[
|
|
4312
|
+
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([u, l]) => {
|
|
4313
|
+
n[u] ??= {}, n[u].before = [i, l];
|
|
4314
|
+
}), Object.entries(a.set ?? {}).forEach(([u, l]) => {
|
|
4315
|
+
n[u] ??= {}, n[u].before = [i, l];
|
|
4316
|
+
})) : Object.entries(a.lerp ?? {}).forEach(([u, l]) => {
|
|
4317
|
+
n[u] ??= {}, n[u].after === void 0 && (n[u].after = [i, l]);
|
|
4317
4318
|
});
|
|
4318
4319
|
const o = {};
|
|
4319
4320
|
return Object.entries(n).forEach(
|
|
4320
|
-
([i, { before: a, after:
|
|
4321
|
-
if (
|
|
4321
|
+
([i, { before: a, after: u }]) => {
|
|
4322
|
+
if (u === void 0 && a) {
|
|
4322
4323
|
o[i] = a[1];
|
|
4323
4324
|
return;
|
|
4324
4325
|
}
|
|
4325
|
-
if (a &&
|
|
4326
|
-
o[i] =
|
|
4326
|
+
if (a && u && a[0] === u[0]) {
|
|
4327
|
+
o[i] = u[1];
|
|
4327
4328
|
return;
|
|
4328
4329
|
}
|
|
4329
|
-
if (a && typeof a[1] == "number" &&
|
|
4330
|
-
o[i] = a[1] + (t - a[0]) * (
|
|
4330
|
+
if (a && typeof a[1] == "number" && u && typeof u[1] == "number") {
|
|
4331
|
+
o[i] = a[1] + (t - a[0]) * (u[1] - a[1]) / (u[0] - a[0]);
|
|
4331
4332
|
return;
|
|
4332
4333
|
}
|
|
4333
4334
|
}
|
|
@@ -4359,15 +4360,15 @@ function bt(e, t) {
|
|
|
4359
4360
|
};
|
|
4360
4361
|
}
|
|
4361
4362
|
class Me {
|
|
4362
|
-
constructor(t, n, o, i, a) {
|
|
4363
|
-
this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this.
|
|
4363
|
+
constructor(t, n, o, i, a, u) {
|
|
4364
|
+
this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this.getAudioOutput = a, this.mediaPreloader = u, this._state = o, setTimeout(this.loop);
|
|
4364
4365
|
}
|
|
4365
4366
|
isConnected(t) {
|
|
4366
4367
|
return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
|
|
4367
4368
|
}
|
|
4368
4369
|
_state;
|
|
4369
4370
|
setState(t) {
|
|
4370
|
-
this._state = t
|
|
4371
|
+
this._state = t;
|
|
4371
4372
|
}
|
|
4372
4373
|
timeout;
|
|
4373
4374
|
loop = async () => {
|
|
@@ -4376,22 +4377,19 @@ class Me {
|
|
|
4376
4377
|
}
|
|
4377
4378
|
function Fe(e, t, n, o, i) {
|
|
4378
4379
|
let a;
|
|
4380
|
+
const u = o(n.file);
|
|
4379
4381
|
switch (n.type) {
|
|
4380
4382
|
case "image":
|
|
4381
|
-
|
|
4382
|
-
a = e instanceof HTMLImageElement ? e : document.createElement("img");
|
|
4383
|
-
const c = o(n.file);
|
|
4384
|
-
a.src.includes(c) || (a.src = c);
|
|
4385
|
-
}
|
|
4383
|
+
a = e instanceof HTMLImageElement ? e : document.createElement("img"), a.src.includes(u) || (a.src = u);
|
|
4386
4384
|
break;
|
|
4387
4385
|
case "audio":
|
|
4388
|
-
|
|
4386
|
+
e instanceof HTMLAudioElement && e.src.includes(u) ? a = e : a = i.getElement(n.file, n.type);
|
|
4389
4387
|
break;
|
|
4390
4388
|
case "video":
|
|
4391
|
-
|
|
4389
|
+
e instanceof HTMLVideoElement && e.src.includes(u) ? a = e : a = i.getElement(n.file, n.type);
|
|
4392
4390
|
break;
|
|
4393
4391
|
}
|
|
4394
|
-
return t.replaceChildren(a), a.style.position = "absolute", a.style.width = "100%", a.style.height = "100%", a;
|
|
4392
|
+
return (t.children.length !== 1 || t.childNodes[0] !== a) && t.replaceChildren(a), a.style.position = "absolute", a.style.width = "100%", a.style.height = "100%", a;
|
|
4395
4393
|
}
|
|
4396
4394
|
function Qt(e, t, n) {
|
|
4397
4395
|
const o = String(t.opacity);
|
|
@@ -4400,8 +4398,12 @@ function Qt(e, t, n) {
|
|
|
4400
4398
|
parseInt(e.style.zIndex) !== i && (e.style.zIndex = String(i)), e.style.objectFit !== n && (e.style.objectFit = n);
|
|
4401
4399
|
}
|
|
4402
4400
|
function Yt(e, t, n) {
|
|
4403
|
-
e.volume !== t.volume && (e.volume = t.volume), e.sinkId !== n
|
|
4404
|
-
|
|
4401
|
+
if (e.volume !== t.volume && (e.volume = t.volume), e.sinkId !== n)
|
|
4402
|
+
try {
|
|
4403
|
+
e.setSinkId(n).catch(() => {
|
|
4404
|
+
});
|
|
4405
|
+
} catch {
|
|
4406
|
+
}
|
|
4405
4407
|
}
|
|
4406
4408
|
const wt = 50, da = 5, Xt = 1e3, pa = 5, fa = 5, ha = 0.3, _a = 0.1;
|
|
4407
4409
|
function ma(e) {
|
|
@@ -4416,15 +4418,15 @@ function en(e, t, n, o) {
|
|
|
4416
4418
|
e.loop !== y && (e.loop = y);
|
|
4417
4419
|
}
|
|
4418
4420
|
}
|
|
4419
|
-
const a = e.currentTime * 1e3 - t.t,
|
|
4421
|
+
const a = e.currentTime * 1e3 - t.t, u = Math.abs(a);
|
|
4420
4422
|
switch (!0) {
|
|
4421
|
-
case (o.state === "idle" && t.rate > 0 &&
|
|
4423
|
+
case (o.state === "idle" && t.rate > 0 && u <= wt):
|
|
4422
4424
|
return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
|
|
4423
|
-
case (o.state === "idle" && t.rate > 0 &&
|
|
4425
|
+
case (o.state === "idle" && t.rate > 0 && u > wt && u <= Xt): {
|
|
4424
4426
|
const l = ma(a), p = Math.max(0, t.rate - l);
|
|
4425
4427
|
return e.playbackRate !== p && (e.playbackRate = p), { state: "intercepting" };
|
|
4426
4428
|
}
|
|
4427
|
-
case (o.state === "intercepting" && t.rate > 0 &&
|
|
4429
|
+
case (o.state === "intercepting" && t.rate > 0 && u <= da):
|
|
4428
4430
|
return e.playbackRate !== t.rate && (e.playbackRate = t.rate), { state: "idle" };
|
|
4429
4431
|
case (o.state === "intercepting" && Math.sign(a) === Math.sign(e.playbackRate - t.rate)):
|
|
4430
4432
|
return console.warn(a, "missed intercept"), { state: "idle" };
|
|
@@ -4464,15 +4466,16 @@ class ga extends Me {
|
|
|
4464
4466
|
this.constructAssetURL,
|
|
4465
4467
|
this.mediaPreloader
|
|
4466
4468
|
) : this.destroy(), !t || !this.audioElement) return;
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4469
|
+
const n = this.getAudioOutput(this._state.audioOutput);
|
|
4470
|
+
Yt(this.audioElement, t, n);
|
|
4471
|
+
const o = en(this.audioElement, t, this._state.keyframes, this.syncState);
|
|
4472
|
+
this.syncState.state !== "seeking" && o.state === "seeking" && this.audioElement.addEventListener(
|
|
4470
4473
|
"seeked",
|
|
4471
4474
|
() => {
|
|
4472
4475
|
this.syncState = { state: "idle" };
|
|
4473
4476
|
},
|
|
4474
4477
|
{ passive: !0, once: !0 }
|
|
4475
|
-
), this.syncState =
|
|
4478
|
+
), this.syncState = o;
|
|
4476
4479
|
}
|
|
4477
4480
|
destroy() {
|
|
4478
4481
|
this.audioElement?.remove(), this.audioElement = void 0;
|
|
@@ -4490,15 +4493,16 @@ class ya extends Me {
|
|
|
4490
4493
|
this.constructAssetURL,
|
|
4491
4494
|
this.mediaPreloader
|
|
4492
4495
|
) : this.destroy(), !t || !this.videoElement) return;
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
+
const n = this.getAudioOutput(this._state.audioOutput);
|
|
4497
|
+
Qt(this.videoElement, t, this._state.fit), Yt(this.videoElement, t, n);
|
|
4498
|
+
const o = en(this.videoElement, t, this._state.keyframes, this.syncState);
|
|
4499
|
+
this.syncState.state !== "seeking" && o.state === "seeking" && this.videoElement.addEventListener(
|
|
4496
4500
|
"seeked",
|
|
4497
4501
|
() => {
|
|
4498
4502
|
this.syncState = { state: "idle" };
|
|
4499
4503
|
},
|
|
4500
4504
|
{ passive: !0, once: !0 }
|
|
4501
|
-
), this.syncState =
|
|
4505
|
+
), this.syncState = o;
|
|
4502
4506
|
}
|
|
4503
4507
|
destroy() {
|
|
4504
4508
|
this.videoElement?.remove(), this.videoElement = void 0;
|
|
@@ -4518,8 +4522,16 @@ class ba {
|
|
|
4518
4522
|
this._state = t, this.update();
|
|
4519
4523
|
}
|
|
4520
4524
|
update() {
|
|
4521
|
-
for (const [t, n] of Object.entries(this._elements))
|
|
4522
|
-
t in this._state
|
|
4525
|
+
for (const [t, n] of Object.entries(this._elements)) {
|
|
4526
|
+
if (!(t in this._state)) {
|
|
4527
|
+
if (n.inUse) {
|
|
4528
|
+
console.warn(`Failed to clean up element ${n.element.src}`);
|
|
4529
|
+
continue;
|
|
4530
|
+
}
|
|
4531
|
+
n.element.src = "", n.element.load(), delete this._elements[t];
|
|
4532
|
+
}
|
|
4533
|
+
n.inUse = n.element.isConnected;
|
|
4534
|
+
}
|
|
4523
4535
|
for (const [t, n] of Object.entries(this._state)) {
|
|
4524
4536
|
if (t in this._elements)
|
|
4525
4537
|
continue;
|
|
@@ -4544,7 +4556,7 @@ class ba {
|
|
|
4544
4556
|
return o.inUse = !0, o.element;
|
|
4545
4557
|
{
|
|
4546
4558
|
const i = document.createElement(n);
|
|
4547
|
-
return i.src = this._constructAssetURL(t), this._elements[t] = { element: i, type: n, inUse: !0 }, i;
|
|
4559
|
+
return i.src = this._constructAssetURL(t), n === "video" && (this._elements[t] = { element: i, type: n, inUse: !0 }), i;
|
|
4548
4560
|
}
|
|
4549
4561
|
}
|
|
4550
4562
|
releaseElement(t) {
|
|
@@ -4559,8 +4571,8 @@ class ba {
|
|
|
4559
4571
|
}
|
|
4560
4572
|
const wa = "data-clip-id";
|
|
4561
4573
|
class Ta {
|
|
4562
|
-
constructor(t, n, o = new ba(t)) {
|
|
4563
|
-
this.constructAssetUrl = t, this.mediaPreloader =
|
|
4574
|
+
constructor(t, n, o, i = new ba(t)) {
|
|
4575
|
+
this.constructAssetUrl = t, this.getAudioOutput = n, this.mediaPreloader = i, this._element = document.createElement("div"), this._element.className = "surface-manager", this._element.style.width = "100%", this._element.style.height = "100%", this._state = o || {}, this.update();
|
|
4564
4576
|
}
|
|
4565
4577
|
_state = {};
|
|
4566
4578
|
setState(t) {
|
|
@@ -4593,13 +4605,34 @@ class Ta {
|
|
|
4593
4605
|
else
|
|
4594
4606
|
switch (o.type) {
|
|
4595
4607
|
case "image":
|
|
4596
|
-
i.manager = new va(
|
|
4608
|
+
i.manager = new va(
|
|
4609
|
+
this._element,
|
|
4610
|
+
i.element,
|
|
4611
|
+
o,
|
|
4612
|
+
this.constructAssetUrl,
|
|
4613
|
+
this.getAudioOutput,
|
|
4614
|
+
this.mediaPreloader
|
|
4615
|
+
);
|
|
4597
4616
|
break;
|
|
4598
4617
|
case "audio":
|
|
4599
|
-
i.manager = new ga(
|
|
4618
|
+
i.manager = new ga(
|
|
4619
|
+
this._element,
|
|
4620
|
+
i.element,
|
|
4621
|
+
o,
|
|
4622
|
+
this.constructAssetUrl,
|
|
4623
|
+
this.getAudioOutput,
|
|
4624
|
+
this.mediaPreloader
|
|
4625
|
+
);
|
|
4600
4626
|
break;
|
|
4601
4627
|
case "video":
|
|
4602
|
-
i.manager = new ya(
|
|
4628
|
+
i.manager = new ya(
|
|
4629
|
+
this._element,
|
|
4630
|
+
i.element,
|
|
4631
|
+
o,
|
|
4632
|
+
this.constructAssetUrl,
|
|
4633
|
+
this.getAudioOutput,
|
|
4634
|
+
this.mediaPreloader
|
|
4635
|
+
);
|
|
4603
4636
|
break;
|
|
4604
4637
|
}
|
|
4605
4638
|
});
|
|
@@ -4609,8 +4642,8 @@ const za = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4609
4642
|
__proto__: null
|
|
4610
4643
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4611
4644
|
export {
|
|
4612
|
-
|
|
4613
|
-
|
|
4645
|
+
Aa as CogsAudioPlayer,
|
|
4646
|
+
An as CogsConfigChangedEvent,
|
|
4614
4647
|
Ea as CogsConnection,
|
|
4615
4648
|
En as CogsConnectionCloseEvent,
|
|
4616
4649
|
kn as CogsConnectionOpenEvent,
|
|
@@ -4618,8 +4651,8 @@ export {
|
|
|
4618
4651
|
zn as CogsMediaConfigChangedEvent,
|
|
4619
4652
|
Cn as CogsMessageEvent,
|
|
4620
4653
|
In as CogsShowPhaseChangedEvent,
|
|
4621
|
-
|
|
4622
|
-
|
|
4654
|
+
Sn as CogsStateChangedEvent,
|
|
4655
|
+
Sa as CogsVideoPlayer,
|
|
4623
4656
|
We as DataStoreItemEvent,
|
|
4624
4657
|
qe as DataStoreItemsEvent,
|
|
4625
4658
|
za as ManifestTypes,
|