@clockworkdog/cogs-client 3.0.0-alpha.7 → 3.0.0-alpha.9
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 +1157 -1195
- package/dist/browser/index.umd.js +5 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/state-based/AudioManager.d.ts +1 -1
- package/dist/state-based/AudioManager.js +12 -9
- package/dist/state-based/ClipManager.d.ts +1 -2
- package/dist/state-based/ClipManager.js +2 -6
- package/dist/state-based/ImageManager.d.ts +1 -1
- package/dist/state-based/ImageManager.js +9 -10
- package/dist/state-based/SurfaceManager.d.ts +1 -2
- package/dist/state-based/SurfaceManager.js +4 -7
- package/dist/state-based/VideoManager.d.ts +1 -3
- package/dist/state-based/VideoManager.js +29 -113
- package/dist/types/MediaSchema.d.ts +13 -13
- package/dist/types/MediaSchema.js +1 -1
- package/package.json +2 -2
package/dist/browser/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ct = /* @__PURE__ */ ((e) => (e.Setup = "setup", e.Preshow = "pre-show", e.InProgress = "in progress", e.Finished = "finished", e))(Ct || {});
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -13,21 +13,21 @@ 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 Ie = function(e, t) {
|
|
17
|
+
return Ie = 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
|
+
}, Ie(e, t);
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function St(e, t) {
|
|
24
|
+
Ie(e, t);
|
|
25
25
|
function n() {
|
|
26
26
|
this.constructor = e;
|
|
27
27
|
}
|
|
28
28
|
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function tn(e) {
|
|
31
31
|
var t = typeof Symbol == "function" && e[Symbol.iterator], n = 0;
|
|
32
32
|
return t ? t.call(e) : {
|
|
33
33
|
next: function() {
|
|
@@ -35,7 +35,7 @@ function nn(e) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function nn(e, t) {
|
|
39
39
|
var n = typeof Symbol == "function" && e[Symbol.iterator];
|
|
40
40
|
if (!n) return e;
|
|
41
41
|
var o = n.call(e), i, a = [], c;
|
|
@@ -52,12 +52,12 @@ function on(e, t) {
|
|
|
52
52
|
}
|
|
53
53
|
return a;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function on() {
|
|
56
56
|
for (var e = [], t = 0; t < arguments.length; t++)
|
|
57
|
-
e = e.concat(
|
|
57
|
+
e = e.concat(nn(arguments[t]));
|
|
58
58
|
return e;
|
|
59
59
|
}
|
|
60
|
-
var
|
|
60
|
+
var At = (
|
|
61
61
|
/** @class */
|
|
62
62
|
/* @__PURE__ */ function() {
|
|
63
63
|
function e(t, n) {
|
|
@@ -65,27 +65,27 @@ var St = (
|
|
|
65
65
|
}
|
|
66
66
|
return e;
|
|
67
67
|
}()
|
|
68
|
-
),
|
|
68
|
+
), rn = (
|
|
69
69
|
/** @class */
|
|
70
70
|
function(e) {
|
|
71
|
-
|
|
71
|
+
St(t, e);
|
|
72
72
|
function t(n, o) {
|
|
73
73
|
var i = e.call(this, "error", o) || this;
|
|
74
74
|
return i.message = n.message, i.error = n, i;
|
|
75
75
|
}
|
|
76
76
|
return t;
|
|
77
|
-
}(
|
|
78
|
-
),
|
|
77
|
+
}(At)
|
|
78
|
+
), sn = (
|
|
79
79
|
/** @class */
|
|
80
80
|
function(e) {
|
|
81
|
-
|
|
81
|
+
St(t, e);
|
|
82
82
|
function t(n, o, i) {
|
|
83
83
|
n === void 0 && (n = 1e3), o === void 0 && (o = "");
|
|
84
84
|
var a = e.call(this, "close", i) || this;
|
|
85
85
|
return a.wasClean = !0, a.code = n, a.reason = o, a;
|
|
86
86
|
}
|
|
87
87
|
return t;
|
|
88
|
-
}(
|
|
88
|
+
}(At)
|
|
89
89
|
);
|
|
90
90
|
/*!
|
|
91
91
|
* Reconnecting WebSocket
|
|
@@ -93,10 +93,10 @@ var St = (
|
|
|
93
93
|
* https://github.com/pladaria/reconnecting-websocket
|
|
94
94
|
* License MIT
|
|
95
95
|
*/
|
|
96
|
-
var
|
|
96
|
+
var an = function() {
|
|
97
97
|
if (typeof WebSocket < "u")
|
|
98
98
|
return WebSocket;
|
|
99
|
-
},
|
|
99
|
+
}, un = function(e) {
|
|
100
100
|
return typeof e < "u" && !!e && e.CLOSING === 2;
|
|
101
101
|
}, F = {
|
|
102
102
|
maxReconnectionDelay: 1e4,
|
|
@@ -106,7 +106,7 @@ var un = function() {
|
|
|
106
106
|
connectionTimeout: 4e3,
|
|
107
107
|
maxRetries: 1 / 0,
|
|
108
108
|
maxEnqueuedMessages: 1 / 0
|
|
109
|
-
},
|
|
109
|
+
}, cn = (
|
|
110
110
|
/** @class */
|
|
111
111
|
function() {
|
|
112
112
|
function e(t, n, o) {
|
|
@@ -121,10 +121,10 @@ var un = function() {
|
|
|
121
121
|
var c = i._options.minUptime, l = c === void 0 ? F.minUptime : c;
|
|
122
122
|
clearTimeout(i._connectTimeout), i._uptimeTimeout = setTimeout(function() {
|
|
123
123
|
return i._acceptOpen();
|
|
124
|
-
}, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(
|
|
125
|
-
return i._ws.send(
|
|
126
|
-
}), i._messageQueue = [], i.onopen && i.onopen(a), i._listeners.open.forEach(function(
|
|
127
|
-
return i._callEventListener(a,
|
|
124
|
+
}, l), i._ws.binaryType = i._binaryType, i._messageQueue.forEach(function(p) {
|
|
125
|
+
return i._ws.send(p);
|
|
126
|
+
}), i._messageQueue = [], i.onopen && i.onopen(a), i._listeners.open.forEach(function(p) {
|
|
127
|
+
return i._callEventListener(a, p);
|
|
128
128
|
});
|
|
129
129
|
}, this._handleMessage = function(a) {
|
|
130
130
|
i._debug("message event"), i.onmessage && i.onmessage(a), i._listeners.message.forEach(function(c) {
|
|
@@ -285,12 +285,12 @@ var un = function() {
|
|
|
285
285
|
var n, o, i = this._listeners[t.type];
|
|
286
286
|
if (i)
|
|
287
287
|
try {
|
|
288
|
-
for (var a =
|
|
288
|
+
for (var a = tn(i), c = a.next(); !c.done; c = a.next()) {
|
|
289
289
|
var l = c.value;
|
|
290
290
|
this._callEventListener(t, l);
|
|
291
291
|
}
|
|
292
|
-
} catch (
|
|
293
|
-
n = { error:
|
|
292
|
+
} catch (p) {
|
|
293
|
+
n = { error: p };
|
|
294
294
|
} finally {
|
|
295
295
|
try {
|
|
296
296
|
c && !c.done && (o = a.return) && o.call(a);
|
|
@@ -306,10 +306,10 @@ var un = function() {
|
|
|
306
306
|
}, e.prototype._debug = function() {
|
|
307
307
|
for (var t = [], n = 0; n < arguments.length; n++)
|
|
308
308
|
t[n] = arguments[n];
|
|
309
|
-
this._options.debug && console.log.apply(console,
|
|
309
|
+
this._options.debug && console.log.apply(console, on(["RWS>"], t));
|
|
310
310
|
}, e.prototype._getNextDelay = function() {
|
|
311
|
-
var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? F.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? F.minReconnectionDelay : i, c = t.maxReconnectionDelay, l = c === void 0 ? F.maxReconnectionDelay : c,
|
|
312
|
-
return this._retryCount > 0 && (
|
|
311
|
+
var t = this._options, n = t.reconnectionDelayGrowFactor, o = n === void 0 ? F.reconnectionDelayGrowFactor : n, i = t.minReconnectionDelay, a = i === void 0 ? F.minReconnectionDelay : i, c = t.maxReconnectionDelay, l = c === void 0 ? F.maxReconnectionDelay : c, p = 0;
|
|
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;
|
|
315
315
|
return new Promise(function(n) {
|
|
@@ -330,28 +330,28 @@ var un = 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 ? F.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? F.connectionTimeout : a, l = n.WebSocket,
|
|
333
|
+
var n = this._options, o = n.maxRetries, i = o === void 0 ? F.maxRetries : o, a = n.connectionTimeout, c = a === void 0 ? F.connectionTimeout : a, l = n.WebSocket, p = l === void 0 ? an() : l;
|
|
334
334
|
if (this._retryCount >= i) {
|
|
335
335
|
this._debug("max retries reached", this._retryCount, ">=", i);
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
|
-
if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !
|
|
338
|
+
if (this._retryCount++, this._debug("connect", this._retryCount), this._removeListeners(), !un(p))
|
|
339
339
|
throw Error("No valid WebSocket class provided");
|
|
340
340
|
this._wait().then(function() {
|
|
341
341
|
return t._getNextUrl(t._url);
|
|
342
342
|
}).then(function(f) {
|
|
343
|
-
t._closeCalled || (t._debug("connect", { url: f, protocols: t._protocols }), t._ws = t._protocols ? new
|
|
343
|
+
t._closeCalled || (t._debug("connect", { url: f, protocols: t._protocols }), t._ws = t._protocols ? new p(f, t._protocols) : new p(f), t._ws.binaryType = t._binaryType, t._connectLock = !1, t._addListeners(), t._connectTimeout = setTimeout(function() {
|
|
344
344
|
return t._handleTimeout();
|
|
345
345
|
}, c));
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
348
|
}, e.prototype._handleTimeout = function() {
|
|
349
|
-
this._debug("timeout event"), this._handleError(new
|
|
349
|
+
this._debug("timeout event"), this._handleError(new rn(Error("TIMEOUT"), this));
|
|
350
350
|
}, e.prototype._disconnect = function(t, n) {
|
|
351
351
|
if (t === void 0 && (t = 1e3), this._clearTimeouts(), !!this._ws) {
|
|
352
352
|
this._removeListeners();
|
|
353
353
|
try {
|
|
354
|
-
this._ws.close(t, n), this._handleClose(new
|
|
354
|
+
this._ws.close(t, n), this._handleClose(new sn(t, n, this));
|
|
355
355
|
} catch {
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -368,16 +368,16 @@ var un = function() {
|
|
|
368
368
|
}, e;
|
|
369
369
|
}()
|
|
370
370
|
);
|
|
371
|
-
const
|
|
372
|
-
function
|
|
371
|
+
const Tt = 12095;
|
|
372
|
+
function ln(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}:${Tt}${n}`;
|
|
375
375
|
}
|
|
376
|
-
async function
|
|
376
|
+
async function za(e) {
|
|
377
377
|
const t = await fetch(e);
|
|
378
378
|
return URL.createObjectURL(new Blob([await t.arrayBuffer()]));
|
|
379
379
|
}
|
|
380
|
-
class
|
|
380
|
+
class dn {
|
|
381
381
|
_items;
|
|
382
382
|
#e = new EventTarget();
|
|
383
383
|
constructor(t) {
|
|
@@ -385,8 +385,8 @@ class pn {
|
|
|
385
385
|
}
|
|
386
386
|
handleDataStoreItemsMessage(t) {
|
|
387
387
|
this._items = { ...this._items, ...t.items }, Object.entries(t.items).forEach(([n, o]) => {
|
|
388
|
-
this.dispatchEvent(new
|
|
389
|
-
}), this.dispatchEvent(new
|
|
388
|
+
this.dispatchEvent(new qe(n, o));
|
|
389
|
+
}), this.dispatchEvent(new Ke(t.items));
|
|
390
390
|
}
|
|
391
391
|
get items() {
|
|
392
392
|
return this._items;
|
|
@@ -396,8 +396,8 @@ class pn {
|
|
|
396
396
|
}
|
|
397
397
|
setItems(t) {
|
|
398
398
|
return this._items = { ...this._items, ...t }, Object.entries(t).forEach(([n, o]) => {
|
|
399
|
-
this.dispatchEvent(new
|
|
400
|
-
}), this.dispatchEvent(new
|
|
399
|
+
this.dispatchEvent(new qe(n, o));
|
|
400
|
+
}), this.dispatchEvent(new Ke(t)), this;
|
|
401
401
|
}
|
|
402
402
|
// Type-safe listeners
|
|
403
403
|
addEventListener(t, n, o) {
|
|
@@ -410,20 +410,20 @@ class pn {
|
|
|
410
410
|
this.#e.dispatchEvent(t);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
class
|
|
413
|
+
class qe extends Event {
|
|
414
414
|
constructor(t, n) {
|
|
415
415
|
super("item"), this.key = t, this.value = n;
|
|
416
416
|
}
|
|
417
417
|
_cogsConnectionEventType = "item";
|
|
418
418
|
}
|
|
419
|
-
class
|
|
419
|
+
class Ke extends Event {
|
|
420
420
|
constructor(t) {
|
|
421
421
|
super("items"), this.items = t;
|
|
422
422
|
}
|
|
423
423
|
_cogsConnectionEventType = "item";
|
|
424
424
|
}
|
|
425
425
|
const te = globalThis.Date;
|
|
426
|
-
function
|
|
426
|
+
function pn(e) {
|
|
427
427
|
const t = e - te.now();
|
|
428
428
|
function n(...i) {
|
|
429
429
|
return i.length === 0 ? new te(n.now()) : new te(...i);
|
|
@@ -433,25 +433,25 @@ function hn(e) {
|
|
|
433
433
|
return te.now() + t;
|
|
434
434
|
}, globalThis.Date = n;
|
|
435
435
|
}
|
|
436
|
-
let
|
|
437
|
-
function
|
|
438
|
-
return ++
|
|
436
|
+
let hn = 0;
|
|
437
|
+
function fn() {
|
|
438
|
+
return ++hn;
|
|
439
439
|
}
|
|
440
|
-
const
|
|
441
|
-
function
|
|
440
|
+
const _n = 5, mn = 1e4;
|
|
441
|
+
function vn({ interval: e, send: t, onChange: n = pn, syncSampleSize: o = _n, syncRequestTimeout: i = mn }) {
|
|
442
442
|
const a = {};
|
|
443
443
|
async function c() {
|
|
444
444
|
const y = [];
|
|
445
445
|
for (let s = 0; s < o; s++) {
|
|
446
|
-
const u = new Promise((
|
|
447
|
-
const h =
|
|
446
|
+
const u = new Promise((d) => {
|
|
447
|
+
const h = fn(), v = Date.now(), _ = performance.now();
|
|
448
448
|
t({ timesync: { id: h } });
|
|
449
|
-
const w = (E, k) =>
|
|
450
|
-
a[h] = { complete: w }, setTimeout(() =>
|
|
449
|
+
const w = (E, k) => d({ sentAt: _, receivedAt: E, serverNow: k, clientNow: v });
|
|
450
|
+
a[h] = { complete: w }, setTimeout(() => d(null), i);
|
|
451
451
|
});
|
|
452
452
|
y.push(u), await u;
|
|
453
453
|
}
|
|
454
|
-
const g = (await Promise.all(y)).filter((s) => s !== null), r =
|
|
454
|
+
const g = (await Promise.all(y)).filter((s) => s !== null), r = gn(g);
|
|
455
455
|
isNaN(r) || n(Date.now() + r);
|
|
456
456
|
}
|
|
457
457
|
const l = (y) => {
|
|
@@ -459,30 +459,30 @@ function gn({ interval: e, send: t, onChange: n = hn, syncSampleSize: o = mn, sy
|
|
|
459
459
|
r && r.complete(g, y.timesync.now);
|
|
460
460
|
};
|
|
461
461
|
c();
|
|
462
|
-
const
|
|
462
|
+
const p = setInterval(c, e);
|
|
463
463
|
return {
|
|
464
464
|
receive: l,
|
|
465
465
|
destroy: () => {
|
|
466
|
-
clearInterval(
|
|
466
|
+
clearInterval(p);
|
|
467
467
|
}
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function gn(e) {
|
|
471
471
|
return e.map(({ sentAt: t, receivedAt: n, clientNow: o, serverNow: i }) => {
|
|
472
472
|
const a = (n - t) / 2;
|
|
473
473
|
return i - o - a;
|
|
474
474
|
}).reduce((t, n) => t + n, 0) / e.length;
|
|
475
475
|
}
|
|
476
|
-
class
|
|
477
|
-
constructor(t, { hostname: n = document.location.hostname, port: o =
|
|
478
|
-
this.manifest = t, this.currentState = { ...i }, this.store = new
|
|
479
|
-
const { useReconnectingWebsocket: c, path: l, pathParams:
|
|
480
|
-
this.urlParams = new URLSearchParams(
|
|
476
|
+
class Ia {
|
|
477
|
+
constructor(t, { hostname: n = document.location.hostname, port: o = Tt } = {}, i, a) {
|
|
478
|
+
this.manifest = t, this.currentState = { ...i }, this.store = new dn(a ?? {});
|
|
479
|
+
const { useReconnectingWebsocket: c, path: l, pathParams: p } = yn(document.location.href);
|
|
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 f = `ws://${n}:${o}${l}?${this.urlParams}`;
|
|
482
|
-
this.websocket = c ? new
|
|
482
|
+
this.websocket = c ? new cn(f) : new WebSocket(f);
|
|
483
483
|
let y;
|
|
484
484
|
this.websocket.onopen = () => {
|
|
485
|
-
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new
|
|
485
|
+
this.currentConfig = {}, this.currentState = {}, this.dispatchEvent(new bn()), this.setState(this.currentState), y = vn({
|
|
486
486
|
interval: 6e4,
|
|
487
487
|
send: (g) => {
|
|
488
488
|
this.websocket.send(JSON.stringify(g));
|
|
@@ -499,18 +499,18 @@ class za {
|
|
|
499
499
|
console.error(r);
|
|
500
500
|
}
|
|
501
501
|
}), this.websocket.onclose = () => {
|
|
502
|
-
y?.destroy(), this.dispatchEvent(new
|
|
502
|
+
y?.destroy(), this.dispatchEvent(new wn());
|
|
503
503
|
}, this.websocket.addEventListener("message", ({ data: g }) => {
|
|
504
504
|
try {
|
|
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 kn(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 Cn(r.updates));
|
|
511
511
|
else if (r.event && r.event.key)
|
|
512
512
|
this.dispatchEvent(
|
|
513
|
-
new
|
|
513
|
+
new Sn(r.event.key, r.event.value)
|
|
514
514
|
);
|
|
515
515
|
else if (typeof r.message == "object") {
|
|
516
516
|
const s = r.message;
|
|
@@ -523,19 +523,19 @@ class za {
|
|
|
523
523
|
};
|
|
524
524
|
break;
|
|
525
525
|
case "show_phase":
|
|
526
|
-
this._showPhase = s.phase, this.dispatchEvent(new
|
|
526
|
+
this._showPhase = s.phase, this.dispatchEvent(new Tn(s.phase));
|
|
527
527
|
break;
|
|
528
528
|
case "media_config_update":
|
|
529
529
|
this._mediaConfig = s;
|
|
530
530
|
for (const u of ["preferOptimizedAudio", "preferOptimizedVideo", "preferOptimizedImages"])
|
|
531
531
|
s[u] ? this.urlParams.set(u, "true") : this.urlParams.delete(u);
|
|
532
|
-
this.dispatchEvent(new
|
|
532
|
+
this.dispatchEvent(new An(s));
|
|
533
533
|
break;
|
|
534
534
|
case "data_store_items":
|
|
535
535
|
this.store.handleDataStoreItemsMessage(s);
|
|
536
536
|
break;
|
|
537
537
|
}
|
|
538
|
-
this.dispatchEvent(new
|
|
538
|
+
this.dispatchEvent(new En(s));
|
|
539
539
|
}
|
|
540
540
|
} catch (s) {
|
|
541
541
|
console.warn("Error handling data", g, s);
|
|
@@ -568,7 +568,7 @@ class za {
|
|
|
568
568
|
get state() {
|
|
569
569
|
return { ...this.currentState };
|
|
570
570
|
}
|
|
571
|
-
_showPhase =
|
|
571
|
+
_showPhase = Ct.Setup;
|
|
572
572
|
get showPhase() {
|
|
573
573
|
return this._showPhase;
|
|
574
574
|
}
|
|
@@ -584,7 +584,7 @@ class za {
|
|
|
584
584
|
* Return asset URLs using the information about the client and server support for HTTP/2
|
|
585
585
|
*/
|
|
586
586
|
getAssetUrl(t) {
|
|
587
|
-
return `${
|
|
587
|
+
return `${ln(t)}?${this.urlParams?.toString() ?? ""}`;
|
|
588
588
|
}
|
|
589
589
|
/**
|
|
590
590
|
* Cached audio outputs use to look up the device/sink ID when a different device label is requested
|
|
@@ -655,7 +655,7 @@ class za {
|
|
|
655
655
|
this.eventTarget.dispatchEvent(t);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function yn(e) {
|
|
659
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") ?? "", c = t.pathname.startsWith("/plugin/") ? decodeURIComponent(t.pathname.split("/")[2]) : void 0;
|
|
660
660
|
if (o) {
|
|
661
661
|
const l = n.get("t") ?? "";
|
|
@@ -691,49 +691,49 @@ function bn(e) {
|
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
class
|
|
694
|
+
class bn extends Event {
|
|
695
695
|
_cogsConnectionEventType = "open";
|
|
696
696
|
constructor() {
|
|
697
697
|
super("open");
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
class
|
|
700
|
+
class wn extends Event {
|
|
701
701
|
_cogsConnectionEventType = "close";
|
|
702
702
|
constructor() {
|
|
703
703
|
super("close");
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
class
|
|
706
|
+
class En extends Event {
|
|
707
707
|
constructor(t) {
|
|
708
708
|
super("message"), this.message = t;
|
|
709
709
|
}
|
|
710
710
|
_cogsConnectionEventType = "message";
|
|
711
711
|
}
|
|
712
|
-
class
|
|
712
|
+
class kn 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 Cn extends Event {
|
|
719
719
|
constructor(t) {
|
|
720
720
|
super("state"), this.state = t;
|
|
721
721
|
}
|
|
722
722
|
_cogsConnectionEventType = "state";
|
|
723
723
|
}
|
|
724
|
-
class
|
|
724
|
+
class Sn extends Event {
|
|
725
725
|
constructor(t, n) {
|
|
726
726
|
super("event"), this.name = t, this.value = n;
|
|
727
727
|
}
|
|
728
728
|
_cogsConnectionEventType = "event";
|
|
729
729
|
}
|
|
730
|
-
class
|
|
730
|
+
class An extends Event {
|
|
731
731
|
constructor(t) {
|
|
732
732
|
super("mediaConfig"), this.mediaConfig = t;
|
|
733
733
|
}
|
|
734
734
|
_cogsConnectionEventType = "mediaConfig";
|
|
735
735
|
}
|
|
736
|
-
class
|
|
736
|
+
class Tn extends Event {
|
|
737
737
|
constructor(t) {
|
|
738
738
|
super("showPhase"), this.showPhase = t;
|
|
739
739
|
}
|
|
@@ -741,17 +741,17 @@ class zn extends Event {
|
|
|
741
741
|
}
|
|
742
742
|
// @__NO_SIDE_EFFECTS__
|
|
743
743
|
function m(e, t, n) {
|
|
744
|
-
function o(l,
|
|
744
|
+
function o(l, p) {
|
|
745
745
|
if (l._zod || Object.defineProperty(l, "_zod", {
|
|
746
746
|
value: {
|
|
747
|
-
def:
|
|
747
|
+
def: p,
|
|
748
748
|
constr: c,
|
|
749
749
|
traits: /* @__PURE__ */ new Set()
|
|
750
750
|
},
|
|
751
751
|
enumerable: !1
|
|
752
752
|
}), l._zod.traits.has(e))
|
|
753
753
|
return;
|
|
754
|
-
l._zod.traits.add(e), t(l,
|
|
754
|
+
l._zod.traits.add(e), t(l, p);
|
|
755
755
|
const f = c.prototype, y = Object.keys(f);
|
|
756
756
|
for (let g = 0; g < y.length; g++) {
|
|
757
757
|
const r = y[g];
|
|
@@ -763,9 +763,9 @@ function m(e, t, n) {
|
|
|
763
763
|
}
|
|
764
764
|
Object.defineProperty(a, "name", { value: e });
|
|
765
765
|
function c(l) {
|
|
766
|
-
var
|
|
766
|
+
var p;
|
|
767
767
|
const f = n?.Parent ? new a() : this;
|
|
768
|
-
o(f, l), (
|
|
768
|
+
o(f, l), (p = f._zod).deferred ?? (p.deferred = []);
|
|
769
769
|
for (const y of f._zod.deferred)
|
|
770
770
|
y();
|
|
771
771
|
return f;
|
|
@@ -779,23 +779,23 @@ class K extends Error {
|
|
|
779
779
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
class
|
|
782
|
+
class zt extends Error {
|
|
783
783
|
constructor(t) {
|
|
784
784
|
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
const
|
|
788
|
-
function
|
|
789
|
-
return
|
|
787
|
+
const It = {};
|
|
788
|
+
function N(e) {
|
|
789
|
+
return It;
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function zn(e) {
|
|
792
792
|
const t = Object.values(e).filter((o) => typeof o == "number");
|
|
793
793
|
return Object.entries(e).filter(([o, i]) => t.indexOf(+o) === -1).map(([o, i]) => i);
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function Oe(e, t) {
|
|
796
796
|
return typeof t == "bigint" ? t.toString() : t;
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function xe(e) {
|
|
799
799
|
return {
|
|
800
800
|
get value() {
|
|
801
801
|
{
|
|
@@ -805,30 +805,30 @@ function Re(e) {
|
|
|
805
805
|
}
|
|
806
806
|
};
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function Le(e) {
|
|
809
809
|
return e == null;
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function Re(e) {
|
|
812
812
|
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
813
813
|
return e.slice(t, n);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function In(e, t) {
|
|
816
816
|
const n = (e.toString().split(".")[1] || "").length, o = t.toString();
|
|
817
817
|
let i = (o.split(".")[1] || "").length;
|
|
818
818
|
if (i === 0 && /\d?e-\d?/.test(o)) {
|
|
819
|
-
const
|
|
820
|
-
|
|
819
|
+
const p = o.match(/\d?e-(\d?)/);
|
|
820
|
+
p?.[1] && (i = Number.parseInt(p[1]));
|
|
821
821
|
}
|
|
822
822
|
const a = n > i ? n : i, c = Number.parseInt(e.toFixed(a).replace(".", "")), l = Number.parseInt(t.toFixed(a).replace(".", ""));
|
|
823
823
|
return c % l / 10 ** a;
|
|
824
824
|
}
|
|
825
|
-
const
|
|
825
|
+
const He = Symbol("evaluating");
|
|
826
826
|
function C(e, t, n) {
|
|
827
827
|
let o;
|
|
828
828
|
Object.defineProperty(e, t, {
|
|
829
829
|
get() {
|
|
830
|
-
if (o !==
|
|
831
|
-
return o === void 0 && (o =
|
|
830
|
+
if (o !== He)
|
|
831
|
+
return o === void 0 && (o = He, o = n()), o;
|
|
832
832
|
},
|
|
833
833
|
set(i) {
|
|
834
834
|
Object.defineProperty(e, t, {
|
|
@@ -855,7 +855,7 @@ function B(...e) {
|
|
|
855
855
|
}
|
|
856
856
|
return Object.defineProperties({}, t);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Je(e) {
|
|
859
859
|
return JSON.stringify(e);
|
|
860
860
|
}
|
|
861
861
|
function On(e) {
|
|
@@ -863,10 +863,10 @@ function On(e) {
|
|
|
863
863
|
}
|
|
864
864
|
const Ot = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
865
865
|
};
|
|
866
|
-
function
|
|
866
|
+
function pe(e) {
|
|
867
867
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
868
868
|
}
|
|
869
|
-
const
|
|
869
|
+
const $n = xe(() => {
|
|
870
870
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
871
871
|
return !1;
|
|
872
872
|
try {
|
|
@@ -877,18 +877,18 @@ const Zn = Re(() => {
|
|
|
877
877
|
}
|
|
878
878
|
});
|
|
879
879
|
function H(e) {
|
|
880
|
-
if (
|
|
880
|
+
if (pe(e) === !1)
|
|
881
881
|
return !1;
|
|
882
882
|
const t = e.constructor;
|
|
883
883
|
if (t === void 0 || typeof t != "function")
|
|
884
884
|
return !0;
|
|
885
885
|
const n = t.prototype;
|
|
886
|
-
return !(
|
|
886
|
+
return !(pe(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
887
887
|
}
|
|
888
|
-
function
|
|
888
|
+
function $t(e) {
|
|
889
889
|
return H(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
890
890
|
}
|
|
891
|
-
const
|
|
891
|
+
const Zn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
892
892
|
function J(e) {
|
|
893
893
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
894
894
|
}
|
|
@@ -909,17 +909,17 @@ function b(e) {
|
|
|
909
909
|
}
|
|
910
910
|
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
911
911
|
}
|
|
912
|
-
function
|
|
912
|
+
function Pn(e) {
|
|
913
913
|
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
914
914
|
}
|
|
915
|
-
const
|
|
915
|
+
const xn = {
|
|
916
916
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
917
917
|
int32: [-2147483648, 2147483647],
|
|
918
918
|
uint32: [0, 4294967295],
|
|
919
919
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
920
920
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
921
921
|
};
|
|
922
|
-
function
|
|
922
|
+
function Ln(e, t) {
|
|
923
923
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
924
924
|
get shape() {
|
|
925
925
|
const i = {};
|
|
@@ -934,7 +934,7 @@ function Rn(e, t) {
|
|
|
934
934
|
});
|
|
935
935
|
return D(e, o);
|
|
936
936
|
}
|
|
937
|
-
function
|
|
937
|
+
function Rn(e, t) {
|
|
938
938
|
const n = e._zod.def, o = B(e._zod.def, {
|
|
939
939
|
get shape() {
|
|
940
940
|
const i = { ...e._zod.def.shape };
|
|
@@ -964,7 +964,7 @@ function Nn(e, t) {
|
|
|
964
964
|
});
|
|
965
965
|
return D(e, i);
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function jn(e, t) {
|
|
968
968
|
if (!H(t))
|
|
969
969
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
970
970
|
const n = {
|
|
@@ -977,7 +977,7 @@ function Dn(e, t) {
|
|
|
977
977
|
};
|
|
978
978
|
return D(e, n);
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Dn(e, t) {
|
|
981
981
|
const n = B(e._zod.def, {
|
|
982
982
|
get shape() {
|
|
983
983
|
const o = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
@@ -991,7 +991,7 @@ function Un(e, t) {
|
|
|
991
991
|
});
|
|
992
992
|
return D(e, n);
|
|
993
993
|
}
|
|
994
|
-
function
|
|
994
|
+
function Mn(e, t, n) {
|
|
995
995
|
const o = B(t._zod.def, {
|
|
996
996
|
get shape() {
|
|
997
997
|
const i = t._zod.def.shape, a = { ...i };
|
|
@@ -1016,7 +1016,7 @@ function Fn(e, t, n) {
|
|
|
1016
1016
|
});
|
|
1017
1017
|
return D(t, o);
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function Fn(e, t, n) {
|
|
1020
1020
|
const o = B(t._zod.def, {
|
|
1021
1021
|
get shape() {
|
|
1022
1022
|
const i = t._zod.def.shape, a = { ...i };
|
|
@@ -1049,27 +1049,27 @@ function q(e, t = 0) {
|
|
|
1049
1049
|
return !0;
|
|
1050
1050
|
return !1;
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function U(e, t) {
|
|
1053
1053
|
return t.map((n) => {
|
|
1054
1054
|
var o;
|
|
1055
1055
|
return (o = n).path ?? (o.path = []), n.path.unshift(e), n;
|
|
1056
1056
|
});
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function se(e) {
|
|
1059
1059
|
return typeof e == "string" ? e : e?.message;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function j(e, t, n) {
|
|
1062
1062
|
const o = { ...e, path: e.path ?? [] };
|
|
1063
1063
|
if (!e.message) {
|
|
1064
|
-
const i =
|
|
1064
|
+
const i = se(e.inst?._zod.def?.error?.(e)) ?? se(t?.error?.(e)) ?? se(n.customError?.(e)) ?? se(n.localeError?.(e)) ?? "Invalid input";
|
|
1065
1065
|
o.message = i;
|
|
1066
1066
|
}
|
|
1067
1067
|
return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function Ne(e) {
|
|
1070
1070
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function re(...e) {
|
|
1073
1073
|
const [t, n, o] = e;
|
|
1074
1074
|
return typeof t == "string" ? {
|
|
1075
1075
|
message: t,
|
|
@@ -1078,25 +1078,25 @@ function ie(...e) {
|
|
|
1078
1078
|
inst: o
|
|
1079
1079
|
} : { ...t };
|
|
1080
1080
|
}
|
|
1081
|
-
const
|
|
1081
|
+
const Zt = (e, t) => {
|
|
1082
1082
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1083
1083
|
value: e._zod,
|
|
1084
1084
|
enumerable: !1
|
|
1085
1085
|
}), Object.defineProperty(e, "issues", {
|
|
1086
1086
|
value: t,
|
|
1087
1087
|
enumerable: !1
|
|
1088
|
-
}), e.message = JSON.stringify(t,
|
|
1088
|
+
}), e.message = JSON.stringify(t, Oe, 2), Object.defineProperty(e, "toString", {
|
|
1089
1089
|
value: () => e.message,
|
|
1090
1090
|
enumerable: !1
|
|
1091
1091
|
});
|
|
1092
|
-
},
|
|
1093
|
-
function
|
|
1092
|
+
}, Pt = /* @__PURE__ */ m("$ZodError", Zt), xt = /* @__PURE__ */ m("$ZodError", Zt, { Parent: Error });
|
|
1093
|
+
function Un(e, t = (n) => n.message) {
|
|
1094
1094
|
const n = {}, o = [];
|
|
1095
1095
|
for (const i of e.issues)
|
|
1096
1096
|
i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : o.push(t(i));
|
|
1097
1097
|
return { formErrors: o, fieldErrors: n };
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function Vn(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)
|
|
@@ -1110,27 +1110,27 @@ function Bn(e, t = (n) => n.message) {
|
|
|
1110
1110
|
else {
|
|
1111
1111
|
let c = n, l = 0;
|
|
1112
1112
|
for (; l < a.path.length; ) {
|
|
1113
|
-
const
|
|
1114
|
-
l === a.path.length - 1 ? (c[
|
|
1113
|
+
const p = a.path[l];
|
|
1114
|
+
l === a.path.length - 1 ? (c[p] = c[p] || { _errors: [] }, c[p]._errors.push(t(a))) : c[p] = c[p] || { _errors: [] }, c = c[p], l++;
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
1117
|
};
|
|
1118
1118
|
return o(e), n;
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1120
|
+
const je = (e) => (t, n, o, i) => {
|
|
1121
1121
|
const a = o ? Object.assign(o, { async: !1 }) : { async: !1 }, c = t._zod.run({ value: n, issues: [] }, a);
|
|
1122
1122
|
if (c instanceof Promise)
|
|
1123
1123
|
throw new K();
|
|
1124
1124
|
if (c.issues.length) {
|
|
1125
|
-
const l = new (i?.Err ?? e)(c.issues.map((
|
|
1125
|
+
const l = new (i?.Err ?? e)(c.issues.map((p) => j(p, a, N())));
|
|
1126
1126
|
throw Ot(l, i?.callee), l;
|
|
1127
1127
|
}
|
|
1128
1128
|
return c.value;
|
|
1129
|
-
},
|
|
1129
|
+
}, De = (e) => async (t, n, o, i) => {
|
|
1130
1130
|
const a = o ? Object.assign(o, { async: !0 }) : { async: !0 };
|
|
1131
1131
|
let c = t._zod.run({ value: n, issues: [] }, a);
|
|
1132
1132
|
if (c instanceof Promise && (c = await c), c.issues.length) {
|
|
1133
|
-
const l = new (i?.Err ?? e)(c.issues.map((
|
|
1133
|
+
const l = new (i?.Err ?? e)(c.issues.map((p) => j(p, a, N())));
|
|
1134
1134
|
throw Ot(l, i?.callee), l;
|
|
1135
1135
|
}
|
|
1136
1136
|
return c.value;
|
|
@@ -1140,58 +1140,58 @@ const Ue = (e) => (t, n, o, i) => {
|
|
|
1140
1140
|
throw new K();
|
|
1141
1141
|
return a.issues.length ? {
|
|
1142
1142
|
success: !1,
|
|
1143
|
-
error: new (e ??
|
|
1143
|
+
error: new (e ?? Pt)(a.issues.map((c) => j(c, i, N())))
|
|
1144
1144
|
} : { success: !0, data: a.value };
|
|
1145
|
-
},
|
|
1145
|
+
}, Bn = /* @__PURE__ */ ve(xt), ge = (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((c) =>
|
|
1150
|
+
error: new e(a.issues.map((c) => j(c, i, N())))
|
|
1151
1151
|
} : { success: !0, data: a.value };
|
|
1152
|
-
},
|
|
1152
|
+
}, Gn = /* @__PURE__ */ ge(xt), Wn = (e) => (t, n, o) => {
|
|
1153
1153
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1154
|
-
return
|
|
1155
|
-
},
|
|
1154
|
+
return je(e)(t, n, i);
|
|
1155
|
+
}, qn = (e) => (t, n, o) => je(e)(t, n, o), Kn = (e) => async (t, n, o) => {
|
|
1156
1156
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1157
|
-
return
|
|
1158
|
-
},
|
|
1157
|
+
return De(e)(t, n, i);
|
|
1158
|
+
}, Hn = (e) => async (t, n, o) => De(e)(t, n, o), Jn = (e) => (t, n, o) => {
|
|
1159
1159
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1160
1160
|
return ve(e)(t, n, i);
|
|
1161
|
-
},
|
|
1161
|
+
}, Yn = (e) => (t, n, o) => ve(e)(t, n, o), Qn = (e) => async (t, n, o) => {
|
|
1162
1162
|
const i = o ? Object.assign(o, { direction: "backward" }) : { direction: "backward" };
|
|
1163
1163
|
return ge(e)(t, n, i);
|
|
1164
|
-
},
|
|
1165
|
-
function
|
|
1166
|
-
return new RegExp(
|
|
1164
|
+
}, Xn = (e) => async (t, n, o) => ge(e)(t, n, o), eo = /^[cC][^\s-]{8,}$/, to = /^[0-9a-z]+$/, no = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, oo = /^[0-9a-vA-V]{20}$/, ro = /^[A-Za-z0-9]{27}$/, io = /^[a-zA-Z0-9_-]{21}$/, so = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, ao = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Ye = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, uo = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, co = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1165
|
+
function lo() {
|
|
1166
|
+
return new RegExp(co, "u");
|
|
1167
1167
|
}
|
|
1168
|
-
const
|
|
1168
|
+
const po = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, ho = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, fo = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, _o = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, mo = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Lt = /^[A-Za-z0-9_-]*$/, vo = /^\+(?:[0-9]){6,14}[0-9]$/, Rt = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", go = /* @__PURE__ */ new RegExp(`^${Rt}$`);
|
|
1169
1169
|
function Nt(e) {
|
|
1170
1170
|
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1171
1171
|
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1173
|
+
function yo(e) {
|
|
1174
1174
|
return new RegExp(`^${Nt(e)}$`);
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1176
|
+
function bo(e) {
|
|
1177
1177
|
const t = Nt({ precision: e.precision }), n = ["Z"];
|
|
1178
1178
|
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1179
1179
|
const o = `${t}(?:${n.join("|")})`;
|
|
1180
|
-
return new RegExp(`^${
|
|
1180
|
+
return new RegExp(`^${Rt}T(?:${o})$`);
|
|
1181
1181
|
}
|
|
1182
|
-
const
|
|
1182
|
+
const wo = (e) => {
|
|
1183
1183
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1184
1184
|
return new RegExp(`^${t}$`);
|
|
1185
|
-
},
|
|
1185
|
+
}, Eo = /^-?\d+$/, ko = /^-?\d+(?:\.\d+)?/, Co = /^null$/i, So = /^[^A-Z]*$/, Ao = /^[^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
|
+
}), jt = {
|
|
1189
1189
|
number: "number",
|
|
1190
1190
|
bigint: "bigint",
|
|
1191
1191
|
object: "date"
|
|
1192
|
-
},
|
|
1193
|
-
|
|
1194
|
-
const n =
|
|
1192
|
+
}, Dt = /* @__PURE__ */ m("$ZodCheckLessThan", (e, t) => {
|
|
1193
|
+
$.init(e, t);
|
|
1194
|
+
const n = jt[typeof t.value];
|
|
1195
1195
|
e._zod.onattach.push((o) => {
|
|
1196
1196
|
const i = o._zod.bag, a = (t.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1197
1197
|
t.value < a && (t.inclusive ? i.maximum = t.value : i.exclusiveMaximum = t.value);
|
|
@@ -1206,9 +1206,9 @@ const Eo = (e) => {
|
|
|
1206
1206
|
continue: !t.abort
|
|
1207
1207
|
});
|
|
1208
1208
|
};
|
|
1209
|
-
}),
|
|
1210
|
-
|
|
1211
|
-
const n =
|
|
1209
|
+
}), Mt = /* @__PURE__ */ m("$ZodCheckGreaterThan", (e, t) => {
|
|
1210
|
+
$.init(e, t);
|
|
1211
|
+
const n = jt[typeof t.value];
|
|
1212
1212
|
e._zod.onattach.push((o) => {
|
|
1213
1213
|
const i = o._zod.bag, a = (t.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1214
1214
|
t.value > a && (t.inclusive ? i.minimum = t.value : i.exclusiveMinimum = t.value);
|
|
@@ -1223,14 +1223,14 @@ const Eo = (e) => {
|
|
|
1223
1223
|
continue: !t.abort
|
|
1224
1224
|
});
|
|
1225
1225
|
};
|
|
1226
|
-
}),
|
|
1227
|
-
|
|
1226
|
+
}), To = /* @__PURE__ */ m("$ZodCheckMultipleOf", (e, t) => {
|
|
1227
|
+
$.init(e, t), e._zod.onattach.push((n) => {
|
|
1228
1228
|
var o;
|
|
1229
1229
|
(o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value);
|
|
1230
1230
|
}), e._zod.check = (n) => {
|
|
1231
1231
|
if (typeof n.value != typeof t.value)
|
|
1232
1232
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1233
|
-
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) :
|
|
1233
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : In(n.value, t.value) === 0) || n.issues.push({
|
|
1234
1234
|
origin: typeof n.value,
|
|
1235
1235
|
code: "not_multiple_of",
|
|
1236
1236
|
divisor: t.value,
|
|
@@ -1239,12 +1239,12 @@ const Eo = (e) => {
|
|
|
1239
1239
|
continue: !t.abort
|
|
1240
1240
|
});
|
|
1241
1241
|
};
|
|
1242
|
-
}),
|
|
1243
|
-
|
|
1244
|
-
const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] =
|
|
1242
|
+
}), zo = /* @__PURE__ */ m("$ZodCheckNumberFormat", (e, t) => {
|
|
1243
|
+
$.init(e, t), t.format = t.format || "float64";
|
|
1244
|
+
const n = t.format?.includes("int"), o = n ? "int" : "number", [i, a] = xn[t.format];
|
|
1245
1245
|
e._zod.onattach.push((c) => {
|
|
1246
1246
|
const l = c._zod.bag;
|
|
1247
|
-
l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern =
|
|
1247
|
+
l.format = t.format, l.minimum = i, l.maximum = a, n && (l.pattern = Eo);
|
|
1248
1248
|
}), e._zod.check = (c) => {
|
|
1249
1249
|
const l = c.value;
|
|
1250
1250
|
if (n) {
|
|
@@ -1296,11 +1296,11 @@ const Eo = (e) => {
|
|
|
1296
1296
|
inst: e
|
|
1297
1297
|
});
|
|
1298
1298
|
};
|
|
1299
|
-
}),
|
|
1299
|
+
}), Io = /* @__PURE__ */ m("$ZodCheckMaxLength", (e, t) => {
|
|
1300
1300
|
var n;
|
|
1301
|
-
|
|
1301
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1302
1302
|
const i = o.value;
|
|
1303
|
-
return !
|
|
1303
|
+
return !Le(i) && i.length !== void 0;
|
|
1304
1304
|
}), e._zod.onattach.push((o) => {
|
|
1305
1305
|
const i = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1306
1306
|
t.maximum < i && (o._zod.bag.maximum = t.maximum);
|
|
@@ -1308,7 +1308,7 @@ const Eo = (e) => {
|
|
|
1308
1308
|
const i = o.value;
|
|
1309
1309
|
if (i.length <= t.maximum)
|
|
1310
1310
|
return;
|
|
1311
|
-
const c =
|
|
1311
|
+
const c = Ne(i);
|
|
1312
1312
|
o.issues.push({
|
|
1313
1313
|
origin: c,
|
|
1314
1314
|
code: "too_big",
|
|
@@ -1321,9 +1321,9 @@ const Eo = (e) => {
|
|
|
1321
1321
|
};
|
|
1322
1322
|
}), Oo = /* @__PURE__ */ m("$ZodCheckMinLength", (e, t) => {
|
|
1323
1323
|
var n;
|
|
1324
|
-
|
|
1324
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1325
1325
|
const i = o.value;
|
|
1326
|
-
return !
|
|
1326
|
+
return !Le(i) && i.length !== void 0;
|
|
1327
1327
|
}), e._zod.onattach.push((o) => {
|
|
1328
1328
|
const i = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1329
1329
|
t.minimum > i && (o._zod.bag.minimum = t.minimum);
|
|
@@ -1331,7 +1331,7 @@ const Eo = (e) => {
|
|
|
1331
1331
|
const i = o.value;
|
|
1332
1332
|
if (i.length >= t.minimum)
|
|
1333
1333
|
return;
|
|
1334
|
-
const c =
|
|
1334
|
+
const c = Ne(i);
|
|
1335
1335
|
o.issues.push({
|
|
1336
1336
|
origin: c,
|
|
1337
1337
|
code: "too_small",
|
|
@@ -1342,11 +1342,11 @@ const Eo = (e) => {
|
|
|
1342
1342
|
continue: !t.abort
|
|
1343
1343
|
});
|
|
1344
1344
|
};
|
|
1345
|
-
}),
|
|
1345
|
+
}), $o = /* @__PURE__ */ m("$ZodCheckLengthEquals", (e, t) => {
|
|
1346
1346
|
var n;
|
|
1347
|
-
|
|
1347
|
+
$.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => {
|
|
1348
1348
|
const i = o.value;
|
|
1349
|
-
return !
|
|
1349
|
+
return !Le(i) && i.length !== void 0;
|
|
1350
1350
|
}), e._zod.onattach.push((o) => {
|
|
1351
1351
|
const i = o._zod.bag;
|
|
1352
1352
|
i.minimum = t.length, i.maximum = t.length, i.length = t.length;
|
|
@@ -1354,7 +1354,7 @@ const Eo = (e) => {
|
|
|
1354
1354
|
const i = o.value, a = i.length;
|
|
1355
1355
|
if (a === t.length)
|
|
1356
1356
|
return;
|
|
1357
|
-
const c =
|
|
1357
|
+
const c = Ne(i), l = a > t.length;
|
|
1358
1358
|
o.issues.push({
|
|
1359
1359
|
origin: c,
|
|
1360
1360
|
...l ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
@@ -1367,7 +1367,7 @@ const Eo = (e) => {
|
|
|
1367
1367
|
};
|
|
1368
1368
|
}), ye = /* @__PURE__ */ m("$ZodCheckStringFormat", (e, t) => {
|
|
1369
1369
|
var n, o;
|
|
1370
|
-
|
|
1370
|
+
$.init(e, t), e._zod.onattach.push((i) => {
|
|
1371
1371
|
const a = i._zod.bag;
|
|
1372
1372
|
a.format = t.format, t.pattern && (a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(t.pattern));
|
|
1373
1373
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (i) => {
|
|
@@ -1382,7 +1382,7 @@ const Eo = (e) => {
|
|
|
1382
1382
|
});
|
|
1383
1383
|
}) : (o = e._zod).check ?? (o.check = () => {
|
|
1384
1384
|
});
|
|
1385
|
-
}),
|
|
1385
|
+
}), Zo = /* @__PURE__ */ m("$ZodCheckRegex", (e, t) => {
|
|
1386
1386
|
ye.init(e, t), e._zod.check = (n) => {
|
|
1387
1387
|
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1388
1388
|
origin: "string",
|
|
@@ -1394,12 +1394,12 @@ const Eo = (e) => {
|
|
|
1394
1394
|
continue: !t.abort
|
|
1395
1395
|
});
|
|
1396
1396
|
};
|
|
1397
|
-
}),
|
|
1398
|
-
t.pattern ?? (t.pattern = To), ye.init(e, t);
|
|
1399
|
-
}), Lo = /* @__PURE__ */ m("$ZodCheckUpperCase", (e, t) => {
|
|
1397
|
+
}), Po = /* @__PURE__ */ m("$ZodCheckLowerCase", (e, t) => {
|
|
1400
1398
|
t.pattern ?? (t.pattern = So), ye.init(e, t);
|
|
1401
|
-
}),
|
|
1402
|
-
|
|
1399
|
+
}), xo = /* @__PURE__ */ m("$ZodCheckUpperCase", (e, t) => {
|
|
1400
|
+
t.pattern ?? (t.pattern = Ao), ye.init(e, t);
|
|
1401
|
+
}), Lo = /* @__PURE__ */ m("$ZodCheckIncludes", (e, t) => {
|
|
1402
|
+
$.init(e, t);
|
|
1403
1403
|
const n = J(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1404
1404
|
t.pattern = o, e._zod.onattach.push((i) => {
|
|
1405
1405
|
const a = i._zod.bag;
|
|
@@ -1415,8 +1415,8 @@ const Eo = (e) => {
|
|
|
1415
1415
|
continue: !t.abort
|
|
1416
1416
|
});
|
|
1417
1417
|
};
|
|
1418
|
-
}),
|
|
1419
|
-
|
|
1418
|
+
}), Ro = /* @__PURE__ */ m("$ZodCheckStartsWith", (e, t) => {
|
|
1419
|
+
$.init(e, t);
|
|
1420
1420
|
const n = new RegExp(`^${J(t.prefix)}.*`);
|
|
1421
1421
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
|
|
1422
1422
|
const i = o._zod.bag;
|
|
@@ -1433,7 +1433,7 @@ const Eo = (e) => {
|
|
|
1433
1433
|
});
|
|
1434
1434
|
};
|
|
1435
1435
|
}), No = /* @__PURE__ */ m("$ZodCheckEndsWith", (e, t) => {
|
|
1436
|
-
|
|
1436
|
+
$.init(e, t);
|
|
1437
1437
|
const n = new RegExp(`.*${J(t.suffix)}$`);
|
|
1438
1438
|
t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => {
|
|
1439
1439
|
const i = o._zod.bag;
|
|
@@ -1449,12 +1449,12 @@ const Eo = (e) => {
|
|
|
1449
1449
|
continue: !t.abort
|
|
1450
1450
|
});
|
|
1451
1451
|
};
|
|
1452
|
-
}),
|
|
1453
|
-
|
|
1452
|
+
}), jo = /* @__PURE__ */ m("$ZodCheckOverwrite", (e, t) => {
|
|
1453
|
+
$.init(e, t), e._zod.check = (n) => {
|
|
1454
1454
|
n.value = t.tx(n.value);
|
|
1455
1455
|
};
|
|
1456
1456
|
});
|
|
1457
|
-
class
|
|
1457
|
+
class Do {
|
|
1458
1458
|
constructor(t = []) {
|
|
1459
1459
|
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1460
1460
|
}
|
|
@@ -1477,13 +1477,13 @@ class Uo {
|
|
|
1477
1477
|
`));
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
|
-
const
|
|
1480
|
+
const Mo = {
|
|
1481
1481
|
major: 4,
|
|
1482
1482
|
minor: 1,
|
|
1483
1483
|
patch: 13
|
|
1484
|
-
},
|
|
1484
|
+
}, S = /* @__PURE__ */ m("$ZodType", (e, t) => {
|
|
1485
1485
|
var n;
|
|
1486
|
-
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version =
|
|
1486
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Mo;
|
|
1487
1487
|
const o = [...e._zod.def.checks ?? []];
|
|
1488
1488
|
e._zod.traits.has("$ZodCheck") && o.unshift(e);
|
|
1489
1489
|
for (const i of o)
|
|
@@ -1494,7 +1494,7 @@ const Fo = {
|
|
|
1494
1494
|
e._zod.run = e._zod.parse;
|
|
1495
1495
|
});
|
|
1496
1496
|
else {
|
|
1497
|
-
const i = (c, l,
|
|
1497
|
+
const i = (c, l, p) => {
|
|
1498
1498
|
let f = q(c), y;
|
|
1499
1499
|
for (const g of l) {
|
|
1500
1500
|
if (g._zod.def.when) {
|
|
@@ -1503,7 +1503,7 @@ const Fo = {
|
|
|
1503
1503
|
} else if (f)
|
|
1504
1504
|
continue;
|
|
1505
1505
|
const r = c.issues.length, s = g._zod.check(c);
|
|
1506
|
-
if (s instanceof Promise &&
|
|
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 () => {
|
|
@@ -1516,16 +1516,16 @@ const Fo = {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
return y ? y.then(() => c) : c;
|
|
1519
|
-
}, a = (c, l,
|
|
1519
|
+
}, a = (c, l, p) => {
|
|
1520
1520
|
if (q(c))
|
|
1521
1521
|
return c.aborted = !0, c;
|
|
1522
|
-
const f = i(l, o,
|
|
1522
|
+
const f = i(l, o, p);
|
|
1523
1523
|
if (f instanceof Promise) {
|
|
1524
|
-
if (
|
|
1524
|
+
if (p.async === !1)
|
|
1525
1525
|
throw new K();
|
|
1526
|
-
return f.then((y) => e._zod.parse(y,
|
|
1526
|
+
return f.then((y) => e._zod.parse(y, p));
|
|
1527
1527
|
}
|
|
1528
|
-
return e._zod.parse(f,
|
|
1528
|
+
return e._zod.parse(f, p);
|
|
1529
1529
|
};
|
|
1530
1530
|
e._zod.run = (c, l) => {
|
|
1531
1531
|
if (l.skipChecks)
|
|
@@ -1534,29 +1534,29 @@ const Fo = {
|
|
|
1534
1534
|
const f = e._zod.parse({ value: c.value, issues: [] }, { ...l, skipChecks: !0 });
|
|
1535
1535
|
return f instanceof Promise ? f.then((y) => a(y, c, l)) : a(f, c, l);
|
|
1536
1536
|
}
|
|
1537
|
-
const
|
|
1538
|
-
if (
|
|
1537
|
+
const p = e._zod.parse(c, l);
|
|
1538
|
+
if (p instanceof Promise) {
|
|
1539
1539
|
if (l.async === !1)
|
|
1540
1540
|
throw new K();
|
|
1541
|
-
return
|
|
1541
|
+
return p.then((f) => i(f, o, l));
|
|
1542
1542
|
}
|
|
1543
|
-
return i(
|
|
1543
|
+
return i(p, o, l);
|
|
1544
1544
|
};
|
|
1545
1545
|
}
|
|
1546
1546
|
e["~standard"] = {
|
|
1547
1547
|
validate: (i) => {
|
|
1548
1548
|
try {
|
|
1549
|
-
const a =
|
|
1549
|
+
const a = Bn(e, i);
|
|
1550
1550
|
return a.success ? { value: a.data } : { issues: a.error?.issues };
|
|
1551
1551
|
} catch {
|
|
1552
|
-
return
|
|
1552
|
+
return Gn(e, i).then((c) => c.success ? { value: c.data } : { issues: c.error?.issues });
|
|
1553
1553
|
}
|
|
1554
1554
|
},
|
|
1555
1555
|
vendor: "zod",
|
|
1556
1556
|
version: 1
|
|
1557
1557
|
};
|
|
1558
1558
|
}), Me = /* @__PURE__ */ m("$ZodString", (e, t) => {
|
|
1559
|
-
|
|
1559
|
+
S.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? wo(e._zod.bag), e._zod.parse = (n, o) => {
|
|
1560
1560
|
if (t.coerce)
|
|
1561
1561
|
try {
|
|
1562
1562
|
n.value = String(n.value);
|
|
@@ -1571,9 +1571,9 @@ const Fo = {
|
|
|
1571
1571
|
};
|
|
1572
1572
|
}), z = /* @__PURE__ */ m("$ZodStringFormat", (e, t) => {
|
|
1573
1573
|
ye.init(e, t), Me.init(e, t);
|
|
1574
|
-
}),
|
|
1575
|
-
t.pattern ?? (t.pattern =
|
|
1576
|
-
}),
|
|
1574
|
+
}), Fo = /* @__PURE__ */ m("$ZodGUID", (e, t) => {
|
|
1575
|
+
t.pattern ?? (t.pattern = ao), z.init(e, t);
|
|
1576
|
+
}), Uo = /* @__PURE__ */ m("$ZodUUID", (e, t) => {
|
|
1577
1577
|
if (t.version) {
|
|
1578
1578
|
const o = {
|
|
1579
1579
|
v1: 1,
|
|
@@ -1587,13 +1587,13 @@ const Fo = {
|
|
|
1587
1587
|
}[t.version];
|
|
1588
1588
|
if (o === void 0)
|
|
1589
1589
|
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1590
|
-
t.pattern ?? (t.pattern =
|
|
1590
|
+
t.pattern ?? (t.pattern = Ye(o));
|
|
1591
1591
|
} else
|
|
1592
|
-
t.pattern ?? (t.pattern =
|
|
1592
|
+
t.pattern ?? (t.pattern = Ye());
|
|
1593
1593
|
z.init(e, t);
|
|
1594
|
-
}),
|
|
1595
|
-
t.pattern ?? (t.pattern =
|
|
1596
|
-
}),
|
|
1594
|
+
}), Vo = /* @__PURE__ */ m("$ZodEmail", (e, t) => {
|
|
1595
|
+
t.pattern ?? (t.pattern = uo), z.init(e, t);
|
|
1596
|
+
}), Bo = /* @__PURE__ */ m("$ZodURL", (e, t) => {
|
|
1597
1597
|
z.init(e, t), e._zod.check = (n) => {
|
|
1598
1598
|
try {
|
|
1599
1599
|
const o = n.value.trim(), i = new URL(o);
|
|
@@ -1625,32 +1625,32 @@ const Fo = {
|
|
|
1625
1625
|
});
|
|
1626
1626
|
}
|
|
1627
1627
|
};
|
|
1628
|
-
}),
|
|
1629
|
-
t.pattern ?? (t.pattern =
|
|
1630
|
-
}),
|
|
1631
|
-
t.pattern ?? (t.pattern =
|
|
1632
|
-
}),
|
|
1628
|
+
}), Go = /* @__PURE__ */ m("$ZodEmoji", (e, t) => {
|
|
1629
|
+
t.pattern ?? (t.pattern = lo()), z.init(e, t);
|
|
1630
|
+
}), Wo = /* @__PURE__ */ m("$ZodNanoID", (e, t) => {
|
|
1631
|
+
t.pattern ?? (t.pattern = io), z.init(e, t);
|
|
1632
|
+
}), qo = /* @__PURE__ */ m("$ZodCUID", (e, t) => {
|
|
1633
|
+
t.pattern ?? (t.pattern = eo), z.init(e, t);
|
|
1634
|
+
}), Ko = /* @__PURE__ */ m("$ZodCUID2", (e, t) => {
|
|
1633
1635
|
t.pattern ?? (t.pattern = to), z.init(e, t);
|
|
1634
|
-
}), Ho = /* @__PURE__ */ m("$
|
|
1636
|
+
}), Ho = /* @__PURE__ */ m("$ZodULID", (e, t) => {
|
|
1635
1637
|
t.pattern ?? (t.pattern = no), z.init(e, t);
|
|
1636
|
-
}), Jo = /* @__PURE__ */ m("$
|
|
1638
|
+
}), Jo = /* @__PURE__ */ m("$ZodXID", (e, t) => {
|
|
1637
1639
|
t.pattern ?? (t.pattern = oo), z.init(e, t);
|
|
1638
|
-
}), Yo = /* @__PURE__ */ m("$
|
|
1640
|
+
}), Yo = /* @__PURE__ */ m("$ZodKSUID", (e, t) => {
|
|
1639
1641
|
t.pattern ?? (t.pattern = ro), z.init(e, t);
|
|
1640
|
-
}), Qo = /* @__PURE__ */ m("$
|
|
1641
|
-
t.pattern ?? (t.pattern = io), z.init(e, t);
|
|
1642
|
-
}), Xo = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
|
|
1643
|
-
t.pattern ?? (t.pattern = wo(t)), z.init(e, t);
|
|
1644
|
-
}), er = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
|
|
1645
|
-
t.pattern ?? (t.pattern = yo), z.init(e, t);
|
|
1646
|
-
}), tr = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
|
|
1642
|
+
}), Qo = /* @__PURE__ */ m("$ZodISODateTime", (e, t) => {
|
|
1647
1643
|
t.pattern ?? (t.pattern = bo(t)), z.init(e, t);
|
|
1648
|
-
}),
|
|
1649
|
-
t.pattern ?? (t.pattern =
|
|
1650
|
-
}),
|
|
1651
|
-
t.pattern ?? (t.pattern =
|
|
1652
|
-
}),
|
|
1653
|
-
t.pattern ?? (t.pattern =
|
|
1644
|
+
}), Xo = /* @__PURE__ */ m("$ZodISODate", (e, t) => {
|
|
1645
|
+
t.pattern ?? (t.pattern = go), z.init(e, t);
|
|
1646
|
+
}), er = /* @__PURE__ */ m("$ZodISOTime", (e, t) => {
|
|
1647
|
+
t.pattern ?? (t.pattern = yo(t)), z.init(e, t);
|
|
1648
|
+
}), tr = /* @__PURE__ */ m("$ZodISODuration", (e, t) => {
|
|
1649
|
+
t.pattern ?? (t.pattern = so), z.init(e, t);
|
|
1650
|
+
}), nr = /* @__PURE__ */ m("$ZodIPv4", (e, t) => {
|
|
1651
|
+
t.pattern ?? (t.pattern = po), z.init(e, t), e._zod.bag.format = "ipv4";
|
|
1652
|
+
}), or = /* @__PURE__ */ m("$ZodIPv6", (e, t) => {
|
|
1653
|
+
t.pattern ?? (t.pattern = ho), z.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1654
1654
|
try {
|
|
1655
1655
|
new URL(`http://[${n.value}]`);
|
|
1656
1656
|
} catch {
|
|
@@ -1663,10 +1663,10 @@ const Fo = {
|
|
|
1663
1663
|
});
|
|
1664
1664
|
}
|
|
1665
1665
|
};
|
|
1666
|
-
}),
|
|
1667
|
-
t.pattern ?? (t.pattern =
|
|
1668
|
-
}),
|
|
1669
|
-
t.pattern ?? (t.pattern =
|
|
1666
|
+
}), rr = /* @__PURE__ */ m("$ZodCIDRv4", (e, t) => {
|
|
1667
|
+
t.pattern ?? (t.pattern = fo), z.init(e, t);
|
|
1668
|
+
}), ir = /* @__PURE__ */ m("$ZodCIDRv6", (e, t) => {
|
|
1669
|
+
t.pattern ?? (t.pattern = _o), z.init(e, t), e._zod.check = (n) => {
|
|
1670
1670
|
const o = n.value.split("/");
|
|
1671
1671
|
try {
|
|
1672
1672
|
if (o.length !== 2)
|
|
@@ -1691,7 +1691,7 @@ const Fo = {
|
|
|
1691
1691
|
}
|
|
1692
1692
|
};
|
|
1693
1693
|
});
|
|
1694
|
-
function
|
|
1694
|
+
function Ft(e) {
|
|
1695
1695
|
if (e === "")
|
|
1696
1696
|
return !0;
|
|
1697
1697
|
if (e.length % 4 !== 0)
|
|
@@ -1702,9 +1702,9 @@ function Mt(e) {
|
|
|
1702
1702
|
return !1;
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
|
-
const
|
|
1706
|
-
t.pattern ?? (t.pattern =
|
|
1707
|
-
|
|
1705
|
+
const sr = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
|
|
1706
|
+
t.pattern ?? (t.pattern = mo), z.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1707
|
+
Ft(n.value) || n.issues.push({
|
|
1708
1708
|
code: "invalid_format",
|
|
1709
1709
|
format: "base64",
|
|
1710
1710
|
input: n.value,
|
|
@@ -1713,15 +1713,15 @@ const ar = /* @__PURE__ */ m("$ZodBase64", (e, t) => {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
};
|
|
1715
1715
|
});
|
|
1716
|
-
function
|
|
1717
|
-
if (!
|
|
1716
|
+
function ar(e) {
|
|
1717
|
+
if (!Lt.test(e))
|
|
1718
1718
|
return !1;
|
|
1719
1719
|
const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1720
|
-
return
|
|
1720
|
+
return Ft(n);
|
|
1721
1721
|
}
|
|
1722
|
-
const
|
|
1723
|
-
t.pattern ?? (t.pattern =
|
|
1724
|
-
|
|
1722
|
+
const ur = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
|
|
1723
|
+
t.pattern ?? (t.pattern = Lt), z.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
1724
|
+
ar(n.value) || n.issues.push({
|
|
1725
1725
|
code: "invalid_format",
|
|
1726
1726
|
format: "base64url",
|
|
1727
1727
|
input: n.value,
|
|
@@ -1729,10 +1729,10 @@ const cr = /* @__PURE__ */ m("$ZodBase64URL", (e, t) => {
|
|
|
1729
1729
|
continue: !t.abort
|
|
1730
1730
|
});
|
|
1731
1731
|
};
|
|
1732
|
-
}),
|
|
1733
|
-
t.pattern ?? (t.pattern =
|
|
1732
|
+
}), cr = /* @__PURE__ */ m("$ZodE164", (e, t) => {
|
|
1733
|
+
t.pattern ?? (t.pattern = vo), z.init(e, t);
|
|
1734
1734
|
});
|
|
1735
|
-
function
|
|
1735
|
+
function lr(e, t = null) {
|
|
1736
1736
|
try {
|
|
1737
1737
|
const n = e.split(".");
|
|
1738
1738
|
if (n.length !== 3)
|
|
@@ -1746,9 +1746,9 @@ function dr(e, t = null) {
|
|
|
1746
1746
|
return !1;
|
|
1747
1747
|
}
|
|
1748
1748
|
}
|
|
1749
|
-
const
|
|
1749
|
+
const dr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
1750
1750
|
z.init(e, t), e._zod.check = (n) => {
|
|
1751
|
-
|
|
1751
|
+
lr(n.value, t.alg) || n.issues.push({
|
|
1752
1752
|
code: "invalid_format",
|
|
1753
1753
|
format: "jwt",
|
|
1754
1754
|
input: n.value,
|
|
@@ -1756,8 +1756,8 @@ const pr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1756
1756
|
continue: !t.abort
|
|
1757
1757
|
});
|
|
1758
1758
|
};
|
|
1759
|
-
}),
|
|
1760
|
-
|
|
1759
|
+
}), Ut = /* @__PURE__ */ m("$ZodNumber", (e, t) => {
|
|
1760
|
+
S.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ko, e._zod.parse = (n, o) => {
|
|
1761
1761
|
if (t.coerce)
|
|
1762
1762
|
try {
|
|
1763
1763
|
n.value = Number(n.value);
|
|
@@ -1775,10 +1775,10 @@ const pr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1775
1775
|
...a ? { received: a } : {}
|
|
1776
1776
|
}), n;
|
|
1777
1777
|
};
|
|
1778
|
-
}),
|
|
1779
|
-
|
|
1780
|
-
}),
|
|
1781
|
-
|
|
1778
|
+
}), pr = /* @__PURE__ */ m("$ZodNumberFormat", (e, t) => {
|
|
1779
|
+
zo.init(e, t), Ut.init(e, t);
|
|
1780
|
+
}), hr = /* @__PURE__ */ m("$ZodNull", (e, t) => {
|
|
1781
|
+
S.init(e, t), e._zod.pattern = Co, 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",
|
|
@@ -1787,21 +1787,21 @@ const pr = /* @__PURE__ */ m("$ZodJWT", (e, t) => {
|
|
|
1787
1787
|
inst: e
|
|
1788
1788
|
}), n;
|
|
1789
1789
|
};
|
|
1790
|
-
}),
|
|
1791
|
-
|
|
1792
|
-
}),
|
|
1793
|
-
|
|
1790
|
+
}), fr = /* @__PURE__ */ m("$ZodUnknown", (e, t) => {
|
|
1791
|
+
S.init(e, t), e._zod.parse = (n) => n;
|
|
1792
|
+
}), _r = /* @__PURE__ */ m("$ZodNever", (e, t) => {
|
|
1793
|
+
S.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,
|
|
1797
1797
|
inst: e
|
|
1798
1798
|
}), n);
|
|
1799
1799
|
});
|
|
1800
|
-
function
|
|
1801
|
-
e.issues.length && t.issues.push(...
|
|
1800
|
+
function Qe(e, t, n) {
|
|
1801
|
+
e.issues.length && t.issues.push(...U(n, e.issues)), t.value[n] = e.value;
|
|
1802
1802
|
}
|
|
1803
|
-
const
|
|
1804
|
-
|
|
1803
|
+
const mr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
1804
|
+
S.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({
|
|
@@ -1813,24 +1813,24 @@ const vr = /* @__PURE__ */ m("$ZodArray", (e, t) => {
|
|
|
1813
1813
|
n.value = Array(i.length);
|
|
1814
1814
|
const a = [];
|
|
1815
1815
|
for (let c = 0; c < i.length; c++) {
|
|
1816
|
-
const l = i[c],
|
|
1816
|
+
const l = i[c], p = t.element._zod.run({
|
|
1817
1817
|
value: l,
|
|
1818
1818
|
issues: []
|
|
1819
1819
|
}, o);
|
|
1820
|
-
|
|
1820
|
+
p instanceof Promise ? a.push(p.then((f) => Qe(f, n, c))) : Qe(p, n, c);
|
|
1821
1821
|
}
|
|
1822
1822
|
return a.length ? Promise.all(a).then(() => n) : n;
|
|
1823
1823
|
};
|
|
1824
1824
|
});
|
|
1825
|
-
function
|
|
1826
|
-
e.issues.length && t.issues.push(...
|
|
1825
|
+
function he(e, t, n, o) {
|
|
1826
|
+
e.issues.length && t.issues.push(...U(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1828
|
+
function Vt(e) {
|
|
1829
1829
|
const t = Object.keys(e.shape);
|
|
1830
1830
|
for (const o of t)
|
|
1831
1831
|
if (!e.shape?.[o]?._zod?.traits?.has("$ZodType"))
|
|
1832
1832
|
throw new Error(`Invalid element at key "${o}": expected a Zod schema`);
|
|
1833
|
-
const n =
|
|
1833
|
+
const n = Pn(e.shape);
|
|
1834
1834
|
return {
|
|
1835
1835
|
...e,
|
|
1836
1836
|
keys: t,
|
|
@@ -1839,8 +1839,8 @@ function Bt(e) {
|
|
|
1839
1839
|
optionalKeys: new Set(n)
|
|
1840
1840
|
};
|
|
1841
1841
|
}
|
|
1842
|
-
function
|
|
1843
|
-
const c = [], l = i.keySet,
|
|
1842
|
+
function Bt(e, t, n, o, i, a) {
|
|
1843
|
+
const c = [], l = i.keySet, p = i.catchall._zod, f = p.def.type;
|
|
1844
1844
|
for (const y in t) {
|
|
1845
1845
|
if (l.has(y))
|
|
1846
1846
|
continue;
|
|
@@ -1848,8 +1848,8 @@ function Gt(e, t, n, o, i, a) {
|
|
|
1848
1848
|
c.push(y);
|
|
1849
1849
|
continue;
|
|
1850
1850
|
}
|
|
1851
|
-
const g =
|
|
1852
|
-
g instanceof Promise ? e.push(g.then((r) =>
|
|
1851
|
+
const g = p.run({ value: t[y], issues: [] }, o);
|
|
1852
|
+
g instanceof Promise ? e.push(g.then((r) => he(r, n, y, t))) : he(g, n, y, t);
|
|
1853
1853
|
}
|
|
1854
1854
|
return c.length && n.issues.push({
|
|
1855
1855
|
code: "unrecognized_keys",
|
|
@@ -1858,34 +1858,34 @@ function Gt(e, t, n, o, i, a) {
|
|
|
1858
1858
|
inst: a
|
|
1859
1859
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1860
1860
|
}
|
|
1861
|
-
const
|
|
1862
|
-
if (
|
|
1861
|
+
const vr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
1862
|
+
if (S.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1863
1863
|
const l = t.shape;
|
|
1864
1864
|
Object.defineProperty(t, "shape", {
|
|
1865
1865
|
get: () => {
|
|
1866
|
-
const
|
|
1866
|
+
const p = { ...l };
|
|
1867
1867
|
return Object.defineProperty(t, "shape", {
|
|
1868
|
-
value:
|
|
1869
|
-
}),
|
|
1868
|
+
value: p
|
|
1869
|
+
}), p;
|
|
1870
1870
|
}
|
|
1871
1871
|
});
|
|
1872
1872
|
}
|
|
1873
|
-
const o =
|
|
1873
|
+
const o = xe(() => Vt(t));
|
|
1874
1874
|
C(e._zod, "propValues", () => {
|
|
1875
|
-
const l = t.shape,
|
|
1875
|
+
const l = t.shape, p = {};
|
|
1876
1876
|
for (const f in l) {
|
|
1877
1877
|
const y = l[f]._zod;
|
|
1878
1878
|
if (y.values) {
|
|
1879
|
-
|
|
1879
|
+
p[f] ?? (p[f] = /* @__PURE__ */ new Set());
|
|
1880
1880
|
for (const g of y.values)
|
|
1881
|
-
|
|
1881
|
+
p[f].add(g);
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
|
-
return
|
|
1884
|
+
return p;
|
|
1885
1885
|
});
|
|
1886
|
-
const i =
|
|
1886
|
+
const i = pe, a = t.catchall;
|
|
1887
1887
|
let c;
|
|
1888
|
-
e._zod.parse = (l,
|
|
1888
|
+
e._zod.parse = (l, p) => {
|
|
1889
1889
|
c ?? (c = o.value);
|
|
1890
1890
|
const f = l.value;
|
|
1891
1891
|
if (!i(f))
|
|
@@ -1898,16 +1898,16 @@ const gr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1898
1898
|
l.value = {};
|
|
1899
1899
|
const y = [], g = c.shape;
|
|
1900
1900
|
for (const r of c.keys) {
|
|
1901
|
-
const u = g[r]._zod.run({ value: f[r], issues: [] },
|
|
1902
|
-
u instanceof Promise ? y.push(u.then((
|
|
1901
|
+
const u = g[r]._zod.run({ value: f[r], issues: [] }, p);
|
|
1902
|
+
u instanceof Promise ? y.push(u.then((d) => he(d, l, r, f))) : he(u, l, r, f);
|
|
1903
1903
|
}
|
|
1904
|
-
return a ?
|
|
1904
|
+
return a ? Bt(y, f, l, p, o.value, e) : y.length ? Promise.all(y).then(() => l) : l;
|
|
1905
1905
|
};
|
|
1906
|
-
}),
|
|
1907
|
-
|
|
1908
|
-
const n = e._zod.parse, o =
|
|
1909
|
-
const s = new
|
|
1910
|
-
const E =
|
|
1906
|
+
}), gr = /* @__PURE__ */ m("$ZodObjectJIT", (e, t) => {
|
|
1907
|
+
vr.init(e, t);
|
|
1908
|
+
const n = e._zod.parse, o = xe(() => Vt(t)), i = (r) => {
|
|
1909
|
+
const s = new Do(["shape", "payload", "ctx"]), u = o.value, d = (w) => {
|
|
1910
|
+
const E = Je(w);
|
|
1911
1911
|
return `shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`;
|
|
1912
1912
|
};
|
|
1913
1913
|
s.write("const input = payload.value;");
|
|
@@ -1917,8 +1917,8 @@ const gr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1917
1917
|
h[w] = `key_${v++}`;
|
|
1918
1918
|
s.write("const newResult = {};");
|
|
1919
1919
|
for (const w of u.keys) {
|
|
1920
|
-
const E = h[w], k =
|
|
1921
|
-
s.write(`const ${E} = ${
|
|
1920
|
+
const E = h[w], k = Je(w);
|
|
1921
|
+
s.write(`const ${E} = ${d(w)};`), s.write(`
|
|
1922
1922
|
if (${E}.issues.length) {
|
|
1923
1923
|
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
1924
1924
|
...iss,
|
|
@@ -1942,12 +1942,12 @@ const gr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1942
1942
|
return (w, E) => _(r, w, E);
|
|
1943
1943
|
};
|
|
1944
1944
|
let a;
|
|
1945
|
-
const c =
|
|
1945
|
+
const c = pe, l = !It.jitless, f = l && $n.value, y = t.catchall;
|
|
1946
1946
|
let g;
|
|
1947
1947
|
e._zod.parse = (r, s) => {
|
|
1948
1948
|
g ?? (g = o.value);
|
|
1949
1949
|
const u = r.value;
|
|
1950
|
-
return c(u) ? l && f && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ?
|
|
1950
|
+
return c(u) ? l && f && s?.async === !1 && s.jitless !== !0 ? (a || (a = i(t.shape)), r = a(r, s), y ? Bt([], u, r, s, g, e) : r) : n(r, s) : (r.issues.push({
|
|
1951
1951
|
expected: "object",
|
|
1952
1952
|
code: "invalid_type",
|
|
1953
1953
|
input: u,
|
|
@@ -1955,7 +1955,7 @@ const gr = /* @__PURE__ */ m("$ZodObject", (e, t) => {
|
|
|
1955
1955
|
}), r);
|
|
1956
1956
|
};
|
|
1957
1957
|
});
|
|
1958
|
-
function
|
|
1958
|
+
function Xe(e, t, n, o) {
|
|
1959
1959
|
for (const a of e)
|
|
1960
1960
|
if (a.issues.length === 0)
|
|
1961
1961
|
return t.value = a.value, t;
|
|
@@ -1964,17 +1964,17 @@ function et(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((c) =>
|
|
1967
|
+
errors: e.map((a) => a.issues.map((c) => j(c, o, N())))
|
|
1968
1968
|
}), t);
|
|
1969
1969
|
}
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1970
|
+
const yr = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
1971
|
+
S.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", () => {
|
|
1975
1975
|
if (t.options.every((i) => i._zod.pattern)) {
|
|
1976
1976
|
const i = t.options.map((a) => a._zod.pattern);
|
|
1977
|
-
return new RegExp(`^(${i.map((a) =>
|
|
1977
|
+
return new RegExp(`^(${i.map((a) => Re(a.source)).join("|")})$`);
|
|
1978
1978
|
}
|
|
1979
1979
|
});
|
|
1980
1980
|
const n = t.options.length === 1, o = t.options[0]._zod.run;
|
|
@@ -1983,8 +1983,8 @@ const br = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1983
1983
|
return o(i, a);
|
|
1984
1984
|
let c = !1;
|
|
1985
1985
|
const l = [];
|
|
1986
|
-
for (const
|
|
1987
|
-
const f =
|
|
1986
|
+
for (const p of t.options) {
|
|
1987
|
+
const f = p._zod.run({
|
|
1988
1988
|
value: i.value,
|
|
1989
1989
|
issues: []
|
|
1990
1990
|
}, a);
|
|
@@ -1996,15 +1996,15 @@ const br = /* @__PURE__ */ m("$ZodUnion", (e, t) => {
|
|
|
1996
1996
|
l.push(f);
|
|
1997
1997
|
}
|
|
1998
1998
|
}
|
|
1999
|
-
return c ? Promise.all(l).then((
|
|
1999
|
+
return c ? Promise.all(l).then((p) => Xe(p, i, e, a)) : Xe(l, i, e, a);
|
|
2000
2000
|
};
|
|
2001
|
-
}),
|
|
2002
|
-
|
|
2001
|
+
}), br = /* @__PURE__ */ m("$ZodIntersection", (e, t) => {
|
|
2002
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
2003
2003
|
const i = n.value, a = t.left._zod.run({ value: i, issues: [] }, o), c = t.right._zod.run({ value: i, issues: [] }, o);
|
|
2004
|
-
return a instanceof Promise || c instanceof Promise ? Promise.all([a, c]).then(([
|
|
2004
|
+
return a instanceof Promise || c instanceof Promise ? Promise.all([a, c]).then(([p, f]) => et(n, p, f)) : et(n, a, c);
|
|
2005
2005
|
};
|
|
2006
2006
|
});
|
|
2007
|
-
function
|
|
2007
|
+
function $e(e, t) {
|
|
2008
2008
|
if (e === t)
|
|
2009
2009
|
return { valid: !0, data: e };
|
|
2010
2010
|
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
@@ -2012,7 +2012,7 @@ function Pe(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 c =
|
|
2015
|
+
const c = $e(e[a], t[a]);
|
|
2016
2016
|
if (!c.valid)
|
|
2017
2017
|
return {
|
|
2018
2018
|
valid: !1,
|
|
@@ -2027,7 +2027,7 @@ function Pe(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], c =
|
|
2030
|
+
const i = e[o], a = t[o], c = $e(i, a);
|
|
2031
2031
|
if (!c.valid)
|
|
2032
2032
|
return {
|
|
2033
2033
|
valid: !1,
|
|
@@ -2039,16 +2039,16 @@ function Pe(e, t) {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
return { valid: !1, mergeErrorPath: [] };
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2042
|
+
function et(e, t, n) {
|
|
2043
2043
|
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), q(e))
|
|
2044
2044
|
return e;
|
|
2045
|
-
const o =
|
|
2045
|
+
const o = $e(t.value, n.value);
|
|
2046
2046
|
if (!o.valid)
|
|
2047
2047
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
|
|
2048
2048
|
return e.value = o.data, e;
|
|
2049
2049
|
}
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2050
|
+
const wr = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
2051
|
+
S.init(e, t);
|
|
2052
2052
|
const n = t.items;
|
|
2053
2053
|
e._zod.parse = (o, i) => {
|
|
2054
2054
|
const a = o.value;
|
|
@@ -2060,9 +2060,9 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2060
2060
|
code: "invalid_type"
|
|
2061
2061
|
}), o;
|
|
2062
2062
|
o.value = [];
|
|
2063
|
-
const c = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"),
|
|
2063
|
+
const c = [], l = [...n].reverse().findIndex((y) => y._zod.optin !== "optional"), p = l === -1 ? 0 : n.length - l;
|
|
2064
2064
|
if (!t.rest) {
|
|
2065
|
-
const y = a.length > n.length, g = a.length <
|
|
2065
|
+
const y = a.length > n.length, g = a.length < p - 1;
|
|
2066
2066
|
if (y || g)
|
|
2067
2067
|
return o.issues.push({
|
|
2068
2068
|
...y ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
|
|
@@ -2073,13 +2073,13 @@ const Er = /* @__PURE__ */ m("$ZodTuple", (e, t) => {
|
|
|
2073
2073
|
}
|
|
2074
2074
|
let f = -1;
|
|
2075
2075
|
for (const y of n) {
|
|
2076
|
-
if (f++, f >= a.length && f >=
|
|
2076
|
+
if (f++, f >= a.length && f >= p)
|
|
2077
2077
|
continue;
|
|
2078
2078
|
const g = y._zod.run({
|
|
2079
2079
|
value: a[f],
|
|
2080
2080
|
issues: []
|
|
2081
2081
|
}, i);
|
|
2082
|
-
g instanceof Promise ? c.push(g.then((r) =>
|
|
2082
|
+
g instanceof Promise ? c.push(g.then((r) => ae(r, o, f))) : ae(g, o, f);
|
|
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 ? c.push(r.then((s) =>
|
|
2092
|
+
r instanceof Promise ? c.push(r.then((s) => ae(s, o, f))) : ae(r, o, f);
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
2095
|
return c.length ? Promise.all(c).then(() => o) : o;
|
|
2096
2096
|
};
|
|
2097
2097
|
});
|
|
2098
|
-
function
|
|
2099
|
-
e.issues.length && t.issues.push(...
|
|
2098
|
+
function ae(e, t, n) {
|
|
2099
|
+
e.issues.length && t.issues.push(...U(n, e.issues)), t.value[n] = e.value;
|
|
2100
2100
|
}
|
|
2101
|
-
const
|
|
2102
|
-
|
|
2101
|
+
const Er = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
2102
|
+
S.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({
|
|
@@ -2117,49 +2117,49 @@ const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2117
2117
|
l.add(typeof f == "number" ? f.toString() : f);
|
|
2118
2118
|
const y = t.valueType._zod.run({ value: i[f], issues: [] }, o);
|
|
2119
2119
|
y instanceof Promise ? a.push(y.then((g) => {
|
|
2120
|
-
g.issues.length && n.issues.push(...
|
|
2121
|
-
})) : (y.issues.length && n.issues.push(...
|
|
2120
|
+
g.issues.length && n.issues.push(...U(f, g.issues)), n.value[f] = g.value;
|
|
2121
|
+
})) : (y.issues.length && n.issues.push(...U(f, y.issues)), n.value[f] = y.value);
|
|
2122
2122
|
}
|
|
2123
|
-
let
|
|
2123
|
+
let p;
|
|
2124
2124
|
for (const f in i)
|
|
2125
|
-
l.has(f) || (
|
|
2126
|
-
|
|
2125
|
+
l.has(f) || (p = p ?? [], p.push(f));
|
|
2126
|
+
p && p.length > 0 && n.issues.push({
|
|
2127
2127
|
code: "unrecognized_keys",
|
|
2128
2128
|
input: i,
|
|
2129
2129
|
inst: e,
|
|
2130
|
-
keys:
|
|
2130
|
+
keys: p
|
|
2131
2131
|
});
|
|
2132
2132
|
} else {
|
|
2133
2133
|
n.value = {};
|
|
2134
2134
|
for (const l of Reflect.ownKeys(i)) {
|
|
2135
2135
|
if (l === "__proto__")
|
|
2136
2136
|
continue;
|
|
2137
|
-
const
|
|
2138
|
-
if (
|
|
2137
|
+
const p = t.keyType._zod.run({ value: l, issues: [] }, o);
|
|
2138
|
+
if (p instanceof Promise)
|
|
2139
2139
|
throw new Error("Async schemas not supported in object keys currently");
|
|
2140
|
-
if (
|
|
2140
|
+
if (p.issues.length) {
|
|
2141
2141
|
n.issues.push({
|
|
2142
2142
|
code: "invalid_key",
|
|
2143
2143
|
origin: "record",
|
|
2144
|
-
issues:
|
|
2144
|
+
issues: p.issues.map((y) => j(y, o, N())),
|
|
2145
2145
|
input: l,
|
|
2146
2146
|
path: [l],
|
|
2147
2147
|
inst: e
|
|
2148
|
-
}), n.value[
|
|
2148
|
+
}), n.value[p.value] = p.value;
|
|
2149
2149
|
continue;
|
|
2150
2150
|
}
|
|
2151
2151
|
const f = t.valueType._zod.run({ value: i[l], issues: [] }, o);
|
|
2152
2152
|
f instanceof Promise ? a.push(f.then((y) => {
|
|
2153
|
-
y.issues.length && n.issues.push(...
|
|
2154
|
-
})) : (f.issues.length && n.issues.push(...
|
|
2153
|
+
y.issues.length && n.issues.push(...U(l, y.issues)), n.value[p.value] = y.value;
|
|
2154
|
+
})) : (f.issues.length && n.issues.push(...U(l, f.issues)), n.value[p.value] = f.value);
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
2157
|
return a.length ? Promise.all(a).then(() => n) : n;
|
|
2158
2158
|
};
|
|
2159
|
-
}),
|
|
2160
|
-
|
|
2161
|
-
const n =
|
|
2162
|
-
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) =>
|
|
2159
|
+
}), kr = /* @__PURE__ */ m("$ZodEnum", (e, t) => {
|
|
2160
|
+
S.init(e, t);
|
|
2161
|
+
const n = zn(t.entries), o = new Set(n);
|
|
2162
|
+
e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((i) => Zn.has(typeof i)).map((i) => typeof i == "string" ? J(i) : i.toString()).join("|")})$`), e._zod.parse = (i, a) => {
|
|
2163
2163
|
const c = i.value;
|
|
2164
2164
|
return o.has(c) || i.issues.push({
|
|
2165
2165
|
code: "invalid_value",
|
|
@@ -2168,8 +2168,8 @@ const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2168
2168
|
inst: e
|
|
2169
2169
|
}), i;
|
|
2170
2170
|
};
|
|
2171
|
-
}),
|
|
2172
|
-
if (
|
|
2171
|
+
}), Cr = /* @__PURE__ */ m("$ZodLiteral", (e, t) => {
|
|
2172
|
+
if (S.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) => {
|
|
@@ -2181,10 +2181,10 @@ const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2181
2181
|
inst: e
|
|
2182
2182
|
}), o;
|
|
2183
2183
|
};
|
|
2184
|
-
}),
|
|
2185
|
-
|
|
2184
|
+
}), Sr = /* @__PURE__ */ m("$ZodTransform", (e, t) => {
|
|
2185
|
+
S.init(e, t), e._zod.parse = (n, o) => {
|
|
2186
2186
|
if (o.direction === "backward")
|
|
2187
|
-
throw new
|
|
2187
|
+
throw new zt(e.constructor.name);
|
|
2188
2188
|
const i = t.transform(n.value, n);
|
|
2189
2189
|
if (o.async)
|
|
2190
2190
|
return (i instanceof Promise ? i : Promise.resolve(i)).then((c) => (n.value = c, n));
|
|
@@ -2193,50 +2193,50 @@ const kr = /* @__PURE__ */ m("$ZodRecord", (e, t) => {
|
|
|
2193
2193
|
return n.value = i, n;
|
|
2194
2194
|
};
|
|
2195
2195
|
});
|
|
2196
|
-
function
|
|
2196
|
+
function tt(e, t) {
|
|
2197
2197
|
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
2198
2198
|
}
|
|
2199
|
-
const
|
|
2200
|
-
|
|
2199
|
+
const Ar = /* @__PURE__ */ m("$ZodOptional", (e, t) => {
|
|
2200
|
+
S.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
|
-
return n ? new RegExp(`^(${
|
|
2202
|
+
return n ? new RegExp(`^(${Re(n.source)})?$`) : void 0;
|
|
2203
2203
|
}), e._zod.parse = (n, o) => {
|
|
2204
2204
|
if (t.innerType._zod.optin === "optional") {
|
|
2205
2205
|
const i = t.innerType._zod.run(n, o);
|
|
2206
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2206
|
+
return i instanceof Promise ? i.then((a) => tt(a, n.value)) : tt(i, n.value);
|
|
2207
2207
|
}
|
|
2208
2208
|
return n.value === void 0 ? n : t.innerType._zod.run(n, o);
|
|
2209
2209
|
};
|
|
2210
|
-
}),
|
|
2211
|
-
|
|
2210
|
+
}), Tr = /* @__PURE__ */ m("$ZodNullable", (e, t) => {
|
|
2211
|
+
S.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
|
-
return n ? new RegExp(`^(${
|
|
2213
|
+
return n ? new RegExp(`^(${Re(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
|
-
}),
|
|
2216
|
-
|
|
2215
|
+
}), zr = /* @__PURE__ */ m("$ZodDefault", (e, t) => {
|
|
2216
|
+
S.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)
|
|
2220
2220
|
return n.value = t.defaultValue, n;
|
|
2221
2221
|
const i = t.innerType._zod.run(n, o);
|
|
2222
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2222
|
+
return i instanceof Promise ? i.then((a) => nt(a, t)) : nt(i, t);
|
|
2223
2223
|
};
|
|
2224
2224
|
});
|
|
2225
|
-
function
|
|
2225
|
+
function nt(e, t) {
|
|
2226
2226
|
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2227
2227
|
}
|
|
2228
|
-
const
|
|
2229
|
-
|
|
2228
|
+
const Ir = /* @__PURE__ */ m("$ZodPrefault", (e, t) => {
|
|
2229
|
+
S.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
|
}), Or = /* @__PURE__ */ m("$ZodNonOptional", (e, t) => {
|
|
2231
|
-
|
|
2231
|
+
S.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) => {
|
|
2235
2235
|
const i = t.innerType._zod.run(n, o);
|
|
2236
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2236
|
+
return i instanceof Promise ? i.then((a) => ot(a, e)) : ot(i, e);
|
|
2237
2237
|
};
|
|
2238
2238
|
});
|
|
2239
|
-
function
|
|
2239
|
+
function ot(e, t) {
|
|
2240
2240
|
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
2241
2241
|
code: "invalid_type",
|
|
2242
2242
|
expected: "nonoptional",
|
|
@@ -2244,58 +2244,58 @@ function rt(e, t) {
|
|
|
2244
2244
|
inst: t
|
|
2245
2245
|
}), e;
|
|
2246
2246
|
}
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2247
|
+
const $r = /* @__PURE__ */ m("$ZodCatch", (e, t) => {
|
|
2248
|
+
S.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((c) =>
|
|
2255
|
+
issues: a.issues.map((c) => j(c, o, N()))
|
|
2256
2256
|
},
|
|
2257
2257
|
input: n.value
|
|
2258
2258
|
}), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
2259
2259
|
...n,
|
|
2260
2260
|
error: {
|
|
2261
|
-
issues: i.issues.map((a) =>
|
|
2261
|
+
issues: i.issues.map((a) => j(a, o, N()))
|
|
2262
2262
|
},
|
|
2263
2263
|
input: n.value
|
|
2264
2264
|
}), n.issues = []), n);
|
|
2265
2265
|
};
|
|
2266
|
-
}),
|
|
2267
|
-
|
|
2266
|
+
}), Zr = /* @__PURE__ */ m("$ZodPipe", (e, t) => {
|
|
2267
|
+
S.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((c) =>
|
|
2270
|
+
return a instanceof Promise ? a.then((c) => ue(c, t.in, o)) : ue(a, t.in, o);
|
|
2271
2271
|
}
|
|
2272
2272
|
const i = t.in._zod.run(n, o);
|
|
2273
|
-
return i instanceof Promise ? i.then((a) =>
|
|
2273
|
+
return i instanceof Promise ? i.then((a) => ue(a, t.out, o)) : ue(i, t.out, o);
|
|
2274
2274
|
};
|
|
2275
2275
|
});
|
|
2276
|
-
function
|
|
2276
|
+
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
|
-
const
|
|
2280
|
-
|
|
2279
|
+
const Pr = /* @__PURE__ */ m("$ZodReadonly", (e, t) => {
|
|
2280
|
+
S.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);
|
|
2284
|
-
return i instanceof Promise ? i.then(
|
|
2284
|
+
return i instanceof Promise ? i.then(rt) : rt(i);
|
|
2285
2285
|
};
|
|
2286
2286
|
});
|
|
2287
|
-
function
|
|
2287
|
+
function rt(e) {
|
|
2288
2288
|
return e.value = Object.freeze(e.value), e;
|
|
2289
2289
|
}
|
|
2290
|
-
const
|
|
2291
|
-
|
|
2290
|
+
const xr = /* @__PURE__ */ m("$ZodCustom", (e, t) => {
|
|
2291
|
+
$.init(e, t), S.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
|
-
return i.then((a) =>
|
|
2295
|
-
|
|
2294
|
+
return i.then((a) => it(a, n, o, e));
|
|
2295
|
+
it(i, n, o, e);
|
|
2296
2296
|
};
|
|
2297
2297
|
});
|
|
2298
|
-
function
|
|
2298
|
+
function it(e, t, n, o) {
|
|
2299
2299
|
if (!e) {
|
|
2300
2300
|
const i = {
|
|
2301
2301
|
code: "custom",
|
|
@@ -2307,11 +2307,11 @@ function st(e, t, n, o) {
|
|
|
2307
2307
|
continue: !o._zod.def.abort
|
|
2308
2308
|
// params: inst._zod.def.params,
|
|
2309
2309
|
};
|
|
2310
|
-
o._zod.def.params && (i.params = o._zod.def.params), t.issues.push(
|
|
2310
|
+
o._zod.def.params && (i.params = o._zod.def.params), t.issues.push(re(i));
|
|
2311
2311
|
}
|
|
2312
2312
|
}
|
|
2313
|
-
var
|
|
2314
|
-
class
|
|
2313
|
+
var st;
|
|
2314
|
+
class Lr {
|
|
2315
2315
|
constructor() {
|
|
2316
2316
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2317
2317
|
}
|
|
@@ -2345,18 +2345,18 @@ class Rr {
|
|
|
2345
2345
|
return this._map.has(t);
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
2348
|
-
function
|
|
2349
|
-
return new
|
|
2348
|
+
function Rr() {
|
|
2349
|
+
return new Lr();
|
|
2350
2350
|
}
|
|
2351
|
-
(
|
|
2352
|
-
const
|
|
2351
|
+
(st = globalThis).__zod_globalRegistry ?? (st.__zod_globalRegistry = Rr());
|
|
2352
|
+
const ce = globalThis.__zod_globalRegistry;
|
|
2353
2353
|
function Nr(e, t) {
|
|
2354
2354
|
return new e({
|
|
2355
2355
|
type: "string",
|
|
2356
2356
|
...b(t)
|
|
2357
2357
|
});
|
|
2358
2358
|
}
|
|
2359
|
-
function
|
|
2359
|
+
function jr(e, t) {
|
|
2360
2360
|
return new e({
|
|
2361
2361
|
type: "string",
|
|
2362
2362
|
format: "email",
|
|
@@ -2365,7 +2365,7 @@ function Dr(e, t) {
|
|
|
2365
2365
|
...b(t)
|
|
2366
2366
|
});
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function at(e, t) {
|
|
2369
2369
|
return new e({
|
|
2370
2370
|
type: "string",
|
|
2371
2371
|
format: "guid",
|
|
@@ -2374,7 +2374,7 @@ function ut(e, t) {
|
|
|
2374
2374
|
...b(t)
|
|
2375
2375
|
});
|
|
2376
2376
|
}
|
|
2377
|
-
function
|
|
2377
|
+
function Dr(e, t) {
|
|
2378
2378
|
return new e({
|
|
2379
2379
|
type: "string",
|
|
2380
2380
|
format: "uuid",
|
|
@@ -2383,7 +2383,7 @@ function Ur(e, t) {
|
|
|
2383
2383
|
...b(t)
|
|
2384
2384
|
});
|
|
2385
2385
|
}
|
|
2386
|
-
function
|
|
2386
|
+
function Mr(e, t) {
|
|
2387
2387
|
return new e({
|
|
2388
2388
|
type: "string",
|
|
2389
2389
|
format: "uuid",
|
|
@@ -2393,7 +2393,7 @@ function Fr(e, t) {
|
|
|
2393
2393
|
...b(t)
|
|
2394
2394
|
});
|
|
2395
2395
|
}
|
|
2396
|
-
function
|
|
2396
|
+
function Fr(e, t) {
|
|
2397
2397
|
return new e({
|
|
2398
2398
|
type: "string",
|
|
2399
2399
|
format: "uuid",
|
|
@@ -2403,7 +2403,7 @@ function Mr(e, t) {
|
|
|
2403
2403
|
...b(t)
|
|
2404
2404
|
});
|
|
2405
2405
|
}
|
|
2406
|
-
function
|
|
2406
|
+
function Ur(e, t) {
|
|
2407
2407
|
return new e({
|
|
2408
2408
|
type: "string",
|
|
2409
2409
|
format: "uuid",
|
|
@@ -2413,7 +2413,7 @@ function Vr(e, t) {
|
|
|
2413
2413
|
...b(t)
|
|
2414
2414
|
});
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function Vr(e, t) {
|
|
2417
2417
|
return new e({
|
|
2418
2418
|
type: "string",
|
|
2419
2419
|
format: "url",
|
|
@@ -2422,7 +2422,7 @@ function Br(e, t) {
|
|
|
2422
2422
|
...b(t)
|
|
2423
2423
|
});
|
|
2424
2424
|
}
|
|
2425
|
-
function
|
|
2425
|
+
function Br(e, t) {
|
|
2426
2426
|
return new e({
|
|
2427
2427
|
type: "string",
|
|
2428
2428
|
format: "emoji",
|
|
@@ -2431,7 +2431,7 @@ function Gr(e, t) {
|
|
|
2431
2431
|
...b(t)
|
|
2432
2432
|
});
|
|
2433
2433
|
}
|
|
2434
|
-
function
|
|
2434
|
+
function Gr(e, t) {
|
|
2435
2435
|
return new e({
|
|
2436
2436
|
type: "string",
|
|
2437
2437
|
format: "nanoid",
|
|
@@ -2440,7 +2440,7 @@ function Wr(e, t) {
|
|
|
2440
2440
|
...b(t)
|
|
2441
2441
|
});
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function Wr(e, t) {
|
|
2444
2444
|
return new e({
|
|
2445
2445
|
type: "string",
|
|
2446
2446
|
format: "cuid",
|
|
@@ -2449,7 +2449,7 @@ function qr(e, t) {
|
|
|
2449
2449
|
...b(t)
|
|
2450
2450
|
});
|
|
2451
2451
|
}
|
|
2452
|
-
function
|
|
2452
|
+
function qr(e, t) {
|
|
2453
2453
|
return new e({
|
|
2454
2454
|
type: "string",
|
|
2455
2455
|
format: "cuid2",
|
|
@@ -2458,7 +2458,7 @@ function Kr(e, t) {
|
|
|
2458
2458
|
...b(t)
|
|
2459
2459
|
});
|
|
2460
2460
|
}
|
|
2461
|
-
function
|
|
2461
|
+
function Kr(e, t) {
|
|
2462
2462
|
return new e({
|
|
2463
2463
|
type: "string",
|
|
2464
2464
|
format: "ulid",
|
|
@@ -2467,7 +2467,7 @@ function Hr(e, t) {
|
|
|
2467
2467
|
...b(t)
|
|
2468
2468
|
});
|
|
2469
2469
|
}
|
|
2470
|
-
function
|
|
2470
|
+
function Hr(e, t) {
|
|
2471
2471
|
return new e({
|
|
2472
2472
|
type: "string",
|
|
2473
2473
|
format: "xid",
|
|
@@ -2476,7 +2476,7 @@ function Jr(e, t) {
|
|
|
2476
2476
|
...b(t)
|
|
2477
2477
|
});
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function Jr(e, t) {
|
|
2480
2480
|
return new e({
|
|
2481
2481
|
type: "string",
|
|
2482
2482
|
format: "ksuid",
|
|
@@ -2485,7 +2485,7 @@ function Yr(e, t) {
|
|
|
2485
2485
|
...b(t)
|
|
2486
2486
|
});
|
|
2487
2487
|
}
|
|
2488
|
-
function
|
|
2488
|
+
function Yr(e, t) {
|
|
2489
2489
|
return new e({
|
|
2490
2490
|
type: "string",
|
|
2491
2491
|
format: "ipv4",
|
|
@@ -2494,7 +2494,7 @@ function Qr(e, t) {
|
|
|
2494
2494
|
...b(t)
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
|
-
function
|
|
2497
|
+
function Qr(e, t) {
|
|
2498
2498
|
return new e({
|
|
2499
2499
|
type: "string",
|
|
2500
2500
|
format: "ipv6",
|
|
@@ -2503,7 +2503,7 @@ function Xr(e, t) {
|
|
|
2503
2503
|
...b(t)
|
|
2504
2504
|
});
|
|
2505
2505
|
}
|
|
2506
|
-
function
|
|
2506
|
+
function Xr(e, t) {
|
|
2507
2507
|
return new e({
|
|
2508
2508
|
type: "string",
|
|
2509
2509
|
format: "cidrv4",
|
|
@@ -2512,7 +2512,7 @@ function ei(e, t) {
|
|
|
2512
2512
|
...b(t)
|
|
2513
2513
|
});
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2515
|
+
function ei(e, t) {
|
|
2516
2516
|
return new e({
|
|
2517
2517
|
type: "string",
|
|
2518
2518
|
format: "cidrv6",
|
|
@@ -2521,7 +2521,7 @@ function ti(e, t) {
|
|
|
2521
2521
|
...b(t)
|
|
2522
2522
|
});
|
|
2523
2523
|
}
|
|
2524
|
-
function
|
|
2524
|
+
function ti(e, t) {
|
|
2525
2525
|
return new e({
|
|
2526
2526
|
type: "string",
|
|
2527
2527
|
format: "base64",
|
|
@@ -2530,7 +2530,7 @@ function ni(e, t) {
|
|
|
2530
2530
|
...b(t)
|
|
2531
2531
|
});
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2533
|
+
function ni(e, t) {
|
|
2534
2534
|
return new e({
|
|
2535
2535
|
type: "string",
|
|
2536
2536
|
format: "base64url",
|
|
@@ -2539,7 +2539,7 @@ function oi(e, t) {
|
|
|
2539
2539
|
...b(t)
|
|
2540
2540
|
});
|
|
2541
2541
|
}
|
|
2542
|
-
function
|
|
2542
|
+
function oi(e, t) {
|
|
2543
2543
|
return new e({
|
|
2544
2544
|
type: "string",
|
|
2545
2545
|
format: "e164",
|
|
@@ -2548,7 +2548,7 @@ function ri(e, t) {
|
|
|
2548
2548
|
...b(t)
|
|
2549
2549
|
});
|
|
2550
2550
|
}
|
|
2551
|
-
function
|
|
2551
|
+
function ri(e, t) {
|
|
2552
2552
|
return new e({
|
|
2553
2553
|
type: "string",
|
|
2554
2554
|
format: "jwt",
|
|
@@ -2557,7 +2557,7 @@ function ii(e, t) {
|
|
|
2557
2557
|
...b(t)
|
|
2558
2558
|
});
|
|
2559
2559
|
}
|
|
2560
|
-
function
|
|
2560
|
+
function ii(e, t) {
|
|
2561
2561
|
return new e({
|
|
2562
2562
|
type: "string",
|
|
2563
2563
|
format: "datetime",
|
|
@@ -2568,7 +2568,7 @@ function si(e, t) {
|
|
|
2568
2568
|
...b(t)
|
|
2569
2569
|
});
|
|
2570
2570
|
}
|
|
2571
|
-
function
|
|
2571
|
+
function si(e, t) {
|
|
2572
2572
|
return new e({
|
|
2573
2573
|
type: "string",
|
|
2574
2574
|
format: "date",
|
|
@@ -2576,7 +2576,7 @@ function ai(e, t) {
|
|
|
2576
2576
|
...b(t)
|
|
2577
2577
|
});
|
|
2578
2578
|
}
|
|
2579
|
-
function
|
|
2579
|
+
function ai(e, t) {
|
|
2580
2580
|
return new e({
|
|
2581
2581
|
type: "string",
|
|
2582
2582
|
format: "time",
|
|
@@ -2585,7 +2585,7 @@ function ui(e, t) {
|
|
|
2585
2585
|
...b(t)
|
|
2586
2586
|
});
|
|
2587
2587
|
}
|
|
2588
|
-
function
|
|
2588
|
+
function ui(e, t) {
|
|
2589
2589
|
return new e({
|
|
2590
2590
|
type: "string",
|
|
2591
2591
|
format: "duration",
|
|
@@ -2593,14 +2593,14 @@ function ci(e, t) {
|
|
|
2593
2593
|
...b(t)
|
|
2594
2594
|
});
|
|
2595
2595
|
}
|
|
2596
|
-
function
|
|
2596
|
+
function ci(e, t) {
|
|
2597
2597
|
return new e({
|
|
2598
2598
|
type: "number",
|
|
2599
2599
|
checks: [],
|
|
2600
2600
|
...b(t)
|
|
2601
2601
|
});
|
|
2602
2602
|
}
|
|
2603
|
-
function
|
|
2603
|
+
function li(e, t) {
|
|
2604
2604
|
return new e({
|
|
2605
2605
|
type: "number",
|
|
2606
2606
|
check: "number_format",
|
|
@@ -2609,122 +2609,122 @@ function di(e, t) {
|
|
|
2609
2609
|
...b(t)
|
|
2610
2610
|
});
|
|
2611
2611
|
}
|
|
2612
|
-
function
|
|
2612
|
+
function di(e, t) {
|
|
2613
2613
|
return new e({
|
|
2614
2614
|
type: "null",
|
|
2615
2615
|
...b(t)
|
|
2616
2616
|
});
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function pi(e) {
|
|
2619
2619
|
return new e({
|
|
2620
2620
|
type: "unknown"
|
|
2621
2621
|
});
|
|
2622
2622
|
}
|
|
2623
|
-
function
|
|
2623
|
+
function hi(e, t) {
|
|
2624
2624
|
return new e({
|
|
2625
2625
|
type: "never",
|
|
2626
2626
|
...b(t)
|
|
2627
2627
|
});
|
|
2628
2628
|
}
|
|
2629
|
-
function
|
|
2630
|
-
return new
|
|
2629
|
+
function ut(e, t) {
|
|
2630
|
+
return new Dt({
|
|
2631
2631
|
check: "less_than",
|
|
2632
2632
|
...b(t),
|
|
2633
2633
|
value: e,
|
|
2634
2634
|
inclusive: !1
|
|
2635
2635
|
});
|
|
2636
2636
|
}
|
|
2637
|
-
function
|
|
2638
|
-
return new
|
|
2637
|
+
function ke(e, t) {
|
|
2638
|
+
return new Dt({
|
|
2639
2639
|
check: "less_than",
|
|
2640
2640
|
...b(t),
|
|
2641
2641
|
value: e,
|
|
2642
2642
|
inclusive: !0
|
|
2643
2643
|
});
|
|
2644
2644
|
}
|
|
2645
|
-
function
|
|
2646
|
-
return new
|
|
2645
|
+
function ct(e, t) {
|
|
2646
|
+
return new Mt({
|
|
2647
2647
|
check: "greater_than",
|
|
2648
2648
|
...b(t),
|
|
2649
2649
|
value: e,
|
|
2650
2650
|
inclusive: !1
|
|
2651
2651
|
});
|
|
2652
2652
|
}
|
|
2653
|
-
function
|
|
2654
|
-
return new
|
|
2653
|
+
function Ce(e, t) {
|
|
2654
|
+
return new Mt({
|
|
2655
2655
|
check: "greater_than",
|
|
2656
2656
|
...b(t),
|
|
2657
2657
|
value: e,
|
|
2658
2658
|
inclusive: !0
|
|
2659
2659
|
});
|
|
2660
2660
|
}
|
|
2661
|
-
function
|
|
2662
|
-
return new
|
|
2661
|
+
function lt(e, t) {
|
|
2662
|
+
return new To({
|
|
2663
2663
|
check: "multiple_of",
|
|
2664
2664
|
...b(t),
|
|
2665
2665
|
value: e
|
|
2666
2666
|
});
|
|
2667
2667
|
}
|
|
2668
|
-
function
|
|
2669
|
-
return new
|
|
2668
|
+
function Gt(e, t) {
|
|
2669
|
+
return new Io({
|
|
2670
2670
|
check: "max_length",
|
|
2671
2671
|
...b(t),
|
|
2672
2672
|
maximum: e
|
|
2673
2673
|
});
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2675
|
+
function fe(e, t) {
|
|
2676
2676
|
return new Oo({
|
|
2677
2677
|
check: "min_length",
|
|
2678
2678
|
...b(t),
|
|
2679
2679
|
minimum: e
|
|
2680
2680
|
});
|
|
2681
2681
|
}
|
|
2682
|
-
function
|
|
2683
|
-
return new
|
|
2682
|
+
function Wt(e, t) {
|
|
2683
|
+
return new $o({
|
|
2684
2684
|
check: "length_equals",
|
|
2685
2685
|
...b(t),
|
|
2686
2686
|
length: e
|
|
2687
2687
|
});
|
|
2688
2688
|
}
|
|
2689
|
-
function
|
|
2690
|
-
return new
|
|
2689
|
+
function fi(e, t) {
|
|
2690
|
+
return new Zo({
|
|
2691
2691
|
check: "string_format",
|
|
2692
2692
|
format: "regex",
|
|
2693
2693
|
...b(t),
|
|
2694
2694
|
pattern: e
|
|
2695
2695
|
});
|
|
2696
2696
|
}
|
|
2697
|
-
function
|
|
2698
|
-
return new
|
|
2697
|
+
function _i(e) {
|
|
2698
|
+
return new Po({
|
|
2699
2699
|
check: "string_format",
|
|
2700
2700
|
format: "lowercase",
|
|
2701
2701
|
...b(e)
|
|
2702
2702
|
});
|
|
2703
2703
|
}
|
|
2704
|
-
function
|
|
2705
|
-
return new
|
|
2704
|
+
function mi(e) {
|
|
2705
|
+
return new xo({
|
|
2706
2706
|
check: "string_format",
|
|
2707
2707
|
format: "uppercase",
|
|
2708
2708
|
...b(e)
|
|
2709
2709
|
});
|
|
2710
2710
|
}
|
|
2711
|
-
function
|
|
2712
|
-
return new
|
|
2711
|
+
function vi(e, t) {
|
|
2712
|
+
return new Lo({
|
|
2713
2713
|
check: "string_format",
|
|
2714
2714
|
format: "includes",
|
|
2715
2715
|
...b(t),
|
|
2716
2716
|
includes: e
|
|
2717
2717
|
});
|
|
2718
2718
|
}
|
|
2719
|
-
function
|
|
2720
|
-
return new
|
|
2719
|
+
function gi(e, t) {
|
|
2720
|
+
return new Ro({
|
|
2721
2721
|
check: "string_format",
|
|
2722
2722
|
format: "starts_with",
|
|
2723
2723
|
...b(t),
|
|
2724
2724
|
prefix: e
|
|
2725
2725
|
});
|
|
2726
2726
|
}
|
|
2727
|
-
function
|
|
2727
|
+
function yi(e, t) {
|
|
2728
2728
|
return new No({
|
|
2729
2729
|
check: "string_format",
|
|
2730
2730
|
format: "ends_with",
|
|
@@ -2733,27 +2733,27 @@ function bi(e, t) {
|
|
|
2733
2733
|
});
|
|
2734
2734
|
}
|
|
2735
2735
|
function ee(e) {
|
|
2736
|
-
return new
|
|
2736
|
+
return new jo({
|
|
2737
2737
|
check: "overwrite",
|
|
2738
2738
|
tx: e
|
|
2739
2739
|
});
|
|
2740
2740
|
}
|
|
2741
|
-
function
|
|
2741
|
+
function bi(e) {
|
|
2742
2742
|
return ee((t) => t.normalize(e));
|
|
2743
2743
|
}
|
|
2744
|
-
function
|
|
2744
|
+
function wi() {
|
|
2745
2745
|
return ee((e) => e.trim());
|
|
2746
2746
|
}
|
|
2747
|
-
function
|
|
2747
|
+
function Ei() {
|
|
2748
2748
|
return ee((e) => e.toLowerCase());
|
|
2749
2749
|
}
|
|
2750
|
-
function
|
|
2750
|
+
function ki() {
|
|
2751
2751
|
return ee((e) => e.toUpperCase());
|
|
2752
2752
|
}
|
|
2753
|
-
function
|
|
2753
|
+
function Ci() {
|
|
2754
2754
|
return ee((e) => On(e));
|
|
2755
2755
|
}
|
|
2756
|
-
function
|
|
2756
|
+
function Si(e, t, n) {
|
|
2757
2757
|
return new e({
|
|
2758
2758
|
type: "array",
|
|
2759
2759
|
element: t,
|
|
@@ -2763,7 +2763,7 @@ function Ti(e, t, n) {
|
|
|
2763
2763
|
...b(n)
|
|
2764
2764
|
});
|
|
2765
2765
|
}
|
|
2766
|
-
function
|
|
2766
|
+
function Ai(e, t, n) {
|
|
2767
2767
|
return new e({
|
|
2768
2768
|
type: "custom",
|
|
2769
2769
|
check: "custom",
|
|
@@ -2771,67 +2771,67 @@ function Si(e, t, n) {
|
|
|
2771
2771
|
...b(n)
|
|
2772
2772
|
});
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2775
|
-
const t =
|
|
2774
|
+
function Ti(e) {
|
|
2775
|
+
const t = zi((n) => (n.addIssue = (o) => {
|
|
2776
2776
|
if (typeof o == "string")
|
|
2777
|
-
n.issues.push(
|
|
2777
|
+
n.issues.push(re(o, n.value, t._zod.def));
|
|
2778
2778
|
else {
|
|
2779
2779
|
const i = o;
|
|
2780
|
-
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = t), i.continue ?? (i.continue = !t._zod.def.abort), n.issues.push(
|
|
2780
|
+
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = t), i.continue ?? (i.continue = !t._zod.def.abort), n.issues.push(re(i));
|
|
2781
2781
|
}
|
|
2782
2782
|
}, e(n.value, n)));
|
|
2783
2783
|
return t;
|
|
2784
2784
|
}
|
|
2785
|
-
function
|
|
2786
|
-
const n = new
|
|
2785
|
+
function zi(e, t) {
|
|
2786
|
+
const n = new $({
|
|
2787
2787
|
check: "custom",
|
|
2788
2788
|
...b(t)
|
|
2789
2789
|
});
|
|
2790
2790
|
return n._zod.check = e, n;
|
|
2791
2791
|
}
|
|
2792
|
-
const
|
|
2793
|
-
|
|
2792
|
+
const Ii = /* @__PURE__ */ m("ZodISODateTime", (e, t) => {
|
|
2793
|
+
Qo.init(e, t), O.init(e, t);
|
|
2794
2794
|
});
|
|
2795
2795
|
function Oi(e) {
|
|
2796
|
-
return
|
|
2796
|
+
return ii(Ii, e);
|
|
2797
2797
|
}
|
|
2798
|
-
const
|
|
2799
|
-
|
|
2798
|
+
const $i = /* @__PURE__ */ m("ZodISODate", (e, t) => {
|
|
2799
|
+
Xo.init(e, t), O.init(e, t);
|
|
2800
2800
|
});
|
|
2801
|
-
function
|
|
2802
|
-
return
|
|
2801
|
+
function Zi(e) {
|
|
2802
|
+
return si($i, e);
|
|
2803
2803
|
}
|
|
2804
|
-
const
|
|
2805
|
-
|
|
2804
|
+
const Pi = /* @__PURE__ */ m("ZodISOTime", (e, t) => {
|
|
2805
|
+
er.init(e, t), O.init(e, t);
|
|
2806
2806
|
});
|
|
2807
|
-
function
|
|
2808
|
-
return
|
|
2807
|
+
function xi(e) {
|
|
2808
|
+
return ai(Pi, e);
|
|
2809
2809
|
}
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2810
|
+
const Li = /* @__PURE__ */ m("ZodISODuration", (e, t) => {
|
|
2811
|
+
tr.init(e, t), O.init(e, t);
|
|
2812
2812
|
});
|
|
2813
|
-
function
|
|
2814
|
-
return
|
|
2813
|
+
function Ri(e) {
|
|
2814
|
+
return ui(Li, e);
|
|
2815
2815
|
}
|
|
2816
2816
|
const Ni = (e, t) => {
|
|
2817
|
-
|
|
2817
|
+
Pt.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
2818
2818
|
format: {
|
|
2819
|
-
value: (n) =>
|
|
2819
|
+
value: (n) => Vn(e, n)
|
|
2820
2820
|
// enumerable: false,
|
|
2821
2821
|
},
|
|
2822
2822
|
flatten: {
|
|
2823
|
-
value: (n) =>
|
|
2823
|
+
value: (n) => Un(e, n)
|
|
2824
2824
|
// enumerable: false,
|
|
2825
2825
|
},
|
|
2826
2826
|
addIssue: {
|
|
2827
2827
|
value: (n) => {
|
|
2828
|
-
e.issues.push(n), e.message = JSON.stringify(e.issues,
|
|
2828
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, Oe, 2);
|
|
2829
2829
|
}
|
|
2830
2830
|
// enumerable: false,
|
|
2831
2831
|
},
|
|
2832
2832
|
addIssues: {
|
|
2833
2833
|
value: (n) => {
|
|
2834
|
-
e.issues.push(...n), e.message = JSON.stringify(e.issues,
|
|
2834
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, Oe, 2);
|
|
2835
2835
|
}
|
|
2836
2836
|
// enumerable: false,
|
|
2837
2837
|
},
|
|
@@ -2844,171 +2844,171 @@ const Ni = (e, t) => {
|
|
|
2844
2844
|
});
|
|
2845
2845
|
}, P = /* @__PURE__ */ m("ZodError", Ni, {
|
|
2846
2846
|
Parent: Error
|
|
2847
|
-
}),
|
|
2847
|
+
}), ji = /* @__PURE__ */ je(P), Di = /* @__PURE__ */ De(P), Mi = /* @__PURE__ */ ve(P), Fi = /* @__PURE__ */ ge(P), Ui = /* @__PURE__ */ Wn(P), Vi = /* @__PURE__ */ qn(P), Bi = /* @__PURE__ */ Kn(P), Gi = /* @__PURE__ */ Hn(P), Wi = /* @__PURE__ */ Jn(P), qi = /* @__PURE__ */ Yn(P), Ki = /* @__PURE__ */ Qn(P), Hi = /* @__PURE__ */ Xn(P), I = /* @__PURE__ */ m("ZodType", (e, t) => (S.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)
|
|
2851
2851
|
]
|
|
2852
|
-
})), e.clone = (n, o) => D(e, n, o), e.brand = () => e, e.register = (n, o) => (n.add(e, o), e), e.parse = (n, o) =>
|
|
2852
|
+
})), e.clone = (n, o) => D(e, n, o), e.brand = () => e, e.register = (n, o) => (n.add(e, o), e), e.parse = (n, o) => ji(e, n, o, { callee: e.parse }), e.safeParse = (n, o) => Mi(e, n, o), e.parseAsync = async (n, o) => Di(e, n, o, { callee: e.parseAsync }), e.safeParseAsync = async (n, o) => Fi(e, n, o), e.spa = e.safeParseAsync, e.encode = (n, o) => Ui(e, n, o), e.decode = (n, o) => Vi(e, n, o), e.encodeAsync = async (n, o) => Bi(e, n, o), e.decodeAsync = async (n, o) => Gi(e, n, o), e.safeEncode = (n, o) => Wi(e, n, o), e.safeDecode = (n, o) => qi(e, n, o), e.safeEncodeAsync = async (n, o) => Ki(e, n, o), e.safeDecodeAsync = async (n, o) => Hi(e, n, o), e.refine = (n, o) => e.check(Gs(n, o)), e.superRefine = (n) => e.check(Ws(n)), e.overwrite = (n) => e.check(ee(n)), e.optional = () => ft(e), e.nullable = () => _t(e), e.nullish = () => ft(_t(e)), e.nonoptional = (n) => js(e, n), e.array = () => ws(e), e.or = (n) => G([e, n]), e.and = (n) => Ss(e, n), e.transform = (n) => mt(e, Zs(n)), e.default = (n) => Ls(e, n), e.prefault = (n) => Ns(e, n), e.catch = (n) => Ms(e, n), e.pipe = (n) => mt(e, n), e.readonly = () => Vs(e), e.describe = (n) => {
|
|
2853
2853
|
const o = e.clone();
|
|
2854
|
-
return
|
|
2854
|
+
return ce.add(o, { description: n }), o;
|
|
2855
2855
|
}, Object.defineProperty(e, "description", {
|
|
2856
2856
|
get() {
|
|
2857
|
-
return
|
|
2857
|
+
return ce.get(e)?.description;
|
|
2858
2858
|
},
|
|
2859
2859
|
configurable: !0
|
|
2860
2860
|
}), e.meta = (...n) => {
|
|
2861
2861
|
if (n.length === 0)
|
|
2862
|
-
return
|
|
2862
|
+
return ce.get(e);
|
|
2863
2863
|
const o = e.clone();
|
|
2864
|
-
return
|
|
2865
|
-
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)),
|
|
2864
|
+
return ce.add(o, n[0]), o;
|
|
2865
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), qt = /* @__PURE__ */ m("_ZodString", (e, t) => {
|
|
2866
2866
|
Me.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(
|
|
2869
|
-
}),
|
|
2870
|
-
Me.init(e, t),
|
|
2868
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...o) => e.check(fi(...o)), e.includes = (...o) => e.check(vi(...o)), e.startsWith = (...o) => e.check(gi(...o)), e.endsWith = (...o) => e.check(yi(...o)), e.min = (...o) => e.check(fe(...o)), e.max = (...o) => e.check(Gt(...o)), e.length = (...o) => e.check(Wt(...o)), e.nonempty = (...o) => e.check(fe(1, ...o)), e.lowercase = (o) => e.check(_i(o)), e.uppercase = (o) => e.check(mi(o)), e.trim = () => e.check(wi()), e.normalize = (...o) => e.check(bi(...o)), e.toLowerCase = () => e.check(Ei()), e.toUpperCase = () => e.check(ki()), e.slugify = () => e.check(Ci());
|
|
2869
|
+
}), Ji = /* @__PURE__ */ m("ZodString", (e, t) => {
|
|
2870
|
+
Me.init(e, t), qt.init(e, t), e.email = (n) => e.check(jr(Yi, n)), e.url = (n) => e.check(Vr(Qi, n)), e.jwt = (n) => e.check(ri(hs, n)), e.emoji = (n) => e.check(Br(Xi, n)), e.guid = (n) => e.check(at(dt, n)), e.uuid = (n) => e.check(Dr(le, n)), e.uuidv4 = (n) => e.check(Mr(le, n)), e.uuidv6 = (n) => e.check(Fr(le, n)), e.uuidv7 = (n) => e.check(Ur(le, n)), e.nanoid = (n) => e.check(Gr(es, n)), e.guid = (n) => e.check(at(dt, n)), e.cuid = (n) => e.check(Wr(ts, n)), e.cuid2 = (n) => e.check(qr(ns, n)), e.ulid = (n) => e.check(Kr(os, n)), e.base64 = (n) => e.check(ti(ls, n)), e.base64url = (n) => e.check(ni(ds, n)), e.xid = (n) => e.check(Hr(rs, n)), e.ksuid = (n) => e.check(Jr(is, n)), e.ipv4 = (n) => e.check(Yr(ss, n)), e.ipv6 = (n) => e.check(Qr(as, n)), e.cidrv4 = (n) => e.check(Xr(us, n)), e.cidrv6 = (n) => e.check(ei(cs, n)), e.e164 = (n) => e.check(oi(ps, n)), e.datetime = (n) => e.check(Oi(n)), e.date = (n) => e.check(Zi(n)), e.time = (n) => e.check(xi(n)), e.duration = (n) => e.check(Ri(n));
|
|
2871
2871
|
});
|
|
2872
2872
|
function Y(e) {
|
|
2873
|
-
return Nr(
|
|
2874
|
-
}
|
|
2875
|
-
const
|
|
2876
|
-
z.init(e, t),
|
|
2877
|
-
}),
|
|
2878
|
-
|
|
2879
|
-
}),
|
|
2880
|
-
|
|
2881
|
-
}),
|
|
2882
|
-
|
|
2883
|
-
}),
|
|
2884
|
-
|
|
2885
|
-
}),
|
|
2886
|
-
|
|
2887
|
-
}),
|
|
2888
|
-
|
|
2889
|
-
}),
|
|
2890
|
-
|
|
2891
|
-
}),
|
|
2892
|
-
|
|
2893
|
-
}),
|
|
2894
|
-
|
|
2895
|
-
}),
|
|
2896
|
-
|
|
2897
|
-
}),
|
|
2898
|
-
|
|
2899
|
-
}),
|
|
2900
|
-
|
|
2901
|
-
}),
|
|
2902
|
-
|
|
2903
|
-
}),
|
|
2904
|
-
|
|
2905
|
-
}),
|
|
2906
|
-
|
|
2907
|
-
}),
|
|
2908
|
-
|
|
2909
|
-
}),
|
|
2910
|
-
|
|
2911
|
-
}),
|
|
2912
|
-
|
|
2913
|
-
}),
|
|
2914
|
-
|
|
2915
|
-
}),
|
|
2916
|
-
|
|
2873
|
+
return Nr(Ji, e);
|
|
2874
|
+
}
|
|
2875
|
+
const O = /* @__PURE__ */ m("ZodStringFormat", (e, t) => {
|
|
2876
|
+
z.init(e, t), qt.init(e, t);
|
|
2877
|
+
}), Yi = /* @__PURE__ */ m("ZodEmail", (e, t) => {
|
|
2878
|
+
Vo.init(e, t), O.init(e, t);
|
|
2879
|
+
}), dt = /* @__PURE__ */ m("ZodGUID", (e, t) => {
|
|
2880
|
+
Fo.init(e, t), O.init(e, t);
|
|
2881
|
+
}), le = /* @__PURE__ */ m("ZodUUID", (e, t) => {
|
|
2882
|
+
Uo.init(e, t), O.init(e, t);
|
|
2883
|
+
}), Qi = /* @__PURE__ */ m("ZodURL", (e, t) => {
|
|
2884
|
+
Bo.init(e, t), O.init(e, t);
|
|
2885
|
+
}), Xi = /* @__PURE__ */ m("ZodEmoji", (e, t) => {
|
|
2886
|
+
Go.init(e, t), O.init(e, t);
|
|
2887
|
+
}), es = /* @__PURE__ */ m("ZodNanoID", (e, t) => {
|
|
2888
|
+
Wo.init(e, t), O.init(e, t);
|
|
2889
|
+
}), ts = /* @__PURE__ */ m("ZodCUID", (e, t) => {
|
|
2890
|
+
qo.init(e, t), O.init(e, t);
|
|
2891
|
+
}), ns = /* @__PURE__ */ m("ZodCUID2", (e, t) => {
|
|
2892
|
+
Ko.init(e, t), O.init(e, t);
|
|
2893
|
+
}), os = /* @__PURE__ */ m("ZodULID", (e, t) => {
|
|
2894
|
+
Ho.init(e, t), O.init(e, t);
|
|
2895
|
+
}), rs = /* @__PURE__ */ m("ZodXID", (e, t) => {
|
|
2896
|
+
Jo.init(e, t), O.init(e, t);
|
|
2897
|
+
}), is = /* @__PURE__ */ m("ZodKSUID", (e, t) => {
|
|
2898
|
+
Yo.init(e, t), O.init(e, t);
|
|
2899
|
+
}), ss = /* @__PURE__ */ m("ZodIPv4", (e, t) => {
|
|
2900
|
+
nr.init(e, t), O.init(e, t);
|
|
2901
|
+
}), as = /* @__PURE__ */ m("ZodIPv6", (e, t) => {
|
|
2902
|
+
or.init(e, t), O.init(e, t);
|
|
2903
|
+
}), us = /* @__PURE__ */ m("ZodCIDRv4", (e, t) => {
|
|
2904
|
+
rr.init(e, t), O.init(e, t);
|
|
2905
|
+
}), cs = /* @__PURE__ */ m("ZodCIDRv6", (e, t) => {
|
|
2906
|
+
ir.init(e, t), O.init(e, t);
|
|
2907
|
+
}), ls = /* @__PURE__ */ m("ZodBase64", (e, t) => {
|
|
2908
|
+
sr.init(e, t), O.init(e, t);
|
|
2909
|
+
}), ds = /* @__PURE__ */ m("ZodBase64URL", (e, t) => {
|
|
2910
|
+
ur.init(e, t), O.init(e, t);
|
|
2911
|
+
}), ps = /* @__PURE__ */ m("ZodE164", (e, t) => {
|
|
2912
|
+
cr.init(e, t), O.init(e, t);
|
|
2913
|
+
}), hs = /* @__PURE__ */ m("ZodJWT", (e, t) => {
|
|
2914
|
+
dr.init(e, t), O.init(e, t);
|
|
2915
|
+
}), Kt = /* @__PURE__ */ m("ZodNumber", (e, t) => {
|
|
2916
|
+
Ut.init(e, t), I.init(e, t), e.gt = (o, i) => e.check(ct(o, i)), e.gte = (o, i) => e.check(Ce(o, i)), e.min = (o, i) => e.check(Ce(o, i)), e.lt = (o, i) => e.check(ut(o, i)), e.lte = (o, i) => e.check(ke(o, i)), e.max = (o, i) => e.check(ke(o, i)), e.int = (o) => e.check(pt(o)), e.safe = (o) => e.check(pt(o)), e.positive = (o) => e.check(ct(0, o)), e.nonnegative = (o) => e.check(Ce(0, o)), e.negative = (o) => e.check(ut(0, o)), e.nonpositive = (o) => e.check(ke(0, o)), e.multipleOf = (o, i) => e.check(lt(o, i)), e.step = (o, i) => e.check(lt(o, i)), e.finite = () => e;
|
|
2917
2917
|
const n = e._zod.bag;
|
|
2918
2918
|
e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
|
|
2919
2919
|
});
|
|
2920
2920
|
function Z(e) {
|
|
2921
|
-
return
|
|
2921
|
+
return ci(Kt, e);
|
|
2922
|
+
}
|
|
2923
|
+
const fs = /* @__PURE__ */ m("ZodNumberFormat", (e, t) => {
|
|
2924
|
+
pr.init(e, t), Kt.init(e, t);
|
|
2925
|
+
});
|
|
2926
|
+
function pt(e) {
|
|
2927
|
+
return li(fs, e);
|
|
2922
2928
|
}
|
|
2923
|
-
const _s = /* @__PURE__ */ m("
|
|
2924
|
-
hr.init(e, t),
|
|
2929
|
+
const _s = /* @__PURE__ */ m("ZodNull", (e, t) => {
|
|
2930
|
+
hr.init(e, t), I.init(e, t);
|
|
2925
2931
|
});
|
|
2926
|
-
function
|
|
2932
|
+
function ms(e) {
|
|
2927
2933
|
return di(_s, e);
|
|
2928
2934
|
}
|
|
2929
|
-
const
|
|
2935
|
+
const vs = /* @__PURE__ */ m("ZodUnknown", (e, t) => {
|
|
2930
2936
|
fr.init(e, t), I.init(e, t);
|
|
2931
2937
|
});
|
|
2932
|
-
function
|
|
2933
|
-
return pi(
|
|
2938
|
+
function ht() {
|
|
2939
|
+
return pi(vs);
|
|
2934
2940
|
}
|
|
2935
|
-
const gs = /* @__PURE__ */ m("
|
|
2941
|
+
const gs = /* @__PURE__ */ m("ZodNever", (e, t) => {
|
|
2936
2942
|
_r.init(e, t), I.init(e, t);
|
|
2937
2943
|
});
|
|
2938
|
-
function
|
|
2939
|
-
return hi(gs);
|
|
2940
|
-
}
|
|
2941
|
-
const ys = /* @__PURE__ */ m("ZodNever", (e, t) => {
|
|
2942
|
-
mr.init(e, t), I.init(e, t);
|
|
2943
|
-
});
|
|
2944
|
-
function bs(e) {
|
|
2945
|
-
return fi(ys, e);
|
|
2944
|
+
function ys(e) {
|
|
2945
|
+
return hi(gs, e);
|
|
2946
2946
|
}
|
|
2947
|
-
const
|
|
2948
|
-
|
|
2947
|
+
const bs = /* @__PURE__ */ m("ZodArray", (e, t) => {
|
|
2948
|
+
mr.init(e, t), I.init(e, t), e.element = t.element, e.min = (n, o) => e.check(fe(n, o)), e.nonempty = (n) => e.check(fe(1, n)), e.max = (n, o) => e.check(Gt(n, o)), e.length = (n, o) => e.check(Wt(n, o)), e.unwrap = () => e.element;
|
|
2949
2949
|
});
|
|
2950
|
-
function
|
|
2951
|
-
return
|
|
2950
|
+
function ws(e, t) {
|
|
2951
|
+
return Si(bs, e, t);
|
|
2952
2952
|
}
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2953
|
+
const Es = /* @__PURE__ */ m("ZodObject", (e, t) => {
|
|
2954
|
+
gr.init(e, t), I.init(e, t), C(e, "shape", () => t.shape), e.keyof = () => Is(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ht() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ht() }), e.strict = () => e.clone({ ...e._zod.def, catchall: ys() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => Nn(e, n), e.safeExtend = (n) => jn(e, n), e.merge = (n) => Dn(e, n), e.pick = (n) => Ln(e, n), e.omit = (n) => Rn(e, n), e.partial = (...n) => Mn(Ht, e, n[0]), e.required = (...n) => Fn(Jt, e, n[0]);
|
|
2955
2955
|
});
|
|
2956
|
-
function
|
|
2956
|
+
function T(e, t) {
|
|
2957
2957
|
const n = {
|
|
2958
2958
|
type: "object",
|
|
2959
2959
|
shape: e ?? {},
|
|
2960
2960
|
...b(t)
|
|
2961
2961
|
};
|
|
2962
|
-
return new
|
|
2962
|
+
return new Es(n);
|
|
2963
2963
|
}
|
|
2964
|
-
const
|
|
2965
|
-
|
|
2964
|
+
const ks = /* @__PURE__ */ m("ZodUnion", (e, t) => {
|
|
2965
|
+
yr.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 ks({
|
|
2969
2969
|
type: "union",
|
|
2970
2970
|
options: e,
|
|
2971
2971
|
...b(t)
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
const
|
|
2975
|
-
|
|
2974
|
+
const Cs = /* @__PURE__ */ m("ZodIntersection", (e, t) => {
|
|
2975
|
+
br.init(e, t), I.init(e, t);
|
|
2976
2976
|
});
|
|
2977
|
-
function
|
|
2978
|
-
return new
|
|
2977
|
+
function Ss(e, t) {
|
|
2978
|
+
return new Cs({
|
|
2979
2979
|
type: "intersection",
|
|
2980
2980
|
left: e,
|
|
2981
2981
|
right: t
|
|
2982
2982
|
});
|
|
2983
2983
|
}
|
|
2984
|
-
const
|
|
2985
|
-
|
|
2984
|
+
const As = /* @__PURE__ */ m("ZodTuple", (e, t) => {
|
|
2985
|
+
wr.init(e, t), I.init(e, t), e.rest = (n) => e.clone({
|
|
2986
2986
|
...e._zod.def,
|
|
2987
2987
|
rest: n
|
|
2988
2988
|
});
|
|
2989
2989
|
});
|
|
2990
2990
|
function L(e, t, n) {
|
|
2991
|
-
const o = t instanceof
|
|
2992
|
-
return new
|
|
2991
|
+
const o = t instanceof S, i = o ? n : t, a = o ? t : null;
|
|
2992
|
+
return new As({
|
|
2993
2993
|
type: "tuple",
|
|
2994
2994
|
items: e,
|
|
2995
2995
|
rest: a,
|
|
2996
2996
|
...b(i)
|
|
2997
2997
|
});
|
|
2998
2998
|
}
|
|
2999
|
-
const
|
|
3000
|
-
|
|
2999
|
+
const Ts = /* @__PURE__ */ m("ZodRecord", (e, t) => {
|
|
3000
|
+
Er.init(e, t), I.init(e, t), e.keyType = t.keyType, e.valueType = t.valueType;
|
|
3001
3001
|
});
|
|
3002
|
-
function
|
|
3003
|
-
return new
|
|
3002
|
+
function zs(e, t, n) {
|
|
3003
|
+
return new Ts({
|
|
3004
3004
|
type: "record",
|
|
3005
3005
|
keyType: e,
|
|
3006
3006
|
valueType: t,
|
|
3007
3007
|
...b(n)
|
|
3008
3008
|
});
|
|
3009
3009
|
}
|
|
3010
|
-
const
|
|
3011
|
-
|
|
3010
|
+
const Ze = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
3011
|
+
kr.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 = {};
|
|
@@ -3017,7 +3017,7 @@ const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3017
3017
|
a[c] = t.entries[c];
|
|
3018
3018
|
else
|
|
3019
3019
|
throw new Error(`Key ${c} not found in enum`);
|
|
3020
|
-
return new
|
|
3020
|
+
return new Ze({
|
|
3021
3021
|
...t,
|
|
3022
3022
|
checks: [],
|
|
3023
3023
|
...b(i),
|
|
@@ -3030,7 +3030,7 @@ const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3030
3030
|
delete a[c];
|
|
3031
3031
|
else
|
|
3032
3032
|
throw new Error(`Key ${c} not found in enum`);
|
|
3033
|
-
return new
|
|
3033
|
+
return new Ze({
|
|
3034
3034
|
...t,
|
|
3035
3035
|
checks: [],
|
|
3036
3036
|
...b(i),
|
|
@@ -3038,16 +3038,16 @@ const xe = /* @__PURE__ */ m("ZodEnum", (e, t) => {
|
|
|
3038
3038
|
});
|
|
3039
3039
|
};
|
|
3040
3040
|
});
|
|
3041
|
-
function
|
|
3041
|
+
function Is(e, t) {
|
|
3042
3042
|
const n = Array.isArray(e) ? Object.fromEntries(e.map((o) => [o, o])) : e;
|
|
3043
|
-
return new
|
|
3043
|
+
return new Ze({
|
|
3044
3044
|
type: "enum",
|
|
3045
3045
|
entries: n,
|
|
3046
3046
|
...b(t)
|
|
3047
3047
|
});
|
|
3048
3048
|
}
|
|
3049
3049
|
const Os = /* @__PURE__ */ m("ZodLiteral", (e, t) => {
|
|
3050
|
-
|
|
3050
|
+
Cr.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.");
|
|
@@ -3062,547 +3062,230 @@ function R(e, t) {
|
|
|
3062
3062
|
...b(t)
|
|
3063
3063
|
});
|
|
3064
3064
|
}
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3065
|
+
const $s = /* @__PURE__ */ m("ZodTransform", (e, t) => {
|
|
3066
|
+
Sr.init(e, t), I.init(e, t), e._zod.parse = (n, o) => {
|
|
3067
3067
|
if (o.direction === "backward")
|
|
3068
|
-
throw new
|
|
3068
|
+
throw new zt(e.constructor.name);
|
|
3069
3069
|
n.addIssue = (a) => {
|
|
3070
3070
|
if (typeof a == "string")
|
|
3071
|
-
n.issues.push(
|
|
3071
|
+
n.issues.push(re(a, n.value, t));
|
|
3072
3072
|
else {
|
|
3073
3073
|
const c = a;
|
|
3074
|
-
c.fatal && (c.continue = !1), c.code ?? (c.code = "custom"), c.input ?? (c.input = n.value), c.inst ?? (c.inst = e), n.issues.push(
|
|
3074
|
+
c.fatal && (c.continue = !1), c.code ?? (c.code = "custom"), c.input ?? (c.input = n.value), c.inst ?? (c.inst = e), n.issues.push(re(c));
|
|
3075
3075
|
}
|
|
3076
3076
|
};
|
|
3077
3077
|
const i = t.transform(n.value, n);
|
|
3078
3078
|
return i instanceof Promise ? i.then((a) => (n.value = a, n)) : (n.value = i, n);
|
|
3079
3079
|
};
|
|
3080
3080
|
});
|
|
3081
|
-
function
|
|
3082
|
-
return new
|
|
3081
|
+
function Zs(e) {
|
|
3082
|
+
return new $s({
|
|
3083
3083
|
type: "transform",
|
|
3084
3084
|
transform: e
|
|
3085
3085
|
});
|
|
3086
3086
|
}
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3087
|
+
const Ht = /* @__PURE__ */ m("ZodOptional", (e, t) => {
|
|
3088
|
+
Ar.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3089
3089
|
});
|
|
3090
|
-
function
|
|
3091
|
-
return new
|
|
3090
|
+
function ft(e) {
|
|
3091
|
+
return new Ht({
|
|
3092
3092
|
type: "optional",
|
|
3093
3093
|
innerType: e
|
|
3094
3094
|
});
|
|
3095
3095
|
}
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3096
|
+
const Ps = /* @__PURE__ */ m("ZodNullable", (e, t) => {
|
|
3097
|
+
Tr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3098
3098
|
});
|
|
3099
|
-
function
|
|
3100
|
-
return new
|
|
3099
|
+
function _t(e) {
|
|
3100
|
+
return new Ps({
|
|
3101
3101
|
type: "nullable",
|
|
3102
3102
|
innerType: e
|
|
3103
3103
|
});
|
|
3104
3104
|
}
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3105
|
+
const xs = /* @__PURE__ */ m("ZodDefault", (e, t) => {
|
|
3106
|
+
zr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3107
3107
|
});
|
|
3108
|
-
function
|
|
3109
|
-
return new
|
|
3108
|
+
function Ls(e, t) {
|
|
3109
|
+
return new xs({
|
|
3110
3110
|
type: "default",
|
|
3111
3111
|
innerType: e,
|
|
3112
3112
|
get defaultValue() {
|
|
3113
|
-
return typeof t == "function" ? t() :
|
|
3113
|
+
return typeof t == "function" ? t() : $t(t);
|
|
3114
3114
|
}
|
|
3115
3115
|
});
|
|
3116
3116
|
}
|
|
3117
|
-
const
|
|
3118
|
-
|
|
3117
|
+
const Rs = /* @__PURE__ */ m("ZodPrefault", (e, t) => {
|
|
3118
|
+
Ir.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3119
3119
|
});
|
|
3120
3120
|
function Ns(e, t) {
|
|
3121
|
-
return new
|
|
3121
|
+
return new Rs({
|
|
3122
3122
|
type: "prefault",
|
|
3123
3123
|
innerType: e,
|
|
3124
3124
|
get defaultValue() {
|
|
3125
|
-
return typeof t == "function" ? t() :
|
|
3125
|
+
return typeof t == "function" ? t() : $t(t);
|
|
3126
3126
|
}
|
|
3127
3127
|
});
|
|
3128
3128
|
}
|
|
3129
|
-
const
|
|
3129
|
+
const Jt = /* @__PURE__ */ m("ZodNonOptional", (e, t) => {
|
|
3130
3130
|
Or.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3131
3131
|
});
|
|
3132
|
-
function
|
|
3133
|
-
return new
|
|
3132
|
+
function js(e, t) {
|
|
3133
|
+
return new Jt({
|
|
3134
3134
|
type: "nonoptional",
|
|
3135
3135
|
innerType: e,
|
|
3136
3136
|
...b(t)
|
|
3137
3137
|
});
|
|
3138
3138
|
}
|
|
3139
|
-
const
|
|
3140
|
-
|
|
3139
|
+
const Ds = /* @__PURE__ */ m("ZodCatch", (e, t) => {
|
|
3140
|
+
$r.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
3141
3141
|
});
|
|
3142
|
-
function
|
|
3143
|
-
return new
|
|
3142
|
+
function Ms(e, t) {
|
|
3143
|
+
return new Ds({
|
|
3144
3144
|
type: "catch",
|
|
3145
3145
|
innerType: e,
|
|
3146
3146
|
catchValue: typeof t == "function" ? t : () => t
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3149
|
+
const Fs = /* @__PURE__ */ m("ZodPipe", (e, t) => {
|
|
3150
|
+
Zr.init(e, t), I.init(e, t), e.in = t.in, e.out = t.out;
|
|
3151
3151
|
});
|
|
3152
|
-
function
|
|
3153
|
-
return new
|
|
3152
|
+
function mt(e, t) {
|
|
3153
|
+
return new Fs({
|
|
3154
3154
|
type: "pipe",
|
|
3155
3155
|
in: e,
|
|
3156
3156
|
out: t
|
|
3157
3157
|
// ...util.normalizeParams(params),
|
|
3158
3158
|
});
|
|
3159
3159
|
}
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3160
|
+
const Us = /* @__PURE__ */ m("ZodReadonly", (e, t) => {
|
|
3161
|
+
Pr.init(e, t), I.init(e, t), e.unwrap = () => e._zod.def.innerType;
|
|
3162
3162
|
});
|
|
3163
|
-
function
|
|
3164
|
-
return new
|
|
3163
|
+
function Vs(e) {
|
|
3164
|
+
return new Us({
|
|
3165
3165
|
type: "readonly",
|
|
3166
3166
|
innerType: e
|
|
3167
3167
|
});
|
|
3168
3168
|
}
|
|
3169
|
-
const
|
|
3170
|
-
|
|
3169
|
+
const Bs = /* @__PURE__ */ m("ZodCustom", (e, t) => {
|
|
3170
|
+
xr.init(e, t), I.init(e, t);
|
|
3171
3171
|
});
|
|
3172
|
-
function
|
|
3173
|
-
return
|
|
3172
|
+
function Gs(e, t = {}) {
|
|
3173
|
+
return Ai(Bs, e, t);
|
|
3174
3174
|
}
|
|
3175
|
-
function
|
|
3176
|
-
return
|
|
3175
|
+
function Ws(e) {
|
|
3176
|
+
return Ti(e);
|
|
3177
3177
|
}
|
|
3178
|
-
const be =
|
|
3178
|
+
const be = T({
|
|
3179
3179
|
t: Z().gte(0),
|
|
3180
3180
|
rate: Z().gte(0)
|
|
3181
|
-
}), Q =
|
|
3181
|
+
}), Q = T({
|
|
3182
3182
|
opacity: Z().gte(0).lte(1),
|
|
3183
|
-
zIndex: Z()
|
|
3184
|
-
}), X =
|
|
3183
|
+
zIndex: Z().default(0)
|
|
3184
|
+
}), X = T({
|
|
3185
3185
|
volume: Z().gte(0).lte(1)
|
|
3186
|
-
}),
|
|
3186
|
+
}), qs = T({
|
|
3187
3187
|
type: R("image"),
|
|
3188
3188
|
file: Y(),
|
|
3189
3189
|
fit: G([R("contain"), R("cover"), R("none")])
|
|
3190
|
-
}),
|
|
3190
|
+
}), Ks = T({
|
|
3191
3191
|
type: R("audio"),
|
|
3192
3192
|
file: Y(),
|
|
3193
3193
|
audioOutput: Y()
|
|
3194
|
-
}),
|
|
3194
|
+
}), Hs = T({
|
|
3195
3195
|
type: R("video"),
|
|
3196
3196
|
file: Y(),
|
|
3197
3197
|
audioOutput: Y(),
|
|
3198
3198
|
fit: G([R("contain"), R("cover"), R("none")])
|
|
3199
|
-
}),
|
|
3199
|
+
}), Fe = L([Z(), ms()]), Js = L([
|
|
3200
3200
|
Z(),
|
|
3201
|
-
|
|
3202
|
-
set:
|
|
3201
|
+
T({
|
|
3202
|
+
set: T({
|
|
3203
3203
|
...Q.shape
|
|
3204
3204
|
}).partial()
|
|
3205
3205
|
}).partial()
|
|
3206
|
-
]),
|
|
3206
|
+
]), Ys = L([
|
|
3207
3207
|
Z(),
|
|
3208
|
-
|
|
3209
|
-
set:
|
|
3208
|
+
T({
|
|
3209
|
+
set: T({
|
|
3210
3210
|
...Q.shape
|
|
3211
3211
|
}).partial(),
|
|
3212
|
-
lerp:
|
|
3212
|
+
lerp: T({
|
|
3213
3213
|
...Q.shape
|
|
3214
3214
|
}).partial()
|
|
3215
3215
|
}).partial()
|
|
3216
|
-
]),
|
|
3216
|
+
]), Qs = L([
|
|
3217
3217
|
Z(),
|
|
3218
|
-
|
|
3219
|
-
set:
|
|
3218
|
+
T({
|
|
3219
|
+
set: T({
|
|
3220
3220
|
...be.shape,
|
|
3221
3221
|
...X.shape
|
|
3222
3222
|
}).partial()
|
|
3223
3223
|
}).partial()
|
|
3224
|
-
]),
|
|
3224
|
+
]), Xs = L([
|
|
3225
3225
|
Z(),
|
|
3226
|
-
|
|
3227
|
-
set:
|
|
3226
|
+
T({
|
|
3227
|
+
set: T({
|
|
3228
3228
|
...be.shape,
|
|
3229
3229
|
...X.shape
|
|
3230
3230
|
}).partial(),
|
|
3231
|
-
lerp:
|
|
3231
|
+
lerp: T({
|
|
3232
3232
|
...X.shape
|
|
3233
3233
|
}).partial()
|
|
3234
3234
|
}).partial()
|
|
3235
|
-
]),
|
|
3235
|
+
]), ea = L([
|
|
3236
3236
|
Z(),
|
|
3237
|
-
|
|
3238
|
-
set:
|
|
3237
|
+
T({
|
|
3238
|
+
set: T({
|
|
3239
3239
|
...be.shape,
|
|
3240
3240
|
...X.shape,
|
|
3241
3241
|
...Q.shape
|
|
3242
3242
|
}).partial()
|
|
3243
3243
|
}).partial()
|
|
3244
|
-
]),
|
|
3244
|
+
]), ta = L([
|
|
3245
3245
|
Z(),
|
|
3246
|
-
|
|
3247
|
-
set:
|
|
3246
|
+
T({
|
|
3247
|
+
set: T({
|
|
3248
3248
|
...be.shape,
|
|
3249
3249
|
...X.shape,
|
|
3250
3250
|
...Q.shape
|
|
3251
3251
|
}).partial(),
|
|
3252
|
-
lerp:
|
|
3252
|
+
lerp: T({
|
|
3253
3253
|
...X.shape,
|
|
3254
3254
|
...Q.shape
|
|
3255
3255
|
}).partial()
|
|
3256
3256
|
}).partial()
|
|
3257
|
-
]),
|
|
3257
|
+
]), na = T({
|
|
3258
|
+
...qs.shape,
|
|
3259
|
+
keyframes: L([Ys], G([Js, Fe]))
|
|
3260
|
+
}), oa = T({
|
|
3258
3261
|
...Ks.shape,
|
|
3259
|
-
keyframes: L([
|
|
3260
|
-
}), ra =
|
|
3262
|
+
keyframes: L([Xs], G([Qs, Fe]))
|
|
3263
|
+
}), ra = T({
|
|
3261
3264
|
...Hs.shape,
|
|
3262
|
-
keyframes: L([
|
|
3263
|
-
}), ia =
|
|
3264
|
-
...Js.shape,
|
|
3265
|
-
keyframes: L([na], G([ta, Ve]))
|
|
3266
|
-
}), sa = Is(Y(), G([oa, ra, ia])), me = {
|
|
3265
|
+
keyframes: L([ta], G([ea, Fe]))
|
|
3266
|
+
}), ia = zs(Y(), G([na, oa, ra])), _e = {
|
|
3267
3267
|
opacity: 1,
|
|
3268
3268
|
zIndex: 0
|
|
3269
3269
|
}, we = {
|
|
3270
3270
|
t: 0,
|
|
3271
3271
|
rate: 1,
|
|
3272
3272
|
volume: 1
|
|
3273
|
-
},
|
|
3273
|
+
}, me = {
|
|
3274
3274
|
t: 0,
|
|
3275
3275
|
rate: 1,
|
|
3276
3276
|
volume: 1,
|
|
3277
3277
|
opacity: 1,
|
|
3278
3278
|
zIndex: 0
|
|
3279
|
-
},
|
|
3279
|
+
}, Oa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3280
3280
|
__proto__: null,
|
|
3281
|
-
MediaSurfaceStateSchema:
|
|
3281
|
+
MediaSurfaceStateSchema: ia,
|
|
3282
3282
|
defaultAudioOptions: we,
|
|
3283
|
-
defaultImageOptions:
|
|
3284
|
-
defaultVideoOptions:
|
|
3283
|
+
defaultImageOptions: _e,
|
|
3284
|
+
defaultVideoOptions: me
|
|
3285
3285
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
if (e.keyframes[0][0] > t)
|
|
3290
|
-
return;
|
|
3291
|
-
const o = e.keyframes.filter((a) => a[1] !== null), i = Te(o, t);
|
|
3292
|
-
return { ...me, ...i };
|
|
3293
|
-
}
|
|
3294
|
-
case "audio": {
|
|
3295
|
-
const n = e.keyframes.filter((a) => a[1] !== null), o = gt(n, t);
|
|
3296
|
-
if (!o)
|
|
3297
|
-
return;
|
|
3298
|
-
const i = Te(n, t);
|
|
3299
|
-
return { ...we, ...i, ...o };
|
|
3300
|
-
}
|
|
3301
|
-
case "video": {
|
|
3302
|
-
const n = e.keyframes.filter((a) => a[1] !== null), o = gt(n, t);
|
|
3303
|
-
if (!o)
|
|
3304
|
-
return;
|
|
3305
|
-
const i = Te(n, t);
|
|
3306
|
-
return { ...re, ...i, ...o };
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
function Te(e, t) {
|
|
3311
|
-
const n = {};
|
|
3312
|
-
for (const [i, a] of e)
|
|
3313
|
-
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
3314
|
-
n[c] ??= {}, n[c].before = [i, l];
|
|
3315
|
-
}), Object.entries(a.set ?? {}).forEach(([c, l]) => {
|
|
3316
|
-
n[c] ??= {}, n[c].before = [i, l];
|
|
3317
|
-
})) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
3318
|
-
n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
|
|
3319
|
-
});
|
|
3320
|
-
const o = {};
|
|
3321
|
-
return Object.entries(n).forEach(
|
|
3322
|
-
([i, { before: a, after: c }]) => {
|
|
3323
|
-
if (c === void 0 && a) {
|
|
3324
|
-
o[i] = a[1];
|
|
3325
|
-
return;
|
|
3326
|
-
}
|
|
3327
|
-
if (a && c && a[0] === c[0]) {
|
|
3328
|
-
o[i] = c[1];
|
|
3329
|
-
return;
|
|
3330
|
-
}
|
|
3331
|
-
if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
|
|
3332
|
-
o[i] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
|
|
3333
|
-
return;
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
), o;
|
|
3337
|
-
}
|
|
3338
|
-
function gt(e, t) {
|
|
3339
|
-
const n = e[0];
|
|
3340
|
-
if (!n || n[0] > t)
|
|
3341
|
-
return;
|
|
3342
|
-
let o = 0, { t: i, rate: a } = we;
|
|
3343
|
-
for (const [f, y] of e) {
|
|
3344
|
-
if (f > t) break;
|
|
3345
|
-
const { set: g } = y;
|
|
3346
|
-
if (!g) continue;
|
|
3347
|
-
const { t: r, rate: s } = g;
|
|
3348
|
-
if (r !== void 0) {
|
|
3349
|
-
o = f, i = r, s !== void 0 && (a = s);
|
|
3350
|
-
continue;
|
|
3351
|
-
}
|
|
3352
|
-
if (s !== void 0) {
|
|
3353
|
-
const p = (f - o) * a;
|
|
3354
|
-
o = f, i += p, a = s;
|
|
3355
|
-
}
|
|
3356
|
-
}
|
|
3357
|
-
const l = (t - o) * a, d = i + l;
|
|
3358
|
-
return {
|
|
3359
|
-
rate: a,
|
|
3360
|
-
t: d
|
|
3361
|
-
};
|
|
3362
|
-
}
|
|
3363
|
-
const aa = 1e3;
|
|
3364
|
-
class Be {
|
|
3365
|
-
constructor(t, n, o, i) {
|
|
3366
|
-
this.surfaceElement = t, this.clipElement = n, this.constructAssetURL = i, this._state = o, setTimeout(this.loop);
|
|
3367
|
-
}
|
|
3368
|
-
/**
|
|
3369
|
-
* This is the delay to be used in the update loop.
|
|
3370
|
-
* It is intended to be dynamic for each loop.
|
|
3371
|
-
*/
|
|
3372
|
-
delay = aa;
|
|
3373
|
-
isConnected(t) {
|
|
3374
|
-
return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
|
|
3375
|
-
}
|
|
3376
|
-
_state;
|
|
3377
|
-
setState(t) {
|
|
3378
|
-
this._state = t, clearTimeout(this.timeout), this.loop();
|
|
3379
|
-
}
|
|
3380
|
-
timeout;
|
|
3381
|
-
loop = async () => {
|
|
3382
|
-
this.isConnected() ? (this.update(), isFinite(this.delay) && (this.timeout = setTimeout(this.loop, this.delay))) : this.destroy();
|
|
3383
|
-
};
|
|
3384
|
-
}
|
|
3385
|
-
class ua extends Be {
|
|
3386
|
-
imageElement;
|
|
3387
|
-
constructor(t, n, o, i) {
|
|
3388
|
-
super(t, n, o, i), this.clipElement = n;
|
|
3389
|
-
}
|
|
3390
|
-
updateImageElement() {
|
|
3391
|
-
this.imageElement = document.createElement("img"), this.clipElement.replaceChildren(this.imageElement), this.imageElement.style.position = "absolute", this.imageElement.style.height = "100%", this.imageElement.style.widows = "100%";
|
|
3392
|
-
}
|
|
3393
|
-
update() {
|
|
3394
|
-
const t = Ee(this._state, Date.now());
|
|
3395
|
-
if (t ? (!this.imageElement || !this.isConnected(this.imageElement)) && this.updateImageElement() : (this.imageElement?.remove(), this.imageElement = void 0), !this.imageElement || !t) return;
|
|
3396
|
-
const n = this.constructAssetURL(this._state.file);
|
|
3397
|
-
this.imageElement.src.includes(n) || (this.imageElement.src = n), this.imageElement.style.objectFit !== this._state.fit && (this.imageElement.style.objectFit = this._state.fit), parseFloat(this.imageElement.style.opacity) !== t.opacity && (this.imageElement.style.opacity = String(t.opacity ?? me.opacity));
|
|
3398
|
-
const o = Math.round(t.zIndex ?? me.zIndex);
|
|
3399
|
-
parseInt(this.imageElement.style.zIndex) !== o && (this.imageElement.style.zIndex = String(o));
|
|
3400
|
-
const { opacity: i } = t;
|
|
3401
|
-
typeof i == "string" && i !== this.imageElement.style.opacity && (this.imageElement.style.opacity = i);
|
|
3402
|
-
}
|
|
3403
|
-
destroy() {
|
|
3404
|
-
this.imageElement?.remove();
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
const ca = 1e3, Se = 10, Qt = 1e3, la = 200, da = 0.15, yt = 0.7, pa = 0.3;
|
|
3408
|
-
function ha(e) {
|
|
3409
|
-
return -Math.sign(e) * Math.pow(Math.abs(e) / Qt, pa) * da;
|
|
3410
|
-
}
|
|
3411
|
-
const fa = 5;
|
|
3412
|
-
function _a(e, t, n) {
|
|
3413
|
-
const o = Ee(e, t);
|
|
3414
|
-
if (!o) return !1;
|
|
3415
|
-
const { t: i, rate: a } = o;
|
|
3416
|
-
if (i === void 0 || a === void 0) return !1;
|
|
3417
|
-
const c = e.keyframes.filter(([f, y]) => f > t && (y?.set?.t !== void 0 || y?.set?.rate !== void 0))[0];
|
|
3418
|
-
if (c?.[1]?.set?.t !== 0) return !1;
|
|
3419
|
-
const l = (n - i) / a, d = c[0] - t;
|
|
3420
|
-
return Math.abs(l - d) <= fa;
|
|
3421
|
-
}
|
|
3422
|
-
class ma extends Be {
|
|
3423
|
-
videoElement;
|
|
3424
|
-
// We seek to another part of the video and do nothing until we get there
|
|
3425
|
-
isSeeking = !1;
|
|
3426
|
-
// We change playbackRate to intercept the server time of the video and don't change course until we intercept
|
|
3427
|
-
timeToIntercept = void 0;
|
|
3428
|
-
constructor(t, n, o, i) {
|
|
3429
|
-
super(t, n, o, i), this.clipElement = n;
|
|
3430
|
-
}
|
|
3431
|
-
updateVideoElement() {
|
|
3432
|
-
this.destroy(), this.videoElement = document.createElement("video"), this.clipElement.replaceChildren(this.videoElement), this.videoElement.style.position = "absolute", this.videoElement.style.width = "100%", this.videoElement.style.height = "100%";
|
|
3433
|
-
}
|
|
3434
|
-
get videoDuration() {
|
|
3435
|
-
if (this.videoElement && !(this.videoElement.readyState < HTMLMediaElement.HAVE_METADATA))
|
|
3436
|
-
return this.videoElement.duration * 1e3;
|
|
3437
|
-
}
|
|
3438
|
-
/**
|
|
3439
|
-
* Helper function to seek to a specified time.
|
|
3440
|
-
* Works with the update loop to poll until seeked event has fired.
|
|
3441
|
-
*/
|
|
3442
|
-
seekTo(t) {
|
|
3443
|
-
this.videoElement && (this.videoElement.addEventListener(
|
|
3444
|
-
"seeked",
|
|
3445
|
-
() => {
|
|
3446
|
-
console.debug("seeked"), this.isSeeking = !1;
|
|
3447
|
-
},
|
|
3448
|
-
{ once: !0, passive: !0 }
|
|
3449
|
-
), this.videoElement.currentTime = t / 1e3);
|
|
3450
|
-
}
|
|
3451
|
-
update() {
|
|
3452
|
-
if (this.isSeeking) return;
|
|
3453
|
-
const t = Date.now(), n = Ee(this._state, t);
|
|
3454
|
-
if (n ? (!this.videoElement || !this.isConnected(this.videoElement)) && this.updateVideoElement() : (this.videoElement?.remove(), this.videoElement = void 0), !n || !this.videoElement) return;
|
|
3455
|
-
const { t: o, rate: i, volume: a } = { ...re, ...n }, c = this.constructAssetURL(this._state.file);
|
|
3456
|
-
this.videoElement.src.includes(c) || (this.videoElement.src = c), this.videoElement.style.objectFit !== this._state.fit && (this.videoElement.style.objectFit = this._state.fit), parseFloat(this.videoElement.style.opacity) !== n.opacity && (this.videoElement.style.opacity = String(n.opacity ?? re.opacity));
|
|
3457
|
-
const l = Math.round(n.zIndex ?? re.zIndex);
|
|
3458
|
-
parseInt(this.videoElement.style.zIndex) !== l && (this.videoElement.style.zIndex = String(l)), this.videoElement.volume !== a && (this.videoElement.volume = a);
|
|
3459
|
-
const d = this.videoDuration;
|
|
3460
|
-
if (d !== void 0) {
|
|
3461
|
-
if (_a(this._state, t, d))
|
|
3462
|
-
this.videoElement.loop || (console.debug("starting loop"), this.videoElement.loop = !0);
|
|
3463
|
-
else if (this.videoElement.loop && (console.debug("stopping loop"), this.videoElement.loop = !1), o > d) {
|
|
3464
|
-
console.debug("ended"), this.delay = 1 / 0;
|
|
3465
|
-
return;
|
|
3466
|
-
}
|
|
3467
|
-
}
|
|
3468
|
-
this.videoElement.paused && i > 0 && (d === void 0 || d > o) && this.videoElement.play().catch(() => {
|
|
3469
|
-
});
|
|
3470
|
-
const y = this.videoElement.currentTime * 1e3 - o, g = Math.abs(y);
|
|
3471
|
-
if (this.timeToIntercept !== void 0)
|
|
3472
|
-
if (g <= Se)
|
|
3473
|
-
console.log("intercepted", `${y.toFixed(0)}ms`), this.timeToIntercept = void 0;
|
|
3474
|
-
else {
|
|
3475
|
-
const r = y / (i - this.videoElement.playbackRate);
|
|
3476
|
-
r < this.timeToIntercept && r > 0 ? (console.debug(`intercepting ${r.toFixed(0)}ms`, `${y.toFixed(0)}ms`), this.timeToIntercept = r) : (console.debug("missed intercept", y, this.timeToIntercept, r), this.timeToIntercept = void 0);
|
|
3477
|
-
}
|
|
3478
|
-
switch (!0) {
|
|
3479
|
-
case g <= Se: {
|
|
3480
|
-
console.debug(`${i}x`, y.toFixed(0)), this.timeToIntercept = void 0, this.videoElement.playbackRate !== i && (this.videoElement.playbackRate = i), this.delay = ca;
|
|
3481
|
-
break;
|
|
3482
|
-
}
|
|
3483
|
-
case this.timeToIntercept !== void 0:
|
|
3484
|
-
this.delay = this.timeToIntercept * yt;
|
|
3485
|
-
break;
|
|
3486
|
-
case (i > 0 && g > Se && g <= Qt && this.timeToIntercept === void 0): {
|
|
3487
|
-
const r = ha(y), s = Math.max(0, i + r);
|
|
3488
|
-
this.timeToIntercept = y / (i - s), console.debug(`${s.toFixed(2)}x`, `${y.toFixed(0)}ms`), this.videoElement.playbackRate !== s && (this.videoElement.playbackRate = s), this.delay = this.timeToIntercept * yt;
|
|
3489
|
-
break;
|
|
3490
|
-
}
|
|
3491
|
-
default: {
|
|
3492
|
-
this.videoElement.playbackRate !== i && (this.videoElement.playbackRate = i), console.debug("seeking"), this.delay = 10, this.seekTo(o + i * la);
|
|
3493
|
-
break;
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
destroy() {
|
|
3498
|
-
this.videoElement && (this.videoElement.src = "", this.videoElement.remove());
|
|
3499
|
-
}
|
|
3500
|
-
}
|
|
3501
|
-
const va = 1e3, bt = 10, Xt = 1e3, ga = 200, ya = 0.2, ba = 0.5;
|
|
3502
|
-
function wa(e) {
|
|
3503
|
-
return Math.sign(e) * Math.pow(Math.abs(e) / Xt, ba) * ya;
|
|
3504
|
-
}
|
|
3505
|
-
class Ea extends Be {
|
|
3506
|
-
audioElement;
|
|
3507
|
-
isSeeking = !1;
|
|
3508
|
-
constructor(t, n, o, i) {
|
|
3509
|
-
super(t, n, o, i), this.clipElement = n;
|
|
3510
|
-
}
|
|
3511
|
-
updateAudioElement() {
|
|
3512
|
-
this.destroy(), this.audioElement = document.createElement("audio"), this.clipElement.replaceChildren(this.audioElement);
|
|
3513
|
-
}
|
|
3514
|
-
/**
|
|
3515
|
-
* Helper function to seek to a specified time.
|
|
3516
|
-
* Works with the update loop to poll until seeked event has fired.
|
|
3517
|
-
*/
|
|
3518
|
-
seekTo(t) {
|
|
3519
|
-
this.audioElement && (this.audioElement.addEventListener(
|
|
3520
|
-
"seeked",
|
|
3521
|
-
() => {
|
|
3522
|
-
this.isSeeking = !1;
|
|
3523
|
-
},
|
|
3524
|
-
{ once: !0, passive: !0 }
|
|
3525
|
-
), this.audioElement.currentTime = t / 1e3);
|
|
3526
|
-
}
|
|
3527
|
-
update() {
|
|
3528
|
-
if (this.isSeeking) return;
|
|
3529
|
-
this.delay = va;
|
|
3530
|
-
const t = Ee(this._state, Date.now());
|
|
3531
|
-
if (t ? (!this.audioElement || !this.isConnected(this.audioElement)) && this.updateAudioElement() : this.destroy(), !t || !this.audioElement) return;
|
|
3532
|
-
const { t: n, rate: o, volume: i } = { ...we, ...t }, a = this.constructAssetURL(this._state.file);
|
|
3533
|
-
this.audioElement.src.includes(a) || (this.audioElement.src = a), this.audioElement.volume !== i && (this.audioElement.volume = i), this.audioElement.paused && o > 0 && this.audioElement.play().catch(() => {
|
|
3534
|
-
});
|
|
3535
|
-
const l = this.audioElement.currentTime * 1e3 - n, d = Math.abs(l);
|
|
3536
|
-
switch (this.delay = 100, !0) {
|
|
3537
|
-
case d <= bt:
|
|
3538
|
-
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o);
|
|
3539
|
-
break;
|
|
3540
|
-
case (o > 0 && d > bt && d <= Xt): {
|
|
3541
|
-
const f = wa(l), y = Math.max(0, o - f);
|
|
3542
|
-
this.audioElement.playbackRate !== y && (this.audioElement.playbackRate = y);
|
|
3543
|
-
break;
|
|
3544
|
-
}
|
|
3545
|
-
default: {
|
|
3546
|
-
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (ga / 1e3));
|
|
3547
|
-
break;
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
destroy() {
|
|
3552
|
-
this.audioElement && (this.audioElement.src = "", this.audioElement.remove());
|
|
3553
|
-
}
|
|
3554
|
-
}
|
|
3555
|
-
const ka = "data-clip-id";
|
|
3556
|
-
class $a {
|
|
3557
|
-
constructor(t, n) {
|
|
3558
|
-
this.constructAssetUrl = t, this._element = document.createElement("div"), this._element.className = "surface-manager", this._element.style.width = "100%", this._element.style.height = "100%", this._state = n || {}, this.update();
|
|
3559
|
-
}
|
|
3560
|
-
_state = {};
|
|
3561
|
-
setState(t) {
|
|
3562
|
-
this._state = t, this.update();
|
|
3563
|
-
}
|
|
3564
|
-
_element;
|
|
3565
|
-
get element() {
|
|
3566
|
-
return this._element;
|
|
3567
|
-
}
|
|
3568
|
-
resources = {};
|
|
3569
|
-
update() {
|
|
3570
|
-
Object.entries(this.resources).forEach(([n, { element: o, manager: i }]) => {
|
|
3571
|
-
n in this._state || (delete this.resources[n], o.remove(), i?.destroy());
|
|
3572
|
-
});
|
|
3573
|
-
const t = Object.keys(this._state).toSorted().map((n) => {
|
|
3574
|
-
const o = this.resources[n];
|
|
3575
|
-
if (o)
|
|
3576
|
-
return o.element;
|
|
3577
|
-
{
|
|
3578
|
-
const i = document.createElement("div");
|
|
3579
|
-
return i.setAttribute(ka, n), this.resources[n] = { element: i }, i;
|
|
3580
|
-
}
|
|
3581
|
-
});
|
|
3582
|
-
this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
|
|
3583
|
-
const o = this._state[n], i = this.resources[n];
|
|
3584
|
-
if (!i)
|
|
3585
|
-
throw new Error("Failed to create resource");
|
|
3586
|
-
if (i.manager)
|
|
3587
|
-
i.manager.setState(o);
|
|
3588
|
-
else
|
|
3589
|
-
switch (o.type) {
|
|
3590
|
-
case "image":
|
|
3591
|
-
i.manager = new ua(this._element, i.element, o, this.constructAssetUrl);
|
|
3592
|
-
break;
|
|
3593
|
-
case "audio":
|
|
3594
|
-
i.manager = new Ea(this._element, i.element, o, this.constructAssetUrl);
|
|
3595
|
-
break;
|
|
3596
|
-
case "video":
|
|
3597
|
-
i.manager = new ma(this._element, i.element, o, this.constructAssetUrl);
|
|
3598
|
-
break;
|
|
3599
|
-
}
|
|
3600
|
-
});
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
var ze = {}, wt;
|
|
3604
|
-
function Ca() {
|
|
3605
|
-
return wt || (wt = 1, function(e) {
|
|
3286
|
+
var Se = {}, vt;
|
|
3287
|
+
function sa() {
|
|
3288
|
+
return vt || (vt = 1, function(e) {
|
|
3606
3289
|
var t = {};
|
|
3607
3290
|
/*! howler.js v2.2.1 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */
|
|
3608
3291
|
(function() {
|
|
@@ -3617,8 +3300,8 @@ function Ca() {
|
|
|
3617
3300
|
if (r = parseFloat(r), s.ctx || g(), r !== void 0 && r >= 0 && r <= 1) {
|
|
3618
3301
|
if (s._volume = r, s._muted) return s;
|
|
3619
3302
|
s.usingWebAudio && s.masterGain.gain.setValueAtTime(r, o.ctx.currentTime);
|
|
3620
|
-
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var
|
|
3621
|
-
var v = s._howls[u]._soundById(
|
|
3303
|
+
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), h = 0; h < d.length; h++) {
|
|
3304
|
+
var v = s._howls[u]._soundById(d[h]);
|
|
3622
3305
|
v && v._node && (v._node.volume = v._volume * r);
|
|
3623
3306
|
}
|
|
3624
3307
|
return s;
|
|
@@ -3627,8 +3310,8 @@ function Ca() {
|
|
|
3627
3310
|
}, mute: function(r) {
|
|
3628
3311
|
var s = this || o;
|
|
3629
3312
|
s.ctx || g(), s._muted = r, s.usingWebAudio && s.masterGain.gain.setValueAtTime(r ? 0 : s._volume, o.ctx.currentTime);
|
|
3630
|
-
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var
|
|
3631
|
-
var v = s._howls[u]._soundById(
|
|
3313
|
+
for (var u = 0; u < s._howls.length; u++) if (!s._howls[u]._webAudio) for (var d = s._howls[u]._getSoundIds(), h = 0; h < d.length; h++) {
|
|
3314
|
+
var v = s._howls[u]._soundById(d[h]);
|
|
3632
3315
|
v && v._node && (v._node.muted = !!r || v._muted);
|
|
3633
3316
|
}
|
|
3634
3317
|
return s;
|
|
@@ -3663,7 +3346,7 @@ function Ca() {
|
|
|
3663
3346
|
return r;
|
|
3664
3347
|
}
|
|
3665
3348
|
if (!s || typeof s.canPlayType != "function") return r;
|
|
3666
|
-
var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""),
|
|
3349
|
+
var u = s.canPlayType("audio/mpeg;").replace(/^no$/, ""), d = r._navigator && r._navigator.userAgent.match(/OPR\/([0-6].)/g), h = d && parseInt(d[0].split("/")[1], 10) < 33;
|
|
3667
3350
|
return r._codecs = { mp3: !(h || !u && !s.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!u, 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;
|
|
3668
3351
|
}, _unlockAudio: function() {
|
|
3669
3352
|
var r = this || o;
|
|
@@ -3671,8 +3354,8 @@ function Ca() {
|
|
|
3671
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);
|
|
3672
3355
|
var s = function(u) {
|
|
3673
3356
|
for (; r._html5AudioPool.length < r.html5PoolSize; ) try {
|
|
3674
|
-
var
|
|
3675
|
-
|
|
3357
|
+
var d = new Audio();
|
|
3358
|
+
d._unlocked = !0, r._releaseHtml5Audio(d);
|
|
3676
3359
|
} catch {
|
|
3677
3360
|
r.noAudio = !0;
|
|
3678
3361
|
break;
|
|
@@ -3709,10 +3392,10 @@ function Ca() {
|
|
|
3709
3392
|
return r._suspendTimer && clearTimeout(r._suspendTimer), r._suspendTimer = setTimeout(function() {
|
|
3710
3393
|
if (r.autoSuspend) {
|
|
3711
3394
|
r._suspendTimer = null, r.state = "suspending";
|
|
3712
|
-
var
|
|
3395
|
+
var d = function() {
|
|
3713
3396
|
r.state = "suspended", r._resumeAfterSuspend && (delete r._resumeAfterSuspend, r._autoResume());
|
|
3714
3397
|
};
|
|
3715
|
-
r.ctx.suspend().then(
|
|
3398
|
+
r.ctx.suspend().then(d, d);
|
|
3716
3399
|
}
|
|
3717
3400
|
}, 3e4), r;
|
|
3718
3401
|
}
|
|
@@ -3738,84 +3421,84 @@ function Ca() {
|
|
|
3738
3421
|
if (o.noAudio) return void r._emit("loaderror", null, "No audio support.");
|
|
3739
3422
|
typeof r._src == "string" && (r._src = [r._src]);
|
|
3740
3423
|
for (var u = 0; u < r._src.length; u++) {
|
|
3741
|
-
var
|
|
3742
|
-
if (r._format && r._format[u])
|
|
3424
|
+
var d, h;
|
|
3425
|
+
if (r._format && r._format[u]) d = r._format[u];
|
|
3743
3426
|
else {
|
|
3744
3427
|
if (typeof (h = r._src[u]) != "string") {
|
|
3745
3428
|
r._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
|
|
3746
3429
|
continue;
|
|
3747
3430
|
}
|
|
3748
|
-
|
|
3431
|
+
d = /^data:audio\/([^;,]+);/i.exec(h), d || (d = /\.([^.]+)$/.exec(h.split("?", 1)[0])), d && (d = d[1].toLowerCase());
|
|
3749
3432
|
}
|
|
3750
|
-
if (
|
|
3433
|
+
if (d || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'), d && o.codecs(d)) {
|
|
3751
3434
|
s = r._src[u];
|
|
3752
3435
|
break;
|
|
3753
3436
|
}
|
|
3754
3437
|
}
|
|
3755
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.");
|
|
3756
3439
|
}, play: function(r, s) {
|
|
3757
|
-
var u = this,
|
|
3758
|
-
if (typeof r == "number")
|
|
3440
|
+
var u = this, d = null;
|
|
3441
|
+
if (typeof r == "number") d = r, r = null;
|
|
3759
3442
|
else {
|
|
3760
3443
|
if (typeof r == "string" && u._state === "loaded" && !u._sprite[r]) return null;
|
|
3761
3444
|
if (r === void 0 && (r = "__default", !u._playLock)) {
|
|
3762
|
-
for (var h = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (h++,
|
|
3763
|
-
h === 1 ? r = null :
|
|
3445
|
+
for (var h = 0, v = 0; v < u._sounds.length; v++) u._sounds[v]._paused && !u._sounds[v]._ended && (h++, d = u._sounds[v]._id);
|
|
3446
|
+
h === 1 ? r = null : d = null;
|
|
3764
3447
|
}
|
|
3765
3448
|
}
|
|
3766
|
-
var _ =
|
|
3449
|
+
var _ = d ? u._soundById(d) : u._inactiveSound();
|
|
3767
3450
|
if (!_) return null;
|
|
3768
|
-
if (
|
|
3451
|
+
if (d && !r && (r = _._sprite || "__default"), u._state !== "loaded") {
|
|
3769
3452
|
_._sprite = r, _._ended = !1;
|
|
3770
3453
|
var w = _._id;
|
|
3771
3454
|
return u._queue.push({ event: "play", action: function() {
|
|
3772
3455
|
u.play(w);
|
|
3773
3456
|
} }), w;
|
|
3774
3457
|
}
|
|
3775
|
-
if (
|
|
3458
|
+
if (d && !_._paused) return s || u._loadQueue("play"), _._id;
|
|
3776
3459
|
u._webAudio && o._autoResume();
|
|
3777
|
-
var E = Math.max(0, _._seek > 0 ? _._seek : u._sprite[r][0] / 1e3), k = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - E), x = 1e3 * k / Math.abs(_._rate),
|
|
3460
|
+
var E = Math.max(0, _._seek > 0 ? _._seek : u._sprite[r][0] / 1e3), k = Math.max(0, (u._sprite[r][0] + u._sprite[r][1]) / 1e3 - E), x = 1e3 * k / Math.abs(_._rate), M = u._sprite[r][0] / 1e3, ie = (u._sprite[r][0] + u._sprite[r][1]) / 1e3;
|
|
3778
3461
|
_._sprite = r, _._ended = !1;
|
|
3779
|
-
var
|
|
3780
|
-
_._paused = !1, _._seek = E, _._start =
|
|
3462
|
+
var Ee = function() {
|
|
3463
|
+
_._paused = !1, _._seek = E, _._start = M, _._stop = ie, _._loop = !(!_._loop && !u._sprite[r][2]);
|
|
3781
3464
|
};
|
|
3782
|
-
if (E >=
|
|
3783
|
-
var
|
|
3465
|
+
if (E >= ie) return void u._ended(_);
|
|
3466
|
+
var A = _._node;
|
|
3784
3467
|
if (u._webAudio) {
|
|
3785
|
-
var
|
|
3786
|
-
u._playLock = !1,
|
|
3468
|
+
var Be = function() {
|
|
3469
|
+
u._playLock = !1, Ee(), u._refreshBuffer(_);
|
|
3787
3470
|
var W = _._muted || u._muted ? 0 : _._volume;
|
|
3788
|
-
|
|
3471
|
+
A.gain.setValueAtTime(W, o.ctx.currentTime), _._playStart = o.ctx.currentTime, A.bufferSource.start === void 0 ? _._loop ? A.bufferSource.noteGrainOn(0, E, 86400) : A.bufferSource.noteGrainOn(0, E, k) : _._loop ? A.bufferSource.start(0, E, 86400) : A.bufferSource.start(0, E, k), x !== 1 / 0 && (u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x)), s || setTimeout(function() {
|
|
3789
3472
|
u._emit("play", _._id), u._loadQueue();
|
|
3790
3473
|
}, 0);
|
|
3791
3474
|
};
|
|
3792
|
-
o.state === "running" && o.ctx.state !== "interrupted" ?
|
|
3475
|
+
o.state === "running" && o.ctx.state !== "interrupted" ? Be() : (u._playLock = !0, u.once("resume", Be), u._clearTimer(_._id));
|
|
3793
3476
|
} else {
|
|
3794
|
-
var
|
|
3795
|
-
|
|
3477
|
+
var Ge = function() {
|
|
3478
|
+
A.currentTime = E, A.muted = _._muted || u._muted || o._muted || A.muted, A.volume = _._volume * o.volume(), A.playbackRate = _._rate;
|
|
3796
3479
|
try {
|
|
3797
|
-
var W =
|
|
3798
|
-
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0,
|
|
3799
|
-
u._playLock = !1,
|
|
3480
|
+
var W = A.play();
|
|
3481
|
+
if (W && typeof Promise < "u" && (W instanceof Promise || typeof W.then == "function") ? (u._playLock = !0, Ee(), W.then(function() {
|
|
3482
|
+
u._playLock = !1, A._unlocked = !0, s || (u._emit("play", _._id), u._loadQueue());
|
|
3800
3483
|
}).catch(function() {
|
|
3801
3484
|
u._playLock = !1, u._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;
|
|
3802
|
-
})) : s || (u._playLock = !1,
|
|
3485
|
+
})) : s || (u._playLock = !1, Ee(), u._emit("play", _._id), u._loadQueue()), A.playbackRate = _._rate, A.paused) return void u._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.");
|
|
3803
3486
|
r !== "__default" || _._loop ? u._endTimers[_._id] = setTimeout(u._ended.bind(u, _), x) : (u._endTimers[_._id] = function() {
|
|
3804
|
-
u._ended(_),
|
|
3805
|
-
},
|
|
3806
|
-
} catch (
|
|
3807
|
-
u._emit("playerror", _._id,
|
|
3487
|
+
u._ended(_), A.removeEventListener("ended", u._endTimers[_._id], !1);
|
|
3488
|
+
}, A.addEventListener("ended", u._endTimers[_._id], !1));
|
|
3489
|
+
} catch (en) {
|
|
3490
|
+
u._emit("playerror", _._id, en);
|
|
3808
3491
|
}
|
|
3809
3492
|
};
|
|
3810
|
-
|
|
3811
|
-
var
|
|
3812
|
-
if (
|
|
3493
|
+
A.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (A.src = u._src, A.load());
|
|
3494
|
+
var Xt = window && window.ejecta || !A.readyState && o._navigator.isCocoonJS;
|
|
3495
|
+
if (A.readyState >= 3 || Xt) Ge();
|
|
3813
3496
|
else {
|
|
3814
3497
|
u._playLock = !0;
|
|
3815
|
-
var
|
|
3816
|
-
|
|
3498
|
+
var We = function() {
|
|
3499
|
+
Ge(), A.removeEventListener(o._canPlayEvent, We, !1);
|
|
3817
3500
|
};
|
|
3818
|
-
|
|
3501
|
+
A.addEventListener(o._canPlayEvent, We, !1), u._clearTimer(_._id);
|
|
3819
3502
|
}
|
|
3820
3503
|
}
|
|
3821
3504
|
return _._id;
|
|
@@ -3824,10 +3507,10 @@ function Ca() {
|
|
|
3824
3507
|
if (s._state !== "loaded" || s._playLock) return s._queue.push({ event: "pause", action: function() {
|
|
3825
3508
|
s.pause(r);
|
|
3826
3509
|
} }), s;
|
|
3827
|
-
for (var u = s._getSoundIds(r),
|
|
3828
|
-
s._clearTimer(u[
|
|
3829
|
-
var h = s._soundById(u[
|
|
3830
|
-
if (h && !h._paused && (h._seek = s.seek(u[
|
|
3510
|
+
for (var u = s._getSoundIds(r), d = 0; d < u.length; d++) {
|
|
3511
|
+
s._clearTimer(u[d]);
|
|
3512
|
+
var h = s._soundById(u[d]);
|
|
3513
|
+
if (h && !h._paused && (h._seek = s.seek(u[d]), h._rateSeek = 0, h._paused = !0, s._stopFade(u[d]), h._node)) if (s._webAudio) {
|
|
3831
3514
|
if (!h._node.bufferSource) continue;
|
|
3832
3515
|
h._node.bufferSource.stop === void 0 ? h._node.bufferSource.noteOff(0) : h._node.bufferSource.stop(0), s._cleanBuffer(h._node);
|
|
3833
3516
|
} else isNaN(h._node.duration) && h._node.duration !== 1 / 0 || h._node.pause();
|
|
@@ -3839,10 +3522,10 @@ function Ca() {
|
|
|
3839
3522
|
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "stop", action: function() {
|
|
3840
3523
|
u.stop(r, s);
|
|
3841
3524
|
} }), u;
|
|
3842
|
-
for (var
|
|
3843
|
-
u._clearTimer(
|
|
3844
|
-
var v = u._soundById(
|
|
3845
|
-
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(
|
|
3525
|
+
for (var d = u._getSoundIds(r), h = 0; h < d.length; h++) {
|
|
3526
|
+
u._clearTimer(d[h]);
|
|
3527
|
+
var v = u._soundById(d[h]);
|
|
3528
|
+
v && (v._seek = v._start || 0, v._rateSeek = 0, v._paused = !0, v._ended = !0, u._stopFade(d[h]), v._node && (u._webAudio ? v._node.bufferSource && (v._node.bufferSource.stop === void 0 ? v._node.bufferSource.noteOff(0) : v._node.bufferSource.stop(0), u._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 && u._clearSound(v._node))), s || u._emit("stop", v._id));
|
|
3846
3529
|
}
|
|
3847
3530
|
return u;
|
|
3848
3531
|
}, mute: function(r, s) {
|
|
@@ -3854,69 +3537,69 @@ function Ca() {
|
|
|
3854
3537
|
if (typeof r != "boolean") return u._muted;
|
|
3855
3538
|
u._muted = r;
|
|
3856
3539
|
}
|
|
3857
|
-
for (var
|
|
3858
|
-
var v = u._soundById(
|
|
3540
|
+
for (var d = u._getSoundIds(s), h = 0; h < d.length; h++) {
|
|
3541
|
+
var v = u._soundById(d[h]);
|
|
3859
3542
|
v && (v._muted = r, v._interval && u._stopFade(v._id), u._webAudio && v._node ? v._node.gain.setValueAtTime(r ? 0 : v._volume, o.ctx.currentTime) : v._node && (v._node.muted = !!o._muted || r), u._emit("mute", v._id));
|
|
3860
3543
|
}
|
|
3861
3544
|
return u;
|
|
3862
3545
|
}, volume: function() {
|
|
3863
|
-
var r, s, u = this,
|
|
3864
|
-
if (
|
|
3865
|
-
|
|
3546
|
+
var r, s, u = this, d = arguments;
|
|
3547
|
+
if (d.length === 0) return u._volume;
|
|
3548
|
+
d.length === 1 || d.length === 2 && d[1] === void 0 ? u._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));
|
|
3866
3549
|
var h;
|
|
3867
3550
|
if (!(r !== void 0 && r >= 0 && r <= 1)) return h = s ? u._soundById(s) : u._sounds[0], h ? h._volume : 0;
|
|
3868
3551
|
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "volume", action: function() {
|
|
3869
|
-
u.volume.apply(u,
|
|
3552
|
+
u.volume.apply(u, d);
|
|
3870
3553
|
} }), u;
|
|
3871
3554
|
s === void 0 && (u._volume = r), s = u._getSoundIds(s);
|
|
3872
|
-
for (var v = 0; v < s.length; v++) (h = u._soundById(s[v])) && (h._volume = r,
|
|
3555
|
+
for (var v = 0; v < s.length; v++) (h = u._soundById(s[v])) && (h._volume = r, d[2] || u._stopFade(s[v]), u._webAudio && h._node && !h._muted ? h._node.gain.setValueAtTime(r, o.ctx.currentTime) : h._node && !h._muted && (h._node.volume = r * o.volume()), u._emit("volume", h._id));
|
|
3873
3556
|
return u;
|
|
3874
|
-
}, fade: function(r, s, u,
|
|
3557
|
+
}, fade: function(r, s, u, d) {
|
|
3875
3558
|
var h = this;
|
|
3876
3559
|
if (h._state !== "loaded" || h._playLock) return h._queue.push({ event: "fade", action: function() {
|
|
3877
|
-
h.fade(r, s, u,
|
|
3560
|
+
h.fade(r, s, u, d);
|
|
3878
3561
|
} }), h;
|
|
3879
|
-
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), h.volume(r,
|
|
3880
|
-
for (var v = h._getSoundIds(
|
|
3562
|
+
r = Math.min(Math.max(0, parseFloat(r)), 1), s = Math.min(Math.max(0, parseFloat(s)), 1), u = parseFloat(u), h.volume(r, d);
|
|
3563
|
+
for (var v = h._getSoundIds(d), _ = 0; _ < v.length; _++) {
|
|
3881
3564
|
var w = h._soundById(v[_]);
|
|
3882
3565
|
if (w) {
|
|
3883
|
-
if (
|
|
3566
|
+
if (d || h._stopFade(v[_]), h._webAudio && !w._muted) {
|
|
3884
3567
|
var E = o.ctx.currentTime, k = E + u / 1e3;
|
|
3885
3568
|
w._volume = r, w._node.gain.setValueAtTime(r, E), w._node.gain.linearRampToValueAtTime(s, k);
|
|
3886
3569
|
}
|
|
3887
|
-
h._startFadeInterval(w, r, s, u, v[_],
|
|
3570
|
+
h._startFadeInterval(w, r, s, u, v[_], d === void 0);
|
|
3888
3571
|
}
|
|
3889
3572
|
}
|
|
3890
3573
|
return h;
|
|
3891
|
-
}, _startFadeInterval: function(r, s, u,
|
|
3892
|
-
var _ = this, w = s, E = u - s, k = Math.abs(E / 0.01), x = Math.max(4, k > 0 ?
|
|
3574
|
+
}, _startFadeInterval: function(r, s, u, d, h, v) {
|
|
3575
|
+
var _ = this, w = s, E = u - s, k = Math.abs(E / 0.01), x = Math.max(4, k > 0 ? d / k : d), M = Date.now();
|
|
3893
3576
|
r._fadeTo = u, r._interval = setInterval(function() {
|
|
3894
|
-
var
|
|
3895
|
-
|
|
3577
|
+
var ie = (Date.now() - M) / d;
|
|
3578
|
+
M = Date.now(), w += E * ie, w = Math.round(100 * w) / 100, w = E < 0 ? Math.max(u, w) : Math.min(u, w), _._webAudio ? r._volume = w : _.volume(w, r._id, !0), v && (_._volume = w), (u < s && w <= u || u > s && w >= u) && (clearInterval(r._interval), r._interval = null, r._fadeTo = null, _.volume(u, r._id), _._emit("fade", r._id));
|
|
3896
3579
|
}, x);
|
|
3897
3580
|
}, _stopFade: function(r) {
|
|
3898
3581
|
var s = this, u = s._soundById(r);
|
|
3899
3582
|
return u && u._interval && (s._webAudio && u._node.gain.cancelScheduledValues(o.ctx.currentTime), clearInterval(u._interval), u._interval = null, s.volume(u._fadeTo, r), u._fadeTo = null, s._emit("fade", r)), s;
|
|
3900
3583
|
}, loop: function() {
|
|
3901
|
-
var r, s, u,
|
|
3902
|
-
if (h.length === 0) return
|
|
3584
|
+
var r, s, u, d = this, h = arguments;
|
|
3585
|
+
if (h.length === 0) return d._loop;
|
|
3903
3586
|
if (h.length === 1) {
|
|
3904
|
-
if (typeof h[0] != "boolean") return !!(u =
|
|
3905
|
-
r = h[0],
|
|
3587
|
+
if (typeof h[0] != "boolean") return !!(u = d._soundById(parseInt(h[0], 10))) && u._loop;
|
|
3588
|
+
r = h[0], d._loop = r;
|
|
3906
3589
|
} else h.length === 2 && (r = h[0], s = parseInt(h[1], 10));
|
|
3907
|
-
for (var v =
|
|
3908
|
-
return
|
|
3590
|
+
for (var v = d._getSoundIds(s), _ = 0; _ < v.length; _++) (u = d._soundById(v[_])) && (u._loop = r, d._webAudio && u._node && u._node.bufferSource && (u._node.bufferSource.loop = r, r && (u._node.bufferSource.loopStart = u._start || 0, u._node.bufferSource.loopEnd = u._stop)));
|
|
3591
|
+
return d;
|
|
3909
3592
|
}, rate: function() {
|
|
3910
|
-
var r, s, u = this,
|
|
3911
|
-
if (
|
|
3912
|
-
else if (
|
|
3913
|
-
var h = u._getSoundIds(), v = h.indexOf(
|
|
3914
|
-
v >= 0 ? s = parseInt(
|
|
3915
|
-
} else
|
|
3593
|
+
var r, s, u = this, d = arguments;
|
|
3594
|
+
if (d.length === 0) s = u._sounds[0]._id;
|
|
3595
|
+
else if (d.length === 1) {
|
|
3596
|
+
var h = u._getSoundIds(), v = h.indexOf(d[0]);
|
|
3597
|
+
v >= 0 ? s = parseInt(d[0], 10) : r = parseFloat(d[0]);
|
|
3598
|
+
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3916
3599
|
var _;
|
|
3917
3600
|
if (typeof r != "number") return _ = u._soundById(s), _ ? _._rate : u._rate;
|
|
3918
3601
|
if (u._state !== "loaded" || u._playLock) return u._queue.push({ event: "rate", action: function() {
|
|
3919
|
-
u.rate.apply(u,
|
|
3602
|
+
u.rate.apply(u, d);
|
|
3920
3603
|
} }), u;
|
|
3921
3604
|
s === void 0 && (u._rate = r), s = u._getSoundIds(s);
|
|
3922
3605
|
for (var w = 0; w < s.length; w++) if (_ = u._soundById(s[w])) {
|
|
@@ -3926,15 +3609,15 @@ function Ca() {
|
|
|
3926
3609
|
}
|
|
3927
3610
|
return u;
|
|
3928
3611
|
}, seek: function() {
|
|
3929
|
-
var r, s, u = this,
|
|
3930
|
-
if (
|
|
3931
|
-
else if (
|
|
3932
|
-
var h = u._getSoundIds(), v = h.indexOf(
|
|
3933
|
-
v >= 0 ? s = parseInt(
|
|
3934
|
-
} else
|
|
3612
|
+
var r, s, u = this, d = arguments;
|
|
3613
|
+
if (d.length === 0) s = u._sounds[0]._id;
|
|
3614
|
+
else if (d.length === 1) {
|
|
3615
|
+
var h = u._getSoundIds(), v = h.indexOf(d[0]);
|
|
3616
|
+
v >= 0 ? s = parseInt(d[0], 10) : u._sounds.length && (s = u._sounds[0]._id, r = parseFloat(d[0]));
|
|
3617
|
+
} else d.length === 2 && (r = parseFloat(d[0]), s = parseInt(d[1], 10));
|
|
3935
3618
|
if (s === void 0) return u;
|
|
3936
3619
|
if (typeof r == "number" && (u._state !== "loaded" || u._playLock)) return u._queue.push({ event: "seek", action: function() {
|
|
3937
|
-
u.seek.apply(u,
|
|
3620
|
+
u.seek.apply(u, d);
|
|
3938
3621
|
} }), u;
|
|
3939
3622
|
var _ = u._soundById(s);
|
|
3940
3623
|
if (_) {
|
|
@@ -3951,10 +3634,10 @@ function Ca() {
|
|
|
3951
3634
|
u._emit("seek", s), k && u.play(s, !0);
|
|
3952
3635
|
};
|
|
3953
3636
|
if (k && !u._webAudio) {
|
|
3954
|
-
var
|
|
3955
|
-
u._playLock ? setTimeout(
|
|
3637
|
+
var M = function() {
|
|
3638
|
+
u._playLock ? setTimeout(M, 0) : x();
|
|
3956
3639
|
};
|
|
3957
|
-
setTimeout(
|
|
3640
|
+
setTimeout(M, 0);
|
|
3958
3641
|
} else x();
|
|
3959
3642
|
}
|
|
3960
3643
|
return u;
|
|
@@ -3964,28 +3647,28 @@ function Ca() {
|
|
|
3964
3647
|
var u = s._soundById(r);
|
|
3965
3648
|
return !!u && !u._paused;
|
|
3966
3649
|
}
|
|
3967
|
-
for (var
|
|
3650
|
+
for (var d = 0; d < s._sounds.length; d++) if (!s._sounds[d]._paused) return !0;
|
|
3968
3651
|
return !1;
|
|
3969
3652
|
}, duration: function(r) {
|
|
3970
|
-
var s = this, u = s._duration,
|
|
3971
|
-
return
|
|
3653
|
+
var s = this, u = s._duration, d = s._soundById(r);
|
|
3654
|
+
return d && (u = s._sprite[d._sprite][1] / 1e3), u;
|
|
3972
3655
|
}, state: function() {
|
|
3973
3656
|
return this._state;
|
|
3974
3657
|
}, unload: function() {
|
|
3975
3658
|
for (var r = this, s = r._sounds, u = 0; u < s.length; u++) s[u]._paused || r.stop(s[u]._id), r._webAudio || (r._clearSound(s[u]._node), s[u]._node.removeEventListener("error", s[u]._errorFn, !1), s[u]._node.removeEventListener(o._canPlayEvent, s[u]._loadFn, !1), s[u]._node.removeEventListener("ended", s[u]._endFn, !1), o._releaseHtml5Audio(s[u]._node)), delete s[u]._node, r._clearTimer(s[u]._id);
|
|
3976
|
-
var
|
|
3977
|
-
|
|
3659
|
+
var d = o._howls.indexOf(r);
|
|
3660
|
+
d >= 0 && o._howls.splice(d, 1);
|
|
3978
3661
|
var h = !0;
|
|
3979
3662
|
for (u = 0; u < o._howls.length; u++) if (o._howls[u]._src === r._src || r._src.indexOf(o._howls[u]._src) >= 0) {
|
|
3980
3663
|
h = !1;
|
|
3981
3664
|
break;
|
|
3982
3665
|
}
|
|
3983
3666
|
return c && h && delete c[r._src], o.noAudio = !1, r._state = "unloaded", r._sounds = [], r = null, null;
|
|
3984
|
-
}, on: function(r, s, u,
|
|
3667
|
+
}, on: function(r, s, u, d) {
|
|
3985
3668
|
var h = this, v = h["_on" + r];
|
|
3986
|
-
return typeof s == "function" && v.push(
|
|
3669
|
+
return typeof s == "function" && v.push(d ? { id: u, fn: s, once: d } : { id: u, fn: s }), h;
|
|
3987
3670
|
}, off: function(r, s, u) {
|
|
3988
|
-
var
|
|
3671
|
+
var d = this, h = d["_on" + r], v = 0;
|
|
3989
3672
|
if (typeof s == "number" && (u = s, s = null), s || u) for (v = 0; v < h.length; v++) {
|
|
3990
3673
|
var _ = u === h[v].id;
|
|
3991
3674
|
if (s === h[v].fn && _ || !s && _) {
|
|
@@ -3993,20 +3676,20 @@ function Ca() {
|
|
|
3993
3676
|
break;
|
|
3994
3677
|
}
|
|
3995
3678
|
}
|
|
3996
|
-
else if (r)
|
|
3679
|
+
else if (r) d["_on" + r] = [];
|
|
3997
3680
|
else {
|
|
3998
|
-
var w = Object.keys(
|
|
3999
|
-
for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(
|
|
3681
|
+
var w = Object.keys(d);
|
|
3682
|
+
for (v = 0; v < w.length; v++) w[v].indexOf("_on") === 0 && Array.isArray(d[w[v]]) && (d[w[v]] = []);
|
|
4000
3683
|
}
|
|
4001
|
-
return
|
|
3684
|
+
return d;
|
|
4002
3685
|
}, once: function(r, s, u) {
|
|
4003
|
-
var
|
|
4004
|
-
return
|
|
3686
|
+
var d = this;
|
|
3687
|
+
return d.on(r, s, u, 1), d;
|
|
4005
3688
|
}, _emit: function(r, s, u) {
|
|
4006
|
-
for (var
|
|
3689
|
+
for (var d = this, h = d["_on" + r], v = h.length - 1; v >= 0; v--) h[v].id && h[v].id !== s && r !== "load" || (setTimeout((function(_) {
|
|
4007
3690
|
_.call(this, s, u);
|
|
4008
|
-
}).bind(
|
|
4009
|
-
return
|
|
3691
|
+
}).bind(d, h[v].fn), 0), h[v].once && d.off(r, h[v].fn, h[v].id));
|
|
3692
|
+
return d._loadQueue(r), d;
|
|
4010
3693
|
}, _loadQueue: function(r) {
|
|
4011
3694
|
var s = this;
|
|
4012
3695
|
if (s._queue.length > 0) {
|
|
@@ -4017,13 +3700,13 @@ function Ca() {
|
|
|
4017
3700
|
}, _ended: function(r) {
|
|
4018
3701
|
var s = this, u = r._sprite;
|
|
4019
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;
|
|
4020
|
-
var
|
|
4021
|
-
if (s._emit("end", r._id), !s._webAudio &&
|
|
3703
|
+
var d = !(!r._loop && !s._sprite[u][2]);
|
|
3704
|
+
if (s._emit("end", r._id), !s._webAudio && d && s.stop(r._id, !0).play(r._id), s._webAudio && d) {
|
|
4022
3705
|
s._emit("play", r._id), r._seek = r._start || 0, r._rateSeek = 0, r._playStart = o.ctx.currentTime;
|
|
4023
3706
|
var h = 1e3 * (r._stop - r._start) / Math.abs(r._rate);
|
|
4024
3707
|
s._endTimers[r._id] = setTimeout(s._ended.bind(s, r), h);
|
|
4025
3708
|
}
|
|
4026
|
-
return s._webAudio && !
|
|
3709
|
+
return s._webAudio && !d && (r._paused = !0, r._ended = !0, r._seek = r._start || 0, r._rateSeek = 0, s._clearTimer(r._id), s._cleanBuffer(r._node), o._autoSuspend()), s._webAudio || d || s.stop(r._id, !0), s;
|
|
4027
3710
|
}, _clearTimer: function(r) {
|
|
4028
3711
|
var s = this;
|
|
4029
3712
|
if (s._endTimers[r]) {
|
|
@@ -4044,18 +3727,18 @@ function Ca() {
|
|
|
4044
3727
|
for (var s = 0; s < r._sounds.length; s++) if (r._sounds[s]._ended) return r._sounds[s].reset();
|
|
4045
3728
|
return new a(r);
|
|
4046
3729
|
}, _drain: function() {
|
|
4047
|
-
var r = this, s = r._pool, u = 0,
|
|
3730
|
+
var r = this, s = r._pool, u = 0, d = 0;
|
|
4048
3731
|
if (!(r._sounds.length < s)) {
|
|
4049
|
-
for (
|
|
4050
|
-
for (
|
|
3732
|
+
for (d = 0; d < r._sounds.length; d++) r._sounds[d]._ended && u++;
|
|
3733
|
+
for (d = r._sounds.length - 1; d >= 0; d--) {
|
|
4051
3734
|
if (u <= s) return;
|
|
4052
|
-
r._sounds[
|
|
3735
|
+
r._sounds[d]._ended && (r._webAudio && r._sounds[d]._node && r._sounds[d]._node.disconnect(0), r._sounds.splice(d, 1), u--);
|
|
4053
3736
|
}
|
|
4054
3737
|
}
|
|
4055
3738
|
}, _getSoundIds: function(r) {
|
|
4056
3739
|
var s = this;
|
|
4057
3740
|
if (r === void 0) {
|
|
4058
|
-
for (var u = [],
|
|
3741
|
+
for (var u = [], d = 0; d < s._sounds.length; d++) u.push(s._sounds[d]._id);
|
|
4059
3742
|
return u;
|
|
4060
3743
|
}
|
|
4061
3744
|
return [r];
|
|
@@ -4098,8 +3781,8 @@ function Ca() {
|
|
|
4098
3781
|
var s = r._src;
|
|
4099
3782
|
if (c[s]) return r._duration = c[s].duration, void y(r);
|
|
4100
3783
|
if (/^data:[^;]+;base64,/.test(s)) {
|
|
4101
|
-
for (var u = atob(s.split(",")[1]),
|
|
4102
|
-
f(
|
|
3784
|
+
for (var u = atob(s.split(",")[1]), d = new Uint8Array(u.length), h = 0; h < u.length; ++h) d[h] = u.charCodeAt(h);
|
|
3785
|
+
f(d.buffer, r);
|
|
4103
3786
|
} else {
|
|
4104
3787
|
var v = new XMLHttpRequest();
|
|
4105
3788
|
v.open(r._xhr.method, s, !0), v.withCredentials = r._xhr.withCredentials, v.responseType = "arraybuffer", r._xhr.headers && Object.keys(r._xhr.headers).forEach(function(_) {
|
|
@@ -4110,9 +3793,9 @@ function Ca() {
|
|
|
4110
3793
|
f(v.response, r);
|
|
4111
3794
|
}, v.onerror = function() {
|
|
4112
3795
|
r._webAudio && (r._html5 = !0, r._webAudio = !1, r._sounds = [], delete c[s], r.load());
|
|
4113
|
-
},
|
|
3796
|
+
}, p(v);
|
|
4114
3797
|
}
|
|
4115
|
-
},
|
|
3798
|
+
}, p = function(r) {
|
|
4116
3799
|
try {
|
|
4117
3800
|
r.send();
|
|
4118
3801
|
} catch {
|
|
@@ -4121,10 +3804,10 @@ function Ca() {
|
|
|
4121
3804
|
}, f = function(r, s) {
|
|
4122
3805
|
var u = function() {
|
|
4123
3806
|
s._emit("loaderror", null, "Decoding audio data failed.");
|
|
4124
|
-
},
|
|
3807
|
+
}, d = function(h) {
|
|
4125
3808
|
h && s._sounds.length > 0 ? (c[s._src] = h, y(s, h)) : u();
|
|
4126
3809
|
};
|
|
4127
|
-
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(
|
|
3810
|
+
typeof Promise < "u" && o.ctx.decodeAudioData.length === 1 ? o.ctx.decodeAudioData(r).then(d).catch(u) : o.ctx.decodeAudioData(r, d, u);
|
|
4128
3811
|
}, y = function(r, s) {
|
|
4129
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());
|
|
4130
3813
|
}, g = function() {
|
|
@@ -4137,19 +3820,19 @@ function Ca() {
|
|
|
4137
3820
|
o.ctx || (o.usingWebAudio = !1);
|
|
4138
3821
|
var r = /iP(hone|od|ad)/.test(o._navigator && o._navigator.platform), s = o._navigator && o._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), u = s ? parseInt(s[1], 10) : null;
|
|
4139
3822
|
if (r && u && u < 9) {
|
|
4140
|
-
var
|
|
4141
|
-
o._navigator && !
|
|
3823
|
+
var d = /safari/.test(o._navigator && o._navigator.userAgent.toLowerCase());
|
|
3824
|
+
o._navigator && !d && (o.usingWebAudio = !1);
|
|
4142
3825
|
}
|
|
4143
3826
|
o.usingWebAudio && (o.masterGain = o.ctx.createGain === void 0 ? o.ctx.createGainNode() : o.ctx.createGain(), o.masterGain.gain.setValueAtTime(o._muted ? 0 : o._volume, o.ctx.currentTime), o.masterGain.connect(o.ctx.destination)), o._setup();
|
|
4144
3827
|
}
|
|
4145
3828
|
};
|
|
4146
3829
|
e.Howler = o, e.Howl = i, typeof t < "u" ? (t.HowlerGlobal = n, t.Howler = o, t.Howl = i, t.Sound = a) : typeof window < "u" && (window.HowlerGlobal = n, window.Howler = o, window.Howl = i, window.Sound = a);
|
|
4147
3830
|
})();
|
|
4148
|
-
}(
|
|
3831
|
+
}(Se)), Se;
|
|
4149
3832
|
}
|
|
4150
|
-
var
|
|
4151
|
-
const
|
|
4152
|
-
class
|
|
3833
|
+
var gt = sa();
|
|
3834
|
+
const aa = typeof navigator < "u" && typeof navigator.standalone < "u";
|
|
3835
|
+
class $a {
|
|
4153
3836
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4154
3837
|
constructor(t) {
|
|
4155
3838
|
this.cogsConnection = t, this.addEventListener("audioClipState", ({ detail: o }) => {
|
|
@@ -4185,8 +3868,8 @@ class Oa {
|
|
|
4185
3868
|
const n = () => {
|
|
4186
3869
|
const o = Object.entries(this.audioClipPlayers).map(([i, a]) => {
|
|
4187
3870
|
const c = Object.values(a.activeClips), l = c.some(
|
|
4188
|
-
({ state:
|
|
4189
|
-
) ? "playing" : c.some(({ state:
|
|
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" : c.some(({ state: p }) => p.type === "paused") ? "paused" : "stopped";
|
|
4190
3873
|
return [i, l];
|
|
4191
3874
|
});
|
|
4192
3875
|
t.sendInitialMediaClipStates({ mediaType: "audio", files: o });
|
|
@@ -4198,20 +3881,20 @@ class Oa {
|
|
|
4198
3881
|
audioClipPlayers = {};
|
|
4199
3882
|
sinkId = "";
|
|
4200
3883
|
setGlobalVolume(t) {
|
|
4201
|
-
this.globalVolume = t,
|
|
3884
|
+
this.globalVolume = t, gt.Howler.volume(t), this.notifyStateListeners();
|
|
4202
3885
|
}
|
|
4203
3886
|
playAudioClip(t, { playId: n, volume: o, fade: i, loop: a }) {
|
|
4204
3887
|
t in this.audioClipPlayers || (this.audioClipPlayers[t] = this.createClip(t, { preload: !1, ephemeral: !0 })), this.updateAudioClipPlayer(t, (c) => {
|
|
4205
|
-
const l = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)),
|
|
3888
|
+
const l = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "paused").map(([g]) => parseInt(g)), p = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pausing").map(([g]) => parseInt(g));
|
|
4206
3889
|
l.forEach((g) => {
|
|
4207
3890
|
c.player.play(g);
|
|
4208
3891
|
});
|
|
4209
|
-
const f = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 ||
|
|
4210
|
-
return
|
|
4211
|
-
c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(c.player, o, i * 1e3, g) :
|
|
3892
|
+
const f = Object.entries(c.activeClips).filter(([, { state: g }]) => g.type === "pause_requested").map(([g]) => parseInt(g)), y = l.length > 0 || p.length > 0 || f.length > 0 ? [] : [c.player.play()];
|
|
3893
|
+
return p.forEach((g) => {
|
|
3894
|
+
c.player.off("fade", void 0, g), c.player.loop(a, g), this.updateActiveAudioClip(t, g, (r) => ({ ...r, state: { type: "playing" } })), ne(i) ? oe(c.player, o, i * 1e3, g) : Te(c.player, o, g);
|
|
4212
3895
|
}), [...l, ...f, ...y].forEach((g) => {
|
|
4213
3896
|
c.player.loop(a, g), c.player.off("play", void 0, g), c.player.off("pause", void 0, g), c.player.off("fade", void 0, g), c.player.off("end", void 0, g), c.player.off("stop", void 0, g), c.player.once("play", () => {
|
|
4214
|
-
|
|
3897
|
+
Ae(c.player, this.sinkId);
|
|
4215
3898
|
}), c.player.once("stop", () => this.handleStoppedClip(t, n, g), g), c.player.on(
|
|
4216
3899
|
"end",
|
|
4217
3900
|
() => {
|
|
@@ -4238,35 +3921,35 @@ class Oa {
|
|
|
4238
3921
|
oe(c.player, o, i * 1e3, g);
|
|
4239
3922
|
},
|
|
4240
3923
|
g
|
|
4241
|
-
)) :
|
|
3924
|
+
)) : Te(c.player, o, g), c.activeClips = { ...c.activeClips, [g]: r };
|
|
4242
3925
|
}), c;
|
|
4243
3926
|
}), this.notifyClipStateListeners(n, t, "playing");
|
|
4244
3927
|
}
|
|
4245
3928
|
pauseAudioClip(t, { fade: n }, o, i) {
|
|
4246
3929
|
Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
4247
3930
|
Object.entries(a.activeClips).map(([c, l]) => {
|
|
4248
|
-
const
|
|
4249
|
-
return (o === void 0 || o ===
|
|
3931
|
+
const p = parseInt(c);
|
|
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(
|
|
4250
3933
|
"fade",
|
|
4251
3934
|
(f) => {
|
|
4252
3935
|
a.player.pause(f), this.updateActiveAudioClip(t, f, (y) => ({ ...y, state: { type: "paused" } })), this.notifyClipStateListeners(l.playId, t, "paused");
|
|
4253
3936
|
},
|
|
4254
|
-
|
|
4255
|
-
), oe(a.player, 0, n * 1e3,
|
|
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 })), [c, l];
|
|
4256
3939
|
})
|
|
4257
3940
|
), a));
|
|
4258
3941
|
}
|
|
4259
3942
|
stopAudioClip(t, { fade: n }, o, i) {
|
|
4260
|
-
|
|
3943
|
+
ua("Stop audio clip", { activeClips: this.audioClipPlayers[t]?.activeClips }), Object.keys(this.audioClipPlayers[t]?.activeClips ?? {}).length !== 0 && this.updateAudioClipPlayer(t, (a) => (a.activeClips = Object.fromEntries(
|
|
4261
3944
|
Object.entries(a.activeClips).map(([c, l]) => {
|
|
4262
|
-
const
|
|
4263
|
-
return (o === void 0 || o ===
|
|
3945
|
+
const p = parseInt(c);
|
|
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(
|
|
4264
3947
|
"fade",
|
|
4265
3948
|
(f) => {
|
|
4266
3949
|
a.player.loop(!1, f), a.player.stop(f);
|
|
4267
3950
|
},
|
|
4268
|
-
|
|
4269
|
-
), l.state = { type: "stopping" }) : (a.player.loop(!1,
|
|
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 })), [c, l];
|
|
4270
3953
|
})
|
|
4271
3954
|
), a));
|
|
4272
3955
|
}
|
|
@@ -4284,7 +3967,7 @@ class Oa {
|
|
|
4284
3967
|
Object.entries(i.activeClips).map(([a, c]) => {
|
|
4285
3968
|
if (c.state.type !== "pausing" && c.state.type !== "stopping") {
|
|
4286
3969
|
const l = parseInt(a);
|
|
4287
|
-
return ne(o) ? oe(i.player, n, o * 1e3, l) :
|
|
3970
|
+
return ne(o) ? oe(i.player, n, o * 1e3, l) : Te(i.player, n, l), [a, { ...c, volume: n }];
|
|
4288
3971
|
} else
|
|
4289
3972
|
return [a, c];
|
|
4290
3973
|
})
|
|
@@ -4306,7 +3989,7 @@ class Oa {
|
|
|
4306
3989
|
}
|
|
4307
3990
|
setAudioSink(t) {
|
|
4308
3991
|
for (const n of Object.values(this.audioClipPlayers))
|
|
4309
|
-
|
|
3992
|
+
Ae(n.player, t);
|
|
4310
3993
|
this.sinkId = t;
|
|
4311
3994
|
}
|
|
4312
3995
|
updateConfig(t) {
|
|
@@ -4319,13 +4002,13 @@ class Oa {
|
|
|
4319
4002
|
this.audioClipPlayers = (() => {
|
|
4320
4003
|
const i = { ...o };
|
|
4321
4004
|
return Object.keys(o).filter(
|
|
4322
|
-
(
|
|
4323
|
-
).forEach((
|
|
4324
|
-
o[
|
|
4325
|
-
}), Object.entries(n).filter(([
|
|
4326
|
-
i[
|
|
4327
|
-
}), Object.keys(o).filter((
|
|
4328
|
-
i[
|
|
4005
|
+
(p) => !(p in n) && !o[p].config.ephemeral
|
|
4006
|
+
).forEach((p) => {
|
|
4007
|
+
o[p].player.unload(), delete i[p];
|
|
4008
|
+
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, f]) => {
|
|
4009
|
+
i[p] = this.createClip(p, { ...f, ephemeral: !1 });
|
|
4010
|
+
}), Object.keys(o).filter((p) => p in n).forEach((p) => {
|
|
4011
|
+
i[p] = this.updatedClip(p, i[p], { ...n[p], ephemeral: !1 });
|
|
4329
4012
|
}), i;
|
|
4330
4013
|
})(), this.notifyStateListeners();
|
|
4331
4014
|
}
|
|
@@ -4359,7 +4042,7 @@ class Oa {
|
|
|
4359
4042
|
this.eventTarget.dispatchEvent(new CustomEvent(t, { detail: n }));
|
|
4360
4043
|
}
|
|
4361
4044
|
createPlayer(t, n) {
|
|
4362
|
-
const o = new
|
|
4045
|
+
const o = new gt.Howl({
|
|
4363
4046
|
src: this.cogsConnection.getAssetUrl(t),
|
|
4364
4047
|
autoplay: !1,
|
|
4365
4048
|
loop: !1,
|
|
@@ -4367,7 +4050,7 @@ class Oa {
|
|
|
4367
4050
|
html5: !0,
|
|
4368
4051
|
preload: n.preload
|
|
4369
4052
|
});
|
|
4370
|
-
return
|
|
4053
|
+
return Ae(o, this.sinkId), o;
|
|
4371
4054
|
}
|
|
4372
4055
|
createClip(t, n) {
|
|
4373
4056
|
return {
|
|
@@ -4381,23 +4064,23 @@ class Oa {
|
|
|
4381
4064
|
return n.config.preload !== o.preload && (i.player.unload(), i.player = this.createPlayer(t, o)), i;
|
|
4382
4065
|
}
|
|
4383
4066
|
}
|
|
4384
|
-
function
|
|
4067
|
+
function ua(...e) {
|
|
4385
4068
|
}
|
|
4386
4069
|
function ne(e) {
|
|
4387
|
-
return !
|
|
4070
|
+
return !aa && typeof e == "number" && !isNaN(e) && e > 0;
|
|
4388
4071
|
}
|
|
4389
|
-
function
|
|
4072
|
+
function Ae(e, t) {
|
|
4390
4073
|
t !== void 0 && (e._html5 ? e._sounds?.forEach((n) => {
|
|
4391
4074
|
n._node?.setSinkId?.(t);
|
|
4392
4075
|
}) : console.warn("Cannot set sink ID: web audio not supported", e));
|
|
4393
4076
|
}
|
|
4394
|
-
function
|
|
4077
|
+
function Te(e, t, n) {
|
|
4395
4078
|
e.volume(t, n), e.mute(t === 0, n);
|
|
4396
4079
|
}
|
|
4397
4080
|
function oe(e, t, n, o) {
|
|
4398
4081
|
e.fade(e.volume(o), t, n, o);
|
|
4399
4082
|
}
|
|
4400
|
-
var
|
|
4083
|
+
var Pe = /* @__PURE__ */ ((e) => (e.Paused = "paused", e.Playing = "playing", e))(Pe || {});
|
|
4401
4084
|
class Za {
|
|
4402
4085
|
constructor(t, n = document.body) {
|
|
4403
4086
|
this.cogsConnection = t, this.parentElement = n, this.addEventListener("videoClipState", ({ detail: i }) => {
|
|
@@ -4459,11 +4142,11 @@ class Za {
|
|
|
4459
4142
|
}
|
|
4460
4143
|
setGlobalVolume(t) {
|
|
4461
4144
|
Object.values(this.videoClipPlayers).forEach((n) => {
|
|
4462
|
-
|
|
4145
|
+
de(n.videoElement, n.volume * t);
|
|
4463
4146
|
}), this.globalVolume = t, this.notifyStateListeners();
|
|
4464
4147
|
}
|
|
4465
4148
|
playVideoClip(t, { playId: n, volume: o, loop: i, fit: a }) {
|
|
4466
|
-
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (c) => (c.videoElement.load(), c)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (c) => (c.volume = o,
|
|
4149
|
+
this.videoClipPlayers[t] || (this.videoClipPlayers[t] = this.createClipPlayer(t, { preload: "none", ephemeral: !0, fit: a })), this.pendingClip && this.updateVideoClipPlayer(this.pendingClip.path, (c) => (c.videoElement.load(), c)), this.activeClip?.path !== t && (this.pendingClip = { path: t, playId: n, actionOncePlaying: "play" }), this.updateVideoClipPlayer(t, (c) => (c.volume = o, de(c.videoElement, o * this.globalVolume), c.videoElement.loop = i, c.videoElement.style.objectFit = a, c.videoElement.currentTime === c.videoElement.duration && (c.videoElement.currentTime = 0), c.videoElement.play(), this.activeClip || (c.videoElement.style.display = "block"), c));
|
|
4467
4150
|
}
|
|
4468
4151
|
pauseVideoClip() {
|
|
4469
4152
|
if (this.pendingClip && (this.pendingClip.actionOncePlaying = "pause"), this.activeClip) {
|
|
@@ -4481,7 +4164,7 @@ class Za {
|
|
|
4481
4164
|
console.warn("Invalid volume", t);
|
|
4482
4165
|
return;
|
|
4483
4166
|
}
|
|
4484
|
-
this.updateVideoClipPlayer(n.path, (o) => (o.videoElement && (o.volume = t,
|
|
4167
|
+
this.updateVideoClipPlayer(n.path, (o) => (o.videoElement && (o.volume = t, de(o.videoElement, t * this.globalVolume)), o));
|
|
4485
4168
|
}
|
|
4486
4169
|
}
|
|
4487
4170
|
setVideoClipFit({ fit: t }) {
|
|
@@ -4502,21 +4185,21 @@ class Za {
|
|
|
4502
4185
|
}
|
|
4503
4186
|
setAudioSink(t) {
|
|
4504
4187
|
for (const n of Object.values(this.videoClipPlayers))
|
|
4505
|
-
|
|
4188
|
+
bt(n, t);
|
|
4506
4189
|
this.sinkId = t;
|
|
4507
4190
|
}
|
|
4508
4191
|
updateConfig(t) {
|
|
4509
4192
|
const n = Object.fromEntries(Object.entries(t).filter(([, { type: i }]) => i === "video" || !i)), o = this.videoClipPlayers;
|
|
4510
4193
|
this.videoClipPlayers = (() => {
|
|
4511
4194
|
const i = { ...o };
|
|
4512
|
-
return Object.keys(o).filter((
|
|
4513
|
-
this.activeClip?.path ===
|
|
4514
|
-
}), Object.entries(n).filter(([
|
|
4515
|
-
i[
|
|
4516
|
-
}), Object.entries(o).filter(([
|
|
4517
|
-
f.config.preload !== n[
|
|
4195
|
+
return Object.keys(o).filter((p) => !(p in n)).forEach((p) => {
|
|
4196
|
+
this.activeClip?.path === p && o[p]?.config.ephemeral === !1 ? this.updateVideoClipPlayer(p, (f) => (f.config = { ...f.config, ephemeral: !0 }, f)) : (this.unloadClip(p), delete i[p]);
|
|
4197
|
+
}), Object.entries(n).filter(([p]) => !o[p]).forEach(([p, f]) => {
|
|
4198
|
+
i[p] = this.createClipPlayer(p, { ...f, preload: yt(f.preload), ephemeral: !1, fit: "contain" });
|
|
4199
|
+
}), Object.entries(o).filter(([p]) => p in n).forEach(([p, f]) => {
|
|
4200
|
+
f.config.preload !== n[p].preload && this.updateVideoClipPlayer(p, (y) => (y.config = {
|
|
4518
4201
|
...y.config,
|
|
4519
|
-
preload:
|
|
4202
|
+
preload: yt(n[p].preload),
|
|
4520
4203
|
ephemeral: !1
|
|
4521
4204
|
}, y.videoElement.preload = y.config.preload, y));
|
|
4522
4205
|
}), i;
|
|
@@ -4529,7 +4212,7 @@ class Za {
|
|
|
4529
4212
|
clips: { ...this.videoClipPlayers },
|
|
4530
4213
|
activeClip: this.activeClip ? {
|
|
4531
4214
|
path: this.activeClip.path,
|
|
4532
|
-
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ?
|
|
4215
|
+
state: this.videoClipPlayers[this.activeClip.path].videoElement?.paused ? Pe.Paused : Pe.Playing,
|
|
4533
4216
|
loop: this.videoClipPlayers[this.activeClip.path].videoElement?.loop ?? !1,
|
|
4534
4217
|
volume: this.videoClipPlayers[this.activeClip.path].videoElement?.muted ? 0 : this.videoClipPlayers[this.activeClip.path].videoElement?.volume ?? 0
|
|
4535
4218
|
} : void 0
|
|
@@ -4551,7 +4234,7 @@ class Za {
|
|
|
4551
4234
|
}
|
|
4552
4235
|
createVideoElement(t, n, { volume: o }) {
|
|
4553
4236
|
const i = document.createElement("video");
|
|
4554
|
-
return i.playsInline = !0, i.src = this.cogsConnection.getAssetUrl(t), i.autoplay = !1, i.loop = !1,
|
|
4237
|
+
return i.playsInline = !0, i.src = this.cogsConnection.getAssetUrl(t), i.autoplay = !1, i.loop = !1, de(i, o * this.globalVolume), i.preload = n.preload, i.addEventListener("playing", () => {
|
|
4555
4238
|
if (this.pendingClip?.path === t) {
|
|
4556
4239
|
switch (this.pendingClip.actionOncePlaying) {
|
|
4557
4240
|
case "play": {
|
|
@@ -4579,7 +4262,7 @@ class Za {
|
|
|
4579
4262
|
videoElement: this.createVideoElement(t, n, { volume: 1 }),
|
|
4580
4263
|
volume: 1
|
|
4581
4264
|
};
|
|
4582
|
-
return
|
|
4265
|
+
return bt(i, this.sinkId), i;
|
|
4583
4266
|
}
|
|
4584
4267
|
unloadClip(t) {
|
|
4585
4268
|
if (this.activeClip?.path === t) {
|
|
@@ -4589,37 +4272,316 @@ class Za {
|
|
|
4589
4272
|
this.videoClipPlayers[t]?.videoElement.remove(), this.updateVideoClipPlayer(t, () => null);
|
|
4590
4273
|
}
|
|
4591
4274
|
}
|
|
4592
|
-
function
|
|
4275
|
+
function yt(e) {
|
|
4593
4276
|
return typeof e == "string" ? e : e ? "auto" : "none";
|
|
4594
4277
|
}
|
|
4595
|
-
function
|
|
4278
|
+
function bt(e, t) {
|
|
4596
4279
|
t !== void 0 && typeof e.videoElement.setSinkId == "function" && e.videoElement.setSinkId(t);
|
|
4597
4280
|
}
|
|
4598
|
-
function
|
|
4281
|
+
function de(e, t) {
|
|
4599
4282
|
e.volume = t, e.muted = t === 0;
|
|
4600
4283
|
}
|
|
4601
|
-
|
|
4284
|
+
function Ue(e, t) {
|
|
4285
|
+
switch (e.type) {
|
|
4286
|
+
case "image": {
|
|
4287
|
+
if (e.keyframes[0][0] > t)
|
|
4288
|
+
return;
|
|
4289
|
+
const o = e.keyframes.filter((a) => a[1] !== null), i = ze(o, t);
|
|
4290
|
+
return { ..._e, ...i };
|
|
4291
|
+
}
|
|
4292
|
+
case "audio": {
|
|
4293
|
+
const n = e.keyframes.filter((a) => a[1] !== null), o = wt(n, t);
|
|
4294
|
+
if (!o)
|
|
4295
|
+
return;
|
|
4296
|
+
const i = ze(n, t);
|
|
4297
|
+
return { ...we, ...i, ...o };
|
|
4298
|
+
}
|
|
4299
|
+
case "video": {
|
|
4300
|
+
const n = e.keyframes.filter((a) => a[1] !== null), o = wt(n, t);
|
|
4301
|
+
if (!o)
|
|
4302
|
+
return;
|
|
4303
|
+
const i = ze(n, t);
|
|
4304
|
+
return { ...me, ...i, ...o };
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
function ze(e, t) {
|
|
4309
|
+
const n = {};
|
|
4310
|
+
for (const [i, a] of e)
|
|
4311
|
+
i <= t ? (Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4312
|
+
n[c] ??= {}, n[c].before = [i, l];
|
|
4313
|
+
}), Object.entries(a.set ?? {}).forEach(([c, l]) => {
|
|
4314
|
+
n[c] ??= {}, n[c].before = [i, l];
|
|
4315
|
+
})) : Object.entries(a.lerp ?? {}).forEach(([c, l]) => {
|
|
4316
|
+
n[c] ??= {}, n[c].after === void 0 && (n[c].after = [i, l]);
|
|
4317
|
+
});
|
|
4318
|
+
const o = {};
|
|
4319
|
+
return Object.entries(n).forEach(
|
|
4320
|
+
([i, { before: a, after: c }]) => {
|
|
4321
|
+
if (c === void 0 && a) {
|
|
4322
|
+
o[i] = a[1];
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
if (a && c && a[0] === c[0]) {
|
|
4326
|
+
o[i] = c[1];
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
if (a && typeof a[1] == "number" && c && typeof c[1] == "number") {
|
|
4330
|
+
o[i] = a[1] + (t - a[0]) * (c[1] - a[1]) / (c[0] - a[0]);
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
), o;
|
|
4335
|
+
}
|
|
4336
|
+
function wt(e, t) {
|
|
4337
|
+
const n = e[0];
|
|
4338
|
+
if (!n || n[0] > t)
|
|
4339
|
+
return;
|
|
4340
|
+
let o = 0, { t: i, rate: a } = we;
|
|
4341
|
+
for (const [f, y] of e) {
|
|
4342
|
+
if (f > t) break;
|
|
4343
|
+
const { set: g } = y;
|
|
4344
|
+
if (!g) continue;
|
|
4345
|
+
const { t: r, rate: s } = g;
|
|
4346
|
+
if (r !== void 0) {
|
|
4347
|
+
o = f, i = r, s !== void 0 && (a = s);
|
|
4348
|
+
continue;
|
|
4349
|
+
}
|
|
4350
|
+
if (s !== void 0) {
|
|
4351
|
+
const d = (f - o) * a;
|
|
4352
|
+
o = f, i += d, a = s;
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
const l = (t - o) * a, p = i + l;
|
|
4356
|
+
return {
|
|
4357
|
+
rate: a,
|
|
4358
|
+
t: p
|
|
4359
|
+
};
|
|
4360
|
+
}
|
|
4361
|
+
const ca = 1e3;
|
|
4362
|
+
class Ve {
|
|
4363
|
+
constructor(t, n, o) {
|
|
4364
|
+
this.surfaceElement = t, this.clipElement = n, this._state = o, setTimeout(this.loop);
|
|
4365
|
+
}
|
|
4366
|
+
/**
|
|
4367
|
+
* This is the delay to be used in the update loop.
|
|
4368
|
+
* It is intended to be dynamic for each loop.
|
|
4369
|
+
*/
|
|
4370
|
+
delay = ca;
|
|
4371
|
+
isConnected(t) {
|
|
4372
|
+
return !(!this.surfaceElement || !this.clipElement || !this.surfaceElement.contains(this.clipElement) || t && !this.clipElement.contains(t));
|
|
4373
|
+
}
|
|
4374
|
+
_state;
|
|
4375
|
+
setState(t) {
|
|
4376
|
+
this._state = t, clearTimeout(this.timeout), this.loop();
|
|
4377
|
+
}
|
|
4378
|
+
timeout;
|
|
4379
|
+
loop = async () => {
|
|
4380
|
+
this.isConnected() ? (this.update(), this.timeout = setTimeout(this.loop, this.delay)) : this.destroy();
|
|
4381
|
+
};
|
|
4382
|
+
}
|
|
4383
|
+
class la extends Ve {
|
|
4384
|
+
imageElement;
|
|
4385
|
+
constructor(t, n, o) {
|
|
4386
|
+
super(t, n, o), this.clipElement = n;
|
|
4387
|
+
}
|
|
4388
|
+
updateImageElement() {
|
|
4389
|
+
this.imageElement = document.createElement("img"), this.clipElement.replaceChildren(this.imageElement), this.imageElement.style.position = "absolute", this.imageElement.style.height = "100%", this.imageElement.style.width = "100%";
|
|
4390
|
+
}
|
|
4391
|
+
update() {
|
|
4392
|
+
const t = Ue(this._state, Date.now());
|
|
4393
|
+
if (t ? (!this.imageElement || !this.isConnected(this.imageElement)) && this.updateImageElement() : (this.imageElement?.remove(), this.imageElement = void 0), !this.imageElement || !t) return;
|
|
4394
|
+
this.imageElement.src.endsWith(this._state.file) || (this.imageElement.src = this._state.file), this.imageElement.style.objectFit !== this._state.fit && (this.imageElement.style.objectFit = this._state.fit), parseFloat(this.imageElement.style.opacity) !== t.opacity && (this.imageElement.style.opacity = String(t.opacity ?? _e.opacity));
|
|
4395
|
+
const n = Math.round(t.zIndex ?? _e.zIndex);
|
|
4396
|
+
parseInt(this.imageElement.style.zIndex) !== n && (this.imageElement.style.zIndex = String(n));
|
|
4397
|
+
const o = String(t.opacity);
|
|
4398
|
+
this.imageElement.style.opacity !== o && (this.imageElement.style.opacity = o);
|
|
4399
|
+
}
|
|
4400
|
+
destroy() {
|
|
4401
|
+
this.imageElement?.remove();
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
const da = 1e3, pa = 100, ha = 10, Et = 10, Yt = 1e3, fa = 200, _a = 0.5, ma = 0.3;
|
|
4405
|
+
function va(e) {
|
|
4406
|
+
return Math.sign(e) * Math.pow(Math.abs(e) / Yt, ma) * _a;
|
|
4407
|
+
}
|
|
4408
|
+
class ga extends Ve {
|
|
4409
|
+
videoElement;
|
|
4410
|
+
isSeeking = !1;
|
|
4411
|
+
constructor(t, n, o) {
|
|
4412
|
+
super(t, n, o), this.clipElement = n;
|
|
4413
|
+
}
|
|
4414
|
+
updateVideoElement() {
|
|
4415
|
+
this.destroy(), this.videoElement = document.createElement("video"), this.clipElement.replaceChildren(this.videoElement), this.videoElement.style.position = "absolute", this.videoElement.style.width = "100%", this.videoElement.style.height = "100%";
|
|
4416
|
+
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Helper function to seek to a specified time.
|
|
4419
|
+
* Works with the update loop to poll until seeked event has fired.
|
|
4420
|
+
*/
|
|
4421
|
+
seekTo(t) {
|
|
4422
|
+
this.videoElement && (this.delay = ha, this.isSeeking = !0, this.videoElement.addEventListener(
|
|
4423
|
+
"seeked",
|
|
4424
|
+
() => {
|
|
4425
|
+
this.isSeeking = !1;
|
|
4426
|
+
},
|
|
4427
|
+
{ once: !0, passive: !0 }
|
|
4428
|
+
), this.videoElement.currentTime = t / 1e3);
|
|
4429
|
+
}
|
|
4430
|
+
update() {
|
|
4431
|
+
if (this.isSeeking) return;
|
|
4432
|
+
this.delay = da;
|
|
4433
|
+
const t = Ue(this._state, Date.now());
|
|
4434
|
+
if (t ? (!this.videoElement || !this.isConnected(this.videoElement)) && this.updateVideoElement() : (this.videoElement?.remove(), this.videoElement = void 0), !t || !this.videoElement) return;
|
|
4435
|
+
const { t: n, rate: o, volume: i } = { ...me, ...t };
|
|
4436
|
+
this.videoElement.src.endsWith(this._state.file) || (this.videoElement.src = this._state.file), this.videoElement.style.objectFit !== this._state.fit && (this.videoElement.style.objectFit = this._state.fit);
|
|
4437
|
+
const a = String(t.opacity);
|
|
4438
|
+
this.videoElement.style.opacity !== a && (this.videoElement.style.opacity = a);
|
|
4439
|
+
const c = Math.round(t.zIndex ?? me.zIndex);
|
|
4440
|
+
parseInt(this.videoElement.style.zIndex) !== c && (this.videoElement.style.zIndex = String(c)), this.videoElement.volume !== i && (this.videoElement.volume = i), this.videoElement.paused && o > 0 && this.videoElement.play().catch(() => {
|
|
4441
|
+
});
|
|
4442
|
+
const p = this.videoElement.currentTime * 1e3 - n, f = Math.abs(p);
|
|
4443
|
+
switch (this.delay = pa, !0) {
|
|
4444
|
+
case f <= Et:
|
|
4445
|
+
this.videoElement.playbackRate !== o && (this.videoElement.playbackRate = o);
|
|
4446
|
+
break;
|
|
4447
|
+
case (o > 0 && f > Et && f <= Yt): {
|
|
4448
|
+
const y = va(p), g = Math.max(0, o - y);
|
|
4449
|
+
this.videoElement.playbackRate !== g && (this.videoElement.playbackRate = g);
|
|
4450
|
+
break;
|
|
4451
|
+
}
|
|
4452
|
+
default: {
|
|
4453
|
+
this.videoElement.playbackRate !== o && (this.videoElement.playbackRate = o), this.seekTo(n + o * fa);
|
|
4454
|
+
break;
|
|
4455
|
+
}
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
destroy() {
|
|
4459
|
+
this.videoElement && (this.videoElement.src = "", this.videoElement.remove());
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
const ya = 1e3, ba = 100, wa = 10, kt = 10, Qt = 1e3, Ea = 200, ka = 0.2, Ca = 0.5;
|
|
4463
|
+
function Sa(e) {
|
|
4464
|
+
return Math.sign(e) * Math.pow(Math.abs(e) / Qt, Ca) * ka;
|
|
4465
|
+
}
|
|
4466
|
+
class Aa extends Ve {
|
|
4467
|
+
audioElement;
|
|
4468
|
+
isSeeking = !1;
|
|
4469
|
+
constructor(t, n, o) {
|
|
4470
|
+
super(t, n, o), this.clipElement = n;
|
|
4471
|
+
}
|
|
4472
|
+
updateAudioElement() {
|
|
4473
|
+
this.destroy(), this.audioElement = document.createElement("audio"), this.clipElement.replaceChildren(this.audioElement);
|
|
4474
|
+
}
|
|
4475
|
+
/**
|
|
4476
|
+
* Helper function to seek to a specified time.
|
|
4477
|
+
* Works with the update loop to poll until seeked event has fired.
|
|
4478
|
+
*/
|
|
4479
|
+
seekTo(t) {
|
|
4480
|
+
this.audioElement && (this.delay = wa, this.isSeeking = !0, this.audioElement.addEventListener(
|
|
4481
|
+
"seeked",
|
|
4482
|
+
() => {
|
|
4483
|
+
this.isSeeking = !1;
|
|
4484
|
+
},
|
|
4485
|
+
{ once: !0, passive: !0 }
|
|
4486
|
+
), this.audioElement.currentTime = t / 1e3);
|
|
4487
|
+
}
|
|
4488
|
+
update() {
|
|
4489
|
+
if (this.isSeeking) return;
|
|
4490
|
+
this.delay = ya;
|
|
4491
|
+
const t = Ue(this._state, Date.now());
|
|
4492
|
+
if (t ? (!this.audioElement || !this.isConnected(this.audioElement)) && this.updateAudioElement() : this.destroy(), !t || !this.audioElement) return;
|
|
4493
|
+
const { t: n, rate: o, volume: i } = { ...we, ...t };
|
|
4494
|
+
this.audioElement.src.endsWith(this._state.file) || (this.audioElement.src = this._state.file), this.audioElement.volume !== i && (this.audioElement.volume = i), this.audioElement.paused && o > 0 && this.audioElement.play().catch(() => {
|
|
4495
|
+
});
|
|
4496
|
+
const c = this.audioElement.currentTime * 1e3 - n, l = Math.abs(c);
|
|
4497
|
+
switch (this.delay = ba, !0) {
|
|
4498
|
+
case l <= kt:
|
|
4499
|
+
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o);
|
|
4500
|
+
break;
|
|
4501
|
+
case (o > 0 && l > kt && l <= Qt): {
|
|
4502
|
+
const p = Sa(c), f = Math.max(0, o - p);
|
|
4503
|
+
this.audioElement.playbackRate !== f && (this.audioElement.playbackRate = f);
|
|
4504
|
+
break;
|
|
4505
|
+
}
|
|
4506
|
+
default: {
|
|
4507
|
+
this.audioElement.playbackRate !== o && (this.audioElement.playbackRate = o), this.delay = 10, this.seekTo(n + o * (Ea / 1e3));
|
|
4508
|
+
break;
|
|
4509
|
+
}
|
|
4510
|
+
}
|
|
4511
|
+
}
|
|
4512
|
+
destroy() {
|
|
4513
|
+
this.audioElement && (this.audioElement.src = "", this.audioElement.remove());
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
const Ta = "data-clip-id";
|
|
4517
|
+
class Pa {
|
|
4518
|
+
_state = {};
|
|
4519
|
+
setState(t) {
|
|
4520
|
+
this._state = t, this.update();
|
|
4521
|
+
}
|
|
4522
|
+
_element;
|
|
4523
|
+
get element() {
|
|
4524
|
+
return this._element;
|
|
4525
|
+
}
|
|
4526
|
+
resources = {};
|
|
4527
|
+
constructor(t) {
|
|
4528
|
+
this._element = document.createElement("div"), this._element.style.width = "100%", this._element.style.height = "100%", this._state = t || {}, this.update();
|
|
4529
|
+
}
|
|
4530
|
+
update() {
|
|
4531
|
+
Object.entries(this.resources).forEach(([n, { element: o, manager: i }]) => {
|
|
4532
|
+
n in this._state || (delete this.resources[n], o.remove(), i?.destroy());
|
|
4533
|
+
});
|
|
4534
|
+
const t = Object.keys(this._state).toSorted().map((n) => {
|
|
4535
|
+
const o = this.resources[n];
|
|
4536
|
+
if (o)
|
|
4537
|
+
return o.element;
|
|
4538
|
+
{
|
|
4539
|
+
const i = document.createElement("div");
|
|
4540
|
+
return i.setAttribute(Ta, n), this.resources[n] = { element: i }, i;
|
|
4541
|
+
}
|
|
4542
|
+
});
|
|
4543
|
+
this._element.replaceChildren(...t), Object.keys(this._state).toSorted().forEach((n) => {
|
|
4544
|
+
const o = this._state[n], i = this.resources[n];
|
|
4545
|
+
if (!i)
|
|
4546
|
+
throw new Error("Failed to create resource");
|
|
4547
|
+
if (i.manager)
|
|
4548
|
+
i.manager.setState(o);
|
|
4549
|
+
else
|
|
4550
|
+
switch (o.type) {
|
|
4551
|
+
case "image":
|
|
4552
|
+
i.manager = new la(this._element, i.element, o);
|
|
4553
|
+
break;
|
|
4554
|
+
case "audio":
|
|
4555
|
+
i.manager = new Aa(this._element, i.element, o);
|
|
4556
|
+
break;
|
|
4557
|
+
case "video":
|
|
4558
|
+
i.manager = new ga(this._element, i.element, o);
|
|
4559
|
+
break;
|
|
4560
|
+
}
|
|
4561
|
+
});
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
const xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4602
4565
|
__proto__: null
|
|
4603
4566
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4604
4567
|
export {
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4568
|
+
$a as CogsAudioPlayer,
|
|
4569
|
+
kn as CogsConfigChangedEvent,
|
|
4570
|
+
Ia as CogsConnection,
|
|
4571
|
+
wn as CogsConnectionCloseEvent,
|
|
4572
|
+
bn as CogsConnectionOpenEvent,
|
|
4573
|
+
Sn as CogsIncomingEvent,
|
|
4574
|
+
An as CogsMediaConfigChangedEvent,
|
|
4575
|
+
En as CogsMessageEvent,
|
|
4576
|
+
Tn as CogsShowPhaseChangedEvent,
|
|
4577
|
+
Cn as CogsStateChangedEvent,
|
|
4615
4578
|
Za as CogsVideoPlayer,
|
|
4616
|
-
|
|
4617
|
-
Ke as
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
Sa as preloadUrl
|
|
4579
|
+
qe as DataStoreItemEvent,
|
|
4580
|
+
Ke as DataStoreItemsEvent,
|
|
4581
|
+
xa as ManifestTypes,
|
|
4582
|
+
Oa as MediaSchema,
|
|
4583
|
+
Pa as SurfaceManager,
|
|
4584
|
+
ln as assetUrl,
|
|
4585
|
+
Ue as getStateAtTime,
|
|
4586
|
+
za as preloadUrl
|
|
4625
4587
|
};
|