variabletime/bin/web/theatre_modules/core-only.min.js
2023-09-24 18:39:52 +02:00

30 lines
97 KiB
JavaScript

(()=>{var pp=Object.create;var Rt=Object.defineProperty,lp=Object.defineProperties,up=Object.getOwnPropertyDescriptor,fp=Object.getOwnPropertyDescriptors,cp=Object.getOwnPropertyNames,ln=Object.getOwnPropertySymbols,dp=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable;var uo=(e,t,r)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))un.call(t,r)&&uo(e,r,t[r]);if(ln)for(var r of ln(t))mp.call(t,r)&&uo(e,r,t[r]);return e},V=(e,t)=>lp(e,fp(t)),fn=e=>Rt(e,"__esModule",{value:!0});var Jt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fo=(e,t)=>{fn(e);for(var r in t)Rt(e,r,{get:t[r],enumerable:!0})},hp=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of cp(t))!un.call(e,o)&&o!=="default"&&Rt(e,o,{get:()=>t[o],enumerable:!(r=up(t,o))||r.enumerable});return e},Yt=e=>hp(fn(Rt(e!=null?pp(dp(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var d=(e,t,r)=>(uo(e,typeof t!="symbol"?t+"":t,r),r);var fi=Jt((Mj,ui)=>{var wu;ui.exports=wu=function(){function e(t,r,o,n){this.set(t,r,o,n)}return e.prototype.set=function(t,r,o,n){this._cx=3*t,this._bx=3*(o-t)-this._cx,this._ax=1-this._cx-this._bx,this._cy=3*r,this._by=3*(n-r)-this._cy,this._ay=1-this._cy-this._by},e.epsilon=1e-6,e.prototype._sampleCurveX=function(t){return((this._ax*t+this._bx)*t+this._cx)*t},e.prototype._sampleCurveY=function(t){return((this._ay*t+this._by)*t+this._cy)*t},e.prototype._sampleCurveDerivativeX=function(t){return(3*this._ax*t+2*this._bx)*t+this._cx},e.prototype._solveCurveX=function(t,r){var o,n,i,a,s,l;for(i=void 0,a=void 0,s=void 0,l=void 0,o=void 0,n=void 0,s=t,n=0;n<8;){if(l=this._sampleCurveX(s)-t,Math.abs(l)<r)return s;if(o=this._sampleCurveDerivativeX(s),Math.abs(o)<r)break;s=s-l/o,n++}if(i=0,a=1,s=t,s<i)return i;if(s>a)return a;for(;i<a;){if(l=this._sampleCurveX(s),Math.abs(l-t)<r)return s;t>l?i=s:a=s,s=(a-i)*.5+i}return s},e.prototype.solve=function(t,r){return this._sampleCurveY(this._solveCurveX(t,r))},e.prototype.solveSimple=function(t){return this._sampleCurveY(this._solveCurveX(t,1e-6))},e}()});var Ds=Jt((sO,ks)=>{var Br,No;Br=[];No=[];function Zh(e,t,r){var o,n,i,a,s,l,p,u;if(e===t)return 0;if(o=e.length,n=t.length,o===0)return n;if(n===0)return o;for(r&&(e=e.toLowerCase(),t=t.toLowerCase()),p=0;p<o;)No[p]=e.charCodeAt(p),Br[p]=++p;for(u=0;u<n;)for(i=t.charCodeAt(u),a=s=u++,p=-1;++p<o;)l=i===No[p]?s:s+1,s=Br[p],Br[p]=a=s>a?l>a?a+1:l:l>s?s+1:l;return a}ks.exports=Zh});var Vs=Jt((pO,Rs)=>{var Es=Ds();function Qh(){var e,t,r,o,n,i=0,a=arguments[0],s=arguments[1],l=s.length,p=arguments[2];p&&(o=p.threshold,n=p.ignoreCase),o===void 0&&(o=0);for(var u=0;u<l;++u)n?t=Es(a,s[u],!0):t=Es(a,s[u]),t>a.length?e=1-t/s[u].length:e=1-t/a.length,e>i&&(i=e,r=s[u]);return i>=o?r:null}Rs.exports=Qh});var zo=Jt((Aw,Ws)=>{"use strict";Ws.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!=0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!=0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!=0;){var a=i[n];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var pn={};fo(pn,{createRafDriver:()=>zt,getProject:()=>ap,notify:()=>pe,onChange:()=>Lr,types:()=>Xr,val:()=>sp});var sn={};fo(sn,{createRafDriver:()=>zt,getProject:()=>ap,notify:()=>pe,onChange:()=>Lr,types:()=>Xr,val:()=>sp});var gp=Array.isArray,$=gp;var yp=typeof window=="object"&&window&&window.Object===Object&&window,Xt=yp;var bp=typeof self=="object"&&self&&self.Object===Object&&self,Pp=Xt||bp||Function("return this")(),N=Pp;var jp=N.Symbol,K=jp;var cn=Object.prototype,_p=cn.hasOwnProperty,Tp=cn.toString,Vt=K?K.toStringTag:void 0;function vp(e){var t=_p.call(e,Vt),r=e[Vt];try{e[Vt]=void 0;var o=!0}catch(i){}var n=Tp.call(e);return o&&(t?e[Vt]=r:delete e[Vt]),n}var dn=vp;var xp=Object.prototype,Sp=xp.toString;function Ip(e){return Sp.call(e)}var mn=Ip;var Ap="[object Null]",Op="[object Undefined]",hn=K?K.toStringTag:void 0;function wp(e){return e==null?e===void 0?Op:Ap:hn&&hn in Object(e)?dn(e):mn(e)}var Q=wp;function Cp(e){return e!=null&&typeof e=="object"}var B=Cp;var kp="[object Symbol]";function Dp(e){return typeof e=="symbol"||B(e)&&Q(e)==kp}var ve=Dp;var Ep=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rp=/^\w*$/;function Vp(e,t){if($(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ve(e)?!0:Rp.test(e)||!Ep.test(e)||t!=null&&e in Object(t)}var et=Vp;function Np(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var M=Np;var Lp="[object AsyncFunction]",Mp="[object Function]",$p="[object GeneratorFunction]",Bp="[object Proxy]";function Fp(e){if(!M(e))return!1;var t=Q(e);return t==Mp||t==$p||t==Lp||t==Bp}var Zt=Fp;var Up=N["__core-js_shared__"],Qt=Up;var gn=function(){var e=/[^.]+$/.exec(Qt&&Qt.keys&&Qt.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function zp(e){return!!gn&&gn in e}var yn=zp;var qp=Function.prototype,Kp=qp.toString;function Wp(e){if(e!=null){try{return Kp.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var he=Wp;var Gp=/[\\^$.*+?()[\]{}|]/g,Hp=/^\[object .+?Constructor\]$/,Jp=Function.prototype,Yp=Object.prototype,Xp=Jp.toString,Zp=Yp.hasOwnProperty,Qp=RegExp("^"+Xp.call(Zp).replace(Gp,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function el(e){if(!M(e)||yn(e))return!1;var t=Zt(e)?Qp:Hp;return t.test(he(e))}var bn=el;function tl(e,t){return e==null?void 0:e[t]}var Pn=tl;function rl(e,t){var r=Pn(e,t);return bn(r)?r:void 0}var W=rl;var ol=W(Object,"create"),ge=ol;function nl(){this.__data__=ge?ge(null):{},this.size=0}var jn=nl;function il(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var _n=il;var al="__lodash_hash_undefined__",sl=Object.prototype,pl=sl.hasOwnProperty;function ll(e){var t=this.__data__;if(ge){var r=t[e];return r===al?void 0:r}return pl.call(t,e)?t[e]:void 0}var Tn=ll;var ul=Object.prototype,fl=ul.hasOwnProperty;function cl(e){var t=this.__data__;return ge?t[e]!==void 0:fl.call(t,e)}var vn=cl;var dl="__lodash_hash_undefined__";function ml(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ge&&t===void 0?dl:t,this}var xn=ml;function tt(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}tt.prototype.clear=jn;tt.prototype.delete=_n;tt.prototype.get=Tn;tt.prototype.has=vn;tt.prototype.set=xn;var co=tt;function hl(){this.__data__=[],this.size=0}var Sn=hl;function gl(e,t){return e===t||e!==e&&t!==t}var rt=gl;function yl(e,t){for(var r=e.length;r--;)if(rt(e[r][0],t))return r;return-1}var xe=yl;var bl=Array.prototype,Pl=bl.splice;function jl(e){var t=this.__data__,r=xe(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():Pl.call(t,r,1),--this.size,!0}var In=jl;function _l(e){var t=this.__data__,r=xe(t,e);return r<0?void 0:t[r][1]}var An=_l;function Tl(e){return xe(this.__data__,e)>-1}var On=Tl;function vl(e,t){var r=this.__data__,o=xe(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}var wn=vl;function ot(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}ot.prototype.clear=Sn;ot.prototype.delete=In;ot.prototype.get=An;ot.prototype.has=On;ot.prototype.set=wn;var Se=ot;var xl=W(N,"Map"),Ie=xl;function Sl(){this.size=0,this.__data__={hash:new co,map:new(Ie||Se),string:new co}}var Cn=Sl;function Il(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var kn=Il;function Al(e,t){var r=e.__data__;return kn(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ae=Al;function Ol(e){var t=Ae(this,e).delete(e);return this.size-=t?1:0,t}var Dn=Ol;function wl(e){return Ae(this,e).get(e)}var En=wl;function Cl(e){return Ae(this,e).has(e)}var Rn=Cl;function kl(e,t){var r=Ae(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}var Vn=kl;function nt(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}nt.prototype.clear=Cn;nt.prototype.delete=Dn;nt.prototype.get=En;nt.prototype.has=Rn;nt.prototype.set=Vn;var Fe=nt;var Dl="Expected a function";function mo(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Dl);var r=function(){var o=arguments,n=t?t.apply(this,o):o[0],i=r.cache;if(i.has(n))return i.get(n);var a=e.apply(this,o);return r.cache=i.set(n,a)||i,a};return r.cache=new(mo.Cache||Fe),r}mo.Cache=Fe;var Nn=mo;var El=500;function Rl(e){var t=Nn(e,function(o){return r.size===El&&r.clear(),o}),r=t.cache;return t}var Ln=Rl;var Vl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nl=/\\(\\)?/g,Ll=Ln(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vl,function(r,o,n,i){t.push(n?i.replace(Nl,"$1"):o||r)}),t}),Mn=Ll;function Ml(e,t){for(var r=-1,o=e==null?0:e.length,n=Array(o);++r<o;)n[r]=t(e[r],r,e);return n}var $n=Ml;var $l=1/0,Bn=K?K.prototype:void 0,Fn=Bn?Bn.toString:void 0;function Un(e){if(typeof e=="string")return e;if($(e))return $n(e,Un)+"";if(ve(e))return Fn?Fn.call(e):"";var t=e+"";return t=="0"&&1/e==-$l?"-0":t}var er=Un;function Bl(e){return e==null?"":er(e)}var tr=Bl;function Fl(e,t){return $(e)?e:et(e,t)?[e]:Mn(tr(e))}var Oe=Fl;var Ul=1/0;function zl(e){if(typeof e=="string"||ve(e))return e;var t=e+"";return t=="0"&&1/e==-Ul?"-0":t}var oe=zl;function ql(e,t){t=Oe(t,e);for(var r=0,o=t.length;e!=null&&r<o;)e=e[oe(t[r++])];return r&&r==o?e:void 0}var it=ql;function Kl(e,t,r){var o=e==null?void 0:it(e,t);return o===void 0?r:o}var at=Kl;function Wl(e,t){return function(r){return e(t(r))}}var rr=Wl;var Gl=rr(Object.getPrototypeOf,Object),st=Gl;var Hl="[object Object]",Jl=Function.prototype,Yl=Object.prototype,zn=Jl.toString,Xl=Yl.hasOwnProperty,Zl=zn.call(Object);function Ql(e){if(!B(e)||Q(e)!=Hl)return!1;var t=st(e);if(t===null)return!0;var r=Xl.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&zn.call(r)==Zl}var Nt=Ql;function eu(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var or=eu;var ho=new WeakMap,qn=new WeakMap,Kn=Symbol("pointerMeta"),tu={get(e,t){if(t===Kn)return ho.get(e);let r=qn.get(e);r||(r=new Map,qn.set(e,r));let o=r.get(t);if(o!==void 0)return o;let n=ho.get(e),i=Wn({root:n.root,path:[...n.path,t]});return r.set(t,i),i}},pt=e=>e[Kn],G=e=>{let{root:t,path:r}=pt(e);return{root:t,path:r}};function Wn(e){var o;let t={root:e.root,path:(o=e.path)!=null?o:[]},r={};return ho.set(r,t),new Proxy(r,tu)}var ye=Wn,ae=e=>e&&!!pt(e);function go(e,t,r){return t.length===0?r(e):nr(e,t,r)}var nr=(e,t,r)=>{if(t.length===0)return r(e);if(Array.isArray(e)){let[o,...n]=t;o=parseInt(String(o),10),isNaN(o)&&(o=0);let i=e[o],a=nr(i,n,r);if(i===a)return e;let s=[...e];return s.splice(o,1,a),s}else if(typeof e=="object"&&e!==null){let[o,...n]=t,i=e[o],a=nr(i,n,r);return i===a?e:V(_({},e),{[o]:a})}else{let[o,...n]=t;return{[o]:nr(void 0,n,r)}}};var lt=class{constructor(){this._head=void 0}peek(){return this._head&&this._head.data}pop(){let t=this._head;if(!!t)return this._head=t.next,t.data}push(t){let r={next:this._head,data:t};this._head=r}};function we(e){return!!(e&&e.isPrism&&e.isPrism===!0)}function Gn(){let e=()=>{},t=new lt,r=e;return{type:"Dataverse_discoveryMechanism",startIgnoringDependencies:()=>{t.push(r)},stopIgnoringDependencies:()=>{t.peek()!==r||t.pop()},reportResolutionStart:p=>{let u=t.peek();u&&u(p),t.push(r)},reportResolutionEnd:p=>{t.pop()},pushCollector:p=>{t.push(p)},popCollector:p=>{if(t.peek()!==p)throw new Error("Popped collector is not on top of the stack");t.pop()}}}function ru(){let e="__dataverse_discoveryMechanism_sharedStack",t=typeof window!="undefined"||typeof window!="undefined"?window:{};if(t){let r=t[e];if(r&&typeof r=="object"&&r.type==="Dataverse_discoveryMechanism")return r;{let o=Gn();return t[e]=o,o}}else return Gn()}var{startIgnoringDependencies:ut,stopIgnoringDependencies:ft,reportResolutionEnd:Hn,reportResolutionStart:Jn,pushCollector:Yn,popCollector:Xn}=ru();var Zn=()=>{},Qn=class{constructor(t,r){this._fn=t;this._prismInstance=r;this._didMarkDependentsAsStale=!1;this._isFresh=!1;this._cacheOfDendencyValues=new Map;this._dependents=new Set;this._dependencies=new Set;this._possiblyStaleDeps=new Set;this._scope=new ir(this);this._lastValue=void 0;this._forciblySetToStale=!1;this._reactToDependencyGoingStale=t=>{this._possiblyStaleDeps.add(t),this._markAsStale()};for(let o of this._dependencies)o._addDependent(this._reactToDependencyGoingStale);ut(),this.getValue(),ft()}get hasDependents(){return this._dependents.size>0}removeDependent(t){this._dependents.delete(t)}addDependent(t){this._dependents.add(t)}destroy(){for(let t of this._dependencies)t._removeDependent(this._reactToDependencyGoingStale);ti(this._scope)}getValue(){if(!this._isFresh){let t=this._recalculate();this._lastValue=t,this._isFresh=!0,this._didMarkDependentsAsStale=!1,this._forciblySetToStale=!1}return this._lastValue}_recalculate(){let t;if(!this._forciblySetToStale&&this._possiblyStaleDeps.size>0){let n=!1;ut();for(let i of this._possiblyStaleDeps)if(this._cacheOfDendencyValues.get(i)!==i.getValue()){n=!0;break}if(ft(),this._possiblyStaleDeps.clear(),!n)return this._lastValue}let r=new Set;this._cacheOfDendencyValues.clear();let o=n=>{r.add(n),this._addDependency(n)};Yn(o),H.push(this._scope);try{t=this._fn()}catch(n){console.error(n)}finally{H.pop()!==this._scope&&console.warn("The Prism hook stack has slipped. This is a bug.")}Xn(o);for(let n of this._dependencies)r.has(n)||this._removeDependency(n);this._dependencies=r,ut();for(let n of r)this._cacheOfDendencyValues.set(n,n.getValue());return ft(),t}forceStale(){this._forciblySetToStale=!0,this._markAsStale()}_markAsStale(){if(!this._didMarkDependentsAsStale){this._didMarkDependentsAsStale=!0,this._isFresh=!1;for(let t of this._dependents)t(this._prismInstance)}}_addDependency(t){this._dependencies.has(t)||(this._dependencies.add(t),t._addDependent(this._reactToDependencyGoingStale))}_removeDependency(t){!this._dependencies.has(t)||(this._dependencies.delete(t),t._removeDependent(this._reactToDependencyGoingStale))}},ou={},ei=class{constructor(t){this._fn=t;this.isPrism=!0;this._state={hot:!1,handle:void 0}}get isHot(){return this._state.hot}onChange(t,r,o=!1){let n=()=>{t.onThisOrNextTick(a)},i=ou,a=()=>{let l=this.getValue();l!==i&&(i=l,r(l))};return this._addDependent(n),o&&(i=this.getValue(),r(i)),()=>{this._removeDependent(n),t.offThisOrNextTick(a),t.offNextTick(a)}}onStale(t){let r=()=>{this._removeDependent(o)},o=()=>t();return this._addDependent(o),r}keepHot(){return this.onStale(()=>{})}_addDependent(t){this._state.hot||this._goHot(),this._state.handle.addDependent(t)}_goHot(){let t=new Qn(this._fn,this);this._state={hot:!0,handle:t}}_removeDependent(t){let r=this._state;if(!r.hot)return;let o=r.handle;o.removeDependent(t),o.hasDependents||(this._state={hot:!1,handle:void 0},o.destroy())}getValue(){Jn(this);let t=this._state,r;return t.hot?r=t.handle.getValue():r=cu(this._fn),Hn(this),r}},ir=class{constructor(t){this._hotHandle=t;this._refs=new Map;this.isPrismScope=!0;this.subs={};this.effects=new Map;this.memos=new Map}ref(t,r){let o=this._refs.get(t);if(o!==void 0)return o;{let n={current:r};return this._refs.set(t,n),n}}effect(t,r,o){let n=this.effects.get(t);n===void 0&&(n={cleanup:Zn,deps:void 0},this.effects.set(t,n)),ri(n.deps,o)&&(n.cleanup(),ut(),n.cleanup=ar(r,Zn).value,ft(),n.deps=o)}memo(t,r,o){let n=this.memos.get(t);return n===void 0&&(n={cachedValue:null,deps:void 0},this.memos.set(t,n)),ri(n.deps,o)&&(ut(),n.cachedValue=ar(r,void 0).value,ft(),n.deps=o),n.cachedValue}state(t,r){let{value:o,setValue:n}=this.memo("state/"+t,()=>{let i={current:r};return{value:i,setValue:s=>{i.current=s,this._hotHandle.forceStale()}}},[]);return[o.current,n]}sub(t){return this.subs[t]||(this.subs[t]=new ir(this._hotHandle)),this.subs[t]}cleanupEffects(){for(let t of this.effects.values())ar(t.cleanup,void 0);this.effects.clear()}source(t,r){let o="$$source/blah";return this.effect(o,()=>t(()=>{this._hotHandle.forceStale()}),[t]),r()}};function ti(e){for(let t of Object.values(e.subs))ti(t);e.cleanupEffects()}function ar(e,t){try{return{value:e(),ok:!0}}catch(r){return setTimeout(function(){throw r}),{value:t,ok:!1}}}var H=new lt;function nu(e,t){let r=H.peek();if(!r)throw new Error("prism.ref() is called outside of a prism() call.");return r.ref(e,t)}function iu(e,t,r){let o=H.peek();if(!o)throw new Error("prism.effect() is called outside of a prism() call.");return o.effect(e,t,r)}function ri(e,t){if(e===void 0||t===void 0)return!0;let r=e.length;if(r!==t.length)return!0;for(let o=0;o<r;o++)if(e[o]!==t[o])return!0;return!1}function oi(e,t,r){let o=H.peek();if(!o)throw new Error("prism.memo() is called outside of a prism() call.");return o.memo(e,t,r)}function au(e,t){let r=H.peek();if(!r)throw new Error("prism.state() is called outside of a prism() call.");return r.state(e,t)}function su(){if(!H.peek())throw new Error("The parent function is called outside of a prism() call.")}function pu(e,t){let r=H.peek();if(!r)throw new Error("prism.scope() is called outside of a prism() call.");let o=r.sub(e);H.push(o);let n=ar(t,void 0).value;return H.pop(),n}function lu(e,t,r){return oi(e,()=>se(t),r).getValue()}function uu(){return!!H.peek()}function fu(e,t){let r=H.peek();if(!r)throw new Error("prism.source() is called outside of a prism() call.");return r.source(e,t)}var se=e=>new ei(e),sr=class{effect(t,r,o){console.warn("prism.effect() does not run in cold prisms")}memo(t,r,o){return r()}state(t,r){return[r,()=>{}]}ref(t,r){return{current:r}}sub(t){return new sr}source(t,r){return r()}};function cu(e){let t=new sr;H.push(t);let r;try{r=e()}catch(o){console.error(o)}finally{H.pop()!==t&&console.warn("The Prism hook stack has slipped. This is a bug.")}return r}se.ref=nu;se.effect=iu;se.memo=oi;se.ensurePrism=su;se.state=au;se.scope=pu;se.sub=lu;se.inPrism=uu;se.source=fu;var g=se;var Ce;(function(o){o[o.Dict=0]="Dict",o[o.Array=1]="Array",o[o.Other=2]="Other"})(Ce||(Ce={}));var yo=e=>Array.isArray(e)?1:Nt(e)?0:2,ni=(e,t,r=yo(e))=>r===0&&typeof t=="string"||r===1&&du(t)?e[t]:void 0,du=e=>{let t=typeof e=="number"?e:parseInt(e,10);return!isNaN(t)&&t>=0&&t<1/0&&(t|0)===t},pr=class{constructor(t,r){this._parent=t;this._path=r;this.children=new Map;this.identityChangeListeners=new Set}addIdentityChangeListener(t){this.identityChangeListeners.add(t)}removeIdentityChangeListener(t){this.identityChangeListeners.delete(t),this._checkForGC()}removeChild(t){this.children.delete(t),this._checkForGC()}getChild(t){return this.children.get(t)}getOrCreateChild(t){let r=this.children.get(t);return r||(r=r=new pr(this,this._path.concat([t])),this.children.set(t,r)),r}_checkForGC(){this.identityChangeListeners.size>0||this.children.size>0||this._parent&&this._parent.removeChild(or(this._path))}},I=class{constructor(t){this.$$isPointerToPrismProvider=!0;this.pointer=ye({root:this,path:[]});this.prism=this.pointerToPrism(this.pointer);this._onPointerValueChange=(t,r)=>{let{path:o}=G(t),n=this._getOrCreateScopeForPath(o);return n.identityChangeListeners.add(r),()=>{n.identityChangeListeners.delete(r)}};this._currentState=t,this._rootScope=new pr(void 0,[])}set(t){let r=this._currentState;this._currentState=t,this._checkUpdates(this._rootScope,r,t)}get(){return this._currentState}getByPointer(t){let r=ae(t)?t:t(this.pointer),o=G(r).path;return this._getIn(o)}_getIn(t){return t.length===0?this.get():at(this.get(),t)}reduce(t){this.set(t(this.get()))}reduceByPointer(t,r){let o=ae(t)?t:t(this.pointer),n=G(o).path,i=go(this.get(),n,r);this.set(i)}setByPointer(t,r){this.reduceByPointer(t,()=>r)}_checkUpdates(t,r,o){if(r===o)return;for(let a of t.identityChangeListeners)a(o);if(t.children.size===0)return;let n=yo(r),i=yo(o);if(!(n===2&&n===i))for(let[a,s]of t.children){let l=ni(r,a,n),p=ni(o,a,i);this._checkUpdates(s,l,p)}}_getOrCreateScopeForPath(t){let r=this._rootScope;for(let o of t)r=r.getOrCreateChild(o);return r}pointerToPrism(t){let{path:r}=G(t),o=i=>this._onPointerValueChange(t,i),n=()=>this._getIn(r);return g(()=>g.source(o,n))}};var ii=new WeakMap;function mu(e){return typeof e=="object"&&e!==null&&e.$$isPointerToPrismProvider===!0}var ke=e=>{let t=pt(e),r=ii.get(t);if(!r){let o=t.root;if(!mu(o))throw new Error("Cannot run pointerToPrism() on a pointer whose root is not an PointerToPrismProvider");r=o.pointerToPrism(e),ii.set(t,r)}return r};var b=e=>ae(e)?ke(e).getValue():we(e)?e.getValue():e;var hu=60*3,ct=class{constructor(t){this._conf=t;this._ticking=!1;this._dormant=!0;this._numberOfDormantTicks=0;this.__ticks=0;this._scheduledForThisOrNextTick=new Set,this._scheduledForNextTick=new Set,this._timeAtCurrentTick=0}get dormant(){return this._dormant}onThisOrNextTick(t){this._scheduledForThisOrNextTick.add(t),this._dormant&&this._goActive()}onNextTick(t){this._scheduledForNextTick.add(t),this._dormant&&this._goActive()}offThisOrNextTick(t){this._scheduledForThisOrNextTick.delete(t)}offNextTick(t){this._scheduledForNextTick.delete(t)}get time(){return this._ticking?this._timeAtCurrentTick:performance.now()}_goActive(){var t,r;!this._dormant||(this._dormant=!1,(r=(t=this._conf)==null?void 0:t.onActive)==null||r.call(t))}_goDormant(){var t,r;this._dormant||(this._dormant=!0,this._numberOfDormantTicks=0,(r=(t=this._conf)==null?void 0:t.onDormant)==null||r.call(t))}tick(t=performance.now()){if(this.__ticks++,!this._dormant&&this._scheduledForNextTick.size===0&&this._scheduledForThisOrNextTick.size===0&&(this._numberOfDormantTicks++,this._numberOfDormantTicks>=hu)){this._goDormant();return}this._ticking=!0,this._timeAtCurrentTick=t;for(let r of this._scheduledForNextTick)this._scheduledForThisOrNextTick.add(r);this._scheduledForNextTick.clear(),this._tick(0),this._ticking=!1}_tick(t){let r=this.time;if(t>10&&console.warn("_tick() recursing for 10 times"),t>100)throw new Error("Maximum recursion limit for _tick()");let o=this._scheduledForThisOrNextTick;this._scheduledForThisOrNextTick=new Set;for(let n of o)n(r);if(this._scheduledForThisOrNextTick.size>0)return this._tick(t+1)}};var Ue=class{constructor(t){this.$$isPointerToPrismProvider=!0;this._currentPointerBox=new I(t),this.pointer=ye({root:this,path:[]})}setPointer(t){this._currentPointerBox.set(t)}pointerToPrism(t){let{path:r}=pt(t);return g(()=>{let o=this._currentPointerBox.prism.getValue(),n=r.reduce((i,a)=>i[a],o);return b(n)})}};var ai=class{constructor(){d(this,"atom",new I({projects:{}}))}add(t,r){this.atom.setByPointer(o=>o.projects[t],r)}get(t){return this.atom.get().projects[t]}has(t){return!!this.get(t)}},gu=new ai,dt=gu;var si=new WeakMap;function v(e){return si.get(e)}function ue(e,t){si.set(e,t)}var lr=[];function ur(e,t){return t.length===0?e:at(e,t)}var De=class{constructor(){d(this,"_values",{})}get(t,r){if(this.has(t))return this._values[t];{let o=r();return this._values[t]=o,o}}has(t){return this._values.hasOwnProperty(t)}};var yu=function(){try{var e=W(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),bo=yu;function bu(e,t,r){t=="__proto__"&&bo?bo(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var mt=bu;var Pu=Object.prototype,ju=Pu.hasOwnProperty;function _u(e,t,r){var o=e[t];(!(ju.call(e,t)&&rt(o,r))||r===void 0&&!(t in e))&&mt(e,t,r)}var ht=_u;var Tu=9007199254740991,vu=/^(?:0|[1-9]\d*)$/;function xu(e,t){var r=typeof e;return t=t==null?Tu:t,!!t&&(r=="number"||r!="symbol"&&vu.test(e))&&e>-1&&e%1==0&&e<t}var gt=xu;function Su(e,t,r,o){if(!M(e))return e;t=Oe(t,e);for(var n=-1,i=t.length,a=i-1,s=e;s!=null&&++n<i;){var l=oe(t[n]),p=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(n!=a){var u=s[l];p=o?o(u,l,s):void 0,p===void 0&&(p=M(u)?u:gt(t[n+1])?[]:{})}ht(s,l,p),s=s[l]}return e}var pi=Su;function Iu(e,t,r){return e==null?e:pi(e,t,r)}var li=Iu;var Po=new WeakMap;function jo(e){return _o(e)}function _o(e){if(Po.has(e))return Po.get(e);let t=e.type==="compound"?Ou(e):e.type==="enum"?Au(e):e.default;return Po.set(e,t),t}function Au(e){let t={$case:e.defaultCase};for(let[r,o]of Object.entries(e.cases))t[r]=_o(o);return t}function Ou(e){let t={};for(let[r,o]of Object.entries(e.props))t[r]=_o(o);return t}var ci=Yt(fi());function To(e,t,r){return g(()=>{let o=b(t);return g.memo("driver",()=>o?o.type==="BasicKeyframedTrack"?Cu(e,o,r):(e.logger.error("Track type not yet supported."),g(()=>{})):g(()=>{}),[o]).getValue()})}function Cu(e,t,r){return g(()=>{let o=g.ref("state",{started:!1}),n=o.current,i=r.getValue();return(!n.started||i<n.validFrom||n.validTo<=i)&&(o.current=n=ku(e,r,t)),n.der.getValue()})}var di=g(()=>{});function ku(e,t,r){let o=t.getValue();if(r.keyframes.length===0)return{started:!0,validFrom:-1/0,validTo:1/0,der:di};let n=0;for(;;){let i=r.keyframes[n];if(!i)return ze.error;let a=n===r.keyframes.length-1;if(o<i.position)return n===0?ze.beforeFirstKeyframe(i):ze.error;if(i.position===o)return a?ze.lastKeyframe(i):ze.between(i,r.keyframes[n+1],t);if(n===r.keyframes.length-1)return ze.lastKeyframe(i);{let s=n+1;if(r.keyframes[s].position<=o){n=s;continue}else return ze.between(i,r.keyframes[n+1],t)}}}var ze={beforeFirstKeyframe(e){return{started:!0,validFrom:-1/0,validTo:e.position,der:g(()=>({left:e.value,progression:0}))}},lastKeyframe(e){return{started:!0,validFrom:e.position,validTo:1/0,der:g(()=>({left:e.value,progression:0}))}},between(e,t,r){if(!e.connectedRight)return{started:!0,validFrom:e.position,validTo:t.position,der:g(()=>({left:e.value,progression:0}))};let o=i=>(i-e.position)/(t.position-e.position);if(!e.type||e.type==="bezier"){let i=new ci.default(e.handles[2],e.handles[3],t.handles[0],t.handles[1]),a=g(()=>{let s=o(r.getValue()),l=i.solveSimple(s);return{left:e.value,right:t.value,progression:l}});return{started:!0,validFrom:e.position,validTo:t.position,der:a}}let n=g(()=>{let i=o(r.getValue()),a=Math.floor(i);return{left:e.value,right:t.value,progression:a}});return{started:!0,validFrom:e.position,validTo:t.position,der:n}},error:{started:!0,validFrom:-1/0,validTo:1/0,der:di}};function yt(e,t,r){let n=r.get(e);if(n&&n.override===t)return n.merged;let i=_({},e);for(let a of Object.keys(t)){let s=t[a],l=e[a];i[a]=typeof s=="object"&&typeof l=="object"?yt(l,s,r):s===void 0?l:s}return r.set(e,{override:t,merged:i}),i}function qe(e,t){let r=e;for(let o of t)r=r[o];return r}var mi=(e,t)=>{let r=g.memo(e,()=>new I(t),[]);return r.set(t),r};var Du=/\s/;function Eu(e){for(var t=e.length;t--&&Du.test(e.charAt(t)););return t}var hi=Eu;var Ru=/^\s+/;function Vu(e){return e&&e.slice(0,hi(e)+1).replace(Ru,"")}var gi=Vu;var yi=0/0,Nu=/^[-+]0x[0-9a-f]+$/i,Lu=/^0b[01]+$/i,Mu=/^0o[0-7]+$/i,$u=parseInt;function Bu(e){if(typeof e=="number")return e;if(ve(e))return yi;if(M(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=M(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=gi(e);var r=Lu.test(e);return r||Mu.test(e)?$u(e.slice(2),r?2:8):Nu.test(e)?yi:+e}var be=Bu;var bi=1/0,Fu=17976931348623157e292;function Uu(e){if(!e)return e===0?e:0;if(e=be(e),e===bi||e===-bi){var t=e<0?-1:1;return t*Fu}return e===e?e:0}var Pi=Uu;function zu(e){var t=Pi(e),r=t%1;return t===t?r?t-r:t:0}var fr=zu;function qu(e){return e}var ji=qu;var Ku=W(N,"WeakMap"),cr=Ku;var _i=Object.create,Wu=function(){function e(){}return function(t){if(!M(t))return{};if(_i)return _i(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Ti=Wu;function Gu(e,t){var r=-1,o=e.length;for(t||(t=Array(o));++r<o;)t[r]=e[r];return t}var vi=Gu;function Hu(e,t){for(var r=-1,o=e==null?0:e.length;++r<o&&t(e[r],r,e)!==!1;);return e}var xi=Hu;function Ju(e,t,r,o){var n=!r;r||(r={});for(var i=-1,a=t.length;++i<a;){var s=t[i],l=o?o(r[s],e[s],s,r,e):void 0;l===void 0&&(l=e[s]),n?mt(r,s,l):ht(r,s,l)}return r}var Ee=Ju;var Yu=9007199254740991;function Xu(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Yu}var bt=Xu;function Zu(e){return e!=null&&bt(e.length)&&!Zt(e)}var dr=Zu;var Qu=Object.prototype;function ef(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Qu;return e===r}var Pt=ef;function tf(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}var Si=tf;var rf="[object Arguments]";function of(e){return B(e)&&Q(e)==rf}var vo=of;var Ii=Object.prototype,nf=Ii.hasOwnProperty,af=Ii.propertyIsEnumerable,sf=vo(function(){return arguments}())?vo:function(e){return B(e)&&nf.call(e,"callee")&&!af.call(e,"callee")},mr=sf;function pf(){return!1}var Ai=pf;var Oi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,wi=Oi&&typeof module=="object"&&module&&!module.nodeType&&module,lf=wi&&wi.exports===Oi,Ci=lf?N.Buffer:void 0,uf=Ci?Ci.isBuffer:void 0,ff=uf||Ai,Ke=ff;var cf="[object Arguments]",df="[object Array]",mf="[object Boolean]",hf="[object Date]",gf="[object Error]",yf="[object Function]",bf="[object Map]",Pf="[object Number]",jf="[object Object]",_f="[object RegExp]",Tf="[object Set]",vf="[object String]",xf="[object WeakMap]",Sf="[object ArrayBuffer]",If="[object DataView]",Af="[object Float32Array]",Of="[object Float64Array]",wf="[object Int8Array]",Cf="[object Int16Array]",kf="[object Int32Array]",Df="[object Uint8Array]",Ef="[object Uint8ClampedArray]",Rf="[object Uint16Array]",Vf="[object Uint32Array]",E={};E[Af]=E[Of]=E[wf]=E[Cf]=E[kf]=E[Df]=E[Ef]=E[Rf]=E[Vf]=!0;E[cf]=E[df]=E[Sf]=E[mf]=E[If]=E[hf]=E[gf]=E[yf]=E[bf]=E[Pf]=E[jf]=E[_f]=E[Tf]=E[vf]=E[xf]=!1;function Nf(e){return B(e)&&bt(e.length)&&!!E[Q(e)]}var ki=Nf;function Lf(e){return function(t){return e(t)}}var jt=Lf;var Di=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Lt=Di&&typeof module=="object"&&module&&!module.nodeType&&module,Mf=Lt&&Lt.exports===Di,xo=Mf&&Xt.process,$f=function(){try{var e=Lt&&Lt.require&&Lt.require("util").types;return e||xo&&xo.binding&&xo.binding("util")}catch(t){}}(),Pe=$f;var Ei=Pe&&Pe.isTypedArray,Bf=Ei?jt(Ei):ki,hr=Bf;var Ff=Object.prototype,Uf=Ff.hasOwnProperty;function zf(e,t){var r=$(e),o=!r&&mr(e),n=!r&&!o&&Ke(e),i=!r&&!o&&!n&&hr(e),a=r||o||n||i,s=a?Si(e.length,String):[],l=s.length;for(var p in e)(t||Uf.call(e,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||i&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||gt(p,l)))&&s.push(p);return s}var gr=zf;var qf=rr(Object.keys,Object),Ri=qf;var Kf=Object.prototype,Wf=Kf.hasOwnProperty;function Gf(e){if(!Pt(e))return Ri(e);var t=[];for(var r in Object(e))Wf.call(e,r)&&r!="constructor"&&t.push(r);return t}var Vi=Gf;function Hf(e){return dr(e)?gr(e):Vi(e)}var fe=Hf;function Jf(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var Ni=Jf;var Yf=Object.prototype,Xf=Yf.hasOwnProperty;function Zf(e){if(!M(e))return Ni(e);var t=Pt(e),r=[];for(var o in e)o=="constructor"&&(t||!Xf.call(e,o))||r.push(o);return r}var Li=Zf;function Qf(e){return dr(e)?gr(e,!0):Li(e)}var _t=Qf;function ec(e,t){for(var r=-1,o=t.length,n=e.length;++r<o;)e[n+r]=t[r];return e}var yr=ec;function tc(e,t,r){var o=-1,n=e.length;t<0&&(t=-t>n?0:n+t),r=r>n?n:r,r<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(n);++o<n;)i[o]=e[o+t];return i}var br=tc;function rc(e,t,r){var o=e.length;return r=r===void 0?o:r,!t&&r>=o?e:br(e,t,r)}var Mi=rc;var oc="\\ud800-\\udfff",nc="\\u0300-\\u036f",ic="\\ufe20-\\ufe2f",ac="\\u20d0-\\u20ff",sc=nc+ic+ac,pc="\\ufe0e\\ufe0f",lc="\\u200d",uc=RegExp("["+lc+oc+sc+pc+"]");function fc(e){return uc.test(e)}var Tt=fc;function cc(e){return e.split("")}var $i=cc;var Bi="\\ud800-\\udfff",dc="\\u0300-\\u036f",mc="\\ufe20-\\ufe2f",hc="\\u20d0-\\u20ff",gc=dc+mc+hc,yc="\\ufe0e\\ufe0f",bc="["+Bi+"]",So="["+gc+"]",Io="\\ud83c[\\udffb-\\udfff]",Pc="(?:"+So+"|"+Io+")",Fi="[^"+Bi+"]",Ui="(?:\\ud83c[\\udde6-\\uddff]){2}",zi="[\\ud800-\\udbff][\\udc00-\\udfff]",jc="\\u200d",qi=Pc+"?",Ki="["+yc+"]?",_c="(?:"+jc+"(?:"+[Fi,Ui,zi].join("|")+")"+Ki+qi+")*",Tc=Ki+qi+_c,vc="(?:"+[Fi+So+"?",So,Ui,zi,bc].join("|")+")",xc=RegExp(Io+"(?="+Io+")|"+vc+Tc,"g");function Sc(e){return e.match(xc)||[]}var Wi=Sc;function Ic(e){return Tt(e)?Wi(e):$i(e)}var Gi=Ic;function Ac(e,t,r){return e===e&&(r!==void 0&&(e=e<=r?e:r),t!==void 0&&(e=e>=t?e:t)),e}var Hi=Ac;function Oc(e,t,r){return r===void 0&&(r=t,t=void 0),r!==void 0&&(r=be(r),r=r===r?r:0),t!==void 0&&(t=be(t),t=t===t?t:0),Hi(be(e),t,r)}var Mt=Oc;function wc(){this.__data__=new Se,this.size=0}var Ji=wc;function Cc(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var Yi=Cc;function kc(e){return this.__data__.get(e)}var Xi=kc;function Dc(e){return this.__data__.has(e)}var Zi=Dc;var Ec=200;function Rc(e,t){var r=this.__data__;if(r instanceof Se){var o=r.__data__;if(!Ie||o.length<Ec-1)return o.push([e,t]),this.size=++r.size,this;r=this.__data__=new Fe(o)}return r.set(e,t),this.size=r.size,this}var Qi=Rc;function vt(e){var t=this.__data__=new Se(e);this.size=t.size}vt.prototype.clear=Ji;vt.prototype.delete=Yi;vt.prototype.get=Xi;vt.prototype.has=Zi;vt.prototype.set=Qi;var Re=vt;function Vc(e,t){return e&&Ee(t,fe(t),e)}var ea=Vc;function Nc(e,t){return e&&Ee(t,_t(t),e)}var ta=Nc;var ra=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oa=ra&&typeof module=="object"&&module&&!module.nodeType&&module,Lc=oa&&oa.exports===ra,na=Lc?N.Buffer:void 0,ia=na?na.allocUnsafe:void 0;function Mc(e,t){if(t)return e.slice();var r=e.length,o=ia?ia(r):new e.constructor(r);return e.copy(o),o}var aa=Mc;function $c(e,t){for(var r=-1,o=e==null?0:e.length,n=0,i=[];++r<o;){var a=e[r];t(a,r,e)&&(i[n++]=a)}return i}var sa=$c;function Bc(){return[]}var Pr=Bc;var Fc=Object.prototype,Uc=Fc.propertyIsEnumerable,pa=Object.getOwnPropertySymbols,zc=pa?function(e){return e==null?[]:(e=Object(e),sa(pa(e),function(t){return Uc.call(e,t)}))}:Pr,xt=zc;function qc(e,t){return Ee(e,xt(e),t)}var la=qc;var Kc=Object.getOwnPropertySymbols,Wc=Kc?function(e){for(var t=[];e;)yr(t,xt(e)),e=st(e);return t}:Pr,jr=Wc;function Gc(e,t){return Ee(e,jr(e),t)}var ua=Gc;function Hc(e,t,r){var o=t(e);return $(e)?o:yr(o,r(e))}var _r=Hc;function Jc(e){return _r(e,fe,xt)}var $t=Jc;function Yc(e){return _r(e,_t,jr)}var fa=Yc;var Xc=W(N,"DataView"),Tr=Xc;var Zc=W(N,"Promise"),vr=Zc;var Qc=W(N,"Set"),xr=Qc;var ca="[object Map]",ed="[object Object]",da="[object Promise]",ma="[object Set]",ha="[object WeakMap]",ga="[object DataView]",td=he(Tr),rd=he(Ie),od=he(vr),nd=he(xr),id=he(cr),We=Q;(Tr&&We(new Tr(new ArrayBuffer(1)))!=ga||Ie&&We(new Ie)!=ca||vr&&We(vr.resolve())!=da||xr&&We(new xr)!=ma||cr&&We(new cr)!=ha)&&(We=function(e){var t=Q(e),r=t==ed?e.constructor:void 0,o=r?he(r):"";if(o)switch(o){case td:return ga;case rd:return ca;case od:return da;case nd:return ma;case id:return ha}return t});var je=We;var ad=Object.prototype,sd=ad.hasOwnProperty;function pd(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&sd.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var ya=pd;var ld=N.Uint8Array,St=ld;function ud(e){var t=new e.constructor(e.byteLength);return new St(t).set(new St(e)),t}var It=ud;function fd(e,t){var r=t?It(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var ba=fd;var cd=/\w*$/;function dd(e){var t=new e.constructor(e.source,cd.exec(e));return t.lastIndex=e.lastIndex,t}var Pa=dd;var ja=K?K.prototype:void 0,_a=ja?ja.valueOf:void 0;function md(e){return _a?Object(_a.call(e)):{}}var Ta=md;function hd(e,t){var r=t?It(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var va=hd;var gd="[object Boolean]",yd="[object Date]",bd="[object Map]",Pd="[object Number]",jd="[object RegExp]",_d="[object Set]",Td="[object String]",vd="[object Symbol]",xd="[object ArrayBuffer]",Sd="[object DataView]",Id="[object Float32Array]",Ad="[object Float64Array]",Od="[object Int8Array]",wd="[object Int16Array]",Cd="[object Int32Array]",kd="[object Uint8Array]",Dd="[object Uint8ClampedArray]",Ed="[object Uint16Array]",Rd="[object Uint32Array]";function Vd(e,t,r){var o=e.constructor;switch(t){case xd:return It(e);case gd:case yd:return new o(+e);case Sd:return ba(e,r);case Id:case Ad:case Od:case wd:case Cd:case kd:case Dd:case Ed:case Rd:return va(e,r);case bd:return new o;case Pd:case Td:return new o(e);case jd:return Pa(e);case _d:return new o;case vd:return Ta(e)}}var xa=Vd;function Nd(e){return typeof e.constructor=="function"&&!Pt(e)?Ti(st(e)):{}}var Sa=Nd;var Ld="[object Map]";function Md(e){return B(e)&&je(e)==Ld}var Ia=Md;var Aa=Pe&&Pe.isMap,$d=Aa?jt(Aa):Ia,Oa=$d;var Bd="[object Set]";function Fd(e){return B(e)&&je(e)==Bd}var wa=Fd;var Ca=Pe&&Pe.isSet,Ud=Ca?jt(Ca):wa,ka=Ud;var zd=1,qd=2,Kd=4,Da="[object Arguments]",Wd="[object Array]",Gd="[object Boolean]",Hd="[object Date]",Jd="[object Error]",Ea="[object Function]",Yd="[object GeneratorFunction]",Xd="[object Map]",Zd="[object Number]",Ra="[object Object]",Qd="[object RegExp]",em="[object Set]",tm="[object String]",rm="[object Symbol]",om="[object WeakMap]",nm="[object ArrayBuffer]",im="[object DataView]",am="[object Float32Array]",sm="[object Float64Array]",pm="[object Int8Array]",lm="[object Int16Array]",um="[object Int32Array]",fm="[object Uint8Array]",cm="[object Uint8ClampedArray]",dm="[object Uint16Array]",mm="[object Uint32Array]",C={};C[Da]=C[Wd]=C[nm]=C[im]=C[Gd]=C[Hd]=C[am]=C[sm]=C[pm]=C[lm]=C[um]=C[Xd]=C[Zd]=C[Ra]=C[Qd]=C[em]=C[tm]=C[rm]=C[fm]=C[cm]=C[dm]=C[mm]=!0;C[Jd]=C[Ea]=C[om]=!1;function Sr(e,t,r,o,n,i){var a,s=t&zd,l=t&qd,p=t&Kd;if(r&&(a=n?r(e,o,n,i):r(e)),a!==void 0)return a;if(!M(e))return e;var u=$(e);if(u){if(a=ya(e),!s)return vi(e,a)}else{var c=je(e),m=c==Ea||c==Yd;if(Ke(e))return aa(e,s);if(c==Ra||c==Da||m&&!n){if(a=l||m?{}:Sa(e),!s)return l?ua(e,ta(a,e)):la(e,ea(a,e))}else{if(!C[c])return n?e:{};a=xa(e,c,s)}}i||(i=new Re);var f=i.get(e);if(f)return f;i.set(e,a),ka(e)?e.forEach(function(P){a.add(Sr(P,t,r,P,e,i))}):Oa(e)&&e.forEach(function(P,j){a.set(j,Sr(P,t,r,j,e,i))});var y=p?l?fa:$t:l?_t:fe,T=u?void 0:y(e);return xi(T||e,function(P,j){T&&(j=P,P=e[j]),ht(a,j,Sr(P,t,r,j,e,i))}),a}var Va=Sr;var hm=1,gm=4;function ym(e){return Va(e,hm|gm)}var Ao=ym;var bm="__lodash_hash_undefined__";function Pm(e){return this.__data__.set(e,bm),this}var Na=Pm;function jm(e){return this.__data__.has(e)}var La=jm;function Ir(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Fe;++t<r;)this.add(e[t])}Ir.prototype.add=Ir.prototype.push=Na;Ir.prototype.has=La;var Ma=Ir;function _m(e,t){for(var r=-1,o=e==null?0:e.length;++r<o;)if(t(e[r],r,e))return!0;return!1}var $a=_m;function Tm(e,t){return e.has(t)}var Ba=Tm;var vm=1,xm=2;function Sm(e,t,r,o,n,i){var a=r&vm,s=e.length,l=t.length;if(s!=l&&!(a&&l>s))return!1;var p=i.get(e),u=i.get(t);if(p&&u)return p==t&&u==e;var c=-1,m=!0,f=r&xm?new Ma:void 0;for(i.set(e,t),i.set(t,e);++c<s;){var y=e[c],T=t[c];if(o)var P=a?o(T,y,c,t,e,i):o(y,T,c,e,t,i);if(P!==void 0){if(P)continue;m=!1;break}if(f){if(!$a(t,function(j,x){if(!Ba(f,x)&&(y===j||n(y,j,r,o,i)))return f.push(x)})){m=!1;break}}else if(!(y===T||n(y,T,r,o,i))){m=!1;break}}return i.delete(e),i.delete(t),m}var Ar=Sm;function Im(e){var t=-1,r=Array(e.size);return e.forEach(function(o,n){r[++t]=[n,o]}),r}var Fa=Im;function Am(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var Ua=Am;var Om=1,wm=2,Cm="[object Boolean]",km="[object Date]",Dm="[object Error]",Em="[object Map]",Rm="[object Number]",Vm="[object RegExp]",Nm="[object Set]",Lm="[object String]",Mm="[object Symbol]",$m="[object ArrayBuffer]",Bm="[object DataView]",za=K?K.prototype:void 0,Oo=za?za.valueOf:void 0;function Fm(e,t,r,o,n,i,a){switch(r){case Bm:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $m:return!(e.byteLength!=t.byteLength||!i(new St(e),new St(t)));case Cm:case km:case Rm:return rt(+e,+t);case Dm:return e.name==t.name&&e.message==t.message;case Vm:case Lm:return e==t+"";case Em:var s=Fa;case Nm:var l=o&Om;if(s||(s=Ua),e.size!=t.size&&!l)return!1;var p=a.get(e);if(p)return p==t;o|=wm,a.set(e,t);var u=Ar(s(e),s(t),o,n,i,a);return a.delete(e),u;case Mm:if(Oo)return Oo.call(e)==Oo.call(t)}return!1}var qa=Fm;var Um=1,zm=Object.prototype,qm=zm.hasOwnProperty;function Km(e,t,r,o,n,i){var a=r&Um,s=$t(e),l=s.length,p=$t(t),u=p.length;if(l!=u&&!a)return!1;for(var c=l;c--;){var m=s[c];if(!(a?m in t:qm.call(t,m)))return!1}var f=i.get(e),y=i.get(t);if(f&&y)return f==t&&y==e;var T=!0;i.set(e,t),i.set(t,e);for(var P=a;++c<l;){m=s[c];var j=e[m],x=t[m];if(o)var O=a?o(x,j,m,t,e,i):o(j,x,m,e,t,i);if(!(O===void 0?j===x||n(j,x,r,o,i):O)){T=!1;break}P||(P=m=="constructor")}if(T&&!P){var U=e.constructor,z=t.constructor;U!=z&&"constructor"in e&&"constructor"in t&&!(typeof U=="function"&&U instanceof U&&typeof z=="function"&&z instanceof z)&&(T=!1)}return i.delete(e),i.delete(t),T}var Ka=Km;var Wm=1,Wa="[object Arguments]",Ga="[object Array]",Or="[object Object]",Gm=Object.prototype,Ha=Gm.hasOwnProperty;function Hm(e,t,r,o,n,i){var a=$(e),s=$(t),l=a?Ga:je(e),p=s?Ga:je(t);l=l==Wa?Or:l,p=p==Wa?Or:p;var u=l==Or,c=p==Or,m=l==p;if(m&&Ke(e)){if(!Ke(t))return!1;a=!0,u=!1}if(m&&!u)return i||(i=new Re),a||hr(e)?Ar(e,t,r,o,n,i):qa(e,t,l,r,o,n,i);if(!(r&Wm)){var f=u&&Ha.call(e,"__wrapped__"),y=c&&Ha.call(t,"__wrapped__");if(f||y){var T=f?e.value():e,P=y?t.value():t;return i||(i=new Re),n(T,P,r,o,i)}}return m?(i||(i=new Re),Ka(e,t,r,o,n,i)):!1}var Ja=Hm;function Ya(e,t,r,o,n){return e===t?!0:e==null||t==null||!B(e)&&!B(t)?e!==e&&t!==t:Ja(e,t,r,o,Ya,n)}var wr=Ya;var Jm=1,Ym=2;function Xm(e,t,r,o){var n=r.length,i=n,a=!o;if(e==null)return!i;for(e=Object(e);n--;){var s=r[n];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++n<i;){s=r[n];var l=s[0],p=e[l],u=s[1];if(a&&s[2]){if(p===void 0&&!(l in e))return!1}else{var c=new Re;if(o)var m=o(p,u,l,e,t,c);if(!(m===void 0?wr(u,p,Jm|Ym,o,c):m))return!1}}return!0}var Xa=Xm;function Zm(e){return e===e&&!M(e)}var Cr=Zm;function Qm(e){for(var t=fe(e),r=t.length;r--;){var o=t[r],n=e[o];t[r]=[o,n,Cr(n)]}return t}var Za=Qm;function eh(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var kr=eh;function th(e){var t=Za(e);return t.length==1&&t[0][2]?kr(t[0][0],t[0][1]):function(r){return r===e||Xa(r,e,t)}}var Qa=th;function rh(e,t){return e!=null&&t in Object(e)}var es=rh;function oh(e,t,r){t=Oe(t,e);for(var o=-1,n=t.length,i=!1;++o<n;){var a=oe(t[o]);if(!(i=e!=null&&r(e,a)))break;e=e[a]}return i||++o!=n?i:(n=e==null?0:e.length,!!n&&bt(n)&&gt(a,n)&&($(e)||mr(e)))}var ts=oh;function nh(e,t){return e!=null&&ts(e,t,es)}var rs=nh;var ih=1,ah=2;function sh(e,t){return et(e)&&Cr(t)?kr(oe(e),t):function(r){var o=at(r,e);return o===void 0&&o===t?rs(r,e):wr(t,o,ih|ah)}}var os=sh;function ph(e){return function(t){return t==null?void 0:t[e]}}var Dr=ph;function lh(e){return function(t){return it(t,e)}}var ns=lh;function uh(e){return et(e)?Dr(oe(e)):ns(e)}var is=uh;function fh(e){return typeof e=="function"?e:e==null?ji:typeof e=="object"?$(e)?os(e[0],e[1]):Qa(e):is(e)}var as=fh;function ch(e){return function(t,r,o){for(var n=-1,i=Object(t),a=o(t),s=a.length;s--;){var l=a[e?s:++n];if(r(i[l],l,i)===!1)break}return t}}var ss=ch;var dh=ss(),ps=dh;function mh(e,t){return e&&ps(e,t,fe)}var ls=mh;var hh=function(){return N.Date.now()},Er=hh;var gh="Expected a function",yh=Math.max,bh=Math.min;function Ph(e,t,r){var o,n,i,a,s,l,p=0,u=!1,c=!1,m=!0;if(typeof e!="function")throw new TypeError(gh);t=be(t)||0,M(r)&&(u=!!r.leading,c="maxWait"in r,i=c?yh(be(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function f(A){var q=o,X=n;return o=n=void 0,p=A,a=e.apply(X,q),a}function y(A){return p=A,s=setTimeout(j,t),u?f(A):a}function T(A){var q=A-l,X=A-p,le=t-q;return c?bh(le,i-X):le}function P(A){var q=A-l,X=A-p;return l===void 0||q>=t||q<0||c&&X>=i}function j(){var A=Er();if(P(A))return x(A);s=setTimeout(j,T(A))}function x(A){return s=void 0,m&&o?f(A):(o=n=void 0,a)}function O(){s!==void 0&&clearTimeout(s),p=0,o=l=n=s=void 0}function U(){return s===void 0?a:x(Er())}function z(){var A=Er(),q=P(A);if(o=arguments,n=this,l=A,q){if(s===void 0)return y(l);if(c)return clearTimeout(s),s=setTimeout(j,t),f(l)}return s===void 0&&(s=setTimeout(j,t)),a}return z.cancel=O,z.flush=U,z}var wo=Ph;function jh(e,t){return t.length<2?e:it(e,br(t,0,-1))}var us=jh;function _h(e){return typeof e=="number"&&e==fr(e)}var Co=_h;function Th(e,t){var r={};return t=as(t,3),ls(e,function(o,n,i){mt(r,n,t(o,n,i))}),r}var ko=Th;function vh(e,t){return t=Oe(t,e),e=us(e,t),e==null||delete e[oe(or(t))]}var fs=vh;var xh=9007199254740991,Sh=Math.floor;function Ih(e,t){var r="";if(!e||t<1||t>xh)return r;do t%2&&(r+=e),t=Sh(t/2),t&&(e+=e);while(t);return r}var Do=Ih;var Ah=Dr("length"),cs=Ah;var ds="\\ud800-\\udfff",Oh="\\u0300-\\u036f",wh="\\ufe20-\\ufe2f",Ch="\\u20d0-\\u20ff",kh=Oh+wh+Ch,Dh="\\ufe0e\\ufe0f",Eh="["+ds+"]",Eo="["+kh+"]",Ro="\\ud83c[\\udffb-\\udfff]",Rh="(?:"+Eo+"|"+Ro+")",ms="[^"+ds+"]",hs="(?:\\ud83c[\\udde6-\\uddff]){2}",gs="[\\ud800-\\udbff][\\udc00-\\udfff]",Vh="\\u200d",ys=Rh+"?",bs="["+Dh+"]?",Nh="(?:"+Vh+"(?:"+[ms,hs,gs].join("|")+")"+bs+ys+")*",Lh=bs+ys+Nh,Mh="(?:"+[ms+Eo+"?",Eo,hs,gs,Eh].join("|")+")",Ps=RegExp(Ro+"(?="+Ro+")|"+Mh+Lh,"g");function $h(e){for(var t=Ps.lastIndex=0;Ps.test(e);)++t;return t}var js=$h;function Bh(e){return Tt(e)?js(e):cs(e)}var Rr=Bh;var Fh=Math.ceil;function Uh(e,t){t=t===void 0?" ":er(t);var r=t.length;if(r<2)return r?Do(t,e):t;var o=Do(t,Fh(e/Rr(t)));return Tt(t)?Mi(Gi(o),0,e).join(""):o.slice(0,e)}var _s=Uh;function zh(e,t,r){e=tr(e),t=fr(t);var o=t?Rr(e):0;return t&&o<t?_s(t-o,r)+e:e}var Ge=zh;function qh(e,t){return e==null?!0:fs(e,t)}var Vr=qh;var Ts=5*1e3,Nr=class{constructor(t){d(this,"_cache",new De);d(this,"_keepHotUntapDebounce");ue(this,t)}get type(){return"Theatre_SheetObject_PublicAPI"}get props(){return v(this).propsP}get sheet(){return v(this).sheet.publicApi}get project(){return v(this).sheet.project.publicApi}get address(){return _({},v(this).address)}_valuesPrism(){return this._cache.get("_valuesPrism",()=>{let t=v(this);return g(()=>b(t.getValues().getValue()))})}onValuesChange(t,r){return Lr(this._valuesPrism(),t,r)}get value(){let t=this._valuesPrism();if(Ts!=null){if(!t.isHot){this._keepHotUntapDebounce!=null&&this._keepHotUntapDebounce.flush();let r=t.keepHot();this._keepHotUntapDebounce=wo(()=>{r(),this._keepHotUntapDebounce=void 0},Ts)}this._keepHotUntapDebounce&&this._keepHotUntapDebounce()}return t.getValue()}set initialValue(t){v(this).setInitialValue(t)}};function Bt(e){let t=new WeakMap;return r=>(t.has(r)||t.set(r,e(r)),t.get(r))}function At(e){return e.type==="compound"||e.type==="enum"}function Ft(e,t){if(!e)return;let[r,...o]=t;if(r===void 0)return e;if(!At(e))return;let n=e.type==="enum"?e.cases[r]:e.props[r];return Ft(n,o)}function vs(e){return!At(e)}var Kh=Bt(e=>{if(e.type==="enum")throw new Error("Not implemented yet for enums");for(let t in e.props){let r=e.props[t];if(At(r)){if(Kh(r))return!0}else return!0}return!1});var Mr=class{constructor(t,r,o){this.sheet=t;this.template=r;this.nativeObject=o;d(this,"$$isPointerToPrismProvider",!0);d(this,"address");d(this,"publicApi");d(this,"_initialValue",new I({}));d(this,"_cache",new De);d(this,"_logger");d(this,"_internalUtilCtx");this._logger=t._logger.named("SheetObject",r.address.objectKey),this._logger._trace("creating object"),this._internalUtilCtx={logger:this._logger.utilFor.internal()},this.address=V(_({},r.address),{sheetInstanceId:t.address.sheetInstanceId}),this.publicApi=new Nr(this)}get type(){return"Theatre_SheetObject"}getValues(){return this._cache.get("getValues()",()=>g(()=>{let t=b(this.template.getDefaultValues()),r=b(this._initialValue.pointer),o=g.memo("withInitialCache",()=>new WeakMap,[]),n=yt(t,r,o),i=b(this.template.getStaticValues()),a=g.memo("withStatics",()=>new WeakMap,[]),l=yt(n,i,a),p;{let c=g.memo("seq",()=>this.getSequencedValues(),[]),m=g.memo("withSeqsCache",()=>new WeakMap,[]);p=b(b(c)),l=yt(l,p,m)}return mi("finalAtom",l).pointer}))}getValueByPointer(t){let r=b(this.getValues()),{path:o}=G(t);return b(qe(r,o))}pointerToPrism(t){let{path:r}=G(t);return g(()=>{let o=b(this.getValues());return b(qe(o,r))})}getSequencedValues(){return g(()=>{let t=g.memo("tracksToProcess",()=>this.template.getArrayOfValidSequenceTracks(),[]),r=b(t),o=new I({}),n=b(this.template.configPointer);return g.effect("processTracks",()=>{let i=[];for(let{trackId:a,pathToProp:s}of r){let l=this._trackIdToPrism(a),p=Ft(n,s),u=p.deserializeAndSanitize,c=p.interpolate,m=()=>{let y=l.getValue();if(!y)return o.setByPointer(O=>qe(O,s),void 0);let T=u(y.left),P=T===void 0?p.default:T;if(y.right===void 0)return o.setByPointer(O=>qe(O,s),P);let j=u(y.right),x=j===void 0?p.default:j;return o.setByPointer(O=>qe(O,s),c(P,x,y.progression))},f=l.onStale(m);m(),i.push(f)}return()=>{for(let a of i)a()}},[n,...r]),o.pointer})}_trackIdToPrism(t){let r=this.template.project.pointers.historic.sheetsById[this.address.sheetId].sequence.tracksByObject[this.address.objectKey].trackData[t],o=this.sheet.getSequence().positionPrism;return To(this._internalUtilCtx,r,o)}get propsP(){return this._cache.get("propsP",()=>ye({root:this,path:[]}))}validateValue(t,r){}setInitialValue(t){this.validateValue(this.propsP,t),this._initialValue.set(t)}};function k(e){return function(r,o){return e(r,o())}}var F;(function(o){o[o.GENERAL=1]="GENERAL",o[o.TODO=2]="TODO",o[o.TROUBLESHOOTING=4]="TROUBLESHOOTING"})(F||(F={}));var R;(function(o){o[o.INTERNAL=8]="INTERNAL",o[o.DEV=16]="DEV",o[o.PUBLIC=32]="PUBLIC"})(R||(R={}));var S;(function(n){n[n.TRACE=64]="TRACE",n[n.DEBUG=128]="DEBUG",n[n.WARN=256]="WARN",n[n.ERROR=512]="ERROR"})(S||(S={}));var h;(function(f){f[f.ERROR_PUBLIC=545]="ERROR_PUBLIC",f[f.ERROR_DEV=529]="ERROR_DEV",f[f._HMM=524]="_HMM",f[f._TODO=522]="_TODO",f[f._ERROR=521]="_ERROR",f[f.WARN_PUBLIC=289]="WARN_PUBLIC",f[f.WARN_DEV=273]="WARN_DEV",f[f._KAPOW=268]="_KAPOW",f[f._WARN=265]="_WARN",f[f.DEBUG_DEV=145]="DEBUG_DEV",f[f._DEBUG=137]="_DEBUG",f[f.TRACE_DEV=81]="TRACE_DEV",f[f._TRACE=73]="_TRACE"})(h||(h={}));var ee={_hmm:te(524),_todo:te(522),_error:te(521),errorDev:te(529),errorPublic:te(545),_kapow:te(268),_warn:te(265),warnDev:te(273),warnPublic:te(289),_debug:te(137),debugDev:te(145),_trace:te(73),traceDev:te(81)};function te(e){return Object.freeze({audience:He(e,8)?"internal":He(e,16)?"dev":"public",category:He(e,4)?"troubleshooting":He(e,2)?"todo":"general",level:He(e,512)?512:He(e,256)?256:He(e,128)?128:64})}function He(e,t){return(e&t)===t}function D(e,t){return((t&32)==32?!0:(t&16)==16?e.dev:(t&8)==8?e.internal:!1)&&e.min<=t}var _e={loggingConsoleStyle:!0,loggerConsoleStyle:!0,includes:Object.freeze({internal:!1,dev:!1,min:256}),filtered:function(){},include:function(){return{}},create:null,creatExt:null,named(e,t,r){return this.create({names:[...e.names,{name:t,key:r}]})},style:{bold:void 0,italic:void 0,cssMemo:new Map([["",""]]),collapseOnRE:/[a-z- ]+/g,color:void 0,collapsed(e){if(e.length<5)return e;let t=e.replace(this.collapseOnRE,"");return this.cssMemo.has(t)||this.cssMemo.set(t,this.css(e)),t},css(e){var o,n,i,a;let t=this.cssMemo.get(e);if(t)return t;let r=`color:${(n=(o=this.color)==null?void 0:o.call(this,e))!=null?n:`hsl(${(e.charCodeAt(0)+e.charCodeAt(e.length-1))%360}, 100%, 60%)`}`;return((i=this.bold)==null?void 0:i.test(e))&&(r+=";font-weight:600"),((a=this.italic)==null?void 0:a.test(e))&&(r+=";font-style:italic"),this.cssMemo.set(e,r),r}}};function Ut(e=console,t={}){let r=V(_({},_e),{includes:_({},_e.includes)}),o={styled:Hh.bind(r,e),noStyle:Yh.bind(r,e)},n=Gh.bind(r);function i(){return r.loggingConsoleStyle&&r.loggerConsoleStyle?o.styled:o.noStyle}return r.create=i(),{configureLogger(a){var s;a==="console"?(r.loggerConsoleStyle=_e.loggerConsoleStyle,r.create=i()):a.type==="console"?(r.loggerConsoleStyle=(s=a.style)!=null?s:_e.loggerConsoleStyle,r.create=i()):a.type==="keyed"?(r.creatExt=l=>a.keyed(l.names),r.create=n):a.type==="named"&&(r.creatExt=Wh.bind(null,a.named),r.create=n)},configureLogging(a){var s,l,p,u,c;r.includes.dev=(s=a.dev)!=null?s:_e.includes.dev,r.includes.internal=(l=a.internal)!=null?l:_e.includes.internal,r.includes.min=(p=a.min)!=null?p:_e.includes.min,r.include=(u=a.include)!=null?u:_e.include,r.loggingConsoleStyle=(c=a.consoleStyle)!=null?c:_e.loggingConsoleStyle,r.create=i()},getLogger(){return r.create({names:[]})}}}function Wh(e,t){let r=[];for(let{name:o,key:n}of t.names)r.push(n==null?o:`${o} (${n})`);return e(r)}function Gh(e){let t=_(_({},this.includes),this.include(e)),r=this.filtered,o=this.named.bind(this,e),n=this.creatExt(e),i=D(t,524),a=D(t,522),s=D(t,521),l=D(t,529),p=D(t,545),u=D(t,265),c=D(t,268),m=D(t,273),f=D(t,289),y=D(t,137),T=D(t,145),P=D(t,73),j=D(t,81),x=i?n.error.bind(n,ee._hmm):r.bind(e,524),O=a?n.error.bind(n,ee._todo):r.bind(e,522),U=s?n.error.bind(n,ee._error):r.bind(e,521),z=l?n.error.bind(n,ee.errorDev):r.bind(e,529),A=p?n.error.bind(n,ee.errorPublic):r.bind(e,545),q=c?n.warn.bind(n,ee._kapow):r.bind(e,268),X=u?n.warn.bind(n,ee._warn):r.bind(e,265),le=m?n.warn.bind(n,ee.warnDev):r.bind(e,273),Ne=f?n.warn.bind(n,ee.warnPublic):r.bind(e,273),Le=y?n.debug.bind(n,ee._debug):r.bind(e,137),Me=T?n.debug.bind(n,ee.debugDev):r.bind(e,145),$e=P?n.trace.bind(n,ee._trace):r.bind(e,73),Be=j?n.trace.bind(n,ee.traceDev):r.bind(e,81),L={_hmm:x,_todo:O,_error:U,errorDev:z,errorPublic:A,_kapow:q,_warn:X,warnDev:le,warnPublic:Ne,_debug:Le,debugDev:Me,_trace:$e,traceDev:Be,lazy:{_hmm:i?k(x):x,_todo:a?k(O):O,_error:s?k(U):U,errorDev:l?k(z):z,errorPublic:p?k(A):A,_kapow:c?k(q):q,_warn:u?k(X):X,warnDev:m?k(le):le,warnPublic:f?k(Ne):Ne,_debug:y?k(Le):Le,debugDev:T?k(Me):Me,_trace:P?k($e):$e,traceDev:j?k(Be):Be},named:o,utilFor:{internal(){return{debug:L._debug,error:L._error,warn:L._warn,trace:L._trace,named(Z,w){return L.named(Z,w).utilFor.internal()}}},dev(){return{debug:L.debugDev,error:L.errorDev,warn:L.warnDev,trace:L.traceDev,named(Z,w){return L.named(Z,w).utilFor.dev()}}},public(){return{error:L.errorPublic,warn:L.warnPublic,debug(Z,w){L._warn(`(public "debug" filtered out) ${Z}`,w)},trace(Z,w){L._warn(`(public "trace" filtered out) ${Z}`,w)},named(Z,w){return L.named(Z,w).utilFor.public()}}}}};return L}function Hh(e,t){let r=_(_({},this.includes),this.include(t)),o=[],n="";for(let l=0;l<t.names.length;l++){let{name:p,key:u}=t.names[l];if(n+=` %c${p}`,o.push(this.style.css(p)),u!=null){let c=`%c#${u}`;n+=c,o.push(this.style.css(c))}}let i=this.filtered,a=this.named.bind(this,t),s=[n,...o];return xs(i,t,r,e,s,Jh(s),a)}function Jh(e){let t=e.slice(0);for(let r=1;r<t.length;r++)t[r]+=";background-color:#e0005a;padding:2px;color:white";return t}function Yh(e,t){let r=_(_({},this.includes),this.include(t)),o="";for(let s=0;s<t.names.length;s++){let{name:l,key:p}=t.names[s];o+=` ${l}`,p!=null&&(o+=`#${p}`)}let n=this.filtered,i=this.named.bind(this,t),a=[o];return xs(n,t,r,e,a,a,i)}function xs(e,t,r,o,n,i,a){let s=D(r,524),l=D(r,522),p=D(r,521),u=D(r,529),c=D(r,545),m=D(r,265),f=D(r,268),y=D(r,273),T=D(r,289),P=D(r,137),j=D(r,145),x=D(r,73),O=D(r,81),U=s?o.error.bind(o,...n):e.bind(t,524),z=l?o.error.bind(o,...n):e.bind(t,522),A=p?o.error.bind(o,...n):e.bind(t,521),q=u?o.error.bind(o,...n):e.bind(t,529),X=c?o.error.bind(o,...n):e.bind(t,545),le=f?o.warn.bind(o,...i):e.bind(t,268),Ne=m?o.warn.bind(o,...n):e.bind(t,265),Le=y?o.warn.bind(o,...n):e.bind(t,273),Me=T?o.warn.bind(o,...n):e.bind(t,273),$e=P?o.info.bind(o,...n):e.bind(t,137),Be=j?o.info.bind(o,...n):e.bind(t,145),L=x?o.debug.bind(o,...n):e.bind(t,73),Z=O?o.debug.bind(o,...n):e.bind(t,81),w={_hmm:U,_todo:z,_error:A,errorDev:q,errorPublic:X,_kapow:le,_warn:Ne,warnDev:Le,warnPublic:Me,_debug:$e,debugDev:Be,_trace:L,traceDev:Z,lazy:{_hmm:s?k(U):U,_todo:l?k(z):z,_error:p?k(A):A,errorDev:u?k(q):q,errorPublic:c?k(X):X,_kapow:f?k(le):le,_warn:m?k(Ne):Ne,warnDev:y?k(Le):Le,warnPublic:T?k(Me):Me,_debug:P?k($e):$e,debugDev:j?k(Be):Be,_trace:x?k(L):L,traceDev:O?k(Z):Z},named:a,utilFor:{internal(){return{debug:w._debug,error:w._error,warn:w._warn,trace:w._trace,named(de,me){return w.named(de,me).utilFor.internal()}}},dev(){return{debug:w.debugDev,error:w.errorDev,warn:w.warnDev,trace:w.traceDev,named(de,me){return w.named(de,me).utilFor.dev()}}},public(){return{error:w.errorPublic,warn:w.warnPublic,debug(de,me){w._warn(`(public "debug" filtered out) ${de}`,me)},trace(de,me){w._warn(`(public "trace" filtered out) ${de}`,me)},named(de,me){return w.named(de,me).utilFor.public()}}}}};return w}var Ss=Ut(console,{_debug:function(){},_error:function(){}});Ss.configureLogging({dev:!0,min:S.TRACE});var Ot=Ss.getLogger().named("Theatre.js (default logger)").utilFor.dev();var Is=new WeakMap;function Vo(e){let t=Is.get(e);if(t)return t;let r=new Map;return Is.set(e,r),As([],e,r),r}function As(e,t,r){for(let[o,n]of Object.entries(t.props))if(!At(n)){let i=[...e,o];r.set(JSON.stringify(i),r.size),Os(i,n,r)}for(let[o,n]of Object.entries(t.props))if(At(n)){let i=[...e,o];r.set(JSON.stringify(i),r.size),Os(i,n,r)}}function Os(e,t,r){if(t.type==="compound")As(e,t,r);else{if(t.type==="enum")throw new Error("Enums aren't supported yet");r.set(JSON.stringify(e),r.size)}}function ws(e){return typeof e=="object"&&e!==null&&Object.keys(e).length===0}var $r=class{constructor(t,r,o,n,i){this.sheetTemplate=t;d(this,"address");d(this,"type","Theatre_SheetObjectTemplate");d(this,"_config");d(this,"_temp_actions_atom");d(this,"_cache",new De);d(this,"project");d(this,"pointerToSheetState");d(this,"pointerToStaticOverrides");this.address=V(_({},t.address),{objectKey:r}),this._config=new I(n),this._temp_actions_atom=new I(i),this.project=t.project,this.pointerToSheetState=this.sheetTemplate.project.pointers.historic.sheetsById[this.address.sheetId],this.pointerToStaticOverrides=this.pointerToSheetState.staticOverrides.byObject[this.address.objectKey]}get staticConfig(){return this._config.get()}get configPointer(){return this._config.pointer}get _temp_actions(){return this._temp_actions_atom.get()}get _temp_actionsPointer(){return this._temp_actions_atom.pointer}createInstance(t,r,o){return this._config.set(o),new Mr(t,this,r)}reconfigure(t){this._config.set(t)}_temp_setActions(t){this._temp_actions_atom.set(t)}getDefaultValues(){return this._cache.get("getDefaultValues()",()=>g(()=>{let t=b(this.configPointer);return jo(t)}))}getStaticValues(){return this._cache.get("getStaticValues",()=>g(()=>{var n;let t=(n=b(this.pointerToStaticOverrides))!=null?n:{};return b(this.configPointer).deserializeAndSanitize(t)||{}}))}getArrayOfValidSequenceTracks(){return this._cache.get("getArrayOfValidSequenceTracks",()=>g(()=>{let t=this.project.pointers.historic.sheetsById[this.address.sheetId],r=b(t.sequence.tracksByObject[this.address.objectKey].trackIdByPropPath);if(!r)return lr;let o=[];if(!r)return lr;let n=b(this.configPointer),i=Object.entries(r);for(let[s,l]of i){let p=Xh(s);if(!p)continue;let u=Ft(n,p);!(u&&vs(u))||o.push({pathToProp:p,trackId:l})}let a=Vo(n);return o.sort((s,l)=>{let p=s.pathToProp,u=l.pathToProp,c=a.get(JSON.stringify(p)),m=a.get(JSON.stringify(u));return c>m?1:-1}),o.length===0?lr:o}))}getMapOfValidSequenceTracks_forStudio(){return this._cache.get("getMapOfValidSequenceTracks_forStudio",()=>g(()=>{let t=b(this.getArrayOfValidSequenceTracks()),r={};for(let{pathToProp:o,trackId:n}of t)li(r,o,n);return r}))}getStaticButNotSequencedOverrides(){return this._cache.get("getStaticButNotSequencedOverrides",()=>g(()=>{let t=b(this.getStaticValues()),r=b(this.getArrayOfValidSequenceTracks()),o=Ao(t);for(let{pathToProp:n}of r){Vr(o,n);let i=n.slice(0,-1);for(;i.length>0;){let a=ur(o,i);if(!ws(a))break;Vr(o,i),i=i.slice(0,-1)}}if(!ws(o))return o}))}getDefaultsAtPointer(t){let{path:r}=G(t),o=this.getDefaultValues().getValue();return ur(o,r)}};function Xh(e){try{return JSON.parse(e)}catch(t){Ot.warn(`property ${JSON.stringify(e)} cannot be parsed. Skipping.`);return}}var Cs=Bt(e=>JSON.stringify(e));var eg=Yt(Vs());var Ns=class extends Error{},J=class extends Ns{};function ne(){let e,t,r=new Promise((n,i)=>{e=a=>{n(a),o.status="resolved"},t=a=>{i(a),o.status="rejected"}}),o={resolve:e,reject:t,promise:r,status:"pending"};return o}var tg=()=>{},wt=tg;var Fr=class{constructor(){d(this,"_stopPlayCallback",wt);d(this,"_state",new I({position:0,playing:!1}));d(this,"statePointer");this.statePointer=this._state.pointer}destroy(){}pause(){this._stopPlayCallback(),this.playing=!1,this._stopPlayCallback=wt}gotoPosition(t){this._updatePositionInState(t)}_updatePositionInState(t){this._state.setByPointer(r=>r.position,t)}getCurrentPosition(){return this._state.get().position}get playing(){return this._state.get().playing}set playing(t){this._state.setByPointer(r=>r.playing,t)}play(t,r,o,n,i){this.playing&&this.pause(),this.playing=!0;let a=r[1]-r[0];{let f=this.getCurrentPosition();f<r[0]||f>r[1]?n==="normal"||n==="alternate"?this._updatePositionInState(r[0]):(n==="reverse"||n==="alternateReverse")&&this._updatePositionInState(r[1]):n==="normal"||n==="alternate"?f===r[1]&&this._updatePositionInState(r[0]):f===r[0]&&this._updatePositionInState(r[1])}let s=ne(),l=i.time,p=a*t,u=this.getCurrentPosition()-r[0];(n==="reverse"||n==="alternateReverse")&&(u=r[1]-this.getCurrentPosition());let c=f=>{let T=Math.max(f-l,0)/1e3,P=Math.min(T*o+u,p);if(P!==p){let j=Math.floor(P/a),x=P/a%1*a;if(n!=="normal")if(n==="reverse")x=a-x;else{let O=j%2==0;n==="alternate"?O||(x=a-x):O&&(x=a-x)}this._updatePositionInState(x+r[0]),m()}else{if(n==="normal")this._updatePositionInState(r[1]);else if(n==="reverse")this._updatePositionInState(r[0]);else{let j=(t-1)%2==0;n==="alternate"?j?this._updatePositionInState(r[1]):this._updatePositionInState(r[0]):j?this._updatePositionInState(r[0]):this._updatePositionInState(r[1])}this.playing=!1,s.resolve(!0)}};this._stopPlayCallback=()=>{i.offThisOrNextTick(c),i.offNextTick(c),this.playing&&s.resolve(!1)};let m=()=>i.onNextTick(c);return i.onThisOrNextTick(c),s.promise}playDynamicRange(t,r){this.playing&&this.pause(),this.playing=!0;let o=ne(),n=t.keepHot();o.promise.then(n,n);let i=r.time,a=l=>{let p=Math.max(l-i,0);i=l;let u=p/1e3,c=this.getCurrentPosition(),m=t.getValue();if(c<m[0]||c>m[1])this.gotoPosition(m[0]);else{let f=c+u;f>m[1]&&(f=m[0]+(f-m[1])),this.gotoPosition(f)}s()};this._stopPlayCallback=()=>{r.offThisOrNextTick(a),r.offNextTick(a),o.resolve(!1)};let s=()=>r.onNextTick(a);return r.onThisOrNextTick(a),o.promise}};var Ls="__TheatreJS_StudioBundle",Ur="__TheatreJS_CoreBundle",Ms="__TheatreJS_Notifications";var zr=e=>(...t)=>{var r;switch(e){case"success":{Ot.debug(t.slice(0,2).join(`
`));break}case"info":{Ot.debug(t.slice(0,2).join(`
`));break}case"warning":{Ot.warn(t.slice(0,2).join(`
`));break}case"error":}return typeof window!="undefined"?(r=window[Ms])==null?void 0:r.notify[e](...t):void 0},pe={warning:zr("warning"),success:zr("success"),info:zr("info"),error:zr("error")};typeof window!="undefined"&&(window.addEventListener("error",e=>{pe.error("An error occurred",`<pre>${e.message}</pre>
See **console** for details.`)}),window.addEventListener("unhandledrejection",e=>{pe.error("An error occurred",`<pre>${e.reason}</pre>
See **console** for details.`)}));var qr=class{constructor(t,r,o){this._decodedBuffer=t;this._audioContext=r;this._nodeDestination=o;d(this,"_mainGain");d(this,"_state",new I({position:0,playing:!1}));d(this,"statePointer");d(this,"_stopPlayCallback",wt);this.statePointer=this._state.pointer,this._mainGain=this._audioContext.createGain(),this._mainGain.connect(this._nodeDestination)}playDynamicRange(t,r){let o=ne();this._playing&&this.pause(),this._playing=!0;let n,i=()=>{n==null||n(),n=this._loopInRange(t.getValue(),r).stop},a=t.onStale(i);return i(),this._stopPlayCallback=()=>{n==null||n(),a(),o.resolve(!1)},o.promise}_loopInRange(t,r){let o=1,n=this.getCurrentPosition(),i=t[1]-t[0];n<t[0]||n>t[1]?this._updatePositionInState(t[0]):n===t[1]&&this._updatePositionInState(t[0]),n=this.getCurrentPosition();let a=this._audioContext.createBufferSource();a.buffer=this._decodedBuffer,a.connect(this._mainGain),a.playbackRate.value=o,a.loop=!0,a.loopStart=t[0],a.loopEnd=t[1];let s=r.time,l=n-t[0];a.start(0,n);let p=m=>{let P=(Math.max(m-s,0)/1e3*o+l)/i%1*i;this._updatePositionInState(P+t[0]),u()},u=()=>r.onNextTick(p);return r.onThisOrNextTick(p),{stop:()=>{a.stop(),a.disconnect(),r.offThisOrNextTick(p),r.offNextTick(p)}}}get _playing(){return this._state.get().playing}set _playing(t){this._state.setByPointer(r=>r.playing,t)}destroy(){}pause(){this._stopPlayCallback(),this._playing=!1,this._stopPlayCallback=wt}gotoPosition(t){this._updatePositionInState(t)}_updatePositionInState(t){this._state.reduce(r=>V(_({},r),{position:t}))}getCurrentPosition(){return this._state.get().position}play(t,r,o,n,i){this._playing&&this.pause(),this._playing=!0;let a=this.getCurrentPosition(),s=r[1]-r[0];if(n!=="normal")throw new J(`Audio-controlled sequences can only be played in the "normal" direction. '${n}' given.`);a<r[0]||a>r[1]?this._updatePositionInState(r[0]):a===r[1]&&this._updatePositionInState(r[0]),a=this.getCurrentPosition();let l=ne(),p=this._audioContext.createBufferSource();p.buffer=this._decodedBuffer,p.connect(this._mainGain),p.playbackRate.value=o,t>1e3&&(pe.warning("Can't play sequences with audio more than 1000 times",`The sequence will still play, but only 1000 times. The \`iterationCount: ${t}\` provided to \`sequence.play()\`
is too high for a sequence with audio.
To fix this, either set \`iterationCount\` to a lower value, or remove the audio from the sequence.`,[{url:"https://www.theatrejs.com/docs/latest/manual/audio",title:"Using Audio"},{url:"https://www.theatrejs.com/docs/latest/api/core#sequence.attachaudio",title:"Audio API"}]),t=1e3),t>1&&(p.loop=!0,p.loopStart=r[0],p.loopEnd=r[1]);let u=i.time,c=a-r[0],m=s*t;p.start(0,a,m-c);let f=P=>{let x=Math.max(P-u,0)/1e3,O=Math.min(x*o+c,m);if(O!==m){let U=O/s%1*s;this._updatePositionInState(U+r[0]),T()}else this._updatePositionInState(r[1]),this._playing=!1,y(),l.resolve(!0)},y=()=>{p.stop(),p.disconnect()};this._stopPlayCallback=()=>{y(),i.offThisOrNextTick(f),i.offNextTick(f),this._playing&&l.resolve(!1)};let T=()=>i.onNextTick(f);return i.onThisOrNextTick(f),l.promise}};var $s=0;function zt(e){var i;let t=a=>{r.tick(a)},r=new ct({onActive(){var a;(a=e==null?void 0:e.start)==null||a.call(e)},onDormant(){var a;(a=e==null?void 0:e.stop)==null||a.call(e)}}),o={tick:t,id:$s++,name:(i=e==null?void 0:e.name)!=null?i:`CustomRafDriver-${$s}`,type:"Theatre_RafDriver_PublicAPI"},n={type:"Theatre_RafDriver_PrivateAPI",publicApi:o,ticker:r,start:e==null?void 0:e.start,stop:e==null?void 0:e.stop};return ue(o,n),o}function rg(){let e=null,o=zt({name:"DefaultCoreRafDriver",start:()=>{if(typeof window!="undefined"){let n=i=>{o.tick(i),e=window.requestAnimationFrame(n)};e=window.requestAnimationFrame(n)}else o.tick(0),setTimeout(()=>o.tick(1),0)},stop:()=>{typeof window!="undefined"&&e!==null&&window.cancelAnimationFrame(e)}});return o}var Kr;function Lo(){return Kr||og(rg()),Kr}function Wr(){return Lo().ticker}function og(e){if(Kr)throw new Error("`setCoreRafDriver()` is already called.");Kr=v(e)}var Gr=class{get type(){return"Theatre_Sequence_PublicAPI"}constructor(t){ue(this,t)}play(t){let r=v(this);if(r._project.isReady()){let o=(t==null?void 0:t.rafDriver)?v(t.rafDriver).ticker:Wr();return r.play(t!=null?t:{},o)}else{let o=ne();return o.resolve(!0),o.promise}}pause(){v(this).pause()}get position(){return v(this).position}set position(t){v(this).position=t}__experimental_getKeyframes(t){return v(this).getKeyframesOfSimpleProp(t)}async attachAudio(t){let{audioContext:r,destinationNode:o,decodedBuffer:n,gainNode:i}=await ng(t),a=new qr(n,r,i);return v(this).replacePlaybackController(a),{audioContext:r,destinationNode:o,decodedBuffer:n,gainNode:i}}get pointer(){return v(this).pointer}};async function ng(e){function t(){if(e.audioContext)return Promise.resolve(e.audioContext);let p=new AudioContext;return p.state==="running"||typeof window=="undefined"?Promise.resolve(p):new Promise(u=>{let c=()=>{p.resume().catch(y=>{console.error(y)})},m=["mousedown","keydown","touchstart"],f={capture:!0,passive:!1};m.forEach(y=>{window.addEventListener(y,c,f)}),p.addEventListener("statechange",()=>{p.state==="running"&&(m.forEach(y=>{window.removeEventListener(y,c,f)}),u(p))})})}async function r(){if(e.source instanceof AudioBuffer)return e.source;let p=ne();if(typeof e.source!="string")throw new Error("Error validating arguments to sequence.attachAudio(). args.source must either be a string or an instance of AudioBuffer.");let u;try{u=await fetch(e.source)}catch(y){throw console.error(y),new Error(`Could not fetch '${e.source}'. Network error logged above.`)}let c;try{c=await u.arrayBuffer()}catch(y){throw console.error(y),new Error(`Could not read '${e.source}' as an arrayBuffer.`)}(await o).decodeAudioData(c,p.resolve,p.reject);let f;try{f=await p.promise}catch(y){throw console.error(y),new Error(`Could not decode ${e.source} as an audio file.`)}return f}let o=t(),n=r(),[i,a]=await Promise.all([o,n]),s=e.destinationNode||i.destination,l=i.createGain();return l.connect(s),{audioContext:i,decodedBuffer:a,gainNode:l,destinationNode:s}}var BO=Ve("Theatre_Project"),FO=Ve("Theatre_Sheet"),UO=Ve("Theatre_SheetTemplate"),Bs=Ve("Theatre_SheetObject"),zO=Ve("Theatre_SheetObjectTemplate"),qO=Ve("Theatre_Project_PublicAPI"),KO=Ve("Theatre_Sheet_PublicAPI"),WO=Ve("Theatre_SheetObject_PublicAPI");function Ve(e){return t=>typeof t=="object"&&!!t&&t.type===e}var Hr=class{constructor(t,r,o,n,i){this._project=t;this._sheet=r;this._lengthD=o;this._subUnitsPerUnitD=n;d(this,"address");d(this,"publicApi");d(this,"_playbackControllerBox");d(this,"_prismOfStatePointer");d(this,"_positionD");d(this,"_positionFormatterD");d(this,"_playableRangeD");d(this,"pointer",ye({root:this,path:[]}));d(this,"$$isPointerToPrismProvider",!0);d(this,"_logger");d(this,"closestGridPosition",t=>{let r=this.subUnitsPerUnit,o=1/r;return parseFloat((Math.round(t/o)*o).toFixed(3))});this._logger=t._logger.named("Sheet",r.address.sheetId).named("Instance",r.address.sheetInstanceId),this.address=V(_({},this._sheet.address),{sequenceName:"default"}),this.publicApi=new Gr(this),this._playbackControllerBox=new I(i!=null?i:new Fr),this._prismOfStatePointer=g(()=>this._playbackControllerBox.prism.getValue().statePointer),this._positionD=g(()=>{let a=this._prismOfStatePointer.getValue();return b(a.position)}),this._positionFormatterD=g(()=>{let a=b(this._subUnitsPerUnitD);return new Fs(a)})}pointerToPrism(t){let{path:r}=G(t);if(r.length===0)return g(()=>({length:b(this.pointer.length),playing:b(this.pointer.playing),position:b(this.pointer.position)}));if(r.length>1)return g(()=>{});let[o]=r;return o==="length"?this._lengthD:o==="position"?this._positionD:o==="playing"?g(()=>b(this._prismOfStatePointer.getValue().playing)):g(()=>{})}getKeyframesOfSimpleProp(t){let{path:r,root:o}=G(t);if(!Bs(o))throw new J("Argument prop must be a pointer to a SheetObject property");let n=b(this._project.pointers.historic.sheetsById[this._sheet.address.sheetId].sequence.tracksByObject[o.address.objectKey]);if(!n)return[];let{trackData:i,trackIdByPropPath:a}=n,s=Cs(r),l=a[s];if(!l)return[];let p=i[l];return p?p.keyframes:[]}get positionFormatter(){return this._positionFormatterD.getValue()}get prismOfStatePointer(){return this._prismOfStatePointer}get length(){return this._lengthD.getValue()}get positionPrism(){return this._positionD}get position(){return this._playbackControllerBox.get().getCurrentPosition()}get subUnitsPerUnit(){return this._subUnitsPerUnitD.getValue()}get positionSnappedToGrid(){return this.closestGridPosition(this.position)}set position(t){let r=t;this.pause(),r>this.length&&(r=this.length);let o=this.length;this._playbackControllerBox.get().gotoPosition(r>o?o:r)}getDurationCold(){return this._lengthD.getValue()}get playing(){return b(this._playbackControllerBox.get().statePointer.playing)}_makeRangeFromSequenceTemplate(){return g(()=>[0,b(this._lengthD)])}playDynamicRange(t,r){return this._playbackControllerBox.get().playDynamicRange(t,r)}async play(t,r){let o=this.length,n=t&&t.range?t.range:[0,o],i=t&&typeof t.iterationCount=="number"?t.iterationCount:1,a=t&&typeof t.rate!="undefined"?t.rate:1,s=t&&t.direction?t.direction:"normal";return await this._play(i,[n[0],n[1]],a,s,r)}_play(t,r,o,n,i){return this._playbackControllerBox.get().play(t,r,o,n,i)}pause(){this._playbackControllerBox.get().pause()}replacePlaybackController(t){this.pause();let r=this._playbackControllerBox.get();this._playbackControllerBox.set(t);let o=r.getCurrentPosition();r.destroy(),t.gotoPosition(o)}},Fs=class{constructor(t){this._fps=t}formatSubUnitForGrid(t){let r=t%1,o=1/this._fps;return Math.round(r/o)+"f"}formatFullUnitForGrid(t){let r=t,o="";r>=Ct&&(o+=Math.floor(r/Ct)+"h",r=r%Ct),r>=Ye&&(o+=Math.floor(r/Ye)+"m",r=r%Ye),r>=Je&&(o+=Math.floor(r/Je)+"s",r=r%Je);let n=1/this._fps;return r>=n&&(o+=Math.floor(r/n)+"f",r=r%n),o.length===0?"0s":o}formatForPlayhead(t){let r=t,o="";if(r>=Ct){let i=Math.floor(r/Ct);o+=Ge(i.toString(),2,"0")+"h",r=r%Ct}if(r>=Ye){let i=Math.floor(r/Ye);o+=Ge(i.toString(),2,"0")+"m",r=r%Ye}else o.length>0&&(o+="00m");if(r>=Je){let i=Math.floor(r/Je);o+=Ge(i.toString(),2,"0")+"s",r=r%Je}else o+="00s";let n=1/this._fps;if(r>=n){let i=Math.round(r/n);o+=Ge(i.toString(),2,"0")+"f",r=r%n}else r/n>.98?(o+=Ge(1 .toString(),2,"0")+"f",r=r%n):o+="00f";return o.length===0?"00s00f":o}formatBasic(t){return t.toFixed(2)+"s"}},Je=1,Ye=Je*60,Ct=Ye*60;var Xr={};fo(Xr,{boolean:()=>Fo,compound:()=>qt,file:()=>ug,image:()=>cg,number:()=>Bo,rgba:()=>yg,string:()=>Uo,stringLiteral:()=>Tg});function Jr(e,t){return e.length<=t?e:e.substr(0,t-3)+"..."}var ig=e=>typeof e=="string"?`string("${Jr(e,10)}")`:typeof e=="number"?`number(${Jr(String(e),10)})`:e===null?"null":e===void 0?"undefined":typeof e=="boolean"?String(e):Array.isArray(e)?"array":typeof e=="object"?"object":"unknown",kt=ig;function ag(e,{removeAlphaIfOpaque:t=!1}={}){let r=(e.a*255|1<<8).toString(16).slice(1);return`#${(e.r*255|1<<8).toString(16).slice(1)+(e.g*255|1<<8).toString(16).slice(1)+(e.b*255|1<<8).toString(16).slice(1)+(t&&r==="ff"?"":r)}`}function Yr(e){return V(_({},e),{toString(){return ag(this,{removeAlphaIfOpaque:!0})}})}function sg(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Mt(r,0,1)]))}function Us(e){function t(r){return r>=.0031308?1.055*r**(1/2.4)-.055:12.92*r}return sg({r:t(e.r),g:t(e.g),b:t(e.b),a:e.a})}function Mo(e){function t(r){return r>=.04045?((r+.055)/(1+.055))**2.4:r/12.92}return{r:t(e.r),g:t(e.g),b:t(e.b),a:e.a}}function $o(e){let t=.4122214708*e.r+.5363325363*e.g+.0514459929*e.b,r=.2119034982*e.r+.6806995451*e.g+.1073969566*e.b,o=.0883024619*e.r+.2817188376*e.g+.6299787005*e.b,n=Math.cbrt(t),i=Math.cbrt(r),a=Math.cbrt(o);return{L:.2104542553*n+.793617785*i-.0040720468*a,a:1.9779984951*n-2.428592205*i+.4505937099*a,b:.0259040371*n+.7827717662*i-.808675766*a,alpha:e.a}}function zs(e){let t=e.L+.3963377774*e.a+.2158037573*e.b,r=e.L-.1055613458*e.a-.0638541728*e.b,o=e.L-.0894841775*e.a-1.291485548*e.b,n=t*t*t,i=r*r*r,a=o*o*o;return{r:4.0767416621*n-3.3077115913*i+.2309699292*a,g:-1.2684380046*n+2.6097574011*i-.3413193965*a,b:-.0041960863*n-.7034186147*i+1.707614701*a,a:e.alpha}}var ce=Symbol("TheatrePropType_Basic");function qs(e){return typeof e=="object"&&!!e&&e[ce]==="TheatrePropType"}function pg(e){if(typeof e=="number")return Bo(e);if(typeof e=="boolean")return Fo(e);if(typeof e=="string")return Uo(e);if(typeof e=="object"&&!!e){if(qs(e))return e;if(Nt(e))return qt(e);throw new J(`This value is not a valid prop type: ${kt(e)}`)}else throw new J(`This value is not a valid prop type: ${kt(e)}`)}function Ks(e){let t={};for(let r of Object.keys(e)){let o=e[r];qs(o)?t[r]=o:t[r]=pg(o)}return t}var lg=(e,t)=>{},qt=(e,t={})=>{lg("t.compound(props, opts)",t);let r=Ks(e),o=new WeakMap;return{type:"compound",props:r,valueType:null,[ce]:"TheatrePropType",label:t.label,default:ko(r,i=>i.default),deserializeAndSanitize:i=>{if(typeof i!="object"||!i)return;if(o.has(i))return o.get(i);let a={},s=!1;for(let[l,p]of Object.entries(r))if(Object.prototype.hasOwnProperty.call(i,l)){let u=p.deserializeAndSanitize(i[l]);u!=null&&(s=!0,a[l]=u)}if(o.set(i,a),s)return a}}},ug=(e,t={})=>{let r=(o,n,i)=>{var s;let a=(s=t.interpolate)!=null?s:Kt;return{type:"file",id:a(o.id,n.id,i)}};return{type:"file",default:{type:"file",id:e},valueType:null,[ce]:"TheatrePropType",label:t.label,interpolate:r,deserializeAndSanitize:fg}},fg=e=>{if(!e)return;let t=!0;if(typeof e.id!="string"&&![null,void 0].includes(e.id)&&(t=!1),e.type!=="file"&&(t=!1),!!t)return e},cg=(e,t={})=>{let r=(o,n,i)=>{var s;let a=(s=t.interpolate)!=null?s:Kt;return{type:"image",id:a(o.id,n.id,i)}};return{type:"image",default:{type:"image",id:e},valueType:null,[ce]:"TheatrePropType",label:t.label,interpolate:r,deserializeAndSanitize:dg}},dg=e=>{if(!e)return;let t=!0;if(typeof e.id!="string"&&![null,void 0].includes(e.id)&&(t=!1),e.type!=="image"&&(t=!1),!!t)return e},Bo=(e,t={})=>{var r;return V(_({type:"number",valueType:0,default:e,[ce]:"TheatrePropType"},t||{}),{label:t.label,nudgeFn:(r=t.nudgeFn)!=null?r:vg,nudgeMultiplier:typeof t.nudgeMultiplier=="number"?t.nudgeMultiplier:void 0,interpolate:gg,deserializeAndSanitize:mg(t.range)})},mg=e=>e?t=>{if(!!(typeof t=="number"&&isFinite(t)))return Mt(t,e[0],e[1])}:hg,hg=e=>typeof e=="number"&&isFinite(e)?e:void 0,gg=(e,t,r)=>e+r*(t-e),yg=(e={r:0,g:0,b:0,a:1},t={})=>{let r={};for(let o of["r","g","b","a"])r[o]=Math.min(Math.max(e[o],0),1);return{type:"rgba",valueType:null,default:Yr(r),[ce]:"TheatrePropType",label:t.label,interpolate:Pg,deserializeAndSanitize:bg}},bg=e=>{if(!e)return;let t=!0;for(let o of["r","g","b","a"])(!Object.prototype.hasOwnProperty.call(e,o)||typeof e[o]!="number")&&(t=!1);if(!t)return;let r={};for(let o of["r","g","b","a"])r[o]=Math.min(Math.max(e[o],0),1);return Yr(r)},Pg=(e,t,r)=>{let o=$o(Mo(e)),n=$o(Mo(t)),i={L:(1-r)*o.L+r*n.L,a:(1-r)*o.a+r*n.a,b:(1-r)*o.b+r*n.b,alpha:(1-r)*o.alpha+r*n.alpha},a=Us(zs(i));return Yr(a)},Fo=(e,t={})=>{var r;return{type:"boolean",default:e,valueType:null,[ce]:"TheatrePropType",label:t.label,interpolate:(r=t.interpolate)!=null?r:Kt,deserializeAndSanitize:jg}},jg=e=>typeof e=="boolean"?e:void 0;function Kt(e){return e}var Uo=(e,t={})=>{var r;return{type:"string",default:e,valueType:null,[ce]:"TheatrePropType",label:t.label,interpolate:(r=t.interpolate)!=null?r:Kt,deserializeAndSanitize:_g}};function _g(e){return typeof e=="string"?e:void 0}function Tg(e,t,r={}){var o,n;return{type:"stringLiteral",default:e,valuesAndLabels:_({},t),[ce]:"TheatrePropType",valueType:null,as:(o=r.as)!=null?o:"menu",label:r.label,interpolate:(n=r.interpolate)!=null?n:Kt,deserializeAndSanitize(i){if(typeof i=="string"&&Object.prototype.hasOwnProperty.call(t,i))return i}}}var vg=({config:e,deltaX:t,deltaFraction:r,magnitude:o})=>{var i;let{range:n}=e;return!e.nudgeMultiplier&&n&&!n.includes(1/0)&&!n.includes(-1/0)?r*(n[1]-n[0])*o:t*o*((i=e.nudgeMultiplier)!=null?i:1)};var xg=e=>e.replace(/^[\s\/]*/,"").replace(/[\s\/]*$/,"").replace(/\s*\/\s*/g," / "),Sg=e=>{if(typeof e!="string")return`it is not a string. (it is a ${typeof e})`;let t=e.split(/\//);if(t.length===0)return"it is empty.";for(let r=0;r<t.length;r++){let o=t[r].trim();if(o.length===0)return`the component #${r+1} is empty.`;if(o.length>64)return`the component '${o}' must have 64 characters or less.`}};function Wt(e,t){let r=xg(e);return r}var Ew=Yt(zo());var Nw=new WeakMap,Zr=class{get type(){return"Theatre_Sheet_PublicAPI"}constructor(t){ue(this,t)}object(t,r,o){let n=v(this),i=Wt(t,"sheet.object"),a=n.getObject(i),s=null,l=o==null?void 0:o.__actions__THIS_API_IS_UNSTABLE_AND_WILL_CHANGE_IN_THE_NEXT_VERSION;if(a)return l&&a.template._temp_setActions(l),a.publicApi;{let p=qt(r);return n.createObject(i,s,p,l).publicApi}}get sequence(){return v(this).getSequence().publicApi}get project(){return v(this).project.publicApi}get address(){return _({},v(this).address)}detachObject(t){let r=v(this),o=Wt(t,`sheet.deleteObject("${t}")`);if(!r.getObject(o)){pe.warning(`Couldn't delete object "${o}"`,`There is no object with key "${o}".
To fix this, make sure you are calling \`sheet.deleteObject("${o}")\` with the correct key.`),console.warn(`Object key "${o}" does not exist.`);return}r.deleteObject(o)}};var Qr=class{constructor(t,r){this.template=t;this.instanceId=r;d(this,"_objects",new I({}));d(this,"_sequence");d(this,"address");d(this,"publicApi");d(this,"project");d(this,"objectsP",this._objects.pointer);d(this,"type","Theatre_Sheet");d(this,"_logger");this._logger=t.project._logger.named("Sheet",r),this._logger._trace("creating sheet"),this.project=t.project,this.address=V(_({},t.address),{sheetInstanceId:this.instanceId}),this.publicApi=new Zr(this)}createObject(t,r,o,n={}){let a=this.template.getObjectTemplate(t,r,o,n).createInstance(this,r,o);return this._objects.setByPointer(s=>s[t],a),a}getObject(t){return this._objects.get()[t]}deleteObject(t){this._objects.reduce(r=>{let o=_({},r);return delete o[t],o})}getSequence(){if(!this._sequence){let t=g(()=>{let o=b(this.project.pointers.historic.sheetsById[this.address.sheetId].sequence.length);return Ig(o)}),r=g(()=>{let o=b(this.project.pointers.historic.sheetsById[this.address.sheetId].sequence.subUnitsPerUnit);return Ag(o)});this._sequence=new Hr(this.template.project,this,t,r)}return this._sequence}},Ig=e=>typeof e=="number"&&isFinite(e)&&e>0?e:10,Ag=e=>typeof e=="number"&&Co(e)&&e>=1&&e<=1e3?e:30;var eo=class{constructor(t,r){this.project=t;d(this,"type","Theatre_SheetTemplate");d(this,"address");d(this,"_instances",new I({}));d(this,"instancesP",this._instances.pointer);d(this,"_objectTemplates",new I({}));d(this,"objectTemplatesP",this._objectTemplates.pointer);this.address=V(_({},t.address),{sheetId:r})}getInstance(t){let r=this._instances.get()[t];return r||(r=new Qr(this,t),this._instances.setByPointer(o=>o[t],r)),r}getObjectTemplate(t,r,o,n){let i=this._objectTemplates.get()[t];return i||(i=new $r(this,t,r,o,n),this._objectTemplates.setByPointer(a=>a[t],i)),i}};var Og=e=>new Promise(t=>setTimeout(t,e)),Gs=Og;function ie(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];if(!1)var n,i;throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(a){return"'"+a+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Xe(e){return!!e&&!!e[Y]}function Ze(e){return!!e&&(function(t){if(!t||typeof t!="object")return!1;var r=Object.getPrototypeOf(t);if(r===null)return!0;var o=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return o===Object||typeof o=="function"&&Function.toString.call(o)===Ng}(e)||Array.isArray(e)||!!e[np]||!!e.constructor[np]||Ko(e)||Wo(e))}function Hs(e){return Xe(e)||ie(23,e),e[Y].t}function Gt(e,t,r){r===void 0&&(r=!1),Dt(e)===0?(r?Object.keys:nn)(e).forEach(function(o){r&&typeof o=="symbol"||t(o,e[o],e)}):e.forEach(function(o,n){return t(n,o,e)})}function Dt(e){var t=e[Y];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Ko(e)?2:Wo(e)?3:0}function qo(e,t){return Dt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wg(e,t){return Dt(e)===2?e.get(t):e[t]}function Js(e,t,r){var o=Dt(e);o===2?e.set(t,r):o===3?(e.delete(t),e.add(r)):e[t]=r}function Cg(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Ko(e){return Rg&&e instanceof Map}function Wo(e){return Vg&&e instanceof Set}function Qe(e){return e.o||e.t}function Go(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Lg(e);delete t[Y];for(var r=nn(t),o=0;o<r.length;o++){var n=r[o],i=t[n];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[n]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[n]})}return Object.create(Object.getPrototypeOf(e),t)}function Ho(e,t){return t===void 0&&(t=!1),Jo(e)||Xe(e)||!Ze(e)||(Dt(e)>1&&(e.set=e.add=e.clear=e.delete=kg),Object.freeze(e),t&&Gt(e,function(r,o){return Ho(o,!0)},!0)),e}function kg(){ie(2)}function Jo(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function Te(e){var t=Mg[e];return t||ie(18,e),t}function Ys(){return Ht}function Yo(e,t){t&&(Te("Patches"),e.u=[],e.s=[],e.v=t)}function to(e){Xo(e),e.p.forEach(Dg),e.p=null}function Xo(e){e===Ht&&(Ht=e.l)}function Xs(e){return Ht={p:[],l:Ht,h:e,m:!0,_:0}}function Dg(e){var t=e[Y];t.i===0||t.i===1?t.j():t.O=!0}function Zo(e,t){t._=t.p.length;var r=t.p[0],o=e!==void 0&&e!==r;return t.h.g||Te("ES5").S(t,e,o),o?(r[Y].P&&(to(t),ie(4)),Ze(e)&&(e=ro(t,e),t.l||oo(t,e)),t.u&&Te("Patches").M(r[Y],e,t.u,t.s)):e=ro(t,r,[]),to(t),t.u&&t.v(t.u,t.s),e!==op?e:void 0}function ro(e,t,r){if(Jo(t))return t;var o=t[Y];if(!o)return Gt(t,function(i,a){return Zs(e,o,t,i,a,r)},!0),t;if(o.A!==e)return t;if(!o.P)return oo(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var n=o.i===4||o.i===5?o.o=Go(o.k):o.o;Gt(o.i===3?new Set(n):n,function(i,a){return Zs(e,o,n,i,a,r)}),oo(e,n,!1),r&&e.u&&Te("Patches").R(o,r,e.u,e.s)}return o.o}function Zs(e,t,r,o,n,i){if(Xe(n)){var a=ro(e,n,i&&t&&t.i!==3&&!qo(t.D,o)?i.concat(o):void 0);if(Js(r,o,a),!Xe(a))return;e.m=!1}if(Ze(n)&&!Jo(n)){if(!e.h.F&&e._<1)return;ro(e,n),t&&t.A.l||oo(e,n)}}function oo(e,t,r){r===void 0&&(r=!1),e.h.F&&e.m&&Ho(t,r)}function Qo(e,t){var r=e[Y];return(r?Qe(r):e)[t]}function Qs(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Object.getPrototypeOf(r)}}function en(e){e.P||(e.P=!0,e.l&&en(e.l))}function tn(e){e.o||(e.o=Go(e.t))}function rn(e,t,r){var o=Ko(t)?Te("MapSet").N(t,r):Wo(t)?Te("MapSet").T(t,r):e.g?function(n,i){var a=Array.isArray(n),s={i:a?1:0,A:i?i.A:Ys(),P:!1,I:!1,D:{},l:i,t:n,k:null,o:null,j:null,C:!1},l=s,p=no;a&&(l=[s],p=io);var u=Proxy.revocable(l,p),c=u.revoke,m=u.proxy;return s.k=m,s.j=c,m}(t,r):Te("ES5").J(t,r);return(r?r.A:Ys()).p.push(o),o}function Eg(e){return Xe(e)||ie(22,e),function t(r){if(!Ze(r))return r;var o,n=r[Y],i=Dt(r);if(n){if(!n.P&&(n.i<4||!Te("ES5").K(n)))return n.t;n.I=!0,o=ep(r,i),n.I=!1}else o=ep(r,i);return Gt(o,function(a,s){n&&wg(n.t,a)===s||Js(o,a,t(s))}),i===3?new Set(o):o}(e)}function ep(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Go(e)}var tp,Ht,on=typeof Symbol!="undefined"&&typeof Symbol("x")=="symbol",Rg=typeof Map!="undefined",Vg=typeof Set!="undefined",rp=typeof Proxy!="undefined"&&Proxy.revocable!==void 0&&typeof Reflect!="undefined",op=on?Symbol.for("immer-nothing"):((tp={})["immer-nothing"]=!0,tp),np=on?Symbol.for("immer-draftable"):"__$immer_draftable",Y=on?Symbol.for("immer-state"):"__$immer_state",Hw=typeof Symbol!="undefined"&&Symbol.iterator||"@@iterator";var Ng=""+Object.prototype.constructor,nn=typeof Reflect!="undefined"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Lg=Object.getOwnPropertyDescriptors||function(e){var t={};return nn(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},Mg={},no={get:function(e,t){if(t===Y)return e;var r=Qe(e);if(!qo(r,t))return function(n,i,a){var s,l=Qs(i,a);return l?"value"in l?l.value:(s=l.get)===null||s===void 0?void 0:s.call(n.k):void 0}(e,r,t);var o=r[t];return e.I||!Ze(o)?o:o===Qo(e.t,t)?(tn(e),e.o[t]=rn(e.A.h,o,e)):o},has:function(e,t){return t in Qe(e)},ownKeys:function(e){return Reflect.ownKeys(Qe(e))},set:function(e,t,r){var o=Qs(Qe(e),t);if(o==null?void 0:o.set)return o.set.call(e.k,r),!0;if(!e.P){var n=Qo(Qe(e),t),i=n==null?void 0:n[Y];if(i&&i.t===r)return e.o[t]=r,e.D[t]=!1,!0;if(Cg(r,n)&&(r!==void 0||qo(e.t,t)))return!0;tn(e),en(e)}return e.o[t]===r&&typeof r!="number"&&(r!==void 0||t in e.o)||(e.o[t]=r,e.D[t]=!0,!0)},deleteProperty:function(e,t){return Qo(e.t,t)!==void 0||t in e.t?(e.D[t]=!1,tn(e),en(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=Qe(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:o.enumerable,value:r[t]}},defineProperty:function(){ie(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ie(12)}},io={};Gt(no,function(e,t){io[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),io.deleteProperty=function(e,t){return no.deleteProperty.call(this,e[0],t)},io.set=function(e,t,r){return no.set.call(this,e[0],t,r,e[0])};var $g=function(){function e(r){var o=this;this.g=rp,this.F=!0,this.produce=function(n,i,a){if(typeof n=="function"&&typeof i!="function"){var s=i;i=n;var l=o;return function(f){var y=this;f===void 0&&(f=s);for(var T=arguments.length,P=Array(T>1?T-1:0),j=1;j<T;j++)P[j-1]=arguments[j];return l.produce(f,function(x){var O;return(O=i).call.apply(O,[y,x].concat(P))})}}var p;if(typeof i!="function"&&ie(6),a!==void 0&&typeof a!="function"&&ie(7),Ze(n)){var u=Xs(o),c=rn(o,n,void 0),m=!0;try{p=i(c),m=!1}finally{m?to(u):Xo(u)}return typeof Promise!="undefined"&&p instanceof Promise?p.then(function(f){return Yo(u,a),Zo(f,u)},function(f){throw to(u),f}):(Yo(u,a),Zo(p,u))}if(!n||typeof n!="object")return(p=i(n))===op?void 0:(p===void 0&&(p=n),o.F&&Ho(p,!0),p);ie(21,n)},this.produceWithPatches=function(n,i){return typeof n=="function"?function(l){for(var p=arguments.length,u=Array(p>1?p-1:0),c=1;c<p;c++)u[c-1]=arguments[c];return o.produceWithPatches(l,function(m){return n.apply(void 0,[m].concat(u))})}:[o.produce(n,i,function(l,p){a=l,s=p}),a,s];var a,s},typeof(r==null?void 0:r.useProxies)=="boolean"&&this.setUseProxies(r.useProxies),typeof(r==null?void 0:r.autoFreeze)=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var t=e.prototype;return t.createDraft=function(r){Ze(r)||ie(8),Xe(r)&&(r=Eg(r));var o=Xs(this),n=rn(this,r,void 0);return n[Y].C=!0,Xo(o),n},t.finishDraft=function(r,o){var n=r&&r[Y],i=n.A;return Yo(i,o),Zo(void 0,i)},t.setAutoFreeze=function(r){this.F=r},t.setUseProxies=function(r){r&&!rp&&ie(20),this.g=r},t.applyPatches=function(r,o){var n;for(n=o.length-1;n>=0;n--){var i=o[n];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}var a=Te("Patches").$;return Xe(r)?a(r,o):this.produce(r,function(s){return a(s,o.slice(n+1))})},e}(),re=new $g,Jw=re.produce,Yw=re.produceWithPatches.bind(re),Xw=re.setAutoFreeze.bind(re),Zw=re.setUseProxies.bind(re),Qw=re.applyPatches.bind(re),eC=re.createDraft.bind(re),tC=re.finishDraft.bind(re);var Bg={currentProjectStateDefinitionVersion:"0.4.0"},Et=Bg;async function an(e,t,r){await Gs(0),e.transaction(({drafts:o})=>{var u;let n=t.address.projectId;o.ephemeral.coreByProject[n]={lastExportedObject:null,loadingState:{type:"loading"}},o.ahistoric.coreByProject[n]={ahistoricStuff:""};function i(){o.ephemeral.coreByProject[n].loadingState={type:"loaded"},o.historic.coreByProject[n]={sheetsById:{},definitionVersion:Et.currentProjectStateDefinitionVersion,revisionHistory:[]}}function a(c){o.ephemeral.coreByProject[n].loadingState={type:"loaded"},o.historic.coreByProject[n]=c}function s(){o.ephemeral.coreByProject[n].loadingState={type:"loaded"}}function l(c){o.ephemeral.coreByProject[n].loadingState={type:"browserStateIsNotBasedOnDiskState",onDiskState:c}}let p=(u=Hs(o.historic))==null?void 0:u.coreByProject[t.address.projectId];p?r&&p.revisionHistory.indexOf(r.revisionHistory[0])==-1?l(r):s():r?a(r):i()})}function ip(){}function ao(e){var i,a;let t=((i=e==null?void 0:e.logging)==null?void 0:i.internal)?(a=e.logging.min)!=null?a:S.WARN:1/0,r=t<=S.DEBUG,o=t<=S.ERROR,n=Ut(void 0,{_debug:r?console.debug.bind(console,"_coreLogger(TheatreInternalLogger) debug"):ip,_error:o?console.error.bind(console,"_coreLogger(TheatreInternalLogger) error"):ip});if(e){let{logger:s,logging:l}=e;s&&n.configureLogger(s),l?n.configureLogging(l):n.configureLogging({dev:!1})}return n.getLogger().named("Theatre")}var so=class{constructor(t,r={},o){this.config=r;this.publicApi=o;d(this,"pointers");d(this,"_pointerProxies");d(this,"address");d(this,"_studioReadyDeferred");d(this,"_assetStorageReadyDeferred");d(this,"_readyPromise");d(this,"_sheetTemplates",new I({}));d(this,"sheetTemplatesP",this._sheetTemplates.pointer);d(this,"_studio");d(this,"assetStorage");d(this,"type","Theatre_Project");d(this,"_logger");var i;this._logger=ao({logging:{dev:!0}}).named("Project",t),this._logger.traceDev("creating project"),this.address={projectId:t};let n=new I({ahistoric:{ahistoricStuff:""},historic:(i=r.state)!=null?i:{sheetsById:{},definitionVersion:Et.currentProjectStateDefinitionVersion,revisionHistory:[]},ephemeral:{loadingState:{type:"loaded"},lastExportedObject:null}});this._assetStorageReadyDeferred=ne(),this.assetStorage={getAssetUrl:a=>{var s;return`${(s=r.assets)==null?void 0:s.baseUrl}/${a}`},createAsset:()=>{throw new Error("Please wait for Project.ready to use assets.")}},this._pointerProxies={historic:new Ue(n.pointer.historic),ahistoric:new Ue(n.pointer.ahistoric),ephemeral:new Ue(n.pointer.ephemeral)},this.pointers={historic:this._pointerProxies.historic.pointer,ahistoric:this._pointerProxies.ahistoric.pointer,ephemeral:this._pointerProxies.ephemeral.pointer},dt.add(t,this),this._studioReadyDeferred=ne(),this._readyPromise=Promise.all([this._studioReadyDeferred.promise,this._assetStorageReadyDeferred.promise]).then(()=>{}),r.state?setTimeout(()=>{this._studio||(this._studioReadyDeferred.resolve(void 0),this._assetStorageReadyDeferred.resolve(void 0),this._logger._trace("ready deferred resolved with no state"))},0):typeof window=="undefined"?console.error(`Argument config.state in Theatre.getProject("${t}", config) is empty. You can safely ignore this message if you're developing a Next.js/Remix project in development mode. But if you are shipping to your end-users, then you need to set config.state, otherwise your project's state will be empty and nothing will animate. Learn more at https://www.theatrejs.com/docs/latest/manual/projects#state`):setTimeout(()=>{if(!this._studio)throw new Error(`Argument config.state in Theatre.getProject("${t}", config) is empty. This is fine while you are using @theatre/core along with @theatre/studio. But since @theatre/studio is not loaded, the state of project "${t}" will be empty.
To fix this, you need to add @theatre/studio into the bundle and export the project's state. Learn how to do that at https://www.theatrejs.com/docs/latest/manual/projects#state
`)},1e3)}attachToStudio(t){if(this._studio){if(this._studio!==t)throw new Error(`Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`);console.warn(`Project ${this.address.projectId} is already attached to studio ${this._studio.address.studioId}`);return}this._studio=t,t.initialized.then(async()=>{var r;await an(t,this,this.config.state),this._pointerProxies.historic.setPointer(t.atomP.historic.coreByProject[this.address.projectId]),this._pointerProxies.ahistoric.setPointer(t.atomP.ahistoric.coreByProject[this.address.projectId]),this._pointerProxies.ephemeral.setPointer(t.atomP.ephemeral.coreByProject[this.address.projectId]),await t.createAssetStorage(this,(r=this.config.assets)==null?void 0:r.baseUrl).then(o=>{this.assetStorage=o,this._assetStorageReadyDeferred.resolve(void 0)}),this._studioReadyDeferred.resolve(void 0)}).catch(r=>{throw console.error(r),r})}get isAttachedToStudio(){return!!this._studio}get ready(){return this._readyPromise}isReady(){return this._studioReadyDeferred.status==="resolved"&&this._assetStorageReadyDeferred.status==="resolved"}getOrCreateSheet(t,r="default"){let o=this._sheetTemplates.get()[t];return o||(o=new eo(this,t),this._sheetTemplates.reduce(n=>V(_({},n),{[t]:o}))),o.getInstance(r)}};var po=class{get type(){return"Theatre_Project_PublicAPI"}constructor(t,r={}){ue(this,new so(t,r,this))}get ready(){return v(this).ready}get isReady(){return v(this).isReady()}get address(){return _({},v(this).address)}getAssetUrl(t){if(!this.isReady){console.error("Calling `project.getAssetUrl()` before `project.ready` is resolved, will always return `undefined`. Either use `project.ready.then(() => project.getAssetUrl())` or `await project.ready` before calling `project.getAssetUrl()`.");return}return t.id?v(this).assetStorage.getAssetUrl(t.id):void 0}sheet(t,r="default"){let o=Wt(t,"project.sheet");return v(this).getOrCreateSheet(o,r).publicApi}};var NC=Yt(zo());function ap(e,t={}){let r=dt.get(e);if(r)return r.publicApi;let n=ao().named("Project",e);return t.state?(Ug(e,t.state),n._debug("deep validated config.state on disk")):n._debug("no config.state"),new po(e,t)}var Fg=(e,t)=>{if(Array.isArray(t)||t==null||t.definitionVersion!==Et.currentProjectStateDefinitionVersion)throw new J(`Error validating conf.state in Theatre.getProject(${JSON.stringify(e)}, conf). The state seems to be formatted in a way that is unreadable to Theatre.js. Read more at https://www.theatrejs.com/docs/latest/manual/projects#state`)},Ug=(e,t)=>{Fg(e,t)};function Lr(e,t,r){let o=r?v(r).ticker:Wr();if(ae(e))return ke(e).onChange(o,t,!0);if(we(e))return e.onChange(o,t,!0);throw new Error("Called onChange(p) where p is neither a pointer nor a prism.")}function sp(e){if(ae(e))return ke(e).getValue();throw new Error("Called val(p) where p is not a pointer.")}var lo=class{constructor(){d(this,"_studio")}get type(){return"Theatre_CoreBundle"}get version(){return"0.7.0"}getBitsForStudio(t,r){if(this._studio)throw new Error("@theatre/core is already attached to @theatre/studio");this._studio=t;let o={projectsP:dt.atom.pointer.projects,privateAPI:v,coreExports:sn,getCoreRafDriver:Lo};r(o)}};zg();function zg(){if(typeof window=="undefined")return;let e=window[Ur];if(typeof e!="undefined")throw typeof e=="object"&&e&&typeof e.version=="string"?new Error(`It seems that the module '@theatre/core' is loaded more than once. This could have two possible causes:
1. You might have two separate versions of Theatre.js in node_modules.
2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.
Note that it **is okay** to import '@theatre/core' multiple times. But those imports should point to the same module.`):new Error(`The variable window.${Ur} seems to be already set by a module other than @theatre/core.`);let t=new lo;window[Ur]=t;let r=window[Ls];r&&r!==null&&r.type==="Theatre_StudioBundle"&&r.registerCoreBundle(t)}window.Theatre={core:pn,get studio(){alert("Theatre.studio is only available in the core-and-studio.js bundle. You're using the core-only.min.js bundle.")}};})();
/**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
//# sourceMappingURL=core-only.min.js.map