@designcombo/state 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var ai = Object.defineProperty;
2
2
  var si = (t, r, n) => r in t ? ai(t, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[r] = n;
3
3
  var Et = (t, r, n) => si(t, typeof r != "symbol" ? r + "" : r, n);
4
- import { subject as Bt, filter as Wt, DESIGN_PREFIX as oi, ADD_PREFIX as ci, LAYER_PREFIX as ui, HISTORY_PREFIX as fi, ACTIVE_PREFIX as li, EDIT_PREFIX as pi, DESIGN_LOAD as di, HISTORY_UNDO as hi, HISTORY_REDO as yi, ADD_CAPTION as mi, ADD_TEXT as bi, ADD_IMAGE as _i, ADD_AUDIO as gi, ADD_VIDEO as vi, ACTIVE_DELETE as Ii, ACTIVE_SPLIT as Si, ACTIVE_CLONE as wi, ACTIVE_PASTE as Ti, EDIT_OBJECT as Ai } from "@designcombo/events";
4
+ import { subject as Bt, filter as Wt, DESIGN_PREFIX as oi, ADD_PREFIX as ci, LAYER_PREFIX as ui, HISTORY_PREFIX as fi, ACTIVE_PREFIX as li, EDIT_PREFIX as pi, DESIGN_LOAD as di, HISTORY_UNDO as hi, HISTORY_REDO as yi, LAYER_DELETE as mi, ADD_CAPTION as bi, ADD_TEXT as _i, ADD_IMAGE as gi, ADD_AUDIO as vi, ADD_VIDEO as Ii, ACTIVE_SPLIT as Si, ACTIVE_CLONE as wi, ACTIVE_PASTE as Ti, EDIT_OBJECT as Ai } from "@designcombo/events";
5
5
  var en = function(t, r) {
6
6
  return en = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, a) {
7
7
  n.__proto__ = a;
@@ -86,15 +86,15 @@ var Ze = function() {
86
86
  if (l)
87
87
  if (this._parentage = null, Array.isArray(l))
88
88
  try {
89
- for (var d = rn(l), A = d.next(); !A.done; A = d.next()) {
90
- var D = A.value;
89
+ for (var d = rn(l), E = d.next(); !E.done; E = d.next()) {
90
+ var D = E.value;
91
91
  D.remove(this);
92
92
  }
93
93
  } catch (f) {
94
94
  r = { error: f };
95
95
  } finally {
96
96
  try {
97
- A && !A.done && (n = d.return) && n.call(d);
97
+ E && !E.done && (n = d.return) && n.call(d);
98
98
  } finally {
99
99
  if (r) throw r.error;
100
100
  }
@@ -108,11 +108,11 @@ var Ze = function() {
108
108
  } catch (f) {
109
109
  c = f instanceof Xr ? f.errors : [f];
110
110
  }
111
- var R = this._finalizers;
112
- if (R) {
111
+ var z = this._finalizers;
112
+ if (z) {
113
113
  this._finalizers = null;
114
114
  try {
115
- for (var h = rn(R), p = h.next(); !p.done; p = h.next()) {
115
+ for (var h = rn(z), p = h.next(); !p.done; p = h.next()) {
116
116
  var g = p.value;
117
117
  try {
118
118
  An(g);
@@ -321,8 +321,8 @@ var kn = function() {
321
321
  }, t.prototype.subscribe = function(r, n, a) {
322
322
  var o = this, c = Fi(r) ? r : new on(r, n, a);
323
323
  return Ve(function() {
324
- var l = o, d = l.operator, A = l.source;
325
- c.add(d ? d.call(c, A) : A ? o._subscribe(c) : o._trySubscribe(c));
324
+ var l = o, d = l.operator, E = l.source;
325
+ c.add(d ? d.call(c, E) : E ? o._subscribe(c) : o._trySubscribe(c));
326
326
  }), c;
327
327
  }, t.prototype._trySubscribe = function(r) {
328
328
  try {
@@ -337,8 +337,8 @@ var kn = function() {
337
337
  next: function(d) {
338
338
  try {
339
339
  r(d);
340
- } catch (A) {
341
- c(A), l.unsubscribe();
340
+ } catch (E) {
341
+ c(E), l.unsubscribe();
342
342
  }
343
343
  },
344
344
  error: c,
@@ -405,8 +405,8 @@ var Ri = Bn(function(t) {
405
405
  a.currentObservers || (a.currentObservers = Array.from(a.observers));
406
406
  try {
407
407
  for (var l = rn(a.currentObservers), d = l.next(); !d.done; d = l.next()) {
408
- var A = d.value;
409
- A.next(n);
408
+ var E = d.value;
409
+ E.next(n);
410
410
  }
411
411
  } catch (D) {
412
412
  o = { error: D };
@@ -513,8 +513,8 @@ function mn(t) {
513
513
  var Ye = { exports: {} };
514
514
  Ye.exports;
515
515
  (function(t, r) {
516
- var n = 200, a = "__lodash_hash_undefined__", o = 1, c = 2, l = 9007199254740991, d = "[object Arguments]", A = "[object Array]", D = "[object AsyncFunction]", w = "[object Boolean]", R = "[object Date]", h = "[object Error]", p = "[object Function]", g = "[object GeneratorFunction]", f = "[object Map]", b = "[object Number]", v = "[object Null]", _ = "[object Object]", m = "[object Promise]", y = "[object Proxy]", F = "[object RegExp]", E = "[object Set]", k = "[object String]", z = "[object Symbol]", N = "[object Undefined]", I = "[object WeakMap]", x = "[object ArrayBuffer]", V = "[object DataView]", _e = "[object Float32Array]", ge = "[object Float64Array]", ve = "[object Int8Array]", er = "[object Int16Array]", rr = "[object Int32Array]", nr = "[object Uint8Array]", ir = "[object Uint8ClampedArray]", C = "[object Uint16Array]", ar = "[object Uint32Array]", sr = /[\\^$.*+?()[\]{}|]/g, rt = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, j = {};
517
- j[_e] = j[ge] = j[ve] = j[er] = j[rr] = j[nr] = j[ir] = j[C] = j[ar] = !0, j[d] = j[A] = j[x] = j[w] = j[V] = j[R] = j[h] = j[p] = j[f] = j[b] = j[_] = j[F] = j[E] = j[k] = j[I] = !1;
516
+ var n = 200, a = "__lodash_hash_undefined__", o = 1, c = 2, l = 9007199254740991, d = "[object Arguments]", E = "[object Array]", D = "[object AsyncFunction]", w = "[object Boolean]", z = "[object Date]", h = "[object Error]", p = "[object Function]", g = "[object GeneratorFunction]", f = "[object Map]", v = "[object Number]", b = "[object Null]", _ = "[object Object]", m = "[object Promise]", y = "[object Proxy]", F = "[object RegExp]", k = "[object Set]", M = "[object String]", N = "[object Symbol]", R = "[object Undefined]", S = "[object WeakMap]", T = "[object ArrayBuffer]", H = "[object DataView]", _e = "[object Float32Array]", ge = "[object Float64Array]", ve = "[object Int8Array]", er = "[object Int16Array]", rr = "[object Int32Array]", nr = "[object Uint8Array]", ir = "[object Uint8ClampedArray]", C = "[object Uint16Array]", ar = "[object Uint32Array]", sr = /[\\^$.*+?()[\]{}|]/g, rt = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, j = {};
517
+ j[_e] = j[ge] = j[ve] = j[er] = j[rr] = j[nr] = j[ir] = j[C] = j[ar] = !0, j[d] = j[E] = j[T] = j[w] = j[H] = j[z] = j[h] = j[p] = j[f] = j[v] = j[_] = j[F] = j[k] = j[M] = j[S] = !1;
518
518
  var Se = typeof et == "object" && et && et.Object === Object && et, or = typeof self == "object" && self && self.Object === Object && self, nt = Se || or || Function("return this")(), we = r && !r.nodeType && r, Te = we && !0 && t && !t.nodeType && t, $t = Te && Te.exports === we, Kt = $t && Se.process, Ae = function() {
519
519
  try {
520
520
  return Kt && Kt.binding && Kt.binding("util");
@@ -522,15 +522,15 @@ Ye.exports;
522
522
  }
523
523
  }(), Vt = Ae && Ae.isTypedArray;
524
524
  function Ee(e, i) {
525
- for (var s = -1, u = e == null ? 0 : e.length, T = 0, S = []; ++s < u; ) {
526
- var M = e[s];
527
- i(M, s, e) && (S[T++] = M);
525
+ for (var s = -1, u = e == null ? 0 : e.length, A = 0, I = []; ++s < u; ) {
526
+ var x = e[s];
527
+ i(x, s, e) && (I[A++] = x);
528
528
  }
529
- return S;
529
+ return I;
530
530
  }
531
531
  function Yt(e, i) {
532
- for (var s = -1, u = i.length, T = e.length; ++s < u; )
533
- e[T + s] = i[s];
532
+ for (var s = -1, u = i.length, A = e.length; ++s < u; )
533
+ e[A + s] = i[s];
534
534
  return e;
535
535
  }
536
536
  function ke(e, i) {
@@ -557,8 +557,8 @@ Ye.exports;
557
557
  }
558
558
  function Oe(e) {
559
559
  var i = -1, s = Array(e.size);
560
- return e.forEach(function(u, T) {
561
- s[++i] = [T, u];
560
+ return e.forEach(function(u, A) {
561
+ s[++i] = [A, u];
562
562
  }), s;
563
563
  }
564
564
  function xe(e, i) {
@@ -578,7 +578,7 @@ Ye.exports;
578
578
  }(), Pe = gt.toString, lr = RegExp(
579
579
  "^" + qt.call(Q).replace(sr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
580
580
  ), Jt = $t ? nt.Buffer : void 0, Ft = nt.Symbol, De = nt.Uint8Array, Rt = gt.propertyIsEnumerable, vt = Ct.splice, it = Ft ? Ft.toStringTag : void 0, zt = Object.getOwnPropertySymbols, Zt = Jt ? Jt.isBuffer : void 0, It = xe(Object.keys, Object), Qt = pt(nt, "DataView"), St = pt(nt, "Map"), te = pt(nt, "Promise"), ee = pt(nt, "Set"), re = pt(nt, "WeakMap"), mt = pt(Object, "create"), Ce = Y(Qt), lt = Y(St), pr = Y(te), dr = Y(ee), hr = Y(re), je = Ft ? Ft.prototype : void 0, ne = je ? je.valueOf : void 0;
581
- function G(e) {
581
+ function B(e) {
582
582
  var i = -1, s = e == null ? 0 : e.length;
583
583
  for (this.clear(); ++i < s; ) {
584
584
  var u = e[i];
@@ -608,8 +608,8 @@ Ye.exports;
608
608
  var s = this.__data__;
609
609
  return this.size += this.has(e) ? 0 : 1, s[e] = mt && i === void 0 ? a : i, this;
610
610
  }
611
- G.prototype.clear = yr, G.prototype.delete = mr, G.prototype.get = br, G.prototype.has = _r, G.prototype.set = gr;
612
- function W(e) {
611
+ B.prototype.clear = yr, B.prototype.delete = mr, B.prototype.get = br, B.prototype.has = _r, B.prototype.set = gr;
612
+ function $(e) {
613
613
  var i = -1, s = e == null ? 0 : e.length;
614
614
  for (this.clear(); ++i < s; ) {
615
615
  var u = e[i];
@@ -620,24 +620,24 @@ Ye.exports;
620
620
  this.__data__ = [], this.size = 0;
621
621
  }
622
622
  function Ir(e) {
623
- var i = this.__data__, s = Ut(i, e);
623
+ var i = this.__data__, s = Lt(i, e);
624
624
  if (s < 0)
625
625
  return !1;
626
626
  var u = i.length - 1;
627
627
  return s == u ? i.pop() : vt.call(i, s, 1), --this.size, !0;
628
628
  }
629
629
  function Sr(e) {
630
- var i = this.__data__, s = Ut(i, e);
630
+ var i = this.__data__, s = Lt(i, e);
631
631
  return s < 0 ? void 0 : i[s][1];
632
632
  }
633
633
  function wr(e) {
634
- return Ut(this.__data__, e) > -1;
634
+ return Lt(this.__data__, e) > -1;
635
635
  }
636
636
  function Tr(e, i) {
637
- var s = this.__data__, u = Ut(s, e);
637
+ var s = this.__data__, u = Lt(s, e);
638
638
  return u < 0 ? (++this.size, s.push([e, i])) : s[u][1] = i, this;
639
639
  }
640
- W.prototype.clear = vr, W.prototype.delete = Ir, W.prototype.get = Sr, W.prototype.has = wr, W.prototype.set = Tr;
640
+ $.prototype.clear = vr, $.prototype.delete = Ir, $.prototype.get = Sr, $.prototype.has = wr, $.prototype.set = Tr;
641
641
  function X(e) {
642
642
  var i = -1, s = e == null ? 0 : e.length;
643
643
  for (this.clear(); ++i < s; ) {
@@ -647,9 +647,9 @@ Ye.exports;
647
647
  }
648
648
  function Ar() {
649
649
  this.size = 0, this.__data__ = {
650
- hash: new G(),
651
- map: new (St || W)(),
652
- string: new G()
650
+ hash: new B(),
651
+ map: new (St || $)(),
652
+ string: new B()
653
653
  };
654
654
  }
655
655
  function Er(e) {
@@ -680,11 +680,11 @@ Ye.exports;
680
680
  }
681
681
  Nt.prototype.add = Nt.prototype.push = Fe, Nt.prototype.has = Ht;
682
682
  function ot(e) {
683
- var i = this.__data__ = new W(e);
683
+ var i = this.__data__ = new $(e);
684
684
  this.size = i.size;
685
685
  }
686
686
  function ie() {
687
- this.__data__ = new W(), this.size = 0;
687
+ this.__data__ = new $(), this.size = 0;
688
688
  }
689
689
  function Mr(e) {
690
690
  var i = this.__data__, s = i.delete(e);
@@ -698,7 +698,7 @@ Ye.exports;
698
698
  }
699
699
  function Cr(e, i) {
700
700
  var s = this.__data__;
701
- if (s instanceof W) {
701
+ if (s instanceof $) {
702
702
  var u = s.__data__;
703
703
  if (!St || u.length < n - 1)
704
704
  return u.push([e, i]), this.size = ++s.size, this;
@@ -708,16 +708,16 @@ Ye.exports;
708
708
  }
709
709
  ot.prototype.clear = ie, ot.prototype.delete = Mr, ot.prototype.get = Pr, ot.prototype.has = Dr, ot.prototype.set = Cr;
710
710
  function jr(e, i) {
711
- var s = Lt(e), u = !s && Ue(e), T = !s && !u && Gt(e), S = !s && !u && !T && Be(e), M = s || u || T || S, O = M ? cr(e.length, String) : [], H = O.length;
711
+ var s = Ut(e), u = !s && Le(e), A = !s && !u && Gt(e), I = !s && !u && !A && Be(e), x = s || u || A || I, O = x ? cr(e.length, String) : [], L = O.length;
712
712
  for (var P in e)
713
- Q.call(e, P) && !(M && // Safari 9 has enumerable `arguments.length` in strict mode.
713
+ Q.call(e, P) && !(x && // Safari 9 has enumerable `arguments.length` in strict mode.
714
714
  (P == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
715
- T && (P == "offset" || P == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
716
- S && (P == "buffer" || P == "byteLength" || P == "byteOffset") || // Skip index properties.
717
- Gr(P, H))) && O.push(P);
715
+ A && (P == "offset" || P == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
716
+ I && (P == "buffer" || P == "byteLength" || P == "byteOffset") || // Skip index properties.
717
+ Gr(P, L))) && O.push(P);
718
718
  return O;
719
719
  }
720
- function Ut(e, i) {
720
+ function Lt(e, i) {
721
721
  for (var s = e.length; s--; )
722
722
  if (He(e[s][0], i))
723
723
  return s;
@@ -725,41 +725,41 @@ Ye.exports;
725
725
  }
726
726
  function ae(e, i, s) {
727
727
  var u = i(e);
728
- return Lt(e) ? u : Yt(u, s(e));
728
+ return Ut(e) ? u : Yt(u, s(e));
729
729
  }
730
730
  function wt(e) {
731
- return e == null ? e === void 0 ? N : v : it && it in Object(e) ? dt(e) : Ne(e);
731
+ return e == null ? e === void 0 ? R : b : it && it in Object(e) ? dt(e) : Ne(e);
732
732
  }
733
733
  function Re(e) {
734
734
  return ut(e) && wt(e) == d;
735
735
  }
736
- function ze(e, i, s, u, T) {
737
- return e === i ? !0 : e == null || i == null || !ut(e) && !ut(i) ? e !== e && i !== i : Fr(e, i, s, u, ze, T);
736
+ function ze(e, i, s, u, A) {
737
+ return e === i ? !0 : e == null || i == null || !ut(e) && !ut(i) ? e !== e && i !== i : Fr(e, i, s, u, ze, A);
738
738
  }
739
- function Fr(e, i, s, u, T, S) {
740
- var M = Lt(e), O = Lt(i), H = M ? A : ct(e), P = O ? A : ct(i);
741
- H = H == d ? _ : H, P = P == d ? _ : P;
742
- var $ = H == _, q = P == _, U = H == P;
739
+ function Fr(e, i, s, u, A, I) {
740
+ var x = Ut(e), O = Ut(i), L = x ? E : ct(e), P = O ? E : ct(i);
741
+ L = L == d ? _ : L, P = P == d ? _ : P;
742
+ var K = L == _, q = P == _, U = L == P;
743
743
  if (U && Gt(e)) {
744
744
  if (!Gt(i))
745
745
  return !1;
746
- M = !0, $ = !1;
746
+ x = !0, K = !1;
747
747
  }
748
- if (U && !$)
749
- return S || (S = new ot()), M || Be(e) ? se(e, i, s, u, T, S) : Hr(e, i, H, s, u, T, S);
748
+ if (U && !K)
749
+ return I || (I = new ot()), x || Be(e) ? se(e, i, s, u, A, I) : Hr(e, i, L, s, u, A, I);
750
750
  if (!(s & o)) {
751
- var K = $ && Q.call(e, "__wrapped__"), B = q && Q.call(i, "__wrapped__");
752
- if (K || B) {
753
- var bt = K ? e.value() : e, ht = B ? i.value() : i;
754
- return S || (S = new ot()), T(bt, ht, s, u, S);
751
+ var V = K && Q.call(e, "__wrapped__"), W = q && Q.call(i, "__wrapped__");
752
+ if (V || W) {
753
+ var bt = V ? e.value() : e, ht = W ? i.value() : i;
754
+ return I || (I = new ot()), A(bt, ht, s, u, I);
755
755
  }
756
756
  }
757
- return U ? (S || (S = new ot()), Ur(e, i, s, u, T, S)) : !1;
757
+ return U ? (I || (I = new ot()), Lr(e, i, s, u, A, I)) : !1;
758
758
  }
759
759
  function Rr(e) {
760
760
  if (!Ge(e) || Wr(e))
761
761
  return !1;
762
- var i = Le(e) ? lr : rt;
762
+ var i = Ue(e) ? lr : rt;
763
763
  return i.test(Y(e));
764
764
  }
765
765
  function zr(e) {
@@ -773,18 +773,18 @@ Ye.exports;
773
773
  Q.call(e, s) && s != "constructor" && i.push(s);
774
774
  return i;
775
775
  }
776
- function se(e, i, s, u, T, S) {
777
- var M = s & o, O = e.length, H = i.length;
778
- if (O != H && !(M && H > O))
776
+ function se(e, i, s, u, A, I) {
777
+ var x = s & o, O = e.length, L = i.length;
778
+ if (O != L && !(x && L > O))
779
779
  return !1;
780
- var P = S.get(e);
781
- if (P && S.get(i))
780
+ var P = I.get(e);
781
+ if (P && I.get(i))
782
782
  return P == i;
783
- var $ = -1, q = !0, U = s & c ? new Nt() : void 0;
784
- for (S.set(e, i), S.set(i, e); ++$ < O; ) {
785
- var K = e[$], B = i[$];
783
+ var K = -1, q = !0, U = s & c ? new Nt() : void 0;
784
+ for (I.set(e, i), I.set(i, e); ++K < O; ) {
785
+ var V = e[K], W = i[K];
786
786
  if (u)
787
- var bt = M ? u(B, K, $, i, e, S) : u(K, B, $, e, i, S);
787
+ var bt = x ? u(W, V, K, i, e, I) : u(V, W, K, e, i, I);
788
788
  if (bt !== void 0) {
789
789
  if (bt)
790
790
  continue;
@@ -793,87 +793,87 @@ Ye.exports;
793
793
  }
794
794
  if (U) {
795
795
  if (!ke(i, function(ht, At) {
796
- if (!Dt(U, At) && (K === ht || T(K, ht, s, u, S)))
796
+ if (!Dt(U, At) && (V === ht || A(V, ht, s, u, I)))
797
797
  return U.push(At);
798
798
  })) {
799
799
  q = !1;
800
800
  break;
801
801
  }
802
- } else if (!(K === B || T(K, B, s, u, S))) {
802
+ } else if (!(V === W || A(V, W, s, u, I))) {
803
803
  q = !1;
804
804
  break;
805
805
  }
806
806
  }
807
- return S.delete(e), S.delete(i), q;
807
+ return I.delete(e), I.delete(i), q;
808
808
  }
809
- function Hr(e, i, s, u, T, S, M) {
809
+ function Hr(e, i, s, u, A, I, x) {
810
810
  switch (s) {
811
- case V:
811
+ case H:
812
812
  if (e.byteLength != i.byteLength || e.byteOffset != i.byteOffset)
813
813
  return !1;
814
814
  e = e.buffer, i = i.buffer;
815
- case x:
816
- return !(e.byteLength != i.byteLength || !S(new De(e), new De(i)));
815
+ case T:
816
+ return !(e.byteLength != i.byteLength || !I(new De(e), new De(i)));
817
817
  case w:
818
- case R:
819
- case b:
818
+ case z:
819
+ case v:
820
820
  return He(+e, +i);
821
821
  case h:
822
822
  return e.name == i.name && e.message == i.message;
823
823
  case F:
824
- case k:
824
+ case M:
825
825
  return e == i + "";
826
826
  case f:
827
827
  var O = Oe;
828
- case E:
829
- var H = u & o;
830
- if (O || (O = st), e.size != i.size && !H)
828
+ case k:
829
+ var L = u & o;
830
+ if (O || (O = st), e.size != i.size && !L)
831
831
  return !1;
832
- var P = M.get(e);
832
+ var P = x.get(e);
833
833
  if (P)
834
834
  return P == i;
835
- u |= c, M.set(e, i);
836
- var $ = se(O(e), O(i), u, T, S, M);
837
- return M.delete(e), $;
838
- case z:
835
+ u |= c, x.set(e, i);
836
+ var K = se(O(e), O(i), u, A, I, x);
837
+ return x.delete(e), K;
838
+ case N:
839
839
  if (ne)
840
840
  return ne.call(e) == ne.call(i);
841
841
  }
842
842
  return !1;
843
843
  }
844
- function Ur(e, i, s, u, T, S) {
845
- var M = s & o, O = Tt(e), H = O.length, P = Tt(i), $ = P.length;
846
- if (H != $ && !M)
844
+ function Lr(e, i, s, u, A, I) {
845
+ var x = s & o, O = Tt(e), L = O.length, P = Tt(i), K = P.length;
846
+ if (L != K && !x)
847
847
  return !1;
848
- for (var q = H; q--; ) {
848
+ for (var q = L; q--; ) {
849
849
  var U = O[q];
850
- if (!(M ? U in i : Q.call(i, U)))
850
+ if (!(x ? U in i : Q.call(i, U)))
851
851
  return !1;
852
852
  }
853
- var K = S.get(e);
854
- if (K && S.get(i))
855
- return K == i;
856
- var B = !0;
857
- S.set(e, i), S.set(i, e);
858
- for (var bt = M; ++q < H; ) {
853
+ var V = I.get(e);
854
+ if (V && I.get(i))
855
+ return V == i;
856
+ var W = !0;
857
+ I.set(e, i), I.set(i, e);
858
+ for (var bt = x; ++q < L; ) {
859
859
  U = O[q];
860
860
  var ht = e[U], At = i[U];
861
861
  if (u)
862
- var Tn = M ? u(At, ht, U, i, e, S) : u(ht, At, U, e, i, S);
863
- if (!(Tn === void 0 ? ht === At || T(ht, At, s, u, S) : Tn)) {
864
- B = !1;
862
+ var Tn = x ? u(At, ht, U, i, e, I) : u(ht, At, U, e, i, I);
863
+ if (!(Tn === void 0 ? ht === At || A(ht, At, s, u, I) : Tn)) {
864
+ W = !1;
865
865
  break;
866
866
  }
867
867
  bt || (bt = U == "constructor");
868
868
  }
869
- if (B && !bt) {
869
+ if (W && !bt) {
870
870
  var We = e.constructor, $e = i.constructor;
871
- We != $e && "constructor" in e && "constructor" in i && !(typeof We == "function" && We instanceof We && typeof $e == "function" && $e instanceof $e) && (B = !1);
871
+ We != $e && "constructor" in e && "constructor" in i && !(typeof We == "function" && We instanceof We && typeof $e == "function" && $e instanceof $e) && (W = !1);
872
872
  }
873
- return S.delete(e), S.delete(i), B;
873
+ return I.delete(e), I.delete(i), W;
874
874
  }
875
875
  function Tt(e) {
876
- return ae(e, ue, Lr);
876
+ return ae(e, ue, Ur);
877
877
  }
878
878
  function at(e, i) {
879
879
  var s = e.__data__;
@@ -890,28 +890,28 @@ Ye.exports;
890
890
  var u = !0;
891
891
  } catch {
892
892
  }
893
- var T = Pe.call(e);
894
- return u && (i ? e[it] = s : delete e[it]), T;
893
+ var A = Pe.call(e);
894
+ return u && (i ? e[it] = s : delete e[it]), A;
895
895
  }
896
- var Lr = zt ? function(e) {
896
+ var Ur = zt ? function(e) {
897
897
  return e == null ? [] : (e = Object(e), Ee(zt(e), function(i) {
898
898
  return Rt.call(e, i);
899
899
  }));
900
900
  } : Vr, ct = wt;
901
- (Qt && ct(new Qt(new ArrayBuffer(1))) != V || St && ct(new St()) != f || te && ct(te.resolve()) != m || ee && ct(new ee()) != E || re && ct(new re()) != I) && (ct = function(e) {
901
+ (Qt && ct(new Qt(new ArrayBuffer(1))) != H || St && ct(new St()) != f || te && ct(te.resolve()) != m || ee && ct(new ee()) != k || re && ct(new re()) != S) && (ct = function(e) {
902
902
  var i = wt(e), s = i == _ ? e.constructor : void 0, u = s ? Y(s) : "";
903
903
  if (u)
904
904
  switch (u) {
905
905
  case Ce:
906
- return V;
906
+ return H;
907
907
  case lt:
908
908
  return f;
909
909
  case pr:
910
910
  return m;
911
911
  case dr:
912
- return E;
912
+ return k;
913
913
  case hr:
914
- return I;
914
+ return S;
915
915
  }
916
916
  return i;
917
917
  });
@@ -948,19 +948,19 @@ Ye.exports;
948
948
  function He(e, i) {
949
949
  return e === i || e !== e && i !== i;
950
950
  }
951
- var Ue = Re(/* @__PURE__ */ function() {
951
+ var Le = Re(/* @__PURE__ */ function() {
952
952
  return arguments;
953
953
  }()) ? Re : function(e) {
954
954
  return ut(e) && Q.call(e, "callee") && !Rt.call(e, "callee");
955
- }, Lt = Array.isArray;
955
+ }, Ut = Array.isArray;
956
956
  function oe(e) {
957
- return e != null && ce(e.length) && !Le(e);
957
+ return e != null && ce(e.length) && !Ue(e);
958
958
  }
959
959
  var Gt = Zt || Yr;
960
960
  function Kr(e, i) {
961
961
  return ze(e, i);
962
962
  }
963
- function Le(e) {
963
+ function Ue(e) {
964
964
  if (!Ge(e))
965
965
  return !1;
966
966
  var i = wt(e);
@@ -993,8 +993,8 @@ const ft = /* @__PURE__ */ mn(zi);
993
993
  var Xe = { exports: {} };
994
994
  Xe.exports;
995
995
  (function(t, r) {
996
- var n = 200, a = "__lodash_hash_undefined__", o = 9007199254740991, c = "[object Arguments]", l = "[object Array]", d = "[object Boolean]", A = "[object Date]", D = "[object Error]", w = "[object Function]", R = "[object GeneratorFunction]", h = "[object Map]", p = "[object Number]", g = "[object Object]", f = "[object Promise]", b = "[object RegExp]", v = "[object Set]", _ = "[object String]", m = "[object Symbol]", y = "[object WeakMap]", F = "[object ArrayBuffer]", E = "[object DataView]", k = "[object Float32Array]", z = "[object Float64Array]", N = "[object Int8Array]", I = "[object Int16Array]", x = "[object Int32Array]", V = "[object Uint8Array]", _e = "[object Uint8ClampedArray]", ge = "[object Uint16Array]", ve = "[object Uint32Array]", er = /[\\^$.*+?()[\]{}|]/g, rr = /\w*$/, nr = /^\[object .+?Constructor\]$/, ir = /^(?:0|[1-9]\d*)$/, C = {};
997
- C[c] = C[l] = C[F] = C[E] = C[d] = C[A] = C[k] = C[z] = C[N] = C[I] = C[x] = C[h] = C[p] = C[g] = C[b] = C[v] = C[_] = C[m] = C[V] = C[_e] = C[ge] = C[ve] = !0, C[D] = C[w] = C[y] = !1;
996
+ var n = 200, a = "__lodash_hash_undefined__", o = 9007199254740991, c = "[object Arguments]", l = "[object Array]", d = "[object Boolean]", E = "[object Date]", D = "[object Error]", w = "[object Function]", z = "[object GeneratorFunction]", h = "[object Map]", p = "[object Number]", g = "[object Object]", f = "[object Promise]", v = "[object RegExp]", b = "[object Set]", _ = "[object String]", m = "[object Symbol]", y = "[object WeakMap]", F = "[object ArrayBuffer]", k = "[object DataView]", M = "[object Float32Array]", N = "[object Float64Array]", R = "[object Int8Array]", S = "[object Int16Array]", T = "[object Int32Array]", H = "[object Uint8Array]", _e = "[object Uint8ClampedArray]", ge = "[object Uint16Array]", ve = "[object Uint32Array]", er = /[\\^$.*+?()[\]{}|]/g, rr = /\w*$/, nr = /^\[object .+?Constructor\]$/, ir = /^(?:0|[1-9]\d*)$/, C = {};
997
+ C[c] = C[l] = C[F] = C[k] = C[d] = C[E] = C[M] = C[N] = C[R] = C[S] = C[T] = C[h] = C[p] = C[g] = C[v] = C[b] = C[_] = C[m] = C[H] = C[_e] = C[ge] = C[ve] = !0, C[D] = C[w] = C[y] = !1;
998
998
  var ar = typeof et == "object" && et && et.Object === Object && et, sr = typeof self == "object" && self && self.Object === Object && self, rt = ar || sr || Function("return this")(), Ie = r && !r.nodeType && r, j = Ie && !0 && t && !t.nodeType && t, Se = j && j.exports === Ie;
999
999
  function or(e, i) {
1000
1000
  return e.set(i[0], i[1]), e;
@@ -1008,13 +1008,13 @@ Xe.exports;
1008
1008
  return e;
1009
1009
  }
1010
1010
  function Te(e, i) {
1011
- for (var s = -1, u = i.length, T = e.length; ++s < u; )
1012
- e[T + s] = i[s];
1011
+ for (var s = -1, u = i.length, A = e.length; ++s < u; )
1012
+ e[A + s] = i[s];
1013
1013
  return e;
1014
1014
  }
1015
1015
  function $t(e, i, s, u) {
1016
- for (var T = -1, S = e ? e.length : 0; ++T < S; )
1017
- s = i(s, e[T], T, e);
1016
+ for (var A = -1, I = e ? e.length : 0; ++A < I; )
1017
+ s = i(s, e[A], A, e);
1018
1018
  return s;
1019
1019
  }
1020
1020
  function Kt(e, i) {
@@ -1036,8 +1036,8 @@ Xe.exports;
1036
1036
  }
1037
1037
  function Ee(e) {
1038
1038
  var i = -1, s = Array(e.size);
1039
- return e.forEach(function(u, T) {
1040
- s[++i] = [T, u];
1039
+ return e.forEach(function(u, A) {
1040
+ s[++i] = [A, u];
1041
1041
  }), s;
1042
1042
  }
1043
1043
  function Yt(e, i) {
@@ -1087,7 +1087,7 @@ Xe.exports;
1087
1087
  return s[e] = It && i === void 0 ? a : i, this;
1088
1088
  }
1089
1089
  lt.prototype.clear = pr, lt.prototype.delete = dr, lt.prototype.get = hr, lt.prototype.has = je, lt.prototype.set = ne;
1090
- function G(e) {
1090
+ function B(e) {
1091
1091
  var i = -1, s = e ? e.length : 0;
1092
1092
  for (this.clear(); ++i < s; ) {
1093
1093
  var u = e[i];
@@ -1115,8 +1115,8 @@ Xe.exports;
1115
1115
  var s = this.__data__, u = Ht(s, e);
1116
1116
  return u < 0 ? s.push([e, i]) : s[u][1] = i, this;
1117
1117
  }
1118
- G.prototype.clear = yr, G.prototype.delete = mr, G.prototype.get = br, G.prototype.has = _r, G.prototype.set = gr;
1119
- function W(e) {
1118
+ B.prototype.clear = yr, B.prototype.delete = mr, B.prototype.get = br, B.prototype.has = _r, B.prototype.set = gr;
1119
+ function $(e) {
1120
1120
  var i = -1, s = e ? e.length : 0;
1121
1121
  for (this.clear(); ++i < s; ) {
1122
1122
  var u = e[i];
@@ -1126,7 +1126,7 @@ Xe.exports;
1126
1126
  function vr() {
1127
1127
  this.__data__ = {
1128
1128
  hash: new lt(),
1129
- map: new (vt || G)(),
1129
+ map: new (vt || B)(),
1130
1130
  string: new lt()
1131
1131
  };
1132
1132
  }
@@ -1142,12 +1142,12 @@ Xe.exports;
1142
1142
  function Tr(e, i) {
1143
1143
  return Tt(this, e).set(e, i), this;
1144
1144
  }
1145
- W.prototype.clear = vr, W.prototype.delete = Ir, W.prototype.get = Sr, W.prototype.has = wr, W.prototype.set = Tr;
1145
+ $.prototype.clear = vr, $.prototype.delete = Ir, $.prototype.get = Sr, $.prototype.has = wr, $.prototype.set = Tr;
1146
1146
  function X(e) {
1147
- this.__data__ = new G(e);
1147
+ this.__data__ = new B(e);
1148
1148
  }
1149
1149
  function Ar() {
1150
- this.__data__ = new G();
1150
+ this.__data__ = new B();
1151
1151
  }
1152
1152
  function Er(e) {
1153
1153
  return this.__data__.delete(e);
@@ -1160,67 +1160,67 @@ Xe.exports;
1160
1160
  }
1161
1161
  function xr(e, i) {
1162
1162
  var s = this.__data__;
1163
- if (s instanceof G) {
1163
+ if (s instanceof B) {
1164
1164
  var u = s.__data__;
1165
1165
  if (!vt || u.length < n - 1)
1166
1166
  return u.push([e, i]), this;
1167
- s = this.__data__ = new W(u);
1167
+ s = this.__data__ = new $(u);
1168
1168
  }
1169
1169
  return s.set(e, i), this;
1170
1170
  }
1171
1171
  X.prototype.clear = Ar, X.prototype.delete = Er, X.prototype.get = kr, X.prototype.has = Or, X.prototype.set = xr;
1172
1172
  function Nt(e, i) {
1173
- var s = oe(e) || Lt(e) ? Kt(e.length, String) : [], u = s.length, T = !!u;
1174
- for (var S in e)
1175
- st.call(e, S) && !(T && (S == "length" || Br(S, u))) && s.push(S);
1173
+ var s = oe(e) || Ut(e) ? Kt(e.length, String) : [], u = s.length, A = !!u;
1174
+ for (var I in e)
1175
+ st.call(e, I) && !(A && (I == "length" || Br(I, u))) && s.push(I);
1176
1176
  return s;
1177
1177
  }
1178
1178
  function Fe(e, i, s) {
1179
1179
  var u = e[i];
1180
- (!(st.call(e, i) && Ue(u, s)) || s === void 0 && !(i in e)) && (e[i] = s);
1180
+ (!(st.call(e, i) && Le(u, s)) || s === void 0 && !(i in e)) && (e[i] = s);
1181
1181
  }
1182
1182
  function Ht(e, i) {
1183
1183
  for (var s = e.length; s--; )
1184
- if (Ue(e[s][0], i))
1184
+ if (Le(e[s][0], i))
1185
1185
  return s;
1186
1186
  return -1;
1187
1187
  }
1188
1188
  function ot(e, i) {
1189
1189
  return e && se(i, ue(i), e);
1190
1190
  }
1191
- function ie(e, i, s, u, T, S, M) {
1191
+ function ie(e, i, s, u, A, I, x) {
1192
1192
  var O;
1193
- if (u && (O = S ? u(e, T, S, M) : u(e)), O !== void 0)
1193
+ if (u && (O = I ? u(e, A, I, x) : u(e)), O !== void 0)
1194
1194
  return O;
1195
1195
  if (!ut(e))
1196
1196
  return e;
1197
- var H = oe(e);
1198
- if (H) {
1199
- if (O = Lr(e), !i)
1197
+ var L = oe(e);
1198
+ if (L) {
1199
+ if (O = Ur(e), !i)
1200
1200
  return Nr(e, O);
1201
1201
  } else {
1202
- var P = dt(e), $ = P == w || P == R;
1203
- if (Le(e))
1204
- return Ut(e, i);
1205
- if (P == g || P == c || $ && !S) {
1202
+ var P = dt(e), K = P == w || P == z;
1203
+ if (Ue(e))
1204
+ return Lt(e, i);
1205
+ if (P == g || P == c || K && !I) {
1206
1206
  if (Vt(e))
1207
- return S ? e : {};
1208
- if (O = ct($ ? {} : e), !i)
1207
+ return I ? e : {};
1208
+ if (O = ct(K ? {} : e), !i)
1209
1209
  return Hr(e, ot(O, e));
1210
1210
  } else {
1211
1211
  if (!C[P])
1212
- return S ? e : {};
1212
+ return I ? e : {};
1213
1213
  O = Gr(e, P, ie, i);
1214
1214
  }
1215
1215
  }
1216
- M || (M = new X());
1217
- var q = M.get(e);
1216
+ x || (x = new X());
1217
+ var q = x.get(e);
1218
1218
  if (q)
1219
1219
  return q;
1220
- if (M.set(e, O), !H)
1221
- var U = s ? Ur(e) : ue(e);
1222
- return we(U || e, function(K, B) {
1223
- U && (B = K, K = e[B]), Fe(O, B, ie(K, i, s, u, B, e, M));
1220
+ if (x.set(e, O), !L)
1221
+ var U = s ? Lr(e) : ue(e);
1222
+ return we(U || e, function(V, W) {
1223
+ U && (W = V, V = e[W]), Fe(O, W, ie(V, i, s, u, W, e, x));
1224
1224
  }), O;
1225
1225
  }
1226
1226
  function Mr(e) {
@@ -1247,7 +1247,7 @@ Xe.exports;
1247
1247
  st.call(e, s) && s != "constructor" && i.push(s);
1248
1248
  return i;
1249
1249
  }
1250
- function Ut(e, i) {
1250
+ function Lt(e, i) {
1251
1251
  if (i)
1252
1252
  return e.slice();
1253
1253
  var s = new e.constructor(e.length);
@@ -1288,16 +1288,16 @@ Xe.exports;
1288
1288
  }
1289
1289
  function se(e, i, s, u) {
1290
1290
  s || (s = {});
1291
- for (var T = -1, S = i.length; ++T < S; ) {
1292
- var M = i[T], O = void 0;
1293
- Fe(s, M, O === void 0 ? e[M] : O);
1291
+ for (var A = -1, I = i.length; ++A < I; ) {
1292
+ var x = i[A], O = void 0;
1293
+ Fe(s, x, O === void 0 ? e[x] : O);
1294
1294
  }
1295
1295
  return s;
1296
1296
  }
1297
1297
  function Hr(e, i) {
1298
1298
  return se(e, pt(e), i);
1299
1299
  }
1300
- function Ur(e) {
1300
+ function Lr(e) {
1301
1301
  return Pr(e, ue, pt);
1302
1302
  }
1303
1303
  function Tt(e, i) {
@@ -1309,24 +1309,24 @@ Xe.exports;
1309
1309
  return Cr(s) ? s : void 0;
1310
1310
  }
1311
1311
  var pt = Jt ? Yt(Jt, Object) : Vr, dt = Dr;
1312
- (Rt && dt(new Rt(new ArrayBuffer(1))) != E || vt && dt(new vt()) != h || it && dt(it.resolve()) != f || zt && dt(new zt()) != v || Zt && dt(new Zt()) != y) && (dt = function(e) {
1312
+ (Rt && dt(new Rt(new ArrayBuffer(1))) != k || vt && dt(new vt()) != h || it && dt(it.resolve()) != f || zt && dt(new zt()) != b || Zt && dt(new Zt()) != y) && (dt = function(e) {
1313
1313
  var i = Ct.call(e), s = i == g ? e.constructor : void 0, u = s ? Y(s) : void 0;
1314
1314
  if (u)
1315
1315
  switch (u) {
1316
1316
  case Qt:
1317
- return E;
1317
+ return k;
1318
1318
  case St:
1319
1319
  return h;
1320
1320
  case te:
1321
1321
  return f;
1322
1322
  case ee:
1323
- return v;
1323
+ return b;
1324
1324
  case re:
1325
1325
  return y;
1326
1326
  }
1327
1327
  return i;
1328
1328
  });
1329
- function Lr(e) {
1329
+ function Ur(e) {
1330
1330
  var i = e.length, s = e.constructor(i);
1331
1331
  return i && typeof e[0] == "string" && st.call(e, "index") && (s.index = e.index, s.input = e.input), s;
1332
1332
  }
@@ -1334,21 +1334,21 @@ Xe.exports;
1334
1334
  return typeof e.constructor == "function" && !Ne(e) ? Mr(Q(e)) : {};
1335
1335
  }
1336
1336
  function Gr(e, i, s, u) {
1337
- var T = e.constructor;
1337
+ var A = e.constructor;
1338
1338
  switch (i) {
1339
1339
  case F:
1340
1340
  return ae(e);
1341
1341
  case d:
1342
- case A:
1343
- return new T(+e);
1344
1342
  case E:
1345
- return wt(e, u);
1343
+ return new A(+e);
1346
1344
  case k:
1347
- case z:
1345
+ return wt(e, u);
1346
+ case M:
1348
1347
  case N:
1349
- case I:
1350
- case x:
1351
- case V:
1348
+ case R:
1349
+ case S:
1350
+ case T:
1351
+ case H:
1352
1352
  case _e:
1353
1353
  case ge:
1354
1354
  case ve:
@@ -1357,10 +1357,10 @@ Xe.exports;
1357
1357
  return Re(e, u, s);
1358
1358
  case p:
1359
1359
  case _:
1360
- return new T(e);
1361
- case b:
1362
- return ze(e);
1360
+ return new A(e);
1363
1361
  case v:
1362
+ return ze(e);
1363
+ case b:
1364
1364
  return Fr(e, u, s);
1365
1365
  case m:
1366
1366
  return Rr(e);
@@ -1396,10 +1396,10 @@ Xe.exports;
1396
1396
  function He(e) {
1397
1397
  return ie(e, !0, !0);
1398
1398
  }
1399
- function Ue(e, i) {
1399
+ function Le(e, i) {
1400
1400
  return e === i || e !== e && i !== i;
1401
1401
  }
1402
- function Lt(e) {
1402
+ function Ut(e) {
1403
1403
  return Kr(e) && st.call(e, "callee") && (!Pe.call(e, "callee") || Ct.call(e) == c);
1404
1404
  }
1405
1405
  var oe = Array.isArray;
@@ -1409,10 +1409,10 @@ Xe.exports;
1409
1409
  function Kr(e) {
1410
1410
  return Be(e) && Gt(e);
1411
1411
  }
1412
- var Le = Ft || Yr;
1412
+ var Ue = Ft || Yr;
1413
1413
  function ce(e) {
1414
1414
  var i = ut(e) ? Ct.call(e) : "";
1415
- return i == w || i == R;
1415
+ return i == w || i == z;
1416
1416
  }
1417
1417
  function Ge(e) {
1418
1418
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= o;
@@ -1453,7 +1453,7 @@ const tt = /* @__PURE__ */ mn(Ni), cn = (t) => {
1453
1453
  }, a.onerror = (o) => {
1454
1454
  n(o);
1455
1455
  }, a.crossOrigin = "anonymous", a.src = t;
1456
- }), Ui = (t) => new Promise((r, n) => {
1456
+ }), Li = (t) => new Promise((r, n) => {
1457
1457
  const a = new Audio();
1458
1458
  a.preload = "auto", a.addEventListener("loadedmetadata", () => {
1459
1459
  const o = a.duration * 1e3;
@@ -1461,7 +1461,7 @@ const tt = /* @__PURE__ */ mn(Ni), cn = (t) => {
1461
1461
  }), a.addEventListener("error", (o) => {
1462
1462
  n(o);
1463
1463
  }), a.src = t, a.crossOrigin = "anonymous", a.load();
1464
- }), Li = (t) => new Promise((r, n) => {
1464
+ }), Ui = (t) => new Promise((r, n) => {
1465
1465
  const a = document.createElement("video");
1466
1466
  a.preload = "auto", a.addEventListener("loadedmetadata", () => {
1467
1467
  const o = a.duration * 1e3, c = a.videoWidth, l = a.videoHeight;
@@ -1482,7 +1482,8 @@ const tt = /* @__PURE__ */ mn(Ni), cn = (t) => {
1482
1482
  y: 0,
1483
1483
  blur: 0
1484
1484
  }, Qe = (t, r) => {
1485
- const n = (r == null ? void 0 : r.duration) || 5e3, a = {
1485
+ let n = r != null && r.trim ? r.trim.to - r.trim.from : (r == null ? void 0 : r.duration) || 5e3;
1486
+ const a = {
1486
1487
  from: 0,
1487
1488
  to: n
1488
1489
  };
@@ -1530,9 +1531,9 @@ function _n(t, r) {
1530
1531
  };
1531
1532
  }
1532
1533
  const Bi = async (t, r) => {
1533
- const n = t.details.src, a = await Li(n), o = _n(r, {
1534
+ const n = t.details.src, a = await Ui(n), o = _n(r, {
1534
1535
  ...a
1535
- }), c = {
1536
+ }), c = qn(t.trim, { duration: a.duration }), l = {
1536
1537
  width: a.width,
1537
1538
  height: a.height,
1538
1539
  duration: a.duration,
@@ -1556,20 +1557,20 @@ const Bi = async (t, r) => {
1556
1557
  };
1557
1558
  return {
1558
1559
  ...t,
1559
- trim: qn(t.trim, { duration: a.duration }),
1560
+ trim: c,
1560
1561
  type: "video",
1561
1562
  name: "video",
1562
- details: c,
1563
- display: Qe(t.display, { duration: a.duration })
1563
+ details: l,
1564
+ display: Qe(t.display, { duration: a.duration, trim: c })
1564
1565
  };
1565
1566
  }, Wi = async (t) => {
1566
- const r = t.id, n = t.details, o = (await Ui(n.src)).duration;
1567
+ const r = t.id, n = t.details, o = (await Li(n.src)).duration, c = qn(t.trim, { duration: o });
1567
1568
  return {
1568
1569
  id: r,
1569
1570
  name: "",
1570
1571
  type: "audio",
1571
- display: Qe(t.display, { duration: o }),
1572
- trim: qn(t.trim, { duration: o }),
1572
+ display: Qe(t.display, { duration: o, trim: c }),
1573
+ trim: c,
1573
1574
  details: {
1574
1575
  src: n.src,
1575
1576
  duration: o,
@@ -1720,7 +1721,9 @@ const Pn = (t) => Object.keys(t).reduce((r, n) => {
1720
1721
  }, r.trackItemsMap[c.id] = c, c.id;
1721
1722
  };
1722
1723
  function qi(t) {
1723
- const r = Bt.pipe(Wt(({ key: p }) => p.startsWith(oi))), n = Bt.pipe(
1724
+ const r = Bt.pipe(
1725
+ Wt(({ key: p }) => p.startsWith(oi))
1726
+ ), n = Bt.pipe(
1724
1727
  Wt(({ key: p }) => p.startsWith(ci))
1725
1728
  ), a = Bt.pipe(
1726
1729
  Wt(({ key: p }) => p.startsWith(ui))
@@ -1733,126 +1736,139 @@ function qi(t) {
1733
1736
  ), d = r.subscribe(async (p) => {
1734
1737
  var g;
1735
1738
  if (p.key === di) {
1736
- const f = (g = p.value) == null ? void 0 : g.payload, b = f.trackItemIds, v = f.trackItemDetailsMap, _ = b.map(async (m) => {
1737
- const y = v[m];
1738
- return (y.type === "caption" || y.type === "text") && await cn([{ fontFamily: y.details.fontFamily, url: y.details.fontUrl }]), !0;
1739
+ const f = (g = p.value) == null ? void 0 : g.payload, v = f.trackItemIds, b = f.trackItemDetailsMap, _ = v.map(async (m) => {
1740
+ const y = b[m];
1741
+ return (y.type === "caption" || y.type === "text") && await cn([
1742
+ {
1743
+ fontFamily: y.details.fontFamily,
1744
+ url: y.details.fontUrl
1745
+ }
1746
+ ]), !0;
1739
1747
  });
1740
1748
  await Promise.all(_), t.updateState({
1741
1749
  ...f
1742
1750
  });
1743
1751
  }
1744
- }), A = o.subscribe((p) => {
1752
+ }), E = o.subscribe((p) => {
1745
1753
  if (p.key === hi) return t.undo();
1746
1754
  if (p.key === yi) return t.redo();
1747
1755
  }), D = a.subscribe((p) => {
1748
- var f, b;
1756
+ var f, v, b;
1749
1757
  const g = [];
1750
- (f = p.value) != null && f.payload.trackItemIds && g.push((b = p.value) == null ? void 0 : b.payload.trackItemIds), t.updateState({ activeIds: g });
1758
+ if ((f = p.value) != null && f.payload.trackItemIds && (g.push((v = p.value) == null ? void 0 : v.payload.trackItemIds), t.updateState({ activeIds: g })), p.key === mi) {
1759
+ const _ = (b = p.value) == null ? void 0 : b.payload.trackItemIds, m = tt(t.getState()), y = _ && _.length ? _ : m.activeIds, F = m.trackItemIds, k = m.trackItemDetailsMap, M = F.filter(
1760
+ (T) => !y.includes(T)
1761
+ ), N = Object.fromEntries(
1762
+ Object.entries(k).filter(
1763
+ ([T]) => !y.includes(T)
1764
+ )
1765
+ ), R = Xi(
1766
+ m.tracks,
1767
+ y
1768
+ ), S = Pn(m.trackItemsMap);
1769
+ t.updateState(
1770
+ {
1771
+ trackItemIds: M,
1772
+ trackItemDetailsMap: N,
1773
+ activeIds: [],
1774
+ tracks: R,
1775
+ duration: S
1776
+ },
1777
+ { updateHistory: !0, kind: "remove" }
1778
+ );
1779
+ }
1751
1780
  }), w = n.subscribe(async (p) => {
1752
- var v, _, m, y, F, E, k;
1753
- const g = [], f = tt(t.getState());
1754
- if ((v = p.value) != null && v.payload.id ? g.push((_ = p.value) == null ? void 0 : _.payload.id) : g.push(Jr()), p.key === mi) {
1755
- const N = ((m = p.value) == null ? void 0 : m.payload).map(async (x) => await Dn(x, f, "caption")), I = await Promise.all(N);
1756
- g.splice(0, g.length), I.forEach((x) => {
1757
- g.push(x), f.trackItemIds.push(x);
1781
+ var m, y, F, k, M, N;
1782
+ const g = [], f = tt(t.getState()), v = ((m = p.value) == null ? void 0 : m.payload.id) ?? Jr();
1783
+ if (g.push(v), p.key === bi) {
1784
+ const S = ((y = p.value) == null ? void 0 : y.payload).map(async (H) => await Dn(H, f, "caption")), T = await Promise.all(S);
1785
+ g.splice(0, g.length), T.forEach((H) => {
1786
+ g.push(H), f.trackItemIds.push(H);
1758
1787
  });
1759
1788
  }
1760
- if (p.key === bi) {
1761
- const z = await Dn((y = p.value) == null ? void 0 : y.payload, f, "text");
1762
- f.trackItemIds.push(z);
1763
- }
1764
1789
  if (p.key === _i) {
1765
- const z = await $i((F = p.value) == null ? void 0 : F.payload, {
1790
+ const R = await Dn(
1791
+ (F = p.value) == null ? void 0 : F.payload,
1792
+ f,
1793
+ "text"
1794
+ );
1795
+ f.trackItemIds.push(R);
1796
+ }
1797
+ let b = "text";
1798
+ if (p.key === gi) {
1799
+ b = "image";
1800
+ const R = await $i((k = p.value) == null ? void 0 : k.payload, {
1766
1801
  size: {
1767
1802
  width: 1080,
1768
1803
  height: 1920
1769
1804
  }
1770
- }), { details: N, ...I } = z;
1771
- f.trackItemDetailsMap[I.id] = {
1772
- type: "image",
1773
- details: N
1774
- }, f.trackItemsMap[I.id] = I, f.trackItemIds.push(I.id);
1775
- }
1776
- if (p.key === gi) {
1777
- const z = await Wi((E = p.value) == null ? void 0 : E.payload), { details: N, ...I } = z;
1778
- f.trackItemDetailsMap[I.id] = {
1779
- type: "audio",
1780
- details: N
1781
- }, f.trackItemsMap[I.id] = I, f.trackItemIds.push(I.id);
1805
+ }), { details: S, ...T } = R;
1806
+ f.trackItemDetailsMap[T.id] = {
1807
+ type: b,
1808
+ details: S
1809
+ }, f.trackItemsMap[T.id] = T, f.trackItemIds.push(T.id);
1782
1810
  }
1783
1811
  if (p.key === vi) {
1784
- const z = await Bi((k = p.value) == null ? void 0 : k.payload, {
1812
+ b = "audio";
1813
+ const R = await Wi((M = p.value) == null ? void 0 : M.payload), { details: S, ...T } = R;
1814
+ f.trackItemDetailsMap[T.id] = {
1815
+ type: b,
1816
+ details: S
1817
+ }, f.trackItemsMap[T.id] = T, f.trackItemIds.push(T.id);
1818
+ }
1819
+ if (p.key === Ii) {
1820
+ b = "video";
1821
+ const R = await Bi((N = p.value) == null ? void 0 : N.payload, {
1785
1822
  size: {
1786
1823
  width: 1080,
1787
1824
  height: 1920
1788
1825
  }
1789
- }), { details: N, ...I } = z;
1790
- f.trackItemDetailsMap[I.id] = {
1791
- type: "video",
1792
- details: N
1793
- }, f.trackItemsMap[I.id] = I, f.trackItemIds.push(I.id);
1826
+ }), { details: S, ...T } = R;
1827
+ f.trackItemDetailsMap[T.id] = {
1828
+ type: b,
1829
+ details: S
1830
+ }, f.trackItemsMap[T.id] = T, f.trackItemIds.push(T.id);
1794
1831
  }
1795
1832
  f.tracks.unshift({
1796
1833
  id: un(),
1797
1834
  accepts: ["text", "audio", "helper", "video", "image", "caption"],
1798
- type: "text",
1835
+ type: b,
1799
1836
  items: g,
1800
1837
  magnetic: !1,
1801
1838
  static: !1
1802
1839
  });
1803
- const b = Pn(f.trackItemsMap);
1840
+ const _ = Pn(f.trackItemsMap);
1804
1841
  t.updateState(
1805
1842
  {
1806
1843
  trackItemIds: f.trackItemIds,
1807
1844
  trackItemDetailsMap: f.trackItemDetailsMap,
1808
1845
  trackItemsMap: f.trackItemsMap,
1809
1846
  tracks: f.tracks,
1810
- duration: b
1847
+ duration: _
1811
1848
  },
1812
1849
  {
1813
1850
  updateHistory: !0,
1814
1851
  kind: "add"
1815
1852
  }
1816
1853
  );
1817
- }), R = c.subscribe(async (p) => {
1854
+ }), z = c.subscribe(async (p) => {
1818
1855
  var g;
1819
- if (p.key === Ii) {
1820
- const f = tt(t.getState()), b = f.activeIds, v = f.trackItemIds, _ = f.trackItemDetailsMap, m = v.filter(
1821
- (k) => !b.includes(k)
1822
- ), y = Object.fromEntries(
1823
- Object.entries(_).filter(
1824
- ([k]) => !b.includes(k)
1825
- )
1826
- ), F = Xi(
1827
- f.tracks,
1828
- b
1829
- ), E = Pn(f.trackItemsMap);
1830
- t.updateState(
1831
- {
1832
- trackItemIds: m,
1833
- trackItemDetailsMap: y,
1834
- activeIds: [],
1835
- tracks: F,
1836
- duration: E
1837
- },
1838
- { updateHistory: !0, kind: "remove" }
1839
- );
1840
- }
1841
1856
  if (p.key === Si) {
1842
- const f = tt(t.getState()), b = (g = p.value) == null ? void 0 : g.options.time;
1857
+ const f = tt(t.getState()), v = (g = p.value) == null ? void 0 : g.options.time;
1843
1858
  if (f.activeIds.length === 1) {
1844
- const v = f.activeIds[0], _ = f.trackItemsMap[v];
1845
- if (b >= _.display.to || b <= _.display.from) return;
1846
- const m = f.trackItemDetailsMap[v], y = Jr(), F = {
1859
+ const b = f.activeIds[0], _ = f.trackItemsMap[b];
1860
+ if (v >= _.display.to || v <= _.display.from)
1861
+ return;
1862
+ const m = f.trackItemDetailsMap[b], y = Jr(), F = {
1847
1863
  ..._,
1848
1864
  id: y,
1849
1865
  display: {
1850
- from: b,
1866
+ from: v,
1851
1867
  to: _.display.to
1852
1868
  }
1853
1869
  };
1854
- f.trackItemsMap[v].display.to = b, f.trackItemsMap[y] = F, f.trackItemIds.push(y), f.trackItemDetailsMap[y] = m, f.tracks.forEach((E) => {
1855
- E.items.includes(v) && E.items.push(y);
1870
+ f.trackItemsMap[b].display.to = v, f.trackItemsMap[y] = F, f.trackItemIds.push(y), f.trackItemDetailsMap[y] = m, f.tracks.forEach((k) => {
1871
+ k.items.includes(b) && k.items.push(y);
1856
1872
  }), t.updateState(
1857
1873
  {
1858
1874
  trackItemDetailsMap: f.trackItemDetailsMap,
@@ -1871,41 +1887,51 @@ function qi(t) {
1871
1887
  if (p.key === wi) {
1872
1888
  const f = tt(t.getState());
1873
1889
  if (f.activeIds.length) {
1874
- const b = f.activeIds, v = [], _ = {
1875
- activeIds: b,
1890
+ const v = f.activeIds, b = [], _ = {
1891
+ activeIds: v,
1876
1892
  trackItemDetailsMap: {},
1877
1893
  trackItemsMap: {},
1878
1894
  tracks: []
1879
1895
  };
1880
- b.forEach((y) => {
1881
- _.trackItemDetailsMap[y] = f.trackItemDetailsMap[y], _.trackItemsMap[y] = f.trackItemsMap[y], v.push(f.tracks.find((F) => F.items.includes(y)));
1896
+ v.forEach((y) => {
1897
+ _.trackItemDetailsMap[y] = f.trackItemDetailsMap[y], _.trackItemsMap[y] = f.trackItemsMap[y], b.push(
1898
+ f.tracks.find((F) => F.items.includes(y))
1899
+ );
1882
1900
  });
1883
1901
  const m = /* @__PURE__ */ new Set();
1884
- v.filter((y) => m.has(y.id) ? !1 : (m.add(y), !0)), _.tracks = Array.from(m.keys()), localStorage.setItem("DesignComboTemp", JSON.stringify(_));
1902
+ b.filter((y) => m.has(y.id) ? !1 : (m.add(y), !0)), _.tracks = Array.from(m.keys()), localStorage.setItem("DesignComboTemp", JSON.stringify(_));
1885
1903
  }
1886
1904
  }
1887
1905
  if (p.key === Ti) {
1888
1906
  const f = localStorage.getItem("DesignComboTemp");
1889
1907
  if (!f) return;
1890
- const b = tt(t.getState()), v = JSON.parse(f), _ = {}, m = v.trackItemsMap, y = v.trackItemDetailsMap, F = v.tracks, E = [], k = v.activeIds.map(async (z) => {
1891
- const N = y[z];
1892
- (N.type === "caption" || N.type === "text") && await cn([{ fontFamily: N.details.fontFamily, url: N.details.fontUrl }]);
1893
- const I = Jr();
1894
- return _[z] = I, b.trackItemsMap[I] = { ...m[z], id: I }, b.trackItemDetailsMap[I] = N, b.trackItemIds.push(I), !0;
1908
+ const v = tt(t.getState()), b = JSON.parse(f), _ = {}, m = b.trackItemsMap, y = b.trackItemDetailsMap, F = b.tracks, k = [], M = b.activeIds.map(async (N) => {
1909
+ const R = y[N];
1910
+ (R.type === "caption" || R.type === "text") && await cn([
1911
+ {
1912
+ fontFamily: R.details.fontFamily,
1913
+ url: R.details.fontUrl
1914
+ }
1915
+ ]);
1916
+ const S = Jr();
1917
+ return _[N] = S, v.trackItemsMap[S] = {
1918
+ ...m[N],
1919
+ id: S
1920
+ }, v.trackItemDetailsMap[S] = R, v.trackItemIds.push(S), !0;
1895
1921
  });
1896
- await Promise.all(k), F.forEach((z) => {
1897
- const N = z.items.map((x) => _[x]), I = {
1898
- ...z,
1899
- items: N,
1922
+ await Promise.all(M), F.forEach((N) => {
1923
+ const R = N.items.map((T) => _[T]), S = {
1924
+ ...N,
1925
+ items: R,
1900
1926
  id: un()
1901
1927
  };
1902
- E.push(I);
1903
- }), b.tracks = [...b.tracks, ...E], t.updateState(
1928
+ k.push(S);
1929
+ }), v.tracks = [...v.tracks, ...k], t.updateState(
1904
1930
  {
1905
- trackItemDetailsMap: b.trackItemDetailsMap,
1906
- tracks: b.tracks,
1907
- trackItemIds: b.trackItemIds,
1908
- trackItemsMap: b.trackItemsMap
1931
+ trackItemDetailsMap: v.trackItemDetailsMap,
1932
+ tracks: v.tracks,
1933
+ trackItemIds: v.trackItemIds,
1934
+ trackItemsMap: v.trackItemsMap
1909
1935
  },
1910
1936
  {
1911
1937
  updateHistory: !0,
@@ -1916,17 +1942,17 @@ function qi(t) {
1916
1942
  }), h = l.subscribe((p) => {
1917
1943
  var g, f;
1918
1944
  if (p.key === Ai) {
1919
- const b = t.getState(), v = tt(b.trackItemDetailsMap), _ = Object.keys((g = p.value) == null ? void 0 : g.payload);
1945
+ const v = t.getState(), b = tt(v.trackItemDetailsMap), _ = Object.keys((g = p.value) == null ? void 0 : g.payload);
1920
1946
  if (!_.length) return;
1921
1947
  const m = (f = p.value) == null ? void 0 : f.payload;
1922
1948
  _.forEach((y) => {
1923
- v[y].details = {
1924
- ...v[y].details,
1949
+ b[y].details = {
1950
+ ...b[y].details,
1925
1951
  ...m[y].details
1926
1952
  };
1927
1953
  }), t.updateState(
1928
1954
  {
1929
- trackItemDetailsMap: { ...v }
1955
+ trackItemDetailsMap: { ...b }
1930
1956
  },
1931
1957
  {
1932
1958
  updateHistory: !0,
@@ -1937,32 +1963,32 @@ function qi(t) {
1937
1963
  });
1938
1964
  return {
1939
1965
  unsubscribe: () => {
1940
- w.unsubscribe(), R.unsubscribe(), h.unsubscribe(), A.unsubscribe(), D.unsubscribe(), d.unsubscribe();
1966
+ w.unsubscribe(), z.unsubscribe(), h.unsubscribe(), E.unsubscribe(), D.unsubscribe(), d.unsubscribe();
1941
1967
  }
1942
1968
  };
1943
1969
  }
1944
1970
  const Ji = { Date: !0, RegExp: !0, String: !0, Number: !0 };
1945
1971
  function Jn(t, r, n = { cyclesFix: !0 }, a = []) {
1946
- var d, A;
1972
+ var d, E;
1947
1973
  let o = [];
1948
1974
  const c = Array.isArray(t);
1949
1975
  for (const D in t) {
1950
- const w = t[D], R = c ? +D : D;
1976
+ const w = t[D], z = c ? +D : D;
1951
1977
  if (!(D in r)) {
1952
1978
  o.push({
1953
1979
  type: "REMOVE",
1954
- path: [R],
1980
+ path: [z],
1955
1981
  oldValue: t[D]
1956
1982
  });
1957
1983
  continue;
1958
1984
  }
1959
1985
  const h = r[D], p = typeof w == "object" && typeof h == "object" && Array.isArray(w) === Array.isArray(h);
1960
- if (w && h && p && !Ji[(A = (d = Object.getPrototypeOf(w)) == null ? void 0 : d.constructor) == null ? void 0 : A.name] && (!n.cyclesFix || !a.includes(w))) {
1986
+ if (w && h && p && !Ji[(E = (d = Object.getPrototypeOf(w)) == null ? void 0 : d.constructor) == null ? void 0 : E.name] && (!n.cyclesFix || !a.includes(w))) {
1961
1987
  const g = Jn(w, h, n, n.cyclesFix ? a.concat([w]) : []);
1962
- o.push.apply(o, g.map((f) => (f.path.unshift(R), f)));
1988
+ o.push.apply(o, g.map((f) => (f.path.unshift(z), f)));
1963
1989
  } else w !== h && // treat NaN values as equivalent
1964
1990
  !(Number.isNaN(w) && Number.isNaN(h)) && !(p && (isNaN(w) ? w + "" == h + "" : +w == +h)) && o.push({
1965
- path: [R],
1991
+ path: [z],
1966
1992
  type: "CHANGE",
1967
1993
  value: h,
1968
1994
  oldValue: w
@@ -2008,7 +2034,7 @@ var gn = Symbol.for("immer-nothing"), fe = Symbol.for("immer-draftable"), J = Sy
2008
2034
  // Note: if more errors are added, the errorOffset in Patches.ts should be increased
2009
2035
  // See Patches.ts for additional errors
2010
2036
  ] : [];
2011
- function L(t, ...r) {
2037
+ function G(t, ...r) {
2012
2038
  if (process.env.NODE_ENV !== "production") {
2013
2039
  const n = Zn[t], a = typeof n == "function" ? n.apply(null, r) : n;
2014
2040
  throw new Error(`[Immer] ${a}`);
@@ -2101,7 +2127,7 @@ function vn(t, r = !1) {
2101
2127
  return tr(t) || xt(t) || !_t(t) || (Mt(t) > 1 && (t.set = t.add = t.clear = t.delete = ta), Object.freeze(t), r && Object.entries(t).forEach(([n, a]) => vn(a, !0))), t;
2102
2128
  }
2103
2129
  function ta() {
2104
- L(2);
2130
+ G(2);
2105
2131
  }
2106
2132
  function tr(t) {
2107
2133
  return Object.isFrozen(t);
@@ -2109,7 +2135,7 @@ function tr(t) {
2109
2135
  var ln = {};
2110
2136
  function Pt(t) {
2111
2137
  const r = ln[t];
2112
- return r || L(0, t), r;
2138
+ return r || G(0, t), r;
2113
2139
  }
2114
2140
  function ea(t, r) {
2115
2141
  ln[t] || (ln[t] = r);
@@ -2148,7 +2174,7 @@ function na(t) {
2148
2174
  function Fn(t, r) {
2149
2175
  r.unfinalizedDrafts_ = r.drafts_.length;
2150
2176
  const n = r.drafts_[0];
2151
- return t !== void 0 && t !== n ? (n[J].modified_ && (pn(r), L(4)), _t(t) && (t = qe(r, t), r.parent_ || Je(r, t)), r.patches_ && Pt("Patches").generateReplacementPatches_(
2177
+ return t !== void 0 && t !== n ? (n[J].modified_ && (pn(r), G(4)), _t(t) && (t = qe(r, t), r.parent_ || Je(r, t)), r.patches_ && Pt("Patches").generateReplacementPatches_(
2152
2178
  n[J].base_,
2153
2179
  t,
2154
2180
  r.patches_,
@@ -2174,7 +2200,7 @@ function qe(t, r, n) {
2174
2200
  let c = o, l = !1;
2175
2201
  a.type_ === 3 && (c = new Set(o), o.clear(), l = !0), le(
2176
2202
  c,
2177
- (d, A) => Rn(t, a, o, d, A, n, l)
2203
+ (d, E) => Rn(t, a, o, d, E, n, l)
2178
2204
  ), Je(t, o, !1), n && t.patches_ && Pt("Patches").generatePatches_(
2179
2205
  a,
2180
2206
  n,
@@ -2185,10 +2211,10 @@ function qe(t, r, n) {
2185
2211
  return a.copy_;
2186
2212
  }
2187
2213
  function Rn(t, r, n, a, o, c, l) {
2188
- if (process.env.NODE_ENV !== "production" && o === n && L(5), xt(o)) {
2214
+ if (process.env.NODE_ENV !== "production" && o === n && G(5), xt(o)) {
2189
2215
  const d = c && r && r.type_ !== 3 && // Set objects are atomic since they have no keys.
2190
- !pe(r.assigned_, a) ? c.concat(a) : void 0, A = qe(t, o, d);
2191
- if (ti(n, a, A), xt(A))
2216
+ !pe(r.assigned_, a) ? c.concat(a) : void 0, E = qe(t, o, d);
2217
+ if (ti(n, a, E), xt(E))
2192
2218
  t.canAutoFreeze_ = !1;
2193
2219
  else
2194
2220
  return;
@@ -2278,13 +2304,13 @@ var In = {
2278
2304
  };
2279
2305
  },
2280
2306
  defineProperty() {
2281
- L(11);
2307
+ G(11);
2282
2308
  },
2283
2309
  getPrototypeOf(t) {
2284
2310
  return Ot(t.base_);
2285
2311
  },
2286
2312
  setPrototypeOf() {
2287
- L(12);
2313
+ G(12);
2288
2314
  }
2289
2315
  }, he = {};
2290
2316
  le(In, (t, r) => {
@@ -2293,10 +2319,10 @@ le(In, (t, r) => {
2293
2319
  };
2294
2320
  });
2295
2321
  he.deleteProperty = function(t, r) {
2296
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(r)) && L(13), he.set.call(this, t, r, void 0);
2322
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(r)) && G(13), he.set.call(this, t, r, void 0);
2297
2323
  };
2298
2324
  he.set = function(t, r, n) {
2299
- return process.env.NODE_ENV !== "production" && r !== "length" && isNaN(parseInt(r)) && L(14), In.set.call(this, t[0], r, n, t[0]);
2325
+ return process.env.NODE_ENV !== "production" && r !== "length" && isNaN(parseInt(r)) && G(14), In.set.call(this, t[0], r, n, t[0]);
2300
2326
  };
2301
2327
  function Qr(t, r) {
2302
2328
  const n = t[J];
@@ -2338,11 +2364,11 @@ var sa = class {
2338
2364
  const c = n;
2339
2365
  n = r;
2340
2366
  const l = this;
2341
- return function(A = c, ...D) {
2342
- return l.produce(A, (w) => n.call(this, w, ...D));
2367
+ return function(E = c, ...D) {
2368
+ return l.produce(E, (w) => n.call(this, w, ...D));
2343
2369
  };
2344
2370
  }
2345
- typeof n != "function" && L(6), a !== void 0 && typeof a != "function" && L(7);
2371
+ typeof n != "function" && G(6), a !== void 0 && typeof a != "function" && G(7);
2346
2372
  let o;
2347
2373
  if (_t(r)) {
2348
2374
  const c = jn(this), l = yn(r, void 0);
@@ -2360,10 +2386,10 @@ var sa = class {
2360
2386
  }
2361
2387
  return o;
2362
2388
  } else
2363
- L(1, r);
2389
+ G(1, r);
2364
2390
  }, this.produceWithPatches = (r, n) => {
2365
2391
  if (typeof r == "function")
2366
- return (l, ...d) => this.produceWithPatches(l, (A) => r(A, ...d));
2392
+ return (l, ...d) => this.produceWithPatches(l, (E) => r(E, ...d));
2367
2393
  let a, o;
2368
2394
  return [this.produce(r, n, (l, d) => {
2369
2395
  a = l, o = d;
@@ -2371,13 +2397,13 @@ var sa = class {
2371
2397
  }, typeof (t == null ? void 0 : t.autoFreeze) == "boolean" && this.setAutoFreeze(t.autoFreeze), typeof (t == null ? void 0 : t.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(t.useStrictShallowCopy);
2372
2398
  }
2373
2399
  createDraft(t) {
2374
- _t(t) || L(8), xt(t) && (t = oa(t));
2400
+ _t(t) || G(8), xt(t) && (t = oa(t));
2375
2401
  const r = jn(this), n = yn(t, void 0);
2376
2402
  return n[J].isManual_ = !0, dn(r), n;
2377
2403
  }
2378
2404
  finishDraft(t, r) {
2379
2405
  const n = t && t[J];
2380
- (!n || !n.isManual_) && L(9);
2406
+ (!n || !n.isManual_) && G(9);
2381
2407
  const { scope_: a } = n;
2382
2408
  return Cn(a, r), Fn(void 0, a);
2383
2409
  }
@@ -2419,7 +2445,7 @@ function yn(t, r) {
2419
2445
  return (r ? r.scope_ : ei()).drafts_.push(n), n;
2420
2446
  }
2421
2447
  function oa(t) {
2422
- return xt(t) || L(10, t), ni(t);
2448
+ return xt(t) || G(10, t), ni(t);
2423
2449
  }
2424
2450
  function ni(t) {
2425
2451
  if (!_t(t) || tr(t))
@@ -2470,34 +2496,34 @@ function zn() {
2470
2496
  }
2471
2497
  }
2472
2498
  function c(h, p, g, f) {
2473
- let { base_: b, assigned_: v } = h, _ = h.copy_;
2474
- _.length < b.length && ([b, _] = [_, b], [g, f] = [f, g]);
2475
- for (let m = 0; m < b.length; m++)
2476
- if (v[m] && _[m] !== b[m]) {
2499
+ let { base_: v, assigned_: b } = h, _ = h.copy_;
2500
+ _.length < v.length && ([v, _] = [_, v], [g, f] = [f, g]);
2501
+ for (let m = 0; m < v.length; m++)
2502
+ if (b[m] && _[m] !== v[m]) {
2477
2503
  const y = p.concat([m]);
2478
2504
  g.push({
2479
2505
  op: r,
2480
2506
  path: y,
2481
2507
  // Need to maybe clone it, as it can in fact be the original value
2482
2508
  // due to the base/copy inversion at the start of this function
2483
- value: R(_[m])
2509
+ value: z(_[m])
2484
2510
  }), f.push({
2485
2511
  op: r,
2486
2512
  path: y,
2487
- value: R(b[m])
2513
+ value: z(v[m])
2488
2514
  });
2489
2515
  }
2490
- for (let m = b.length; m < _.length; m++) {
2516
+ for (let m = v.length; m < _.length; m++) {
2491
2517
  const y = p.concat([m]);
2492
2518
  g.push({
2493
2519
  op: n,
2494
2520
  path: y,
2495
2521
  // Need to maybe clone it, as it can in fact be the original value
2496
2522
  // due to the base/copy inversion at the start of this function
2497
- value: R(_[m])
2523
+ value: z(_[m])
2498
2524
  });
2499
2525
  }
2500
- for (let m = _.length - 1; b.length <= m; --m) {
2526
+ for (let m = _.length - 1; v.length <= m; --m) {
2501
2527
  const y = p.concat([m]);
2502
2528
  f.push({
2503
2529
  op: a,
@@ -2506,21 +2532,21 @@ function zn() {
2506
2532
  }
2507
2533
  }
2508
2534
  function l(h, p, g, f) {
2509
- const { base_: b, copy_: v } = h;
2535
+ const { base_: v, copy_: b } = h;
2510
2536
  le(h.assigned_, (_, m) => {
2511
- const y = Zr(b, _), F = Zr(v, _), E = m ? pe(b, _) ? r : n : a;
2512
- if (y === F && E === r)
2537
+ const y = Zr(v, _), F = Zr(b, _), k = m ? pe(v, _) ? r : n : a;
2538
+ if (y === F && k === r)
2513
2539
  return;
2514
- const k = p.concat(_);
2515
- g.push(E === a ? { op: E, path: k } : { op: E, path: k, value: F }), f.push(
2516
- E === n ? { op: a, path: k } : E === a ? { op: n, path: k, value: R(y) } : { op: r, path: k, value: R(y) }
2540
+ const M = p.concat(_);
2541
+ g.push(k === a ? { op: k, path: M } : { op: k, path: M, value: F }), f.push(
2542
+ k === n ? { op: a, path: M } : k === a ? { op: n, path: M, value: z(y) } : { op: r, path: M, value: z(y) }
2517
2543
  );
2518
2544
  });
2519
2545
  }
2520
2546
  function d(h, p, g, f) {
2521
- let { base_: b, copy_: v } = h, _ = 0;
2522
- b.forEach((m) => {
2523
- if (!v.has(m)) {
2547
+ let { base_: v, copy_: b } = h, _ = 0;
2548
+ v.forEach((m) => {
2549
+ if (!b.has(m)) {
2524
2550
  const y = p.concat([_]);
2525
2551
  g.push({
2526
2552
  op: a,
@@ -2533,8 +2559,8 @@ function zn() {
2533
2559
  });
2534
2560
  }
2535
2561
  _++;
2536
- }), _ = 0, v.forEach((m) => {
2537
- if (!b.has(m)) {
2562
+ }), _ = 0, b.forEach((m) => {
2563
+ if (!v.has(m)) {
2538
2564
  const y = p.concat([_]);
2539
2565
  g.push({
2540
2566
  op: n,
@@ -2549,7 +2575,7 @@ function zn() {
2549
2575
  _++;
2550
2576
  });
2551
2577
  }
2552
- function A(h, p, g, f) {
2578
+ function E(h, p, g, f) {
2553
2579
  g.push({
2554
2580
  op: r,
2555
2581
  path: [],
@@ -2562,48 +2588,48 @@ function zn() {
2562
2588
  }
2563
2589
  function D(h, p) {
2564
2590
  return p.forEach((g) => {
2565
- const { path: f, op: b } = g;
2566
- let v = h;
2591
+ const { path: f, op: v } = g;
2592
+ let b = h;
2567
2593
  for (let F = 0; F < f.length - 1; F++) {
2568
- const E = Mt(v);
2569
- let k = f[F];
2570
- typeof k != "string" && typeof k != "number" && (k = "" + k), (E === 0 || E === 1) && (k === "__proto__" || k === "constructor") && L(19), typeof v == "function" && k === "prototype" && L(19), v = Zr(v, k), typeof v != "object" && L(18, f.join("/"));
2594
+ const k = Mt(b);
2595
+ let M = f[F];
2596
+ typeof M != "string" && typeof M != "number" && (M = "" + M), (k === 0 || k === 1) && (M === "__proto__" || M === "constructor") && G(19), typeof b == "function" && M === "prototype" && G(19), b = Zr(b, M), typeof b != "object" && G(18, f.join("/"));
2571
2597
  }
2572
- const _ = Mt(v), m = w(g.value), y = f[f.length - 1];
2573
- switch (b) {
2598
+ const _ = Mt(b), m = w(g.value), y = f[f.length - 1];
2599
+ switch (v) {
2574
2600
  case r:
2575
2601
  switch (_) {
2576
2602
  case 2:
2577
- return v.set(y, m);
2603
+ return b.set(y, m);
2578
2604
  case 3:
2579
- L(16);
2605
+ G(16);
2580
2606
  default:
2581
- return v[y] = m;
2607
+ return b[y] = m;
2582
2608
  }
2583
2609
  case n:
2584
2610
  switch (_) {
2585
2611
  case 1:
2586
- return y === "-" ? v.push(m) : v.splice(y, 0, m);
2612
+ return y === "-" ? b.push(m) : b.splice(y, 0, m);
2587
2613
  case 2:
2588
- return v.set(y, m);
2614
+ return b.set(y, m);
2589
2615
  case 3:
2590
- return v.add(m);
2616
+ return b.add(m);
2591
2617
  default:
2592
- return v[y] = m;
2618
+ return b[y] = m;
2593
2619
  }
2594
2620
  case a:
2595
2621
  switch (_) {
2596
2622
  case 1:
2597
- return v.splice(y, 1);
2623
+ return b.splice(y, 1);
2598
2624
  case 2:
2599
- return v.delete(y);
2625
+ return b.delete(y);
2600
2626
  case 3:
2601
- return v.delete(g.value);
2627
+ return b.delete(g.value);
2602
2628
  default:
2603
- return delete v[y];
2629
+ return delete b[y];
2604
2630
  }
2605
2631
  default:
2606
- L(17, b);
2632
+ G(17, v);
2607
2633
  }
2608
2634
  }), h;
2609
2635
  }
@@ -2623,13 +2649,13 @@ function zn() {
2623
2649
  p[g] = w(h[g]);
2624
2650
  return pe(h, fe) && (p[fe] = h[fe]), p;
2625
2651
  }
2626
- function R(h) {
2652
+ function z(h) {
2627
2653
  return xt(h) ? w(h) : h;
2628
2654
  }
2629
2655
  ea("Patches", {
2630
2656
  applyPatches_: D,
2631
2657
  generatePatches_: o,
2632
- generateReplacementPatches_: A
2658
+ generateReplacementPatches_: E
2633
2659
  });
2634
2660
  }
2635
2661
  var Z = new sa(), ca = Z.produce;
@@ -2665,7 +2691,7 @@ function Ia(t, r) {
2665
2691
  t[o + n] = r[n];
2666
2692
  return t;
2667
2693
  }
2668
- var Sn = Object.prototype, Sa = Sn.hasOwnProperty, wn = Sn.toString, Nn = _a.Symbol, wa = Sn.propertyIsEnumerable, Hn = Nn ? Nn.isConcatSpreadable : void 0, Un = Math.max;
2694
+ var Sn = Object.prototype, Sa = Sn.hasOwnProperty, wn = Sn.toString, Nn = _a.Symbol, wa = Sn.propertyIsEnumerable, Hn = Nn ? Nn.isConcatSpreadable : void 0, Ln = Math.max;
2669
2695
  function Ta(t, r, n, a, o) {
2670
2696
  var c = -1, l = t.length;
2671
2697
  for (n || (n = Oa), o || (o = []); ++c < l; ) {
@@ -2687,8 +2713,8 @@ function Ea(t, r, n) {
2687
2713
  return c;
2688
2714
  }
2689
2715
  function ka(t, r) {
2690
- return r = Un(r === void 0 ? t.length - 1 : r, 0), function() {
2691
- for (var n = arguments, a = -1, o = Un(n.length - r, 0), c = Array(o); ++a < o; )
2716
+ return r = Ln(r === void 0 ? t.length - 1 : r, 0), function() {
2717
+ for (var n = arguments, a = -1, o = Ln(n.length - r, 0), c = Array(o); ++a < o; )
2692
2718
  c[a] = n[r + a];
2693
2719
  a = -1;
2694
2720
  for (var l = Array(r + 1); ++a < r; )
@@ -2735,7 +2761,7 @@ function za(t) {
2735
2761
  var Na = ka(function(t, r) {
2736
2762
  return t == null ? {} : Aa(t, va(Ta(r), xa));
2737
2763
  }), Ha = Na;
2738
- const Ln = /* @__PURE__ */ mn(Ha), Ua = {
2764
+ const Un = /* @__PURE__ */ mn(Ha), La = {
2739
2765
  tracks: [],
2740
2766
  trackItemIds: [],
2741
2767
  trackItemsMap: {},
@@ -2765,7 +2791,7 @@ class Ba {
2765
2791
  Et(this, "undos", []);
2766
2792
  Et(this, "redos", []);
2767
2793
  Et(this, "listener");
2768
- const n = r || Ua;
2794
+ const n = r || La;
2769
2795
  this.stateSubject = new Mn(n), this.stateHistorySubject = new Mn({
2770
2796
  handleRedo: !1,
2771
2797
  handleUndo: !1
@@ -2781,7 +2807,7 @@ class Ba {
2781
2807
  this.destroyListeners();
2782
2808
  }
2783
2809
  updateHistory(r, n) {
2784
- const a = Ln(r, Gn), o = Ln(this.getState(), Gn), c = Jn(o, a);
2810
+ const a = Un(r, Gn), o = Un(this.getState(), Gn), c = Jn(o, a);
2785
2811
  c.length && (this.undos.push({ undos: c, type: n }), this.redos = []);
2786
2812
  }
2787
2813
  getStateHistory() {
@@ -2868,36 +2894,36 @@ class Ba {
2868
2894
  trackItemIds: c,
2869
2895
  tracks: l,
2870
2896
  transitionIds: d,
2871
- transitionsMap: A,
2897
+ transitionsMap: E,
2872
2898
  trackItemsMap: D
2873
2899
  } = this.getState(), w = tt({
2874
2900
  trackItemDetailsMap: o,
2875
2901
  trackItemIds: c,
2876
2902
  tracks: l,
2877
2903
  transitionIds: d,
2878
- transitionsMap: A,
2904
+ transitionsMap: E,
2879
2905
  trackItemsMap: D
2880
- }), R = [], h = [], p = [], g = [], f = [], b = [];
2881
- n.forEach((I) => {
2882
- let x;
2883
- const V = I.path.slice(1);
2884
- I.type === "CREATE" ? x = {
2885
- path: V,
2906
+ }), z = [], h = [], p = [], g = [], f = [], v = [];
2907
+ n.forEach((S) => {
2908
+ let T;
2909
+ const H = S.path.slice(1);
2910
+ S.type === "CREATE" ? T = {
2911
+ path: H,
2886
2912
  op: "remove",
2887
- value: I.value
2888
- } : I.type === "CHANGE" ? x = {
2889
- path: V,
2913
+ value: S.value
2914
+ } : S.type === "CHANGE" ? T = {
2915
+ path: H,
2890
2916
  op: "replace",
2891
- value: I.oldValue
2892
- } : x = {
2893
- path: V,
2917
+ value: S.oldValue
2918
+ } : T = {
2919
+ path: H,
2894
2920
  op: "add",
2895
- value: I.oldValue
2896
- }, I.path.includes("trackItemIds") ? p.push(x) : I.path.includes("transitionIds") ? h.push(x) : I.path.includes("trackItemsMap") ? f.push(x) : I.path.includes("transitionsMap") ? g.push(x) : I.path.includes("tracks") ? R.push(x) : I.path.includes("trackItemDetailsMap") && b.push(x);
2921
+ value: S.oldValue
2922
+ }, S.path.includes("trackItemIds") ? p.push(T) : S.path.includes("transitionIds") ? h.push(T) : S.path.includes("trackItemsMap") ? f.push(T) : S.path.includes("transitionsMap") ? g.push(T) : S.path.includes("tracks") ? z.push(T) : S.path.includes("trackItemDetailsMap") && v.push(T);
2897
2923
  });
2898
- const v = this.applyPatch(
2924
+ const b = this.applyPatch(
2899
2925
  w.tracks,
2900
- R
2926
+ z
2901
2927
  ), _ = this.applyPatch(
2902
2928
  w.transitionIds,
2903
2929
  h
@@ -2910,18 +2936,18 @@ class Ba {
2910
2936
  ), F = this.applyPatch(
2911
2937
  w.trackItemsMap,
2912
2938
  f
2913
- ), E = this.applyPatch(
2939
+ ), k = this.applyPatch(
2914
2940
  w.trackItemDetailsMap,
2915
- b
2916
- ), k = tt({
2917
- tracks: v,
2941
+ v
2942
+ ), M = tt({
2943
+ tracks: b,
2918
2944
  transitionIds: _,
2919
2945
  trackItemIds: m,
2920
2946
  transitionsMap: y,
2921
2947
  trackItemsMap: F,
2922
- trackItemDetailsMap: E
2923
- }), z = tt(this.getState()), N = { ...z, ...k };
2924
- this.prevState = z, this.redos.push({ redos: n, type: a }), this.stateSubject.next(N), this.stateHistorySubject.next({ handleRedo: !1, handleUndo: !0 });
2948
+ trackItemDetailsMap: k
2949
+ }), N = tt(this.getState()), R = { ...N, ...M };
2950
+ this.prevState = N, this.redos.push({ redos: n, type: a }), this.stateSubject.next(R), this.stateHistorySubject.next({ handleRedo: !1, handleUndo: !0 });
2925
2951
  }
2926
2952
  applyPatch(r, n) {
2927
2953
  return n.reverse().reduce((a, o) => ca(a, (c) => {
@@ -2937,36 +2963,36 @@ class Ba {
2937
2963
  trackItemIds: c,
2938
2964
  tracks: l,
2939
2965
  transitionIds: d,
2940
- transitionsMap: A,
2966
+ transitionsMap: E,
2941
2967
  trackItemsMap: D
2942
2968
  } = this.getState(), w = tt({
2943
2969
  trackItemDetailsMap: o,
2944
2970
  trackItemIds: c,
2945
2971
  tracks: l,
2946
2972
  transitionIds: d,
2947
- transitionsMap: A,
2973
+ transitionsMap: E,
2948
2974
  trackItemsMap: D
2949
- }), R = [], h = [], p = [], g = [], f = [], b = [];
2950
- n.forEach((I) => {
2951
- let x;
2952
- const V = I.path.slice(1);
2953
- I.type === "CREATE" ? x = {
2954
- path: V,
2975
+ }), z = [], h = [], p = [], g = [], f = [], v = [];
2976
+ n.forEach((S) => {
2977
+ let T;
2978
+ const H = S.path.slice(1);
2979
+ S.type === "CREATE" ? T = {
2980
+ path: H,
2955
2981
  op: "add",
2956
- value: I.value
2957
- } : I.type === "CHANGE" ? x = {
2958
- path: V,
2982
+ value: S.value
2983
+ } : S.type === "CHANGE" ? T = {
2984
+ path: H,
2959
2985
  op: "replace",
2960
- value: I.value
2961
- } : x = {
2962
- path: V,
2986
+ value: S.value
2987
+ } : T = {
2988
+ path: H,
2963
2989
  op: "remove",
2964
- value: I.oldValue
2965
- }, I.path.includes("trackItemIds") ? p.push(x) : I.path.includes("transitionIds") ? h.push(x) : I.path.includes("trackItemsMap") ? f.push(x) : I.path.includes("transitionsMap") ? g.push(x) : I.path.includes("trackItemDetailsMap") ? b.push(x) : R.push(x);
2990
+ value: S.oldValue
2991
+ }, S.path.includes("trackItemIds") ? p.push(T) : S.path.includes("transitionIds") ? h.push(T) : S.path.includes("trackItemsMap") ? f.push(T) : S.path.includes("transitionsMap") ? g.push(T) : S.path.includes("trackItemDetailsMap") ? v.push(T) : z.push(T);
2966
2992
  });
2967
- const v = this.applyPatch(
2993
+ const b = this.applyPatch(
2968
2994
  w.tracks,
2969
- R
2995
+ z
2970
2996
  ), _ = this.applyPatch(
2971
2997
  w.transitionIds,
2972
2998
  h
@@ -2979,18 +3005,18 @@ class Ba {
2979
3005
  ), F = this.applyPatch(
2980
3006
  w.trackItemsMap,
2981
3007
  f
2982
- ), E = this.applyPatch(
3008
+ ), k = this.applyPatch(
2983
3009
  w.trackItemDetailsMap,
2984
- b
2985
- ), k = tt({
2986
- tracks: v,
3010
+ v
3011
+ ), M = tt({
3012
+ tracks: b,
2987
3013
  transitionIds: _,
2988
3014
  trackItemIds: m,
2989
3015
  transitionsMap: y,
2990
3016
  trackItemsMap: F,
2991
- trackItemDetailsMap: E
2992
- }), z = tt(this.getState()), N = { ...z, ...k };
2993
- this.prevState = z, this.undos.push({ undos: n, type: a }), this.stateSubject.next(N), this.stateHistorySubject.next({ handleRedo: !0, handleUndo: !1 });
3017
+ trackItemDetailsMap: k
3018
+ }), N = tt(this.getState()), R = { ...N, ...M };
3019
+ this.prevState = N, this.undos.push({ undos: n, type: a }), this.stateSubject.next(R), this.stateHistorySubject.next({ handleRedo: !0, handleUndo: !1 });
2994
3020
  }
2995
3021
  }
2996
3022
  export {