@designcombo/state 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(b,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("@designcombo/events")):typeof define=="function"&&define.amd?define(["exports","@designcombo/events"],Y):(b=typeof globalThis<"u"?globalThis:b||self,Y(b.events={},b.events))})(this,function(b,Y){"use strict";var Cs=Object.defineProperty;var Rs=(b,Y,jt)=>Y in b?Cs(b,Y,{enumerable:!0,configurable:!0,writable:!0,value:jt}):b[Y]=jt;var de=(b,Y,jt)=>Rs(b,typeof Y!="symbol"?Y+"":Y,jt);var jt=function(t,r){return jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},jt(t,r)};function Te(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");jt(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function Sr(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tr(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,c=[],d;try{for(;(r===void 0||r-- >0)&&!(s=i.next()).done;)c.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(d)throw d.error}}return c}function kr(t,r,n){if(n||arguments.length===2)for(var i=0,s=r.length,c;i<s;i++)(c||!(i in r))&&(c||(c=Array.prototype.slice.call(r,0,i)),c[i]=r[i]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function xt(t){return typeof t=="function"}function Rn(t){var r=function(i){Error.call(i),i.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var wr=Rn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(b,G){typeof exports=="object"&&typeof module<"u"?G(exports,require("@designcombo/events")):typeof define=="function"&&define.amd?define(["exports","@designcombo/events"],G):(b=typeof globalThis<"u"?globalThis:b||self,G(b.events={},b.events))})(this,function(b,G){"use strict";var Cs=Object.defineProperty;var Rs=(b,G,Ht)=>G in b?Cs(b,G,{enumerable:!0,configurable:!0,writable:!0,value:Ht}):b[G]=Ht;var pe=(b,G,Ht)=>Rs(b,typeof G!="symbol"?G+"":G,Ht);var Ht=function(t,r){return Ht=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},Ht(t,r)};function Te(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");Ht(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}function Sr(t){var r=typeof Symbol=="function"&&Symbol.iterator,n=r&&t[r],i=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tr(t,r){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),s,c=[],d;try{for(;(r===void 0||r-- >0)&&!(s=i.next()).done;)c.push(s.value)}catch(p){d={error:p}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(d)throw d.error}}return c}function kr(t,r,n){if(n||arguments.length===2)for(var i=0,s=r.length,c;i<s;i++)(c||!(i in r))&&(c||(c=Array.prototype.slice.call(r,0,i)),c[i]=r[i]);return t.concat(c||Array.prototype.slice.call(r))}typeof SuppressedError=="function"&&SuppressedError;function xt(t){return typeof t=="function"}function Rn(t){var r=function(i){Error.call(i),i.stack=new Error().stack},n=t(r);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var wr=Rn(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
2
2
  `+n.map(function(i,s){return s+1+") "+i.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=n}});function Ar(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Be=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var d=this._parentage;if(d)if(this._parentage=null,Array.isArray(d))try{for(var p=Sr(d),A=p.next();!A.done;A=p.next()){var O=A.value;O.remove(this)}}catch(u){r={error:u}}finally{try{A&&!A.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}else d.remove(this);var S=this.initialTeardown;if(xt(S))try{S()}catch(u){c=u instanceof wr?u.errors:[u]}var R=this._finalizers;if(R){this._finalizers=null;try{for(var m=Sr(R),M=m.next();!M.done;M=m.next()){var D=M.value;try{Fn(D)}catch(u){c=c??[],u instanceof wr?c=kr(kr([],Tr(c)),Tr(u.errors)):c.push(u)}}}catch(u){i={error:u}}finally{try{M&&!M.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}}if(c)throw new wr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)Fn(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}(),xn=Be.EMPTY;function Ln(t){return t instanceof Be||t&&"closed"in t&&xt(t.remove)&&xt(t.add)&&xt(t.unsubscribe)}function Fn(t){xt(t)?t():t.unsubscribe()}var Nn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Hn={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,kr([t,r],Tr(n)))},clearTimeout:function(t){var r=Hn.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Yi(t){Hn.setTimeout(function(){throw t})}function jn(){}function Ve(t){t()}var zn=function(t){Te(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Ln(n)&&n.add(i)):i.destination=Ki,i}return r.create=function(n,i,s){return new Dr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Be),Gi=Function.prototype.bind;function Mr(t,r){return Gi.call(t,r)}var Wi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Ze(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Ze(i)}else Ze(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Ze(n)}},t}(),Dr=function(t){Te(r,t);function r(n,i,s){var c=t.call(this)||this,d;if(xt(n)||!n)d={next:n??void 0,error:i??void 0,complete:s??void 0};else{var p;c&&Nn.useDeprecatedNextContext?(p=Object.create(n),p.unsubscribe=function(){return c.unsubscribe()},d={next:n.next&&Mr(n.next,p),error:n.error&&Mr(n.error,p),complete:n.complete&&Mr(n.complete,p)}):d=n}return c.destination=new Wi(d),c}return r}(zn);function Ze(t){Yi(t)}function Xi(t){throw t}var Ki={closed:!0,next:jn,error:Xi,complete:jn},Bi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Vi(t){return t}function Zi(t){return t.length===0?Vi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var $n=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=Ji(r)?r:new Dr(r,n,i);return Ve(function(){var d=s,p=d.operator,A=d.source;c.add(p?p.call(c,A):A?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Un(n),new n(function(s,c){var d=new Dr({next:function(p){try{r(p)}catch(A){c(A),d.unsubscribe()}},error:c,complete:s});i.subscribe(d)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[Bi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Zi(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Un(r),new r(function(i,s){var c;n.subscribe(function(d){return c=d},function(d){return s(d)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Un(t){var r;return(r=t??Nn.Promise)!==null&&r!==void 0?r:Promise}function qi(t){return t&&xt(t.next)&&xt(t.error)&&xt(t.complete)}function Ji(t){return t&&t instanceof zn||qi(t)&&Ln(t)}var Qi=Rn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Yn=function(t){Te(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Gn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Qi},r.prototype.next=function(n){var i=this;Ve(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var d=Sr(i.currentObservers),p=d.next();!p.done;p=d.next()){var A=p.value;A.next(n)}}catch(O){s={error:O}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;Ve(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;Ve(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,d=s.isStopped,p=s.observers;return c||d?xn:(this.currentObservers=null,p.push(n),new Be(function(){i.currentObservers=null,Ar(p,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,d=i.isStopped;s?n.error(c):d&&n.complete()},r.prototype.asObservable=function(){var n=new $n;return n.source=this,n},r.create=function(n,i){return new Gn(n,i)},r}($n),Gn=function(t){Te(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:xn},r}(Yn),Wn=function(t){Te(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Yn),Et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Or(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qe={exports:{}};qe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,d=9007199254740991,p="[object Arguments]",A="[object Array]",O="[object AsyncFunction]",S="[object Boolean]",R="[object Date]",m="[object Error]",M="[object Function]",D="[object GeneratorFunction]",u="[object Map]",f="[object Number]",_="[object Null]",g="[object Object]",y="[object Promise]",h="[object Proxy]",v="[object RegExp]",I="[object Set]",E="[object String]",U="[object Symbol]",x="[object Undefined]",C="[object WeakMap]",w="[object ArrayBuffer]",T="[object DataView]",j="[object Float32Array]",J="[object Float64Array]",tt="[object Int8Array]",Ut="[object Int16Array]",Yt="[object Int32Array]",bt="[object Uint8Array]",ee="[object Uint8ClampedArray]",F="[object Uint16Array]",W="[object Uint32Array]",dt=/[\\^$.*+?()[\]{}|]/g,K=/^\[object .+?Constructor\]$/,St=/^(?:0|[1-9]\d*)$/,N={};N[j]=N[J]=N[tt]=N[Ut]=N[Yt]=N[bt]=N[ee]=N[F]=N[W]=!0,N[p]=N[A]=N[w]=N[S]=N[T]=N[R]=N[m]=N[M]=N[u]=N[f]=N[g]=N[v]=N[I]=N[E]=N[C]=!1;var wt=typeof Et=="object"&&Et&&Et.Object===Object&&Et,he=typeof self=="object"&&self&&self.Object===Object&&self,pt=wt||he||Function("return this")(),re=r&&!r.nodeType&&r,ne=re&&!0&&t&&!t.nodeType&&t,G=ne&&ne.exports===re,B=G&&wt.process,L=function(){try{return B&&B.binding&&B.binding("util")}catch{}}(),ht=L&&L.isTypedArray;function lt(e,a){for(var o=-1,l=e==null?0:e.length,P=0,k=[];++o<l;){var z=e[o];a(z,o,e)&&(k[P++]=z)}return k}function et(e,a){for(var o=-1,l=a.length,P=e.length;++o<l;)e[P+o]=a[o];return e}function vt(e,a){for(var o=-1,l=e==null?0:e.length;++o<l;)if(a(e[o],o,e))return!0;return!1}function st(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function ie(e){return function(a){return e(a)}}function Gt(e,a){return e.has(a)}function V(e,a){return e==null?void 0:e[a]}function At(e){var a=-1,o=Array(e.size);return e.forEach(function(l,P){o[++a]=[P,l]}),o}function Wt(e,a){return function(o){return e(a(o))}}function Tt(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var Ot=Array.prototype,Kr=Function.prototype,ae=Object.prototype,me=pt["__core-js_shared__"],xe=Kr.toString,kt=ae.hasOwnProperty,or=function(){var e=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),cr=ae.toString,Br=RegExp("^"+xe.call(kt).replace(dt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=G?pt.Buffer:void 0,ye=pt.Symbol,ur=pt.Uint8Array,Ie=ae.propertyIsEnumerable,se=Ot.splice,Mt=ye?ye.toStringTag:void 0,_e=Object.getOwnPropertySymbols,Fe=Le?Le.isBuffer:void 0,oe=Wt(Object.keys,Object),Ne=Ft(pt,"DataView"),ce=Ft(pt,"Map"),He=Ft(pt,"Promise"),je=Ft(pt,"Set"),ze=Ft(pt,"WeakMap"),Xt=Ft(Object,"create"),lr=ft(Ne),Lt=ft(ce),Vr=ft(He),Zr=ft(je),qr=ft(ze),fr=ye?ye.prototype:void 0,$e=fr?fr.valueOf:void 0;function rt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Jr(){this.__data__=Xt?Xt(null):{},this.size=0}function Qr(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function tn(e){var a=this.__data__;if(Xt){var o=a[e];return o===i?void 0:o}return kt.call(a,e)?a[e]:void 0}function en(e){var a=this.__data__;return Xt?a[e]!==void 0:kt.call(a,e)}function rn(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Xt&&a===void 0?i:a,this}rt.prototype.clear=Jr,rt.prototype.delete=Qr,rt.prototype.get=tn,rt.prototype.has=en,rt.prototype.set=rn;function ot(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function nn(){this.__data__=[],this.size=0}function an(e){var a=this.__data__,o=ve(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():se.call(a,o,1),--this.size,!0}function sn(e){var a=this.__data__,o=ve(a,e);return o<0?void 0:a[o][1]}function on(e){return ve(this.__data__,e)>-1}function cn(e,a){var o=this.__data__,l=ve(o,e);return l<0?(++this.size,o.push([e,a])):o[l][1]=a,this}ot.prototype.clear=nn,ot.prototype.delete=an,ot.prototype.get=sn,ot.prototype.has=on,ot.prototype.set=cn;function mt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function un(){this.size=0,this.__data__={hash:new rt,map:new(ce||ot),string:new rt}}function ln(e){var a=Dt(this,e).delete(e);return this.size-=a?1:0,a}function fn(e){return Dt(this,e).get(e)}function dn(e){return Dt(this,e).has(e)}function pn(e,a){var o=Dt(this,e),l=o.size;return o.set(e,a),this.size+=o.size==l?0:1,this}mt.prototype.clear=un,mt.prototype.delete=ln,mt.prototype.get=fn,mt.prototype.has=dn,mt.prototype.set=pn;function ge(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new mt;++a<o;)this.add(e[a])}function dr(e){return this.__data__.set(e,i),this}function be(e){return this.__data__.has(e)}ge.prototype.add=ge.prototype.push=dr,ge.prototype.has=be;function Pt(e){var a=this.__data__=new ot(e);this.size=a.size}function Ue(){this.__data__=new ot,this.size=0}function hn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function mn(e){return this.__data__.get(e)}function yn(e){return this.__data__.has(e)}function In(e,a){var o=this.__data__;if(o instanceof ot){var l=o.__data__;if(!ce||l.length<n-1)return l.push([e,a]),this.size=++o.size,this;o=this.__data__=new mt(l)}return o.set(e,a),this.size=o.size,this}Pt.prototype.clear=Ue,Pt.prototype.delete=hn,Pt.prototype.get=mn,Pt.prototype.has=yn,Pt.prototype.set=In;function _n(e,a){var o=Ee(e),l=!o&&Ir(e),P=!o&&!l&&Se(e),k=!o&&!l&&!P&&br(e),z=o||l||P||k,H=z?st(e.length,String):[],Z=H.length;for(var $ in e)kt.call(e,$)&&!(z&&($=="length"||P&&($=="offset"||$=="parent")||k&&($=="buffer"||$=="byteLength"||$=="byteOffset")||wn($,Z)))&&H.push($);return H}function ve(e,a){for(var o=e.length;o--;)if(yr(e[o][0],a))return o;return-1}function Ye(e,a,o){var l=a(e);return Ee(e)?l:et(l,o(e))}function ue(e){return e==null?e===void 0?x:_:Mt&&Mt in Object(e)?Nt(e):mr(e)}function pr(e){return Rt(e)&&ue(e)==p}function hr(e,a,o,l,P){return e===a?!0:e==null||a==null||!Rt(e)&&!Rt(a)?e!==e&&a!==a:gn(e,a,o,l,hr,P)}function gn(e,a,o,l,P,k){var z=Ee(e),H=Ee(a),Z=z?A:Ct(e),$=H?A:Ct(a);Z=Z==p?g:Z,$=$==p?g:$;var ct=Z==g,yt=$==g,Q=Z==$;if(Q&&Se(e)){if(!Se(a))return!1;z=!0,ct=!1}if(Q&&!ct)return k||(k=new Pt),z||br(e)?Ge(e,a,o,l,P,k):Sn(e,a,Z,o,l,P,k);if(!(o&s)){var ut=ct&&kt.call(e,"__wrapped__"),nt=yt&&kt.call(a,"__wrapped__");if(ut||nt){var Kt=ut?e.value():e,Ht=nt?a.value():a;return k||(k=new Pt),P(Kt,Ht,o,l,k)}}return Q?(k||(k=new Pt),Tn(e,a,o,l,P,k)):!1}function bn(e){if(!gr(e)||Mn(e))return!1;var a=_r(e)?Br:K;return a.test(ft(e))}function vn(e){return Rt(e)&&Xe(e.length)&&!!N[ue(e)]}function En(e){if(!Dn(e))return oe(e);var a=[];for(var o in Object(e))kt.call(e,o)&&o!="constructor"&&a.push(o);return a}function Ge(e,a,o,l,P,k){var z=o&s,H=e.length,Z=a.length;if(H!=Z&&!(z&&Z>H))return!1;var $=k.get(e);if($&&k.get(a))return $==a;var ct=-1,yt=!0,Q=o&c?new ge:void 0;for(k.set(e,a),k.set(a,e);++ct<H;){var ut=e[ct],nt=a[ct];if(l)var Kt=z?l(nt,ut,ct,a,e,k):l(ut,nt,ct,e,a,k);if(Kt!==void 0){if(Kt)continue;yt=!1;break}if(Q){if(!vt(a,function(Ht,fe){if(!Gt(Q,fe)&&(ut===Ht||P(ut,Ht,o,l,k)))return Q.push(fe)})){yt=!1;break}}else if(!(ut===nt||P(ut,nt,o,l,k))){yt=!1;break}}return k.delete(e),k.delete(a),yt}function Sn(e,a,o,l,P,k,z){switch(o){case T:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case w:return!(e.byteLength!=a.byteLength||!k(new ur(e),new ur(a)));case S:case R:case f:return yr(+e,+a);case m:return e.name==a.name&&e.message==a.message;case v:case E:return e==a+"";case u:var H=At;case I:var Z=l&s;if(H||(H=Tt),e.size!=a.size&&!Z)return!1;var $=z.get(e);if($)return $==a;l|=c,z.set(e,a);var ct=Ge(H(e),H(a),l,P,k,z);return z.delete(e),ct;case U:if($e)return $e.call(e)==$e.call(a)}return!1}function Tn(e,a,o,l,P,k){var z=o&s,H=le(e),Z=H.length,$=le(a),ct=$.length;if(Z!=ct&&!z)return!1;for(var yt=Z;yt--;){var Q=H[yt];if(!(z?Q in a:kt.call(a,Q)))return!1}var ut=k.get(e);if(ut&&k.get(a))return ut==a;var nt=!0;k.set(e,a),k.set(a,e);for(var Kt=z;++yt<Z;){Q=H[yt];var Ht=e[Q],fe=a[Q];if(l)var Ui=z?l(fe,Ht,Q,a,e,k):l(Ht,fe,Q,e,a,k);if(!(Ui===void 0?Ht===fe||P(Ht,fe,o,l,k):Ui)){nt=!1;break}Kt||(Kt=Q=="constructor")}if(nt&&!Kt){var vr=e.constructor,Er=a.constructor;vr!=Er&&"constructor"in e&&"constructor"in a&&!(typeof vr=="function"&&vr instanceof vr&&typeof Er=="function"&&Er instanceof Er)&&(nt=!1)}return k.delete(e),k.delete(a),nt}function le(e){return Ye(e,Ke,kn)}function Dt(e,a){var o=e.__data__;return An(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Ft(e,a){var o=V(e,a);return bn(o)?o:void 0}function Nt(e){var a=kt.call(e,Mt),o=e[Mt];try{e[Mt]=void 0;var l=!0}catch{}var P=cr.call(e);return l&&(a?e[Mt]=o:delete e[Mt]),P}var kn=_e?function(e){return e==null?[]:(e=Object(e),lt(_e(e),function(a){return Ie.call(e,a)}))}:Pn,Ct=ue;(Ne&&Ct(new Ne(new ArrayBuffer(1)))!=T||ce&&Ct(new ce)!=u||He&&Ct(He.resolve())!=y||je&&Ct(new je)!=I||ze&&Ct(new ze)!=C)&&(Ct=function(e){var a=ue(e),o=a==g?e.constructor:void 0,l=o?ft(o):"";if(l)switch(l){case lr:return T;case Lt:return u;case Vr:return y;case Zr:return I;case qr:return C}return a});function wn(e,a){return a=a??d,!!a&&(typeof e=="number"||St.test(e))&&e>-1&&e%1==0&&e<a}function An(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Mn(e){return!!or&&or in e}function Dn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||ae;return e===o}function mr(e){return cr.call(e)}function ft(e){if(e!=null){try{return xe.call(e)}catch{}try{return e+""}catch{}}return""}function yr(e,a){return e===a||e!==e&&a!==a}var Ir=pr(function(){return arguments}())?pr:function(e){return Rt(e)&&kt.call(e,"callee")&&!Ie.call(e,"callee")},Ee=Array.isArray;function We(e){return e!=null&&Xe(e.length)&&!_r(e)}var Se=Fe||Cn;function On(e,a){return hr(e,a)}function _r(e){if(!gr(e))return!1;var a=ue(e);return a==M||a==D||a==O||a==h}function Xe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=d}function gr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function Rt(e){return e!=null&&typeof e=="object"}var br=ht?ie(ht):vn;function Ke(e){return We(e)?_n(e):En(e)}function Pn(){return[]}function Cn(){return!1}t.exports=On}(qe,qe.exports);var ta=qe.exports;const it=Or(ta),ea="add",Xn="track",Kn="trackItems",ra=`${Xn}:changed`,na=`${Kn}:changed`,Bn="state",ia=`${Bn}:changed`,Je="design",Vn=`${Je}:load`,Zn=`${Je}:resize`,It="add",qn=`${It}:text`,Jn=`${It}:video`,Qn=`${It}:audio`,aa=`${It}:placeholder`,ti=`${It}:image`,sa=`${It}:mask`,oa=`${It}:transition`,ca=`${It}:animation`,ei=`${It}:caption`,ri=`${It}:template`,ni=`${It}:items`,zt="edit",ii=`${zt}:object`,ai=`${zt}:replaceMedia`,ua=`${zt}:text`,la=`${zt}:shape`,fa=`${zt}:templateItem`,da=`${zt}:deleteTemplateItem`,pa="enterEditMode",Bt="active",ha=`${Bt}:set`,ma=`${Bt}:delete`,si=`${Bt}:paste`,oi=`${Bt}:clone`,ci=`${Bt}:split`,at="layer",ya=`${at}:locked`,Ia=`${at}:hidden`,_a=`${at}:move`,ga=`${at}:select`,ba=`${at}:selection`,va=`${at}:sendTo`,Ea=`${at}:rename`,Sa=`${at}:editingName`,Ta=`${at}:copy`,ka=`${at}:paste`,ui=`${at}:clone`,wa=`${at}:split`,Aa=`${at}:cut`,li=`${at}:delete`,ke="history",fi=`${ke}:undo`,di=`${ke}:redo`,Ma=`${ke}:reset`,Pr="scale",pi=`${Pr}:changed`;var Qe={exports:{}};Qe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",d="[object Array]",p="[object Boolean]",A="[object Date]",O="[object Error]",S="[object Function]",R="[object GeneratorFunction]",m="[object Map]",M="[object Number]",D="[object Object]",u="[object Promise]",f="[object RegExp]",_="[object Set]",g="[object String]",y="[object Symbol]",h="[object WeakMap]",v="[object ArrayBuffer]",I="[object DataView]",E="[object Float32Array]",U="[object Float64Array]",x="[object Int8Array]",C="[object Int16Array]",w="[object Int32Array]",T="[object Uint8Array]",j="[object Uint8ClampedArray]",J="[object Uint16Array]",tt="[object Uint32Array]",Ut=/[\\^$.*+?()[\]{}|]/g,Yt=/\w*$/,bt=/^\[object .+?Constructor\]$/,ee=/^(?:0|[1-9]\d*)$/,F={};F[c]=F[d]=F[v]=F[I]=F[p]=F[A]=F[E]=F[U]=F[x]=F[C]=F[w]=F[m]=F[M]=F[D]=F[f]=F[_]=F[g]=F[y]=F[T]=F[j]=F[J]=F[tt]=!0,F[O]=F[S]=F[h]=!1;var W=typeof Et=="object"&&Et&&Et.Object===Object&&Et,dt=typeof self=="object"&&self&&self.Object===Object&&self,K=W||dt||Function("return this")(),St=r&&!r.nodeType&&r,N=St&&!0&&t&&!t.nodeType&&t,wt=N&&N.exports===St;function he(e,a){return e.set(a[0],a[1]),e}function pt(e,a){return e.add(a),e}function re(e,a){for(var o=-1,l=e?e.length:0;++o<l&&a(e[o],o,e)!==!1;);return e}function ne(e,a){for(var o=-1,l=a.length,P=e.length;++o<l;)e[P+o]=a[o];return e}function G(e,a,o,l){for(var P=-1,k=e?e.length:0;++P<k;)o=a(o,e[P],P,e);return o}function B(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function L(e,a){return e==null?void 0:e[a]}function ht(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function lt(e){var a=-1,o=Array(e.size);return e.forEach(function(l,P){o[++a]=[P,l]}),o}function et(e,a){return function(o){return e(a(o))}}function vt(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var st=Array.prototype,ie=Function.prototype,Gt=Object.prototype,V=K["__core-js_shared__"],At=function(){var e=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Wt=ie.toString,Tt=Gt.hasOwnProperty,Ot=Gt.toString,Kr=RegExp("^"+Wt.call(Tt).replace(Ut,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ae=wt?K.Buffer:void 0,me=K.Symbol,xe=K.Uint8Array,kt=et(Object.getPrototypeOf,Object),or=Object.create,cr=Gt.propertyIsEnumerable,Br=st.splice,Le=Object.getOwnPropertySymbols,ye=ae?ae.isBuffer:void 0,ur=et(Object.keys,Object),Ie=Dt(K,"DataView"),se=Dt(K,"Map"),Mt=Dt(K,"Promise"),_e=Dt(K,"Set"),Fe=Dt(K,"WeakMap"),oe=Dt(Object,"create"),Ne=ft(Ie),ce=ft(se),He=ft(Mt),je=ft(_e),ze=ft(Fe),Xt=me?me.prototype:void 0,lr=Xt?Xt.valueOf:void 0;function Lt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Vr(){this.__data__=oe?oe(null):{}}function Zr(e){return this.has(e)&&delete this.__data__[e]}function qr(e){var a=this.__data__;if(oe){var o=a[e];return o===i?void 0:o}return Tt.call(a,e)?a[e]:void 0}function fr(e){var a=this.__data__;return oe?a[e]!==void 0:Tt.call(a,e)}function $e(e,a){var o=this.__data__;return o[e]=oe&&a===void 0?i:a,this}Lt.prototype.clear=Vr,Lt.prototype.delete=Zr,Lt.prototype.get=qr,Lt.prototype.has=fr,Lt.prototype.set=$e;function rt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Jr(){this.__data__=[]}function Qr(e){var a=this.__data__,o=be(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():Br.call(a,o,1),!0}function tn(e){var a=this.__data__,o=be(a,e);return o<0?void 0:a[o][1]}function en(e){return be(this.__data__,e)>-1}function rn(e,a){var o=this.__data__,l=be(o,e);return l<0?o.push([e,a]):o[l][1]=a,this}rt.prototype.clear=Jr,rt.prototype.delete=Qr,rt.prototype.get=tn,rt.prototype.has=en,rt.prototype.set=rn;function ot(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function nn(){this.__data__={hash:new Lt,map:new(se||rt),string:new Lt}}function an(e){return le(this,e).delete(e)}function sn(e){return le(this,e).get(e)}function on(e){return le(this,e).has(e)}function cn(e,a){return le(this,e).set(e,a),this}ot.prototype.clear=nn,ot.prototype.delete=an,ot.prototype.get=sn,ot.prototype.has=on,ot.prototype.set=cn;function mt(e){this.__data__=new rt(e)}function un(){this.__data__=new rt}function ln(e){return this.__data__.delete(e)}function fn(e){return this.__data__.get(e)}function dn(e){return this.__data__.has(e)}function pn(e,a){var o=this.__data__;if(o instanceof rt){var l=o.__data__;if(!se||l.length<n-1)return l.push([e,a]),this;o=this.__data__=new ot(l)}return o.set(e,a),this}mt.prototype.clear=un,mt.prototype.delete=ln,mt.prototype.get=fn,mt.prototype.has=dn,mt.prototype.set=pn;function ge(e,a){var o=We(e)||Ee(e)?B(e.length,String):[],l=o.length,P=!!l;for(var k in e)Tt.call(e,k)&&!(P&&(k=="length"||An(k,l)))&&o.push(k);return o}function dr(e,a,o){var l=e[a];(!(Tt.call(e,a)&&Ir(l,o))||o===void 0&&!(a in e))&&(e[a]=o)}function be(e,a){for(var o=e.length;o--;)if(Ir(e[o][0],a))return o;return-1}function Pt(e,a){return e&&Ge(a,Ke(a),e)}function Ue(e,a,o,l,P,k,z){var H;if(l&&(H=k?l(e,P,k,z):l(e)),H!==void 0)return H;if(!Rt(e))return e;var Z=We(e);if(Z){if(H=kn(e),!a)return En(e,H)}else{var $=Nt(e),ct=$==S||$==R;if(_r(e))return ve(e,a);if($==D||$==c||ct&&!k){if(ht(e))return k?e:{};if(H=Ct(ct?{}:e),!a)return Sn(e,Pt(H,e))}else{if(!F[$])return k?e:{};H=wn(e,$,Ue,a)}}z||(z=new mt);var yt=z.get(e);if(yt)return yt;if(z.set(e,H),!Z)var Q=o?Tn(e):Ke(e);return re(Q||e,function(ut,nt){Q&&(nt=ut,ut=e[nt]),dr(H,nt,Ue(ut,a,o,l,nt,e,z))}),H}function hn(e){return Rt(e)?or(e):{}}function mn(e,a,o){var l=a(e);return We(e)?l:ne(l,o(e))}function yn(e){return Ot.call(e)}function In(e){if(!Rt(e)||Dn(e))return!1;var a=Xe(e)||ht(e)?Kr:bt;return a.test(ft(e))}function _n(e){if(!mr(e))return ur(e);var a=[];for(var o in Object(e))Tt.call(e,o)&&o!="constructor"&&a.push(o);return a}function ve(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function Ye(e){var a=new e.constructor(e.byteLength);return new xe(a).set(new xe(e)),a}function ue(e,a){var o=a?Ye(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function pr(e,a,o){var l=a?o(lt(e),!0):lt(e);return G(l,he,new e.constructor)}function hr(e){var a=new e.constructor(e.source,Yt.exec(e));return a.lastIndex=e.lastIndex,a}function gn(e,a,o){var l=a?o(vt(e),!0):vt(e);return G(l,pt,new e.constructor)}function bn(e){return lr?Object(lr.call(e)):{}}function vn(e,a){var o=a?Ye(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function En(e,a){var o=-1,l=e.length;for(a||(a=Array(l));++o<l;)a[o]=e[o];return a}function Ge(e,a,o,l){o||(o={});for(var P=-1,k=a.length;++P<k;){var z=a[P],H=void 0;dr(o,z,H===void 0?e[z]:H)}return o}function Sn(e,a){return Ge(e,Ft(e),a)}function Tn(e){return mn(e,Ke,Ft)}function le(e,a){var o=e.__data__;return Mn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Dt(e,a){var o=L(e,a);return In(o)?o:void 0}var Ft=Le?et(Le,Object):Pn,Nt=yn;(Ie&&Nt(new Ie(new ArrayBuffer(1)))!=I||se&&Nt(new se)!=m||Mt&&Nt(Mt.resolve())!=u||_e&&Nt(new _e)!=_||Fe&&Nt(new Fe)!=h)&&(Nt=function(e){var a=Ot.call(e),o=a==D?e.constructor:void 0,l=o?ft(o):void 0;if(l)switch(l){case Ne:return I;case ce:return m;case He:return u;case je:return _;case ze:return h}return a});function kn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&Tt.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function Ct(e){return typeof e.constructor=="function"&&!mr(e)?hn(kt(e)):{}}function wn(e,a,o,l){var P=e.constructor;switch(a){case v:return Ye(e);case p:case A:return new P(+e);case I:return ue(e,l);case E:case U:case x:case C:case w:case T:case j:case J:case tt:return vn(e,l);case m:return pr(e,l,o);case M:case g:return new P(e);case f:return hr(e);case _:return gn(e,l,o);case y:return bn(e)}}function An(e,a){return a=a??s,!!a&&(typeof e=="number"||ee.test(e))&&e>-1&&e%1==0&&e<a}function Mn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Dn(e){return!!At&&At in e}function mr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Gt;return e===o}function ft(e){if(e!=null){try{return Wt.call(e)}catch{}try{return e+""}catch{}}return""}function yr(e){return Ue(e,!0,!0)}function Ir(e,a){return e===a||e!==e&&a!==a}function Ee(e){return On(e)&&Tt.call(e,"callee")&&(!cr.call(e,"callee")||Ot.call(e)==c)}var We=Array.isArray;function Se(e){return e!=null&&gr(e.length)&&!Xe(e)}function On(e){return br(e)&&Se(e)}var _r=ye||Cn;function Xe(e){var a=Rt(e)?Ot.call(e):"";return a==S||a==R}function gr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function Rt(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function br(e){return!!e&&typeof e=="object"}function Ke(e){return Se(e)?ge(e):_n(e)}function Pn(){return[]}function Cn(){return!1}t.exports=yr}(Qe,Qe.exports);var Da=Qe.exports;const X=Or(Da),hi=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Oa=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),mi=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,d=i.videoHeight;r({duration:s,width:c,height:d})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),yi=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},tr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Pa="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let er=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Pa[n[t]&63];return r};function pe(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=er(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const rr={color:"#000000",x:0,y:0,blur:0},we=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},Ii=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function nr(t,r){const n=t.scaleMode,i={x:t.size.width/2,y:t.size.height/2},s={x:r.width/2,y:r.height/2};let c;n==="fill"?c=Math.max(t.size.width/r.width,t.size.height/r.height):c=Math.min(t.size.width/r.width,t.size.height/r.height);const d=i.x-s.x;return{top:`${i.y-s.y}px`,left:`${d}px`,transform:`scale(${c})`}}const _i=async(t,r)=>{const n=t.details.src,i=await mi(n),s=nr(r,{...i}),c=Ii(t.trim,{duration:i.duration}),d={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||rr,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible",mediaWidth:t.details.mediaWidth||i.width||100,mediaHeight:t.details.mediaHeight||i.height||100};return{...t,trim:c,type:"video",name:"video",details:d,playbackRate:t.playbackRate||1,display:we(t.display,{duration:i.duration,trim:c}),duration:i.duration}},gi=async t=>{const r=t.id,n=t.details,s=(await Oa(n.src)).duration,c=Ii(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:we(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},Ca=async(t,r)=>{var R,m,M;const n=t.trackItemIds,i=t.size||{width:t.details.width,height:t.details.height},s=Math.min(r.size.width/i.width,r.size.height/i.height),c=((R=t.details)==null?void 0:R.rotate)||0,d={top:((m=t.details)==null?void 0:m.top)||0,left:((M=t.details)==null?void 0:M.left)||0},p=t.display,A=t.trim||t.display;let O=1/0,S=0;return n.forEach(D=>{const u=t.trackItemsMap[D];u.display.from<O&&(O=u.display.from),u.display.to>S&&(S=u.display.to)}),{id:t.id,details:{...i,top:d.top,left:d.left,scale:s,rotate:c},trim:A,display:p||{from:O,to:S},activeEdit:!1}},bi=async(t,r)=>{const n=t.details,i=await hi(n.src),s=nr(r,i);return{id:t.id,type:"image",name:"image",display:we(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||rr,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible",mediaWidth:n.mediaWidth||n.width||i.width||100,mediaHeight:n.mediaHeight||n.height||i.height||100},metadata:t.metadata||{}}},vi=async(t,r)=>{const n=t;n.details.fontUrl&&await tr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=Si(s),d=yi(n.details.text,c),p=nr(r,{width:c.width,height:d});return{id:i,name:"caption",type:"caption",display:we(n.display),details:{...c,text:s.text||"",height:d,fontUrl:s.fontUrl,top:c.top||p.top,left:c.left||p.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||rr,words:s.words||[]},metadata:t.metadata||{}}},Ei=async(t,r)=>{t.details.fontUrl&&await tr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=Si(i),c=yi(t.details.text,s),d=nr(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:we(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||d.top,left:s.left||d.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||rr},metadata:{}}},Si=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none",skewX:t.skewX||0,skewY:t.skewY||0}),Ra=async(t,r)=>{switch(t.type){case"video":return _i(t,r||{});case"audio":return gi(t);case"image":return bi(t,r||{});case"text":return Ei(t,r||{});case"caption":return vi(t,r||{});default:throw new Error("Unsupported track item")}};function xa(t,r){return r.some(n=>t.some(i=>i.id===n.id))}const La=(t=[],r=[])=>t.length===0?r.map(i=>({id:pe(),items:[i.id],type:i.type,accepts:["text","image","video","audio","caption","template"]})):t.map(n=>({...n,items:n.items||[],accepts:["audio","video","image","text","caption","template"],type:n.type||"text",magnetic:n.magnetic||!1,static:n.static||!1,id:n.id||pe()}));function Fa(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0||i.static)return i})}const Vt=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Cr(t,r,n){return Math.min(Math.max(t,r),n)}const Na=(t,r,n,i,s)=>{if(i===void 0&&s===void 0)return{trackId:void 0,trackIndex:void 0};const c=s!==void 0?r[Cr(s,0,r.length)]:r.find(A=>A.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Cr(s,0,r.length):void 0};const d=c.items.map(A=>n[A]),p=t.map(A=>n[A]);for(const A of d){const O=A.display.from,S=A.display.to;for(const R of p){const m=R.display.from;if(!(R.display.to<=O||m>=S))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}};function Ha(t,r){let i=r.reduce((s,c)=>c.display.to>s.display.to?c:s,{display:{to:0}}).display.to;t.forEach(s=>{const c=s.display.from,p=s.display.to-c;s.display.from=i,s.display.to=s.display.from+p,i=s.display.to})}function ja(t){const r=t,n=r.tracks,i=r.trackItemsMap,s=[],c={};return n.forEach(d=>{var A;const p=d.items.map(O=>i[O]).sort((O,S)=>O.display.from-S.display.from);for(let O=0;O<p.length-1;O++){const S=p[O],R=p[O+1];if(Math.abs(S.display.to-R.display.from)<=1){const m=`${S.id}-${R.id}`;if((A=r.transitionIds)==null?void 0:A.includes(m))c[m]=r.transitionsMap[m];else{const D={id:m,duration:1500,fromId:S.id,toId:R.id,kind:"none",trackId:d.id,type:"transition"};c[m]=D}s.push(m)}}}),r.transitionIds=s,r.transitionsMap=c,{transitionIds:s,transitionsMap:c}}function za(t){const r=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(Je))),n=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(It))),i=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(at))),s=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(ke))),c=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(Bt))),d=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(zt))),p=Y.subject.pipe(Y.filter(({key:u})=>u.startsWith(Pr))),A=r.subscribe(async u=>{var f,_;if(u.key===Vn){const g=(f=u.value)==null?void 0:f.payload,y=g.trackItemsMap,h=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");for(const I in h)if(h[I].type==="text"||h[I].type==="caption"){const E=h[I].details;await tr([{fontFamily:E.fontFamily,url:E.fontUrl}])}const v=Vt(y);t.updateState({...g,duration:v},{kind:"design:load",updateHistory:!1})}if(u.key===Zn){const g=(_=u.value)==null?void 0:_.payload;t.updateState({size:g},{kind:"design:resize",updateHistory:!1})}}),O=s.subscribe(u=>{if(u.key===fi)return t.undo();if(u.key===di)return t.redo()}),S=p.subscribe(u=>{var f;if(u.key===pi){const _=(f=u.value)==null?void 0:f.payload.scale;t.updateState({scale:_},{kind:"update",updateHistory:!1})}}),R=i.subscribe(u=>{var _,g,y,h;const f=[];if((_=u.value)!=null&&_.payload.trackItemIds&&(f.push((g=u.value)==null?void 0:g.payload.trackItemIds),t.updateState({activeIds:f},{kind:"update",updateHistory:!1})),u.key===li){const v=(y=u.value)==null?void 0:y.payload.trackItemIds,I=X(t.getState()),E=v&&v.length?v:I.activeIds,U=I.trackItemIds,x=I.transitionIds,C=I.trackItemDetailsMap,w=X(I.tracks),T=X(I.structure);E.forEach(W=>{var K;const dt=I.trackItemsMap[W]||I.transitionsMap[W];if(dt.type==="template"){const St=(K=I.structure.find(wt=>wt.id===dt.id))==null?void 0:K.items;E.push(...St);const N=T.findIndex(wt=>wt.id===dt.id);T.splice(N,1)}});const j=U.filter(W=>!E.includes(W)),J=x.filter(W=>!E.includes(W)),tt=Object.fromEntries(Object.entries(C).filter(([W])=>!E.includes(W))),Ut=Object.fromEntries(Object.entries(I.transitionsMap).filter(([W])=>!E.includes(W))),Yt=Fa(I.tracks,E),bt=Object.fromEntries(Object.entries(I.trackItemsMap).filter(([W])=>!E.includes(W)));w.filter(W=>W.magnetic).forEach(W=>{let dt=0;W==null||W.items.forEach(K=>{if(bt[K]){const St=bt[K].display.to-bt[K].display.from;bt[K].display={from:dt,to:dt+St},dt+=St}})});const F=Vt(bt);t.updateState({trackItemIds:j,trackItemDetailsMap:tt,activeIds:[],trackItemsMap:bt,tracks:Yt,duration:F,structure:T,transitionIds:J,transitionsMap:Ut},{updateHistory:!0,kind:"remove"})}if(u.key===ui){const v=X(t.getState()),I={},E=((h=u.value)==null?void 0:h.payload.trackItemIds)||v.activeIds;if(E.length===0)return;E.forEach(x=>{const C=v.trackItemsMap[x],w=v.trackItemDetailsMap[x],T=pe();v.trackItemsMap[T]={...X(C),id:T},v.trackItemDetailsMap[T]={...X(w)},v.trackItemIds.push(T);const j=v.tracks.find(J=>J.items.includes(x));I[j.id]?I[j.id].items.push(T):I[j.id]={...j,id:pe(),items:[T],static:!1,magnetic:!1}});const U=Object.values(I);v.tracks=[...U,...v.tracks],t.updateState({trackItemDetailsMap:v.trackItemDetailsMap,tracks:v.tracks,trackItemIds:v.trackItemIds,trackItemsMap:v.trackItemsMap},{updateHistory:!0,kind:"update"})}}),m=n.subscribe(async u=>{var U,x,C,w,T,j,J,tt,Ut,Yt,bt,ee,F,W,dt,K,St,N,wt,he,pt,re,ne;const f=X(t.getState()),_=((x=(U=u.value)==null?void 0:U.options)==null?void 0:x.isSelected)||!1,g=(w=(C=u.value)==null?void 0:C.options)==null?void 0:w.scaleMode;let y=[],h="text";const v=(j=(T=u.value)==null?void 0:T.options)==null?void 0:j.trackId;let I=(tt=(J=u.value)==null?void 0:J.options)==null?void 0:tt.trackIndex;if(u.key===ni){const G=(Ut=u.value)==null?void 0:Ut.payload,B=G.trackItems.map(V=>Ra(V,{size:f.size})),L=await Promise.all(B),ht=La(G.tracks,G.trackItems),lt=[],et={},vt={};if(L.forEach(V=>{const{details:At,...Wt}=V;lt.push(V.id),et[V.id]={type:V.type,details:At},vt[V.id]=Wt}),xa(f.tracks,ht))f.tracks.forEach(V=>{ht.forEach(At=>{if(V.id===At.id){if(V.magnetic){const Wt=At.items.map(Ot=>vt[Ot]),Tt=V.items.map(Ot=>f.trackItemsMap[Ot]);Ha(Wt,Tt)}V.items.push(...lt)}})});else{const V=((bt=(Yt=u.value)==null?void 0:Yt.options)==null?void 0:bt.trackIndex)||0,At=Cr(V,0,f.tracks.length);f.tracks.splice(At,0,...ht)}f.trackItemDetailsMap={...f.trackItemDetailsMap,...et},f.trackItemsMap={...f.trackItemsMap,...vt},f.trackItemIds=[...f.trackItemIds,...lt],f.duration=Vt(f.trackItemsMap);const{transitionIds:ie,transitionsMap:Gt}=ja(f);t.updateState({trackItemIds:f.trackItemIds,trackItemDetailsMap:f.trackItemDetailsMap,trackItemsMap:f.trackItemsMap,tracks:f.tracks,duration:f.duration,transitionIds:ie,transitionsMap:Gt},{updateHistory:!0,kind:"add"});return}if(u.key===ei){h="caption";const G=(ee=u.value)==null?void 0:ee.payload,B=[];for(const lt of G){const et=vi(lt,{size:f.size});B.push(et)}const L=await Promise.all(B),ht=[];for(const lt of L){const et=lt.id;ht.push(et);const{details:vt,...st}=lt;f.trackItemDetailsMap[et]={type:h,details:vt},f.trackItemsMap[et]=st,f.trackItemIds.push(et)}y=ht}if(u.key===qn){h="text";const G=await Ei((F=u.value)==null?void 0:F.payload,{size:f.size}),{details:B,...L}=G;f.trackItemDetailsMap[L.id]={type:h,details:B},f.trackItemsMap[L.id]=L,f.trackItemIds.push(L.id),y=[L.id]}if(u.key===ri){h="template";const G=(W=u.value)==null?void 0:W.payload.trackItemsMap,B=(dt=u.value)==null?void 0:dt.payload.trackItemDetailsMap,L=(K=u.value)==null?void 0:K.payload.transitionsMap,ht=((St=u.value)==null?void 0:St.payload.transitionIds)||[],lt=(N=u.value)==null?void 0:N.payload.trackItemIds,et=((wt=u.value)==null?void 0:wt.payload.tracks)||[],{details:vt,...st}=await Ca((he=u.value)==null?void 0:he.payload,{size:f.size}),ie={id:st.id,items:lt,transitions:ht,tracks:et};f.trackItemDetailsMap[st.id]={type:h,details:vt},f.trackItemsMap[st.id]=st,f.trackItemIds.push(st.id),y=[st.id],f.trackItemsMap={...f.trackItemsMap,...G,[st.id]:{type:"template",...st}},f.trackItemDetailsMap={...f.trackItemDetailsMap,...B,[st.id]:{type:"template",details:vt}},f.transitionsMap={...f.transitionsMap,...L},f.structure=[...f.structure,ie]}if(u.key===ti){h="image";const G=await bi((pt=u.value)==null?void 0:pt.payload,{size:f.size,scaleMode:g}),{details:B,...L}=G;f.trackItemDetailsMap[L.id]={type:h,details:B},f.trackItemsMap[L.id]=L,f.trackItemIds.push(L.id),y=[L.id]}if(u.key===Qn){h="audio";const G=await gi((re=u.value)==null?void 0:re.payload),{details:B,...L}=G;f.trackItemDetailsMap[L.id]={type:h,details:B},f.trackItemsMap[L.id]=L,f.trackItemIds.push(L.id),y=[L.id]}if(u.key===Jn){h="video";const G=await _i((ne=u.value)==null?void 0:ne.payload,{size:f.size,scaleMode:g}),{details:B,...L}=G;f.trackItemDetailsMap[L.id]={type:h,details:B,metadata:L.metadata},f.trackItemsMap[L.id]=L,f.trackItemIds.push(L.id),y=[L.id]}const E=Na(y,f.tracks,f.trackItemsMap,v,I);if(E.trackId){const G=f.tracks.find(B=>B.id===E.trackId);G&&G.items.push(...y)}else if(E.trackIndex!==void 0){const G={id:er(),accepts:["text","audio","helper","video","image","caption","template"],type:h,items:y,magnetic:!1,static:!1};f.tracks.splice(E.trackIndex,0,G)}else f.tracks.unshift({id:er(),accepts:["text","audio","helper","video","image","caption","template"],type:h,items:y,magnetic:!1,static:!1});_&&(f.activeIds=y),f.duration=Vt(f.trackItemsMap),t.updateState({activeIds:f.activeIds,trackItemIds:f.trackItemIds,trackItemDetailsMap:f.trackItemDetailsMap,trackItemsMap:f.trackItemsMap,transitionsMap:f.transitionsMap,tracks:f.tracks,duration:f.duration,structure:f.structure},{updateHistory:!0,kind:"add"})}),M=c.subscribe(async u=>{var f;if(u.key===ci){const _=X(t.getState()),g=(f=u.value)==null?void 0:f.options.time;if(_.activeIds.length===1){const y=_.activeIds[0],h=X(_.trackItemsMap[y]);if(g>=h.display.to||g<=h.display.from)return;const v=X(_.trackItemDetailsMap[y]),I=pe(),E=X({...h,display:{from:h.display.from,to:g}}),U=X({...h,id:I,display:{from:g,to:h.display.to}});if(h.type==="video"||h.type==="audio"){const x=g-E.display.from;E.trim={from:h.trim.from,to:h.trim.from+x},U.trim={from:h.trim.from+x,to:h.trim.to}}_.trackItemsMap[y]=E,_.trackItemsMap[I]=U,_.trackItemIds.push(I),_.trackItemDetailsMap[I]=v,_.tracks.forEach(x=>{x.items.includes(y)&&x.items.push(I)}),t.updateState({trackItemDetailsMap:_.trackItemDetailsMap,tracks:_.tracks,trackItemIds:_.trackItemIds,trackItemsMap:_.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(u.key===oi){const _=X(t.getState());if(_.activeIds.length){const g=_.activeIds,y=[],h={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(I=>{h.trackItemDetailsMap[I]=_.trackItemDetailsMap[I],h.trackItemsMap[I]=_.trackItemsMap[I],y.push(_.tracks.find(E=>E.items.includes(I)))});const v=new Set;y.filter(I=>v.has(I.id)?!1:(v.add(I),!0)),h.tracks=Array.from(v.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(h))}}if(u.key===si){const _=localStorage.getItem("DesignComboTemp");if(!_)return;const g=X(t.getState()),y=JSON.parse(_),h={},v=y.trackItemsMap,I=y.trackItemDetailsMap,E=y.tracks,U=[],x=y.activeIds.map(async C=>{const w=I[C];(w.type==="caption"||w.type==="text")&&w.details.fontUrl&&await tr([{fontFamily:w.details.fontFamily,url:w.details.fontUrl}]);const T=pe();return h[C]=T,g.trackItemsMap[T]={...v[C],id:T},g.trackItemDetailsMap[T]=w,g.trackItemIds.push(T),!0});await Promise.all(x),E.forEach(C=>{const w=C.items.map(j=>h[j]),T={...C,items:w,id:er()};U.push(T)}),g.tracks=[...g.tracks,...U],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),D=d.subscribe(async u=>{var f,_,g;if(u.key===ii){const y=X(t.getState()),h=y.trackItemDetailsMap,v=y.trackItemsMap,I=Object.keys((f=u.value)==null?void 0:f.payload);if(!I.length)return;const E=(_=u.value)==null?void 0:_.payload;I.forEach(x=>{const C=E[x];C.details?h[x].details={...h[x].details,...C.details}:E[x].playbackRate&&(v[x].playbackRate=E[x].playbackRate)});const U=Vt(v);t.updateState({trackItemDetailsMap:{...h},trackItemsMap:{...v},duration:U},{updateHistory:!0,kind:"update:details"})}if(u.key===ai){const y=(g=u.value)==null?void 0:g.payload,h=Object.keys(y)[0],v=Object.values(y)[0],I=X(t.getState()),E=I.trackItemDetailsMap[h];if(v.details){if(v.type==="image"&&v.details.src){const C=await hi(v.details.src),w=E.details.width||0,T=E.details.height||0;let j=C.width,J=C.height;const tt=C.width/C.height;w/T>tt?(j=w,J=w/tt):(J=T,j=T*tt),v.details.mediaWidth=j,v.details.mediaHeight=J}if(v.type==="video"&&v.details.src){const C=await mi(v.details.src),w=E.details.width||0,T=E.details.height||0;let j=C.width,J=C.height;const tt=C.width/C.height;w/T>tt?(j=w,J=w/tt):(J=T,j=T*tt),v.details.mediaWidth=j,v.details.mediaHeight=J}const x=E.details;E.details={...x,...v.details},v.details=E.details}const U={...E,...v};I.trackItemDetailsMap[h]=U,I.trackItemsMap[h]={...I.trackItemsMap[h],type:v.type},t.updateState({trackItemDetailsMap:{...I.trackItemDetailsMap},trackItemsMap:{...I.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{m.unsubscribe(),M.unsubscribe(),D.unsubscribe(),O.unsubscribe(),R.unsubscribe(),A.unsubscribe(),S.unsubscribe()}}}const $a={Date:!0,RegExp:!0,String:!0,Number:!0};function Ti(t,r,n={cyclesFix:!0},i=[]){var p,A;let s=[];const c=Array.isArray(t);for(const O in t){const S=t[O],R=c?+O:O;if(!(O in r)){s.push({type:"REMOVE",path:[R],oldValue:t[O]});continue}const m=r[O],M=typeof S=="object"&&typeof m=="object"&&Array.isArray(S)===Array.isArray(m);if(S&&m&&M&&!$a[(A=(p=Object.getPrototypeOf(S))==null?void 0:p.constructor)==null?void 0:A.name]&&(!n.cyclesFix||!i.includes(S))){const D=Ti(S,m,n,n.cyclesFix?i.concat([S]):[]);s.push.apply(s,D.map(u=>(u.path.unshift(R),u)))}else S!==m&&!(Number.isNaN(S)&&Number.isNaN(m))&&!(M&&(isNaN(S)?S+""==m+"":+S==+m))&&s.push({path:[R],type:"CHANGE",value:m,oldValue:S})}const d=Array.isArray(r);for(const O in r)O in t||s.push({type:"CREATE",path:[d?+O:O],value:r[O]});return s}var Rr=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),ki=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function q(t,...r){if(process.env.NODE_ENV!=="production"){const n=ki[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Zt=Object.getPrototypeOf;function qt(t){return!!t&&!!t[_t]}function $t(t){var r;return t?wi(t)||Array.isArray(t)||!!t[Ae]||!!((r=t.constructor)!=null&&r[Ae])||Oe(t)||Pe(t):!1}var Ua=Object.prototype.constructor.toString();function wi(t){if(!t||typeof t!="object")return!1;const r=Zt(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)===Ua}function Me(t,r){Jt(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function Jt(t){const r=t[_t];return r?r.type_:Array.isArray(t)?1:Oe(t)?2:Pe(t)?3:0}function De(t,r){return Jt(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function xr(t,r){return Jt(t)===2?t.get(r):t[r]}function Ai(t,r,n){const i=Jt(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Ya(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Oe(t){return t instanceof Map}function Pe(t){return t instanceof Set}function Qt(t){return t.copy_||t.base_}function Lr(t,r){if(Oe(t))return new Map(t);if(Pe(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=wi(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[_t];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const d=s[c],p=i[d];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(i[d]={configurable:!0,writable:!0,enumerable:p.enumerable,value:t[d]})}return Object.create(Zt(t),i)}else{const i=Zt(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Fr(t,r=!1){return ir(t)||qt(t)||!$t(t)||(Jt(t)>1&&(t.set=t.add=t.clear=t.delete=Ga),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Fr(i,!0))),t}function Ga(){q(2)}function ir(t){return Object.isFrozen(t)}var Nr={};function te(t){const r=Nr[t];return r||q(0,t),r}function Wa(t,r){Nr[t]||(Nr[t]=r)}var Ce;function Mi(){return Ce}function Xa(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Di(t,r){r&&(te("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function Hr(t){jr(t),t.drafts_.forEach(Ka),t.drafts_=null}function jr(t){t===Ce&&(Ce=t.parent_)}function Oi(t){return Ce=Xa(Ce,t)}function Ka(t){const r=t[_t];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Pi(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[_t].modified_&&(Hr(r),q(4)),$t(t)&&(t=ar(r,t),r.parent_||sr(r,t)),r.patches_&&te("Patches").generateReplacementPatches_(n[_t].base_,t,r.patches_,r.inversePatches_)):t=ar(r,n,[]),Hr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Rr?t:void 0}function ar(t,r,n){if(ir(r))return r;const i=r[_t];if(!i)return Me(r,(s,c)=>Ci(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return sr(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,d=!1;i.type_===3&&(c=new Set(s),s.clear(),d=!0),Me(c,(p,A)=>Ci(t,i,s,p,A,n,d)),sr(t,s,!1),n&&t.patches_&&te("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Ci(t,r,n,i,s,c,d){if(process.env.NODE_ENV!=="production"&&s===n&&q(5),qt(s)){const p=c&&r&&r.type_!==3&&!De(r.assigned_,i)?c.concat(i):void 0,A=ar(t,s,p);if(Ai(n,i,A),qt(A))t.canAutoFreeze_=!1;else return}else d&&n.add(s);if($t(s)&&!ir(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ar(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&sr(t,s)}}function sr(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Fr(r,n)}function Ba(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Mi(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=zr;n&&(s=[i],c=Re);const{revoke:d,proxy:p}=Proxy.revocable(s,c);return i.draft_=p,i.revoke_=d,p}var zr={get(t,r){if(r===_t)return t;const n=Qt(t);if(!De(n,r))return Va(t,n,r);const i=n[r];return t.finalized_||!$t(i)?i:i===$r(t.base_,r)?(Yr(t),t.copy_[r]=Gr(i,t)):i},has(t,r){return r in Qt(t)},ownKeys(t){return Reflect.ownKeys(Qt(t))},set(t,r,n){const i=Ri(Qt(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=$r(Qt(t),r),c=s==null?void 0:s[_t];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Ya(n,s)&&(n!==void 0||De(t.base_,r)))return!0;Yr(t),Ur(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 $r(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Yr(t),Ur(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=Qt(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){q(11)},getPrototypeOf(t){return Zt(t.base_)},setPrototypeOf(){q(12)}},Re={};Me(zr,(t,r)=>{Re[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Re.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&q(13),Re.set.call(this,t,r,void 0)},Re.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&q(14),zr.set.call(this,t[0],r,n,t[0])};function $r(t,r){const n=t[_t];return(n?Qt(n):t)[r]}function Va(t,r,n){var s;const i=Ri(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function Ri(t,r){if(!(r in t))return;let n=Zt(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=Zt(n)}}function Ur(t){t.modified_||(t.modified_=!0,t.parent_&&Ur(t.parent_))}function Yr(t){t.copy_||(t.copy_=Lr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Za=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const d=this;return function(A=c,...O){return d.produce(A,S=>n.call(this,S,...O))}}typeof n!="function"&&q(6),i!==void 0&&typeof i!="function"&&q(7);let s;if($t(r)){const c=Oi(this),d=Gr(r,void 0);let p=!0;try{s=n(d),p=!1}finally{p?Hr(c):jr(c)}return Di(c,i),Pi(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Rr&&(s=void 0),this.autoFreeze_&&Fr(s,!0),i){const c=[],d=[];te("Patches").generateReplacementPatches_(r,s,c,d),i(c,d)}return s}else q(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(d,...p)=>this.produceWithPatches(d,A=>r(A,...p));let i,s;return[this.produce(r,n,(d,p)=>{i=d,s=p}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){$t(t)||q(8),qt(t)&&(t=qa(t));const r=Oi(this),n=Gr(t,void 0);return n[_t].isManual_=!0,jr(r),n}finishDraft(t,r){const n=t&&t[_t];(!n||!n.isManual_)&&q(9);const{scope_:i}=n;return Di(i,r),Pi(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=te("Patches").applyPatches_;return qt(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Gr(t,r){const n=Oe(t)?te("MapSet").proxyMap_(t,r):Pe(t)?te("MapSet").proxySet_(t,r):Ba(t,r);return(r?r.scope_:Mi()).drafts_.push(n),n}function qa(t){return qt(t)||q(10,t),xi(t)}function xi(t){if(!$t(t)||ir(t))return t;const r=t[_t];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Lr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=Lr(t,!0);return Me(n,(i,s)=>{Ai(n,i,xi(s))}),r&&(r.finalized_=!1),n}function Li(){process.env.NODE_ENV!=="production"&&ki.push('Sets cannot have "replace" patches.',function(m){return"Unsupported patch operation: "+m},function(m){return"Cannot apply patch, path doesn't resolve: "+m},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(m,M,D,u){switch(m.type_){case 0:case 2:return d(m,M,D,u);case 1:return c(m,M,D,u);case 3:return p(m,M,D,u)}}function c(m,M,D,u){let{base_:f,assigned_:_}=m,g=m.copy_;g.length<f.length&&([f,g]=[g,f],[D,u]=[u,D]);for(let y=0;y<f.length;y++)if(_[y]&&g[y]!==f[y]){const h=M.concat([y]);D.push({op:r,path:h,value:R(g[y])}),u.push({op:r,path:h,value:R(f[y])})}for(let y=f.length;y<g.length;y++){const h=M.concat([y]);D.push({op:n,path:h,value:R(g[y])})}for(let y=g.length-1;f.length<=y;--y){const h=M.concat([y]);u.push({op:i,path:h})}}function d(m,M,D,u){const{base_:f,copy_:_}=m;Me(m.assigned_,(g,y)=>{const h=xr(f,g),v=xr(_,g),I=y?De(f,g)?r:n:i;if(h===v&&I===r)return;const E=M.concat(g);D.push(I===i?{op:I,path:E}:{op:I,path:E,value:v}),u.push(I===n?{op:i,path:E}:I===i?{op:n,path:E,value:R(h)}:{op:r,path:E,value:R(h)})})}function p(m,M,D,u){let{base_:f,copy_:_}=m,g=0;f.forEach(y=>{if(!_.has(y)){const h=M.concat([g]);D.push({op:i,path:h,value:y}),u.unshift({op:n,path:h,value:y})}g++}),g=0,_.forEach(y=>{if(!f.has(y)){const h=M.concat([g]);D.push({op:n,path:h,value:y}),u.unshift({op:i,path:h,value:y})}g++})}function A(m,M,D,u){D.push({op:r,path:[],value:M===Rr?void 0:M}),u.push({op:r,path:[],value:m})}function O(m,M){return M.forEach(D=>{const{path:u,op:f}=D;let _=m;for(let v=0;v<u.length-1;v++){const I=Jt(_);let E=u[v];typeof E!="string"&&typeof E!="number"&&(E=""+E),(I===0||I===1)&&(E==="__proto__"||E==="constructor")&&q(19),typeof _=="function"&&E==="prototype"&&q(19),_=xr(_,E),typeof _!="object"&&q(18,u.join("/"))}const g=Jt(_),y=S(D.value),h=u[u.length-1];switch(f){case r:switch(g){case 2:return _.set(h,y);case 3:q(16);default:return _[h]=y}case n:switch(g){case 1:return h==="-"?_.push(y):_.splice(h,0,y);case 2:return _.set(h,y);case 3:return _.add(y);default:return _[h]=y}case i:switch(g){case 1:return _.splice(h,1);case 2:return _.delete(h);case 3:return _.delete(D.value);default:return delete _[h]}default:q(17,f)}}),m}function S(m){if(!$t(m))return m;if(Array.isArray(m))return m.map(S);if(Oe(m))return new Map(Array.from(m.entries()).map(([D,u])=>[D,S(u)]));if(Pe(m))return new Set(Array.from(m).map(S));const M=Object.create(Zt(m));for(const D in m)M[D]=S(m[D]);return De(m,Ae)&&(M[Ae]=m[Ae]),M}function R(m){return qt(m)?S(m):m}Wa("Patches",{applyPatches_:O,generatePatches_:s,generateReplacementPatches_:A})}var gt=new Za,Ja=gt.produce;gt.produceWithPatches.bind(gt),gt.setAutoFreeze.bind(gt),gt.setUseStrictShallowCopy.bind(gt);var Qa=gt.applyPatches.bind(gt);gt.createDraft.bind(gt),gt.finishDraft.bind(gt);var ts=1/0,es=9007199254740991,rs="[object Arguments]",ns="[object Function]",is="[object GeneratorFunction]",as="[object Symbol]",ss=typeof Et=="object"&&Et&&Et.Object===Object&&Et,os=typeof self=="object"&&self&&self.Object===Object&&self,cs=ss||os||Function("return this")();function us(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 ls(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function fs(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Wr=Object.prototype,ds=Wr.hasOwnProperty,Xr=Wr.toString,Fi=cs.Symbol,ps=Wr.propertyIsEnumerable,Ni=Fi?Fi.isConcatSpreadable:void 0,Hi=Math.max;function hs(t,r,n,i,s){var c=-1,d=t.length;for(n||(n=_s),s||(s=[]);++c<d;){var p=t[c];n(p)?fs(s,p):s[s.length]=p}return s}function ms(t,r){return t=Object(t),ys(t,r,function(n,i){return i in t})}function ys(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var d=r[i],p=t[d];n(p,d)&&(c[d]=p)}return c}function Is(t,r){return r=Hi(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=Hi(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var d=Array(r+1);++i<r;)d[i]=n[i];return d[r]=c,us(t,this,d)}}function _s(t){return vs(t)||bs(t)||!!(Ni&&t&&t[Ni])}function gs(t){if(typeof t=="string"||As(t))return t;var r=t+"";return r=="0"&&1/t==-ts?"-0":r}function bs(t){return Ss(t)&&ds.call(t,"callee")&&(!ps.call(t,"callee")||Xr.call(t)==rs)}var vs=Array.isArray;function Es(t){return t!=null&&ks(t.length)&&!Ts(t)}function Ss(t){return ji(t)&&Es(t)}function Ts(t){var r=ws(t)?Xr.call(t):"";return r==ns||r==is}function ks(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=es}function ws(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function ji(t){return!!t&&typeof t=="object"}function As(t){return typeof t=="symbol"||ji(t)&&Xr.call(t)==as}var Ms=Is(function(t,r){return t==null?{}:ms(t,ls(hs(r),gs))}),Ds=Ms;const zi=Or(Ds),Os={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{},structure:[]},$i=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class Ps{constructor(r){de(this,"stateSubject");de(this,"stateHistorySubject");de(this,"prevState");de(this,"undos",[]);de(this,"redos",[]);de(this,"listener");const n=r||Os;this.stateSubject=new Wn(n),this.stateHistorySubject=new Wn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){za(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=zi(r,$i),s=zi(this.getState(),$i),c=Ti(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};it(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{(!it(n.trackItemIds,this.prevState.trackItemIds)||!it(n.tracks,this.prevState.tracks)||!it(n.transitionIds,this.prevState.transitionIds))&&r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{it(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!it(n.tracks,this.prevState.tracks)||!it(n.trackItemIds,this.prevState.trackItemIds)||!it(n.trackItemsMap,this.prevState.trackItemsMap)||!it(n.transitionIds,this.prevState.transitionIds)||!it(n.transitionsMap,this.prevState.transitionsMap)||!it(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||!it(n.structure,this.prevState.structure))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap,structure:n.structure})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;Li();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:O}=this.getState(),S=X({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:O}),R=[],m=[],M=[],D=[],u=[],f=[];n.forEach(w=>{let T;const j=w.path.slice(1);w.type==="CREATE"?T={path:j,op:"remove",value:w.value}:w.type==="CHANGE"?T={path:j,op:"replace",value:w.oldValue}:T={path:j,op:"add",value:w.oldValue},w.path.includes("trackItemIds")?M.push(T):w.path.includes("transitionIds")?m.push(T):w.path.includes("trackItemsMap")?u.push(T):w.path.includes("transitionsMap")?D.push(T):w.path.includes("tracks")?R.push(T):w.path.includes("trackItemDetailsMap")&&f.push(T)});const _=this.applyPatch(S.tracks,R),g=this.applyPatch(S.transitionIds,m),y=this.applyPatch(S.trackItemIds,M),h=this.applyPatch(S.transitionsMap,D),v=this.applyPatch(S.trackItemsMap,u),I=this.applyPatch(S.trackItemDetailsMap,f),E=X({tracks:_,transitionIds:g,trackItemIds:y,transitionsMap:h,trackItemsMap:v,trackItemDetailsMap:I}),U=X(this.getState()),x={...U,...E};this.prevState=U,this.redos.push({redos:n,type:i});const C=Vt(x.trackItemsMap);this.stateSubject.next({...x,duration:C}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Ja(i,c=>{Qa(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;Li();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:O}=this.getState(),S=X({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:O}),R=[],m=[],M=[],D=[],u=[],f=[];n.forEach(w=>{let T;const j=w.path.slice(1);w.type==="CREATE"?T={path:j,op:"add",value:w.value}:w.type==="CHANGE"?T={path:j,op:"replace",value:w.value}:T={path:j,op:"remove",value:w.oldValue},w.path.includes("trackItemIds")?M.push(T):w.path.includes("transitionIds")?m.push(T):w.path.includes("trackItemsMap")?u.push(T):w.path.includes("transitionsMap")?D.push(T):w.path.includes("trackItemDetailsMap")?f.push(T):R.push(T)});const _=this.applyPatch(S.tracks,R),g=this.applyPatch(S.transitionIds,m),y=this.applyPatch(S.trackItemIds,M),h=this.applyPatch(S.transitionsMap,D),v=this.applyPatch(S.trackItemsMap,u),I=this.applyPatch(S.trackItemDetailsMap,f),E=X({tracks:_,transitionIds:g,trackItemIds:y,transitionsMap:h,trackItemsMap:v,trackItemDetailsMap:I}),U=X(this.getState()),x={...U,...E};this.prevState=U,this.undos.push({undos:n,type:i});const C=Vt(x.trackItemsMap);this.stateSubject.next({...x,duration:C}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}b.ACTIVE_CLONE=oi,b.ACTIVE_DELETE=ma,b.ACTIVE_PASTE=si,b.ACTIVE_PREFIX=Bt,b.ACTIVE_SET=ha,b.ACTIVE_SPLIT=ci,b.ADD_ANIMATION=ca,b.ADD_AUDIO=Qn,b.ADD_CAPTION=ei,b.ADD_IMAGE=ti,b.ADD_ITEMS=ni,b.ADD_MASK=sa,b.ADD_PLACEHOLDER=aa,b.ADD_PREFIX=It,b.ADD_SUFFIX=ea,b.ADD_TEMPLATE=ri,b.ADD_TEXT=qn,b.ADD_TRANSITION=oa,b.ADD_VIDEO=Jn,b.DELETE_TEMPLATE_ITEM=da,b.DESIGN_LOAD=Vn,b.DESIGN_PREFIX=Je,b.DESIGN_RESIZE=Zn,b.EDIT_OBJECT=ii,b.EDIT_PREFIX=zt,b.EDIT_SHAPE=la,b.EDIT_TEMPLATE_ITEM=fa,b.EDIT_TEXT=ua,b.ENTER_EDIT_MODE=pa,b.HISTORY_PREFIX=ke,b.HISTORY_REDO=di,b.HISTORY_RESET=Ma,b.HISTORY_UNDO=fi,b.LAYER_CLONE=ui,b.LAYER_COPY=Ta,b.LAYER_CUT=Aa,b.LAYER_DELETE=li,b.LAYER_EDITING_NAME=Sa,b.LAYER_HIDDEN=Ia,b.LAYER_LOCKED=ya,b.LAYER_MOVE=_a,b.LAYER_PASTE=ka,b.LAYER_PREFIX=at,b.LAYER_RENAME=Ea,b.LAYER_SELECT=ga,b.LAYER_SELECTION=ba,b.LAYER_SEND_TO=va,b.LAYER_SPLIT=wa,b.REPLACE_MEDIA=ai,b.STATE_CHANGED=ia,b.STATE_PREFIX=Bn,b.TIMELINE_SCALE_CHANGED=pi,b.TIMELINE_SCALE_PREFIX=Pr,b.TRACKS_CHANGED=ra,b.TRACK_ITEMS_CHANGED=na,b.TRACK_ITEMS_PREFIX=Kn,b.TRACK_PREFIX=Xn,b.default=Ps,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function Ar(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var Be=function(){function t(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var r,n,i,s,c;if(!this.closed){this.closed=!0;var d=this._parentage;if(d)if(this._parentage=null,Array.isArray(d))try{for(var p=Sr(d),A=p.next();!A.done;A=p.next()){var C=A.value;C.remove(this)}}catch(u){r={error:u}}finally{try{A&&!A.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}else d.remove(this);var E=this.initialTeardown;if(xt(E))try{E()}catch(u){c=u instanceof wr?u.errors:[u]}var F=this._finalizers;if(F){this._finalizers=null;try{for(var m=Sr(F),M=m.next();!M.done;M=m.next()){var O=M.value;try{Fn(O)}catch(u){c=c??[],u instanceof wr?c=kr(kr([],Tr(c)),Tr(u.errors)):c.push(u)}}}catch(u){i={error:u}}finally{try{M&&!M.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}}if(c)throw new wr(c)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)Fn(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}(),xn=Be.EMPTY;function Ln(t){return t instanceof Be||t&&"closed"in t&&xt(t.remove)&&xt(t.add)&&xt(t.unsubscribe)}function Fn(t){xt(t)?t():t.unsubscribe()}var Nn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},jn={setTimeout:function(t,r){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return setTimeout.apply(void 0,kr([t,r],Tr(n)))},clearTimeout:function(t){var r=jn.delegate;return((r==null?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Yi(t){jn.setTimeout(function(){throw t})}function Hn(){}function Ve(t){t()}var zn=function(t){Te(r,t);function r(n){var i=t.call(this)||this;return i.isStopped=!1,n?(i.destination=n,Ln(n)&&n.add(i)):i.destination=Ki,i}return r.create=function(n,i,s){return new Dr(n,i,s)},r.prototype.next=function(n){this.isStopped||this._next(n)},r.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(n){this.destination.next(n)},r.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(Be),Gi=Function.prototype.bind;function Mr(t,r){return Gi.call(t,r)}var Wi=function(){function t(r){this.partialObserver=r}return t.prototype.next=function(r){var n=this.partialObserver;if(n.next)try{n.next(r)}catch(i){Ze(i)}},t.prototype.error=function(r){var n=this.partialObserver;if(n.error)try{n.error(r)}catch(i){Ze(i)}else Ze(r)},t.prototype.complete=function(){var r=this.partialObserver;if(r.complete)try{r.complete()}catch(n){Ze(n)}},t}(),Dr=function(t){Te(r,t);function r(n,i,s){var c=t.call(this)||this,d;if(xt(n)||!n)d={next:n??void 0,error:i??void 0,complete:s??void 0};else{var p;c&&Nn.useDeprecatedNextContext?(p=Object.create(n),p.unsubscribe=function(){return c.unsubscribe()},d={next:n.next&&Mr(n.next,p),error:n.error&&Mr(n.error,p),complete:n.complete&&Mr(n.complete,p)}):d=n}return c.destination=new Wi(d),c}return r}(zn);function Ze(t){Yi(t)}function Xi(t){throw t}var Ki={closed:!0,next:Hn,error:Xi,complete:Hn},Bi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Vi(t){return t}function Zi(t){return t.length===0?Vi:t.length===1?t[0]:function(n){return t.reduce(function(i,s){return s(i)},n)}}var $n=function(){function t(r){r&&(this._subscribe=r)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(r,n,i){var s=this,c=Ji(r)?r:new Dr(r,n,i);return Ve(function(){var d=s,p=d.operator,A=d.source;c.add(p?p.call(c,A):A?s._subscribe(c):s._trySubscribe(c))}),c},t.prototype._trySubscribe=function(r){try{return this._subscribe(r)}catch(n){r.error(n)}},t.prototype.forEach=function(r,n){var i=this;return n=Un(n),new n(function(s,c){var d=new Dr({next:function(p){try{r(p)}catch(A){c(A),d.unsubscribe()}},error:c,complete:s});i.subscribe(d)})},t.prototype._subscribe=function(r){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(r)},t.prototype[Bi]=function(){return this},t.prototype.pipe=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Zi(r)(this)},t.prototype.toPromise=function(r){var n=this;return r=Un(r),new r(function(i,s){var c;n.subscribe(function(d){return c=d},function(d){return s(d)},function(){return i(c)})})},t.create=function(r){return new t(r)},t}();function Un(t){var r;return(r=t??Nn.Promise)!==null&&r!==void 0?r:Promise}function qi(t){return t&&xt(t.next)&&xt(t.error)&&xt(t.complete)}function Ji(t){return t&&t instanceof zn||qi(t)&&Ln(t)}var Qi=Rn(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Yn=function(t){Te(r,t);function r(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return r.prototype.lift=function(n){var i=new Gn(this,this);return i.operator=n,i},r.prototype._throwIfClosed=function(){if(this.closed)throw new Qi},r.prototype.next=function(n){var i=this;Ve(function(){var s,c;if(i._throwIfClosed(),!i.isStopped){i.currentObservers||(i.currentObservers=Array.from(i.observers));try{for(var d=Sr(i.currentObservers),p=d.next();!p.done;p=d.next()){var A=p.value;A.next(n)}}catch(C){s={error:C}}finally{try{p&&!p.done&&(c=d.return)&&c.call(d)}finally{if(s)throw s.error}}}})},r.prototype.error=function(n){var i=this;Ve(function(){if(i._throwIfClosed(),!i.isStopped){i.hasError=i.isStopped=!0,i.thrownError=n;for(var s=i.observers;s.length;)s.shift().error(n)}})},r.prototype.complete=function(){var n=this;Ve(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var i=n.observers;i.length;)i.shift().complete()}})},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},r.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},r.prototype._innerSubscribe=function(n){var i=this,s=this,c=s.hasError,d=s.isStopped,p=s.observers;return c||d?xn:(this.currentObservers=null,p.push(n),new Be(function(){i.currentObservers=null,Ar(p,n)}))},r.prototype._checkFinalizedStatuses=function(n){var i=this,s=i.hasError,c=i.thrownError,d=i.isStopped;s?n.error(c):d&&n.complete()},r.prototype.asObservable=function(){var n=new $n;return n.source=this,n},r.create=function(n,i){return new Gn(n,i)},r}($n),Gn=function(t){Te(r,t);function r(n,i){var s=t.call(this)||this;return s.destination=n,s.source=i,s}return r.prototype.next=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.next)===null||s===void 0||s.call(i,n)},r.prototype.error=function(n){var i,s;(s=(i=this.destination)===null||i===void 0?void 0:i.error)===null||s===void 0||s.call(i,n)},r.prototype.complete=function(){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||i===void 0||i.call(n)},r.prototype._subscribe=function(n){var i,s;return(s=(i=this.source)===null||i===void 0?void 0:i.subscribe(n))!==null&&s!==void 0?s:xn},r}(Yn),Wn=function(t){Te(r,t);function r(n){var i=t.call(this)||this;return i._value=n,i}return Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),r.prototype._subscribe=function(n){var i=t.prototype._subscribe.call(this,n);return!i.closed&&n.next(this._value),i},r.prototype.getValue=function(){var n=this,i=n.hasError,s=n.thrownError,c=n._value;if(i)throw s;return this._throwIfClosed(),c},r.prototype.next=function(n){t.prototype.next.call(this,this._value=n)},r}(Yn),Et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Or(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var qe={exports:{}};qe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=1,c=2,d=9007199254740991,p="[object Arguments]",A="[object Array]",C="[object AsyncFunction]",E="[object Boolean]",F="[object Date]",m="[object Error]",M="[object Function]",O="[object GeneratorFunction]",u="[object Map]",f="[object Number]",_="[object Null]",g="[object Object]",y="[object Promise]",h="[object Proxy]",v="[object RegExp]",I="[object Set]",S="[object String]",j="[object Symbol]",D="[object Undefined]",L="[object WeakMap]",w="[object ArrayBuffer]",k="[object DataView]",$="[object Float32Array]",J="[object Float64Array]",B="[object Int8Array]",Ut="[object Int16Array]",Yt="[object Int32Array]",Gt="[object Uint8Array]",Wt="[object Uint8ClampedArray]",H="[object Uint16Array]",bt="[object Uint32Array]",ne=/[\\^$.*+?()[\]{}|]/g,st=/^\[object .+?Constructor\]$/,R=/^(?:0|[1-9]\d*)$/,P={};P[$]=P[J]=P[B]=P[Ut]=P[Yt]=P[Gt]=P[Wt]=P[H]=P[bt]=!0,P[p]=P[A]=P[w]=P[E]=P[k]=P[F]=P[m]=P[M]=P[u]=P[f]=P[g]=P[v]=P[I]=P[S]=P[L]=!1;var et=typeof Et=="object"&&Et&&Et.Object===Object&&Et,kt=typeof self=="object"&&self&&self.Object===Object&&self,ot=et||kt||Function("return this")(),wt=r&&!r.nodeType&&r,ie=wt&&!0&&t&&!t.nodeType&&t,W=ie&&ie.exports===wt,K=W&&et.process,N=function(){try{return K&&K.binding&&K.binding("util")}catch{}}(),ht=N&&N.isTypedArray;function dt(e,a){for(var o=-1,l=e==null?0:e.length,x=0,T=[];++o<l;){var U=e[o];a(U,o,e)&&(T[x++]=U)}return T}function rt(e,a){for(var o=-1,l=a.length,x=e.length;++o<l;)e[x+o]=a[o];return e}function vt(e,a){for(var o=-1,l=e==null?0:e.length;++o<l;)if(a(e[o],o,e))return!0;return!1}function ct(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function ae(e){return function(a){return e(a)}}function Xt(e,a){return e.has(a)}function V(e,a){return e==null?void 0:e[a]}function At(e){var a=-1,o=Array(e.size);return e.forEach(function(l,x){o[++a]=[x,l]}),o}function Kt(e,a){return function(o){return e(a(o))}}function St(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var Ot=Array.prototype,Kr=Function.prototype,se=Object.prototype,me=ot["__core-js_shared__"],xe=Kr.toString,Tt=se.hasOwnProperty,or=function(){var e=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),cr=se.toString,Br=RegExp("^"+xe.call(Tt).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=W?ot.Buffer:void 0,ye=ot.Symbol,ur=ot.Uint8Array,Ie=se.propertyIsEnumerable,oe=Ot.splice,Mt=ye?ye.toStringTag:void 0,_e=Object.getOwnPropertySymbols,Fe=Le?Le.isBuffer:void 0,ce=Kt(Object.keys,Object),Ne=Ft(ot,"DataView"),ue=Ft(ot,"Map"),je=Ft(ot,"Promise"),He=Ft(ot,"Set"),ze=Ft(ot,"WeakMap"),Bt=Ft(Object,"create"),lr=pt(Ne),Lt=pt(ue),Vr=pt(je),Zr=pt(He),qr=pt(ze),fr=ye?ye.prototype:void 0,$e=fr?fr.valueOf:void 0;function nt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Jr(){this.__data__=Bt?Bt(null):{},this.size=0}function Qr(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a}function tn(e){var a=this.__data__;if(Bt){var o=a[e];return o===i?void 0:o}return Tt.call(a,e)?a[e]:void 0}function en(e){var a=this.__data__;return Bt?a[e]!==void 0:Tt.call(a,e)}function rn(e,a){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Bt&&a===void 0?i:a,this}nt.prototype.clear=Jr,nt.prototype.delete=Qr,nt.prototype.get=tn,nt.prototype.has=en,nt.prototype.set=rn;function ut(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function nn(){this.__data__=[],this.size=0}function an(e){var a=this.__data__,o=ve(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():oe.call(a,o,1),--this.size,!0}function sn(e){var a=this.__data__,o=ve(a,e);return o<0?void 0:a[o][1]}function on(e){return ve(this.__data__,e)>-1}function cn(e,a){var o=this.__data__,l=ve(o,e);return l<0?(++this.size,o.push([e,a])):o[l][1]=a,this}ut.prototype.clear=nn,ut.prototype.delete=an,ut.prototype.get=sn,ut.prototype.has=on,ut.prototype.set=cn;function mt(e){var a=-1,o=e==null?0:e.length;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function un(){this.size=0,this.__data__={hash:new nt,map:new(ue||ut),string:new nt}}function ln(e){var a=Dt(this,e).delete(e);return this.size-=a?1:0,a}function fn(e){return Dt(this,e).get(e)}function dn(e){return Dt(this,e).has(e)}function pn(e,a){var o=Dt(this,e),l=o.size;return o.set(e,a),this.size+=o.size==l?0:1,this}mt.prototype.clear=un,mt.prototype.delete=ln,mt.prototype.get=fn,mt.prototype.has=dn,mt.prototype.set=pn;function ge(e){var a=-1,o=e==null?0:e.length;for(this.__data__=new mt;++a<o;)this.add(e[a])}function dr(e){return this.__data__.set(e,i),this}function be(e){return this.__data__.has(e)}ge.prototype.add=ge.prototype.push=dr,ge.prototype.has=be;function Pt(e){var a=this.__data__=new ut(e);this.size=a.size}function Ue(){this.__data__=new ut,this.size=0}function hn(e){var a=this.__data__,o=a.delete(e);return this.size=a.size,o}function mn(e){return this.__data__.get(e)}function yn(e){return this.__data__.has(e)}function In(e,a){var o=this.__data__;if(o instanceof ut){var l=o.__data__;if(!ue||l.length<n-1)return l.push([e,a]),this.size=++o.size,this;o=this.__data__=new mt(l)}return o.set(e,a),this.size=o.size,this}Pt.prototype.clear=Ue,Pt.prototype.delete=hn,Pt.prototype.get=mn,Pt.prototype.has=yn,Pt.prototype.set=In;function _n(e,a){var o=Ee(e),l=!o&&Ir(e),x=!o&&!l&&Se(e),T=!o&&!l&&!x&&br(e),U=o||l||x||T,z=U?ct(e.length,String):[],Z=z.length;for(var Y in e)Tt.call(e,Y)&&!(U&&(Y=="length"||x&&(Y=="offset"||Y=="parent")||T&&(Y=="buffer"||Y=="byteLength"||Y=="byteOffset")||wn(Y,Z)))&&z.push(Y);return z}function ve(e,a){for(var o=e.length;o--;)if(yr(e[o][0],a))return o;return-1}function Ye(e,a,o){var l=a(e);return Ee(e)?l:rt(l,o(e))}function le(e){return e==null?e===void 0?D:_:Mt&&Mt in Object(e)?Nt(e):mr(e)}function pr(e){return Rt(e)&&le(e)==p}function hr(e,a,o,l,x){return e===a?!0:e==null||a==null||!Rt(e)&&!Rt(a)?e!==e&&a!==a:gn(e,a,o,l,hr,x)}function gn(e,a,o,l,x,T){var U=Ee(e),z=Ee(a),Z=U?A:Ct(e),Y=z?A:Ct(a);Z=Z==p?g:Z,Y=Y==p?g:Y;var lt=Z==g,yt=Y==g,Q=Z==Y;if(Q&&Se(e)){if(!Se(a))return!1;U=!0,lt=!1}if(Q&&!lt)return T||(T=new Pt),U||br(e)?Ge(e,a,o,l,x,T):Sn(e,a,Z,o,l,x,T);if(!(o&s)){var ft=lt&&Tt.call(e,"__wrapped__"),it=yt&&Tt.call(a,"__wrapped__");if(ft||it){var Vt=ft?e.value():e,jt=it?a.value():a;return T||(T=new Pt),x(Vt,jt,o,l,T)}}return Q?(T||(T=new Pt),Tn(e,a,o,l,x,T)):!1}function bn(e){if(!gr(e)||Mn(e))return!1;var a=_r(e)?Br:st;return a.test(pt(e))}function vn(e){return Rt(e)&&Xe(e.length)&&!!P[le(e)]}function En(e){if(!Dn(e))return ce(e);var a=[];for(var o in Object(e))Tt.call(e,o)&&o!="constructor"&&a.push(o);return a}function Ge(e,a,o,l,x,T){var U=o&s,z=e.length,Z=a.length;if(z!=Z&&!(U&&Z>z))return!1;var Y=T.get(e);if(Y&&T.get(a))return Y==a;var lt=-1,yt=!0,Q=o&c?new ge:void 0;for(T.set(e,a),T.set(a,e);++lt<z;){var ft=e[lt],it=a[lt];if(l)var Vt=U?l(it,ft,lt,a,e,T):l(ft,it,lt,e,a,T);if(Vt!==void 0){if(Vt)continue;yt=!1;break}if(Q){if(!vt(a,function(jt,de){if(!Xt(Q,de)&&(ft===jt||x(ft,jt,o,l,T)))return Q.push(de)})){yt=!1;break}}else if(!(ft===it||x(ft,it,o,l,T))){yt=!1;break}}return T.delete(e),T.delete(a),yt}function Sn(e,a,o,l,x,T,U){switch(o){case k:if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case w:return!(e.byteLength!=a.byteLength||!T(new ur(e),new ur(a)));case E:case F:case f:return yr(+e,+a);case m:return e.name==a.name&&e.message==a.message;case v:case S:return e==a+"";case u:var z=At;case I:var Z=l&s;if(z||(z=St),e.size!=a.size&&!Z)return!1;var Y=U.get(e);if(Y)return Y==a;l|=c,U.set(e,a);var lt=Ge(z(e),z(a),l,x,T,U);return U.delete(e),lt;case j:if($e)return $e.call(e)==$e.call(a)}return!1}function Tn(e,a,o,l,x,T){var U=o&s,z=fe(e),Z=z.length,Y=fe(a),lt=Y.length;if(Z!=lt&&!U)return!1;for(var yt=Z;yt--;){var Q=z[yt];if(!(U?Q in a:Tt.call(a,Q)))return!1}var ft=T.get(e);if(ft&&T.get(a))return ft==a;var it=!0;T.set(e,a),T.set(a,e);for(var Vt=U;++yt<Z;){Q=z[yt];var jt=e[Q],de=a[Q];if(l)var Ui=U?l(de,jt,Q,a,e,T):l(jt,de,Q,e,a,T);if(!(Ui===void 0?jt===de||x(jt,de,o,l,T):Ui)){it=!1;break}Vt||(Vt=Q=="constructor")}if(it&&!Vt){var vr=e.constructor,Er=a.constructor;vr!=Er&&"constructor"in e&&"constructor"in a&&!(typeof vr=="function"&&vr instanceof vr&&typeof Er=="function"&&Er instanceof Er)&&(it=!1)}return T.delete(e),T.delete(a),it}function fe(e){return Ye(e,Ke,kn)}function Dt(e,a){var o=e.__data__;return An(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Ft(e,a){var o=V(e,a);return bn(o)?o:void 0}function Nt(e){var a=Tt.call(e,Mt),o=e[Mt];try{e[Mt]=void 0;var l=!0}catch{}var x=cr.call(e);return l&&(a?e[Mt]=o:delete e[Mt]),x}var kn=_e?function(e){return e==null?[]:(e=Object(e),dt(_e(e),function(a){return Ie.call(e,a)}))}:Pn,Ct=le;(Ne&&Ct(new Ne(new ArrayBuffer(1)))!=k||ue&&Ct(new ue)!=u||je&&Ct(je.resolve())!=y||He&&Ct(new He)!=I||ze&&Ct(new ze)!=L)&&(Ct=function(e){var a=le(e),o=a==g?e.constructor:void 0,l=o?pt(o):"";if(l)switch(l){case lr:return k;case Lt:return u;case Vr:return y;case Zr:return I;case qr:return L}return a});function wn(e,a){return a=a??d,!!a&&(typeof e=="number"||R.test(e))&&e>-1&&e%1==0&&e<a}function An(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Mn(e){return!!or&&or in e}function Dn(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||se;return e===o}function mr(e){return cr.call(e)}function pt(e){if(e!=null){try{return xe.call(e)}catch{}try{return e+""}catch{}}return""}function yr(e,a){return e===a||e!==e&&a!==a}var Ir=pr(function(){return arguments}())?pr:function(e){return Rt(e)&&Tt.call(e,"callee")&&!Ie.call(e,"callee")},Ee=Array.isArray;function We(e){return e!=null&&Xe(e.length)&&!_r(e)}var Se=Fe||Cn;function On(e,a){return hr(e,a)}function _r(e){if(!gr(e))return!1;var a=le(e);return a==M||a==O||a==C||a==h}function Xe(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=d}function gr(e){var a=typeof e;return e!=null&&(a=="object"||a=="function")}function Rt(e){return e!=null&&typeof e=="object"}var br=ht?ae(ht):vn;function Ke(e){return We(e)?_n(e):En(e)}function Pn(){return[]}function Cn(){return!1}t.exports=On}(qe,qe.exports);var ta=qe.exports;const tt=Or(ta),ea="add",Xn="track",Kn="trackItems",ra=`${Xn}:changed`,na=`${Kn}:changed`,Bn="state",ia=`${Bn}:changed`,Je="design",Vn=`${Je}:load`,Zn=`${Je}:resize`,It="add",qn=`${It}:text`,Jn=`${It}:video`,Qn=`${It}:audio`,aa=`${It}:placeholder`,ti=`${It}:image`,sa=`${It}:mask`,oa=`${It}:transition`,ca=`${It}:animation`,ei=`${It}:caption`,ri=`${It}:template`,ni=`${It}:items`,zt="edit",ii=`${zt}:object`,ai=`${zt}:replaceMedia`,ua=`${zt}:text`,la=`${zt}:shape`,fa=`${zt}:templateItem`,da=`${zt}:deleteTemplateItem`,pa="enterEditMode",Zt="active",ha=`${Zt}:set`,ma=`${Zt}:delete`,si=`${Zt}:paste`,oi=`${Zt}:clone`,ci=`${Zt}:split`,at="layer",ya=`${at}:locked`,Ia=`${at}:hidden`,_a=`${at}:move`,ga=`${at}:select`,ba=`${at}:selection`,va=`${at}:sendTo`,Ea=`${at}:rename`,Sa=`${at}:editingName`,Ta=`${at}:copy`,ka=`${at}:paste`,ui=`${at}:clone`,wa=`${at}:split`,Aa=`${at}:cut`,li=`${at}:delete`,ke="history",fi=`${ke}:undo`,di=`${ke}:redo`,Ma=`${ke}:reset`,Pr="scale",pi=`${Pr}:changed`;var Qe={exports:{}};Qe.exports,function(t,r){var n=200,i="__lodash_hash_undefined__",s=9007199254740991,c="[object Arguments]",d="[object Array]",p="[object Boolean]",A="[object Date]",C="[object Error]",E="[object Function]",F="[object GeneratorFunction]",m="[object Map]",M="[object Number]",O="[object Object]",u="[object Promise]",f="[object RegExp]",_="[object Set]",g="[object String]",y="[object Symbol]",h="[object WeakMap]",v="[object ArrayBuffer]",I="[object DataView]",S="[object Float32Array]",j="[object Float64Array]",D="[object Int8Array]",L="[object Int16Array]",w="[object Int32Array]",k="[object Uint8Array]",$="[object Uint8ClampedArray]",J="[object Uint16Array]",B="[object Uint32Array]",Ut=/[\\^$.*+?()[\]{}|]/g,Yt=/\w*$/,Gt=/^\[object .+?Constructor\]$/,Wt=/^(?:0|[1-9]\d*)$/,H={};H[c]=H[d]=H[v]=H[I]=H[p]=H[A]=H[S]=H[j]=H[D]=H[L]=H[w]=H[m]=H[M]=H[O]=H[f]=H[_]=H[g]=H[y]=H[k]=H[$]=H[J]=H[B]=!0,H[C]=H[E]=H[h]=!1;var bt=typeof Et=="object"&&Et&&Et.Object===Object&&Et,ne=typeof self=="object"&&self&&self.Object===Object&&self,st=bt||ne||Function("return this")(),R=r&&!r.nodeType&&r,P=R&&!0&&t&&!t.nodeType&&t,et=P&&P.exports===R;function kt(e,a){return e.set(a[0],a[1]),e}function ot(e,a){return e.add(a),e}function wt(e,a){for(var o=-1,l=e?e.length:0;++o<l&&a(e[o],o,e)!==!1;);return e}function ie(e,a){for(var o=-1,l=a.length,x=e.length;++o<l;)e[x+o]=a[o];return e}function W(e,a,o,l){for(var x=-1,T=e?e.length:0;++x<T;)o=a(o,e[x],x,e);return o}function K(e,a){for(var o=-1,l=Array(e);++o<e;)l[o]=a(o);return l}function N(e,a){return e==null?void 0:e[a]}function ht(e){var a=!1;if(e!=null&&typeof e.toString!="function")try{a=!!(e+"")}catch{}return a}function dt(e){var a=-1,o=Array(e.size);return e.forEach(function(l,x){o[++a]=[x,l]}),o}function rt(e,a){return function(o){return e(a(o))}}function vt(e){var a=-1,o=Array(e.size);return e.forEach(function(l){o[++a]=l}),o}var ct=Array.prototype,ae=Function.prototype,Xt=Object.prototype,V=st["__core-js_shared__"],At=function(){var e=/[^.]+$/.exec(V&&V.keys&&V.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Kt=ae.toString,St=Xt.hasOwnProperty,Ot=Xt.toString,Kr=RegExp("^"+Kt.call(St).replace(Ut,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=et?st.Buffer:void 0,me=st.Symbol,xe=st.Uint8Array,Tt=rt(Object.getPrototypeOf,Object),or=Object.create,cr=Xt.propertyIsEnumerable,Br=ct.splice,Le=Object.getOwnPropertySymbols,ye=se?se.isBuffer:void 0,ur=rt(Object.keys,Object),Ie=Dt(st,"DataView"),oe=Dt(st,"Map"),Mt=Dt(st,"Promise"),_e=Dt(st,"Set"),Fe=Dt(st,"WeakMap"),ce=Dt(Object,"create"),Ne=pt(Ie),ue=pt(oe),je=pt(Mt),He=pt(_e),ze=pt(Fe),Bt=me?me.prototype:void 0,lr=Bt?Bt.valueOf:void 0;function Lt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Vr(){this.__data__=ce?ce(null):{}}function Zr(e){return this.has(e)&&delete this.__data__[e]}function qr(e){var a=this.__data__;if(ce){var o=a[e];return o===i?void 0:o}return St.call(a,e)?a[e]:void 0}function fr(e){var a=this.__data__;return ce?a[e]!==void 0:St.call(a,e)}function $e(e,a){var o=this.__data__;return o[e]=ce&&a===void 0?i:a,this}Lt.prototype.clear=Vr,Lt.prototype.delete=Zr,Lt.prototype.get=qr,Lt.prototype.has=fr,Lt.prototype.set=$e;function nt(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function Jr(){this.__data__=[]}function Qr(e){var a=this.__data__,o=be(a,e);if(o<0)return!1;var l=a.length-1;return o==l?a.pop():Br.call(a,o,1),!0}function tn(e){var a=this.__data__,o=be(a,e);return o<0?void 0:a[o][1]}function en(e){return be(this.__data__,e)>-1}function rn(e,a){var o=this.__data__,l=be(o,e);return l<0?o.push([e,a]):o[l][1]=a,this}nt.prototype.clear=Jr,nt.prototype.delete=Qr,nt.prototype.get=tn,nt.prototype.has=en,nt.prototype.set=rn;function ut(e){var a=-1,o=e?e.length:0;for(this.clear();++a<o;){var l=e[a];this.set(l[0],l[1])}}function nn(){this.__data__={hash:new Lt,map:new(oe||nt),string:new Lt}}function an(e){return fe(this,e).delete(e)}function sn(e){return fe(this,e).get(e)}function on(e){return fe(this,e).has(e)}function cn(e,a){return fe(this,e).set(e,a),this}ut.prototype.clear=nn,ut.prototype.delete=an,ut.prototype.get=sn,ut.prototype.has=on,ut.prototype.set=cn;function mt(e){this.__data__=new nt(e)}function un(){this.__data__=new nt}function ln(e){return this.__data__.delete(e)}function fn(e){return this.__data__.get(e)}function dn(e){return this.__data__.has(e)}function pn(e,a){var o=this.__data__;if(o instanceof nt){var l=o.__data__;if(!oe||l.length<n-1)return l.push([e,a]),this;o=this.__data__=new ut(l)}return o.set(e,a),this}mt.prototype.clear=un,mt.prototype.delete=ln,mt.prototype.get=fn,mt.prototype.has=dn,mt.prototype.set=pn;function ge(e,a){var o=We(e)||Ee(e)?K(e.length,String):[],l=o.length,x=!!l;for(var T in e)St.call(e,T)&&!(x&&(T=="length"||An(T,l)))&&o.push(T);return o}function dr(e,a,o){var l=e[a];(!(St.call(e,a)&&Ir(l,o))||o===void 0&&!(a in e))&&(e[a]=o)}function be(e,a){for(var o=e.length;o--;)if(Ir(e[o][0],a))return o;return-1}function Pt(e,a){return e&&Ge(a,Ke(a),e)}function Ue(e,a,o,l,x,T,U){var z;if(l&&(z=T?l(e,x,T,U):l(e)),z!==void 0)return z;if(!Rt(e))return e;var Z=We(e);if(Z){if(z=kn(e),!a)return En(e,z)}else{var Y=Nt(e),lt=Y==E||Y==F;if(_r(e))return ve(e,a);if(Y==O||Y==c||lt&&!T){if(ht(e))return T?e:{};if(z=Ct(lt?{}:e),!a)return Sn(e,Pt(z,e))}else{if(!H[Y])return T?e:{};z=wn(e,Y,Ue,a)}}U||(U=new mt);var yt=U.get(e);if(yt)return yt;if(U.set(e,z),!Z)var Q=o?Tn(e):Ke(e);return wt(Q||e,function(ft,it){Q&&(it=ft,ft=e[it]),dr(z,it,Ue(ft,a,o,l,it,e,U))}),z}function hn(e){return Rt(e)?or(e):{}}function mn(e,a,o){var l=a(e);return We(e)?l:ie(l,o(e))}function yn(e){return Ot.call(e)}function In(e){if(!Rt(e)||Dn(e))return!1;var a=Xe(e)||ht(e)?Kr:Gt;return a.test(pt(e))}function _n(e){if(!mr(e))return ur(e);var a=[];for(var o in Object(e))St.call(e,o)&&o!="constructor"&&a.push(o);return a}function ve(e,a){if(a)return e.slice();var o=new e.constructor(e.length);return e.copy(o),o}function Ye(e){var a=new e.constructor(e.byteLength);return new xe(a).set(new xe(e)),a}function le(e,a){var o=a?Ye(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}function pr(e,a,o){var l=a?o(dt(e),!0):dt(e);return W(l,kt,new e.constructor)}function hr(e){var a=new e.constructor(e.source,Yt.exec(e));return a.lastIndex=e.lastIndex,a}function gn(e,a,o){var l=a?o(vt(e),!0):vt(e);return W(l,ot,new e.constructor)}function bn(e){return lr?Object(lr.call(e)):{}}function vn(e,a){var o=a?Ye(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}function En(e,a){var o=-1,l=e.length;for(a||(a=Array(l));++o<l;)a[o]=e[o];return a}function Ge(e,a,o,l){o||(o={});for(var x=-1,T=a.length;++x<T;){var U=a[x],z=void 0;dr(o,U,z===void 0?e[U]:z)}return o}function Sn(e,a){return Ge(e,Ft(e),a)}function Tn(e){return mn(e,Ke,Ft)}function fe(e,a){var o=e.__data__;return Mn(a)?o[typeof a=="string"?"string":"hash"]:o.map}function Dt(e,a){var o=N(e,a);return In(o)?o:void 0}var Ft=Le?rt(Le,Object):Pn,Nt=yn;(Ie&&Nt(new Ie(new ArrayBuffer(1)))!=I||oe&&Nt(new oe)!=m||Mt&&Nt(Mt.resolve())!=u||_e&&Nt(new _e)!=_||Fe&&Nt(new Fe)!=h)&&(Nt=function(e){var a=Ot.call(e),o=a==O?e.constructor:void 0,l=o?pt(o):void 0;if(l)switch(l){case Ne:return I;case ue:return m;case je:return u;case He:return _;case ze:return h}return a});function kn(e){var a=e.length,o=e.constructor(a);return a&&typeof e[0]=="string"&&St.call(e,"index")&&(o.index=e.index,o.input=e.input),o}function Ct(e){return typeof e.constructor=="function"&&!mr(e)?hn(Tt(e)):{}}function wn(e,a,o,l){var x=e.constructor;switch(a){case v:return Ye(e);case p:case A:return new x(+e);case I:return le(e,l);case S:case j:case D:case L:case w:case k:case $:case J:case B:return vn(e,l);case m:return pr(e,l,o);case M:case g:return new x(e);case f:return hr(e);case _:return gn(e,l,o);case y:return bn(e)}}function An(e,a){return a=a??s,!!a&&(typeof e=="number"||Wt.test(e))&&e>-1&&e%1==0&&e<a}function Mn(e){var a=typeof e;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?e!=="__proto__":e===null}function Dn(e){return!!At&&At in e}function mr(e){var a=e&&e.constructor,o=typeof a=="function"&&a.prototype||Xt;return e===o}function pt(e){if(e!=null){try{return Kt.call(e)}catch{}try{return e+""}catch{}}return""}function yr(e){return Ue(e,!0,!0)}function Ir(e,a){return e===a||e!==e&&a!==a}function Ee(e){return On(e)&&St.call(e,"callee")&&(!cr.call(e,"callee")||Ot.call(e)==c)}var We=Array.isArray;function Se(e){return e!=null&&gr(e.length)&&!Xe(e)}function On(e){return br(e)&&Se(e)}var _r=ye||Cn;function Xe(e){var a=Rt(e)?Ot.call(e):"";return a==E||a==F}function gr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=s}function Rt(e){var a=typeof e;return!!e&&(a=="object"||a=="function")}function br(e){return!!e&&typeof e=="object"}function Ke(e){return Se(e)?ge(e):_n(e)}function Pn(){return[]}function Cn(){return!1}t.exports=yr}(Qe,Qe.exports);var Da=Qe.exports;const X=Or(Da),hi=t=>new Promise((r,n)=>{const i=new Image;console.warn("update cdn config for cors?"),i.onload=()=>{const s=i.width,c=i.height;r({width:s,height:c})},i.onerror=s=>{n(s)},i.crossOrigin="anonymous",i.src=t}),Oa=t=>new Promise((r,n)=>{const i=new Audio;i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3;r({duration:s})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.crossOrigin="anonymous",i.load()}),mi=t=>new Promise((r,n)=>{const i=document.createElement("video");i.preload="auto",i.addEventListener("loadedmetadata",()=>{const s=i.duration*1e3,c=i.videoWidth,d=i.videoHeight;r({duration:s,width:c,height:d})}),i.addEventListener("error",s=>{n(s)}),i.src=t,i.load()}),yi=(t,r)=>{const n=document.createElement("div");Object.keys(r).forEach(s=>{s!=="height"&&(n.style[s]=r[s])}),document.body.appendChild(n),n.textContent=t,n.style.whiteSpace="normal",n.style.position="absolute",n.style.visibility="hidden",n.style.display="inline-block",n.style.width=r.width+"px",n.style.fontSize=r.fontSize+"px";const i=getComputedStyle(n).height;return document.body.removeChild(n),parseFloat(i)},tr=t=>{const r=t.map(n=>new FontFace(n.fontFamily,`url(${n.url})`).load().catch(i=>i));return r.length===0?Promise.resolve(!0):new Promise((n,i)=>{Promise.all(r).then(s=>{s.forEach(c=>{c&&c.family&&(document.fonts.add(c),n(!0))})}).catch(s=>i(s))})},Pa="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let er=(t=21)=>{let r="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)r+=Pa[n[t]&63];return r};function he(t=16){const r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=r.charAt(Math.floor(Math.random()*r.length));let i=er(t-1);return i=i.replace(/[^a-zA-Z0-9]/g,"").slice(0,t-1),n+i}const rr={color:"#000000",x:0,y:0,blur:0},we=(t,r)=>{let n=r!=null&&r.trim?r.trim.to-r.trim.from:(r==null?void 0:r.duration)||5e3;const i={from:0,to:n};if(!t)return i;if(t.from<0)return console.error("'from' must be a non-negative number. Returning default display."),i;if(t.from!==void 0&&t.to===void 0)return{from:t.from,to:t.from+n};if(t.to!==void 0){if(t.to<0)return console.error("'to' must be a non-negative number. Returning default display."),i;if(t.to<t.from)return console.error("'to' must be greater than or equal to 'from'. Returning default display."),i}return t},Ii=(t,r)=>t?t.from&&!t.to?{from:t.from,to:r.duration}:t:{from:0,to:r.duration};function nr(t,r){const n=t.scaleMode,i={x:t.size.width/2,y:t.size.height/2},s={x:r.width/2,y:r.height/2};let c;n==="fill"?c=Math.max(t.size.width/r.width,t.size.height/r.height):c=Math.min(t.size.width/r.width,t.size.height/r.height);const d=i.x-s.x;return{top:`${i.y-s.y}px`,left:`${d}px`,transform:`scale(${c})`}}const _i=async(t,r)=>{const n=t.details.src,i=await mi(n),s=nr(r,{...i}),c=Ii(t.trim,{duration:i.duration}),d={width:i.width,height:i.height,opacity:100,src:n,volume:t.details.volume??100,borderRadius:t.details.borderRadius??0,borderWidth:t.details.borderWidth??0,borderColor:t.details.borderColor||"#000000",boxShadow:t.details.boxShadow||rr,top:t.details.top||s.top||"0px",left:t.details.left||s.left||"0px",transform:t.details.transform||s.transform,blur:t.details.blur||0,brightness:t.details.brightness||100,flipX:t.details.flipX||!1,flipY:t.details.flipY||!1,rotate:t.details.rotate||"0deg",visibility:t.details.visibility||"visible"};return{...t,trim:c,type:"video",name:"video",details:d,playbackRate:t.playbackRate||1,display:we(t.display,{duration:i.duration,trim:c}),duration:i.duration}},gi=async t=>{const r=t.id,n=t.details,s=(await Oa(n.src)).duration,c=Ii(t.trim,{duration:s});return{id:r,name:"",type:"audio",display:we(t.display,{duration:s,trim:c}),trim:c,playbackRate:t.playbackRate||1,details:{src:n.src,volume:n.volume??100},metadata:{...t.metadata},duration:s}},Ca=async(t,r)=>{var F,m,M;const n=t.trackItemIds,i=t.size||{width:t.details.width,height:t.details.height},s=Math.min(r.size.width/i.width,r.size.height/i.height),c=((F=t.details)==null?void 0:F.rotate)||0,d={top:((m=t.details)==null?void 0:m.top)||0,left:((M=t.details)==null?void 0:M.left)||0},p=t.display,A=t.trim||t.display;let C=1/0,E=0;return n.forEach(O=>{const u=t.trackItemsMap[O];u.display.from<C&&(C=u.display.from),u.display.to>E&&(E=u.display.to)}),{id:t.id,details:{...i,top:d.top,left:d.left,scale:s,rotate:c},trim:A,display:p||{from:C,to:E},activeEdit:!1}},bi=async(t,r)=>{const n=t.details,i=await hi(n.src),s=nr(r,i);return{id:t.id,type:"image",name:"image",display:we(t.display),playbackRate:t.playbackRate||1,details:{src:n.src||"",width:n.width||i.width||100,height:n.height||i.height||100,opacity:n.opacity??100,transform:n.transform||s.transform,border:n.border||"none",borderRadius:n.borderRadius||0,boxShadow:n.boxShadow||rr,top:n.top||s.top||"0px",left:n.left||s.left||"0px",borderWidth:n.borderWidth??0,borderColor:n.borderColor||"#000000",blur:n.blur||0,brightness:n.brightness||100,flipX:n.flipX||!1,flipY:n.flipY||!1,rotate:n.rotate||"0deg",visibility:n.visibility||"visible"},metadata:t.metadata||{}}},vi=async(t,r)=>{const n=t;n.details.fontUrl&&await tr([{fontFamily:n.details.fontFamily,url:n.details.fontUrl}]);const i=n.id,s=n.details,c=Si(s),d=yi(n.details.text,c),p=nr(r,{width:c.width,height:d});return{id:i,name:"caption",type:"caption",display:we(n.display),details:{...c,text:s.text||"",height:d,fontUrl:s.fontUrl,top:c.top||p.top,left:c.left||p.left,borderWidth:s.borderWidth||0,borderColor:s.borderColor||"#000000",boxShadow:s.boxShadow||rr,words:s.words||[]},metadata:t.metadata||{}}},Ei=async(t,r)=>{t.details.fontUrl&&await tr([{fontFamily:t.details.fontFamily,url:t.details.fontUrl}]);const n=t.id,i=t.details,s=Si(i),c=yi(t.details.text,s),d=nr(r,{width:s.width,height:c});return{id:n,name:"text",type:"text",display:we(t.display),details:{...s,text:i.text||"",height:c,fontUrl:i.fontUrl,top:s.top||d.top,left:s.left||d.left,borderWidth:i.borderWidth||0,borderColor:i.borderColor||"#000000",boxShadow:i.boxShadow||rr},metadata:{}}},Si=t=>({fontFamily:t.fontFamily||"Arial",fontSize:t.fontSize||"16px",fontWeight:t.fontWeight||"normal",fontStyle:t.fontStyle||"normal",textDecoration:t.textDecoration||"none",textAlign:t.textAlign||"left",lineHeight:t.lineHeight||"normal",letterSpacing:t.letterSpacing||"normal",wordSpacing:t.wordSpacing||"normal",color:t.color||"#ffffff",backgroundColor:t.backgroundColor||"transparent",border:t.border||"none",textShadow:t.textShadow||"none",text:t.text||"",opacity:t.opacity??100,width:t.width||300,wordWrap:t.wordWrap||"normal",wordBreak:t.wordBreak||"normal",WebkitTextStrokeColor:t.WebkitTextStrokeColor||"#ffffff",WebkitTextStrokeWidth:t.WebkitTextStrokeWidth||"0px",top:t.top,left:t.left,textTransform:t.textTransform||"none",transform:t.transform||"none",skewX:t.skewX||0,skewY:t.skewY||0}),Ra=async(t,r)=>{switch(t.type){case"video":return _i(t,r||{});case"audio":return gi(t);case"image":return bi(t,r||{});case"text":return Ei(t,r||{});case"caption":return vi(t,r||{});default:throw new Error("Unsupported track item")}};function xa(t,r){return r.some(n=>t.some(i=>i.id===n.id))}const La=(t=[],r=[])=>t.length===0?r.map(i=>({id:he(),items:[i.id],type:i.type,accepts:["text","image","video","audio","caption","template"]})):t.map(n=>({...n,items:n.items||[],accepts:["audio","video","image","text","caption","template"],type:n.type||"text",magnetic:n.magnetic||!1,static:n.static||!1,id:n.id||he()}));function Fa(t,r){return t.filter(i=>{if(r.forEach(s=>{i.items.includes(s)&&(i.items=i.items.filter(c=>c!==s))}),i.items.length!==0||i.static)return i})}const qt=t=>Object.keys(t).reduce((r,n)=>{const{display:i,playbackRate:s}=t[n];return Math.max(r,i.to/(s||1))},0);function Cr(t,r,n){return Math.min(Math.max(t,r),n)}const Na=(t,r,n,i,s)=>{if(i===void 0&&s===void 0)return{trackId:void 0,trackIndex:void 0};const c=s!==void 0?r[Cr(s,0,r.length)]:r.find(A=>A.id===i);if(!c)return{trackId:void 0,trackIndex:s!==void 0?Cr(s,0,r.length):void 0};const d=c.items.map(A=>n[A]),p=t.map(A=>n[A]);for(const A of d){const C=A.display.from,E=A.display.to;for(const F of p){const m=F.display.from;if(!(F.display.to<=C||m>=E))return{trackId:void 0,trackIndex:r.indexOf(c)}}}return{trackId:c.id,trackIndex:r.indexOf(c)}};function ja(t,r){let i=r.reduce((s,c)=>c.display.to>s.display.to?c:s,{display:{to:0}}).display.to;t.forEach(s=>{const c=s.display.from,p=s.display.to-c;s.display.from=i,s.display.to=s.display.from+p,i=s.display.to})}function Ha(t){const r=t,n=r.tracks,i=r.trackItemsMap,s=[],c={};return n.forEach(d=>{var A;const p=d.items.map(C=>i[C]).sort((C,E)=>C.display.from-E.display.from);for(let C=0;C<p.length-1;C++){const E=p[C],F=p[C+1];if(Math.abs(E.display.to-F.display.from)<=1){const m=`${E.id}-${F.id}`;if((A=r.transitionIds)==null?void 0:A.includes(m))c[m]=r.transitionsMap[m];else{const O={id:m,duration:1500,fromId:E.id,toId:F.id,kind:"none",trackId:d.id,type:"transition"};c[m]=O}s.push(m)}}}),r.transitionIds=s,r.transitionsMap=c,{transitionIds:s,transitionsMap:c}}function za(t){const r=G.subject.pipe(G.filter(({key:u})=>u.startsWith(Je))),n=G.subject.pipe(G.filter(({key:u})=>u.startsWith(It))),i=G.subject.pipe(G.filter(({key:u})=>u.startsWith(at))),s=G.subject.pipe(G.filter(({key:u})=>u.startsWith(ke))),c=G.subject.pipe(G.filter(({key:u})=>u.startsWith(Zt))),d=G.subject.pipe(G.filter(({key:u})=>u.startsWith(zt))),p=G.subject.pipe(G.filter(({key:u})=>u.startsWith(Pr))),A=r.subscribe(async u=>{var f,_;if(u.key===Vn){const g=(f=u.value)==null?void 0:f.payload,y=g.trackItemsMap,h=g.trackItemDetailsMap;console.warn("IMPROVE FONTS LOADING");for(const I in h)if(h[I].type==="text"||h[I].type==="caption"){const S=h[I].details;await tr([{fontFamily:S.fontFamily,url:S.fontUrl}])}const v=qt(y);t.updateState({...g,duration:v},{kind:"design:load",updateHistory:!1})}if(u.key===Zn){const g=(_=u.value)==null?void 0:_.payload;t.updateState({size:g},{kind:"design:resize",updateHistory:!1})}}),C=s.subscribe(u=>{if(u.key===fi)return t.undo();if(u.key===di)return t.redo()}),E=p.subscribe(u=>{var f;if(u.key===pi){const _=(f=u.value)==null?void 0:f.payload.scale;t.updateState({scale:_},{kind:"update",updateHistory:!1})}}),F=i.subscribe(u=>{var _,g,y,h;const f=[];if((_=u.value)!=null&&_.payload.trackItemIds&&(f.push((g=u.value)==null?void 0:g.payload.trackItemIds),t.updateState({activeIds:f},{kind:"update",updateHistory:!1})),u.key===li){const v=(y=u.value)==null?void 0:y.payload.trackItemIds,I=X(t.getState()),S=v&&v.length?v:I.activeIds,j=S.map(R=>I.transitionsMap[R]).filter(R=>!!R).map(R=>R.id),D=S.map(R=>I.trackItemsMap[R]).filter(R=>!!R).map(R=>R.id),L=I.transitionIds.filter(R=>{const P=I.transitionsMap[R];return D.includes(P.fromId)||D.includes(P.toId)});D.push(...L,...j);const w=I.trackItemIds,k=I.transitionIds,$=I.trackItemDetailsMap,J=X(I.tracks),B=X(I.structure);D.forEach(R=>{var et;const P=I.trackItemsMap[R]||I.transitionsMap[R];if(P.type==="template"){const kt=(et=I.structure.find(wt=>wt.id===P.id))==null?void 0:et.items;D.push(...kt);const ot=B.findIndex(wt=>wt.id===P.id);B.splice(ot,1)}}),D.forEach(R=>{B.forEach(P=>{P.items.includes(R)&&(P.items=P.items.filter(et=>et!==R))})});const Ut=w.filter(R=>!D.includes(R)),Yt=k.filter(R=>!D.includes(R)),Gt=Object.fromEntries(Object.entries($).filter(([R])=>!D.includes(R))),Wt=Object.fromEntries(Object.entries(I.transitionsMap).filter(([R])=>!D.includes(R))),H=Fa(I.tracks,D),bt=Object.fromEntries(Object.entries(I.trackItemsMap).filter(([R])=>!D.includes(R)));J.filter(R=>R.magnetic).forEach(R=>{let P=0;R==null||R.items.forEach(et=>{if(bt[et]){const kt=bt[et].display.to-bt[et].display.from;bt[et].display={from:P,to:P+kt},P+=kt}})});const st=qt(bt);t.updateState({trackItemIds:Ut,trackItemDetailsMap:Gt,activeIds:[],trackItemsMap:bt,tracks:H,duration:st,structure:B,transitionIds:Yt,transitionsMap:Wt},{updateHistory:!0,kind:"remove"})}if(u.key===ui){const v=X(t.getState()),I={},S=((h=u.value)==null?void 0:h.payload.trackItemIds)||v.activeIds;if(S.length===0)return;S.forEach(D=>{const L=v.trackItemsMap[D],w=v.trackItemDetailsMap[D],k=he();v.trackItemsMap[k]={...X(L),id:k},v.trackItemDetailsMap[k]={...X(w)},v.trackItemIds.push(k);const $=v.tracks.find(J=>J.items.includes(D));I[$.id]?I[$.id].items.push(k):I[$.id]={...$,id:he(),items:[k],static:!1,magnetic:!1}});const j=Object.values(I);v.tracks=[...j,...v.tracks],t.updateState({trackItemDetailsMap:v.trackItemDetailsMap,tracks:v.tracks,trackItemIds:v.trackItemIds,trackItemsMap:v.trackItemsMap},{updateHistory:!0,kind:"update"})}}),m=n.subscribe(async u=>{var j,D,L,w,k,$,J,B,Ut,Yt,Gt,Wt,H,bt,ne,st,R,P,et,kt,ot,wt,ie;const f=X(t.getState()),_=((D=(j=u.value)==null?void 0:j.options)==null?void 0:D.isSelected)||!1,g=(w=(L=u.value)==null?void 0:L.options)==null?void 0:w.scaleMode;let y=[],h="text";const v=($=(k=u.value)==null?void 0:k.options)==null?void 0:$.trackId;let I=(B=(J=u.value)==null?void 0:J.options)==null?void 0:B.trackIndex;if(u.key===ni){const W=(Ut=u.value)==null?void 0:Ut.payload,K=W.trackItems.map(V=>Ra(V,{size:f.size})),N=await Promise.all(K),ht=La(W.tracks,W.trackItems),dt=[],rt={},vt={};if(N.forEach(V=>{const{details:At,...Kt}=V;dt.push(V.id),rt[V.id]={type:V.type,details:At},vt[V.id]=Kt}),xa(f.tracks,ht))f.tracks.forEach(V=>{ht.forEach(At=>{if(V.id===At.id){if(V.magnetic){const Kt=At.items.map(Ot=>vt[Ot]),St=V.items.map(Ot=>f.trackItemsMap[Ot]);ja(Kt,St)}V.items.push(...dt)}})});else{const V=((Gt=(Yt=u.value)==null?void 0:Yt.options)==null?void 0:Gt.trackIndex)||0,At=Cr(V,0,f.tracks.length);f.tracks.splice(At,0,...ht)}f.trackItemDetailsMap={...f.trackItemDetailsMap,...rt},f.trackItemsMap={...f.trackItemsMap,...vt},f.trackItemIds=[...f.trackItemIds,...dt],f.duration=qt(f.trackItemsMap);const{transitionIds:ae,transitionsMap:Xt}=Ha(f);t.updateState({trackItemIds:f.trackItemIds,trackItemDetailsMap:f.trackItemDetailsMap,trackItemsMap:f.trackItemsMap,tracks:f.tracks,duration:f.duration,transitionIds:ae,transitionsMap:Xt},{updateHistory:!0,kind:"add"});return}if(u.key===ei){h="caption";const W=(Wt=u.value)==null?void 0:Wt.payload,K=[];for(const dt of W){const rt=vi(dt,{size:f.size});K.push(rt)}const N=await Promise.all(K),ht=[];for(const dt of N){const rt=dt.id;ht.push(rt);const{details:vt,...ct}=dt;f.trackItemDetailsMap[rt]={type:h,details:vt},f.trackItemsMap[rt]=ct,f.trackItemIds.push(rt)}y=ht}if(u.key===qn){h="text";const W=await Ei((H=u.value)==null?void 0:H.payload,{size:f.size}),{details:K,...N}=W;f.trackItemDetailsMap[N.id]={type:h,details:K},f.trackItemsMap[N.id]=N,f.trackItemIds.push(N.id),y=[N.id]}if(u.key===ri){h="template";const W=(bt=u.value)==null?void 0:bt.payload.trackItemsMap,K=(ne=u.value)==null?void 0:ne.payload.trackItemDetailsMap,N=(st=u.value)==null?void 0:st.payload.transitionsMap,ht=((R=u.value)==null?void 0:R.payload.transitionIds)||[],dt=(P=u.value)==null?void 0:P.payload.trackItemIds,rt=((et=u.value)==null?void 0:et.payload.tracks)||[],{details:vt,...ct}=await Ca((kt=u.value)==null?void 0:kt.payload,{size:f.size}),ae={id:ct.id,items:dt,transitions:ht,tracks:rt};f.trackItemDetailsMap[ct.id]={type:h,details:vt},f.trackItemsMap[ct.id]=ct,f.trackItemIds.push(ct.id),y=[ct.id],f.trackItemsMap={...f.trackItemsMap,...W,[ct.id]:{type:"template",...ct}},f.trackItemDetailsMap={...f.trackItemDetailsMap,...K,[ct.id]:{type:"template",details:vt}},f.transitionsMap={...f.transitionsMap,...N},f.structure=[...f.structure,ae]}if(u.key===ti){h="image";const W=await bi((ot=u.value)==null?void 0:ot.payload,{size:f.size,scaleMode:g}),{details:K,...N}=W;f.trackItemDetailsMap[N.id]={type:h,details:K},f.trackItemsMap[N.id]=N,f.trackItemIds.push(N.id),y=[N.id]}if(u.key===Qn){h="audio";const W=await gi((wt=u.value)==null?void 0:wt.payload),{details:K,...N}=W;f.trackItemDetailsMap[N.id]={type:h,details:K},f.trackItemsMap[N.id]=N,f.trackItemIds.push(N.id),y=[N.id]}if(u.key===Jn){h="video";const W=await _i((ie=u.value)==null?void 0:ie.payload,{size:f.size,scaleMode:g}),{details:K,...N}=W;f.trackItemDetailsMap[N.id]={type:h,details:K,metadata:N.metadata},f.trackItemsMap[N.id]=N,f.trackItemIds.push(N.id),y=[N.id]}const S=Na(y,f.tracks,f.trackItemsMap,v,I);if(S.trackId){const W=f.tracks.find(K=>K.id===S.trackId);W&&W.items.push(...y)}else if(S.trackIndex!==void 0){const W={id:er(),accepts:["text","audio","helper","video","image","caption","template"],type:h,items:y,magnetic:!1,static:!1};f.tracks.splice(S.trackIndex,0,W)}else f.tracks.unshift({id:er(),accepts:["text","audio","helper","video","image","caption","template"],type:h,items:y,magnetic:!1,static:!1});_&&(f.activeIds=y),f.duration=qt(f.trackItemsMap),t.updateState({activeIds:f.activeIds,trackItemIds:f.trackItemIds,trackItemDetailsMap:f.trackItemDetailsMap,trackItemsMap:f.trackItemsMap,transitionsMap:f.transitionsMap,tracks:f.tracks,duration:f.duration,structure:f.structure},{updateHistory:!0,kind:"add"})}),M=c.subscribe(async u=>{var f;if(u.key===ci){const _=X(t.getState()),g=(f=u.value)==null?void 0:f.options.time;if(_.activeIds.length===1){const y=_.activeIds[0],h=X(_.trackItemsMap[y]);if(g>=h.display.to||g<=h.display.from)return;const v=X(_.trackItemDetailsMap[y]),I=he(),S=X({...h,display:{from:h.display.from,to:g}}),j=X({...h,id:I,display:{from:g,to:h.display.to}});if(h.type==="video"||h.type==="audio"){const D=g-S.display.from;S.trim={from:h.trim.from,to:h.trim.from+D},j.trim={from:h.trim.from+D,to:h.trim.to}}_.trackItemsMap[y]=S,_.trackItemsMap[I]=j,_.trackItemIds.push(I),_.trackItemDetailsMap[I]=v,_.tracks.forEach(D=>{D.items.includes(y)&&D.items.push(I)}),t.updateState({trackItemDetailsMap:_.trackItemDetailsMap,tracks:_.tracks,trackItemIds:_.trackItemIds,trackItemsMap:_.trackItemsMap},{updateHistory:!0,kind:"update"})}return}if(u.key===oi){const _=X(t.getState());if(_.activeIds.length){const g=_.activeIds,y=[],h={activeIds:g,trackItemDetailsMap:{},trackItemsMap:{},tracks:[]};g.forEach(I=>{h.trackItemDetailsMap[I]=_.trackItemDetailsMap[I],h.trackItemsMap[I]=_.trackItemsMap[I],y.push(_.tracks.find(S=>S.items.includes(I)))});const v=new Set;y.filter(I=>v.has(I.id)?!1:(v.add(I),!0)),h.tracks=Array.from(v.keys()),localStorage.setItem("DesignComboTemp",JSON.stringify(h))}}if(u.key===si){const _=localStorage.getItem("DesignComboTemp");if(!_)return;const g=X(t.getState()),y=JSON.parse(_),h={},v=y.trackItemsMap,I=y.trackItemDetailsMap,S=y.tracks,j=[],D=y.activeIds.map(async L=>{const w=I[L];(w.type==="caption"||w.type==="text")&&w.details.fontUrl&&await tr([{fontFamily:w.details.fontFamily,url:w.details.fontUrl}]);const k=he();return h[L]=k,g.trackItemsMap[k]={...v[L],id:k},g.trackItemDetailsMap[k]=w,g.trackItemIds.push(k),!0});await Promise.all(D),S.forEach(L=>{const w=L.items.map($=>h[$]),k={...L,items:w,id:er()};j.push(k)}),g.tracks=[...g.tracks,...j],t.updateState({trackItemDetailsMap:g.trackItemDetailsMap,tracks:g.tracks,trackItemIds:g.trackItemIds,trackItemsMap:g.trackItemsMap},{updateHistory:!0,kind:"update"})}}),O=d.subscribe(async u=>{var f,_,g;if(u.key===ii){const y=X(t.getState()),h=y.trackItemDetailsMap,v=y.trackItemsMap,I=Object.keys((f=u.value)==null?void 0:f.payload);if(!I.length)return;const S=(_=u.value)==null?void 0:_.payload;I.forEach(D=>{const L=S[D];L.details?h[D].details={...h[D].details,...L.details}:S[D].playbackRate&&(v[D].playbackRate=S[D].playbackRate)});const j=qt(v);t.updateState({trackItemDetailsMap:{...h},trackItemsMap:{...v},duration:j},{updateHistory:!0,kind:"update:details"})}if(u.key===ai){const y=(g=u.value)==null?void 0:g.payload,h=Object.keys(y)[0],v=Object.values(y)[0],I=X(t.getState()),S=I.trackItemDetailsMap[h],j=S.details;if(v.details){if(v.type==="image"&&v.details.src){const L=await hi(v.details.src),w=S.details.width||0,k=S.details.height||0;let $=L.width,J=L.height;const B=L.width/L.height;w/k>B?($=w,J=w/B):(J=k,$=k*B),j.crop={x:0,y:0,height:j.height,width:j.width},v.details.width=$,v.details.height=J}if(v.type==="video"&&v.details.src){const L=await mi(v.details.src),w=S.details.width||0,k=S.details.height||0;let $=L.width,J=L.height;const B=L.width/L.height;w/k>B?($=w,J=w/B):(J=k,$=k*B),j.crop={x:0,y:0,height:j.height,width:j.width},v.details.width=$,v.details.height=J}S.details={...j,...v.details},v.details=S.details}const D={...S,...v};I.trackItemDetailsMap[h]=D,I.trackItemsMap[h]={...I.trackItemsMap[h],type:v.type},t.updateState({trackItemDetailsMap:{...I.trackItemDetailsMap},trackItemsMap:{...I.trackItemsMap}},{updateHistory:!0,kind:"update:details"})}});return{unsubscribe:()=>{m.unsubscribe(),M.unsubscribe(),O.unsubscribe(),C.unsubscribe(),F.unsubscribe(),A.unsubscribe(),E.unsubscribe()}}}const $a={Date:!0,RegExp:!0,String:!0,Number:!0};function Ti(t,r,n={cyclesFix:!0},i=[]){var p,A;let s=[];const c=Array.isArray(t);for(const C in t){const E=t[C],F=c?+C:C;if(!(C in r)){s.push({type:"REMOVE",path:[F],oldValue:t[C]});continue}const m=r[C],M=typeof E=="object"&&typeof m=="object"&&Array.isArray(E)===Array.isArray(m);if(E&&m&&M&&!$a[(A=(p=Object.getPrototypeOf(E))==null?void 0:p.constructor)==null?void 0:A.name]&&(!n.cyclesFix||!i.includes(E))){const O=Ti(E,m,n,n.cyclesFix?i.concat([E]):[]);s.push.apply(s,O.map(u=>(u.path.unshift(F),u)))}else E!==m&&!(Number.isNaN(E)&&Number.isNaN(m))&&!(M&&(isNaN(E)?E+""==m+"":+E==+m))&&s.push({path:[F],type:"CHANGE",value:m,oldValue:E})}const d=Array.isArray(r);for(const C in r)C in t||s.push({type:"CREATE",path:[d?+C:C],value:r[C]});return s}var Rr=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),ki=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function q(t,...r){if(process.env.NODE_ENV!=="production"){const n=ki[t],i=typeof n=="function"?n.apply(null,r):n;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Jt=Object.getPrototypeOf;function Qt(t){return!!t&&!!t[_t]}function $t(t){var r;return t?wi(t)||Array.isArray(t)||!!t[Ae]||!!((r=t.constructor)!=null&&r[Ae])||Oe(t)||Pe(t):!1}var Ua=Object.prototype.constructor.toString();function wi(t){if(!t||typeof t!="object")return!1;const r=Jt(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)===Ua}function Me(t,r){te(t)===0?Reflect.ownKeys(t).forEach(n=>{r(n,t[n],t)}):t.forEach((n,i)=>r(i,n,t))}function te(t){const r=t[_t];return r?r.type_:Array.isArray(t)?1:Oe(t)?2:Pe(t)?3:0}function De(t,r){return te(t)===2?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function xr(t,r){return te(t)===2?t.get(r):t[r]}function Ai(t,r,n){const i=te(t);i===2?t.set(r,n):i===3?t.add(n):t[r]=n}function Ya(t,r){return t===r?t!==0||1/t===1/r:t!==t&&r!==r}function Oe(t){return t instanceof Map}function Pe(t){return t instanceof Set}function ee(t){return t.copy_||t.base_}function Lr(t,r){if(Oe(t))return new Map(t);if(Pe(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=wi(t);if(r===!0||r==="class_only"&&!n){const i=Object.getOwnPropertyDescriptors(t);delete i[_t];let s=Reflect.ownKeys(i);for(let c=0;c<s.length;c++){const d=s[c],p=i[d];p.writable===!1&&(p.writable=!0,p.configurable=!0),(p.get||p.set)&&(i[d]={configurable:!0,writable:!0,enumerable:p.enumerable,value:t[d]})}return Object.create(Jt(t),i)}else{const i=Jt(t);if(i!==null&&n)return{...t};const s=Object.create(i);return Object.assign(s,t)}}function Fr(t,r=!1){return ir(t)||Qt(t)||!$t(t)||(te(t)>1&&(t.set=t.add=t.clear=t.delete=Ga),Object.freeze(t),r&&Object.entries(t).forEach(([n,i])=>Fr(i,!0))),t}function Ga(){q(2)}function ir(t){return Object.isFrozen(t)}var Nr={};function re(t){const r=Nr[t];return r||q(0,t),r}function Wa(t,r){Nr[t]||(Nr[t]=r)}var Ce;function Mi(){return Ce}function Xa(t,r){return{drafts_:[],parent_:t,immer_:r,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Di(t,r){r&&(re("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=r)}function jr(t){Hr(t),t.drafts_.forEach(Ka),t.drafts_=null}function Hr(t){t===Ce&&(Ce=t.parent_)}function Oi(t){return Ce=Xa(Ce,t)}function Ka(t){const r=t[_t];r.type_===0||r.type_===1?r.revoke_():r.revoked_=!0}function Pi(t,r){r.unfinalizedDrafts_=r.drafts_.length;const n=r.drafts_[0];return t!==void 0&&t!==n?(n[_t].modified_&&(jr(r),q(4)),$t(t)&&(t=ar(r,t),r.parent_||sr(r,t)),r.patches_&&re("Patches").generateReplacementPatches_(n[_t].base_,t,r.patches_,r.inversePatches_)):t=ar(r,n,[]),jr(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==Rr?t:void 0}function ar(t,r,n){if(ir(r))return r;const i=r[_t];if(!i)return Me(r,(s,c)=>Ci(t,i,r,s,c,n)),r;if(i.scope_!==t)return r;if(!i.modified_)return sr(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let c=s,d=!1;i.type_===3&&(c=new Set(s),s.clear(),d=!0),Me(c,(p,A)=>Ci(t,i,s,p,A,n,d)),sr(t,s,!1),n&&t.patches_&&re("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Ci(t,r,n,i,s,c,d){if(process.env.NODE_ENV!=="production"&&s===n&&q(5),Qt(s)){const p=c&&r&&r.type_!==3&&!De(r.assigned_,i)?c.concat(i):void 0,A=ar(t,s,p);if(Ai(n,i,A),Qt(A))t.canAutoFreeze_=!1;else return}else d&&n.add(s);if($t(s)&&!ir(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ar(t,s),(!r||!r.scope_.parent_)&&typeof i!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,i)&&sr(t,s)}}function sr(t,r,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Fr(r,n)}function Ba(t,r){const n=Array.isArray(t),i={type_:n?1:0,scope_:r?r.scope_:Mi(),modified_:!1,finalized_:!1,assigned_:{},parent_:r,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=i,c=zr;n&&(s=[i],c=Re);const{revoke:d,proxy:p}=Proxy.revocable(s,c);return i.draft_=p,i.revoke_=d,p}var zr={get(t,r){if(r===_t)return t;const n=ee(t);if(!De(n,r))return Va(t,n,r);const i=n[r];return t.finalized_||!$t(i)?i:i===$r(t.base_,r)?(Yr(t),t.copy_[r]=Gr(i,t)):i},has(t,r){return r in ee(t)},ownKeys(t){return Reflect.ownKeys(ee(t))},set(t,r,n){const i=Ri(ee(t),r);if(i!=null&&i.set)return i.set.call(t.draft_,n),!0;if(!t.modified_){const s=$r(ee(t),r),c=s==null?void 0:s[_t];if(c&&c.base_===n)return t.copy_[r]=n,t.assigned_[r]=!1,!0;if(Ya(n,s)&&(n!==void 0||De(t.base_,r)))return!0;Yr(t),Ur(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 $r(t.base_,r)!==void 0||r in t.base_?(t.assigned_[r]=!1,Yr(t),Ur(t)):delete t.assigned_[r],t.copy_&&delete t.copy_[r],!0},getOwnPropertyDescriptor(t,r){const n=ee(t),i=Reflect.getOwnPropertyDescriptor(n,r);return i&&{writable:!0,configurable:t.type_!==1||r!=="length",enumerable:i.enumerable,value:n[r]}},defineProperty(){q(11)},getPrototypeOf(t){return Jt(t.base_)},setPrototypeOf(){q(12)}},Re={};Me(zr,(t,r)=>{Re[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Re.deleteProperty=function(t,r){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(r))&&q(13),Re.set.call(this,t,r,void 0)},Re.set=function(t,r,n){return process.env.NODE_ENV!=="production"&&r!=="length"&&isNaN(parseInt(r))&&q(14),zr.set.call(this,t[0],r,n,t[0])};function $r(t,r){const n=t[_t];return(n?ee(n):t)[r]}function Va(t,r,n){var s;const i=Ri(r,n);return i?"value"in i?i.value:(s=i.get)==null?void 0:s.call(t.draft_):void 0}function Ri(t,r){if(!(r in t))return;let n=Jt(t);for(;n;){const i=Object.getOwnPropertyDescriptor(n,r);if(i)return i;n=Jt(n)}}function Ur(t){t.modified_||(t.modified_=!0,t.parent_&&Ur(t.parent_))}function Yr(t){t.copy_||(t.copy_=Lr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Za=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(r,n,i)=>{if(typeof r=="function"&&typeof n!="function"){const c=n;n=r;const d=this;return function(A=c,...C){return d.produce(A,E=>n.call(this,E,...C))}}typeof n!="function"&&q(6),i!==void 0&&typeof i!="function"&&q(7);let s;if($t(r)){const c=Oi(this),d=Gr(r,void 0);let p=!0;try{s=n(d),p=!1}finally{p?jr(c):Hr(c)}return Di(c,i),Pi(s,c)}else if(!r||typeof r!="object"){if(s=n(r),s===void 0&&(s=r),s===Rr&&(s=void 0),this.autoFreeze_&&Fr(s,!0),i){const c=[],d=[];re("Patches").generateReplacementPatches_(r,s,c,d),i(c,d)}return s}else q(1,r)},this.produceWithPatches=(r,n)=>{if(typeof r=="function")return(d,...p)=>this.produceWithPatches(d,A=>r(A,...p));let i,s;return[this.produce(r,n,(d,p)=>{i=d,s=p}),i,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){$t(t)||q(8),Qt(t)&&(t=qa(t));const r=Oi(this),n=Gr(t,void 0);return n[_t].isManual_=!0,Hr(r),n}finishDraft(t,r){const n=t&&t[_t];(!n||!n.isManual_)&&q(9);const{scope_:i}=n;return Di(i,r),Pi(void 0,i)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const s=r[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(r=r.slice(n+1));const i=re("Patches").applyPatches_;return Qt(t)?i(t,r):this.produce(t,s=>i(s,r))}};function Gr(t,r){const n=Oe(t)?re("MapSet").proxyMap_(t,r):Pe(t)?re("MapSet").proxySet_(t,r):Ba(t,r);return(r?r.scope_:Mi()).drafts_.push(n),n}function qa(t){return Qt(t)||q(10,t),xi(t)}function xi(t){if(!$t(t)||ir(t))return t;const r=t[_t];let n;if(r){if(!r.modified_)return r.base_;r.finalized_=!0,n=Lr(t,r.scope_.immer_.useStrictShallowCopy_)}else n=Lr(t,!0);return Me(n,(i,s)=>{Ai(n,i,xi(s))}),r&&(r.finalized_=!1),n}function Li(){process.env.NODE_ENV!=="production"&&ki.push('Sets cannot have "replace" patches.',function(m){return"Unsupported patch operation: "+m},function(m){return"Cannot apply patch, path doesn't resolve: "+m},"Patching reserved attributes like __proto__, prototype and constructor is not allowed");const r="replace",n="add",i="remove";function s(m,M,O,u){switch(m.type_){case 0:case 2:return d(m,M,O,u);case 1:return c(m,M,O,u);case 3:return p(m,M,O,u)}}function c(m,M,O,u){let{base_:f,assigned_:_}=m,g=m.copy_;g.length<f.length&&([f,g]=[g,f],[O,u]=[u,O]);for(let y=0;y<f.length;y++)if(_[y]&&g[y]!==f[y]){const h=M.concat([y]);O.push({op:r,path:h,value:F(g[y])}),u.push({op:r,path:h,value:F(f[y])})}for(let y=f.length;y<g.length;y++){const h=M.concat([y]);O.push({op:n,path:h,value:F(g[y])})}for(let y=g.length-1;f.length<=y;--y){const h=M.concat([y]);u.push({op:i,path:h})}}function d(m,M,O,u){const{base_:f,copy_:_}=m;Me(m.assigned_,(g,y)=>{const h=xr(f,g),v=xr(_,g),I=y?De(f,g)?r:n:i;if(h===v&&I===r)return;const S=M.concat(g);O.push(I===i?{op:I,path:S}:{op:I,path:S,value:v}),u.push(I===n?{op:i,path:S}:I===i?{op:n,path:S,value:F(h)}:{op:r,path:S,value:F(h)})})}function p(m,M,O,u){let{base_:f,copy_:_}=m,g=0;f.forEach(y=>{if(!_.has(y)){const h=M.concat([g]);O.push({op:i,path:h,value:y}),u.unshift({op:n,path:h,value:y})}g++}),g=0,_.forEach(y=>{if(!f.has(y)){const h=M.concat([g]);O.push({op:n,path:h,value:y}),u.unshift({op:i,path:h,value:y})}g++})}function A(m,M,O,u){O.push({op:r,path:[],value:M===Rr?void 0:M}),u.push({op:r,path:[],value:m})}function C(m,M){return M.forEach(O=>{const{path:u,op:f}=O;let _=m;for(let v=0;v<u.length-1;v++){const I=te(_);let S=u[v];typeof S!="string"&&typeof S!="number"&&(S=""+S),(I===0||I===1)&&(S==="__proto__"||S==="constructor")&&q(19),typeof _=="function"&&S==="prototype"&&q(19),_=xr(_,S),typeof _!="object"&&q(18,u.join("/"))}const g=te(_),y=E(O.value),h=u[u.length-1];switch(f){case r:switch(g){case 2:return _.set(h,y);case 3:q(16);default:return _[h]=y}case n:switch(g){case 1:return h==="-"?_.push(y):_.splice(h,0,y);case 2:return _.set(h,y);case 3:return _.add(y);default:return _[h]=y}case i:switch(g){case 1:return _.splice(h,1);case 2:return _.delete(h);case 3:return _.delete(O.value);default:return delete _[h]}default:q(17,f)}}),m}function E(m){if(!$t(m))return m;if(Array.isArray(m))return m.map(E);if(Oe(m))return new Map(Array.from(m.entries()).map(([O,u])=>[O,E(u)]));if(Pe(m))return new Set(Array.from(m).map(E));const M=Object.create(Jt(m));for(const O in m)M[O]=E(m[O]);return De(m,Ae)&&(M[Ae]=m[Ae]),M}function F(m){return Qt(m)?E(m):m}Wa("Patches",{applyPatches_:C,generatePatches_:s,generateReplacementPatches_:A})}var gt=new Za,Ja=gt.produce;gt.produceWithPatches.bind(gt),gt.setAutoFreeze.bind(gt),gt.setUseStrictShallowCopy.bind(gt);var Qa=gt.applyPatches.bind(gt);gt.createDraft.bind(gt),gt.finishDraft.bind(gt);var ts=1/0,es=9007199254740991,rs="[object Arguments]",ns="[object Function]",is="[object GeneratorFunction]",as="[object Symbol]",ss=typeof Et=="object"&&Et&&Et.Object===Object&&Et,os=typeof self=="object"&&self&&self.Object===Object&&self,cs=ss||os||Function("return this")();function us(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 ls(t,r){for(var n=-1,i=t?t.length:0,s=Array(i);++n<i;)s[n]=r(t[n],n,t);return s}function fs(t,r){for(var n=-1,i=r.length,s=t.length;++n<i;)t[s+n]=r[n];return t}var Wr=Object.prototype,ds=Wr.hasOwnProperty,Xr=Wr.toString,Fi=cs.Symbol,ps=Wr.propertyIsEnumerable,Ni=Fi?Fi.isConcatSpreadable:void 0,ji=Math.max;function hs(t,r,n,i,s){var c=-1,d=t.length;for(n||(n=_s),s||(s=[]);++c<d;){var p=t[c];n(p)?fs(s,p):s[s.length]=p}return s}function ms(t,r){return t=Object(t),ys(t,r,function(n,i){return i in t})}function ys(t,r,n){for(var i=-1,s=r.length,c={};++i<s;){var d=r[i],p=t[d];n(p,d)&&(c[d]=p)}return c}function Is(t,r){return r=ji(r===void 0?t.length-1:r,0),function(){for(var n=arguments,i=-1,s=ji(n.length-r,0),c=Array(s);++i<s;)c[i]=n[r+i];i=-1;for(var d=Array(r+1);++i<r;)d[i]=n[i];return d[r]=c,us(t,this,d)}}function _s(t){return vs(t)||bs(t)||!!(Ni&&t&&t[Ni])}function gs(t){if(typeof t=="string"||As(t))return t;var r=t+"";return r=="0"&&1/t==-ts?"-0":r}function bs(t){return Ss(t)&&ds.call(t,"callee")&&(!ps.call(t,"callee")||Xr.call(t)==rs)}var vs=Array.isArray;function Es(t){return t!=null&&ks(t.length)&&!Ts(t)}function Ss(t){return Hi(t)&&Es(t)}function Ts(t){var r=ws(t)?Xr.call(t):"";return r==ns||r==is}function ks(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=es}function ws(t){var r=typeof t;return!!t&&(r=="object"||r=="function")}function Hi(t){return!!t&&typeof t=="object"}function As(t){return typeof t=="symbol"||Hi(t)&&Xr.call(t)==as}var Ms=Is(function(t,r){return t==null?{}:ms(t,ls(hs(r),gs))}),Ds=Ms;const zi=Or(Ds),Os={size:{width:1080,height:1920},tracks:[],trackItemIds:[],trackItemsMap:{},transitionIds:[],transitionsMap:{},scale:{unit:1,zoom:1,segments:1,index:1},duration:0,activeIds:[],trackItemDetailsMap:{},structure:[]},$i=["tracks","trackItemsMap","trackItemDetailsMap","transitionIds","transitionsMap","trackItemIds"];class Ps{constructor(r){pe(this,"stateSubject");pe(this,"stateHistorySubject");pe(this,"prevState");pe(this,"undos",[]);pe(this,"redos",[]);pe(this,"listener");const n=Object.assign({},Os,r);this.stateSubject=new Wn(n),this.stateHistorySubject=new Wn({handleRedo:!1,handleUndo:!1}),this.prevState=n,this.initListeners()}initListeners(){za(this)}destroyListeners(){this.listener&&this.listener.unsubscribe()}purge(){this.destroyListeners()}updateHistory(r,n){const i=zi(r,$i),s=zi(this.getState(),$i),c=Ti(s,i);c.length&&(this.undos.push({undos:c,type:n}),this.redos=[])}getStateHistory(){return this.stateHistorySubject.getValue()}subscribeHistory(r){return this.stateHistorySubject.subscribe(r)}getState(){return this.stateSubject.getValue()}subscribe(r){return this.stateSubject.subscribe(r)}updateState(r,n={updateHistory:!1}){const i=this.getState(),s={...i,...r};tt(i,s)||(n.updateHistory&&this.updateHistory(s,n.kind),this.prevState=i,this.stateSubject.next(s))}subscribeToSize(r){return this.stateSubject.asObservable().subscribe(n=>{tt(n.size,this.prevState.size)||r({size:n.size})})}subscribeToScale(r){return this.stateSubject.asObservable().subscribe(n=>{tt(n.scale,this.prevState.scale)||r({scale:n.scale})})}subscribeToUpdateTrackItem(r){return this.stateSubject.asObservable().subscribe(n=>{tt(n.trackItemsMap,this.prevState.trackItemsMap)||r({trackItemsMap:n.trackItemsMap})})}subscribeToUpdateTrackItemTrim(r){return this.stateSubject.asObservable().subscribe(n=>{if(!tt(n.trackItemsMap,this.prevState.trackItemsMap)){const i=Object.keys(n.trackItemsMap).filter(s=>{const c=this.prevState.trackItemsMap[s],d=n.trackItemsMap[s];return c&&d&&!tt(c.trim,d.trim)});r({trackItemsMap:n.trackItemsMap,changedTrimIds:i.length>0?i:void 0})}})}subscribeToUpdateItemDetails(r){return this.stateSubject.asObservable().subscribe(n=>{tt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||r({trackItemDetailsMap:n.trackItemDetailsMap})})}subscribeToDuration(r){return this.stateSubject.asObservable().subscribe(n=>{n.duration!==this.prevState.duration&&r({duration:n.duration})})}subscribeToHistory(r){return this.stateHistorySubject.asObservable().subscribe(n=>{if(n.handleRedo){const i=this.undos[this.undos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}if(n.handleUndo){const i=this.redos[this.redos.length-1].type;i==="update"&&r({...this.getState(),type:i}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!1})}})}subscribeToAddOrRemoveItems(r){return this.stateSubject.asObservable().subscribe(n=>{(!tt(n.trackItemIds,this.prevState.trackItemIds)||!tt(n.tracks,this.prevState.tracks)||!tt(n.transitionIds,this.prevState.transitionIds))&&r({trackItemIds:n.trackItemIds})})}subscribeToActiveIds(r){return this.stateSubject.asObservable().subscribe(n=>{tt(n.activeIds,this.prevState.activeIds)||r({activeIds:n.activeIds})})}subscribeToTracks(r){return this.stateSubject.asObservable().subscribe(n=>{(!tt(n.tracks,this.prevState.tracks)||!tt(n.trackItemIds,this.prevState.trackItemIds)||!tt(n.trackItemsMap,this.prevState.trackItemsMap)||!tt(n.transitionIds,this.prevState.transitionIds)||!tt(n.transitionsMap,this.prevState.transitionsMap)||!tt(n.trackItemDetailsMap,this.prevState.trackItemDetailsMap)||!tt(n.structure,this.prevState.structure))&&r({tracks:n.tracks,trackItemIds:n.trackItemIds,trackItemsMap:n.trackItemsMap,transitionIds:n.transitionIds,transitionsMap:n.transitionsMap,trackItemDetailsMap:n.trackItemDetailsMap,structure:n.structure})})}undo(){const r=this.undos.pop(),n=r==null?void 0:r.undos,i=r==null?void 0:r.type;if(!n||!i)return;Li();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:C}=this.getState(),E=X({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:C}),F=[],m=[],M=[],O=[],u=[],f=[];n.forEach(w=>{let k;const $=w.path.slice(1);w.type==="CREATE"?k={path:$,op:"remove",value:w.value}:w.type==="CHANGE"?k={path:$,op:"replace",value:w.oldValue}:k={path:$,op:"add",value:w.oldValue},w.path.includes("trackItemIds")?M.push(k):w.path.includes("transitionIds")?m.push(k):w.path.includes("trackItemsMap")?u.push(k):w.path.includes("transitionsMap")?O.push(k):w.path.includes("tracks")?F.push(k):w.path.includes("trackItemDetailsMap")&&f.push(k)});const _=this.applyPatch(E.tracks,F),g=this.applyPatch(E.transitionIds,m),y=this.applyPatch(E.trackItemIds,M),h=this.applyPatch(E.transitionsMap,O),v=this.applyPatch(E.trackItemsMap,u),I=this.applyPatch(E.trackItemDetailsMap,f),S=X({tracks:_,transitionIds:g,trackItemIds:y,transitionsMap:h,trackItemsMap:v,trackItemDetailsMap:I}),j=X(this.getState()),D={...j,...S};this.prevState=j,this.redos.push({redos:n,type:i});const L=qt(D.trackItemsMap);this.stateSubject.next({...D,duration:L}),this.stateHistorySubject.next({handleRedo:!1,handleUndo:!0})}applyPatch(r,n){return n.reverse().reduce((i,s)=>Ja(i,c=>{Qa(c,[s])}),r)}redo(){const r=this.redos.pop(),n=r==null?void 0:r.redos,i=r==null?void 0:r.type;if(!n||!i)return;Li();const{trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:C}=this.getState(),E=X({trackItemDetailsMap:s,trackItemIds:c,tracks:d,transitionIds:p,transitionsMap:A,trackItemsMap:C}),F=[],m=[],M=[],O=[],u=[],f=[];n.forEach(w=>{let k;const $=w.path.slice(1);w.type==="CREATE"?k={path:$,op:"add",value:w.value}:w.type==="CHANGE"?k={path:$,op:"replace",value:w.value}:k={path:$,op:"remove",value:w.oldValue},w.path.includes("trackItemIds")?M.push(k):w.path.includes("transitionIds")?m.push(k):w.path.includes("trackItemsMap")?u.push(k):w.path.includes("transitionsMap")?O.push(k):w.path.includes("trackItemDetailsMap")?f.push(k):F.push(k)});const _=this.applyPatch(E.tracks,F),g=this.applyPatch(E.transitionIds,m),y=this.applyPatch(E.trackItemIds,M),h=this.applyPatch(E.transitionsMap,O),v=this.applyPatch(E.trackItemsMap,u),I=this.applyPatch(E.trackItemDetailsMap,f),S=X({tracks:_,transitionIds:g,trackItemIds:y,transitionsMap:h,trackItemsMap:v,trackItemDetailsMap:I}),j=X(this.getState()),D={...j,...S};this.prevState=j,this.undos.push({undos:n,type:i});const L=qt(D.trackItemsMap);this.stateSubject.next({...D,duration:L}),this.stateHistorySubject.next({handleRedo:!0,handleUndo:!1})}}b.ACTIVE_CLONE=oi,b.ACTIVE_DELETE=ma,b.ACTIVE_PASTE=si,b.ACTIVE_PREFIX=Zt,b.ACTIVE_SET=ha,b.ACTIVE_SPLIT=ci,b.ADD_ANIMATION=ca,b.ADD_AUDIO=Qn,b.ADD_CAPTION=ei,b.ADD_IMAGE=ti,b.ADD_ITEMS=ni,b.ADD_MASK=sa,b.ADD_PLACEHOLDER=aa,b.ADD_PREFIX=It,b.ADD_SUFFIX=ea,b.ADD_TEMPLATE=ri,b.ADD_TEXT=qn,b.ADD_TRANSITION=oa,b.ADD_VIDEO=Jn,b.DELETE_TEMPLATE_ITEM=da,b.DESIGN_LOAD=Vn,b.DESIGN_PREFIX=Je,b.DESIGN_RESIZE=Zn,b.EDIT_OBJECT=ii,b.EDIT_PREFIX=zt,b.EDIT_SHAPE=la,b.EDIT_TEMPLATE_ITEM=fa,b.EDIT_TEXT=ua,b.ENTER_EDIT_MODE=pa,b.HISTORY_PREFIX=ke,b.HISTORY_REDO=di,b.HISTORY_RESET=Ma,b.HISTORY_UNDO=fi,b.LAYER_CLONE=ui,b.LAYER_COPY=Ta,b.LAYER_CUT=Aa,b.LAYER_DELETE=li,b.LAYER_EDITING_NAME=Sa,b.LAYER_HIDDEN=Ia,b.LAYER_LOCKED=ya,b.LAYER_MOVE=_a,b.LAYER_PASTE=ka,b.LAYER_PREFIX=at,b.LAYER_RENAME=Ea,b.LAYER_SELECT=ga,b.LAYER_SELECTION=ba,b.LAYER_SEND_TO=va,b.LAYER_SPLIT=wa,b.REPLACE_MEDIA=ai,b.STATE_CHANGED=ia,b.STATE_PREFIX=Bn,b.TIMELINE_SCALE_CHANGED=pi,b.TIMELINE_SCALE_PREFIX=Pr,b.TRACKS_CHANGED=ra,b.TRACK_ITEMS_CHANGED=na,b.TRACK_ITEMS_PREFIX=Kn,b.TRACK_PREFIX=Xn,b.default=Ps,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/state.d.ts CHANGED
@@ -19,7 +19,7 @@ declare class StateManager implements IStateManager {
19
19
  type: IKindHistory;
20
20
  }[];
21
21
  private listener;
22
- constructor(state?: State);
22
+ constructor(state?: Partial<State>);
23
23
  initListeners(): void;
24
24
  destroyListeners(): void;
25
25
  purge(): void;
@@ -38,6 +38,10 @@ declare class StateManager implements IStateManager {
38
38
  subscribeToUpdateTrackItem(callback: (trackItemUpdate: {
39
39
  trackItemsMap: State["trackItemsMap"];
40
40
  }) => void): import('rxjs').Subscription;
41
+ subscribeToUpdateTrackItemTrim(callback: (trackItemUpdate: {
42
+ trackItemsMap: State["trackItemsMap"];
43
+ changedTrimIds?: string[];
44
+ }) => void): import('rxjs').Subscription;
41
45
  subscribeToUpdateItemDetails(callback: (trackItemDetailsMap: {
42
46
  trackItemDetailsMap: State["trackItemDetailsMap"];
43
47
  }) => void): import('rxjs').Subscription;
@@ -90,8 +90,6 @@ export declare const loadImageItem: (payload: ITrackItem & IImage, options: {
90
90
  flipY: any;
91
91
  rotate: any;
92
92
  visibility: any;
93
- mediaWidth: any;
94
- mediaHeight: any;
95
93
  };
96
94
  metadata: Record<string, any>;
97
95
  }>;
@@ -256,8 +254,6 @@ export declare const loadTrackItem: (payload: ITrackItem & (IVideo | IAudio | II
256
254
  flipY: any;
257
255
  rotate: any;
258
256
  visibility: any;
259
- mediaWidth: any;
260
- mediaHeight: any;
261
257
  };
262
258
  metadata: Record<string, any>;
263
259
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcombo/state",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"
@@ -25,7 +25,7 @@
25
25
  "typescript": "^5.3.3",
26
26
  "vite": "^5.2.0",
27
27
  "vite-plugin-dts": "^3.9.1",
28
- "@designcombo/types": "1.0.6",
28
+ "@designcombo/types": "1.1.0",
29
29
  "@designcombo/typescript-config": "0.0.0"
30
30
  },
31
31
  "dependencies": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@designcombo/events": "^1.0.2",
42
- "@designcombo/types": "1.0.6"
42
+ "@designcombo/types": "1.1.0"
43
43
  },
44
44
  "scripts": {
45
45
  "dev": "vite",