@descix/frqtl-web 0.7.0-p1 → 0.7.0-p2
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/CLAUDE.md +4 -4
- package/README.md +1 -1
- package/dist/dist-manifest.json +6 -6
- package/dist/sdk.html +1 -1
- package/dist/shim/engine/router.js +2 -2
- package/dist/studio/app-assets/{SceneCodeEditor-BtUm1Vs8.js → SceneCodeEditor-Ck982ITn.js} +1 -1
- package/dist/studio/app-assets/{index-BkQm60fi.js → index-DX5L-7-w.js} +2 -2
- package/dist/studio/app.html +1 -1
- package/llms.txt +5 -5
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -5,7 +5,7 @@ in the browser. Physics comes out of local per-pixel rules — a frame moves one
|
|
|
5
5
|
occupancy, momentum — rather than force equations or wave PDEs. Double-slit fringes, wave interference
|
|
6
6
|
and blackbody spectra are computed live from the automaton, not replayed.
|
|
7
7
|
|
|
8
|
-
`0.7.0-
|
|
8
|
+
`0.7.0-p2` (npm dist-tag `next`). The node twin is `@descix/frqtl-node` (the same modules,
|
|
9
9
|
plus `bootNode` and the hosted eyes).
|
|
10
10
|
|
|
11
11
|
## Install
|
|
@@ -38,7 +38,7 @@ refused by name), and `await recipeContext.setDeclared(name, patch)` changes one
|
|
|
38
38
|
`parts/<NewKind>.js` (class renamed, imports rewritten to package specifiers), points the entry at it and re-runs in place.
|
|
39
39
|
`runner.declared` rows read `inParts` and `module`.
|
|
40
40
|
|
|
41
|
-
Read a real part before writing your own: `https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
41
|
+
Read a real part before writing your own: `https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/frqtl/parts/DetectorWall.js`.
|
|
42
42
|
|
|
43
43
|
## Boot it — the two doors (`@descix/frqtl-web/boot`)
|
|
44
44
|
bootScene(mount, buildExperiment, { renderer: 'p5' | 'three', seed, onTick, render })
|
|
@@ -63,7 +63,7 @@ imports `./boot`, `./registry`, `./project`, `./host-view` or `./site-graph` by
|
|
|
63
63
|
row, so read the manifest from the same root: `new URL('dist-manifest.json', root)`. A page that holds only its map
|
|
64
64
|
recovers the root through `FRQTL_WEB_HOST_SPECIFIERS`: `imports[row.specifier]` minus `row.libPath`.
|
|
65
65
|
The root is an absolute URL or starts with `/`, `./` or `../`. A sketch held as text boots as `bootProject(mount, sketchProject(text))`.
|
|
66
|
-
Or skip the map: `<script src="https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
66
|
+
Or skip the map: `<script src="https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/frqtl-web.min.js"></script>` then `FRQTL.bootScene(…)`,
|
|
67
67
|
`FRQTL.Wall`, …
|
|
68
68
|
|
|
69
69
|
String kinds: `exp.addObject('Wall', props)` resolves the kind in the SCENE's realm (the frame the scene
|
|
@@ -122,6 +122,6 @@ Everything is a Frame (recursive); there is no separate "particle" class.
|
|
|
122
122
|
- The published build is WASM-only on the engine side (compiled surface).
|
|
123
123
|
|
|
124
124
|
## Curated notebooks
|
|
125
|
-
Index: `https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
125
|
+
Index: `https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/notebooks/notebooks.json`
|
|
126
126
|
|
|
127
127
|
## No account, credits, or tokens are needed for anything above.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ comes out of local per-pixel rules — a frame moves one pixel per tick, single
|
|
|
5
5
|
rather than force equations. Interference, blackbody spectra and atom-like binding emerge from the
|
|
6
6
|
automaton.
|
|
7
7
|
|
|
8
|
-
`0.7.0-
|
|
8
|
+
`0.7.0-p2` (npm dist-tag `next`). The node twin is `@descix/frqtl-node` — the same
|
|
9
9
|
modules, built from the same source. See it run: https://egpt-frqtl.descix.net (the showcase scenes in STUDIO and
|
|
10
10
|
the GYM).
|
|
11
11
|
|
package/dist/dist-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descix/frqtl-web",
|
|
3
|
-
"version": "0.7.0-
|
|
3
|
+
"version": "0.7.0-p2",
|
|
4
4
|
"files": {
|
|
5
5
|
"boot/node-refusal.js": "23ce7b8bb34fb86d19970b7e4275e463ae2963cf8a5c3b4ffe72bd6ff6261b47",
|
|
6
6
|
"css/bootstrap.min.css": "3c8f27e6009ccfd710a905e6dcf12d0ee3c6f2ac7da05b0572d3e0d12e736fc8",
|
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
"notebooks/stats.html": "360db52d77ef46c690e7c865a7ce672d5032b916a0a0796f6070d5f17b03132b",
|
|
303
303
|
"notebooks/transcendentals.html": "1dfc5d40f0e3e6cccc785fb73d73ef82e24048d7affd10143370779ef2032b8c",
|
|
304
304
|
"notebooks/view-vendored-d3.html": "debeeef830f8c328b3b6e13b0b8fe26021ba55802b89d8dbe78b8a0c6c002eac",
|
|
305
|
-
"sdk.html": "
|
|
305
|
+
"sdk.html": "bd7d46350b14c0e0cfeb61a883d2bb0642b012f09ce4b39d7b09258e25db4fdb",
|
|
306
306
|
"shim/bundle/index.js": "edc501a039ce47102657604df71fbc17ba3e4760ca087055351231c7469f5c50",
|
|
307
307
|
"shim/bundle/indexHtml.js": "2c4fbc502bb33fce93596cee19e143a58bb63c18d0b18ea597f81610e3a9a027",
|
|
308
308
|
"shim/bundle/zip.js": "00f7b5fb5f36ff40a59d86758c503d9d7fb43949c1b5a4f2e7367c43d92786f9",
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
"shim/controls/registry.js": "3df843d774968d18e012624f2aba2fb09b08ede9e21b6c1f6687d4f3e9b46d3e",
|
|
312
312
|
"shim/engine/boot-phases.js": "c6e12e12824bcf6f1a289f46e41c898a5416c80c131594525145aae9a3eefbfa",
|
|
313
313
|
"shim/engine/engine-stack-boot.js": "0abf57dcff2ca2bb025c787a17875d49d54d9218ac08c78cb9c678dbb6118d08",
|
|
314
|
-
"shim/engine/router.js": "
|
|
314
|
+
"shim/engine/router.js": "e44cf9c81b663a878d21499eb06e5b204ba92289eb7547656704166a5d700764",
|
|
315
315
|
"shim/engine/site-assemble.mjs": "37c9915c34b102daa8fe6389f8d66a1e3379e074e87d2ad79b0cff7a81a2d4b6",
|
|
316
316
|
"shim/engine/site-graph.js": "4d5e5f9ecc2cefcf30eab25203178c0bb13230e9ce7f34bb3b36178f6b79dcb9",
|
|
317
317
|
"shim/experiment-frame/index.js": "5a0219aaa225d8f808c405b08623ce85ada37d83fb4f55f983db3303e431e47f",
|
|
@@ -374,11 +374,11 @@
|
|
|
374
374
|
"shim/storage/local-storage-provider.js": "e14894e5d33bce961e66a2816e4b5c23b8e00534398ca9635d19de117f0f150e",
|
|
375
375
|
"shim/storage/make-namespace-store.js": "f88cfc65244cd7a3c3a43c173001855bb95571916a117b22f38d051823f2856f",
|
|
376
376
|
"site-assemble/browser-refusal.js": "257840fda32b088f86d05935c29d4913f74e0214dc985b309b1d8363c6ec2782",
|
|
377
|
-
"studio/app-assets/SceneCodeEditor-
|
|
377
|
+
"studio/app-assets/SceneCodeEditor-Ck982ITn.js": "d02d7a21a31ecf9e8288c1e04d8dcd49dd6cde67adeee4912b80c06b0fb813fb",
|
|
378
378
|
"studio/app-assets/host-view.js": "30f55d6976968cf0acf7870830870ffad0d439d779759af60a3aaf66c2063cf1",
|
|
379
|
-
"studio/app-assets/index-BkQm60fi.js": "7eb972d12a3b07e79a127841f3108a7ec4f6f4e5eb01682fee47c075c4dcddf9",
|
|
380
379
|
"studio/app-assets/index-DMlx7z1P.css": "23e79037f0089ce0782be5898ec5c2fb32cb067a0f66a87a24126b09cb4793da",
|
|
381
|
-
"studio/app.
|
|
380
|
+
"studio/app-assets/index-DX5L-7-w.js": "90394a3db7b363ab1b68997e86eb7b08457ab2508941634b4b3833f3c2ce029e",
|
|
381
|
+
"studio/app.html": "28374aeee9482f29e168ab6af8806c775d74eedc98d8691b50d8c75c5dc81b8a",
|
|
382
382
|
"vendor/d3-array/src/array.js": "0083c26850f97fa2735802530964aa737683402bbc560d14e0e27696b0c693bb",
|
|
383
383
|
"vendor/d3-array/src/ascending.js": "cb830a957d172fa6f6f52c67ef09a264986c3e795156930d342ed74edcea5e6b",
|
|
384
384
|
"vendor/d3-array/src/bin.js": "41f7cc39e146683c5da6ea7489903de2c5edb9bf725ca15b7cd015f603b306ac",
|
package/dist/sdk.html
CHANGED
|
@@ -132,7 +132,7 @@ universe.experimentTickFunctions.push(<span class="keyword">function</span> (u)
|
|
|
132
132
|
|
|
133
133
|
<p>In the browser (<code>@descix/frqtl-web</code>), <code>bootScene(mount, sketch)</code> boots the engine and the renderer and runs a sketch — a <code>buildExperiment(exp)</code> function whose first statement creates the world. Import the parts the sketch uses from the same dist the doors come from:</p>
|
|
134
134
|
|
|
135
|
-
<pre><code><span class="keyword">const</span> DIST = <span class="string">'https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
135
|
+
<pre><code><span class="keyword">const</span> DIST = <span class="string">'https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist'</span>;
|
|
136
136
|
<span class="keyword">const</span> { bootScene } = <span class="keyword">await</span> import(DIST + <span class="string">'/frqtl/experiments/_shared/doors.js'</span>);
|
|
137
137
|
<span class="keyword">const</span> { SphereEmitter } = <span class="keyword">await</span> import(DIST + <span class="string">'/frqtl/parts/index.js'</span>);
|
|
138
138
|
|
|
@@ -152,7 +152,7 @@ var DIST_PROFILE = buildDistProfile('../..');
|
|
|
152
152
|
// lib/shim/engine/test/router.test.mjs asserts them against the two
|
|
153
153
|
// package.json#version fields so a forgotten bump fails `make verify`, not a
|
|
154
154
|
// silent stale-CDN-URL bug.
|
|
155
|
-
var CDN_SDK_VERSION = '0.7.0-
|
|
155
|
+
var CDN_SDK_VERSION = '0.7.0-p2'; // sdk/frqtl-web/package.json#version (the ONE version owner) — bound by router.test.mjs
|
|
156
156
|
var CDN_MATH_SDK_VERSION = '0.3.3-p2.1'; // sdk/egpt-math-sdk/package.json#version — bound by router.test.mjs; bumped with each npm publish
|
|
157
157
|
|
|
158
158
|
/**
|
|
@@ -526,7 +526,7 @@ var _assertProfileParity = (function () {
|
|
|
526
526
|
* // CDN mode (static hosting — the artifact host shell has no server, no page anchor):
|
|
527
527
|
* const cdnRouter = engineRouter({ mode: 'cdn', engine: 'wasm' });
|
|
528
528
|
* console.log(cdnRouter.resolve('compat/engine.js'));
|
|
529
|
-
* // 'https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
529
|
+
* // 'https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/frqtl/compat/engine.js'
|
|
530
530
|
*
|
|
531
531
|
* // CDN mode, self-hosted: a copy of dist/ served from the consumer's own origin:
|
|
532
532
|
* const selfHosted = engineRouter({ mode: 'cdn', engine: 'wasm', base: 'https://example.org/vendor/frqtl-web/dist' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,C as w,j as r}from"./index-
|
|
1
|
+
import{r as s,C as w,j as r}from"./index-DX5L-7-w.js";function k({fileName:o,language:d,source:a,appliedSource:c,monacoBaseUrl:f,onRun:p,onReset:m,onClose:C,onChange:g,extraActions:j,error:t}){if(typeof o!="string"||!o)throw new Error("[SceneCodeEditor] fileName is required — the scene file as its owner names it (its roster row source). (FAIL-LOUD.)");if(typeof a!="string"||typeof c!="string")throw new Error("[SceneCodeEditor] source and appliedSource must be the scene text. (FAIL-LOUD.)");if(!f)throw new Error("[SceneCodeEditor] monacoBaseUrl is required — ferry FraqtlIde's router-resolved base. (FAIL-LOUD.)");if(d!==void 0&&d!=="javascript"&&d!=="json")throw new Error("[SceneCodeEditor] language is 'javascript' or 'json', got "+JSON.stringify(d)+". (FAIL-LOUD.)");const x=s.useRef(null),l=s.useRef(null),[h,b]=s.useState(a),u=s.useRef({});u.current={onRun:p,onChange:g};function v(){var e=l.current&&l.current.activeFile();return e?e.value:h}s.useEffect(function(){var e=new w({mountEl:x.current,monacoBaseUrl:f,emitBusRun:!1,showRun:!1});return e.openFile({id:o,language:d||"javascript",value:a,kind:"frqtl"}),e.onRun(function(i){u.current.onRun(i.value)}),e.onContentChange(function(){var i=e.activeFile();i&&(b(i.value),typeof u.current.onChange=="function"&&u.current.onChange(i.value))}),l.current=e,function(){e.dispose(),l.current=null}},[]),s.useEffect(function(){var e=l.current;if(e){var i=e.activeFile();i&&i.value!==a&&(e.setFileValue(o,a),b(a))}},[a,o]),s.useEffect(function(){var e=l.current;e&&e.setBaseline(o,c)},[c,o]),s.useEffect(function(){var e=l.current;e&&e.setMarkers(o,t&&t.line?[{startLineNumber:t.line,startColumn:t.col||1,endLineNumber:t.line,endColumn:(t.col||1)+1,message:t.message,severity:"error"}]:[])},[t,o]);var y=h!==c,n={root:{display:"flex",flexDirection:"column",width:"100%",height:"100%",background:"#111",color:"#ccc",fontFamily:"ui-monospace,Menlo,Consolas,monospace",fontSize:"0.75rem"},head:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",borderBottom:"1px solid #222",flexShrink:0,flexWrap:"wrap"},file:{color:"#7ec8e3",fontWeight:700},mark:{color:"#fb4",fontSize:"0.7rem"},btn:{padding:"2px 10px",background:"#1a2a3a",color:"#8af",border:"1px solid #2a3a4a",borderRadius:"3px",cursor:"pointer",fontSize:"0.7rem"},run:{background:"#1a3a24",color:"#6c9",borderColor:"#2a4a34"},off:{opacity:.45,cursor:"not-allowed"},pane:{flex:1,position:"relative",overflow:"hidden",minHeight:0},err:{background:"#2a1111",color:"#ff6b6b",padding:"6px 12px",fontSize:"0.7rem",whiteSpace:"pre-wrap",maxHeight:"30%",overflow:"auto",flexShrink:0,borderTop:"1px solid #b6161c"}};return r.jsxs("div",{style:n.root,"data-role":"scene-code-editor","data-edited":y?"1":"0",children:[r.jsxs("div",{style:n.head,children:[r.jsx("span",{style:n.file,"data-role":"scene-editor-file",children:o}),y&&r.jsx("span",{style:n.mark,"data-role":"scene-editor-edited",children:"(edited)"}),r.jsx("span",{style:{flex:1}}),r.jsx("button",{style:Object.assign({},n.btn,n.run),"data-role":"scene-editor-run",title:"Run this code in a fresh frame (Cmd/Ctrl+Enter)",onClick:function(){p(v())},children:"Run"}),r.jsx("button",{style:n.btn,"data-role":"scene-editor-reset",title:"Back to the scene file: re-read it, discard these edits, reload",onClick:function(){m()},children:"Reset"}),(j||[]).map(function(e){return r.jsx("button",{"data-role":"scene-editor-action-"+e.id,disabled:!!e.disabled,title:e.title||"",style:Object.assign({},n.btn,e.disabled?n.off:{}),onClick:function(){e.disabled||e.onClick()},children:e.label},e.id)}),r.jsx("button",{style:n.btn,"data-role":"scene-editor-close",title:"Hide the editor; the code stays as you left it",onClick:function(){C(v())},children:"Close"})]}),r.jsx("div",{ref:x,style:n.pane}),t&&r.jsxs("div",{style:n.err,"data-role":"scene-editor-error",children:[t.line?"line "+t.line+(t.col?":"+t.col:"")+" — ":"",t.message]})]})}export{k as default};
|
|
@@ -62,13 +62,13 @@ missing boot markers: [`+a.join(", ")+`]
|
|
|
62
62
|
A canonical experiment page boots through _shared/boot.js, whose boot record writes all of
|
|
63
63
|
[`+ku.join(", ")+"] on its <html> as the boot begins."):yb(s,o,n,"missing boot markers: ["+a.join(", ")+"] (document readyState="+(t.readyState||"unknown")+").")}function Ms(e,t,n,r){return{verdict:e,ok:t,done:n,message:"[experiment-frame] "+r}}function yb(e,t,n,r){return e>=t?Ms(Ps.NOT_EXPERIMENT,!1,!0,"the frame never became a canonical experiment page within "+t+`ms.
|
|
64
64
|
requested: `+n+`
|
|
65
|
-
`+r):Ms(Ps.PENDING,!1,!1,"waiting for "+n+" — "+r)}function vR(e,t){var n=t||{},r={src:e&&e.src?e.src:"",href:"",sameOrigin:!0,readyState:void 0,markers:[],hasHostShellRoot:!1,elapsedMs:n.elapsedMs,timeoutMs:n.timeoutMs},i=null;try{if(i=e&&e.contentWindow,!i)return r;r.href=i.location&&i.location.href||"";var o=i.document;r.readyState=o?o.readyState:void 0;var s=o&&o.documentElement;r.markers=ku.filter(function(a){return!!(s&&s.hasAttribute&&s.hasAttribute(a))}),r.hasHostShellRoot=!!(o&&o.querySelector&&o.querySelector(Sk))}catch{r.sameOrigin=!1}return r}function yR(e,t){var n=e||(typeof document<"u"?document.body:null);if(!n)return null;var r=n.querySelector&&n.querySelector('[data-role="experiment-frame-error"]');r&&r.parentNode.removeChild(r);var i=n.ownerDocument.createElement("div");return i.setAttribute("data-role","experiment-frame-error"),i.style.cssText="position:absolute;inset:0;z-index:9999;padding:16px;overflow:auto;white-space:pre-wrap;background:#1a0000;color:#ff6b6b;border:2px solid #b6161c;font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;",i.textContent=t,n.style&&(!n.style.position||n.style.position==="static")&&(n.style.position="relative"),n.appendChild(i),i}function bR(e,t){var n=t||{},r=typeof n.timeoutMs=="number"?n.timeoutMs:Ek,i=typeof n.pollMs=="number"?n.pollMs:150,o=Date.now(),s=!1,a=setInterval(l,i);l();function l(){if(!s){var u=vR(e,{elapsedMs:Date.now()-o,timeoutMs:r}),d=gR(u);if(d.done){if(c(),d.ok){typeof n.onOk=="function"&&n.onOk(e.contentWindow);return}typeof console<"u"&&console.error&&console.error(d.message),yR(n.overlayHost||e&&e.parentNode,d.message),typeof n.onError=="function"&&n.onError(d)}}}function c(){s||(s=!0,clearInterval(a))}return c}const xR="pub",ad="data-frqtl-site-build",bb=/^[0-9a-f]{8}$/,xb=Object.freeze([Object.freeze({package:"@descix/frqtl-web",dir:""}),Object.freeze({package:"@descix/egpt-math-sdk",dir:"egpt-math-sdk"})]);var ld={__frqtlRoot:"/","assets/models/":"/frqtl/assets/models/","experiments/":"/frqtl/experiments/",__mathSdkUrl:"/egpt-src/index.js",__mathWasmUrl:"/egpt-src/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:"/egpt-src/wasm/egpt_math_sdk_wasm.js",__mathBackend:"js-reference",__notebookBase:"/notebooks",__vendorBase:"/vendor"};function wR(e){if(/\/$/.test(e))throw new Error('[engineRouter] buildDistProfile(base) takes a relative dist-root path with no trailing slash (e.g. "../.."), got '+JSON.stringify(e)+".");return{__frqtlRoot:e+"/","assets/models/":e+"/js/models/","experiments/":e+"/experiments/",__mathSdkUrl:e+"/../egpt-math-sdk/index.js",__mathWasmUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:e+"/../egpt-math-sdk/notebooks",__vendorBase:e+"/../egpt-math-sdk/vendor"}}var Vp=wR("../.."),qp="0.7.0-
|
|
65
|
+
`+r):Ms(Ps.PENDING,!1,!1,"waiting for "+n+" — "+r)}function vR(e,t){var n=t||{},r={src:e&&e.src?e.src:"",href:"",sameOrigin:!0,readyState:void 0,markers:[],hasHostShellRoot:!1,elapsedMs:n.elapsedMs,timeoutMs:n.timeoutMs},i=null;try{if(i=e&&e.contentWindow,!i)return r;r.href=i.location&&i.location.href||"";var o=i.document;r.readyState=o?o.readyState:void 0;var s=o&&o.documentElement;r.markers=ku.filter(function(a){return!!(s&&s.hasAttribute&&s.hasAttribute(a))}),r.hasHostShellRoot=!!(o&&o.querySelector&&o.querySelector(Sk))}catch{r.sameOrigin=!1}return r}function yR(e,t){var n=e||(typeof document<"u"?document.body:null);if(!n)return null;var r=n.querySelector&&n.querySelector('[data-role="experiment-frame-error"]');r&&r.parentNode.removeChild(r);var i=n.ownerDocument.createElement("div");return i.setAttribute("data-role","experiment-frame-error"),i.style.cssText="position:absolute;inset:0;z-index:9999;padding:16px;overflow:auto;white-space:pre-wrap;background:#1a0000;color:#ff6b6b;border:2px solid #b6161c;font:12px/1.55 ui-monospace,Menlo,Consolas,monospace;",i.textContent=t,n.style&&(!n.style.position||n.style.position==="static")&&(n.style.position="relative"),n.appendChild(i),i}function bR(e,t){var n=t||{},r=typeof n.timeoutMs=="number"?n.timeoutMs:Ek,i=typeof n.pollMs=="number"?n.pollMs:150,o=Date.now(),s=!1,a=setInterval(l,i);l();function l(){if(!s){var u=vR(e,{elapsedMs:Date.now()-o,timeoutMs:r}),d=gR(u);if(d.done){if(c(),d.ok){typeof n.onOk=="function"&&n.onOk(e.contentWindow);return}typeof console<"u"&&console.error&&console.error(d.message),yR(n.overlayHost||e&&e.parentNode,d.message),typeof n.onError=="function"&&n.onError(d)}}}function c(){s||(s=!0,clearInterval(a))}return c}const xR="pub",ad="data-frqtl-site-build",bb=/^[0-9a-f]{8}$/,xb=Object.freeze([Object.freeze({package:"@descix/frqtl-web",dir:""}),Object.freeze({package:"@descix/egpt-math-sdk",dir:"egpt-math-sdk"})]);var ld={__frqtlRoot:"/","assets/models/":"/frqtl/assets/models/","experiments/":"/frqtl/experiments/",__mathSdkUrl:"/egpt-src/index.js",__mathWasmUrl:"/egpt-src/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:"/egpt-src/wasm/egpt_math_sdk_wasm.js",__mathBackend:"js-reference",__notebookBase:"/notebooks",__vendorBase:"/vendor"};function wR(e){if(/\/$/.test(e))throw new Error('[engineRouter] buildDistProfile(base) takes a relative dist-root path with no trailing slash (e.g. "../.."), got '+JSON.stringify(e)+".");return{__frqtlRoot:e+"/","assets/models/":e+"/js/models/","experiments/":e+"/experiments/",__mathSdkUrl:e+"/../egpt-math-sdk/index.js",__mathWasmUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:e+"/../egpt-math-sdk/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:e+"/../egpt-math-sdk/notebooks",__vendorBase:e+"/../egpt-math-sdk/vendor"}}var Vp=wR("../.."),qp="0.7.0-p2",_R="0.3.3-p2.1";function Ok(e){if(typeof e!="string"||!e)throw new Error("[engineRouter] cdnDistBaseFor(version): a published @descix/frqtl-web version (got "+JSON.stringify(e)+").");return"https://cdn.jsdelivr.net/npm/@descix/frqtl-web@"+e+"/dist"}var Ck=Ok(qp),Ic="https://cdn.jsdelivr.net/npm/@descix/egpt-math-sdk@"+_R+"/dist";function kR(e){var t=typeof e=="string"&&e!==""&&!/\/$/.test(e);if(t)try{new URL(e)}catch{t=!1}if(!t)throw new Error(`[engineRouter] mode:"cdn" opts.base must be the absolute URL of a copy of the package's dist/ directory, with no trailing slash (e.g. "https://example.org/vendor/frqtl-web/dist"); got `+JSON.stringify(e)+". From a page: new URL('./vendor/frqtl-web/dist', location.href).href. (FAIL-LOUD.)");return e}function jk(e){return kR(e),{__frqtlRoot:e+"/","assets/models/":e+"/js/models/","experiments/":e+"/experiments/",__mathSdkUrl:Ic+"/index.js",__mathWasmUrl:Ic+"/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:Ic+"/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:Ic+"/notebooks",__vendorBase:e+"/vendor"}}var $p=jk(Ck),SR="@descix/frqtl-web",ER="@descix/egpt-math-sdk";function wb(e,t){var n=xb.find(function(r){return r.package===t});if(!n)throw new Error("[engineRouter] no site-graph.js::SITE_PLACEMENTS row places "+t+" (rows: "+xb.map(function(r){return r.package}).join(", ")+").");return n.dir?e+"/"+n.dir:e}function Kp(e,t){if(!e||!t)throw new Error("[engineRouter] buildStaticProfile(graphBase, entryBase) needs both bases (got "+JSON.stringify(e)+", "+JSON.stringify(t)+") — the graph and the entry pages are anchored separately; a co-served host passes the same base twice.");var n=wb(e,SR),r=wb(e,ER);return{__frqtlRoot:n+"/","assets/models/":n+"/js/models/","experiments/":t+"/experiments/",__mathSdkUrl:r+"/index.js",__mathWasmUrl:r+"/wasm/egpt_math_sdk_wasm_bg.wasm",__mathWasmModuleUrl:r+"/wasm/egpt_math_sdk_wasm.js",__mathBackend:"wasm-math",__notebookBase:n+"/notebooks",__vendorBase:n+"/vendor"}}var Qd="./"+xR;function Rk(e){if(typeof e!="string"||!bb.test(e))throw new Error("[engineRouter] the static site build id must match "+bb+" (the bundle's <html "+ad+">), got "+JSON.stringify(e)+".");return e}function Rg(e){return Qd+"/"+Rk(e)}function Lg(e){if(!e)throw new Error('[engineRouter] mode:"static" resolves against the document — no document.baseURI here. Outside a browser pass opts.documentBaseURI (the URL of the directory serving the static site).');return e}function OR(e,t){return new URL(Rg(t),Lg(e)).href}function CR(e){return new URL(Qd,Lg(e)).href}function jR(){var e=typeof document<"u"&&document.documentElement&&typeof document.documentElement.getAttribute=="function"?document.documentElement.getAttribute(ad):null;if(!e)throw new Error('[engineRouter] mode:"static": this document carries no build stamp (<html '+ad+">) — only the assembled bundle's pages can resolve the stamped graph (make static-deploy).");return Rk(e)}var RR="app-assets",LR=RR+"/host-view.js";(function(){var e=Kp(Rg("00000000"),Qd),t=Object.keys(ld).filter(function(o){return o.indexOf("__")!==0}).sort(),n=Object.keys(Vp).filter(function(o){return o.indexOf("__")!==0}).sort(),r=Object.keys($p).filter(function(o){return o.indexOf("__")!==0}).sort(),i=Object.keys(e).filter(function(o){return o.indexOf("__")!==0}).sort();if(t.join(",")!==n.join(",")||t.join(",")!==r.join(",")||t.join(",")!==i.join(","))throw new Error(`[engineRouter] Profile parity FAIL: dev/dist/cdn/static profiles have different path keys.
|
|
66
66
|
dev: `+t.join(", ")+`
|
|
67
67
|
dist: `+n.join(", ")+`
|
|
68
68
|
cdn: `+r.join(", ")+`
|
|
69
69
|
static: `+i.join(", "));if(!ld.__vendorBase||!Vp.__vendorBase||!$p.__vendorBase||!e.__vendorBase)throw new Error("[engineRouter] Profile parity FAIL: __vendorBase must be defined in ALL FOUR profiles.");return!0})();function AR(e){var t=!!(e.documentRelative||e.documentBaseURI);if(t&&e.build===void 0)throw new Error('[engineRouter] mode:"static" outside a browser needs opts.build — the site build id the stamped graph directory is named by (scripts/site-build.mjs siteBuildId()).');if(!t&&e.build!==void 0)throw new Error('[engineRouter] mode:"static" in a browser reads the build from <html '+ad+">; remove opts.build:"+JSON.stringify(e.build)+".");if(e.documentRelative)return Kp(Rg(e.build),Qd);var n=Lg(e.documentBaseURI||(typeof document<"u"?document.baseURI:"")),r=t?e.build:jR();return Kp(OR(n,r),CR(n))}var _b=Object.freeze(["assets/vendor/","compat/","objects/","parts/","experiments/_shared/","shim/"]),kb=Object.freeze({"scenes/":"a scene is a roster row, not a package path: its URL is sceneUrlOf(roster, row) (lib/shim/registry/roster.js) on the roster a host loads"});function PR(e,t){Object.keys(kb).forEach(function(s){if(t.indexOf(s)===0)throw new Error('[engineRouter] "'+t+'" is under the retired prefix "'+s+'": '+kb[s]+". (FAIL-LOUD.)")});for(var n=0;n<_b.length;n++)if(t.indexOf(_b[n])===0)return e.__frqtlRoot+(t.indexOf("shim/")===0?t:"frqtl/"+t);for(var r=Object.keys(e).filter(function(s){return s.indexOf("__")!==0}),i=0;i<r.length;i++){var o=r[i];if(t===o||t.indexOf(o)===0)return e[o]+t.slice(o.length)}return null}function Ag(e){e=e||{};var t=e.mode||"dev-core",n=e.engine||"wasm";if(n==="js")throw new Error('[engineRouter] JS reference engine archived — FRQTL is WASM-only. Remove engine:"js"; the only FRQTL physics engine is the compiled Rust/WASM engine.');if(t==="static"&&e.base)throw new Error('[engineRouter] mode:"static" takes no opts.base — the static base is derived from the document (STATIC_SDK_DIR against document.baseURI). Remove base:'+JSON.stringify(e.base)+".");if(e.documentRelative&&t!=="static")throw new Error('[engineRouter] opts.documentRelative applies only to mode:"static" (got mode:"'+t+'").');if(e.documentRelative&&e.documentBaseURI)throw new Error("[engineRouter] opts.documentRelative and opts.documentBaseURI are exclusive — a document-relative router is anchored at no document.");if(e.build!==void 0&&t!=="static")throw new Error('[engineRouter] opts.build applies only to mode:"static" (got mode:"'+t+'").');var r=t==="dist"?Vp:t==="cdn"?e.base!==void 0?jk(e.base):$p:t==="static"?AR(e):ld;function i(f){var h=r.__distOmit;if(h&&Array.isArray(h)){for(var v=0;v<h.length;v++)if(f===h[v])return""}var m=PR(r,f);if(m!==null)return m;if(r!==ld)throw new Error('[engineRouter] mode:"'+t+'" has no profile prefix for "'+f+'". Add the prefix to every profile in lib/shim/engine/router.js (profile parity).');return"/frqtl/"+f}var o=e.mathSdkUrl||typeof window<"u"&&window._egptMathSdkUrl||r.__mathSdkUrl||"",s=e.mathWasmUrl||typeof window<"u"&&window._egptMathWasmUrl||r.__mathWasmUrl||"",a=e.mathWasmModuleUrl||typeof window<"u"&&window._egptMathWasmModuleUrl||r.__mathWasmModuleUrl||"",l="";if(typeof window<"u"&&typeof URLSearchParams<"u")try{l=new URLSearchParams(window.location.search).get("mathBackend")||""}catch{}var c=e.mathBackend||l||r.__mathBackend;c==="wasm"&&(c="wasm-math");var u=r.__notebookBase||"/notebooks",d=r.__vendorBase||"/vendor";return{resolve:i,frqtlRoot:function(){return r.__frqtlRoot},engine:n,mathSdkUrl:o,mathWasmUrl:s,mathWasmModuleUrl:a,mathBackend:c,notebookBase:u,vendorBase:d,distBase:t==="cdn"?e.base||Ck:null}}const Sb=Object.freeze(["markdown","js","module","canvas","chart","view"]),Pg="</cell>",Lk="</cell>";function MR(e){return String(e).split(Pg).join(Lk)}function TR(e){return String(e).split(Lk).join(Pg)}function Yp(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function DR(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Eb(e){const t=Object.create(null);if(!e)return t;const n=/([a-zA-Z_][\w-]*)\s*=\s*("([^"]*)"|'([^']*)')/g;let r;for(;(r=n.exec(e))!==null;){const i=r[1],o=r[3]!==void 0?r[3]:r[4]!==void 0?r[4]:"";t[i]=DR(o)}return t}function dh(e){return e?String(e).split(",").map(function(t){return t.trim()}).filter(function(t){return t.length>0}):[]}function IR(e){return!e||!e.length?"":e.join(", ")}function Ob(e){var t={};return e&&String(e).split(",").forEach(function(n){var r=n.trim();if(r){var i=r.indexOf("=");if(i!==-1){var o=r.slice(0,i).trim(),s=r.slice(i+1).trim();if(o){var a=Number(s);t[o]=s!==""&&isFinite(a)?a:s}}}}),t}function FR(e){if(!e)return"";var t=Object.keys(e);return t.length?t.map(function(n){return n+"="+e[n]}).join(","):""}const Su=[{key:"type",kind:"string"},{key:"lane",kind:"string"},{key:"id",kind:"string"},{key:"name",kind:"string"},{key:"in",kind:"names"},{key:"out",kind:"names"},{key:"bind",kind:"string"},{key:"spec",kind:"string"},{key:"realm",kind:"string"},{key:"module",kind:"string"},{key:"subscribe",kind:"string"},{key:"setup",kind:"string"},{key:"shape",kind:"string"},{key:"stage",kind:"string"},{key:"seed",kind:"string"},{key:"render3d",kind:"bool"},{key:"renderOptions",kind:"opts"},{key:"cameraPreset",kind:"string"},{key:"produces",kind:"names"},{key:"produceVia",kind:"string"},{key:"produceAfter",kind:"string"},{key:"liveChart",kind:"string"},{key:"liveChartKind",kind:"string"},{key:"opts",kind:"opts"},{key:"collapsed",kind:"bool"}];function NR(e){const t=e||{},n={};for(const{key:r,kind:i}of Su){const o=t[r];i==="names"?n[r]=Array.isArray(o)?o.slice():[]:i==="opts"?n[r]=o&&typeof o=="object"&&!Array.isArray(o)?o:{}:i==="bool"?n[r]=!!o:n[r]=typeof o=="string"?o:o==null?"":String(o)}return n}function zR(e,t){const n=(Array.isArray(e)?e:[]).slice(),r=Array.isArray(t)?t:[];for(let i=0;i<r.length;i++)n.indexOf(r[i])===-1&&n.push(r[i]);return n}function Fc(e){return e.title?'notebook "'+e.title+'"':"untitled notebook"}function BR(e){if(typeof e!="string")throw new Error("[notebook/format] parse() requires an HTML string; got "+typeof e);const t=/<frqtl-notebook\b([^>]*)>([\s\S]*?)<\/frqtl-notebook>/i.exec(e);if(!t)throw new Error("[notebook/format] no <frqtl-notebook>…</frqtl-notebook> root found — not a FRQTL native notebook (FAIL-LOUD).");const n=Eb(t[1]),r=t[2],i=[],o=/<cell\b/gi,s=/<\/cell>/gi;let a;for(;(a=o.exec(r))!==null;){const l=i.length,c=r.indexOf(">",a.index);if(c===-1)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" open tag `<cell` has no closing `>` (FAIL-LOUD).");const u=r.slice(a.index,c+1);s.lastIndex=c+1;const d=s.exec(r);if(d===null)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" "+u+" has no </cell> closer — the rest of the notebook would be one cell body (FAIL-LOUD).");o.lastIndex=d.index+d[0].length;const f=Eb(r.slice(a.index+a[0].length,c)),h=r.slice(c+1,d.index);if(Sb.indexOf(f.type)===-1)throw new Error("[notebook/format] "+Fc(n)+": cell #"+l+" has "+(f.type===void 0?"no type attribute":'unknown type="'+f.type+'"')+" — legal types (CELL_TYPES): "+Sb.join(", ")+" (FAIL-LOUD).");const v=dh(f.produces),m=zR(dh(f.out),v),x={type:f.type,lane:f.lane||"",id:f.id||"",name:f.name||"",in:dh(f.in),out:m,bind:f.bind||"",spec:f.spec||"",realm:f.realm||"",module:f.module||"",subscribe:f.subscribe||"",setup:f.setup||"",shape:f.shape||"",stage:f.stage||"",seed:f.seed||"",render3d:f.render3d==="true",renderOptions:Ob(f.renderOptions),cameraPreset:f.cameraPreset||"",produces:v,produceVia:f.produceVia||"",produceAfter:f.produceAfter||"",liveChart:f.liveChart||"",liveChartKind:f.liveChartKind||"",opts:Ob(f.opts),collapsed:f.collapsed==="true"};i.push({...NR(x),body:TR(h)})}if(i.length===0)throw new Error("[notebook/format] "+Fc(n)+" has zero <cell> elements — nothing to render, run or scan (FAIL-LOUD).");return{title:n.title||"",version:n.version||"1",cells:i}}function UR(e){const t=Array.isArray(e.produces)?e.produces:[],r=(Array.isArray(e.out)?e.out:[]).filter(function(o){return t.indexOf(o)===-1});let i="<cell";for(let o=0;o<Su.length;o++){const s=Su[o].key,a=Su[o].kind;if(a==="bool"){e[s]&&(i+=" "+s+'="true"');continue}let l;a==="names"?l=IR(s==="out"?r:s==="produces"?t:e[s]):a==="opts"?l=FR(e[s]):l=typeof e[s]=="string"?e[s]:"",l&&(i+=" "+s+'="'+Yp(l)+'"')}return i+=">",i}function HR(e){if(!e||typeof e!="object")throw new Error("[notebook/format] serialize() requires a notebook object.");if(!Array.isArray(e.cells))throw new Error("[notebook/format] notebook.cells must be an array.");const t=e.version||"1",n=e.title||"",r=[];r.push('<frqtl-notebook version="'+Yp(t)+'"'+(n?' title="'+Yp(n)+'"':"")+">"),r.push("");for(let i=0;i<e.cells.length;i++){const o=e.cells[i],s=MR(o.body==null?"":o.body);r.push(UR(o)+s+Pg),r.push("")}return r.push("</frqtl-notebook>"),r.push(""),r.join(`
|
|
70
70
|
`)}var Ir={IDLE:"idle",RUNNING:"running",OK:"ok",ERROR:"error",STALE:"stale"};class WR{constructor(t,n){if(n=n||{},!t||!Array.isArray(t.cells))throw new Error("[NotebookKernel] requires a notebook object with a cells[] array.");this._runtime=n.runtime||ci,this._bus=n.bus||Ee;var r=["runCell","resetMathScope"].filter(function(f){return typeof this._runtime[f]!="function"},this);if(r.length)throw new Error("[NotebookKernel] the injected runtime does not satisfy the kernel's contract — missing: "+r.join(", ")+". Pass lib/shim/runtime/index.js's `Runtime` (Runtime.runCell, Runtime.resetMathScope), or a stub that implements both.");this._disposed=!1,this._cells=t.cells.slice(),this._cellById=new Map;for(var i=0;i<this._cells.length;i++){var o=this._cells[i];o.id&&this._cellById.set(o.id,o)}this.bindings=new Map,this.cellState=new Map;for(var s=0;s<this._cells.length;s++){var a=this._cells[s];a.id&&this.cellState.set(a.id,{status:Ir.IDLE,lastRunInputVersions:{},outputs:{}})}this._consumersOfName=new Map;for(var l=0;l<this._cells.length;l++){var c=this._cells[l];if(!(!c.id||!Array.isArray(c.in)))for(var u=0;u<c.in.length;u++){var d=c.in[u];this._consumersOfName.has(d)||this._consumersOfName.set(d,new Set),this._consumersOfName.get(d).add(c.id)}}}resetScope(){this.bindings.clear(),this._runtime.resetMathScope()}moduleSet(){for(var t={},n=0;n<this._cells.length;n++){var r=this._cells[n];r.type==="module"&&r.name&&(t[r.name]=r.body==null?"":String(r.body))}return t}_setStatus(t,n){if(!this._disposed){var r=this.cellState.get(t);r&&(r.status=n,this._bus.emit("notebook:cellstate",{cellId:t,status:n}))}}runCell(t,n){if(n=n||{},this._disposed)return Promise.reject(new Error('[NotebookKernel] disposed; cannot run cell "'+t+'".'));var r=this._cellById.get(t);if(!r)return Promise.reject(new Error('[NotebookKernel] no cell with id "'+t+'".'));for(var i=this,o={},s=Array.isArray(r.in)?r.in:[],a={},l=0;l<s.length;l++){var c=s[l];if(!i.bindings.has(c)){var u=i._findProducerCellId(c),d=u?"run cell "+u+" first.":"no cell in this notebook declares it as an output.",f=new Error('[NotebookKernel] cell "'+t+'" declares input "'+c+'", not yet produced — '+d+" (FAIL-LOUD; upstream is NOT auto-run.)");i._setStatus(t,Ir.ERROR);var h=i.cellState.get(t);return h&&(h.outputs={}),Promise.reject(f)}var v=i.bindings.get(c);o[c]=v.value,a[c]=v.version}return i._setStatus(t,Ir.RUNNING),i._runtime.runCell({lane:r.lane||"math",code:r.body||"",id:t,inputs:o,modules:i.moduleSet(),declaredOutputs:Array.isArray(r.out)?r.out:[],display:n.display||null}).then(function(m){if(i._disposed)return m;var x=i.cellState.get(t);if(m&&m.ok){for(var b=Array.isArray(r.out)?r.out:[],g=0;g<b.length;g++){var k=b[g],E=i.bindings.get(k),C=E?E.version+1:1;i.bindings.set(k,{value:m.outputs[k],version:C,producerCellId:t}),i._markConsumersStale(k,t)}x&&(x.outputs=m.outputs||{},x.lastRunInputVersions=a),i._setStatus(t,Ir.OK)}else x&&(x.outputs={}),i._setStatus(t,Ir.ERROR);return m})}commitViewOutputs(t,n){if(!this._disposed){for(var r=this.cellState.get(t),i=n&&typeof n=="object"?n:{},o=Object.keys(i),s=0;s<o.length;s++){var a=o[s],l=this.bindings.get(a),c=l?l.version+1:1;this.bindings.set(a,{value:i[a],version:c,producerCellId:t}),this._markConsumersStale(a,t)}r&&(r.outputs=i),this._setStatus(t,Ir.OK)}}runOrder(){for(var t={js:!0,canvas:!0,chart:!0,view:!0},n=[],r=0;r<this._cells.length;r++){var i=this._cells[r];i.id&&t[i.type]&&n.push(i)}for(var o=new Map,s=new Map,a=new Map,l=0;l<n.length;l++)o.set(n[l].id,l),s.set(n[l].id,0),a.set(n[l].id,new Set);for(var c=0;c<n.length;c++)for(var u=n[c],d=Array.isArray(u.in)?u.in:[],f=0;f<d.length;f++){var h=this._findProducerCellId(d[f]);if(h&&h!==u.id&&s.has(h)){var v=a.get(h);v.has(u.id)||(v.add(u.id),s.set(u.id,s.get(u.id)+1))}}for(var m=[],x=0;x<n.length;x++)s.get(n[x].id)===0&&m.push(n[x].id);for(var b=[],g=this._cellById;m.length>0;){m.sort(function(E,C){return o.get(E)-o.get(C)});var k=m.shift();b.push(g.get(k)),a.get(k).forEach(function(E){s.set(E,s.get(E)-1),s.get(E)===0&&m.push(E)})}if(b.length!==n.length)throw new Error("[NotebookKernel] runAll cannot order cells: a dependency CYCLE exists among declared in/out bindings. (FAIL-LOUD — no safe linear run order.)");return b}runAll(t){if(t=t||{},this._disposed)return Promise.reject(new Error("[NotebookKernel] disposed; cannot runAll."));var n=this,r;try{r=n.runOrder()}catch(f){return Promise.reject(f)}n.resetScope();var i=r.length,o=typeof t.displayFor=="function"?t.displayFor:null,s=typeof t.onProgress=="function"?t.onProgress:null,a=typeof t.runner=="function"?t.runner:null,l=[];function c(f,h,v){var m={index:f,total:i,cellId:h,phase:v};n._disposed||n._bus.emit("notebook:runall",m),s&&s(m)}var u=Promise.resolve(),d={ok:!0,failedCellId:null,error:null,ran:0};return r.forEach(function(f,h){u=u.then(function(){if(!(n._disposed||!d.ok)){c(h+1,f.id,"running");var v=a?a(f):null;if(v&&typeof v.then=="function")return v.then(function(x){l.push({cellId:f.id,result:x}),d.ran+=1,!x||!x.ok?(d.ok=!1,d.failedCellId=f.id,d.error=x&&x.error?x.error:'cell "'+f.id+'" did not complete ok.',c(h+1,f.id,"error")):c(h+1,f.id,"ok")},function(x){l.push({cellId:f.id,result:{ok:!1,error:x&&x.message?x.message:String(x)}}),d.ran+=1,d.ok=!1,d.failedCellId=f.id,d.error=x&&x.message?x.message:String(x),c(h+1,f.id,"error")});var m=o?{display:o(f.id)}:{};return n.runCell(f.id,m).then(function(x){l.push({cellId:f.id,result:x}),d.ran+=1,!x||!x.ok?(d.ok=!1,d.failedCellId=f.id,d.error=x&&x.error?x.error:'cell "'+f.id+'" did not complete ok.',c(h+1,f.id,"error")):c(h+1,f.id,"ok")},function(x){l.push({cellId:f.id,result:{ok:!1,error:x&&x.message?x.message:String(x)}}),d.ran+=1,d.ok=!1,d.failedCellId=f.id,d.error=x&&x.message?x.message:String(x),c(h+1,f.id,"error")})}})}),u.then(function(){return{total:i,ran:d.ran,ok:d.ok,failedCellId:d.failedCellId,error:d.error,results:l}})}_markConsumersStale(t,n){var r=this._consumersOfName.get(t);if(r){var i=this;r.forEach(function(o){if(o!==n){var s=i.cellState.get(o);s&&(s.status===Ir.OK||s.status===Ir.ERROR)&&i._setStatus(o,Ir.STALE)}})}}_findProducerCellId(t){for(var n=0;n<this._cells.length;n++){var r=this._cells[n];if(r.id&&Array.isArray(r.out)&&r.out.indexOf(t)!==-1)return r.id}return null}getCellState(t){return this.cellState.get(t)||null}getBinding(t){return this.bindings.get(t)||null}dispose(){this._disposed=!0,this.resetScope(),this.cellState.clear(),this._cellById.clear(),this._consumersOfName.clear(),this._cells=[]}}var Mg=Object.create(null);function VR(e){return typeof e=="string"&&e.length>0&&/^[a-z][a-z0-9-]*$/.test(e)}function Ak(e,t){if(!VR(e))throw new Error('[realm-registry] register: invalid realm name "'+String(e)+'" (expect lowercase-kebab, e.g. "frqtl"). (FAIL-LOUD.)');if(!t||typeof t.boot!="function")throw new Error('[realm-registry] register("'+e+'"): descriptor must have a boot(hostEl, transport) function. (FAIL-LOUD.)');Mg[e]=t}function qR(e){var t=Mg[e];if(!t)throw new Error('[realm-registry] get: no realm registered for "'+String(e)+'". Registered: ['+$R().join(", ")+"]. (Blessed realms register at import; a BYO realm must register() first.) (FAIL-LOUD.)");return t}function $R(){return Object.keys(Mg)}function cd(e,t){var n=t||"data-plane payload";if(typeof structuredClone!="function"){try{JSON.parse(JSON.stringify(e))}catch(r){throw new TypeError("[view-handle] "+n+" is not serializable (JSON fallback): "+(r&&r.message?r.message:String(r))+" (VETO-CLASS #1 — the data plane must be structured-clone-serializable so a marshalling host is not a fork.)")}return e}try{structuredClone(e)}catch(r){throw new TypeError("[view-handle] "+n+" is not structured-clone-serializable: "+(r&&r.message?r.message:String(r))+" (VETO-CLASS #1 — never pass a live object ref/function/DOM node across the handle data plane; a marshalling host cannot carry it.)")}return e}function cs(e,t){try{return Promise.resolve(e.apply(null,t))}catch(n){return Promise.reject(n)}}function Pk(e){if(!e||typeof e.inject!="function"||typeof e.call!="function"||typeof e.on!="function"||typeof e.dispose!="function")throw new Error("[view-handle] makeViewHandle requires an impl with inject/call/on/dispose (start/stop/step optional but recommended). (FAIL-LOUD.)");var t={transport:e._transport||"in-app",inject:function(n,r){if(typeof n!="string"||!n)return Promise.reject(new Error("[view-handle] inject: name must be a non-empty string."));try{cd(r,'inject("'+n+'") payload')}catch(i){return Promise.reject(i)}return cs(e.inject,[n,r])},call:function(n,r){return cs(e.call,[n,r])},on:function(n,r){if(typeof r!="function")throw new Error('[view-handle] on("'+String(n)+'"): cb must be a function.');var i=function(s){cd(s,'on("'+String(n)+'") event payload'),r(s)},o=e.on(n,i);return typeof o=="function"?o:function(){}},start:function(){return e.start?cs(e.start,[]):Promise.resolve()},stop:function(){return e.stop?cs(e.stop,[]):Promise.resolve()},step:function(){return e.step?cs(e.step,[]):Promise.resolve()},dispose:function(){return cs(e.dispose,[])}};return Object.freeze(t)}function KR(){var e=[];return{kind:"in-app",isInApp:function(){return!0},post:function(t){for(var n=0;n<e.length;n++)try{e[n](t)}catch{}},subscribe:function(t){if(typeof t!="function")throw new Error("[realm-transport:in-app] subscribe requires a function.");return e.push(t),function(){var n=e.indexOf(t);n!==-1&&e.splice(n,1)}}}}const YR=Object.freeze([Object.freeze({specifier:"@descix/frqtl-web/parts",libPath:"frqtl/parts/index.js",why:"the parts barrel",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/parts/",libPath:"frqtl/parts/",why:"one part = one file",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/shim/controls/registry.js",libPath:"shim/controls/registry.js",why:"knob registration (registerControls): a scene declares its own sliders and toggles",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/shim/render/sun-look.js",libPath:"shim/render/sun-look.js",why:"the one owner of the sun's FX bag (SunLook)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/display-slot.js",libPath:"frqtl/compat/renderer/display-slot.js",why:"the booted display name a dual-mode scene reads before its co-init call",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/orbit-bag.js",libPath:"frqtl/compat/renderer/orbit-bag.js",why:"hasAngularPose, THE 3D-ness predicate of a camera pose",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/_collisionMatrixLanes.js",libPath:"frqtl/objects/setup/_collisionMatrixLanes.js",why:"the one collision-lane table (density lanes of a collision scene)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/compat/engine.js",libPath:"frqtl/compat/engine.js",why:"the engine accessor (a scene that builds its frames by hand)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/kinds",libPath:"frqtl/objects/kinds-entry.js",why:"the kind registry: a composed fork registers its renamed class (registerKind, kindNamed, kindOf, registeredKinds)",tier:"scene"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/tagger.js",libPath:"frqtl/objects/objects/tagger.js",why:"imported by DetectorWall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/schema/index.js",libPath:"frqtl/objects/schema/index.js",why:"imported by DetectorWall, SlitScreen, Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/shim/render/heat-colormap.js",libPath:"shim/render/heat-colormap.js",why:"imported by GraphingDetectorWall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/schema/valueNormalizer.js",libPath:"frqtl/objects/schema/valueNormalizer.js",why:"imported by LiveChart, Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/Box.js",libPath:"frqtl/objects/objects/Box.js",why:"imported by OvenBox — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/QuantumEmitter.js",libPath:"frqtl/objects/objects/QuantumEmitter.js",why:"imported by OvenBox — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/shim/expr/ast-schema.js",libPath:"shim/expr/ast-schema.js",why:"imported by OvenBox, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/actionCompiler.js",libPath:"frqtl/objects/objects/actionCompiler.js",why:"imported by OvenBox, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/v1-replacements.js",libPath:"frqtl/objects/v1-replacements.js",why:"imported by SlitLightSource — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/slitLinerScatter.js",libPath:"frqtl/objects/objects/slitLinerScatter.js",why:"imported by SlitScreen, Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/setupSphereEmitter3D.js",libPath:"frqtl/objects/setup/setupSphereEmitter3D.js",why:"imported by SphereEmitter — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/directedRedirectProgram.js",libPath:"frqtl/objects/objects/directedRedirectProgram.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/compat/renderer/lo-drawn-center.js",libPath:"frqtl/compat/renderer/lo-drawn-center.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/setup/setupTunnelPointExit.js",libPath:"frqtl/objects/setup/setupTunnelPointExit.js",why:"imported by Tunnel — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/constants/WallBehaviors.js",libPath:"frqtl/objects/constants/WallBehaviors.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/objects/absorbRadiation.js",libPath:"frqtl/objects/objects/absorbRadiation.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"}),Object.freeze({specifier:"@descix/frqtl-web/objects/geometry/SlabFace.js",libPath:"frqtl/objects/geometry/SlabFace.js",why:"imported by Wall — a forked copy imports it",tier:"part-internal"})]),Mk=Object.freeze({specifier:"@descix/frqtl-web/boot",libPath:"frqtl/experiments/_shared/doors.js",why:"the scene doors (bootScene, bootProject)"}),GR=Object.freeze([Mk,Object.freeze({specifier:"@descix/frqtl-web/registry",libPath:"shim/registry/index.js",why:"the roster contract and its readers (normalizeRoster, sceneGroups, showcaseCard, showcaseHref), the roster loader (loadRoster), projectOf + emptyProjectOf, STUDIO's deep-link landing record"}),Object.freeze({specifier:"@descix/frqtl-web/project",libPath:"shim/project/index.js",why:"the specifier table, the link site, sketchProject and the project identity"}),Object.freeze({specifier:"@descix/frqtl-web/host-view",libPath:"shim/host/index.js",why:"the DeSciX host-view declarer: a page declares its own view"}),Object.freeze({specifier:"@descix/frqtl-web/site-graph",libPath:"shim/engine/site-graph.js",why:"the static site's shape: the graph directory, the build-stamp attribute, the build id pattern, the IDE entry page, the host-provided attribute"})]);function JR(e){if(/^(\/|\.\/|\.\.\/)/.test(e))return!0;try{return new URL(e),!0}catch{return!1}}function XR(e){if(typeof e!="string"||!e.endsWith("/"))throw new TypeError('[specifiers] importMapFor(libRootUrl): the lib-identity root URL as seen from the page, ending in "/" (got '+JSON.stringify(e)+"). (FAIL-LOUD.)");if(!JR(e))throw new TypeError("[specifiers] importMapFor(libRootUrl): "+JSON.stringify(e)+' is neither an absolute URL nor a path starting with "/", "./" or "../", so a browser reads every row built on it as a bare specifier and ignores it. Write it as '+JSON.stringify("./"+e)+" (relative to the page) or "+JSON.stringify("/"+e)+" (from the origin root). (FAIL-LOUD.)");const t={};for(const n of YR)t[n.specifier]=e+n.libPath;return{imports:t}}function QR(e){const t=XR(e);for(const n of GR)t.imports[n.specifier]=e+n.libPath;return t}var fh=Object.freeze({SEED:"seed",RENDERER:"renderer",ENGINE:"engine"}),Tk=Object.freeze([Object.freeze({key:fh.SEED,reader:"lib/frqtl/experiments/empty/index.html",forward:!0}),Object.freeze({key:fh.RENDERER,reader:"lib/frqtl/experiments/_shared/boot.js",forward:!0}),Object.freeze({key:fh.ENGINE,reader:"lib/frqtl/experiments/_shared/boot.js",forward:!1,why:"the host's own physics-engine selector (e.g. the GYM's Benchmark/Compare engine dropdown) is the SOLE authority for this axis; forwarding an outer ?engine= would let it silently override an explicit host choice, which is exactly the engine-sniffing-from-above-the-shim class of bug this codebase forbids elsewhere"})]),ZR=Object.freeze([Object.freeze({key:"chrome",appliedBy:"lib/frqtl/experiments/_shared/boot.js",forward:!1,acceptedValues:Object.freeze(["canvas"]),why:`chrome is a HOST-COMPOSITION decision (whether the experiment's own control chrome DOM renders), never a per-experiment physics/render parameter; forwarding it from an outer host URL into an embedded iframe would reintroduce the hidden-experiment-chrome bug (the GYM must always show the experiment's own full chrome, never chrome=canvas — see the "WHEN should a host set chrome=canvas" doc above for the general criterion, not just the GYM's specific answer to it)`})]),eL=Object.freeze(Tk.filter(function(e){return e.forward}).map(function(e){return e.key}));const Dk=/\b(TODO|TBD|FIXME|XXX|placeholder|lorem)\b/i,tL=/^(#|$)|example\.(com|org|net)|localhost|127\.0\.0\.1/i,Gp=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Zs(e,t){if(typeof e!="string"||e.trim()==="")throw new Error(t+" must be non-empty text (got "+JSON.stringify(e)+").");if(Dk.test(e))throw new Error(t+": placeholder text in shipped copy: "+JSON.stringify(e));return e}function nL(e,t){if(typeof e=="string"){Zs(e,t);return}if(!e||typeof e!="object"||typeof e.text!="string")throw new Error(t+": a segment is neither a string nor { text, href } (got "+JSON.stringify(e)+").");if(Zs(e.text,t),!Gp(e,"href")||e.href!==null&&typeof e.href!="string")throw new Error(t+": link segment "+JSON.stringify(e.text)+" must declare href as a URL or null (not-yet-known link), got "+JSON.stringify(e.href)+".");if(Gp(e,"em")&&e.em!==!0)throw new Error(t+": segment "+JSON.stringify(e.text)+" declares em as "+JSON.stringify(e.em)+" — em is true (emphasis) or absent.");if(typeof e.href=="string"&&(tL.test(e.href)||!/^https:\/\//.test(e.href)))throw new Error(t+": placeholder or non-https href "+JSON.stringify(e.href)+" — a link not yet known is declared null, never a stand-in URL.")}function Ik(e,t){if(typeof e=="string"){if(Dk.test(e))throw new Error(t+": placeholder text in shipped copy: "+JSON.stringify(e));return}e&&typeof e=="object"&&Object.keys(e).forEach(n=>Ik(e[n],t))}function Do(e,t,n){if(!n||typeof n.table!="boolean")throw new TypeError("copy-gate: assertCopyParagraphs("+t+") needs { table: true|false }.");if(!Array.isArray(e)||e.length===0)throw new Error(t+" must be a non-empty array of paragraphs (got "+JSON.stringify(e)+").");return e.forEach((r,i)=>{const o=t+" paragraph "+i;if(Array.isArray(r)){if(r.length===0)throw new Error(o+" is an empty segment array.");r.forEach(s=>nL(s,o));return}if(r&&typeof r=="object"&&Gp(r,"table")){if(!n.table)throw new Error(o+" is a table paragraph — a table is allowed only in a showcase intro (roster.js ROSTER_KEYS.intro); this copy is plain paragraphs.");Ik(r.table,o);return}throw new Error(o+" is neither a segment array nor a table paragraph (got "+JSON.stringify(r)+").")}),e}const at={compare:"compare",author:"author",ide:"ide",codec:"codec",bench:"bench"},rL=Object.freeze([at.author,at.compare]);function Fk(e){if(!Object.prototype.hasOwnProperty.call(at,e)||at[e]!==e)throw new Error("[presets] readsRoster(preset): "+JSON.stringify(e)+" is not a live preset — PRESETS: "+Object.keys(at).join(", ")+". (FAIL-LOUD.)");return rL.indexOf(e)!==-1}const Cb={notebooks:"ide",notebook:"ide",sim:"ide"};function iL(e){return e?Cb[e]?Cb[e]:at[e]?e:"ide":"ide"}const Nk=["bench"],jb=Object.freeze(["internal","public"]);function Zd(e){if(e===void 0)return"internal";if(jb.indexOf(e)===-1)throw new Error("[presets] unknown audience "+JSON.stringify(e)+" — AUDIENCES: "+jb.join(", ")+".");return e}function Tg(e){return Zd(e)==="internal"?Object.keys(at):Object.keys(at).filter(function(t){return Nk.indexOf(t)===-1})}function zk(e,t){var n=iL(e);return Zd(t)==="public"&&Nk.indexOf(n)!==-1?"ide":n}const oL=at.author;function sL(e,t){return zk(e===void 0?oL:e,t)}function Dg(e,t,n,r){var i=e+"/"+encodeURIComponent(t)+"/index.html?engine="+encodeURIComponent(n),o=new URLSearchParams(r||"");return eL.forEach(function(s){var a=o.get(s);a!==null&&a!==""&&(i+="&"+s+"="+encodeURIComponent(a))}),i}function aL(e,t){var n=ZR.filter(function(i){return i.key==="chrome"})[0];if(!n||!Array.isArray(n.acceptedValues))throw new Error('[presets] withHostChrome: lib/shim/page-params HOST_TOKENS has no "chrome" entry with acceptedValues — contract module out of date. (FAIL-LOUD.)');if(n.acceptedValues.indexOf(t)===-1)throw new Error("[presets] withHostChrome: invalid chrome token "+JSON.stringify(t)+" — accepted values: ["+n.acceptedValues.join(", ")+"]. (FAIL-LOUD.)");var r=typeof e=="string"&&e.indexOf("?")===-1?"?":"&";return e+r+"chrome="+encodeURIComponent(t)}const Al={ide:"FAT",compare:"Gym",bench:"Math Bench",author:"Studio",codec:"Rosetta"},lL="https://godsworld.ai",cL=null,uL=null,dL="https://github.com/Jolieabadir/workshop",hh="https://egpt.descix.net/prod/egpt/site/10_PAPERS/Address_Is_The_Map/Address_Is_The_Map.pdf",fL=null,ud=Object.freeze(["This is a work in development: developers are encouraged to contribute at the ",Object.freeze({text:"EGPT FRQTL SDK repo",href:cL}),", check out the ",Object.freeze({text:"GitHub issues",href:uL}),", and earn EGPT tokens for accepted PRs."]);function Ig(e){return"preset-"+e}function hL(e){return Zd(e)==="public"}function Nc(e,t){return Object.freeze({title:Al[e],seenKey:Ig(e),paragraphs:Object.freeze(t.map(Object.freeze).concat([ud]))})}const Fg=Object.freeze({compare:Nc("compare",[['GYM is a testing ground for new "sugar" objects. Think of FRQTL experiments like actual fractals: you can start a Koch Snowflake at iteration 0 and wait a long time to get to 1 million, or you can build composite sugar objects in FRQTL that start the emergent physics at later iterations by doing a statistical packaging of the earlier iterations into sugar objects (like 3DEmitter, which can be turned into a Laser, etc.). GYM is where you test your proposed sugar object.']]),author:Nc("author",[["STUDIO is the basis of the Tony Stark JARVIS-like interface that Maxi (",{text:"GodsWorld.ai",href:lL},") embodies."],["The designer explores 3D drag-and-drop as a human-machine interface and is a follow-up to ",{text:"Jolie's workshop repo",href:dL},"."]]),ide:Nc("ide",[['FAT provides a notebook programming environment in which both the FRQTL (frame and quantum language) non-algebraic language and the traditionally understood transform approach can be used by way of FAT, the "Faster Abadir Transform" (compare the fast Fourier transform).'],["FAT is built on an algebraic mathematical language, EGPT Math (compare Matlab, Mathematica, or Lean), but the native mathematical objects like EGPTReal are strictly constructive. That is, EGPT Math's EGPTReal is constructively bijective to standard mathematical Real numbers."]]),codec:Nc("codec",[[`ROSETTA is the mathematical formalization of the AS operator (not just AND, OR, and NOT) per Rota's "Barrier of Meaning" and Ulam's concept. At an intuitive level, "AS" is formalized in the concept of "`,{text:"The Address ",href:hh},{text:"is",href:hh,em:!0},{text:" The Map",href:hh},'", or the address ',{text:"as",href:null,em:!0}," the map. It is formalized in the canonical bijections of the EGPT number hierarchy to the Lean Standard types of Nat, Rat, Real and beth staircase, and also in the Lean translation bijections for N to GEMM and CNF, etc."],["ROSETTA is an exploration of a completely new approach to building transform codecs. In EGPT, which is bijectively equivalent to standard mathematics, ",{text:'there is no "proving"; there is only translating a mathematical object from one form to another',href:fL},"."],["The EGPT Lean proofs show bijective equivalence between a number N and GEMM, and CNF form, etc. With that in place, entirely new and exponentially more efficient approaches to LLMs are possible: for example, deterministic and lossless Strassen can be used at any floating-point precision, and all calculations can be kept on low-energy integer units in the CPU or deterministically reconstructibly parallelized on GPUs."]])});function pL(e){var t=Tg("public");t.forEach(function(n){if(!Object.prototype.hasOwnProperty.call(e,n))throw new Error('[presets] PRESET_EXPLAINERS has no explainer for public preset "'+n+'".')}),Object.keys(e).forEach(function(n){if(t.indexOf(n)===-1)throw new Error('[presets] PRESET_EXPLAINERS names "'+n+'", which is not a public preset ('+t.join(", ")+").");var r=e[n];if(r.title!==Al[n])throw new Error("[presets] PRESET_EXPLAINERS."+n+".title must be PRESET_LABELS."+n+".");if(r.seenKey!==Ig(n))throw new Error("[presets] PRESET_EXPLAINERS."+n+'.seenKey must be presetExplainerKey("'+n+'").');if(!Array.isArray(r.paragraphs)||r.paragraphs.length<2)throw new Error("[presets] PRESET_EXPLAINERS."+n+" needs its own copy followed by DEVELOPER_NOTICE.");var i=r.paragraphs.length-1;if(r.paragraphs[i]!==ud)throw new Error("[presets] PRESET_EXPLAINERS."+n+" must END with the shared DEVELOPER_NOTICE (by reference — a pasted copy drifts).");r.paragraphs.forEach(function(o,s){if(s!==i&&o===ud)throw new Error("[presets] PRESET_EXPLAINERS."+n+" repeats DEVELOPER_NOTICE.");if(!Array.isArray(o)||o.length===0)throw new Error("[presets] PRESET_EXPLAINERS."+n+": paragraph "+s+" is not a non-empty segment array.")}),Do(r.paragraphs,"[presets] PRESET_EXPLAINERS."+n,{table:!1})})}pL(Fg);const Jp=Object.freeze({desktop:Object.freeze([Object.freeze(["The controls, from the top: Run and Pause start and stop the scene, Restart builds it again from its first tick, and Rec records what you see as a video."]),Object.freeze(["The tools on the left: the Hand picks up an object and moves it, the Dropper places a new object from the Palette, and the Pencil lets you edit all of an object's settings."]),Object.freeze(["The camera: the sliders at the top left turn it and set its distance. In a 3D scene the MOVE and LOOK pads at the bottom steer it."])]),phone:Object.freeze([Object.freeze(["The controls at the top: Run and Pause start and stop the scene, Restart builds it again from its first tick, and Rec records what you see as a video."]),Object.freeze(["On the scene: drag one finger to turn a 3D scene, pinch to zoom, twist two fingers to roll it, drag two fingers to slide it, and double tap to put the camera back."]),Object.freeze(["HAND, at the bottom, picks up objects: with it on, one finger moves an object, and two fingers on it twist it or resize it. In a 3D scene the MOVE and LOOK pads on either side of it steer the camera."])])});Object.keys(Jp).forEach(function(e){Do(Jp[e],"[presets] STUDIO_CONTROLS."+e,{table:!1})});function mL(e,t){var n=Fg[e];if(!n)throw new Error('[presets] presetExplainerFor: "'+e+'" has no PRESET_EXPLAINERS row (public presets: '+Tg("public").join(", ")+").");if(!t||typeof t.onPhone!="boolean")throw new TypeError("[presets] presetExplainerFor(id, { onPhone }): onPhone is isMobileDevice(window) (lib/shim/host/device.js), a boolean (got "+JSON.stringify(t)+").");if(e!==at.author)return n;var r=n.paragraphs.slice(0,n.paragraphs.length-1);return Object.freeze({title:n.title,seenKey:n.seenKey,paragraphs:Object.freeze(r.concat(Jp[t.onPhone?"phone":"desktop"],[ud]))})}const gL="(pointer: coarse) and (max-width: 932px)";function Bk(e){if(!e||typeof e.matchMedia!="function")throw new TypeError("[device] isMobileDevice(win) needs the window the page is laid out in (a matchMedia function); got "+(e===null?"null":typeof e)+". (FAIL-LOUD.)");return e.matchMedia(gL).matches===!0}var Uk=null,Ng=null,dd=Object.freeze(["files","projects"]),vL=Object.freeze({files:'the project folder (lib/shim/storage/folders.js, namespace "project-folders") for a STUDIO save, the codec chain (lib/shim/storage/codec-chains.js, namespace "codec-chains") for a ROSETTA save',projects:'the project folder (lib/shim/storage/folders.js, namespace "project-folders")'});function la(e,t){if(typeof e!="string"||e.length===0)throw new Error("[StorageProvider] "+t+" is a non-empty string (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");if(e.indexOf("/")!==-1)throw new Error("[StorageProvider] "+t+" "+JSON.stringify(e)+' contains "/" — "/" is reserved in a storage key; name it without one. (FAIL-LOUD.)')}function yL(e){return Object.freeze({get:function(t,n){return e.get(t,n)},put:function(t,n,r){if(dd.indexOf(t)!==-1)throw new Error('[StorageProvider] a write into the retired namespace "'+t+'" (key '+JSON.stringify(n)+") is refused — that save format is retired; "+vL[t]+" replaced it. (FAIL-LOUD.)");return e.put(t,n,r)},delete:function(t,n){return e.delete(t,n)},list:function(t){return e.list(t)}})}var Rb=["get","put","delete","list"];function bL(e){if(!e||typeof e!="object")throw new Error("[StorageProvider] provider must be a non-null object; got "+typeof e);for(var t=0;t<Rb.length;t++){var n=Rb[t];if(typeof e[n]!="function")throw new Error('[StorageProvider] provider is missing required method "'+n+'"')}}function xL(e){bL(e),Uk=e,Ng=yL(e)}function gn(){if(!Uk)throw new Error("[StorageProvider] no active provider has been set. Call bootLocalStorage() (lib/shim/storage/boot.js) during app boot, or setActiveProvider(<provider>) for a non-browser driver.");return Ng}function wL(){return Ng}const Hk="explainers",Wk=Object.freeze([{id:"shown-first-visit",shows:!0,means:"storage answered and holds no seen record for this key: the card shows; Continue writes the record"},{id:"suppressed-seen",shows:!1,means:"storage holds a seen record for this key: the card does not show"},{id:"storage-unavailable-shown",shows:!0,means:"no storage provider, or the provider threw on read or on the Continue write: the card shows and nothing is remembered; data-run-once-detail names what failed"},{id:"not-offered-audience",shows:!1,notOffered:!0,means:"the host does not offer this card to its audience: nothing is read, written or shown; data-run-once-detail names the audience (recordRunOnceNotOffered)"},{id:"not-offered-no-roster-row",shows:!1,notOffered:!0,means:"the scene has no showcase-roster row, so it has no card: nothing is read, written or shown; data-run-once-detail names the scene (recordRunOnceNotOffered)"}].map(Object.freeze)),Vk=new Map(Wk.map(e=>[e.id,e]));function _L(){return{seenAt:new Date().toISOString()}}function Xp(e){return e&&e.message?String(e.message):String(e)}function Ts(e,t){const n=Vk.get(e);if(!n)throw new Error(`run-once-card: '${e}' is not a RUN_ONCE_OUTCOMES row`);return t===void 0?{row:e,shows:n.shows}:{row:e,shows:n.shows,detail:t}}function ef(e){if(typeof e!="string"||e==="")throw new TypeError(`run-once-card: seenKey must be a non-empty string (got ${JSON.stringify(e)})`)}async function qk(e){ef(e);let t;try{t=gn()}catch(r){return Ts("storage-unavailable-shown",`no storage provider: ${Xp(r)}`)}let n;try{n=await t.get(Hk,e)}catch(r){return Ts("storage-unavailable-shown",`read failed: ${Xp(r)}`)}return n==null?Ts("shown-first-visit"):Ts("suppressed-seen")}async function $k(e,t){if(ef(e),t.row==="storage-unavailable-shown")return t;try{await gn().put(Hk,e,_L())}catch(n){return Ts("storage-unavailable-shown",`write failed: ${Xp(n)}`)}return t}function Io(e,t,n){e.dataset.runOnceKey=t,e.dataset.runOnceOutcome=n.row,n.detail===void 0?delete e.dataset.runOnceDetail:e.dataset.runOnceDetail=n.detail}function zg(e){delete e.dataset.runOnceKey,delete e.dataset.runOnceOutcome,delete e.dataset.runOnceDetail}function fd(e,t){if(!e||!e.dataset||!e.ownerDocument)throw new TypeError("run-once-card: hostEl must be a DOM element");if(!t||typeof t!="object")throw new TypeError("run-once-card: spec bag required");if(ef(t.seenKey),typeof t.title!="string"||t.title==="")throw new TypeError(`run-once-card: title must be a non-empty string (${t.seenKey})`);if(!Array.isArray(t.paragraphs)||t.paragraphs.length===0)throw new TypeError(`run-once-card: paragraphs must be a non-empty array (${t.seenKey})`);if(t.paragraphs.forEach(n=>{if(n&&!Array.isArray(n)&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"table")){kL(n,t.seenKey);return}if(!Array.isArray(n))throw new TypeError(`run-once-card: a paragraph is neither a segment array nor { table } (${t.seenKey})`);n.forEach(r=>{if(typeof r!="string"&&(!r||typeof r.text!="string"||!Object.prototype.hasOwnProperty.call(r,"href")||r.href!==null&&typeof r.href!="string"||Object.prototype.hasOwnProperty.call(r,"em")&&r.em!==!0))throw new TypeError(`run-once-card: segment ${JSON.stringify(r)} is neither a string nor { text, href: string|null, em?: true } (${t.seenKey})`)})}),t.onContinue!==void 0&&typeof t.onContinue!="function")throw new TypeError(`run-once-card: onContinue must be a function when given (${t.seenKey})`);t.progress!==void 0&&SL(t.progress,t.seenKey)}function kL(e,t){const n=o=>{throw new TypeError(`run-once-card: table paragraph ${o} (${t})`)};Object.keys(e).length!==1&&n("has fields beside table: "+Object.keys(e).join(", "));const r=e.table;(!r||typeof r!="object"||Array.isArray(r))&&n("needs table: { caption, head, rows }");const i=Object.keys(r).filter(o=>o!=="caption"&&o!=="head"&&o!=="rows");i.length&&n("has unknown field(s) "+i.join(", ")+" — fields: caption, head, rows"),(typeof r.caption!="string"||r.caption.trim()==="")&&n("needs a non-empty caption"),(!Array.isArray(r.head)||r.head.length===0)&&n("needs a non-empty head"),(!Array.isArray(r.rows)||r.rows.length===0)&&n("needs a non-empty rows array"),r.head.forEach(o=>{typeof o!="string"&&n("head cell "+JSON.stringify(o)+" is not a string")}),r.rows.forEach((o,s)=>{(!Array.isArray(o)||o.length!==r.head.length)&&n("row "+s+" is not "+r.head.length+" cells long (the head's length)"),o.forEach(a=>{typeof a!="string"&&n("row "+s+" cell "+JSON.stringify(a)+" is not a string")})})}function SL(e,t){if(!e||typeof e!="object")throw new TypeError(`run-once-card: progress must be a { phases, current, subscribe } bag (${t})`);const{phases:n}=e;if(!Array.isArray(n)||n.length===0)throw new TypeError(`run-once-card: progress.phases must be a non-empty array (${t})`);const r=new Set;if(n.forEach(i=>{if(!i||typeof i.id!="string"||i.id===""||typeof i.means!="string"||r.has(i.id))throw new TypeError(`run-once-card: progress phase ${JSON.stringify(i)} is not a unique { id, means } (${t})`);r.add(i.id)}),typeof e.current!="function"||typeof e.subscribe!="function")throw new TypeError(`run-once-card: progress needs current() and subscribe(cb) functions (${t})`);Kk(e.current(),n)}function Kk(e,t){const n=t.map(i=>i.id),r=(i,o)=>{throw new Error(`run-once-card: progress ${o} '${i}' is not one of its phases — ${n.join(", ")}`)};if(!e||typeof e!="object")throw new TypeError("run-once-card: progress snapshot must be an object");return n.includes(e.phase)||r(e.phase,"phase"),e.failed!==null&&e.failed!==void 0&&!n.includes(e.failed)&&r(e.failed,"failed"),Object.keys(e.phases||{}).forEach(i=>{n.includes(i)||r(i,"phases key")}),e}function EL(e,t){const n=e.phases&&e.phases[t];return n?n.complete?1:n.total>0?Math.min(1,n.done/n.total):0:0}function OL({scrollHeight:e,clientHeight:t,scrollTop:n}){return e-t>1&&n+t<e-1}function CL(e,t){const n=e.createElement("div");n.dataset.runOnceProgress="",n.style.cssText="flex:none;margin:0 0 12px;";const r=e.createElement("div");r.style.cssText="display:flex;gap:3px;height:4px;";const i=new Map;t.phases.forEach(l=>{const c=e.createElement("div");c.dataset.bootPhase=l.id,c.title=l.means,c.style.cssText="flex:1 1 0;background:#262a33;border-radius:2px;overflow:hidden;";const u=e.createElement("div");u.style.cssText="height:100%;width:0%;background:#2d6cdf;",c.appendChild(u),r.appendChild(c),i.set(l.id,{seg:c,fill:u})});const o=e.createElement("div");o.dataset.runOnceProgressCaption="",o.style.cssText="margin-top:6px;font-size:12px;color:#8a919c;",n.appendChild(r),n.appendChild(o);function s(l){Kk(l,t.phases),t.phases.forEach(u=>{const d=EL(l,u.id),{seg:f,fill:h}=i.get(u.id);h.style.width=(d*100).toFixed(1)+"%",f.dataset.fill=String(d),l.failed===u.id&&(f.dataset.failed="",h.style.background="#b6161c",h.style.width="100%")});const c=t.phases.find(u=>u.id===(l.failed||l.phase));o.textContent=l.failed?`Failed: ${c.means}`:c.means,n.dataset.runOnceProgressPhase=l.failed||l.phase}s(t.current());const a=t.subscribe(s);if(typeof a!="function")throw new TypeError("run-once-card: progress.subscribe(cb) must return an unsubscribe function");return{el:n,unsubscribe:a}}function jL(e,t){const n=e.createElement("div");n.style.cssText="margin:0 0 12px;overflow-x:auto;";const r=e.createElement("table");r.dataset.runOnceTable="",r.style.cssText="border-collapse:collapse;width:100%;font-size:12px;line-height:1.4;";const i=e.createElement("caption");i.appendChild(e.createTextNode(t.caption)),i.style.cssText="caption-side:top;text-align:left;font-weight:700;margin:0 0 6px;color:#d8dbe0;",r.appendChild(i);const o=(c,u)=>{const d=e.createElement(c);return d.appendChild(e.createTextNode(u)),d.style.cssText="border:1px solid #2c313a;padding:4px 6px;text-align:left;vertical-align:top;"+(c==="th"?"color:#8fb8ff;font-weight:600;":""),d},s=e.createElement("thead"),a=e.createElement("tr");t.head.forEach(c=>a.appendChild(o("th",c))),s.appendChild(a),r.appendChild(s);const l=e.createElement("tbody");return t.rows.forEach(c=>{const u=e.createElement("tr");c.forEach(d=>u.appendChild(o("td",d))),l.appendChild(u)}),r.appendChild(l),n.appendChild(r),n}function Yk(e,t,n){for(;t.firstChild;)t.removeChild(t.firstChild);n.forEach(r=>{if(!Array.isArray(r)){t.appendChild(jL(e,r.table));return}const i=e.createElement("p");i.style.cssText="margin:0 0 12px;",r.forEach(o=>{if(typeof o=="string"){i.appendChild(e.createTextNode(o));return}let s=e.createTextNode(o.text);if(o.em===!0){const l=e.createElement("em");l.appendChild(s),s=l}if(o.href===null){i.appendChild(s);return}const a=e.createElement("a");a.href=o.href,a.target="_blank",a.rel="noopener noreferrer",a.appendChild(s),a.style.cssText="color:#7cc4ff;",i.appendChild(a)}),t.appendChild(i)})}function Gk(e,t,n,r,i){const o=e.ownerDocument,s=o.defaultView;if(!s||!s.ResizeObserver)throw new Error(`run-once-card: the host window has no ResizeObserver (the scroll cue re-measures on resize) (${t.seenKey})`);const a="run-once-title-"+t.seenKey,l=o.createElement("div");l.dataset.runOnceCard=t.seenKey,l.style.cssText=i===null?"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:12px;box-sizing:border-box;background:rgba(0,0,0,0.6);pointer-events:auto;":(i==="flow"?"position:relative;":"position:absolute;left:0;right:0;top:0;")+"display:flex;justify-content:center;padding:8px;box-sizing:border-box;pointer-events:none;";const c=o.createElement("div");c.setAttribute("role","dialog"),c.setAttribute("aria-modal",i===null?"true":"false"),c.setAttribute("aria-labelledby",a),c.style.cssText="box-sizing:border-box;width:100%;max-width:"+(i===null?"560px;max-height:100%;":"440px;max-height:45vh;pointer-events:auto;")+'overflow:hidden;display:flex;flex-direction:column;background:#15171c;color:#d8dbe0;border:1px solid #2c313a;border-radius:8px;padding:20px 22px 16px;box-shadow:0 12px 40px rgba(0,0,0,0.5);font:14px/1.55 system-ui,-apple-system,"Segoe UI",sans-serif;';const u=o.createElement("h2");u.id=a,u.textContent=t.title,u.style.cssText="margin:0 0 12px;font-size:13px;font-weight:700;letter-spacing:2px;text-transform:uppercase;color:#8fb8ff;flex:none;",c.appendChild(u);let d=null;t.progress&&(d=CL(o,t.progress),c.appendChild(d.el));const f=o.createElement("div");f.style.cssText="position:relative;flex:1 1 auto;min-height:0;display:flex;flex-direction:column;";const h=o.createElement("div");h.dataset.runOnceText="",h.style.cssText="flex:1 1 auto;min-height:0;overflow:auto;",h.tabIndex=0,f.appendChild(h);const v=o.createElement("div");v.dataset.runOnceScrollCue="",v.setAttribute("aria-hidden","true"),v.style.cssText="position:absolute;left:0;right:0;bottom:0;height:44px;box-sizing:border-box;padding-top:24px;text-align:center;font-size:12px;line-height:18px;color:#8a919c;pointer-events:none;background:linear-gradient(to bottom, rgba(21,23,28,0), #15171c 70%);",v.textContent="Scroll for more ↓",v.hidden=!0,f.appendChild(v),c.appendChild(f),Yk(o,h,t.paragraphs);const m=o.createElement("div");m.style.cssText="display:flex;justify-content:flex-end;margin-top:4px;flex:none;";const x=o.createElement("button");x.type="button",x.dataset.runOnceContinue="",x.textContent=n,x.style.cssText="background:#2d6cdf;color:#fff;border:0;border-radius:5px;padding:8px 18px;font:600 13px system-ui,sans-serif;cursor:pointer;",x.addEventListener("click",r),m.appendChild(x),c.appendChild(m),l.addEventListener("keydown",C=>{if(i!==null||C.key!=="Tab")return;const S=o.activeElement;!C.shiftKey&&S===x?(C.preventDefault(),h.focus({preventScroll:!0})):C.shiftKey&&S===h&&(C.preventDefault(),x.focus({preventScroll:!0}))}),l.appendChild(c),e.appendChild(l);const b=()=>{v.hidden=!OL({scrollHeight:h.scrollHeight,clientHeight:h.clientHeight,scrollTop:h.scrollTop})};b(),h.addEventListener("scroll",b,{passive:!0});const g=new s.ResizeObserver(b);g.observe(h);const k=d?d.unsubscribe:null;function E(){k&&k(),g.disconnect()}return{overlay:l,panel:c,body:h,row:m,continueBtn:x,teardown:E,measure:b}}function Us(e,t,n,r){if(!e||!e.dataset)throw new TypeError("run-once-card: hostEl must be a DOM element");ef(t);const i=Vk.get(n);if(!i||i.notOffered!==!0)throw new Error(`run-once-card: recordRunOnceNotOffered row ${JSON.stringify(n)} is not a not-offered row — `+Wk.filter(o=>o.notOffered).map(o=>o.id).join(", ")+".");if(typeof r!="string"||r==="")throw new TypeError(`run-once-card: recordRunOnceNotOffered needs a non-empty reason (${t})`);return Io(e,t,Ts(n,r)),{close(){zg(e)}}}const Qp=new Set;function Zp(e){for(let t=e;t;t=t.parentNode)if(t.inert===!0)return!0;return!1}const Lb=["covers"];function Jk(e,t,n){if(t===void 0)return{};if(!t||typeof t!="object")throw new TypeError(`run-once-card: options must be a { covers } bag when given (${n})`);const r=Object.keys(t).filter(o=>!Lb.includes(o));if(r.length)throw new TypeError(`run-once-card: unknown option(s) ${r.join(", ")} — options: ${Lb.join(", ")} (${n})`);const i=t.covers;if(i!==void 0){if(!i||i.ownerDocument!==e.ownerDocument||!("inert"in i))throw new TypeError(`run-once-card: covers must be an element of the host's document (${n})`);if(i===e||Xk(i,e))throw new Error(`run-once-card: covers contains the card's own host — the card would cover itself (${n})`)}return{covers:i}}function Xk(e,t){for(let n=t.parentNode;n;n=n.parentNode)if(n===e)return!0;return!1}function Qk(e,t,n,r){const i=e.ownerDocument,o=i.defaultView;if(n&&n.inert===!0)throw new Error(`run-once-card: '${t.seenKey}' covers an element that is already inert — one cover has one owner (another card, or the host, already holds it)`);let s=null,a=null,l=null;const c={seenKey:t.seenKey,doc:i,btn:null};function u(){a&&!Zp(a)&&a.focus({preventScroll:!0})}const d=()=>{o.setTimeout(u,0)};function f(){if(s===null)return;const v=i.activeElement===null||i.activeElement===i.body||Xk(s,i.activeElement);if(l&&(l(),l=null),s.parentNode&&s.parentNode.removeChild(s),n&&(n.inert=!1,o.removeEventListener("blur",d)),Qp.delete(c),s=null,a=null,v&&!LL(i)){const m=r.returnFocusTo;m&&m!==i.body&&m.isConnected!==!1&&typeof m.focus=="function"&&!Zp(m)&&m.focus({preventScroll:!0})}}const h=Gk(e,t,r.dismissLabel,r.onDismiss,null);return s=h.overlay,r.reopened&&(s.dataset.runOnceReopened=""),a=h.continueBtn,l=h.teardown,c.btn=a,Qp.add(c),n&&(n.inert=!0,o.addEventListener("blur",d)),u(),{remove:f,focus:u}}function Zk(e,t,n){const r=e.ownerDocument.defaultView;if(t&&(!r||typeof r.addEventListener!="function"))throw new Error(`run-once-card: covers needs the host document's window for the blur reclaim (${n})`)}function Pl(e,t,n){fd(e,t);const{covers:r}=Jk(e,n,t.seenKey);Zk(e,r,t.seenKey);let i=!1,o=null;return{ready:qk(t.seenKey).then(a=>i?a:a.shows?(o=Qk(e,t,r,{dismissLabel:"Continue",reopened:!1,returnFocusTo:null,onDismiss:()=>{o.remove(),$k(t.seenKey,a).then(l=>{i||Io(e,t.seenKey,l)}),t.onContinue&&t.onContinue()}}),Io(e,t.seenKey,a),a):(Io(e,t.seenKey,a),a)),close(){i=!0,o&&o.remove(),zg(e)},focus(){o&&o.focus()}}}function RL(e,t,n){fd(e,t);for(const s of["onContinue","progress"])if(t[s]!==void 0)throw new TypeError(`run-once-card: a reopened card gates nothing — '${s}' is refused (${t.seenKey})`);const{covers:r}=Jk(e,n,t.seenKey);Zk(e,r,t.seenKey);const i=e.ownerDocument;let o=null;return o=Qk(e,t,r,{dismissLabel:"Close",reopened:!0,returnFocusTo:i.activeElement,onDismiss:()=>{o.remove()}}),{close(){o.remove()},focus:o.focus}}function LL(e){const t=[...Qp].filter(n=>n.doc===e&&!Zp(n.btn));if(t.length>1)throw new Error("run-once-card: "+t.length+" cards show uncovered at once ("+t.map(n=>n.seenKey).join(", ")+") — a stacked card must cover the one beneath it");return t.length===1?(t[0].btn.focus({preventScroll:!0}),!0):!1}const Ab=Object.freeze(["top","flow"]),AL=4e3;function PL(e,t,n){fd(e,t);for(const m of["onContinue","progress"])if(t[m]!==void 0)throw new TypeError(`run-once-card: a task is ended by the act or by Skip — '${m}' is refused (${t.seenKey})`);const r=n&&typeof n=="object"?Object.keys(n).filter(m=>m!=="dock"):[];if(!n||typeof n!="object"||r.length||Ab.indexOf(n.dock)===-1)throw new TypeError(`run-once-card: openRunOnceTask options are { dock: ${Ab.join(" | ")} } (got ${JSON.stringify(n)}) (${t.seenKey})`);const i=e.ownerDocument,o=i.defaultView;let s=!1,a=null,l=null,c=!1,u=null,d=null;function f(){u!==null&&(o.clearTimeout(u),u=null),a!==null&&(a.teardown(),a.overlay.parentNode&&a.overlay.parentNode.removeChild(a.overlay),a=null,l=null)}function h(){return $k(t.seenKey,d).then(m=>(s||Io(e,t.seenKey,m),m))}return{ready:qk(t.seenKey).then(m=>(d=m,s?m:m.shows?(a=Gk(e,t,"Skip",()=>{const x=c;f(),x||h()},n.dock),a.overlay.dataset.runOnceTask="asked",l=i.createElement("div"),l.dataset.runOnceTaskStatus="",l.style.cssText="flex:none;margin:0 0 8px;font-size:13px;color:#9ad0a0;",l.hidden=!0,a.panel.insertBefore(l,a.row),Io(e,t.seenKey,m),m):(Io(e,t.seenKey,m),m))),status(m){if(typeof m!="string")throw new TypeError(`run-once-card: task status(text) takes a string (${t.seenKey})`);l===null||c||(l.textContent=m,l.hidden=m==="")},complete(m){if(a===null)throw new Error(`run-once-card: complete() on the task '${t.seenKey}', which is not showing (never shown, skipped or closed) — the host watches only a task that shows. (FAIL-LOUD.)`);return fd(e,{seenKey:t.seenKey,title:t.title,paragraphs:m}),c?Promise.resolve(d):(c=!0,Yk(i,a.body,m),a.measure(),l.hidden=!0,a.continueBtn.textContent="Close",a.overlay.dataset.runOnceTask="done",u=o.setTimeout(f,AL),h())},showing(){return a!==null},close(){s=!0,f(),zg(e)}}}var eS="frqtl";function ph(e,t){return eS+":"+e+":"+t}function ML(e){return eS+":"+e+":"}function mo(e,t){if(typeof e!="string"||e.length===0)throw new Error("[LocalStorageProvider] "+t+" must be a non-empty string; got: "+JSON.stringify(e));if(e.indexOf("/")!==-1)throw new Error("[LocalStorageProvider] "+t+' must not contain "/"; got: '+JSON.stringify(e))}class TL{constructor(){if(typeof window>"u"||typeof window.localStorage>"u"||window.localStorage===null)throw new Error("[LocalStorageProvider] window.localStorage is not available in this environment. Use a different StorageProvider (e.g. a server-backed RemoteStorageProvider) or ensure the page is served in a context where localStorage is permitted.");try{var t="__frqtl_storage_probe__";window.localStorage.setItem(t,"1"),window.localStorage.removeItem(t)}catch(n){throw new Error("[LocalStorageProvider] window.localStorage is present but write-blocked (private browsing with strict storage restrictions?). Error: "+(n&&n.message?n.message:String(n)))}this._ls=window.localStorage}get(t,n){mo(t,"namespace"),mo(n,"key");var r=this._ls.getItem(ph(t,n));if(r===null)return null;try{return JSON.parse(r)}catch(i){throw new Error('[LocalStorageProvider] stored value for "'+t+"/"+n+'" is not valid JSON. Storage may be corrupted. Error: '+(i&&i.message?i.message:String(i)))}}put(t,n,r){mo(t,"namespace"),mo(n,"key");var i;try{i=JSON.stringify(r)}catch(o){throw new Error('[LocalStorageProvider] value for "'+t+"/"+n+'" is not JSON-serialisable: '+(o&&o.message?o.message:String(o)))}try{this._ls.setItem(ph(t,n),i)}catch(o){throw new Error('[LocalStorageProvider] localStorage.setItem failed for "'+t+"/"+n+'" — storage may be full (QuotaExceededError) or blocked. Error: '+(o&&o.message?o.message:String(o)))}}delete(t,n){mo(t,"namespace"),mo(n,"key"),this._ls.removeItem(ph(t,n))}list(t){mo(t,"namespace");for(var n=ML(t),r=[],i=this._ls,o=i.length,s=0;s<o;s++){var a=i.key(s);if(a!==null&&a.indexOf(n)===0){var l=a.slice(n.length),c=i.getItem(a),u=null;try{u=JSON.parse(c)}catch(h){console.warn('[LocalStorageProvider] skipping malformed entry "'+a+'": '+(h&&h.message?h.message:String(h)));continue}var d={key:l};if(u!==null&&typeof u=="object"&&!Array.isArray(u))for(var f in u)Object.prototype.hasOwnProperty.call(u,f)&&f!=="key"&&(d[f]=u[f]);r.push(d)}}return r}}const DL=Object.freeze([{id:"installed",means:"a LocalStorageProvider was constructed and is now the active provider"},{id:"already-active",means:"a provider was already active (a host set its own, or boot ran before); left as is"},{id:"unavailable",means:"localStorage is absent or write-blocked: no provider is set; detail is the reason"}].map(Object.freeze));function IL(){if(wL())return{row:"already-active"};let e;try{e=new TL}catch(t){return{row:"unavailable",detail:t&&t.message?String(t.message):String(t)}}return xL(e),{row:"installed"}}const mh=Object.freeze({row:"data-storage-boot",detail:"data-storage-boot-detail"}),FL=new Set(DL.map(e=>e.id));function NL(e,t){if(!e||typeof e.setAttribute!="function"||typeof e.removeAttribute!="function")throw new TypeError("storage boot: recordStorageBoot needs a DOM element");if(!t||!FL.has(t.row))throw new Error("storage boot: "+JSON.stringify(t&&t.row)+" is not a STORAGE_BOOT_OUTCOMES row");e.setAttribute(mh.row,t.row),t.detail===void 0?e.removeAttribute(mh.detail):e.setAttribute(mh.detail,t.detail)}const vi=Object.freeze([Object.freeze({key:"preset",prop:"initialPreset"}),Object.freeze({key:"module",prop:"initialModule",surfaces:Object.freeze([at.codec]),remedy:"a saved STUDIO project is ?project=<name>"}),Object.freeze({key:"project",prop:"initialProject",surfaces:Object.freeze([at.author])}),Object.freeze({key:"notebook",prop:"initialNotebook",surfaces:Object.freeze([at.ide])}),Object.freeze({key:"walkthrough",prop:"initialWalkthrough",surfaces:Object.freeze([at.author,at.compare])}),Object.freeze({key:"mode",prop:"initialWalkthroughMode",surfaces:Object.freeze([at.author,at.compare])}),Object.freeze({key:"scene",prop:"initialScene",surfaces:Object.freeze([at.author])}),Object.freeze({key:"renderer",prop:"initialSceneRenderer",surfaces:Object.freeze([at.author])})]);var zL=Tk.map(function(e){return e.key});function tS(e,t){return zL.indexOf(e.key)!==-1&&e.surfaces.indexOf(t)===-1}const tf=Object.freeze([Object.freeze({key:"experiment",prop:"refusedExperiment",refusal:"?experiment= is gone: the experiment pages were deleted — a scene opens by ?walkthrough=<id> (a saved one by ?project=<name>)"})]);function BL(e){return tf.some(function(t){return t.prop===e})}function nS(e){var t=e instanceof URLSearchParams?e:new URLSearchParams(e||""),n={};return vi.concat(tf).forEach(function(r){var i=t.get(r.key);i&&(n[r.prop]=i)}),n}function UL(e){if(!e)return"";var t=vi.map(function(r){return r.key});Object.keys(e).forEach(function(r){if(t.indexOf(r)===-1)throw new Error('[deep-link] unknown deep-link key "'+r+'" — DEEP_LINK_PARAMS declares: ['+t.join(", ")+"].")});var n=new URLSearchParams;return vi.forEach(function(r){e[r.key]&&n.set(r.key,e[r.key])}),n.toString()}var rS=vi.filter(function(e){return e.key==="preset"})[0].prop;function hd(e,t){return sL(e?e[rS]:void 0,t)}function iS(e,t){var n=Object.assign({},e||{});return n[rS]=t,n}function gh(e){if(!e)return"";var t={};vi.forEach(function(r){t[r.prop]=r.key});var n={};return Object.keys(e).forEach(function(r){if(!BL(r)){if(!Object.prototype.hasOwnProperty.call(t,r))throw new Error('[deep-link] unknown deep-link prop "'+r+'" — DEEP_LINK_PARAMS declares: ['+Object.keys(t).join(", ")+"].");n[t[r]]=e[r]}}),UL(n)}function HL(e){var t=vi.concat(tf).map(function(r){return r.prop}),n={};return Object.keys(e||{}).forEach(function(r){if(t.indexOf(r)===-1)throw new Error('[deep-link] unknown FraqtlIde prop "'+r+'" — neither a named FraqtlIde prop nor a DEEP_LINK_PARAMS prop: ['+t.join(", ")+"].");e[r]&&(n[r]=e[r])}),n}function Ml(e){return vi.filter(function(t){return t.surfaces&&t.surfaces.indexOf(e)!==-1})}function oS(e){var t={};return Object.keys(at).forEach(function(n){var r={};Ml(at[n]).forEach(function(i){e&&e[i.prop]&&(r[i.prop]=e[i.prop])}),t[at[n]]=r}),t}function WL(e,t){if(!e)return null;var n=function(o){return(Al[o]||o)+" ("+o+")"},r=tf.filter(function(o){return e[o.prop]}).map(function(o){return o.refusal}),i=r.concat(vi.filter(function(o){return o.surfaces&&e[o.prop]&&o.surfaces.indexOf(t)===-1&&!tS(o,t)}).map(function(o){return o.key+'="'+e[o.prop]+'" is not a deep-link key of '+n(t)+" — it belongs to "+o.surfaces.map(n).join(", ")+(o.remedy?"; "+o.remedy:"")}));return i.length?"Deep link error: "+i.join(" · ")+".":null}function VL(e,t,n,r){var i=Ml(t).filter(function(a){return a.key===n})[0];if(!i)throw new Error('[deep-link] surface "'+t+'" has no deep-link key "'+n+'" — DEEP_LINK_PARAMS gives it: ['+Ml(t).map(function(a){return a.key}).join(", ")+"].");var o=Object.assign({},e&&e[t]||{});r?o[i.prop]=String(r):delete o[i.prop];var s=Object.assign({},e||{});return s[t]=o,s}function qL(e,t){var n=Ml(e);return Object.keys(t||{}).forEach(function(r){if(!n.some(function(i){return i.key===r}))throw new Error('[deep-link] surface "'+e+'" has no deep-link key "'+r+'" — DEEP_LINK_PARAMS gives it: ['+n.map(function(i){return i.key}).join(", ")+"].")}),n.map(function(r){var i=t&&t[r.key];return[r.key,i?String(i):""]})}function $L(e,t,n){var r=Ml(t).filter(function(a){return a.surfaces.indexOf(n)!==-1});if(!r.length)throw new Error('[deep-link] surfaces "'+t+'" and "'+n+'" share no deep-link key — DEEP_LINK_PARAMS gives no selection to hand off.');var i=e&&e[t]||{},o={};r.forEach(function(a){i[a.prop]&&(o[a.prop]=i[a.prop])});var s=Object.assign({},e||{});return s[n]=o,s}function KL(e,t,n){var r=new URLSearchParams(e instanceof URLSearchParams?e:String(e||"").replace(/^\?/,"")),i=gh(t);if(gh(Pb(nS(r),n))===gh(Pb(t,n)))return null;var o=hd(t,n);vi.forEach(function(a){a.surfaces&&tS(a,o)||r.delete(a.key)});var s=r.toString();return i+(i&&s?"&":"")+s}function Pb(e,t){var n=hd(e,t);return iS(oS(e)[n],n)}function il(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var vh=1,Mb=Object.freeze([{key:"version",normalize:function(e){if(e===void 0||e===vh)return vh;throw new Error("[render-state] renderState.version "+JSON.stringify(e)+" — this owner reads version "+vh+" only. (FAIL-LOUD.)")}},{key:"renderer",normalize:function(e){return typeof e=="string"&&e.length>0?e:null}},{key:"engine",normalize:function(e){return typeof e=="string"&&e.length>0?e:null}},{key:"seed",normalize:function(e){return e!=null&&e!==""?String(e):null}},{key:"backdropVisible",normalize:function(e){return typeof e=="boolean"?e:null}},{key:"camera",normalize:function(e){return il(e)?{orbit:il(e.orbit)?e.orbit:null,preset:typeof e.preset=="string"?e.preset:null}:null}},{key:"render",normalize:function(e){return Array.isArray(e)?e.filter(function(t){return il(t)&&typeof t.key=="string"&&t.key.length>0}):[]}}].map(Object.freeze));function yi(e){if(e!==null&&!il(e))throw new Error("[render-state] a renderState is a bag (a plain object) or null for none — got "+(e===void 0?"undefined":Array.isArray(e)?"an array":typeof e)+". (FAIL-LOUD.)");var t=e||{};if(Object.prototype.hasOwnProperty.call(t,"pageControls")){var n=Array.isArray(t.pageControls)?t.pageControls:[];throw new Error("[render-state] this saved project carries page controls (renderState.pageControls: "+(n.map(function(o){return il(o)?String(o.id):"?"}).join(", ")||"an empty list")+") — page controls are declared in the sketch's own code; move them into the sketch and save again. (FAIL-LOUD.)")}var r=Mb.map(function(o){return o.key});Object.keys(t).forEach(function(o){if(r.indexOf(o)===-1)throw new Error('[render-state] renderState has no key "'+o+'" — its keys (RENDER_STATE_KEYS): '+r.join(", ")+". (FAIL-LOUD.)")});var i={};return Mb.forEach(function(o){i[o.key]=o.normalize(t[o.key])}),i}function sS(e,t){if(typeof e!="string"||!t)return e;if(Object.prototype.hasOwnProperty.call(t,"egpt3D"))throw new Error("[render-state] applySavedUrlOverrides: `egpt3D` is DELETED — 3D-ness is the scene's co-init call (exp.createScene), and the display is `renderer` (three IS the 3D display). (FAIL-LOUD.)");var n=e.indexOf("?"),r=n===-1?e:e.slice(0,n),i=n===-1?"":e.slice(n+1),o=new URLSearchParams(i);t.renderer&&o.set("renderer",t.renderer),t.seed!==void 0&&t.seed!==null&&t.seed!==""&&o.set("seed",String(t.seed));var s=o.toString();return s?r+"?"+s:r}const em=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Bg=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),zc=e=>e.map(t=>typeof t=="string"?t:t.text).join("");function Ql(e){return e&&typeof e=="object"&&!Object.isFrozen(e)&&(Object.freeze(e),Object.keys(e).forEach(t=>Ql(e[t]))),e}const nf=e=>Ql(structuredClone(e));function Dt(e,t){throw new Error("[roster] "+e+" "+t+" (FAIL-LOUD.)")}function lr(e,t){return(typeof e!="string"||e.trim()==="")&&Dt(t,"must be non-empty text (got "+JSON.stringify(e)+")."),e}const ki=e=>(t,n,r)=>t===null?null:e(t,n,r),Si=(e,t)=>Zs(e,"[roster] "+t);function Tb(e,t){return Do([e],"[roster] "+t,{table:!1}),e.every(n=>typeof n=="string")||Dt(t,"is a plain paragraph: strings only (no links)."),nf(e)}function YL(e,t){return(!Bg(e)||Object.keys(e).length===0)&&Dt(t,"must be a non-empty setOrbit patch (got "+JSON.stringify(e)+")."),Object.keys(e).forEach(n=>{(typeof e[n]!="number"||!Number.isFinite(e[n]))&&Dt(t+"."+n,"must be a finite number (got "+String(e[n])+").")}),nf(e)}function GL(e,t){return(!Number.isInteger(e)||e<1)&&Dt(t,"must be an integer >= 1 (got "+JSON.stringify(e)+")."),e}function aS(e,t){Bg(e)||Dt(t,"must be a renderState bag (got "+JSON.stringify(e)+").");try{return Ql(yi(structuredClone(e)))}catch(n){throw new Error("[roster] "+t+": "+n.message)}}function JL(e,t){return aS(e,t),nf(e)}function XL(e,t){lr(e,t);let n=null;try{n=new URL(e)}catch{Dt(t,"must be an absolute origin such as https://host (got "+JSON.stringify(e)+").")}return(n.protocol!=="https:"&&n.protocol!=="http:"||n.origin!==e)&&Dt(t,"must be an absolute http(s) origin with no path and no trailing slash (got "+JSON.stringify(e)+"; its origin is "+JSON.stringify(n.origin)+")."),e}function QL(e,t){return Do(e,"[roster] "+t,{table:!0}),nf(e)}function ZL(e,t){if(typeof e!="string"||e==="")return"must be a relative URL ending .js (got "+JSON.stringify(e)+")";if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(e))return JSON.stringify(e)+" is absolute; a scene source is relative to the roster, so every scene sits under its directory";if(e[0]==="/"||e[0]==="\\")return JSON.stringify(e)+" starts with a slash; a scene source is relative to the roster's directory";if(e.split(/[/\\]/).indexOf("..")!==-1)return JSON.stringify(e)+` has a ".." segment; a scene source never leaves the roster's directory`;if(!/\.js$/.test(e))return JSON.stringify(e)+" does not end .js; a scene is one sketch file";const n=new URL("./",t).href,r=new URL(e,t);return r.href.indexOf(n)!==0||r.search||r.hash?JSON.stringify(e)+" resolves to "+r.href+", outside the roster's directory "+n:null}function eA(e,t,n){const r=ZL(e,n.href);return r&&Dt(t,r+"."),e}function qt(e,t,n,r){return Object.freeze(Object.assign({key:e,type:t,required:!0,default:void 0,child:null,many:!1,check:n},r))}function Yr(e,t,n,r){return Object.freeze({key:e,type:t,required:!1,default:Ql(n),child:null,many:!1,check:r})}function us(e,t,n,r,i){return Object.freeze({key:e,type:t+(r?"[]":" | null"),required:n,default:Ql(i),child:t,many:r,check:null})}const tA=Object.freeze({roster:Object.freeze([us("rows","scene",!0,!0,void 0),Yr("firstContact","scene id | null (null: the Empty Universe)",null,ki(lr)),us("showcase","showcase",!1,!1,null)]),scene:Object.freeze([qt("id","id (unique)",lr),qt("title","text",lr),qt("group","text",lr,{missing:"every scene names its group; the package owns no default group"}),qt("source","relative URL ending .js (no scheme, no leading /, no ..)",eA),Yr("prose","text | null",null,ki(lr)),Yr("renderState","renderState bag",yi({}),aS),us("modes","mode",!1,!0,[])]),mode:Object.freeze([qt("id","id (unique in its scene)",lr),qt("label","text",lr),Yr("renderState","renderState delta | null",null,ki(JL))]),showcase:Object.freeze([qt("group","text",lr),qt("siteOrigin","absolute http(s) origin, no path",XL),us("rows","card",!0,!0,void 0),us("intro","intro",!1,!1,null),Yr("invite","plain paragraph | null",null,ki(Tb)),Yr("throughLine","plain paragraph | null",null,ki(Tb))]),card:Object.freeze([qt("id","scene id",lr),Yr("mode","mode id | null (null: the scene's default mode)",null,ki(lr)),qt("title","copy text",Si),qt("tile","copy text",Si),qt("what","copy text",Si),qt("why","copy text",Si),qt("how","copy text",Si),Yr("controls","copy text | null",null,ki(Si)),us("still","still",!1,!1,null)]),still:Object.freeze([qt("tick","integer >= 1",GL),qt("alt","copy text",Si),Yr("pose","setOrbit patch | null",null,ki(YL))]),intro:Object.freeze([qt("seenKey","text",lr),qt("title","copy text",Si),qt("paragraphs","copy paragraphs (table paragraphs allowed)",QL)])}),yh=Object.freeze({roster:{href:"href is a load fact: pass it as normalizeRoster(json, href), never in the JSON"},scene:{is3D:"is3D is derived: walkthroughIs3D(roster, id, mode)",kind:"a scene has no kind",order:"the order is the array index"},card:{kind:"a card names its scene row by id; it has no kind",order:"the order is the array index",is3D:"is3D is derived: walkthroughIs3D(roster, id, mode)"},showcase:{app:"the app serving a site is the host's fact, not the roster's"}}),lS=new WeakSet,cS=new WeakMap;function tm(e,t,n,r){const i=tA[e],o=i.map(a=>a.key);Bg(t)||Dt(n,"is a "+e+": a JSON object (got "+JSON.stringify(t)+")."),Object.keys(t).forEach(a=>{if(o.indexOf(a)!==-1)return;const l=yh[e]&&em(yh[e],a)?yh[e][a]+". ":"";Dt(n,'has no key "'+a+'" — '+l+e+" keys (ROSTER_KEYS."+e+"): "+o.join(", ")+".")});const s={};return i.forEach(a=>{const l=n+"."+a.key;if(!em(t,a.key)){a.required&&Dt(n,'is missing required key "'+a.key+'" ('+a.type+")"+(a.missing?": "+a.missing:"")+" — "+e+" keys (ROSTER_KEYS."+e+"): "+o.join(", ")+"."),s[a.key]=a.default;return}const c=t[a.key];if(!a.child){s[a.key]=a.check(c,l,r);return}a.many?(Array.isArray(c)||Dt(l,"must be a list of "+a.child+" (got "+JSON.stringify(c)+")."),s[a.key]=Object.freeze(c.map((u,d)=>tm(a.child,u,l+"["+d+"]",r)))):s[a.key]=c===null?null:tm(a.child,c,l,r)}),Object.freeze(s)}function uS(e,t,n){const r=e.modes.map(o=>o.id),i=t??(r.length>0?r[0]:null);return i!==null&&r.indexOf(i)===-1&&Dt(n,'names mode "'+i+'" of scene "'+e.id+'", which declares ['+r.join(", ")+"]."),r.length>1?i:null}function nA(e,t){const n=Hg(t);if(n)throw new Error("[roster] normalizeRoster(json, href): "+n+" (FAIL-LOUD.)");const r=tm("roster",e,"roster",{href:t}),i=new Map;r.rows.forEach((a,l)=>{i.has(a.id)&&Dt("roster.rows["+l+"].id",'"'+a.id+'" is declared twice; a scene id is unique.'),i.set(a.id,a);const c=new Set;a.modes.forEach((u,d)=>{c.has(u.id)&&Dt("roster.rows["+l+"].modes["+d+"].id",'"'+u.id+'" is declared twice in scene "'+a.id+'".'),c.add(u.id)})}),r.firstContact!==null&&!i.has(r.firstContact)&&Dt("roster.firstContact",'"'+r.firstContact+'" is not a declared scene id — declared: ['+[...i.keys()].join(", ")+"].");let o=r.showcase;if(o!==null){const a=new Set,l=o.invite===null?null:zc(o.invite),c=o.intro===null?[]:o.intro.paragraphs;if(o.throughLine!==null){const d=zc(o.throughLine);c.forEach((f,h)=>{Array.isArray(f)&&zc(f).indexOf(d)!==-1&&Dt("roster.showcase.intro.paragraphs["+h+"]","pastes showcase.throughLine — the through-line has one place.")})}const u=o.rows.map((d,f)=>{const h="roster.showcase.rows["+f+"]",v=i.get(d.id);v||Dt(h+".id",'"'+d.id+'" is not a declared scene id — declared: ['+[...i.keys()].join(", ")+"].");const m=uS(v,d.mode,h+".mode"),x=d.id+":"+m;return a.has(x)&&Dt(h,"repeats the card "+x+"; a scene and mode have one card."),a.add(x),["what","why","how","controls"].forEach(b=>{const g=d[b];g!==null&&(l!==null&&g.indexOf(l)!==-1&&Dt(h+"."+b,"pastes showcase.invite — the card appends it by reference."),c.forEach((k,E)=>{Array.isArray(k)&&g.indexOf(zc(k))!==-1&&Dt(h+"."+b,"pastes showcase.intro paragraph "+E+" — the intro's text has one place.")}))}),Object.freeze(Object.assign({},d,{mode:m}))});o=Object.freeze(Object.assign({},o,{rows:Object.freeze(u)}))}const s=Object.freeze(Object.assign({},r,{showcase:o,href:t}));return lS.add(s),s.rows.forEach(a=>cS.set(a,s)),s}function Ug(e){return e===void 0?"undefined":typeof e=="string"?"the string "+JSON.stringify(e):e===null||typeof e!="object"?String(e):"an object that normalizeRoster did not return"}function Jt(e,t){if(!lS.has(e))throw new Error("[roster] "+t+" takes a roster bag first (normalizeRoster(json, href), or loadRoster from roster-link.js); got "+Ug(e)+". (FAIL-LOUD.)");return e}function rf(e,t,n){const r=cS.get(e);if(!r||r.rows.indexOf(e)===-1||n&&r!==n)throw new Error("[roster] "+t+" takes a scene row of "+(n?"that":"a normalized")+" roster bag (walkthroughById(roster, id)); got "+Ug(e)+". (FAIL-LOUD.)");return e}function rA(e,t,n){if(e.showcase===null||e.showcase.rows.indexOf(t)===-1)throw new Error("[roster] "+n+" takes a card of roster.showcase.rows from the same bag (exhibitFor(roster, scene)); got "+JSON.stringify(t&&{id:t.id,mode:t.mode})+". (FAIL-LOUD.)");return t}function Hg(e){if(typeof e!="string"||e==="")return"a roster href is an absolute URL string (got "+JSON.stringify(e)+").";let t=null;try{t=new URL(e)}catch{t=null}return t===null?"roster href "+JSON.stringify(e)+" is relative; it must be absolute (https://…): inside the DeSciX store shell (descix.net) a relative or root-relative href such as /assets/… resolves against the daita app, not this app's media.":t.protocol!=="https:"&&t.protocol!=="http:"&&t.protocol!=="file:"?"roster href "+JSON.stringify(e)+" has scheme "+t.protocol+"; a roster is read over http(s), or file: in node.":e.indexOf("?")!==-1||e.indexOf("#")!==-1?"roster href "+JSON.stringify(e)+" carries a query or a hash; a roster URL is a plain file URL.":null}function iA(e,t){return Jt(e,"sceneUrlOf(roster, row)"),rf(t,"sceneUrlOf(roster, row)",e),new URL(t.source,e.href).href}function Kt(e,t){Jt(e,"walkthroughById(roster, id)");for(let n=0;n<e.rows.length;n++)if(e.rows[n].id===t)return e.rows[n];return null}function Tl(e){return rf(e,"walkthroughModes(row)").modes}function Ro(e){const t=rf(e,"defaultWalkthroughModeId(row)").modes;return t.length>0?t[0].id:null}function Qi(e,t){const n=rf(e,"effectiveRenderState(row, modeId)").modes;let r=null;if(t==null)r=n.length>0?n[0]:null;else if(r=n.find(a=>a.id===t)||null,!r)throw new Error('[roster] scene "'+e.id+'" has no mode "'+t+'" — declared modes: ['+n.map(a=>a.id).join(", ")+"]. (FAIL-LOUD.)");const i=e.renderState,o=r&&r.renderState||{},s=Object.assign({},i,o);return s.render=i.render.concat(Array.isArray(o.render)?o.render:[]),yi(s)}function oA(e,t,n){Jt(e,"walkthroughIs3D(roster, id, modeId)");const r=Kt(e,t);return r===null?!1:Qi(r,n).renderer==="three"}function sA(e){return Jt(e,"firstContactOf(roster)"),e.firstContact===null?null:Kt(e,e.firstContact)}function dS(e){Jt(e,"sceneGroups(roster)");const t=[];e.showcase!==null&&t.push({label:e.showcase.group,rows:e.showcase.rows.map(r=>({id:r.id,title:r.title}))});const n=t.length;return e.rows.forEach(r=>{let i=t[t.length-1];(t.length===n||i.label!==r.group)&&(t.push({label:r.group,rows:[]}),i=t[t.length-1]),i.rows.push({id:r.id,title:r.title})}),t}const aA=Object.freeze([Object.freeze(["Move and Look: this scene is 3D. Drag the MOVE pad (bottom left) to walk the camera forward, back and sideways, and the LOOK pad (bottom right) to turn it. Both pads take a finger on a phone or the mouse on a desktop; on a keyboard, W/A/S/D move and the arrow keys look."])]);function fS(e,t,n){if(Jt(e,n),!t||typeof t!="object")throw new Error("[roster] "+n+" takes a scene { id, modeId? }; got "+Ug(t)+". (FAIL-LOUD.)");if(em(t,"kind"))throw new Error("[roster] "+n+": a scene has no kind — pass { id, modeId? }. (FAIL-LOUD.)");const r=Kt(e,t.id);if(!r)throw new Error("[roster] "+n+': "'+t.id+'" is not a declared scene — declared: ['+e.rows.map(i=>i.id).join(", ")+"]. (FAIL-LOUD.)");return uS(r,t.modeId,n+" modeId")}function hS(e,t){const n=fS(e,t,"exhibitFor(roster, scene)");return e.showcase===null?null:e.showcase.rows.find(r=>r.id===t.id&&r.mode===n)||null}function ea(e,t){const n=fS(e,t,"sceneKey(roster, scene)");return"scene-rung-"+t.id+(n?"-"+n:"")}function pS(e,t){Jt(e,"showcaseCard(roster, card)"),rA(e,t,"showcaseCard(roster, card)");const n=oA(e,t.id,t.mode);let r=["what","why","how"].map(i=>Object.freeze([t[i]]));return t.controls!==null&&(r=r.concat([Object.freeze([t.controls])])),n&&(r=r.concat(aA)),e.showcase.invite!==null&&(r=r.concat([e.showcase.invite])),Object.freeze({id:t.id,modeId:t.mode,seenKey:ea(e,{id:t.id,modeId:t.mode}),title:t.title,paragraphs:Object.freeze(r),is3D:n})}function mS(e){return Jt(e,"showcaseIntro(roster)"),e.showcase===null?null:e.showcase.intro}new TextEncoder;function ka(e){throw new Error("[identity] "+e+" (FAIL-LOUD.)")}function gS(e){e||ka("a project file has an empty path."),(e.startsWith("/")||/^[a-z][a-z0-9+.-]*:/i.test(e))&&ka('"'+e+'" is absolute — a project path is root-relative.'),e.startsWith("./")&&ka('"'+e+'" starts with "./" — a project path carries no leading "./".'),e.indexOf("\\")!==-1&&ka('"'+e+'" uses "\\" — a project path is "/"-separated.'),e.split("/").some(t=>t===""||t==="."||t==="..")&&ka('"'+e+'" has an empty, "." or ".." segment — a project path names one file under the root.')}const Ge="frqtl.json";function Qn(e){throw new Error("["+Ge+"] "+e+" (FAIL-LOUD.)")}function Db(){return pd.map(function(e){return e.key}).join(", ")}const pd=Object.freeze([Object.freeze({key:"name",type:"string",required:!0,rule:"a non-empty string — the project's name",check:function(e){e.length===0&&Qn(`"name" is empty — a project's name is a non-empty string.`)}}),Object.freeze({key:"kind",type:"string",required:!0,rule:'"scene" (a notebook project, "notebook", comes with P5)',check:function(e){e==="notebook"&&Qn('"kind": "notebook" — a notebook project comes with P5 (notebooks on projects); a project today is "kind": "scene".'),e!=="scene"&&Qn('"kind": '+JSON.stringify(e)+' is not a project kind — "scene", or "notebook" (P5).')}}),Object.freeze({key:"entry",type:"string",required:!0,rule:'a root-relative project path ending ".js" — the module whose default export is buildExperiment(exp)',check:function(e){try{gS(e)}catch(t){Qn('"entry": '+String(t&&t.message||t))}e.endsWith(".js")||Qn('"entry": '+JSON.stringify(e)+' does not end ".js" — the entry is the project module whose default export is buildExperiment(exp).')}}),Object.freeze({key:"version",type:"string",required:!1,rule:"the author's own string, never interpreted (optional)",check:function(){}})]);function Wg(e){(!e||typeof e!="object"||Array.isArray(e))&&Qn("a manifest is an object { "+Db()+" } (got "+(Array.isArray(e)?"an array":e===null?"null":typeof e)+").");const t=pd.map(function(i){return i.key}),n=Object.keys(e).filter(function(i){return t.indexOf(i)===-1});n.length&&Qn("unknown key"+(n.length>1?"s ":" ")+n.map(function(i){return JSON.stringify(i)}).join(", ")+" — a manifest holds exactly MANIFEST_KEYS (lib/shim/project/manifest.js): "+Db()+". How a host boots the folder (display, seed, camera, render rows) is its renderState, kept beside the folder.");const r={};for(const i of pd){const o=e[i.key];if(o===void 0){i.required&&Qn('"'+i.key+'" is REQUIRED — '+i.rule+".");continue}typeof o!==i.type&&Qn('"'+i.key+'" is '+(o===null?"null":typeof o)+" — "+i.rule+"."),i.check(o),r[i.key]=o}return Object.freeze(r)}function Zo(e){typeof e!="string"&&Qn("parseManifest(text): the text of "+Ge+" (got "+typeof e+").");let t;try{t=JSON.parse(e)}catch(n){Qn("is not valid JSON: "+String(n&&n.message||n)+".")}return Wg(t)}function Vg(e){return JSON.stringify(Wg(e),null,2)+`
|
|
71
|
-
`}function vS(e){(!e||typeof e!="object")&&Qn("manifestFor({ name, entry }) (got "+(e===null?"null":typeof e)+").");const t=Object.keys(e).filter(function(n){return n!=="name"&&n!=="entry"});return t.length&&Qn("manifestFor({ name, entry }) takes the name and the entry only (got "+t.join(", ")+') — a fresh project is kind "scene" with no version; any other bag goes through normalizeManifest.'),Wg({name:e.name,kind:"scene",entry:e.entry})}new URL("../../",import.meta.url).href;new TextDecoder("utf-8",{fatal:!0});function lA(e){throw new Error("[link] "+e+" (FAIL-LOUD.)")}function cA(e,t){return t?t.entry:(lA("entryOf: no entry — the project carries no "+Ge+' (manifest.js; manifestFor({ name, entry }) writes one) and no `entry` was given (a one-string sketch: { files: { "sketch.js": text }, entry: "sketch.js" }).'),e)}function $o(e,t){const n=e&&Object.prototype.hasOwnProperty.call(e,Ge);return cA(t,n?Zo(e[Ge]):null)}const Ib="sketch.js";function qg(e,t){return Promise.resolve().then(function(){if(typeof e!="string"||!e)throw new TypeError("readText(url): a URL string (got "+JSON.stringify(e)+")");if(e.indexOf("file:")===0){var n=typeof process<"u"&&process.getBuiltinModule?process.getBuiltinModule:null;if(typeof n!="function")throw new Error(e+" is a file: URL; reading one needs node's process.getBuiltinModule (Node 20.16+ / 22.3+). In a page, serve the package over http");var r=n("node:fs"),i=n("node:url").fileURLToPath;return r.promises.readFile(i(e),"utf8").catch(function(s){throw new Error("reading "+e+" failed: "+(s&&s.message))})}var o=t&&t.fetch||(typeof fetch=="function"?fetch:null);if(!o)throw new Error("no fetch available to load "+e);return Promise.resolve(o(e)).then(function(s){if(!s||!s.ok)throw new Error("GET "+e+" answered "+(s?s.status:"nothing"));return s.text()})})}const of="empty",Fb="experiments/_shared/empty-sketch.js",Bc="projectOf(roster, id, { fetch, mode })",Nb="emptyProjectOf({ router, fetch })";function yS(e,t,n){const r=e===void 0?{}:e;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("[scene-source] "+n+": options are an object (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");return Object.keys(r).forEach(i=>{if(t.indexOf(i)===-1)throw new Error("[scene-source] "+n+' has no option "'+i+'" — options: '+t.join(", ")+(i==="router"?"; a roster scene's URL is sceneUrlOf(roster, row), not a router path":"")+". (FAIL-LOUD.)")}),r}function bS(e,t,n,r,i){return qg(t,{fetch:r.fetch}).catch(o=>{throw new Error("[scene-source] "+n+" — "+(o&&o.message||o)+". (FAIL-LOUD.)")}).then(o=>{if(typeof o!="string"||!o.trim())throw new Error("[scene-source] "+n+" — "+t+" has an empty body. (FAIL-LOUD.)");const s=vS({name:e,entry:Ib}),a={};return a[Ge]=Vg(s),a[Ib]=o,{manifest:s,files:a,renderState:i}})}function md(e,t,n){return Promise.resolve().then(()=>{Jt(e,Bc);const r=yS(n,["fetch","mode"],Bc);if(typeof t!="string"||t==="")throw new Error("[scene-source] "+Bc+" takes a scene id string (got "+JSON.stringify(t)+"). (FAIL-LOUD.)");const i=Kt(e,t);if(!i)throw new Error("[scene-source] "+Bc+': "'+t+'" is not a declared scene — declared: ['+e.rows.map(s=>s.id).join(", ")+"]. (FAIL-LOUD.)");const o=Qi(i,r.mode);return bS(i.id,iA(e,i),'scene "'+i.id+'"',r,o)})}function xS(e){return Promise.resolve().then(()=>{const t=yS(e,["router","fetch"],Nb);if(!t.router||typeof t.router.resolve!="function")throw new Error("[scene-source] "+Nb+" needs the host's engineRouter (lib/shim/engine/router.js) to resolve "+Fb+". (FAIL-LOUD.)");const n=t.router.resolve(Fb);return bS(of,n,"the Empty Universe",t,yi({}))})}var zb=Object.freeze({roster:"roster",edited:"edited"});function Zl(e,t){if(typeof e!="string")throw new Error("[scene-buffer] "+t+" must be the scene text (a string), got "+typeof e+". (FAIL-LOUD.)");return e}function es(e){if(!e||typeof e.file!="string"||typeof e.text!="string"||!("override"in e))throw new Error("[scene-buffer] not a scene buffer — make one with seedBuffer(fileText). (FAIL-LOUD.)");return e}function sf(e,t,n){return Object.freeze({file:e,text:t,override:n})}function Dl(e){if(arguments.length>1)throw new Error("[scene-buffer] seedBuffer(fileText) takes the text only — the scene's text is its sketch file. (FAIL-LOUD.)");var t=Zl(e,"seedBuffer(fileText)");return sf(t,t,null)}function nm(e,t){return es(e),sf(e.file,Zl(t,"editBuffer(b, text)"),e.override)}function wS(e,t){es(e);var n=Zl(t,"runBuffer(b, text)");return sf(e.file,n,n===e.file?null:n)}var rm="Run your code edits first — the editor holds text the canvas has not run, and a hand edit is written into the code the canvas runs (the writer never merges a text edit).";function uA(e,t){es(e);var n=Zl(t,"adoptSketch(b, text)");if($g(e))throw new Error("[scene-buffer] adoptSketch: "+rm+" (FAIL-LOUD.)");return sf(e.file,n,n===e.file?null:n)}function _S(e){return e?es(e).override:null}function af(e){return es(e),e.override!==null?e.override:e.file}function dA(e){return _S(e)!==null?zb.edited:zb.roster}function $g(e){return es(e).text!==af(e)}function fA(e){return e?(es(e),e.override!==null||e.text!==e.file?"Open in STUDIO opens the roster scene file, not these edits — Reset to the file first (edits in this editor live for this session only).":null):null}function kS(e){var t=e&&typeof e.stack=="string"?e.stack:"",n=/(?:blob:|data:text\/javascript)[^\n]*?:(\d+):(\d+)\)?[ \t]*$/m.exec(t);return n?{line:Number(n[1]),col:Number(n[2])}:null}function lf(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("[scene-buffer] "+t+" takes the folder's files ({ path: text }). (FAIL-LOUD.)");return Object.keys(e).forEach(function(n){Zl(e[n],t+' — files["'+n+'"]')}),e}function xi(e){if(!e||typeof e.entry!="string"||typeof e.active!="string"||!e.files||typeof e.files!="object")throw new Error("[scene-buffer] not a project buffer — make one with seedProject(files). (FAIL-LOUD.)");return e}function ec(e,t,n){return Object.freeze({entry:e,active:t,files:Object.freeze(n)})}function Kg(e,t,n){if(!Object.prototype.hasOwnProperty.call(e.files,t))throw new Error("[scene-buffer] "+n+': "'+t+'" is not a file of this project (files: '+Object.keys(e.files).join(", ")+"). (FAIL-LOUD.)");return t}function ms(e){return!(e===Ge||/\.m?js$/.test(e))}function hA(e){lf(e,"seedProject(files)");var t=$o(e),n={};return Object.keys(e).forEach(function(r){n[r]=Dl(e[r])}),ec(t,t,n)}function SS(e){xi(e);function t(n){return n===e.entry?0:n===Ge?1:n.indexOf("parts/")===0?2:3}return Object.keys(e.files).sort(function(n,r){return t(n)-t(r)||(n<r?-1:n>r?1:0)})}function Dr(e){return xi(e).active}function Bb(e,t){return xi(e),ec(e.entry,Kg(e,t,"selectFile"),Object.assign({},e.files))}function Sa(e,t){return xi(e),e.files[Kg(e,t,"bufferOf")]}function Ub(e,t,n){if(xi(e),Kg(e,t,"editFile"),ms(t))throw new Error('[scene-buffer] editFile: "'+t+'" is read-only in the drawer (a module or '+Ge+" is editable). (FAIL-LOUD.)");var r=Object.assign({},e.files);return r[t]=nm(e.files[t],n),ec(e.entry,e.active,r)}function pA(e,t){xi(e),lf(t,"runProject(p, files)");var n={};Object.keys(t).forEach(function(i){n[i]=Object.prototype.hasOwnProperty.call(e.files,i)?wS(e.files[i],t[i]):Dl(t[i])});var r=$o(t);return ec(r,Object.prototype.hasOwnProperty.call(n,e.active)?e.active:r,n)}function ES(e,t){xi(e),lf(t,"adoptFiles(p, files)");var n=Object.assign({},e.files);return Object.keys(t).forEach(function(r){n[r]=Object.prototype.hasOwnProperty.call(e.files,r)?uA(e.files[r],t[r]):Dl(t[r])}),ec(e.entry,e.active,n)}function Hb(e,t){lf(t,"adoptWritten(p, files)");var n={};return Object.keys(t).forEach(function(r){r!==Ge&&(n[r]=t[r])}),ES(e,n)}function mA(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=af(e.files[n])}),t}function bh(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=e.files[n].text}),t}function Eu(e){return SS(e).filter(function(t){return $g(e.files[t])})}function xh(e){return Eu(e).length>0}const gA="modulepreload",vA=function(e,t){return new URL(e,t).href},Wb={},OS=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=vA(c,r),c in Wb)return;Wb[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let v=s.length-1;v>=0;v--){const m=s[v];if(m.href===c&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":gA,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((v,m)=>{h.addEventListener("load",v),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var CS=j.lazy(function(){return OS(()=>import("./SceneCodeEditor-BtUm1Vs8.js"),[],import.meta.url)});const tc=Object.freeze([{id:"modules",means:"Loading the scene objects"},{id:"engine-ready",means:"Starting the WASM engine"},{id:"renderer",means:"Loading the renderer"},{id:"sketch",means:"Building the scene"}].map(Object.freeze)),yA=Object.freeze(tc.map(e=>e.id)),ol="frqtl:boot-phase";function gd(e){const t=tc.find(n=>n.id===e);if(!t)throw new Error(`boot-phases: "${e}" is not a boot phase — ${yA.join(", ")}.`);return t}const bA=Object.freeze(tc.map(({id:e,means:t})=>Object.freeze({id:e,means:t}))),xA=tc[0].id;function im(){return{phase:xA,done:0,total:0,phases:{},failed:null}}function om(e){const t=e&&e.documentElement,n=t&&t.getAttribute("data-egpt-boot-progress");if(!n)return im();const r=JSON.parse(n),i=t.getAttribute("data-egpt-boot-phase");gd(i);const o=t.getAttribute("data-egpt-boot-failed")||null;o&&gd(o);const s=r[i]||{done:0,total:0};return{phase:i,done:s.done,total:s.total,phases:r,failed:o}}function Vb(e){return e.failed?"Failed: "+gd(e.failed).means:tc.every(n=>e.phases[n.id]&&e.phases[n.id].complete)?null:gd(e.phase).means}function qb(e){let t;try{t=e.contentDocument}catch(n){throw new Error("watchFrameBootPhases: the frame's document is not readable ("+n.message+") — the boot record is a same-origin contract.")}if(t===null)throw new Error("watchFrameBootPhases: frame.contentDocument is null — the frame is cross-origin or detached; the boot record is a same-origin contract.");return t}function wA(e){if(!e||typeof e.addEventListener!="function")throw new TypeError("watchFrameBootPhases(frameEl): frameEl must be an <iframe> element");let t=om(qb(e));const n=new Set,r=()=>{n.forEach(s=>s(t))};function i(s){t=s.detail,r()}function o(){t=om(qb(e)),r()}return e.addEventListener(ol,i),e.addEventListener("load",o),{phases:bA,current:()=>t,subscribe(s){if(typeof s!="function")throw new TypeError("watchFrameBootPhases: subscribe(cb) needs a function");return n.add(s),()=>{n.delete(s)}},close(){n.clear(),e.removeEventListener(ol,i),e.removeEventListener("load",o)}}}var Il="project-folders",wh=Object.freeze(["files","renderState"]),vd="index.html";function kr(e){throw new Error("[folders] "+e+" (FAIL-LOUD.)")}function _h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Zi(e){_h(e)||kr("a project folder row is { "+wh.join(", ")+" } (got "+(e===null?"null":Array.isArray(e)?"an array":typeof e)+").");var t=Object.keys(e).filter(function(o){return wh.indexOf(o)===-1});t.length&&kr("unknown key "+t.map(function(o){return JSON.stringify(o)}).join(", ")+" — a project folder row holds exactly FOLDER_ROW_KEYS (lib/shim/storage/folders.js): "+wh.join(", ")+".");var n=e.files;(!_h(n)||Object.keys(n).length===0)&&kr('"files" is the folder { path: text } with at least '+Ge+" (got "+(_h(n)?"an empty map":typeof n)+").");var r={};Object.keys(n).forEach(function(o){gS(o),o===vd&&kr('"'+vd+'" at the folder root is reserved — the Export generates it (the host page that carries the boot bag); a project folder never holds one.'),typeof n[o]!="string"&&kr('"'+o+'" is not text (got '+(n[o]instanceof Uint8Array?"bytes":typeof n[o])+") — a project folder holds text files only."),r[o]=n[o]}),typeof r[Ge]!="string"&&kr("the folder carries no "+Ge+" — a project folder is named and entered by its manifest (lib/shim/project/manifest.js manifestFor({ name, entry }) writes one).");var i=Zo(r[Ge]).name;return la(i,'a project folder name (frqtl.json "name")'),Object.freeze({files:Object.freeze(r),renderState:yi(e.renderState)})}function $b(e){return Zo(Zi(e).files[Ge]).name}function jS(e){return{files:Object.assign({},e.files),renderState:e.renderState}}function Kb(e,t){var n=Zi(t),r=Zo(n.files[Ge]).name;return e.put(Il,r,jS(n)),r}function sm(e,t,n){la(n,"a project folder name");var r=Zi(t);e.get(Il,n)!==null&&kr('a project named "'+n+'" is already saved — Save As takes a name no saved project has (choose another, or delete the saved one first).');var i=Object.assign({},r.files);i[Ge]=Vg(Object.assign({},Zo(r.files[Ge]),{name:n}));var o=Zi({files:i,renderState:r.renderState});return e.put(Il,n,jS(o)),n}function kh(e,t){la(t,"a project folder name");var n=e.get(Il,t);if(n==null)return null;var r;try{r=Zi(n)}catch(o){kr('the saved project "'+t+'" is not a project folder row: '+(o&&o.message||o))}var i=Zo(r.files[Ge]).name;return i!==t&&kr('the saved project under "'+t+'" names itself "'+i+'" in '+Ge+" — a folder is keyed by its manifest name."),r}function _A(e){return e.list(Il).map(function(t){return t.key}).sort().map(function(t){return{name:t}})}function kA(e){var t=[];return dd.forEach(function(n){e.list(n).forEach(function(r){t.push({namespace:n,key:r.key})})}),t}function SA(e,t){return Array.isArray(t)||kr("deleteRetiredSaves(provider, saves): saves is retiredSaves(provider)'s list."),t.forEach(function(n){(!n||dd.indexOf(n.namespace)===-1||typeof n.key!="string")&&kr("deleteRetiredSaves deletes only retired saves ({ namespace in ["+dd.join(", ")+"], key }) — got "+JSON.stringify(n)+".")}),t.forEach(function(n){e.delete(n.namespace,n.key)}),t.length}const sl=Object.freeze({parts:Object.freeze({path:"parts/index.js",name:null}),ObjectSchema:Object.freeze({path:"objects/schema/index.js",name:"ObjectSchema"}),ObjectFactory:Object.freeze({path:"objects/ObjectFactory.js",name:"ObjectFactory"}),MakeControlsForObject:Object.freeze({path:"objects/objects/makeControlsForObject.js",name:"MakeControlsForObject"}),MakeControlsForRenderSurface:Object.freeze({path:"objects/objects/makeControlsForRenderSurface.js",name:"MakeControlsForRenderSurface"}),ControlBind:Object.freeze({path:"objects/objects/controlBind.js",name:"ControlBind"}),FrqtlControlSlider:Object.freeze({path:"objects/objects/frqtl-control-slider.js",name:"FrqtlControlSlider"}),FrqtlControlWriteQueue:Object.freeze({path:"objects/objects/frqtl-control-write-queue.js",name:"FrqtlControlWriteQueue"}),FrqtlControlsPanel:Object.freeze({path:"parts/FrqtlControlsPanel.js",name:"FrqtlControlsPanel"}),CameraControls:Object.freeze({path:"parts/CameraControls.js",name:"CameraControls"}),Filters:Object.freeze({path:"compat/renderer/Filters.js",name:"Filters"}),OrbitBag:Object.freeze({path:"compat/renderer/orbit-bag.js",name:null}),LoDrawnCenter:Object.freeze({path:"compat/renderer/lo-drawn-center.js",name:null}),ShimRpc:Object.freeze({path:"shim/rpc/index.js",name:null}),ControlRegistry:Object.freeze({path:"shim/controls/registry.js",name:null}),RenderState:Object.freeze({path:"shim/render-state/apply.js",name:null})}),Yb=Object.keys(sl).map(function(e){return sl[e].path}),Ea=new WeakMap,RS=new WeakMap;function EA(e){if(!e||typeof e.resolve!="function")throw new TypeError("[frame-modules] a router (engineRouter() instance) is required — the frame's module URLs come from the ONE path authority. (FAIL-LOUD.)")}function OA(e,t,n){return new Promise(function(r,i){if(!e||!e.document)throw new TypeError("[frame-modules] frameImport(cw, …): cw is the frame's contentWindow. (FAIL-LOUD.)");if(Yb.indexOf(t)===-1)throw new Error('[frame-modules] "'+t+'" is not a frame module — the table is lib/features/ide/frame-modules.js FRAME_MODULES ('+Yb.join(", ")+"). (FAIL-LOUD.)");EA(n);const o=new URL(n.resolve(t),document.baseURI).href;let s;try{s=new e.Function("u","return import(u)")}catch(a){throw new Error("[frame-modules] the frame refused to evaluate its module-import door ("+(a&&a.message||a)+") — a content-security policy without 'unsafe-eval' blocks frameImport (lib/features/ide/frame-modules.js); this host cannot drive a frame's modules. (FAIL-LOUD.)")}r(s(o).catch(function(a){throw new Error("[frame-modules] the frame could not import "+t+" from "+o+" (frame "+e.location.href+"): "+(a&&a.message||a)+". (FAIL-LOUD.)")}))})}function CA(e,t){const n=e&&e.document;if(!n)return Promise.reject(new TypeError("[frame-modules] loadFrameModules(cw, router): cw is the frame's contentWindow. (FAIL-LOUD.)"));if(Ea.has(n))return Ea.get(n);const r=Object.keys(sl),i=Promise.all(r.map(function(o){return OA(e,sl[o].path,t)})).then(function(o){const s={};r.forEach(function(l,c){const u=sl[l],d=u.name===null?o[c]:o[c][u.name];if(d===void 0)throw new Error("[frame-modules] "+u.path+" exports no "+u.name+". (FAIL-LOUD.)");s[l]=d});const a=Object.freeze(s);return RS.set(n,a),a});return Ea.set(n,i),i.catch(function(){Ea.get(n)===i&&Ea.delete(n)}),i}function nc(e){const t=e&&e.document;return t&&RS.get(t)||null}function jA(e,t){if(!t||typeof t.envelopeOf!="function")throw new Error("[project-design] computeEntityBboxForDesign needs the live runner (its envelopeOf is the ONE envelope of a declared object). (FAIL-LOUD.)");var n=t.envelopeOf(e);return n?{left:Math.round(n.left),top:Math.round(n.top),width:Math.round(n.w),height:Math.round(n.h)}:null}function RA(e,t,n,r,i,o){if(arguments.length>6)throw new Error('[project-design] buildObject("'+e+`"): takes (kind, runner, cw, x, y, overrideProps) — a world size is not an argument; the builder reads runner.canvas_rect, written by the scene's exp.createCanvas(w, h, cfg) / exp.createScene(w, h, d, cfg). (FAIL-LOUD.)`);if(!t||!n)throw new Error('[project-design] buildObject("'+e+'"): '+(t?"no iframe scope (cw)":"no runner")+" — a palette drop needs the live runner and the canvas iframe window. (FAIL-LOUD.)");var s=nc(n);if(!s)throw new Error('[project-design] buildObject("'+e+`"): the frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs before a runner is taken. (FAIL-LOUD.)`);var a=s.ObjectFactory;return a.create(e,o,{runner:t,cw:n,x:r,y:i,fromPalette:!0})}const LA="data-frqtl-studio-landing",LS=Object.freeze([{id:"refused-key",runs:!1,means:"the link carries a key STUDIO does not own, or a deleted key (deep-link.js deepLinkRefusalOf): the refusal is on the deep-link strip and the opening scene opens"},{id:"conflict",runs:!1,means:"the link names more than one scene source (two of walkthrough, project and scene), or a renderer beside a walkthrough or a project, which carry their own: nothing opens"},{id:"mode-without-walkthrough",runs:!1,means:"the link names a mode and no walkthrough: nothing opens"},{id:"renderer-without-scene",runs:!1,means:"the link names a renderer and no scene; a renderer is chosen only for a scene link: nothing opens"},{id:"unknown-walkthrough",runs:!1,means:"the linked walkthrough is not a scene of the loaded roster (walkthroughById(roster, id)): nothing opens"},{id:"unknown-mode",runs:!1,means:"the linked mode is not one the linked scene declares (walkthroughModes): nothing opens"},{id:"scene-refused-origin",runs:!1,means:"the linked scene URL is on neither the page's origin nor the roster's (roster-link.js sceneOriginRefusalOf): the strip names the rule and both origins; nothing opens"},{id:"scene-unreadable",runs:!1,means:"the linked scene URL is allowed but its read failed (a non-200, an empty body, or not a .js sketch): nothing opens"},{id:"project-unreadable",runs:!1,means:"the linked saved project is present but its folder is refused by the load: nothing opens"},{id:"project-not-found",runs:!1,means:"no saved project of the linked name in this browser: nothing opens"},{id:"ok",runs:!0,means:"the linked walkthrough (in the linked mode, else its default), saved project or scene resolved and was handed to STUDIO's selection path; the scene starts on load"},{id:"first-contact",runs:!1,means:"no STUDIO deep link: the roster's first-contact scene (firstContactOf(roster)) opens"},{id:"first-contact-empty",runs:!1,means:"no STUDIO deep link and the roster declares no first contact: the Empty Universe opens"}].map(Object.freeze)),Gb=new Set(LS.map(e=>e.id));function AS(e,t){if(!Gb.has(t))throw new Error("[studio-landing] '"+t+"' is not a STUDIO_LANDING_OUTCOMES row — declared: ["+[...Gb].join(", ")+"]. (FAIL-LOUD.)");return e&&e.setAttribute(LA,t),t}const PS="frqtl-roster",AA=3e5,Sh='<link rel="'+PS+'" href="https://…">';function PA(e){if(!e||typeof e.querySelectorAll!="function")throw new Error("[roster-link] rosterHrefOf(doc) takes a document; got "+String(e)+". (FAIL-LOUD.)");const t=Array.from(e.querySelectorAll('link[rel~="'+PS+'"]'));if(t.length===0)throw new Error("[roster-link] this document has no "+Sh+" — STUDIO and the GYM read their scene list from the roster it names; the host writes the link into the page. (FAIL-LOUD.)");if(t.length>1)throw new Error("[roster-link] this document has "+t.length+" "+Sh+" links; a document names exactly one roster. (FAIL-LOUD.)");const n=t[0].getAttribute("href"),r=Hg(n);if(r)throw new Error("[roster-link] "+Sh+": "+r+" (FAIL-LOUD.)");return n}function MA(e,t){const n=Hg(e);if(n)throw new Error("[roster-link] rosterRequestUrl(href, now): "+n+" (FAIL-LOUD.)");if(!Number.isFinite(t))throw new Error("[roster-link] rosterRequestUrl(href, now): now is epoch milliseconds (got "+String(t)+"). (FAIL-LOUD.)");return new URL(e).protocol==="file:"?e:e+"?b="+Math.floor(t/AA)}function TA(e,t){return Promise.resolve().then(()=>{const n=t||{},r=MA(e,n.now===void 0?Date.now():n.now);return qg(r,{fetch:n.fetch}).then(i=>{if(i.trim()==="")throw new Error("[roster-link] roster "+r+" is empty. (FAIL-LOUD.)");let o=null;try{o=JSON.parse(i)}catch(s){throw new Error("[roster-link] roster "+r+" is not JSON: "+s.message+" (FAIL-LOUD.)")}return nA(o,e)},i=>{throw new Error("[roster-link] loading the roster failed: "+i.message+" (FAIL-LOUD.)")})})}function DA(e,t){const n=t||{};if(Jt(n.roster,"sceneOriginRefusalOf(url, { pageOrigin, roster })"),typeof n.pageOrigin!="string"||n.pageOrigin==="")throw new Error("[roster-link] sceneOriginRefusalOf(url, { pageOrigin, roster }): pageOrigin is the page's location.origin (got "+JSON.stringify(n.pageOrigin)+"). (FAIL-LOUD.)");const r=new URL(n.roster.href).origin;let i=null;try{i=new URL(e).origin}catch{i=null}return i!==null&&i!=="null"&&(i===n.pageOrigin||i===r)?null:"a scene opens from this page's origin ("+n.pageOrigin+") or its roster's origin ("+r+"); "+JSON.stringify(e)+" is "+(i===null?"not an absolute URL":"on "+i)+"."}var IA=new TextEncoder,FA=new TextDecoder;function am(e){return IA.encode(e==null?"":String(e))}function NA(e){return FA.decode(e)}var zA=function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e}();function MS(e){for(var t=4294967295,n=0;n<e.length;n++)t=t>>>8^zA[(t^e[n])&255];return(t^4294967295)>>>0}function Ot(e){return[e&255,e>>>8&255]}function Kn(e){return e=e>>>0,[e&255,e>>>8&255,e>>>16&255,e>>>24&255]}function ds(e){var t=0,n;for(n=0;n<e.length;n++)t+=e[n].length;var r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++)r.set(e[n],i),i+=e[n].length;return r}function go(e,t){return e[t]|e[t+1]<<8}function vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var TS=67324752,DS=33639248,IS=101010256;function BA(e){if(!Array.isArray(e))throw new Error("[bundle/zip] zipStore(entries): entries must be an array.");for(var t=[],n=[],r=0,i=0;i<e.length;i++){var o=e[i];if(!o||typeof o.name!="string"||!(o.bytes instanceof Uint8Array))throw new Error("[bundle/zip] zipStore: entry "+i+" must be {name:string, bytes:Uint8Array}.");var s=am(o.name),a=o.bytes,l=MS(a),c=a.length,u=ds([new Uint8Array(Kn(TS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),s,a]);t.push(u);var d=ds([new Uint8Array(Kn(DS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(0)),new Uint8Array(Kn(r)),s]);n.push(d),r+=u.length}var f=ds(t),h=ds(n),v=ds([new Uint8Array(Kn(IS)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(e.length)),new Uint8Array(Ot(e.length)),new Uint8Array(Kn(h.length)),new Uint8Array(Kn(f.length)),new Uint8Array(Ot(0))]);return ds([f,h,v])}function UA(e){if(!(e instanceof Uint8Array))throw new Error("[bundle/zip] unzipStore(bytes): bytes must be a Uint8Array.");for(var t=-1,n=e.length-22;n>=0;n--)if(vo(e,n)===IS){t=n;break}if(t===-1)throw new Error("[bundle/zip] unzipStore: End Of Central Directory record not found (not a ZIP).");for(var r=go(e,t+10),i=vo(e,t+16),o=[],s=i,a=0;a<r;a++){if(vo(e,s)!==DS)throw new Error("[bundle/zip] unzipStore: bad central directory signature at record "+a+".");var l=go(e,s+10),c=vo(e,s+16),u=vo(e,s+20),d=go(e,s+28),f=go(e,s+30),h=go(e,s+32),v=vo(e,s+42),m=NA(e.subarray(s+46,s+46+d));if(l!==0)throw new Error('[bundle/zip] unzipStore: entry "'+m+'" uses compression method '+l+" — this reader is STORE-only (method 0).");if(vo(e,v)!==TS)throw new Error('[bundle/zip] unzipStore: bad local header signature for "'+m+'".');var x=go(e,v+26),b=go(e,v+28),g=v+30+x+b,k=e.slice(g,g+u),E=MS(k);if(E!==c)throw new Error('[bundle/zip] unzipStore: CRC-32 mismatch for "'+m+'" (stored '+c+", computed "+E+").");o.push({name:m,bytes:k}),s+=46+d+f+h}return o}var Yg="frqtl-boot",Ou='<script type="application/json" id="'+Yg+'">',FS="<\/script>";function HA(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Jb(e){return JSON.stringify(e??null).replace(/</g,"\\u003c")}function WA(e){if(e=e||{},typeof e.sdkVersion!="string"||e.sdkVersion.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.sdkVersion is REQUIRED (the CDN pin). (FAIL-LOUD.)");if(typeof e.name!="string"||e.name.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.name is the project's frqtl.json name. (FAIL-LOUD.)");var t=Jb(QR(Ok(e.sdkVersion)+"/"));return["<!DOCTYPE html>",'<html lang="en">',"<head>",' <meta charset="UTF-8">',' <meta name="viewport" content="width=device-width, initial-scale=1">'," <title>"+HA(e.name)+" — FRQTL</title>"," <style>"," html,body{margin:0;height:100%;background:#0b0b0f;color:#ddd;"," font:14px/1.5 ui-sans-serif,system-ui,sans-serif;}"," #frqtl-mount{position:relative;width:100vw;height:100vh;}"," #frqtl-err{position:absolute;inset:0;padding:16px;white-space:pre-wrap;"," font:12px/1.5 ui-monospace,Menlo,Consolas,monospace;color:#ff6b6b;"," background:#1a0000;display:none;overflow:auto;}"," </style>","</head>","<body>",' <div id="frqtl-mount"></div>',' <pre id="frqtl-err"></pre>'," "+Ou+Jb(e.renderState)+FS,' <script type="importmap">'+t+"<\/script>",' <script type="module">'," import { bootProject } from "+JSON.stringify(Mk.specifier)+";"," const renderState = JSON.parse(document.getElementById("+JSON.stringify(Yg)+").textContent);",' const mount = document.getElementById("frqtl-mount");',' const errBox = document.getElementById("frqtl-err");'," function fail(title, detail){",' errBox.style.display = "block";',' errBox.textContent = title + "\\n\\n" + detail;'," }",' if (location.protocol === "file:") {',' fail("Serve this folder over http", "e.g. `npx serve` — a file:// page cannot fetch the project files.");'," } else {",' bootProject(mount, { url: new URL("./", location.href).href }, { renderState: renderState })',' .catch((e) => fail("FRQTL project boot failed", String(e && e.stack || e)));'," }"," <\/script>","</body>","</html>",""].join(`
|
|
71
|
+
`}function vS(e){(!e||typeof e!="object")&&Qn("manifestFor({ name, entry }) (got "+(e===null?"null":typeof e)+").");const t=Object.keys(e).filter(function(n){return n!=="name"&&n!=="entry"});return t.length&&Qn("manifestFor({ name, entry }) takes the name and the entry only (got "+t.join(", ")+') — a fresh project is kind "scene" with no version; any other bag goes through normalizeManifest.'),Wg({name:e.name,kind:"scene",entry:e.entry})}new URL("../../",import.meta.url).href;new TextDecoder("utf-8",{fatal:!0});function lA(e){throw new Error("[link] "+e+" (FAIL-LOUD.)")}function cA(e,t){return t?t.entry:(lA("entryOf: no entry — the project carries no "+Ge+' (manifest.js; manifestFor({ name, entry }) writes one) and no `entry` was given (a one-string sketch: { files: { "sketch.js": text }, entry: "sketch.js" }).'),e)}function $o(e,t){const n=e&&Object.prototype.hasOwnProperty.call(e,Ge);return cA(t,n?Zo(e[Ge]):null)}const Ib="sketch.js";function qg(e,t){return Promise.resolve().then(function(){if(typeof e!="string"||!e)throw new TypeError("readText(url): a URL string (got "+JSON.stringify(e)+")");if(e.indexOf("file:")===0){var n=typeof process<"u"&&process.getBuiltinModule?process.getBuiltinModule:null;if(typeof n!="function")throw new Error(e+" is a file: URL; reading one needs node's process.getBuiltinModule (Node 20.16+ / 22.3+). In a page, serve the package over http");var r=n("node:fs"),i=n("node:url").fileURLToPath;return r.promises.readFile(i(e),"utf8").catch(function(s){throw new Error("reading "+e+" failed: "+(s&&s.message))})}var o=t&&t.fetch||(typeof fetch=="function"?fetch:null);if(!o)throw new Error("no fetch available to load "+e);return Promise.resolve(o(e)).then(function(s){if(!s||!s.ok)throw new Error("GET "+e+" answered "+(s?s.status:"nothing"));return s.text()})})}const of="empty",Fb="experiments/_shared/empty-sketch.js",Bc="projectOf(roster, id, { fetch, mode })",Nb="emptyProjectOf({ router, fetch })";function yS(e,t,n){const r=e===void 0?{}:e;if(r===null||typeof r!="object"||Array.isArray(r))throw new Error("[scene-source] "+n+": options are an object (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");return Object.keys(r).forEach(i=>{if(t.indexOf(i)===-1)throw new Error("[scene-source] "+n+' has no option "'+i+'" — options: '+t.join(", ")+(i==="router"?"; a roster scene's URL is sceneUrlOf(roster, row), not a router path":"")+". (FAIL-LOUD.)")}),r}function bS(e,t,n,r,i){return qg(t,{fetch:r.fetch}).catch(o=>{throw new Error("[scene-source] "+n+" — "+(o&&o.message||o)+". (FAIL-LOUD.)")}).then(o=>{if(typeof o!="string"||!o.trim())throw new Error("[scene-source] "+n+" — "+t+" has an empty body. (FAIL-LOUD.)");const s=vS({name:e,entry:Ib}),a={};return a[Ge]=Vg(s),a[Ib]=o,{manifest:s,files:a,renderState:i}})}function md(e,t,n){return Promise.resolve().then(()=>{Jt(e,Bc);const r=yS(n,["fetch","mode"],Bc);if(typeof t!="string"||t==="")throw new Error("[scene-source] "+Bc+" takes a scene id string (got "+JSON.stringify(t)+"). (FAIL-LOUD.)");const i=Kt(e,t);if(!i)throw new Error("[scene-source] "+Bc+': "'+t+'" is not a declared scene — declared: ['+e.rows.map(s=>s.id).join(", ")+"]. (FAIL-LOUD.)");const o=Qi(i,r.mode);return bS(i.id,iA(e,i),'scene "'+i.id+'"',r,o)})}function xS(e){return Promise.resolve().then(()=>{const t=yS(e,["router","fetch"],Nb);if(!t.router||typeof t.router.resolve!="function")throw new Error("[scene-source] "+Nb+" needs the host's engineRouter (lib/shim/engine/router.js) to resolve "+Fb+". (FAIL-LOUD.)");const n=t.router.resolve(Fb);return bS(of,n,"the Empty Universe",t,yi({}))})}var zb=Object.freeze({roster:"roster",edited:"edited"});function Zl(e,t){if(typeof e!="string")throw new Error("[scene-buffer] "+t+" must be the scene text (a string), got "+typeof e+". (FAIL-LOUD.)");return e}function es(e){if(!e||typeof e.file!="string"||typeof e.text!="string"||!("override"in e))throw new Error("[scene-buffer] not a scene buffer — make one with seedBuffer(fileText). (FAIL-LOUD.)");return e}function sf(e,t,n){return Object.freeze({file:e,text:t,override:n})}function Dl(e){if(arguments.length>1)throw new Error("[scene-buffer] seedBuffer(fileText) takes the text only — the scene's text is its sketch file. (FAIL-LOUD.)");var t=Zl(e,"seedBuffer(fileText)");return sf(t,t,null)}function nm(e,t){return es(e),sf(e.file,Zl(t,"editBuffer(b, text)"),e.override)}function wS(e,t){es(e);var n=Zl(t,"runBuffer(b, text)");return sf(e.file,n,n===e.file?null:n)}var rm="Run your code edits first — the editor holds text the canvas has not run, and a hand edit is written into the code the canvas runs (the writer never merges a text edit).";function uA(e,t){es(e);var n=Zl(t,"adoptSketch(b, text)");if($g(e))throw new Error("[scene-buffer] adoptSketch: "+rm+" (FAIL-LOUD.)");return sf(e.file,n,n===e.file?null:n)}function _S(e){return e?es(e).override:null}function af(e){return es(e),e.override!==null?e.override:e.file}function dA(e){return _S(e)!==null?zb.edited:zb.roster}function $g(e){return es(e).text!==af(e)}function fA(e){return e?(es(e),e.override!==null||e.text!==e.file?"Open in STUDIO opens the roster scene file, not these edits — Reset to the file first (edits in this editor live for this session only).":null):null}function kS(e){var t=e&&typeof e.stack=="string"?e.stack:"",n=/(?:blob:|data:text\/javascript)[^\n]*?:(\d+):(\d+)\)?[ \t]*$/m.exec(t);return n?{line:Number(n[1]),col:Number(n[2])}:null}function lf(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("[scene-buffer] "+t+" takes the folder's files ({ path: text }). (FAIL-LOUD.)");return Object.keys(e).forEach(function(n){Zl(e[n],t+' — files["'+n+'"]')}),e}function xi(e){if(!e||typeof e.entry!="string"||typeof e.active!="string"||!e.files||typeof e.files!="object")throw new Error("[scene-buffer] not a project buffer — make one with seedProject(files). (FAIL-LOUD.)");return e}function ec(e,t,n){return Object.freeze({entry:e,active:t,files:Object.freeze(n)})}function Kg(e,t,n){if(!Object.prototype.hasOwnProperty.call(e.files,t))throw new Error("[scene-buffer] "+n+': "'+t+'" is not a file of this project (files: '+Object.keys(e.files).join(", ")+"). (FAIL-LOUD.)");return t}function ms(e){return!(e===Ge||/\.m?js$/.test(e))}function hA(e){lf(e,"seedProject(files)");var t=$o(e),n={};return Object.keys(e).forEach(function(r){n[r]=Dl(e[r])}),ec(t,t,n)}function SS(e){xi(e);function t(n){return n===e.entry?0:n===Ge?1:n.indexOf("parts/")===0?2:3}return Object.keys(e.files).sort(function(n,r){return t(n)-t(r)||(n<r?-1:n>r?1:0)})}function Dr(e){return xi(e).active}function Bb(e,t){return xi(e),ec(e.entry,Kg(e,t,"selectFile"),Object.assign({},e.files))}function Sa(e,t){return xi(e),e.files[Kg(e,t,"bufferOf")]}function Ub(e,t,n){if(xi(e),Kg(e,t,"editFile"),ms(t))throw new Error('[scene-buffer] editFile: "'+t+'" is read-only in the drawer (a module or '+Ge+" is editable). (FAIL-LOUD.)");var r=Object.assign({},e.files);return r[t]=nm(e.files[t],n),ec(e.entry,e.active,r)}function pA(e,t){xi(e),lf(t,"runProject(p, files)");var n={};Object.keys(t).forEach(function(i){n[i]=Object.prototype.hasOwnProperty.call(e.files,i)?wS(e.files[i],t[i]):Dl(t[i])});var r=$o(t);return ec(r,Object.prototype.hasOwnProperty.call(n,e.active)?e.active:r,n)}function ES(e,t){xi(e),lf(t,"adoptFiles(p, files)");var n=Object.assign({},e.files);return Object.keys(t).forEach(function(r){n[r]=Object.prototype.hasOwnProperty.call(e.files,r)?uA(e.files[r],t[r]):Dl(t[r])}),ec(e.entry,e.active,n)}function Hb(e,t){lf(t,"adoptWritten(p, files)");var n={};return Object.keys(t).forEach(function(r){r!==Ge&&(n[r]=t[r])}),ES(e,n)}function mA(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=af(e.files[n])}),t}function bh(e){xi(e);var t={};return Object.keys(e.files).forEach(function(n){t[n]=e.files[n].text}),t}function Eu(e){return SS(e).filter(function(t){return $g(e.files[t])})}function xh(e){return Eu(e).length>0}const gA="modulepreload",vA=function(e,t){return new URL(e,t).href},Wb={},OS=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=vA(c,r),c in Wb)return;Wb[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let v=s.length-1;v>=0;v--){const m=s[v];if(m.href===c&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":gA,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((v,m)=>{h.addEventListener("load",v),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return i.then(s=>{for(const a of s||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var CS=j.lazy(function(){return OS(()=>import("./SceneCodeEditor-Ck982ITn.js"),[],import.meta.url)});const tc=Object.freeze([{id:"modules",means:"Loading the scene objects"},{id:"engine-ready",means:"Starting the WASM engine"},{id:"renderer",means:"Loading the renderer"},{id:"sketch",means:"Building the scene"}].map(Object.freeze)),yA=Object.freeze(tc.map(e=>e.id)),ol="frqtl:boot-phase";function gd(e){const t=tc.find(n=>n.id===e);if(!t)throw new Error(`boot-phases: "${e}" is not a boot phase — ${yA.join(", ")}.`);return t}const bA=Object.freeze(tc.map(({id:e,means:t})=>Object.freeze({id:e,means:t}))),xA=tc[0].id;function im(){return{phase:xA,done:0,total:0,phases:{},failed:null}}function om(e){const t=e&&e.documentElement,n=t&&t.getAttribute("data-egpt-boot-progress");if(!n)return im();const r=JSON.parse(n),i=t.getAttribute("data-egpt-boot-phase");gd(i);const o=t.getAttribute("data-egpt-boot-failed")||null;o&&gd(o);const s=r[i]||{done:0,total:0};return{phase:i,done:s.done,total:s.total,phases:r,failed:o}}function Vb(e){return e.failed?"Failed: "+gd(e.failed).means:tc.every(n=>e.phases[n.id]&&e.phases[n.id].complete)?null:gd(e.phase).means}function qb(e){let t;try{t=e.contentDocument}catch(n){throw new Error("watchFrameBootPhases: the frame's document is not readable ("+n.message+") — the boot record is a same-origin contract.")}if(t===null)throw new Error("watchFrameBootPhases: frame.contentDocument is null — the frame is cross-origin or detached; the boot record is a same-origin contract.");return t}function wA(e){if(!e||typeof e.addEventListener!="function")throw new TypeError("watchFrameBootPhases(frameEl): frameEl must be an <iframe> element");let t=om(qb(e));const n=new Set,r=()=>{n.forEach(s=>s(t))};function i(s){t=s.detail,r()}function o(){t=om(qb(e)),r()}return e.addEventListener(ol,i),e.addEventListener("load",o),{phases:bA,current:()=>t,subscribe(s){if(typeof s!="function")throw new TypeError("watchFrameBootPhases: subscribe(cb) needs a function");return n.add(s),()=>{n.delete(s)}},close(){n.clear(),e.removeEventListener(ol,i),e.removeEventListener("load",o)}}}var Il="project-folders",wh=Object.freeze(["files","renderState"]),vd="index.html";function kr(e){throw new Error("[folders] "+e+" (FAIL-LOUD.)")}function _h(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Zi(e){_h(e)||kr("a project folder row is { "+wh.join(", ")+" } (got "+(e===null?"null":Array.isArray(e)?"an array":typeof e)+").");var t=Object.keys(e).filter(function(o){return wh.indexOf(o)===-1});t.length&&kr("unknown key "+t.map(function(o){return JSON.stringify(o)}).join(", ")+" — a project folder row holds exactly FOLDER_ROW_KEYS (lib/shim/storage/folders.js): "+wh.join(", ")+".");var n=e.files;(!_h(n)||Object.keys(n).length===0)&&kr('"files" is the folder { path: text } with at least '+Ge+" (got "+(_h(n)?"an empty map":typeof n)+").");var r={};Object.keys(n).forEach(function(o){gS(o),o===vd&&kr('"'+vd+'" at the folder root is reserved — the Export generates it (the host page that carries the boot bag); a project folder never holds one.'),typeof n[o]!="string"&&kr('"'+o+'" is not text (got '+(n[o]instanceof Uint8Array?"bytes":typeof n[o])+") — a project folder holds text files only."),r[o]=n[o]}),typeof r[Ge]!="string"&&kr("the folder carries no "+Ge+" — a project folder is named and entered by its manifest (lib/shim/project/manifest.js manifestFor({ name, entry }) writes one).");var i=Zo(r[Ge]).name;return la(i,'a project folder name (frqtl.json "name")'),Object.freeze({files:Object.freeze(r),renderState:yi(e.renderState)})}function $b(e){return Zo(Zi(e).files[Ge]).name}function jS(e){return{files:Object.assign({},e.files),renderState:e.renderState}}function Kb(e,t){var n=Zi(t),r=Zo(n.files[Ge]).name;return e.put(Il,r,jS(n)),r}function sm(e,t,n){la(n,"a project folder name");var r=Zi(t);e.get(Il,n)!==null&&kr('a project named "'+n+'" is already saved — Save As takes a name no saved project has (choose another, or delete the saved one first).');var i=Object.assign({},r.files);i[Ge]=Vg(Object.assign({},Zo(r.files[Ge]),{name:n}));var o=Zi({files:i,renderState:r.renderState});return e.put(Il,n,jS(o)),n}function kh(e,t){la(t,"a project folder name");var n=e.get(Il,t);if(n==null)return null;var r;try{r=Zi(n)}catch(o){kr('the saved project "'+t+'" is not a project folder row: '+(o&&o.message||o))}var i=Zo(r.files[Ge]).name;return i!==t&&kr('the saved project under "'+t+'" names itself "'+i+'" in '+Ge+" — a folder is keyed by its manifest name."),r}function _A(e){return e.list(Il).map(function(t){return t.key}).sort().map(function(t){return{name:t}})}function kA(e){var t=[];return dd.forEach(function(n){e.list(n).forEach(function(r){t.push({namespace:n,key:r.key})})}),t}function SA(e,t){return Array.isArray(t)||kr("deleteRetiredSaves(provider, saves): saves is retiredSaves(provider)'s list."),t.forEach(function(n){(!n||dd.indexOf(n.namespace)===-1||typeof n.key!="string")&&kr("deleteRetiredSaves deletes only retired saves ({ namespace in ["+dd.join(", ")+"], key }) — got "+JSON.stringify(n)+".")}),t.forEach(function(n){e.delete(n.namespace,n.key)}),t.length}const sl=Object.freeze({parts:Object.freeze({path:"parts/index.js",name:null}),ObjectSchema:Object.freeze({path:"objects/schema/index.js",name:"ObjectSchema"}),ObjectFactory:Object.freeze({path:"objects/ObjectFactory.js",name:"ObjectFactory"}),MakeControlsForObject:Object.freeze({path:"objects/objects/makeControlsForObject.js",name:"MakeControlsForObject"}),MakeControlsForRenderSurface:Object.freeze({path:"objects/objects/makeControlsForRenderSurface.js",name:"MakeControlsForRenderSurface"}),ControlBind:Object.freeze({path:"objects/objects/controlBind.js",name:"ControlBind"}),FrqtlControlSlider:Object.freeze({path:"objects/objects/frqtl-control-slider.js",name:"FrqtlControlSlider"}),FrqtlControlWriteQueue:Object.freeze({path:"objects/objects/frqtl-control-write-queue.js",name:"FrqtlControlWriteQueue"}),FrqtlControlsPanel:Object.freeze({path:"parts/FrqtlControlsPanel.js",name:"FrqtlControlsPanel"}),CameraControls:Object.freeze({path:"parts/CameraControls.js",name:"CameraControls"}),Filters:Object.freeze({path:"compat/renderer/Filters.js",name:"Filters"}),OrbitBag:Object.freeze({path:"compat/renderer/orbit-bag.js",name:null}),LoDrawnCenter:Object.freeze({path:"compat/renderer/lo-drawn-center.js",name:null}),ShimRpc:Object.freeze({path:"shim/rpc/index.js",name:null}),ControlRegistry:Object.freeze({path:"shim/controls/registry.js",name:null}),RenderState:Object.freeze({path:"shim/render-state/apply.js",name:null})}),Yb=Object.keys(sl).map(function(e){return sl[e].path}),Ea=new WeakMap,RS=new WeakMap;function EA(e){if(!e||typeof e.resolve!="function")throw new TypeError("[frame-modules] a router (engineRouter() instance) is required — the frame's module URLs come from the ONE path authority. (FAIL-LOUD.)")}function OA(e,t,n){return new Promise(function(r,i){if(!e||!e.document)throw new TypeError("[frame-modules] frameImport(cw, …): cw is the frame's contentWindow. (FAIL-LOUD.)");if(Yb.indexOf(t)===-1)throw new Error('[frame-modules] "'+t+'" is not a frame module — the table is lib/features/ide/frame-modules.js FRAME_MODULES ('+Yb.join(", ")+"). (FAIL-LOUD.)");EA(n);const o=new URL(n.resolve(t),document.baseURI).href;let s;try{s=new e.Function("u","return import(u)")}catch(a){throw new Error("[frame-modules] the frame refused to evaluate its module-import door ("+(a&&a.message||a)+") — a content-security policy without 'unsafe-eval' blocks frameImport (lib/features/ide/frame-modules.js); this host cannot drive a frame's modules. (FAIL-LOUD.)")}r(s(o).catch(function(a){throw new Error("[frame-modules] the frame could not import "+t+" from "+o+" (frame "+e.location.href+"): "+(a&&a.message||a)+". (FAIL-LOUD.)")}))})}function CA(e,t){const n=e&&e.document;if(!n)return Promise.reject(new TypeError("[frame-modules] loadFrameModules(cw, router): cw is the frame's contentWindow. (FAIL-LOUD.)"));if(Ea.has(n))return Ea.get(n);const r=Object.keys(sl),i=Promise.all(r.map(function(o){return OA(e,sl[o].path,t)})).then(function(o){const s={};r.forEach(function(l,c){const u=sl[l],d=u.name===null?o[c]:o[c][u.name];if(d===void 0)throw new Error("[frame-modules] "+u.path+" exports no "+u.name+". (FAIL-LOUD.)");s[l]=d});const a=Object.freeze(s);return RS.set(n,a),a});return Ea.set(n,i),i.catch(function(){Ea.get(n)===i&&Ea.delete(n)}),i}function nc(e){const t=e&&e.document;return t&&RS.get(t)||null}function jA(e,t){if(!t||typeof t.envelopeOf!="function")throw new Error("[project-design] computeEntityBboxForDesign needs the live runner (its envelopeOf is the ONE envelope of a declared object). (FAIL-LOUD.)");var n=t.envelopeOf(e);return n?{left:Math.round(n.left),top:Math.round(n.top),width:Math.round(n.w),height:Math.round(n.h)}:null}function RA(e,t,n,r,i,o){if(arguments.length>6)throw new Error('[project-design] buildObject("'+e+`"): takes (kind, runner, cw, x, y, overrideProps) — a world size is not an argument; the builder reads runner.canvas_rect, written by the scene's exp.createCanvas(w, h, cfg) / exp.createScene(w, h, d, cfg). (FAIL-LOUD.)`);if(!t||!n)throw new Error('[project-design] buildObject("'+e+'"): '+(t?"no iframe scope (cw)":"no runner")+" — a palette drop needs the live runner and the canvas iframe window. (FAIL-LOUD.)");var s=nc(n);if(!s)throw new Error('[project-design] buildObject("'+e+`"): the frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs before a runner is taken. (FAIL-LOUD.)`);var a=s.ObjectFactory;return a.create(e,o,{runner:t,cw:n,x:r,y:i,fromPalette:!0})}const LA="data-frqtl-studio-landing",LS=Object.freeze([{id:"refused-key",runs:!1,means:"the link carries a key STUDIO does not own, or a deleted key (deep-link.js deepLinkRefusalOf): the refusal is on the deep-link strip and the opening scene opens"},{id:"conflict",runs:!1,means:"the link names more than one scene source (two of walkthrough, project and scene), or a renderer beside a walkthrough or a project, which carry their own: nothing opens"},{id:"mode-without-walkthrough",runs:!1,means:"the link names a mode and no walkthrough: nothing opens"},{id:"renderer-without-scene",runs:!1,means:"the link names a renderer and no scene; a renderer is chosen only for a scene link: nothing opens"},{id:"unknown-walkthrough",runs:!1,means:"the linked walkthrough is not a scene of the loaded roster (walkthroughById(roster, id)): nothing opens"},{id:"unknown-mode",runs:!1,means:"the linked mode is not one the linked scene declares (walkthroughModes): nothing opens"},{id:"scene-refused-origin",runs:!1,means:"the linked scene URL is on neither the page's origin nor the roster's (roster-link.js sceneOriginRefusalOf): the strip names the rule and both origins; nothing opens"},{id:"scene-unreadable",runs:!1,means:"the linked scene URL is allowed but its read failed (a non-200, an empty body, or not a .js sketch): nothing opens"},{id:"project-unreadable",runs:!1,means:"the linked saved project is present but its folder is refused by the load: nothing opens"},{id:"project-not-found",runs:!1,means:"no saved project of the linked name in this browser: nothing opens"},{id:"ok",runs:!0,means:"the linked walkthrough (in the linked mode, else its default), saved project or scene resolved and was handed to STUDIO's selection path; the scene starts on load"},{id:"first-contact",runs:!1,means:"no STUDIO deep link: the roster's first-contact scene (firstContactOf(roster)) opens"},{id:"first-contact-empty",runs:!1,means:"no STUDIO deep link and the roster declares no first contact: the Empty Universe opens"}].map(Object.freeze)),Gb=new Set(LS.map(e=>e.id));function AS(e,t){if(!Gb.has(t))throw new Error("[studio-landing] '"+t+"' is not a STUDIO_LANDING_OUTCOMES row — declared: ["+[...Gb].join(", ")+"]. (FAIL-LOUD.)");return e&&e.setAttribute(LA,t),t}const PS="frqtl-roster",AA=3e5,Sh='<link rel="'+PS+'" href="https://…">';function PA(e){if(!e||typeof e.querySelectorAll!="function")throw new Error("[roster-link] rosterHrefOf(doc) takes a document; got "+String(e)+". (FAIL-LOUD.)");const t=Array.from(e.querySelectorAll('link[rel~="'+PS+'"]'));if(t.length===0)throw new Error("[roster-link] this document has no "+Sh+" — STUDIO and the GYM read their scene list from the roster it names; the host writes the link into the page. (FAIL-LOUD.)");if(t.length>1)throw new Error("[roster-link] this document has "+t.length+" "+Sh+" links; a document names exactly one roster. (FAIL-LOUD.)");const n=t[0].getAttribute("href"),r=Hg(n);if(r)throw new Error("[roster-link] "+Sh+": "+r+" (FAIL-LOUD.)");return n}function MA(e,t){const n=Hg(e);if(n)throw new Error("[roster-link] rosterRequestUrl(href, now): "+n+" (FAIL-LOUD.)");if(!Number.isFinite(t))throw new Error("[roster-link] rosterRequestUrl(href, now): now is epoch milliseconds (got "+String(t)+"). (FAIL-LOUD.)");return new URL(e).protocol==="file:"?e:e+"?b="+Math.floor(t/AA)}function TA(e,t){return Promise.resolve().then(()=>{const n=t||{},r=MA(e,n.now===void 0?Date.now():n.now);return qg(r,{fetch:n.fetch}).then(i=>{if(i.trim()==="")throw new Error("[roster-link] roster "+r+" is empty. (FAIL-LOUD.)");let o=null;try{o=JSON.parse(i)}catch(s){throw new Error("[roster-link] roster "+r+" is not JSON: "+s.message+" (FAIL-LOUD.)")}return nA(o,e)},i=>{throw new Error("[roster-link] loading the roster failed: "+i.message+" (FAIL-LOUD.)")})})}function DA(e,t){const n=t||{};if(Jt(n.roster,"sceneOriginRefusalOf(url, { pageOrigin, roster })"),typeof n.pageOrigin!="string"||n.pageOrigin==="")throw new Error("[roster-link] sceneOriginRefusalOf(url, { pageOrigin, roster }): pageOrigin is the page's location.origin (got "+JSON.stringify(n.pageOrigin)+"). (FAIL-LOUD.)");const r=new URL(n.roster.href).origin;let i=null;try{i=new URL(e).origin}catch{i=null}return i!==null&&i!=="null"&&(i===n.pageOrigin||i===r)?null:"a scene opens from this page's origin ("+n.pageOrigin+") or its roster's origin ("+r+"); "+JSON.stringify(e)+" is "+(i===null?"not an absolute URL":"on "+i)+"."}var IA=new TextEncoder,FA=new TextDecoder;function am(e){return IA.encode(e==null?"":String(e))}function NA(e){return FA.decode(e)}var zA=function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e}();function MS(e){for(var t=4294967295,n=0;n<e.length;n++)t=t>>>8^zA[(t^e[n])&255];return(t^4294967295)>>>0}function Ot(e){return[e&255,e>>>8&255]}function Kn(e){return e=e>>>0,[e&255,e>>>8&255,e>>>16&255,e>>>24&255]}function ds(e){var t=0,n;for(n=0;n<e.length;n++)t+=e[n].length;var r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++)r.set(e[n],i),i+=e[n].length;return r}function go(e,t){return e[t]|e[t+1]<<8}function vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var TS=67324752,DS=33639248,IS=101010256;function BA(e){if(!Array.isArray(e))throw new Error("[bundle/zip] zipStore(entries): entries must be an array.");for(var t=[],n=[],r=0,i=0;i<e.length;i++){var o=e[i];if(!o||typeof o.name!="string"||!(o.bytes instanceof Uint8Array))throw new Error("[bundle/zip] zipStore: entry "+i+" must be {name:string, bytes:Uint8Array}.");var s=am(o.name),a=o.bytes,l=MS(a),c=a.length,u=ds([new Uint8Array(Kn(TS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),s,a]);t.push(u);var d=ds([new Uint8Array(Kn(DS)),new Uint8Array(Ot(20)),new Uint8Array(Ot(20)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(l)),new Uint8Array(Kn(c)),new Uint8Array(Kn(c)),new Uint8Array(Ot(s.length)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Kn(0)),new Uint8Array(Kn(r)),s]);n.push(d),r+=u.length}var f=ds(t),h=ds(n),v=ds([new Uint8Array(Kn(IS)),new Uint8Array(Ot(0)),new Uint8Array(Ot(0)),new Uint8Array(Ot(e.length)),new Uint8Array(Ot(e.length)),new Uint8Array(Kn(h.length)),new Uint8Array(Kn(f.length)),new Uint8Array(Ot(0))]);return ds([f,h,v])}function UA(e){if(!(e instanceof Uint8Array))throw new Error("[bundle/zip] unzipStore(bytes): bytes must be a Uint8Array.");for(var t=-1,n=e.length-22;n>=0;n--)if(vo(e,n)===IS){t=n;break}if(t===-1)throw new Error("[bundle/zip] unzipStore: End Of Central Directory record not found (not a ZIP).");for(var r=go(e,t+10),i=vo(e,t+16),o=[],s=i,a=0;a<r;a++){if(vo(e,s)!==DS)throw new Error("[bundle/zip] unzipStore: bad central directory signature at record "+a+".");var l=go(e,s+10),c=vo(e,s+16),u=vo(e,s+20),d=go(e,s+28),f=go(e,s+30),h=go(e,s+32),v=vo(e,s+42),m=NA(e.subarray(s+46,s+46+d));if(l!==0)throw new Error('[bundle/zip] unzipStore: entry "'+m+'" uses compression method '+l+" — this reader is STORE-only (method 0).");if(vo(e,v)!==TS)throw new Error('[bundle/zip] unzipStore: bad local header signature for "'+m+'".');var x=go(e,v+26),b=go(e,v+28),g=v+30+x+b,k=e.slice(g,g+u),E=MS(k);if(E!==c)throw new Error('[bundle/zip] unzipStore: CRC-32 mismatch for "'+m+'" (stored '+c+", computed "+E+").");o.push({name:m,bytes:k}),s+=46+d+f+h}return o}var Yg="frqtl-boot",Ou='<script type="application/json" id="'+Yg+'">',FS="<\/script>";function HA(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Jb(e){return JSON.stringify(e??null).replace(/</g,"\\u003c")}function WA(e){if(e=e||{},typeof e.sdkVersion!="string"||e.sdkVersion.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.sdkVersion is REQUIRED (the CDN pin). (FAIL-LOUD.)");if(typeof e.name!="string"||e.name.length===0)throw new Error("[bundle/indexHtml] buildIndexHtml: args.name is the project's frqtl.json name. (FAIL-LOUD.)");var t=Jb(QR(Ok(e.sdkVersion)+"/"));return["<!DOCTYPE html>",'<html lang="en">',"<head>",' <meta charset="UTF-8">',' <meta name="viewport" content="width=device-width, initial-scale=1">'," <title>"+HA(e.name)+" — FRQTL</title>"," <style>"," html,body{margin:0;height:100%;background:#0b0b0f;color:#ddd;"," font:14px/1.5 ui-sans-serif,system-ui,sans-serif;}"," #frqtl-mount{position:relative;width:100vw;height:100vh;}"," #frqtl-err{position:absolute;inset:0;padding:16px;white-space:pre-wrap;"," font:12px/1.5 ui-monospace,Menlo,Consolas,monospace;color:#ff6b6b;"," background:#1a0000;display:none;overflow:auto;}"," </style>","</head>","<body>",' <div id="frqtl-mount"></div>',' <pre id="frqtl-err"></pre>'," "+Ou+Jb(e.renderState)+FS,' <script type="importmap">'+t+"<\/script>",' <script type="module">'," import { bootProject } from "+JSON.stringify(Mk.specifier)+";"," const renderState = JSON.parse(document.getElementById("+JSON.stringify(Yg)+").textContent);",' const mount = document.getElementById("frqtl-mount");',' const errBox = document.getElementById("frqtl-err");'," function fail(title, detail){",' errBox.style.display = "block";',' errBox.textContent = title + "\\n\\n" + detail;'," }",' if (location.protocol === "file:") {',' fail("Serve this folder over http", "e.g. `npx serve` — a file:// page cannot fetch the project files.");'," } else {",' bootProject(mount, { url: new URL("./", location.href).href }, { renderState: renderState })',' .catch((e) => fail("FRQTL project boot failed", String(e && e.stack || e)));'," }"," <\/script>","</body>","</html>",""].join(`
|
|
72
72
|
`)}function VA(e){if(typeof e!="string")throw new Error("[bundle/indexHtml] readBootBag(html): the page text (got "+typeof e+"). (FAIL-LOUD.)");var t=e.indexOf(Ou);if(t===-1)throw new Error('[bundle/indexHtml] the index.html carries no boot bag (<script type="application/json" id="'+Yg+'">) — it is not the page an Export writes. (FAIL-LOUD.)');if(e.indexOf(Ou,t+1)!==-1)throw new Error("[bundle/indexHtml] the index.html carries two boot bags — an Export writes one. (FAIL-LOUD.)");var n=t+Ou.length,r=e.indexOf(FS,n);if(r===-1)throw new Error("[bundle/indexHtml] the boot bag element is not closed. (FAIL-LOUD.)");try{return JSON.parse(e.slice(n,r))}catch(i){throw new Error("[bundle/indexHtml] the boot bag is not valid JSON: "+(i&&i.message||i)+". (FAIL-LOUD.)")}}var qA=Object.freeze(["experiment.js","manifest.json"]),NS="this is the retired export format; the project folder replaced it (frqtl.json + sketch.js)",Xb="sketch.js",$A=new TextDecoder("utf-8",{fatal:!0});function hr(e){throw new Error("[bundle] "+e+" (FAIL-LOUD.)")}function KA(e,t,n){var r=Zi({files:e,renderState:t}),i=n&&n.sdkVersion,o=Zo(r.files[Ge]).name,s=Object.keys(r.files).map(function(a){return{name:a,bytes:am(r.files[a])}});return s.push({name:vd,bytes:am(WA({name:o,sdkVersion:i,renderState:r.renderState}))}),BA(s)}function YA(e){return e.length>=4&&e[0]===80&&e[1]===75&&(e[2]===3&&e[3]===4||e[2]===5&&e[3]===6)}function zS(e,t){try{return $A.decode(e)}catch{hr(t+" is not UTF-8 text — a project folder holds text files only.")}}function BS(e){var t=String(e).split(/[\\/]/).pop();return t}function GA(e){var t=UA(e).filter(function(a){return!/\/$/.test(a.name)}),n=t.map(function(a){return a.name}),r=qA.filter(function(a){return n.indexOf(a)!==-1});if(r.length&&hr("the archive carries "+r.join(" and ")+": "+NS+"."),n.indexOf(Ge)===-1){var i=n.map(function(a){return a.split("/")[0]}).filter(function(a,l,c){return c.indexOf(a)===l});i.length===1&&n.indexOf(i[0]+"/"+Ge)!==-1&&n.every(function(a){return a.indexOf(i[0]+"/")===0})&&hr("the archive carries no "+Ge+" at its root — the archive holds the folder `"+i[0]+"/` rather than its contents — zip the folder's CONTENTS ("+Ge+" at the root), as an Export writes it."),hr("the archive carries no "+Ge+" at its root — a project archive is the folder zipped (frqtl.json + sketch.js + …), as an Export writes it.")}var o={},s=null;return t.forEach(function(a){var l=zS(a.bytes,'"'+a.name+'"');if(a.name===vd){s=VA(l);return}o[a.name]=l}),Zi({files:o,renderState:s})}function JA(e){var t;try{t=JSON.parse(e)}catch{hr("the file is neither a project archive (.zip) nor a sketch (.js), and not valid JSON either.")}t&&typeof t=="object"&&("schemaVersion"in t||"scripts"in t)&&"source"in t&&hr("the file is a v4 module envelope: "+NS+"."),hr("the JSON file is not a project — Import takes a project archive (.zip) or one sketch (.js).")}function XA(e,t){var n=BS(t),r=n.replace(/\.js$/,"");r||hr('the sketch file "'+n+'" has no name before ".js".');var i={};return i[Ge]=Vg(vS({name:r,entry:Xb})),i[Xb]=e,Zi({files:i,renderState:null})}function US(e,t){if(e instanceof Uint8Array||hr("importArchive(bytes, fileName): bytes is a Uint8Array."),(typeof t!="string"||t.length===0)&&hr("importArchive(bytes, fileName): the file's name."),YA(e))return GA(e);var n=BS(t);if(/\.mjs$/i.test(n)){var r=pd.filter(function(o){return o.key==="entry"})[0].rule;hr('"'+n+`" is a .mjs module — a one-file Import takes a .js sketch, because a project's entry is `+r+" (frqtl.json, lib/shim/project/manifest.js MANIFEST_KEYS). Rename it to .js and import it again.")}var i=zS(e,'"'+n+'"');if(/\.js$/.test(n))return XA(i,n);if(/\.json$/i.test(n)||/^\s*\{/.test(i))return JA(i);hr('"'+n+'" is not a project — Import takes a project archive (.zip, as an Export writes it) or one sketch (.js).')}var Mi="_empty",Lo="scene:";function QA(e,t,n){if(!e||e===Mi)return"Empty Universe (New)";if(e.indexOf(Lo)===0){var r=e.slice(Lo.length);return"Scene draft: "+decodeURIComponent(r.split("?")[0].split("/").pop()||r)}if(e.indexOf("walkthrough:")===0){var i=e.slice(12),o=n&&n.find(function(l){return l.id===i});return o?o.title:i}if(e.indexOf("project:")===0){var s=e.slice(8),a=t&&t.find(function(l){return l.id===s});return a?a.name:s}return e}function HS(e){return e&&typeof e.label=="string"&&e.label?e.label:e.name}function WS(e){if(!e||e.type!=="number")return null;var t=e.constraint||{},n=e.widgetConfig||{},r=function(i){return typeof i=="number"&&isFinite(i)};return!r(t.min)||!r(t.max)||!r(n.step)||n.step<=0||t.max<=t.min?null:{min:t.min,max:t.max,step:n.step}}function Eh(e){if(!Array.isArray(e))throw new TypeError("[author-ux-utils] declaredLayerRows takes runner.declared (an array). (FAIL-LOUD.)");return e.map(function(t){return{ref:t,name:t.name||t._schemaKind,schemaKind:t._schemaKind,visible:t.visible!==!1}})}var Oa="studioLandingOf(link, { roster, loadProject, pageOrigin, baseURI, fetch? })";function On(e,t,n){var r=LS.find(function(i){return i.id===AS(null,e)});return{id:e,err:t||null,select:n||null,run:r.runs}}function Qb(e){var t=sA(e);return t?{value:"walkthrough:"+t.id,mode:null,opts:{quiet:!0}}:{value:Mi,mode:null,opts:{quiet:!0}}}function ZA(e){if(!e||typeof e!="object")throw new Error("[studio-landing-of] "+Oa+": deps is an object. (FAIL-LOUD.)");if(typeof e.walkthroughById=="function"||typeof e.walkthroughModes=="function")throw new Error("[studio-landing-of] "+Oa+": deps carry the loaded roster bag, never the registry readers (walkthroughById/walkthroughModes) — the resolver reads the roster itself. (FAIL-LOUD.)");if(Jt(e.roster,Oa),typeof e.loadProject!="function")throw new Error("[studio-landing-of] "+Oa+": deps.loadProject is the saved-project loader. (FAIL-LOUD.)");["pageOrigin","baseURI"].forEach(function(t){if(typeof e[t]!="string"||e[t]==="")throw new Error("[studio-landing-of] "+Oa+": deps."+t+" is the page's "+(t==="pageOrigin"?"location.origin":"document.baseURI")+" (got "+JSON.stringify(e[t])+"). (FAIL-LOUD.)")})}function eP(e,t){var n=null;try{n=new URL(e.scene,t.baseURI).href}catch{n=null}var r=n===null?JSON.stringify(e.scene)+" is not a URL":DA(n,{pageOrigin:t.pageOrigin,roster:t.roster});if(r)return Promise.resolve(On("scene-refused-origin","Deep link error: scene refused — "+r));var i=null;e.renderer&&(i=yi({renderer:e.renderer}).renderer);var o=function(s){return On("scene-unreadable",'Deep link error: scene "'+e.scene+'" — '+s)};return qg(n,{fetch:t.fetch}).then(function(s){if(!s.trim())return o(n+" has an empty body.");var a=decodeURIComponent(new URL(n).pathname.split("/").pop()||""),l;try{l=US(new TextEncoder().encode(s),a)}catch(d){return o(d&&d.message?d.message:String(d))}var c=i===null?l.renderState:yi(Object.assign({},l.renderState,{renderer:i})),u={scene:e.scene};return e.renderer&&(u.renderer=e.renderer),On("ok",null,{value:Lo+n,mode:null,opts:{folder:{files:Object.assign({},l.files),renderState:c},link:u}})},function(s){return o(s&&s.message?s.message:String(s))})}function tP(e,t){return Promise.resolve().then(function(){ZA(t);var n=e||{},r=t.roster;if(n.refusal)return On("refused-key",n.refusal,Qb(r));var i=["walkthrough","project","scene"].filter(function(c){return n[c]});if(i.length>1)return On("conflict","Deep link error: "+i.map(function(c){return c+'="'+n[c]+'"'}).join(" conflicts with ")+" — a deep link selects ONE scene; keep one of them.");if(n.renderer&&(n.walkthrough||n.project))return On("conflict",'Deep link error: renderer="'+n.renderer+'" conflicts with '+(n.walkthrough?'walkthrough="'+n.walkthrough+'"':'project="'+n.project+'"')+" — that scene carries its own renderer; renderer= is for a ?scene= draft only.");if(n.mode&&!n.walkthrough)return On("mode-without-walkthrough",'Deep link error: mode="'+n.mode+'" needs walkthrough=<scene id> — a mode belongs to a roster scene.');if(n.renderer&&!n.scene)return On("renderer-without-scene",'Deep link error: renderer="'+n.renderer+'" needs scene=<url> — a renderer is chosen only for a scene draft.');if(n.walkthrough){var o=Kt(r,n.walkthrough);if(!o)return On("unknown-walkthrough",'Deep link error: unknown walkthrough "'+n.walkthrough+`" — not a scene of this site's roster.`);if(n.mode){var s=Tl(o).map(function(c){return c.id});if(s.indexOf(n.mode)===-1)return On("unknown-mode",'Deep link error: unknown mode "'+n.mode+'" for walkthrough "'+o.id+'" — declared modes: ['+s.join(", ")+"].")}return On("ok",null,{value:"walkthrough:"+o.id,mode:n.mode||null})}if(n.scene)return eP(n,t);if(n.project){var a;try{a=t.loadProject(n.project)}catch(c){return On("project-unreadable",'Deep link error: saved project "'+n.project+'" — '+(c&&c.message?c.message:c))}return a?On("ok",null,{value:"project:"+n.project,mode:null}):On("project-not-found",'Deep link error: saved project "'+n.project+'" not found.')}var l=Qb(r);return On(l.value===Mi?"first-contact-empty":"first-contact",null,l)})}const nP=4,rP=200,iP=[{scene:{id:"cl1d-mirror-route",modeId:"3d"},part:"m6",homes:"starPoints",title:"Try it: put the mirror back",ask:{desktop:[["One mirror is out of place: the cyan one, standing inside the ring. Pick the Hand (the hand icon under Tools, on the left), then drag the cyan mirror out into its empty slot in the ring."]],phone:[["One mirror is out of place: the cyan one, standing inside the ring. Tap HAND at the bottom, then drag the cyan mirror with one finger out into its empty slot in the ring."]]},done:[["Done: the cyan mirror is back in its slot."]],status:function(e){return"It is "+e+" px from its slot."}}];function oP(e,t){var n="[studio-try-it] row "+t;if(!e.scene||typeof e.scene.id!="string"||e.scene.id==="")throw new Error(n+": scene is { id, modeId }.");if(["part","homes"].forEach(function(r){if(typeof e[r]!="string"||e[r]==="")throw new Error(n+": "+r+" is a non-empty name.")}),Zs(e.title,n+".title"),Do(e.ask.desktop,n+".ask.desktop",{table:!1}),Do(e.ask.phone,n+".ask.phone",{table:!1}),Do(e.done,n+".done",{table:!1}),typeof e.status!="function")throw new Error(n+": status(px) words the live distance.");return Zs(e.status(67),n+".status"),Object.freeze(e)}const za=Object.freeze(iP.map(oP));function sP(e,t){Jt(e,"tryItFor(roster, scene)");for(var n=ea(e,t),r=0;r<za.length;r++)if(Kt(e,za[r].scene.id)&&ea(e,za[r].scene)===n)return za[r];return null}function cf(e){if(za.indexOf(e)===-1)throw new Error("[studio-try-it] not a try-it row — pass tryItFor(scene)'s answer. (FAIL-LOUD.)")}function aP(e,t){return Jt(e,"tryItKey(roster, row)"),cf(t),"tryit-"+ea(e,t.scene)}function lP(e,t,n){if(Jt(e,"tryItBag(roster, row, { onPhone })"),cf(t),!n||typeof n.onPhone!="boolean")throw new TypeError("[studio-try-it] tryItBag(roster, row, { onPhone }): onPhone is isMobileDevice(window) (lib/shim/host/device.js). (FAIL-LOUD.)");return{seenKey:aP(e,t),title:t.title,paragraphs:t.ask[n.onPhone?"phone":"desktop"]}}function cP(e,t){cf(e);var n=t&&t[e.homes],r=n&&n[e.part];if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number")throw new Error("[studio-try-it] the scene "+e.scene.id+" does not export "+e.homes+"."+e.part+" as [x, y] — the try-it reads where "+e.part+" belongs from the scene file. (FAIL-LOUD.)");return r}function uP(e,t){return Math.hypot(e.left+e.w/2-t[0],e.top+e.h/2-t[1])}function dP(e,t,n,r){Jt(t,"watchTryIt(hostEl, roster, row, how)"),cf(n),["runnerOf","exportsOf","onError"].forEach(function(d){if(!r||typeof r[d]!="function")throw new TypeError("[studio-try-it] watchTryIt(hostEl, roster, row, how): how."+d+" is a function. (FAIL-LOUD.)")});var i=PL(e,lP(t,n,{onPhone:r.onPhone}),{dock:r.dock}),o=e.ownerDocument.defaultView,s=null,a=!1,l=!1;function c(){s!==null&&(o.clearInterval(s),s=null)}function u(){if(!i.showing()){c();return}var d;try{var f=r.runnerOf(),h=r.exportsOf();if(!f||!h)return;var v=f.declared.find(function(x){return x.name===n.part});if(!v)throw new Error('[studio-try-it] the running scene declares no "'+n.part+'" — the try-it has nothing to watch. (FAIL-LOUD.)');var m=f.envelopeOf(v);if(!m)throw new Error('[studio-try-it] "'+n.part+'" has no envelope to read. (FAIL-LOUD.)');d=uP(m,cP(n,h))}catch(x){l=!0,c(),i.status(""),r.onError(x&&x.message?x.message:String(x));return}if(d<=nP){l=!0,c(),e.dataset.tryItOffPx=d.toFixed(2),i.complete(n.done);return}e.dataset.tryItOffPx=d.toFixed(2),i.status(Zs(n.status(Math.round(d)),"[studio-try-it] status"))}return i.ready.then(function(d){a||!d.shows||(u(),l||(s=o.setInterval(u,rP)))}),{ready:i.ready,close:function(){a=!0,c(),delete e.dataset.tryItOffPx,i.close()}}}const VS=Object.freeze({slopPx:8,longPressMs:500,doubleTapMs:350,doubleTapPx:32,pinchOn:.06,twistOnDeg:8,panOnPx:12,orbitDegPerView:180}),fP=Object.freeze({orbit:Object.freeze(["azimuth","elevation"]),zoom:Object.freeze(["distance"]),roll:Object.freeze(["roll"]),pan:Object.freeze(["target"])});function Gg(e){var t=(e%360+360)%360;return t>180?t-360:t}function hP(e,t,n,r){var i=Math.hypot(t.x-e.x,t.y-e.y),o=Math.hypot(r.x-n.x,r.y-n.y),s=Math.atan2(t.y-e.y,t.x-e.x)*180/Math.PI,a=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI;return{scale:i>0?o/i:1,twistDeg:Gg(a-s),centroid:{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}}function pP(e,t,n,r){if(!(n>0))throw new Error("[canvas-gestures] orbitDelta needs the canvas width (got "+String(n)+"). (FAIL-LOUD.)");var i=(r||0)*Math.PI/180,o=e*Math.cos(i)-t*Math.sin(i),s=e*Math.sin(i)+t*Math.cos(i),a=VS.orbitDegPerView/n;return{dAz:a*o,dEl:-a*s}}function Ba(e,t){if(!Array.isArray(e))throw new Error("[canvas-gestures] the camera publishes no poseFields array — every camera handle declares its axes (RENDERER_CONTRACT §1a.2). (FAIL-LOUD.)");for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.name===t){var i=r.constraint||{};return{min:typeof i.min=="number"?i.min:-1/0,max:typeof i.max=="number"?i.max:1/0,wrap:typeof i.wrap=="number"?i.wrap:null}}}return null}function qS(e,t){return Math.min(t.max,Math.max(t.min,e))}function Oh(e,t){if(!t.wrap)return qS(e,t);var n=isFinite(t.min)?t.min:-t.wrap/2;return((e-n)%t.wrap+t.wrap)%t.wrap+n}function mP(e,t){return fP[t].filter(function(n){return!Ba(e,n)})}function gP(e,t,n,r){var i={},o=[];function s(c){var u=mP(n,c);return u.length?(o.push({gesture:c,axes:u}),!1):!0}if(t.fingers===1){if((t.dx||t.dy)&&s("orbit")){var a=pP(t.dx,t.dy,r,e.roll);i.azimuth=Oh(e.azimuth+a.dAz,Ba(n,"azimuth")),i.elevation=Oh(e.elevation+a.dEl,Ba(n,"elevation"))}return{patch:i,refused:o}}var l=t.active||{};return l.zoom&&s("zoom")&&(i.distance=qS(e.distance/t.scale,Ba(n,"distance"))),l.roll&&s("roll")&&(i.roll=Oh(e.roll-t.twistDeg,Ba(n,"roll"))),l.pan&&s("pan"),{patch:i,refused:o}}function vP(e,t,n){var r=50;function i(a){var l=a*Math.PI/180,c=e([t[0],t[1],t[2]||0]),u=e([t[0]+r*Math.cos(l),t[1]+r*Math.sin(l),t[2]||0]);return!c||!u?null:Math.atan2(u[1]-c[1],u[0]-c[0])*180/Math.PI}var o=i(n),s=i(n+5);if(o===null||s===null)throw new Error("[canvas-gestures] the object's centre is not on screen from this view, so its turning sense cannot be read. (FAIL-LOUD.)");return Gg(s-o)>=0?1:-1}function yP(e,t,n){var r=e+n*t;return(r%360+360)%360}function bP(e){if(!e||typeof e.hitTest!="function"||typeof e.handArmed!="function"||typeof e.emit!="function")throw new Error("[canvas-gestures] createGestureReader({ hitTest, handArmed, emit }) needs all three functions. (FAIL-LOUD.)");var t=Object.assign({},VS,e.tuning||{}),n=e.timers||{set:function(g,k){return setTimeout(g,k)},clear:function(g){clearTimeout(g)}},r=e.emit,i=new Map,o=null,s=null,a=null,l=null,c=null;function u(){l!==null&&(n.clear(l),l=null)}function d(g){var k=[];i.forEach(function(S,M){k.length<2&&k.push(M)});var E=i.get(k[0]),C=i.get(k[1]);a={ids:k,a0:{x:E.x,y:E.y},b0:{x:C.x,y:C.y},lastCentroid:{x:(E.x+C.x)/2,y:(E.y+C.y)/2},base:{scale:1,twist:0,centroid:{x:(E.x+C.x)/2,y:(E.y+C.y)/2}},active:g?{resize:!1,rotate:!1}:{zoom:!1,roll:!1,pan:!1},target:g||null},r(g?{kind:"object",phase:"begin",target:g}:{kind:"world",phase:"begin",fingers:2})}function f(){var g=i.get(a.ids[0]),k=i.get(a.ids[1]);if(!(!g||!k)){var E=hP(a.a0,a.b0,g,k),C=a.active,S=a.base,M=a.target?"resize":"zoom",L=a.target?"rotate":"roll";!C[M]&&Math.abs(E.scale-1)>t.pinchOn&&(C[M]=!0,S.scale=E.scale),!C[L]&&Math.abs(E.twistDeg)>t.twistOnDeg&&(C[L]=!0,S.twist=E.twistDeg);var T=C[M]?E.scale/S.scale:1,V=C[L]?Gg(E.twistDeg-S.twist):0;if(a.target){r({kind:"object",phase:"update",target:a.target,scale:T,twistDeg:V,active:{resize:C.resize,rotate:C.rotate}});return}var G=null;!C.pan&&Math.hypot(E.centroid.x-S.centroid.x,E.centroid.y-S.centroid.y)>t.panOnPx&&(C.pan=!0,a.lastCentroid={x:S.centroid.x,y:S.centroid.y}),C.pan&&(G={from:a.lastCentroid,to:{x:E.centroid.x,y:E.centroid.y}},a.lastCentroid={x:E.centroid.x,y:E.centroid.y}),r({kind:"world",phase:"update",fingers:2,scale:T,twistDeg:V,pan:G,active:{zoom:C.zoom,roll:C.roll,pan:C.pan}})}}function h(){a&&(a.target?r({kind:"object",phase:"end",target:a.target}):r({kind:"world",phase:"end",fingers:2}),a=null)}function v(g){if(g.type==="mouse"){if(g.button!==void 0&&g.button!==0)return;o="mouse",r({kind:"press",x:g.x,y:g.y});return}if(i.set(g.id,{x:g.x,y:g.y}),i.size===1){var k=e.hitTest(g.x,g.y)||null;s={id:g.id,x0:g.x,y0:g.y,t0:g.t,hit:k},k&&e.handArmed()?(o="pending-object",l=n.set(function(){l=null,o==="pending-object"&&(o="held",r({kind:"hold",x:s.x0,y:s.y0}))},t.longPressMs)):o="pending-world";return}if(i.size===2&&(o==="pending-object"||o==="object-drag"||o==="pending-world"||o==="world-1")){u();var E=e.hitTest(g.x,g.y)||null,C=o==="pending-object"||o==="object-drag";o==="object-drag"&&r({kind:"release"}),o==="world-1"&&r({kind:"world",phase:"end",fingers:1}),C&&E&&E===s.hit?(o="object-2",d(s.hit)):(o="world-2",d(null));return}}function m(g){if(g.type==="mouse"){r(o==="mouse"?{kind:"drag",x:g.x,y:g.y}:{kind:"hover",x:g.x,y:g.y});return}if(i.has(g.id)){if(i.set(g.id,{x:g.x,y:g.y}),o==="world-2"||o==="object-2"){f();return}if(!(!s||g.id!==s.id)){var k=Math.hypot(g.x-s.x0,g.y-s.y0)>t.slopPx,E=o==="held"&&k&&typeof g.t=="number"&&typeof s.t0=="number"&&g.t-s.t0<t.longPressMs;(o==="pending-object"||E)&&k?(u(),o="object-drag",r({kind:"press",x:s.x0,y:s.y0}),r({kind:"drag",x:g.x,y:g.y})):o==="object-drag"?r({kind:"drag",x:g.x,y:g.y}):o==="pending-world"&&k?(o="world-1",r({kind:"world",phase:"begin",fingers:1}),r({kind:"world",phase:"update",fingers:1,dx:g.x-s.x0,dy:g.y-s.y0})):o==="world-1"&&r({kind:"world",phase:"update",fingers:1,dx:g.x-s.x0,dy:g.y-s.y0})}}}function x(g,k){if(g.type==="mouse"){o==="mouse"&&(o=null,r({kind:"release"}));return}if(i.has(g.id)){if(i.delete(g.id),u(),o==="pending-object")k||(r({kind:"press",x:s.x0,y:s.y0}),r({kind:"release"})),o=null;else if(o==="pending-world"){if(!k){var E=!s.hit,C=E&&c&&s.t0-c.t<=t.doubleTapMs&&Math.hypot(s.x0-c.x,s.y0-c.y)<=t.doubleTapPx;C?(c=null,r({kind:"reset",x:s.x0,y:s.y0})):(r({kind:"press",x:s.x0,y:s.y0}),r({kind:"release"}),c=E?{t:g.t,x:s.x0,y:s.y0}:null)}o=null}else o==="object-drag"?(r({kind:"release"}),o=null):o==="world-1"?(r({kind:"world",phase:"end",fingers:1}),o=null):o==="world-2"||o==="object-2"?(h(),o="spent"):o==="held"&&(o="spent");i.size===0&&(o=null,s=null,a=null)}}function b(){u(),(o==="mouse"||o==="object-drag")&&r({kind:"release"}),o==="world-1"&&r({kind:"world",phase:"end",fingers:1}),(o==="world-2"||o==="object-2")&&h(),i.clear(),o=null,s=null,a=null}return{down:v,move:m,up:function(g){x(g,!1)},cancel:function(g){x(g,!0)},reset:b,mode:function(){return o}}}function xP(e,t){if(!e||typeof e.addEventListener!="function")throw new Error("[canvas-gestures] bindCanvasGestures(el, reader) needs an element. (FAIL-LOUD.)");e.style.touchAction="none";function n(l){var c=e.getBoundingClientRect();return{id:l.pointerId,type:l.pointerType||"mouse",x:l.clientX-c.left,y:l.clientY-c.top,t:typeof l.timeStamp=="number"?l.timeStamp:Date.now(),button:l.button}}function r(l){l.pointerType==="mouse"&&l.button!==0||(t.down(n(l)),l.preventDefault())}function i(l){t.move(n(l)),t.mode()!==null&&l.preventDefault()}function o(l){t.up(n(l)),l.preventDefault()}function s(l){t.cancel(n(l))}function a(l){l.pointerType==="mouse"&&t.up(n(l))}return e.addEventListener("pointerdown",r),e.addEventListener("pointermove",i),e.addEventListener("pointerup",o),e.addEventListener("pointercancel",s),e.addEventListener("pointerleave",a),function(){e.removeEventListener("pointerdown",r),e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",o),e.removeEventListener("pointercancel",s),e.removeEventListener("pointerleave",a),t.reset()}}function wP(e,t){var n=nc(e);if(!n)throw new Error("[save-state] the STUDIO frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs before a runner is taken. (FAIL-LOUD.)");return n.RenderState.backdropOf(t)}function _P(e){return e?e.visible!==!1:null}function kP(e){if(!Array.isArray(e))return[];for(var t=[],n=0;n<e.length;n++){var r=e[n];r&&r.bind&&typeof r.bind.prop=="string"&&r.bind.prop.length>0&&t.push({key:r.bind.prop,value:r.value})}return t}function SP(e,t){return e!==t}function $S(e,t){if(typeof e!="string"||!e)throw new TypeError("[share-file] downloadBlob(filename, blob): filename must be a non-empty string. (FAIL-LOUD.)");if(!t||typeof t.size!="number"||typeof t.type!="string")throw new TypeError("[share-file] downloadBlob(filename, blob): blob must be a Blob. (FAIL-LOUD.)");var n=URL.createObjectURL(t);try{var r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}finally{setTimeout(function(){URL.revokeObjectURL(n)},0)}}function KS(e,t){if(!e||typeof e!="object")throw new TypeError("[share-file] "+t+"(nav, …): nav is the window's navigator. (FAIL-LOUD.)")}function YS(e,t){return KS(e,"canShareFile"),typeof e.canShare!="function"||typeof e.share!="function"?!1:e.canShare({files:[t]})===!0}function EP(e,t,n){if(KS(e,"shareFile"),!YS(e,t))throw new Error("[share-file] shareFile: this browser's Web Share does not take this file ("+(t&&t.type)+") — offer the download instead (canShareFile gates the Share action). (FAIL-LOUD.)");return e.share({files:[t],title:n})}function OP(e,t,n){$S(e,new Blob([t],{type:"application/zip"}))}function CP(e){return e.arrayBuffer().then(function(t){return new Uint8Array(t)})}function jP(e){return typeof window<"u"&&typeof window.__FRQTL_SDK_VERSION__=="string"&&window.__FRQTL_SDK_VERSION__.length>0?Promise.resolve(window.__FRQTL_SDK_VERSION__):qp.length>0?Promise.resolve(qp):Promise.reject(new Error("[bundle-export] deriveSdkVersion: the router CDN_SDK_VERSION authority is empty — pass an explicit version or set window.__FRQTL_SDK_VERSION__. (Never fabricate a CDN pin.)"))}function Zb(e){throw new Error("[capture-envelope] "+e+" (FAIL-LOUD.)")}function RP(e){typeof e!="string"&&Zb("base64ToBytes expects the base64 string of encoded.bytes, got "+typeof e),typeof atob!="function"&&Zb("base64ToBytes needs a global atob (every browser, and node >= 16)");for(var t=atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function LP(e){if(!e||typeof e!="object")throw new TypeError("[studio-recorder] recordUnavailableReason(win): win is the experiment frame's window. (FAIL-LOUD.)");return typeof e.VideoEncoder!="function"?"this browser has no WebCodecs VideoEncoder (or the page is not a secure context), and the one recorder, FrqtlVision.record (lib/frqtl/parts/FrqtlVision.js), encodes with it — the Record button is hidden":null}var ex=Object.freeze({"video/mp4":"mp4","video/webm":"webm"});function Uc(e){return(e<10?"0":"")+e}function AP(e,t,n){var r=ex[n];if(!r)throw new Error("[studio-recorder] recordingFileName: no file extension for mime "+JSON.stringify(n)+" (known: "+Object.keys(ex).join(", ")+"). (FAIL-LOUD.)");var i=String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(!i)throw new Error("[studio-recorder] recordingFileName: the scene has no name to put in the file name (got "+JSON.stringify(e)+"). (FAIL-LOUD.)");var o=t.getFullYear()+Uc(t.getMonth()+1)+Uc(t.getDate())+"-"+Uc(t.getHours())+Uc(t.getMinutes());return"frqtl-"+i+"-"+o+"."+r}function PP(e,t,n){var r=e.encoded.mime;return new File([RP(e.encoded.bytes)],AP(t,n,r),{type:r})}var tx="#6a9ad0",nx="#cfcfcf",rx="#a08060";function MP({value:e,roster:t,savedProjects:n,onChange:r,disabled:i}){Jt(t,"ExperimentDropdown({ value, roster, savedProjects, onChange, disabled })");var[o,s]=j.useState(!1),a=j.useRef(null);j.useEffect(function(){if(!o)return;function f(h){a.current&&!a.current.contains(h.target)&&s(!1)}return document.addEventListener("mousedown",f),function(){document.removeEventListener("mousedown",f)}},[o]),j.useEffect(function(){if(!o)return;function f(h){h.key==="Escape"&&s(!1)}return document.addEventListener("keydown",f),function(){document.removeEventListener("keydown",f)}},[o]);function l(f){s(!1),f!==e&&r&&r(f)}var c=QA(e,n,t.rows),u=!e||e===Mi?rx:e.indexOf("walkthrough:")===0?tx:nx,d=!e||e===Mi;return y.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block"},children:[y.jsxs("button",{disabled:!!i,style:TP(!!i),onClick:function(){i||s(function(f){return!f})},title:"Switch experiment or open saved project","aria-haspopup":"listbox","aria-expanded":o,children:[y.jsx("span",{style:{color:u,fontStyle:d?"italic":"normal",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:c}),y.jsx("span",{style:{color:"#555",marginLeft:"5px",fontSize:"0.55rem",flexShrink:0},children:o?"▲":"▼"})]}),o&&y.jsxs("div",{style:DP,role:"listbox","aria-label":"Select experiment",children:[y.jsx(Ch,{val:Mi,selected:e===Mi,onSelect:l,hoverBg:"#2a2200",children:y.jsx("span",{style:{fontStyle:"italic",color:rx},children:"Empty Universe (New)"})}),dS(t).map(function(f,h){return y.jsxs(Ze.Fragment,{children:[y.jsx(ix,{scene:!0,children:f.label}),f.rows.map(function(v){var m="walkthrough:"+v.id,x=Kt(t,v.id);return y.jsx(Ch,{val:m,selected:e===m,onSelect:l,hoverBg:"#16222f",title:x?x.prose:void 0,children:y.jsx("span",{style:{color:tx},children:v.title})},h+":"+m)})]},h+":"+f.label)}),n&&n.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(ix,{children:"Saved Projects"}),n.map(function(f){var h="project:"+f.id;return y.jsx(Ch,{val:h,selected:e===h,onSelect:l,hoverBg:"#1e1e1e",children:y.jsx("span",{style:{color:nx},children:f.name})},h)})]})]})]})}function ix({children:e,scene:t}){return y.jsx("div",{"data-scene-group":t?"":void 0,style:{fontSize:"0.55rem",letterSpacing:"1px",textTransform:"uppercase",color:"#444",padding:"5px 8px 2px",borderTop:"1px solid #222",userSelect:"none"},children:e})}function Ch({val:e,selected:t,onSelect:n,hoverBg:r,children:i,title:o}){var[s,a]=j.useState(!1);return y.jsx("div",{role:"option","data-value":e,"aria-selected":t,title:o||void 0,style:{padding:"5px 8px",cursor:"pointer",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",background:s?r:t?"#26323f":"transparent",userSelect:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:function(){n(e)},onMouseEnter:function(){a(!0)},onMouseLeave:function(){a(!1)},children:i})}function TP(e){return{display:"flex",alignItems:"center",gap:"4px",maxWidth:"200px",minWidth:"120px",background:"#1a1a1a",border:"1px solid #333",color:"#ccc",padding:"3px 6px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",cursor:e?"not-allowed":"pointer",borderRadius:"3px",opacity:e?.5:1,outline:"none"}}var DP={position:"absolute",top:"100%",left:0,zIndex:9999,background:"#151515",border:"1px solid #333",borderRadius:"3px",minWidth:"200px",maxWidth:"300px",maxHeight:"320px",overflowY:"auto",boxShadow:"0 4px 16px rgba(0,0,0,0.6)",marginTop:"2px"};function Ko(e){return!e||typeof e!="object"?!1:Object.prototype.toString.call(e)==="[object Map]"?!0:typeof e.get=="function"&&typeof e.entries=="function"&&typeof e.forEach=="function"&&typeof e.size=="number"}function GS(e){var t=[],n=[];if(e&&typeof e=="object"&&Array.isArray(e.cells)){for(var r=0;r<e.cells.length;r++)n.push(Number(e.cells[r].v)||0);return{labels:t,values:n,cells:e.cells,maxV:Number(e.maxV)||0}}if(Ko(e)){var i=Array.from(e.entries());i.sort(function(l,c){return Number(l[0])-Number(c[0])});for(var o=0;o<i.length;o++)t.push(String(i[o][0])),n.push(Number(i[o][1]))}else if(Array.isArray(e))for(var s=0;s<e.length;s++){var a=e[s];a&&typeof a=="object"?(t.push(String(a.x!=null?a.x:s)),n.push(Number(a.y!=null?a.y:a.count!=null?a.count:0))):(t.push(String(s)),n.push(Number(a)))}else e&&typeof e=="object"&&Object.keys(e).forEach(function(l){t.push(l),n.push(Number(e[l]))});return{labels:t,values:n}}function IP(e,t){if(!e||typeof e.render!="function"||typeof e.destroy!="function")throw new Error("[realm-chart] makeChartHandle requires a chart-env with render()/destroy(). (FAIL-LOUD.)");var n=null;function r(o){var s=o&&o.kind||"bar",a=o&&o.label||"series",l=GS(o&&o.data);return n=Object.assign({kind:s,label:a},l),e.render(n),n}var i={_transport:t&&t.kind||"in-app",inject:function(o,s){return o==="chart"?!s||typeof s.data>"u"||s.data===null?Promise.reject(new Error('[realm-chart] inject("chart") needs { data } (the bound value to plot) — binding not yet produced. (FAIL-LOUD.)')):(r(s),Promise.resolve()):Promise.reject(new Error('[realm-chart] inject: unknown name "'+o+'" (expect "chart"). (FAIL-LOUD.)'))},call:function(o){if(o==="lastData")return n;throw new Error('[realm-chart] call: unknown fn "'+o+'" (expect "lastData"). (FAIL-LOUD.)')},on:function(){return function(){}},start:function(){n&&e.render(n)},stop:function(){},step:function(){return n&&e.render(n),n},dispose:function(){n=null,e.destroy()},_chartEnv:e};return{handle:Pk(i),impl:i}}const yd=["detectorHistogram","absorberStats","liveCount","detectorSurface"],Jg=100;function FP(e,t,n){var r=typeof n=="number"?n:Jg;return t-e>=r}function lm(e){e=e||{};var t=e.handle,n=e.chartEnv,r=e.projector||"detectorHistogram",i=e.kind==="line"?"line":"bar",o=e.label||r;function s(){var x=typeof o=="function"?o():o;return x==null||x===""?r:String(x)}var a=typeof e.now=="function"?e.now:function(){return Date.now()},l=typeof e.throttleMs=="number"?e.throttleMs:Jg,c=e.orientation;function u(){var x=typeof c=="function"?c():c;if(x!=null)return String(x)==="90"?90:0}if(!t||typeof t.on!="function"||typeof t.call!="function")throw new Error("[live-chart-controller] requires a view-handle with on()/call(). (FAIL-LOUD.)");if(!n||typeof n.render!="function"||typeof n.destroy!="function")throw new Error("[live-chart-controller] requires a chart-env with render()/destroy(). (FAIL-LOUD.)");if(yd.indexOf(r)===-1)throw new Error('[live-chart-controller] unknown liveChart projector "'+r+'" (expect one of ['+yd.join(", ")+"]). (FAIL-LOUD.)");var d=-1/0,f=null,h=!1;function v(){var x;try{x=Promise.resolve(t.call(r))}catch(b){return Promise.reject(b)}return x.then(function(b){var g=GS(b);n.render({kind:i,label:s(),labels:g.labels,values:g.values,cells:g.cells,maxV:g.maxV,orientation:u()})})}function m(){FP(d,a(),l)&&(d=a(),v())}return{start:function(){h||f||(f=t.on("tick",m))},stop:function(){if(!h){if(f){try{f()}catch{}f=null}return v()}},dispose:function(){if(!h){if(f){try{f()}catch{}f=null}try{v().catch(function(){})}catch{}h=!0,n.destroy()}}}}var jh=null;function ox(){return jh||(jh=OS(()=>Promise.resolve().then(()=>rz),void 0,import.meta.url).then(function(e){return e.makeChartEnv})),jh}function NP(e){return e?Ko(e.combined)?e.combined:(Ko(e),e):{}}var sx={detectorHistogram:{method:"getCollisionHistogram",drain:!0,project:function(e){return NP(e.getCollisionHistogram())}},absorberStats:{method:"getAbsorbStats",drain:!1,project:function(e){var t=e.getAbsorbStats()||{};return{stored:Number(t.stored)||0,absorbed:Number(t.absorbedTotal)||0,radiated:Number(t.radiatedTotal)||0}}},liveCount:{method:"getLiveCount",drain:!0,project:function(e){return{live:Number(e.getLiveCount())||0}}},detectorSurface:{method:"getCollisionHistogram",drain:!0,project:function(e){return zP(e.getCollisionHistogram())}}},Hc=12;function zP(e){var t=[],n=0,r=e&&e.grid;if(!Ko(r))return{cells:t,maxV:n};var i=new Map;return r.forEach(function(o,s){if(Ko(o)){var a=Math.floor(Number(s)/Hc)*Hc;o.forEach(function(l,c){var u=Math.floor(Number(c)/Hc)*Hc,d=a+","+u;i.set(d,(i.get(d)||0)+(Number(l)||0))})}}),i.forEach(function(o,s){var a=s.split(",");o>n&&(n=o),t.push({x:Number(a[1]),y:Number(a[0]),v:o})}),{cells:t,maxV:n}}function JS(e){var t=e||"detectorHistogram",n=sx[t];if(!n)throw new Error('[live-chart-wiring] unknown liveChart projector "'+t+'" — must be one of ['+Object.keys(sx).join(", ")+"]. (FAIL-LOUD.)");return n}function BP(e,t){var n=JS(t.projector).method;return t.sourceHandle&&typeof t.sourceHandle[n]=="function"?t.sourceHandle:typeof t.source=="string"&&t.source&&e?e.getObjectByName(t.source,function(r){return typeof r[n]=="function"}):null}function XS(e,t){if(!e||!t||typeof t.name!="string"||!t.name)return null;function n(o){return!!(o&&o.gateCounter===t.name&&typeof o.emissionCap=="number")}for(var r=e.declared||[],i=0;i<r.length;i++)if(n(r[i]))return r[i];return null}function UP(e,t){var n=XS(e,t);return n?n.emissionCap:null}function HP(e,t){var n=[];return{on:function(r,i){if(r!=="tick")throw new Error('[live-chart-wiring] adapter only supports the "tick" event. (FAIL-LOUD.)');return n.push(i),function(){var o=n.indexOf(i);o!==-1&&n.splice(o,1)}},call:function(){return t.project(e)},_emitTick:function(){for(var r=0;r<n.length;r++)try{n[r]({})}catch{}}}}function WP(e,t){var n=e.createElement("div"),r=t.rect&&t.rect.w||200,i=t.rect&&t.rect.h||140;n.style&&(n.style.position="absolute",n.style.left="-100000px",n.style.top="0",n.style.width=r+"px",n.style.height=i+"px",n.style.pointerEvents="none"),n.setAttribute("data-role","live-chart-offscreen");var o=e.body||e.documentElement||null;return o&&typeof o.appendChild=="function"&&o.appendChild(n),n}async function QS(e,t){if(t=t||{},!e||!Array.isArray(e.largeObjects)||typeof e.addTickListener!="function")throw new Error("[live-chart-wiring] mountLiveCharts requires a runner with largeObjects and addTickListener(). (FAIL-LOUD.)");var n=t.document||(typeof document<"u"?document:null),r=typeof t.now=="function"?t.now:typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return Date.now()},i=typeof t.makeChartEnv=="function"?t.makeChartEnv:null,o=!1;function s(){i||o||(o=!0,ox().then(function(f){i=f}).catch(function(f){o=!1,typeof console<"u"&&console.error&&console.error("[live-chart-wiring] chart-env factory load failed:",f)}))}var a=[];function l(f,h,v){if(!n||typeof n.createElement!="function")throw new Error("[live-chart-wiring] a DOM document is required to host the offscreen chart canvas. (FAIL-LOUD.)");var m=f.chartSpec,x=WP(n,f),b=i(x),g=HP(h,v),k=lm({handle:g,chartEnv:b,projector:m.projector||"detectorHistogram",kind:m.kind||"bar",label:function(){var E=f.label!=null&&f.label!==""?f.label:m.label||"detector",C=UP(e,h);return C!=null?E+" (cap "+C+")":E},now:r,throttleMs:typeof m.refreshMs=="number"?m.refreshMs:100,orientation:function(){var E=f.orientation!=null?f.orientation:m.orientation;return String(E)==="90"?90:0}});(function(E){f.liveCanvas=function(){return E&&typeof E.querySelector=="function"?E.querySelector("canvas"):null}})(x),k.start(),a.push({lo:f,source:h,desc:v,controller:k,host:x,adapter:g})}function c(){for(var f=0,h=e.largeObjects||[],v=0;v<h.length;v++){var m=h[v];if(!(!m||!m.chartSpec||m._liveChartWired||m._liveChartWireFailed)){var x=JS(m.chartSpec.projector),b=BP(e,m.chartSpec);if(b){try{b[x.method]()}catch(g){throw m._liveChartWireFailed=!0,g}if(!i){s();continue}l(m,b,x),m._liveChartWired=!0,f++}}}return f}var u=function(f){c();for(var h=0;h<a.length;h++){var v=a[h];v.desc.drain&&v.source[v.desc.method](f),v.adapter._emitTick()}},d=e.addTickListener(u);return c(),o&&!i&&(i=await ox(),o=!1,c()),{charts:a,rescan:c,dispose:function(){try{d&&d()}catch{}for(var f=0;f<a.length;f++){var h=a[f];try{h.controller.dispose()}catch{}try{h.host&&h.host.parentNode&&typeof h.host.parentNode.removeChild=="function"&&h.host.parentNode.removeChild(h.host)}catch{}try{h.lo._liveChartWired=!1}catch{}try{h.lo.liveCanvas=null}catch{}}a.length=0}}}function ax(e){var t=e.field||{},n=t.widgetConfig||{},r=t.constraint||{},i=n.min!=null?n.min:r.min!=null?r.min:0,o=n.max!=null?n.max:r.max!=null?r.max:100,s=n.step!=null?n.step:r.integer?1:.1,a=e.value!=null&&e.value!==""?e.value:i;function l(c){var u=r.integer?parseInt(c.target.value,10):parseFloat(c.target.value);isNaN(u)||e.commit(u)}return Ze.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1}},Ze.createElement("input",{type:"range",min:i,max:o,step:s,value:a,style:{flex:1,accentColor:"#7ec8e3"},onChange:l}),Ze.createElement("span",{style:{minWidth:"42px",textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"}},String(a)))}function VP(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function qP(e){if(!e||!Array.isArray(e))return"#888888";function t(n){return("0"+Math.max(0,Math.min(255,Math.round(n))).toString(16)).slice(-2)}return"#"+t(e[0])+t(e[1])+t(e[2])}function $P(e){return Ze.createElement("input",{type:"color",value:qP(Array.isArray(e.value)?e.value:null),style:{width:44,height:22,border:"none",background:"none",cursor:"pointer",padding:0},onChange:function(t){e.commit(VP(t.target.value))}})}var KP={width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"4px",fontSize:"0.62rem"};function YP(e){var t=e.obj||{},n=e.value!=null&&e.value!==""?Math.round(Number(e.value)):0,r=typeof t.getFundamentalDimension=="function"?t.getFundamentalDimension():n;(typeof r!="number"||isNaN(r))&&(r=n);for(var i=Math.max(n,r)+4,o=[],s=0;s<=i;s++)o.push(s);o.indexOf(n)===-1&&(o.push(n),o.sort(function(l,c){return l-c}));function a(l){var c=l===r?" — fundamental":l<r?" — below floor (ratchet)":" — above (slower/redder)";return"Dim "+l+c}return Ze.createElement("select",{value:String(n),style:KP,onChange:function(l){e.commit(parseInt(l.target.value,10))}},o.map(function(l){return Ze.createElement("option",{key:l,value:String(l)},a(l))}))}function GP(e){return Ze.createElement("input",{type:"checkbox",checked:!!e.value,style:{accentColor:"#7ec8e3",cursor:"pointer"},onChange:function(t){e.commit(t.target.checked)}})}var Rh=[{id:"dimension-select",match:function(e,t){return t.widgetHint==="dimension-select"},Component:YP},{id:"oven-temperature",match:function(e,t){return e==="OvenBox"&&t.name==="temperature"},Component:ax},{id:"slider",match:function(e,t){return t.type==="number"&&t.widgetHint==="slider"},Component:ax},{id:"rgb-color-picker",match:function(e,t){return t.type==="rgb"},Component:$P},{id:"boolean-checkbox",match:function(e,t){return t.type==="boolean"},Component:GP}];function JP(e,t){if(!t)return null;for(var n=0;n<Rh.length;n++)if(Rh[n].match(e,t))return Rh[n];return null}var Ca=8,XP=10,QP="rgba(74, 122, 191, 0.85)",ZP="rgba(74, 122, 191, 0.30)",eM="rgba(138, 180, 248, 0.90)",tM="rgba(255, 255, 255, 0.95)",nM="rgba(74, 122, 191, 1.0)";function Ua(e,t){return jA(e,t)}function rM(e,t,n,r,i){if(e){if(typeof i!="function")throw new Error("[author-bbox-overlay] paintAuthorOverlay needs the host's world→overlay map (toOverlay) — there is no camera-blind default. (FAIL-LOUD.)");e.clearRect(0,0,e.canvas.width,e.canvas.height);for(var o=0;o<t.length;o++){var s=t[o],a=s.ref;if(a){var l=Ua(a,r);if(l){var c=i(l);if(!(!c||c.width<=0||c.height<=0)){var u=a===n;e.fillStyle=ZP,e.fillRect(c.left,c.top,c.width,c.height),e.strokeStyle=u?eM:QP,e.lineWidth=u?2:1,e.setLineDash([4,3]),e.strokeRect(c.left,c.top,c.width,c.height),e.setLineDash([]),u&&iM(e,c)}}}}}}function iM(e,t){var n=XP,r=n/2,i=t.left+t.width/2,o=t.top+t.height/2,s=[{x:t.left,y:t.top},{x:t.left+t.width,y:t.top},{x:t.left,y:t.top+t.height},{x:t.left+t.width,y:t.top+t.height},{x:i,y:t.top},{x:i,y:t.top+t.height},{x:t.left,y:o},{x:t.left+t.width,y:o}];e.fillStyle=tM,e.strokeStyle=nM,e.lineWidth=1.5;for(var a=0;a<s.length;a++){var l=s[a];e.fillRect(l.x-r,l.y-r,n,n),e.strokeRect(l.x-r,l.y-r,n,n)}}function Lh(e,t){if(!e)return null;var n=e,r=t.x,i=t.y;if(r<n.left-Ca||r>n.left+n.width+Ca||i<n.top-Ca||i>n.top+n.height+Ca)return null;var o=Ca,s=n.left+n.width/2,a=n.top+n.height/2,l=n.width<2*o||n.height<2*o;if(!l){if(hn(r,n.left,o)&&hn(i,n.top,o))return"scale-tl";if(hn(r,n.left+n.width,o)&&hn(i,n.top,o))return"scale-tr";if(hn(r,n.left,o)&&hn(i,n.top+n.height,o))return"scale-bl";if(hn(r,n.left+n.width,o)&&hn(i,n.top+n.height,o))return"scale-br";if(hn(r,s,o)&&hn(i,n.top,o))return"scale-t";if(hn(r,s,o)&&hn(i,n.top+n.height,o))return"scale-b";if(hn(r,n.left,o)&&hn(i,a,o))return"scale-l";if(hn(r,n.left+n.width,o)&&hn(i,a,o))return"scale-r"}return r>=n.left&&r<=n.left+n.width&&i>=n.top&&i<=n.top+n.height?"move":null}function hn(e,t,n){return Math.abs(e-t)<=n}function lx(e){return!e||e==="move"?"grab":e==="scale-tl"||e==="scale-br"?"nwse-resize":e==="scale-tr"||e==="scale-bl"?"nesw-resize":e==="scale-t"||e==="scale-b"?"ns-resize":e==="scale-l"||e==="scale-r"?"ew-resize":"default"}function oM(e,t,n){var r=Object.assign({},e),i=n.x,o=n.y;return t==="scale-tl"?(r.left+=i,r.top+=o,r.width-=i,r.height-=o):t==="scale-tr"?(r.top+=o,r.width+=i,r.height-=o):t==="scale-bl"?(r.left+=i,r.width-=i,r.height+=o):t==="scale-br"?(r.width+=i,r.height+=o):t==="scale-t"?(r.top+=o,r.height-=o):t==="scale-b"?r.height+=o:t==="scale-l"?(r.left+=i,r.width-=i):t==="scale-r"&&(r.width+=i),r.width<4&&(r.width=4),r.height<4&&(r.height=4),r}var sM={loading:"The scene is loading",paused:"Run the scene to record it","rate-unmeasured":"Record waits for the scene's measured tick rate (about a second after Run)"};function aM(e){var t=sM[e.reason];if(!t)throw new Error('[AuthorView] FrqtlVision.recordRefusal gave reason "'+e.reason+'", which the Record button has no title for — add it to REC_REFUSAL_TITLES. (FAIL-LOUD.)');return t}function ot(e){var t=nc(e);if(!t)throw new Error("[AuthorView] the STUDIO frame's modules are not loaded — loadFrameModules(cw, router) (lib/features/ide/frame-modules.js) runs in grab() before a runner is taken. (FAIL-LOUD.)");return t}function cr(e){return!!(e&&nc(e))}function Ha(e,t){return e&&e.FrqtlPage?e.FrqtlPage[t]:null}var Wc=Mi,ZS="empty",lM="data-frqtl-renderer";function cx(e){var t=e&&e.document&&e.document.documentElement;return t&&t.getAttribute(lM)||null}function cM(e,t){var n=function(o){return!!(o&&o.phases&&o.phases.renderer&&o.phases.renderer.complete)};if(n(om(e.document)))return t(),function(){};var r=e.frameElement;if(!r)return function(){};var i=function(o){n(o.detail)&&(r.removeEventListener(ol,i),t())};return r.addEventListener(ol,i),function(){r.removeEventListener(ol,i)}}function ux(e){return e&&Array.isArray(e.presets)?e.presets:[]}function dx(e){return e&&Array.isArray(e.poseFields)?e.poseFields:[]}var fx="▶ Run",hx="▌▌ Pause",px="● Rec",mx="Saving…";function uM(e){var t=Math.max(0,Math.floor(e/1e3));return Math.floor(t/60)+":"+(t%60<10?"0":"")+t%60}function gx(e){return"■ Stop ● "+uM(e)}var Vc={hand:"grab",dropper:"crosshair",pencil:"default"},dM=4,or="design",sr="run";function vx(e){var t=j.useRef(null),[n,r]=j.useState(null);j.useLayoutEffect(function(){var o=t.current;if(o){for(var s=0,a=0;a<o.children.length;a++)s=Math.max(s,o.children[a].getBoundingClientRect().width);var l=Math.ceil(s);l>0&&l!==n&&r(l)}});var i=Object.assign({},e);return delete i.labels,delete i.style,delete i.children,y.jsxs(Ze.Fragment,{children:[y.jsx("button",{...i,style:Object.assign({},e.style,n?{width:n+"px",boxSizing:"border-box",textAlign:"center",whiteSpace:"nowrap"}:null),children:e.children}),y.jsx("span",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:"-10000px",top:0,visibility:"hidden",pointerEvents:"none"},children:e.labels.map(function(o){return y.jsx("span",{style:Object.assign({},e.style,{display:"inline-block",boxSizing:"border-box",whiteSpace:"nowrap",width:"auto"}),children:o},o)})})]})}function qc(e){var t=e.kind,n={width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto"}};return t==="hand"?y.jsxs("svg",{...n,children:[y.jsx("path",{d:"M18 11V6a2 2 0 0 0-4 0v5"}),y.jsx("path",{d:"M14 10V4a2 2 0 0 0-4 0v6"}),y.jsx("path",{d:"M10 10.5V6a2 2 0 0 0-4 0v8"}),y.jsx("path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"})]}):t==="dropper"?y.jsxs("svg",{...n,children:[y.jsx("path",{d:"m2 22 1-4 11-11 3 3L6 21z"}),y.jsx("path",{d:"m14 7 3 3"}),y.jsx("path",{d:"M17 4a2.83 2.83 0 0 1 4 4l-2 2-4-4z"})]}):y.jsxs("svg",{...n,children:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"})]})}var fM=["emitter","boundary","composite","measurement","circuit"],hM={emitter:"Emitters",boundary:"Boundaries",composite:"Composite",measurement:"Measurement",circuit:"Circuit"};function fs(e,t){var n=ZS,r=typeof window<"u"&&window.location?window.location.search:"",i=Dg(e,n,"wasm",r);return i=sS(i,t),aL(i,"canvas")}function pM(e){var t=j.useRef(null),n=j.useRef(null),r=j.useRef(e.onChange);return r.current=e.onChange,j.useEffect(function(){var i=e.cw,o=t.current;if(!(!cr(i)||!o)){var s=Object.assign({},e.control,{onChange:function(l){r.current(l)}}),a=ot(i).FrqtlControlSlider.mount(o,{descriptor:s});return n.current=a,function(){a.dispose(),n.current=null}}},[e.cw,e.control.id]),j.useEffect(function(){if(n.current){var i=typeof e.control.fmt=="function"?e.control.fmt(e.control.value):String(e.control.value);n.current.setValue(e.control.value,i)}},[e.control.value]),y.jsx("div",{ref:t,style:{flex:1}})}function mM(e){var t=e.ready,n=e.ctxRef,r=e.reloadKey,[i,o]=j.useState(null),[s,a]=j.useState(null),l=j.useRef(null);j.useEffect(function(){if(o(null),a(null),l.current&&(l.current.dispose(),l.current=null),!!t){var u=n.current.cw;if(!cr(u)){o([]);return}var d=Ha(u,"controls"),f=d&&typeof d.controlNames=="function"?d.controlNames():[];if(f.length===0){o([]);return}var h=f[0];a(h);var v=ot(u).ShimRpc.makeInAppRpc(function(m,x){return ot(u).FrqtlControlsPanel.dispatch(d,m,x)});return l.current=v,v.call("listControls",[h]).then(function(m){o(m)}).catch(function(){o([])}),function(){v.dispose()}}},[t,r]);function c(u,d){if(!(!l.current||!s)){var f=n.current.writeQueue,h=function(){l.current.call("setControlValue",[s,u,d]).then(function(v){o(function(m){return(m||[]).map(function(x){return x.id===u?Object.assign({},x,v):x})})}).catch(function(v){window.console&&console.error&&console.error("[AuthorView PageControls] setControlValue failed:",v)})};f&&typeof f.write=="function"?f.write(s+"."+u,h):h()}}return i===null?y.jsx("div",{style:bd,children:"Loading page controls…"}):i.length===0?y.jsx("div",{style:bd,children:"No page-level controls declared by this experiment."}):y.jsx("div",{children:i.map(function(u){var d=typeof u.min=="number"&&typeof u.max=="number";return y.jsxs("div",{style:cm,"data-page-control":u.id,children:[y.jsx("div",{style:um,title:u.label,children:u.label}),d?y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1},children:[y.jsx("input",{type:"range",min:u.min,max:u.max,step:u.step,value:u.value,style:{flex:1,accentColor:"#7ec8e3"},onChange:function(f){c(u.id,parseFloat(f.target.value))}}),y.jsx("span",{style:{minWidth:42,textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"},children:u.valueText})]}):y.jsx("span",{style:dm,children:u.valueText})]},u.id)})})}var bd={color:"#6a6a6a",fontSize:"0.62rem"},cm={display:"flex",alignItems:"center",gap:"6px",padding:"3px 0"},um={flex:"0 0 40%",color:"#9a9a9a",fontSize:"0.64rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dm={color:"#ccc",fontSize:"0.64rem"};function gM(e){var t=e.ready,n=e.ctxRef,r=e.reloadKey,[i,o]=j.useState(null),s=e.retained||[];function a(){var u=n.current.cw,d=n.current.runner;if(!cr(u)||!d){o([]);return}var f;try{f=ot(u).MakeControlsForRenderSurface.makeControlsForRenderSurface({runner:d})}catch(h){window.console&&console.error&&console.error("[AuthorView RenderControls] makeControlsForRenderSurface failed:",h),o([]);return}o(f.controls.map(function(h){return Object.assign({},h,{valueText:typeof h.fmt=="function"?h.fmt(h.value):String(h.value)})}))}j.useEffect(function(){if(o(null),!!t){a();var u=n.current.runner;if(!u||typeof u.addRenderOptionsListener!="function")throw new Error("[AuthorView RenderControls] runner.addRenderOptionsListener is missing — the runner announces every applied render-option write; the panel reads back on it. (FAIL-LOUD.)");return u.addRenderOptionsListener(function(){a()})}},[t,r]);function l(u,d){var f=n.current.cw,h=n.current.runner;if(!(!f||!h)){var v=n.current.writeQueue,m=function(){try{ot(f).ControlBind.resolveBind(u.bind,{runner:h},"render").set(d)}catch(x){window.console&&console.error&&console.error("[AuthorView RenderControls] write failed:",x)}};v&&typeof v.write=="function"?v.write("render."+u.id,m):m()}}if(i===null)return y.jsx("div",{style:bd,children:"Loading render controls…"});var c=s.map(function(u){return y.jsxs("div",{style:cm,"data-role":"studio-render-retained",children:[y.jsx("div",{style:um,title:u.key,children:u.key}),y.jsxs("span",{style:dm,children:[String(u.value)," — not available on ",e.rendererName||"this renderer"]})]},"retained:"+u.key)});return i.length===0?y.jsxs("div",{children:[y.jsx("div",{style:bd,children:"The active renderer declares no render controls."}),c]}):y.jsxs("div",{children:[i.map(function(u){var d=u.kind==="scalar"&&u.min===0&&u.max===1&&u.step===1,f=u.kind==="scalar"&&!d;return y.jsxs("div",{style:cm,"data-render-row":u.id,children:[y.jsx("div",{style:um,title:u.label,children:u.label}),d?y.jsx("input",{type:"checkbox",checked:!!u.value,onChange:function(h){l(u,h.target.checked?1:0)},style:{accentColor:"#7ec8e3"}}):f?y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",flex:1},children:[y.jsx("input",{type:"range",min:u.min,max:u.max,step:u.step,value:u.value,style:{flex:1,accentColor:"#7ec8e3"},onChange:function(h){l(u,parseFloat(h.target.value))}}),y.jsx("span",{style:{minWidth:42,textAlign:"right",color:"#7ec8e3",font:"11px ui-monospace,Menlo,Consolas,monospace"},children:u.valueText})]}):u.kind==="enum"?y.jsx("select",{value:u.value,style:{flex:1,background:"#1a1a1a",color:"#ccc",border:"1px solid #2a2a2a",borderRadius:"2px",font:"11px ui-monospace,Menlo,Consolas,monospace"},onChange:function(h){l(u,h.target.value)},children:u.values.map(function(h){return y.jsx("option",{value:h,children:h},h)})}):y.jsx("span",{style:dm,children:u.valueText})]},u.id)}),c]})}function vM({experimentBase:e,monacoBaseUrl:t,initialProject:n,deepLinkRefusal:r,roster:i,initialWalkthrough:o,initialWalkthroughMode:s,initialScene:a,initialSceneRenderer:l,resolveScript:c,onLinkSelect:u}){if(!e||typeof c!="function")throw new Error("[AuthorView] experimentBase and resolveScript are required — mount AuthorView through FraqtlIde (lib/features/ide/index.jsx), the only mounter, which derives both from its engineRouter.");Jt(i,"AuthorView({ experimentBase, roster, resolveScript, … })");var d=j.useRef(null),f=j.useRef(null),h=j.useRef(null),v=j.useRef(null),m=j.useRef(null),x=j.useRef(null),b=j.useRef(null),g=j.useRef(null),k=j.useRef(null),E=j.useRef(null),C=j.useRef(null),S=j.useRef({runner:null,backdrop:null,Filters:null,cw:null,tool:null,dropType:null,controlsRegistry:null,controlsNameByObject:null,controlsNameCounters:null}),M=j.useRef({active:!1,lo:null,startX:0,startY:0,zone:null,origBbox:null}),[L,T]=j.useState({projectId:null,name:Wc,dirty:!1}),[V,G]=j.useState([]),[N,te]=j.useState([]),[W,Y]=j.useState(null),[re,pe]=j.useState([]),B=j.useRef([]),[ee,ce]=j.useState(null),ve=j.useRef(null),[ke,je]=j.useState(function(){return fs(e)}),[ie,me]=j.useState(or),xe=j.useRef(or),[ge,kt]=j.useState(!1),[ut,_n]=j.useState(null),[tn,ir]=j.useState(null),ht=tn?tn.text:null;function ye(p,w){ir(p==null?null:{source:w||"general",text:String(p)})}function St(p){ir(function(w){return w&&w.source===p?null:w})}var[ln,Wn]=j.useState(null),An=j.useRef(!1),Pn=j.useRef(null),[Mn,vr]=j.useState({particles:!0,backdrop:!1}),[Xt,Pt]=j.useState([]),[Ut,Et]=j.useState(null),De=j.useRef(null),Tn=j.useRef(null),[I,de]=j.useState(null),[fe,Ie]=j.useState({fpsLimit:0,tpsLimit:0}),[Ft,cn]=j.useState(null),[Xe,un]=j.useState(null),[Pe,Mt]=j.useState({phase:"idle"}),[Wt,Dn]=j.useState(0),lt=j.useRef(null),we=j.useRef(null),[pt,_]=j.useState(null),[R,P]=j.useState(null),$=j.useRef(null),U=j.useRef(null),[H,he]=j.useState(null),[Ae,Ve]=j.useState(0),[Qe]=j.useState(function(){return Bk(window)}),[Be,Ce]=j.useState(!Qe),[qe,nn]=j.useState(!Qe),[F,K]=j.useState(null),[We,kn]=j.useState({}),[Nt,Sn]=j.useState(null),[bt,ct]=j.useState(null),[$r,lo]=j.useState([]),[wE,yv]=j.useState([]),[_E,bv]=j.useState(null),[Pr,kE]=j.useState(null),[SE,ac]=j.useState(!1),[bf,xv]=j.useState(""),[co,ua]=j.useState(null),[uo,xf]=j.useState(!1),wv=j.useRef(null),[_v,EE]=j.useState(0);j.useEffect(function(){var p=wv.current,w=p?p.offsetWidth:0;w!==_v&&EE(w)});var lc=j.useRef({host:null,frame:null,frameCw:null});function cc(){var p=S.current.cw,w=S.current.runner;w&&p&&Ha(p,"runner")===w?Vt(w,S.current.backdrop,De.current):Ef()}j.useEffect(function(){var p=f.current&&f.current.parentElement;if(!p||typeof ResizeObserver!="function")throw new Error("[AuthorView] the canvas region (or ResizeObserver) is missing — the overlay is re-measured when the region's box changes. (FAIL-LOUD.)");var w=new ResizeObserver(function(){cc()});return w.observe(p),window.addEventListener("resize",cc),lc.current.host=w,function(){w.disconnect(),window.removeEventListener("resize",cc);var O=lc.current.frame;if(O)try{O.disconnect()}catch{}lc.current={host:null,frame:null,frameCw:null}}},[]);function kv(p){var w=lc.current;if(w.frameCw!==p){if(w.frame)try{w.frame.disconnect()}catch{}if(typeof p.ResizeObserver!="function")throw new Error("[AuthorView] the experiment frame has no ResizeObserver — the overlay follows the frame's canvas box through it. (FAIL-LOUD.)");w.frame=new p.ResizeObserver(function(){cc()}),w.frameCw=p}var O=p.document.getElementById("canvas-wrapper");O&&w.frame.observe(O);for(var A=p.document.querySelectorAll("canvas"),D=0;D<A.length;D++)w.frame.observe(A[D])}var[wf,Sv]=j.useState(!1),[Vn,OE]=j.useState(null),rt=j.useRef(null),[CE,uc]=j.useState(null),ns=j.useRef("seed"),_f=j.useRef(!1);function Mr(p){var w=typeof p=="function"?p(rt.current):p;rt.current=w,OE(w)}function da(){var p=Ha(S.current.cw,"experiment");return p&&typeof p.toSketch=="function"?p:null}function fa(){return rt.current?mA(rt.current):null}function Ev(p){if(typeof p[$o(fa())]!="string")throw new Error("the facade wrote no entry sketch (files: "+Object.keys(p).join(", ")+")");Mr(Hb(rt.current,p))}function kf(p){return rm+" (unrun: "+Eu(p).join(", ")+")"}function Ov(p){Mr(function(w){var O=Dr(w);return ms(O)||Sa(w,O).text===p?w:Ub(w,O,p)})}function jE(p){var w=Eu(p);return y.jsx("div",{style:_e.filePickerRow,children:y.jsx("select",{"data-role":"studio-file-picker",value:Dr(p),style:_e.filePicker,onChange:function(O){var A=O.target.value;Mr(function(D){return Bb(D,A)})},children:SS(p).map(function(O){return y.jsx("option",{value:O,children:O+(ms(O)?" (read-only)":"")+(w.indexOf(O)!==-1?" (edited)":"")},O)})})})}function Kr(p){var w=rt.current,O=da();return!w||!O?(ye(p+" is not written into code — the scene's sketch text has not loaded, so a hand moves the running scene only.","hand"),Promise.resolve()):xh(w)?(ye(p+" refused — "+kf(w),"hand"),Promise.resolve()):O.toSketch().then(function(A){Ev(A.files),A.refused.length?ye(p+" — not written: "+A.refused.map(function(D){return D.reason}).join(" "),"hand"):St("hand")}).catch(function(A){ye(p+" could not be written into the code: "+(A&&A.message?A.message:A),"hand")})}j.useEffect(function(){xe.current=ie},[ie]),j.useEffect(function(){S.current.tool=pt,Av()},[pt]),j.useEffect(function(){S.current.dropType=R},[R]),j.useEffect(function(){De.current=Ut},[Ut]),j.useEffect(function(){rs()},[]),j.useEffect(function(){var p=!0;return tP({refusal:r,walkthrough:o,mode:s,project:n,scene:a,renderer:l},{roster:i,pageOrigin:window.location.origin,baseURI:document.baseURI,loadProject:function(w){return kh(gn(),w)}}).then(function(w){p&&(w.select&&ho(w.select.value,w.select.mode,w.select.opts),An.current=w.run,w.err&&Wn(w.err),AS(document.documentElement,w.id),w.id==="ok"&&w.select&&w.select.value.indexOf("walkthrough:")===0&&_n({id:w.select.value.slice(12),modeId:w.select.mode}))},function(w){p&&ye("STUDIO could not resolve its deep link: "+(w&&w.message?w.message:w))}),function(){p=!1}},[]),j.useEffect(function(){var p=g.current,w=b.current;if(!ut||!p||!w)return;var O=hS(i,ut),A=mS(i);if(!O){var D=ea(i,ut),z=D+" has no showcase-roster row",oe=Us(p,D,"not-offered-no-roster-row",z),Q=Us(w,A?A.seenKey:D,"not-offered-no-roster-row",z);return function(){oe.close(),Q.close()}}var J=pS(i,O),ne=sP(i,ut),Fe=null;function Me(){Fe||(Fe=dP(C.current,i,ne,{onPhone:Qe,dock:Qe?"top":"flow",runnerOf:function(){return S.current.runner},exportsOf:function(){var Ue=da();return Ue&&Ue.world?Ue.sceneExports:null},onError:function(Ue){ye(Ue,"tryit")}}))}var it={seenKey:J.seenKey,title:J.title,paragraphs:J.paragraphs};ne&&(it.onContinue=Me);var le=Pl(p,it,{covers:E.current});ne&&le.ready.then(function(Ue){Ue.shows||Me()});var Oe=A?Pl(w,A,{covers:k.current}):Us(w,J.seenKey,"not-offered-no-roster-row",J.seenKey+": the roster has no showcase intro");return function(){Oe.close(),le.close(),Fe&&Fe.close()}},[ut]),j.useEffect(function(){!ge||!An.current||(An.current=!1,qv())},[ge]);function rs(){var p;try{p=gn()}catch{G([]),te([]);return}G(_A(p).map(function(w){return{id:w.name,name:w.name}})),te(kA(p))}function RE(){var p=N;if(p.length&&window.confirm("Delete "+p.length+" save"+(p.length===1?"":"s")+" in the retired project format? They cannot be opened, and this cannot be undone.")){try{SA(gn(),p)}catch(w){ye("Delete retired saves failed: "+(w&&w.message?w.message:w),"retired")}rs()}}function Cv(){var p=S.current.runner,w=S.current.cw,O=S.current.backdrop;if(!p||!w)return null;var A=cx(w),D=null,z=null;try{var oe=new URLSearchParams(w.location.search);D=oe.get("engine"),z=oe.get("seed")}catch{}var Q=ot(w).MakeControlsForRenderSurface.makeControlsForRenderSurface({runner:p}),J=kP(Q.controls).concat(B.current),ne=p.cameraControl||null,Fe=ne?{orbit:ne.getOrbit(),preset:bt||ve.current||null}:null,Me=_P(O);return yi({version:1,renderer:A,engine:D,seed:z,backdropVisible:Me,camera:Fe,render:J})}function LE(p,w,O){if(!(!O||!p||!w)){if(!p.FrqtlPage||typeof p.FrqtlPage.applyRenderState!="function")throw new Error("the STUDIO frame has no FrqtlPage.applyRenderState — a saved render state is replayed only on the blank universe page (experiments/empty/index.html). (FAIL-LOUD.)");var A=p.FrqtlPage.applyRenderState(O);B.current=A.retained,pe(A.retained);var D=A.camera==="retained"?A.preset:null;return ve.current=D,ce(D),(A.camera==="preset"||A.camera==="orbit")&&(Sn(w.cameraControl.getOrbit()),ct(A.preset),Af(w)),A.backdrop!==null&&vr(function(z){return Object.assign({},z,{backdrop:A.backdrop})}),A}}function jv(p){var w;try{w=Cv()}catch(O){return ye(p+" refused — "+(O&&O.message?O.message:O)),{ok:!1}}return!w&&L.walkthroughId&&(w=Qi(Kt(i,L.walkthroughId),L.walkthroughMode)),{ok:!0,state:w}}function Rv(p,w){window._egptPendingFolder=Object.assign({},p),Y(null),ns.current="run",window._egptPendingRenderState=w;var O=w?{renderer:w.renderer,seed:w.seed}:null;uc(null),kt(!1),ye(null),Et(null),De.current=null,Pt([]),me(or),je(fs(e,O)+"&_r="+Date.now())}function AE(p){if(!(typeof p!="string"||!rt.current)){var w=Dr(rt.current);!ms(w)&&p!==Sa(rt.current,w).text&&Mr(Ub(rt.current,w,p));var O=jv("Run");O.ok&&(T(function(A){return Object.assign({},A,{dirty:!0})}),Rv(bh(rt.current),O.state))}}function Lv(){var p=rt.current?Dr(rt.current):null,w=rt.current?$o(fa()):null;return L.walkthroughId?p===w?Kt(i,L.walkthroughId).source:L.walkthroughId+"/"+p:L.projectId&&p?L.projectId+"/"+p:L.sceneUrl?L.name+"/"+(p||w):of+"/"+(p||w)}function PE(){if(uc(null),L.walkthroughId){ho("walkthrough:"+L.walkthroughId,L.walkthroughMode);return}if(L.projectId){ho("project:"+L.projectId);return}if(L.sceneUrl&&Pn.current){ho(Lo+L.sceneUrl,null,{quiet:!0,folder:Pn.current.folder,link:Pn.current.link});return}ho(Wc)}function dc(p){return rt.current?!1:(ye(p+" refused — this scene has no sketch text (the scene has not finished loading)."),!0)}function Av(){var p=S.current.cw;try{var w=p&&p.document.querySelector("canvas");w&&(w.style.cursor=Vc[S.current.tool]||"default")}catch{}}var qn=j.useCallback(function(p){Pt(p?Eh(p.declared):[])},[]),Vt=j.useCallback(function(p,w,O,A){var D=f.current;if(D){var z=D.getContext("2d");if(z){var oe=A??xe.current;if(Ef(),!p){z.clearRect(0,0,D.width,D.height);return}if(is(p)){z.clearRect(0,0,D.width,D.height);return}var Q=Eh(p.declared);if(oe===sr){if(!O){z.clearRect(0,0,D.width,D.height);return}Q=Q.filter(function(J){return J&&J.ref===O})}rM(z,Q,O||null,p,fc)}}},[]);function is(p){var w=S.current.cw;if(!w)throw new Error("[AuthorView] no experiment frame is grabbed — OrbitBag.hasAngularPose, the ONE 3D-ness predicate (lib/frqtl/compat/renderer/orbit-bag.js), is read off the frame's modules. (FAIL-LOUD.)");return ot(w).OrbitBag.hasAngularPose(p?p.cameraControl:null)}function os(p,w,O){var A=S.current.runner,D=A&&A.renderer;if(!D||typeof D.screenToWorld!="function")throw new Error("[AuthorView] the active renderer provider has no screenToWorld capability (RENDERER_CONTRACT) — STUDIO maps the canvas only through the camera's own screenToWorld. (FAIL-LOUD.)");var z=f.current;return D.screenToWorld(p,w,z.width,z.height,O)}function ME(p,w){return ot(S.current.cw).LoDrawnCenter.drawnCenter(p.envelopeOf(w))[2]}function Pv(p,w){var O=f.current,A=S.current.runner.screenPointOf([p,w,0],O.width,O.height);return A?{x:A[0],y:A[1]}:null}function fc(p){if(!p)return null;var w=Pv(p.left,p.top),O=Pv(p.left+p.width,p.top+p.height);return!w||!O?null:{left:w.x,top:w.y,width:O.x-w.x,height:O.y-w.y}}function Sf(){if(Qe){var p=d.current,w=f.current,O=w&&w.parentElement,A=null;try{A=p&&p.contentDocument}catch{A=null}var D=A?A.querySelectorAll('[data-role="camera-joystick"]'):[],z=null;if(O&&D.length===2){var oe=D[0].getBoundingClientRect(),Q=D[1].getBoundingClientRect(),J=p.getBoundingClientRect(),ne=O.getBoundingClientRect(),Fe=oe.left<Q.left?oe:Q,Me=oe.left<Q.left?Q:oe;z={x:J.left-ne.left+(Fe.right+Me.left)/2,y:J.top-ne.top+(Fe.top+Fe.bottom)/2}}K(function(it){return it===z||it&&z&&it.x===z.x&&it.y===z.y?it:z})}}function Ef(){Sf();var p=f.current;if(p){var w=d.current,O=null;try{if(w&&w.contentDocument){for(var A=w.contentDocument.querySelectorAll("canvas"),D=0;D<A.length;D++){var z=A[D].getBoundingClientRect();if(z.width>0&&z.height>0){O=A[D];break}}!O&&A.length&&(O=A[0])}}catch{}if(!O){var oe=p.parentElement;oe&&(p.style.left="0",p.style.top="0",p.style.width="100%",p.style.height="100%",p.style.right="",p.style.bottom="",p.width=oe.clientWidth,p.height=oe.clientHeight);return}var Q=O.getBoundingClientRect(),J=w.getBoundingClientRect(),ne=p.parentElement?p.parentElement.getBoundingClientRect():J,Fe=J.left-ne.left+Q.left,Me=J.top-ne.top+Q.top,it=Q.width,le=Q.height,Oe=Math.round(it),Ue=Math.round(le);p.width!==Oe&&(p.width=Oe),p.height!==Ue&&(p.height=Ue),kE(function(X){return X&&X.left===Fe&&X.top===Me&&X.width===it&&X.height===le?X:{left:Fe,top:Me,width:it,height:le}})}}function Of(p,w,O){if(p.controlsNameByObject||(p.controlsNameByObject=new WeakMap),p.controlsNameByObject.has(O))return p.controlsNameByObject.get(O);p.controlsNameCounters||(p.controlsNameCounters={}),p.controlsNameCounters[w]=(p.controlsNameCounters[w]||0)+1;for(var A=O&&typeof O.name=="string"&&O.name?O.name:w+"#"+p.controlsNameCounters[w],D=A,z=1;p.controlsRegistry&&p.controlsRegistry.hasObject(D);)D=A+"_"+ ++z;return p.controlsNameByObject.set(O,D),D}function Mv(p,w){var O=S.current.cw,A=S.current.runner,D=S.current.controlsRegistry;if(!(!O||!A||!D||!p)){var z=Of(S.current,w,p);if(!D.hasObject(z)){var oe;try{oe=ot(O).MakeControlsForObject.makeControlsForObject(p,{},{kind:w,name:z})}catch(J){window.console&&console.error&&console.error("[AuthorView] makeControlsForObject failed for "+w+' "'+z+'":',J);return}var Q=oe.controls.map(function(J){return Object.assign({},J,{onChange:function(ne){A.updateObjectProperty(p,J.bind.prop,ne),Kr("Knob")}})});D.registerObject(z,p,w),D.registerControls(z,Q)}}}function TE(p){var w=S.current.controlsRegistry;if(!(!w||!p||!S.current.controlsNameByObject)){var O=S.current.controlsNameByObject.get(p);O&&(w.hasControls(O)&&w.unregisterControls(O),w.hasObject(O)&&w.unregisterObject(O))}}function Cf(){var p=S.current.runner;p&&p.declared.forEach(function(w){Mv(w,w._schemaKind)})}function jf(p,w,O,A,D,z){p.updateObjectProperty(w,"rect",ot(S.current.cw).LoDrawnCenter.snapRectPosition([O,A,D,z]))}function Tv(p){var w=S.current.cw;if(!cr(w)||!p)return null;var O=ot(w).ObjectSchema;try{return O.ux(p._schemaKind)}catch{return null}}function Dv(p,w){if(!w||w==="move")return w;var O=Tv(p);return O&&(O.resizable===!1||Array.isArray(O.handles)&&O.handles.indexOf(w)===-1)?"move":w}function DE(p,w,O){for(var A=ot(p).ObjectSchema.placeableCatalog(),D=0;D<A.length;D++)if(A[D].kind===w&&A[D].defaultProps&&Object.prototype.hasOwnProperty.call(A[D].defaultProps,"is2D"))return{is2D:!O};return null}function Iv(p,w,O){var A=S.current.cw,D=S.current.runner,z=S.current.backdrop,oe,Q;Promise.resolve().then(function(){if(!A||!D)throw new Error("the canvas frame has no "+[!A&&"window (ctx.cw)",!D&&"experiment runner (FrqtlPage.runner)"].filter(Boolean).join(" and no ")+" — nothing to place into.");var J=IE(w,O);oe=J.x,Q=J.y;var ne=DE(A,p,is(D));return ne}).then(function(J){var ne=RA(p,D,A,oe,Q,J);Mv(ne,ne._schemaKind),qn(D,z),Et(ne),De.current=ne,fo(D),Vt(D,z,ne),T(function(Fe){return Object.assign({},Fe,{dirty:!0})}),Kr("Drop"),Fv(),St("drop")}).catch(function(J){window.console&&console.error&&console.error("[AuthorView] place "+p+" failed:",J),Fv(),ye("Place "+p+" failed: "+(J&&J.message?J.message:J),"drop")})}function IE(p,w){var O=os(p,w,0);if(!O)throw new Error("that canvas point does not meet the drop plane (z = 0) from this camera view — drop where the scene is visible.");return O}function Fv(){_("hand"),P(null),S.current.tool="hand",S.current.dropType=null}function FE(){var p=f.current;if(!p||p.__egptOverlayHandlers)return;p.__egptOverlayHandlers=!0;var w=bP({hitTest:function(X,Se){var se=S.current.runner,ae=se?Rf(se,X,Se):null;return ae?ae.ref:null},handArmed:function(){return S.current.tool==="hand"},emit:function(X){X.kind==="press"?O(X.x,X.y):X.kind==="drag"?D(X.x,X.y):X.kind==="hover"?oe(X.x,X.y):X.kind==="release"?Q():X.kind==="hold"?J(X.x,X.y):X.kind==="reset"?VE():X.kind==="world"?Fe(X):X.kind==="object"&&Ue(X)}});xP(p,w);function O(X,Se){var se=S.current.runner;if(se){var ae=S.current.backdrop,be=S.current.tool;if(be){if(be==="dropper"){S.current.dropType&&Iv(S.current.dropType,X,Se);return}var $e=is(se),Je=Rf(se,X,Se);if(Je){var mt=Je.ref;if(Et(mt),De.current=mt,qn(se,ae),Vt(se,ae,mt),be==="pencil"){$e&&(p.style.cursor="default");return}A(se,mt,Je.zone,X,Se)}else Et(null),De.current=null,Vt(se,ae,null),M.current.active=!1,$e&&(p.style.cursor="default")}}}function A(X,Se,se,ae,be){if(!X.positionAuthorityOf(Se)){ye("Not moved: "+X.noPositionAuthorityMessage(Se),"drag"),p.style.cursor="not-allowed";return}St("drag");var $e=Ua(Se,X),Je=ME(X,Se),mt=os(ae,be,Je);if(!mt){p.style.cursor="not-allowed";return}M.current={active:!0,lo:Se,startX:mt.x,startY:mt.y,planeZ:Je,zone:se,origBbox:$e?Object.assign({},$e):null},p.style.cursor=lx(se)}function D(X,Se){var se=S.current.runner;if(se){var ae=S.current.backdrop,be=M.current;if(!(!be.active||!be.lo)){var $e=os(X,Se,be.planeZ);if($e){var Je={x:$e.x-be.startX,y:$e.y-be.startY};if(be.moved=!0,be.origBbox){var mt=be.origBbox;if(be.zone==="move"||!be.zone){var gc=se.envelopeOf(be.lo);jf(se,be.lo,mt.left+Je.x,mt.top+Je.y,gc.w,gc.h)}else{var wi=oM(mt,be.zone,Je);jf(se,be.lo,wi.left,wi.top,wi.width,wi.height)}}z(se,ae,be.lo)}}}}function z(X,Se,se){qn(X,Se),Vt(X,Se,se);try{X.repaint()}catch(ae){window.console&&console.warn&&console.warn("[AuthorView] hand: repaint() failed:",ae)}T(function(ae){return Object.assign({},ae,{dirty:!0})})}function oe(X,Se){var se=S.current.runner;if(se){var ae=De.current;if(ae&&!is(se)){var be=Ua(ae,se);if(be){var $e=fc(be),Je=Dv(ae,Lh($e,{x:X,y:Se}));p.style.cursor=Je?lx(Je):Vc[S.current.tool]||"default";return}}p.style.cursor=Vc[S.current.tool]||"default"}}function Q(){if(M.current.active){var X=!!M.current.moved;M.current={active:!1,lo:null,startX:0,startY:0,zone:null,origBbox:null},p&&(p.style.cursor=Vc[S.current.tool]||"default"),X&&Kr("Move")}}function J(X,Se){var se=S.current.runner;if(se){var ae=Rf(se,X,Se);ae&&(Et(ae.ref),De.current=ae.ref,qn(se,S.current.backdrop),Vt(se,S.current.backdrop,ae.ref))}}var ne=null;function Fe(X){var Se=S.current.runner,se=Se&&Se.cameraControl;if(X.phase==="begin"){ne=se?{pose:se.getOrbit(),refusedSaid:{}}:{pose:null,refusedSaid:{}},se||Me(ne,"camera","this scene's renderer publishes no camera handle (getCameraControl).");return}if(X.phase==="end"){ne=null;return}if(!(!ne||!ne.pose||!se)){var ae=gP(ne.pose,X,se.poseFields,p.width);ae.refused.forEach(function(Je){Me(ne,Je.gesture,"this camera declares no "+Je.axes.join("/")+" axis (its poseFields: "+se.poseFields.map(function(mt){return mt.name}).join(", ")+").")});var be=ae.patch;if(X.fingers===2&&X.pan&&!ae.refused.some(function(Je){return Je.gesture==="pan"})){var $e=it(Se,se,X.pan.from,X.pan.to);$e&&(be.target=$e)}Object.keys(be).length&&Lf(be)}}function Me(X,Se,se){X.refusedSaid[Se]||(X.refusedSaid[Se]=!0,console.error("[AuthorView] touch "+Se+" refused: "+se+" (FAIL-LOUD.)"))}function it(X,Se,se,ae){var be=le(Se),$e=os(se.x,se.y,be.z),Je=os(ae.x,ae.y,be.z);return!$e||!Je?null:{x:be.x-(Je.x-$e.x),y:be.y-(Je.y-$e.y),z:be.z}}function le(X){var Se=X.getOrbit();if(Se.target)return{x:Se.target.x,y:Se.target.y,z:Se.target.z||0};if(typeof X.worldFromCameraOffset=="function"){var se=X.worldFromCameraOffset({right:0,up:0,forward:Se.distance});return{x:se[0],y:se[1],z:se[2]}}if(is(S.current.runner))throw new Error("[AuthorView] the angular camera has no worldFromCameraOffset, so its orbit centre cannot be read for a pan. (FAIL-LOUD.)");var ae=os(p.width/2,p.height/2,0);return{x:ae.x,y:ae.y,z:0}}var Oe=null;function Ue(X){var Se=S.current.runner;if(Se){if(X.phase==="begin"){var se=X.target;Et(se),De.current=se;var ae=Se.envelopeOf(se),be=Tv(se),$e=ot(S.current.cw).ObjectSchema.get(se._schemaKind).fields,Je=$e.some(function(Nf){return Nf.name==="orientationDeg"}),mt=Je?typeof se.orientationDeg=="number"?se.orientationDeg:0:null,gc=ot(S.current.cw).LoDrawnCenter.drawnCenter(ae);Oe={handle:se,env:Object.assign({},ae),orientation:mt,resizable:!!(be&&be.resizable===!0),handedness:Je?vP(function(Nf){return Se.screenPointOf(Nf,p.width,p.height)},gc,mt):null,refusedSaid:{}};return}if(X.phase==="end"){Oe&&Oe.wrote&&Kr(Oe.wrote),Oe=null;return}if(Oe){var wi=!1;if(X.active.rotate&&(Oe.orientation===null?Me(Oe,"rotate",Oe.handle._schemaKind+" declares no orientationDeg field."):(Se.updateObjectProperty(Oe.handle,"orientationDeg",yP(Oe.orientation,X.twistDeg,Oe.handedness)),wi=!0,Oe.wrote="Rotate")),X.active.resize)if(!Oe.resizable)Me(Oe,"resize",Oe.handle._schemaKind+" does not declare itself resizable (ux.resizable).");else{var as=Oe.env,iy=Math.max(1,as.w*X.scale),oy=Math.max(1,as.h*X.scale);jf(Se,Oe.handle,as.left+(as.w-iy)/2,as.top+(as.h-oy)/2,iy,oy),wi=!0,Oe.wrote=Oe.wrote==="Rotate"?"Rotate":"Resize"}wi&&z(Se,S.current.backdrop,Oe.handle)}}}}function Rf(p,w,O){if(is(p)){var A=f.current,D=typeof p.pickObjectAtScreen=="function"?p.pickObjectAtScreen(w,O,A.width,A.height):null;return D?{ref:D,zone:"move"}:null}var z=De.current;if(z){var oe=Ua(z,p);if(oe){var Q=Dv(z,Lh(fc(oe),{x:w,y:O}));if(Q)return{ref:z,zone:Q}}}for(var J=Eh(p.declared),ne=J.length-1;ne>=0;ne--)if(p.isPointable(J[ne].ref)){var Fe=Ua(J[ne].ref,p);if(Fe&&Lh(fc(Fe),{x:w,y:O}))return{ref:J[ne].ref,zone:"move"}}return null}function NE(p){typeof p.setDesignMode=="function"&&p.setDesignMode(!0),p.stop(),p.step()}function fo(p){if(!(!p||typeof p.repaint!="function"))try{p.repaint()}catch(w){window.console&&console.warn&&console.warn("[AuthorView] repaint() after a scene mutation failed:",w)}}function zE(p,w,O){if(O.__studioScenePreApplied){O.__studioScenePreApplied=!1;try{Cf(),qn(p,w),Vt(p,w,null),fo(p)}catch(A){ye("Recipe load failed: "+(A&&A.message?A.message:A)),window.console&&console.error&&console.error("[AuthorView] _consumePendingModule failed:",A)}}}function BE(p){if(!(!p||!p.FrqtlPage||typeof p.FrqtlPage.isReady!="function"||!p.FrqtlPage.isReady())&&!p.__studioSceneApplying){p.__studioSceneApplying=!0;var w=window._egptPendingFolder;window._egptPendingFolder=void 0;var O=ns.current;ns.current="seed";var A=w||xS({router:{resolve:c}}).then(function(z){return z.files}),D=null;Promise.resolve(A).then(function(z){return D=z,O==="seed"||!rt.current?Mr(hA(z)):O==="run"&&Mr(pA(rt.current,z)),p.FrqtlPage.applyModuleSource({files:z})}).then(function(){p.__studioScenePreApplied=!0}).catch(function(z){var oe=z&&z.message?z.message:String(z);if(ye("Scene load failed: "+oe),O==="run"&&D!==null){var Q=kS(z);uc({message:oe,line:Q?Q.line:void 0,col:Q?Q.col:void 0}),Sv(!0),xf(!0)}})}}var Nv=j.useCallback(function(){var p=d.current,w=p&&p.contentWindow;if(!w)return!1;if(!Ha(w,"runner")){try{(!p.src||!w.location||w.location.href===p.src)&&BE(w)}catch{}return!1}try{if(p.src&&w.location&&w.location.href!==p.src)return!1}catch{}if(!nc(w))return CA(w,{resolve:c}).catch(function(le){ye("STUDIO cannot drive this frame: "+(le&&le.message?le.message:le)),window.console&&console.error&&console.error("[AuthorView] frame modules not loaded:",le)}),!1;var O=Ha(w,"runner"),A=wP(w,O),D=ot(w).Filters,z=SP(S.current.runner,O);if(S.current.writeQueue&&typeof S.current.writeQueue.dispose=="function"&&S.current.writeQueue.dispose(),S.current={runner:O,backdrop:A,Filters:D,cw:w,tool:S.current.tool,dropType:S.current.dropType,controlsRegistry:ot(w).ControlRegistry.makeControlRegistry(),controlsNameByObject:new WeakMap,controlsNameCounters:{},writeQueue:ot(w).FrqtlControlWriteQueue.makeControlWriteQueue()},typeof O=="object"&&O&&(O._onObjectMoved=function(){var le=S.current.runner;le&&(typeof le.getGrabbedObject=="function"&&le.getGrabbedObject()&&(_f.current=!0),qn(le,S.current.backdrop),Vt(le,S.current.backdrop,De.current))}),Promise.resolve().then(Cf).catch(function(le){window.console&&console.error&&console.error("[AuthorView] scene controls not registered:",le),ye("Scene controls not registered: "+(le&&le.message?le.message:le))}),z&&O&&!O._liveChartsMounted){O._liveChartsMounted=!0;var oe=!1;w.addEventListener("pagehide",function(){oe=!0,O._liveChartsMount&&(O._liveChartsMount.dispose(),O._liveChartsMount=null)},{once:!0});try{QS(O,{document:w.document}).then(function(le){if(oe){le.dispose();return}O._liveChartsMount=le}).catch(function(le){window.console&&console.error&&console.error("[AuthorView] mountLiveCharts failed:",le)})}catch(le){window.console&&console.error&&console.error("[AuthorView] mountLiveCharts threw:",le)}}var Q=O._renderOptions||{};vr({particles:Q.renderBaseCanvas!==!1,backdrop:A?A.visible!==!1:!1}),typeof O.getRateLimits=="function"&&Ie(O.getRateLimits());var J=O.cameraControl||null;if(z&&ct(null),Sn(J?J.getOrbit():null),lo(ux(J)),yv(dx(J)),bv(!!(O.renderer&&typeof O.renderer.screenToWorld=="function")),z&&Hv(),J||cM(w,function(){var le=S.current.runner;if(le===O){var Oe=le.cameraControl||null;Oe&&(Sn(Oe.getOrbit()),lo(ux(Oe)),yv(dx(Oe)),bv(!!(le.renderer&&typeof le.renderer.screenToWorld=="function")),Uv(w,le),Pf(le,xe.current,S.current.tool),m.current||(m.current={orbit:Oe.getOrbit(),preset:null}),kv(w),Sf())}}),qn(O,A),Ef(),kv(w),FE(),Av(),z){NE(O),me(or);var ne=x.current;if(!ne)throw new Error("[AuthorView] the control host element is not mounted — STUDIO hands it to the runner (runner.controlHost) so a scene knob is reachable above the overlay. (FAIL-LOUD.)");for(;ne.firstChild;)ne.removeChild(ne.firstChild);O.controlHost=ne}if(zE(O,A,w),Uv(w,O),Sf(),z&&typeof O.addAimListener=="function"){Tn.current&&Tn.current();var Fe=null;Tn.current=O.addAimListener(function(le){if(S.current.runner===O){if(le.state!=="grabbed"&&_f.current&&(_f.current=!1,Kr("Carry")),le.state==="grabbed"){var Oe=O.getGrabbedObject();Oe&&Oe!==De.current&&(De.current=Oe,Et(Oe),qn(O,S.current.backdrop))}le.error&&le.error!==Fe&&ye("Not held: "+le.error,"aim"),le.error||St("aim"),Fe=le.error}})}z&&(B.current=[],pe([]),ve.current=null,ce(null)),z&&(m.current=null);var Me=null;if(window._egptPendingRenderState!==void 0){var it=window._egptPendingRenderState;window._egptPendingRenderState=void 0;try{Me=LE(w,O,it)}catch(le){throw ye("Saved render state could not be applied: "+(le&&le.message?le.message:le)),le}}return z&&O.cameraControl&&(m.current={orbit:O.cameraControl.getOrbit(),preset:Me&&Me.camera==="preset"?Me.preset:null}),Vt(O,A,De.current,z?or:xe.current),kt(!0),!0},[qn,Vt]);j.useEffect(function(){var p=0,w=null,O=!1;function A(){if(!O&&!Nv()){if(++p>120){ye("Timed out waiting for the experiment runner.");return}w=setTimeout(A,150)}}var D=d.current;function z(){p=0,kt(!1),ye(null),A()}return D&&D.addEventListener("load",z),A(),function(){O=!0,D&&D.removeEventListener("load",z),w&&clearTimeout(w)}},[Nv,ke]),j.useEffect(function(){return function(){Hv(),Tn.current&&(Tn.current(),Tn.current=null)}},[]),j.useEffect(function(){if(ge){var p=setInterval(function(){var w=S.current.runner;if(w){typeof w.getRates=="function"&&de(w.getRates()),typeof w.getRateLimits=="function"&&Ie(w.getRateLimits());var O=w.isRunning?sr:or;xe.current!==O&&me(O)}},1e3);return function(){clearInterval(p)}}},[ge]);function zv(p,w){var O=S.current.runner;if(!(!O||typeof O.setRateLimits!="function")){var A=w==="Inf"?1/0:Number(w);if(!(isNaN(A)||A<0))try{var D={};D[p]=A,O.setRateLimits(D),Ie(O.getRateLimits())}catch(z){window.console&&console.warn&&console.warn("[AuthorView] setRateLimits failed:",z&&z.message?z.message:z)}}}function UE(p){var w=S.current.runner;w&&w.setRenderOption("renderBaseCanvas",p),vr(function(O){return Object.assign({},O,{particles:p})}),T(function(O){return Object.assign({},O,{dirty:!0})})}function Bv(p){var w=S.current.runner,O=S.current.backdrop;w&&O&&w.updateObjectProperty(O,"visible",p),vr(function(A){return Object.assign({},A,{backdrop:p})}),T(function(A){return Object.assign({},A,{dirty:!0})})}function HE(p,w){var O=S.current.runner;try{O.updateObjectProperty(p.ref,"visible",w)}catch(A){ye("Visibility not changed: "+(A&&A.message?A.message:A));return}qn(O),fo(O),Kr("Visibility")}function WE(p){var w=cr(S.current.cw)?ot(S.current.cw).ObjectSchema.get(p):null;return!!(w&&w.fields.some(function(O){return O.name==="visible"}))}function Uv(p,w){if(!(!p||!w)&&!(v.current&&v.current.cw===p)){var O=p.document&&p.document.getElementById("canvas-wrapper");if(O&&!p.document.querySelector('[data-role="camera-joystick"]')){var A=ot(p).CameraControls.attach(w,O);A&&A.mounted&&(v.current={handle:A,cw:p})}}}function Hv(){var p=v.current;if(p&&p.handle&&typeof p.handle.dispose=="function")try{p.handle.dispose()}catch{}v.current=null}function Lf(p){var w=S.current.runner;!w||!w.cameraControl||(w.cameraControl.setOrbit(p),Sn(w.cameraControl.getOrbit()),ct(null),Af(w))}function Af(p){fo(p),Vt(p,S.current.backdrop,De.current)}function VE(){var p=S.current.runner;if(!p||!p.cameraControl){console.error("[AuthorView] touch reset refused: this scene's renderer publishes no camera handle (getCameraControl). (FAIL-LOUD.)");return}var w=m.current;if(!w)throw new Error("[AuthorView] the scene's opening camera was never read, so a double tap has no view to return to. (FAIL-LOUD.)");w.preset?Wv(w.preset):Lf(w.orbit)}function Wv(p){var w=S.current.runner;!w||!w.cameraControl||typeof w.cameraControl.setPreset!="function"||(w.cameraControl.setPreset(p),Sn(w.cameraControl.getOrbit()),ct(p),ve.current=null,ce(null),Af(w))}function Vv(){var p=S.current.runner,w=De.current;!p||!w||(TE(w),p.removeObject(w),Et(null),De.current=null,qn(p,S.current.backdrop),Vt(p,S.current.backdrop,null),T(function(O){return Object.assign({},O,{dirty:!0})}),Kr("Delete"))}j.useEffect(function(){var p=S.current.runner;p&&typeof p.setSelectHighlight=="function"&&(p.setSelectHighlight(Ut||null),fo(p))},[Ut]);function Pf(p,w,O){if(!(!p||typeof p.setAimArmed!="function")){var A=w===or&&!!O;A!==p.isAimArmed()&&(p.setAimArmed(A),fo(p))}}j.useEffect(function(){ge&&Pf(S.current.runner,ie,pt)},[ge,ie,pt]),j.useEffect(function(){function p(w){if(De.current){var O=w.target;if(!(O&&O.closest&&O.closest("[data-selection-safe]"))){Et(null),De.current=null;var A=S.current.runner;A&&Vt(A,S.current.backdrop,null)}}}return document.addEventListener("mousedown",p,!0),function(){document.removeEventListener("mousedown",p,!0)}},[]),j.useEffect(function(){function p(w){if(!(w.key!=="Delete"&&w.key!=="Backspace")&&De.current){var O=S.current.cw,A=cr(O)?ot(O).CameraControls:null;if(!A)throw new Error("[AuthorView] CameraControls.isTypingTarget is unreachable in the experiment frame — it is the ONE typing predicate (lib/frqtl/parts/CameraControls.js). (FAIL-LOUD.)");A.isTypingTarget(w,document)||(w.preventDefault(),Vv())}}return window.addEventListener("keydown",p),function(){window.removeEventListener("keydown",p)}},[]);function qE(p,w){if(p.button!==0||!ge)return;var O=p.currentTarget,A=p.pointerId,D={kind:w.kind,label:w.displayName,x0:p.clientX,y0:p.clientY,dragging:!1,suppressClick:!1};$.current=D;try{O.setPointerCapture(A)}catch{}function z(ne){if(!D.dragging){if(Math.abs(ne.clientX-D.x0)+Math.abs(ne.clientY-D.y0)<dM)return;D.dragging=!0,D.prevCursor=document.body.style.cursor,D.prevSelect=document.body.style.userSelect,document.body.style.cursor="copy",document.body.style.userSelect="none",he({label:D.label,x:ne.clientX,y:ne.clientY})}var Fe=U.current;Fe&&(Fe.style.left=ne.clientX+12+"px",Fe.style.top=ne.clientY+12+"px")}function oe(ne,Fe){O.removeEventListener("pointermove",z),O.removeEventListener("pointerup",Q),O.removeEventListener("pointercancel",J);try{O.releasePointerCapture(A)}catch{}if(D.dragging&&(D.suppressClick=!0,setTimeout(function(){D.suppressClick=!1},0),document.body.style.cursor=D.prevCursor||"",document.body.style.userSelect=D.prevSelect||"",he(null),!!Fe)){var Me=f.current;if(!(!Me||document.elementFromPoint(ne.clientX,ne.clientY)!==Me)){var it=Me.getBoundingClientRect();Iv(D.kind,ne.clientX-it.left,ne.clientY-it.top)}}}function Q(ne){oe(ne,!0)}function J(ne){oe(ne,!1)}O.addEventListener("pointermove",z),O.addEventListener("pointerup",Q),O.addEventListener("pointercancel",J)}function $E(p){var w=$.current;w&&w.kind===p.kind&&w.suppressClick||KE(p.kind)}function KE(p){St("drop"),P(p),_("dropper")}function hc(p){if(St("drop"),pt===p){_(null),P(null),Et(null),De.current=null;var w=S.current.runner;w&&Vt(w,S.current.backdrop,null);return}_(p),p!=="dropper"&&P(null)}function YE(){var p=S.current.runner;p&&(p.stop(),typeof p.setDesignMode=="function"&&p.setDesignMode(!0),p.step(),me(or),Vt(p,S.current.backdrop,De.current,or))}function qv(){var p=S.current.runner;p&&(typeof p.setDesignMode=="function"&&p.setDesignMode(!1),Pf(p,sr,S.current.tool),p.start(),me(sr),Vt(p,S.current.backdrop,De.current,sr))}function GE(){xe.current===sr?YE():qv()}function JE(){if(!dc("Restart")){var p=bh(rt.current),w=jv("Restart");if(w.ok){var O=w.state;if(L.projectId)try{Kb(gn(),{files:p,renderState:O}),T(function(A){return Object.assign({},A,{dirty:!1})}),rs()}catch(A){ye("Restart: the save failed — "+(A&&A.message?A.message:A),"save")}Rv(p,O)}}}function $v(p,w,O){T({projectId:null,walkthroughId:p.id,walkthroughMode:w||null,name:p.title,dirty:!1}),O?(window._egptPendingFolder=Object.assign({},O),ns.current="keep"):(window._egptPendingFolder=md(i,p.id).then(function(z){return z.files}),ns.current="seed",Mr(null));var A=Qi(p,w);window._egptPendingRenderState=A;var D={renderer:A.renderer,seed:A.seed};je(fs(e,D)+"&_r="+Date.now())}function XE(p){var w=Kt(i,L.walkthroughId);if(w&&p!==(L.walkthroughMode||Ro(w))&&!dc("Switching mode")){var O=fa();window._egptPendingFolder=void 0,window._egptPendingRenderState=void 0,kt(!1),ye(null),Et(null),De.current=null,Pt([]),me(or),$v(w,p,O),ss(Kv(w,p))}}function ss(p){typeof u=="function"&&qL(at.author,p).forEach(function(w){u(w[0],w[1])})}function Kv(p,w){return{walkthrough:p.id,mode:Tl(p).length>1?w||Ro(p):""}}function ho(p,w,O){var A=!!(O&&O.quiet);if(An.current=!1,window._egptPendingFolder=void 0,Y(null),window._egptPendingRenderState=void 0,ns.current="seed",Mr(null),uc(null),kt(!1),ye(null),Wn(null),Et(null),De.current=null,Pt([]),me(or),p===Wc){T({projectId:null,name:"Empty Universe",dirty:!1}),A||ss({}),je(fs(e)+"&_r="+Date.now());return}if(p.indexOf("walkthrough:")===0){var D=p.slice(12),z=Kt(i,D);if(!z){ye("Walk-through rung not found: "+D);return}$v(z,w||Ro(z)),A||ss(Kv(z,w));return}if(p.indexOf(Lo)===0){var oe=O&&O.folder;if(!oe||!oe.files||!oe.renderState){ye("Scene draft refused — a scene: selection carries its folder (studio-landing-of.js). (FAIL-LOUD.)");return}var Q=p.slice(Lo.length);Pn.current={folder:oe,link:O&&O.link||{scene:Q}},T({projectId:null,sceneUrl:Q,name:decodeURIComponent(Q.split("/").pop()),dirty:!1}),A||ss(Pn.current.link),window._egptPendingFolder=Object.assign({},oe.files),window._egptPendingRenderState=oe.renderState,je(fs(e,{renderer:oe.renderState.renderer,seed:oe.renderState.seed})+"&_r="+Date.now());return}if(p.indexOf("project:")===0){var J=p.slice(8);try{var ne=kh(gn(),J);if(!ne){ye("Project not found: "+J);return}T({projectId:J,name:J,dirty:!1}),A||ss({project:J}),window._egptPendingFolder=Object.assign({},ne.files),window._egptPendingRenderState=ne.renderState;var Fe={renderer:ne.renderState.renderer,seed:ne.renderState.seed};je(fs(e,Fe)+"&_r="+Date.now())}catch(Me){ye("Load project failed: "+(Me&&Me.message?Me.message:Me))}return}}function Mf(p,w,O){if(dc(p))return Promise.resolve(null);if(!fa())return ye(p+" refused — the canvas has no project folder yet (it has not finished loading).",w),Promise.resolve(null);var A;try{A=Cv()}catch(z){return ye(p+" refused — "+(z&&z.message?z.message:z),w),Promise.resolve(null)}if(xh(rt.current))return O?Promise.resolve({files:bh(rt.current),renderState:A,unrun:!0}):(ye(p+" refused — "+kf(rt.current),w),Promise.resolve(null));var D=da();return D?D.toSketch().then(function(z){return z.refused.length&&ye(p+" — hands not written: "+z.refused.map(function(oe){return oe.reason}).join(" "),"hand"),Ev(z.files),{files:fa(),renderState:A,unrun:!1}}):(ye(p+" refused — the canvas has no scene facade to write the sketch from (it has not finished loading).",w),Promise.resolve(null))}var Yv="Saved your code; the canvas still runs the previous text — Run to see it.";function Gv(p){if(!(!p||!p.trim())){ac(!1);var w=p.trim();if(rt.current&&Eu(rt.current).indexOf(Ge)!==-1){ye("Save As refused — "+rm+" (unrun: "+Ge+", which Save As renames)","save");return}Mf("Save As","save",!0).then(function(O){if(O){var A=gn();sm(A,{files:O.files,renderState:O.renderState},w);var D={};D[Ge]=kh(A,w).files[Ge],Mr(ES(rt.current,D)),St("save"),Y(O.unrun?Yv:'Saved as "'+w+'".'),T({projectId:w,name:w,dirty:!1}),ss({project:w}),rs()}}).catch(function(O){ye("Save As failed: "+(O&&O.message?O.message:O),"save")})}}function Tf(p){dc("Save As")||(xv(p),ac(!0))}function QE(){if(!L.projectId){Tf(L.name||"");return}Mf("Save","save",!0).then(function(p){p&&(Kb(gn(),{files:p.files,renderState:p.renderState}),St("save"),Y(p.unrun?Yv:'Saved "'+L.projectId+'".'),T(function(w){return Object.assign({},w,{dirty:!1})}),rs())}).catch(function(p){ye("Save failed: "+(p&&p.message?p.message:p),"save")})}j.useEffect(function(){if(!(!ge||!S.current.cw)){var p=LP(S.current.cw);p&&we.current!==p&&(we.current=p,console.error("[AuthorView] Record unavailable: "+p+". (FAIL-LOUD.)")),p||un(ot(S.current.cw).parts.FrqtlVision.RECORD_DEFAULTS.seconds),cn(p||!1)}},[ge]),j.useEffect(function(){ge||!lt.current||(lt.current.stop(),lt.current=null,Mt({phase:"idle"}))},[ge]),j.useEffect(function(){if(Pe.phase==="recording"){Dn(Date.now());var p=setInterval(function(){Dn(Date.now())},250);return function(){clearInterval(p)}}},[Pe.phase]);var ha=ge&&S.current.runner&&cr(S.current.cw)?ot(S.current.cw).parts.FrqtlVision.recordRefusal(S.current.runner):{reason:"loading"},Jv=Pe.phase==="encoding"||Pe.phase!=="recording"&&!!ha;function ZE(){return L.walkthroughId||L.name||ZS}function eO(){if(Pe.phase==="recording"){lt.current&<.current.stop(),Mt({phase:"encoding"});return}var p=S.current.cw,w=S.current.runner,O=new AbortController,A,D=ZE(),z=new Date;try{A=ot(p).parts.FrqtlVision.attach(w).record({signal:O.signal})}catch(Q){ye("Record failed: "+(Q&&Q.message?Q.message:Q),"record"),console.error("[AuthorView] Record failed to start:",Q);return}var oe={};lt.current={stop:function(){O.abort()},token:oe},St("record"),Mt({phase:"recording",startedMs:Date.now()}),A.then(function(Q){if(!(!lt.current||lt.current.token!==oe)){var J=PP(Q,D,z);lt.current=null,Mt({phase:"ready",file:J,frames:Q.track.frames.length,everyTicks:Q.track.ticksPerFrame,atLimit:!Q.truncated,canShare:YS(navigator,J)})}}).catch(function(Q){!lt.current||lt.current.token!==oe||(lt.current=null,Mt({phase:"idle"}),ye("Recording failed: "+(Q&&Q.message?Q.message:Q),"record"),console.error("[AuthorView] Recording failed:",Q))})}function tO(){EP(navigator,Pe.file,Pe.file.name).then(function(){St("record")},function(p){p&&p.name==="AbortError"||(ye("Share failed: "+(p&&p.message?p.message:p)+" — use Save instead.","record"),console.error("[AuthorView] Share failed:",p))})}function nO(){$S(Pe.file.name,Pe.file),St("record")}var Df=j.useRef(null);function rO(){Mf("Export","export",!1).then(function(p){return p?jP().then(function(w){var O=KA(p.files,p.renderState,{sdkVersion:w});OP($b({files:p.files,renderState:p.renderState})+".zip",O),St("export")}):null}).catch(function(p){ye("Export failed: "+(p&&p.message?p.message:p),"export")})}function iO(p){var w=p.target.files&&p.target.files[0];p.target.value="",w&&CP(w).then(function(O){var A=US(O,w.name),D=$b(A);sm(gn(),A,D),St("import"),rs(),ho("project:"+D)}).catch(function(O){ye("Import failed: "+(O&&O.message?O.message:O),"import")})}function Xv(p){var w=da();return!w||!rt.current?"the scene's sketch text has not loaded":typeof w.forkRefusal!="function"?"this page's facade has no fork door":xh(rt.current)?kf(rt.current):w.forkRefusal(p)}function Qv(p,w){ua(null);var O=(w||"").trim();if(O){var A=Xv(p);if(A){ye("Fork refused — "+A,"fork");return}da().fork(p,O,{by:"human"}).then(function(D){Mr(Bb(Hb(rt.current,D.files),D.file)),T(function(Q){return Object.assign({},Q,{dirty:!0})}),St("fork"),Y("Forked "+D.from+" into "+D.file+" — edit it in the code drawer, then Run.");var z=S.current.runner;Cf(),qn(z,S.current.backdrop);var oe=z.declared.filter(function(Q){return Q.name===p})[0]||null;Et(oe),De.current=oe,Vt(z,S.current.backdrop,oe),fo(z)}).catch(function(D){ye("Fork failed: "+(D&&D.message?D.message:D),"fork")})}}function Zv(p,w,O,A){if(!cr(p)||!w)return null;var D;try{D=ot(p).MakeControlsForObject.makeControlsForObject(w,{},{kind:O,name:A})}catch(Q){return window.console&&console.error&&console.error("[AuthorView Inspector] makeControlsForObject failed:",Q),null}var z={},oe={};return D.controls.forEach(function(Q){z[Q.id]=Q}),D.display.forEach(function(Q){oe[Q.id]=Q}),{objectName:A,display:D.display,controlsById:z,displayById:oe}}function ey(p,w,O,A,D,z){function oe(Ue){z(O.name,Ue)}var Q=A?A.objectName+"."+O.name:null,J=A&&Q?A.controlsById[Q]:null,ne=A&&Q?A.displayById[Q]:null,Fe=JP(p,O);if(Fe){var Me=J?J.value:ne?ne.value:w?w[O.name]:void 0;return Ze.createElement(Fe.Component,{obj:w,field:O,value:Me,commit:oe})}if(J){if(J.kind==="scalar")return y.jsx(pM,{cw:D,control:J,onChange:oe});if(J.kind==="enum")return y.jsx("select",{value:J.value,style:_e.select,onChange:function(Ue){oe(Ue.target.value)},children:J.values.map(function(Ue){return y.jsx("option",{value:Ue,children:Ue},Ue)})});if(J.kind==="flags")return y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:J.values.map(function(Ue){var X=J.value.indexOf(Ue)!==-1;return y.jsxs("label",{style:Object.assign({},_e.sub,{display:"flex",gap:"5px",cursor:"pointer"}),children:[y.jsx("input",{type:"checkbox",checked:X,onChange:function(Se){var se=J.value.slice();Se.target.checked?se.indexOf(Ue)===-1&&se.push(Ue):se=se.filter(function(ae){return ae!==Ue}),oe(se)}})," ",Ue]},Ue)})});if(J.kind==="vector"){var it=J.value.length===4?["left","top","w","h"]:J.value.length===6?["left","top","z","w","h","d"]:J.value.map(function(Ue,X){return String(X)});return y.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px"},children:it.map(function(Ue,X){return y.jsxs("label",{style:Object.assign({},_e.sub,{display:"flex",gap:"3px",alignItems:"center"}),children:[Ue,y.jsx("input",{type:"number",value:Math.round(J.value[X]||0),step:"1",style:Object.assign({},_e.numInput,{width:48}),onChange:function(Se){var se=parseInt(Se.target.value,10);if(!isNaN(se)){var ae=J.value.slice();ae[X]=se,oe(ae)}}})]},Ue)})})}}if(O.type==="rect-array"){var le=A&&A.display?A.display.filter(function(Ue){return Ue.id.indexOf(Q+"[")===0}):[];return y.jsx("span",{style:_e.fieldVal,children:le.length?le.length+" rect(s)":"—"})}if(ne){var Oe=ne.value;return y.jsx("span",{style:_e.fieldVal,children:Oe!=null?typeof Oe=="object"?JSON.stringify(Oe):String(Oe):"—"})}return y.jsx("span",{style:_e.fieldVal,children:"—"})}function pa(p){return!We[p]}function oO(p){kn(function(w){var O=Object.assign({},w);return O[p]=!w[p],O})}function pc(p){var w=pa(p);return y.jsxs("div",{style:Object.assign({},_e.h,{cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",userSelect:"none"}),"data-selection-safe":!0,title:w?"Collapse section":"Expand section",onClick:function(){oO(p)},children:[y.jsx("span",{children:p}),y.jsx("span",{style:{color:"#6a7a8a",fontSize:"0.6rem"},children:w?"▾":"▸"})]})}function sO(){if(!Ut)return y.jsx("div",{style:_e.sub,children:"Select an object (Pencil) to edit."});var p=S.current.cw,w=S.current.runner,O=cr(p)?ot(p).ObjectSchema:null,A=Ut,D=A._schemaKind,z=O?O.get(D):null;if(!z)return y.jsxs("div",{children:[y.jsx("div",{style:{marginBottom:"6px",color:"#ccc",fontSize:"0.68rem"},children:Ut.name||D}),y.jsx("div",{style:Object.assign({},_e.sub,{marginTop:"6px"}),children:"Schema loading — try again in a moment."})]});function oe(ae,be,$e){var Je=S.current.writeQueue,mt=ae+"."+be;Je&&typeof Je.write=="function"?Je.write(mt,$e):$e()}function Q(ae){var be=cr(p)?ot(p).MakeControlsForObject.NULL_ENUM_SENTINEL:void 0;return be!==void 0&&ae===be?null:ae}var J=Of(S.current,D,A),ne=Zv(p,A,D,J);function Fe(ae,be){if(w){if(be=Q(be),ae==="leafDimension"&&typeof A.getFundamentalDimension=="function"){var $e=A.getFundamentalDimension();if(typeof $e=="number"&&typeof be=="number"&&be<$e&&typeof window<"u"&&typeof window.confirm=="function"){var Je=window.confirm("Emit Dimension "+be+" is BELOW the current fundamental ("+$e+"). This self-lowers the universe floor GLOBALLY and is a ONE-WAY RATCHET (there is no removeDimension). Continue?");if(!Je)return}}oe(J,ae,function(){try{w.updateObjectProperty(A,ae,be),Ve(function(mt){return mt+1}),Kr("Inspector edit"),qn(w,S.current.backdrop),Vt(w,S.current.backdrop,De.current),T(function(mt){return Object.assign({},mt,{dirty:!0})})}catch(mt){console.error("[AuthorView inspector] "+mt.message)}})}}var Me=w?XS(w,A):null,it=Me?Me._schemaKind||"QuantumEmitter":null,le=null;if(Me&&O){var Oe=null;try{Oe=O.get(it)}catch{Oe=null}le=(Oe&&Oe.fields||[]).filter(function(ae){return ae.name==="emissionCap"})[0]||null}var Ue=Me?Of(S.current,it,Me):null,X=Me&&le?Zv(p,Me,it,Ue):null;function Se(ae,be){!w||!Me||oe(Ue,ae,function(){try{w.updateObjectProperty(Me,ae,be),Ve(function($e){return $e+1}),Kr("Inspector edit"),T(function($e){return Object.assign({},$e,{dirty:!0})})}catch($e){console.error("[AuthorView inspector] "+$e.message)}})}var se=Xv(A.name);return y.jsxs("div",{children:[y.jsx("div",{style:{marginBottom:"6px"},children:y.jsx("button",{"data-role":"studio-fork-part",disabled:!!se,title:se||"Copy "+D+"'s part file into this project as parts/My"+D+".js and use it here",style:Object.assign({},$n(!1),se?{opacity:.45,cursor:"not-allowed"}:null),onClick:function(){se||ua({name:A.name,value:"My"+D})},children:"Fork into project"})}),z.description&&y.jsx("div",{style:{marginBottom:"8px",color:"#7a8a9a",fontSize:"0.62rem",lineHeight:1.5,borderBottom:"1px solid #1c1c1c",paddingBottom:"6px"},children:z.description}),y.jsxs("div",{style:{marginBottom:"6px",color:"#ccc",fontSize:"0.68rem",display:"flex",alignItems:"center",gap:"6px"},children:[y.jsxs("span",{style:{flex:1},children:[A.name||D,y.jsxs("span",{style:Object.assign({},_e.sub,{marginLeft:"6px"}),children:["(",D,")"]})]}),y.jsx("button",{type:"button",title:"Delete (Del/Backspace)",onClick:Vv,style:{background:"#2a1414",border:"1px solid #5a2a2a",color:"#e08080",borderRadius:"3px",fontSize:"0.62rem",padding:"2px 7px",cursor:"pointer"},children:"Delete"})]}),z.fields.filter(function(ae){if(ae.internal===!0)return!1;var be=cr(p)?ot(p).MakeControlsForObject.evalVisibleWhen:null;return!(ae.visibleWhen&&be&&!be(ae,A))}).map(function(ae){return y.jsxs("div",{style:_e.fieldRow,"data-role":"studio-inspector-field","data-field":ae.name,children:[y.jsxs("div",{style:_e.fieldLabel,title:ae.description||ae.name,children:[ae.label||ae.name,ae.description&&y.jsx("span",{style:{color:"#4a5a6a",marginLeft:"3px"},title:ae.description,children:"?"})]}),y.jsx("div",{style:{flex:1,minWidth:0},children:ey(D,A,ae,ne,p,Fe)})]},ae.name)}),Me&&le&&y.jsxs("div",{"data-role":"population-gate",style:{marginTop:"10px",borderTop:"1px solid #2a2a2a",paddingTop:"8px"},children:[y.jsx("div",{style:_e.h,children:"Population Gate"}),y.jsx("div",{style:{marginBottom:"6px",color:"#7a8a9a",fontSize:"0.62rem",lineHeight:1.5},children:"This counter is the population authority for an emission gate — the knob writes the gating emitter's live emission cap (applies next tick; emission pauses at the limit and resumes below it)."}),y.jsxs("div",{"data-role":"population-gate-cap",style:_e.fieldRow,children:[y.jsx("div",{style:_e.fieldLabel,title:le.description||le.name,children:le.label||le.name}),y.jsx("div",{style:{flex:1,minWidth:0},children:ey(it,Me,le,X,p,Se)})]})]})]})}function aO(){var p=S.current.cw,w=cr(p)?ot(p).ObjectSchema:null,O=w?w.placeableCatalog():[];if(O.length===0)return y.jsx("span",{style:{opacity:.6,fontSize:11},children:"palette unavailable — ObjectSchema not loaded in the canvas frame"});for(var A={},D=0;D<O.length;D++){var z=O[D],oe=z.category||"other";A[oe]||(A[oe]=[]),A[oe].push(z)}var Q=[];return fM.forEach(function(J){!A[J]||A[J].length===0||(Q.push(y.jsx("div",{style:Object.assign({},_e.h,{marginTop:"8px"}),children:hM[J]||J},J)),A[J].forEach(function(ne){Q.push(y.jsx("button",{style:lO(ne.kind),disabled:!ge,onPointerDown:function(Fe){qE(Fe,ne)},onClick:function(){$E(ne)},title:ne.description,children:ne.displayName},ne.kind))}))}),Q}var _e={root:{display:"flex",flexDirection:"column",height:"100%",background:"#0d0d0d",color:"#cfcfcf",font:"12px ui-monospace,Menlo,Consolas,monospace"},topbar:{display:"flex",alignItems:"center",gap:"6px",padding:"5px 8px",background:"#111",borderBottom:"1px solid #222",flexShrink:0,flexWrap:"wrap"},body:{display:"flex",flex:1,minHeight:0},col:{display:"flex",flexDirection:"column",minWidth:0},palette:{width:172,borderRight:"1px solid #222",padding:"8px",flex:"0 0 auto",overflowY:"auto"},center:{flex:1,display:"flex",flexDirection:"column",background:"#000",minWidth:0,minHeight:0},canvasRegion:{position:"relative",flex:"1 1 0",minHeight:0},filePickerRow:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",background:"#111",borderBottom:"1px solid #222",flexShrink:0},filePicker:{background:"#1a1a1a",color:"#7ec8e3",border:"1px solid #333",borderRadius:"3px",font:"11px ui-monospace,Menlo,Consolas,monospace",padding:"2px 4px"},readOnlyFile:{flex:1,margin:0,padding:"8px 12px",overflow:"auto",color:"#aaa",font:"11px ui-monospace,Menlo,Consolas,monospace",whiteSpace:"pre-wrap"},right:{width:240,borderLeft:"1px solid #222",display:"flex",flexDirection:"column",flex:"0 0 auto",overflowY:"auto"},h:{fontSize:"0.62rem",letterSpacing:"1px",color:"#5a5a5a",textTransform:"uppercase",margin:"4px 0 6px"},toolRow:{display:"flex",gap:"6px",marginBottom:"8px"},chip:{display:"flex",alignItems:"center",gap:"6px",width:"100%",textAlign:"left",background:"#1a1a1a",border:"1px solid #333",color:"#ccc",padding:"6px 8px",marginBottom:"4px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem"},row:{display:"flex",alignItems:"center",gap:"7px",padding:"4px 2px"},sect:{padding:"10px",borderBottom:"1px solid #1c1c1c"},iframe:{position:"absolute",inset:0,width:"100%",height:"100%",border:0},overlay:{position:"absolute",left:0,top:0,pointerEvents:"auto",background:"transparent"},sel:{background:"#26323f"},sub:{color:"#7a7a7a",fontSize:"0.62rem"},fieldRow:{display:"flex",alignItems:"flex-start",gap:"5px",padding:"3px 0",borderBottom:"1px solid #141414"},fieldLabel:{color:"#7a7a7a",fontSize:"0.6rem",flex:"0 0 80px",paddingTop:"3px",wordBreak:"break-all"},fieldVal:{color:"#aaa",fontSize:"0.62rem"},numInput:{width:60,background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"2px 4px",fontSize:"0.62rem"},textInput:{width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"2px 4px",fontSize:"0.62rem"},select:{width:"100%",background:"#1a1a1a",color:"#ccc",border:"1px solid #333",padding:"4px",fontSize:"0.62rem"},hint:{color:"#4a4a4a",fontSize:"0.6rem",lineHeight:1.5,marginTop:"10px",whiteSpace:"pre-wrap"}};function If(p){var w=pt===p;return{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0",cursor:"pointer",borderRadius:"4px",background:w?"#2a3a4a":"#1a1a1a",border:"1px solid "+(w?"#4a7abf":"#333"),boxShadow:w?"inset 0 -3px 0 #8ab4f8":"none",color:w?"#8ab4f8":"#777"}}function Ff(p,w){return{role:"button","aria-label":w,"aria-pressed":pt===p?"true":"false","data-tool":p}}function lO(p){var w=R===p;return Object.assign({},_e.chip,w?{borderColor:"#4a7abf",color:"#8ab4f8",background:"#22303f"}:null)}function cO(p){var w=ie===p,O={design:{bg:"#2a2a18",border:"#8a8a30",text:"#c8c84a"},run:{bg:"#182a18",border:"#308a30",text:"#4ac84a"},pause:{bg:"#2a1818",border:"#8a3030",text:"#c84a4a"}},A=O[p]||{};return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",letterSpacing:"0.5px",background:w?A.bg:"#1a1a1a",border:"1px solid "+(w?A.border:"#333"),color:w?A.text:"#999"}}function ty(){return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",letterSpacing:"0.5px",background:"#1a1a1a",border:"1px solid #333",color:"#999"}}function $n(p){return{padding:"3px 9px",cursor:"pointer",borderRadius:"3px",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",background:p?"#1a2a1a":"#1a1a1a",border:"1px solid "+(p?"#4a8a4a":"#333"),color:p?"#6aaa6a":"#888"}}function ny(p,w,O,A){return y.jsxs("label",{style:_e.row,children:[y.jsx("input",{type:"checkbox",checked:w,onChange:function(D){O(D.target.checked)},style:{accentColor:A},disabled:!ge}),p]})}var uO=L.projectId?"project:"+L.projectId:L.walkthroughId?"walkthrough:"+L.walkthroughId:L.sceneUrl?Lo+L.sceneUrl:Wc,dO=ie===sr?"running":"design",fO=ie===sr?"#6aaa6a":"#c8c84a",mc=L.walkthroughId?Kt(i,L.walkthroughId):null,ry=mc?Tl(mc):[],hO=mc?L.walkthroughMode||Ro(mc):null,pO=Object.assign({position:"absolute",left:0,top:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1},Pr?{left:Pr.left+"px",top:Pr.top+"px",width:Pr.width+"px",height:Pr.height+"px"}:{}),mO=Object.assign({},_e.overlay,Pr?{left:Pr.left+"px",top:Pr.top+"px",width:Pr.width+"px",height:Pr.height+"px"}:{},{pointerEvents:"auto"});return y.jsxs("div",{style:_e.root,children:[y.jsxs("div",{ref:k,"data-role":"studio-showcase-covered",style:{display:"contents"},children:[y.jsxs("div",{ref:E,"data-role":"studio-scene-covered",style:{display:"contents"},children:[H&&y.jsx("div",{ref:U,"data-role":"palette-drag-ghost","aria-hidden":"true",style:Object.assign({},_e.chip,{position:"fixed",left:H.x+12+"px",top:H.y+12+"px",width:"auto",zIndex:1e3,pointerEvents:"none",opacity:.9,borderColor:"#4a7abf",color:"#8ab4f8",background:"#22303f"}),children:H.label}),co&&y.jsx("div",{"data-role":"studio-fork-prompt",style:{position:"absolute",inset:0,zIndex:999,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs("div",{style:{background:"#1a1a1a",border:"1px solid #333",borderRadius:"6px",padding:"20px",minWidth:"280px"},children:[y.jsxs("div",{style:{marginBottom:"10px",fontSize:"0.75rem",color:"#ccc"},children:['Fork "',co.name,'" into a new part class (parts/<Name>.js):']}),y.jsx("input",{type:"text",value:co.value,autoFocus:!0,"data-role":"studio-fork-name",style:Object.assign({},_e.textInput,{marginBottom:"12px",display:"block"}),onChange:function(p){var w=p.target.value;ua(function(O){return O&&Object.assign({},O,{value:w})})},onKeyDown:function(p){p.key==="Enter"&&Qv(co.name,co.value),p.key==="Escape"&&ua(null)}}),y.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[y.jsx("button",{style:$n(!1),onClick:function(){ua(null)},children:"Cancel"}),y.jsx("button",{style:$n(!0),"data-role":"studio-fork-commit",onClick:function(){Qv(co.name,co.value)},children:"Fork"})]})]})}),SE&&y.jsx("div",{"data-role":"studio-save-as-prompt",style:{position:"absolute",inset:0,zIndex:999,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:y.jsxs("div",{style:{background:"#1a1a1a",border:"1px solid #333",borderRadius:"6px",padding:"20px",minWidth:"280px"},children:[y.jsx("div",{style:{marginBottom:"10px",fontSize:"0.75rem",color:"#ccc"},children:"Save project as:"}),y.jsx("input",{type:"text",value:bf,autoFocus:!0,style:Object.assign({},_e.textInput,{marginBottom:"12px",display:"block"}),onChange:function(p){xv(p.target.value)},onKeyDown:function(p){p.key==="Enter"&&Gv(bf),p.key==="Escape"&&ac(!1)}}),y.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[y.jsx("button",{style:$n(!1),onClick:function(){ac(!1)},children:"Cancel"}),y.jsx("button",{style:$n(!0),onClick:function(){Gv(bf)},children:"Save"})]})]})}),y.jsxs("div",{style:_e.topbar,children:[y.jsx("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",letterSpacing:"0.5px",textTransform:"uppercase"},children:"Experiment"}),y.jsx(MP,{value:uO,roster:i,savedProjects:V,onChange:ho,disabled:!ge&&!ht}),ry.length>1&&y.jsx("div",{"data-role":"studio-mode-strip",style:{display:"inline-flex",alignItems:"center",gap:"0",border:"1px solid #333",borderRadius:"4px",overflow:"hidden"},title:"Switch this walk-through between its declared modes (reloads the scene)",children:ry.map(function(p,w){var O=p.id===hO;return y.jsx("button",{"data-role":"studio-mode-segment","data-mode-id":p.id,"data-active":O?"true":"false",disabled:!ge&&!ht,onClick:function(){XE(p.id)},style:{padding:"3px 10px",cursor:"pointer",fontSize:"0.62rem",fontFamily:"ui-monospace,Menlo,Consolas,monospace",border:"none",borderLeft:w===0?"none":"1px solid #333",background:O?"#16323c":"#141414",color:O?"#7ec8e3":"#777"},children:p.label},p.id)})}),y.jsxs("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",maxWidth:"120px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[L.name,L.dirty?" *":""]}),y.jsx("div",{style:{flex:"0 0 6px"}}),y.jsxs("span",{"data-role":"studio-scene-controls",style:{display:"inline-flex",alignItems:"center",gap:"6px",flexWrap:"nowrap"},children:[y.jsx("span",{style:{color:"#5a5a5a",fontSize:"0.62rem",letterSpacing:"0.5px",textTransform:"uppercase"},children:"Mode"}),y.jsx(vx,{style:cO(ie===sr?or:sr),disabled:!ge,labels:[fx,hx],onClick:GE,"data-selection-safe":!0,title:ie===sr?"Pause — freeze the field, edit objects (Design)":"Run the simulation",children:ie===sr?hx:fx}),y.jsx("button",{style:ty(),disabled:!ge&&!ht,onClick:JE,"data-selection-safe":!0,title:"Restart — save current design, reload from tick 0",children:"↻ Restart"}),Ft===!1&&y.jsx("span",{"data-role":"studio-record","data-phase":Pe.phase,style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:y.jsx(vx,{"data-role":"studio-record-toggle","data-selection-safe":!0,labels:[px,mx,gx((Xe||0)*1e3)],style:Object.assign(ty(),Pe.phase==="recording"?{background:"#2a1414",border:"1px solid #c84a4a",color:"#ff6a6a"}:{color:"#d88"},Jv?{opacity:.45,cursor:"not-allowed"}:null),disabled:Jv,"data-refusal":Pe.phase!=="recording"&&ha?ha.reason:void 0,onClick:eO,title:Pe.phase==="recording"?"Stop recording":ha?aM(ha):"Record the scene as a video (up to "+Xe+" s)",children:Pe.phase==="recording"?gx(Wt-Pe.startedMs):Pe.phase==="encoding"?mx:px})})]}),Ft===!1&&Pe.phase==="ready"&&y.jsxs("span",{"data-role":"studio-record-result","data-name":Pe.file.name,"data-mime":Pe.file.type,"data-bytes":Pe.file.size,"data-frames":Pe.frames,"data-at-limit":Pe.atLimit?"true":"false","data-can-share":Pe.canShare?"true":"false",style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[Pe.atLimit&&y.jsx("span",{style:{color:"#c8c84a",fontSize:"0.6rem"},title:"The recording stopped itself at the "+Xe+" s limit",children:Xe+" s limit"}),Pe.canShare&&y.jsx("button",{"data-role":"studio-record-share","data-selection-safe":!0,style:$n(!0),onClick:tO,title:"Share the recording — save it to Photos or post it",children:"Share video"}),y.jsx("button",{"data-role":"studio-record-save","data-selection-safe":!0,style:$n(!Pe.canShare),onClick:nO,title:"Download "+Pe.file.name,children:"Save video"})]}),y.jsx("div",{style:{flex:"0 0 6px"}}),y.jsx("button",{style:{padding:"3px 9px",fontSize:"0.66rem",cursor:"pointer",borderRadius:"4px",border:"1px solid "+(uo?"#7ec8e3":"#333"),background:uo?"#16323c":"#1a1a1a",color:uo?"#7ec8e3":"#bbb"},"data-role":"studio-scene-code",onClick:function(){Sv(!0),xf(function(p){return!p})},title:"Show the scene's code — the file it was built from (Cmd/Ctrl+Enter runs it)",children:"</> Code"}),y.jsx("div",{style:{flex:"0 0 6px"}}),L.projectId?y.jsxs(y.Fragment,{children:[y.jsx("button",{style:$n(!0),disabled:!ge,onClick:QE,title:"Save — overwrite current project",children:"Save"}),y.jsx("button",{style:$n(!1),disabled:!ge,onClick:function(){Tf(L.name+" copy")},title:"Save As — create a new project",children:"Save As"})]}):y.jsx("button",{style:$n(!0),disabled:!ge,onClick:function(){Tf(L.name||"")},title:"Save As — name and save a new project",children:"Save As"}),y.jsx("button",{style:$n(!1),disabled:!ge,onClick:rO,title:"Export — download this project's folder as a .zip (its files + an index.html that boots it)",children:"Export"}),y.jsx("button",{style:$n(!1),onClick:function(){Df.current&&Df.current.click()},title:"Import — a project .zip (as Export writes it) or one sketch .js, saved and opened",children:"Import"}),y.jsx("input",{ref:Df,type:"file",accept:".zip,application/zip,.js,text/javascript",style:{display:"none"},onChange:iO,"data-role":"bundle-import-input"}),y.jsx("div",{style:{flex:1}}),ge&&y.jsx("span",{style:{fontSize:"0.6rem",color:fO,letterSpacing:"0.5px"},children:dO})]}),N.length>0&&y.jsxs("div",{"data-role":"studio-retired-saves","data-count":N.length,style:{display:"flex",alignItems:"center",gap:"10px",padding:"4px 10px",background:"#2a2410",color:"#d8c070",fontSize:"0.66rem",borderBottom:"1px solid #3a3418",flexShrink:0},children:[y.jsx("span",{children:N.length+" save"+(N.length===1?"":"s")+" in the retired project format cannot be opened (the project folder replaced it)."}),y.jsx("button",{style:$n(!1),onClick:RE,"data-role":"studio-delete-retired",title:"Delete exactly these retired saves (asks first)",children:"Delete retired saves"})]}),y.jsxs("div",{style:_e.body,children:[y.jsxs("div",{style:Object.assign({},_e.col,_e.palette,Be?null:{width:20,minWidth:20,padding:"4px 2px"}),children:[y.jsx("div",{"data-selection-safe":!0,title:Be?"Hide panel":"Show Tools / Palette",onClick:function(){Ce(!Be)},style:{cursor:"pointer",textAlign:Be?"right":"center",color:"#6a7a8a",fontSize:"0.72rem",marginBottom:"4px",userSelect:"none"},children:Be?"◂":"▸"}),Be&&y.jsxs(Ze.Fragment,{children:[y.jsx("div",{style:_e.h,children:"Tools"}),y.jsxs("div",{style:_e.toolRow,children:[y.jsx("div",{style:If("hand"),...Ff("hand","Hand"),"data-selection-safe":!0,title:"Hand — drag to move (click again for unobstructed view)",onClick:function(){hc("hand")},children:y.jsx(qc,{kind:"hand"})}),y.jsx("div",{style:If("dropper"),...Ff("dropper","Dropper"),"data-selection-safe":!0,title:"Dropper — click canvas to place (click again for unobstructed view)",onClick:function(){hc("dropper")},children:y.jsx(qc,{kind:"dropper"})}),y.jsx("div",{style:If("pencil"),...Ff("pencil","Pencil"),"data-selection-safe":!0,title:"Pencil — click object to edit (click again for unobstructed view)",onClick:function(){hc("pencil")},children:y.jsx(qc,{kind:"pencil"})})]}),y.jsx("div",{style:_e.h,children:"Palette"}),aO(),y.jsx("div",{style:Object.assign({},_e.h,{marginTop:"10px"}),children:"Effects"}),y.jsxs("button",{style:_e.chip,onClick:function(){Bv(!Mn.backdrop)},disabled:!ge,title:"Toggle pond backdrop",children:["□ Backdrop ",y.jsx("span",{style:_e.sub,children:"(pond)"})]}),y.jsxs("div",{style:_e.hint,children:[!pt&&`Unobstructed running view.
|
|
73
73
|
Pick a tool to edit.`,pt==="hand"&&`Drag bbox interior to move.
|
|
74
74
|
Drag edge/corner to scale.`,pt==="dropper"&&(R?`Click canvas to place:
|
package/dist/studio/app.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
background: #0d0d0d;
|
|
14
14
|
}
|
|
15
15
|
</style>
|
|
16
|
-
<script type="module" crossorigin src="./app-assets/index-
|
|
16
|
+
<script type="module" crossorigin src="./app-assets/index-DX5L-7-w.js"></script>
|
|
17
17
|
<link rel="stylesheet" crossorigin href="./app-assets/index-DMlx7z1P.css">
|
|
18
18
|
<script src="DeSciXAppSDK.js" data-frqtl-host-provided></script>
|
|
19
19
|
<link rel="home" href="index.html" data-frqtl-host-provided>
|
package/llms.txt
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> A discrete cellular-automata physics engine (compiled Rust → WASM) for the browser: interference,
|
|
4
4
|
> blackbody spectra and binding emerge from per-pixel rules (1 px/tick, single occupancy, momentum).
|
|
5
|
-
> 0.7.0-
|
|
5
|
+
> 0.7.0-p2 on npm dist-tag `next`. Node twin: @descix/frqtl-node.
|
|
6
6
|
|
|
7
7
|
- Install: `npm install @descix/frqtl-web`
|
|
8
8
|
- See it run: https://egpt-frqtl.descix.net (the showcase scenes in STUDIO and the GYM)
|
|
9
|
-
- One-file form (global FRQTL): https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
9
|
+
- One-file form (global FRQTL): https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/frqtl-web.min.js
|
|
10
10
|
- A scene is an ES module: `export default function buildExperiment(exp)`, first statement
|
|
11
11
|
`exp.createCanvas(w, h, cfg)` (2D, p5) or `exp.createScene(w, h, d, cfg)` (3D, three); parts from
|
|
12
|
-
`@descix/frqtl-web/parts`. A part to read: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
12
|
+
`@descix/frqtl-web/parts`. A part to read: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/frqtl/parts/DetectorWall.js
|
|
13
13
|
- Doors (`@descix/frqtl-web/boot`): `bootScene(mount, buildExperiment, opts)`;
|
|
14
14
|
`bootProject(mount, { files: { 'sketch.js': text }, entry: 'sketch.js' }, opts)` or `{ url, entry }`; a folder whose
|
|
15
15
|
`frqtl.json` names its entry boots as `{ files }` or `{ url }` with no `entry`.
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
- `./host-view`: `declareHostView`, `HOST_VIEW_OUTCOMES`, `CONTRACT_VIOLATIONS`, `HOST_SDK_SCRIPT` (an app asks its DeSciX shell for a view, once: `declareHostView({ sdk: window.DeSciX, mode, fallback })`; the outcome is on the html element's dataset).
|
|
22
22
|
- `./site-graph`: `SITE_GRAPH_DIR`, `SITE_BUILD_ATTR`, `SITE_BUILD_ID_RE`, `siteBuildStampOf`, `STATIC_APP_PAGE`, `SITE_STUDIO_DIR`, `HOST_PROVIDED_ATTR`, `SITE_PLACEMENTS`, `SITE_ENTRY_PAGES`, `isSiteEntry`, `siteGraphFaults` (the static site's shape: graph directory, build-stamp attribute, build id pattern and its reader, IDE entry page, the attribute declaring a file host-provided, the graph directory of each placed package, the entry pages; and the rule that a served graph is the placed releases' bytes; for a reader of a served site, both packages)
|
|
23
23
|
- `await recipeContext.fork(name, NewKind, { by })`: copies the `parts` entry's part file into the folder as `parts/<NewKind>.js` (class renamed, imports rewritten to package specifiers) and re-runs the scene in place.
|
|
24
|
-
- API reference: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
25
|
-
- Full agent guide: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-
|
|
24
|
+
- API reference: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/dist/sdk.html
|
|
25
|
+
- Full agent guide: https://cdn.jsdelivr.net/npm/@descix/frqtl-web@0.7.0-p2/CLAUDE.md
|
|
26
26
|
- Acceptance is visual; no CLI ships. No account, credits or tokens are needed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descix/frqtl-web",
|
|
3
|
-
"version": "0.7.0-
|
|
3
|
+
"version": "0.7.0-p2",
|
|
4
4
|
"description": "FRQTL for the browser \u2014 the discrete fractal physics engine (compiled Rust \u2192 WASM), its parts as ES modules, the scene doors (bootScene, bootProject) and frqtl-web.min.js.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|