@designcombo/state 2.1.0 → 3.0.0-beta.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/index.es.js +67 -66
- package/dist/index.umd.js +1 -1
- package/dist/utils/load-item.d.ts +10 -0
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
@@ -552,7 +552,7 @@ pr.exports;
|
|
552
552
|
function dt(e, s) {
|
553
553
|
return e.has(s);
|
554
554
|
}
|
555
|
-
function
|
555
|
+
function tt(e, s) {
|
556
556
|
return e == null ? void 0 : e[s];
|
557
557
|
}
|
558
558
|
function Yt(e) {
|
@@ -578,7 +578,7 @@ pr.exports;
|
|
578
578
|
}(), Je = jt.toString, Sr = RegExp(
|
579
579
|
"^" + we.call(St).replace(yt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
580
580
|
), Te = Gt ? q.Buffer : void 0, he = q.Symbol, qe = q.Uint8Array, me = jt.propertyIsEnumerable, qt = gt.splice, Et = he ? he.toStringTag : void 0, ye = Object.getOwnPropertySymbols, Ee = Te ? Te.isBuffer : void 0, Zt = pe(Object.keys, Object), Me = Nt(q, "DataView"), Qt = Nt(q, "Map"), Ae = Nt(q, "Promise"), De = Nt(q, "Set"), xe = Nt(q, "WeakMap"), Bt = Nt(Object, "create"), Ze = ft(Me), zt = ft(Qt), kr = ft(Ae), wr = ft(De), Tr = ft(xe), Qe = he ? he.prototype : void 0, Oe = Qe ? Qe.valueOf : void 0;
|
581
|
-
function
|
581
|
+
function et(e) {
|
582
582
|
var s = -1, o = e == null ? 0 : e.length;
|
583
583
|
for (this.clear(); ++s < o; ) {
|
584
584
|
var l = e[s];
|
@@ -608,7 +608,7 @@ pr.exports;
|
|
608
608
|
var o = this.__data__;
|
609
609
|
return this.size += this.has(e) ? 0 : 1, o[e] = Bt && s === void 0 ? i : s, this;
|
610
610
|
}
|
611
|
-
|
611
|
+
et.prototype.clear = Er, et.prototype.delete = Mr, et.prototype.get = Ar, et.prototype.has = Dr, et.prototype.set = xr;
|
612
612
|
function st(e) {
|
613
613
|
var s = -1, o = e == null ? 0 : e.length;
|
614
614
|
for (this.clear(); ++s < o; ) {
|
@@ -647,9 +647,9 @@ pr.exports;
|
|
647
647
|
}
|
648
648
|
function jr() {
|
649
649
|
this.size = 0, this.__data__ = {
|
650
|
-
hash: new
|
650
|
+
hash: new et(),
|
651
651
|
map: new (Qt || st)(),
|
652
|
-
string: new
|
652
|
+
string: new et()
|
653
653
|
};
|
654
654
|
}
|
655
655
|
function zr(e) {
|
@@ -748,9 +748,9 @@ pr.exports;
|
|
748
748
|
if (Z && !at)
|
749
749
|
return E || (E = new Ot()), U || cr(e) ? Re(e, s, o, l, F, E) : Jr(e, s, J, o, l, F, E);
|
750
750
|
if (!(o & a)) {
|
751
|
-
var ot = at && St.call(e, "__wrapped__"),
|
752
|
-
if (ot ||
|
753
|
-
var Kt = ot ? e.value() : e, Ht =
|
751
|
+
var ot = at && St.call(e, "__wrapped__"), rt = mt && St.call(s, "__wrapped__");
|
752
|
+
if (ot || rt) {
|
753
|
+
var Kt = ot ? e.value() : e, Ht = rt ? s.value() : s;
|
754
754
|
return E || (E = new Ot()), F(Kt, Ht, o, l, E);
|
755
755
|
}
|
756
756
|
}
|
@@ -782,9 +782,9 @@ pr.exports;
|
|
782
782
|
return G == s;
|
783
783
|
var at = -1, mt = !0, Z = o & c ? new Ie() : void 0;
|
784
784
|
for (E.set(e, s), E.set(s, e); ++at < $; ) {
|
785
|
-
var ot = e[at],
|
785
|
+
var ot = e[at], rt = s[at];
|
786
786
|
if (l)
|
787
|
-
var Kt = U ? l(
|
787
|
+
var Kt = U ? l(rt, ot, at, s, e, E) : l(ot, rt, at, e, s, E);
|
788
788
|
if (Kt !== void 0) {
|
789
789
|
if (Kt)
|
790
790
|
continue;
|
@@ -799,7 +799,7 @@ pr.exports;
|
|
799
799
|
mt = !1;
|
800
800
|
break;
|
801
801
|
}
|
802
|
-
} else if (!(ot ===
|
802
|
+
} else if (!(ot === rt || F(ot, rt, o, l, E))) {
|
803
803
|
mt = !1;
|
804
804
|
break;
|
805
805
|
}
|
@@ -853,7 +853,7 @@ pr.exports;
|
|
853
853
|
var ot = E.get(e);
|
854
854
|
if (ot && E.get(s))
|
855
855
|
return ot == s;
|
856
|
-
var
|
856
|
+
var rt = !0;
|
857
857
|
E.set(e, s), E.set(s, e);
|
858
858
|
for (var Kt = U; ++mt < J; ) {
|
859
859
|
Z = $[mt];
|
@@ -861,16 +861,16 @@ pr.exports;
|
|
861
861
|
if (l)
|
862
862
|
var Rn = U ? l(re, Ht, Z, s, e, E) : l(Ht, re, Z, e, s, E);
|
863
863
|
if (!(Rn === void 0 ? Ht === re || F(Ht, re, o, l, E) : Rn)) {
|
864
|
-
|
864
|
+
rt = !1;
|
865
865
|
break;
|
866
866
|
}
|
867
867
|
Kt || (Kt = Z == "constructor");
|
868
868
|
}
|
869
|
-
if (
|
869
|
+
if (rt && !Kt) {
|
870
870
|
var ur = e.constructor, lr = s.constructor;
|
871
|
-
ur != lr && "constructor" in e && "constructor" in s && !(typeof ur == "function" && ur instanceof ur && typeof lr == "function" && lr instanceof lr) && (
|
871
|
+
ur != lr && "constructor" in e && "constructor" in s && !(typeof ur == "function" && ur instanceof ur && typeof lr == "function" && lr instanceof lr) && (rt = !1);
|
872
872
|
}
|
873
|
-
return E.delete(e), E.delete(s),
|
873
|
+
return E.delete(e), E.delete(s), rt;
|
874
874
|
}
|
875
875
|
function ee(e) {
|
876
876
|
return Ce(e, ze, Zr);
|
@@ -880,7 +880,7 @@ pr.exports;
|
|
880
880
|
return tn(s) ? o[typeof s == "string" ? "string" : "hash"] : o.map;
|
881
881
|
}
|
882
882
|
function Nt(e, s) {
|
883
|
-
var o =
|
883
|
+
var o = tt(e, s);
|
884
884
|
return Kr(o) ? o : void 0;
|
885
885
|
}
|
886
886
|
function Lt(e) {
|
@@ -989,7 +989,7 @@ pr.exports;
|
|
989
989
|
t.exports = nn;
|
990
990
|
})(pr, pr.exports);
|
991
991
|
var zi = pr.exports;
|
992
|
-
const
|
992
|
+
const nt = /* @__PURE__ */ Mn(zi), fa = "add", Ni = "track", Li = "trackItems", pa = `${Ni}:changed`, ha = `${Li}:changed`, Hi = "state", ma = `${Hi}:changed`, An = "design", $i = `${An}:load`, Ui = `${An}:resize`, wt = "add", Gi = `${wt}:text`, Wi = `${wt}:video`, Yi = `${wt}:audio`, ya = `${wt}:placeholder`, Bi = `${wt}:image`, Ia = `${wt}:mask`, ga = `${wt}:transition`, ba = `${wt}:animation`, Ki = `${wt}:caption`, Xi = `${wt}:template`, Vi = `${wt}:items`, fe = "edit", Ji = `${fe}:object`, qi = `${fe}:replaceMedia`, _a = `${fe}:text`, va = `${fe}:shape`, Sa = `${fe}:templateItem`, ka = `${fe}:deleteTemplateItem`, wa = "enterEditMode", ke = "active", Ta = `${ke}:set`, Ea = `${ke}:delete`, Zi = `${ke}:paste`, Qi = `${ke}:clone`, ts = `${ke}:split`, ct = "layer", Ma = `${ct}:locked`, Aa = `${ct}:hidden`, Da = `${ct}:move`, xa = `${ct}:select`, Oa = `${ct}:selection`, Pa = `${ct}:sendTo`, Ca = `${ct}:rename`, Ra = `${ct}:editingName`, Fa = `${ct}:copy`, ja = `${ct}:paste`, es = `${ct}:clone`, za = `${ct}:split`, Na = `${ct}:cut`, rs = `${ct}:delete`, ns = `${ct}:replace`, br = "history", is = `${br}:undo`, ss = `${br}:redo`, La = `${br}:reset`, ai = "scale", as = `${ai}:changed`;
|
993
993
|
var hr = { exports: {} };
|
994
994
|
hr.exports;
|
995
995
|
(function(t, r) {
|
@@ -1051,8 +1051,8 @@ hr.exports;
|
|
1051
1051
|
o[++s] = l;
|
1052
1052
|
}), o;
|
1053
1053
|
}
|
1054
|
-
var pt = Array.prototype, lt = Function.prototype, dt = Object.prototype,
|
1055
|
-
var e = /[^.]+$/.exec(
|
1054
|
+
var pt = Array.prototype, lt = Function.prototype, dt = Object.prototype, tt = ut["__core-js_shared__"], Yt = function() {
|
1055
|
+
var e = /[^.]+$/.exec(tt && tt.keys && tt.keys.IE_PROTO || "");
|
1056
1056
|
return e ? "Symbol(src)_1." + e : "";
|
1057
1057
|
}(), pe = lt.toString, K = dt.hasOwnProperty, gt = dt.toString, Jt = RegExp(
|
1058
1058
|
"^" + pe.call(K).replace(B, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
@@ -1087,7 +1087,7 @@ hr.exports;
|
|
1087
1087
|
return o[e] = Zt && s === void 0 ? i : s, this;
|
1088
1088
|
}
|
1089
1089
|
zt.prototype.clear = kr, zt.prototype.delete = wr, zt.prototype.get = Tr, zt.prototype.has = Qe, zt.prototype.set = Oe;
|
1090
|
-
function
|
1090
|
+
function et(e) {
|
1091
1091
|
var s = -1, o = e ? e.length : 0;
|
1092
1092
|
for (this.clear(); ++s < o; ) {
|
1093
1093
|
var l = e[s];
|
@@ -1115,7 +1115,7 @@ hr.exports;
|
|
1115
1115
|
var o = this.__data__, l = ge(o, e);
|
1116
1116
|
return l < 0 ? o.push([e, s]) : o[l][1] = s, this;
|
1117
1117
|
}
|
1118
|
-
|
1118
|
+
et.prototype.clear = Er, et.prototype.delete = Mr, et.prototype.get = Ar, et.prototype.has = Dr, et.prototype.set = xr;
|
1119
1119
|
function st(e) {
|
1120
1120
|
var s = -1, o = e ? e.length : 0;
|
1121
1121
|
for (this.clear(); ++s < o; ) {
|
@@ -1126,7 +1126,7 @@ hr.exports;
|
|
1126
1126
|
function Or() {
|
1127
1127
|
this.__data__ = {
|
1128
1128
|
hash: new zt(),
|
1129
|
-
map: new (qt ||
|
1129
|
+
map: new (qt || et)(),
|
1130
1130
|
string: new zt()
|
1131
1131
|
};
|
1132
1132
|
}
|
@@ -1144,10 +1144,10 @@ hr.exports;
|
|
1144
1144
|
}
|
1145
1145
|
st.prototype.clear = Or, st.prototype.delete = Pr, st.prototype.get = Cr, st.prototype.has = Rr, st.prototype.set = Fr;
|
1146
1146
|
function ht(e) {
|
1147
|
-
this.__data__ = new
|
1147
|
+
this.__data__ = new et(e);
|
1148
1148
|
}
|
1149
1149
|
function jr() {
|
1150
|
-
this.__data__ = new
|
1150
|
+
this.__data__ = new et();
|
1151
1151
|
}
|
1152
1152
|
function zr(e) {
|
1153
1153
|
return this.__data__.delete(e);
|
@@ -1160,7 +1160,7 @@ hr.exports;
|
|
1160
1160
|
}
|
1161
1161
|
function Hr(e, s) {
|
1162
1162
|
var o = this.__data__;
|
1163
|
-
if (o instanceof
|
1163
|
+
if (o instanceof et) {
|
1164
1164
|
var l = o.__data__;
|
1165
1165
|
if (!qt || l.length < n - 1)
|
1166
1166
|
return l.push([e, s]), this;
|
@@ -1219,8 +1219,8 @@ hr.exports;
|
|
1219
1219
|
return mt;
|
1220
1220
|
if (U.set(e, $), !J)
|
1221
1221
|
var Z = o ? qr(e) : ze(e);
|
1222
|
-
return Ft(Z || e, function(ot,
|
1223
|
-
Z && (
|
1222
|
+
return Ft(Z || e, function(ot, rt) {
|
1223
|
+
Z && (rt = ot, ot = e[rt]), tr($, rt, Pe(ot, s, o, l, rt, e, U));
|
1224
1224
|
}), $;
|
1225
1225
|
}
|
1226
1226
|
function $r(e) {
|
@@ -2237,11 +2237,11 @@ function Is(t) {
|
|
2237
2237
|
for (const pt of L) {
|
2238
2238
|
const lt = pt.id;
|
2239
2239
|
It.push(lt);
|
2240
|
-
const { details: dt, ...
|
2240
|
+
const { details: dt, ...tt } = pt;
|
2241
2241
|
d.trackItemDetailsMap[lt] = {
|
2242
2242
|
type: S,
|
2243
2243
|
details: dt
|
2244
|
-
}, d.trackItemsMap[lt] =
|
2244
|
+
}, d.trackItemsMap[lt] = tt, d.trackItemIds.push(lt);
|
2245
2245
|
}
|
2246
2246
|
h = It;
|
2247
2247
|
}
|
@@ -2257,28 +2257,28 @@ function Is(t) {
|
|
2257
2257
|
}
|
2258
2258
|
if (u.key === Xi) {
|
2259
2259
|
S = "template";
|
2260
|
-
const W = (Rt = u.value) == null ? void 0 : Rt.payload.trackItemsMap, X = (v = u.value) == null ? void 0 : v.payload.trackItemDetailsMap, L = (V = u.value) == null ? void 0 : V.payload.transitionsMap, It = ((it = u.value) == null ? void 0 : it.payload.transitionIds) || [], pt = (q = u.value) == null ? void 0 : q.payload.trackItemIds, lt = ((Ft = u.value) == null ? void 0 : Ft.payload.tracks) || [], { details: dt, ...
|
2260
|
+
const W = (Rt = u.value) == null ? void 0 : Rt.payload.trackItemsMap, X = (v = u.value) == null ? void 0 : v.payload.trackItemDetailsMap, L = (V = u.value) == null ? void 0 : V.payload.transitionsMap, It = ((it = u.value) == null ? void 0 : it.payload.transitionIds) || [], pt = (q = u.value) == null ? void 0 : q.payload.trackItemIds, lt = ((Ft = u.value) == null ? void 0 : Ft.payload.tracks) || [], { details: dt, ...tt } = await us((Tt = u.value) == null ? void 0 : Tt.payload, {
|
2261
2261
|
size: d.size
|
2262
2262
|
}), Yt = {
|
2263
|
-
id:
|
2263
|
+
id: tt.id,
|
2264
2264
|
items: pt,
|
2265
2265
|
transitions: It,
|
2266
2266
|
tracks: lt
|
2267
2267
|
};
|
2268
|
-
d.trackItemDetailsMap[
|
2268
|
+
d.trackItemDetailsMap[tt.id] = {
|
2269
2269
|
type: S,
|
2270
2270
|
details: dt
|
2271
|
-
}, d.trackItemsMap[
|
2271
|
+
}, d.trackItemsMap[tt.id] = tt, d.trackItemIds.push(tt.id), h = [tt.id], d.trackItemsMap = {
|
2272
2272
|
...d.trackItemsMap,
|
2273
2273
|
...W,
|
2274
|
-
[
|
2274
|
+
[tt.id]: {
|
2275
2275
|
type: "template",
|
2276
|
-
...
|
2276
|
+
...tt
|
2277
2277
|
}
|
2278
2278
|
}, d.trackItemDetailsMap = {
|
2279
2279
|
...d.trackItemDetailsMap,
|
2280
2280
|
...X,
|
2281
|
-
[
|
2281
|
+
[tt.id]: {
|
2282
2282
|
type: "template",
|
2283
2283
|
details: dt
|
2284
2284
|
}
|
@@ -2651,7 +2651,7 @@ var Dn = Symbol.for("immer-nothing"), Le = Symbol.for("immer-draftable"), bt = S
|
|
2651
2651
|
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
2652
2652
|
// See Patches.ts for additional errors
|
2653
2653
|
] : [];
|
2654
|
-
function
|
2654
|
+
function Q(t, ...r) {
|
2655
2655
|
if (process.env.NODE_ENV !== "production") {
|
2656
2656
|
const n = Ii[t], i = typeof n == "function" ? n.apply(null, r) : n;
|
2657
2657
|
throw new Error(`[Immer] ${i}`);
|
@@ -2744,7 +2744,7 @@ function xn(t, r = !1) {
|
|
2744
2744
|
return vr(t) || ue(t) || !Xt(t) || (le(t) > 1 && (t.set = t.add = t.clear = t.delete = vs), Object.freeze(t), r && Object.entries(t).forEach(([n, i]) => xn(i, !0))), t;
|
2745
2745
|
}
|
2746
2746
|
function vs() {
|
2747
|
-
|
2747
|
+
Q(2);
|
2748
2748
|
}
|
2749
2749
|
function vr(t) {
|
2750
2750
|
return Object.isFrozen(t);
|
@@ -2752,7 +2752,7 @@ function vr(t) {
|
|
2752
2752
|
var Sn = {};
|
2753
2753
|
function de(t) {
|
2754
2754
|
const r = Sn[t];
|
2755
|
-
return r ||
|
2755
|
+
return r || Q(0, t), r;
|
2756
2756
|
}
|
2757
2757
|
function Ss(t, r) {
|
2758
2758
|
Sn[t] || (Sn[t] = r);
|
@@ -2791,7 +2791,7 @@ function ws(t) {
|
|
2791
2791
|
function Yn(t, r) {
|
2792
2792
|
r.unfinalizedDrafts_ = r.drafts_.length;
|
2793
2793
|
const n = r.drafts_[0];
|
2794
|
-
return t !== void 0 && t !== n ? (n[bt].modified_ && (kn(r),
|
2794
|
+
return t !== void 0 && t !== n ? (n[bt].modified_ && (kn(r), Q(4)), Xt(t) && (t = yr(r, t), r.parent_ || Ir(r, t)), r.patches_ && de("Patches").generateReplacementPatches_(
|
2795
2795
|
n[bt].base_,
|
2796
2796
|
t,
|
2797
2797
|
r.patches_,
|
@@ -2828,7 +2828,7 @@ function yr(t, r, n) {
|
|
2828
2828
|
return i.copy_;
|
2829
2829
|
}
|
2830
2830
|
function Bn(t, r, n, i, a, c, f) {
|
2831
|
-
if (process.env.NODE_ENV !== "production" && a === n &&
|
2831
|
+
if (process.env.NODE_ENV !== "production" && a === n && Q(5), ue(a)) {
|
2832
2832
|
const p = c && r && r.type_ !== 3 && // Set objects are atomic since they have no keys.
|
2833
2833
|
!$e(r.assigned_, i) ? c.concat(i) : void 0, k = yr(t, a, p);
|
2834
2834
|
if (bi(n, i, k), ue(k))
|
@@ -2921,13 +2921,13 @@ var On = {
|
|
2921
2921
|
};
|
2922
2922
|
},
|
2923
2923
|
defineProperty() {
|
2924
|
-
|
2924
|
+
Q(11);
|
2925
2925
|
},
|
2926
2926
|
getPrototypeOf(t) {
|
2927
2927
|
return ce(t.base_);
|
2928
2928
|
},
|
2929
2929
|
setPrototypeOf() {
|
2930
|
-
|
2930
|
+
Q(12);
|
2931
2931
|
}
|
2932
2932
|
}, Ge = {};
|
2933
2933
|
He(On, (t, r) => {
|
@@ -2936,10 +2936,10 @@ He(On, (t, r) => {
|
|
2936
2936
|
};
|
2937
2937
|
});
|
2938
2938
|
Ge.deleteProperty = function(t, r) {
|
2939
|
-
return process.env.NODE_ENV !== "production" && isNaN(parseInt(r)) &&
|
2939
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(r)) && Q(13), Ge.set.call(this, t, r, void 0);
|
2940
2940
|
};
|
2941
2941
|
Ge.set = function(t, r, n) {
|
2942
|
-
return process.env.NODE_ENV !== "production" && r !== "length" && isNaN(parseInt(r)) &&
|
2942
|
+
return process.env.NODE_ENV !== "production" && r !== "length" && isNaN(parseInt(r)) && Q(14), On.set.call(this, t[0], r, n, t[0]);
|
2943
2943
|
};
|
2944
2944
|
function ln(t, r) {
|
2945
2945
|
const n = t[bt];
|
@@ -2985,7 +2985,7 @@ var Ms = class {
|
|
2985
2985
|
return f.produce(k, (A) => n.call(this, A, ...j));
|
2986
2986
|
};
|
2987
2987
|
}
|
2988
|
-
typeof n != "function" &&
|
2988
|
+
typeof n != "function" && Q(6), i !== void 0 && typeof i != "function" && Q(7);
|
2989
2989
|
let a;
|
2990
2990
|
if (Xt(r)) {
|
2991
2991
|
const c = Wn(this), f = En(r, void 0);
|
@@ -3003,7 +3003,7 @@ var Ms = class {
|
|
3003
3003
|
}
|
3004
3004
|
return a;
|
3005
3005
|
} else
|
3006
|
-
|
3006
|
+
Q(1, r);
|
3007
3007
|
}, this.produceWithPatches = (r, n) => {
|
3008
3008
|
if (typeof r == "function")
|
3009
3009
|
return (f, ...p) => this.produceWithPatches(f, (k) => r(k, ...p));
|
@@ -3014,13 +3014,13 @@ var Ms = class {
|
|
3014
3014
|
}, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
|
3015
3015
|
}
|
3016
3016
|
createDraft(t) {
|
3017
|
-
Xt(t) ||
|
3017
|
+
Xt(t) || Q(8), ue(t) && (t = As(t));
|
3018
3018
|
const r = Wn(this), n = En(t, void 0);
|
3019
3019
|
return n[bt].isManual_ = !0, wn(r), n;
|
3020
3020
|
}
|
3021
3021
|
finishDraft(t, r) {
|
3022
3022
|
const n = t && t[bt];
|
3023
|
-
(!n || !n.isManual_) &&
|
3023
|
+
(!n || !n.isManual_) && Q(9);
|
3024
3024
|
const { scope_: i } = n;
|
3025
3025
|
return Gn(i, r), Yn(void 0, i);
|
3026
3026
|
}
|
@@ -3062,7 +3062,7 @@ function En(t, r) {
|
|
3062
3062
|
return (r ? r.scope_ : _i()).drafts_.push(n), n;
|
3063
3063
|
}
|
3064
3064
|
function As(t) {
|
3065
|
-
return ue(t) ||
|
3065
|
+
return ue(t) || Q(10, t), Si(t);
|
3066
3066
|
}
|
3067
3067
|
function Si(t) {
|
3068
3068
|
if (!Xt(t) || vr(t))
|
@@ -3210,7 +3210,7 @@ function Kn() {
|
|
3210
3210
|
for (let S = 0; S < u.length - 1; S++) {
|
3211
3211
|
const I = le(g);
|
3212
3212
|
let m = u[S];
|
3213
|
-
typeof m != "string" && typeof m != "number" && (m = "" + m), (I === 0 || I === 1) && (m === "__proto__" || m === "constructor") &&
|
3213
|
+
typeof m != "string" && typeof m != "number" && (m = "" + m), (I === 0 || I === 1) && (m === "__proto__" || m === "constructor") && Q(19), typeof g == "function" && m === "prototype" && Q(19), g = un(g, m), typeof g != "object" && Q(18, u.join("/"));
|
3214
3214
|
}
|
3215
3215
|
const b = le(g), _ = A(C.value), h = u[u.length - 1];
|
3216
3216
|
switch (d) {
|
@@ -3219,7 +3219,7 @@ function Kn() {
|
|
3219
3219
|
case 2:
|
3220
3220
|
return g.set(h, _);
|
3221
3221
|
case 3:
|
3222
|
-
|
3222
|
+
Q(16);
|
3223
3223
|
default:
|
3224
3224
|
return g[h] = _;
|
3225
3225
|
}
|
@@ -3246,7 +3246,7 @@ function Kn() {
|
|
3246
3246
|
return delete g[h];
|
3247
3247
|
}
|
3248
3248
|
default:
|
3249
|
-
|
3249
|
+
Q(17, d);
|
3250
3250
|
}
|
3251
3251
|
}), y;
|
3252
3252
|
}
|
@@ -3455,18 +3455,18 @@ class Ha {
|
|
3455
3455
|
...i,
|
3456
3456
|
...r
|
3457
3457
|
};
|
3458
|
-
|
3458
|
+
nt(i, a) || (n.updateHistory && this.updateHistory(a, n.kind), this.prevState = i, this.stateSubject.next(a));
|
3459
3459
|
}
|
3460
3460
|
// emit changes for design size
|
3461
3461
|
subscribeToSize(r) {
|
3462
3462
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3463
|
-
|
3463
|
+
nt(n.size, this.prevState.size) || r({ size: n.size });
|
3464
3464
|
});
|
3465
3465
|
}
|
3466
3466
|
// Selectively subscribe to scale changes
|
3467
3467
|
subscribeToScale(r) {
|
3468
3468
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3469
|
-
|
3469
|
+
nt(n.scale, this.prevState.scale) || r({ scale: n.scale });
|
3470
3470
|
});
|
3471
3471
|
}
|
3472
3472
|
// Selectively subscribe to fps changes
|
@@ -3477,19 +3477,19 @@ class Ha {
|
|
3477
3477
|
}
|
3478
3478
|
subscribeToUpdateTrackItem(r) {
|
3479
3479
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3480
|
-
|
3480
|
+
nt(n.trackItemsMap, this.prevState.trackItemsMap) || r({ trackItemsMap: n.trackItemsMap });
|
3481
3481
|
});
|
3482
3482
|
}
|
3483
3483
|
subscribeToUpdateTrackItemTiming(r) {
|
3484
3484
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3485
|
-
if (!
|
3485
|
+
if (!nt(n.trackItemsMap, this.prevState.trackItemsMap)) {
|
3486
3486
|
const i = Object.keys(n.trackItemsMap).filter((c) => {
|
3487
3487
|
const f = this.prevState.trackItemsMap[c], p = n.trackItemsMap[c];
|
3488
|
-
return f && p && !
|
3488
|
+
return f && p && !nt(f.trim, p.trim);
|
3489
3489
|
}), a = Object.keys(n.trackItemsMap).filter(
|
3490
3490
|
(c) => {
|
3491
3491
|
const f = this.prevState.trackItemsMap[c], p = n.trackItemsMap[c];
|
3492
|
-
return f && p && !
|
3492
|
+
return f && p && !nt(f.display, p.display);
|
3493
3493
|
}
|
3494
3494
|
);
|
3495
3495
|
r({
|
@@ -3502,7 +3502,7 @@ class Ha {
|
|
3502
3502
|
}
|
3503
3503
|
subscribeToUpdateItemDetails(r) {
|
3504
3504
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3505
|
-
|
3505
|
+
nt(n.trackItemDetailsMap, this.prevState.trackItemDetailsMap) || r({ trackItemDetailsMap: n.trackItemDetailsMap });
|
3506
3506
|
});
|
3507
3507
|
}
|
3508
3508
|
// Selectively subscribe to duration changes
|
@@ -3525,22 +3525,23 @@ class Ha {
|
|
3525
3525
|
}
|
3526
3526
|
subscribeToAddOrRemoveItems(r) {
|
3527
3527
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3528
|
-
|
3528
|
+
const i = [...n.trackItemIds].sort(), a = [...this.prevState.trackItemIds].sort();
|
3529
|
+
nt(i, a) || r({ trackItemIds: n.trackItemIds });
|
3529
3530
|
});
|
3530
3531
|
}
|
3531
3532
|
// Selectively subscribe to activeIds changes
|
3532
3533
|
subscribeToActiveIds(r) {
|
3533
3534
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3534
|
-
|
3535
|
+
nt(n.activeIds, this.prevState.activeIds) || r({ activeIds: n.activeIds });
|
3535
3536
|
});
|
3536
3537
|
}
|
3537
3538
|
// Selectively subscribe to multiple track-related properties
|
3538
3539
|
subscribeToTracks(r) {
|
3539
3540
|
return this.stateSubject.asObservable().subscribe((n) => {
|
3540
|
-
(!
|
3541
|
+
(!nt(n.tracks, this.prevState.tracks) || !nt(n.trackItemIds, this.prevState.trackItemIds) || !nt(n.trackItemsMap, this.prevState.trackItemsMap) || !nt(n.transitionIds, this.prevState.transitionIds) || !nt(n.transitionsMap, this.prevState.transitionsMap) || !nt(
|
3541
3542
|
n.trackItemDetailsMap,
|
3542
3543
|
this.prevState.trackItemDetailsMap
|
3543
|
-
) || !
|
3544
|
+
) || !nt(n.structure, this.prevState.structure)) && r({
|
3544
3545
|
tracks: n.tracks,
|
3545
3546
|
trackItemIds: n.trackItemIds,
|
3546
3547
|
trackItemsMap: n.trackItemsMap,
|
package/dist/index.umd.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
(function(b,X){typeof exports=="object"&&typeof module<"u"?X(exports,require("@designcombo/events")):typeof define=="function"&&define.amd?define(["exports","@designcombo/events"],X):(b=typeof globalThis<"u"?globalThis:b||self,X(b.events={},b.events))})(this,function(b,X){"use strict";var Ls=Object.defineProperty;var Fs=(b,X,Gt)=>X in b?Ls(b,X,{enumerable:!0,configurable:!0,writable:!0,value:Gt}):b[X]=Gt;var he=(b,X,Gt)=>Fs(b,typeof X!="symbol"?X+"":X,Gt);var Gt=function(t,r){return Gt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},Gt(t,r)};function ke(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Gt(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function Tr(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function kr(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,c=[],f;try{for(;(r===void 0||r-- >0)&&!(s=i.next()).done;)c.push(s.value)}catch(p){f={error:p}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(f)throw f.error}}return c}function wr(t,r,n){if(n||arguments.length===2)for(var i=0,s=r.length,c;i<s;i++)(c||!(i in r))&&(c||(c=Array.prototype.slice.call(r,0,i)),c[i]=r[i]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function Ft(t){return typeof t=="function"}function Ln(t){var r=function(i){Error.call(i),i.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Mr=Ln(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
2
2
|
`+n.map(function(i,s){return s+1+") "+i.toString()}).join(`
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function Ar(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Ze=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var f=this._parentage;if(f)if(this._parentage=null,Array.isArray(f))try{for(var p=Tr(f),T=p.next();!T.done;T=p.next()){var N=T.value;N.remove(this)}}catch(u){r={error:u}}finally{try{T&&!T.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}else f.remove(this);var D=this.initialTeardown;if(Ft(D))try{D()}catch(u){c=u instanceof Mr?u.errors:[u]}var P=this._finalizers;if(P){this._finalizers=null;try{for(var y=Tr(P),w=y.next();!w.done;w=y.next()){var x=w.value;try{jn(x)}catch(u){c=c??[],u instanceof Mr?c=wr(wr([],kr(c)),kr(u.errors)):c.push(u)}}}catch(u){i={error:u}}finally{try{w&&!w.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}}if(c)throw new Mr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)jn(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&Ar(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&Ar(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),Fn=Ze.EMPTY;function Nn(t){return t instanceof Ze||t&&"closed"in t&&Ft(t.remove)&&Ft(t.add)&&Ft(t.unsubscribe)}function jn(t){Ft(t)?t():t.unsubscribe()}var Hn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},zn={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,wr([t,r],kr(n)))},clearTimeout:function(t){var r=zn.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Ki(t){zn.setTimeout(function(){throw t})}function $n(){}function qe(t){t()}var Un=function(t){ke(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Nn(n)&&n.add(i)):i.destination=Zi,i}return r.create=function(n,i,s){return new Or(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Ze),Bi=Function.prototype.bind;function Dr(t,r){return Bi.call(t,r)}var Vi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Qe(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Qe(i)}else Qe(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Qe(n)}},t}(),Or=function(t){ke(r,t);function r(n,i,s){var c=t.call(this)||this,f;if(Ft(n)||!n)f={next:n??void 0,error:i??void 0,complete:s??void 0};else{var p;c&&Hn.useDeprecatedNextContext?(p=Object.create(n),p.unsubscribe=function(){return c.unsubscribe()},f={next:n.next&&Dr(n.next,p),error:n.error&&Dr(n.error,p),complete:n.complete&&Dr(n.complete,p)}):f=n}return c.destination=new Vi(f),c}return r}(Un);function Qe(t){Ki(t)}function Ji(t){throw t}var Zi={closed:!0,next:$n,error:Ji,complete:$n},qi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Qi(t){return t}function ta(t){return t.length===0?Qi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var Yn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=ra(r)?r:new Or(r,n,i);return qe(function(){var f=s,p=f.operator,T=f.source;c.add(p?p.call(c,T):T?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Gn(n),new n(function(s,c){var f=new Or({next:function(p){try{r(p)}catch(T){c(T),f.unsubscribe()}},error:c,complete:s});i.subscribe(f)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[qi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return ta(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Gn(r),new r(function(i,s){var c;n.subscribe(function(f){return c=f},function(f){return s(f)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Gn(t){var r;return(r=t??Hn.Promise)!==null&&r!==void 0?r:Promise}function ea(t){return t&&Ft(t.next)&&Ft(t.error)&&Ft(t.complete)}function ra(t){return t&&t instanceof Un||ea(t)&&Nn(t)}var na=Ln(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Wn=function(t){ke(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Xn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new na},r.prototype.next=function(n){var i=this;qe(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var f=Tr(i.currentObservers),p=f.next();!p.done;p=f.next()){var T=p.value;T.next(n)}}catch(N){s={error:N}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;qe(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;qe(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,f=s.isStopped,p=s.observers;return c||f?Fn:(this.currentObservers=null,p.push(n),new Ze(function(){i.currentObservers=null,Ar(p,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,f=i.isStopped;s?n.error(c):f&&n.complete()},r.prototype.asObservable=function(){var n=new Yn;return n.source=this,n},r.create=function(n,i){return new Xn(n,i)},r}(Yn),Xn=function(t){ke(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:Fn},r}(Wn),Kn=function(t){ke(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Wn),Tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr={exports:{}};tr.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,f=9007199254740991,p="[object Arguments]",T="[object Array]",N="[object AsyncFunction]",D="[object Boolean]",P="[object Date]",y="[object Error]",w="[object Function]",x="[object GeneratorFunction]",u="[object Map]",d="[object Number]",_="[object Null]",g="[object Object]",v="[object Promise]",h="[object Proxy]",E="[object RegExp]",I="[object Set]",m="[object String]",O="[object Symbol]",R="[object Undefined]",k="[object WeakMap]",L="[object ArrayBuffer]",j="[object DataView]",H="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",B="[object Int16Array]",kt="[object Int32Array]",Ot="[object Uint8Array]",Pt="[object Uint8ClampedArray]",$="[object Uint16Array]",Kt="[object Uint32Array]",vt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,Nt=/^(?:0|[1-9]\d*)$/,S={};S[H]=S[A]=S[C]=S[B]=S[kt]=S[Ot]=S[Pt]=S[$]=S[Kt]=!0,S[p]=S[T]=S[L]=S[D]=S[j]=S[P]=S[y]=S[w]=S[u]=S[d]=S[g]=S[E]=S[I]=S[m]=S[k]=!1;var Z=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,ot=typeof self=="object"&&self&&self.Object===Object&&self,et=Z||ot||Function("return this")(),jt=r&&!r.nodeType&&r,Mt=jt&&!0&&t&&!t.nodeType&&t,Bt=Mt&&Mt.exports===jt,Vt=Bt&&Z.process,se=function(){try{return Vt&&Vt.binding&&Vt.binding("util")}catch{}}(),W=se&&se.isTypedArray;function J(e,a){for(var o=-1,l=e==null?0:e.length,F=0,M=[];++o<l;){var Y=e[o];a(Y,o,e)&&(M[F++]=Y)}return M}function z(e,a){for(var o=-1,l=a.length,F=e.length;++o<l;)e[F+o]=a[o];return e}function St(e,a){for(var o=-1,l=e==null?0:e.length;++o<l;)if(a(e[o],o,e))return!0;return!1}function mt(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function ft(e){return function(a){return e(a)}}function pt(e,a){return e.has(a)}function nt(e,a){return e==null?void 0:e[a]}function Jt(e){var a=-1,o=Array(e.size);return e.forEach(function(l,F){o[++a]=[F,l]}),o}function ye(e,a){return function(o){return e(a(o))}}function V(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var Et=Array.prototype,oe=Function.prototype,Ht=Object.prototype,Ct=et["__core-js_shared__"],Ne=oe.toString,wt=Ht.hasOwnProperty,cr=function(){var e=/[^.]+$/.exec(Ct&&Ct.keys&&Ct.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ur=Ht.toString,Jr=RegExp("^"+Ne.call(wt).replace(vt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=Bt?et.Buffer:void 0,Ie=et.Symbol,lr=et.Uint8Array,_e=Ht.propertyIsEnumerable,ce=Et.splice,At=Ie?Ie.toStringTag:void 0,ge=Object.getOwnPropertySymbols,He=je?je.isBuffer:void 0,ue=ye(Object.keys,Object),ze=$t(et,"DataView"),le=$t(et,"Map"),$e=$t(et,"Promise"),Ue=$t(et,"Set"),Ye=$t(et,"WeakMap"),Zt=$t(Object,"create"),dr=ht(ze),zt=ht(le),Zr=ht($e),qr=ht(Ue),Qr=ht(Ye),fr=Ie?Ie.prototype:void 0,Ge=fr?fr.valueOf:void 0;function at(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function tn(){this.__data__=Zt?Zt(null):{},this.size=0}function en(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function rn(e){var a=this.__data__;if(Zt){var o=a[e];return o===i?void 0:o}return wt.call(a,e)?a[e]:void 0}function nn(e){var a=this.__data__;return Zt?a[e]!==void 0:wt.call(a,e)}function an(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Zt&&a===void 0?i:a,this}at.prototype.clear=tn,at.prototype.delete=en,at.prototype.get=rn,at.prototype.has=nn,at.prototype.set=an;function ct(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function sn(){this.__data__=[],this.size=0}function on(e){var a=this.__data__,o=Se(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():ce.call(a,o,1),--this.size,!0}function cn(e){var a=this.__data__,o=Se(a,e);return o<0?void 0:a[o][1]}function un(e){return Se(this.__data__,e)>-1}function ln(e,a){var o=this.__data__,l=Se(o,e);return l<0?(++this.size,o.push([e,a])):o[l][1]=a,this}ct.prototype.clear=sn,ct.prototype.delete=on,ct.prototype.get=cn,ct.prototype.has=un,ct.prototype.set=ln;function yt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function dn(){this.size=0,this.__data__={hash:new at,map:new(le||ct),string:new at}}function fn(e){var a=Dt(this,e).delete(e);return this.size-=a?1:0,a}function pn(e){return Dt(this,e).get(e)}function hn(e){return Dt(this,e).has(e)}function mn(e,a){var o=Dt(this,e),l=o.size;return o.set(e,a),this.size+=o.size==l?0:1,this}yt.prototype.clear=dn,yt.prototype.delete=fn,yt.prototype.get=pn,yt.prototype.has=hn,yt.prototype.set=mn;function be(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new yt;++a<o;)this.add(e[a])}function pr(e){return this.__data__.set(e,i),this}function ve(e){return this.__data__.has(e)}be.prototype.add=be.prototype.push=pr,be.prototype.has=ve;function Rt(e){var a=this.__data__=new ct(e);this.size=a.size}function We(){this.__data__=new ct,this.size=0}function yn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function In(e){return this.__data__.get(e)}function _n(e){return this.__data__.has(e)}function gn(e,a){var o=this.__data__;if(o instanceof ct){var l=o.__data__;if(!le||l.length<n-1)return l.push([e,a]),this.size=++o.size,this;o=this.__data__=new yt(l)}return o.set(e,a),this.size=o.size,this}Rt.prototype.clear=We,Rt.prototype.delete=yn,Rt.prototype.get=In,Rt.prototype.has=_n,Rt.prototype.set=gn;function bn(e,a){var o=Ee(e),l=!o&&_r(e),F=!o&&!l&&Te(e),M=!o&&!l&&!F&&vr(e),Y=o||l||F||M,U=Y?mt(e.length,String):[],q=U.length;for(var G in e)wt.call(e,G)&&!(Y&&(G=="length"||F&&(G=="offset"||G=="parent")||M&&(G=="buffer"||G=="byteLength"||G=="byteOffset")||An(G,q)))&&U.push(G);return U}function Se(e,a){for(var o=e.length;o--;)if(Ir(e[o][0],a))return o;return-1}function Xe(e,a,o){var l=a(e);return Ee(e)?l:z(l,o(e))}function de(e){return e==null?e===void 0?R:_:At&&At in Object(e)?Ut(e):yr(e)}function hr(e){return Lt(e)&&de(e)==p}function mr(e,a,o,l,F){return e===a?!0:e==null||a==null||!Lt(e)&&!Lt(a)?e!==e&&a!==a:vn(e,a,o,l,mr,F)}function vn(e,a,o,l,F,M){var Y=Ee(e),U=Ee(a),q=Y?T:xt(e),G=U?T:xt(a);q=q==p?g:q,G=G==p?g:G;var ut=q==g,It=G==g,rt=q==G;if(rt&&Te(e)){if(!Te(a))return!1;Y=!0,ut=!1}if(rt&&!ut)return M||(M=new Rt),Y||vr(e)?Ke(e,a,o,l,F,M):kn(e,a,q,o,l,F,M);if(!(o&s)){var lt=ut&&wt.call(e,"__wrapped__"),st=It&&wt.call(a,"__wrapped__");if(lt||st){var qt=lt?e.value():e,Yt=st?a.value():a;return M||(M=new Rt),F(qt,Yt,o,l,M)}}return rt?(M||(M=new Rt),wn(e,a,o,l,F,M)):!1}function Sn(e){if(!br(e)||On(e))return!1;var a=gr(e)?Jr:dt;return a.test(ht(e))}function En(e){return Lt(e)&&Ve(e.length)&&!!S[de(e)]}function Tn(e){if(!Pn(e))return ue(e);var a=[];for(var o in Object(e))wt.call(e,o)&&o!="constructor"&&a.push(o);return a}function Ke(e,a,o,l,F,M){var Y=o&s,U=e.length,q=a.length;if(U!=q&&!(Y&&q>U))return!1;var G=M.get(e);if(G&&M.get(a))return G==a;var ut=-1,It=!0,rt=o&c?new be:void 0;for(M.set(e,a),M.set(a,e);++ut<U;){var lt=e[ut],st=a[ut];if(l)var qt=Y?l(st,lt,ut,a,e,M):l(lt,st,ut,e,a,M);if(qt!==void 0){if(qt)continue;It=!1;break}if(rt){if(!St(a,function(Yt,pe){if(!pt(rt,pe)&&(lt===Yt||F(lt,Yt,o,l,M)))return rt.push(pe)})){It=!1;break}}else if(!(lt===st||F(lt,st,o,l,M))){It=!1;break}}return M.delete(e),M.delete(a),It}function kn(e,a,o,l,F,M,Y){switch(o){case j:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case L:return!(e.byteLength!=a.byteLength||!M(new lr(e),new lr(a)));case D:case P:case d:return Ir(+e,+a);case y:return e.name==a.name&&e.message==a.message;case E:case m:return e==a+"";case u:var U=Jt;case I:var q=l&s;if(U||(U=V),e.size!=a.size&&!q)return!1;var G=Y.get(e);if(G)return G==a;l|=c,Y.set(e,a);var ut=Ke(U(e),U(a),l,F,M,Y);return Y.delete(e),ut;case O:if(Ge)return Ge.call(e)==Ge.call(a)}return!1}function wn(e,a,o,l,F,M){var Y=o&s,U=fe(e),q=U.length,G=fe(a),ut=G.length;if(q!=ut&&!Y)return!1;for(var It=q;It--;){var rt=U[It];if(!(Y?rt in a:wt.call(a,rt)))return!1}var lt=M.get(e);if(lt&&M.get(a))return lt==a;var st=!0;M.set(e,a),M.set(a,e);for(var qt=Y;++It<q;){rt=U[It];var Yt=e[rt],pe=a[rt];if(l)var Xi=Y?l(pe,Yt,rt,a,e,M):l(Yt,pe,rt,e,a,M);if(!(Xi===void 0?Yt===pe||F(Yt,pe,o,l,M):Xi)){st=!1;break}qt||(qt=rt=="constructor")}if(st&&!qt){var Sr=e.constructor,Er=a.constructor;Sr!=Er&&"constructor"in e&&"constructor"in a&&!(typeof Sr=="function"&&Sr instanceof Sr&&typeof Er=="function"&&Er instanceof Er)&&(st=!1)}return M.delete(e),M.delete(a),st}function fe(e){return Xe(e,Je,Mn)}function Dt(e,a){var o=e.__data__;return Dn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function $t(e,a){var o=nt(e,a);return Sn(o)?o:void 0}function Ut(e){var a=wt.call(e,At),o=e[At];try{e[At]=void 0;var l=!0}catch{}var F=ur.call(e);return l&&(a?e[At]=o:delete e[At]),F}var Mn=ge?function(e){return e==null?[]:(e=Object(e),J(ge(e),function(a){return _e.call(e,a)}))}:Rn,xt=de;(ze&&xt(new ze(new ArrayBuffer(1)))!=j||le&&xt(new le)!=u||$e&&xt($e.resolve())!=v||Ue&&xt(new Ue)!=I||Ye&&xt(new Ye)!=k)&&(xt=function(e){var a=de(e),o=a==g?e.constructor:void 0,l=o?ht(o):"";if(l)switch(l){case dr:return j;case zt:return u;case Zr:return v;case qr:return I;case Qr:return k}return a});function An(e,a){return a=a??f,!!a&&(typeof e=="number"||Nt.test(e))&&e>-1&&e%1==0&&e<a}function Dn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function On(e){return!!cr&&cr in e}function Pn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Ht;return e===o}function yr(e){return ur.call(e)}function ht(e){if(e!=null){try{return Ne.call(e)}catch{}try{return e+""}catch{}}return""}function Ir(e,a){return e===a||e!==e&&a!==a}var _r=hr(function(){return arguments}())?hr:function(e){return Lt(e)&&wt.call(e,"callee")&&!_e.call(e,"callee")},Ee=Array.isArray;function Be(e){return e!=null&&Ve(e.length)&&!gr(e)}var Te=He||xn;function Cn(e,a){return mr(e,a)}function gr(e){if(!br(e))return!1;var a=de(e);return a==w||a==x||a==N||a==h}function Ve(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=f}function br(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function Lt(e){return e!=null&&typeof e=="object"}var vr=W?ft(W):En;function Je(e){return Be(e)?bn(e):Tn(e)}function Rn(){return[]}function xn(){return!1}t.exports=Cn}(tr,tr.exports);var ia=tr.exports;const Q=Pr(ia),aa="add",Bn="track",Vn="trackItems",sa=`${Bn}:changed`,oa=`${Vn}:changed`,Jn="state",ca=`${Jn}:changed`,er="design",Zn=`${er}:load`,qn=`${er}:resize`,_t="add",Qn=`${_t}:text`,ti=`${_t}:video`,ei=`${_t}:audio`,ua=`${_t}:placeholder`,ri=`${_t}:image`,la=`${_t}:mask`,da=`${_t}:transition`,fa=`${_t}:animation`,ni=`${_t}:caption`,ii=`${_t}:template`,ai=`${_t}:items`,Wt="edit",si=`${Wt}:object`,oi=`${Wt}:replaceMedia`,pa=`${Wt}:text`,ha=`${Wt}:shape`,ma=`${Wt}:templateItem`,ya=`${Wt}:deleteTemplateItem`,Ia="enterEditMode",Qt="active",_a=`${Qt}:set`,ga=`${Qt}:delete`,ci=`${Qt}:paste`,ui=`${Qt}:clone`,li=`${Qt}:split`,it="layer",ba=`${it}:locked`,va=`${it}:hidden`,Sa=`${it}:move`,Ea=`${it}:select`,Ta=`${it}:selection`,ka=`${it}:sendTo`,wa=`${it}:rename`,Ma=`${it}:editingName`,Aa=`${it}:copy`,Da=`${it}:paste`,di=`${it}:clone`,Oa=`${it}:split`,Pa=`${it}:cut`,fi=`${it}:delete`,pi=`${it}:replace`,we="history",hi=`${we}:undo`,mi=`${we}:redo`,Ca=`${we}:reset`,Cr="scale",yi=`${Cr}:changed`;var rr={exports:{}};rr.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",f="[object Array]",p="[object Boolean]",T="[object Date]",N="[object Error]",D="[object Function]",P="[object GeneratorFunction]",y="[object Map]",w="[object Number]",x="[object Object]",u="[object Promise]",d="[object RegExp]",_="[object Set]",g="[object String]",v="[object Symbol]",h="[object WeakMap]",E="[object ArrayBuffer]",I="[object DataView]",m="[object Float32Array]",O="[object Float64Array]",R="[object Int8Array]",k="[object Int16Array]",L="[object Int32Array]",j="[object Uint8Array]",H="[object Uint8ClampedArray]",A="[object Uint16Array]",C="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,kt=/\w*$/,Ot=/^\[object .+?Constructor\]$/,Pt=/^(?:0|[1-9]\d*)$/,$={};$[c]=$[f]=$[E]=$[I]=$[p]=$[T]=$[m]=$[O]=$[R]=$[k]=$[L]=$[y]=$[w]=$[x]=$[d]=$[_]=$[g]=$[v]=$[j]=$[H]=$[A]=$[C]=!0,$[N]=$[D]=$[h]=!1;var Kt=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,vt=typeof self=="object"&&self&&self.Object===Object&&self,dt=Kt||vt||Function("return this")(),Nt=r&&!r.nodeType&&r,S=Nt&&!0&&t&&!t.nodeType&&t,Z=S&&S.exports===Nt;function ot(e,a){return e.set(a[0],a[1]),e}function et(e,a){return e.add(a),e}function jt(e,a){for(var o=-1,l=e?e.length:0;++o<l&&a(e[o],o,e)!==!1;);return e}function Mt(e,a){for(var o=-1,l=a.length,F=e.length;++o<l;)e[F+o]=a[o];return e}function Bt(e,a,o,l){for(var F=-1,M=e?e.length:0;++F<M;)o=a(o,e[F],F,e);return o}function Vt(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function se(e,a){return e==null?void 0:e[a]}function W(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function J(e){var a=-1,o=Array(e.size);return e.forEach(function(l,F){o[++a]=[F,l]}),o}function z(e,a){return function(o){return e(a(o))}}function St(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var mt=Array.prototype,ft=Function.prototype,pt=Object.prototype,nt=dt["__core-js_shared__"],Jt=function(){var e=/[^.]+$/.exec(nt&&nt.keys&&nt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ye=ft.toString,V=pt.hasOwnProperty,Et=pt.toString,oe=RegExp("^"+ye.call(V).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ht=Z?dt.Buffer:void 0,Ct=dt.Symbol,Ne=dt.Uint8Array,wt=z(Object.getPrototypeOf,Object),cr=Object.create,ur=pt.propertyIsEnumerable,Jr=mt.splice,je=Object.getOwnPropertySymbols,Ie=Ht?Ht.isBuffer:void 0,lr=z(Object.keys,Object),_e=Dt(dt,"DataView"),ce=Dt(dt,"Map"),At=Dt(dt,"Promise"),ge=Dt(dt,"Set"),He=Dt(dt,"WeakMap"),ue=Dt(Object,"create"),ze=ht(_e),le=ht(ce),$e=ht(At),Ue=ht(ge),Ye=ht(He),Zt=Ct?Ct.prototype:void 0,dr=Zt?Zt.valueOf:void 0;function zt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Zr(){this.__data__=ue?ue(null):{}}function qr(e){return this.has(e)&&delete this.__data__[e]}function Qr(e){var a=this.__data__;if(ue){var o=a[e];return o===i?void 0:o}return V.call(a,e)?a[e]:void 0}function fr(e){var a=this.__data__;return ue?a[e]!==void 0:V.call(a,e)}function Ge(e,a){var o=this.__data__;return o[e]=ue&&a===void 0?i:a,this}zt.prototype.clear=Zr,zt.prototype.delete=qr,zt.prototype.get=Qr,zt.prototype.has=fr,zt.prototype.set=Ge;function at(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function tn(){this.__data__=[]}function en(e){var a=this.__data__,o=ve(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():Jr.call(a,o,1),!0}function rn(e){var a=this.__data__,o=ve(a,e);return o<0?void 0:a[o][1]}function nn(e){return ve(this.__data__,e)>-1}function an(e,a){var o=this.__data__,l=ve(o,e);return l<0?o.push([e,a]):o[l][1]=a,this}at.prototype.clear=tn,at.prototype.delete=en,at.prototype.get=rn,at.prototype.has=nn,at.prototype.set=an;function ct(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function sn(){this.__data__={hash:new zt,map:new(ce||at),string:new zt}}function on(e){return fe(this,e).delete(e)}function cn(e){return fe(this,e).get(e)}function un(e){return fe(this,e).has(e)}function ln(e,a){return fe(this,e).set(e,a),this}ct.prototype.clear=sn,ct.prototype.delete=on,ct.prototype.get=cn,ct.prototype.has=un,ct.prototype.set=ln;function yt(e){this.__data__=new at(e)}function dn(){this.__data__=new at}function fn(e){return this.__data__.delete(e)}function pn(e){return this.__data__.get(e)}function hn(e){return this.__data__.has(e)}function mn(e,a){var o=this.__data__;if(o instanceof at){var l=o.__data__;if(!ce||l.length<n-1)return l.push([e,a]),this;o=this.__data__=new ct(l)}return o.set(e,a),this}yt.prototype.clear=dn,yt.prototype.delete=fn,yt.prototype.get=pn,yt.prototype.has=hn,yt.prototype.set=mn;function be(e,a){var o=Be(e)||Ee(e)?Vt(e.length,String):[],l=o.length,F=!!l;for(var M in e)V.call(e,M)&&!(F&&(M=="length"||Dn(M,l)))&&o.push(M);return o}function pr(e,a,o){var l=e[a];(!(V.call(e,a)&&_r(l,o))||o===void 0&&!(a in e))&&(e[a]=o)}function ve(e,a){for(var o=e.length;o--;)if(_r(e[o][0],a))return o;return-1}function Rt(e,a){return e&&Ke(a,Je(a),e)}function We(e,a,o,l,F,M,Y){var U;if(l&&(U=M?l(e,F,M,Y):l(e)),U!==void 0)return U;if(!Lt(e))return e;var q=Be(e);if(q){if(U=Mn(e),!a)return Tn(e,U)}else{var G=Ut(e),ut=G==D||G==P;if(gr(e))return Se(e,a);if(G==x||G==c||ut&&!M){if(W(e))return M?e:{};if(U=xt(ut?{}:e),!a)return kn(e,Rt(U,e))}else{if(!$[G])return M?e:{};U=An(e,G,We,a)}}Y||(Y=new yt);var It=Y.get(e);if(It)return It;if(Y.set(e,U),!q)var rt=o?wn(e):Je(e);return jt(rt||e,function(lt,st){rt&&(st=lt,lt=e[st]),pr(U,st,We(lt,a,o,l,st,e,Y))}),U}function yn(e){return Lt(e)?cr(e):{}}function In(e,a,o){var l=a(e);return Be(e)?l:Mt(l,o(e))}function _n(e){return Et.call(e)}function gn(e){if(!Lt(e)||Pn(e))return!1;var a=Ve(e)||W(e)?oe:Ot;return a.test(ht(e))}function bn(e){if(!yr(e))return lr(e);var a=[];for(var o in Object(e))V.call(e,o)&&o!="constructor"&&a.push(o);return a}function Se(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function Xe(e){var a=new e.constructor(e.byteLength);return new Ne(a).set(new Ne(e)),a}function de(e,a){var o=a?Xe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function hr(e,a,o){var l=a?o(J(e),!0):J(e);return Bt(l,ot,new e.constructor)}function mr(e){var a=new e.constructor(e.source,kt.exec(e));return a.lastIndex=e.lastIndex,a}function vn(e,a,o){var l=a?o(St(e),!0):St(e);return Bt(l,et,new e.constructor)}function Sn(e){return dr?Object(dr.call(e)):{}}function En(e,a){var o=a?Xe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Tn(e,a){var o=-1,l=e.length;for(a||(a=Array(l));++o<l;)a[o]=e[o];return a}function Ke(e,a,o,l){o||(o={});for(var F=-1,M=a.length;++F<M;){var Y=a[F],U=void 0;pr(o,Y,U===void 0?e[Y]:U)}return o}function kn(e,a){return Ke(e,$t(e),a)}function wn(e){return In(e,Je,$t)}function fe(e,a){var o=e.__data__;return On(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Dt(e,a){var o=se(e,a);return gn(o)?o:void 0}var $t=je?z(je,Object):Rn,Ut=_n;(_e&&Ut(new _e(new ArrayBuffer(1)))!=I||ce&&Ut(new ce)!=y||At&&Ut(At.resolve())!=u||ge&&Ut(new ge)!=_||He&&Ut(new He)!=h)&&(Ut=function(e){var a=Et.call(e),o=a==x?e.constructor:void 0,l=o?ht(o):void 0;if(l)switch(l){case ze:return I;case le:return y;case $e:return u;case Ue:return _;case Ye:return h}return a});function Mn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&V.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function xt(e){return typeof e.constructor=="function"&&!yr(e)?yn(wt(e)):{}}function An(e,a,o,l){var F=e.constructor;switch(a){case E:return Xe(e);case p:case T:return new F(+e);case I:return de(e,l);case m:case O:case R:case k:case L:case j:case H:case A:case C:return En(e,l);case y:return hr(e,l,o);case w:case g:return new F(e);case d:return mr(e);case _:return vn(e,l,o);case v:return Sn(e)}}function Dn(e,a){return a=a??s,!!a&&(typeof e=="number"||Pt.test(e))&&e>-1&&e%1==0&&e<a}function On(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Pn(e){return!!Jt&&Jt in e}function yr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||pt;return e===o}function ht(e){if(e!=null){try{return ye.call(e)}catch{}try{return e+""}catch{}}return""}function Ir(e){return We(e,!0,!0)}function _r(e,a){return e===a||e!==e&&a!==a}function Ee(e){return Cn(e)&&V.call(e,"callee")&&(!ur.call(e,"callee")||Et.call(e)==c)}var Be=Array.isArray;function Te(e){return e!=null&&br(e.length)&&!Ve(e)}function Cn(e){return vr(e)&&Te(e)}var gr=Ie||xn;function Ve(e){var a=Lt(e)?Et.call(e):"";return a==D||a==P}function br(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function Lt(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function vr(e){return!!e&&typeof e=="object"}function Je(e){return Te(e)?be(e):bn(e)}function Rn(){return[]}function xn(){return!1}t.exports=Ir}(rr,rr.exports);var Ra=rr.exports;const K=Pr(Ra),Rr=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Ii=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),xr=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,f=i.videoHeight;r({duration:s,width:c,height:f})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),_i=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},nr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},xa="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Me=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=xa[n[t]&63];return r};function me(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=Me(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const ir={color:"#000000",x:0,y:0,blur:0},Ae=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},gi=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function De(t,r){const n=t.scaleMode,i={x:t.size.width/2,y:t.size.height/2},s={x:r.width/2,y:r.height/2};let c;n==="fill"?c=Math.max(t.size.width/r.width,t.size.height/r.height):c=Math.min(t.size.width/r.width,t.size.height/r.height);const f=i.x-s.x;return{top:`${i.y-s.y}px`,left:`${f}px`,transform:`scale(${c})`}}const bi=async(t,r)=>{const n=t.details.src,i=await xr(n),s=De(r,{...i}),c=gi(t.trim,{duration:i.duration}),f={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||ir,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible"};return{...t,trim:c,type:"video",name:"video",details:f,playbackRate:t.playbackRate||1,display:Ae(t.display,{duration:i.duration,trim:c}),duration:i.duration}},vi=async t=>{const r=t.id,n=t.details,s=(await Ii(n.src)).duration,c=gi(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:Ae(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},La=async(t,r)=>{var P;const n=t.trackItemIds,i=t.size||{width:t.details.width,height:t.details.height},s=Math.min(r.size.width/i.width,r.size.height/i.height),c=((P=t.details)==null?void 0:P.rotate)||0,f=De(r,i),p=t.display,T=t.trim||t.display;let N=1/0,D=0;return n.forEach(y=>{const w=t.trackItemsMap[y];w.display.from<N&&(N=w.display.from),w.display.to>D&&(D=w.display.to)}),{id:t.id,details:{...i,top:t.details.top||f.top,left:t.details.left||f.left,scale:s,rotate:c},trim:T,display:p||{from:N,to:D},activeEdit:!1}},Si=async(t,r)=>{const n=t.details,i=await Rr(n.src),s=De(r,i);return{id:t.id,type:"image",name:"image",display:Ae(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||ir,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible"},metadata:t.metadata||{}}},Ei=async(t,r)=>{const n=t;n.details.fontUrl&&await nr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=ki(s),f=_i(n.details.text,c),p=De(r,{width:c.width,height:f});return{id:i,name:"caption",type:"caption",display:Ae(n.display),details:{...c,text:s.text||"",height:f,fontUrl:s.fontUrl,top:c.top||p.top,left:c.left||p.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||ir,words:s.words||[]},metadata:t.metadata||{}}},Ti=async(t,r)=>{t.details.fontUrl&&await nr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=ki(i),c=_i(t.details.text,s),f=De(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:Ae(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||f.top,left:s.left||f.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||ir},metadata:{}}},ki=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none",skewX:t.skewX||0,skewY:t.skewY||0}),Fa=async(t,r)=>{switch(t.type){case"video":return bi(t,r||{});case"audio":return vi(t);case"image":return Si(t,r||{});case"text":return Ti(t,r||{});case"caption":return Ei(t,r||{});default:throw new Error("Unsupported track item")}};function Na(t,r){return r.some(n=>t.some(i=>i.id===n.id))}const ja=(t=[],r=[])=>t.length===0?r.map(i=>({id:me(),items:[i.id],type:i.type,accepts:["text","image","video","audio","caption","template"]})):t.map(n=>({...n,items:n.items||[],accepts:["audio","video","image","text","caption","template"],type:n.type||"text",magnetic:n.magnetic||!1,static:n.static||!1,id:n.id||me()}));function Ha(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0||i.static)return i})}const te=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Lr(t,r,n){return Math.min(Math.max(t,r),n)}const za=(t,r,n,i,s)=>{if(i===void 0&&s===void 0)return{trackId:void 0,trackIndex:void 0};const c=s!==void 0?r[Lr(s,0,r.length)]:r.find(T=>T.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Lr(s,0,r.length):void 0};const f=c.items.map(T=>n[T]),p=t.map(T=>n[T]);for(const T of f){const N=T.display.from,D=T.display.to;for(const P of p){const y=P.display.from;if(!(P.display.to<=N||y>=D))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}},wi=(t,r)=>{var p,T;const n=((p=t.details.crop)==null?void 0:p.width)||t.details.width||0,i=((T=t.details.crop)==null?void 0:T.height)||t.details.height||0;let s=r.width,c=r.height;const f=r.width/r.height;return n/i>f?(s=n,c=n/f):(c=i,s=i*f),{newWidth:s,newHeight:c,crop:{x:0,y:0,height:i,width:n}}},Mi=(t,r)=>{const n=K(t.trim),i=K(t.display);return r.duration<t.display.to&&(i.to=r.duration,n&&(n.to=r.duration)),{duration:r.duration,trim:n,display:i}};function $a(t,r){let i=r.reduce((s,c)=>c.display.to>s.display.to?c:s,{display:{to:0}}).display.to;t.forEach(s=>{const c=s.display.from,p=s.display.to-c;s.display.from=i,s.display.to=s.display.from+p,i=s.display.to})}function Ua(t){const r=t,n=r.tracks,i=r.trackItemsMap,s=[],c={},f=r.structure;return n.forEach(p=>{var N;const T=p.items.map(D=>i[D]).sort((D,P)=>D.display.from-P.display.from);for(let D=0;D<T.length-1;D++){const P=T[D],y=T[D+1];if(Math.abs(P.display.to-y.display.from)<=1){const w=`${P.id}-${y.id}`;if((N=r.transitionIds)==null?void 0:N.includes(w))c[w]=r.transitionsMap[w];else{const u={id:w,duration:1500,fromId:P.id,toId:y.id,kind:"none",trackId:p.id,type:"transition"};c[w]=u}s.push(w)}}}),f.forEach(p=>{p.transitions.forEach(T=>{c[T]={...r.transitionsMap[T],trackId:p.id}})}),r.transitionIds=s,r.transitionsMap=c,{transitionIds:s,transitionsMap:c}}function Ya(t){const r=X.subject.pipe(X.filter(({key:u})=>u.startsWith(er))),n=X.subject.pipe(X.filter(({key:u})=>u.startsWith(_t))),i=X.subject.pipe(X.filter(({key:u})=>u.startsWith(it))),s=X.subject.pipe(X.filter(({key:u})=>u.startsWith(we))),c=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Qt))),f=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Wt))),p=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Cr))),T=r.subscribe(async u=>{var d,_;if(u.key===Zn){const g=(d=u.value)==null?void 0:d.payload,v=g.trackItemsMap,h=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");for(const I in h)if(h[I].type==="text"||h[I].type==="caption"){const m=h[I].details;await nr([{fontFamily:m.fontFamily,url:m.fontUrl}])}const E=te(v);t.updateState({...g,duration:E},{kind:"design:load",updateHistory:!1})}if(u.key===qn){const g=(_=u.value)==null?void 0:_.payload;t.updateState({size:g},{kind:"design:resize",updateHistory:!1})}}),N=s.subscribe(u=>{if(u.key===hi)return t.undo();if(u.key===mi)return t.redo()}),D=p.subscribe(u=>{var d;if(u.key===yi){const _=(d=u.value)==null?void 0:d.payload.scale;t.updateState({scale:_},{kind:"update",updateHistory:!1})}}),P=i.subscribe(async u=>{var _,g,v,h,E;const d=[];if((_=u.value)!=null&&_.payload.trackItemIds&&(d.push((g=u.value)==null?void 0:g.payload.trackItemIds),t.updateState({activeIds:d},{kind:"update",updateHistory:!1})),u.key===fi){const I=(v=u.value)==null?void 0:v.payload.trackItemIds,m=K(t.getState()),O=I&&I.length?I:m.activeIds,R=O.map(S=>m.transitionsMap[S]).filter(S=>!!S).map(S=>S.id),k=O.map(S=>m.trackItemsMap[S]).filter(S=>!!S).map(S=>S.id),L=m.transitionIds.filter(S=>{const Z=m.transitionsMap[S];return k.includes(Z.fromId)||k.includes(Z.toId)});k.push(...L,...R);const j=m.trackItemIds,H=m.transitionIds,A=m.trackItemDetailsMap,C=K(m.tracks),B=K(m.structure);k.forEach(S=>{var ot;const Z=m.trackItemsMap[S]||m.transitionsMap[S];if(Z.type==="template"){const et=(ot=m.structure.find(Mt=>Mt.id===Z.id))==null?void 0:ot.items;k.push(...et);const jt=B.findIndex(Mt=>Mt.id===Z.id);B.splice(jt,1)}}),k.forEach(S=>{B.forEach(Z=>{Z.items.includes(S)&&(Z.items=Z.items.filter(ot=>ot!==S))})});const kt=j.filter(S=>!k.includes(S)),Ot=H.filter(S=>!k.includes(S)),Pt=Object.fromEntries(Object.entries(A).filter(([S])=>!k.includes(S))),$=Object.fromEntries(Object.entries(m.transitionsMap).filter(([S])=>!k.includes(S))),Kt=Ha(m.tracks,k),vt=Object.fromEntries(Object.entries(m.trackItemsMap).filter(([S])=>!k.includes(S)));C.filter(S=>S.magnetic).forEach(S=>{let Z=0;S==null||S.items.forEach(ot=>{if(vt[ot]){const et=vt[ot].display.to-vt[ot].display.from;vt[ot].display={from:Z,to:Z+et},Z+=et}})});const Nt=te(vt);t.updateState({trackItemIds:kt,trackItemDetailsMap:Pt,activeIds:[],trackItemsMap:vt,tracks:Kt,duration:Nt,structure:B,transitionIds:Ot,transitionsMap:$},{updateHistory:!0,kind:"remove"})}if(u.key===di){const I=K(t.getState()),m={},O=((h=u.value)==null?void 0:h.payload.trackItemIds)||I.activeIds;if(O.length===0)return;O.forEach(k=>{const L=I.trackItemsMap[k],j=I.trackItemDetailsMap[k],H=me();I.trackItemsMap[H]={...K(L),id:H},I.trackItemDetailsMap[H]={...K(j)},I.trackItemIds.push(H);const A=I.tracks.find(C=>C.items.includes(k));m[A.id]?m[A.id].items.push(H):m[A.id]={...A,id:me(),items:[H],static:!1,magnetic:!1}});const R=Object.values(m);I.tracks=[...R,...I.tracks],t.updateState({trackItemDetailsMap:I.trackItemDetailsMap,tracks:I.tracks,trackItemIds:I.trackItemIds,trackItemsMap:I.trackItemsMap},{updateHistory:!0,kind:"update"})}if(u.key===pi){const I=(E=u.value)==null?void 0:E.payload,m=Object.keys(I)[0],O=Object.values(I)[0],R=K(t.getState()),k=R.trackItemDetailsMap[m],L=K(R.trackItemsMap[m]),j=k.details;if(!O.details.src)return;if(k.type==="image"){const H=await Rr(O.details.src),{crop:A,newHeight:C,newWidth:B}=wi(k,H);O.details.crop=A,O.details.height=C,O.details.width=B}else if(k.type==="video"){const H=await xr(O.details.src),A=R.trackItemsMap[m],{display:C,duration:B,trim:kt}=Mi(A,H),{crop:Ot,newHeight:Pt,newWidth:$}=wi(k,H);O.details.crop=Ot,O.details.height=Pt,O.details.width=$,L.display=C,L.duration=B,L.trim=kt}else if(k.type==="audio"){const H=await Ii(O.details.src),A=R.trackItemsMap[m],{display:C,duration:B,trim:kt}=Mi(A,H);L.display=C,L.duration=B,L.trim=kt}k.details={...j,...O.details},R.trackItemDetailsMap[m]={...k},R.trackItemsMap[m]={...L},t.updateState({trackItemDetailsMap:R.trackItemDetailsMap,trackItemsMap:R.trackItemsMap},{updateHistory:!0,kind:"update:details"})}}),y=n.subscribe(async u=>{var R,k,L,j,H,A,C,B,kt,Ot,Pt,$,Kt,vt,dt,Nt,S,Z,ot,et,jt,Mt,Bt,Vt,se;const d=K(t.getState()),_=((k=(R=u.value)==null?void 0:R.options)==null?void 0:k.isSelected)||!1,g=(j=(L=u.value)==null?void 0:L.options)==null?void 0:j.scaleMode,v=(A=(H=u.value)==null?void 0:H.options)==null?void 0:A.isNewTrack;let h=[],E="text";const I=(B=(C=u.value)==null?void 0:C.options)==null?void 0:B.trackId;let m=(Ot=(kt=u.value)==null?void 0:kt.options)==null?void 0:Ot.trackIndex;if(u.key===ai){const W=(Pt=u.value)==null?void 0:Pt.payload,J=W.trackItems.map(V=>Fa(V,{size:d.size})),z=await Promise.all(J),St=ja(W.tracks,W.trackItems),mt=[],ft={},pt={};if(z.forEach(V=>{const{details:Et,...oe}=V;mt.push(V.id),ft[V.id]={type:V.type,details:Et},pt[V.id]=oe}),Na(d.tracks,St))d.tracks.forEach(V=>{St.forEach(Et=>{if(V.id===Et.id){if(V.magnetic){const oe=Et.items.map(Ct=>pt[Ct]),Ht=V.items.map(Ct=>d.trackItemsMap[Ct]);$a(oe,Ht)}V.items.push(...mt)}})});else{const V=((Kt=($=u.value)==null?void 0:$.options)==null?void 0:Kt.trackIndex)||0,Et=Lr(V,0,d.tracks.length);d.tracks.splice(Et,0,...St)}d.trackItemDetailsMap={...d.trackItemDetailsMap,...ft},d.trackItemsMap={...d.trackItemsMap,...pt},d.trackItemIds=[...d.trackItemIds,...mt],d.duration=te(d.trackItemsMap);const{transitionIds:Jt,transitionsMap:ye}=Ua(d);t.updateState({trackItemIds:d.trackItemIds,trackItemDetailsMap:d.trackItemDetailsMap,trackItemsMap:d.trackItemsMap,tracks:d.tracks,duration:d.duration,transitionIds:Jt,transitionsMap:ye},{updateHistory:!0,kind:"add"});return}if(u.key===ni){E="caption";const W=(vt=u.value)==null?void 0:vt.payload,J=[];for(const mt of W){const ft=Ei(mt,{size:d.size});J.push(ft)}const z=await Promise.all(J),St=[];for(const mt of z){const ft=mt.id;St.push(ft);const{details:pt,...nt}=mt;d.trackItemDetailsMap[ft]={type:E,details:pt},d.trackItemsMap[ft]=nt,d.trackItemIds.push(ft)}h=St}if(u.key===Qn){E="text";const W=await Ti((dt=u.value)==null?void 0:dt.payload,{size:d.size}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:E,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ii){E="template";const W=(Nt=u.value)==null?void 0:Nt.payload.trackItemsMap,J=(S=u.value)==null?void 0:S.payload.trackItemDetailsMap,z=(Z=u.value)==null?void 0:Z.payload.transitionsMap,St=((ot=u.value)==null?void 0:ot.payload.transitionIds)||[],mt=(et=u.value)==null?void 0:et.payload.trackItemIds,ft=((jt=u.value)==null?void 0:jt.payload.tracks)||[],{details:pt,...nt}=await La((Mt=u.value)==null?void 0:Mt.payload,{size:d.size}),Jt={id:nt.id,items:mt,transitions:St,tracks:ft};d.trackItemDetailsMap[nt.id]={type:E,details:pt},d.trackItemsMap[nt.id]=nt,d.trackItemIds.push(nt.id),h=[nt.id],d.trackItemsMap={...d.trackItemsMap,...W,[nt.id]:{type:"template",...nt}},d.trackItemDetailsMap={...d.trackItemDetailsMap,...J,[nt.id]:{type:"template",details:pt}},d.transitionsMap={...d.transitionsMap,...z},d.structure=[...d.structure,Jt]}if(u.key===ri){E="image";const W=await Si((Bt=u.value)==null?void 0:Bt.payload,{size:d.size,scaleMode:g}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:E,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ei){E="audio";const W=await vi((Vt=u.value)==null?void 0:Vt.payload),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:E,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ti){E="video";const W=await bi((se=u.value)==null?void 0:se.payload,{size:d.size,scaleMode:g}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:E,details:J,metadata:z.metadata},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}const O=za(h,d.tracks,d.trackItemsMap,I,m);if(v){const W=Me();O.trackId=W;const J={id:O.trackId,accepts:["text","audio","helper","video","image","caption","template"],type:E,items:h,magnetic:!1,static:!1};d.tracks.splice(O.trackIndex,0,J)}else if(O.trackId){const W=d.tracks.find(J=>J.id===O.trackId);W&&W.items.push(...h)}else if(O.trackIndex!==void 0){const W={id:Me(),accepts:["text","audio","helper","video","image","caption","template"],type:E,items:h,magnetic:!1,static:!1};d.tracks.splice(O.trackIndex,0,W)}else d.tracks.unshift({id:Me(),accepts:["text","audio","helper","video","image","caption","template"],type:E,items:h,magnetic:!1,static:!1});_&&(d.activeIds=h),d.duration=te(d.trackItemsMap),t.updateState({activeIds:d.activeIds,trackItemIds:d.trackItemIds,trackItemDetailsMap:d.trackItemDetailsMap,trackItemsMap:d.trackItemsMap,transitionsMap:d.transitionsMap,tracks:d.tracks,duration:d.duration,structure:d.structure},{updateHistory:!0,kind:"add"})}),w=c.subscribe(async u=>{var d;if(u.key===li){const _=K(t.getState()),g=(d=u.value)==null?void 0:d.options.time;if(_.activeIds.length===1){const v=_.activeIds[0],h=K(_.trackItemsMap[v]);if(g>=h.display.to||g<=h.display.from)return;const E=K(_.trackItemDetailsMap[v]),I=me(),m=K({...h,display:{from:h.display.from,to:g}}),O=K({...h,id:I,display:{from:g,to:h.display.to}});if(h.type==="video"||h.type==="audio"){const R=g-m.display.from;m.trim={from:h.trim.from,to:h.trim.from+R},O.trim={from:h.trim.from+R,to:h.trim.to}}_.trackItemsMap[v]=m,_.trackItemsMap[I]=O,_.trackItemIds.push(I),_.trackItemDetailsMap[I]=E,_.tracks.forEach(R=>{R.items.includes(v)&&R.items.push(I)}),t.updateState({trackItemDetailsMap:_.trackItemDetailsMap,tracks:_.tracks,trackItemIds:_.trackItemIds,trackItemsMap:_.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(u.key===ui){const _=K(t.getState());if(_.activeIds.length){const g=_.activeIds,v=[],h={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(I=>{h.trackItemDetailsMap[I]=_.trackItemDetailsMap[I],h.trackItemsMap[I]=_.trackItemsMap[I],v.push(_.tracks.find(m=>m.items.includes(I)))});const E=new Set;v.filter(I=>E.has(I.id)?!1:(E.add(I),!0)),h.tracks=Array.from(E.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(h))}}if(u.key===ci){const _=localStorage.getItem("DesignComboTemp");if(!_)return;const g=K(t.getState()),v=JSON.parse(_),h={},E=v.trackItemsMap,I=v.trackItemDetailsMap,m=v.tracks,O=[],R=v.activeIds.map(async k=>{const L=I[k];(L.type==="caption"||L.type==="text")&&L.details.fontUrl&&await nr([{fontFamily:L.details.fontFamily,url:L.details.fontUrl}]);const j=me();return h[k]=j,g.trackItemsMap[j]={...E[k],id:j},g.trackItemDetailsMap[j]=L,g.trackItemIds.push(j),!0});await Promise.all(R),m.forEach(k=>{const L=k.items.map(H=>h[H]),j={...k,items:L,id:Me()};O.push(j)}),g.tracks=[...g.tracks,...O],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),x=f.subscribe(async u=>{var d,_,g;if(u.key===si){const v=K(t.getState()),h=v.trackItemDetailsMap,E=v.trackItemsMap,I=Object.keys((d=u.value)==null?void 0:d.payload);if(!I.length)return;const m=(_=u.value)==null?void 0:_.payload;I.forEach(R=>{const k=m[R];k.details?h[R].details={...h[R].details,...k.details}:m[R].playbackRate&&(E[R].playbackRate=m[R].playbackRate),m[R].display&&(E[R].display=m[R].display)});const O=te(E);t.updateState({trackItemDetailsMap:{...h},trackItemsMap:{...E},duration:O},{updateHistory:!0,kind:"update:details"})}if(u.key===oi){const v=(g=u.value)==null?void 0:g.payload,h=Object.keys(v)[0],E=Object.values(v)[0],I=K(t.getState()),m=I.trackItemDetailsMap[h],O=m.details;if(E.details){if(E.type==="image"&&E.details.src){const k=await Rr(E.details.src),L=m.details.width||0,j=m.details.height||0;let H=k.width,A=k.height;const C=k.width/k.height;L/j>C?(H=L,A=L/C):(A=j,H=j*C),O.crop={x:0,y:0,height:O.height,width:O.width},E.details.width=H,E.details.height=A}if(E.type==="video"&&E.details.src){const k=await xr(E.details.src),L=m.details.width||0,j=m.details.height||0;let H=k.width,A=k.height;const C=k.width/k.height;L/j>C?(H=L,A=L/C):(A=j,H=j*C),O.crop={x:0,y:0,height:O.height,width:O.width},E.details.width=H,E.details.height=A}m.details={...O,...E.details},E.details=m.details}const R={...m,...E};I.trackItemDetailsMap[h]=R,I.trackItemsMap[h]={...I.trackItemsMap[h],type:E.type},t.updateState({trackItemDetailsMap:{...I.trackItemDetailsMap},trackItemsMap:{...I.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{y.unsubscribe(),w.unsubscribe(),x.unsubscribe(),N.unsubscribe(),P.unsubscribe(),T.unsubscribe(),D.unsubscribe()}}}const Ga={Date:!0,RegExp:!0,String:!0,Number:!0};function Ai(t,r,n={cyclesFix:!0},i=[]){var p,T;let s=[];const c=Array.isArray(t);for(const N in t){const D=t[N],P=c?+N:N;if(!(N in r)){s.push({type:"REMOVE",path:[P],oldValue:t[N]});continue}const y=r[N],w=typeof D=="object"&&typeof y=="object"&&Array.isArray(D)===Array.isArray(y);if(D&&y&&w&&!Ga[(T=(p=Object.getPrototypeOf(D))==null?void 0:p.constructor)==null?void 0:T.name]&&(!n.cyclesFix||!i.includes(D))){const x=Ai(D,y,n,n.cyclesFix?i.concat([D]):[]);s.push.apply(s,x.map(u=>(u.path.unshift(P),u)))}else D!==y&&!(Number.isNaN(D)&&Number.isNaN(y))&&!(w&&(isNaN(D)?D+""==y+"":+D==+y))&&s.push({path:[P],type:"CHANGE",value:y,oldValue:D})}const f=Array.isArray(r);for(const N in r)N in t||s.push({type:"CREATE",path:[f?+N:N],value:r[N]});return s}var Fr=Symbol.for("immer-nothing"),Oe=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Di=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function tt(t,...r){if(process.env.NODE_ENV!=="production"){const n=Di[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ee=Object.getPrototypeOf;function re(t){return!!t&&!!t[gt]}function Xt(t){var r;return t?Oi(t)||Array.isArray(t)||!!t[Oe]||!!((r=t.constructor)!=null&&r[Oe])||Re(t)||xe(t):!1}var Wa=Object.prototype.constructor.toString();function Oi(t){if(!t||typeof t!="object")return!1;const r=ee(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Wa}function Pe(t,r){ne(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function ne(t){const r=t[gt];return r?r.type_:Array.isArray(t)?1:Re(t)?2:xe(t)?3:0}function Ce(t,r){return ne(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function Nr(t,r){return ne(t)===2?t.get(r):t[r]}function Pi(t,r,n){const i=ne(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Xa(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Re(t){return t instanceof Map}function xe(t){return t instanceof Set}function ie(t){return t.copy_||t.base_}function jr(t,r){if(Re(t))return new Map(t);if(xe(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Oi(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[gt];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const f=s[c],p=i[f];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(i[f]={configurable:!0,writable:!0,enumerable:p.enumerable,value:t[f]})}return Object.create(ee(t),i)}else{const i=ee(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Hr(t,r=!1){return ar(t)||re(t)||!Xt(t)||(ne(t)>1&&(t.set=t.add=t.clear=t.delete=Ka),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Hr(i,!0))),t}function Ka(){tt(2)}function ar(t){return Object.isFrozen(t)}var zr={};function ae(t){const r=zr[t];return r||tt(0,t),r}function Ba(t,r){zr[t]||(zr[t]=r)}var Le;function Ci(){return Le}function Va(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ri(t,r){r&&(ae("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function $r(t){Ur(t),t.drafts_.forEach(Ja),t.drafts_=null}function Ur(t){t===Le&&(Le=t.parent_)}function xi(t){return Le=Va(Le,t)}function Ja(t){const r=t[gt];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Li(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[gt].modified_&&($r(r),tt(4)),Xt(t)&&(t=sr(r,t),r.parent_||or(r,t)),r.patches_&&ae("Patches").generateReplacementPatches_(n[gt].base_,t,r.patches_,r.inversePatches_)):t=sr(r,n,[]),$r(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Fr?t:void 0}function sr(t,r,n){if(ar(r))return r;const i=r[gt];if(!i)return Pe(r,(s,c)=>Fi(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return or(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,f=!1;i.type_===3&&(c=new Set(s),s.clear(),f=!0),Pe(c,(p,T)=>Fi(t,i,s,p,T,n,f)),or(t,s,!1),n&&t.patches_&&ae("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Fi(t,r,n,i,s,c,f){if(process.env.NODE_ENV!=="production"&&s===n&&tt(5),re(s)){const p=c&&r&&r.type_!==3&&!Ce(r.assigned_,i)?c.concat(i):void 0,T=sr(t,s,p);if(Pi(n,i,T),re(T))t.canAutoFreeze_=!1;else return}else f&&n.add(s);if(Xt(s)&&!ar(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;sr(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&or(t,s)}}function or(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Hr(r,n)}function Za(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Ci(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=Yr;n&&(s=[i],c=Fe);const{revoke:f,proxy:p}=Proxy.revocable(s,c);return i.draft_=p,i.revoke_=f,p}var Yr={get(t,r){if(r===gt)return t;const n=ie(t);if(!Ce(n,r))return qa(t,n,r);const i=n[r];return t.finalized_||!Xt(i)?i:i===Gr(t.base_,r)?(Xr(t),t.copy_[r]=Kr(i,t)):i},has(t,r){return r in ie(t)},ownKeys(t){return Reflect.ownKeys(ie(t))},set(t,r,n){const i=Ni(ie(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Gr(ie(t),r),c=s==null?void 0:s[gt];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Xa(n,s)&&(n!==void 0||Ce(t.base_,r)))return!0;Xr(t),Wr(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Gr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Xr(t),Wr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=ie(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){tt(11)},getPrototypeOf(t){return ee(t.base_)},setPrototypeOf(){tt(12)}},Fe={};Pe(Yr,(t,r)=>{Fe[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Fe.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&tt(13),Fe.set.call(this,t,r,void 0)},Fe.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&tt(14),Yr.set.call(this,t[0],r,n,t[0])};function Gr(t,r){const n=t[gt];return(n?ie(n):t)[r]}function qa(t,r,n){var s;const i=Ni(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function Ni(t,r){if(!(r in t))return;let n=ee(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=ee(n)}}function Wr(t){t.modified_||(t.modified_=!0,t.parent_&&Wr(t.parent_))}function Xr(t){t.copy_||(t.copy_=jr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Qa=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const f=this;return function(T=c,...N){return f.produce(T,D=>n.call(this,D,...N))}}typeof n!="function"&&tt(6),i!==void 0&&typeof i!="function"&&tt(7);let s;if(Xt(r)){const c=xi(this),f=Kr(r,void 0);let p=!0;try{s=n(f),p=!1}finally{p?$r(c):Ur(c)}return Ri(c,i),Li(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Fr&&(s=void 0),this.autoFreeze_&&Hr(s,!0),i){const c=[],f=[];ae("Patches").generateReplacementPatches_(r,s,c,f),i(c,f)}return s}else tt(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(f,...p)=>this.produceWithPatches(f,T=>r(T,...p));let i,s;return[this.produce(r,n,(f,p)=>{i=f,s=p}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Xt(t)||tt(8),re(t)&&(t=ts(t));const r=xi(this),n=Kr(t,void 0);return n[gt].isManual_=!0,Ur(r),n}finishDraft(t,r){const n=t&&t[gt];(!n||!n.isManual_)&&tt(9);const{scope_:i}=n;return Ri(i,r),Li(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=ae("Patches").applyPatches_;return re(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Kr(t,r){const n=Re(t)?ae("MapSet").proxyMap_(t,r):xe(t)?ae("MapSet").proxySet_(t,r):Za(t,r);return(r?r.scope_:Ci()).drafts_.push(n),n}function ts(t){return re(t)||tt(10,t),ji(t)}function ji(t){if(!Xt(t)||ar(t))return t;const r=t[gt];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=jr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=jr(t,!0);return Pe(n,(i,s)=>{Pi(n,i,ji(s))}),r&&(r.finalized_=!1),n}function Hi(){process.env.NODE_ENV!=="production"&&Di.push('Sets cannot have "replace" patches.',function(y){return"Unsupported patch operation: "+y},function(y){return"Cannot apply patch, path doesn't resolve: "+y},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(y,w,x,u){switch(y.type_){case 0:case 2:return f(y,w,x,u);case 1:return c(y,w,x,u);case 3:return p(y,w,x,u)}}function c(y,w,x,u){let{base_:d,assigned_:_}=y,g=y.copy_;g.length<d.length&&([d,g]=[g,d],[x,u]=[u,x]);for(let v=0;v<d.length;v++)if(_[v]&&g[v]!==d[v]){const h=w.concat([v]);x.push({op:r,path:h,value:P(g[v])}),u.push({op:r,path:h,value:P(d[v])})}for(let v=d.length;v<g.length;v++){const h=w.concat([v]);x.push({op:n,path:h,value:P(g[v])})}for(let v=g.length-1;d.length<=v;--v){const h=w.concat([v]);u.push({op:i,path:h})}}function f(y,w,x,u){const{base_:d,copy_:_}=y;Pe(y.assigned_,(g,v)=>{const h=Nr(d,g),E=Nr(_,g),I=v?Ce(d,g)?r:n:i;if(h===E&&I===r)return;const m=w.concat(g);x.push(I===i?{op:I,path:m}:{op:I,path:m,value:E}),u.push(I===n?{op:i,path:m}:I===i?{op:n,path:m,value:P(h)}:{op:r,path:m,value:P(h)})})}function p(y,w,x,u){let{base_:d,copy_:_}=y,g=0;d.forEach(v=>{if(!_.has(v)){const h=w.concat([g]);x.push({op:i,path:h,value:v}),u.unshift({op:n,path:h,value:v})}g++}),g=0,_.forEach(v=>{if(!d.has(v)){const h=w.concat([g]);x.push({op:n,path:h,value:v}),u.unshift({op:i,path:h,value:v})}g++})}function T(y,w,x,u){x.push({op:r,path:[],value:w===Fr?void 0:w}),u.push({op:r,path:[],value:y})}function N(y,w){return w.forEach(x=>{const{path:u,op:d}=x;let _=y;for(let E=0;E<u.length-1;E++){const I=ne(_);let m=u[E];typeof m!="string"&&typeof m!="number"&&(m=""+m),(I===0||I===1)&&(m==="__proto__"||m==="constructor")&&tt(19),typeof _=="function"&&m==="prototype"&&tt(19),_=Nr(_,m),typeof _!="object"&&tt(18,u.join("/"))}const g=ne(_),v=D(x.value),h=u[u.length-1];switch(d){case r:switch(g){case 2:return _.set(h,v);case 3:tt(16);default:return _[h]=v}case n:switch(g){case 1:return h==="-"?_.push(v):_.splice(h,0,v);case 2:return _.set(h,v);case 3:return _.add(v);default:return _[h]=v}case i:switch(g){case 1:return _.splice(h,1);case 2:return _.delete(h);case 3:return _.delete(x.value);default:return delete _[h]}default:tt(17,d)}}),y}function D(y){if(!Xt(y))return y;if(Array.isArray(y))return y.map(D);if(Re(y))return new Map(Array.from(y.entries()).map(([x,u])=>[x,D(u)]));if(xe(y))return new Set(Array.from(y).map(D));const w=Object.create(ee(y));for(const x in y)w[x]=D(y[x]);return Ce(y,Oe)&&(w[Oe]=y[Oe]),w}function P(y){return re(y)?D(y):y}Ba("Patches",{applyPatches_:N,generatePatches_:s,generateReplacementPatches_:T})}var bt=new Qa,es=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseStrictShallowCopy.bind(bt);var rs=bt.applyPatches.bind(bt);bt.createDraft.bind(bt),bt.finishDraft.bind(bt);var ns=1/0,is=9007199254740991,as="[object Arguments]",ss="[object Function]",os="[object GeneratorFunction]",cs="[object Symbol]",us=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,ls=typeof self=="object"&&self&&self.Object===Object&&self,ds=us||ls||Function("return this")();function fs(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function ps(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function hs(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Br=Object.prototype,ms=Br.hasOwnProperty,Vr=Br.toString,zi=ds.Symbol,ys=Br.propertyIsEnumerable,$i=zi?zi.isConcatSpreadable:void 0,Ui=Math.max;function Is(t,r,n,i,s){var c=-1,f=t.length;for(n||(n=vs),s||(s=[]);++c<f;){var p=t[c];n(p)?hs(s,p):s[s.length]=p}return s}function _s(t,r){return t=Object(t),gs(t,r,function(n,i){return i in t})}function gs(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var f=r[i],p=t[f];n(p,f)&&(c[f]=p)}return c}function bs(t,r){return r=Ui(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=Ui(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var f=Array(r+1);++i<r;)f[i]=n[i];return f[r]=c,fs(t,this,f)}}function vs(t){return Ts(t)||Es(t)||!!($i&&t&&t[$i])}function Ss(t){if(typeof t=="string"||Os(t))return t;var r=t+"";return r=="0"&&1/t==-ns?"-0":r}function Es(t){return ws(t)&&ms.call(t,"callee")&&(!ys.call(t,"callee")||Vr.call(t)==as)}var Ts=Array.isArray;function ks(t){return t!=null&&As(t.length)&&!Ms(t)}function ws(t){return Yi(t)&&ks(t)}function Ms(t){var r=Ds(t)?Vr.call(t):"";return r==ss||r==os}function As(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=is}function Ds(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function Yi(t){return!!t&&typeof t=="object"}function Os(t){return typeof t=="symbol"||Yi(t)&&Vr.call(t)==cs}var Ps=bs(function(t,r){return t==null?{}:_s(t,ps(Is(r),Ss))}),Cs=Ps;const Gi=Pr(Cs),Rs={size:{width:1080,height:1920},fps:30,tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{},structure:[]},Wi=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds","structure"];class xs{constructor(r){he(this,"stateSubject");he(this,"stateHistorySubject");he(this,"prevState");he(this,"undos",[]);he(this,"redos",[]);he(this,"listener");const n=Object.assign({},Rs,r);this.stateSubject=new Kn(n),this.stateHistorySubject=new Kn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Ya(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=Gi(r,Wi),s=Gi(this.getState(),Wi),c=Ai(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};Q(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{Q(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{Q(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToFps(r){return this.stateSubject.asObservable().subscribe(n=>{n.fps!==this.prevState.fps&&r({fps:n.fps})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{Q(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateTrackItemTiming(r){return this.stateSubject.asObservable().subscribe(n=>{if(!Q(n.trackItemsMap,this.prevState.trackItemsMap)){const i=Object.keys(n.trackItemsMap).filter(c=>{const f=this.prevState.trackItemsMap[c],p=n.trackItemsMap[c];return f&&p&&!Q(f.trim,p.trim)}),s=Object.keys(n.trackItemsMap).filter(c=>{const f=this.prevState.trackItemsMap[c],p=n.trackItemsMap[c];return f&&p&&!Q(f.display,p.display)});r({trackItemsMap:n.trackItemsMap,changedTrimIds:i.length>0?i:void 0,changedDisplayIds:s.length>0?s:void 0})}})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{Q(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{(!Q(n.trackItemIds,this.prevState.trackItemIds)||!Q(n.tracks,this.prevState.tracks)||!Q(n.transitionIds,this.prevState.transitionIds))&&r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{Q(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!Q(n.tracks,this.prevState.tracks)||!Q(n.trackItemIds,this.prevState.trackItemIds)||!Q(n.trackItemsMap,this.prevState.trackItemsMap)||!Q(n.transitionIds,this.prevState.transitionIds)||!Q(n.transitionsMap,this.prevState.transitionsMap)||!Q(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||!Q(n.structure,this.prevState.structure))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap,structure:n.structure})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;Hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}=this.getState(),P=K({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}),y=[],w=[],x=[],u=[],d=[],_=[],g=[];n.forEach(A=>{let C;const B=A.path.slice(1);A.type==="CREATE"?C={path:B,op:"remove",value:A.value}:A.type==="CHANGE"?C={path:B,op:"replace",value:A.oldValue}:C={path:B,op:"add",value:A.oldValue},A.path.includes("trackItemIds")?x.push(C):A.path.includes("transitionIds")?w.push(C):A.path.includes("trackItemsMap")?d.push(C):A.path.includes("transitionsMap")?u.push(C):A.path.includes("tracks")?y.push(C):A.path.includes("trackItemDetailsMap")?_.push(C):A.path.includes("structure")&&g.push(C)});const v=this.applyPatch(P.tracks,y),h=this.applyPatch(P.transitionIds,w),E=this.applyPatch(P.trackItemIds,x),I=this.applyPatch(P.transitionsMap,u),m=this.applyPatch(P.trackItemsMap,d),O=this.applyPatch(P.trackItemDetailsMap,_),R=this.applyPatch(P.structure,g),k=K({tracks:v,transitionIds:h,trackItemIds:E,transitionsMap:I,trackItemsMap:m,trackItemDetailsMap:O,structure:R}),L=K(this.getState()),j={...L,...k};this.prevState=L,this.redos.push({redos:n,type:i});const H=te(j.trackItemsMap);this.stateSubject.next({...j,duration:H}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>es(i,c=>{rs(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;Hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}=this.getState(),P=K({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}),y=[],w=[],x=[],u=[],d=[],_=[],g=[];n.forEach(A=>{let C;const B=A.path.slice(1);A.type==="CREATE"?C={path:B,op:"add",value:A.value}:A.type==="CHANGE"?C={path:B,op:"replace",value:A.value}:C={path:B,op:"remove",value:A.oldValue},A.path.includes("trackItemIds")?x.push(C):A.path.includes("transitionIds")?w.push(C):A.path.includes("trackItemsMap")?d.push(C):A.path.includes("transitionsMap")?u.push(C):A.path.includes("trackItemDetailsMap")?_.push(C):A.path.includes("structure")?g.push(C):y.push(C)});const v=this.applyPatch(P.tracks,y),h=this.applyPatch(P.transitionIds,w),E=this.applyPatch(P.trackItemIds,x),I=this.applyPatch(P.transitionsMap,u),m=this.applyPatch(P.trackItemsMap,d),O=this.applyPatch(P.trackItemDetailsMap,_),R=this.applyPatch(P.structure,g),k=K({tracks:v,transitionIds:h,trackItemIds:E,transitionsMap:I,trackItemsMap:m,trackItemDetailsMap:O,structure:R}),L=K(this.getState()),j={...L,...k};this.prevState=L,this.undos.push({undos:n,type:i});const H=te(j.trackItemsMap);this.stateSubject.next({...j,duration:H}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}toJSON(){const{fps:r,tracks:n,size:i,trackItemDetailsMap:s,trackItemIds:c,transitionsMap:f,trackItemsMap:p,transitionIds:T}=this.getState();return{fps:r,tracks:n,size:i,trackItemDetailsMap:s,trackItemIds:c,transitionsMap:f,trackItemsMap:p,transitionIds:T}}}b.ACTIVE_CLONE=ui,b.ACTIVE_DELETE=ga,b.ACTIVE_PASTE=ci,b.ACTIVE_PREFIX=Qt,b.ACTIVE_SET=_a,b.ACTIVE_SPLIT=li,b.ADD_ANIMATION=fa,b.ADD_AUDIO=ei,b.ADD_CAPTION=ni,b.ADD_IMAGE=ri,b.ADD_ITEMS=ai,b.ADD_MASK=la,b.ADD_PLACEHOLDER=ua,b.ADD_PREFIX=_t,b.ADD_SUFFIX=aa,b.ADD_TEMPLATE=ii,b.ADD_TEXT=Qn,b.ADD_TRANSITION=da,b.ADD_VIDEO=ti,b.DELETE_TEMPLATE_ITEM=ya,b.DESIGN_LOAD=Zn,b.DESIGN_PREFIX=er,b.DESIGN_RESIZE=qn,b.EDIT_OBJECT=si,b.EDIT_PREFIX=Wt,b.EDIT_SHAPE=ha,b.EDIT_TEMPLATE_ITEM=ma,b.EDIT_TEXT=pa,b.ENTER_EDIT_MODE=Ia,b.HISTORY_PREFIX=we,b.HISTORY_REDO=mi,b.HISTORY_RESET=Ca,b.HISTORY_UNDO=hi,b.LAYER_CLONE=di,b.LAYER_COPY=Aa,b.LAYER_CUT=Pa,b.LAYER_DELETE=fi,b.LAYER_EDITING_NAME=Ma,b.LAYER_HIDDEN=va,b.LAYER_LOCKED=ba,b.LAYER_MOVE=Sa,b.LAYER_PASTE=Da,b.LAYER_PREFIX=it,b.LAYER_RENAME=wa,b.LAYER_REPLACE=pi,b.LAYER_SELECT=Ea,b.LAYER_SELECTION=Ta,b.LAYER_SEND_TO=ka,b.LAYER_SPLIT=Oa,b.REPLACE_MEDIA=oi,b.STATE_CHANGED=ca,b.STATE_PREFIX=Jn,b.TIMELINE_SCALE_CHANGED=yi,b.TIMELINE_SCALE_PREFIX=Cr,b.TRACKS_CHANGED=sa,b.TRACK_ITEMS_CHANGED=oa,b.TRACK_ITEMS_PREFIX=Vn,b.TRACK_PREFIX=Bn,b.default=xs,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
3
|
+
`):"",this.name="UnsubscriptionError",this.errors=n}});function Ar(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Ze=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var f=this._parentage;if(f)if(this._parentage=null,Array.isArray(f))try{for(var p=Tr(f),T=p.next();!T.done;T=p.next()){var N=T.value;N.remove(this)}}catch(u){r={error:u}}finally{try{T&&!T.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}else f.remove(this);var D=this.initialTeardown;if(Ft(D))try{D()}catch(u){c=u instanceof Mr?u.errors:[u]}var P=this._finalizers;if(P){this._finalizers=null;try{for(var y=Tr(P),w=y.next();!w.done;w=y.next()){var x=w.value;try{jn(x)}catch(u){c=c??[],u instanceof Mr?c=wr(wr([],kr(c)),kr(u.errors)):c.push(u)}}}catch(u){i={error:u}}finally{try{w&&!w.done&&(s=y.return)&&s.call(y)}finally{if(i)throw i.error}}}if(c)throw new Mr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)jn(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(r)}},t.prototype._hasParent=function(r){var n=this._parentage;return n===r||Array.isArray(n)&&n.includes(r)},t.prototype._addParent=function(r){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(r),n):n?[n,r]:r},t.prototype._removeParent=function(r){var n=this._parentage;n===r?this._parentage=null:Array.isArray(n)&&Ar(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&Ar(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),Fn=Ze.EMPTY;function Nn(t){return t instanceof Ze||t&&"closed"in t&&Ft(t.remove)&&Ft(t.add)&&Ft(t.unsubscribe)}function jn(t){Ft(t)?t():t.unsubscribe()}var Hn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},zn={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,wr([t,r],kr(n)))},clearTimeout:function(t){var r=zn.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Ki(t){zn.setTimeout(function(){throw t})}function $n(){}function qe(t){t()}var Un=function(t){ke(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Nn(n)&&n.add(i)):i.destination=Zi,i}return r.create=function(n,i,s){return new Or(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Ze),Bi=Function.prototype.bind;function Dr(t,r){return Bi.call(t,r)}var Vi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Qe(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Qe(i)}else Qe(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Qe(n)}},t}(),Or=function(t){ke(r,t);function r(n,i,s){var c=t.call(this)||this,f;if(Ft(n)||!n)f={next:n??void 0,error:i??void 0,complete:s??void 0};else{var p;c&&Hn.useDeprecatedNextContext?(p=Object.create(n),p.unsubscribe=function(){return c.unsubscribe()},f={next:n.next&&Dr(n.next,p),error:n.error&&Dr(n.error,p),complete:n.complete&&Dr(n.complete,p)}):f=n}return c.destination=new Vi(f),c}return r}(Un);function Qe(t){Ki(t)}function Ji(t){throw t}var Zi={closed:!0,next:$n,error:Ji,complete:$n},qi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Qi(t){return t}function ta(t){return t.length===0?Qi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var Yn=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=ra(r)?r:new Or(r,n,i);return qe(function(){var f=s,p=f.operator,T=f.source;c.add(p?p.call(c,T):T?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Gn(n),new n(function(s,c){var f=new Or({next:function(p){try{r(p)}catch(T){c(T),f.unsubscribe()}},error:c,complete:s});i.subscribe(f)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[qi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return ta(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Gn(r),new r(function(i,s){var c;n.subscribe(function(f){return c=f},function(f){return s(f)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Gn(t){var r;return(r=t??Hn.Promise)!==null&&r!==void 0?r:Promise}function ea(t){return t&&Ft(t.next)&&Ft(t.error)&&Ft(t.complete)}function ra(t){return t&&t instanceof Un||ea(t)&&Nn(t)}var na=Ln(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Wn=function(t){ke(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Xn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new na},r.prototype.next=function(n){var i=this;qe(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var f=Tr(i.currentObservers),p=f.next();!p.done;p=f.next()){var T=p.value;T.next(n)}}catch(N){s={error:N}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;qe(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;qe(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,f=s.isStopped,p=s.observers;return c||f?Fn:(this.currentObservers=null,p.push(n),new Ze(function(){i.currentObservers=null,Ar(p,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,f=i.isStopped;s?n.error(c):f&&n.complete()},r.prototype.asObservable=function(){var n=new Yn;return n.source=this,n},r.create=function(n,i){return new Xn(n,i)},r}(Yn),Xn=function(t){ke(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:Fn},r}(Wn),Kn=function(t){ke(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Wn),Tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tr={exports:{}};tr.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,f=9007199254740991,p="[object Arguments]",T="[object Array]",N="[object AsyncFunction]",D="[object Boolean]",P="[object Date]",y="[object Error]",w="[object Function]",x="[object GeneratorFunction]",u="[object Map]",d="[object Number]",_="[object Null]",g="[object Object]",v="[object Promise]",h="[object Proxy]",S="[object RegExp]",I="[object Set]",m="[object String]",O="[object Symbol]",R="[object Undefined]",k="[object WeakMap]",L="[object ArrayBuffer]",j="[object DataView]",H="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",B="[object Int16Array]",kt="[object Int32Array]",Ot="[object Uint8Array]",Pt="[object Uint8ClampedArray]",$="[object Uint16Array]",Kt="[object Uint32Array]",vt=/[\\^$.*+?()[\]{}|]/g,dt=/^\[object .+?Constructor\]$/,Nt=/^(?:0|[1-9]\d*)$/,E={};E[H]=E[A]=E[C]=E[B]=E[kt]=E[Ot]=E[Pt]=E[$]=E[Kt]=!0,E[p]=E[T]=E[L]=E[D]=E[j]=E[P]=E[y]=E[w]=E[u]=E[d]=E[g]=E[S]=E[I]=E[m]=E[k]=!1;var Z=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,ot=typeof self=="object"&&self&&self.Object===Object&&self,tt=Z||ot||Function("return this")(),jt=r&&!r.nodeType&&r,Mt=jt&&!0&&t&&!t.nodeType&&t,Bt=Mt&&Mt.exports===jt,Vt=Bt&&Z.process,se=function(){try{return Vt&&Vt.binding&&Vt.binding("util")}catch{}}(),W=se&&se.isTypedArray;function J(e,a){for(var o=-1,l=e==null?0:e.length,F=0,M=[];++o<l;){var Y=e[o];a(Y,o,e)&&(M[F++]=Y)}return M}function z(e,a){for(var o=-1,l=a.length,F=e.length;++o<l;)e[F+o]=a[o];return e}function Et(e,a){for(var o=-1,l=e==null?0:e.length;++o<l;)if(a(e[o],o,e))return!0;return!1}function mt(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function ft(e){return function(a){return e(a)}}function pt(e,a){return e.has(a)}function rt(e,a){return e==null?void 0:e[a]}function Jt(e){var a=-1,o=Array(e.size);return e.forEach(function(l,F){o[++a]=[F,l]}),o}function ye(e,a){return function(o){return e(a(o))}}function V(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var St=Array.prototype,oe=Function.prototype,Ht=Object.prototype,Ct=tt["__core-js_shared__"],Ne=oe.toString,wt=Ht.hasOwnProperty,cr=function(){var e=/[^.]+$/.exec(Ct&&Ct.keys&&Ct.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ur=Ht.toString,Jr=RegExp("^"+Ne.call(wt).replace(vt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),je=Bt?tt.Buffer:void 0,Ie=tt.Symbol,lr=tt.Uint8Array,_e=Ht.propertyIsEnumerable,ce=St.splice,At=Ie?Ie.toStringTag:void 0,ge=Object.getOwnPropertySymbols,He=je?je.isBuffer:void 0,ue=ye(Object.keys,Object),ze=$t(tt,"DataView"),le=$t(tt,"Map"),$e=$t(tt,"Promise"),Ue=$t(tt,"Set"),Ye=$t(tt,"WeakMap"),Zt=$t(Object,"create"),dr=ht(ze),zt=ht(le),Zr=ht($e),qr=ht(Ue),Qr=ht(Ye),fr=Ie?Ie.prototype:void 0,Ge=fr?fr.valueOf:void 0;function at(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function tn(){this.__data__=Zt?Zt(null):{},this.size=0}function en(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function rn(e){var a=this.__data__;if(Zt){var o=a[e];return o===i?void 0:o}return wt.call(a,e)?a[e]:void 0}function nn(e){var a=this.__data__;return Zt?a[e]!==void 0:wt.call(a,e)}function an(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Zt&&a===void 0?i:a,this}at.prototype.clear=tn,at.prototype.delete=en,at.prototype.get=rn,at.prototype.has=nn,at.prototype.set=an;function ct(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function sn(){this.__data__=[],this.size=0}function on(e){var a=this.__data__,o=Ee(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():ce.call(a,o,1),--this.size,!0}function cn(e){var a=this.__data__,o=Ee(a,e);return o<0?void 0:a[o][1]}function un(e){return Ee(this.__data__,e)>-1}function ln(e,a){var o=this.__data__,l=Ee(o,e);return l<0?(++this.size,o.push([e,a])):o[l][1]=a,this}ct.prototype.clear=sn,ct.prototype.delete=on,ct.prototype.get=cn,ct.prototype.has=un,ct.prototype.set=ln;function yt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function dn(){this.size=0,this.__data__={hash:new at,map:new(le||ct),string:new at}}function fn(e){var a=Dt(this,e).delete(e);return this.size-=a?1:0,a}function pn(e){return Dt(this,e).get(e)}function hn(e){return Dt(this,e).has(e)}function mn(e,a){var o=Dt(this,e),l=o.size;return o.set(e,a),this.size+=o.size==l?0:1,this}yt.prototype.clear=dn,yt.prototype.delete=fn,yt.prototype.get=pn,yt.prototype.has=hn,yt.prototype.set=mn;function be(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new yt;++a<o;)this.add(e[a])}function pr(e){return this.__data__.set(e,i),this}function ve(e){return this.__data__.has(e)}be.prototype.add=be.prototype.push=pr,be.prototype.has=ve;function Rt(e){var a=this.__data__=new ct(e);this.size=a.size}function We(){this.__data__=new ct,this.size=0}function yn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function In(e){return this.__data__.get(e)}function _n(e){return this.__data__.has(e)}function gn(e,a){var o=this.__data__;if(o instanceof ct){var l=o.__data__;if(!le||l.length<n-1)return l.push([e,a]),this.size=++o.size,this;o=this.__data__=new yt(l)}return o.set(e,a),this.size=o.size,this}Rt.prototype.clear=We,Rt.prototype.delete=yn,Rt.prototype.get=In,Rt.prototype.has=_n,Rt.prototype.set=gn;function bn(e,a){var o=Se(e),l=!o&&_r(e),F=!o&&!l&&Te(e),M=!o&&!l&&!F&&vr(e),Y=o||l||F||M,U=Y?mt(e.length,String):[],q=U.length;for(var G in e)wt.call(e,G)&&!(Y&&(G=="length"||F&&(G=="offset"||G=="parent")||M&&(G=="buffer"||G=="byteLength"||G=="byteOffset")||An(G,q)))&&U.push(G);return U}function Ee(e,a){for(var o=e.length;o--;)if(Ir(e[o][0],a))return o;return-1}function Xe(e,a,o){var l=a(e);return Se(e)?l:z(l,o(e))}function de(e){return e==null?e===void 0?R:_:At&&At in Object(e)?Ut(e):yr(e)}function hr(e){return Lt(e)&&de(e)==p}function mr(e,a,o,l,F){return e===a?!0:e==null||a==null||!Lt(e)&&!Lt(a)?e!==e&&a!==a:vn(e,a,o,l,mr,F)}function vn(e,a,o,l,F,M){var Y=Se(e),U=Se(a),q=Y?T:xt(e),G=U?T:xt(a);q=q==p?g:q,G=G==p?g:G;var ut=q==g,It=G==g,et=q==G;if(et&&Te(e)){if(!Te(a))return!1;Y=!0,ut=!1}if(et&&!ut)return M||(M=new Rt),Y||vr(e)?Ke(e,a,o,l,F,M):kn(e,a,q,o,l,F,M);if(!(o&s)){var lt=ut&&wt.call(e,"__wrapped__"),st=It&&wt.call(a,"__wrapped__");if(lt||st){var qt=lt?e.value():e,Yt=st?a.value():a;return M||(M=new Rt),F(qt,Yt,o,l,M)}}return et?(M||(M=new Rt),wn(e,a,o,l,F,M)):!1}function En(e){if(!br(e)||On(e))return!1;var a=gr(e)?Jr:dt;return a.test(ht(e))}function Sn(e){return Lt(e)&&Ve(e.length)&&!!E[de(e)]}function Tn(e){if(!Pn(e))return ue(e);var a=[];for(var o in Object(e))wt.call(e,o)&&o!="constructor"&&a.push(o);return a}function Ke(e,a,o,l,F,M){var Y=o&s,U=e.length,q=a.length;if(U!=q&&!(Y&&q>U))return!1;var G=M.get(e);if(G&&M.get(a))return G==a;var ut=-1,It=!0,et=o&c?new be:void 0;for(M.set(e,a),M.set(a,e);++ut<U;){var lt=e[ut],st=a[ut];if(l)var qt=Y?l(st,lt,ut,a,e,M):l(lt,st,ut,e,a,M);if(qt!==void 0){if(qt)continue;It=!1;break}if(et){if(!Et(a,function(Yt,pe){if(!pt(et,pe)&&(lt===Yt||F(lt,Yt,o,l,M)))return et.push(pe)})){It=!1;break}}else if(!(lt===st||F(lt,st,o,l,M))){It=!1;break}}return M.delete(e),M.delete(a),It}function kn(e,a,o,l,F,M,Y){switch(o){case j:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case L:return!(e.byteLength!=a.byteLength||!M(new lr(e),new lr(a)));case D:case P:case d:return Ir(+e,+a);case y:return e.name==a.name&&e.message==a.message;case S:case m:return e==a+"";case u:var U=Jt;case I:var q=l&s;if(U||(U=V),e.size!=a.size&&!q)return!1;var G=Y.get(e);if(G)return G==a;l|=c,Y.set(e,a);var ut=Ke(U(e),U(a),l,F,M,Y);return Y.delete(e),ut;case O:if(Ge)return Ge.call(e)==Ge.call(a)}return!1}function wn(e,a,o,l,F,M){var Y=o&s,U=fe(e),q=U.length,G=fe(a),ut=G.length;if(q!=ut&&!Y)return!1;for(var It=q;It--;){var et=U[It];if(!(Y?et in a:wt.call(a,et)))return!1}var lt=M.get(e);if(lt&&M.get(a))return lt==a;var st=!0;M.set(e,a),M.set(a,e);for(var qt=Y;++It<q;){et=U[It];var Yt=e[et],pe=a[et];if(l)var Xi=Y?l(pe,Yt,et,a,e,M):l(Yt,pe,et,e,a,M);if(!(Xi===void 0?Yt===pe||F(Yt,pe,o,l,M):Xi)){st=!1;break}qt||(qt=et=="constructor")}if(st&&!qt){var Er=e.constructor,Sr=a.constructor;Er!=Sr&&"constructor"in e&&"constructor"in a&&!(typeof Er=="function"&&Er instanceof Er&&typeof Sr=="function"&&Sr instanceof Sr)&&(st=!1)}return M.delete(e),M.delete(a),st}function fe(e){return Xe(e,Je,Mn)}function Dt(e,a){var o=e.__data__;return Dn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function $t(e,a){var o=rt(e,a);return En(o)?o:void 0}function Ut(e){var a=wt.call(e,At),o=e[At];try{e[At]=void 0;var l=!0}catch{}var F=ur.call(e);return l&&(a?e[At]=o:delete e[At]),F}var Mn=ge?function(e){return e==null?[]:(e=Object(e),J(ge(e),function(a){return _e.call(e,a)}))}:Rn,xt=de;(ze&&xt(new ze(new ArrayBuffer(1)))!=j||le&&xt(new le)!=u||$e&&xt($e.resolve())!=v||Ue&&xt(new Ue)!=I||Ye&&xt(new Ye)!=k)&&(xt=function(e){var a=de(e),o=a==g?e.constructor:void 0,l=o?ht(o):"";if(l)switch(l){case dr:return j;case zt:return u;case Zr:return v;case qr:return I;case Qr:return k}return a});function An(e,a){return a=a??f,!!a&&(typeof e=="number"||Nt.test(e))&&e>-1&&e%1==0&&e<a}function Dn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function On(e){return!!cr&&cr in e}function Pn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Ht;return e===o}function yr(e){return ur.call(e)}function ht(e){if(e!=null){try{return Ne.call(e)}catch{}try{return e+""}catch{}}return""}function Ir(e,a){return e===a||e!==e&&a!==a}var _r=hr(function(){return arguments}())?hr:function(e){return Lt(e)&&wt.call(e,"callee")&&!_e.call(e,"callee")},Se=Array.isArray;function Be(e){return e!=null&&Ve(e.length)&&!gr(e)}var Te=He||xn;function Cn(e,a){return mr(e,a)}function gr(e){if(!br(e))return!1;var a=de(e);return a==w||a==x||a==N||a==h}function Ve(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=f}function br(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function Lt(e){return e!=null&&typeof e=="object"}var vr=W?ft(W):Sn;function Je(e){return Be(e)?bn(e):Tn(e)}function Rn(){return[]}function xn(){return!1}t.exports=Cn}(tr,tr.exports);var ia=tr.exports;const nt=Pr(ia),aa="add",Bn="track",Vn="trackItems",sa=`${Bn}:changed`,oa=`${Vn}:changed`,Jn="state",ca=`${Jn}:changed`,er="design",Zn=`${er}:load`,qn=`${er}:resize`,_t="add",Qn=`${_t}:text`,ti=`${_t}:video`,ei=`${_t}:audio`,ua=`${_t}:placeholder`,ri=`${_t}:image`,la=`${_t}:mask`,da=`${_t}:transition`,fa=`${_t}:animation`,ni=`${_t}:caption`,ii=`${_t}:template`,ai=`${_t}:items`,Wt="edit",si=`${Wt}:object`,oi=`${Wt}:replaceMedia`,pa=`${Wt}:text`,ha=`${Wt}:shape`,ma=`${Wt}:templateItem`,ya=`${Wt}:deleteTemplateItem`,Ia="enterEditMode",Qt="active",_a=`${Qt}:set`,ga=`${Qt}:delete`,ci=`${Qt}:paste`,ui=`${Qt}:clone`,li=`${Qt}:split`,it="layer",ba=`${it}:locked`,va=`${it}:hidden`,Ea=`${it}:move`,Sa=`${it}:select`,Ta=`${it}:selection`,ka=`${it}:sendTo`,wa=`${it}:rename`,Ma=`${it}:editingName`,Aa=`${it}:copy`,Da=`${it}:paste`,di=`${it}:clone`,Oa=`${it}:split`,Pa=`${it}:cut`,fi=`${it}:delete`,pi=`${it}:replace`,we="history",hi=`${we}:undo`,mi=`${we}:redo`,Ca=`${we}:reset`,Cr="scale",yi=`${Cr}:changed`;var rr={exports:{}};rr.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",f="[object Array]",p="[object Boolean]",T="[object Date]",N="[object Error]",D="[object Function]",P="[object GeneratorFunction]",y="[object Map]",w="[object Number]",x="[object Object]",u="[object Promise]",d="[object RegExp]",_="[object Set]",g="[object String]",v="[object Symbol]",h="[object WeakMap]",S="[object ArrayBuffer]",I="[object DataView]",m="[object Float32Array]",O="[object Float64Array]",R="[object Int8Array]",k="[object Int16Array]",L="[object Int32Array]",j="[object Uint8Array]",H="[object Uint8ClampedArray]",A="[object Uint16Array]",C="[object Uint32Array]",B=/[\\^$.*+?()[\]{}|]/g,kt=/\w*$/,Ot=/^\[object .+?Constructor\]$/,Pt=/^(?:0|[1-9]\d*)$/,$={};$[c]=$[f]=$[S]=$[I]=$[p]=$[T]=$[m]=$[O]=$[R]=$[k]=$[L]=$[y]=$[w]=$[x]=$[d]=$[_]=$[g]=$[v]=$[j]=$[H]=$[A]=$[C]=!0,$[N]=$[D]=$[h]=!1;var Kt=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,vt=typeof self=="object"&&self&&self.Object===Object&&self,dt=Kt||vt||Function("return this")(),Nt=r&&!r.nodeType&&r,E=Nt&&!0&&t&&!t.nodeType&&t,Z=E&&E.exports===Nt;function ot(e,a){return e.set(a[0],a[1]),e}function tt(e,a){return e.add(a),e}function jt(e,a){for(var o=-1,l=e?e.length:0;++o<l&&a(e[o],o,e)!==!1;);return e}function Mt(e,a){for(var o=-1,l=a.length,F=e.length;++o<l;)e[F+o]=a[o];return e}function Bt(e,a,o,l){for(var F=-1,M=e?e.length:0;++F<M;)o=a(o,e[F],F,e);return o}function Vt(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function se(e,a){return e==null?void 0:e[a]}function W(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function J(e){var a=-1,o=Array(e.size);return e.forEach(function(l,F){o[++a]=[F,l]}),o}function z(e,a){return function(o){return e(a(o))}}function Et(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var mt=Array.prototype,ft=Function.prototype,pt=Object.prototype,rt=dt["__core-js_shared__"],Jt=function(){var e=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ye=ft.toString,V=pt.hasOwnProperty,St=pt.toString,oe=RegExp("^"+ye.call(V).replace(B,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ht=Z?dt.Buffer:void 0,Ct=dt.Symbol,Ne=dt.Uint8Array,wt=z(Object.getPrototypeOf,Object),cr=Object.create,ur=pt.propertyIsEnumerable,Jr=mt.splice,je=Object.getOwnPropertySymbols,Ie=Ht?Ht.isBuffer:void 0,lr=z(Object.keys,Object),_e=Dt(dt,"DataView"),ce=Dt(dt,"Map"),At=Dt(dt,"Promise"),ge=Dt(dt,"Set"),He=Dt(dt,"WeakMap"),ue=Dt(Object,"create"),ze=ht(_e),le=ht(ce),$e=ht(At),Ue=ht(ge),Ye=ht(He),Zt=Ct?Ct.prototype:void 0,dr=Zt?Zt.valueOf:void 0;function zt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Zr(){this.__data__=ue?ue(null):{}}function qr(e){return this.has(e)&&delete this.__data__[e]}function Qr(e){var a=this.__data__;if(ue){var o=a[e];return o===i?void 0:o}return V.call(a,e)?a[e]:void 0}function fr(e){var a=this.__data__;return ue?a[e]!==void 0:V.call(a,e)}function Ge(e,a){var o=this.__data__;return o[e]=ue&&a===void 0?i:a,this}zt.prototype.clear=Zr,zt.prototype.delete=qr,zt.prototype.get=Qr,zt.prototype.has=fr,zt.prototype.set=Ge;function at(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function tn(){this.__data__=[]}function en(e){var a=this.__data__,o=ve(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():Jr.call(a,o,1),!0}function rn(e){var a=this.__data__,o=ve(a,e);return o<0?void 0:a[o][1]}function nn(e){return ve(this.__data__,e)>-1}function an(e,a){var o=this.__data__,l=ve(o,e);return l<0?o.push([e,a]):o[l][1]=a,this}at.prototype.clear=tn,at.prototype.delete=en,at.prototype.get=rn,at.prototype.has=nn,at.prototype.set=an;function ct(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function sn(){this.__data__={hash:new zt,map:new(ce||at),string:new zt}}function on(e){return fe(this,e).delete(e)}function cn(e){return fe(this,e).get(e)}function un(e){return fe(this,e).has(e)}function ln(e,a){return fe(this,e).set(e,a),this}ct.prototype.clear=sn,ct.prototype.delete=on,ct.prototype.get=cn,ct.prototype.has=un,ct.prototype.set=ln;function yt(e){this.__data__=new at(e)}function dn(){this.__data__=new at}function fn(e){return this.__data__.delete(e)}function pn(e){return this.__data__.get(e)}function hn(e){return this.__data__.has(e)}function mn(e,a){var o=this.__data__;if(o instanceof at){var l=o.__data__;if(!ce||l.length<n-1)return l.push([e,a]),this;o=this.__data__=new ct(l)}return o.set(e,a),this}yt.prototype.clear=dn,yt.prototype.delete=fn,yt.prototype.get=pn,yt.prototype.has=hn,yt.prototype.set=mn;function be(e,a){var o=Be(e)||Se(e)?Vt(e.length,String):[],l=o.length,F=!!l;for(var M in e)V.call(e,M)&&!(F&&(M=="length"||Dn(M,l)))&&o.push(M);return o}function pr(e,a,o){var l=e[a];(!(V.call(e,a)&&_r(l,o))||o===void 0&&!(a in e))&&(e[a]=o)}function ve(e,a){for(var o=e.length;o--;)if(_r(e[o][0],a))return o;return-1}function Rt(e,a){return e&&Ke(a,Je(a),e)}function We(e,a,o,l,F,M,Y){var U;if(l&&(U=M?l(e,F,M,Y):l(e)),U!==void 0)return U;if(!Lt(e))return e;var q=Be(e);if(q){if(U=Mn(e),!a)return Tn(e,U)}else{var G=Ut(e),ut=G==D||G==P;if(gr(e))return Ee(e,a);if(G==x||G==c||ut&&!M){if(W(e))return M?e:{};if(U=xt(ut?{}:e),!a)return kn(e,Rt(U,e))}else{if(!$[G])return M?e:{};U=An(e,G,We,a)}}Y||(Y=new yt);var It=Y.get(e);if(It)return It;if(Y.set(e,U),!q)var et=o?wn(e):Je(e);return jt(et||e,function(lt,st){et&&(st=lt,lt=e[st]),pr(U,st,We(lt,a,o,l,st,e,Y))}),U}function yn(e){return Lt(e)?cr(e):{}}function In(e,a,o){var l=a(e);return Be(e)?l:Mt(l,o(e))}function _n(e){return St.call(e)}function gn(e){if(!Lt(e)||Pn(e))return!1;var a=Ve(e)||W(e)?oe:Ot;return a.test(ht(e))}function bn(e){if(!yr(e))return lr(e);var a=[];for(var o in Object(e))V.call(e,o)&&o!="constructor"&&a.push(o);return a}function Ee(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function Xe(e){var a=new e.constructor(e.byteLength);return new Ne(a).set(new Ne(e)),a}function de(e,a){var o=a?Xe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function hr(e,a,o){var l=a?o(J(e),!0):J(e);return Bt(l,ot,new e.constructor)}function mr(e){var a=new e.constructor(e.source,kt.exec(e));return a.lastIndex=e.lastIndex,a}function vn(e,a,o){var l=a?o(Et(e),!0):Et(e);return Bt(l,tt,new e.constructor)}function En(e){return dr?Object(dr.call(e)):{}}function Sn(e,a){var o=a?Xe(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function Tn(e,a){var o=-1,l=e.length;for(a||(a=Array(l));++o<l;)a[o]=e[o];return a}function Ke(e,a,o,l){o||(o={});for(var F=-1,M=a.length;++F<M;){var Y=a[F],U=void 0;pr(o,Y,U===void 0?e[Y]:U)}return o}function kn(e,a){return Ke(e,$t(e),a)}function wn(e){return In(e,Je,$t)}function fe(e,a){var o=e.__data__;return On(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Dt(e,a){var o=se(e,a);return gn(o)?o:void 0}var $t=je?z(je,Object):Rn,Ut=_n;(_e&&Ut(new _e(new ArrayBuffer(1)))!=I||ce&&Ut(new ce)!=y||At&&Ut(At.resolve())!=u||ge&&Ut(new ge)!=_||He&&Ut(new He)!=h)&&(Ut=function(e){var a=St.call(e),o=a==x?e.constructor:void 0,l=o?ht(o):void 0;if(l)switch(l){case ze:return I;case le:return y;case $e:return u;case Ue:return _;case Ye:return h}return a});function Mn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&V.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function xt(e){return typeof e.constructor=="function"&&!yr(e)?yn(wt(e)):{}}function An(e,a,o,l){var F=e.constructor;switch(a){case S:return Xe(e);case p:case T:return new F(+e);case I:return de(e,l);case m:case O:case R:case k:case L:case j:case H:case A:case C:return Sn(e,l);case y:return hr(e,l,o);case w:case g:return new F(e);case d:return mr(e);case _:return vn(e,l,o);case v:return En(e)}}function Dn(e,a){return a=a??s,!!a&&(typeof e=="number"||Pt.test(e))&&e>-1&&e%1==0&&e<a}function On(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Pn(e){return!!Jt&&Jt in e}function yr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||pt;return e===o}function ht(e){if(e!=null){try{return ye.call(e)}catch{}try{return e+""}catch{}}return""}function Ir(e){return We(e,!0,!0)}function _r(e,a){return e===a||e!==e&&a!==a}function Se(e){return Cn(e)&&V.call(e,"callee")&&(!ur.call(e,"callee")||St.call(e)==c)}var Be=Array.isArray;function Te(e){return e!=null&&br(e.length)&&!Ve(e)}function Cn(e){return vr(e)&&Te(e)}var gr=Ie||xn;function Ve(e){var a=Lt(e)?St.call(e):"";return a==D||a==P}function br(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function Lt(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function vr(e){return!!e&&typeof e=="object"}function Je(e){return Te(e)?be(e):bn(e)}function Rn(){return[]}function xn(){return!1}t.exports=Ir}(rr,rr.exports);var Ra=rr.exports;const K=Pr(Ra),Rr=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Ii=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),xr=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,f=i.videoHeight;r({duration:s,width:c,height:f})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),_i=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},nr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},xa="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Me=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=xa[n[t]&63];return r};function me(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=Me(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const ir={color:"#000000",x:0,y:0,blur:0},Ae=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},gi=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function De(t,r){const n=t.scaleMode,i={x:t.size.width/2,y:t.size.height/2},s={x:r.width/2,y:r.height/2};let c;n==="fill"?c=Math.max(t.size.width/r.width,t.size.height/r.height):c=Math.min(t.size.width/r.width,t.size.height/r.height);const f=i.x-s.x;return{top:`${i.y-s.y}px`,left:`${f}px`,transform:`scale(${c})`}}const bi=async(t,r)=>{const n=t.details.src,i=await xr(n),s=De(r,{...i}),c=gi(t.trim,{duration:i.duration}),f={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||ir,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible"};return{...t,trim:c,type:"video",name:"video",details:f,playbackRate:t.playbackRate||1,display:Ae(t.display,{duration:i.duration,trim:c}),duration:i.duration}},vi=async t=>{const r=t.id,n=t.details,s=(await Ii(n.src)).duration,c=gi(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:Ae(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},La=async(t,r)=>{var P;const n=t.trackItemIds,i=t.size||{width:t.details.width,height:t.details.height},s=Math.min(r.size.width/i.width,r.size.height/i.height),c=((P=t.details)==null?void 0:P.rotate)||0,f=De(r,i),p=t.display,T=t.trim||t.display;let N=1/0,D=0;return n.forEach(y=>{const w=t.trackItemsMap[y];w.display.from<N&&(N=w.display.from),w.display.to>D&&(D=w.display.to)}),{id:t.id,details:{...i,top:t.details.top||f.top,left:t.details.left||f.left,scale:s,rotate:c},trim:T,display:p||{from:N,to:D},activeEdit:!1}},Ei=async(t,r)=>{const n=t.details,i=await Rr(n.src),s=De(r,i);return{id:t.id,type:"image",name:"image",display:Ae(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||ir,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible"},metadata:t.metadata||{}}},Si=async(t,r)=>{const n=t;n.details.fontUrl&&await nr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=ki(s),f=_i(n.details.text,c),p=De(r,{width:c.width,height:f});return{id:i,name:"caption",type:"caption",display:Ae(n.display),details:{...c,text:s.text||"",height:f,fontUrl:s.fontUrl,top:c.top||p.top,left:c.left||p.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||ir,words:s.words||[]},metadata:t.metadata||{}}},Ti=async(t,r)=>{t.details.fontUrl&&await nr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=ki(i),c=_i(t.details.text,s),f=De(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:Ae(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||f.top,left:s.left||f.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||ir},metadata:{}}},ki=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none",skewX:t.skewX||0,skewY:t.skewY||0}),Fa=async(t,r)=>{switch(t.type){case"video":return bi(t,r||{});case"audio":return vi(t);case"image":return Ei(t,r||{});case"text":return Ti(t,r||{});case"caption":return Si(t,r||{});default:throw new Error("Unsupported track item")}};function Na(t,r){return r.some(n=>t.some(i=>i.id===n.id))}const ja=(t=[],r=[])=>t.length===0?r.map(i=>({id:me(),items:[i.id],type:i.type,accepts:["text","image","video","audio","caption","template"]})):t.map(n=>({...n,items:n.items||[],accepts:["audio","video","image","text","caption","template"],type:n.type||"text",magnetic:n.magnetic||!1,static:n.static||!1,id:n.id||me()}));function Ha(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0||i.static)return i})}const te=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Lr(t,r,n){return Math.min(Math.max(t,r),n)}const za=(t,r,n,i,s)=>{if(i===void 0&&s===void 0)return{trackId:void 0,trackIndex:void 0};const c=s!==void 0?r[Lr(s,0,r.length)]:r.find(T=>T.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Lr(s,0,r.length):void 0};const f=c.items.map(T=>n[T]),p=t.map(T=>n[T]);for(const T of f){const N=T.display.from,D=T.display.to;for(const P of p){const y=P.display.from;if(!(P.display.to<=N||y>=D))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}},wi=(t,r)=>{var p,T;const n=((p=t.details.crop)==null?void 0:p.width)||t.details.width||0,i=((T=t.details.crop)==null?void 0:T.height)||t.details.height||0;let s=r.width,c=r.height;const f=r.width/r.height;return n/i>f?(s=n,c=n/f):(c=i,s=i*f),{newWidth:s,newHeight:c,crop:{x:0,y:0,height:i,width:n}}},Mi=(t,r)=>{const n=K(t.trim),i=K(t.display);return r.duration<t.display.to&&(i.to=r.duration,n&&(n.to=r.duration)),{duration:r.duration,trim:n,display:i}};function $a(t,r){let i=r.reduce((s,c)=>c.display.to>s.display.to?c:s,{display:{to:0}}).display.to;t.forEach(s=>{const c=s.display.from,p=s.display.to-c;s.display.from=i,s.display.to=s.display.from+p,i=s.display.to})}function Ua(t){const r=t,n=r.tracks,i=r.trackItemsMap,s=[],c={},f=r.structure;return n.forEach(p=>{var N;const T=p.items.map(D=>i[D]).sort((D,P)=>D.display.from-P.display.from);for(let D=0;D<T.length-1;D++){const P=T[D],y=T[D+1];if(Math.abs(P.display.to-y.display.from)<=1){const w=`${P.id}-${y.id}`;if((N=r.transitionIds)==null?void 0:N.includes(w))c[w]=r.transitionsMap[w];else{const u={id:w,duration:1500,fromId:P.id,toId:y.id,kind:"none",trackId:p.id,type:"transition"};c[w]=u}s.push(w)}}}),f.forEach(p=>{p.transitions.forEach(T=>{c[T]={...r.transitionsMap[T],trackId:p.id}})}),r.transitionIds=s,r.transitionsMap=c,{transitionIds:s,transitionsMap:c}}function Ya(t){const r=X.subject.pipe(X.filter(({key:u})=>u.startsWith(er))),n=X.subject.pipe(X.filter(({key:u})=>u.startsWith(_t))),i=X.subject.pipe(X.filter(({key:u})=>u.startsWith(it))),s=X.subject.pipe(X.filter(({key:u})=>u.startsWith(we))),c=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Qt))),f=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Wt))),p=X.subject.pipe(X.filter(({key:u})=>u.startsWith(Cr))),T=r.subscribe(async u=>{var d,_;if(u.key===Zn){const g=(d=u.value)==null?void 0:d.payload,v=g.trackItemsMap,h=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");for(const I in h)if(h[I].type==="text"||h[I].type==="caption"){const m=h[I].details;await nr([{fontFamily:m.fontFamily,url:m.fontUrl}])}const S=te(v);t.updateState({...g,duration:S},{kind:"design:load",updateHistory:!1})}if(u.key===qn){const g=(_=u.value)==null?void 0:_.payload;t.updateState({size:g},{kind:"design:resize",updateHistory:!1})}}),N=s.subscribe(u=>{if(u.key===hi)return t.undo();if(u.key===mi)return t.redo()}),D=p.subscribe(u=>{var d;if(u.key===yi){const _=(d=u.value)==null?void 0:d.payload.scale;t.updateState({scale:_},{kind:"update",updateHistory:!1})}}),P=i.subscribe(async u=>{var _,g,v,h,S;const d=[];if((_=u.value)!=null&&_.payload.trackItemIds&&(d.push((g=u.value)==null?void 0:g.payload.trackItemIds),t.updateState({activeIds:d},{kind:"update",updateHistory:!1})),u.key===fi){const I=(v=u.value)==null?void 0:v.payload.trackItemIds,m=K(t.getState()),O=I&&I.length?I:m.activeIds,R=O.map(E=>m.transitionsMap[E]).filter(E=>!!E).map(E=>E.id),k=O.map(E=>m.trackItemsMap[E]).filter(E=>!!E).map(E=>E.id),L=m.transitionIds.filter(E=>{const Z=m.transitionsMap[E];return k.includes(Z.fromId)||k.includes(Z.toId)});k.push(...L,...R);const j=m.trackItemIds,H=m.transitionIds,A=m.trackItemDetailsMap,C=K(m.tracks),B=K(m.structure);k.forEach(E=>{var ot;const Z=m.trackItemsMap[E]||m.transitionsMap[E];if(Z.type==="template"){const tt=(ot=m.structure.find(Mt=>Mt.id===Z.id))==null?void 0:ot.items;k.push(...tt);const jt=B.findIndex(Mt=>Mt.id===Z.id);B.splice(jt,1)}}),k.forEach(E=>{B.forEach(Z=>{Z.items.includes(E)&&(Z.items=Z.items.filter(ot=>ot!==E))})});const kt=j.filter(E=>!k.includes(E)),Ot=H.filter(E=>!k.includes(E)),Pt=Object.fromEntries(Object.entries(A).filter(([E])=>!k.includes(E))),$=Object.fromEntries(Object.entries(m.transitionsMap).filter(([E])=>!k.includes(E))),Kt=Ha(m.tracks,k),vt=Object.fromEntries(Object.entries(m.trackItemsMap).filter(([E])=>!k.includes(E)));C.filter(E=>E.magnetic).forEach(E=>{let Z=0;E==null||E.items.forEach(ot=>{if(vt[ot]){const tt=vt[ot].display.to-vt[ot].display.from;vt[ot].display={from:Z,to:Z+tt},Z+=tt}})});const Nt=te(vt);t.updateState({trackItemIds:kt,trackItemDetailsMap:Pt,activeIds:[],trackItemsMap:vt,tracks:Kt,duration:Nt,structure:B,transitionIds:Ot,transitionsMap:$},{updateHistory:!0,kind:"remove"})}if(u.key===di){const I=K(t.getState()),m={},O=((h=u.value)==null?void 0:h.payload.trackItemIds)||I.activeIds;if(O.length===0)return;O.forEach(k=>{const L=I.trackItemsMap[k],j=I.trackItemDetailsMap[k],H=me();I.trackItemsMap[H]={...K(L),id:H},I.trackItemDetailsMap[H]={...K(j)},I.trackItemIds.push(H);const A=I.tracks.find(C=>C.items.includes(k));m[A.id]?m[A.id].items.push(H):m[A.id]={...A,id:me(),items:[H],static:!1,magnetic:!1}});const R=Object.values(m);I.tracks=[...R,...I.tracks],t.updateState({trackItemDetailsMap:I.trackItemDetailsMap,tracks:I.tracks,trackItemIds:I.trackItemIds,trackItemsMap:I.trackItemsMap},{updateHistory:!0,kind:"update"})}if(u.key===pi){const I=(S=u.value)==null?void 0:S.payload,m=Object.keys(I)[0],O=Object.values(I)[0],R=K(t.getState()),k=R.trackItemDetailsMap[m],L=K(R.trackItemsMap[m]),j=k.details;if(!O.details.src)return;if(k.type==="image"){const H=await Rr(O.details.src),{crop:A,newHeight:C,newWidth:B}=wi(k,H);O.details.crop=A,O.details.height=C,O.details.width=B}else if(k.type==="video"){const H=await xr(O.details.src),A=R.trackItemsMap[m],{display:C,duration:B,trim:kt}=Mi(A,H),{crop:Ot,newHeight:Pt,newWidth:$}=wi(k,H);O.details.crop=Ot,O.details.height=Pt,O.details.width=$,L.display=C,L.duration=B,L.trim=kt}else if(k.type==="audio"){const H=await Ii(O.details.src),A=R.trackItemsMap[m],{display:C,duration:B,trim:kt}=Mi(A,H);L.display=C,L.duration=B,L.trim=kt}k.details={...j,...O.details},R.trackItemDetailsMap[m]={...k},R.trackItemsMap[m]={...L},t.updateState({trackItemDetailsMap:R.trackItemDetailsMap,trackItemsMap:R.trackItemsMap},{updateHistory:!0,kind:"update:details"})}}),y=n.subscribe(async u=>{var R,k,L,j,H,A,C,B,kt,Ot,Pt,$,Kt,vt,dt,Nt,E,Z,ot,tt,jt,Mt,Bt,Vt,se;const d=K(t.getState()),_=((k=(R=u.value)==null?void 0:R.options)==null?void 0:k.isSelected)||!1,g=(j=(L=u.value)==null?void 0:L.options)==null?void 0:j.scaleMode,v=(A=(H=u.value)==null?void 0:H.options)==null?void 0:A.isNewTrack;let h=[],S="text";const I=(B=(C=u.value)==null?void 0:C.options)==null?void 0:B.trackId;let m=(Ot=(kt=u.value)==null?void 0:kt.options)==null?void 0:Ot.trackIndex;if(u.key===ai){const W=(Pt=u.value)==null?void 0:Pt.payload,J=W.trackItems.map(V=>Fa(V,{size:d.size})),z=await Promise.all(J),Et=ja(W.tracks,W.trackItems),mt=[],ft={},pt={};if(z.forEach(V=>{const{details:St,...oe}=V;mt.push(V.id),ft[V.id]={type:V.type,details:St},pt[V.id]=oe}),Na(d.tracks,Et))d.tracks.forEach(V=>{Et.forEach(St=>{if(V.id===St.id){if(V.magnetic){const oe=St.items.map(Ct=>pt[Ct]),Ht=V.items.map(Ct=>d.trackItemsMap[Ct]);$a(oe,Ht)}V.items.push(...mt)}})});else{const V=((Kt=($=u.value)==null?void 0:$.options)==null?void 0:Kt.trackIndex)||0,St=Lr(V,0,d.tracks.length);d.tracks.splice(St,0,...Et)}d.trackItemDetailsMap={...d.trackItemDetailsMap,...ft},d.trackItemsMap={...d.trackItemsMap,...pt},d.trackItemIds=[...d.trackItemIds,...mt],d.duration=te(d.trackItemsMap);const{transitionIds:Jt,transitionsMap:ye}=Ua(d);t.updateState({trackItemIds:d.trackItemIds,trackItemDetailsMap:d.trackItemDetailsMap,trackItemsMap:d.trackItemsMap,tracks:d.tracks,duration:d.duration,transitionIds:Jt,transitionsMap:ye},{updateHistory:!0,kind:"add"});return}if(u.key===ni){S="caption";const W=(vt=u.value)==null?void 0:vt.payload,J=[];for(const mt of W){const ft=Si(mt,{size:d.size});J.push(ft)}const z=await Promise.all(J),Et=[];for(const mt of z){const ft=mt.id;Et.push(ft);const{details:pt,...rt}=mt;d.trackItemDetailsMap[ft]={type:S,details:pt},d.trackItemsMap[ft]=rt,d.trackItemIds.push(ft)}h=Et}if(u.key===Qn){S="text";const W=await Ti((dt=u.value)==null?void 0:dt.payload,{size:d.size}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:S,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ii){S="template";const W=(Nt=u.value)==null?void 0:Nt.payload.trackItemsMap,J=(E=u.value)==null?void 0:E.payload.trackItemDetailsMap,z=(Z=u.value)==null?void 0:Z.payload.transitionsMap,Et=((ot=u.value)==null?void 0:ot.payload.transitionIds)||[],mt=(tt=u.value)==null?void 0:tt.payload.trackItemIds,ft=((jt=u.value)==null?void 0:jt.payload.tracks)||[],{details:pt,...rt}=await La((Mt=u.value)==null?void 0:Mt.payload,{size:d.size}),Jt={id:rt.id,items:mt,transitions:Et,tracks:ft};d.trackItemDetailsMap[rt.id]={type:S,details:pt},d.trackItemsMap[rt.id]=rt,d.trackItemIds.push(rt.id),h=[rt.id],d.trackItemsMap={...d.trackItemsMap,...W,[rt.id]:{type:"template",...rt}},d.trackItemDetailsMap={...d.trackItemDetailsMap,...J,[rt.id]:{type:"template",details:pt}},d.transitionsMap={...d.transitionsMap,...z},d.structure=[...d.structure,Jt]}if(u.key===ri){S="image";const W=await Ei((Bt=u.value)==null?void 0:Bt.payload,{size:d.size,scaleMode:g}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:S,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ei){S="audio";const W=await vi((Vt=u.value)==null?void 0:Vt.payload),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:S,details:J},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}if(u.key===ti){S="video";const W=await bi((se=u.value)==null?void 0:se.payload,{size:d.size,scaleMode:g}),{details:J,...z}=W;d.trackItemDetailsMap[z.id]={type:S,details:J,metadata:z.metadata},d.trackItemsMap[z.id]=z,d.trackItemIds.push(z.id),h=[z.id]}const O=za(h,d.tracks,d.trackItemsMap,I,m);if(v){const W=Me();O.trackId=W;const J={id:O.trackId,accepts:["text","audio","helper","video","image","caption","template"],type:S,items:h,magnetic:!1,static:!1};d.tracks.splice(O.trackIndex,0,J)}else if(O.trackId){const W=d.tracks.find(J=>J.id===O.trackId);W&&W.items.push(...h)}else if(O.trackIndex!==void 0){const W={id:Me(),accepts:["text","audio","helper","video","image","caption","template"],type:S,items:h,magnetic:!1,static:!1};d.tracks.splice(O.trackIndex,0,W)}else d.tracks.unshift({id:Me(),accepts:["text","audio","helper","video","image","caption","template"],type:S,items:h,magnetic:!1,static:!1});_&&(d.activeIds=h),d.duration=te(d.trackItemsMap),t.updateState({activeIds:d.activeIds,trackItemIds:d.trackItemIds,trackItemDetailsMap:d.trackItemDetailsMap,trackItemsMap:d.trackItemsMap,transitionsMap:d.transitionsMap,tracks:d.tracks,duration:d.duration,structure:d.structure},{updateHistory:!0,kind:"add"})}),w=c.subscribe(async u=>{var d;if(u.key===li){const _=K(t.getState()),g=(d=u.value)==null?void 0:d.options.time;if(_.activeIds.length===1){const v=_.activeIds[0],h=K(_.trackItemsMap[v]);if(g>=h.display.to||g<=h.display.from)return;const S=K(_.trackItemDetailsMap[v]),I=me(),m=K({...h,display:{from:h.display.from,to:g}}),O=K({...h,id:I,display:{from:g,to:h.display.to}});if(h.type==="video"||h.type==="audio"){const R=g-m.display.from;m.trim={from:h.trim.from,to:h.trim.from+R},O.trim={from:h.trim.from+R,to:h.trim.to}}_.trackItemsMap[v]=m,_.trackItemsMap[I]=O,_.trackItemIds.push(I),_.trackItemDetailsMap[I]=S,_.tracks.forEach(R=>{R.items.includes(v)&&R.items.push(I)}),t.updateState({trackItemDetailsMap:_.trackItemDetailsMap,tracks:_.tracks,trackItemIds:_.trackItemIds,trackItemsMap:_.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(u.key===ui){const _=K(t.getState());if(_.activeIds.length){const g=_.activeIds,v=[],h={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(I=>{h.trackItemDetailsMap[I]=_.trackItemDetailsMap[I],h.trackItemsMap[I]=_.trackItemsMap[I],v.push(_.tracks.find(m=>m.items.includes(I)))});const S=new Set;v.filter(I=>S.has(I.id)?!1:(S.add(I),!0)),h.tracks=Array.from(S.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(h))}}if(u.key===ci){const _=localStorage.getItem("DesignComboTemp");if(!_)return;const g=K(t.getState()),v=JSON.parse(_),h={},S=v.trackItemsMap,I=v.trackItemDetailsMap,m=v.tracks,O=[],R=v.activeIds.map(async k=>{const L=I[k];(L.type==="caption"||L.type==="text")&&L.details.fontUrl&&await nr([{fontFamily:L.details.fontFamily,url:L.details.fontUrl}]);const j=me();return h[k]=j,g.trackItemsMap[j]={...S[k],id:j},g.trackItemDetailsMap[j]=L,g.trackItemIds.push(j),!0});await Promise.all(R),m.forEach(k=>{const L=k.items.map(H=>h[H]),j={...k,items:L,id:Me()};O.push(j)}),g.tracks=[...g.tracks,...O],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),x=f.subscribe(async u=>{var d,_,g;if(u.key===si){const v=K(t.getState()),h=v.trackItemDetailsMap,S=v.trackItemsMap,I=Object.keys((d=u.value)==null?void 0:d.payload);if(!I.length)return;const m=(_=u.value)==null?void 0:_.payload;I.forEach(R=>{const k=m[R];k.details?h[R].details={...h[R].details,...k.details}:m[R].playbackRate&&(S[R].playbackRate=m[R].playbackRate),m[R].display&&(S[R].display=m[R].display)});const O=te(S);t.updateState({trackItemDetailsMap:{...h},trackItemsMap:{...S},duration:O},{updateHistory:!0,kind:"update:details"})}if(u.key===oi){const v=(g=u.value)==null?void 0:g.payload,h=Object.keys(v)[0],S=Object.values(v)[0],I=K(t.getState()),m=I.trackItemDetailsMap[h],O=m.details;if(S.details){if(S.type==="image"&&S.details.src){const k=await Rr(S.details.src),L=m.details.width||0,j=m.details.height||0;let H=k.width,A=k.height;const C=k.width/k.height;L/j>C?(H=L,A=L/C):(A=j,H=j*C),O.crop={x:0,y:0,height:O.height,width:O.width},S.details.width=H,S.details.height=A}if(S.type==="video"&&S.details.src){const k=await xr(S.details.src),L=m.details.width||0,j=m.details.height||0;let H=k.width,A=k.height;const C=k.width/k.height;L/j>C?(H=L,A=L/C):(A=j,H=j*C),O.crop={x:0,y:0,height:O.height,width:O.width},S.details.width=H,S.details.height=A}m.details={...O,...S.details},S.details=m.details}const R={...m,...S};I.trackItemDetailsMap[h]=R,I.trackItemsMap[h]={...I.trackItemsMap[h],type:S.type},t.updateState({trackItemDetailsMap:{...I.trackItemDetailsMap},trackItemsMap:{...I.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{y.unsubscribe(),w.unsubscribe(),x.unsubscribe(),N.unsubscribe(),P.unsubscribe(),T.unsubscribe(),D.unsubscribe()}}}const Ga={Date:!0,RegExp:!0,String:!0,Number:!0};function Ai(t,r,n={cyclesFix:!0},i=[]){var p,T;let s=[];const c=Array.isArray(t);for(const N in t){const D=t[N],P=c?+N:N;if(!(N in r)){s.push({type:"REMOVE",path:[P],oldValue:t[N]});continue}const y=r[N],w=typeof D=="object"&&typeof y=="object"&&Array.isArray(D)===Array.isArray(y);if(D&&y&&w&&!Ga[(T=(p=Object.getPrototypeOf(D))==null?void 0:p.constructor)==null?void 0:T.name]&&(!n.cyclesFix||!i.includes(D))){const x=Ai(D,y,n,n.cyclesFix?i.concat([D]):[]);s.push.apply(s,x.map(u=>(u.path.unshift(P),u)))}else D!==y&&!(Number.isNaN(D)&&Number.isNaN(y))&&!(w&&(isNaN(D)?D+""==y+"":+D==+y))&&s.push({path:[P],type:"CHANGE",value:y,oldValue:D})}const f=Array.isArray(r);for(const N in r)N in t||s.push({type:"CREATE",path:[f?+N:N],value:r[N]});return s}var Fr=Symbol.for("immer-nothing"),Oe=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Di=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function Q(t,...r){if(process.env.NODE_ENV!=="production"){const n=Di[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var ee=Object.getPrototypeOf;function re(t){return!!t&&!!t[gt]}function Xt(t){var r;return t?Oi(t)||Array.isArray(t)||!!t[Oe]||!!((r=t.constructor)!=null&&r[Oe])||Re(t)||xe(t):!1}var Wa=Object.prototype.constructor.toString();function Oi(t){if(!t||typeof t!="object")return!1;const r=ee(t);if(r===null)return!0;const n=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Wa}function Pe(t,r){ne(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function ne(t){const r=t[gt];return r?r.type_:Array.isArray(t)?1:Re(t)?2:xe(t)?3:0}function Ce(t,r){return ne(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function Nr(t,r){return ne(t)===2?t.get(r):t[r]}function Pi(t,r,n){const i=ne(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Xa(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Re(t){return t instanceof Map}function xe(t){return t instanceof Set}function ie(t){return t.copy_||t.base_}function jr(t,r){if(Re(t))return new Map(t);if(xe(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Oi(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[gt];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const f=s[c],p=i[f];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(i[f]={configurable:!0,writable:!0,enumerable:p.enumerable,value:t[f]})}return Object.create(ee(t),i)}else{const i=ee(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Hr(t,r=!1){return ar(t)||re(t)||!Xt(t)||(ne(t)>1&&(t.set=t.add=t.clear=t.delete=Ka),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Hr(i,!0))),t}function Ka(){Q(2)}function ar(t){return Object.isFrozen(t)}var zr={};function ae(t){const r=zr[t];return r||Q(0,t),r}function Ba(t,r){zr[t]||(zr[t]=r)}var Le;function Ci(){return Le}function Va(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ri(t,r){r&&(ae("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function $r(t){Ur(t),t.drafts_.forEach(Ja),t.drafts_=null}function Ur(t){t===Le&&(Le=t.parent_)}function xi(t){return Le=Va(Le,t)}function Ja(t){const r=t[gt];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Li(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[gt].modified_&&($r(r),Q(4)),Xt(t)&&(t=sr(r,t),r.parent_||or(r,t)),r.patches_&&ae("Patches").generateReplacementPatches_(n[gt].base_,t,r.patches_,r.inversePatches_)):t=sr(r,n,[]),$r(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Fr?t:void 0}function sr(t,r,n){if(ar(r))return r;const i=r[gt];if(!i)return Pe(r,(s,c)=>Fi(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return or(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,f=!1;i.type_===3&&(c=new Set(s),s.clear(),f=!0),Pe(c,(p,T)=>Fi(t,i,s,p,T,n,f)),or(t,s,!1),n&&t.patches_&&ae("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Fi(t,r,n,i,s,c,f){if(process.env.NODE_ENV!=="production"&&s===n&&Q(5),re(s)){const p=c&&r&&r.type_!==3&&!Ce(r.assigned_,i)?c.concat(i):void 0,T=sr(t,s,p);if(Pi(n,i,T),re(T))t.canAutoFreeze_=!1;else return}else f&&n.add(s);if(Xt(s)&&!ar(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;sr(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&or(t,s)}}function or(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Hr(r,n)}function Za(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Ci(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=Yr;n&&(s=[i],c=Fe);const{revoke:f,proxy:p}=Proxy.revocable(s,c);return i.draft_=p,i.revoke_=f,p}var Yr={get(t,r){if(r===gt)return t;const n=ie(t);if(!Ce(n,r))return qa(t,n,r);const i=n[r];return t.finalized_||!Xt(i)?i:i===Gr(t.base_,r)?(Xr(t),t.copy_[r]=Kr(i,t)):i},has(t,r){return r in ie(t)},ownKeys(t){return Reflect.ownKeys(ie(t))},set(t,r,n){const i=Ni(ie(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=Gr(ie(t),r),c=s==null?void 0:s[gt];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Xa(n,s)&&(n!==void 0||Ce(t.base_,r)))return!0;Xr(t),Wr(t)}return t.copy_[r]===n&&(n!==void 0||r in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[r])||(t.copy_[r]=n,t.assigned_[r]=!0),!0},deleteProperty(t,r){return Gr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Xr(t),Wr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=ie(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){Q(11)},getPrototypeOf(t){return ee(t.base_)},setPrototypeOf(){Q(12)}},Fe={};Pe(Yr,(t,r)=>{Fe[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Fe.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&Q(13),Fe.set.call(this,t,r,void 0)},Fe.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&Q(14),Yr.set.call(this,t[0],r,n,t[0])};function Gr(t,r){const n=t[gt];return(n?ie(n):t)[r]}function qa(t,r,n){var s;const i=Ni(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function Ni(t,r){if(!(r in t))return;let n=ee(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=ee(n)}}function Wr(t){t.modified_||(t.modified_=!0,t.parent_&&Wr(t.parent_))}function Xr(t){t.copy_||(t.copy_=jr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Qa=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const f=this;return function(T=c,...N){return f.produce(T,D=>n.call(this,D,...N))}}typeof n!="function"&&Q(6),i!==void 0&&typeof i!="function"&&Q(7);let s;if(Xt(r)){const c=xi(this),f=Kr(r,void 0);let p=!0;try{s=n(f),p=!1}finally{p?$r(c):Ur(c)}return Ri(c,i),Li(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Fr&&(s=void 0),this.autoFreeze_&&Hr(s,!0),i){const c=[],f=[];ae("Patches").generateReplacementPatches_(r,s,c,f),i(c,f)}return s}else Q(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(f,...p)=>this.produceWithPatches(f,T=>r(T,...p));let i,s;return[this.produce(r,n,(f,p)=>{i=f,s=p}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Xt(t)||Q(8),re(t)&&(t=ts(t));const r=xi(this),n=Kr(t,void 0);return n[gt].isManual_=!0,Ur(r),n}finishDraft(t,r){const n=t&&t[gt];(!n||!n.isManual_)&&Q(9);const{scope_:i}=n;return Ri(i,r),Li(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=ae("Patches").applyPatches_;return re(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Kr(t,r){const n=Re(t)?ae("MapSet").proxyMap_(t,r):xe(t)?ae("MapSet").proxySet_(t,r):Za(t,r);return(r?r.scope_:Ci()).drafts_.push(n),n}function ts(t){return re(t)||Q(10,t),ji(t)}function ji(t){if(!Xt(t)||ar(t))return t;const r=t[gt];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=jr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=jr(t,!0);return Pe(n,(i,s)=>{Pi(n,i,ji(s))}),r&&(r.finalized_=!1),n}function Hi(){process.env.NODE_ENV!=="production"&&Di.push('Sets cannot have "replace" patches.',function(y){return"Unsupported patch operation: "+y},function(y){return"Cannot apply patch, path doesn't resolve: "+y},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(y,w,x,u){switch(y.type_){case 0:case 2:return f(y,w,x,u);case 1:return c(y,w,x,u);case 3:return p(y,w,x,u)}}function c(y,w,x,u){let{base_:d,assigned_:_}=y,g=y.copy_;g.length<d.length&&([d,g]=[g,d],[x,u]=[u,x]);for(let v=0;v<d.length;v++)if(_[v]&&g[v]!==d[v]){const h=w.concat([v]);x.push({op:r,path:h,value:P(g[v])}),u.push({op:r,path:h,value:P(d[v])})}for(let v=d.length;v<g.length;v++){const h=w.concat([v]);x.push({op:n,path:h,value:P(g[v])})}for(let v=g.length-1;d.length<=v;--v){const h=w.concat([v]);u.push({op:i,path:h})}}function f(y,w,x,u){const{base_:d,copy_:_}=y;Pe(y.assigned_,(g,v)=>{const h=Nr(d,g),S=Nr(_,g),I=v?Ce(d,g)?r:n:i;if(h===S&&I===r)return;const m=w.concat(g);x.push(I===i?{op:I,path:m}:{op:I,path:m,value:S}),u.push(I===n?{op:i,path:m}:I===i?{op:n,path:m,value:P(h)}:{op:r,path:m,value:P(h)})})}function p(y,w,x,u){let{base_:d,copy_:_}=y,g=0;d.forEach(v=>{if(!_.has(v)){const h=w.concat([g]);x.push({op:i,path:h,value:v}),u.unshift({op:n,path:h,value:v})}g++}),g=0,_.forEach(v=>{if(!d.has(v)){const h=w.concat([g]);x.push({op:n,path:h,value:v}),u.unshift({op:i,path:h,value:v})}g++})}function T(y,w,x,u){x.push({op:r,path:[],value:w===Fr?void 0:w}),u.push({op:r,path:[],value:y})}function N(y,w){return w.forEach(x=>{const{path:u,op:d}=x;let _=y;for(let S=0;S<u.length-1;S++){const I=ne(_);let m=u[S];typeof m!="string"&&typeof m!="number"&&(m=""+m),(I===0||I===1)&&(m==="__proto__"||m==="constructor")&&Q(19),typeof _=="function"&&m==="prototype"&&Q(19),_=Nr(_,m),typeof _!="object"&&Q(18,u.join("/"))}const g=ne(_),v=D(x.value),h=u[u.length-1];switch(d){case r:switch(g){case 2:return _.set(h,v);case 3:Q(16);default:return _[h]=v}case n:switch(g){case 1:return h==="-"?_.push(v):_.splice(h,0,v);case 2:return _.set(h,v);case 3:return _.add(v);default:return _[h]=v}case i:switch(g){case 1:return _.splice(h,1);case 2:return _.delete(h);case 3:return _.delete(x.value);default:return delete _[h]}default:Q(17,d)}}),y}function D(y){if(!Xt(y))return y;if(Array.isArray(y))return y.map(D);if(Re(y))return new Map(Array.from(y.entries()).map(([x,u])=>[x,D(u)]));if(xe(y))return new Set(Array.from(y).map(D));const w=Object.create(ee(y));for(const x in y)w[x]=D(y[x]);return Ce(y,Oe)&&(w[Oe]=y[Oe]),w}function P(y){return re(y)?D(y):y}Ba("Patches",{applyPatches_:N,generatePatches_:s,generateReplacementPatches_:T})}var bt=new Qa,es=bt.produce;bt.produceWithPatches.bind(bt),bt.setAutoFreeze.bind(bt),bt.setUseStrictShallowCopy.bind(bt);var rs=bt.applyPatches.bind(bt);bt.createDraft.bind(bt),bt.finishDraft.bind(bt);var ns=1/0,is=9007199254740991,as="[object Arguments]",ss="[object Function]",os="[object GeneratorFunction]",cs="[object Symbol]",us=typeof Tt=="object"&&Tt&&Tt.Object===Object&&Tt,ls=typeof self=="object"&&self&&self.Object===Object&&self,ds=us||ls||Function("return this")();function fs(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}function ps(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function hs(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Br=Object.prototype,ms=Br.hasOwnProperty,Vr=Br.toString,zi=ds.Symbol,ys=Br.propertyIsEnumerable,$i=zi?zi.isConcatSpreadable:void 0,Ui=Math.max;function Is(t,r,n,i,s){var c=-1,f=t.length;for(n||(n=vs),s||(s=[]);++c<f;){var p=t[c];n(p)?hs(s,p):s[s.length]=p}return s}function _s(t,r){return t=Object(t),gs(t,r,function(n,i){return i in t})}function gs(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var f=r[i],p=t[f];n(p,f)&&(c[f]=p)}return c}function bs(t,r){return r=Ui(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=Ui(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var f=Array(r+1);++i<r;)f[i]=n[i];return f[r]=c,fs(t,this,f)}}function vs(t){return Ts(t)||Ss(t)||!!($i&&t&&t[$i])}function Es(t){if(typeof t=="string"||Os(t))return t;var r=t+"";return r=="0"&&1/t==-ns?"-0":r}function Ss(t){return ws(t)&&ms.call(t,"callee")&&(!ys.call(t,"callee")||Vr.call(t)==as)}var Ts=Array.isArray;function ks(t){return t!=null&&As(t.length)&&!Ms(t)}function ws(t){return Yi(t)&&ks(t)}function Ms(t){var r=Ds(t)?Vr.call(t):"";return r==ss||r==os}function As(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=is}function Ds(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function Yi(t){return!!t&&typeof t=="object"}function Os(t){return typeof t=="symbol"||Yi(t)&&Vr.call(t)==cs}var Ps=bs(function(t,r){return t==null?{}:_s(t,ps(Is(r),Es))}),Cs=Ps;const Gi=Pr(Cs),Rs={size:{width:1080,height:1920},fps:30,tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{},structure:[]},Wi=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds","structure"];class xs{constructor(r){he(this,"stateSubject");he(this,"stateHistorySubject");he(this,"prevState");he(this,"undos",[]);he(this,"redos",[]);he(this,"listener");const n=Object.assign({},Rs,r);this.stateSubject=new Kn(n),this.stateHistorySubject=new Kn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Ya(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=Gi(r,Wi),s=Gi(this.getState(),Wi),c=Ai(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};nt(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToFps(r){return this.stateSubject.asObservable().subscribe(n=>{n.fps!==this.prevState.fps&&r({fps:n.fps})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateTrackItemTiming(r){return this.stateSubject.asObservable().subscribe(n=>{if(!nt(n.trackItemsMap,this.prevState.trackItemsMap)){const i=Object.keys(n.trackItemsMap).filter(c=>{const f=this.prevState.trackItemsMap[c],p=n.trackItemsMap[c];return f&&p&&!nt(f.trim,p.trim)}),s=Object.keys(n.trackItemsMap).filter(c=>{const f=this.prevState.trackItemsMap[c],p=n.trackItemsMap[c];return f&&p&&!nt(f.display,p.display)});r({trackItemsMap:n.trackItemsMap,changedTrimIds:i.length>0?i:void 0,changedDisplayIds:s.length>0?s:void 0})}})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{const i=[...n.trackItemIds].sort(),s=[...this.prevState.trackItemIds].sort();nt(i,s)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{nt(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!nt(n.tracks,this.prevState.tracks)||!nt(n.trackItemIds,this.prevState.trackItemIds)||!nt(n.trackItemsMap,this.prevState.trackItemsMap)||!nt(n.transitionIds,this.prevState.transitionIds)||!nt(n.transitionsMap,this.prevState.transitionsMap)||!nt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||!nt(n.structure,this.prevState.structure))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap,structure:n.structure})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;Hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}=this.getState(),P=K({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}),y=[],w=[],x=[],u=[],d=[],_=[],g=[];n.forEach(A=>{let C;const B=A.path.slice(1);A.type==="CREATE"?C={path:B,op:"remove",value:A.value}:A.type==="CHANGE"?C={path:B,op:"replace",value:A.oldValue}:C={path:B,op:"add",value:A.oldValue},A.path.includes("trackItemIds")?x.push(C):A.path.includes("transitionIds")?w.push(C):A.path.includes("trackItemsMap")?d.push(C):A.path.includes("transitionsMap")?u.push(C):A.path.includes("tracks")?y.push(C):A.path.includes("trackItemDetailsMap")?_.push(C):A.path.includes("structure")&&g.push(C)});const v=this.applyPatch(P.tracks,y),h=this.applyPatch(P.transitionIds,w),S=this.applyPatch(P.trackItemIds,x),I=this.applyPatch(P.transitionsMap,u),m=this.applyPatch(P.trackItemsMap,d),O=this.applyPatch(P.trackItemDetailsMap,_),R=this.applyPatch(P.structure,g),k=K({tracks:v,transitionIds:h,trackItemIds:S,transitionsMap:I,trackItemsMap:m,trackItemDetailsMap:O,structure:R}),L=K(this.getState()),j={...L,...k};this.prevState=L,this.redos.push({redos:n,type:i});const H=te(j.trackItemsMap);this.stateSubject.next({...j,duration:H}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>es(i,c=>{rs(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;Hi();const{trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}=this.getState(),P=K({trackItemDetailsMap:s,trackItemIds:c,tracks:f,transitionIds:p,transitionsMap:T,trackItemsMap:N,structure:D}),y=[],w=[],x=[],u=[],d=[],_=[],g=[];n.forEach(A=>{let C;const B=A.path.slice(1);A.type==="CREATE"?C={path:B,op:"add",value:A.value}:A.type==="CHANGE"?C={path:B,op:"replace",value:A.value}:C={path:B,op:"remove",value:A.oldValue},A.path.includes("trackItemIds")?x.push(C):A.path.includes("transitionIds")?w.push(C):A.path.includes("trackItemsMap")?d.push(C):A.path.includes("transitionsMap")?u.push(C):A.path.includes("trackItemDetailsMap")?_.push(C):A.path.includes("structure")?g.push(C):y.push(C)});const v=this.applyPatch(P.tracks,y),h=this.applyPatch(P.transitionIds,w),S=this.applyPatch(P.trackItemIds,x),I=this.applyPatch(P.transitionsMap,u),m=this.applyPatch(P.trackItemsMap,d),O=this.applyPatch(P.trackItemDetailsMap,_),R=this.applyPatch(P.structure,g),k=K({tracks:v,transitionIds:h,trackItemIds:S,transitionsMap:I,trackItemsMap:m,trackItemDetailsMap:O,structure:R}),L=K(this.getState()),j={...L,...k};this.prevState=L,this.undos.push({undos:n,type:i});const H=te(j.trackItemsMap);this.stateSubject.next({...j,duration:H}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}toJSON(){const{fps:r,tracks:n,size:i,trackItemDetailsMap:s,trackItemIds:c,transitionsMap:f,trackItemsMap:p,transitionIds:T}=this.getState();return{fps:r,tracks:n,size:i,trackItemDetailsMap:s,trackItemIds:c,transitionsMap:f,trackItemsMap:p,transitionIds:T}}}b.ACTIVE_CLONE=ui,b.ACTIVE_DELETE=ga,b.ACTIVE_PASTE=ci,b.ACTIVE_PREFIX=Qt,b.ACTIVE_SET=_a,b.ACTIVE_SPLIT=li,b.ADD_ANIMATION=fa,b.ADD_AUDIO=ei,b.ADD_CAPTION=ni,b.ADD_IMAGE=ri,b.ADD_ITEMS=ai,b.ADD_MASK=la,b.ADD_PLACEHOLDER=ua,b.ADD_PREFIX=_t,b.ADD_SUFFIX=aa,b.ADD_TEMPLATE=ii,b.ADD_TEXT=Qn,b.ADD_TRANSITION=da,b.ADD_VIDEO=ti,b.DELETE_TEMPLATE_ITEM=ya,b.DESIGN_LOAD=Zn,b.DESIGN_PREFIX=er,b.DESIGN_RESIZE=qn,b.EDIT_OBJECT=si,b.EDIT_PREFIX=Wt,b.EDIT_SHAPE=ha,b.EDIT_TEMPLATE_ITEM=ma,b.EDIT_TEXT=pa,b.ENTER_EDIT_MODE=Ia,b.HISTORY_PREFIX=we,b.HISTORY_REDO=mi,b.HISTORY_RESET=Ca,b.HISTORY_UNDO=hi,b.LAYER_CLONE=di,b.LAYER_COPY=Aa,b.LAYER_CUT=Pa,b.LAYER_DELETE=fi,b.LAYER_EDITING_NAME=Ma,b.LAYER_HIDDEN=va,b.LAYER_LOCKED=ba,b.LAYER_MOVE=Ea,b.LAYER_PASTE=Da,b.LAYER_PREFIX=it,b.LAYER_RENAME=wa,b.LAYER_REPLACE=pi,b.LAYER_SELECT=Sa,b.LAYER_SELECTION=Ta,b.LAYER_SEND_TO=ka,b.LAYER_SPLIT=Oa,b.REPLACE_MEDIA=oi,b.STATE_CHANGED=ca,b.STATE_PREFIX=Jn,b.TIMELINE_SCALE_CHANGED=yi,b.TIMELINE_SCALE_PREFIX=Cr,b.TRACKS_CHANGED=sa,b.TRACK_ITEMS_CHANGED=oa,b.TRACK_ITEMS_PREFIX=Vn,b.TRACK_PREFIX=Bn,b.default=xs,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
@@ -23,6 +23,11 @@ export declare const loadVideoItem: (layer: ITrackItem & IVideo, options: Partia
|
|
23
23
|
modifier?: IDisplay;
|
24
24
|
activeEdit?: boolean;
|
25
25
|
metadata: Record<string, any>;
|
26
|
+
transitionInfo?: {
|
27
|
+
isFrom: boolean;
|
28
|
+
isTo: boolean;
|
29
|
+
transition: import('@designcombo/types').ITransition;
|
30
|
+
};
|
26
31
|
}>;
|
27
32
|
export declare const loadAudioItem: (payload: ITrackItem & IAudio) => Promise<{
|
28
33
|
id: string;
|
@@ -214,6 +219,11 @@ export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | II
|
|
214
219
|
modifier?: IDisplay;
|
215
220
|
activeEdit?: boolean;
|
216
221
|
metadata: Record<string, any>;
|
222
|
+
transitionInfo?: {
|
223
|
+
isFrom: boolean;
|
224
|
+
isTo: boolean;
|
225
|
+
transition: import('@designcombo/types').ITransition;
|
226
|
+
};
|
217
227
|
} | {
|
218
228
|
id: string;
|
219
229
|
name: string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@designcombo/state",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0-beta.0",
|
4
4
|
"private": false,
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"typescript": "^5.3.3",
|
26
26
|
"vite": "^5.2.0",
|
27
27
|
"vite-plugin-dts": "^3.9.1",
|
28
|
-
"@designcombo/types": "
|
28
|
+
"@designcombo/types": "3.0.0-beta.0",
|
29
29
|
"@designcombo/typescript-config": "0.0.0"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
@@ -39,7 +39,7 @@
|
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
41
|
"@designcombo/events": "^1.0.2",
|
42
|
-
"@designcombo/types": "
|
42
|
+
"@designcombo/types": "3.0.0-beta.0"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"dev": "vite",
|