@tomorrowevening/theatre-browser-bundles 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-and-studio.js +25 -25
- package/dist/core-only.min.js +4 -4
- package/package.json +1 -1
package/dist/core-and-studio.js
CHANGED
|
@@ -60047,7 +60047,7 @@ To fix this, either set \`iterationCount\` to a lower value, or remove the audio
|
|
|
60047
60047
|
if (true) {
|
|
60048
60048
|
notify.warning("Sequence can't be played", `You seem to have called \`sequence.play()\` before the project has finished loading.
|
|
60049
60049
|
|
|
60050
|
-
This would **not** a problem in production when using \`@theatre
|
|
60050
|
+
This would **not** a problem in production when using \`@tomorrowevening/theatre-core\`, since Theatre.js loads instantly in core mode. However, when using \`@tomorrowevening/theatre-studio\`, it takes a few milliseconds for it to load your project's state, before which your sequences cannot start playing.
|
|
60051
60051
|
|
|
60052
60052
|
To fix this, simply defer calling \`sequence.play()\` until after the project is loaded, like this:
|
|
60053
60053
|
|
|
@@ -60098,7 +60098,7 @@ project.ready.then(() => {
|
|
|
60098
60098
|
return priv.goToAndPlay(markerName, conf != null ? conf : {}, ticker);
|
|
60099
60099
|
} else {
|
|
60100
60100
|
if (true) {
|
|
60101
|
-
notify.warning("Sequence can't go to marker", "You seem to have called `sequence.goToAndPlay()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@theatre
|
|
60101
|
+
notify.warning("Sequence can't go to marker", "You seem to have called `sequence.goToAndPlay()` before the project has finished loading.\n\nThis would **not** a problem in production when using `@tomorrowevening/theatre-core`, since Theatre.js loads instantly in core mode. However, it seems that you are using `@tomorrowevening/theatre-studio`, which takes a few milliseconds to load, because itcontains a lot of code responsible for the editing UI.\n\nTo fix this, wait for `project.ready` to resolve, and only then call `sequence.goToAndPlay()`.\n\nLearn more at https://www.theatrejs.com/docs/latest/manual/projects#state");
|
|
60102
60102
|
}
|
|
60103
60103
|
const d3 = defer();
|
|
60104
60104
|
d3.resolve(true);
|
|
@@ -61697,9 +61697,9 @@ To fix this, make sure you are calling \`sheet.deleteObject("${sanitizedPath}")\
|
|
|
61697
61697
|
} else {
|
|
61698
61698
|
setTimeout(() => {
|
|
61699
61699
|
if (!this._studio) {
|
|
61700
|
-
throw new Error(`Argument config.state in Theatre.getProject("${id}", config) is empty. This is fine while you are using @theatre
|
|
61700
|
+
throw new Error(`Argument config.state in Theatre.getProject("${id}", config) is empty. This is fine while you are using @tomorrowevening/theatre-core along with @tomorrowevening/theatre-studio. But since @tomorrowevening/theatre-studio is not loaded, the state of project "${id}" will be empty.
|
|
61701
61701
|
|
|
61702
|
-
To fix this, you need to add @theatre
|
|
61702
|
+
To fix this, you need to add @tomorrowevening/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
|
|
61703
61703
|
`);
|
|
61704
61704
|
}
|
|
61705
61705
|
}, 1e3);
|
|
@@ -61898,7 +61898,7 @@ You can fix this by either calling Theatre.getProject() once per projectId, or c
|
|
|
61898
61898
|
}
|
|
61899
61899
|
getBitsForStudio(studio3, callback) {
|
|
61900
61900
|
if (this._studio) {
|
|
61901
|
-
throw new Error(`@theatre
|
|
61901
|
+
throw new Error(`@tomorrowevening/theatre-core is already attached to @tomorrowevening/theatre-studio`);
|
|
61902
61902
|
}
|
|
61903
61903
|
this._studio = studio3;
|
|
61904
61904
|
const bits = {
|
|
@@ -61919,13 +61919,13 @@ You can fix this by either calling Theatre.getProject() once per projectId, or c
|
|
|
61919
61919
|
const existingBundle = window[coreBundle];
|
|
61920
61920
|
if (typeof existingBundle !== "undefined") {
|
|
61921
61921
|
if (typeof existingBundle === "object" && existingBundle && typeof existingBundle.version === "string") {
|
|
61922
|
-
throw new Error(`It seems that the module '@theatre
|
|
61922
|
+
throw new Error(`It seems that the module '@tomorrowevening/theatre-core' is loaded more than once. This could have two possible causes:
|
|
61923
61923
|
1. You might have two separate versions of Theatre.js in node_modules.
|
|
61924
61924
|
2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.
|
|
61925
61925
|
|
|
61926
|
-
Note that it **is okay** to import '@theatre
|
|
61926
|
+
Note that it **is okay** to import '@tomorrowevening/theatre-core' multiple times. But those imports should point to the same module.`);
|
|
61927
61927
|
} else {
|
|
61928
|
-
throw new Error(`The variable window.${coreBundle} seems to be already set by a module other than @theatre
|
|
61928
|
+
throw new Error(`The variable window.${coreBundle} seems to be already set by a module other than @tomorrowevening/theatre-core.`);
|
|
61929
61929
|
}
|
|
61930
61930
|
}
|
|
61931
61931
|
const coreBundle2 = new CoreBundle();
|
|
@@ -63935,9 +63935,9 @@ Note that it **is okay** to import '@theatre/core' multiple times. But those imp
|
|
|
63935
63935
|
getStudioProject() {
|
|
63936
63936
|
const core = getStudio().core;
|
|
63937
63937
|
if (!core) {
|
|
63938
|
-
throw new Error(`You're calling studio.getStudioProject() before \`@theatre
|
|
63939
|
-
1. Check if \`@theatre
|
|
63940
|
-
2. Check the stack trace of this error and make sure the funciton that calls getStudioProject() is run after \`@theatre
|
|
63938
|
+
throw new Error(`You're calling studio.getStudioProject() before \`@tomorrowevening/theatre-core\` is loaded. To fix this:
|
|
63939
|
+
1. Check if \`@tomorrowevening/theatre-core\` is import/required in your bundle.
|
|
63940
|
+
2. Check the stack trace of this error and make sure the funciton that calls getStudioProject() is run after \`@tomorrowevening/theatre-core\` is loaded.`);
|
|
63941
63941
|
}
|
|
63942
63942
|
return getStudio().getStudioProject(core);
|
|
63943
63943
|
}
|
|
@@ -64033,7 +64033,7 @@ Note that it **is okay** to import '@theatre/core' multiple times. But those imp
|
|
|
64033
64033
|
createPane(paneClass) {
|
|
64034
64034
|
const core = this._studio.core;
|
|
64035
64035
|
if (!core) {
|
|
64036
|
-
throw new Error(`Can't create a pane because @theatre
|
|
64036
|
+
throw new Error(`Can't create a pane because @tomorrowevening/theatre-core is not yet loaded`);
|
|
64037
64037
|
}
|
|
64038
64038
|
const extensionId = val(this._studio.atomP.ephemeral.extensions.paneClasses[paneClass].extensionId);
|
|
64039
64039
|
const allPaneInstances = val(this._studio.atomP.historic.panelInstanceDesceriptors);
|
|
@@ -64066,7 +64066,7 @@ Note that it **is okay** to import '@theatre/core' multiple times. But those imp
|
|
|
64066
64066
|
destroyPane(instanceId) {
|
|
64067
64067
|
const core = this._studio.core;
|
|
64068
64068
|
if (!core) {
|
|
64069
|
-
throw new Error(`Can't do this yet because @theatre
|
|
64069
|
+
throw new Error(`Can't do this yet because @tomorrowevening/theatre-core is not yet loaded`);
|
|
64070
64070
|
}
|
|
64071
64071
|
this._studio.transaction(({ drafts: drafts2 }) => {
|
|
64072
64072
|
delete drafts2.historic.panelInstanceDesceriptors[instanceId];
|
|
@@ -64260,27 +64260,27 @@ Note that it **is okay** to import '@theatre/core' multiple times. But those imp
|
|
|
64260
64260
|
init_assets();
|
|
64261
64261
|
init_notify();
|
|
64262
64262
|
var DEFAULT_PERSISTENCE_KEY = "theatre-0.4";
|
|
64263
|
-
var STUDIO_NOT_INITIALIZED_MESSAGE = `You seem to have imported '@theatre
|
|
64263
|
+
var STUDIO_NOT_INITIALIZED_MESSAGE = `You seem to have imported '@tomorrowevening/theatre-studio' but haven't initialized it. You can initialize the studio by:
|
|
64264
64264
|
\`\`\`
|
|
64265
|
-
import studio from '@theatre
|
|
64265
|
+
import studio from '@tomorrowevening/theatre-studio'
|
|
64266
64266
|
studio.initialize()
|
|
64267
64267
|
\`\`\`
|
|
64268
64268
|
|
|
64269
|
-
* If you didn't mean to import '@theatre
|
|
64269
|
+
* If you didn't mean to import '@tomorrowevening/theatre-studio', this means that your bundler is not tree-shaking it. This is most likely a bundler misconfiguration.
|
|
64270
64270
|
|
|
64271
|
-
* If you meant to import '@theatre
|
|
64271
|
+
* If you meant to import '@tomorrowevening/theatre-studio' without showing its UI, you can do that by running:
|
|
64272
64272
|
|
|
64273
64273
|
\`\`\`
|
|
64274
|
-
import studio from '@theatre
|
|
64274
|
+
import studio from '@tomorrowevening/theatre-studio'
|
|
64275
64275
|
studio.initialize()
|
|
64276
64276
|
studio.ui.hide()
|
|
64277
64277
|
\`\`\`
|
|
64278
64278
|
`;
|
|
64279
|
-
var STUDIO_INITIALIZED_LATE_MSG = `You seem to have imported '@theatre
|
|
64279
|
+
var STUDIO_INITIALIZED_LATE_MSG = `You seem to have imported '@tomorrowevening/theatre-studio' but called \`studio.initialize()\` after some delay.
|
|
64280
64280
|
Theatre.js projects remain in pending mode (won't play their sequences) until the studio is initialized, so you should place the \`studio.initialize()\` line right after the import line:
|
|
64281
64281
|
|
|
64282
64282
|
\`\`\`
|
|
64283
|
-
import studio from '@theatre
|
|
64283
|
+
import studio from '@tomorrowevening/theatre-studio'
|
|
64284
64284
|
// ... and other imports
|
|
64285
64285
|
|
|
64286
64286
|
studio.initialize()
|
|
@@ -64328,7 +64328,7 @@ studio.initialize()
|
|
|
64328
64328
|
}
|
|
64329
64329
|
async initialize(opts) {
|
|
64330
64330
|
if (!this._coreBits) {
|
|
64331
|
-
throw new Error(`You seem to have imported \`@theatre
|
|
64331
|
+
throw new Error(`You seem to have imported \`@tomorrowevening/theatre-studio\` without importing \`@tomorrowevening/theatre-core\`. Make sure to include an import of \`@tomorrowevening/theatre-core\` before calling \`studio.initializer()\`.`);
|
|
64332
64332
|
}
|
|
64333
64333
|
if (this._initializeFnCalled) {
|
|
64334
64334
|
return this._initializedDeferred.promise;
|
|
@@ -64353,7 +64353,7 @@ studio.initialize()
|
|
|
64353
64353
|
}
|
|
64354
64354
|
const rafDriverPrivateApi = this._coreBits.privateAPI(opts.__experimental_rafDriver);
|
|
64355
64355
|
if (!rafDriverPrivateApi) {
|
|
64356
|
-
throw new Error("parameter `rafDriver` in `studio.initialize({__experimental_rafDriver})` seems to come from a different version of `@theatre
|
|
64356
|
+
throw new Error("parameter `rafDriver` in `studio.initialize({__experimental_rafDriver})` seems to come from a different version of `@tomorrowevening/theatre-core` than the version that is attached to `@tomorrowevening/theatre-studio`");
|
|
64357
64357
|
}
|
|
64358
64358
|
this._rafDriver = rafDriverPrivateApi;
|
|
64359
64359
|
} else {
|
|
@@ -64633,13 +64633,13 @@ studio.initialize()
|
|
|
64633
64633
|
const existingStudioBundle = window[studioBundle];
|
|
64634
64634
|
if (typeof existingStudioBundle !== "undefined") {
|
|
64635
64635
|
if (typeof existingStudioBundle === "object" && existingStudioBundle && typeof existingStudioBundle.version === "string") {
|
|
64636
|
-
throw new Error(`It seems that the module '@theatre
|
|
64636
|
+
throw new Error(`It seems that the module '@tomorrowevening/theatre-studio' is loaded more than once. This could have two possible causes:
|
|
64637
64637
|
1. You might have two separate versions of Theatre.js in node_modules.
|
|
64638
64638
|
2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.
|
|
64639
64639
|
|
|
64640
|
-
Note that it **is okay** to import '@theatre
|
|
64640
|
+
Note that it **is okay** to import '@tomorrowevening/theatre-studio' multiple times. But those imports should point to the same module.`);
|
|
64641
64641
|
} else {
|
|
64642
|
-
throw new Error(`The variable window.${studioBundle} seems to be already set by a module other than @theatre
|
|
64642
|
+
throw new Error(`The variable window.${studioBundle} seems to be already set by a module other than @tomorrowevening/theatre-core.`);
|
|
64643
64643
|
}
|
|
64644
64644
|
}
|
|
64645
64645
|
const studioBundle2 = new StudioBundle(studioPrivateAPI);
|
package/dist/core-only.min.js
CHANGED
|
@@ -10,14 +10,14 @@ is too high for a sequence with audio.
|
|
|
10
10
|
|
|
11
11
|
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]),v()}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 v=()=>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 Wr;function Lo(){return Wr||og(rg()),Wr}function Kt(){return Lo().ticker}function og(e){if(Wr)throw new Error("`setCoreRafDriver()` is already called.");Wr=T(e)}var Gr=class{get type(){return"Theatre_Sequence_PublicAPI"}constructor(t){ue(this,t)}play(t){let r=T(this);if(r._project.isReady()){let o=(t==null?void 0:t.rafDriver)?T(t.rafDriver).ticker:Kt();return r.play(t!=null?t:{},o)}else{let o=re();return o.resolve(!0),o.promise}}pause(){T(this).pause()}get position(){return T(this).position}set position(t){T(this).position=t}__experimental_getKeyframes(t){return T(this).getKeyframesOfSimpleProp(t)}async attachAudio(t){let{audioContext:r,destinationNode:o,decodedBuffer:n,gainNode:i}=await ng(t),a=new Kr(n,r,i);return T(this).replacePlaybackController(a),{audioContext:r,destinationNode:o,decodedBuffer:n,gainNode:i}}get pointer(){return T(this).pointer}getMarkerPosition(t){return T(this).getMarkerPosition(t)}goToAndPlay(t,r){let o=T(this);if(o._project.isReady()){let n=(r==null?void 0:r.rafDriver)?T(r.rafDriver).ticker:Kt();return o.goToAndPlay(t,r!=null?r:{},n)}else{let n=re();return n.resolve(!0),n.promise}}goToAndStop(t){return T(this).goToAndStop(t)}};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=re();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=Te("Theatre_Project"),FO=Te("Theatre_Sheet"),UO=Te("Theatre_SheetTemplate"),Bs=Te("Theatre_SheetObject"),qO=Te("Theatre_Sequence"),zO=Te("Theatre_SheetObjectTemplate"),KO=Te("Theatre_Project_PublicAPI"),WO=Te("Theatre_Sheet_PublicAPI"),GO=Te("Theatre_SheetObject_PublicAPI");function Te(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 Ur),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)})}get type(){return"Theatre_Sequence"}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),subUnitsPerUnit:b(this.pointer.subUnitsPerUnit)}));if(r.length>1)return g(()=>{});let[o]=r;return o==="length"?this._lengthD:o==="subUnitsPerUnit"?this._subUnitsPerUnitD: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)}getMarkerPosition(t){let r=this._project.pointers.historic.sheetsById[this._sheet.address.sheetId],o=b(r.sequence.markers);if(!o)return;let n=o.find(i=>i.label===t);return n==null?void 0:n.position}async goToAndPlay(t,r,o){let n=this.getMarkerPosition(t);if(n===void 0)throw new Error(`Marker "${t}" not found in sequence "${this._sheet.address.sheetId}"`);return this.position=n,this.play(r,o)}goToAndStop(t){let r=this.getMarkerPosition(t);if(r===void 0)throw new Error(`Marker "${t}" not found in sequence "${this._sheet.address.sheetId}"`);this.position=r}},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:()=>Wt,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,$t(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 qs(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 zs(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(zs(e))return e;if(Lt(e))return Wt(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];zs(o)?t[r]=o:t[r]=pg(o)}return t}var lg=(e,t)=>{},Wt=(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:Gt;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:Gt;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 $t(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(qs(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:Gt,deserializeAndSanitize:jg}},jg=e=>typeof e=="boolean"?e:void 0;function Gt(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:Gt,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:Gt,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 Dt(e,t){let r=xg(e);return r}var Rw=Xt(qo());var Lw=new WeakMap,Zr=class{get type(){return"Theatre_Sheet_PublicAPI"}constructor(t){ue(this,t)}object(t,r,o){let n=T(this),i=Dt(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=Wt(r);return n.createObject(i,s,p,l).publicApi}}__experimental_getExistingObject(t){let r=T(this),o=Dt(t,"sheet.object"),n=r.getObject(o);return n==null?void 0:n.publicApi}get sequence(){return T(this).getSequence().publicApi}get project(){return T(this).project.publicApi}get address(){return _({},T(this).address)}detachObject(t){let r=T(this),o=Dt(t,`sheet.deleteObject("${t}")`);if(!r.getObject(o)){pe.warning(`Couldn't delete object "${o}"`,`There is no object with key "${o}".
|
|
12
12
|
|
|
13
|
-
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 Br(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 Ht(e,t,r){r===void 0&&(r=!1),Et(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 Et(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 zo(e,t){return Et(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wg(e,t){return Et(e)===2?e.get(t):e[t]}function Js(e,t,r){var o=Et(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)||(Et(e)>1&&(e.set=e.add=e.clear=e.delete=kg),Object.freeze(e),t&&Ht(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 ve(e){var t=Mg[e];return t||ie(18,e),t}function Ys(){return Jt}function Yo(e,t){t&&(ve("Patches"),e.u=[],e.s=[],e.v=t)}function to(e){Xo(e),e.p.forEach(Dg),e.p=null}function Xo(e){e===Jt&&(Jt=e.l)}function Xs(e){return Jt={p:[],l:Jt,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||ve("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&&ve("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 Ht(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;Ht(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&&ve("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&&!zo(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)?ve("MapSet").N(t,r):Wo(t)?ve("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):ve("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=Et(r);if(n){if(!n.P&&(n.i<4||!ve("ES5").K(n)))return n.t;n.I=!0,o=ep(r,i),n.I=!1}else o=ep(r,i);return Ht(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,Jt,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",Jw=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(!zo(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||zo(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={};Ht(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 v=arguments.length,P=Array(v>1?v-1:0),j=1;j<v;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=ve("Patches").$;return Xe(r)?a(r,o):this.produce(r,function(s){return a(s,o.slice(n+1))})},e}(),oe=new $g,Yw=oe.produce,Xw=oe.produceWithPatches.bind(oe),Zw=oe.setAutoFreeze.bind(oe),Qw=oe.setUseProxies.bind(oe),eC=oe.applyPatches.bind(oe),tC=oe.createDraft.bind(oe),rC=oe.finishDraft.bind(oe);var Bg={currentProjectStateDefinitionVersion:"0.4.0"},Rt=Bg;async function an(e,t,r){if(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:Rt.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()}),r==null?void 0:r.sheetsById){let o=t.address.projectId;e.transaction(({stateEditors:n})=>{var i,a,s,l,p,u,c;for(let[m,f]of Object.entries(r.sheetsById))if((i=f==null?void 0:f.sequence)==null?void 0:i.markers){let y=f.sequence.markers;((c=(u=(p=(l=(s=(a=n==null?void 0:n.studio)==null?void 0:a.historic)==null?void 0:s.projects)==null?void 0:l.stateByProjectId)==null?void 0:p.stateBySheetId)==null?void 0:u.sequenceEditor)==null?void 0:c.replaceMarkers)&&n.studio.historic.projects.stateByProjectId.stateBySheetId.sequenceEditor.replaceMarkers({sheetAddress:{projectId:o,sheetId:m},markers:y,snappingFunction:v=>v})}})}}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=qt(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:Rt.currentProjectStateDefinitionVersion,revisionHistory:[]},ephemeral:{loadingState:{type:"loaded"},lastExportedObject:null}});this._assetStorageReadyDeferred=re(),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=re(),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.
|
|
13
|
+
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 Br(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 Ht(e,t,r){r===void 0&&(r=!1),Et(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 Et(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 zo(e,t){return Et(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wg(e,t){return Et(e)===2?e.get(t):e[t]}function Js(e,t,r){var o=Et(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)||(Et(e)>1&&(e.set=e.add=e.clear=e.delete=kg),Object.freeze(e),t&&Ht(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 ve(e){var t=Mg[e];return t||ie(18,e),t}function Ys(){return Jt}function Yo(e,t){t&&(ve("Patches"),e.u=[],e.s=[],e.v=t)}function to(e){Xo(e),e.p.forEach(Dg),e.p=null}function Xo(e){e===Jt&&(Jt=e.l)}function Xs(e){return Jt={p:[],l:Jt,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||ve("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&&ve("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 Ht(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;Ht(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&&ve("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&&!zo(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)?ve("MapSet").N(t,r):Wo(t)?ve("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):ve("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=Et(r);if(n){if(!n.P&&(n.i<4||!ve("ES5").K(n)))return n.t;n.I=!0,o=ep(r,i),n.I=!1}else o=ep(r,i);return Ht(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,Jt,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",Jw=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(!zo(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||zo(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={};Ht(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 v=arguments.length,P=Array(v>1?v-1:0),j=1;j<v;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=ve("Patches").$;return Xe(r)?a(r,o):this.produce(r,function(s){return a(s,o.slice(n+1))})},e}(),oe=new $g,Yw=oe.produce,Xw=oe.produceWithPatches.bind(oe),Zw=oe.setAutoFreeze.bind(oe),Qw=oe.setUseProxies.bind(oe),eC=oe.applyPatches.bind(oe),tC=oe.createDraft.bind(oe),rC=oe.finishDraft.bind(oe);var Bg={currentProjectStateDefinitionVersion:"0.4.0"},Rt=Bg;async function an(e,t,r){if(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:Rt.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()}),r==null?void 0:r.sheetsById){let o=t.address.projectId;e.transaction(({stateEditors:n})=>{var i,a,s,l,p,u,c;for(let[m,f]of Object.entries(r.sheetsById))if((i=f==null?void 0:f.sequence)==null?void 0:i.markers){let y=f.sequence.markers;((c=(u=(p=(l=(s=(a=n==null?void 0:n.studio)==null?void 0:a.historic)==null?void 0:s.projects)==null?void 0:l.stateByProjectId)==null?void 0:p.stateBySheetId)==null?void 0:u.sequenceEditor)==null?void 0:c.replaceMarkers)&&n.studio.historic.projects.stateByProjectId.stateBySheetId.sequenceEditor.replaceMarkers({sheetAddress:{projectId:o,sheetId:m},markers:y,snappingFunction:v=>v})}})}}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=qt(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:Rt.currentProjectStateDefinitionVersion,revisionHistory:[]},ephemeral:{loadingState:{type:"loaded"},lastExportedObject:null}});this._assetStorageReadyDeferred=re(),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=re(),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 @tomorrowevening/theatre-core along with @tomorrowevening/theatre-studio. But since @tomorrowevening/theatre-studio is not loaded, the state of project "${t}" will be empty.
|
|
14
14
|
|
|
15
|
-
To fix this, you need to add @theatre
|
|
16
|
-
`)},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 T(this).ready}get isReady(){return T(this).isReady()}get address(){return _({},T(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?T(this).assetStorage.getAssetUrl(t.id):void 0}sheet(t,r="default"){let o=Dt(t,"project.sheet");return T(this).getOrCreateSheet(o,r).publicApi}};var LC=Xt(qo());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!==Rt.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 Mr(e,t,r){let o=r?T(r).ticker:Kt();if(ae(e))return De(e).onChange(o,t,!0);if(Ce(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 De(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"1.0.2"}getBitsForStudio(t,r){if(this._studio)throw new Error("@theatre
|
|
15
|
+
To fix this, you need to add @tomorrowevening/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
|
|
16
|
+
`)},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 T(this).ready}get isReady(){return T(this).isReady()}get address(){return _({},T(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?T(this).assetStorage.getAssetUrl(t.id):void 0}sheet(t,r="default"){let o=Dt(t,"project.sheet");return T(this).getOrCreateSheet(o,r).publicApi}};var LC=Xt(qo());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!==Rt.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 Mr(e,t,r){let o=r?T(r).ticker:Kt();if(ae(e))return De(e).onChange(o,t,!0);if(Ce(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 De(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"1.0.2"}getBitsForStudio(t,r){if(this._studio)throw new Error("@tomorrowevening/theatre-core is already attached to @tomorrowevening/theatre-studio");this._studio=t;let o={projectsP:dt.atom.pointer.projects,privateAPI:T,coreExports:sn,getCoreRafDriver:Lo};r(o)}};qg();function qg(){if(typeof window=="undefined")return;let e=window[qr];if(typeof e!="undefined")throw typeof e=="object"&&e&&typeof e.version=="string"?new Error(`It seems that the module '@tomorrowevening/theatre-core' is loaded more than once. This could have two possible causes:
|
|
17
17
|
1. You might have two separate versions of Theatre.js in node_modules.
|
|
18
18
|
2. Or this might be a bundling misconfiguration, in case you're using a bundler like Webpack/ESBuild/Rollup.
|
|
19
19
|
|
|
20
|
-
Note that it **is okay** to import '@theatre
|
|
20
|
+
Note that it **is okay** to import '@tomorrowevening/theatre-core' multiple times. But those imports should point to the same module.`):new Error(`The variable window.${qr} seems to be already set by a module other than @tomorrowevening/theatre-core.`);let t=new lo;window[qr]=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.")}};})();
|
|
21
21
|
/**
|
|
22
22
|
* @license
|
|
23
23
|
* Lodash (Custom Build) <https://lodash.com/>
|