@shotstack/shotstack-studio 1.1.1 → 1.2.0
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/core/entities/player.d.ts +2 -0
- package/dist/core/shotstack-canvas.d.ts +1 -0
- package/dist/shotstack-studio.es.js +408 -341
- package/dist/shotstack-studio.umd.js +6 -6
- package/package.json +1 -1
- package/readme.md +12 -15
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { Filter as
|
|
1
|
+
import * as x from "pixi.js";
|
|
2
|
+
import { Filter as Kt, deprecation as Ht, GpuProgram as Bt, GlProgram as Vt, Color as $t } from "pixi.js";
|
|
3
3
|
import * as dt from "opentype.js";
|
|
4
|
-
import * as
|
|
5
|
-
import { FFmpeg as
|
|
6
|
-
class
|
|
4
|
+
import * as jt from "howler";
|
|
5
|
+
import { FFmpeg as Ut } from "@ffmpeg/ffmpeg";
|
|
6
|
+
class Pt {
|
|
7
7
|
events;
|
|
8
8
|
constructor() {
|
|
9
9
|
this.events = {};
|
|
@@ -23,21 +23,21 @@ class At {
|
|
|
23
23
|
i(t);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class Wt extends Pt {
|
|
27
27
|
registry;
|
|
28
28
|
constructor() {
|
|
29
29
|
super(), this.registry = {};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
class
|
|
32
|
+
class Yt {
|
|
33
33
|
loadTracker;
|
|
34
34
|
constructor() {
|
|
35
|
-
this.loadTracker = new
|
|
35
|
+
this.loadTracker = new Wt();
|
|
36
36
|
}
|
|
37
37
|
async load(e, t) {
|
|
38
38
|
this.updateAssetLoadMetadata(e, "pending", 0);
|
|
39
39
|
try {
|
|
40
|
-
const i = await
|
|
40
|
+
const i = await x.Assets.load(t, (s) => {
|
|
41
41
|
this.updateAssetLoadMetadata(e, "loading", s);
|
|
42
42
|
});
|
|
43
43
|
return this.updateAssetLoadMetadata(e, "success", 1), i;
|
|
@@ -63,8 +63,8 @@ class Ze {
|
|
|
63
63
|
woff2Decompressor;
|
|
64
64
|
constructor() {
|
|
65
65
|
this.name = Ze.Name, this.extension = {
|
|
66
|
-
type: [
|
|
67
|
-
priority:
|
|
66
|
+
type: [x.ExtensionType.LoadParser],
|
|
67
|
+
priority: x.LoaderParserPriority.High,
|
|
68
68
|
ref: null
|
|
69
69
|
}, this.validFontExtensions = ["ttf", "otf", "woff", "woff2"], this.woff2Decompressor = null;
|
|
70
70
|
}
|
|
@@ -75,7 +75,7 @@ class Ze {
|
|
|
75
75
|
async load(e, t, i) {
|
|
76
76
|
const s = e.split("?")[0]?.split(".").pop()?.toLowerCase() ?? "", n = await fetch(e).then((p) => p.arrayBuffer());
|
|
77
77
|
if (s !== "woff2") {
|
|
78
|
-
const p = dt.parse(new Uint8Array(n).buffer),
|
|
78
|
+
const p = dt.parse(new Uint8Array(n).buffer), _ = p.names.fontFamily.en || p.names.fontFamily[Object.keys(p.names.fontFamily)[0]], A = new FontFace(_, `url(${e})`);
|
|
79
79
|
return await A.load(), document.fonts.add(A), A;
|
|
80
80
|
}
|
|
81
81
|
if (await this.loadWoff2Decompressor(), !this.woff2Decompressor)
|
|
@@ -259,7 +259,7 @@ class F extends Error {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
F.create = (a) => new F(a);
|
|
262
|
-
const
|
|
262
|
+
const _e = (a, e) => {
|
|
263
263
|
let t;
|
|
264
264
|
switch (a.code) {
|
|
265
265
|
case u.invalid_type:
|
|
@@ -315,9 +315,9 @@ const ke = (a, e) => {
|
|
|
315
315
|
}
|
|
316
316
|
return { message: t };
|
|
317
317
|
};
|
|
318
|
-
let
|
|
318
|
+
let Xt = _e;
|
|
319
319
|
function Ye() {
|
|
320
|
-
return
|
|
320
|
+
return Xt;
|
|
321
321
|
}
|
|
322
322
|
const Xe = (a) => {
|
|
323
323
|
const { data: e, path: t, errorMaps: i, issueData: s } = a, n = [...t, ...s.path || []], r = {
|
|
@@ -352,7 +352,7 @@ function d(a, e) {
|
|
|
352
352
|
// then schema-bound map if available
|
|
353
353
|
t,
|
|
354
354
|
// then global override map
|
|
355
|
-
t ===
|
|
355
|
+
t === _e ? void 0 : _e
|
|
356
356
|
// then global default map
|
|
357
357
|
].filter((s) => !!s)
|
|
358
358
|
});
|
|
@@ -372,7 +372,7 @@ class I {
|
|
|
372
372
|
const i = [];
|
|
373
373
|
for (const s of t) {
|
|
374
374
|
if (s.status === "aborted")
|
|
375
|
-
return
|
|
375
|
+
return w;
|
|
376
376
|
s.status === "dirty" && e.dirty(), i.push(s.value);
|
|
377
377
|
}
|
|
378
378
|
return { status: e.value, value: i };
|
|
@@ -393,20 +393,20 @@ class I {
|
|
|
393
393
|
for (const s of t) {
|
|
394
394
|
const { key: n, value: r } = s;
|
|
395
395
|
if (n.status === "aborted" || r.status === "aborted")
|
|
396
|
-
return
|
|
396
|
+
return w;
|
|
397
397
|
n.status === "dirty" && e.dirty(), r.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof r.value < "u" || s.alwaysSet) && (i[n.value] = r.value);
|
|
398
398
|
}
|
|
399
399
|
return { status: e.value, value: i };
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const w = Object.freeze({
|
|
403
403
|
status: "aborted"
|
|
404
404
|
}), ye = (a) => ({ status: "dirty", value: a }), M = (a) => ({ status: "valid", value: a }), pt = (a) => a.status === "aborted", mt = (a) => a.status === "dirty", fe = (a) => a.status === "valid", Te = (a) => typeof Promise < "u" && a instanceof Promise;
|
|
405
405
|
function Oe(a, e, t, i) {
|
|
406
406
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
407
407
|
return e.get(a);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function Rt(a, e, t, i, s) {
|
|
410
410
|
if (typeof e == "function" ? a !== e || !0 : !e.has(a)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
411
411
|
return e.set(a, t), t;
|
|
412
412
|
}
|
|
@@ -438,7 +438,7 @@ const gt = (a, e) => {
|
|
|
438
438
|
}
|
|
439
439
|
};
|
|
440
440
|
};
|
|
441
|
-
function
|
|
441
|
+
function k(a) {
|
|
442
442
|
if (!a)
|
|
443
443
|
return {};
|
|
444
444
|
const { errorMap: e, invalid_type_error: t, required_error: i, description: s } = a;
|
|
@@ -619,7 +619,7 @@ class b {
|
|
|
619
619
|
}
|
|
620
620
|
transform(e) {
|
|
621
621
|
return new Y({
|
|
622
|
-
...
|
|
622
|
+
...k(this._def),
|
|
623
623
|
schema: this,
|
|
624
624
|
typeName: v.ZodEffects,
|
|
625
625
|
effect: { type: "transform", transform: e }
|
|
@@ -628,23 +628,23 @@ class b {
|
|
|
628
628
|
default(e) {
|
|
629
629
|
const t = typeof e == "function" ? e : () => e;
|
|
630
630
|
return new Fe({
|
|
631
|
-
...
|
|
631
|
+
...k(this._def),
|
|
632
632
|
innerType: this,
|
|
633
633
|
defaultValue: t,
|
|
634
634
|
typeName: v.ZodDefault
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
brand() {
|
|
638
|
-
return new
|
|
638
|
+
return new Et({
|
|
639
639
|
typeName: v.ZodBranded,
|
|
640
640
|
type: this,
|
|
641
|
-
...
|
|
641
|
+
...k(this._def)
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
catch(e) {
|
|
645
645
|
const t = typeof e == "function" ? e : () => e;
|
|
646
646
|
return new Ne({
|
|
647
|
-
...
|
|
647
|
+
...k(this._def),
|
|
648
648
|
innerType: this,
|
|
649
649
|
catchValue: t,
|
|
650
650
|
typeName: v.ZodCatch
|
|
@@ -670,26 +670,26 @@ class b {
|
|
|
670
670
|
return this.safeParse(null).success;
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
const
|
|
673
|
+
const qt = /^c[^\s-]{8,}$/i, Gt = /^[0-9a-z]+$/, Qt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Jt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, ei = /^[a-z0-9_-]{21}$/i, ti = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ii = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, si = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ni = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
674
674
|
let We;
|
|
675
|
-
const
|
|
676
|
-
function
|
|
675
|
+
const ai = /^(?:(?: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])$/, ri = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, oi = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ci = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, li = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, hi = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, zt = "((\\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])))", ui = new RegExp(`^${zt}$`);
|
|
676
|
+
function It(a) {
|
|
677
677
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
678
678
|
return a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
679
679
|
}
|
|
680
|
-
function ui(a) {
|
|
681
|
-
return new RegExp(`^${zt(a)}$`);
|
|
682
|
-
}
|
|
683
680
|
function di(a) {
|
|
684
|
-
|
|
681
|
+
return new RegExp(`^${It(a)}$`);
|
|
682
|
+
}
|
|
683
|
+
function fi(a) {
|
|
684
|
+
let e = `${zt}T${It(a)}`;
|
|
685
685
|
const t = [];
|
|
686
686
|
return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
687
687
|
}
|
|
688
|
-
function fi(a, e) {
|
|
689
|
-
return !!((e === "v4" || !e) && ni.test(a) || (e === "v6" || !e) && ri.test(a));
|
|
690
|
-
}
|
|
691
688
|
function pi(a, e) {
|
|
692
|
-
|
|
689
|
+
return !!((e === "v4" || !e) && ai.test(a) || (e === "v6" || !e) && oi.test(a));
|
|
690
|
+
}
|
|
691
|
+
function mi(a, e) {
|
|
692
|
+
if (!ti.test(a))
|
|
693
693
|
return !1;
|
|
694
694
|
try {
|
|
695
695
|
const [t] = a.split("."), i = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(i));
|
|
@@ -698,8 +698,8 @@ function pi(a, e) {
|
|
|
698
698
|
return !1;
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
return !!((e === "v4" || !e) &&
|
|
701
|
+
function gi(a, e) {
|
|
702
|
+
return !!((e === "v4" || !e) && ri.test(a) || (e === "v6" || !e) && ci.test(a));
|
|
703
703
|
}
|
|
704
704
|
class j extends b {
|
|
705
705
|
_parse(e) {
|
|
@@ -709,7 +709,7 @@ class j extends b {
|
|
|
709
709
|
code: u.invalid_type,
|
|
710
710
|
expected: f.string,
|
|
711
711
|
received: n.parsedType
|
|
712
|
-
}),
|
|
712
|
+
}), w;
|
|
713
713
|
}
|
|
714
714
|
const i = new I();
|
|
715
715
|
let s;
|
|
@@ -750,43 +750,43 @@ class j extends b {
|
|
|
750
750
|
message: n.message
|
|
751
751
|
}), i.dirty());
|
|
752
752
|
} else if (n.kind === "email")
|
|
753
|
-
|
|
753
|
+
si.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
754
754
|
validation: "email",
|
|
755
755
|
code: u.invalid_string,
|
|
756
756
|
message: n.message
|
|
757
757
|
}), i.dirty());
|
|
758
758
|
else if (n.kind === "emoji")
|
|
759
|
-
We || (We = new RegExp(
|
|
759
|
+
We || (We = new RegExp(ni, "u")), We.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
760
760
|
validation: "emoji",
|
|
761
761
|
code: u.invalid_string,
|
|
762
762
|
message: n.message
|
|
763
763
|
}), i.dirty());
|
|
764
764
|
else if (n.kind === "uuid")
|
|
765
|
-
|
|
765
|
+
Jt.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
766
766
|
validation: "uuid",
|
|
767
767
|
code: u.invalid_string,
|
|
768
768
|
message: n.message
|
|
769
769
|
}), i.dirty());
|
|
770
770
|
else if (n.kind === "nanoid")
|
|
771
|
-
|
|
771
|
+
ei.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
772
772
|
validation: "nanoid",
|
|
773
773
|
code: u.invalid_string,
|
|
774
774
|
message: n.message
|
|
775
775
|
}), i.dirty());
|
|
776
776
|
else if (n.kind === "cuid")
|
|
777
|
-
|
|
777
|
+
qt.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
778
778
|
validation: "cuid",
|
|
779
779
|
code: u.invalid_string,
|
|
780
780
|
message: n.message
|
|
781
781
|
}), i.dirty());
|
|
782
782
|
else if (n.kind === "cuid2")
|
|
783
|
-
|
|
783
|
+
Gt.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
784
784
|
validation: "cuid2",
|
|
785
785
|
code: u.invalid_string,
|
|
786
786
|
message: n.message
|
|
787
787
|
}), i.dirty());
|
|
788
788
|
else if (n.kind === "ulid")
|
|
789
|
-
|
|
789
|
+
Qt.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
790
790
|
validation: "ulid",
|
|
791
791
|
code: u.invalid_string,
|
|
792
792
|
message: n.message
|
|
@@ -817,39 +817,39 @@ class j extends b {
|
|
|
817
817
|
code: u.invalid_string,
|
|
818
818
|
validation: { endsWith: n.value },
|
|
819
819
|
message: n.message
|
|
820
|
-
}), i.dirty()) : n.kind === "datetime" ?
|
|
820
|
+
}), i.dirty()) : n.kind === "datetime" ? fi(n).test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
821
821
|
code: u.invalid_string,
|
|
822
822
|
validation: "datetime",
|
|
823
823
|
message: n.message
|
|
824
|
-
}), i.dirty()) : n.kind === "date" ?
|
|
824
|
+
}), i.dirty()) : n.kind === "date" ? ui.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
825
825
|
code: u.invalid_string,
|
|
826
826
|
validation: "date",
|
|
827
827
|
message: n.message
|
|
828
|
-
}), i.dirty()) : n.kind === "time" ?
|
|
828
|
+
}), i.dirty()) : n.kind === "time" ? di(n).test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
829
829
|
code: u.invalid_string,
|
|
830
830
|
validation: "time",
|
|
831
831
|
message: n.message
|
|
832
|
-
}), i.dirty()) : n.kind === "duration" ?
|
|
832
|
+
}), i.dirty()) : n.kind === "duration" ? ii.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
833
833
|
validation: "duration",
|
|
834
834
|
code: u.invalid_string,
|
|
835
835
|
message: n.message
|
|
836
|
-
}), i.dirty()) : n.kind === "ip" ?
|
|
836
|
+
}), i.dirty()) : n.kind === "ip" ? pi(e.data, n.version) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
837
837
|
validation: "ip",
|
|
838
838
|
code: u.invalid_string,
|
|
839
839
|
message: n.message
|
|
840
|
-
}), i.dirty()) : n.kind === "jwt" ?
|
|
840
|
+
}), i.dirty()) : n.kind === "jwt" ? mi(e.data, n.alg) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
841
841
|
validation: "jwt",
|
|
842
842
|
code: u.invalid_string,
|
|
843
843
|
message: n.message
|
|
844
|
-
}), i.dirty()) : n.kind === "cidr" ?
|
|
844
|
+
}), i.dirty()) : n.kind === "cidr" ? gi(e.data, n.version) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
845
845
|
validation: "cidr",
|
|
846
846
|
code: u.invalid_string,
|
|
847
847
|
message: n.message
|
|
848
|
-
}), i.dirty()) : n.kind === "base64" ?
|
|
848
|
+
}), i.dirty()) : n.kind === "base64" ? li.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
849
849
|
validation: "base64",
|
|
850
850
|
code: u.invalid_string,
|
|
851
851
|
message: n.message
|
|
852
|
-
}), i.dirty()) : n.kind === "base64url" ?
|
|
852
|
+
}), i.dirty()) : n.kind === "base64url" ? hi.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
853
853
|
validation: "base64url",
|
|
854
854
|
code: u.invalid_string,
|
|
855
855
|
message: n.message
|
|
@@ -1085,10 +1085,10 @@ j.create = (a) => {
|
|
|
1085
1085
|
checks: [],
|
|
1086
1086
|
typeName: v.ZodString,
|
|
1087
1087
|
coerce: (e = a?.coerce) !== null && e !== void 0 ? e : !1,
|
|
1088
|
-
...
|
|
1088
|
+
...k(a)
|
|
1089
1089
|
});
|
|
1090
1090
|
};
|
|
1091
|
-
function
|
|
1091
|
+
function yi(a, e) {
|
|
1092
1092
|
const t = (a.toString().split(".")[1] || "").length, i = (e.toString().split(".")[1] || "").length, s = t > i ? t : i, n = parseInt(a.toFixed(s).replace(".", "")), r = parseInt(e.toFixed(s).replace(".", ""));
|
|
1093
1093
|
return n % r / Math.pow(10, s);
|
|
1094
1094
|
}
|
|
@@ -1103,7 +1103,7 @@ class pe extends b {
|
|
|
1103
1103
|
code: u.invalid_type,
|
|
1104
1104
|
expected: f.number,
|
|
1105
1105
|
received: n.parsedType
|
|
1106
|
-
}),
|
|
1106
|
+
}), w;
|
|
1107
1107
|
}
|
|
1108
1108
|
let i;
|
|
1109
1109
|
const s = new I();
|
|
@@ -1127,7 +1127,7 @@ class pe extends b {
|
|
|
1127
1127
|
inclusive: n.inclusive,
|
|
1128
1128
|
exact: !1,
|
|
1129
1129
|
message: n.message
|
|
1130
|
-
}), s.dirty()) : n.kind === "multipleOf" ?
|
|
1130
|
+
}), s.dirty()) : n.kind === "multipleOf" ? yi(e.data, n.value) !== 0 && (i = this._getOrReturnCtx(e, i), d(i, {
|
|
1131
1131
|
code: u.not_multiple_of,
|
|
1132
1132
|
multipleOf: n.value,
|
|
1133
1133
|
message: n.message
|
|
@@ -1262,7 +1262,7 @@ pe.create = (a) => new pe({
|
|
|
1262
1262
|
checks: [],
|
|
1263
1263
|
typeName: v.ZodNumber,
|
|
1264
1264
|
coerce: a?.coerce || !1,
|
|
1265
|
-
...
|
|
1265
|
+
...k(a)
|
|
1266
1266
|
});
|
|
1267
1267
|
class me extends b {
|
|
1268
1268
|
constructor() {
|
|
@@ -1305,7 +1305,7 @@ class me extends b {
|
|
|
1305
1305
|
code: u.invalid_type,
|
|
1306
1306
|
expected: f.bigint,
|
|
1307
1307
|
received: t.parsedType
|
|
1308
|
-
}),
|
|
1308
|
+
}), w;
|
|
1309
1309
|
}
|
|
1310
1310
|
gte(e, t) {
|
|
1311
1311
|
return this.setLimit("min", e, !0, m.toString(t));
|
|
@@ -1397,7 +1397,7 @@ me.create = (a) => {
|
|
|
1397
1397
|
checks: [],
|
|
1398
1398
|
typeName: v.ZodBigInt,
|
|
1399
1399
|
coerce: (e = a?.coerce) !== null && e !== void 0 ? e : !1,
|
|
1400
|
-
...
|
|
1400
|
+
...k(a)
|
|
1401
1401
|
});
|
|
1402
1402
|
};
|
|
1403
1403
|
class qe extends b {
|
|
@@ -1408,7 +1408,7 @@ class qe extends b {
|
|
|
1408
1408
|
code: u.invalid_type,
|
|
1409
1409
|
expected: f.boolean,
|
|
1410
1410
|
received: i.parsedType
|
|
1411
|
-
}),
|
|
1411
|
+
}), w;
|
|
1412
1412
|
}
|
|
1413
1413
|
return M(e.data);
|
|
1414
1414
|
}
|
|
@@ -1416,7 +1416,7 @@ class qe extends b {
|
|
|
1416
1416
|
qe.create = (a) => new qe({
|
|
1417
1417
|
typeName: v.ZodBoolean,
|
|
1418
1418
|
coerce: a?.coerce || !1,
|
|
1419
|
-
...
|
|
1419
|
+
...k(a)
|
|
1420
1420
|
});
|
|
1421
1421
|
class be extends b {
|
|
1422
1422
|
_parse(e) {
|
|
@@ -1426,13 +1426,13 @@ class be extends b {
|
|
|
1426
1426
|
code: u.invalid_type,
|
|
1427
1427
|
expected: f.date,
|
|
1428
1428
|
received: n.parsedType
|
|
1429
|
-
}),
|
|
1429
|
+
}), w;
|
|
1430
1430
|
}
|
|
1431
1431
|
if (isNaN(e.data.getTime())) {
|
|
1432
1432
|
const n = this._getOrReturnCtx(e);
|
|
1433
1433
|
return d(n, {
|
|
1434
1434
|
code: u.invalid_date
|
|
1435
|
-
}),
|
|
1435
|
+
}), w;
|
|
1436
1436
|
}
|
|
1437
1437
|
const i = new I();
|
|
1438
1438
|
let s;
|
|
@@ -1494,7 +1494,7 @@ be.create = (a) => new be({
|
|
|
1494
1494
|
checks: [],
|
|
1495
1495
|
coerce: a?.coerce || !1,
|
|
1496
1496
|
typeName: v.ZodDate,
|
|
1497
|
-
...
|
|
1497
|
+
...k(a)
|
|
1498
1498
|
});
|
|
1499
1499
|
class Ge extends b {
|
|
1500
1500
|
_parse(e) {
|
|
@@ -1504,14 +1504,14 @@ class Ge extends b {
|
|
|
1504
1504
|
code: u.invalid_type,
|
|
1505
1505
|
expected: f.symbol,
|
|
1506
1506
|
received: i.parsedType
|
|
1507
|
-
}),
|
|
1507
|
+
}), w;
|
|
1508
1508
|
}
|
|
1509
1509
|
return M(e.data);
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
1512
|
Ge.create = (a) => new Ge({
|
|
1513
1513
|
typeName: v.ZodSymbol,
|
|
1514
|
-
...
|
|
1514
|
+
...k(a)
|
|
1515
1515
|
});
|
|
1516
1516
|
class Ae extends b {
|
|
1517
1517
|
_parse(e) {
|
|
@@ -1521,14 +1521,14 @@ class Ae extends b {
|
|
|
1521
1521
|
code: u.invalid_type,
|
|
1522
1522
|
expected: f.undefined,
|
|
1523
1523
|
received: i.parsedType
|
|
1524
|
-
}),
|
|
1524
|
+
}), w;
|
|
1525
1525
|
}
|
|
1526
1526
|
return M(e.data);
|
|
1527
1527
|
}
|
|
1528
1528
|
}
|
|
1529
1529
|
Ae.create = (a) => new Ae({
|
|
1530
1530
|
typeName: v.ZodUndefined,
|
|
1531
|
-
...
|
|
1531
|
+
...k(a)
|
|
1532
1532
|
});
|
|
1533
1533
|
class Pe extends b {
|
|
1534
1534
|
_parse(e) {
|
|
@@ -1538,14 +1538,14 @@ class Pe extends b {
|
|
|
1538
1538
|
code: u.invalid_type,
|
|
1539
1539
|
expected: f.null,
|
|
1540
1540
|
received: i.parsedType
|
|
1541
|
-
}),
|
|
1541
|
+
}), w;
|
|
1542
1542
|
}
|
|
1543
1543
|
return M(e.data);
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
1546
|
Pe.create = (a) => new Pe({
|
|
1547
1547
|
typeName: v.ZodNull,
|
|
1548
|
-
...
|
|
1548
|
+
...k(a)
|
|
1549
1549
|
});
|
|
1550
1550
|
class Qe extends b {
|
|
1551
1551
|
constructor() {
|
|
@@ -1557,7 +1557,7 @@ class Qe extends b {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
Qe.create = (a) => new Qe({
|
|
1559
1559
|
typeName: v.ZodAny,
|
|
1560
|
-
...
|
|
1560
|
+
...k(a)
|
|
1561
1561
|
});
|
|
1562
1562
|
class ue extends b {
|
|
1563
1563
|
constructor() {
|
|
@@ -1569,7 +1569,7 @@ class ue extends b {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
ue.create = (a) => new ue({
|
|
1571
1571
|
typeName: v.ZodUnknown,
|
|
1572
|
-
...
|
|
1572
|
+
...k(a)
|
|
1573
1573
|
});
|
|
1574
1574
|
class G extends b {
|
|
1575
1575
|
_parse(e) {
|
|
@@ -1578,12 +1578,12 @@ class G extends b {
|
|
|
1578
1578
|
code: u.invalid_type,
|
|
1579
1579
|
expected: f.never,
|
|
1580
1580
|
received: t.parsedType
|
|
1581
|
-
}),
|
|
1581
|
+
}), w;
|
|
1582
1582
|
}
|
|
1583
1583
|
}
|
|
1584
1584
|
G.create = (a) => new G({
|
|
1585
1585
|
typeName: v.ZodNever,
|
|
1586
|
-
...
|
|
1586
|
+
...k(a)
|
|
1587
1587
|
});
|
|
1588
1588
|
class Je extends b {
|
|
1589
1589
|
_parse(e) {
|
|
@@ -1593,14 +1593,14 @@ class Je extends b {
|
|
|
1593
1593
|
code: u.invalid_type,
|
|
1594
1594
|
expected: f.void,
|
|
1595
1595
|
received: i.parsedType
|
|
1596
|
-
}),
|
|
1596
|
+
}), w;
|
|
1597
1597
|
}
|
|
1598
1598
|
return M(e.data);
|
|
1599
1599
|
}
|
|
1600
1600
|
}
|
|
1601
1601
|
Je.create = (a) => new Je({
|
|
1602
1602
|
typeName: v.ZodVoid,
|
|
1603
|
-
...
|
|
1603
|
+
...k(a)
|
|
1604
1604
|
});
|
|
1605
1605
|
class Z extends b {
|
|
1606
1606
|
_parse(e) {
|
|
@@ -1610,7 +1610,7 @@ class Z extends b {
|
|
|
1610
1610
|
code: u.invalid_type,
|
|
1611
1611
|
expected: f.array,
|
|
1612
1612
|
received: t.parsedType
|
|
1613
|
-
}),
|
|
1613
|
+
}), w;
|
|
1614
1614
|
if (s.exactLength !== null) {
|
|
1615
1615
|
const r = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1616
1616
|
(r || o) && (d(t, {
|
|
@@ -1673,7 +1673,7 @@ Z.create = (a, e) => new Z({
|
|
|
1673
1673
|
maxLength: null,
|
|
1674
1674
|
exactLength: null,
|
|
1675
1675
|
typeName: v.ZodArray,
|
|
1676
|
-
...
|
|
1676
|
+
...k(e)
|
|
1677
1677
|
});
|
|
1678
1678
|
function ce(a) {
|
|
1679
1679
|
if (a instanceof P) {
|
|
@@ -1708,7 +1708,7 @@ class P extends b {
|
|
|
1708
1708
|
code: u.invalid_type,
|
|
1709
1709
|
expected: f.object,
|
|
1710
1710
|
received: c.parsedType
|
|
1711
|
-
}),
|
|
1711
|
+
}), w;
|
|
1712
1712
|
}
|
|
1713
1713
|
const { status: i, ctx: s } = this._processInputParams(e), { shape: n, keys: r } = this._getCached(), o = [];
|
|
1714
1714
|
if (!(this._def.catchall instanceof G && this._def.unknownKeys === "strip"))
|
|
@@ -1954,7 +1954,7 @@ class P extends b {
|
|
|
1954
1954
|
});
|
|
1955
1955
|
}
|
|
1956
1956
|
keyof() {
|
|
1957
|
-
return
|
|
1957
|
+
return Lt(C.objectKeys(this.shape));
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
1960
|
P.create = (a, e) => new P({
|
|
@@ -1962,21 +1962,21 @@ P.create = (a, e) => new P({
|
|
|
1962
1962
|
unknownKeys: "strip",
|
|
1963
1963
|
catchall: G.create(),
|
|
1964
1964
|
typeName: v.ZodObject,
|
|
1965
|
-
...
|
|
1965
|
+
...k(e)
|
|
1966
1966
|
});
|
|
1967
1967
|
P.strictCreate = (a, e) => new P({
|
|
1968
1968
|
shape: () => a,
|
|
1969
1969
|
unknownKeys: "strict",
|
|
1970
1970
|
catchall: G.create(),
|
|
1971
1971
|
typeName: v.ZodObject,
|
|
1972
|
-
...
|
|
1972
|
+
...k(e)
|
|
1973
1973
|
});
|
|
1974
1974
|
P.lazycreate = (a, e) => new P({
|
|
1975
1975
|
shape: a,
|
|
1976
1976
|
unknownKeys: "strip",
|
|
1977
1977
|
catchall: G.create(),
|
|
1978
1978
|
typeName: v.ZodObject,
|
|
1979
|
-
...
|
|
1979
|
+
...k(e)
|
|
1980
1980
|
});
|
|
1981
1981
|
class Re extends b {
|
|
1982
1982
|
_parse(e) {
|
|
@@ -1992,7 +1992,7 @@ class Re extends b {
|
|
|
1992
1992
|
return d(t, {
|
|
1993
1993
|
code: u.invalid_union,
|
|
1994
1994
|
unionErrors: r
|
|
1995
|
-
}),
|
|
1995
|
+
}), w;
|
|
1996
1996
|
}
|
|
1997
1997
|
if (t.common.async)
|
|
1998
1998
|
return Promise.all(i.map(async (n) => {
|
|
@@ -2039,7 +2039,7 @@ class Re extends b {
|
|
|
2039
2039
|
return d(t, {
|
|
2040
2040
|
code: u.invalid_union,
|
|
2041
2041
|
unionErrors: o
|
|
2042
|
-
}),
|
|
2042
|
+
}), w;
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
2045
|
get options() {
|
|
@@ -2049,9 +2049,9 @@ class Re extends b {
|
|
|
2049
2049
|
Re.create = (a, e) => new Re({
|
|
2050
2050
|
options: a,
|
|
2051
2051
|
typeName: v.ZodUnion,
|
|
2052
|
-
...
|
|
2052
|
+
...k(e)
|
|
2053
2053
|
});
|
|
2054
|
-
const $ = (a) => a instanceof Le ? $(a.schema) : a instanceof Y ? $(a.innerType()) : a instanceof Ee ? [a.value] : a instanceof ie ? a.options : a instanceof Me ? C.objectValues(a.enum) : a instanceof Fe ? $(a._def.innerType) : a instanceof Ae ? [void 0] : a instanceof Pe ? [null] : a instanceof U ? [void 0, ...$(a.unwrap())] : a instanceof se ? [null, ...$(a.unwrap())] : a instanceof
|
|
2054
|
+
const $ = (a) => a instanceof Le ? $(a.schema) : a instanceof Y ? $(a.innerType()) : a instanceof Ee ? [a.value] : a instanceof ie ? a.options : a instanceof Me ? C.objectValues(a.enum) : a instanceof Fe ? $(a._def.innerType) : a instanceof Ae ? [void 0] : a instanceof Pe ? [null] : a instanceof U ? [void 0, ...$(a.unwrap())] : a instanceof se ? [null, ...$(a.unwrap())] : a instanceof Et || a instanceof De ? $(a.unwrap()) : a instanceof Ne ? $(a._def.innerType) : [];
|
|
2055
2055
|
class nt extends b {
|
|
2056
2056
|
_parse(e) {
|
|
2057
2057
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2060,7 +2060,7 @@ class nt extends b {
|
|
|
2060
2060
|
code: u.invalid_type,
|
|
2061
2061
|
expected: f.object,
|
|
2062
2062
|
received: t.parsedType
|
|
2063
|
-
}),
|
|
2063
|
+
}), w;
|
|
2064
2064
|
const i = this.discriminator, s = t.data[i], n = this.optionsMap.get(s);
|
|
2065
2065
|
return n ? t.common.async ? n._parseAsync({
|
|
2066
2066
|
data: t.data,
|
|
@@ -2074,7 +2074,7 @@ class nt extends b {
|
|
|
2074
2074
|
code: u.invalid_union_discriminator,
|
|
2075
2075
|
options: Array.from(this.optionsMap.keys()),
|
|
2076
2076
|
path: [i]
|
|
2077
|
-
}),
|
|
2077
|
+
}), w);
|
|
2078
2078
|
}
|
|
2079
2079
|
get discriminator() {
|
|
2080
2080
|
return this._def.discriminator;
|
|
@@ -2110,7 +2110,7 @@ class nt extends b {
|
|
|
2110
2110
|
discriminator: e,
|
|
2111
2111
|
options: t,
|
|
2112
2112
|
optionsMap: s,
|
|
2113
|
-
...
|
|
2113
|
+
...k(i)
|
|
2114
2114
|
});
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
@@ -2144,11 +2144,11 @@ class ze extends b {
|
|
|
2144
2144
|
_parse(e) {
|
|
2145
2145
|
const { status: t, ctx: i } = this._processInputParams(e), s = (n, r) => {
|
|
2146
2146
|
if (pt(n) || pt(r))
|
|
2147
|
-
return
|
|
2147
|
+
return w;
|
|
2148
2148
|
const o = et(n.value, r.value);
|
|
2149
2149
|
return o.valid ? ((mt(n) || mt(r)) && t.dirty(), { status: t.value, value: o.data }) : (d(i, {
|
|
2150
2150
|
code: u.invalid_intersection_types
|
|
2151
|
-
}),
|
|
2151
|
+
}), w);
|
|
2152
2152
|
};
|
|
2153
2153
|
return i.common.async ? Promise.all([
|
|
2154
2154
|
this._def.left._parseAsync({
|
|
@@ -2176,7 +2176,7 @@ ze.create = (a, e, t) => new ze({
|
|
|
2176
2176
|
left: a,
|
|
2177
2177
|
right: e,
|
|
2178
2178
|
typeName: v.ZodIntersection,
|
|
2179
|
-
...
|
|
2179
|
+
...k(t)
|
|
2180
2180
|
});
|
|
2181
2181
|
class W extends b {
|
|
2182
2182
|
_parse(e) {
|
|
@@ -2186,7 +2186,7 @@ class W extends b {
|
|
|
2186
2186
|
code: u.invalid_type,
|
|
2187
2187
|
expected: f.array,
|
|
2188
2188
|
received: i.parsedType
|
|
2189
|
-
}),
|
|
2189
|
+
}), w;
|
|
2190
2190
|
if (i.data.length < this._def.items.length)
|
|
2191
2191
|
return d(i, {
|
|
2192
2192
|
code: u.too_small,
|
|
@@ -2194,7 +2194,7 @@ class W extends b {
|
|
|
2194
2194
|
inclusive: !0,
|
|
2195
2195
|
exact: !1,
|
|
2196
2196
|
type: "array"
|
|
2197
|
-
}),
|
|
2197
|
+
}), w;
|
|
2198
2198
|
!this._def.rest && i.data.length > this._def.items.length && (d(i, {
|
|
2199
2199
|
code: u.too_big,
|
|
2200
2200
|
maximum: this._def.items.length,
|
|
@@ -2225,7 +2225,7 @@ W.create = (a, e) => {
|
|
|
2225
2225
|
items: a,
|
|
2226
2226
|
typeName: v.ZodTuple,
|
|
2227
2227
|
rest: null,
|
|
2228
|
-
...
|
|
2228
|
+
...k(e)
|
|
2229
2229
|
});
|
|
2230
2230
|
};
|
|
2231
2231
|
class Ie extends b {
|
|
@@ -2242,7 +2242,7 @@ class Ie extends b {
|
|
|
2242
2242
|
code: u.invalid_type,
|
|
2243
2243
|
expected: f.object,
|
|
2244
2244
|
received: i.parsedType
|
|
2245
|
-
}),
|
|
2245
|
+
}), w;
|
|
2246
2246
|
const s = [], n = this._def.keyType, r = this._def.valueType;
|
|
2247
2247
|
for (const o in i.data)
|
|
2248
2248
|
s.push({
|
|
@@ -2260,12 +2260,12 @@ class Ie extends b {
|
|
|
2260
2260
|
keyType: e,
|
|
2261
2261
|
valueType: t,
|
|
2262
2262
|
typeName: v.ZodRecord,
|
|
2263
|
-
...
|
|
2263
|
+
...k(i)
|
|
2264
2264
|
}) : new Ie({
|
|
2265
2265
|
keyType: j.create(),
|
|
2266
2266
|
valueType: e,
|
|
2267
2267
|
typeName: v.ZodRecord,
|
|
2268
|
-
...
|
|
2268
|
+
...k(t)
|
|
2269
2269
|
});
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
@@ -2283,7 +2283,7 @@ class tt extends b {
|
|
|
2283
2283
|
code: u.invalid_type,
|
|
2284
2284
|
expected: f.map,
|
|
2285
2285
|
received: i.parsedType
|
|
2286
|
-
}),
|
|
2286
|
+
}), w;
|
|
2287
2287
|
const s = this._def.keyType, n = this._def.valueType, r = [...i.data.entries()].map(([o, h], c) => ({
|
|
2288
2288
|
key: s._parse(new K(i, o, i.path, [c, "key"])),
|
|
2289
2289
|
value: n._parse(new K(i, h, i.path, [c, "value"]))
|
|
@@ -2294,7 +2294,7 @@ class tt extends b {
|
|
|
2294
2294
|
for (const h of r) {
|
|
2295
2295
|
const c = await h.key, l = await h.value;
|
|
2296
2296
|
if (c.status === "aborted" || l.status === "aborted")
|
|
2297
|
-
return
|
|
2297
|
+
return w;
|
|
2298
2298
|
(c.status === "dirty" || l.status === "dirty") && t.dirty(), o.set(c.value, l.value);
|
|
2299
2299
|
}
|
|
2300
2300
|
return { status: t.value, value: o };
|
|
@@ -2304,7 +2304,7 @@ class tt extends b {
|
|
|
2304
2304
|
for (const h of r) {
|
|
2305
2305
|
const c = h.key, l = h.value;
|
|
2306
2306
|
if (c.status === "aborted" || l.status === "aborted")
|
|
2307
|
-
return
|
|
2307
|
+
return w;
|
|
2308
2308
|
(c.status === "dirty" || l.status === "dirty") && t.dirty(), o.set(c.value, l.value);
|
|
2309
2309
|
}
|
|
2310
2310
|
return { status: t.value, value: o };
|
|
@@ -2315,7 +2315,7 @@ tt.create = (a, e, t) => new tt({
|
|
|
2315
2315
|
valueType: e,
|
|
2316
2316
|
keyType: a,
|
|
2317
2317
|
typeName: v.ZodMap,
|
|
2318
|
-
...
|
|
2318
|
+
...k(t)
|
|
2319
2319
|
});
|
|
2320
2320
|
class ge extends b {
|
|
2321
2321
|
_parse(e) {
|
|
@@ -2325,7 +2325,7 @@ class ge extends b {
|
|
|
2325
2325
|
code: u.invalid_type,
|
|
2326
2326
|
expected: f.set,
|
|
2327
2327
|
received: i.parsedType
|
|
2328
|
-
}),
|
|
2328
|
+
}), w;
|
|
2329
2329
|
const s = this._def;
|
|
2330
2330
|
s.minSize !== null && i.data.size < s.minSize.value && (d(i, {
|
|
2331
2331
|
code: u.too_small,
|
|
@@ -2347,7 +2347,7 @@ class ge extends b {
|
|
|
2347
2347
|
const c = /* @__PURE__ */ new Set();
|
|
2348
2348
|
for (const l of h) {
|
|
2349
2349
|
if (l.status === "aborted")
|
|
2350
|
-
return
|
|
2350
|
+
return w;
|
|
2351
2351
|
l.status === "dirty" && t.dirty(), c.add(l.value);
|
|
2352
2352
|
}
|
|
2353
2353
|
return { status: t.value, value: c };
|
|
@@ -2379,7 +2379,7 @@ ge.create = (a, e) => new ge({
|
|
|
2379
2379
|
minSize: null,
|
|
2380
2380
|
maxSize: null,
|
|
2381
2381
|
typeName: v.ZodSet,
|
|
2382
|
-
...
|
|
2382
|
+
...k(e)
|
|
2383
2383
|
});
|
|
2384
2384
|
class we extends b {
|
|
2385
2385
|
constructor() {
|
|
@@ -2392,7 +2392,7 @@ class we extends b {
|
|
|
2392
2392
|
code: u.invalid_type,
|
|
2393
2393
|
expected: f.function,
|
|
2394
2394
|
received: t.parsedType
|
|
2395
|
-
}),
|
|
2395
|
+
}), w;
|
|
2396
2396
|
function i(o, h) {
|
|
2397
2397
|
return Xe({
|
|
2398
2398
|
data: o,
|
|
@@ -2401,7 +2401,7 @@ class we extends b {
|
|
|
2401
2401
|
t.common.contextualErrorMap,
|
|
2402
2402
|
t.schemaErrorMap,
|
|
2403
2403
|
Ye(),
|
|
2404
|
-
|
|
2404
|
+
_e
|
|
2405
2405
|
].filter((c) => !!c),
|
|
2406
2406
|
issueData: {
|
|
2407
2407
|
code: u.invalid_arguments,
|
|
@@ -2417,7 +2417,7 @@ class we extends b {
|
|
|
2417
2417
|
t.common.contextualErrorMap,
|
|
2418
2418
|
t.schemaErrorMap,
|
|
2419
2419
|
Ye(),
|
|
2420
|
-
|
|
2420
|
+
_e
|
|
2421
2421
|
].filter((c) => !!c),
|
|
2422
2422
|
issueData: {
|
|
2423
2423
|
code: u.invalid_return_type,
|
|
@@ -2429,11 +2429,11 @@ class we extends b {
|
|
|
2429
2429
|
if (this._def.returns instanceof Ce) {
|
|
2430
2430
|
const o = this;
|
|
2431
2431
|
return M(async function(...h) {
|
|
2432
|
-
const c = new F([]), l = await o._def.args.parseAsync(h, n).catch((
|
|
2433
|
-
throw c.addIssue(i(h,
|
|
2432
|
+
const c = new F([]), l = await o._def.args.parseAsync(h, n).catch((_) => {
|
|
2433
|
+
throw c.addIssue(i(h, _)), c;
|
|
2434
2434
|
}), g = await Reflect.apply(r, this, l);
|
|
2435
|
-
return await o._def.returns._def.type.parseAsync(g, n).catch((
|
|
2436
|
-
throw c.addIssue(s(g,
|
|
2435
|
+
return await o._def.returns._def.type.parseAsync(g, n).catch((_) => {
|
|
2436
|
+
throw c.addIssue(s(g, _)), c;
|
|
2437
2437
|
});
|
|
2438
2438
|
});
|
|
2439
2439
|
} else {
|
|
@@ -2478,7 +2478,7 @@ class we extends b {
|
|
|
2478
2478
|
args: e || W.create([]).rest(ue.create()),
|
|
2479
2479
|
returns: t || ue.create(),
|
|
2480
2480
|
typeName: v.ZodFunction,
|
|
2481
|
-
...
|
|
2481
|
+
...k(i)
|
|
2482
2482
|
});
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
@@ -2494,7 +2494,7 @@ class Le extends b {
|
|
|
2494
2494
|
Le.create = (a, e) => new Le({
|
|
2495
2495
|
getter: a,
|
|
2496
2496
|
typeName: v.ZodLazy,
|
|
2497
|
-
...
|
|
2497
|
+
...k(e)
|
|
2498
2498
|
});
|
|
2499
2499
|
class Ee extends b {
|
|
2500
2500
|
_parse(e) {
|
|
@@ -2504,7 +2504,7 @@ class Ee extends b {
|
|
|
2504
2504
|
received: t.data,
|
|
2505
2505
|
code: u.invalid_literal,
|
|
2506
2506
|
expected: this._def.value
|
|
2507
|
-
}),
|
|
2507
|
+
}), w;
|
|
2508
2508
|
}
|
|
2509
2509
|
return { status: "valid", value: e.data };
|
|
2510
2510
|
}
|
|
@@ -2515,13 +2515,13 @@ class Ee extends b {
|
|
|
2515
2515
|
Ee.create = (a, e) => new Ee({
|
|
2516
2516
|
value: a,
|
|
2517
2517
|
typeName: v.ZodLiteral,
|
|
2518
|
-
...
|
|
2518
|
+
...k(e)
|
|
2519
2519
|
});
|
|
2520
|
-
function
|
|
2520
|
+
function Lt(a, e) {
|
|
2521
2521
|
return new ie({
|
|
2522
2522
|
values: a,
|
|
2523
2523
|
typeName: v.ZodEnum,
|
|
2524
|
-
...
|
|
2524
|
+
...k(e)
|
|
2525
2525
|
});
|
|
2526
2526
|
}
|
|
2527
2527
|
class ie extends b {
|
|
@@ -2535,15 +2535,15 @@ class ie extends b {
|
|
|
2535
2535
|
expected: C.joinValues(i),
|
|
2536
2536
|
received: t.parsedType,
|
|
2537
2537
|
code: u.invalid_type
|
|
2538
|
-
}),
|
|
2538
|
+
}), w;
|
|
2539
2539
|
}
|
|
2540
|
-
if (Oe(this, ve) ||
|
|
2540
|
+
if (Oe(this, ve) || Rt(this, ve, new Set(this._def.values)), !Oe(this, ve).has(e.data)) {
|
|
2541
2541
|
const t = this._getOrReturnCtx(e), i = this._def.values;
|
|
2542
2542
|
return d(t, {
|
|
2543
2543
|
received: t.data,
|
|
2544
2544
|
code: u.invalid_enum_value,
|
|
2545
2545
|
options: i
|
|
2546
|
-
}),
|
|
2546
|
+
}), w;
|
|
2547
2547
|
}
|
|
2548
2548
|
return M(e.data);
|
|
2549
2549
|
}
|
|
@@ -2582,7 +2582,7 @@ class ie extends b {
|
|
|
2582
2582
|
}
|
|
2583
2583
|
}
|
|
2584
2584
|
ve = /* @__PURE__ */ new WeakMap();
|
|
2585
|
-
ie.create =
|
|
2585
|
+
ie.create = Lt;
|
|
2586
2586
|
class Me extends b {
|
|
2587
2587
|
constructor() {
|
|
2588
2588
|
super(...arguments), xe.set(this, void 0);
|
|
@@ -2595,15 +2595,15 @@ class Me extends b {
|
|
|
2595
2595
|
expected: C.joinValues(s),
|
|
2596
2596
|
received: i.parsedType,
|
|
2597
2597
|
code: u.invalid_type
|
|
2598
|
-
}),
|
|
2598
|
+
}), w;
|
|
2599
2599
|
}
|
|
2600
|
-
if (Oe(this, xe) ||
|
|
2600
|
+
if (Oe(this, xe) || Rt(this, xe, new Set(C.getValidEnumValues(this._def.values))), !Oe(this, xe).has(e.data)) {
|
|
2601
2601
|
const s = C.objectValues(t);
|
|
2602
2602
|
return d(i, {
|
|
2603
2603
|
received: i.data,
|
|
2604
2604
|
code: u.invalid_enum_value,
|
|
2605
2605
|
options: s
|
|
2606
|
-
}),
|
|
2606
|
+
}), w;
|
|
2607
2607
|
}
|
|
2608
2608
|
return M(e.data);
|
|
2609
2609
|
}
|
|
@@ -2615,7 +2615,7 @@ xe = /* @__PURE__ */ new WeakMap();
|
|
|
2615
2615
|
Me.create = (a, e) => new Me({
|
|
2616
2616
|
values: a,
|
|
2617
2617
|
typeName: v.ZodNativeEnum,
|
|
2618
|
-
...
|
|
2618
|
+
...k(e)
|
|
2619
2619
|
});
|
|
2620
2620
|
class Ce extends b {
|
|
2621
2621
|
unwrap() {
|
|
@@ -2628,7 +2628,7 @@ class Ce extends b {
|
|
|
2628
2628
|
code: u.invalid_type,
|
|
2629
2629
|
expected: f.promise,
|
|
2630
2630
|
received: t.parsedType
|
|
2631
|
-
}),
|
|
2631
|
+
}), w;
|
|
2632
2632
|
const i = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2633
2633
|
return M(i.then((s) => this._def.type.parseAsync(s, {
|
|
2634
2634
|
path: t.path,
|
|
@@ -2639,7 +2639,7 @@ class Ce extends b {
|
|
|
2639
2639
|
Ce.create = (a, e) => new Ce({
|
|
2640
2640
|
type: a,
|
|
2641
2641
|
typeName: v.ZodPromise,
|
|
2642
|
-
...
|
|
2642
|
+
...k(e)
|
|
2643
2643
|
});
|
|
2644
2644
|
class Y extends b {
|
|
2645
2645
|
innerType() {
|
|
@@ -2662,23 +2662,23 @@ class Y extends b {
|
|
|
2662
2662
|
if (i.common.async)
|
|
2663
2663
|
return Promise.resolve(r).then(async (o) => {
|
|
2664
2664
|
if (t.value === "aborted")
|
|
2665
|
-
return
|
|
2665
|
+
return w;
|
|
2666
2666
|
const h = await this._def.schema._parseAsync({
|
|
2667
2667
|
data: o,
|
|
2668
2668
|
path: i.path,
|
|
2669
2669
|
parent: i
|
|
2670
2670
|
});
|
|
2671
|
-
return h.status === "aborted" ?
|
|
2671
|
+
return h.status === "aborted" ? w : h.status === "dirty" || t.value === "dirty" ? ye(h.value) : h;
|
|
2672
2672
|
});
|
|
2673
2673
|
{
|
|
2674
2674
|
if (t.value === "aborted")
|
|
2675
|
-
return
|
|
2675
|
+
return w;
|
|
2676
2676
|
const o = this._def.schema._parseSync({
|
|
2677
2677
|
data: r,
|
|
2678
2678
|
path: i.path,
|
|
2679
2679
|
parent: i
|
|
2680
2680
|
});
|
|
2681
|
-
return o.status === "aborted" ?
|
|
2681
|
+
return o.status === "aborted" ? w : o.status === "dirty" || t.value === "dirty" ? ye(o.value) : o;
|
|
2682
2682
|
}
|
|
2683
2683
|
}
|
|
2684
2684
|
if (s.type === "refinement") {
|
|
@@ -2696,9 +2696,9 @@ class Y extends b {
|
|
|
2696
2696
|
path: i.path,
|
|
2697
2697
|
parent: i
|
|
2698
2698
|
});
|
|
2699
|
-
return o.status === "aborted" ?
|
|
2699
|
+
return o.status === "aborted" ? w : (o.status === "dirty" && t.dirty(), r(o.value), { status: t.value, value: o.value });
|
|
2700
2700
|
} else
|
|
2701
|
-
return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((o) => o.status === "aborted" ?
|
|
2701
|
+
return this._def.schema._parseAsync({ data: i.data, path: i.path, parent: i }).then((o) => o.status === "aborted" ? w : (o.status === "dirty" && t.dirty(), r(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2702
2702
|
}
|
|
2703
2703
|
if (s.type === "transform")
|
|
2704
2704
|
if (i.common.async === !1) {
|
|
@@ -2722,13 +2722,13 @@ Y.create = (a, e, t) => new Y({
|
|
|
2722
2722
|
schema: a,
|
|
2723
2723
|
typeName: v.ZodEffects,
|
|
2724
2724
|
effect: e,
|
|
2725
|
-
...
|
|
2725
|
+
...k(t)
|
|
2726
2726
|
});
|
|
2727
2727
|
Y.createWithPreprocess = (a, e, t) => new Y({
|
|
2728
2728
|
schema: e,
|
|
2729
2729
|
effect: { type: "preprocess", transform: a },
|
|
2730
2730
|
typeName: v.ZodEffects,
|
|
2731
|
-
...
|
|
2731
|
+
...k(t)
|
|
2732
2732
|
});
|
|
2733
2733
|
class U extends b {
|
|
2734
2734
|
_parse(e) {
|
|
@@ -2741,7 +2741,7 @@ class U extends b {
|
|
|
2741
2741
|
U.create = (a, e) => new U({
|
|
2742
2742
|
innerType: a,
|
|
2743
2743
|
typeName: v.ZodOptional,
|
|
2744
|
-
...
|
|
2744
|
+
...k(e)
|
|
2745
2745
|
});
|
|
2746
2746
|
class se extends b {
|
|
2747
2747
|
_parse(e) {
|
|
@@ -2754,7 +2754,7 @@ class se extends b {
|
|
|
2754
2754
|
se.create = (a, e) => new se({
|
|
2755
2755
|
innerType: a,
|
|
2756
2756
|
typeName: v.ZodNullable,
|
|
2757
|
-
...
|
|
2757
|
+
...k(e)
|
|
2758
2758
|
});
|
|
2759
2759
|
class Fe extends b {
|
|
2760
2760
|
_parse(e) {
|
|
@@ -2774,7 +2774,7 @@ Fe.create = (a, e) => new Fe({
|
|
|
2774
2774
|
innerType: a,
|
|
2775
2775
|
typeName: v.ZodDefault,
|
|
2776
2776
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2777
|
-
...
|
|
2777
|
+
...k(e)
|
|
2778
2778
|
});
|
|
2779
2779
|
class Ne extends b {
|
|
2780
2780
|
_parse(e) {
|
|
@@ -2817,7 +2817,7 @@ Ne.create = (a, e) => new Ne({
|
|
|
2817
2817
|
innerType: a,
|
|
2818
2818
|
typeName: v.ZodCatch,
|
|
2819
2819
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2820
|
-
...
|
|
2820
|
+
...k(e)
|
|
2821
2821
|
});
|
|
2822
2822
|
class it extends b {
|
|
2823
2823
|
_parse(e) {
|
|
@@ -2827,16 +2827,16 @@ class it extends b {
|
|
|
2827
2827
|
code: u.invalid_type,
|
|
2828
2828
|
expected: f.nan,
|
|
2829
2829
|
received: i.parsedType
|
|
2830
|
-
}),
|
|
2830
|
+
}), w;
|
|
2831
2831
|
}
|
|
2832
2832
|
return { status: "valid", value: e.data };
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
2835
|
it.create = (a) => new it({
|
|
2836
2836
|
typeName: v.ZodNaN,
|
|
2837
|
-
...
|
|
2837
|
+
...k(a)
|
|
2838
2838
|
});
|
|
2839
|
-
class
|
|
2839
|
+
class Et extends b {
|
|
2840
2840
|
_parse(e) {
|
|
2841
2841
|
const { ctx: t } = this._processInputParams(e), i = t.data;
|
|
2842
2842
|
return this._def.type._parse({
|
|
@@ -2859,7 +2859,7 @@ class Ke extends b {
|
|
|
2859
2859
|
path: i.path,
|
|
2860
2860
|
parent: i
|
|
2861
2861
|
});
|
|
2862
|
-
return n.status === "aborted" ?
|
|
2862
|
+
return n.status === "aborted" ? w : n.status === "dirty" ? (t.dirty(), ye(n.value)) : this._def.out._parseAsync({
|
|
2863
2863
|
data: n.value,
|
|
2864
2864
|
path: i.path,
|
|
2865
2865
|
parent: i
|
|
@@ -2871,7 +2871,7 @@ class Ke extends b {
|
|
|
2871
2871
|
path: i.path,
|
|
2872
2872
|
parent: i
|
|
2873
2873
|
});
|
|
2874
|
-
return s.status === "aborted" ?
|
|
2874
|
+
return s.status === "aborted" ? w : s.status === "dirty" ? (t.dirty(), {
|
|
2875
2875
|
status: "dirty",
|
|
2876
2876
|
value: s.value
|
|
2877
2877
|
}) : this._def.out._parseSync({
|
|
@@ -2901,7 +2901,7 @@ class De extends b {
|
|
|
2901
2901
|
De.create = (a, e) => new De({
|
|
2902
2902
|
innerType: a,
|
|
2903
2903
|
typeName: v.ZodReadonly,
|
|
2904
|
-
...
|
|
2904
|
+
...k(e)
|
|
2905
2905
|
});
|
|
2906
2906
|
P.lazycreate;
|
|
2907
2907
|
var v;
|
|
@@ -2923,7 +2923,7 @@ Je.create;
|
|
|
2923
2923
|
Z.create;
|
|
2924
2924
|
const O = P.create;
|
|
2925
2925
|
P.strictCreate;
|
|
2926
|
-
const
|
|
2926
|
+
const vi = Re.create;
|
|
2927
2927
|
nt.create;
|
|
2928
2928
|
ze.create;
|
|
2929
2929
|
W.create;
|
|
@@ -2940,7 +2940,7 @@ U.create;
|
|
|
2940
2940
|
se.create;
|
|
2941
2941
|
Y.createWithPreprocess;
|
|
2942
2942
|
Ke.create;
|
|
2943
|
-
const
|
|
2943
|
+
const xi = Q(["linear", "bezier", "constant"]), wi = Q([
|
|
2944
2944
|
"ease",
|
|
2945
2945
|
"easeIn",
|
|
2946
2946
|
"easeOut",
|
|
@@ -2974,72 +2974,72 @@ const vi = Q(["linear", "bezier", "constant"]), xi = Q([
|
|
|
2974
2974
|
to: y(),
|
|
2975
2975
|
start: y().min(0),
|
|
2976
2976
|
length: y().positive(),
|
|
2977
|
-
interpolation:
|
|
2978
|
-
easing:
|
|
2979
|
-
}),
|
|
2977
|
+
interpolation: xi.optional(),
|
|
2978
|
+
easing: wi.optional()
|
|
2979
|
+
}), ki = L().url("Invalid audio url format."), _i = ae.extend({
|
|
2980
2980
|
from: y().min(0).max(1),
|
|
2981
2981
|
to: y().min(0).max(1)
|
|
2982
2982
|
}).array().or(y().min(0).max(1)), yt = O({
|
|
2983
2983
|
type: ne("audio"),
|
|
2984
|
-
src:
|
|
2984
|
+
src: ki,
|
|
2985
2985
|
trim: y().optional(),
|
|
2986
2986
|
volume: _i.optional()
|
|
2987
|
-
}),
|
|
2987
|
+
}), bi = Q(["top", "topRight", "right", "bottomRight", "bottom", "bottomLeft", "left", "topLeft", "center"]), vt = O({
|
|
2988
2988
|
type: ne("html"),
|
|
2989
2989
|
html: L(),
|
|
2990
2990
|
css: L(),
|
|
2991
2991
|
width: y().positive().optional(),
|
|
2992
2992
|
height: y().positive().optional(),
|
|
2993
|
-
position:
|
|
2994
|
-
}),
|
|
2993
|
+
position: bi.optional()
|
|
2994
|
+
}), Ci = L().url("Invalid image url format."), Si = O({
|
|
2995
2995
|
top: y().min(0).optional(),
|
|
2996
2996
|
right: y().min(0).optional(),
|
|
2997
2997
|
bottom: y().min(0).optional(),
|
|
2998
2998
|
left: y().min(0).optional()
|
|
2999
2999
|
}), xt = O({
|
|
3000
3000
|
type: ne("image"),
|
|
3001
|
-
src:
|
|
3002
|
-
crop:
|
|
3003
|
-
}),
|
|
3001
|
+
src: Ci,
|
|
3002
|
+
crop: Si.optional()
|
|
3003
|
+
}), Ti = L().url("Invalid luma url format."), wt = O({
|
|
3004
3004
|
type: ne("luma"),
|
|
3005
|
-
src:
|
|
3006
|
-
}),
|
|
3005
|
+
src: Ti
|
|
3006
|
+
}), Mt = L().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), kt = O({
|
|
3007
3007
|
width: y().positive(),
|
|
3008
3008
|
height: y().positive()
|
|
3009
|
-
}),
|
|
3009
|
+
}), _t = O({
|
|
3010
3010
|
radius: y().positive()
|
|
3011
3011
|
}), bt = O({
|
|
3012
3012
|
length: y().positive(),
|
|
3013
3013
|
thickness: y().positive()
|
|
3014
|
-
}), Ti = O({
|
|
3015
|
-
color: Et,
|
|
3016
|
-
opacity: y().min(0).max(1)
|
|
3017
3014
|
}), Oi = O({
|
|
3018
|
-
color:
|
|
3015
|
+
color: Mt,
|
|
3016
|
+
opacity: y().min(0).max(1)
|
|
3017
|
+
}), Ai = O({
|
|
3018
|
+
color: Mt,
|
|
3019
3019
|
width: y().positive()
|
|
3020
3020
|
}), Ct = O({
|
|
3021
3021
|
type: ne("shape"),
|
|
3022
3022
|
width: y().positive().optional(),
|
|
3023
3023
|
height: y().positive().optional(),
|
|
3024
3024
|
shape: Q(["rectangle", "circle", "line"]),
|
|
3025
|
-
fill:
|
|
3026
|
-
stroke:
|
|
3027
|
-
rectangle:
|
|
3028
|
-
circle:
|
|
3025
|
+
fill: Oi.optional(),
|
|
3026
|
+
stroke: Ai.optional(),
|
|
3027
|
+
rectangle: kt.optional(),
|
|
3028
|
+
circle: _t.optional(),
|
|
3029
3029
|
line: bt.optional()
|
|
3030
|
-
}).refine((a) => a.shape === "rectangle" ?
|
|
3030
|
+
}).refine((a) => a.shape === "rectangle" ? kt.safeParse(a.rectangle) : a.shape === "circle" ? _t.safeParse(a.circle) : a.shape === "line" ? bt.safeParse(a.line) : !1), at = L().regex(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|transparent$/, "Invalid color format."), Pi = O({
|
|
3031
3031
|
color: at.optional(),
|
|
3032
3032
|
family: L().optional(),
|
|
3033
3033
|
size: y().positive().optional(),
|
|
3034
3034
|
weight: y().optional(),
|
|
3035
3035
|
lineHeight: y().optional()
|
|
3036
|
-
}),
|
|
3036
|
+
}), Ri = O({
|
|
3037
3037
|
horizontal: Q(["left", "center", "right"]).optional(),
|
|
3038
3038
|
vertical: Q(["top", "center", "bottom"]).optional()
|
|
3039
|
-
}),
|
|
3039
|
+
}), zi = O({
|
|
3040
3040
|
color: at,
|
|
3041
3041
|
opacity: y().min(0).max(1)
|
|
3042
|
-
}),
|
|
3042
|
+
}), Ii = O({
|
|
3043
3043
|
width: y().positive(),
|
|
3044
3044
|
color: at
|
|
3045
3045
|
}), St = O({
|
|
@@ -3047,81 +3047,81 @@ const vi = Q(["linear", "bezier", "constant"]), xi = Q([
|
|
|
3047
3047
|
text: L(),
|
|
3048
3048
|
width: y().positive().optional(),
|
|
3049
3049
|
height: y().positive().optional(),
|
|
3050
|
-
font:
|
|
3051
|
-
alignment:
|
|
3052
|
-
background:
|
|
3053
|
-
stroke:
|
|
3054
|
-
}),
|
|
3050
|
+
font: Pi.optional(),
|
|
3051
|
+
alignment: Ri.optional(),
|
|
3052
|
+
background: zi.optional(),
|
|
3053
|
+
stroke: Ii.optional()
|
|
3054
|
+
}), Li = L().url("Invalid video url format."), Ei = O({
|
|
3055
3055
|
top: y().min(0).optional(),
|
|
3056
3056
|
right: y().min(0).optional(),
|
|
3057
3057
|
bottom: y().min(0).optional(),
|
|
3058
3058
|
left: y().min(0).optional()
|
|
3059
|
-
}),
|
|
3059
|
+
}), Mi = ae.extend({
|
|
3060
3060
|
from: y().min(0).max(1),
|
|
3061
3061
|
to: y().min(0).max(1)
|
|
3062
3062
|
}).array().or(y().min(0).max(1)), Tt = O({
|
|
3063
3063
|
type: ne("video"),
|
|
3064
|
-
src:
|
|
3064
|
+
src: Li,
|
|
3065
3065
|
trim: y().optional(),
|
|
3066
|
-
crop:
|
|
3067
|
-
volume:
|
|
3068
|
-
}),
|
|
3066
|
+
crop: Ei.optional(),
|
|
3067
|
+
volume: Mi.optional()
|
|
3068
|
+
}), Fi = vi([St, Ct, vt, xt, Tt, wt, yt]).refine((a) => a.type === "text" ? St.safeParse(a) : a.type === "shape" ? Ct.safeParse(a) : a.type === "html" ? vt.safeParse(a) : a.type === "image" ? xt.safeParse(a) : a.type === "video" ? Tt.safeParse(a) : a.type === "luma" ? wt.safeParse(a) : a.type === "audio" ? yt.safeParse(a) : !1), Ni = Q(["topLeft", "top", "topRight", "left", "center", "right", "bottomLeft", "bottom", "bottomRight"]), Di = Q(["crop", "cover", "contain", "none"]), de = y().min(-10).max(10).default(0), Zi = ae.extend({
|
|
3069
3069
|
from: de,
|
|
3070
3070
|
to: de
|
|
3071
|
-
}).array().or(de),
|
|
3071
|
+
}).array().or(de), Ki = ae.extend({
|
|
3072
3072
|
from: de,
|
|
3073
3073
|
to: de
|
|
3074
|
-
}).array().or(de),
|
|
3075
|
-
x:
|
|
3076
|
-
y:
|
|
3077
|
-
}),
|
|
3074
|
+
}).array().or(de), Hi = O({
|
|
3075
|
+
x: Zi.default(0),
|
|
3076
|
+
y: Ki.default(0)
|
|
3077
|
+
}), Bi = ae.extend({
|
|
3078
3078
|
from: y().min(0).max(1),
|
|
3079
3079
|
to: y().min(0).max(1)
|
|
3080
|
-
}).array().or(y().min(0).max(1)),
|
|
3080
|
+
}).array().or(y().min(0).max(1)), Vi = ae.extend({
|
|
3081
3081
|
from: y().min(0),
|
|
3082
3082
|
to: y().min(0)
|
|
3083
|
-
}).array().or(y().min(0)),
|
|
3083
|
+
}).array().or(y().min(0)), $i = O({
|
|
3084
3084
|
angle: ae.extend({
|
|
3085
3085
|
from: y(),
|
|
3086
3086
|
to: y()
|
|
3087
3087
|
}).array().or(y())
|
|
3088
|
-
}),
|
|
3088
|
+
}), ji = L(), Ot = L(), Ui = O({
|
|
3089
3089
|
in: Ot.optional(),
|
|
3090
3090
|
out: Ot.optional()
|
|
3091
|
-
}),
|
|
3092
|
-
rotate:
|
|
3093
|
-
}),
|
|
3094
|
-
asset:
|
|
3091
|
+
}), Wi = O({
|
|
3092
|
+
rotate: $i.default({ angle: 0 })
|
|
3093
|
+
}), Ft = O({
|
|
3094
|
+
asset: Fi,
|
|
3095
3095
|
start: y().min(0),
|
|
3096
3096
|
length: y().positive(),
|
|
3097
|
-
position:
|
|
3098
|
-
fit:
|
|
3099
|
-
offset:
|
|
3100
|
-
opacity:
|
|
3101
|
-
scale:
|
|
3102
|
-
transform:
|
|
3103
|
-
effect:
|
|
3104
|
-
transition:
|
|
3105
|
-
}),
|
|
3106
|
-
clips:
|
|
3107
|
-
}),
|
|
3108
|
-
src:
|
|
3109
|
-
}), qi = O({
|
|
3110
|
-
background: L().optional(),
|
|
3111
|
-
fonts: Xi.array().optional(),
|
|
3112
|
-
tracks: Wi.array()
|
|
3097
|
+
position: Ni.default("center").optional(),
|
|
3098
|
+
fit: Di.default("crop").optional(),
|
|
3099
|
+
offset: Hi.default({ x: 0, y: 0 }).optional(),
|
|
3100
|
+
opacity: Bi.default(1).optional(),
|
|
3101
|
+
scale: Vi.default(1).optional(),
|
|
3102
|
+
transform: Wi.default({ rotate: { angle: 0 } }).optional(),
|
|
3103
|
+
effect: ji.optional(),
|
|
3104
|
+
transition: Ui.optional()
|
|
3105
|
+
}), Yi = O({
|
|
3106
|
+
clips: Ft.array()
|
|
3107
|
+
}), Xi = L().url("Invalid image url format."), qi = O({
|
|
3108
|
+
src: Xi
|
|
3113
3109
|
}), Gi = O({
|
|
3110
|
+
background: L().optional(),
|
|
3111
|
+
fonts: qi.array().optional(),
|
|
3112
|
+
tracks: Yi.array()
|
|
3113
|
+
}), Qi = O({
|
|
3114
3114
|
size: O({
|
|
3115
3115
|
width: y().positive(),
|
|
3116
3116
|
height: y().positive()
|
|
3117
3117
|
}),
|
|
3118
3118
|
fps: y().positive().optional(),
|
|
3119
3119
|
format: L()
|
|
3120
|
-
}),
|
|
3121
|
-
timeline:
|
|
3122
|
-
output:
|
|
3120
|
+
}), Ji = O({
|
|
3121
|
+
timeline: Gi,
|
|
3122
|
+
output: Qi
|
|
3123
3123
|
});
|
|
3124
|
-
class
|
|
3124
|
+
class es {
|
|
3125
3125
|
curves = {};
|
|
3126
3126
|
constructor() {
|
|
3127
3127
|
this.initializeCurves();
|
|
@@ -3243,16 +3243,16 @@ class Ji {
|
|
|
3243
3243
|
};
|
|
3244
3244
|
}
|
|
3245
3245
|
getValue(e, t, i, s) {
|
|
3246
|
-
const n = this.curves[s ?? ""] ?? this.curves.ease, [[r, o], [h, c]] = n, l = i + (3 * r - 3 * h + 1) * i * (1 - i), g = e, p = e + (t - e) * o,
|
|
3247
|
-
return N ** 3 * g + 3 * N ** 2 * S * p + 3 * N * S ** 2 *
|
|
3246
|
+
const n = this.curves[s ?? ""] ?? this.curves.ease, [[r, o], [h, c]] = n, l = i + (3 * r - 3 * h + 1) * i * (1 - i), g = e, p = e + (t - e) * o, _ = e + (t - e) * c, A = t, S = l, N = 1 - S;
|
|
3247
|
+
return N ** 3 * g + 3 * N ** 2 * S * p + 3 * N * S ** 2 * _ + S ** 3 * A;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
class
|
|
3250
|
+
class z {
|
|
3251
3251
|
property;
|
|
3252
3252
|
length;
|
|
3253
3253
|
cubicBuilder;
|
|
3254
3254
|
constructor(e, t, i = 0) {
|
|
3255
|
-
this.property = this.createKeyframes(e, t, i), this.length = t, this.cubicBuilder = new
|
|
3255
|
+
this.property = this.createKeyframes(e, t, i), this.length = t, this.cubicBuilder = new es();
|
|
3256
3256
|
}
|
|
3257
3257
|
getValue(e) {
|
|
3258
3258
|
const t = this.property.find((s) => e >= s.start && e < s.start + s.length);
|
|
@@ -3332,8 +3332,8 @@ class He {
|
|
|
3332
3332
|
validAudioExtensions;
|
|
3333
3333
|
constructor() {
|
|
3334
3334
|
this.name = He.Name, this.extension = {
|
|
3335
|
-
type: [
|
|
3336
|
-
priority:
|
|
3335
|
+
type: [x.ExtensionType.LoadParser],
|
|
3336
|
+
priority: x.LoaderParserPriority.Normal,
|
|
3337
3337
|
ref: null
|
|
3338
3338
|
}, this.validAudioExtensions = ["mp3", "mpeg", "ogg", "wav"];
|
|
3339
3339
|
}
|
|
@@ -3351,7 +3351,7 @@ class He {
|
|
|
3351
3351
|
e?.unload();
|
|
3352
3352
|
}
|
|
3353
3353
|
}
|
|
3354
|
-
class
|
|
3354
|
+
class ts {
|
|
3355
3355
|
clipConfiguration;
|
|
3356
3356
|
constructor(e) {
|
|
3357
3357
|
this.clipConfiguration = e;
|
|
@@ -3363,20 +3363,20 @@ class es {
|
|
|
3363
3363
|
const l = 0;
|
|
3364
3364
|
switch (this.getPresetName()) {
|
|
3365
3365
|
case "zoomIn": {
|
|
3366
|
-
const p = this.getZoomSpeed(),
|
|
3367
|
-
r.push({ from:
|
|
3366
|
+
const p = this.getZoomSpeed(), _ = 1 * this.clipConfiguration.scale, A = p * this.clipConfiguration.scale;
|
|
3367
|
+
r.push({ from: _, to: A, start: l, length: c, interpolation: "linear" });
|
|
3368
3368
|
break;
|
|
3369
3369
|
}
|
|
3370
3370
|
case "zoomOut": {
|
|
3371
|
-
const
|
|
3372
|
-
r.push({ from:
|
|
3371
|
+
const _ = this.getZoomSpeed() * this.clipConfiguration.scale, A = 1 * this.clipConfiguration.scale;
|
|
3372
|
+
r.push({ from: _, to: A, start: l, length: c, interpolation: "linear" });
|
|
3373
3373
|
break;
|
|
3374
3374
|
}
|
|
3375
3375
|
case "slideLeft": {
|
|
3376
3376
|
let p = this.getSlideStart();
|
|
3377
|
-
const
|
|
3378
|
-
if (A <
|
|
3379
|
-
const S = Math.abs(
|
|
3377
|
+
const _ = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3378
|
+
if (A < _) {
|
|
3379
|
+
const S = Math.abs(_ / e.width);
|
|
3380
3380
|
r.push({ from: S, to: S, start: l, length: c, interpolation: "linear" });
|
|
3381
3381
|
} else
|
|
3382
3382
|
p = (A - e.width) / 2 / e.width;
|
|
@@ -3385,9 +3385,9 @@ class es {
|
|
|
3385
3385
|
}
|
|
3386
3386
|
case "slideRight": {
|
|
3387
3387
|
let p = this.getSlideStart();
|
|
3388
|
-
const
|
|
3389
|
-
if (A <
|
|
3390
|
-
const S = Math.abs(
|
|
3388
|
+
const _ = e.width + e.width * p * 2, A = t.height / t.width * e.height;
|
|
3389
|
+
if (A < _) {
|
|
3390
|
+
const S = Math.abs(_ / e.width);
|
|
3391
3391
|
r.push({ from: S, to: S, start: l, length: c, interpolation: "linear" });
|
|
3392
3392
|
} else
|
|
3393
3393
|
p = (A - e.width) / 2 / e.width;
|
|
@@ -3396,9 +3396,9 @@ class es {
|
|
|
3396
3396
|
}
|
|
3397
3397
|
case "slideUp": {
|
|
3398
3398
|
let p = this.getSlideStart();
|
|
3399
|
-
const
|
|
3400
|
-
if (A <
|
|
3401
|
-
const S = Math.abs(
|
|
3399
|
+
const _ = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3400
|
+
if (A < _) {
|
|
3401
|
+
const S = Math.abs(_ / e.height);
|
|
3402
3402
|
r.push({ from: S, to: S, start: l, length: c, interpolation: "linear" });
|
|
3403
3403
|
} else
|
|
3404
3404
|
p = (A - e.height) / 2 / e.height;
|
|
@@ -3407,9 +3407,9 @@ class es {
|
|
|
3407
3407
|
}
|
|
3408
3408
|
case "slideDown": {
|
|
3409
3409
|
let p = this.getSlideStart();
|
|
3410
|
-
const
|
|
3411
|
-
if (A <
|
|
3412
|
-
const S = Math.abs(
|
|
3410
|
+
const _ = e.height + e.height * p * 2, A = t.height / t.width * e.width;
|
|
3411
|
+
if (A < _) {
|
|
3412
|
+
const S = Math.abs(_ / e.height);
|
|
3413
3413
|
r.push({ from: S, to: S, start: l, length: c, interpolation: "linear" });
|
|
3414
3414
|
} else
|
|
3415
3415
|
p = (A - e.height) / 2 / e.height;
|
|
@@ -3450,7 +3450,7 @@ class es {
|
|
|
3450
3450
|
return 0;
|
|
3451
3451
|
}
|
|
3452
3452
|
}
|
|
3453
|
-
class
|
|
3453
|
+
class is {
|
|
3454
3454
|
clipConfiguration;
|
|
3455
3455
|
constructor(e) {
|
|
3456
3456
|
this.clipConfiguration = e;
|
|
@@ -3604,11 +3604,11 @@ class ts {
|
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
}
|
|
3607
|
-
class
|
|
3607
|
+
class ss {
|
|
3608
3608
|
static ButtonLeftClick = 0;
|
|
3609
3609
|
static ButtonRightClick = 3;
|
|
3610
3610
|
}
|
|
3611
|
-
class
|
|
3611
|
+
class ns {
|
|
3612
3612
|
containerSize;
|
|
3613
3613
|
constructor(e) {
|
|
3614
3614
|
this.containerSize = e;
|
|
@@ -3717,14 +3717,14 @@ class ss {
|
|
|
3717
3717
|
class rt {
|
|
3718
3718
|
container;
|
|
3719
3719
|
constructor() {
|
|
3720
|
-
this.container = new
|
|
3720
|
+
this.container = new x.Container();
|
|
3721
3721
|
}
|
|
3722
3722
|
/** @internal */
|
|
3723
3723
|
getContainer() {
|
|
3724
3724
|
return this.container;
|
|
3725
3725
|
}
|
|
3726
3726
|
}
|
|
3727
|
-
class
|
|
3727
|
+
class R extends rt {
|
|
3728
3728
|
static SnapThreshold = 20;
|
|
3729
3729
|
static DiscardedFrameCount = Math.ceil(1 / 30 * 1e3);
|
|
3730
3730
|
static ScaleHandleRadius = 10;
|
|
@@ -3758,19 +3758,20 @@ class z extends rt {
|
|
|
3758
3758
|
isRotating;
|
|
3759
3759
|
rotationStart;
|
|
3760
3760
|
rotationOffset;
|
|
3761
|
+
initialClipConfiguration;
|
|
3761
3762
|
constructor(e, t) {
|
|
3762
|
-
super(), this.edit = e, this.layer = 0, this.shouldDispose = !1, this.clipConfiguration = t, this.positionBuilder = new
|
|
3763
|
+
super(), this.edit = e, this.layer = 0, this.shouldDispose = !1, this.clipConfiguration = t, this.positionBuilder = new ns(e.size), this.outline = null, this.topLeftScaleHandle = null, this.topRightScaleHandle = null, this.bottomRightScaleHandle = null, this.bottomLeftScaleHandle = null, this.rotationHandle = null, this.isHovering = !1, this.isDragging = !1, this.dragOffset = { x: 0, y: 0 }, this.scaleDirection = null, this.scaleStart = null, this.scaleOffset = { x: 0, y: 0 }, this.isRotating = !1, this.rotationStart = null, this.rotationOffset = { x: 0, y: 0 }, this.initialClipConfiguration = null;
|
|
3763
3764
|
}
|
|
3764
3765
|
configureKeyframes() {
|
|
3765
|
-
if (this.offsetXKeyframeBuilder = new
|
|
3766
|
+
if (this.offsetXKeyframeBuilder = new z(this.clipConfiguration.offset?.x ?? 0, this.getLength()), this.offsetYKeyframeBuilder = new z(this.clipConfiguration.offset?.y ?? 0, this.getLength()), this.scaleKeyframeBuilder = new z(this.clipConfiguration.scale ?? 1, this.getLength(), 1), this.opacityKeyframeBuilder = new z(this.clipConfiguration.opacity ?? 1, this.getLength(), 1), this.rotationKeyframeBuilder = new z(this.clipConfiguration.transform?.rotate?.angle ?? 0, this.getLength()), this.clipHasKeyframes())
|
|
3766
3767
|
return;
|
|
3767
|
-
const e = [], t = [], i = [], s = [], n = [], r = new
|
|
3768
|
+
const e = [], t = [], i = [], s = [], n = [], r = new ts(this.clipConfiguration).build(this.edit.size, this.getSize());
|
|
3768
3769
|
e.push(...r.offsetXKeyframes), t.push(...r.offsetYKeyframes), i.push(...r.opacityKeyframes), s.push(...r.scaleKeyframes), n.push(...r.rotationKeyframes);
|
|
3769
|
-
const o = new
|
|
3770
|
-
e.push(...o.offsetXKeyframes), t.push(...o.offsetYKeyframes), i.push(...o.opacityKeyframes), s.push(...o.scaleKeyframes), n.push(...o.rotationKeyframes), e.length && (this.offsetXKeyframeBuilder = new
|
|
3770
|
+
const o = new is(this.clipConfiguration).build();
|
|
3771
|
+
e.push(...o.offsetXKeyframes), t.push(...o.offsetYKeyframes), i.push(...o.opacityKeyframes), s.push(...o.scaleKeyframes), n.push(...o.rotationKeyframes), e.length && (this.offsetXKeyframeBuilder = new z(e, this.getLength())), t.length && (this.offsetYKeyframeBuilder = new z(t, this.getLength())), i.length && (this.opacityKeyframeBuilder = new z(i, this.getLength(), 1)), s.length && (this.scaleKeyframeBuilder = new z(s, this.getLength(), 1)), n.length && (this.rotationKeyframeBuilder = new z(n, this.getLength()));
|
|
3771
3772
|
}
|
|
3772
3773
|
async load() {
|
|
3773
|
-
this.outline = new
|
|
3774
|
+
this.outline = new x.Graphics(), this.getContainer().addChild(this.outline), this.topLeftScaleHandle = new x.Graphics(), this.topRightScaleHandle = new x.Graphics(), this.bottomRightScaleHandle = new x.Graphics(), this.bottomLeftScaleHandle = new x.Graphics(), this.getContainer().addChild(this.topLeftScaleHandle), this.getContainer().addChild(this.topRightScaleHandle), this.getContainer().addChild(this.bottomRightScaleHandle), this.getContainer().addChild(this.bottomLeftScaleHandle), this.rotationHandle = new x.Graphics(), this.getContainer().addChild(this.rotationHandle), this.getContainer().cursor = "pointer", this.getContainer().eventMode = "static", this.getContainer().on("pointerdown", this.onPointerStart.bind(this)), this.getContainer().on("pointermove", this.onPointerMove.bind(this)), this.getContainer().on("globalpointermove", this.onPointerMove.bind(this)), this.getContainer().on("pointerup", this.onPointerUp.bind(this)), this.getContainer().on("pointerupoutside", this.onPointerUp.bind(this)), this.getContainer().on("pointerover", this.onPointerOver.bind(this)), this.getContainer().on("pointerout", this.onPointerOut.bind(this));
|
|
3774
3775
|
}
|
|
3775
3776
|
update(e, t) {
|
|
3776
3777
|
if (this.getContainer().visible = this.isActive(), this.getContainer().zIndex = this.layer, !this.isActive())
|
|
@@ -3788,14 +3789,14 @@ class z extends rt {
|
|
|
3788
3789
|
return;
|
|
3789
3790
|
}
|
|
3790
3791
|
const e = this.isHovering || this.isDragging ? 65535 : 16777215, t = this.getSize(), i = this.getScale();
|
|
3791
|
-
if (this.outline.clear(), this.outline.strokeStyle = { width:
|
|
3792
|
+
if (this.outline.clear(), this.outline.strokeStyle = { width: R.OutlineWidth / i, color: e }, this.outline.rect(0, 0, t.width, t.height), this.outline.stroke(), !this.topLeftScaleHandle || !this.topRightScaleHandle || !this.bottomRightScaleHandle || !this.bottomLeftScaleHandle || !this.isActive() || this.edit.getSelectedClip() !== this)
|
|
3792
3793
|
return;
|
|
3793
3794
|
this.topLeftScaleHandle.fillStyle = { color: e }, this.topLeftScaleHandle.clear();
|
|
3794
|
-
const s =
|
|
3795
|
+
const s = R.ScaleHandleRadius * 2 / i;
|
|
3795
3796
|
if (this.topLeftScaleHandle.rect(-s / 2, -s / 2, s, s), this.topLeftScaleHandle.fill(), this.topRightScaleHandle.fillStyle = { color: e }, this.topRightScaleHandle.clear(), this.topRightScaleHandle.rect(t.width - s / 2, -s / 2, s, s), this.topRightScaleHandle.fill(), this.bottomRightScaleHandle.fillStyle = { color: e }, this.bottomRightScaleHandle.clear(), this.bottomRightScaleHandle.rect(t.width - s / 2, t.height - s / 2, s, s), this.bottomRightScaleHandle.fill(), this.bottomLeftScaleHandle.fillStyle = { color: e }, this.bottomLeftScaleHandle.clear(), this.bottomLeftScaleHandle.rect(-s / 2, t.height - s / 2, s, s), this.bottomLeftScaleHandle.fill(), !this.rotationHandle)
|
|
3796
3797
|
return;
|
|
3797
3798
|
const n = t.width / 2, r = -50 / i;
|
|
3798
|
-
this.rotationHandle.clear(), this.rotationHandle.fillStyle = { color: e }, this.rotationHandle.circle(n, r,
|
|
3799
|
+
this.rotationHandle.clear(), this.rotationHandle.fillStyle = { color: e }, this.rotationHandle.circle(n, r, R.RotationHandleRadius / i), this.rotationHandle.fill(), this.outline.strokeStyle = { width: R.OutlineWidth / i, color: e }, this.outline.moveTo(n, 0), this.outline.lineTo(n, r), this.outline.stroke();
|
|
3799
3800
|
}
|
|
3800
3801
|
dispose() {
|
|
3801
3802
|
this.outline?.destroy(), this.outline = null, this.topLeftScaleHandle?.destroy(), this.topLeftScaleHandle = null, this.topRightScaleHandle?.destroy(), this.topRightScaleHandle = null, this.bottomLeftScaleHandle?.destroy(), this.bottomLeftScaleHandle = null, this.bottomRightScaleHandle?.destroy(), this.bottomRightScaleHandle = null, this.rotationHandle?.destroy(), this.rotationHandle = null;
|
|
@@ -3850,10 +3851,10 @@ class z extends rt {
|
|
|
3850
3851
|
return this.edit.playbackTime >= this.getStart() && this.edit.playbackTime < this.getEnd();
|
|
3851
3852
|
}
|
|
3852
3853
|
shouldDiscardFrame() {
|
|
3853
|
-
return this.getPlaybackTime() <
|
|
3854
|
+
return this.getPlaybackTime() < R.DiscardedFrameCount;
|
|
3854
3855
|
}
|
|
3855
3856
|
onPointerStart(e) {
|
|
3856
|
-
if (e.button !==
|
|
3857
|
+
if (e.button !== ss.ButtonLeftClick || (this.edit.setSelectedClip(this), this.initialClipConfiguration = structuredClone(this.clipConfiguration), this.clipHasKeyframes()))
|
|
3857
3858
|
return;
|
|
3858
3859
|
if (this.scaleDirection = null, this.topLeftScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "topLeft"), this.topRightScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "topRight"), this.bottomRightScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "bottomRight"), this.bottomLeftScaleHandle?.getBounds().containsPoint(e.globalX, e.globalY) && (this.scaleDirection = "bottomLeft"), this.scaleDirection !== null) {
|
|
3859
3860
|
this.scaleStart = this.getScale() / this.getFitScale();
|
|
@@ -3877,14 +3878,14 @@ class z extends rt {
|
|
|
3877
3878
|
onPointerMove(e) {
|
|
3878
3879
|
if (this.scaleDirection !== null && this.scaleStart !== null) {
|
|
3879
3880
|
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.sqrt((this.scaleOffset.x - n.x) ** 2 + (this.scaleOffset.y - n.y) ** 2), h = Math.sqrt((t.x - n.x) ** 2 + (t.y - n.y) ** 2) / r, c = this.scaleStart * h;
|
|
3880
|
-
this.clipConfiguration.scale = Math.max(
|
|
3881
|
+
this.clipConfiguration.scale = Math.max(R.MinScale, Math.min(c, R.MaxScale)), this.scaleKeyframeBuilder = new z(this.clipConfiguration.scale, this.getLength(), 1);
|
|
3881
3882
|
return;
|
|
3882
3883
|
}
|
|
3883
3884
|
if (this.isRotating && this.rotationStart !== null) {
|
|
3884
3885
|
const t = e.getLocalPosition(this.edit.getContainer()), i = this.getPosition(), s = this.getPivot(), n = { x: i.x + s.x, y: i.y + s.y }, r = Math.atan2(this.rotationOffset.y - n.y, this.rotationOffset.x - n.x), h = (Math.atan2(t.y - n.y, t.x - n.x) - r) * (180 / Math.PI);
|
|
3885
3886
|
let c = this.rotationStart + h;
|
|
3886
3887
|
const l = 45, g = c % l, p = 2;
|
|
3887
|
-
Math.abs(g) < p ? c = Math.floor(c / l) * l : Math.abs(g - l) < p && (c = Math.ceil(c / l) * l), this.clipConfiguration.transform || (this.clipConfiguration.transform = { rotate: { angle: 0 } }), this.clipConfiguration.transform.rotate || (this.clipConfiguration.transform.rotate = { angle: 0 }), this.clipConfiguration.transform.rotate.angle = c, this.rotationKeyframeBuilder = new
|
|
3888
|
+
Math.abs(g) < p ? c = Math.floor(c / l) * l : Math.abs(g - l) < p && (c = Math.ceil(c / l) * l), this.clipConfiguration.transform || (this.clipConfiguration.transform = { rotate: { angle: 0 } }), this.clipConfiguration.transform.rotate || (this.clipConfiguration.transform.rotate = { angle: 0 }), this.clipConfiguration.transform.rotate.angle = c, this.rotationKeyframeBuilder = new z(this.clipConfiguration.transform.rotate.angle, this.getLength());
|
|
3888
3889
|
return;
|
|
3889
3890
|
}
|
|
3890
3891
|
if (this.isDragging) {
|
|
@@ -3899,13 +3900,13 @@ class z extends rt {
|
|
|
3899
3900
|
{ x: n.x, y: n.y + this.getSize().height },
|
|
3900
3901
|
{ x: n.x + this.getSize().width, y: n.y + this.getSize().height }
|
|
3901
3902
|
], l = { x: n.x + this.getSize().width / 2, y: n.y + this.getSize().height / 2 }, g = [...c, l];
|
|
3902
|
-
let p =
|
|
3903
|
+
let p = R.SnapThreshold, _ = R.SnapThreshold, A = null, S = null;
|
|
3903
3904
|
for (const J of g)
|
|
3904
3905
|
for (const re of h) {
|
|
3905
3906
|
const H = Math.abs(J.x - re.x);
|
|
3906
3907
|
H < p && (p = H, A = n.x + (re.x - J.x));
|
|
3907
3908
|
const oe = Math.abs(J.y - re.y);
|
|
3908
|
-
oe <
|
|
3909
|
+
oe < _ && (_ = oe, S = n.y + (re.y - J.y));
|
|
3909
3910
|
}
|
|
3910
3911
|
A !== null && (n.x = A), S !== null && (n.y = S);
|
|
3911
3912
|
const N = this.positionBuilder.absoluteToRelative(
|
|
@@ -3913,11 +3914,11 @@ class z extends rt {
|
|
|
3913
3914
|
this.clipConfiguration.position ?? "center",
|
|
3914
3915
|
n
|
|
3915
3916
|
);
|
|
3916
|
-
this.clipConfiguration.offset || (this.clipConfiguration.offset = { x: 0, y: 0 }), this.clipConfiguration.offset.x = N.x, this.clipConfiguration.offset.y = N.y, this.offsetXKeyframeBuilder = new
|
|
3917
|
+
this.clipConfiguration.offset || (this.clipConfiguration.offset = { x: 0, y: 0 }), this.clipConfiguration.offset.x = N.x, this.clipConfiguration.offset.y = N.y, this.offsetXKeyframeBuilder = new z(this.clipConfiguration.offset.x, this.getLength()), this.offsetYKeyframeBuilder = new z(this.clipConfiguration.offset.y, this.getLength());
|
|
3917
3918
|
}
|
|
3918
3919
|
}
|
|
3919
3920
|
onPointerUp() {
|
|
3920
|
-
this.isDragging && this.edit.
|
|
3921
|
+
(this.isDragging || this.scaleDirection !== null || this.isRotating) && this.hasStateChanged() && this.edit.setUpdatedClip(this, this.initialClipConfiguration), this.isDragging = !1, this.dragOffset = { x: 0, y: 0 }, this.scaleDirection = null, this.scaleStart = null, this.scaleOffset = { x: 0, y: 0 }, this.isRotating = !1, this.rotationStart = null, this.rotationOffset = { x: 0, y: 0 }, this.initialClipConfiguration = null;
|
|
3921
3922
|
}
|
|
3922
3923
|
onPointerOver() {
|
|
3923
3924
|
this.isHovering = !0;
|
|
@@ -3936,8 +3937,13 @@ class z extends rt {
|
|
|
3936
3937
|
this.clipConfiguration.transform?.rotate?.angle
|
|
3937
3938
|
].some((e) => e && typeof e != "number");
|
|
3938
3939
|
}
|
|
3940
|
+
hasStateChanged() {
|
|
3941
|
+
if (!this.initialClipConfiguration) return !1;
|
|
3942
|
+
const e = this.clipConfiguration.offset?.x, t = this.clipConfiguration.offset?.y, i = this.clipConfiguration.scale, s = Number(this.clipConfiguration.transform?.rotate?.angle ?? 0), n = this.initialClipConfiguration.offset?.x, r = this.initialClipConfiguration.offset?.y, o = this.initialClipConfiguration.scale, h = Number(this.initialClipConfiguration.transform?.rotate?.angle ?? 0);
|
|
3943
|
+
return n !== void 0 && e !== n || r !== void 0 && t !== r || o !== void 0 && i !== o || s !== h;
|
|
3944
|
+
}
|
|
3939
3945
|
}
|
|
3940
|
-
class st extends
|
|
3946
|
+
class st extends R {
|
|
3941
3947
|
audioResource;
|
|
3942
3948
|
isPlaying;
|
|
3943
3949
|
volumeKeyframeBuilder;
|
|
@@ -3945,12 +3951,12 @@ class st extends z {
|
|
|
3945
3951
|
constructor(e, t) {
|
|
3946
3952
|
super(e, t), this.audioResource = null, this.isPlaying = !1;
|
|
3947
3953
|
const i = t.asset;
|
|
3948
|
-
this.volumeKeyframeBuilder = new
|
|
3954
|
+
this.volumeKeyframeBuilder = new z(i.volume ?? 1, this.getLength()), this.syncTimer = 0;
|
|
3949
3955
|
}
|
|
3950
3956
|
async load() {
|
|
3951
3957
|
await super.load();
|
|
3952
3958
|
const e = this.clipConfiguration.asset, t = e.src, i = { src: t, loadParser: He.Name }, s = await this.edit.assetLoader.load(t, i);
|
|
3953
|
-
if (!(s instanceof
|
|
3959
|
+
if (!(s instanceof jt.Howl))
|
|
3954
3960
|
throw new Error(`Invalid audio source '${e.src}'.`);
|
|
3955
3961
|
this.audioResource = s, this.configureKeyframes();
|
|
3956
3962
|
}
|
|
@@ -3977,7 +3983,7 @@ class st extends z {
|
|
|
3977
3983
|
return this.volumeKeyframeBuilder.getValue(this.getPlaybackTime());
|
|
3978
3984
|
}
|
|
3979
3985
|
}
|
|
3980
|
-
var
|
|
3986
|
+
var as = `in vec2 aPosition;
|
|
3981
3987
|
out vec2 vTextureCoord;
|
|
3982
3988
|
|
|
3983
3989
|
uniform vec4 uInputSize;
|
|
@@ -4004,7 +4010,7 @@ void main(void)
|
|
|
4004
4010
|
gl_Position = filterVertexPosition();
|
|
4005
4011
|
vTextureCoord = filterTextureCoord();
|
|
4006
4012
|
}
|
|
4007
|
-
`,
|
|
4013
|
+
`, rs = `struct GlobalFilterUniforms {
|
|
4008
4014
|
uInputSize:vec4<f32>,
|
|
4009
4015
|
uInputPixel:vec4<f32>,
|
|
4010
4016
|
uInputClamp:vec4<f32>,
|
|
@@ -4053,7 +4059,7 @@ fn mainVertex(
|
|
|
4053
4059
|
filterVertexPosition(aPosition),
|
|
4054
4060
|
filterTextureCoord(aPosition)
|
|
4055
4061
|
);
|
|
4056
|
-
}`,
|
|
4062
|
+
}`, os = `precision highp float;
|
|
4057
4063
|
in vec2 vTextureCoord;
|
|
4058
4064
|
out vec4 finalColor;
|
|
4059
4065
|
|
|
@@ -4094,7 +4100,7 @@ void main(void) {
|
|
|
4094
4100
|
vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);
|
|
4095
4101
|
finalColor = contentColor + outlineColor;
|
|
4096
4102
|
}
|
|
4097
|
-
`,
|
|
4103
|
+
`, cs = `struct OutlineUniforms {
|
|
4098
4104
|
uThickness:vec2<f32>,
|
|
4099
4105
|
uColor:vec3<f32>,
|
|
4100
4106
|
uAlpha:f32,
|
|
@@ -4158,24 +4164,24 @@ fn outlineMaxAlphaAtPos(uv: vec2<f32>) -> f32 {
|
|
|
4158
4164
|
return maxAlpha;
|
|
4159
4165
|
}
|
|
4160
4166
|
|
|
4161
|
-
const DOUBLE_PI: f32 = 3.14159265358979323846264 * 2.;`,
|
|
4162
|
-
const Be = class ee extends
|
|
4167
|
+
const DOUBLE_PI: f32 = 3.14159265358979323846264 * 2.;`, ls = Object.defineProperty, hs = (a, e, t) => e in a ? ls(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t, te = (a, e, t) => (hs(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4168
|
+
const Be = class ee extends Kt {
|
|
4163
4169
|
/** @ignore */
|
|
4164
4170
|
constructor(...e) {
|
|
4165
4171
|
let t = e[0] ?? {};
|
|
4166
|
-
typeof t == "number" && (
|
|
4167
|
-
const i = t.quality ?? 0.1, s =
|
|
4172
|
+
typeof t == "number" && (Ht("6.0.0", "OutlineFilter constructor params are now options object. See params: { thickness, color, quality, alpha, knockout }"), t = { thickness: t }, e[1] !== void 0 && (t.color = e[1]), e[2] !== void 0 && (t.quality = e[2]), e[3] !== void 0 && (t.alpha = e[3]), e[4] !== void 0 && (t.knockout = e[4])), t = { ...ee.DEFAULT_OPTIONS, ...t };
|
|
4173
|
+
const i = t.quality ?? 0.1, s = Bt.from({
|
|
4168
4174
|
vertex: {
|
|
4169
|
-
source:
|
|
4175
|
+
source: rs,
|
|
4170
4176
|
entryPoint: "mainVertex"
|
|
4171
4177
|
},
|
|
4172
4178
|
fragment: {
|
|
4173
|
-
source:
|
|
4179
|
+
source: cs,
|
|
4174
4180
|
entryPoint: "mainFragment"
|
|
4175
4181
|
}
|
|
4176
|
-
}), n =
|
|
4177
|
-
vertex:
|
|
4178
|
-
fragment:
|
|
4182
|
+
}), n = Vt.from({
|
|
4183
|
+
vertex: as,
|
|
4184
|
+
fragment: os.replace(/\$\{ANGLE_STEP\}/, ee.getAngleStep(i).toFixed(7)),
|
|
4179
4185
|
name: "outline-filter"
|
|
4180
4186
|
});
|
|
4181
4187
|
super({
|
|
@@ -4190,7 +4196,7 @@ const Be = class ee extends Zt {
|
|
|
4190
4196
|
uKnockout: { value: t.knockout ? 1 : 0, type: "f32" }
|
|
4191
4197
|
}
|
|
4192
4198
|
}
|
|
4193
|
-
}), te(this, "uniforms"), te(this, "_thickness"), te(this, "_quality"), te(this, "_color"), this.uniforms = this.resources.outlineUniforms.uniforms, this.uniforms.uAngleStep = ee.getAngleStep(i), this._color = new
|
|
4199
|
+
}), te(this, "uniforms"), te(this, "_thickness"), te(this, "_quality"), te(this, "_color"), this.uniforms = this.resources.outlineUniforms.uniforms, this.uniforms.uAngleStep = ee.getAngleStep(i), this._color = new $t(), this.color = t.color ?? 0, Object.assign(this, t);
|
|
4194
4200
|
}
|
|
4195
4201
|
/**
|
|
4196
4202
|
* Override existing apply method in `Filter`
|
|
@@ -4275,7 +4281,7 @@ te(Be, "DEFAULT_OPTIONS", {
|
|
|
4275
4281
|
te(Be, "MIN_SAMPLES", 1);
|
|
4276
4282
|
te(Be, "MAX_SAMPLES", 100);
|
|
4277
4283
|
let ot = Be;
|
|
4278
|
-
class
|
|
4284
|
+
class us extends R {
|
|
4279
4285
|
background;
|
|
4280
4286
|
text;
|
|
4281
4287
|
constructor(e, t) {
|
|
@@ -4286,12 +4292,12 @@ class hs extends z {
|
|
|
4286
4292
|
const e = this.clipConfiguration.asset, t = await this.parseDocument();
|
|
4287
4293
|
if (!t)
|
|
4288
4294
|
return;
|
|
4289
|
-
const i = new
|
|
4295
|
+
const i = new x.Graphics();
|
|
4290
4296
|
t.background.color && (i.fillStyle = {
|
|
4291
4297
|
color: t.background.color,
|
|
4292
4298
|
alpha: t.background.opacity ?? 1
|
|
4293
4299
|
}, i.rect(0, 0, e.width ?? this.edit.size.width, e.height ?? this.edit.size.height), i.fill());
|
|
4294
|
-
const s = new
|
|
4300
|
+
const s = new x.Text();
|
|
4295
4301
|
s.text = t.text;
|
|
4296
4302
|
const { horizontal: n, vertical: r } = t.alignment;
|
|
4297
4303
|
s.style = {
|
|
@@ -4384,7 +4390,7 @@ class hs extends z {
|
|
|
4384
4390
|
}
|
|
4385
4391
|
}
|
|
4386
4392
|
}
|
|
4387
|
-
class
|
|
4393
|
+
class ds extends R {
|
|
4388
4394
|
texture;
|
|
4389
4395
|
sprite;
|
|
4390
4396
|
constructor(e, t) {
|
|
@@ -4397,9 +4403,9 @@ class us extends z {
|
|
|
4397
4403
|
crossovern: "anonymous",
|
|
4398
4404
|
data: {}
|
|
4399
4405
|
}, s = await this.edit.assetLoader.load(t, i);
|
|
4400
|
-
if (!(s?.source instanceof
|
|
4406
|
+
if (!(s?.source instanceof x.ImageSource))
|
|
4401
4407
|
throw new Error(`Invalid image source '${e.src}'.`);
|
|
4402
|
-
this.texture = this.createCroppedTexture(s), this.sprite = new
|
|
4408
|
+
this.texture = this.createCroppedTexture(s), this.sprite = new x.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4403
4409
|
}
|
|
4404
4410
|
update(e, t) {
|
|
4405
4411
|
super.update(e, t);
|
|
@@ -4417,11 +4423,47 @@ class us extends z {
|
|
|
4417
4423
|
const t = this.clipConfiguration.asset;
|
|
4418
4424
|
if (!t.crop)
|
|
4419
4425
|
return e;
|
|
4420
|
-
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), h = Math.floor((t.crop?.bottom ?? 0) * s), c = n, l = o, g = i - n - r, p = s - o - h,
|
|
4421
|
-
return new
|
|
4426
|
+
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), h = Math.floor((t.crop?.bottom ?? 0) * s), c = n, l = o, g = i - n - r, p = s - o - h, _ = new x.Rectangle(c, l, g, p);
|
|
4427
|
+
return new x.Texture({ source: e.source, frame: _ });
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
class At extends R {
|
|
4431
|
+
texture;
|
|
4432
|
+
sprite;
|
|
4433
|
+
isPlaying;
|
|
4434
|
+
constructor(e, t) {
|
|
4435
|
+
super(e, t), this.texture = null, this.sprite = null, this.isPlaying = !1;
|
|
4436
|
+
}
|
|
4437
|
+
async load() {
|
|
4438
|
+
await super.load();
|
|
4439
|
+
const e = this.clipConfiguration.asset, t = e.src, i = { src: t, data: { autoPlay: !1, muted: !0 } }, s = await this.edit.assetLoader.load(t, i);
|
|
4440
|
+
if (!(s?.source instanceof x.ImageSource || s?.source instanceof x.VideoSource))
|
|
4441
|
+
throw new Error(`Invalid luma source '${e.src}'.`);
|
|
4442
|
+
this.texture = s, this.sprite = new x.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4443
|
+
}
|
|
4444
|
+
update(e, t) {
|
|
4445
|
+
if (super.update(e, t), !this.texture || !(this.texture.source instanceof x.VideoSource))
|
|
4446
|
+
return;
|
|
4447
|
+
const i = this.getPlaybackTime(), s = this.edit.isPlaying && this.isActive();
|
|
4448
|
+
s && (this.isPlaying || (this.isPlaying = !0, this.texture.source.resource.currentTime = i / 1e3, this.texture.source.resource.play().catch(console.error)), this.texture.source.resource.volume !== this.getVolume() && (this.texture.source.resource.volume = this.getVolume()), Math.abs(this.texture.source.resource.currentTime * 1e3 - i) > 100 && (this.texture.source.resource.currentTime = i / 1e3)), !s && this.isPlaying && (this.isPlaying = !1, this.texture.source.resource.pause()), !this.edit.isPlaying && this.isActive() && (this.texture.source.resource.currentTime = i / 1e3);
|
|
4449
|
+
}
|
|
4450
|
+
draw() {
|
|
4451
|
+
super.draw();
|
|
4452
|
+
}
|
|
4453
|
+
dispose() {
|
|
4454
|
+
super.dispose(), this.sprite?.destroy(), this.sprite = null, this.texture?.destroy(), this.texture = null;
|
|
4455
|
+
}
|
|
4456
|
+
getSize() {
|
|
4457
|
+
return { width: this.sprite?.width ?? 0, height: this.sprite?.height ?? 0 };
|
|
4458
|
+
}
|
|
4459
|
+
getVolume() {
|
|
4460
|
+
return 0;
|
|
4461
|
+
}
|
|
4462
|
+
getMask() {
|
|
4463
|
+
return this.sprite;
|
|
4422
4464
|
}
|
|
4423
4465
|
}
|
|
4424
|
-
class
|
|
4466
|
+
class fs extends R {
|
|
4425
4467
|
shape;
|
|
4426
4468
|
shapeBackground;
|
|
4427
4469
|
constructor(e, t) {
|
|
@@ -4429,9 +4471,9 @@ class ds extends z {
|
|
|
4429
4471
|
}
|
|
4430
4472
|
async load() {
|
|
4431
4473
|
await super.load();
|
|
4432
|
-
const e = this.clipConfiguration.asset, t = new
|
|
4474
|
+
const e = this.clipConfiguration.asset, t = new x.Graphics(), i = e.width ?? this.edit.size.width, s = e.height ?? this.edit.size.height;
|
|
4433
4475
|
t.fillStyle = { color: "transparent" }, t.rect(0, 0, i, s), t.fill();
|
|
4434
|
-
const n = new
|
|
4476
|
+
const n = new x.Graphics();
|
|
4435
4477
|
switch (e.shape) {
|
|
4436
4478
|
case "rectangle": {
|
|
4437
4479
|
const r = e.rectangle, o = i / 2 - r.width / 2, h = s / 2 - r.height / 2;
|
|
@@ -4484,7 +4526,7 @@ class ds extends z {
|
|
|
4484
4526
|
return 1;
|
|
4485
4527
|
}
|
|
4486
4528
|
}
|
|
4487
|
-
class
|
|
4529
|
+
class ps extends R {
|
|
4488
4530
|
background;
|
|
4489
4531
|
text;
|
|
4490
4532
|
constructor(e, t) {
|
|
@@ -4492,12 +4534,12 @@ class fs extends z {
|
|
|
4492
4534
|
}
|
|
4493
4535
|
async load() {
|
|
4494
4536
|
await super.load();
|
|
4495
|
-
const e = this.clipConfiguration.asset, t = new
|
|
4537
|
+
const e = this.clipConfiguration.asset, t = new x.Graphics();
|
|
4496
4538
|
e.background && (t.fillStyle = {
|
|
4497
4539
|
color: e.background.color,
|
|
4498
4540
|
alpha: e.background.opacity
|
|
4499
4541
|
}, t.rect(0, 0, e.width ?? this.edit.size.width, e.height ?? this.edit.size.height), t.fill());
|
|
4500
|
-
const i = new
|
|
4542
|
+
const i = new x.Text();
|
|
4501
4543
|
i.text = e.text;
|
|
4502
4544
|
const s = e.alignment?.horizontal ?? "center", n = e.alignment?.vertical ?? "center";
|
|
4503
4545
|
i.style = {
|
|
@@ -4543,7 +4585,7 @@ class fs extends z {
|
|
|
4543
4585
|
return 1;
|
|
4544
4586
|
}
|
|
4545
4587
|
}
|
|
4546
|
-
class
|
|
4588
|
+
class ms extends R {
|
|
4547
4589
|
texture;
|
|
4548
4590
|
sprite;
|
|
4549
4591
|
isPlaying;
|
|
@@ -4552,7 +4594,7 @@ class ps extends z {
|
|
|
4552
4594
|
constructor(e, t) {
|
|
4553
4595
|
super(e, t), this.texture = null, this.sprite = null, this.isPlaying = !1;
|
|
4554
4596
|
const i = this.clipConfiguration.asset;
|
|
4555
|
-
this.volumeKeyframeBuilder = new
|
|
4597
|
+
this.volumeKeyframeBuilder = new z(i.volume ?? 1, this.getLength()), this.syncTimer = 0;
|
|
4556
4598
|
}
|
|
4557
4599
|
/**
|
|
4558
4600
|
* TODO: Add support for .mov and .webm files
|
|
@@ -4563,9 +4605,9 @@ class ps extends z {
|
|
|
4563
4605
|
if (t.endsWith(".mov") || t.endsWith(".webm"))
|
|
4564
4606
|
throw new Error(`Video source '${e.src}' is not supported. .mov and .webm files are currently not supported.`);
|
|
4565
4607
|
const i = { src: t, data: { autoPlay: !1, muted: !1 } }, s = await this.edit.assetLoader.load(t, i);
|
|
4566
|
-
if (!(s?.source instanceof
|
|
4608
|
+
if (!(s?.source instanceof x.VideoSource))
|
|
4567
4609
|
throw new Error(`Invalid video source '${e.src}'.`);
|
|
4568
|
-
this.texture = this.createCroppedTexture(s), this.sprite = new
|
|
4610
|
+
this.texture = this.createCroppedTexture(s), this.sprite = new x.Sprite(this.texture), this.getContainer().addChild(this.sprite), this.configureKeyframes();
|
|
4569
4611
|
}
|
|
4570
4612
|
update(e, t) {
|
|
4571
4613
|
super.update(e, t);
|
|
@@ -4593,8 +4635,8 @@ class ps extends z {
|
|
|
4593
4635
|
const t = this.clipConfiguration.asset;
|
|
4594
4636
|
if (!t.crop)
|
|
4595
4637
|
return e;
|
|
4596
|
-
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), h = Math.floor((t.crop?.bottom ?? 0) * s), c = n, l = o, g = i - n - r, p = s - o - h,
|
|
4597
|
-
return new
|
|
4638
|
+
const i = e.width, s = e.height, n = Math.floor((t.crop?.left ?? 0) * i), r = Math.floor((t.crop?.right ?? 0) * i), o = Math.floor((t.crop?.top ?? 0) * s), h = Math.floor((t.crop?.bottom ?? 0) * s), c = n, l = o, g = i - n - r, p = s - o - h, _ = new x.Rectangle(c, l, g, p);
|
|
4639
|
+
return new x.Texture({ source: e.source, frame: _ });
|
|
4598
4640
|
}
|
|
4599
4641
|
}
|
|
4600
4642
|
class le extends rt {
|
|
@@ -4615,11 +4657,13 @@ class le extends rt {
|
|
|
4615
4657
|
isPlaying;
|
|
4616
4658
|
/** @internal */
|
|
4617
4659
|
selectedClip;
|
|
4660
|
+
/** @internal */
|
|
4661
|
+
updatedClip;
|
|
4618
4662
|
constructor(e, t = "#ffffff") {
|
|
4619
|
-
super(), this.assetLoader = new
|
|
4663
|
+
super(), this.assetLoader = new Yt(), this.edit = null, this.tracks = [], this.clipsToDispose = [], this.clips = [], this.events = new Pt(), this.size = e, this.playbackTime = 0, this.totalDuration = 0, this.isPlaying = !1, this.selectedClip = null, this.updatedClip = null, this.backgroundColor = t;
|
|
4620
4664
|
}
|
|
4621
4665
|
async load() {
|
|
4622
|
-
const e = new
|
|
4666
|
+
const e = new x.Graphics();
|
|
4623
4667
|
e.fillStyle = {
|
|
4624
4668
|
color: this.backgroundColor
|
|
4625
4669
|
}, e.rect(0, 0, this.size.width, this.size.height), e.fill(), this.getContainer().addChild(e);
|
|
@@ -4652,7 +4696,7 @@ class le extends rt {
|
|
|
4652
4696
|
this.seek(0);
|
|
4653
4697
|
}
|
|
4654
4698
|
async loadEdit(e) {
|
|
4655
|
-
this.clearClips(), this.edit =
|
|
4699
|
+
this.clearClips(), this.edit = Ji.parse(e), this.backgroundColor = this.edit.timeline.background || "#000000", await Promise.all(
|
|
4656
4700
|
(this.edit.timeline.fonts ?? []).map(async (t) => {
|
|
4657
4701
|
const i = t.src, s = { src: i, loadParser: Ze.Name };
|
|
4658
4702
|
return this.assetLoader.load(i, s);
|
|
@@ -4663,6 +4707,7 @@ class le extends rt {
|
|
|
4663
4707
|
const n = this.createPlayerFromAssetType(s);
|
|
4664
4708
|
n.layer = t + 1, await this.addPlayer(t, n);
|
|
4665
4709
|
}
|
|
4710
|
+
this.updateTotalDuration();
|
|
4666
4711
|
}
|
|
4667
4712
|
getEdit() {
|
|
4668
4713
|
const e = [], t = /* @__PURE__ */ new Map();
|
|
@@ -4681,7 +4726,7 @@ class le extends rt {
|
|
|
4681
4726
|
};
|
|
4682
4727
|
}
|
|
4683
4728
|
addClip(e, t) {
|
|
4684
|
-
const i =
|
|
4729
|
+
const i = Ft.parse(t), s = this.createPlayerFromAssetType(i);
|
|
4685
4730
|
s.layer = e + 1, this.addPlayer(e, s), this.updateTotalDuration();
|
|
4686
4731
|
}
|
|
4687
4732
|
getClip(e, t) {
|
|
@@ -4706,7 +4751,7 @@ class le extends rt {
|
|
|
4706
4751
|
i.forEach(({ clip: s }) => {
|
|
4707
4752
|
const n = 1e5 - s.layer * le.ZIndexPadding, r = `shotstack-track-${n}`;
|
|
4708
4753
|
let o = this.getContainer().getChildByLabel(r, !1);
|
|
4709
|
-
o || (o = new
|
|
4754
|
+
o || (o = new x.Container({
|
|
4710
4755
|
label: r,
|
|
4711
4756
|
zIndex: n
|
|
4712
4757
|
}), this.getContainer().addChild(o)), o.addChild(s.getContainer());
|
|
@@ -4733,7 +4778,7 @@ class le extends rt {
|
|
|
4733
4778
|
i.forEach(({ clip: s }) => {
|
|
4734
4779
|
const n = 1e5 - s.layer * le.ZIndexPadding, r = `shotstack-track-${n}`;
|
|
4735
4780
|
let o = this.getContainer().getChildByLabel(r, !1);
|
|
4736
|
-
o || (o = new
|
|
4781
|
+
o || (o = new x.Container({
|
|
4737
4782
|
label: r,
|
|
4738
4783
|
zIndex: n
|
|
4739
4784
|
}), this.getContainer().addChild(o)), o.addChild(s.getContainer());
|
|
@@ -4756,6 +4801,23 @@ class le extends rt {
|
|
|
4756
4801
|
};
|
|
4757
4802
|
this.events.emit("clip:selected", n);
|
|
4758
4803
|
}
|
|
4804
|
+
/** @internal */
|
|
4805
|
+
setUpdatedClip(e, t = null) {
|
|
4806
|
+
this.updatedClip = e;
|
|
4807
|
+
const i = e.layer - 1, n = this.clips.filter((o) => o.layer === e.layer).indexOf(e), r = {
|
|
4808
|
+
previous: {
|
|
4809
|
+
clip: t,
|
|
4810
|
+
trackIndex: i,
|
|
4811
|
+
clipIndex: n
|
|
4812
|
+
},
|
|
4813
|
+
current: {
|
|
4814
|
+
clip: e.clipConfiguration,
|
|
4815
|
+
trackIndex: i,
|
|
4816
|
+
clipIndex: n
|
|
4817
|
+
}
|
|
4818
|
+
};
|
|
4819
|
+
this.events.emit("clip:updated", r);
|
|
4820
|
+
}
|
|
4759
4821
|
queueDisposeClip(e) {
|
|
4760
4822
|
this.clipsToDispose.push(e);
|
|
4761
4823
|
}
|
|
@@ -4773,7 +4835,7 @@ class le extends rt {
|
|
|
4773
4835
|
this.getContainer().removeChildAt(t);
|
|
4774
4836
|
} else
|
|
4775
4837
|
for (const t of this.getContainer().children)
|
|
4776
|
-
if (t instanceof
|
|
4838
|
+
if (t instanceof x.Container && t.label?.toString().startsWith("shotstack-track-") && t.children.includes(e.getContainer())) {
|
|
4777
4839
|
t.removeChild(e.getContainer());
|
|
4778
4840
|
break;
|
|
4779
4841
|
}
|
|
@@ -4786,7 +4848,7 @@ class le extends rt {
|
|
|
4786
4848
|
const { asset: t } = e.clipConfiguration;
|
|
4787
4849
|
if (t && "src" in t && typeof t.src == "string")
|
|
4788
4850
|
try {
|
|
4789
|
-
|
|
4851
|
+
x.Assets.unload(t.src);
|
|
4790
4852
|
} catch (i) {
|
|
4791
4853
|
console.warn(`Failed to unload asset: ${t.src}`, i);
|
|
4792
4854
|
}
|
|
@@ -4809,29 +4871,33 @@ class le extends rt {
|
|
|
4809
4871
|
let t;
|
|
4810
4872
|
switch (e.asset.type) {
|
|
4811
4873
|
case "text": {
|
|
4812
|
-
t = new
|
|
4874
|
+
t = new ps(this, e);
|
|
4813
4875
|
break;
|
|
4814
4876
|
}
|
|
4815
4877
|
case "shape": {
|
|
4816
|
-
t = new
|
|
4878
|
+
t = new fs(this, e);
|
|
4817
4879
|
break;
|
|
4818
4880
|
}
|
|
4819
4881
|
case "html": {
|
|
4820
|
-
t = new
|
|
4882
|
+
t = new us(this, e);
|
|
4821
4883
|
break;
|
|
4822
4884
|
}
|
|
4823
4885
|
case "image": {
|
|
4824
|
-
t = new
|
|
4886
|
+
t = new ds(this, e);
|
|
4825
4887
|
break;
|
|
4826
4888
|
}
|
|
4827
4889
|
case "video": {
|
|
4828
|
-
t = new
|
|
4890
|
+
t = new ms(this, e);
|
|
4829
4891
|
break;
|
|
4830
4892
|
}
|
|
4831
4893
|
case "audio": {
|
|
4832
4894
|
t = new st(this, e);
|
|
4833
4895
|
break;
|
|
4834
4896
|
}
|
|
4897
|
+
case "luma": {
|
|
4898
|
+
t = new At(this, e);
|
|
4899
|
+
break;
|
|
4900
|
+
}
|
|
4835
4901
|
default:
|
|
4836
4902
|
throw new Error(`Unsupported clip type: ${e.asset.type}`);
|
|
4837
4903
|
}
|
|
@@ -4843,10 +4909,12 @@ class le extends rt {
|
|
|
4843
4909
|
this.tracks[e].push(t), this.clips.push(t);
|
|
4844
4910
|
const i = 1e5 - (e + 1) * le.ZIndexPadding, s = `shotstack-track-${i}`;
|
|
4845
4911
|
let n = this.getContainer().getChildByLabel(s, !1);
|
|
4846
|
-
n || (n = new
|
|
4912
|
+
n || (n = new x.Container({ label: s, zIndex: i }), this.getContainer().addChild(n)), n.addChild(t.getContainer());
|
|
4913
|
+
const r = t instanceof At;
|
|
4914
|
+
await t.load(), r && n.setMask({ mask: t.getMask(), inverse: !0 }), this.updateTotalDuration();
|
|
4847
4915
|
}
|
|
4848
4916
|
}
|
|
4849
|
-
class
|
|
4917
|
+
class ke extends rt {
|
|
4850
4918
|
static Width = 250;
|
|
4851
4919
|
static Height = 100;
|
|
4852
4920
|
fps;
|
|
@@ -4859,15 +4927,15 @@ class _e extends rt {
|
|
|
4859
4927
|
super(), this.background = null, this.text = null, this.fps = 0, this.playbackTime = 0, this.playbackDuration = 0, this.isPlaying = !1;
|
|
4860
4928
|
}
|
|
4861
4929
|
async load() {
|
|
4862
|
-
const e = new
|
|
4863
|
-
e.fillStyle = { color: "#424242", alpha: 0.5 }, e.rect(0, 0,
|
|
4864
|
-
const t = new
|
|
4930
|
+
const e = new x.Graphics();
|
|
4931
|
+
e.fillStyle = { color: "#424242", alpha: 0.5 }, e.rect(0, 0, ke.Width, ke.Height), e.fill(), this.getContainer().addChild(e), this.background = e;
|
|
4932
|
+
const t = new x.Text();
|
|
4865
4933
|
t.text = "", t.style = {
|
|
4866
4934
|
fontFamily: "monospace",
|
|
4867
4935
|
fontSize: 14,
|
|
4868
4936
|
fill: "#ffffff",
|
|
4869
4937
|
wordWrap: !0,
|
|
4870
|
-
wordWrapWidth:
|
|
4938
|
+
wordWrapWidth: ke.Width
|
|
4871
4939
|
}, this.getContainer().addChild(t), this.text = t;
|
|
4872
4940
|
}
|
|
4873
4941
|
update(e, t) {
|
|
@@ -4912,13 +4980,13 @@ class he {
|
|
|
4912
4980
|
maxZoom = 4;
|
|
4913
4981
|
currentZoom = 0.8;
|
|
4914
4982
|
constructor(e, t) {
|
|
4915
|
-
this.size = e, this.application = new
|
|
4983
|
+
this.size = e, this.application = new x.Application(), this.edit = t, this.inspector = new ke();
|
|
4916
4984
|
}
|
|
4917
4985
|
async load() {
|
|
4918
4986
|
const e = document.querySelector(he.CanvasSelector);
|
|
4919
4987
|
if (!e)
|
|
4920
4988
|
throw new Error(`Shotstack canvas root element '${he.CanvasSelector}' not found.`);
|
|
4921
|
-
this.registerExtensions(), this.container = new
|
|
4989
|
+
this.registerExtensions(), this.container = new x.Container(), this.background = new x.Graphics(), this.background.fillStyle = { color: "#424242" }, this.background.rect(0, 0, this.size.width, this.size.height), this.background.fill(), await this.configureApplication(), this.configureStage(), this.setupTouchHandling(e), this.edit.getContainer().scale = this.currentZoom, e.appendChild(this.application.canvas);
|
|
4922
4990
|
}
|
|
4923
4991
|
setupTouchHandling(e) {
|
|
4924
4992
|
const t = this.edit.getContainer();
|
|
@@ -4967,7 +5035,7 @@ class he {
|
|
|
4967
5035
|
t.scale.x = this.currentZoom, t.scale.y = this.currentZoom;
|
|
4968
5036
|
}
|
|
4969
5037
|
registerExtensions() {
|
|
4970
|
-
he.extensionsRegistered || (
|
|
5038
|
+
he.extensionsRegistered || (x.extensions.add(new He()), x.extensions.add(new Ze()), he.extensionsRegistered = !0);
|
|
4971
5039
|
}
|
|
4972
5040
|
async configureApplication() {
|
|
4973
5041
|
const e = {
|
|
@@ -4984,7 +5052,7 @@ class he {
|
|
|
4984
5052
|
configureStage() {
|
|
4985
5053
|
if (!this.container || !this.background)
|
|
4986
5054
|
throw new Error("Shotstack canvas container not set up.");
|
|
4987
|
-
this.container.addChild(this.background), this.container.addChild(this.edit.getContainer()), this.container.addChild(this.inspector.getContainer()), this.application.stage.addChild(this.container), this.application.stage.eventMode = "static", this.application.stage.hitArea = new
|
|
5055
|
+
this.container.addChild(this.background), this.container.addChild(this.edit.getContainer()), this.container.addChild(this.inspector.getContainer()), this.application.stage.addChild(this.container), this.application.stage.eventMode = "static", this.application.stage.hitArea = new x.Rectangle(0, 0, this.size.width, this.size.height), this.application.stage.on("click", this.onClick.bind(this)), this.edit.getContainer().position = {
|
|
4988
5056
|
x: this.application.canvas.width / 2 - this.edit.size.width * this.currentZoom / 2,
|
|
4989
5057
|
y: this.application.canvas.height / 2 - this.edit.size.height * this.currentZoom / 2
|
|
4990
5058
|
};
|
|
@@ -4992,13 +5060,12 @@ class he {
|
|
|
4992
5060
|
onClick() {
|
|
4993
5061
|
this.edit.pause();
|
|
4994
5062
|
}
|
|
4995
|
-
/** @internal */
|
|
4996
5063
|
dispose() {
|
|
4997
5064
|
const e = document.querySelector(he.CanvasSelector);
|
|
4998
5065
|
e && e.contains(this.application.canvas) && e.removeChild(this.application.canvas), this.application.ticker.remove(this.onTick, this), this.application.stage.off("click", this.onClick, this), this.background?.destroy(), this.container?.destroy(), this.inspector.dispose(), this.application.destroy(!0, { children: !0, texture: !0 });
|
|
4999
5066
|
}
|
|
5000
5067
|
}
|
|
5001
|
-
class
|
|
5068
|
+
class vs {
|
|
5002
5069
|
edit;
|
|
5003
5070
|
seekDistance = 50;
|
|
5004
5071
|
seekDistanceLarge = 500;
|
|
@@ -5069,13 +5136,13 @@ class ys {
|
|
|
5069
5136
|
}
|
|
5070
5137
|
};
|
|
5071
5138
|
}
|
|
5072
|
-
class
|
|
5139
|
+
class xs {
|
|
5073
5140
|
ffmpeg;
|
|
5074
5141
|
isReady = !1;
|
|
5075
5142
|
edit;
|
|
5076
5143
|
application;
|
|
5077
5144
|
constructor(e, t) {
|
|
5078
|
-
this.edit = e, this.application = t.application, this.ffmpeg = new
|
|
5145
|
+
this.edit = e, this.application = t.application, this.ffmpeg = new Ut();
|
|
5079
5146
|
}
|
|
5080
5147
|
async init() {
|
|
5081
5148
|
if (!this.isReady)
|
|
@@ -5093,7 +5160,7 @@ class vs {
|
|
|
5093
5160
|
n.visible = !1;
|
|
5094
5161
|
const g = this.createProgressOverlay();
|
|
5095
5162
|
try {
|
|
5096
|
-
const p = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 },
|
|
5163
|
+
const p = this.edit.getSize ? this.edit.getSize() : { width: 1920, height: 1080 }, _ = Math.ceil(this.edit.totalDuration * t / 1e3), A = 1e3 / t, S = 100, N = 50, J = 50, re = (T) => Math.round(T / _ * N);
|
|
5097
5164
|
this.updateProgressOverlay(g, 0, S);
|
|
5098
5165
|
const H = document.createElement("canvas");
|
|
5099
5166
|
H.width = p.width, H.height = p.height;
|
|
@@ -5111,13 +5178,13 @@ class vs {
|
|
|
5111
5178
|
}
|
|
5112
5179
|
}
|
|
5113
5180
|
n.position.x = 0, n.position.y = 0, n.scale.x = 1, n.scale.y = 1;
|
|
5114
|
-
for (let T = 0; T <
|
|
5181
|
+
for (let T = 0; T < _; T += 1) {
|
|
5115
5182
|
this.edit.seek(T * A), this.edit.tick ? this.edit.tick(0, 0) : (this.edit.update?.(0, 0), this.edit.draw?.());
|
|
5116
5183
|
try {
|
|
5117
5184
|
const { extract: D } = this.application.renderer, E = D.canvas(n);
|
|
5118
5185
|
oe.clearRect(0, 0, H.width, H.height), oe.drawImage(E, 0, 0);
|
|
5119
|
-
const V = H.toDataURL("image/png"), Se = await (await fetch(V)).arrayBuffer(),
|
|
5120
|
-
await this.ffmpeg.writeFile(
|
|
5186
|
+
const V = H.toDataURL("image/png"), Se = await (await fetch(V)).arrayBuffer(), Zt = `frame_${T.toString().padStart(6, "0")}.png`;
|
|
5187
|
+
await this.ffmpeg.writeFile(Zt, new Uint8Array(Se));
|
|
5121
5188
|
} catch (D) {
|
|
5122
5189
|
console.error(`Error capturing frame ${T}:`, D);
|
|
5123
5190
|
}
|
|
@@ -5155,16 +5222,16 @@ class vs {
|
|
|
5155
5222
|
const D = T.includes("frame=") && T.includes("fps=") ? T.match(/frame=\s*(\d+)/) : null;
|
|
5156
5223
|
if (D?.[1]) {
|
|
5157
5224
|
const E = parseInt(D[1], 10);
|
|
5158
|
-
if (!Number.isNaN(E) && E > ct && (ct = E, E <=
|
|
5159
|
-
const V = Math.round(E /
|
|
5225
|
+
if (!Number.isNaN(E) && E > ct && (ct = E, E <= _)) {
|
|
5226
|
+
const V = Math.round(E / _ * J);
|
|
5160
5227
|
this.updateProgressOverlay(g, N + V, S);
|
|
5161
5228
|
}
|
|
5162
5229
|
}
|
|
5163
5230
|
};
|
|
5164
5231
|
this.ffmpeg.on("log", lt), await this.ffmpeg.exec(X), this.ffmpeg.off("log", lt), this.updateProgressOverlay(g, N + J, S);
|
|
5165
|
-
const je = await this.ffmpeg.readFile($e),
|
|
5232
|
+
const je = await this.ffmpeg.readFile($e), Nt = je instanceof Uint8Array ? je : new TextEncoder().encode(je.toString()), Dt = new Blob([Nt], { type: "video/mp4" }), ht = URL.createObjectURL(Dt), Ue = document.createElement("a");
|
|
5166
5233
|
Ue.href = ht, Ue.download = e, Ue.click(), URL.revokeObjectURL(ht);
|
|
5167
|
-
for (let T = 0; T <
|
|
5234
|
+
for (let T = 0; T < _; T += 1)
|
|
5168
5235
|
try {
|
|
5169
5236
|
await this.ffmpeg.deleteFile(`frame_${T.toString().padStart(6, "0")}.png`);
|
|
5170
5237
|
} catch {
|
|
@@ -5197,10 +5264,10 @@ class vs {
|
|
|
5197
5264
|
searchContainerForPlayers(e, t) {
|
|
5198
5265
|
if (e) {
|
|
5199
5266
|
for (const i of e.children)
|
|
5200
|
-
if (i instanceof
|
|
5267
|
+
if (i instanceof x.Container) {
|
|
5201
5268
|
if (i.label?.startsWith("shotstack-track-")) {
|
|
5202
5269
|
for (const n of i.children)
|
|
5203
|
-
if (n instanceof
|
|
5270
|
+
if (n instanceof x.Container) {
|
|
5204
5271
|
const r = n, o = ["player", "clip", "audioPlayer", "entity"];
|
|
5205
5272
|
for (const h of o) {
|
|
5206
5273
|
const c = r[h];
|
|
@@ -5291,7 +5358,7 @@ class vs {
|
|
|
5291
5358
|
}
|
|
5292
5359
|
export {
|
|
5293
5360
|
he as Canvas,
|
|
5294
|
-
|
|
5361
|
+
vs as Controls,
|
|
5295
5362
|
le as Edit,
|
|
5296
|
-
|
|
5363
|
+
xs as VideoExporter
|
|
5297
5364
|
};
|