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