@designcombo/state 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.es.js +1512 -1396
- package/dist/index.umd.js +3 -3
- package/dist/state.d.ts +1 -0
- package/dist/utils/duration.d.ts +3 -0
- package/dist/utils/generate-id.d.ts +1 -0
- package/dist/utils/load-item.d.ts +4 -3
- package/dist/utils/track.d.ts +1 -2
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
(function(
|
2
|
-
`+n.map(function(o
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function or(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var ge=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,o,a,u;if(!this.closed){this.closed=!0;var f=this._parentage;if(f)if(this._parentage=null,Array.isArray(f))try{for(var p=er(f),w=p.next();!w.done;w=p.next()){var _=w.value;_.remove(this)}}catch(y){r={error:y}}finally{try{w&&!w.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}else f.remove(this);var d=this.initialTeardown;if(pt(d))try{d()}catch(y){u=y instanceof ir?y.errors:[y]}var E=this._finalizers;if(E){this._finalizers=null;try{for(var l=er(E),g=l.next();!g.done;g=l.next()){var v=g.value;try{wn(v)}catch(y){u=u??[],y instanceof ir?u=nr(nr([],rr(u)),rr(y.errors)):u.push(y)}}}catch(y){o={error:y}}finally{try{g&&!g.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}}if(u)throw new ir(u)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)wn(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)&&or(n,r)},t.prototype.remove=function(r){var n=this._finalizers;n&&or(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=function(){var r=new t;return r.closed=!0,r}(),t}(),Sn=ge.EMPTY;function In(t){return t instanceof ge||t&&"closed"in t&&pt(t.remove)&&pt(t.add)&&pt(t.unsubscribe)}function wn(t){pt(t)?t():t.unsubscribe()}var Tn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},An={setTimeout:function(t,r){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return setTimeout.apply(void 0,nr([t,r],rr(n)))},clearTimeout:function(t){var r=An.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function ti(t){An.setTimeout(function(){throw t})}function En(){}function me(t){t()}var On=function(t){ot(r,t);function r(n){var o=t.call(this)||this;return o.isStopped=!1,n?(o.destination=n,In(n)&&n.add(o)):o.destination=ii,o}return r.create=function(n,o,a){return new ar(n,o,a)},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}(ge),ei=Function.prototype.bind;function sr(t,r){return ei.call(t,r)}var ri=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(o){ve(o)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(o){ve(o)}else ve(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){ve(n)}},t}(),ar=function(t){ot(r,t);function r(n,o,a){var u=t.call(this)||this,f;if(pt(n)||!n)f={next:n??void 0,error:o??void 0,complete:a??void 0};else{var p;u&&Tn.useDeprecatedNextContext?(p=Object.create(n),p.unsubscribe=function(){return u.unsubscribe()},f={next:n.next&&sr(n.next,p),error:n.error&&sr(n.error,p),complete:n.complete&&sr(n.complete,p)}):f=n}return u.destination=new ri(f),u}return r}(On);function ve(t){ti(t)}function ni(t){throw t}var ii={closed:!0,next:En,error:ni,complete:En},oi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function si(t){return t}function ai(t){return t.length===0?si:t.length===1?t[0]:function(n){return t.reduce(function(o,a){return a(o)},n)}}var xn=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,o){var a=this,u=ui(r)?r:new ar(r,n,o);return me(function(){var f=a,p=f.operator,w=f.source;u.add(p?p.call(u,w):w?a._subscribe(u):a._trySubscribe(u))}),u},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var o=this;return n=Pn(n),new n(function(a,u){var f=new ar({next:function(p){try{r(p)}catch(w){u(w),f.unsubscribe()}},error:u,complete:a});o.subscribe(f)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[oi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return ai(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Pn(r),new r(function(o,a){var u;n.subscribe(function(f){return u=f},function(f){return a(f)},function(){return o(u)})})},t.create=function(r){return new t(r)},t}();function Pn(t){var r;return(r=t??Tn.Promise)!==null&&r!==void 0?r:Promise}function ci(t){return t&&pt(t.next)&&pt(t.error)&&pt(t.complete)}function ui(t){return t&&t instanceof On||ci(t)&&In(t)}var fi=vn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Mn=function(t){ot(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 o=new Cn(this,this);return o.operator=n,o},r.prototype._throwIfClosed=function(){if(this.closed)throw new fi},r.prototype.next=function(n){var o=this;me(function(){var a,u;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var f=er(o.currentObservers),p=f.next();!p.done;p=f.next()){var w=p.value;w.next(n)}}catch(_){a={error:_}}finally{try{p&&!p.done&&(u=f.return)&&u.call(f)}finally{if(a)throw a.error}}}})},r.prototype.error=function(n){var o=this;me(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=n;for(var a=o.observers;a.length;)a.shift().error(n)}})},r.prototype.complete=function(){var n=this;me(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var o=n.observers;o.length;)o.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 o=this,a=this,u=a.hasError,f=a.isStopped,p=a.observers;return u||f?Sn:(this.currentObservers=null,p.push(n),new ge(function(){o.currentObservers=null,or(p,n)}))},r.prototype._checkFinalizedStatuses=function(n){var o=this,a=o.hasError,u=o.thrownError,f=o.isStopped;a?n.error(u):f&&n.complete()},r.prototype.asObservable=function(){var n=new xn;return n.source=this,n},r.create=function(n,o){return new Cn(n,o)},r}(xn),Cn=function(t){ot(r,t);function r(n,o){var a=t.call(this)||this;return a.destination=n,a.source=o,a}return r.prototype.next=function(n){var o,a;(a=(o=this.destination)===null||o===void 0?void 0:o.next)===null||a===void 0||a.call(o,n)},r.prototype.error=function(n){var o,a;(a=(o=this.destination)===null||o===void 0?void 0:o.error)===null||a===void 0||a.call(o,n)},r.prototype.complete=function(){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||o===void 0||o.call(n)},r.prototype._subscribe=function(n){var o,a;return(a=(o=this.source)===null||o===void 0?void 0:o.subscribe(n))!==null&&a!==void 0?a:Sn},r}(Mn),kn=function(t){ot(r,t);function r(n){var o=t.call(this)||this;return o._value=n,o}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var o=t.prototype._subscribe.call(this,n);return!o.closed&&n.next(this._value),o},r.prototype.getValue=function(){var n=this,o=n.hasError,a=n.thrownError,u=n._value;if(o)throw a;return this._throwIfClosed(),u},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Mn),Q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Se={exports:{}};Se.exports,function(t,r){var n=200,o="__lodash_hash_undefined__",a=1,u=2,f=9007199254740991,p="[object Arguments]",w="[object Array]",_="[object AsyncFunction]",d="[object Boolean]",E="[object Date]",l="[object Error]",g="[object Function]",v="[object GeneratorFunction]",y="[object Map]",T="[object Number]",S="[object Null]",m="[object Object]",h="[object Promise]",A="[object Proxy]",G="[object RegExp]",R="[object Set]",F="[object String]",at="[object Symbol]",mt="[object Undefined]",M="[object WeakMap]",j="[object ArrayBuffer]",V="[object DataView]",Oe="[object Float32Array]",xe="[object Float64Array]",Pe="[object Int8Array]",Ar="[object Int16Array]",Er="[object Int32Array]",Or="[object Uint8Array]",xr="[object Uint8ClampedArray]",k="[object Uint16Array]",Pr="[object Uint32Array]",Mr=/[\\^$.*+?()[\]{}|]/g,et=/^\[object .+?Constructor\]$/,Me=/^(?:0|[1-9]\d*)$/,D={};D[Oe]=D[xe]=D[Pe]=D[Ar]=D[Er]=D[Or]=D[xr]=D[k]=D[Pr]=!0,D[p]=D[w]=D[j]=D[d]=D[V]=D[E]=D[l]=D[g]=D[y]=D[T]=D[m]=D[G]=D[R]=D[F]=D[M]=!1;var Ce=typeof Q=="object"&&Q&&Q.Object===Object&&Q,Cr=typeof self=="object"&&self&&self.Object===Object&&self,rt=Ce||Cr||Function("return this")(),ke=r&&!r.nodeType&&r,De=ke&&!0&&t&&!t.nodeType&&t,Qt=De&&De.exports===ke,te=Qt&&Ce.process,je=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ee=je&&je.isTypedArray;function Fe(e,i){for(var s=-1,c=e==null?0:e.length,I=0,b=[];++s<c;){var x=e[s];i(x,s,e)&&(b[I++]=x)}return b}function re(e,i){for(var s=-1,c=i.length,I=e.length;++s<c;)e[I+s]=i[s];return e}function Re(e,i){for(var s=-1,c=e==null?0:e.length;++s<c;)if(i(e[s],s,e))return!0;return!1}function kr(e,i){for(var s=-1,c=Array(e);++s<e;)c[s]=i(s);return c}function Dr(e){return function(i){return e(i)}}function Ft(e,i){return e.has(i)}function ne(e,i){return e==null?void 0:e[i]}function ze(e){var i=-1,s=Array(e.size);return e.forEach(function(c,I){s[++i]=[I,c]}),s}function He(e,i){return function(s){return e(i(s))}}function ct(e){var i=-1,s=Array(e.size);return e.forEach(function(c){s[++i]=c}),s}var Rt=Array.prototype,jr=Function.prototype,Ot=Object.prototype,zt=rt["__core-js_shared__"],ie=jr.toString,tt=Ot.hasOwnProperty,Ne=function(){var e=/[^.]+$/.exec(zt&&zt.keys&&zt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=Ot.toString,Fr=RegExp("^"+ie.call(tt).replace(Mr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=Qt?rt.Buffer:void 0,Ht=rt.Symbol,Le=rt.Uint8Array,Nt=Ot.propertyIsEnumerable,xt=Rt.splice,nt=Ht?Ht.toStringTag:void 0,Ut=Object.getOwnPropertySymbols,se=oe?oe.isBuffer:void 0,Pt=He(Object.keys,Object),ae=yt(rt,"DataView"),Mt=yt(rt,"Map"),ce=yt(rt,"Promise"),ue=yt(rt,"Set"),fe=yt(rt,"WeakMap"),vt=yt(Object,"create"),Ge=Y(ae),ht=Y(Mt),Rr=Y(ce),zr=Y(ue),Hr=Y(fe),Be=Ht?Ht.prototype:void 0,le=Be?Be.valueOf:void 0;function U(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Nr(){this.__data__=vt?vt(null):{},this.size=0}function Ur(e){var i=this.has(e)&&delete this.__data__[e];return this.size-=i?1:0,i}function Lr(e){var i=this.__data__;if(vt){var s=i[e];return s===o?void 0:s}return tt.call(i,e)?i[e]:void 0}function Gr(e){var i=this.__data__;return vt?i[e]!==void 0:tt.call(i,e)}function Br(e,i){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=vt&&i===void 0?o:i,this}U.prototype.clear=Nr,U.prototype.delete=Ur,U.prototype.get=Lr,U.prototype.has=Gr,U.prototype.set=Br;function B(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Wr(){this.__data__=[],this.size=0}function $r(e){var i=this.__data__,s=Bt(i,e);if(s<0)return!1;var c=i.length-1;return s==c?i.pop():xt.call(i,s,1),--this.size,!0}function Kr(e){var i=this.__data__,s=Bt(i,e);return s<0?void 0:i[s][1]}function Vr(e){return Bt(this.__data__,e)>-1}function Yr(e,i){var s=this.__data__,c=Bt(s,e);return c<0?(++this.size,s.push([e,i])):s[c][1]=i,this}B.prototype.clear=Wr,B.prototype.delete=$r,B.prototype.get=Kr,B.prototype.has=Vr,B.prototype.set=Yr;function X(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Xr(){this.size=0,this.__data__={hash:new U,map:new(Mt||B),string:new U}}function qr(e){var i=it(this,e).delete(e);return this.size-=i?1:0,i}function Jr(e){return it(this,e).get(e)}function Zr(e){return it(this,e).has(e)}function Qr(e,i){var s=it(this,e),c=s.size;return s.set(e,i),this.size+=s.size==c?0:1,this}X.prototype.clear=Xr,X.prototype.delete=qr,X.prototype.get=Jr,X.prototype.has=Zr,X.prototype.set=Qr;function Lt(e){var i=-1,s=e==null?0:e.length;for(this.__data__=new X;++i<s;)this.add(e[i])}function We(e){return this.__data__.set(e,o),this}function Gt(e){return this.__data__.has(e)}Lt.prototype.add=Lt.prototype.push=We,Lt.prototype.has=Gt;function ut(e){var i=this.__data__=new B(e);this.size=i.size}function pe(){this.__data__=new B,this.size=0}function tn(e){var i=this.__data__,s=i.delete(e);return this.size=i.size,s}function en(e){return this.__data__.get(e)}function rn(e){return this.__data__.has(e)}function nn(e,i){var s=this.__data__;if(s instanceof B){var c=s.__data__;if(!Mt||c.length<n-1)return c.push([e,i]),this.size=++s.size,this;s=this.__data__=new X(c)}return s.set(e,i),this.size=s.size,this}ut.prototype.clear=pe,ut.prototype.delete=tn,ut.prototype.get=en,ut.prototype.has=rn,ut.prototype.set=nn;function on(e,i){var s=Wt(e),c=!s&&Xe(e),I=!s&&!c&&$t(e),b=!s&&!c&&!I&&Ze(e),x=s||c||I||b,O=x?kr(e.length,String):[],z=O.length;for(var C in e)tt.call(e,C)&&!(x&&(C=="length"||I&&(C=="offset"||C=="parent")||b&&(C=="buffer"||C=="byteLength"||C=="byteOffset")||dn(C,z)))&&O.push(C);return O}function Bt(e,i){for(var s=e.length;s--;)if(Ye(e[s][0],i))return s;return-1}function de(e,i,s){var c=i(e);return Wt(e)?c:re(c,s(e))}function Ct(e){return e==null?e===void 0?mt:S:nt&&nt in Object(e)?bt(e):Ve(e)}function $e(e){return lt(e)&&Ct(e)==p}function Ke(e,i,s,c,I){return e===i?!0:e==null||i==null||!lt(e)&&!lt(i)?e!==e&&i!==i:sn(e,i,s,c,Ke,I)}function sn(e,i,s,c,I,b){var x=Wt(e),O=Wt(i),z=x?w:ft(e),C=O?w:ft(i);z=z==p?m:z,C=C==p?m:C;var W=z==m,q=C==m,N=z==C;if(N&&$t(e)){if(!$t(i))return!1;x=!0,W=!1}if(N&&!W)return b||(b=new ut),x||Ze(e)?he(e,i,s,c,I,b):fn(e,i,z,s,c,I,b);if(!(s&a)){var $=W&&tt.call(e,"__wrapped__"),L=q&&tt.call(i,"__wrapped__");if($||L){var St=$?e.value():e,_t=L?i.value():i;return b||(b=new ut),I(St,_t,s,c,b)}}return N?(b||(b=new ut),ln(e,i,s,c,I,b)):!1}function an(e){if(!Je(e)||yn(e))return!1;var i=qe(e)?Fr:et;return i.test(Y(e))}function cn(e){return lt(e)&&be(e.length)&&!!D[Ct(e)]}function un(e){if(!bn(e))return Pt(e);var i=[];for(var s in Object(e))tt.call(e,s)&&s!="constructor"&&i.push(s);return i}function he(e,i,s,c,I,b){var x=s&a,O=e.length,z=i.length;if(O!=z&&!(x&&z>O))return!1;var C=b.get(e);if(C&&b.get(i))return C==i;var W=-1,q=!0,N=s&u?new Lt:void 0;for(b.set(e,i),b.set(i,e);++W<O;){var $=e[W],L=i[W];if(c)var St=x?c(L,$,W,i,e,b):c($,L,W,e,i,b);if(St!==void 0){if(St)continue;q=!1;break}if(N){if(!Re(i,function(_t,Dt){if(!Ft(N,Dt)&&($===_t||I($,_t,s,c,b)))return N.push(Dt)})){q=!1;break}}else if(!($===L||I($,L,s,c,b))){q=!1;break}}return b.delete(e),b.delete(i),q}function fn(e,i,s,c,I,b,x){switch(s){case V:if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case j:return!(e.byteLength!=i.byteLength||!b(new Le(e),new Le(i)));case d:case E:case T:return Ye(+e,+i);case l:return e.name==i.name&&e.message==i.message;case G:case F:return e==i+"";case y:var O=ze;case R:var z=c&a;if(O||(O=ct),e.size!=i.size&&!z)return!1;var C=x.get(e);if(C)return C==i;c|=u,x.set(e,i);var W=he(O(e),O(i),c,I,b,x);return x.delete(e),W;case at:if(le)return le.call(e)==le.call(i)}return!1}function ln(e,i,s,c,I,b){var x=s&a,O=kt(e),z=O.length,C=kt(i),W=C.length;if(z!=W&&!x)return!1;for(var q=z;q--;){var N=O[q];if(!(x?N in i:tt.call(i,N)))return!1}var $=b.get(e);if($&&b.get(i))return $==i;var L=!0;b.set(e,i),b.set(i,e);for(var St=x;++q<z;){N=O[q];var _t=e[N],Dt=i[N];if(c)var Qn=x?c(Dt,_t,N,i,e,b):c(_t,Dt,N,e,i,b);if(!(Qn===void 0?_t===Dt||I(_t,Dt,s,c,b):Qn)){L=!1;break}St||(St=N=="constructor")}if(L&&!St){var Qe=e.constructor,tr=i.constructor;Qe!=tr&&"constructor"in e&&"constructor"in i&&!(typeof Qe=="function"&&Qe instanceof Qe&&typeof tr=="function"&&tr instanceof tr)&&(L=!1)}return b.delete(e),b.delete(i),L}function kt(e){return de(e,_e,pn)}function it(e,i){var s=e.__data__;return hn(i)?s[typeof i=="string"?"string":"hash"]:s.map}function yt(e,i){var s=ne(e,i);return an(s)?s:void 0}function bt(e){var i=tt.call(e,nt),s=e[nt];try{e[nt]=void 0;var c=!0}catch{}var I=Ue.call(e);return c&&(i?e[nt]=s:delete e[nt]),I}var pn=Ut?function(e){return e==null?[]:(e=Object(e),Fe(Ut(e),function(i){return Nt.call(e,i)}))}:gn,ft=Ct;(ae&&ft(new ae(new ArrayBuffer(1)))!=V||Mt&&ft(new Mt)!=y||ce&&ft(ce.resolve())!=h||ue&&ft(new ue)!=R||fe&&ft(new fe)!=M)&&(ft=function(e){var i=Ct(e),s=i==m?e.constructor:void 0,c=s?Y(s):"";if(c)switch(c){case Ge:return V;case ht:return y;case Rr:return h;case zr:return R;case Hr:return M}return i});function dn(e,i){return i=i??f,!!i&&(typeof e=="number"||Me.test(e))&&e>-1&&e%1==0&&e<i}function hn(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function yn(e){return!!Ne&&Ne in e}function bn(e){var i=e&&e.constructor,s=typeof i=="function"&&i.prototype||Ot;return e===s}function Ve(e){return Ue.call(e)}function Y(e){if(e!=null){try{return ie.call(e)}catch{}try{return e+""}catch{}}return""}function Ye(e,i){return e===i||e!==e&&i!==i}var Xe=$e(function(){return arguments}())?$e:function(e){return lt(e)&&tt.call(e,"callee")&&!Nt.call(e,"callee")},Wt=Array.isArray;function ye(e){return e!=null&&be(e.length)&&!qe(e)}var $t=se||mn;function _n(e,i){return Ke(e,i)}function qe(e){if(!Je(e))return!1;var i=Ct(e);return i==g||i==v||i==_||i==A}function be(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=f}function Je(e){var i=typeof e;return e!=null&&(i=="object"||i=="function")}function lt(e){return e!=null&&typeof e=="object"}var Ze=ee?Dr(ee):cn;function _e(e){return ye(e)?on(e):un(e)}function gn(){return[]}function mn(){return!1}t.exports=_n}(Se,Se.exports);var li=Se.exports;const st=cr(li);var Ie={exports:{}};Ie.exports,function(t,r){var n=200,o="__lodash_hash_undefined__",a=9007199254740991,u="[object Arguments]",f="[object Array]",p="[object Boolean]",w="[object Date]",_="[object Error]",d="[object Function]",E="[object GeneratorFunction]",l="[object Map]",g="[object Number]",v="[object Object]",y="[object Promise]",T="[object RegExp]",S="[object Set]",m="[object String]",h="[object Symbol]",A="[object WeakMap]",G="[object ArrayBuffer]",R="[object DataView]",F="[object Float32Array]",at="[object Float64Array]",mt="[object Int8Array]",M="[object Int16Array]",j="[object Int32Array]",V="[object Uint8Array]",Oe="[object Uint8ClampedArray]",xe="[object Uint16Array]",Pe="[object Uint32Array]",Ar=/[\\^$.*+?()[\]{}|]/g,Er=/\w*$/,Or=/^\[object .+?Constructor\]$/,xr=/^(?:0|[1-9]\d*)$/,k={};k[u]=k[f]=k[G]=k[R]=k[p]=k[w]=k[F]=k[at]=k[mt]=k[M]=k[j]=k[l]=k[g]=k[v]=k[T]=k[S]=k[m]=k[h]=k[V]=k[Oe]=k[xe]=k[Pe]=!0,k[_]=k[d]=k[A]=!1;var Pr=typeof Q=="object"&&Q&&Q.Object===Object&&Q,Mr=typeof self=="object"&&self&&self.Object===Object&&self,et=Pr||Mr||Function("return this")(),Me=r&&!r.nodeType&&r,D=Me&&!0&&t&&!t.nodeType&&t,Ce=D&&D.exports===Me;function Cr(e,i){return e.set(i[0],i[1]),e}function rt(e,i){return e.add(i),e}function ke(e,i){for(var s=-1,c=e?e.length:0;++s<c&&i(e[s],s,e)!==!1;);return e}function De(e,i){for(var s=-1,c=i.length,I=e.length;++s<c;)e[I+s]=i[s];return e}function Qt(e,i,s,c){for(var I=-1,b=e?e.length:0;++I<b;)s=i(s,e[I],I,e);return s}function te(e,i){for(var s=-1,c=Array(e);++s<e;)c[s]=i(s);return c}function je(e,i){return e==null?void 0:e[i]}function ee(e){var i=!1;if(e!=null&&typeof e.toString!="function")try{i=!!(e+"")}catch{}return i}function Fe(e){var i=-1,s=Array(e.size);return e.forEach(function(c,I){s[++i]=[I,c]}),s}function re(e,i){return function(s){return e(i(s))}}function Re(e){var i=-1,s=Array(e.size);return e.forEach(function(c){s[++i]=c}),s}var kr=Array.prototype,Dr=Function.prototype,Ft=Object.prototype,ne=et["__core-js_shared__"],ze=function(){var e=/[^.]+$/.exec(ne&&ne.keys&&ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),He=Dr.toString,ct=Ft.hasOwnProperty,Rt=Ft.toString,jr=RegExp("^"+He.call(ct).replace(Ar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ot=Ce?et.Buffer:void 0,zt=et.Symbol,ie=et.Uint8Array,tt=re(Object.getPrototypeOf,Object),Ne=Object.create,Ue=Ft.propertyIsEnumerable,Fr=kr.splice,oe=Object.getOwnPropertySymbols,Ht=Ot?Ot.isBuffer:void 0,Le=re(Object.keys,Object),Nt=it(et,"DataView"),xt=it(et,"Map"),nt=it(et,"Promise"),Ut=it(et,"Set"),se=it(et,"WeakMap"),Pt=it(Object,"create"),ae=Y(Nt),Mt=Y(xt),ce=Y(nt),ue=Y(Ut),fe=Y(se),vt=zt?zt.prototype:void 0,Ge=vt?vt.valueOf:void 0;function ht(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Rr(){this.__data__=Pt?Pt(null):{}}function zr(e){return this.has(e)&&delete this.__data__[e]}function Hr(e){var i=this.__data__;if(Pt){var s=i[e];return s===o?void 0:s}return ct.call(i,e)?i[e]:void 0}function Be(e){var i=this.__data__;return Pt?i[e]!==void 0:ct.call(i,e)}function le(e,i){var s=this.__data__;return s[e]=Pt&&i===void 0?o:i,this}ht.prototype.clear=Rr,ht.prototype.delete=zr,ht.prototype.get=Hr,ht.prototype.has=Be,ht.prototype.set=le;function U(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Nr(){this.__data__=[]}function Ur(e){var i=this.__data__,s=Gt(i,e);if(s<0)return!1;var c=i.length-1;return s==c?i.pop():Fr.call(i,s,1),!0}function Lr(e){var i=this.__data__,s=Gt(i,e);return s<0?void 0:i[s][1]}function Gr(e){return Gt(this.__data__,e)>-1}function Br(e,i){var s=this.__data__,c=Gt(s,e);return c<0?s.push([e,i]):s[c][1]=i,this}U.prototype.clear=Nr,U.prototype.delete=Ur,U.prototype.get=Lr,U.prototype.has=Gr,U.prototype.set=Br;function B(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var c=e[i];this.set(c[0],c[1])}}function Wr(){this.__data__={hash:new ht,map:new(xt||U),string:new ht}}function $r(e){return kt(this,e).delete(e)}function Kr(e){return kt(this,e).get(e)}function Vr(e){return kt(this,e).has(e)}function Yr(e,i){return kt(this,e).set(e,i),this}B.prototype.clear=Wr,B.prototype.delete=$r,B.prototype.get=Kr,B.prototype.has=Vr,B.prototype.set=Yr;function X(e){this.__data__=new U(e)}function Xr(){this.__data__=new U}function qr(e){return this.__data__.delete(e)}function Jr(e){return this.__data__.get(e)}function Zr(e){return this.__data__.has(e)}function Qr(e,i){var s=this.__data__;if(s instanceof U){var c=s.__data__;if(!xt||c.length<n-1)return c.push([e,i]),this;s=this.__data__=new B(c)}return s.set(e,i),this}X.prototype.clear=Xr,X.prototype.delete=qr,X.prototype.get=Jr,X.prototype.has=Zr,X.prototype.set=Qr;function Lt(e,i){var s=ye(e)||Wt(e)?te(e.length,String):[],c=s.length,I=!!c;for(var b in e)ct.call(e,b)&&!(I&&(b=="length"||hn(b,c)))&&s.push(b);return s}function We(e,i,s){var c=e[i];(!(ct.call(e,i)&&Xe(c,s))||s===void 0&&!(i in e))&&(e[i]=s)}function Gt(e,i){for(var s=e.length;s--;)if(Xe(e[s][0],i))return s;return-1}function ut(e,i){return e&&he(i,_e(i),e)}function pe(e,i,s,c,I,b,x){var O;if(c&&(O=b?c(e,I,b,x):c(e)),O!==void 0)return O;if(!lt(e))return e;var z=ye(e);if(z){if(O=pn(e),!i)return un(e,O)}else{var C=bt(e),W=C==d||C==E;if(qe(e))return Bt(e,i);if(C==v||C==u||W&&!b){if(ee(e))return b?e:{};if(O=ft(W?{}:e),!i)return fn(e,ut(O,e))}else{if(!k[C])return b?e:{};O=dn(e,C,pe,i)}}x||(x=new X);var q=x.get(e);if(q)return q;if(x.set(e,O),!z)var N=s?ln(e):_e(e);return ke(N||e,function($,L){N&&(L=$,$=e[L]),We(O,L,pe($,i,s,c,L,e,x))}),O}function tn(e){return lt(e)?Ne(e):{}}function en(e,i,s){var c=i(e);return ye(e)?c:De(c,s(e))}function rn(e){return Rt.call(e)}function nn(e){if(!lt(e)||bn(e))return!1;var i=be(e)||ee(e)?jr:Or;return i.test(Y(e))}function on(e){if(!Ve(e))return Le(e);var i=[];for(var s in Object(e))ct.call(e,s)&&s!="constructor"&&i.push(s);return i}function Bt(e,i){if(i)return e.slice();var s=new e.constructor(e.length);return e.copy(s),s}function de(e){var i=new e.constructor(e.byteLength);return new ie(i).set(new ie(e)),i}function Ct(e,i){var s=i?de(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function $e(e,i,s){var c=i?s(Fe(e),!0):Fe(e);return Qt(c,Cr,new e.constructor)}function Ke(e){var i=new e.constructor(e.source,Er.exec(e));return i.lastIndex=e.lastIndex,i}function sn(e,i,s){var c=i?s(Re(e),!0):Re(e);return Qt(c,rt,new e.constructor)}function an(e){return Ge?Object(Ge.call(e)):{}}function cn(e,i){var s=i?de(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function un(e,i){var s=-1,c=e.length;for(i||(i=Array(c));++s<c;)i[s]=e[s];return i}function he(e,i,s,c){s||(s={});for(var I=-1,b=i.length;++I<b;){var x=i[I],O=void 0;We(s,x,O===void 0?e[x]:O)}return s}function fn(e,i){return he(e,yt(e),i)}function ln(e){return en(e,_e,yt)}function kt(e,i){var s=e.__data__;return yn(i)?s[typeof i=="string"?"string":"hash"]:s.map}function it(e,i){var s=je(e,i);return nn(s)?s:void 0}var yt=oe?re(oe,Object):gn,bt=rn;(Nt&&bt(new Nt(new ArrayBuffer(1)))!=R||xt&&bt(new xt)!=l||nt&&bt(nt.resolve())!=y||Ut&&bt(new Ut)!=S||se&&bt(new se)!=A)&&(bt=function(e){var i=Rt.call(e),s=i==v?e.constructor:void 0,c=s?Y(s):void 0;if(c)switch(c){case ae:return R;case Mt:return l;case ce:return y;case ue:return S;case fe:return A}return i});function pn(e){var i=e.length,s=e.constructor(i);return i&&typeof e[0]=="string"&&ct.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function ft(e){return typeof e.constructor=="function"&&!Ve(e)?tn(tt(e)):{}}function dn(e,i,s,c){var I=e.constructor;switch(i){case G:return de(e);case p:case w:return new I(+e);case R:return Ct(e,c);case F:case at:case mt:case M:case j:case V:case Oe:case xe:case Pe:return cn(e,c);case l:return $e(e,c,s);case g:case m:return new I(e);case T:return Ke(e);case S:return sn(e,c,s);case h:return an(e)}}function hn(e,i){return i=i??a,!!i&&(typeof e=="number"||xr.test(e))&&e>-1&&e%1==0&&e<i}function yn(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function bn(e){return!!ze&&ze in e}function Ve(e){var i=e&&e.constructor,s=typeof i=="function"&&i.prototype||Ft;return e===s}function Y(e){if(e!=null){try{return He.call(e)}catch{}try{return e+""}catch{}}return""}function Ye(e){return pe(e,!0,!0)}function Xe(e,i){return e===i||e!==e&&i!==i}function Wt(e){return _n(e)&&ct.call(e,"callee")&&(!Ue.call(e,"callee")||Rt.call(e)==u)}var ye=Array.isArray;function $t(e){return e!=null&&Je(e.length)&&!be(e)}function _n(e){return Ze(e)&&$t(e)}var qe=Ht||mn;function be(e){var i=lt(e)?Rt.call(e):"";return i==d||i==E}function Je(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=a}function lt(e){var i=typeof e;return!!e&&(i=="object"||i=="function")}function Ze(e){return!!e&&typeof e=="object"}function _e(e){return $t(e)?Lt(e):on(e)}function gn(){return[]}function mn(){return!1}t.exports=Ye}(Ie,Ie.exports);var pi=Ie.exports;const dt=cr(pi),di=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(o=>o));return r.length===0?Promise.resolve(!0):new Promise((n,o)=>{Promise.all(r).then(a=>{a.forEach(u=>{u&&u.family&&(document.fonts.add(u),n(!0))})}).catch(a=>o(a))})},hi=t=>new Promise((r,n)=>{const o=new Image;console.warn("update cdn config for cors?"),o.onload=()=>{const a=o.width,u=o.height;r({width:a,height:u})},o.onerror=a=>{n(a)},o.crossOrigin="anonymous",o.src=t}),yi=t=>new Promise((r,n)=>{const o=new Audio;o.preload="auto",o.addEventListener("loadedmetadata",()=>{const a=o.duration*1e3;r({duration:a})}),o.addEventListener("error",a=>{n(a)}),o.src=t,o.crossOrigin="anonymous",o.load()}),bi=t=>new Promise((r,n)=>{const o=document.createElement("video");o.preload="auto",o.addEventListener("loadedmetadata",()=>{const a=o.duration*1e3,u=o.videoWidth,f=o.videoHeight;r({duration:a,width:u,height:f})}),o.addEventListener("error",a=>{n(a)}),o.src=t,o.load()}),_i=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(a=>{a!=="height"&&(n.style[a]=r[a])}),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 o=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(o)},ur={color:"#000000",x:0,y:0,blur:0},we=(t,r)=>{const n=(r==null?void 0:r.duration)||5e3,o={from:0,to:n};if(!t)return o;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),o;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."),o;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),o}return t},Dn=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function fr(t,r){const n={x:t.size.width/2,y:t.size.height/2},o={x:r.width/2,y:r.height/2},a=Math.min(t.size.width/r.width,t.size.height/r.height),u=n.x-o.x;return{top:`${n.y-o.y}px`,left:`${u}px`,transform:`scale(${a})`}}const gi=async(t,r)=>{const n=t.details.src,o=await bi(n),a=fr(r,{...o}),u={width:o.width,height:o.height,duration:o.duration,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||ur,top:a.top||"0px",left:a.left||"0px",transform:a.transform};return{...t,trim:Dn(t.trim,{duration:o.duration}),type:"video",name:"video",details:u,display:we(t.display,{duration:o.duration})}},mi=async t=>{const r=t.id,n=t.details,a=(await yi(n.src)).duration;return{id:r,name:"",type:"audio",display:we(t.display,{duration:a}),trim:Dn(t.trim,{duration:a}),details:{src:n.src,duration:a,volume:n.volume??100},metadata:{...t.metadata}}},vi=async(t,r)=>{const n=t.details,o=await hi(n.src),a=fr(r,o);return{id:t.id,type:"image",name:"image",display:we(t.display),details:{src:n.src||"",width:n.width||o.width||100,height:n.height||o.height||100,opacity:n.opacity??100,transform:a.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||ur,top:a.top||"0px",left:a.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000"},metadata:t.metadata||{}}},Si=async(t,r)=>{const n=t.id;await di([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const o=t.details,a=Ii(o),u=_i(t.details.text,a),f=fr(r,{width:a.width,height:u});return{id:n,name:"text",type:"text",display:we(t.display),details:{...a,text:o.text||"",height:u,fontUrl:o.fontUrl,top:f.top,left:f.left,borderWidth:o.borderWidth||0,borderColor:o.borderColor||"#000000",boxShadow:o.boxShadow||ur},metadata:{}}},Ii=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||"0px",left:t.left||"0px"}),wi="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Ti=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=wi[n[t]&63];return r};const jn=t=>Object.keys(t).reduce((r,n)=>{const{display:o}=t[n];return Math.max(r,o.to)},0);function Ai(t,r){return t.map(n=>({...n,items:n.items.filter(o=>!r.includes(o))}))}function Ei(t){const r=P.subject.pipe(P.filter(({key:_})=>_.startsWith(P.ADD_PREFIX))),n=P.subject.pipe(P.filter(({key:_})=>_.startsWith(P.HISTORY_PREFIX))),o=P.subject.pipe(P.filter(({key:_})=>_.startsWith(P.ACTIVE_PREFIX))),a=P.subject.pipe(P.filter(({key:_})=>_.startsWith(P.EDIT_PREFIX))),u=n.subscribe(_=>{if(_.key===P.HISTORY_UNDO)return t.undo();if(_.key===P.HISTORY_REDO)return t.redo()}),f=r.subscribe(async _=>{var l,g,v,y,T;const d=dt(t.getState());if(_.key===P.ADD_TEXT){const S=await Si((l=_.value)==null?void 0:l.payload,{size:{width:1080,height:1920}}),{details:m,...h}=S;d.trackItemDetailsMap[h.id]={type:"text",details:m},d.trackItemsMap[h.id]=h,d.trackItemIds.push(h.id)}if(_.key===P.ADD_IMAGE){const S=await vi((g=_.value)==null?void 0:g.payload,{size:{width:1080,height:1920}}),{details:m,...h}=S;d.trackItemDetailsMap[h.id]={type:"image",details:m},d.trackItemsMap[h.id]=h,d.trackItemIds.push(h.id)}if(_.key===P.ADD_AUDIO){const S=await mi((v=_.value)==null?void 0:v.payload),{details:m,...h}=S;d.trackItemDetailsMap[h.id]={type:"audio",details:m},d.trackItemsMap[h.id]=h,d.trackItemIds.push(h.id)}if(_.key===P.ADD_VIDEO){const S=await gi((y=_.value)==null?void 0:y.payload,{size:{width:1080,height:1920}}),{details:m,...h}=S;d.trackItemDetailsMap[h.id]={type:"video",details:m},d.trackItemsMap[h.id]=h,d.trackItemIds.push(h.id)}d.tracks.unshift({id:Ti(),accepts:["text","audio","helper","video","image"],type:"text",items:[(T=_.value)==null?void 0:T.payload.id],magnetic:!1,static:!1});const E=jn(d.trackItemsMap);t.updateState({trackItemIds:d.trackItemIds,trackItemDetailsMap:{...d.trackItemDetailsMap},trackItemsMap:{...d.trackItemsMap},tracks:d.tracks,duration:E},{updateHistory:!0,kind:"add"})}),p=o.subscribe(_=>{if(_.key===P.ACTIVE_DELETE){const d=dt(t.getState()),E=d.activeIds,l=d.trackItemIds,g=d.trackItemDetailsMap,v=l.filter(m=>!E.includes(m)),y=Object.fromEntries(Object.entries(g).filter(([m])=>!E.includes(m))),T=Ai(d.tracks,E),S=jn(d.trackItemsMap);t.updateState({trackItemIds:v,trackItemDetailsMap:y,activeIds:[],tracks:T,duration:S},{updateHistory:!0,kind:"remove"})}}),w=a.subscribe(_=>{var d,E;if(_.key===P.EDIT_OBJECT){const l=t.getState(),g=dt(l.trackItemDetailsMap),v=Object.keys((d=_.value)==null?void 0:d.payload);if(!v.length)return;const y=(E=_.value)==null?void 0:E.payload;v.forEach(T=>{g[T].details={...g[T].details,...y[T].details}}),t.updateState({trackItemDetailsMap:{...g}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{f.unsubscribe(),p.unsubscribe(),w.unsubscribe(),u.unsubscribe()}}}const Oi={Date:!0,RegExp:!0,String:!0,Number:!0};function Fn(t,r,n={cyclesFix:!0},o=[]){var p,w;let a=[];const u=Array.isArray(t);for(const _ in t){const d=t[_],E=u?+_:_;if(!(_ in r)){a.push({type:"REMOVE",path:[E],oldValue:t[_]});continue}const l=r[_],g=typeof d=="object"&&typeof l=="object"&&Array.isArray(d)===Array.isArray(l);if(d&&l&&g&&!Oi[(w=(p=Object.getPrototypeOf(d))==null?void 0:p.constructor)==null?void 0:w.name]&&(!n.cyclesFix||!o.includes(d))){const v=Fn(d,l,n,n.cyclesFix?o.concat([d]):[]);a.push.apply(a,v.map(y=>(y.path.unshift(E),y)))}else d!==l&&!(Number.isNaN(d)&&Number.isNaN(l))&&!(g&&(isNaN(d)?d+""==l+"":+d==+l))&&a.push({path:[E],type:"CHANGE",value:l,oldValue:d})}const f=Array.isArray(r);for(const _ in r)_ in t||a.push({type:"CREATE",path:[f?+_:_],value:r[_]});return a}var lr=Symbol.for("immer-nothing"),Kt=Symbol.for("immer-draftable"),J=Symbol.for("immer-state"),Rn=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 H(t,...r){if(process.env.NODE_ENV!=="production"){const n=Rn[t],o=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var It=Object.getPrototypeOf;function wt(t){return!!t&&!!t[J]}function gt(t){var r;return t?zn(t)||Array.isArray(t)||!!t[Kt]||!!((r=t.constructor)!=null&&r[Kt])||Xt(t)||qt(t):!1}var xi=Object.prototype.constructor.toString();function zn(t){if(!t||typeof t!="object")return!1;const r=It(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)===xi}function Vt(t,r){Tt(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,o)=>r(o,n,t))}function Tt(t){const r=t[J];return r?r.type_:Array.isArray(t)?1:Xt(t)?2:qt(t)?3:0}function Yt(t,r){return Tt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function pr(t,r){return Tt(t)===2?t.get(r):t[r]}function Hn(t,r,n){const o=Tt(t);o===2?t.set(r,n):o===3?t.add(n):t[r]=n}function Pi(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Xt(t){return t instanceof Map}function qt(t){return t instanceof Set}function At(t){return t.copy_||t.base_}function dr(t,r){if(Xt(t))return new Map(t);if(qt(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=zn(t);if(r===!0||r==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(t);delete o[J];let a=Reflect.ownKeys(o);for(let u=0;u<a.length;u++){const f=a[u],p=o[f];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(o[f]={configurable:!0,writable:!0,enumerable:p.enumerable,value:t[f]})}return Object.create(It(t),o)}else{const o=It(t);if(o!==null&&n)return{...t};const a=Object.create(o);return Object.assign(a,t)}}function hr(t,r=!1){return Te(t)||wt(t)||!gt(t)||(Tt(t)>1&&(t.set=t.add=t.clear=t.delete=Mi),Object.freeze(t),r&&Object.entries(t).forEach(([n,o])=>hr(o,!0))),t}function Mi(){H(2)}function Te(t){return Object.isFrozen(t)}var yr={};function Et(t){const r=yr[t];return r||H(0,t),r}function Ci(t,r){yr[t]||(yr[t]=r)}var Jt;function Nn(){return Jt}function ki(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Un(t,r){r&&(Et("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function br(t){_r(t),t.drafts_.forEach(Di),t.drafts_=null}function _r(t){t===Jt&&(Jt=t.parent_)}function Ln(t){return Jt=ki(Jt,t)}function Di(t){const r=t[J];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Gn(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[J].modified_&&(br(r),H(4)),gt(t)&&(t=Ae(r,t),r.parent_||Ee(r,t)),r.patches_&&Et("Patches").generateReplacementPatches_(n[J].base_,t,r.patches_,r.inversePatches_)):t=Ae(r,n,[]),br(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==lr?t:void 0}function Ae(t,r,n){if(Te(r))return r;const o=r[J];if(!o)return Vt(r,(a,u)=>Bn(t,o,r,a,u,n)),r;if(o.scope_!==t)return r;if(!o.modified_)return Ee(t,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let u=a,f=!1;o.type_===3&&(u=new Set(a),a.clear(),f=!0),Vt(u,(p,w)=>Bn(t,o,a,p,w,n,f)),Ee(t,a,!1),n&&t.patches_&&Et("Patches").generatePatches_(o,n,t.patches_,t.inversePatches_)}return o.copy_}function Bn(t,r,n,o,a,u,f){if(process.env.NODE_ENV!=="production"&&a===n&&H(5),wt(a)){const p=u&&r&&r.type_!==3&&!Yt(r.assigned_,o)?u.concat(o):void 0,w=Ae(t,a,p);if(Hn(n,o,w),wt(w))t.canAutoFreeze_=!1;else return}else f&&n.add(a);if(gt(a)&&!Te(a)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Ae(t,a),(!r||!r.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&Ee(t,a)}}function Ee(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&hr(r,n)}function ji(t,r){const n=Array.isArray(t),o={type_:n?1:0,scope_:r?r.scope_:Nn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=o,u=gr;n&&(a=[o],u=Zt);const{revoke:f,proxy:p}=Proxy.revocable(a,u);return o.draft_=p,o.revoke_=f,p}var gr={get(t,r){if(r===J)return t;const n=At(t);if(!Yt(n,r))return Fi(t,n,r);const o=n[r];return t.finalized_||!gt(o)?o:o===mr(t.base_,r)?(Sr(t),t.copy_[r]=Ir(o,t)):o},has(t,r){return r in At(t)},ownKeys(t){return Reflect.ownKeys(At(t))},set(t,r,n){const o=Wn(At(t),r);if(o!=null&&o.set)return o.set.call(t.draft_,n),!0;if(!t.modified_){const a=mr(At(t),r),u=a==null?void 0:a[J];if(u&&u.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Pi(n,a)&&(n!==void 0||Yt(t.base_,r)))return!0;Sr(t),vr(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 mr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Sr(t),vr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=At(t),o=Reflect.getOwnPropertyDescriptor(n,r);return o&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:o.enumerable,value:n[r]}},defineProperty(){H(11)},getPrototypeOf(t){return It(t.base_)},setPrototypeOf(){H(12)}},Zt={};Vt(gr,(t,r)=>{Zt[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Zt.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&H(13),Zt.set.call(this,t,r,void 0)},Zt.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&H(14),gr.set.call(this,t[0],r,n,t[0])};function mr(t,r){const n=t[J];return(n?At(n):t)[r]}function Fi(t,r,n){var a;const o=Wn(r,n);return o?"value"in o?o.value:(a=o.get)==null?void 0:a.call(t.draft_):void 0}function Wn(t,r){if(!(r in t))return;let n=It(t);for(;n;){const o=Object.getOwnPropertyDescriptor(n,r);if(o)return o;n=It(n)}}function vr(t){t.modified_||(t.modified_=!0,t.parent_&&vr(t.parent_))}function Sr(t){t.copy_||(t.copy_=dr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Ri=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,o)=>{if(typeof r=="function"&&typeof n!="function"){const u=n;n=r;const f=this;return function(w=u,..._){return f.produce(w,d=>n.call(this,d,..._))}}typeof n!="function"&&H(6),o!==void 0&&typeof o!="function"&&H(7);let a;if(gt(r)){const u=Ln(this),f=Ir(r,void 0);let p=!0;try{a=n(f),p=!1}finally{p?br(u):_r(u)}return Un(u,o),Gn(a,u)}else if(!r||typeof r!="object"){if(a=n(r),a===void 0&&(a=r),a===lr&&(a=void 0),this.autoFreeze_&&hr(a,!0),o){const u=[],f=[];Et("Patches").generateReplacementPatches_(r,a,u,f),o(u,f)}return a}else H(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(f,...p)=>this.produceWithPatches(f,w=>r(w,...p));let o,a;return[this.produce(r,n,(f,p)=>{o=f,a=p}),o,a]},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){gt(t)||H(8),wt(t)&&(t=zi(t));const r=Ln(this),n=Ir(t,void 0);return n[J].isManual_=!0,_r(r),n}finishDraft(t,r){const n=t&&t[J];(!n||!n.isManual_)&&H(9);const{scope_:o}=n;return Un(o,r),Gn(void 0,o)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const a=r[n];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}n>-1&&(r=r.slice(n+1));const o=Et("Patches").applyPatches_;return wt(t)?o(t,r):this.produce(t,a=>o(a,r))}};function Ir(t,r){const n=Xt(t)?Et("MapSet").proxyMap_(t,r):qt(t)?Et("MapSet").proxySet_(t,r):ji(t,r);return(r?r.scope_:Nn()).drafts_.push(n),n}function zi(t){return wt(t)||H(10,t),$n(t)}function $n(t){if(!gt(t)||Te(t))return t;const r=t[J];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=dr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=dr(t,!0);return Vt(n,(o,a)=>{Hn(n,o,$n(a))}),r&&(r.finalized_=!1),n}function Kn(){process.env.NODE_ENV!=="production"&&Rn.push('Sets cannot have "replace" patches.',function(l){return"Unsupported patch operation: "+l},function(l){return"Cannot apply patch, path doesn't resolve: "+l},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",o="remove";function a(l,g,v,y){switch(l.type_){case 0:case 2:return f(l,g,v,y);case 1:return u(l,g,v,y);case 3:return p(l,g,v,y)}}function u(l,g,v,y){let{base_:T,assigned_:S}=l,m=l.copy_;m.length<T.length&&([T,m]=[m,T],[v,y]=[y,v]);for(let h=0;h<T.length;h++)if(S[h]&&m[h]!==T[h]){const A=g.concat([h]);v.push({op:r,path:A,value:E(m[h])}),y.push({op:r,path:A,value:E(T[h])})}for(let h=T.length;h<m.length;h++){const A=g.concat([h]);v.push({op:n,path:A,value:E(m[h])})}for(let h=m.length-1;T.length<=h;--h){const A=g.concat([h]);y.push({op:o,path:A})}}function f(l,g,v,y){const{base_:T,copy_:S}=l;Vt(l.assigned_,(m,h)=>{const A=pr(T,m),G=pr(S,m),R=h?Yt(T,m)?r:n:o;if(A===G&&R===r)return;const F=g.concat(m);v.push(R===o?{op:R,path:F}:{op:R,path:F,value:G}),y.push(R===n?{op:o,path:F}:R===o?{op:n,path:F,value:E(A)}:{op:r,path:F,value:E(A)})})}function p(l,g,v,y){let{base_:T,copy_:S}=l,m=0;T.forEach(h=>{if(!S.has(h)){const A=g.concat([m]);v.push({op:o,path:A,value:h}),y.unshift({op:n,path:A,value:h})}m++}),m=0,S.forEach(h=>{if(!T.has(h)){const A=g.concat([m]);v.push({op:n,path:A,value:h}),y.unshift({op:o,path:A,value:h})}m++})}function w(l,g,v,y){v.push({op:r,path:[],value:g===lr?void 0:g}),y.push({op:r,path:[],value:l})}function _(l,g){return g.forEach(v=>{const{path:y,op:T}=v;let S=l;for(let G=0;G<y.length-1;G++){const R=Tt(S);let F=y[G];typeof F!="string"&&typeof F!="number"&&(F=""+F),(R===0||R===1)&&(F==="__proto__"||F==="constructor")&&H(19),typeof S=="function"&&F==="prototype"&&H(19),S=pr(S,F),typeof S!="object"&&H(18,y.join("/"))}const m=Tt(S),h=d(v.value),A=y[y.length-1];switch(T){case r:switch(m){case 2:return S.set(A,h);case 3:H(16);default:return S[A]=h}case n:switch(m){case 1:return A==="-"?S.push(h):S.splice(A,0,h);case 2:return S.set(A,h);case 3:return S.add(h);default:return S[A]=h}case o:switch(m){case 1:return S.splice(A,1);case 2:return S.delete(A);case 3:return S.delete(v.value);default:return delete S[A]}default:H(17,T)}}),l}function d(l){if(!gt(l))return l;if(Array.isArray(l))return l.map(d);if(Xt(l))return new Map(Array.from(l.entries()).map(([v,y])=>[v,d(y)]));if(qt(l))return new Set(Array.from(l).map(d));const g=Object.create(It(l));for(const v in l)g[v]=d(l[v]);return Yt(l,Kt)&&(g[Kt]=l[Kt]),g}function E(l){return wt(l)?d(l):l}Ci("Patches",{applyPatches_:_,generatePatches_:a,generateReplacementPatches_:w})}var Z=new Ri,Hi=Z.produce;Z.produceWithPatches.bind(Z),Z.setAutoFreeze.bind(Z),Z.setUseStrictShallowCopy.bind(Z);var Ni=Z.applyPatches.bind(Z);Z.createDraft.bind(Z),Z.finishDraft.bind(Z);var Ui=1/0,Li=9007199254740991,Gi="[object Arguments]",Bi="[object Function]",Wi="[object GeneratorFunction]",$i="[object Symbol]",Ki=typeof Q=="object"&&Q&&Q.Object===Object&&Q,Vi=typeof self=="object"&&self&&self.Object===Object&&self,Yi=Ki||Vi||Function("return this")();function Xi(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 qi(t,r){for(var n=-1,o=t?t.length:0,a=Array(o);++n<o;)a[n]=r(t[n],n,t);return a}function Ji(t,r){for(var n=-1,o=r.length,a=t.length;++n<o;)t[a+n]=r[n];return t}var wr=Object.prototype,Zi=wr.hasOwnProperty,Tr=wr.toString,Vn=Yi.Symbol,Qi=wr.propertyIsEnumerable,Yn=Vn?Vn.isConcatSpreadable:void 0,Xn=Math.max;function to(t,r,n,o,a){var u=-1,f=t.length;for(n||(n=io),a||(a=[]);++u<f;){var p=t[u];n(p)?Ji(a,p):a[a.length]=p}return a}function eo(t,r){return t=Object(t),ro(t,r,function(n,o){return o in t})}function ro(t,r,n){for(var o=-1,a=r.length,u={};++o<a;){var f=r[o],p=t[f];n(p,f)&&(u[f]=p)}return u}function no(t,r){return r=Xn(r===void 0?t.length-1:r,0),function(){for(var n=arguments,o=-1,a=Xn(n.length-r,0),u=Array(a);++o<a;)u[o]=n[r+o];o=-1;for(var f=Array(r+1);++o<r;)f[o]=n[o];return f[r]=u,Xi(t,this,f)}}function io(t){return ao(t)||so(t)||!!(Yn&&t&&t[Yn])}function oo(t){if(typeof t=="string"||ho(t))return t;var r=t+"";return r=="0"&&1/t==-Ui?"-0":r}function so(t){return uo(t)&&Zi.call(t,"callee")&&(!Qi.call(t,"callee")||Tr.call(t)==Gi)}var ao=Array.isArray;function co(t){return t!=null&&lo(t.length)&&!fo(t)}function uo(t){return qn(t)&&co(t)}function fo(t){var r=po(t)?Tr.call(t):"";return r==Bi||r==Wi}function lo(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Li}function po(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function qn(t){return!!t&&typeof t=="object"}function ho(t){return typeof t=="symbol"||qn(t)&&Tr.call(t)==$i}var yo=no(function(t,r){return t==null?{}:eo(t,qi(to(r),oo))}),bo=yo;const Jn=cr(bo),_o={tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1},duration:0,activeIds:[],trackItemDetailsMap:{}},Zn=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class go{constructor(r){jt(this,"stateSubject");jt(this,"stateHistorySubject");jt(this,"prevState");jt(this,"undos",[]);jt(this,"redos",[]);jt(this,"listener");const n=r||_o;this.stateSubject=new kn(n),this.stateHistorySubject=new kn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Ei(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const o=Jn(r,Zn),a=Jn(this.getState(),Zn),u=Fn(a,o);u.length&&(this.undos.push({undos:u,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 o=this.getState(),a={...o,...r};st(o,a)||(n.updateHistory&&this.updateHistory(a,n.kind),this.prevState=o,this.stateSubject.next(a))}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{st(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{st(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 o=this.undos[this.undos.length-1].type;o==="update"&&r({...this.getState(),type:o}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const o=this.redos[this.redos.length-1].type;o==="update"&&r({...this.getState(),type:o}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{st(n.trackItemIds,this.prevState.trackItemIds)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{st(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!st(n.tracks,this.prevState.tracks)||!st(n.trackItemIds,this.prevState.trackItemIds)||!st(n.trackItemsMap,this.prevState.trackItemsMap)||!st(n.transitionIds,this.prevState.transitionIds)||!st(n.transitionsMap,this.prevState.transitionsMap))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,o=r==null?void 0:r.type;if(!n||!o)return;Kn();const{trackItemDetailsMap:a,trackItemIds:u,tracks:f,transitionIds:p,transitionsMap:w,trackItemsMap:_}=this.getState(),d=dt({trackItemDetailsMap:a,trackItemIds:u,tracks:f,transitionIds:p,transitionsMap:w,trackItemsMap:_}),E=[],l=[],g=[],v=[],y=[],T=[];n.forEach(M=>{let j;const V=M.path.slice(1);M.type==="CREATE"?j={path:V,op:"remove",value:M.value}:M.type==="CHANGE"?j={path:V,op:"replace",value:M.oldValue}:j={path:V,op:"add",value:M.oldValue},M.path.includes("trackItemIds")?g.push(j):M.path.includes("transitionIds")?l.push(j):M.path.includes("trackItemsMap")?y.push(j):M.path.includes("transitionsMap")?v.push(j):M.path.includes("tracks")?E.push(j):M.path.includes("trackItemDetailsMap")&&T.push(j)});const S=this.applyPatch(d.tracks,E),m=this.applyPatch(d.transitionIds,l),h=this.applyPatch(d.trackItemIds,g),A=this.applyPatch(d.transitionsMap,v),G=this.applyPatch(d.trackItemsMap,y),R=this.applyPatch(d.trackItemDetailsMap,T),F=dt({tracks:S,transitionIds:m,trackItemIds:h,transitionsMap:A,trackItemsMap:G,trackItemDetailsMap:R}),at=dt(this.getState()),mt={...at,...F};this.prevState=at,this.redos.push({redos:n,type:o}),this.stateSubject.next(mt),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((o,a)=>Hi(o,u=>{Ni(u,[a])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,o=r==null?void 0:r.type;if(!n||!o)return;Kn();const{trackItemDetailsMap:a,trackItemIds:u,tracks:f,transitionIds:p,transitionsMap:w,trackItemsMap:_}=this.getState(),d=dt({trackItemDetailsMap:a,trackItemIds:u,tracks:f,transitionIds:p,transitionsMap:w,trackItemsMap:_}),E=[],l=[],g=[],v=[],y=[],T=[];n.forEach(M=>{let j;const V=M.path.slice(1);M.type==="CREATE"?j={path:V,op:"add",value:M.value}:M.type==="CHANGE"?j={path:V,op:"replace",value:M.value}:j={path:V,op:"remove",value:M.oldValue},M.path.includes("trackItemIds")?g.push(j):M.path.includes("transitionIds")?l.push(j):M.path.includes("trackItemsMap")?y.push(j):M.path.includes("transitionsMap")?v.push(j):M.path.includes("trackItemDetailsMap")?T.push(j):E.push(j)});const S=this.applyPatch(d.tracks,E),m=this.applyPatch(d.transitionIds,l),h=this.applyPatch(d.trackItemIds,g),A=this.applyPatch(d.transitionsMap,v),G=this.applyPatch(d.trackItemsMap,y),R=this.applyPatch(d.trackItemDetailsMap,T),F=dt({tracks:S,transitionIds:m,trackItemIds:h,transitionsMap:A,trackItemsMap:G,trackItemDetailsMap:R}),at=dt(this.getState()),mt={...at,...F};this.prevState=at,this.undos.push({undos:n,type:o}),this.stateSubject.next(mt),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return go});
|
1
|
+
(function(A,Y){typeof exports=="object"&&typeof module<"u"?module.exports=Y(require("@designcombo/events")):typeof define=="function"&&define.amd?define(["@designcombo/events"],Y):(A=typeof globalThis<"u"?globalThis:A||self,A.events=Y(A.events))})(this,function(A){"use strict";var va=Object.defineProperty;var Ia=(A,Y,ct)=>Y in A?va(A,Y,{enumerable:!0,configurable:!0,writable:!0,value:ct}):A[Y]=ct;var jt=(A,Y,ct)=>Ia(A,typeof Y!="symbol"?Y+"":Y,ct);var Y=function(t,r){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o])},Y(t,r)};function ct(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Y(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function er(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],a=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function rr(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var a=n.call(t),o,c=[],l;try{for(;(r===void 0||r-- >0)&&!(o=a.next()).done;)c.push(o.value)}catch(d){l={error:d}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(l)throw l.error}}return c}function nr(t,r,n){if(n||arguments.length===2)for(var a=0,o=r.length,c;a<o;a++)(c||!(a in r))&&(c||(c=Array.prototype.slice.call(r,0,a)),c[a]=r[a]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function ht(t){return typeof t=="function"}function wn(t){var r=function(a){Error.call(a),a.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var ir=wn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
|
2
|
+
`+n.map(function(a,o){return o+1+") "+a.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 _e=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,a,o,c;if(!this.closed){this.closed=!0;var l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var d=er(l),E=d.next();!E.done;E=d.next()){var C=E.value;C.remove(this)}}catch(f){r={error:f}}finally{try{E&&!E.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}else l.remove(this);var w=this.initialTeardown;if(ht(w))try{w()}catch(f){c=f instanceof ir?f.errors:[f]}var z=this._finalizers;if(z){this._finalizers=null;try{for(var h=er(z),p=h.next();!p.done;p=h.next()){var g=p.value;try{En(g)}catch(f){c=c??[],f instanceof ir?c=nr(nr([],rr(c)),rr(f.errors)):c.push(f)}}}catch(f){a={error:f}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(a)throw a.error}}}if(c)throw new ir(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)En(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}(),Tn=_e.EMPTY;function An(t){return t instanceof _e||t&&"closed"in t&&ht(t.remove)&&ht(t.add)&&ht(t.unsubscribe)}function En(t){ht(t)?t():t.unsubscribe()}var kn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},On={setTimeout:function(t,r){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return setTimeout.apply(void 0,nr([t,r],rr(n)))},clearTimeout:function(t){var r=On.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function ii(t){On.setTimeout(function(){throw t})}function xn(){}function ge(t){t()}var Mn=function(t){ct(r,t);function r(n){var a=t.call(this)||this;return a.isStopped=!1,n?(a.destination=n,An(n)&&n.add(a)):a.destination=ci,a}return r.create=function(n,a,o){return new or(n,a,o)},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}(_e),ai=Function.prototype.bind;function sr(t,r){return ai.call(t,r)}var si=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(a){ve(a)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(a){ve(a)}else ve(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){ve(n)}},t}(),or=function(t){ct(r,t);function r(n,a,o){var c=t.call(this)||this,l;if(ht(n)||!n)l={next:n??void 0,error:a??void 0,complete:o??void 0};else{var d;c&&kn.useDeprecatedNextContext?(d=Object.create(n),d.unsubscribe=function(){return c.unsubscribe()},l={next:n.next&&sr(n.next,d),error:n.error&&sr(n.error,d),complete:n.complete&&sr(n.complete,d)}):l=n}return c.destination=new si(l),c}return r}(Mn);function ve(t){ii(t)}function oi(t){throw t}var ci={closed:!0,next:xn,error:oi,complete:xn},ui=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function fi(t){return t}function li(t){return t.length===0?fi:t.length===1?t[0]:function(n){return t.reduce(function(a,o){return o(a)},n)}}var Pn=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,a){var o=this,c=di(r)?r:new or(r,n,a);return ge(function(){var l=o,d=l.operator,E=l.source;c.add(d?d.call(c,E):E?o._subscribe(c):o._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 a=this;return n=Dn(n),new n(function(o,c){var l=new or({next:function(d){try{r(d)}catch(E){c(E),l.unsubscribe()}},error:c,complete:o});a.subscribe(l)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[ui]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return li(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Dn(r),new r(function(a,o){var c;n.subscribe(function(l){return c=l},function(l){return o(l)},function(){return a(c)})})},t.create=function(r){return new t(r)},t}();function Dn(t){var r;return(r=t??kn.Promise)!==null&&r!==void 0?r:Promise}function pi(t){return t&&ht(t.next)&&ht(t.error)&&ht(t.complete)}function di(t){return t&&t instanceof Mn||pi(t)&&An(t)}var hi=wn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Cn=function(t){ct(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 a=new jn(this,this);return a.operator=n,a},r.prototype._throwIfClosed=function(){if(this.closed)throw new hi},r.prototype.next=function(n){var a=this;ge(function(){var o,c;if(a._throwIfClosed(),!a.isStopped){a.currentObservers||(a.currentObservers=Array.from(a.observers));try{for(var l=er(a.currentObservers),d=l.next();!d.done;d=l.next()){var E=d.value;E.next(n)}}catch(C){o={error:C}}finally{try{d&&!d.done&&(c=l.return)&&c.call(l)}finally{if(o)throw o.error}}}})},r.prototype.error=function(n){var a=this;ge(function(){if(a._throwIfClosed(),!a.isStopped){a.hasError=a.isStopped=!0,a.thrownError=n;for(var o=a.observers;o.length;)o.shift().error(n)}})},r.prototype.complete=function(){var n=this;ge(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var a=n.observers;a.length;)a.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 a=this,o=this,c=o.hasError,l=o.isStopped,d=o.observers;return c||l?Tn:(this.currentObservers=null,d.push(n),new _e(function(){a.currentObservers=null,ar(d,n)}))},r.prototype._checkFinalizedStatuses=function(n){var a=this,o=a.hasError,c=a.thrownError,l=a.isStopped;o?n.error(c):l&&n.complete()},r.prototype.asObservable=function(){var n=new Pn;return n.source=this,n},r.create=function(n,a){return new jn(n,a)},r}(Pn),jn=function(t){ct(r,t);function r(n,a){var o=t.call(this)||this;return o.destination=n,o.source=a,o}return r.prototype.next=function(n){var a,o;(o=(a=this.destination)===null||a===void 0?void 0:a.next)===null||o===void 0||o.call(a,n)},r.prototype.error=function(n){var a,o;(o=(a=this.destination)===null||a===void 0?void 0:a.error)===null||o===void 0||o.call(a,n)},r.prototype.complete=function(){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||a===void 0||a.call(n)},r.prototype._subscribe=function(n){var a,o;return(o=(a=this.source)===null||a===void 0?void 0:a.subscribe(n))!==null&&o!==void 0?o:Tn},r}(Cn),Fn=function(t){ct(r,t);function r(n){var a=t.call(this)||this;return a._value=n,a}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var a=t.prototype._subscribe.call(this,n);return!a.closed&&n.next(this._value),a},r.prototype.getValue=function(){var n=this,a=n.hasError,o=n.thrownError,c=n._value;if(a)throw o;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Cn),et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ie={exports:{}};Ie.exports,function(t,r){var n=200,a="__lodash_hash_undefined__",o=1,c=2,l=9007199254740991,d="[object Arguments]",E="[object Array]",C="[object AsyncFunction]",w="[object Boolean]",z="[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]",R="[object RegExp]",k="[object Set]",O="[object String]",N="[object Symbol]",H="[object Undefined]",I="[object WeakMap]",M="[object ArrayBuffer]",X="[object DataView]",ke="[object Float32Array]",Oe="[object Float64Array]",xe="[object Int8Array]",Or="[object Int16Array]",xr="[object Int32Array]",Mr="[object Uint8Array]",Pr="[object Uint8ClampedArray]",j="[object Uint16Array]",Dr="[object Uint32Array]",Cr=/[\\^$.*+?()[\]{}|]/g,it=/^\[object .+?Constructor\]$/,Me=/^(?:0|[1-9]\d*)$/,F={};F[ke]=F[Oe]=F[xe]=F[Or]=F[xr]=F[Mr]=F[Pr]=F[j]=F[Dr]=!0,F[d]=F[E]=F[M]=F[w]=F[X]=F[z]=F[h]=F[p]=F[f]=F[b]=F[_]=F[R]=F[k]=F[O]=F[I]=!1;var Pe=typeof et=="object"&&et&&et.Object===Object&&et,jr=typeof self=="object"&&self&&self.Object===Object&&self,at=Pe||jr||Function("return this")(),De=r&&!r.nodeType&&r,Ce=De&&!0&&t&&!t.nodeType&&t,Qt=Ce&&Ce.exports===De,te=Qt&&Pe.process,je=function(){try{return te&&te.binding&&te.binding("util")}catch{}}(),ee=je&&je.isTypedArray;function Fe(e,i){for(var s=-1,u=e==null?0:e.length,T=0,S=[];++s<u;){var P=e[s];i(P,s,e)&&(S[T++]=P)}return S}function re(e,i){for(var s=-1,u=i.length,T=e.length;++s<u;)e[T+s]=i[s];return e}function Re(e,i){for(var s=-1,u=e==null?0:e.length;++s<u;)if(i(e[s],s,e))return!0;return!1}function Fr(e,i){for(var s=-1,u=Array(e);++s<e;)u[s]=i(s);return u}function Rr(e){return function(i){return e(i)}}function Ft(e,i){return e.has(i)}function ne(e,i){return e==null?void 0:e[i]}function ze(e){var i=-1,s=Array(e.size);return e.forEach(function(u,T){s[++i]=[T,u]}),s}function Ne(e,i){return function(s){return e(i(s))}}function ft(e){var i=-1,s=Array(e.size);return e.forEach(function(u){s[++i]=u}),s}var Rt=Array.prototype,zr=Function.prototype,kt=Object.prototype,zt=at["__core-js_shared__"],ie=zr.toString,nt=kt.hasOwnProperty,He=function(){var e=/[^.]+$/.exec(zt&&zt.keys&&zt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=kt.toString,Nr=RegExp("^"+ie.call(nt).replace(Cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ae=Qt?at.Buffer:void 0,Nt=at.Symbol,Le=at.Uint8Array,Ht=kt.propertyIsEnumerable,Ot=Rt.splice,st=Nt?Nt.toStringTag:void 0,Ut=Object.getOwnPropertySymbols,se=ae?ae.isBuffer:void 0,xt=Ne(Object.keys,Object),oe=mt(at,"DataView"),Mt=mt(at,"Map"),ce=mt(at,"Promise"),ue=mt(at,"Set"),fe=mt(at,"WeakMap"),vt=mt(Object,"create"),Ge=q(oe),yt=q(Mt),Hr=q(ce),Ur=q(ue),Lr=q(fe),Be=Nt?Nt.prototype:void 0,le=Be?Be.valueOf:void 0;function B(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Gr(){this.__data__=vt?vt(null):{},this.size=0}function Br(e){var i=this.has(e)&&delete this.__data__[e];return this.size-=i?1:0,i}function Wr(e){var i=this.__data__;if(vt){var s=i[e];return s===a?void 0:s}return nt.call(i,e)?i[e]:void 0}function $r(e){var i=this.__data__;return vt?i[e]!==void 0:nt.call(i,e)}function Kr(e,i){var s=this.__data__;return this.size+=this.has(e)?0:1,s[e]=vt&&i===void 0?a:i,this}B.prototype.clear=Gr,B.prototype.delete=Br,B.prototype.get=Wr,B.prototype.has=$r,B.prototype.set=Kr;function $(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Vr(){this.__data__=[],this.size=0}function Yr(e){var i=this.__data__,s=Bt(i,e);if(s<0)return!1;var u=i.length-1;return s==u?i.pop():Ot.call(i,s,1),--this.size,!0}function Xr(e){var i=this.__data__,s=Bt(i,e);return s<0?void 0:i[s][1]}function qr(e){return Bt(this.__data__,e)>-1}function Jr(e,i){var s=this.__data__,u=Bt(s,e);return u<0?(++this.size,s.push([e,i])):s[u][1]=i,this}$.prototype.clear=Vr,$.prototype.delete=Yr,$.prototype.get=Xr,$.prototype.has=qr,$.prototype.set=Jr;function J(e){var i=-1,s=e==null?0:e.length;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Zr(){this.size=0,this.__data__={hash:new B,map:new(Mt||$),string:new B}}function Qr(e){var i=ot(this,e).delete(e);return this.size-=i?1:0,i}function tn(e){return ot(this,e).get(e)}function en(e){return ot(this,e).has(e)}function rn(e,i){var s=ot(this,e),u=s.size;return s.set(e,i),this.size+=s.size==u?0:1,this}J.prototype.clear=Zr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Lt(e){var i=-1,s=e==null?0:e.length;for(this.__data__=new J;++i<s;)this.add(e[i])}function We(e){return this.__data__.set(e,a),this}function Gt(e){return this.__data__.has(e)}Lt.prototype.add=Lt.prototype.push=We,Lt.prototype.has=Gt;function lt(e){var i=this.__data__=new $(e);this.size=i.size}function pe(){this.__data__=new $,this.size=0}function nn(e){var i=this.__data__,s=i.delete(e);return this.size=i.size,s}function an(e){return this.__data__.get(e)}function sn(e){return this.__data__.has(e)}function on(e,i){var s=this.__data__;if(s instanceof $){var u=s.__data__;if(!Mt||u.length<n-1)return u.push([e,i]),this.size=++s.size,this;s=this.__data__=new J(u)}return s.set(e,i),this.size=s.size,this}lt.prototype.clear=pe,lt.prototype.delete=nn,lt.prototype.get=an,lt.prototype.has=sn,lt.prototype.set=on;function cn(e,i){var s=Wt(e),u=!s&&Xe(e),T=!s&&!u&&$t(e),S=!s&&!u&&!T&&Ze(e),P=s||u||T||S,x=P?Fr(e.length,String):[],U=x.length;for(var D in e)nt.call(e,D)&&!(P&&(D=="length"||T&&(D=="offset"||D=="parent")||S&&(D=="buffer"||D=="byteLength"||D=="byteOffset")||mn(D,U)))&&x.push(D);return x}function Bt(e,i){for(var s=e.length;s--;)if(Ye(e[s][0],i))return s;return-1}function de(e,i,s){var u=i(e);return Wt(e)?u:re(u,s(e))}function Pt(e){return e==null?e===void 0?H:v:st&&st in Object(e)?bt(e):Ve(e)}function $e(e){return dt(e)&&Pt(e)==d}function Ke(e,i,s,u,T){return e===i?!0:e==null||i==null||!dt(e)&&!dt(i)?e!==e&&i!==i:un(e,i,s,u,Ke,T)}function un(e,i,s,u,T,S){var P=Wt(e),x=Wt(i),U=P?E:pt(e),D=x?E:pt(i);U=U==d?_:U,D=D==d?_:D;var K=U==_,Z=D==_,G=U==D;if(G&&$t(e)){if(!$t(i))return!1;P=!0,K=!1}if(G&&!K)return S||(S=new lt),P||Ze(e)?he(e,i,s,u,T,S):dn(e,i,U,s,u,T,S);if(!(s&o)){var V=K&&nt.call(e,"__wrapped__"),W=Z&&nt.call(i,"__wrapped__");if(V||W){var It=V?e.value():e,_t=W?i.value():i;return S||(S=new lt),T(It,_t,s,u,S)}}return G?(S||(S=new lt),hn(e,i,s,u,T,S)):!1}function fn(e){if(!Je(e)||_n(e))return!1;var i=qe(e)?Nr:it;return i.test(q(e))}function ln(e){return dt(e)&&me(e.length)&&!!F[Pt(e)]}function pn(e){if(!gn(e))return xt(e);var i=[];for(var s in Object(e))nt.call(e,s)&&s!="constructor"&&i.push(s);return i}function he(e,i,s,u,T,S){var P=s&o,x=e.length,U=i.length;if(x!=U&&!(P&&U>x))return!1;var D=S.get(e);if(D&&S.get(i))return D==i;var K=-1,Z=!0,G=s&c?new Lt:void 0;for(S.set(e,i),S.set(i,e);++K<x;){var V=e[K],W=i[K];if(u)var It=P?u(W,V,K,i,e,S):u(V,W,K,e,i,S);if(It!==void 0){if(It)continue;Z=!1;break}if(G){if(!Re(i,function(_t,Ct){if(!Ft(G,Ct)&&(V===_t||T(V,_t,s,u,S)))return G.push(Ct)})){Z=!1;break}}else if(!(V===W||T(V,W,s,u,S))){Z=!1;break}}return S.delete(e),S.delete(i),Z}function dn(e,i,s,u,T,S,P){switch(s){case X:if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case M:return!(e.byteLength!=i.byteLength||!S(new Le(e),new Le(i)));case w:case z:case b:return Ye(+e,+i);case h:return e.name==i.name&&e.message==i.message;case R:case O:return e==i+"";case f:var x=ze;case k:var U=u&o;if(x||(x=ft),e.size!=i.size&&!U)return!1;var D=P.get(e);if(D)return D==i;u|=c,P.set(e,i);var K=he(x(e),x(i),u,T,S,P);return P.delete(e),K;case N:if(le)return le.call(e)==le.call(i)}return!1}function hn(e,i,s,u,T,S){var P=s&o,x=Dt(e),U=x.length,D=Dt(i),K=D.length;if(U!=K&&!P)return!1;for(var Z=U;Z--;){var G=x[Z];if(!(P?G in i:nt.call(i,G)))return!1}var V=S.get(e);if(V&&S.get(i))return V==i;var W=!0;S.set(e,i),S.set(i,e);for(var It=P;++Z<U;){G=x[Z];var _t=e[G],Ct=i[G];if(u)var ni=P?u(Ct,_t,G,i,e,S):u(_t,Ct,G,e,i,S);if(!(ni===void 0?_t===Ct||T(_t,Ct,s,u,S):ni)){W=!1;break}It||(It=G=="constructor")}if(W&&!It){var Qe=e.constructor,tr=i.constructor;Qe!=tr&&"constructor"in e&&"constructor"in i&&!(typeof Qe=="function"&&Qe instanceof Qe&&typeof tr=="function"&&tr instanceof tr)&&(W=!1)}return S.delete(e),S.delete(i),W}function Dt(e){return de(e,be,yn)}function ot(e,i){var s=e.__data__;return bn(i)?s[typeof i=="string"?"string":"hash"]:s.map}function mt(e,i){var s=ne(e,i);return fn(s)?s:void 0}function bt(e){var i=nt.call(e,st),s=e[st];try{e[st]=void 0;var u=!0}catch{}var T=Ue.call(e);return u&&(i?e[st]=s:delete e[st]),T}var yn=Ut?function(e){return e==null?[]:(e=Object(e),Fe(Ut(e),function(i){return Ht.call(e,i)}))}:In,pt=Pt;(oe&&pt(new oe(new ArrayBuffer(1)))!=X||Mt&&pt(new Mt)!=f||ce&&pt(ce.resolve())!=m||ue&&pt(new ue)!=k||fe&&pt(new fe)!=I)&&(pt=function(e){var i=Pt(e),s=i==_?e.constructor:void 0,u=s?q(s):"";if(u)switch(u){case Ge:return X;case yt:return f;case Hr:return m;case Ur:return k;case Lr:return I}return i});function mn(e,i){return i=i??l,!!i&&(typeof e=="number"||Me.test(e))&&e>-1&&e%1==0&&e<i}function bn(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function _n(e){return!!He&&He in e}function gn(e){var i=e&&e.constructor,s=typeof i=="function"&&i.prototype||kt;return e===s}function Ve(e){return Ue.call(e)}function q(e){if(e!=null){try{return ie.call(e)}catch{}try{return e+""}catch{}}return""}function Ye(e,i){return e===i||e!==e&&i!==i}var Xe=$e(function(){return arguments}())?$e:function(e){return dt(e)&&nt.call(e,"callee")&&!Ht.call(e,"callee")},Wt=Array.isArray;function ye(e){return e!=null&&me(e.length)&&!qe(e)}var $t=se||Sn;function vn(e,i){return Ke(e,i)}function qe(e){if(!Je(e))return!1;var i=Pt(e);return i==p||i==g||i==C||i==y}function me(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=l}function Je(e){var i=typeof e;return e!=null&&(i=="object"||i=="function")}function dt(e){return e!=null&&typeof e=="object"}var Ze=ee?Rr(ee):ln;function be(e){return ye(e)?cn(e):pn(e)}function In(){return[]}function Sn(){return!1}t.exports=vn}(Ie,Ie.exports);var yi=Ie.exports;const ut=cr(yi);var Se={exports:{}};Se.exports,function(t,r){var n=200,a="__lodash_hash_undefined__",o=9007199254740991,c="[object Arguments]",l="[object Array]",d="[object Boolean]",E="[object Date]",C="[object Error]",w="[object Function]",z="[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]",R="[object ArrayBuffer]",k="[object DataView]",O="[object Float32Array]",N="[object Float64Array]",H="[object Int8Array]",I="[object Int16Array]",M="[object Int32Array]",X="[object Uint8Array]",ke="[object Uint8ClampedArray]",Oe="[object Uint16Array]",xe="[object Uint32Array]",Or=/[\\^$.*+?()[\]{}|]/g,xr=/\w*$/,Mr=/^\[object .+?Constructor\]$/,Pr=/^(?:0|[1-9]\d*)$/,j={};j[c]=j[l]=j[R]=j[k]=j[d]=j[E]=j[O]=j[N]=j[H]=j[I]=j[M]=j[h]=j[p]=j[g]=j[b]=j[v]=j[_]=j[m]=j[X]=j[ke]=j[Oe]=j[xe]=!0,j[C]=j[w]=j[y]=!1;var Dr=typeof et=="object"&&et&&et.Object===Object&&et,Cr=typeof self=="object"&&self&&self.Object===Object&&self,it=Dr||Cr||Function("return this")(),Me=r&&!r.nodeType&&r,F=Me&&!0&&t&&!t.nodeType&&t,Pe=F&&F.exports===Me;function jr(e,i){return e.set(i[0],i[1]),e}function at(e,i){return e.add(i),e}function De(e,i){for(var s=-1,u=e?e.length:0;++s<u&&i(e[s],s,e)!==!1;);return e}function Ce(e,i){for(var s=-1,u=i.length,T=e.length;++s<u;)e[T+s]=i[s];return e}function Qt(e,i,s,u){for(var T=-1,S=e?e.length:0;++T<S;)s=i(s,e[T],T,e);return s}function te(e,i){for(var s=-1,u=Array(e);++s<e;)u[s]=i(s);return u}function je(e,i){return e==null?void 0:e[i]}function ee(e){var i=!1;if(e!=null&&typeof e.toString!="function")try{i=!!(e+"")}catch{}return i}function Fe(e){var i=-1,s=Array(e.size);return e.forEach(function(u,T){s[++i]=[T,u]}),s}function re(e,i){return function(s){return e(i(s))}}function Re(e){var i=-1,s=Array(e.size);return e.forEach(function(u){s[++i]=u}),s}var Fr=Array.prototype,Rr=Function.prototype,Ft=Object.prototype,ne=it["__core-js_shared__"],ze=function(){var e=/[^.]+$/.exec(ne&&ne.keys&&ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ne=Rr.toString,ft=Ft.hasOwnProperty,Rt=Ft.toString,zr=RegExp("^"+Ne.call(ft).replace(Or,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kt=Pe?it.Buffer:void 0,zt=it.Symbol,ie=it.Uint8Array,nt=re(Object.getPrototypeOf,Object),He=Object.create,Ue=Ft.propertyIsEnumerable,Nr=Fr.splice,ae=Object.getOwnPropertySymbols,Nt=kt?kt.isBuffer:void 0,Le=re(Object.keys,Object),Ht=ot(it,"DataView"),Ot=ot(it,"Map"),st=ot(it,"Promise"),Ut=ot(it,"Set"),se=ot(it,"WeakMap"),xt=ot(Object,"create"),oe=q(Ht),Mt=q(Ot),ce=q(st),ue=q(Ut),fe=q(se),vt=zt?zt.prototype:void 0,Ge=vt?vt.valueOf:void 0;function yt(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Hr(){this.__data__=xt?xt(null):{}}function Ur(e){return this.has(e)&&delete this.__data__[e]}function Lr(e){var i=this.__data__;if(xt){var s=i[e];return s===a?void 0:s}return ft.call(i,e)?i[e]:void 0}function Be(e){var i=this.__data__;return xt?i[e]!==void 0:ft.call(i,e)}function le(e,i){var s=this.__data__;return s[e]=xt&&i===void 0?a:i,this}yt.prototype.clear=Hr,yt.prototype.delete=Ur,yt.prototype.get=Lr,yt.prototype.has=Be,yt.prototype.set=le;function B(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Gr(){this.__data__=[]}function Br(e){var i=this.__data__,s=Gt(i,e);if(s<0)return!1;var u=i.length-1;return s==u?i.pop():Nr.call(i,s,1),!0}function Wr(e){var i=this.__data__,s=Gt(i,e);return s<0?void 0:i[s][1]}function $r(e){return Gt(this.__data__,e)>-1}function Kr(e,i){var s=this.__data__,u=Gt(s,e);return u<0?s.push([e,i]):s[u][1]=i,this}B.prototype.clear=Gr,B.prototype.delete=Br,B.prototype.get=Wr,B.prototype.has=$r,B.prototype.set=Kr;function $(e){var i=-1,s=e?e.length:0;for(this.clear();++i<s;){var u=e[i];this.set(u[0],u[1])}}function Vr(){this.__data__={hash:new yt,map:new(Ot||B),string:new yt}}function Yr(e){return Dt(this,e).delete(e)}function Xr(e){return Dt(this,e).get(e)}function qr(e){return Dt(this,e).has(e)}function Jr(e,i){return Dt(this,e).set(e,i),this}$.prototype.clear=Vr,$.prototype.delete=Yr,$.prototype.get=Xr,$.prototype.has=qr,$.prototype.set=Jr;function J(e){this.__data__=new B(e)}function Zr(){this.__data__=new B}function Qr(e){return this.__data__.delete(e)}function tn(e){return this.__data__.get(e)}function en(e){return this.__data__.has(e)}function rn(e,i){var s=this.__data__;if(s instanceof B){var u=s.__data__;if(!Ot||u.length<n-1)return u.push([e,i]),this;s=this.__data__=new $(u)}return s.set(e,i),this}J.prototype.clear=Zr,J.prototype.delete=Qr,J.prototype.get=tn,J.prototype.has=en,J.prototype.set=rn;function Lt(e,i){var s=ye(e)||Wt(e)?te(e.length,String):[],u=s.length,T=!!u;for(var S in e)ft.call(e,S)&&!(T&&(S=="length"||bn(S,u)))&&s.push(S);return s}function We(e,i,s){var u=e[i];(!(ft.call(e,i)&&Xe(u,s))||s===void 0&&!(i in e))&&(e[i]=s)}function Gt(e,i){for(var s=e.length;s--;)if(Xe(e[s][0],i))return s;return-1}function lt(e,i){return e&&he(i,be(i),e)}function pe(e,i,s,u,T,S,P){var x;if(u&&(x=S?u(e,T,S,P):u(e)),x!==void 0)return x;if(!dt(e))return e;var U=ye(e);if(U){if(x=yn(e),!i)return pn(e,x)}else{var D=bt(e),K=D==w||D==z;if(qe(e))return Bt(e,i);if(D==g||D==c||K&&!S){if(ee(e))return S?e:{};if(x=pt(K?{}:e),!i)return dn(e,lt(x,e))}else{if(!j[D])return S?e:{};x=mn(e,D,pe,i)}}P||(P=new J);var Z=P.get(e);if(Z)return Z;if(P.set(e,x),!U)var G=s?hn(e):be(e);return De(G||e,function(V,W){G&&(W=V,V=e[W]),We(x,W,pe(V,i,s,u,W,e,P))}),x}function nn(e){return dt(e)?He(e):{}}function an(e,i,s){var u=i(e);return ye(e)?u:Ce(u,s(e))}function sn(e){return Rt.call(e)}function on(e){if(!dt(e)||gn(e))return!1;var i=me(e)||ee(e)?zr:Mr;return i.test(q(e))}function cn(e){if(!Ve(e))return Le(e);var i=[];for(var s in Object(e))ft.call(e,s)&&s!="constructor"&&i.push(s);return i}function Bt(e,i){if(i)return e.slice();var s=new e.constructor(e.length);return e.copy(s),s}function de(e){var i=new e.constructor(e.byteLength);return new ie(i).set(new ie(e)),i}function Pt(e,i){var s=i?de(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function $e(e,i,s){var u=i?s(Fe(e),!0):Fe(e);return Qt(u,jr,new e.constructor)}function Ke(e){var i=new e.constructor(e.source,xr.exec(e));return i.lastIndex=e.lastIndex,i}function un(e,i,s){var u=i?s(Re(e),!0):Re(e);return Qt(u,at,new e.constructor)}function fn(e){return Ge?Object(Ge.call(e)):{}}function ln(e,i){var s=i?de(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function pn(e,i){var s=-1,u=e.length;for(i||(i=Array(u));++s<u;)i[s]=e[s];return i}function he(e,i,s,u){s||(s={});for(var T=-1,S=i.length;++T<S;){var P=i[T],x=void 0;We(s,P,x===void 0?e[P]:x)}return s}function dn(e,i){return he(e,mt(e),i)}function hn(e){return an(e,be,mt)}function Dt(e,i){var s=e.__data__;return _n(i)?s[typeof i=="string"?"string":"hash"]:s.map}function ot(e,i){var s=je(e,i);return on(s)?s:void 0}var mt=ae?re(ae,Object):In,bt=sn;(Ht&&bt(new Ht(new ArrayBuffer(1)))!=k||Ot&&bt(new Ot)!=h||st&&bt(st.resolve())!=f||Ut&&bt(new Ut)!=v||se&&bt(new se)!=y)&&(bt=function(e){var i=Rt.call(e),s=i==g?e.constructor:void 0,u=s?q(s):void 0;if(u)switch(u){case oe:return k;case Mt:return h;case ce:return f;case ue:return v;case fe:return y}return i});function yn(e){var i=e.length,s=e.constructor(i);return i&&typeof e[0]=="string"&&ft.call(e,"index")&&(s.index=e.index,s.input=e.input),s}function pt(e){return typeof e.constructor=="function"&&!Ve(e)?nn(nt(e)):{}}function mn(e,i,s,u){var T=e.constructor;switch(i){case R:return de(e);case d:case E:return new T(+e);case k:return Pt(e,u);case O:case N:case H:case I:case M:case X:case ke:case Oe:case xe:return ln(e,u);case h:return $e(e,u,s);case p:case _:return new T(e);case b:return Ke(e);case v:return un(e,u,s);case m:return fn(e)}}function bn(e,i){return i=i??o,!!i&&(typeof e=="number"||Pr.test(e))&&e>-1&&e%1==0&&e<i}function _n(e){var i=typeof e;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?e!=="__proto__":e===null}function gn(e){return!!ze&&ze in e}function Ve(e){var i=e&&e.constructor,s=typeof i=="function"&&i.prototype||Ft;return e===s}function q(e){if(e!=null){try{return Ne.call(e)}catch{}try{return e+""}catch{}}return""}function Ye(e){return pe(e,!0,!0)}function Xe(e,i){return e===i||e!==e&&i!==i}function Wt(e){return vn(e)&&ft.call(e,"callee")&&(!Ue.call(e,"callee")||Rt.call(e)==c)}var ye=Array.isArray;function $t(e){return e!=null&&Je(e.length)&&!me(e)}function vn(e){return Ze(e)&&$t(e)}var qe=Nt||Sn;function me(e){var i=dt(e)?Rt.call(e):"";return i==w||i==z}function Je(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=o}function dt(e){var i=typeof e;return!!e&&(i=="object"||i=="function")}function Ze(e){return!!e&&typeof e=="object"}function be(e){return $t(e)?Lt(e):cn(e)}function In(){return[]}function Sn(){return!1}t.exports=Ye}(Se,Se.exports);var mi=Se.exports;const rt=cr(mi),ur=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(a=>a));return r.length===0?Promise.resolve(!0):new Promise((n,a)=>{Promise.all(r).then(o=>{o.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(o=>a(o))})},bi=t=>new Promise((r,n)=>{const a=new Image;console.warn("update cdn config for cors?"),a.onload=()=>{const o=a.width,c=a.height;r({width:o,height:c})},a.onerror=o=>{n(o)},a.crossOrigin="anonymous",a.src=t}),_i=t=>new Promise((r,n)=>{const a=new Audio;a.preload="auto",a.addEventListener("loadedmetadata",()=>{const o=a.duration*1e3;r({duration:o})}),a.addEventListener("error",o=>{n(o)}),a.src=t,a.crossOrigin="anonymous",a.load()}),gi=t=>new Promise((r,n)=>{const a=document.createElement("video");a.preload="auto",a.addEventListener("loadedmetadata",()=>{const o=a.duration*1e3,c=a.videoWidth,l=a.videoHeight;r({duration:o,width:c,height:l})}),a.addEventListener("error",o=>{n(o)}),a.src=t,a.load()}),vi=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(o=>{o!=="height"&&(n.style[o]=r[o])}),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 a=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(a)},fr={color:"#000000",x:0,y:0,blur:0},we=(t,r)=>{const n=(r==null?void 0:r.duration)||5e3,a={from:0,to:n};if(!t)return a;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),a;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."),a;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),a}return t},Rn=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function lr(t,r){const n={x:t.size.width/2,y:t.size.height/2},a={x:r.width/2,y:r.height/2},o=Math.min(t.size.width/r.width,t.size.height/r.height),c=n.x-a.x;return{top:`${n.y-a.y}px`,left:`${c}px`,transform:`scale(${o})`}}const Ii=async(t,r)=>{const n=t.details.src,a=await gi(n),o=lr(r,{...a}),c={width:a.width,height:a.height,duration:a.duration,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||fr,top:o.top||"0px",left:o.left||"0px",transform:o.transform};return{...t,trim:Rn(t.trim,{duration:a.duration}),type:"video",name:"video",details:c,display:we(t.display,{duration:a.duration})}},Si=async t=>{const r=t.id,n=t.details,o=(await _i(n.src)).duration;return{id:r,name:"",type:"audio",display:we(t.display,{duration:o}),trim:Rn(t.trim,{duration:o}),details:{src:n.src,duration:o,volume:n.volume??100},metadata:{...t.metadata}}},wi=async(t,r)=>{const n=t.details,a=await bi(n.src),o=lr(r,a);return{id:t.id,type:"image",name:"image",display:we(t.display),details:{src:n.src||"",width:n.width||a.width||100,height:n.height||a.height||100,opacity:n.opacity??100,transform:o.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||fr,top:o.top||"0px",left:o.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000"},metadata:t.metadata||{}}},Ti=async(t,r,n=!0)=>{const a=t.id;n&&await ur([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const o=t.details,c=Ai(o),l=vi(t.details.text,c),d=lr(r,{width:c.width,height:l});return{id:a,name:r.type,type:r.type,display:we(t.display),details:{...c,text:o.text||"",height:l,fontUrl:o.fontUrl,top:d.top,left:d.left,borderWidth:o.borderWidth||0,borderColor:o.borderColor||"#000000",boxShadow:o.boxShadow||fr},metadata:{}}},Ai=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||"0px",left:t.left||"0px"}),Ei="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let pr=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Ei[n[t]&63];return r};function ki(t,r){return t.map(n=>({...n,items:n.items.filter(a=>!r.includes(a))}))}function dr(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let a=pr(t-1);return a=a.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+a}const zn=t=>Object.keys(t).reduce((r,n)=>{const{display:a}=t[n];return Math.max(r,a.to)},0),Nn=async(t,r,n)=>{const a=await Ti(t,{size:{width:1080,height:1920},type:n}),{details:o,...c}=a;return r.trackItemDetailsMap[c.id]={type:n,details:o},r.trackItemsMap[c.id]=c,c.id};function Oi(t){const r=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.DESIGN_PREFIX))),n=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ADD_PREFIX))),a=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.LAYER_PREFIX))),o=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.HISTORY_PREFIX))),c=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.ACTIVE_PREFIX))),l=A.subject.pipe(A.filter(({key:p})=>p.startsWith(A.EDIT_PREFIX))),d=r.subscribe(async p=>{var g;if(p.key===A.DESIGN_LOAD){const f=(g=p.value)==null?void 0:g.payload,b=f.trackItemIds,v=f.trackItemDetailsMap,_=b.map(async m=>{const y=v[m];return(y.type==="caption"||y.type==="text")&&await ur([{fontFamily:y.details.fontFamily,url:y.details.fontUrl}]),!0});await Promise.all(_),t.updateState({...f})}}),E=o.subscribe(p=>{if(p.key===A.HISTORY_UNDO)return t.undo();if(p.key===A.HISTORY_REDO)return t.redo()}),C=a.subscribe(p=>{var f,b;const g=[];(f=p.value)!=null&&f.payload.trackItemIds&&g.push((b=p.value)==null?void 0:b.payload.trackItemIds),t.updateState({activeIds:g})}),w=n.subscribe(async p=>{var v,_,m,y,R,k,O;const g=[],f=rt(t.getState());if((v=p.value)!=null&&v.payload.id?g.push((_=p.value)==null?void 0:_.payload.id):g.push(dr()),p.key===A.ADD_CAPTION){const H=((m=p.value)==null?void 0:m.payload).map(async M=>await Nn(M,f,"caption")),I=await Promise.all(H);g.splice(0,g.length),I.forEach(M=>{g.push(M),f.trackItemIds.push(M)})}if(p.key===A.ADD_TEXT){const N=await Nn((y=p.value)==null?void 0:y.payload,f,"text");f.trackItemIds.push(N)}if(p.key===A.ADD_IMAGE){const N=await wi((R=p.value)==null?void 0:R.payload,{size:{width:1080,height:1920}}),{details:H,...I}=N;f.trackItemDetailsMap[I.id]={type:"image",details:H},f.trackItemsMap[I.id]=I,f.trackItemIds.push(I.id)}if(p.key===A.ADD_AUDIO){const N=await Si((k=p.value)==null?void 0:k.payload),{details:H,...I}=N;f.trackItemDetailsMap[I.id]={type:"audio",details:H},f.trackItemsMap[I.id]=I,f.trackItemIds.push(I.id)}if(p.key===A.ADD_VIDEO){const N=await Ii((O=p.value)==null?void 0:O.payload,{size:{width:1080,height:1920}}),{details:H,...I}=N;f.trackItemDetailsMap[I.id]={type:"video",details:H},f.trackItemsMap[I.id]=I,f.trackItemIds.push(I.id)}f.tracks.unshift({id:pr(),accepts:["text","audio","helper","video","image","caption"],type:"text",items:g,magnetic:!1,static:!1});const b=zn(f.trackItemsMap);t.updateState({trackItemIds:f.trackItemIds,trackItemDetailsMap:f.trackItemDetailsMap,trackItemsMap:f.trackItemsMap,tracks:f.tracks,duration:b},{updateHistory:!0,kind:"add"})}),z=c.subscribe(async p=>{var g;if(p.key===A.ACTIVE_DELETE){const f=rt(t.getState()),b=f.activeIds,v=f.trackItemIds,_=f.trackItemDetailsMap,m=v.filter(O=>!b.includes(O)),y=Object.fromEntries(Object.entries(_).filter(([O])=>!b.includes(O))),R=ki(f.tracks,b),k=zn(f.trackItemsMap);t.updateState({trackItemIds:m,trackItemDetailsMap:y,activeIds:[],tracks:R,duration:k},{updateHistory:!0,kind:"remove"})}if(p.key===A.ACTIVE_SPLIT){const f=rt(t.getState()),b=(g=p.value)==null?void 0:g.options.time;if(f.activeIds.length===1){const v=f.activeIds[0],_=f.trackItemsMap[v];if(b>=_.display.to||b<=_.display.from)return;const m=f.trackItemDetailsMap[v],y=dr(),R={..._,id:y,display:{from:b,to:_.display.to}};f.trackItemsMap[v].display.to=b,f.trackItemsMap[y]=R,f.trackItemIds.push(y),f.trackItemDetailsMap[y]=m,f.tracks.forEach(k=>{k.items.includes(v)&&k.items.push(y)}),t.updateState({trackItemDetailsMap:f.trackItemDetailsMap,tracks:f.tracks,trackItemIds:f.trackItemIds,trackItemsMap:f.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(p.key===A.ACTIVE_CLONE){const f=rt(t.getState());if(f.activeIds.length){const b=f.activeIds,v=[],_={activeIds:b,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};b.forEach(y=>{_.trackItemDetailsMap[y]=f.trackItemDetailsMap[y],_.trackItemsMap[y]=f.trackItemsMap[y],v.push(f.tracks.find(R=>R.items.includes(y)))});const m=new Set;v.filter(y=>m.has(y.id)?!1:(m.add(y),!0)),_.tracks=Array.from(m.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(_))}}if(p.key===A.ACTIVE_PASTE){const f=localStorage.getItem("DesignComboTemp");if(!f)return;const b=rt(t.getState()),v=JSON.parse(f),_={},m=v.trackItemsMap,y=v.trackItemDetailsMap,R=v.tracks,k=[],O=v.activeIds.map(async N=>{const H=y[N];(H.type==="caption"||H.type==="text")&&await ur([{fontFamily:H.details.fontFamily,url:H.details.fontUrl}]);const I=dr();return _[N]=I,b.trackItemsMap[I]={...m[N],id:I},b.trackItemDetailsMap[I]=H,b.trackItemIds.push(I),!0});await Promise.all(O),R.forEach(N=>{const H=N.items.map(M=>_[M]),I={...N,items:H,id:pr()};k.push(I)}),b.tracks=[...b.tracks,...k],t.updateState({trackItemDetailsMap:b.trackItemDetailsMap,tracks:b.tracks,trackItemIds:b.trackItemIds,trackItemsMap:b.trackItemsMap},{updateHistory:!0,kind:"update"})}}),h=l.subscribe(p=>{var g,f;if(p.key===A.EDIT_OBJECT){const b=t.getState(),v=rt(b.trackItemDetailsMap),_=Object.keys((g=p.value)==null?void 0:g.payload);if(!_.length)return;const m=(f=p.value)==null?void 0:f.payload;_.forEach(y=>{v[y].details={...v[y].details,...m[y].details}}),t.updateState({trackItemDetailsMap:{...v}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{w.unsubscribe(),z.unsubscribe(),h.unsubscribe(),E.unsubscribe(),C.unsubscribe(),d.unsubscribe()}}}const xi={Date:!0,RegExp:!0,String:!0,Number:!0};function Hn(t,r,n={cyclesFix:!0},a=[]){var d,E;let o=[];const c=Array.isArray(t);for(const C in t){const w=t[C],z=c?+C:C;if(!(C in r)){o.push({type:"REMOVE",path:[z],oldValue:t[C]});continue}const h=r[C],p=typeof w=="object"&&typeof h=="object"&&Array.isArray(w)===Array.isArray(h);if(w&&h&&p&&!xi[(E=(d=Object.getPrototypeOf(w))==null?void 0:d.constructor)==null?void 0:E.name]&&(!n.cyclesFix||!a.includes(w))){const g=Hn(w,h,n,n.cyclesFix?a.concat([w]):[]);o.push.apply(o,g.map(f=>(f.path.unshift(z),f)))}else w!==h&&!(Number.isNaN(w)&&Number.isNaN(h))&&!(p&&(isNaN(w)?w+""==h+"":+w==+h))&&o.push({path:[z],type:"CHANGE",value:h,oldValue:w})}const l=Array.isArray(r);for(const C in r)C in t||o.push({type:"CREATE",path:[l?+C:C],value:r[C]});return o}var hr=Symbol.for("immer-nothing"),Kt=Symbol.for("immer-draftable"),Q=Symbol.for("immer-state"),Un=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 L(t,...r){if(process.env.NODE_ENV!=="production"){const n=Un[t],a=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${a}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var St=Object.getPrototypeOf;function wt(t){return!!t&&!!t[Q]}function gt(t){var r;return t?Ln(t)||Array.isArray(t)||!!t[Kt]||!!((r=t.constructor)!=null&&r[Kt])||Xt(t)||qt(t):!1}var Mi=Object.prototype.constructor.toString();function Ln(t){if(!t||typeof t!="object")return!1;const r=St(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)===Mi}function Vt(t,r){Tt(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,a)=>r(a,n,t))}function Tt(t){const r=t[Q];return r?r.type_:Array.isArray(t)?1:Xt(t)?2:qt(t)?3:0}function Yt(t,r){return Tt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function yr(t,r){return Tt(t)===2?t.get(r):t[r]}function Gn(t,r,n){const a=Tt(t);a===2?t.set(r,n):a===3?t.add(n):t[r]=n}function Pi(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Xt(t){return t instanceof Map}function qt(t){return t instanceof Set}function At(t){return t.copy_||t.base_}function mr(t,r){if(Xt(t))return new Map(t);if(qt(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Ln(t);if(r===!0||r==="class_only"&&!n){const a=Object.getOwnPropertyDescriptors(t);delete a[Q];let o=Reflect.ownKeys(a);for(let c=0;c<o.length;c++){const l=o[c],d=a[l];d.writable===!1&&(d.writable=!0,d.configurable=!0),(d.get||d.set)&&(a[l]={configurable:!0,writable:!0,enumerable:d.enumerable,value:t[l]})}return Object.create(St(t),a)}else{const a=St(t);if(a!==null&&n)return{...t};const o=Object.create(a);return Object.assign(o,t)}}function br(t,r=!1){return Te(t)||wt(t)||!gt(t)||(Tt(t)>1&&(t.set=t.add=t.clear=t.delete=Di),Object.freeze(t),r&&Object.entries(t).forEach(([n,a])=>br(a,!0))),t}function Di(){L(2)}function Te(t){return Object.isFrozen(t)}var _r={};function Et(t){const r=_r[t];return r||L(0,t),r}function Ci(t,r){_r[t]||(_r[t]=r)}var Jt;function Bn(){return Jt}function ji(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Wn(t,r){r&&(Et("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function gr(t){vr(t),t.drafts_.forEach(Fi),t.drafts_=null}function vr(t){t===Jt&&(Jt=t.parent_)}function $n(t){return Jt=ji(Jt,t)}function Fi(t){const r=t[Q];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Kn(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[Q].modified_&&(gr(r),L(4)),gt(t)&&(t=Ae(r,t),r.parent_||Ee(r,t)),r.patches_&&Et("Patches").generateReplacementPatches_(n[Q].base_,t,r.patches_,r.inversePatches_)):t=Ae(r,n,[]),gr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==hr?t:void 0}function Ae(t,r,n){if(Te(r))return r;const a=r[Q];if(!a)return Vt(r,(o,c)=>Vn(t,a,r,o,c,n)),r;if(a.scope_!==t)return r;if(!a.modified_)return Ee(t,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const o=a.copy_;let c=o,l=!1;a.type_===3&&(c=new Set(o),o.clear(),l=!0),Vt(c,(d,E)=>Vn(t,a,o,d,E,n,l)),Ee(t,o,!1),n&&t.patches_&&Et("Patches").generatePatches_(a,n,t.patches_,t.inversePatches_)}return a.copy_}function Vn(t,r,n,a,o,c,l){if(process.env.NODE_ENV!=="production"&&o===n&&L(5),wt(o)){const d=c&&r&&r.type_!==3&&!Yt(r.assigned_,a)?c.concat(a):void 0,E=Ae(t,o,d);if(Gn(n,a,E),wt(E))t.canAutoFreeze_=!1;else return}else l&&n.add(o);if(gt(o)&&!Te(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;Ae(t,o),(!r||!r.scope_.parent_)&&typeof a!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,a)&&Ee(t,o)}}function Ee(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&br(r,n)}function Ri(t,r){const n=Array.isArray(t),a={type_:n?1:0,scope_:r?r.scope_:Bn(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=a,c=Ir;n&&(o=[a],c=Zt);const{revoke:l,proxy:d}=Proxy.revocable(o,c);return a.draft_=d,a.revoke_=l,d}var Ir={get(t,r){if(r===Q)return t;const n=At(t);if(!Yt(n,r))return zi(t,n,r);const a=n[r];return t.finalized_||!gt(a)?a:a===Sr(t.base_,r)?(Tr(t),t.copy_[r]=Ar(a,t)):a},has(t,r){return r in At(t)},ownKeys(t){return Reflect.ownKeys(At(t))},set(t,r,n){const a=Yn(At(t),r);if(a!=null&&a.set)return a.set.call(t.draft_,n),!0;if(!t.modified_){const o=Sr(At(t),r),c=o==null?void 0:o[Q];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Pi(n,o)&&(n!==void 0||Yt(t.base_,r)))return!0;Tr(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 Sr(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Tr(t),wr(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=At(t),a=Reflect.getOwnPropertyDescriptor(n,r);return a&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:a.enumerable,value:n[r]}},defineProperty(){L(11)},getPrototypeOf(t){return St(t.base_)},setPrototypeOf(){L(12)}},Zt={};Vt(Ir,(t,r)=>{Zt[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Zt.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&L(13),Zt.set.call(this,t,r,void 0)},Zt.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&L(14),Ir.set.call(this,t[0],r,n,t[0])};function Sr(t,r){const n=t[Q];return(n?At(n):t)[r]}function zi(t,r,n){var o;const a=Yn(r,n);return a?"value"in a?a.value:(o=a.get)==null?void 0:o.call(t.draft_):void 0}function Yn(t,r){if(!(r in t))return;let n=St(t);for(;n;){const a=Object.getOwnPropertyDescriptor(n,r);if(a)return a;n=St(n)}}function wr(t){t.modified_||(t.modified_=!0,t.parent_&&wr(t.parent_))}function Tr(t){t.copy_||(t.copy_=mr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Ni=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,a)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const l=this;return function(E=c,...C){return l.produce(E,w=>n.call(this,w,...C))}}typeof n!="function"&&L(6),a!==void 0&&typeof a!="function"&&L(7);let o;if(gt(r)){const c=$n(this),l=Ar(r,void 0);let d=!0;try{o=n(l),d=!1}finally{d?gr(c):vr(c)}return Wn(c,a),Kn(o,c)}else if(!r||typeof r!="object"){if(o=n(r),o===void 0&&(o=r),o===hr&&(o=void 0),this.autoFreeze_&&br(o,!0),a){const c=[],l=[];Et("Patches").generateReplacementPatches_(r,o,c,l),a(c,l)}return o}else L(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(l,...d)=>this.produceWithPatches(l,E=>r(E,...d));let a,o;return[this.produce(r,n,(l,d)=>{a=l,o=d}),a,o]},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){gt(t)||L(8),wt(t)&&(t=Hi(t));const r=$n(this),n=Ar(t,void 0);return n[Q].isManual_=!0,vr(r),n}finishDraft(t,r){const n=t&&t[Q];(!n||!n.isManual_)&&L(9);const{scope_:a}=n;return Wn(a,r),Kn(void 0,a)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const o=r[n];if(o.path.length===0&&o.op==="replace"){t=o.value;break}}n>-1&&(r=r.slice(n+1));const a=Et("Patches").applyPatches_;return wt(t)?a(t,r):this.produce(t,o=>a(o,r))}};function Ar(t,r){const n=Xt(t)?Et("MapSet").proxyMap_(t,r):qt(t)?Et("MapSet").proxySet_(t,r):Ri(t,r);return(r?r.scope_:Bn()).drafts_.push(n),n}function Hi(t){return wt(t)||L(10,t),Xn(t)}function Xn(t){if(!gt(t)||Te(t))return t;const r=t[Q];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=mr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=mr(t,!0);return Vt(n,(a,o)=>{Gn(n,a,Xn(o))}),r&&(r.finalized_=!1),n}function qn(){process.env.NODE_ENV!=="production"&&Un.push('Sets cannot have "replace" patches.',function(h){return"Unsupported patch operation: "+h},function(h){return"Cannot apply patch, path doesn't resolve: "+h},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",a="remove";function o(h,p,g,f){switch(h.type_){case 0:case 2:return l(h,p,g,f);case 1:return c(h,p,g,f);case 3:return d(h,p,g,f)}}function c(h,p,g,f){let{base_:b,assigned_:v}=h,_=h.copy_;_.length<b.length&&([b,_]=[_,b],[g,f]=[f,g]);for(let m=0;m<b.length;m++)if(v[m]&&_[m]!==b[m]){const y=p.concat([m]);g.push({op:r,path:y,value:z(_[m])}),f.push({op:r,path:y,value:z(b[m])})}for(let m=b.length;m<_.length;m++){const y=p.concat([m]);g.push({op:n,path:y,value:z(_[m])})}for(let m=_.length-1;b.length<=m;--m){const y=p.concat([m]);f.push({op:a,path:y})}}function l(h,p,g,f){const{base_:b,copy_:v}=h;Vt(h.assigned_,(_,m)=>{const y=yr(b,_),R=yr(v,_),k=m?Yt(b,_)?r:n:a;if(y===R&&k===r)return;const O=p.concat(_);g.push(k===a?{op:k,path:O}:{op:k,path:O,value:R}),f.push(k===n?{op:a,path:O}:k===a?{op:n,path:O,value:z(y)}:{op:r,path:O,value:z(y)})})}function d(h,p,g,f){let{base_:b,copy_:v}=h,_=0;b.forEach(m=>{if(!v.has(m)){const y=p.concat([_]);g.push({op:a,path:y,value:m}),f.unshift({op:n,path:y,value:m})}_++}),_=0,v.forEach(m=>{if(!b.has(m)){const y=p.concat([_]);g.push({op:n,path:y,value:m}),f.unshift({op:a,path:y,value:m})}_++})}function E(h,p,g,f){g.push({op:r,path:[],value:p===hr?void 0:p}),f.push({op:r,path:[],value:h})}function C(h,p){return p.forEach(g=>{const{path:f,op:b}=g;let v=h;for(let R=0;R<f.length-1;R++){const k=Tt(v);let O=f[R];typeof O!="string"&&typeof O!="number"&&(O=""+O),(k===0||k===1)&&(O==="__proto__"||O==="constructor")&&L(19),typeof v=="function"&&O==="prototype"&&L(19),v=yr(v,O),typeof v!="object"&&L(18,f.join("/"))}const _=Tt(v),m=w(g.value),y=f[f.length-1];switch(b){case r:switch(_){case 2:return v.set(y,m);case 3:L(16);default:return v[y]=m}case n:switch(_){case 1:return y==="-"?v.push(m):v.splice(y,0,m);case 2:return v.set(y,m);case 3:return v.add(m);default:return v[y]=m}case a:switch(_){case 1:return v.splice(y,1);case 2:return v.delete(y);case 3:return v.delete(g.value);default:return delete v[y]}default:L(17,b)}}),h}function w(h){if(!gt(h))return h;if(Array.isArray(h))return h.map(w);if(Xt(h))return new Map(Array.from(h.entries()).map(([g,f])=>[g,w(f)]));if(qt(h))return new Set(Array.from(h).map(w));const p=Object.create(St(h));for(const g in h)p[g]=w(h[g]);return Yt(h,Kt)&&(p[Kt]=h[Kt]),p}function z(h){return wt(h)?w(h):h}Ci("Patches",{applyPatches_:C,generatePatches_:o,generateReplacementPatches_:E})}var tt=new Ni,Ui=tt.produce;tt.produceWithPatches.bind(tt),tt.setAutoFreeze.bind(tt),tt.setUseStrictShallowCopy.bind(tt);var Li=tt.applyPatches.bind(tt);tt.createDraft.bind(tt),tt.finishDraft.bind(tt);var Gi=1/0,Bi=9007199254740991,Wi="[object Arguments]",$i="[object Function]",Ki="[object GeneratorFunction]",Vi="[object Symbol]",Yi=typeof et=="object"&&et&&et.Object===Object&&et,Xi=typeof self=="object"&&self&&self.Object===Object&&self,qi=Yi||Xi||Function("return this")();function Ji(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 Zi(t,r){for(var n=-1,a=t?t.length:0,o=Array(a);++n<a;)o[n]=r(t[n],n,t);return o}function Qi(t,r){for(var n=-1,a=r.length,o=t.length;++n<a;)t[o+n]=r[n];return t}var Er=Object.prototype,ta=Er.hasOwnProperty,kr=Er.toString,Jn=qi.Symbol,ea=Er.propertyIsEnumerable,Zn=Jn?Jn.isConcatSpreadable:void 0,Qn=Math.max;function ra(t,r,n,a,o){var c=-1,l=t.length;for(n||(n=sa),o||(o=[]);++c<l;){var d=t[c];n(d)?Qi(o,d):o[o.length]=d}return o}function na(t,r){return t=Object(t),ia(t,r,function(n,a){return a in t})}function ia(t,r,n){for(var a=-1,o=r.length,c={};++a<o;){var l=r[a],d=t[l];n(d,l)&&(c[l]=d)}return c}function aa(t,r){return r=Qn(r===void 0?t.length-1:r,0),function(){for(var n=arguments,a=-1,o=Qn(n.length-r,0),c=Array(o);++a<o;)c[a]=n[r+a];a=-1;for(var l=Array(r+1);++a<r;)l[a]=n[a];return l[r]=c,Ji(t,this,l)}}function sa(t){return ua(t)||ca(t)||!!(Zn&&t&&t[Zn])}function oa(t){if(typeof t=="string"||ya(t))return t;var r=t+"";return r=="0"&&1/t==-Gi?"-0":r}function ca(t){return la(t)&&ta.call(t,"callee")&&(!ea.call(t,"callee")||kr.call(t)==Wi)}var ua=Array.isArray;function fa(t){return t!=null&&da(t.length)&&!pa(t)}function la(t){return ti(t)&&fa(t)}function pa(t){var r=ha(t)?kr.call(t):"";return r==$i||r==Ki}function da(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Bi}function ha(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function ti(t){return!!t&&typeof t=="object"}function ya(t){return typeof t=="symbol"||ti(t)&&kr.call(t)==Vi}var ma=aa(function(t,r){return t==null?{}:na(t,Zi(ra(r),oa))}),ba=ma;const ei=cr(ba),_a={tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1},duration:0,activeIds:[],trackItemDetailsMap:{}},ri=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class ga{constructor(r){jt(this,"stateSubject");jt(this,"stateHistorySubject");jt(this,"prevState");jt(this,"undos",[]);jt(this,"redos",[]);jt(this,"listener");const n=r||_a;this.stateSubject=new Fn(n),this.stateHistorySubject=new Fn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){Oi(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const a=ei(r,ri),o=ei(this.getState(),ri),c=Hn(o,a);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 a=this.getState(),o={...a,...r};ut(a,o)||(n.updateHistory&&this.updateHistory(o,n.kind),this.prevState=a,this.stateSubject.next(o))}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{ut(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{ut(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 a=this.undos[this.undos.length-1].type;a==="update"&&r({...this.getState(),type:a}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const a=this.redos[this.redos.length-1].type;a==="update"&&r({...this.getState(),type:a}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{ut(n.trackItemIds,this.prevState.trackItemIds)||r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{ut(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!ut(n.tracks,this.prevState.tracks)||!ut(n.trackItemIds,this.prevState.trackItemIds)||!ut(n.trackItemsMap,this.prevState.trackItemsMap)||!ut(n.transitionIds,this.prevState.transitionIds)||!ut(n.transitionsMap,this.prevState.transitionsMap))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,a=r==null?void 0:r.type;if(!n||!a)return;qn();const{trackItemDetailsMap:o,trackItemIds:c,tracks:l,transitionIds:d,transitionsMap:E,trackItemsMap:C}=this.getState(),w=rt({trackItemDetailsMap:o,trackItemIds:c,tracks:l,transitionIds:d,transitionsMap:E,trackItemsMap:C}),z=[],h=[],p=[],g=[],f=[],b=[];n.forEach(I=>{let M;const X=I.path.slice(1);I.type==="CREATE"?M={path:X,op:"remove",value:I.value}:I.type==="CHANGE"?M={path:X,op:"replace",value:I.oldValue}:M={path:X,op:"add",value:I.oldValue},I.path.includes("trackItemIds")?p.push(M):I.path.includes("transitionIds")?h.push(M):I.path.includes("trackItemsMap")?f.push(M):I.path.includes("transitionsMap")?g.push(M):I.path.includes("tracks")?z.push(M):I.path.includes("trackItemDetailsMap")&&b.push(M)});const v=this.applyPatch(w.tracks,z),_=this.applyPatch(w.transitionIds,h),m=this.applyPatch(w.trackItemIds,p),y=this.applyPatch(w.transitionsMap,g),R=this.applyPatch(w.trackItemsMap,f),k=this.applyPatch(w.trackItemDetailsMap,b),O=rt({tracks:v,transitionIds:_,trackItemIds:m,transitionsMap:y,trackItemsMap:R,trackItemDetailsMap:k}),N=rt(this.getState()),H={...N,...O};this.prevState=N,this.redos.push({redos:n,type:a}),this.stateSubject.next(H),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((a,o)=>Ui(a,c=>{Li(c,[o])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,a=r==null?void 0:r.type;if(!n||!a)return;qn();const{trackItemDetailsMap:o,trackItemIds:c,tracks:l,transitionIds:d,transitionsMap:E,trackItemsMap:C}=this.getState(),w=rt({trackItemDetailsMap:o,trackItemIds:c,tracks:l,transitionIds:d,transitionsMap:E,trackItemsMap:C}),z=[],h=[],p=[],g=[],f=[],b=[];n.forEach(I=>{let M;const X=I.path.slice(1);I.type==="CREATE"?M={path:X,op:"add",value:I.value}:I.type==="CHANGE"?M={path:X,op:"replace",value:I.value}:M={path:X,op:"remove",value:I.oldValue},I.path.includes("trackItemIds")?p.push(M):I.path.includes("transitionIds")?h.push(M):I.path.includes("trackItemsMap")?f.push(M):I.path.includes("transitionsMap")?g.push(M):I.path.includes("trackItemDetailsMap")?b.push(M):z.push(M)});const v=this.applyPatch(w.tracks,z),_=this.applyPatch(w.transitionIds,h),m=this.applyPatch(w.trackItemIds,p),y=this.applyPatch(w.transitionsMap,g),R=this.applyPatch(w.trackItemsMap,f),k=this.applyPatch(w.trackItemDetailsMap,b),O=rt({tracks:v,transitionIds:_,trackItemIds:m,transitionsMap:y,trackItemsMap:R,trackItemDetailsMap:k}),N=rt(this.getState()),H={...N,...O};this.prevState=N,this.undos.push({undos:n,type:a}),this.stateSubject.next(H),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}return ga});
|
package/dist/state.d.ts
CHANGED
@@ -59,6 +59,7 @@ declare class StateManager implements IStateManager {
|
|
59
59
|
trackItemsMap: State["trackItemsMap"];
|
60
60
|
transitionIds: State["transitionIds"];
|
61
61
|
transitionsMap: State["transitionsMap"];
|
62
|
+
trackItemDetailsMap: State["trackItemDetailsMap"];
|
62
63
|
}) => void): import('rxjs').Subscription;
|
63
64
|
undo(): void;
|
64
65
|
applyPatch(json: any, patches: Patch[]): any;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function generateId(length?: number): string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IAudio, IImage, IText, IVideo } from '@designcombo/types';
|
1
|
+
import { IAudio, ICaption, IImage, IText, IVideo } from '@designcombo/types';
|
2
2
|
|
3
3
|
type OptionsType = {
|
4
4
|
size: {
|
@@ -16,11 +16,12 @@ export declare const loadImageItem: (payload: IImage, options: {
|
|
16
16
|
height: number;
|
17
17
|
};
|
18
18
|
}) => Promise<IImage>;
|
19
|
-
export declare const loadTextItem: (payload: IText, options: {
|
19
|
+
export declare const loadTextItem: (payload: IText | ICaption, options: {
|
20
20
|
origin?: number;
|
21
21
|
size?: {
|
22
22
|
width: number;
|
23
23
|
height: number;
|
24
24
|
};
|
25
|
-
|
25
|
+
type: "text" | "caption";
|
26
|
+
}, loadFont?: boolean) => Promise<IText | ICaption>;
|
26
27
|
export {};
|
package/dist/utils/track.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ITrack
|
1
|
+
import { ITrack } from '@designcombo/types';
|
2
2
|
|
3
|
-
export declare const getDuration: (trackItems: Record<string, ITrackItem>) => number;
|
4
3
|
export declare function removeItemsFromTrack(tracks: ITrack[], itemsToRemove: string[]): ITrack[];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@designcombo/state",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.7",
|
4
4
|
"private": false,
|
5
5
|
"files": [
|
6
6
|
"dist"
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"typescript": "^5.3.3",
|
25
25
|
"vite": "^5.2.0",
|
26
26
|
"vite-plugin-dts": "^3.9.1",
|
27
|
-
"@designcombo/events": "0.1.
|
27
|
+
"@designcombo/events": "0.1.7",
|
28
28
|
"@designcombo/typescript-config": "0.0.0",
|
29
|
-
"@designcombo/types": "0.1.
|
29
|
+
"@designcombo/types": "0.1.7"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"immer": "^10.1.1",
|
@@ -38,8 +38,8 @@
|
|
38
38
|
"nanoid": "^5.0.7"
|
39
39
|
},
|
40
40
|
"peerDependencies": {
|
41
|
-
"@designcombo/
|
42
|
-
"@designcombo/
|
41
|
+
"@designcombo/events": "0.1.7",
|
42
|
+
"@designcombo/types": "0.1.7"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"dev": "vite",
|