@three-blocks/devtools 1.0.0-alpha.190.g3ffe5c0ecc9c → 1.0.0-alpha.193.g4eb273dec3a7

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/CHANGELOG.md CHANGED
@@ -1,9 +1,27 @@
1
1
  # @three-blocks/devtools
2
2
 
3
- ## 1.0.0-alpha.190.g3ffe5c0ecc9c
3
+ ## 1.0.0-alpha.193.g4eb273dec3a7
4
+
5
+ - Tools: Mesh to Splat, OAV, and VAV are now installable from the Blender hub.
6
+
7
+ - Tools: The presentation now explains realistic shader startup and worker rendering clearly.
8
+
9
+ - Website: Spotlight Type no longer flashes blank while its canvas text initializes.
10
+
11
+ - Website: Alpha release badges stay compact and red while development builds use yellow.
12
+
13
+ - CLI: Splat-engine downloads now install reliably on Windows and support both Mac architectures.
4
14
 
5
15
  - Tools: Private tool releases now deliver the current Blender and CLI bundles.
6
16
 
17
+ - Devtools: Shader traces now measure replay, skip PMREM setup, and support Three.js r186dev.
18
+
19
+ - Devtools: Compute shaders now warm asynchronously and ocean shaders hydrate without setup.
20
+
21
+ - Starter: Website demos now rebuild with the current Devtools during local development.
22
+
23
+ - Tools: Example parity now reuses evidence when captures and execution contracts are unchanged.
24
+
7
25
  - Tools: Example optimization now waits for loading and exits cleanly after parity.
8
26
 
9
27
  - Website: Mobile navigation now opens from a responsive menu on every page.
@@ -26,7 +44,7 @@
26
44
 
27
45
  - Website: Release pages show the exact version with a short changelog.
28
46
 
29
- - Packages: Built from `3ffe5c0ecc9c`.
47
+ - Packages: Built from `4eb273dec3a7`.
30
48
 
31
49
 
32
50
  This changelog is generated from Changesets.
package/README.md CHANGED
@@ -47,7 +47,7 @@ The overlay changes from **Live** to **Precompiled** after a fresh capture loads
47
47
 
48
48
  ### Three.js r185 compatibility patch
49
49
 
50
- Shader precompilation supports Three.js `>=0.185.0 <0.186.0`. Every adapter applies the same version-gated transform to `three/build/three.webgpu.js` in memory and never writes `node_modules`. Exact source anchors fail closed on unknown or partially patched builds. Current captures require precompiled manifest version `3` and shader receipt transform version `50`; recapture older artifacts instead of editing them.
50
+ Shader precompilation supports Three.js `>=0.185.0 <0.186.0`. Every adapter applies the same version-gated transform to `three/build/three.webgpu.js` in memory and never writes `node_modules`. Exact source anchors fail closed on unknown or partially patched builds. Current captures require precompiled manifest version `3` and shader receipt transform version `51`; recapture older artifacts instead of editing them.
51
51
 
52
52
  The [Three.js WebGPU compatibility reference](../../docs/maintenance/three-webgpu-release-compatibility.md) defines the released r185 patches, source markers, removal conditions, and verification gates.
53
53
 
@@ -33,7 +33,7 @@ declare function activeShaderCaptureScene(): string;
33
33
  * Capture-runtime copy of the devtools timing seam. This module is injected as a
34
34
  * standalone browser script and therefore cannot import three-blocks/devtools.
35
35
  */
36
- declare function wrapThreeBlocksCaptureTimedBuild(builder: UnknownRecord, key: 'build' | 'buildAsync', record?: (elapsedMs: number) => void, clock?: () => number, onBuilt?: () => void): void;
36
+ declare function wrapThreeBlocksCaptureTimedBuild(builder: UnknownRecord, key: 'build' | 'buildAsync' | 'prepareForHydration', record?: (elapsedMs: number, method: 'build' | 'buildAsync' | 'prepareForHydration') => void, clock?: () => number, onBuilt?: () => void): void;
37
37
  /** Called immediately after Three creates a live NodeBuilder, before setup/build. */
38
38
  declare function instrumentThreeBlocksShaderBuilder(builderValue: unknown, rendererValue: unknown, targetValue?: unknown): void;
39
39
  /** Called after the #34068 builder callback observes a successful real build. */
@@ -1,3 +1,3 @@
1
- var An=Object.defineProperty;var p=(t,e)=>An(t,"name",{value:e,configurable:true});var De="three-webgpu-r185-v1",Ke=["fragmentNode","vertexNode","colorNode","positionNode","normalNode","opacityNode","alphaTestNode","backdropNode","backdropAlphaNode","emissiveNode","metalnessNode","roughnessNode","clearcoatNode","clearcoatRoughnessNode","transmissionNode","thicknessNode","iorNode","outputNode","mrtNode","depthNode","castShadowNode","receivedShadowNode","maskNode","envNode"];var J=["_renderContexts","_renderContexts"],j=Object.freeze({renderContextMrt:"three-r185-render-context-mrt",renderContextInput:"three-r185-render-context-input",skinningEvent:"three-r185-skinning-event",previousBoneMatrices:"three-r185-previous-bone-matrices",previousInstanceMatrices:"three-r185-previous-instance-matrices",previousInstanceMatricesEvent:"three-r185-previous-instance-matrices-event",dynamicLightData:"three-r185-dynamic-light-data",morphUpdateEvent:"three-r185-morph-update-event",maxMip:"three-r185-max-mip",morphTargetTexture:"three-r185-morph-target-texture",cubeMap:"three-r185-cube-map",passTexture:"three-r185-pass-texture",reflector:"three-r185-reflector",object3D:"three-r185-object3d",passSetupOutput:"three-r185-pass-setup-output",retainedLightUniform:"three-r185-retained-light-uniform",retainedReference:"three-r185-retained-reference",retainedShadowChild:"three-r185-retained-shadow-child",retainedShadowFar:"three-r185-retained-shadow-far",materialSteps:"three-r185-material-steps"});function Ge(t){let e=/^(.*)-([^-]+)-(-?\d+)$/u.exec(t);if(e?.[1]===void 0||e[2]===void 0||e[3]===void 0)return;let n=Number(e[3]);if(Number.isSafeInteger(n))return {attachmentState:e[1],mrtState:e[2],callDepth:n}}p(Ge,"parseThreeR185RenderContextKey");function Mt(t){return t==="185"||t===185}p(Mt,"supportsThreeR185Revision");function Tn(t){let e=t.constructor;return (typeof e=="function"||typeof e=="object"&&e!==null)&&typeof Reflect.get(e,"name")=="string"?String(Reflect.get(e,"name")):"unknown"}p(Tn,"constructorName");function ze(t){let e=t,n=p(o=>e[o]===true,"flag"),r=typeof e.textureNode=="object"&&e.textureNode!==null||typeof e.nodeUniform=="object"&&e.nodeUniform!==null;return n("isNodeUniformsGroup")?"NodeUniformsGroup":n("isUniformsGroup")?"UniformsGroup":n("isNodeUniformBuffer")?"NodeUniformBuffer":n("isUniformBuffer")?"UniformBuffer":n("isStorageBuffer")?r?"NodeStorageBuffer":"StorageBuffer":n("isSampledCubeTexture")?r?"NodeSampledCubeTexture":"SampledCubeTexture":n("isSampledTexture3D")?"NodeSampledTexture3D":n("isSampled3DTexture")?"Sampled3DTexture":n("isSampledArrayTexture")?r?"NodeSampledArrayTexture":"SampledArrayTexture":n("isSampledTexture")?r?"NodeSampledTexture":"SampledTexture":n("isSampler")?r?"NodeSampler":"Sampler":typeof e.kind=="string"?e.kind:Tn(t)}p(ze,"capturedBindingKind");var Lt="three-webgpu-r186dev-v1";function Ot(t){return t==="186dev"}p(Ot,"supportsThreeR186DevRevision");var It="three-blocks.shader-capture.runtime.v1";var xn=Symbol.for("three-blocks.shader-capture.cache.v1"),Cn=Symbol.for("three-blocks.shader-capture.cache-value.v1"),_n=Symbol.for("three-blocks.shader-input-registry.v1"),nt="/__three-blocks/shaders/capture",pe="/__three-blocks/shaders/telemetry",Me=4096,Bn=5,En=65536,Ut=256*1024,Mn=1e3,Ln=/^[a-z0-9][a-z0-9_-]{0,63}$/u,je=De,On=new Set(["cameraProjectionMatrix","cameraProjectionMatrixInverse","cameraViewMatrix","cameraWorldMatrix","cameraNormalMatrix","cameraPosition"]),We=["lightPosition","lightTargetPosition","lightViewPosition","lightShadowMatrix"],In=new Set(["_texture","_width","_height","_maxMip","_matrixUniform","_flipYUniform"]),Un={bias:"shadowBias",intensity:"shadowIntensity",normalBias:"shadowNormalBias",radius:"shadowRadius",blurSamples:"shadowBlurSamples",mapSize:"shadowMapSize"},M={buildCalls:0,renderBuilds:0,computeBuilds:0,registeredBuilds:0,registeredRenderBuilds:0,registeredComputeBuilds:0,buildMs:0,injected:0,injectedRender:0,injectedCompute:0,missed:0,missedRender:0,missedCompute:0,missedKeys:[]},_={capture:false,forceLive:false,settleFrames:60,readiness:{},transform:1},nn=new WeakMap,Pt=new WeakSet,$t=new WeakSet,rt=new WeakMap,ot=new Set,rn=new WeakMap,ve=[],xe=[],Ft=new WeakMap,Dt=new WeakMap,Kt=new WeakMap,Q,we=0,He=false,ye=false,ee="default",re,oe,ne=false,it=0,Ne,Gt=false,I,K,Ce={},fe,le=false;function _e(t){return /^.+\/input-[a-zA-Z0-9_-]+-\d{4}$/u.test(t)}p(_e,"isAutomaticInputContainerKey");function l(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}p(l,"isRecord");function on(){let t=Reflect.get(globalThis,_n);return l(t)&&t.version===1?t:void 0}p(on,"retainedInputRegistry");function F(t){let e=on(),n=e?.keyFor;if(typeof n!="function")return;let r=Reflect.apply(n,e,[t]);return typeof r=="string"&&r.startsWith("@three-blocks-input:")?r:void 0}p(F,"retainedInputKey");function zt(t){if(t===null||typeof t!="object")return;let e=on(),n=e?.locationForValue;if(typeof n=="function"){let i=Reflect.apply(n,e,[t]);if(l(i)&&typeof i.key=="string"&&i.key.startsWith("@three-blocks-input:")&&Array.isArray(i.path)&&i.path.every(s=>s==="value"||s==="array"))return {container:i.key,path:i.path}}let r=e?.keyForValue;if(typeof r!="function")return;let o=Reflect.apply(r,e,[t]);return typeof o=="string"&&o.startsWith("@three-blocks-input:")?{container:o,path:["value"]}:void 0}p(zt,"retainedInputValueLocation");function st(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return;if(e.add(t),Array.isArray(t)){for(let r of t){let o=st(r,e);if(o)return o}return}let n=t;for(let r of ["key","container"]){let o=n[r];if(typeof o=="string"&&_e(o))return o}for(let r of Object.values(n)){let o=st(r,e);if(o)return o}}p(st,"automaticInputContainerReference");function at(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return;if(e.add(t),Array.isArray(t)){for(let i of t){let s=at(i,e);if(s)return s}return}let n=t,r=n.container,o=n.path;if(typeof r=="string"&&Array.isArray(o)){let i=o.filter(s=>typeof s=="string");if(r==="@renderer"&&i.includes(J[0])||r==="@object"&&i.includes("_renderer"))return `${r}.${i.join(".")}`}for(let i of Object.values(n)){let s=at(i,e);if(s)return s}}p(at,"transientRendererReference");function Be(t){return l(t)&&t.isNode===true}p(Be,"isNode");function w(t){if(l(t)&&typeof t.getSelf=="function"){let e=t.getSelf();return Be(e)?e:void 0}return Be(t)?t:void 0}p(w,"nodeFrom");function he(t){let e=new Map;if(t.isNode!==true)return e;e.set(t,[]);let n=[t];for(let r=0;r<n.length;r++){let o=n[r];if(!o||typeof o.getSerializeChildren!="function")continue;let i=e.get(o)??[],s=0;for(let d of o.getSerializeChildren()){let a=w(d.childNode);if(a&&!e.has(a)&&(e.set(a,[...i,s]),n.push(a)),s++,s>Me)throw new Error("Shader node graph exceeds the capture child limit.")}}return e}p(he,"indexNodeGraph");function dt(t){if(t.k==="owned"){let e=dt(t.owner);return e===t.owner?t:{...t,owner:e}}if(t.k==="container"&&t.key==="@renderer"&&t.path.length>=4&&t.path[0]===J[0]&&t.path[1]===J[1]&&t.path.at(-1)==="mrt"){let e=t.path[2],n=typeof e=="string"?Ge(e):void 0;if(n!==void 0){let r=sn(n.attachmentState);return {k:"recipe",id:j.renderContextMrt,version:1,input:{attachmentState:n.attachmentState,callDepth:n.callDepth,...r===void 0?{}:{samples:r}}}}}return t}p(dt,"stableRenderContextAddress");function Pn(t){for(;t.k==="owned";)t=t.owner;return t.k==="container"&&t.key.startsWith("@three-blocks-input:")&&!t.key.startsWith("@three-blocks-input:setup-")}p(Pn,"addressUsesGenericRetainedInputRoot");function sn(t){let e=t.split(":");if(e.length!==6)return;let n=Number(e[3]);return Number.isSafeInteger(n)&&n>=0?n:void 0}p(sn,"renderAttachmentSamples");function $n(t,e){let n=l(t)?t:{},r={isDepthTexture:n.isDepthTexture===true,isRenderTargetTexture:n.isRenderTargetTexture===true,isDataTexture:n.isDataTexture===true,isData3DTexture:n.isData3DTexture===true,isCubeTexture:n.isCubeTexture===true,format:typeof n.format=="number"?n.format:null,type:typeof n.type=="number"?n.type:null,compareFunction:typeof n.compareFunction=="number"?n.compareFunction:null};typeof n.name=="string"&&n.name.length>0&&(r.name=n.name),typeof n.colorSpace=="string"&&n.colorSpace.length>0&&(r.colorSpace=n.colorSpace);let o=sn(e);return o!==void 0&&(r.samples=o),r}p($n,"textureResourceSignature");function Fn(t,e){if(t.k!=="inputNode"||t.value.container!=="@renderer")return t;let n=t.value.path;if(n.length<4||n[0]!==J[0]||n[1]!==J[1]||typeof n[2]!="string")return t;let r=Ge(n[2]);if(r===void 0)return t;let o=n[3]==="depthTexture"&&n.length===4?"depthTexture":n[3]==="textures"&&n.length===5&&Number.isSafeInteger(n[4])?"texture":void 0;if(o===void 0)return t;let{k:i,value:s,...d}=t;return {k:"recipe",id:j.renderContextInput,version:1,input:{attachmentState:r.attachmentState,callDepth:r.callDepth,mrt:r.mrtState!=="default",resource:o,...o==="texture"?{index:Number(n[4])}:{},texture:$n(e,r.attachmentState),node:d}}}p(Fn,"stableRenderContextInputAddress");function m(t){if(!l(t))return typeof t;let e=t.constructor;return (typeof e=="function"||l(e))&&typeof e.name=="string"?e.name:"unknown"}p(m,"constructorName");function Wt(t){if(!l(t))return m(t);let e=l(t.image)?t.image:void 0;return [m(t),typeof t.uuid=="string"?`uuid=${t.uuid}`:"",typeof t.name=="string"&&t.name?`name=${t.name}`:"",t.isRenderTargetTexture===true?"renderTarget":"",t.isPMREMTexture===true?"pmrem":"",e&&typeof e.width=="number"&&typeof e.height=="number"?`${e.width}x${e.height}`:"",typeof t.format=="number"?`format=${t.format}`:"",typeof t.type=="number"?`type=${t.type}`:""].filter(Boolean).join("/")}p(Wt,"textureLabel");function Se(t,e){return typeof t=="string"&&t.length>0?t.slice(0,512):e}p(Se,"boundedLabel");function Dn(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now():Date.now()}p(Dn,"now");function an(t){return l(t)&&typeof t.then=="function"}p(an,"promiseLike");function Kn(t){_={capture:t.capture===true,forceLive:t.forceLive===true,settleFrames:Number.isSafeInteger(t.settleFrames)&&t.settleFrames>=0?t.settleFrames:60,settleTimeoutMs:Number.isSafeInteger(t.settleTimeoutMs)&&Number(t.settleTimeoutMs)>=1e3?Number(t.settleTimeoutMs):3e4,visibilityGuard:t.visibilityGuard===true,...typeof t.captureId=="string"?{captureId:t.captureId}:{},...typeof t.sessionKey=="string"?{sessionKey:t.sessionKey}:{},...typeof t.token=="string"?{token:t.token}:{},readiness:{...typeof t.readiness?.selector=="string"?{selector:t.readiness.selector}:{},...typeof t.readiness?.global=="string"?{global:t.readiness.global}:{}},transform:t.transform},fe=void 0,le=false,re=void 0,oe=void 0,ne=false,it=0,Ne=void 0,K=void 0,Reflect.set(globalThis,xn,n=>{l(n)&&Ht(n);});let e=Reflect.get(globalThis,Cn);l(e)&&Ht(e),(_.capture||dn())&&zn();}p(Kn,"configureThreeBlocksShaderCapture");function dn(){let t=Reflect.get(globalThis,"location"),e=l(t)?Reflect.get(t,"search"):void 0;if(typeof e!="string")return false;let n=new URLSearchParams(e),r=n.get("threeBlocksShaderMode");return n.get("capture")==="1"||r==="live"||r==="precompiled"}p(dn,"drivenShaderSession");function ht(){return _.capture||_.forceLive||dn()}p(ht,"shaderSessionActive");function Ht(t){if(I=t,!_.capture)return;let e=cn(),n=t.automaticRegistrationPrefix,r=typeof n=="function"?Reflect.apply(n,t,[e]):void 0;typeof r=="string"&&(K=r);}p(Ht,"adoptCaptureCache");function Gn(t){if(!_.capture||I===void 0)return;let e=I.automaticRegistrationPrefix,n=typeof e=="function"?Reflect.apply(e,I,[t]):void 0;if(typeof n=="string"){K=n;return}let r=I.enableAutomaticRegistration;if(typeof r=="function"){K="auto";try{Reflect.apply(r,I,[{scene:t,prefix:K}]);}catch(o){throw K=void 0,o}}}p(Gn,"ensureCaptureAutomaticRegistration");function zn(){if(Gt)return;let t=globalThis,e=t.requestAnimationFrame;if(typeof e!="function")return;Gt=true;let n=0,r=0,o=false,i=new Map,s=p(()=>{o||i.size===0||(o=true,Reflect.apply(e,t,[()=>{o=false;let d=[...i.values()];i.clear();let a=n++*(1e3/60);for(let u of d)try{u(a);}catch(f){queueMicrotask(()=>{throw f});}s();}]));},"schedule");Reflect.set(t,"requestAnimationFrame",d=>{let a=++r;return i.set(a,d),s(),a}),Reflect.set(t,"cancelAnimationFrame",d=>{i.delete(d);});}p(zn,"installDeterministicRaf");function H(t,e){if(!I)return;let n=I[t];return typeof n=="function"?Reflect.apply(n,I,e):void 0}p(H,"cacheCall");function cn(){if(I&&typeof I.activeScene=="string"&&I.activeScene!=="default")return I.activeScene;let t=Reflect.get(globalThis,"location"),e=l(t)?Reflect.get(t,"search"):void 0,n=typeof e=="string"?new URLSearchParams(e).get("captureId"):null;return n!==null&&Ln.test(n)?n:I&&typeof I.activeScene=="string"?I.activeScene:"default"}p(cn,"activeShaderCaptureScene");function ie(){return cn()}p(ie,"activeScene");function me(t,e,n,r){let o=H(t==="compute"?"registrationForCompute":"registrationForRender",t==="compute"?[e,n]:[e,n,r]);return (!l(o)||typeof o.key!="string")&&(Gn(n),o=H(t==="compute"?"registrationForCompute":"registrationForRender",t==="compute"?[e,n]:[e,n,r])),l(o)&&typeof o.key=="string"?o:void 0}p(me,"sceneRegistration");function Wn(t){return t.key}p(Wn,"capturedRegistrationKey");function gt(t,e){let n=e==="compute"?t.object:t.material;return n!==null&&typeof n=="object"?n:void 0}p(gt,"builderTarget");function un(t){return t.material===null||t.material===void 0?"compute":"render"}p(un,"buildKind");function qe(t){if(!l(t))return;let e={};for(let n of ["uuid","id","name","type"]){let r=t[n];typeof r=="string"?e[n]=Se(r,""):(typeof r=="number"&&Number.isFinite(r)||typeof r=="boolean")&&(e[n]=r);}return Object.keys(e).length===0?void 0:e}p(qe,"objectIdentity");function Hn(t,e,n,r){if(xe.length>=Me)return;let o=t==="compute"?e.object:e.material,i=Se(l(o)?o.name??o.type:void 0,"unknown"),s=H("registrations",[n]),d=qe(o),a=l(r)?qe(r.material):void 0;xe.push({kind:t,name:i,reason:t==="compute"?`unregistered compute "${i}"`:`unregistered material "${i}"`,...d===void 0?{}:{target:d},...a===void 0?{}:{renderObjectMaterial:a},...Array.isArray(s)?{registrations:s.slice(0,16).flatMap(u=>{if(!l(u))return [];let f=qe(u.target);return [{...typeof u.key=="string"?{key:Se(u.key,"")}:{},...typeof u.kind=="string"?{kind:Se(u.kind,"")}:{},...f??{},sameTarget:u.target===o,...l(r)?{sameRenderObjectMaterial:u.target===r.material}:{}}]})}:{}});}p(Hn,"addSkipped");function qt(t,e,n=i=>{M.buildMs+=i;},r=Dn,o){let i=t[e];typeof i=="function"&&Reflect.set(t,e,p(function(...d){let a=r(),u;try{u=Reflect.apply(i,this,d);}catch(f){throw n(r()-a),f}return an(u)?Promise.resolve(u).then(f=>(n(r()-a),o?.(),f),f=>{throw n(r()-a),f}):(n(r()-a),o?.(),u)},"timedBuild"));}p(qt,"wrapThreeBlocksCaptureTimedBuild");function fn(t,e,n){if(!ht()||!l(t)||!l(e)||Pt.has(t))return;Pt.add(t);let r=ie(),o=H("containers",[r]);rt.set(t,new Set(Array.isArray(o)?o.filter(g=>l(g)&&typeof g.key=="string").map(g=>String(g.key)):[]));let i=l(n)&&l(n.material)?n:void 0,s=i?"render":un(t),d=s==="render"&&i?Ee("render",i):gt(t,s);d&&(i&&rn.set(t,i),me(s,d,ie(),i));let a=[];nn.set(t,a);let u=t.getUniformFromNode;typeof u=="function"&&Reflect.set(t,"getUniformFromNode",p(function(k,N,S,c){let y=Reflect.apply(u,this,[k,N,S,c]),R=w(k),b=typeof S=="string"?S:this.shaderStage;if(R&&typeof N=="string"&&(b==="vertex"||b==="fragment"||b==="compute")){let A=l(y)&&typeof y.name=="string"?y.name:typeof c=="string"?c:null;a.push({node:R,type:N,stage:b,name:A,...typeof R.id=="number"?{nid:R.id}:{}});}return y},"captureUniform"));let f=p(()=>{$t.has(t)||($t.add(t),ln(t,e));},"recordBuild");qt(t,"build",void 0,void 0,f),qt(t,"buildAsync",void 0,void 0,f);}p(fn,"instrumentThreeBlocksShaderBuilder");function ce(t){return Object.assign(Object.create(Object.getPrototypeOf(t)),t)}p(ce,"cloneCaptureRecord");function qn(t){let e=Object.create(t);for(let s of ["object","material","scene","camera","lightsNode","context","vertexShader","fragmentShader","computeShader","observer","hardwareClipping","updateNodes","updateBeforeNodes","updateAfterNodes"]){let d=t[s];Reflect.set(e,s,s==="material"&&l(d)?ce(d):Array.isArray(d)?[...d]:d);}let n=typeof t.getAttributesArray=="function"?Reflect.apply(t.getAttributesArray,t,[]):[],r=Array.isArray(n)?n.map(s=>l(s)?ce(s):s):[];Reflect.set(e,"getAttributesArray",()=>r);let o=typeof t.getBindings=="function"?Reflect.apply(t.getBindings,t,[]):[],i=Array.isArray(o)?o.map(s=>{if(!l(s))return s;let d=ce(s),a=Array.isArray(s.bindings)?s.bindings.map(u=>{if(!l(u))return u;let f=ce(u);return Array.isArray(u.uniforms)&&Reflect.set(f,"uniforms",u.uniforms.map(g=>l(g)?ce(g):g)),f}):[];return Reflect.set(d,"bindings",a),d}):[];return Reflect.set(e,"getBindings",()=>i),e}p(qn,"snapshotBuilderState");function ln(t,e){if(!ht()||_.capture&&ye||!l(t)||!l(e))return;M.buildCalls++,oe=Date.now(),ne=false;let n=un(t);n==="compute"?M.computeBuilds++:M.renderBuilds++;let r=ie();ee=r;let o=rt.get(t)??new Set,i=H("containers",[r]);if(Array.isArray(i))for(let u of i)l(u)&&typeof u.key=="string"&&_e(u.key)&&!o.has(u.key)&&ot.add(u.key);rt.delete(t);let s=gt(t,n),d=n==="render"?rn.get(t)??(l(t.object)?t.object:void 0):void 0,a=s?me(n,s,r,d):void 0;if(a){M.registeredBuilds++,n==="compute"?M.registeredComputeBuilds++:M.registeredRenderBuilds++;let u=Wn(a);if(ve.length<Me){let f=qn(t),g={scene:r,key:u,kind:n,builder:f,renderer:e,...d?{renderObject:d}:{},journal:[...nn.get(t)??[]]};ve.push(g);}}else Hn(n,t,r,d);hn();}p(ln,"recordThreeBlocksShaderBuild");function Ee(t,e){return t==="compute"?e!==null&&typeof e=="object"?e:void 0:l(e)&&e.material!==null&&typeof e.material=="object"?e.material:void 0}p(Ee,"targetForProvider");function Jt(t,e,n){if(_.capture&&ye)return;let r=ie();ee=r;let o=Ee(t,e),i=t==="render"&&l(e)?e:void 0,s=o?me(t,o,r,i):void 0;n!=null?(M.injected++,t==="compute"?M.injectedCompute++:M.injectedRender++):s&&(M.missed++,t==="compute"?M.missedCompute++:M.missedRender++,M.missedKeys.length<Me&&!M.missedKeys.includes(s.key)&&M.missedKeys.push(s.key)),_.capture||hn();}p(Jt,"recordProviderResult");function Jn(t){let e=t.debug;if(!l(e))return;let n=e.onNodeBuilderCreated,r=Kt.get(t);if(n===r)return;let o=typeof n=="function"?n:void 0,i=p(function(d,a){o!==void 0&&Reflect.apply(o,this,[d,a]),fn(d,t,a);},"captureNodeBuilder");Kt.set(t,i),e.onNodeBuilderCreated=i;}p(Jn,"installCaptureBuilderCallback");function Yn(t,e,n){if(!l(t))return;if(n!==void 0)if(Mt(n))je=De;else if(Ot(n))je=Lt;else throw new Error(`@three-blocks/devtools supports Three.js revisions 185 and 186dev capture; received ${JSON.stringify(n)}.`);let r=Reflect.get(t,"backend");if(l(r)&&r.isWebGLBackend===true||!ht())return;if(l(e)&&e!==Ce&&(Ce=e,Ae=void 0),Jn(t),_.forceLive){let u=Dt.get(t);u||(u={__threeBlocksCaptureForceLive:true,getForRender(f){let g=Ee("render",f);g&&me("render",g,ie(),l(f)?f:void 0);},getForCompute(f){let g=Ee("compute",f);g&&me("compute",g,ie());}},Dt.set(t,u)),t.nodeBuilderStateProvider=u;return}let o=t.nodeBuilderStateProvider;if(!l(o))return;let i=Ft.get(o);if(i){t.nodeBuilderStateProvider=i;return}if(o.__threeBlocksCaptureWrapper===true)return;let s=o.getForRender,d=o.getForCompute;if(typeof s!="function"||typeof d!="function")return;let a={__threeBlocksCaptureWrapper:true,getForRender(u,f,g){let k=Reflect.apply(s,o,[u,f,g]);return Jt("render",u,k),k},getForCompute(u,f,g){let k=Reflect.apply(d,o,[u,f,g]);return Jt("compute",u,k),k}};Ft.set(o,a),t.nodeBuilderStateProvider=a;}p(Yn,"prepareThreeBlocksShaderRenderer");var Xn=Object.freeze({configureThreeBlocksShaderCapture:Kn,instrumentThreeBlocksShaderBuilder:fn,prepareThreeBlocksShaderRenderer:Yn,recordThreeBlocksShaderBuild:ln});Reflect.set(globalThis,Symbol.for(It),Xn);function Vn(t){return w(t)}p(Vn,"unwrapTsl");var Ae;function z(){if(Ae)return Ae;let t=new Map;for(let[e,n]of Object.entries(Ce)){let r=Vn(n);r&&!t.has(r)&&t.set(r,e);}return Ae=t,t}p(z,"tslMap");function Zn(t,e){if(!(!e||!l(t._nodes)||typeof t._nodes.getEnvironmentNode!="function"))return w(Reflect.apply(t._nodes.getEnvironmentNode,t._nodes,[e]))}p(Zn,"sceneEnvironmentNode");function Qn(t,e){if(!(!e||!l(t._nodes)||typeof t._nodes.getBackgroundNode!="function"))return w(Reflect.apply(t._nodes.getBackgroundNode,t._nodes,[e]))}p(Qn,"sceneBackgroundNode");var Yt=new WeakMap;function er(t,e,n){let r=Reflect.get(t,"getLightNodes");if(typeof r!="function")return [];let o=Reflect.get(e,"getDataFromNode");if(typeof o=="function")for(let d of ["fragment","vertex","compute","any"]){let a=Reflect.apply(o,e,[t,d]),u=l(a)?a.lightNodes:void 0;if(Array.isArray(u))return u.map(w).filter(f=>f!==void 0)}let s=Reflect.apply(r,t,[{renderer:n,context:{materialLightings:[]},getDataFromNode(d){let a=Yt.get(d);return a||(a={},Yt.set(d,a)),a}}]);return Array.isArray(s)?s.map(w).filter(d=>d!==void 0):[]}p(er,"lightNodes");function Je(t,e){let n=Reflect.get(Ce,t);return typeof n=="function"?w(Reflect.apply(n,void 0,[e])):void 0}p(Je,"lightUniform");function Ye(t){if(!t)return [];let e=[],n=Reflect.get(t,"traverse");return typeof n=="function"&&Reflect.apply(n,t,[r=>{r!==null&&typeof r=="object"&&Reflect.get(r,"isLight")===true&&e.push(r);}]),e}p(Ye,"sceneLights");function ue(t){if(!t)return [];let e=[],n=Reflect.get(t,"traverse");return typeof n=="function"&&Reflect.apply(n,t,[r=>{r!==null&&typeof r=="object"&&e.push(r);}]),e}p(ue,"sceneObjects");function tr(t){let e=[],n=new Set,r=p((o,i)=>{if(n.has(o))return;n.add(o),e.push([o,i]);let s=Reflect.get(o,"children");if(Array.isArray(s))for(let[d,a]of s.entries())l(a)&&a.isObject3D===true&&r(a,[...i,"children",d]);},"visit");return r(t,[]),e}p(tr,"object3DPaths");function nr(t){return !(Reflect.get(t,"isNode")===true||Reflect.get(t,"isObject3D")===true||Reflect.get(t,"isTexture")===true||Reflect.get(t,"isMaterial")===true||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Set||t instanceof Promise)}p(nr,"isScannable");function ct(t,e,n,r=()=>false,o=false){let i=new Set,s=[{value:t,path:[],depth:0}];for(let d=0;d<s.length;d++){let a=s[d];if(!a||i.has(a.value)||a.depth>Bn)continue;let{value:u,path:f,depth:g}=a;i.add(u);let k=Array.isArray(u)?Array.from(u,(N,S)=>[S,N]):u instanceof Map?[...u.entries()].filter(N=>typeof N[0]=="string"||typeof N[0]=="number").map(([N,S])=>[`map:${String(N)}`,S]):Object.keys(u).map(N=>[N,Reflect.get(u,N)]);for(let[N,S]of k){if(S===null||typeof S!="object")continue;let c=[...f,N];if(!r(c))if(Be(S)){let y=w(S);y&&e(y,c),o&&s.push({value:y??S,path:c,depth:g+1});}else n(S,c),nr(S)&&s.push({value:S,path:c,depth:g+1});}}}p(ct,"scanContainer");function pn(t){if(new Uint8Array(new Uint16Array([258]).buffer)[0]!==2)throw new Error("Shader capture requires a little-endian host.");let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=e.toBase64;if(typeof n=="function")return n.call(e);let r="",o=32768;for(let i=0;i<e.length;i+=o)r+=String.fromCharCode(...e.subarray(i,i+o));return btoa(r)}p(pn,"bytesToBase64");function rr(t){if(!ArrayBuffer.isView(t)||m(t)!=="Float32Array")throw new Error(`RangeNode setup produced an unsupported ${m(t)} buffer.`);if(t.byteLength>Ut)throw new Error(`RangeNode setup buffer is ${t.byteLength} bytes; embedded shader inputs are limited to ${Ut} bytes.`);return {t:"f32",data:pn(t)}}p(rr,"serializeRangeBuffer");function Xt(t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(l(t)){for(let[e,n]of [["isVector2","v2"],["isVector3","v3"],["isVector4","v4"],["isColor","c"],["isMatrix3","m3"],["isMatrix4","m4"]])if(t[e]===true&&typeof t.toArray=="function"){let r=Reflect.apply(t.toArray,t,[]);if(Array.isArray(r)&&r.every(o=>typeof o=="number"&&Number.isFinite(o)))return {t:n,a:r}}}}p(Xt,"serializeValueItem");function Vt(t){if(Array.isArray(t)){let r=t.map(Xt);return r.every(o=>o!==void 0)?{t:"arr",items:r}:void 0}let e=Xt(t);if(e!==void 0)return e;if(l(t)&&t.isTexture===true&&t.image==null&&t.isRenderTargetTexture!==true&&t.version===0&&(t.name===""||t.name===void 0))return {t:"tex"};if(!l(t)||t.isDataTexture!==true||!l(t.image))return;let n=t.image.data;if(!(!ArrayBuffer.isView(n)||typeof Reflect.get(n,"length")!="number"||Number(Reflect.get(n,"length"))>En))return {t:"dtex",arrayType:m(n),data:pn(n),width:typeof t.image.width=="number"?t.image.width:0,height:typeof t.image.height=="number"?t.image.height:0,format:typeof t.format=="number"?t.format:0,type:typeof t.type=="number"?t.type:0,minFilter:typeof t.minFilter=="number"?t.minFilter:0,magFilter:typeof t.magFilter=="number"?t.magFilter:0,wrapS:typeof t.wrapS=="number"?t.wrapS:0,wrapT:typeof t.wrapT=="number"?t.wrapT:0,name:typeof t.name=="string"?t.name:""}}p(Vt,"serializeStaticValue");function Xe(t){if(!(Object.hasOwn(t,"update")||Object.hasOwn(t,"updateBefore")||Object.hasOwn(t,"updateAfter"))){if(Reflect.get(t,"isStorageTextureNode")===true)return "storageTexture";if(Reflect.get(t,"isStorageBufferNode")===true)return "storage";switch(m(t)){case "BufferNode":return "buffer";case "BufferAttributeNode":return "bufferAttribute";case "Texture3DNode":return "texture3D";case "CubeTextureNode":return "cubeTexture";case "TextureNode":return "texture";case "UniformArrayNode":return "uniformArray";case "UniformNode":return "uniform";case "PMREMNode":return "pmremTexture";default:return}}}p(Xe,"inputClass");function Zt(t,e){let n=m(t);return n!==m(e)||["TextureNode","Texture3DNode","CubeTextureNode"].includes(n)||!!w(Reflect.get(t,"compareNode"))!=!!w(Reflect.get(e,"compareNode"))||Reflect.get(t,"access")!==Reflect.get(e,"access")?false:m(t)==="BufferAttributeNode"?["bufferType","bufferStride","bufferOffset","usage","instanced"].every(r=>Reflect.get(t,r)===Reflect.get(e,r)):true}p(Zt,"hasEquivalentSharedInputShape");function or(t){if(t.k==="inputNode")return t.value;if(t.k==="container")return {container:t.key,path:[...t.path,"value"]};if(t.k==="anchor"&&t.path.length===0)return {container:"@material",path:[t.slot,"value"]}}p(or,"sharedTextureValueLocation");function Qt(t){if(t?.k==="container")return {container:t.key,path:t.path};if(t?.k==="anchor"&&t.path.length===0)return {container:"@material",path:[t.slot]}}p(Qt,"sharedTextureNodeLocation");function en(t,e){if(t.isDataArrayTexture!==true||t.format!==1023||t.type!==1015||!l(t.image)||t.image.data===null||typeof t.image.data!="object"||m(t.image.data)!=="Float32Array")return false;let n=e.morphAttributes,r=e.attributes;if(!l(n)||!l(r)||!l(r.position))return false;let o=Array.isArray(n.position)?n.position:[],i=Array.isArray(n.normal)?n.normal:[],s=Array.isArray(n.color)?n.color:[],d=o.length>0?o:i.length>0?i:s;if(d.length===0)return false;let a=r.position.count;if(!Number.isSafeInteger(a)||Number(a)<0)return false;let u=s.length>0?3:i.length>0?2:1,f=Number(a)*u,g=1;return f>4096&&(g=Math.ceil(f/4096),f=4096),t.image.width===f&&t.image.height===g&&t.image.depth===d.length&&Reflect.get(t.image.data,"length")===f*g*4*d.length}p(en,"isThreeR185MorphTargetTexture");function ir(t){let e=H("registrations",[t]),n=new Map;if(Array.isArray(e))for(let a of e){if(!l(a))continue;let u=[],f=w(a.owner);f&&u.push(f);let g=a.target;if(a.kind==="compute"){let k=w(g);k&&u.push(k);}else if(g!==null&&typeof g=="object")for(let k of Ke){let N=w(Reflect.get(g,k));N&&u.push(N);}for(let k of u)for(let N of he(k).keys()){let S=F(N);S!==void 0&&!n.has(S)&&n.set(S,N);}}let r=[...n].map(([a,u])=>({key:a,node:u})),o=new Map,i=new Map,s=p((a,u)=>{let f=i.get(a);(f===void 0||u.path.length<f.path.length)&&i.set(a,u);},"rememberNearestValue");for(let a of r)o.set(a.node,{k:"container",key:a.key,path:[]});let d=p((a,u)=>{let f=o.get(a)??u;o.has(a)||o.set(a,f);for(let[g,k]of he(a))g===a||o.has(g)||o.set(g,{k:"owned",owner:f,path:k});},"indexGraph");for(let a of r){let u={k:"container",key:a.key,path:[]};s(a.node,{container:a.key,path:[]}),d(a.node,u),ct(a.node,(f,g)=>d(f,{k:"container",key:a.key,path:g}),(f,g)=>s(f,{container:a.key,path:g}),Y,true);}return {roots:r,nodes:o,values:i}}p(ir,"buildRetainedGraphIndex");function ut(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return false;if(e.add(t),Array.isArray(t))return t.some(r=>ut(r,e));let n=t;return n.k==="recipe"?true:Object.values(n).some(r=>ut(r,e))}p(ut,"addressUsesRecipe");function ft(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return false;if(e.add(t),Array.isArray(t))return t.some(r=>ft(r,e));let n=t;return n.k==="recipe"&&typeof n.id=="string"?[j.skinningEvent,j.previousBoneMatrices,j.previousInstanceMatrices,j.previousInstanceMatricesEvent,j.dynamicLightData,j.morphTargetTexture,j.morphUpdateEvent,j.cubeMap,j.passTexture,j.reflector,j.object3D,j.passSetupOutput,j.retainedReference,j.retainedShadowChild,j.retainedShadowFar,j.materialSteps].includes(n.id):Object.values(n).some(r=>ft(r,e))}p(ft,"addressUsesContextScopedRecipe");var lt=class{static{p(this,"RecipeCollisionIndex");}#t=new Map;#i=new WeakMap;#e=0;viewportInput(e){let n=this.#i.get(e);return n===void 0&&(n=this.#e++,this.#i.set(e,n)),n}register(e,n,r,o){if(!ut(e)||ft(e))return;let i=JSON.stringify(e),s=this.#t.get(i);if(s!==void 0&&s.source!==n)throw new Error(`Shader recipe collision between "${s.shaderKey}" (${s.usage}) and "${r}" (${o}) for ${i}. Register the live resources in distinct stable application containers or make their structural recipe signatures unique.`);s===void 0&&this.#t.set(i,{source:n,shaderKey:r,usage:o});}};function Y(t){return t.includes("_inspector")||t.includes("_renderer")||t.includes("_lastRenderer")||t.includes("_lastCullingRenderer")||t.includes("renderer")||t.some(e=>typeof e=="string"&&e.startsWith("_cached"))}p(Y,"applicationContainerPathIsTransient");function sr(t){return t.some(e=>typeof e=="string"&&e.startsWith("_"))||t[0]==="contextNode"&&t[1]==="value"&&typeof t[2]=="string"&&t[2].startsWith("renderPipeline")}p(sr,"materialPathIsTransient");var pt=class{static{p(this,"CaptureClassifier");}#t;#i;#e=new Map;#c=new Map;#r=new Map;#u=new Map;#s=[];#f=new Set;#l=[];#a=[];constructor(e,n){this.#t=e,this.#i=n;let r=e.kind==="compute"?Be(e.target)?[{slot:"compute",node:e.target}]:[]:Ke.flatMap(c=>{let y=w(Reflect.get(e.target,c));return y?[{slot:c,node:y}]:[]});for(let c of r)this.#o(c.node,{k:"anchor",key:e.key,slot:c.slot,path:[]});let o=w(e.builder.lightsNode);this.#a.length=0;let i=this.#a;if(o){let c=er(o,e.builder,e.renderer);this.#l.push(...c),this.#s.push(`lights=${c.length}`);for(let y of c){let R=Reflect.get(y,"light");if(R===null||typeof R!="object")continue;let b=i.length;i.push(R);let A={k:"lightNode",light:b};if(this.#o(y,A),Reflect.get(y,"isAnalyticLightNode")===true){let v=w(Reflect.get(y,"baseColorNode")),B=v??w(Reflect.get(y,"colorNode"));B&&this.#e.set(B,{k:"owned",owner:A,path:[v!==void 0||R!==null&&typeof R=="object"&&Reflect.get(R,"castShadow")===true?"baseColorNode":"colorNode"]});}for(let v of We){let B=Je(v,R);this.#s.push(`${b}/${v}=${B?`${m(B)}:${m(Reflect.get(B,"value"))}:${String(Reflect.get(B,"updateType"))}`:"missing"}`),B&&this.#o(B,{k:"lightUniform",fn:v,light:b});}}}else this.#s.push("lights=missing");let s=e.builder.scene!==null&&typeof e.builder.scene=="object"?e.builder.scene:null;for(let[c,y]of Ye(s).entries()){if(i.includes(y))continue;let R=i.length+c;for(let b of We){let A=Je(b,y);A&&this.#o(A,{k:"lightUniform",fn:b,light:R,sceneLight:c});}}let d=Zn(e.renderer,s);d&&this.#o(d,{k:"sceneEnv"});let a=p((c,y,R,b=false)=>{this.#r.has(y)||this.#r.set(y,{container:c,path:[]}),ct(y,(A,v)=>this.#o(A,{k:"container",key:c,path:v}),(A,v)=>{this.#r.has(A)||this.#r.set(A,{container:c,path:v});},R,b);},"scan");if(e.kind==="render")for(let c of Object.getOwnPropertyNames(e.target)){let y=w(Reflect.get(e.target,c));y&&!this.#e.has(y)&&this.#e.set(y,{k:"container",key:"@material",path:[c]});}let u=H("containers",[e.scene]),f=Array.isArray(u)?u.find(c=>l(c)&&typeof c.key=="string"&&c.key.includes("/resource-batched-text-")):void 0;if(l(f)&&typeof f.key=="string"&&f.target!==null&&typeof f.target=="object"&&a(f.key,f.target,Y,true),Array.isArray(u)){for(let c of u)if(c!==f&&l(c)&&typeof c.key=="string"&&c.target!==null&&typeof c.target=="object"){let y=c.key;if(_e(y)||ot.has(y))continue;a(y,c.target,Y,true);}}if(e.kind==="render"){a("@material",e.target,sr,true),e.renderObject&&a("@renderObject",e.renderObject,A=>A.length===1&&A[0]!=="context");let c=Reflect.get(e.renderer,"getMRT"),y=Reflect.get(e.builder,"context"),b=(l(y)?w(y.mrt):void 0)??(typeof c=="function"?w(Reflect.apply(c,e.renderer,[])):void 0);e.renderObject&&b&&this.#o(b,{k:"container",key:"@renderObject",path:["context","mrt"]});}let g=e.builder.object;g!==null&&typeof g=="object"&&a("@object",g,c=>Y(c)||e.kind==="compute"&&c.some(y=>typeof y=="string"&&y.startsWith("_")),e.kind==="compute"),s&&a("@scene",s,Y);let k=Qn(e.renderer,s),N=k?this.#m(k):void 0;if(k&&N){this.#o(k,N);let c=w(Reflect.get(k,"_cubeTextureNode"));c&&this.#e.set(c,{k:"owned",owner:N,path:["_cubeTextureNode"]});}for(let[c,y]of ue(s).entries())a(`@sceneObject:${c}`,y,Y);a("@renderer",e.renderer,c=>c.length>=1&&c[0]==="_inspector"||c.length===2&&c[0]==="_nodes"&&c[1]==="nodeBuilderCache");let S=H("containers",[e.scene]);if(Array.isArray(S)){for(let c of S)if(l(c)&&typeof c.key=="string"&&c.target!==null&&typeof c.target=="object"){let y=c.key;if(_e(y)||ot.has(y))continue;a(y,c.target,Y,true);}}for(let[c,y]of e.retainedGraph.values){let R=this.#r.get(c);(R===void 0||R.container==="@renderer"&&R.path[0]===J[0]&&R.path[1]===J[1])&&this.#r.set(c,y);}for(let[c,y]of e.retainedGraph.nodes)!this.#e.has(c)&&!z().has(c)&&Xe(c)===void 0&&this.#e.set(c,y);}#n(e,n,r,o){let i=Reflect.get(e,"value"),s=this.#c.get(e)??o??(r.k==="recipe"&&r.id===j.renderContextInput&&i!==null&&typeof i=="object"?i:e);return this.#c.set(e,s),this.#i.register(r,s,this.#t.key,n),r}#o(e,n){!this.#e.has(e)&&!z().has(e)&&this.#e.set(e,n);for(let[r,o]of he(e))r===e||this.#e.has(r)||z().has(r)||this.#e.set(r,{k:"owned",owner:n,path:o});}#N(e){let n=w(Reflect.get(this.#t.target,"contextNode")),r=n?Reflect.get(n,"value"):void 0,o=l(r)?r.renderPipelineState:void 0,i=l(o)?w(o.viewOffsetOwner):void 0;if(!i||Reflect.get(i,"camera")!==e)return;let s=F(i);return s===void 0?void 0:{container:s,path:["camera"]}}#d(e){let n=F(e);if(n!==void 0)return {k:"container",key:n,path:[]};let r=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null;for(let[o,i]of ue(r).entries()){let s=Reflect.get(i,"shadow");if(l(s)&&w(s.shadowNode)===e)return {k:"container",key:`@sceneObject:${o}`,path:["shadow","shadowNode"]}}return this.#e.get(e)}#S(e){let n=p((o,i)=>{let s=Reflect.get(o,"shadow");if(!(Reflect.get(o,"isLight")!==true&&(Reflect.get(o,"isObject3D")!==true||!l(s)))){for(let d of We)if(Je(d,o)===e)return {k:"recipe",id:j.retainedLightUniform,version:1,input:{fn:d,light:i}}}},"address");for(let{key:o,node:i}of this.#t.retainedGraph.roots){let s,d=p((a,u)=>{s??=n(a,{container:o,path:u});},"inspect");if(d(i,[]),s===void 0&&ct(i,()=>{},d,Y),s===void 0)for(let a of Object.getOwnPropertyNames(i)){let u=Reflect.get(i,a);if(!(!l(u)||u.isObject3D!==true))for(let[f,g]of tr(u))s??=n(f,{container:o,path:[a,...g]});}if(s!==void 0)return s}let r=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null;for(let[o,i]of ue(r).entries()){let s=Reflect.get(i,"shadow"),d=l(s)?Reflect.get(s,"shadowNode"):void 0,a=l(d)?Reflect.get(d,"lights"):void 0;if(Array.isArray(a))for(let[u,f]of a.entries()){if(f===null||typeof f!="object")continue;let g=n(f,{container:`@sceneObject:${o}`,path:["shadow","shadowNode","lights",u]});if(g!==void 0)return g}}}#A(e){if(m(e)!=="UniformNode"||Reflect.get(e,"name")!=="shadowFar"||Reflect.get(e,"updateType")!=="render")return;let n=Reflect.get(e,"update");if(typeof n!="function")return;let r=Reflect.get(e,"value"),o=[],i=0;for(let[d,a]of this.#e){if(Reflect.get(d,"isShadowBaseNode")!==true||Reflect.get(d,"isShadowNode")===true)continue;let u=Reflect.get(d,"maxFar"),f=Reflect.get(d,"camera"),g=l(f)?f.far:void 0;if(typeof u!="number"||!Number.isFinite(u)||typeof g!="number"||!Number.isFinite(g))continue;let k=100000025e-2+i*2;i++;try{Reflect.set(d,"maxFar",k),Reflect.set(f,"far",k+1),Reflect.apply(n,e,[{}]),Reflect.get(e,"value")===k&&o.push(this.#d(d)??a);}catch{}finally{Reflect.set(d,"maxFar",u),Reflect.set(f,"far",g);try{Reflect.apply(n,e,[{}]);}catch{Reflect.set(e,"value",r);}}}let s=o.length===1?o[0]:void 0;if(s!==void 0)return {k:"recipe",id:j.retainedShadowFar,version:1,input:{owner:s}}}#T(e){if(Reflect.get(e,"isShadowNode")!==true)return;let n=[];for(let o of this.#e.keys()){if(Reflect.get(o,"isShadowBaseNode")!==true||Reflect.get(o,"isShadowNode")===true)continue;let i=Reflect.get(o,"_shadowNodes"),s=Reflect.get(o,"lights");if(!Array.isArray(i)||!Array.isArray(s)||i.length===0||i.length!==s.length)continue;let d=i.indexOf(e),a=this.#d(o);d>=0&&a!==void 0&&n.push({owner:a,index:d,count:i.length});}let r=n.length===1?n[0]:void 0;if(r!==void 0)return {k:"recipe",id:j.retainedShadowChild,version:1,input:{owner:r.owner,index:r.index,count:r.count}}}#j(e){let n=[];for(let r of this.#e.keys()){if(Reflect.get(r,"isShadowBaseNode")!==true||Reflect.get(r,"isShadowNode")===true)continue;let o=Reflect.get(r,"lights");if(!(!Array.isArray(o)||o.length===0))for(let[i,s]of o.entries()){let d=this.#d(r);l(s)&&s.shadow===e&&d!==void 0&&n.push({owner:d,path:["lights",i,"shadow"],ownerCount:o.length});}}return n.length===1?n[0]:void 0}#v(e){let n=[];for(let r of this.#e.keys()){if(Reflect.get(r,"isShadowBaseNode")!==true||Reflect.get(r,"isShadowNode")===true)continue;let o=this.#d(r);if(o?.k!=="container")continue;let i=Reflect.get(r,"lights");if(!(!Array.isArray(i)||i.length===0))for(let[s,d]of i.entries()){let a=l(d)?d.shadow:void 0,u=l(a)?a.map:void 0;if(!l(u))continue;u._depthTexture===e&&n.push({container:o.key,path:[...o.path,"lights",s,"shadow","map","_depthTexture"]});let f=u.textures;if(Array.isArray(f))for(let[g,k]of f.entries())k===e&&n.push({container:o.key,path:[...o.path,"lights",s,"shadow","map","textures",g]});}}return n.length===1?n[0]:void 0}#p(e){if(!["ReferenceNode","ReferenceBaseNode"].includes(m(e)))return;let n=Reflect.get(e,"property"),r=Reflect.get(e,"uniformType");if(typeof n!="string"||n.length===0||typeof r!="string"||r.length===0)return;let o=Reflect.get(e,"object"),i=o!==null&&typeof o=="object"?this.#j(o):void 0,s=o!==null&&typeof o=="object"?this.#N(o)??this.#r.get(o):void 0,d=w(o),a=d?this.#d(d):void 0;if(o!==null&&typeof o=="object"&&s===void 0&&a===void 0&&i===void 0)return;let u=w(Reflect.get(e,"group")),f=u?z().get(u):void 0;if(u&&f===void 0)return;let g=Reflect.get(e,"count");if(g!==null&&(!Number.isSafeInteger(g)||Number(g)<0))return;let k=Reflect.get(e,"name"),N=i?.owner??a;return N!==void 0?{k:"recipe",id:j.retainedReference,version:1,input:{owner:N,...i===void 0?{}:{path:i.path,ownerCount:i.ownerCount},property:n,uniformType:r,...g===null?{}:{count:Number(g)},...f===void 0?{}:{group:f},...typeof k=="string"&&k.length>0?{name:k}:{}}}:{k:"reference",property:n,uniformType:r,...g===null?{}:{count:Number(g)},...s===void 0?{}:{object:s},...f===void 0?{}:{group:f},...typeof k=="string"&&k.length>0?{name:k}:{}}}#h(e){if(Reflect.get(e,"isMaterialReferenceNode")!==true)return;let n=Reflect.get(e,"property"),r=Reflect.get(e,"uniformType"),o=Reflect.get(e,"referenceType"),i=typeof r=="string"||r===null?r:o;return typeof n=="string"&&(typeof i=="string"||i===null)?{k:"materialCache",property:n,type:i}:void 0}#x(e){if(m(e)!=="UniformNode"||Reflect.get(e,"nodeType")!=="int"||Reflect.get(e,"updateType")!=="render")return;let n=this.#t.builder.material,r=this.#t.builder.object,o=l(r)?r.material:void 0,i=Reflect.get(e,"update");if(typeof i!="function")return;let s=[];l(n)&&s.push({owner:"material",target:n}),l(o)&&o!==n&&s.push({owner:"objectMaterial",target:o});let d=Reflect.get(e,"value"),a=[];for(let{owner:u,target:f}of s){let g=f.steps;if(!Number.isSafeInteger(g)||Number(g)<0||Number(g)>2147483647)continue;let k=Number(g)===2147483647?2147483646:Number(g)+1;try{Reflect.set(f,"steps",k),Reflect.apply(i,e,[{material:n,object:r}]),Reflect.get(e,"value")===k&&a.push(u);}catch{}finally{Reflect.set(f,"steps",g);try{Reflect.apply(i,e,[{material:n,object:r}]);}catch{Reflect.set(e,"value",d);}}}if(a.length===1)return a[0]==="material"?{k:"recipe",id:j.materialSteps,version:1}:{k:"recipe",id:j.materialSteps,version:1,input:{owner:"objectMaterial"}}}#g(e){if(!this.#l.includes(e)||Reflect.get(e,"light")!==void 0)return;let n=m(e);return /^[A-Za-z][A-Za-z0-9]*LightDataNode$/u.test(n)?{k:"recipe",id:j.dynamicLightData,version:1,input:{type:n}}:void 0}#C(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback");if(!l(n)||n.isSkinnedMesh!==true||typeof r!="function")return;let o=n.skeleton;if(!l(o))return;let i=o.boneMatrices,s=o.bones,d=o.update;if(!ArrayBuffer.isView(i)||m(i)!=="Float32Array"||!Array.isArray(s)||s.length===0||typeof d!="function")return;let a=i;if(a.length!==s.length*16)return;let u=this.#t.journal.filter(b=>{let A=Reflect.get(b.node,"value");return m(b.node)==="BufferNode"&&b.type==="buffer"&&b.stage==="vertex"&&Reflect.get(b.node,"bufferType")==="mat4"&&Reflect.get(b.node,"bufferCount")===s.length&&A!==a&&ArrayBuffer.isView(A)&&m(A)==="Float32Array"&&Reflect.get(A,"length")===a.length}),f=[...new Set(u.map(b=>Reflect.get(b.node,"value")))];if(f.length===0)return;let g=new Float32Array(a),k=f.map(b=>new Float32Array(b)),N=Object.getOwnPropertyDescriptor(o,"update"),S={},c=[];try{if(!Reflect.set(o,"update",()=>{}))return;for(let b=0;b<a.length;b++)a[b]=-100000.5-b;Reflect.apply(r,e,[{object:n,frameId:S}]),c=f.filter(b=>b.every((A,v)=>A===a[v]));}catch{return}finally{a.set(g);for(let[b,A]of f.entries())A.set(k[b]);N===void 0?Reflect.deleteProperty(o,"update"):Object.defineProperty(o,"update",N);}let y=c[0];if(c.length!==1||y===void 0)return;let R={k:"recipe",id:j.previousBoneMatrices,version:1,input:{count:s.length}};for(let b of u)Reflect.get(b.node,"value")===y&&(this.#e.set(b.node,R),this.#c.set(b.node,o));}#_(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback");if(!l(n)||n.isInstancedMesh!==true||typeof r!="function")return;let o=n.instanceMatrix,i=l(o)?o.array:void 0,s=l(o)?o.count:void 0;if(!ArrayBuffer.isView(i)||m(i)!=="Float32Array"||!Number.isSafeInteger(s)||Number(s)<1||Reflect.get(i,"length")!==Number(s)*16)return;let d=i,a=this.#t.journal.filter(c=>{let y=Reflect.get(c.node,"value");return m(c.node)==="BufferNode"&&c.type==="buffer"&&c.stage==="vertex"&&Reflect.get(c.node,"bufferType")==="mat4"&&Reflect.get(c.node,"bufferCount")===s&&y!==d&&ArrayBuffer.isView(y)&&m(y)==="Float32Array"&&Reflect.get(y,"length")===d.length}),u=[...new Set(a.map(c=>Reflect.get(c.node,"value")))];if(u.length===0)return;let f=new Float32Array(d),g=u.map(c=>new Float32Array(c)),k=[];try{for(let c=0;c<d.length;c++)d[c]=-200000.5-c;Reflect.apply(r,e,[{object:n}]),k=u.filter(c=>c.every((y,R)=>y===d[R]));}catch{return}finally{d.set(f);for(let[c,y]of u.entries())y.set(g[c]);}let N=k[0];if(k.length!==1||N===void 0)return;let S={k:"recipe",id:j.previousInstanceMatrices,version:1,input:{count:Number(s)}};for(let c of a)Reflect.get(c.node,"value")===N&&(this.#e.set(c.node,S),this.#c.set(c.node,n));this.#f.add(e);}#y(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback"),o=typeof r=="function"?Function.prototype.toString.call(r):"";if(!l(n)||!o.includes("morphTargetsRelative")||!o.includes("morphTargetInfluences")||!o.includes(".reduce")||!o.includes(".update"))return;let i=n.morphTargetInfluences,s=n.geometry,d=n.morphTexture;if(!l(s))return;let a=n.isInstancedMesh===true&&i===void 0&&s.morphTargetsRelative===true&&Number.isSafeInteger(n.count)&&Number(n.count)>1&&l(d);if(!Array.isArray(i)&&!a)return;let u=s.morphAttributes;if(!l(u))return;let f=Array.isArray(u.position)?u.position:[],g=Array.isArray(u.normal)?u.normal:[],k=Array.isArray(u.color)?u.color:[],N=f.length>0?f:g.length>0?g:k;if(N.length===0||Array.isArray(i)&&N.length!==i.length)return;let S=this.#t.journal.some(R=>{let b=Reflect.get(R.node,"value");return m(R.node)==="TextureNode"&&R.type==="texture"&&R.stage==="vertex"&&Reflect.get(R.node,"sampler")===false&&l(b)&&en(b,s)}),c=this.#t.journal.flatMap((R,b)=>m(R.node)==="UniformArrayNode"?[`${b}:${R.type}/${R.stage}:same=${Reflect.get(R.node,"array")===i}:length=${Array.isArray(Reflect.get(R.node,"array"))?Reflect.get(R.node,"array").length:"na"}`]:[]);if(this.#s.push(`morph=${String(Reflect.get(n,"name")??"")}:targets=${N.length}:influences=${Array.isArray(i)?i.length:"none"}:texture=${S}:arrays=[${c.join(",")}]`),!S)return;if(a){let R=this.#t.journal.filter(x=>m(x.node)==="TextureNode"&&x.type==="texture"&&x.stage==="vertex"&&Reflect.get(x.node,"value")===d);if(R.length!==1)return;let b=[];for(let x of this.#t.journal){let U=Reflect.get(x.node,"value");m(x.node)==="UniformNode"&&x.type==="float"&&x.stage==="vertex"&&typeof U=="number"&&Number.isFinite(U)&&!b.some(O=>O.node===x.node)&&b.push({node:x.node,value:U});}let A=[];try{for(let[x,U]of b.entries()){let O=-100000.5-x;if(!Reflect.set(U.node,"value",O)||Reflect.get(U.node,"value")!==O)return}try{Reflect.apply(r,e,[{object:n}]);}catch{}A=b.filter(x=>Reflect.get(x.node,"value")===1).map(x=>x.node);}finally{for(let x of b)Reflect.set(x.node,"value",x.value);}let v=A[0],B=R[0]?.node;return A.length===1&&v!==void 0&&B!==void 0?{base:v,morphTexture:B,count:N.length}:void 0}if(!Array.isArray(i))return;let y=this.#t.journal.flatMap((R,b)=>{let A=Reflect.get(R.node,"array");if(m(R.node)!=="UniformArrayNode"||R.type!=="buffer"||R.stage!=="vertex"||A!==i&&(!Array.isArray(A)||A.length!==i.length))return [];let v=this.#t.journal[b-1];return v===void 0||m(v.node)!=="UniformNode"||v.type!=="float"||v.stage!=="vertex"||typeof Reflect.get(v.node,"value")!="number"||!Number.isFinite(Reflect.get(v.node,"value"))?[]:[{base:v.node,influences:R.node,count:i.length}]});return y.length===1?y[0]:void 0}#B(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;if(this.#f.has(e))return {k:"recipe",id:j.previousInstanceMatricesEvent,version:1};let n=this.#t.builder.object,r=Reflect.get(e,"callback"),o=typeof r=="function"?Function.prototype.toString.call(r):"";if(l(n)&&n.isSkinnedMesh===true&&o.includes("skeleton"))return {k:"recipe",id:j.skinningEvent,version:1};let i=this.#y(e);if(i){let s=this.#e.get(i.base),d=i.influences===void 0?void 0:this.#e.get(i.influences),a=i.morphTexture===void 0?void 0:this.#e.get(i.morphTexture);return s===void 0||d===void 0==(a===void 0)?void 0:{k:"recipe",id:j.morphUpdateEvent,version:1,input:d===void 0?{base:s,morphTexture:a,count:i.count}:{base:s,influences:d,count:i.count}}}}#E(e){if(m(e)!=="MaxMipLevelNode")return;let n=w(Reflect.get(e,"textureNode"));if(!n)return;let r=this.classify(n,"max-mip texture owner");return {k:"recipe",id:j.maxMip,version:1,input:r}}#m(e){if(m(e)!=="CubeMapNode")return;let n=w(Reflect.get(e,"envNode"));if(n)return {k:"recipe",id:j.cubeMap,version:1,input:this.classify(n,"cube-map environment")}}#b(e){if(m(e)!=="Object3DNode")return;let n=Reflect.get(e,"scope");if(!["direction","worldMatrix","position","scale","viewPosition","radius"].includes(String(n)))return;let r=Reflect.get(e,"object3d");if(r===null||typeof r!="object")return;let o=this.#t.builder.object,i="object";if(r!==o){let a=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,u=ue(a).indexOf(r);if(u<0)return;i={sceneObject:u};}let s={k:"recipe",id:j.object3D,version:1,input:{scope:String(n),object:i}};this.#e.set(e,s);let d=w(Reflect.get(e,"uniformNode"));return d&&this.#e.set(d,{k:"owned",owner:s,path:["uniformNode"]}),this.#n(e,"Object3DNode",s,r)}#R(e){let n=w(Reflect.get(e,"textureNode")),r=n?w(Reflect.get(n,"passNode")):void 0;if(!r||Reflect.get(r,"isPassNode")!==true||typeof Reflect.get(r,"setup")!="function")return;let o=F(r),i=this.#e.get(r)??(o?{k:"container",key:o,path:[]}:void 0);if(i===void 0)return;let s={k:"recipe",id:j.passSetupOutput,version:1,input:{owner:i}};return this.#o(e,s),this.#n(e,"pass setup output",s,r)}#k(e){if(m(e)!=="ReflectorNode")return;let n=w(Reflect.get(e,"_reflectorBaseNode")),r=n?w(Reflect.get(n,"textureNode")):void 0;if(!n||m(n)!=="ReflectorBaseNode"||!r||m(r)!=="ReflectorNode")return;let o=Reflect.get(n,"target");if(o===null||typeof o!="object")return;let i=Reflect.get(o,"parent"),s=this.#t.builder.object,d=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,a=null;if(i!==null&&typeof i=="object")if(i===s)a="object";else {let B=ue(d).indexOf(i);if(B<0)return;a={sceneObject:B};}let u=p((B,x)=>{if(B===null||typeof B!="object")return;let U=x.map(O=>Reflect.get(B,O));return U.every(O=>typeof O=="number"&&Number.isFinite(O))?U:void 0},"components"),f=u(Reflect.get(o,"position"),["x","y","z"]),g=u(Reflect.get(o,"quaternion"),["x","y","z","w"]),k=u(Reflect.get(o,"scale"),["x","y","z"]),N=Reflect.get(n,"resolutionScale"),S=Reflect.get(n,"samples");if(!f||!g||!k||typeof N!="number"||!Number.isFinite(N)||!Number.isSafeInteger(S)||Number(S)<0)return;let c=i!==null&&typeof i=="object"?Reflect.get(i,"children"):void 0,y=Array.isArray(c)?c.indexOf(o):-1;if(i!==null&&y<0)return;let R={k:"recipe",id:j.reflector,version:1,input:{resolutionScale:N,generateMipmaps:Reflect.get(n,"generateMipmaps")===true,bounces:Reflect.get(n,"bounces")===true,depth:Reflect.get(n,"depth")===true,samples:Number(S),parent:a,targetIndex:y,position:f,quaternion:g,scale:k}};this.#e.set(r,R),this.#e.set(n,{k:"owned",owner:R,path:["_reflectorBaseNode"]});let b=w(Reflect.get(r,"_depthNode")),A={k:"owned",owner:R,path:["_depthNode"]};b&&this.#e.set(b,A);let v=e===b?A:R;return this.#e.set(e,v),v}#M(e){if(m(e)!=="TextureNode"||Reflect.get(e,"sampler")!==false)return;let n=Reflect.get(e,"value"),r=this.#t.builder.object,o=l(r)?r.geometry:void 0;if(!(!l(r)||!l(n)||!l(o)||this.#r.has(n)||Reflect.get(r,"morphTexture")===n||!en(n,o)))return {k:"recipe",id:j.morphTargetTexture,version:1}}noteUpdateNode(e){let n=this.#e.get(e);if(n){let a=["ReferenceNode","ReferenceBaseNode"].includes(m(e))?w(Reflect.get(e,"node")):void 0;a&&this.#e.set(a,{k:"owned",owner:n,path:["node"],prime:"reference"});return}let r=m(e)==="RTTNode"?F(e):void 0;if(r?.startsWith("@three-blocks-input:setup-rtt-")===true){let a={k:"container",key:r,path:[]};this.#e.set(e,a);let u=Reflect.get(e,"value");u!==null&&typeof u=="object"&&this.#r.set(u,{container:r,path:["value"]});return}if(this.#R(e))return;let o=this.#g(e);if(o){this.#o(e,o);return}this.#C(e),this.#_(e);let i=this.#y(e);if(i?.influences){let a=Reflect.get(i.influences,"elementType");this.#e.set(i.influences,{k:"inputNode",nodeClass:"uniformArray",value:{container:"@object",path:["morphTargetInfluences"]},access:null,uniformType:typeof a=="string"?a:null});}if(m(e)==="PMREMNode"){let a=this.classify(e,"PMREM update node ownership");for(let u of ["_texture","_width","_height","_maxMip"]){let f=w(Reflect.get(e,u));f&&this.#e.set(f,{k:"owned",owner:a,path:[u]});}return}if(m(e)==="ReflectorBaseNode"){let a=w(Reflect.get(e,"textureNode"));a&&this.#k(a);}if(m(e)==="Object3DNode"){this.#b(e);return}if(m(e)==="CubeMapNode"){let a=this.classify(e,"cube-map update node ownership"),u=w(Reflect.get(e,"envNode")),f=w(Reflect.get(e,"_cubeTextureNode"));f&&f!==u&&this.#e.set(f,{k:"owned",owner:a,path:["_cubeTextureNode"]});return}let s=this.#h(e)??this.#p(e);if(s===void 0&&["ReferenceNode","ReferenceBaseNode"].includes(m(e))){let a=F(e);a!==void 0&&(s={k:"container",key:a,path:[]});}if(s===void 0){["TextureNode","Texture3DNode","CubeTextureNode"].includes(m(e))&&(s=this.classify(e,"texture update node ownership"));let a=s===void 0&&Reflect.get(e,"isTextureNode")===true?Vt(Reflect.get(e,"value")):void 0;if(l(a)&&a.t==="tex"&&this.classify(e,"update node ownership"),s===void 0)return}this.#e.set(e,s);let d=w(Reflect.get(e,"node"));d&&this.#e.set(d,{k:"owned",owner:s,path:["node"],prime:"reference"});}shouldOmitUpdateNode(e){return m(e)==="InspectorNode"?true:m(e)==="EventNode"&&Reflect.get(e,"eventType")==="frame"&&l(this.#t.builder.object)&&Reflect.get(this.#t.builder.object,"isInstancedMesh")===true}#L(e){if(Reflect.get(e,"isTextureNode")!==true)return;let n=Reflect.get(e,"update");if(typeof n!="function")return;let r=p(()=>{try{Reflect.apply(n,e,[{}]);}catch{}},"invoke");for(let o of this.#w()){if(Reflect.get(o.light,"isSpotLight")!==true)continue;let i=Reflect.get(o.light,"map");if(i===null||typeof i!="object")continue;let s={},d=false;try{Reflect.set(o.light,"map",s),r(),d=Reflect.get(e,"value")===s;}finally{Reflect.set(o.light,"map",i),r();}if(d)return {k:"lightUniform",fn:"spotLightMap",...o.address}}}#w(){let e=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,n=this.#a.map((r,o)=>({light:r,address:{light:o}}));for(let[r,o]of Ye(e).entries())this.#a.includes(o)||n.push({light:o,address:{light:this.#a.length+r,sceneLight:r}});return n}#O(e){let n=this.#w();if(n.length===0)return;if(Reflect.get(e,"isReferenceNode")===true){let i=Reflect.get(e,"object"),s=Reflect.get(e,"property");if(i===null||typeof i!="object"||typeof s!="string")return;let d=Un[s],a=s==="near"?"shadowCameraNear":s==="far"?"shadowCameraFar":void 0;for(let u of n){let f=Reflect.get(u.light,"shadow");if(!(f===null||typeof f!="object")){if(d!==void 0&&f===i)return {k:"lightUniform",fn:d,...u.address};if(a!==void 0&&Reflect.get(f,"camera")===i)return {k:"lightUniform",fn:a,...u.address}}}return}if(Reflect.get(e,"isUniformNode")!==true)return;let r=Reflect.get(e,"update");if(typeof r!="function"||typeof Reflect.get(e,"value")!="number")return;let o=p(()=>{try{Reflect.apply(r,e,[{}]);}catch{}},"invoke");for(let i of n){let s=Reflect.get(i.light,"shadow"),d=s!==null&&typeof s=="object"?Reflect.get(s,"camera"):void 0;if(!(d===null||typeof d!="object"))for(let a of ["shadowCameraNear","shadowCameraFar"]){let u=a==="shadowCameraNear"?"near":"far",f=Reflect.get(d,u);if(typeof f!="number")continue;let g=f+12345.625,k=false;try{Reflect.set(d,u,g),o(),k=Reflect.get(e,"value")===g;}finally{Reflect.set(d,u,f),o();}if(k)return {k:"lightUniform",fn:a,...i.address}}}}#I(e){if(m(e)!=="BufferNode")return false;let n=Reflect.get(this.#t.builder,"getNodeProperties");if(typeof n!="function")return false;for(let r of this.#e.keys()){if(m(r)!=="RangeNode")continue;let o=Reflect.apply(n,this.#t.builder,[r]),i=l(o)?w(o.outputNode):void 0;if(i&&he(i).has(e))return true}return false}classify(e,n){let r=Reflect.get(e,"name");if(typeof r=="string"&&On.has(r))return {k:"namedRenderUniform",name:r};let o=this.#A(e);if(o)return this.#e.set(e,o),this.#n(e,n,o);let i=this.#T(e);if(i)return this.#e.set(e,i),this.#n(e,n,i);let s=this.#e.get(e),d=this.#t.retainedGraph.nodes.get(e);if(s&&s!==d)return this.#n(e,n,dt(s));let a=this.#b(e);if(a)return a;let u=this.#R(e);if(u)return u;let f=this.#p(e);if(f)return this.#e.set(e,f),f.k==="recipe"?this.#n(e,n,f):f;let g=this.#h(e);if(g)return this.#e.set(e,g),g;let k=this.#x(e);if(k)return this.#e.set(e,k),this.#n(e,n,k);let N=this.#g(e);if(N)return this.#e.set(e,N),this.#n(e,n,N);let S=this.#B(e);if(S)return this.#e.set(e,S),this.#n(e,n,S);let c=this.#E(e);if(c){this.#e.set(e,c);let h=w(Reflect.get(e,"textureNode")),T=h?Reflect.get(h,"value"):void 0;return this.#n(e,n,c,T!==null&&typeof T=="object"?T:h)}let y=this.#m(e);if(y)return this.#e.set(e,y),this.#n(e,n,y);let R=this.#M(e);if(R){this.#e.set(e,R);let h=Reflect.get(e,"value");return this.#n(e,n,R,h!==null&&typeof h=="object"?h:e)}let b=w(Reflect.get(e,"referenceNode")),A=b!==void 0?this.#e.get(b):void 0;if(b!==void 0&&A===void 0){let h=F(b);h&&(A={k:"container",key:h,path:[]});}let v=Reflect.get(e,"value"),B=v!==null&&typeof v=="object"?this.#r.get(v)??zt(v):void 0,x=Qt(A);if(n.startsWith("uniform ")&&A!==void 0&&w(Reflect.get(e,"compareNode"))===void 0&&(x?.container.startsWith("@three-blocks-input:")!==true||B===void 0))return this.#e.set(e,A),A;let U=m(e)==="ReflectorNode"?F(e):void 0;if(U!==void 0){let h={k:"container",key:U,path:[]};return this.#e.set(e,h),h}let O=this.#k(b&&m(b)==="ReflectorNode"?b:e);if(O)return this.#e.set(e,O),this.#n(e,n,O);let gn=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,Le=Reflect.get(e,"light");if(Le!==null&&typeof Le=="object"){let h=Ye(gn).indexOf(Le);if(h>=0){let T={k:"lightNode",light:h,sceneLight:h};return Reflect.get(e,"isShadowBaseNode")===true?{k:"owned",owner:T,path:["shadowNode"]}:T}}let Oe=this.#S(e);if(Oe)return this.#e.set(e,Oe),this.#n(e,n,Oe);let Ie=this.#L(e);if(Ie)return this.#e.set(e,Ie),Ie;let G=Reflect.get(e,"value"),se=Reflect.get(e,"array");if(G!==null&&typeof G=="object"||se!==null&&typeof se=="object")for(let[h,T]of this.#e){if(h===e)continue;let C=G!==null&&typeof G=="object"&&Reflect.get(h,"value")===G,E=se!==null&&typeof se=="object"&&Reflect.get(h,"array")===se;if(!(!C&&!E)){if(Zt(h,e))return this.#e.set(e,T),T;if(C&&["TextureNode","Texture3DNode","CubeTextureNode"].includes(m(e))){let P=or(T);if(P!==void 0){this.#r.set(G,P);break}}}}if(G!==null&&typeof G=="object")for(let[h,T]of z()){if(Reflect.get(h,"isViewportNode")!==true)continue;let C=w(Reflect.get(h,"_output"));if(C===void 0||Reflect.get(C,"value")!==G||!Zt(C,e))continue;let E={k:"owned",owner:{k:"tsl",name:T},path:["_output"]};return this.#e.set(e,E),E}let yt=z().get(e);if(yt)return {k:"tsl",name:yt};let mt=Xe(e),Ue=mt==="uniformArray"?Reflect.get(e,"array"):Reflect.get(e,"value"),bt=Ue!==null&&typeof Ue=="object"?this.#r.get(Ue):void 0;if(!(bt!==void 0&&!bt.container.startsWith("@three-blocks-input:"))){for(let[h,T]of this.#e)for(let C of Object.getOwnPropertyNames(h))if(Reflect.get(h,C)===e){if(mt!==void 0&&Pn(T)||(T.k==="inputNode"||T.k==="inputValue"||T.k==="recipe")&&!In.has(C))continue;let E={k:"owned",owner:T,path:[C]};return this.#e.set(e,E),E}}for(let[h,T]of z()){for(let C of Object.getOwnPropertyNames(h))if(Reflect.get(h,C)===e)return {k:"owned",owner:{k:"tsl",name:T},path:[C]};for(let[C,E]of he(h))if(C===e)return {k:"owned",owner:{k:"tsl",name:T},path:E}}let Rt={ViewportDepthTextureNode:"viewportDepthTexture",ViewportSharedTextureNode:"viewportSharedTexture",ViewportTextureNode:"viewportMipTexture"}[m(e)];if(Rt!==void 0){let h={k:"inputValue",nodeClass:Rt,json:{viewport:this.#i.viewportInput(e)}};return this.#e.set(e,h),h}let be=m(e)==="PassTextureNode"?e:b&&m(b)==="PassTextureNode"?b:void 0;if(be){let h=w(Reflect.get(be,"passNode")),T=h?F(h):void 0,C=h?this.#e.get(h)??(T?{k:"container",key:T,path:[]}:void 0):void 0,E=h?Object.getOwnPropertyNames(h).filter(P=>w(Reflect.get(h,P))===be):[];if(C&&E.length===1){let P={k:"owned",owner:C,path:[E[0]]};return this.#e.set(be,P),this.#e.set(e,P),P}}if(m(e)==="PassMultipleTextureNode"){let h=w(Reflect.get(e,"passNode")),T=Reflect.get(e,"textureName"),C=Reflect.get(e,"previousTexture")===true,E=C?"_previousTextureNodes":"_textureNodes",P=h?F(h):void 0,X=h?this.#e.get(h)??[...this.#e].find(([q])=>w(q)===h)?.[1]??(P?{k:"container",key:P,path:[]}:void 0):void 0,te=h?Reflect.get(h,E):void 0,ae=l(te)&&typeof T=="string"?w(Reflect.get(te,T)):void 0;if(X&&typeof T=="string"&&ae){let q={k:"recipe",id:j.passTexture,version:1,input:{owner:X,name:T,previous:C}};return this.#e.set(e,q),q}this.#s.push(`passTexture=${m(h)}/${String(T)}/${E} owner=${X?JSON.stringify(X):"missing"} collection=${m(te)} canonical=${m(ae)}`);}let Re=F(e),L=Xe(e);if(L){let h=L==="uniformArray"?Reflect.get(e,"array"):Reflect.get(e,"value"),T=Reflect.get(e,"access"),C=L==="uniformArray"?Reflect.get(e,"elementType"):L==="storage"||L==="buffer"||L==="bufferAttribute"?Reflect.get(e,"bufferType"):Reflect.get(e,"uniformType"),E=typeof T=="string"?T:null,P=typeof C=="string"?C:null,X=w(Reflect.get(e,"group"))??w(Reflect.get(e,"groupNode")),te=X?z().get(X):void 0,ae=te?{group:te}:{},q=Reflect.get(e,"bufferCount"),Tt=L==="storage"||L==="buffer"?{bufferCount:Number.isSafeInteger(q)&&Number(q)>=0?Number(q):0,...L==="storage"?{atomic:Reflect.get(e,"isAtomic")===true,pbo:Reflect.get(e,"isPBO")===true}:{}}:{},jt=h!==null&&typeof h=="object"?zt(h):void 0,kn=h!==null&&typeof h=="object"&&(Reflect.get(h,"isStorageBufferAttribute")===true||Reflect.get(h,"isStorageInstancedBufferAttribute")===true),ke=h!==null&&typeof h=="object"?this.#r.get(h):void 0,wn=ke!==void 0&&!ke.container.startsWith("@")?ke:void 0,V=h!==null&&typeof h=="object"?this.#v(h)??wn??(kn?jt:void 0)??ke??jt:void 0;if(!V&&h!==null&&typeof h=="object"){let $=Reflect.get(h,"array");$!==null&&typeof $=="object"&&(V=this.#r.get($));}let vt=L==="bufferAttribute"?{stride:Number.isSafeInteger(Reflect.get(e,"bufferStride"))?Number(Reflect.get(e,"bufferStride")):0,offset:Number.isSafeInteger(Reflect.get(e,"bufferOffset"))?Number(Reflect.get(e,"bufferOffset")):0,usage:Number.isSafeInteger(Reflect.get(e,"usage"))?Number(Reflect.get(e,"usage")):0,instanced:Reflect.get(e,"instanced")===true||h!==null&&typeof h=="object"&&(Reflect.get(h,"isInstancedBufferAttribute")===true||Reflect.get(h,"isInstancedInterleavedBuffer")===true)||V?.path.includes("instanceMatrix")===true||V?.path.includes("instanceColor")===true}:{},xt=["texture","cubeTexture","texture3D"].includes(L)&&w(Reflect.get(e,"compareNode"))?{comparison:true}:{},de=["texture","cubeTexture"].includes(L)?Qt(A):void 0,Ct=de!==void 0&&(de.container.startsWith("@three-blocks-input:")!==true||V===void 0||V.container===de.container),_t=Ct?de:V??de,Nn=Ct?`${L}Reference`:L,$e=Reflect.get(e,"name"),Bt=typeof $e=="string"&&$e.length>0?{name:$e}:{},Z=_t?{k:"inputNode",nodeClass:Nn,value:_t,access:E,uniformType:P,...Bt,...ae,...Tt,...vt,...xt}:void 0;if(!Z&&Re!==void 0){let $={k:"container",key:Re,path:[]};return this.#e.set(e,$),$}if(!Z){let $=this.#I(e)?rr(h):Vt(h);$!==void 0&&(Z={k:"inputValue",nodeClass:L,json:$,access:E,uniformType:P,...Bt,...ae,...Tt,...vt,...xt});}if(Z){let $=JSON.stringify(Z),Fe=this.#u.get($)??0;this.#u.set($,Fe+1);let Sn=Fe===0?Z:{...Z,n:Fe},Et=Fn(Sn,h);return this.#e.set(e,Et),this.#n(e,n,Et,h!==null&&typeof h=="object"?h:e)}}if(s)return this.#n(e,n,dt(s));if(Re!==void 0){let h={k:"container",key:Re,path:[]};return this.#e.set(e,h),h}let Pe=this.#O(e);if(Pe)return this.#e.set(e,Pe),this.#n(e,n,Pe);let kt=p(h=>m(h)===m(e)&&m(Reflect.get(h,"value"))===m(Reflect.get(e,"value"))&&Reflect.get(h,"updateType")===Reflect.get(e,"updateType"),"comparable"),yn=[...z()].filter(([h])=>kt(h)).slice(0,8).map(([,h])=>h),mn=[...this.#e].filter(([h])=>kt(h)).slice(0,8).map(([h,T])=>`${JSON.stringify(T)}@${Wt(Reflect.get(h,"value"))}`),wt=l(Reflect.get(e,"value"))?Reflect.get(Reflect.get(e,"value"),"uuid"):void 0,Nt=typeof wt=="string"?[...this.#e].filter(([h])=>l(Reflect.get(h,"value"))&&Reflect.get(Reflect.get(h,"value"),"uuid")===wt).slice(0,12).map(([h,T])=>`${m(h)}:${JSON.stringify(T)}`):[],St=H("containers",[this.#t.scene]),bn=Array.isArray(St)?St.slice(0,64).flatMap(h=>{if(!l(h)||typeof h.key!="string"||!l(h.target))return [];let T=h.target,C=Object.keys(T).filter(E=>Reflect.get(T,E)===Reflect.get(e,"value"));return [`${h.key}/${m(T)}${C.length>0?`:${C.join(",")}`:""}`]}):[],At=m(e)==="EventNode"?Reflect.get(e,"callback"):void 0,Rn=typeof At=="function"?Function.prototype.toString.call(At).replaceAll(/\s+/gu," ").slice(0,320):void 0,D=this.#t.builder.object;throw new Error(`Cannot address ${m(e)}${typeof r=="string"&&r?` "${r}"`:""} used by ${n} for shader key "${this.#t.key}". Node metadata: value=${m(Reflect.get(e,"value"))}, update=${typeof Reflect.get(e,"update")=="function"?Reflect.get(e,"update").name||"anonymous":"none"}, updateType=${String(Reflect.get(e,"updateType"))}.`+(L?` Input metadata: class=${L}, value=${m(Reflect.get(e,"value"))}, access=${String(Reflect.get(e,"access"))}, uniformType=${String(Reflect.get(e,"uniformType"))}.`:"")+` Similar semantic inputs: tsl=[${yn.join(", ")}], paths=[${mn.join(", ")}].`+(l(Reflect.get(e,"value"))&&Reflect.get(Reflect.get(e,"value"),"isTexture")===true?` Texture value: ${Wt(Reflect.get(e,"value"))}.`:"")+(Nt.length>0?` Same-texture paths: [${Nt.join(", ")}].`:"")+` Classifier diagnostics: ${this.#s.join("; ")}. Registered containers: [${bn.join(", ")}].`+(Reflect.get(e,"isStorageBufferNode")===true?` Storage metadata: type=${String(Reflect.get(e,"bufferType"))}, count=${String(Reflect.get(e,"bufferCount"))}, value=${m(Reflect.get(e,"value"))}.`:"")+(m(e)==="MaterialReferenceNode"?` Material reference metadata: flag=${String(Reflect.get(e,"isMaterialReferenceNode"))}, property=${String(Reflect.get(e,"property"))}, uniformType=${String(Reflect.get(e,"uniformType"))}.`:"")+(m(e)==="EventNode"?` Event metadata: type=${String(Reflect.get(e,"eventType"))}, object=${m(D)}, objectName=${l(D)?String(D.name??""):""}, instanced=${l(D)&&D.isInstancedMesh===true}, skinned=${l(D)&&D.isSkinnedMesh===true}, morphs=${l(D)&&Array.isArray(D.morphTargetInfluences)?D.morphTargetInfluences.length:0}, callback=${Rn??"none"}.`:""))}};function Ve(t){return Array.isArray(t)?t.map(w).filter(e=>e!==void 0):[]}p(Ve,"nodeArray");function ar(t,e,n){let r=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`struct\\s+${r}Struct\\s*\\{([\\s\\S]*?)\\};`,"u"),i=[t.vertexShader,t.fragmentShader,t.computeShader].filter(a=>typeof a=="string"),s;for(let a of i){let u=o.exec(a)?.[1];if(u!==void 0&&(s=[...u.matchAll(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*:/gmu)].map(f=>f[1]).filter(f=>f!==void 0),s.length>0))break}if(!s||s.length===0)return;let d=new Map(n.map(a=>[a.name,a.type]));if(!s.some(a=>!d.has(a)))return s.map(a=>({name:a,type:d.get(a)}))}p(ar,"wgslUniformLayout");var dr=[{directive:/(?:^|\n)\s*enable\s+subgroups\s*;/u,feature:"subgroups"},{directive:/(?:^|\n)\s*enable\s+subgroups[-_]f16\s*;/u,feature:"subgroups-f16"},{directive:/(?:^|\n)\s*enable\s+f16\s*;/u,feature:"shader-f16"},{directive:/(?:^|\n)\s*enable\s+clip_distances\s*;/u,feature:"clip-distances"},{directive:/(?:^|\n)\s*enable\s+dual_source_blending\s*;/u,feature:"dual-source-blending"}];function cr(t){let e=[];for(let n of dr)t.some(r=>r!==null&&n.directive.test(r))&&e.push(n.feature);return e}p(cr,"shaderRequirements");function ur(t,e){let n=new Map,r=new Set,o=[];for(let i of t){let s=e(i.node,`uniform ${i.name??"<generated>"}`),d=JSON.stringify(s),a=n.get(d);a===void 0&&(a=new Map,n.set(d,a));let u=a.get(i.nid);u===void 0&&(u=a.size,a.set(i.nid,u));let f=`${d}\0${u}\0${i.stage}`;r.has(f)||(r.add(f),o.push({address:s,instance:u,type:i.type,stage:i.stage,name:i.name}));}return o}p(ur,"reduceJournal");function fr(t,e){if(e==="NodeStorageBuffer"||e==="StorageBuffer"){let n=t.access;return typeof n=="string"?{access:n}:{}}if(e.includes("Sampled")){let n=t.store===true,r=t.access;return {store:n,...n&&typeof r=="string"?{access:r}:{}}}return {}}p(fr,"capturedBindingAccess");function lr(t,e,n){let r=gt(t.builder,t.kind);if(!r)throw new Error(`Shader key "${t.key}" has no live build target.`);let o=new pt({...t,target:r,retainedGraph:n},e),i=Ve(t.builder.updateNodes),s=Ve(t.builder.updateBeforeNodes),d=Ve(t.builder.updateAfterNodes);for(let c of [...i,...s,...d])o.noteUpdateNode(c);let a=ur(t.journal,(c,y)=>o.classify(c,y)),u=typeof t.builder.getAttributesArray=="function"?Reflect.apply(t.builder.getAttributesArray,t.builder,[]):[],f=Array.isArray(u)?u.map((c,y)=>{if(!l(c)||typeof c.name!="string"||typeof c.type!="string")throw new Error(`Shader attribute ${y} is invalid.`);let R=w(c.node);return {name:c.name,type:c.type,node:R?o.classify(R,`attribute ${c.name}`):null}}):[],g=typeof t.builder.getBindings=="function"?Reflect.apply(t.builder.getBindings,t.builder,[]):[],k=Array.isArray(g)?g.map((c,y)=>{if(!l(c)||!Array.isArray(c.bindings))throw new Error(`Shader bind group ${y} is invalid.`);return {name:typeof c.name=="string"?c.name:`group-${y}`,bindings:c.bindings.map((R,b)=>{if(!l(R)||typeof R.name!="string")throw new Error(`Shader binding ${y}/${b} is invalid.`);let A=ze(R),v;if(A==="NodeUniformsGroup"){if(!Array.isArray(R.uniforms))throw new Error(`Shader uniform group ${y}/${b} has no member list.`);let B=R.uniforms.map((x,U)=>{if(!l(x)||typeof x.name!="string"||typeof x.getType!="function")throw new Error(`Shader uniform ${y}/${b}/${U} is invalid.`);let O=Reflect.apply(x.getType,x,[]);if(typeof O!="string")throw new Error(`Shader uniform ${y}/${b}/${U} has no stable type.`);return {name:x.name,type:O}});v=ar(t.builder,R.name,a)??B;}return {name:R.name,kind:A,...fr(R,A),...v===void 0?{}:{uniforms:v}}})}}):[],N=l(t.builder.observer)?{hasNode:t.builder.observer.hasNode===true,hasAnimation:t.builder.observer.hasAnimation===true}:null,S=p(c=>typeof t.builder[c]=="string"?t.builder[c]:null,"shader");return {key:t.key,vertexShader:S("vertexShader"),fragmentShader:S("fragmentShader"),computeShader:S("computeShader"),declarations:a,attributes:f,bindGroups:k,updateNodes:i.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateNodes")),updateBeforeNodes:s.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateBeforeNodes")),updateAfterNodes:d.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateAfterNodes")),requirements:cr([S("vertexShader"),S("fragmentShader"),S("computeShader")]),observer:N,hardwareClipping:t.builder.hardwareClipping===true}}p(lr,"entryFromSnapshot");function Ze(t){return (t??"").replace(/\b(nodeUniform|nodeVar|nodeVarying|nodeAttribute|NodeBuffer_|nodeCode)\d+\b/gu,"$1#").split(`
1
+ var Tn=Object.defineProperty;var p=(t,e)=>Tn(t,"name",{value:e,configurable:true});var De="three-webgpu-r185-v1",Ge=["fragmentNode","vertexNode","colorNode","positionNode","normalNode","opacityNode","alphaTestNode","backdropNode","backdropAlphaNode","emissiveNode","metalnessNode","roughnessNode","clearcoatNode","clearcoatRoughnessNode","transmissionNode","thicknessNode","iorNode","outputNode","mrtNode","depthNode","castShadowNode","receivedShadowNode","maskNode","envNode"];var J=["_renderContexts","_renderContexts"],j=Object.freeze({renderContextMrt:"three-r185-render-context-mrt",renderContextInput:"three-r185-render-context-input",skinningEvent:"three-r185-skinning-event",previousBoneMatrices:"three-r185-previous-bone-matrices",previousInstanceMatrices:"three-r185-previous-instance-matrices",previousInstanceMatricesEvent:"three-r185-previous-instance-matrices-event",dynamicLightData:"three-r185-dynamic-light-data",morphUpdateEvent:"three-r185-morph-update-event",maxMip:"three-r185-max-mip",morphTargetTexture:"three-r185-morph-target-texture",cubeMap:"three-r185-cube-map",passTexture:"three-r185-pass-texture",reflector:"three-r185-reflector",object3D:"three-r185-object3d",passSetupOutput:"three-r185-pass-setup-output",retainedLightUniform:"three-r185-retained-light-uniform",retainedReference:"three-r185-retained-reference",retainedShadowChild:"three-r185-retained-shadow-child",retainedShadowFar:"three-r185-retained-shadow-far",materialSteps:"three-r185-material-steps"});function Ke(t){let e=/^(.*)-([^-]+)-(-?\d+)$/u.exec(t);if(e?.[1]===void 0||e[2]===void 0||e[3]===void 0)return;let n=Number(e[3]);if(Number.isSafeInteger(n))return {attachmentState:e[1],mrtState:e[2],callDepth:n}}p(Ke,"parseThreeR185RenderContextKey");function Lt(t){return t==="185"||t===185}p(Lt,"supportsThreeR185Revision");function jn(t){let e=t.constructor;return (typeof e=="function"||typeof e=="object"&&e!==null)&&typeof Reflect.get(e,"name")=="string"?String(Reflect.get(e,"name")):"unknown"}p(jn,"constructorName");function ze(t){let e=t,n=p(o=>e[o]===true,"flag"),r=typeof e.textureNode=="object"&&e.textureNode!==null||typeof e.nodeUniform=="object"&&e.nodeUniform!==null;return n("isNodeUniformsGroup")?"NodeUniformsGroup":n("isUniformsGroup")?"UniformsGroup":n("isNodeUniformBuffer")?"NodeUniformBuffer":n("isUniformBuffer")?"UniformBuffer":n("isStorageBuffer")?r?"NodeStorageBuffer":"StorageBuffer":n("isSampledCubeTexture")?r?"NodeSampledCubeTexture":"SampledCubeTexture":n("isSampledTexture3D")?"NodeSampledTexture3D":n("isSampled3DTexture")?"Sampled3DTexture":n("isSampledArrayTexture")?r?"NodeSampledArrayTexture":"SampledArrayTexture":n("isSampledTexture")?r?"NodeSampledTexture":"SampledTexture":n("isSampler")?r?"NodeSampler":"Sampler":typeof e.kind=="string"?e.kind:jn(t)}p(ze,"capturedBindingKind");var Ot="three-webgpu-r186dev-v1";function Pt(t){return t==="186dev"}p(Pt,"supportsThreeR186DevRevision");var It="three-blocks.shader-capture.runtime.v1";var Cn=Symbol.for("three-blocks.shader-capture.cache.v1"),Mn=Symbol.for("three-blocks.shader-capture.cache-value.v1"),Bn=Symbol.for("three-blocks.shader-input-registry.v1"),rt="/__three-blocks/shaders/capture",pe="/__three-blocks/shaders/telemetry",Ee=4096,_n=5,En=65536,Ut=256*1024,Ln=1e3,On=/^[a-z0-9][a-z0-9_-]{0,63}$/u,je=De,Pn=new Set(["cameraProjectionMatrix","cameraProjectionMatrixInverse","cameraViewMatrix","cameraWorldMatrix","cameraNormalMatrix","cameraPosition"]),He=["lightPosition","lightTargetPosition","lightViewPosition","lightShadowMatrix"],In=new Set(["_texture","_width","_height","_maxMip","_matrixUniform","_flipYUniform"]),Un={bias:"shadowBias",intensity:"shadowIntensity",normalBias:"shadowNormalBias",radius:"shadowRadius",blurSamples:"shadowBlurSamples",mapSize:"shadowMapSize"},C={buildCalls:0,renderBuilds:0,computeBuilds:0,registeredBuilds:0,registeredRenderBuilds:0,registeredComputeBuilds:0,buildMs:0,syncBuildMs:0,asyncBuildElapsedMs:0,precompiledSetupMs:0,maxSyncBuildMs:0,maxPrecompiledSetupMs:0,hydrationMs:0,maxHydrationMs:0,injected:0,injectedRender:0,injectedCompute:0,missed:0,missedRender:0,missedCompute:0,missedKeys:[]},B={capture:false,forceLive:false,settleFrames:60,readiness:{},transform:1},rn=new WeakMap,$t=new WeakSet,Ft=new WeakSet,ot=new WeakMap,it=new Set,on=new WeakMap,xe=[],ve=[],Dt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap,zt=new WeakMap,Q,we=0,We=false,ye=false,ee="default",re,oe,ne=false,st=0,Ne,Ht=false,P,G,Ce={},fe,le=false;function Me(t){return /^.+\/input-[a-zA-Z0-9_-]+-\d{4}$/u.test(t)}p(Me,"isAutomaticInputContainerKey");function l(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}p(l,"isRecord");function sn(){let t=Reflect.get(globalThis,Bn);return l(t)&&t.version===1?t:void 0}p(sn,"retainedInputRegistry");function F(t){let e=sn(),n=e?.keyFor;if(typeof n!="function")return;let r=Reflect.apply(n,e,[t]);return typeof r=="string"&&r.startsWith("@three-blocks-input:")?r:void 0}p(F,"retainedInputKey");function Wt(t){if(t===null||typeof t!="object")return;let e=sn(),n=e?.locationForValue;if(typeof n=="function"){let i=Reflect.apply(n,e,[t]);if(l(i)&&typeof i.key=="string"&&i.key.startsWith("@three-blocks-input:")&&Array.isArray(i.path)&&i.path.every(a=>a==="value"||a==="array"))return {container:i.key,path:i.path}}let r=e?.keyForValue;if(typeof r!="function")return;let o=Reflect.apply(r,e,[t]);return typeof o=="string"&&o.startsWith("@three-blocks-input:")?{container:o,path:["value"]}:void 0}p(Wt,"retainedInputValueLocation");function at(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return;if(e.add(t),Array.isArray(t)){for(let r of t){let o=at(r,e);if(o)return o}return}let n=t;for(let r of ["key","container"]){let o=n[r];if(typeof o=="string"&&Me(o))return o}for(let r of Object.values(n)){let o=at(r,e);if(o)return o}}p(at,"automaticInputContainerReference");function dt(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return;if(e.add(t),Array.isArray(t)){for(let i of t){let a=dt(i,e);if(a)return a}return}let n=t,r=n.container,o=n.path;if(typeof r=="string"&&Array.isArray(o)){let i=o.filter(a=>typeof a=="string");if(r==="@renderer"&&i.includes(J[0])||r==="@object"&&i.includes("_renderer"))return `${r}.${i.join(".")}`}for(let i of Object.values(n)){let a=dt(i,e);if(a)return a}}p(dt,"transientRendererReference");function Be(t){return l(t)&&t.isNode===true}p(Be,"isNode");function w(t){if(l(t)&&typeof t.getSelf=="function"){let e=t.getSelf();return Be(e)?e:void 0}return Be(t)?t:void 0}p(w,"nodeFrom");function he(t){let e=new Map;if(t.isNode!==true)return e;e.set(t,[]);let n=[t];for(let r=0;r<n.length;r++){let o=n[r];if(!o||typeof o.getSerializeChildren!="function")continue;let i=e.get(o)??[],a=0;for(let f of o.getSerializeChildren()){let s=w(f.childNode);if(s&&!e.has(s)&&(e.set(s,[...i,a]),n.push(s)),a++,a>Ee)throw new Error("Shader node graph exceeds the capture child limit.")}}return e}p(he,"indexNodeGraph");function ct(t){if(t.k==="owned"){let e=ct(t.owner);return e===t.owner?t:{...t,owner:e}}if(t.k==="container"&&t.key==="@renderer"&&t.path.length>=4&&t.path[0]===J[0]&&t.path[1]===J[1]&&t.path.at(-1)==="mrt"){let e=t.path[2],n=typeof e=="string"?Ke(e):void 0;if(n!==void 0){let r=an(n.attachmentState);return {k:"recipe",id:j.renderContextMrt,version:1,input:{attachmentState:n.attachmentState,callDepth:n.callDepth,...r===void 0?{}:{samples:r}}}}}return t}p(ct,"stableRenderContextAddress");function $n(t){for(;t.k==="owned";)t=t.owner;return t.k==="container"&&t.key.startsWith("@three-blocks-input:")&&!t.key.startsWith("@three-blocks-input:setup-")}p($n,"addressUsesGenericRetainedInputRoot");function an(t){let e=t.split(":");if(e.length!==6)return;let n=Number(e[3]);return Number.isSafeInteger(n)&&n>=0?n:void 0}p(an,"renderAttachmentSamples");function Fn(t,e){let n=l(t)?t:{},r={isDepthTexture:n.isDepthTexture===true,isRenderTargetTexture:n.isRenderTargetTexture===true,isDataTexture:n.isDataTexture===true,isData3DTexture:n.isData3DTexture===true,isCubeTexture:n.isCubeTexture===true,format:typeof n.format=="number"?n.format:null,type:typeof n.type=="number"?n.type:null,compareFunction:typeof n.compareFunction=="number"?n.compareFunction:null};typeof n.name=="string"&&n.name.length>0&&(r.name=n.name),typeof n.colorSpace=="string"&&n.colorSpace.length>0&&(r.colorSpace=n.colorSpace);let o=an(e);return o!==void 0&&(r.samples=o),r}p(Fn,"textureResourceSignature");function Dn(t,e){if(t.k!=="inputNode"||t.value.container!=="@renderer")return t;let n=t.value.path;if(n.length<4||n[0]!==J[0]||n[1]!==J[1]||typeof n[2]!="string")return t;let r=Ke(n[2]);if(r===void 0)return t;let o=n[3]==="depthTexture"&&n.length===4?"depthTexture":n[3]==="textures"&&n.length===5&&Number.isSafeInteger(n[4])?"texture":void 0;if(o===void 0)return t;let{k:i,value:a,...f}=t;return {k:"recipe",id:j.renderContextInput,version:1,input:{attachmentState:r.attachmentState,callDepth:r.callDepth,mrt:r.mrtState!=="default",resource:o,...o==="texture"?{index:Number(n[4])}:{},texture:Fn(e,r.attachmentState),node:f}}}p(Dn,"stableRenderContextInputAddress");function m(t){if(!l(t))return typeof t;let e=t.constructor;return (typeof e=="function"||l(e))&&typeof e.name=="string"?e.name:"unknown"}p(m,"constructorName");function qt(t){if(!l(t))return m(t);let e=l(t.image)?t.image:void 0;return [m(t),typeof t.uuid=="string"?`uuid=${t.uuid}`:"",typeof t.name=="string"&&t.name?`name=${t.name}`:"",t.isRenderTargetTexture===true?"renderTarget":"",t.isPMREMTexture===true?"pmrem":"",e&&typeof e.width=="number"&&typeof e.height=="number"?`${e.width}x${e.height}`:"",typeof t.format=="number"?`format=${t.format}`:"",typeof t.type=="number"?`type=${t.type}`:""].filter(Boolean).join("/")}p(qt,"textureLabel");function Se(t,e){return typeof t=="string"&&t.length>0?t.slice(0,512):e}p(Se,"boundedLabel");var Gn=typeof performance=="object"&&typeof performance.now=="function"?performance.now.bind(performance):void 0;function Kn(){return Gn?.()??Date.now()}p(Kn,"now");function dn(t){return l(t)&&typeof t.then=="function"}p(dn,"promiseLike");function zn(t){B={capture:t.capture===true,forceLive:t.forceLive===true,settleFrames:Number.isSafeInteger(t.settleFrames)&&t.settleFrames>=0?t.settleFrames:60,settleTimeoutMs:Number.isSafeInteger(t.settleTimeoutMs)&&Number(t.settleTimeoutMs)>=1e3?Number(t.settleTimeoutMs):3e4,visibilityGuard:t.visibilityGuard===true,...typeof t.captureId=="string"?{captureId:t.captureId}:{},...typeof t.sessionKey=="string"?{sessionKey:t.sessionKey}:{},...typeof t.token=="string"?{token:t.token}:{},readiness:{...typeof t.readiness?.selector=="string"?{selector:t.readiness.selector}:{},...typeof t.readiness?.global=="string"?{global:t.readiness.global}:{}},transform:t.transform},fe=void 0,le=false,re=void 0,oe=void 0,ne=false,st=0,Ne=void 0,G=void 0,Reflect.set(globalThis,Cn,n=>{l(n)&&Jt(n);});let e=Reflect.get(globalThis,Mn);l(e)&&Jt(e),(B.capture||cn())&&Wn();}p(zn,"configureThreeBlocksShaderCapture");function cn(){let t=Reflect.get(globalThis,"location"),e=l(t)?Reflect.get(t,"search"):void 0;if(typeof e!="string")return false;let n=new URLSearchParams(e),r=n.get("threeBlocksShaderMode");return n.get("capture")==="1"||r==="live"||r==="precompiled"}p(cn,"drivenShaderSession");function gt(){return B.capture||B.forceLive||cn()}p(gt,"shaderSessionActive");function Jt(t){if(P=t,!B.capture)return;let e=un(),n=t.automaticRegistrationPrefix,r=typeof n=="function"?Reflect.apply(n,t,[e]):void 0;typeof r=="string"&&(G=r);}p(Jt,"adoptCaptureCache");function Hn(t){if(!B.capture||P===void 0)return;let e=P.automaticRegistrationPrefix,n=typeof e=="function"?Reflect.apply(e,P,[t]):void 0;if(typeof n=="string"){G=n;return}let r=P.enableAutomaticRegistration;if(typeof r=="function"){G="auto";try{Reflect.apply(r,P,[{scene:t,prefix:G}]);}catch(o){throw G=void 0,o}}}p(Hn,"ensureCaptureAutomaticRegistration");function Wn(){if(Ht)return;let t=globalThis,e=t.requestAnimationFrame;if(typeof e!="function")return;Ht=true;let n=0,r=0,o=false,i=new Map,a=p(()=>{o||i.size===0||(o=true,Reflect.apply(e,t,[()=>{o=false;let f=[...i.values()];i.clear();let s=n++*(1e3/60);for(let d of f)try{d(s);}catch(u){queueMicrotask(()=>{throw u});}a();}]));},"schedule");Reflect.set(t,"requestAnimationFrame",f=>{let s=++r;return i.set(s,f),a(),s}),Reflect.set(t,"cancelAnimationFrame",f=>{i.delete(f);});}p(Wn,"installDeterministicRaf");function W(t,e){if(!P)return;let n=P[t];return typeof n=="function"?Reflect.apply(n,P,e):void 0}p(W,"cacheCall");function un(){if(P&&typeof P.activeScene=="string"&&P.activeScene!=="default")return P.activeScene;let t=Reflect.get(globalThis,"location"),e=l(t)?Reflect.get(t,"search"):void 0,n=typeof e=="string"?new URLSearchParams(e).get("captureId"):null;return n!==null&&On.test(n)?n:P&&typeof P.activeScene=="string"?P.activeScene:"default"}p(un,"activeShaderCaptureScene");function ie(){return un()}p(ie,"activeScene");function me(t,e,n,r){let o=W(t==="compute"?"registrationForCompute":"registrationForRender",t==="compute"?[e,n]:[e,n,r]);return (!l(o)||typeof o.key!="string")&&(Hn(n),o=W(t==="compute"?"registrationForCompute":"registrationForRender",t==="compute"?[e,n]:[e,n,r])),l(o)&&typeof o.key=="string"?o:void 0}p(me,"sceneRegistration");function qn(t){return t.key}p(qn,"capturedRegistrationKey");function yt(t,e){let n=e==="compute"?t.object:t.material;return n!==null&&typeof n=="object"?n:void 0}p(yt,"builderTarget");function fn(t){return t.material===null||t.material===void 0?"compute":"render"}p(fn,"buildKind");function qe(t){if(!l(t))return;let e={};for(let n of ["uuid","id","name","type"]){let r=t[n];typeof r=="string"?e[n]=Se(r,""):(typeof r=="number"&&Number.isFinite(r)||typeof r=="boolean")&&(e[n]=r);}return Object.keys(e).length===0?void 0:e}p(qe,"objectIdentity");function Jn(t,e,n,r){if(ve.length>=Ee)return;let o=t==="compute"?e.object:e.material,i=Se(l(o)?o.name??o.type:void 0,"unknown"),a=W("registrations",[n]),f=qe(o),s=l(r)?qe(r.material):void 0;ve.push({kind:t,name:i,reason:t==="compute"?`unregistered compute "${i}"`:`unregistered material "${i}"`,...f===void 0?{}:{target:f},...s===void 0?{}:{renderObjectMaterial:s},...Array.isArray(a)?{registrations:a.slice(0,16).flatMap(d=>{if(!l(d))return [];let u=qe(d.target);return [{...typeof d.key=="string"?{key:Se(d.key,"")}:{},...typeof d.kind=="string"?{kind:Se(d.kind,"")}:{},...u??{},sameTarget:d.target===o,...l(r)?{sameRenderObjectMaterial:d.target===r.material}:{}}]})}:{}});}p(Jn,"addSkipped");function Je(t,e,n=(i,a)=>{a==="prepareForHydration"?(C.precompiledSetupMs+=i,C.maxPrecompiledSetupMs=Math.max(C.maxPrecompiledSetupMs,i)):(C.buildMs+=i,a==="buildAsync"?C.asyncBuildElapsedMs+=i:(C.syncBuildMs+=i,C.maxSyncBuildMs=Math.max(C.maxSyncBuildMs,i)));},r=Kn,o){let i=t[e];typeof i=="function"&&Reflect.set(t,e,p(function(...f){let s=r(),d;try{d=Reflect.apply(i,this,f);}catch(u){throw n(r()-s,e),u}return dn(d)?Promise.resolve(d).then(u=>(n(r()-s,e),o?.(),u),u=>{throw n(r()-s,e),u}):(n(r()-s,e),o?.(),d)},"timedBuild"));}p(Je,"wrapThreeBlocksCaptureTimedBuild");function ln(t,e,n){if(!gt()||!l(t)||!l(e)||$t.has(t))return;$t.add(t);let r=ie(),o=W("containers",[r]);ot.set(t,new Set(Array.isArray(o)?o.filter(h=>l(h)&&typeof h.key=="string").map(h=>String(h.key)):[]));let i=l(n)&&l(n.material)?n:void 0,a=i?"render":fn(t),f=a==="render"&&i?_e("render",i):yt(t,a);f&&(i&&on.set(t,i),me(a,f,ie(),i));let s=[];rn.set(t,s);let d=t.getUniformFromNode;typeof d=="function"&&Reflect.set(t,"getUniformFromNode",p(function(k,N,S,c){let y=Reflect.apply(d,this,[k,N,S,c]),R=w(k),b=typeof S=="string"?S:this.shaderStage;if(R&&typeof N=="string"&&(b==="vertex"||b==="fragment"||b==="compute")){let A=l(y)&&typeof y.name=="string"?y.name:typeof c=="string"?c:null;s.push({node:R,type:N,stage:b,name:A,...typeof R.id=="number"?{nid:R.id}:{}});}return y},"captureUniform"));let u=p(()=>{Ft.has(t)||(Ft.add(t),pn(t,e));},"recordBuild");Je(t,"build",void 0,void 0,u),Je(t,"buildAsync",void 0,void 0,u),Je(t,"prepareForHydration");}p(ln,"instrumentThreeBlocksShaderBuilder");function ce(t){return Object.assign(Object.create(Object.getPrototypeOf(t)),t)}p(ce,"cloneCaptureRecord");function Yn(t){let e=Object.create(t);for(let a of ["object","material","scene","camera","lightsNode","context","vertexShader","fragmentShader","computeShader","observer","hardwareClipping","updateNodes","updateBeforeNodes","updateAfterNodes"]){let f=t[a];Reflect.set(e,a,a==="material"&&l(f)?ce(f):Array.isArray(f)?[...f]:f);}let n=typeof t.getAttributesArray=="function"?Reflect.apply(t.getAttributesArray,t,[]):[],r=Array.isArray(n)?n.map(a=>l(a)?ce(a):a):[];Reflect.set(e,"getAttributesArray",()=>r);let o=typeof t.getBindings=="function"?Reflect.apply(t.getBindings,t,[]):[],i=Array.isArray(o)?o.map(a=>{if(!l(a))return a;let f=ce(a),s=Array.isArray(a.bindings)?a.bindings.map(d=>{if(!l(d))return d;let u=ce(d);return Array.isArray(d.uniforms)&&Reflect.set(u,"uniforms",d.uniforms.map(h=>l(h)?ce(h):h)),u}):[];return Reflect.set(f,"bindings",s),f}):[];return Reflect.set(e,"getBindings",()=>i),e}p(Yn,"snapshotBuilderState");function pn(t,e){if(!gt()||B.capture&&ye||!l(t)||!l(e))return;C.buildCalls++,oe=Date.now(),ne=false;let n=fn(t);n==="compute"?C.computeBuilds++:C.renderBuilds++;let r=ie();ee=r;let o=ot.get(t)??new Set,i=W("containers",[r]);if(Array.isArray(i))for(let d of i)l(d)&&typeof d.key=="string"&&Me(d.key)&&!o.has(d.key)&&it.add(d.key);ot.delete(t);let a=yt(t,n),f=n==="render"?on.get(t)??(l(t.object)?t.object:void 0):void 0,s=a?me(n,a,r,f):void 0;if(s){C.registeredBuilds++,n==="compute"?C.registeredComputeBuilds++:C.registeredRenderBuilds++;let d=qn(s);if(xe.length<Ee){let u=Yn(t),h={scene:r,key:d,kind:n,builder:u,renderer:e,...f?{renderObject:f}:{},journal:[...rn.get(t)??[]]};xe.push(h);}}else Jn(n,t,r,f);gn();}p(pn,"recordThreeBlocksShaderBuild");function _e(t,e){return t==="compute"?e!==null&&typeof e=="object"?e:void 0:l(e)&&e.material!==null&&typeof e.material=="object"?e.material:void 0}p(_e,"targetForProvider");function Yt(t,e,n,r){if(B.capture&&ye)return;let o=ie();ee=o;let i=_e(t,e),a=t==="render"&&l(e)?e:void 0,f=i?me(t,i,o,a):void 0;n!=null?(C.injected++,t==="compute"?C.injectedCompute++:C.injectedRender++):f&&(C.missed++,t==="compute"?C.missedCompute++:C.missedRender++,C.missedKeys.length<Ee&&!C.missedKeys.includes(f.key)&&C.missedKeys.push(f.key));let s=r.stats;if(l(s)){let d=s.hydrationMs,u=s.maxHydrationMs;if(typeof d=="number"&&Number.isFinite(d)&&d>=0){let h=Gt.get(r)??0;C.hydrationMs+=d>=h?d-h:d,Gt.set(r,d);}typeof u=="number"&&Number.isFinite(u)&&u>=0&&(C.maxHydrationMs=Math.max(C.maxHydrationMs,u));}B.capture||gn();}p(Yt,"recordProviderResult");function Xn(t){let e=t.debug;if(!l(e))return;let n=e.onNodeBuilderCreated,r=zt.get(t);if(n===r)return;let o=typeof n=="function"?n:void 0,i=p(function(f,s){o!==void 0&&Reflect.apply(o,this,[f,s]),ln(f,t,s);},"captureNodeBuilder");zt.set(t,i),e.onNodeBuilderCreated=i;}p(Xn,"installCaptureBuilderCallback");function Vn(t,e,n){if(!l(t))return;if(n!==void 0)if(Lt(n))je=De;else if(Pt(n))je=Ot;else throw new Error(`@three-blocks/devtools supports Three.js revisions 185 and 186dev capture; received ${JSON.stringify(n)}.`);let r=Reflect.get(t,"backend");if(l(r)&&r.isWebGLBackend===true||!gt())return;if(l(e)&&e!==Ce&&(Ce=e,Ae=void 0),Xn(t),B.forceLive){let d=Kt.get(t);d||(d={__threeBlocksCaptureForceLive:true,getForRender(u){let h=_e("render",u);h&&me("render",h,ie(),l(u)?u:void 0);},getForCompute(u){let h=_e("compute",u);h&&me("compute",h,ie());}},Kt.set(t,d)),t.nodeBuilderStateProvider=d;return}let o=t.nodeBuilderStateProvider;if(!l(o))return;let i=Dt.get(o);if(i){t.nodeBuilderStateProvider=i;return}if(o.__threeBlocksCaptureWrapper===true)return;let a=o.getForRender,f=o.getForCompute;if(typeof a!="function"||typeof f!="function")return;let s={__threeBlocksCaptureWrapper:true,get stats(){return o.stats},getForRender(d,u,h){let k=Reflect.apply(a,o,[d,u,h]);return Yt("render",d,k,o),k},getForCompute(d,u,h){let k=Reflect.apply(f,o,[d,u,h]);return Yt("compute",d,k,o),k}};Dt.set(o,s),t.nodeBuilderStateProvider=s;}p(Vn,"prepareThreeBlocksShaderRenderer");var Zn=Object.freeze({configureThreeBlocksShaderCapture:zn,instrumentThreeBlocksShaderBuilder:ln,prepareThreeBlocksShaderRenderer:Vn,recordThreeBlocksShaderBuild:pn});Reflect.set(globalThis,Symbol.for(It),Zn);function Qn(t){return w(t)}p(Qn,"unwrapTsl");var Ae;function z(){if(Ae)return Ae;let t=new Map;for(let[e,n]of Object.entries(Ce)){let r=Qn(n);r&&!t.has(r)&&t.set(r,e);}return Ae=t,t}p(z,"tslMap");function er(t,e){if(!(!e||!l(t._nodes)||typeof t._nodes.getEnvironmentNode!="function"))return w(Reflect.apply(t._nodes.getEnvironmentNode,t._nodes,[e]))}p(er,"sceneEnvironmentNode");function tr(t,e){if(!(!e||!l(t._nodes)||typeof t._nodes.getBackgroundNode!="function"))return w(Reflect.apply(t._nodes.getBackgroundNode,t._nodes,[e]))}p(tr,"sceneBackgroundNode");var Xt=new WeakMap;function nr(t,e,n){let r=Reflect.get(t,"getLightNodes");if(typeof r!="function")return [];let o=Reflect.get(e,"getDataFromNode");if(typeof o=="function")for(let f of ["fragment","vertex","compute","any"]){let s=Reflect.apply(o,e,[t,f]),d=l(s)?s.lightNodes:void 0;if(Array.isArray(d))return d.map(w).filter(u=>u!==void 0)}let a=Reflect.apply(r,t,[{renderer:n,context:{materialLightings:[]},getDataFromNode(f){let s=Xt.get(f);return s||(s={},Xt.set(f,s)),s}}]);return Array.isArray(a)?a.map(w).filter(f=>f!==void 0):[]}p(nr,"lightNodes");function Ye(t,e){let n=Reflect.get(Ce,t);return typeof n=="function"?w(Reflect.apply(n,void 0,[e])):void 0}p(Ye,"lightUniform");function Xe(t){if(!t)return [];let e=[],n=Reflect.get(t,"traverse");return typeof n=="function"&&Reflect.apply(n,t,[r=>{r!==null&&typeof r=="object"&&Reflect.get(r,"isLight")===true&&e.push(r);}]),e}p(Xe,"sceneLights");function ue(t){if(!t)return [];let e=[],n=Reflect.get(t,"traverse");return typeof n=="function"&&Reflect.apply(n,t,[r=>{r!==null&&typeof r=="object"&&e.push(r);}]),e}p(ue,"sceneObjects");function rr(t){let e=[],n=new Set,r=p((o,i)=>{if(n.has(o))return;n.add(o),e.push([o,i]);let a=Reflect.get(o,"children");if(Array.isArray(a))for(let[f,s]of a.entries())l(s)&&s.isObject3D===true&&r(s,[...i,"children",f]);},"visit");return r(t,[]),e}p(rr,"object3DPaths");function or(t){return !(Reflect.get(t,"isNode")===true||Reflect.get(t,"isObject3D")===true||Reflect.get(t,"isTexture")===true||Reflect.get(t,"isMaterial")===true||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Set||t instanceof Promise)}p(or,"isScannable");function ut(t,e,n,r=()=>false,o=false){let i=new Set,a=[{value:t,path:[],depth:0}];for(let f=0;f<a.length;f++){let s=a[f];if(!s||i.has(s.value)||s.depth>_n)continue;let{value:d,path:u,depth:h}=s;i.add(d);let k=Array.isArray(d)?Array.from(d,(N,S)=>[S,N]):d instanceof Map?[...d.entries()].filter(N=>typeof N[0]=="string"||typeof N[0]=="number").map(([N,S])=>[`map:${String(N)}`,S]):Object.keys(d).map(N=>[N,Reflect.get(d,N)]);for(let[N,S]of k){if(S===null||typeof S!="object")continue;let c=[...u,N];if(!r(c))if(Be(S)){let y=w(S);y&&e(y,c),o&&a.push({value:y??S,path:c,depth:h+1});}else n(S,c),or(S)&&a.push({value:S,path:c,depth:h+1});}}}p(ut,"scanContainer");function hn(t){if(new Uint8Array(new Uint16Array([258]).buffer)[0]!==2)throw new Error("Shader capture requires a little-endian host.");let e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=e.toBase64;if(typeof n=="function")return n.call(e);let r="",o=32768;for(let i=0;i<e.length;i+=o)r+=String.fromCharCode(...e.subarray(i,i+o));return btoa(r)}p(hn,"bytesToBase64");function ir(t){if(!ArrayBuffer.isView(t)||m(t)!=="Float32Array")throw new Error(`RangeNode setup produced an unsupported ${m(t)} buffer.`);if(t.byteLength>Ut)throw new Error(`RangeNode setup buffer is ${t.byteLength} bytes; embedded shader inputs are limited to ${Ut} bytes.`);return {t:"f32",data:hn(t)}}p(ir,"serializeRangeBuffer");function Vt(t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(l(t)){for(let[e,n]of [["isVector2","v2"],["isVector3","v3"],["isVector4","v4"],["isColor","c"],["isMatrix3","m3"],["isMatrix4","m4"]])if(t[e]===true&&typeof t.toArray=="function"){let r=Reflect.apply(t.toArray,t,[]);if(Array.isArray(r)&&r.every(o=>typeof o=="number"&&Number.isFinite(o)))return {t:n,a:r}}}}p(Vt,"serializeValueItem");function Zt(t){if(Array.isArray(t)){let r=t.map(Vt);return r.every(o=>o!==void 0)?{t:"arr",items:r}:void 0}let e=Vt(t);if(e!==void 0)return e;if(l(t)&&t.isTexture===true&&t.image==null&&t.isRenderTargetTexture!==true&&t.version===0&&(t.name===""||t.name===void 0))return {t:"tex"};if(!l(t)||t.isDataTexture!==true||!l(t.image))return;let n=t.image.data;if(!(!ArrayBuffer.isView(n)||typeof Reflect.get(n,"length")!="number"||Number(Reflect.get(n,"length"))>En))return {t:"dtex",arrayType:m(n),data:hn(n),width:typeof t.image.width=="number"?t.image.width:0,height:typeof t.image.height=="number"?t.image.height:0,format:typeof t.format=="number"?t.format:0,type:typeof t.type=="number"?t.type:0,minFilter:typeof t.minFilter=="number"?t.minFilter:0,magFilter:typeof t.magFilter=="number"?t.magFilter:0,wrapS:typeof t.wrapS=="number"?t.wrapS:0,wrapT:typeof t.wrapT=="number"?t.wrapT:0,name:typeof t.name=="string"?t.name:""}}p(Zt,"serializeStaticValue");function Ve(t){if(!(Object.hasOwn(t,"update")||Object.hasOwn(t,"updateBefore")||Object.hasOwn(t,"updateAfter"))){if(Reflect.get(t,"isStorageTextureNode")===true)return "storageTexture";if(Reflect.get(t,"isStorageBufferNode")===true)return "storage";switch(m(t)){case "BufferNode":return "buffer";case "BufferAttributeNode":return "bufferAttribute";case "Texture3DNode":return "texture3D";case "CubeTextureNode":return "cubeTexture";case "TextureNode":return "texture";case "UniformArrayNode":return "uniformArray";case "UniformNode":return "uniform";case "PMREMNode":return "pmremTexture";default:return}}}p(Ve,"inputClass");function Qt(t,e){let n=m(t);return n!==m(e)||["TextureNode","Texture3DNode","CubeTextureNode"].includes(n)||!!w(Reflect.get(t,"compareNode"))!=!!w(Reflect.get(e,"compareNode"))||Reflect.get(t,"access")!==Reflect.get(e,"access")?false:m(t)==="BufferAttributeNode"?["bufferType","bufferStride","bufferOffset","usage","instanced"].every(r=>Reflect.get(t,r)===Reflect.get(e,r)):true}p(Qt,"hasEquivalentSharedInputShape");function sr(t){if(t.k==="inputNode")return t.value;if(t.k==="container")return {container:t.key,path:[...t.path,"value"]};if(t.k==="anchor"&&t.path.length===0)return {container:"@material",path:[t.slot,"value"]}}p(sr,"sharedTextureValueLocation");function en(t){if(t?.k==="container")return {container:t.key,path:t.path};if(t?.k==="anchor"&&t.path.length===0)return {container:"@material",path:[t.slot]}}p(en,"sharedTextureNodeLocation");function tn(t,e){if(t.isDataArrayTexture!==true||t.format!==1023||t.type!==1015||!l(t.image)||t.image.data===null||typeof t.image.data!="object"||m(t.image.data)!=="Float32Array")return false;let n=e.morphAttributes,r=e.attributes;if(!l(n)||!l(r)||!l(r.position))return false;let o=Array.isArray(n.position)?n.position:[],i=Array.isArray(n.normal)?n.normal:[],a=Array.isArray(n.color)?n.color:[],f=o.length>0?o:i.length>0?i:a;if(f.length===0)return false;let s=r.position.count;if(!Number.isSafeInteger(s)||Number(s)<0)return false;let d=a.length>0?3:i.length>0?2:1,u=Number(s)*d,h=1;return u>4096&&(h=Math.ceil(u/4096),u=4096),t.image.width===u&&t.image.height===h&&t.image.depth===f.length&&Reflect.get(t.image.data,"length")===u*h*4*f.length}p(tn,"isThreeR185MorphTargetTexture");function ar(t){let e=W("registrations",[t]),n=new Map;if(Array.isArray(e))for(let s of e){if(!l(s))continue;let d=[],u=w(s.owner);u&&d.push(u);let h=s.target;if(s.kind==="compute"){let k=w(h);k&&d.push(k);}else if(h!==null&&typeof h=="object")for(let k of Ge){let N=w(Reflect.get(h,k));N&&d.push(N);}for(let k of d)for(let N of he(k).keys()){let S=F(N);S!==void 0&&!n.has(S)&&n.set(S,N);}}let r=[...n].map(([s,d])=>({key:s,node:d})),o=new Map,i=new Map,a=p((s,d)=>{let u=i.get(s);(u===void 0||d.path.length<u.path.length)&&i.set(s,d);},"rememberNearestValue");for(let s of r)o.set(s.node,{k:"container",key:s.key,path:[]});let f=p((s,d)=>{let u=o.get(s)??d;o.has(s)||o.set(s,u);for(let[h,k]of he(s))h===s||o.has(h)||o.set(h,{k:"owned",owner:u,path:k});},"indexGraph");for(let s of r){let d={k:"container",key:s.key,path:[]};a(s.node,{container:s.key,path:[]}),f(s.node,d),ut(s.node,(u,h)=>f(u,{k:"container",key:s.key,path:h}),(u,h)=>a(u,{container:s.key,path:h}),Y,true);}return {roots:r,nodes:o,values:i}}p(ar,"buildRetainedGraphIndex");function ft(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return false;if(e.add(t),Array.isArray(t))return t.some(r=>ft(r,e));let n=t;return n.k==="recipe"?true:Object.values(n).some(r=>ft(r,e))}p(ft,"addressUsesRecipe");function lt(t,e=new Set){if(t===null||typeof t!="object"||e.has(t))return false;if(e.add(t),Array.isArray(t))return t.some(r=>lt(r,e));let n=t;return n.k==="recipe"&&typeof n.id=="string"?[j.skinningEvent,j.previousBoneMatrices,j.previousInstanceMatrices,j.previousInstanceMatricesEvent,j.dynamicLightData,j.morphTargetTexture,j.morphUpdateEvent,j.cubeMap,j.passTexture,j.reflector,j.object3D,j.passSetupOutput,j.retainedReference,j.retainedShadowChild,j.retainedShadowFar,j.materialSteps].includes(n.id):Object.values(n).some(r=>lt(r,e))}p(lt,"addressUsesContextScopedRecipe");var pt=class{static{p(this,"RecipeCollisionIndex");}#t=new Map;#i=new WeakMap;#e=0;viewportInput(e){let n=this.#i.get(e);return n===void 0&&(n=this.#e++,this.#i.set(e,n)),n}register(e,n,r,o){if(!ft(e)||lt(e))return;let i=JSON.stringify(e),a=this.#t.get(i);if(a!==void 0&&a.source!==n)throw new Error(`Shader recipe collision between "${a.shaderKey}" (${a.usage}) and "${r}" (${o}) for ${i}. Register the live resources in distinct stable application containers or make their structural recipe signatures unique.`);a===void 0&&this.#t.set(i,{source:n,shaderKey:r,usage:o});}};function Y(t){return t.includes("_inspector")||t.includes("_renderer")||t.includes("_lastRenderer")||t.includes("_lastCullingRenderer")||t.includes("renderer")||t.some(e=>typeof e=="string"&&e.startsWith("_cached"))}p(Y,"applicationContainerPathIsTransient");function dr(t){return t.some(e=>typeof e=="string"&&e.startsWith("_"))||t[0]==="contextNode"&&t[1]==="value"&&typeof t[2]=="string"&&t[2].startsWith("renderPipeline")}p(dr,"materialPathIsTransient");var ht=class{static{p(this,"CaptureClassifier");}#t;#i;#e=new Map;#c=new Map;#r=new Map;#u=new Map;#s=[];#f=new Set;#l=[];#a=[];constructor(e,n){this.#t=e,this.#i=n;let r=e.kind==="compute"?Be(e.target)?[{slot:"compute",node:e.target}]:[]:Ge.flatMap(c=>{let y=w(Reflect.get(e.target,c));return y?[{slot:c,node:y}]:[]});for(let c of r)this.#o(c.node,{k:"anchor",key:e.key,slot:c.slot,path:[]});let o=w(e.builder.lightsNode);this.#a.length=0;let i=this.#a;if(o){let c=nr(o,e.builder,e.renderer);this.#l.push(...c),this.#s.push(`lights=${c.length}`);for(let y of c){let R=Reflect.get(y,"light");if(R===null||typeof R!="object")continue;let b=i.length;i.push(R);let A={k:"lightNode",light:b};if(this.#o(y,A),Reflect.get(y,"isAnalyticLightNode")===true){let x=w(Reflect.get(y,"baseColorNode")),_=x??w(Reflect.get(y,"colorNode"));_&&this.#e.set(_,{k:"owned",owner:A,path:[x!==void 0||R!==null&&typeof R=="object"&&Reflect.get(R,"castShadow")===true?"baseColorNode":"colorNode"]});}for(let x of He){let _=Ye(x,R);this.#s.push(`${b}/${x}=${_?`${m(_)}:${m(Reflect.get(_,"value"))}:${String(Reflect.get(_,"updateType"))}`:"missing"}`),_&&this.#o(_,{k:"lightUniform",fn:x,light:b});}}}else this.#s.push("lights=missing");let a=e.builder.scene!==null&&typeof e.builder.scene=="object"?e.builder.scene:null;for(let[c,y]of Xe(a).entries()){if(i.includes(y))continue;let R=i.length+c;for(let b of He){let A=Ye(b,y);A&&this.#o(A,{k:"lightUniform",fn:b,light:R,sceneLight:c});}}let f=er(e.renderer,a);f&&this.#o(f,{k:"sceneEnv"});let s=p((c,y,R,b=false)=>{this.#r.has(y)||this.#r.set(y,{container:c,path:[]}),ut(y,(A,x)=>this.#o(A,{k:"container",key:c,path:x}),(A,x)=>{this.#r.has(A)||this.#r.set(A,{container:c,path:x});},R,b);},"scan");if(e.kind==="render")for(let c of Object.getOwnPropertyNames(e.target)){let y=w(Reflect.get(e.target,c));y&&!this.#e.has(y)&&this.#e.set(y,{k:"container",key:"@material",path:[c]});}let d=W("containers",[e.scene]),u=Array.isArray(d)?d.find(c=>l(c)&&typeof c.key=="string"&&c.key.includes("/resource-batched-text-")):void 0;if(l(u)&&typeof u.key=="string"&&u.target!==null&&typeof u.target=="object"&&s(u.key,u.target,Y,true),Array.isArray(d)){for(let c of d)if(c!==u&&l(c)&&typeof c.key=="string"&&c.target!==null&&typeof c.target=="object"){let y=c.key;if(Me(y)||it.has(y))continue;s(y,c.target,Y,true);}}if(e.kind==="render"){s("@material",e.target,dr,true),e.renderObject&&s("@renderObject",e.renderObject,A=>A.length===1&&A[0]!=="context");let c=Reflect.get(e.renderer,"getMRT"),y=Reflect.get(e.builder,"context"),b=(l(y)?w(y.mrt):void 0)??(typeof c=="function"?w(Reflect.apply(c,e.renderer,[])):void 0);e.renderObject&&b&&this.#o(b,{k:"container",key:"@renderObject",path:["context","mrt"]});}let h=e.builder.object;h!==null&&typeof h=="object"&&s("@object",h,c=>Y(c)||e.kind==="compute"&&c.some(y=>typeof y=="string"&&y.startsWith("_")),e.kind==="compute"),a&&s("@scene",a,Y);let k=tr(e.renderer,a),N=k?this.#m(k):void 0;if(k&&N){this.#o(k,N);let c=w(Reflect.get(k,"_cubeTextureNode"));c&&this.#e.set(c,{k:"owned",owner:N,path:["_cubeTextureNode"]});}for(let[c,y]of ue(a).entries())s(`@sceneObject:${c}`,y,Y);s("@renderer",e.renderer,c=>c.length>=1&&c[0]==="_inspector"||c.length===2&&c[0]==="_nodes"&&c[1]==="nodeBuilderCache");let S=W("containers",[e.scene]);if(Array.isArray(S)){for(let c of S)if(l(c)&&typeof c.key=="string"&&c.target!==null&&typeof c.target=="object"){let y=c.key;if(Me(y)||it.has(y))continue;s(y,c.target,Y,true);}}for(let[c,y]of e.retainedGraph.values){let R=this.#r.get(c);(R===void 0||R.container==="@renderer"&&R.path[0]===J[0]&&R.path[1]===J[1])&&this.#r.set(c,y);}for(let[c,y]of e.retainedGraph.nodes)!this.#e.has(c)&&!z().has(c)&&Ve(c)===void 0&&this.#e.set(c,y);}#n(e,n,r,o){let i=Reflect.get(e,"value"),a=this.#c.get(e)??o??(r.k==="recipe"&&r.id===j.renderContextInput&&i!==null&&typeof i=="object"?i:e);return this.#c.set(e,a),this.#i.register(r,a,this.#t.key,n),r}#o(e,n){!this.#e.has(e)&&!z().has(e)&&this.#e.set(e,n);for(let[r,o]of he(e))r===e||this.#e.has(r)||z().has(r)||this.#e.set(r,{k:"owned",owner:n,path:o});}#N(e){let n=w(Reflect.get(this.#t.target,"contextNode")),r=n?Reflect.get(n,"value"):void 0,o=l(r)?r.renderPipelineState:void 0,i=l(o)?w(o.viewOffsetOwner):void 0;if(!i||Reflect.get(i,"camera")!==e)return;let a=F(i);return a===void 0?void 0:{container:a,path:["camera"]}}#d(e){let n=F(e);if(n!==void 0)return {k:"container",key:n,path:[]};let r=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null;for(let[o,i]of ue(r).entries()){let a=Reflect.get(i,"shadow");if(l(a)&&w(a.shadowNode)===e)return {k:"container",key:`@sceneObject:${o}`,path:["shadow","shadowNode"]}}return this.#e.get(e)}#S(e){let n=p((o,i)=>{let a=Reflect.get(o,"shadow");if(!(Reflect.get(o,"isLight")!==true&&(Reflect.get(o,"isObject3D")!==true||!l(a)))){for(let f of He)if(Ye(f,o)===e)return {k:"recipe",id:j.retainedLightUniform,version:1,input:{fn:f,light:i}}}},"address");for(let{key:o,node:i}of this.#t.retainedGraph.roots){let a,f=p((s,d)=>{a??=n(s,{container:o,path:d});},"inspect");if(f(i,[]),a===void 0&&ut(i,()=>{},f,Y),a===void 0)for(let s of Object.getOwnPropertyNames(i)){let d=Reflect.get(i,s);if(!(!l(d)||d.isObject3D!==true))for(let[u,h]of rr(d))a??=n(u,{container:o,path:[s,...h]});}if(a!==void 0)return a}let r=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null;for(let[o,i]of ue(r).entries()){let a=Reflect.get(i,"shadow"),f=l(a)?Reflect.get(a,"shadowNode"):void 0,s=l(f)?Reflect.get(f,"lights"):void 0;if(Array.isArray(s))for(let[d,u]of s.entries()){if(u===null||typeof u!="object")continue;let h=n(u,{container:`@sceneObject:${o}`,path:["shadow","shadowNode","lights",d]});if(h!==void 0)return h}}}#A(e){if(m(e)!=="UniformNode"||Reflect.get(e,"name")!=="shadowFar"||Reflect.get(e,"updateType")!=="render")return;let n=Reflect.get(e,"update");if(typeof n!="function")return;let r=Reflect.get(e,"value"),o=[],i=0;for(let[f,s]of this.#e){if(Reflect.get(f,"isShadowBaseNode")!==true||Reflect.get(f,"isShadowNode")===true)continue;let d=Reflect.get(f,"maxFar"),u=Reflect.get(f,"camera"),h=l(u)?u.far:void 0;if(typeof d!="number"||!Number.isFinite(d)||typeof h!="number"||!Number.isFinite(h))continue;let k=100000025e-2+i*2;i++;try{Reflect.set(f,"maxFar",k),Reflect.set(u,"far",k+1),Reflect.apply(n,e,[{}]),Reflect.get(e,"value")===k&&o.push(this.#d(f)??s);}catch{}finally{Reflect.set(f,"maxFar",d),Reflect.set(u,"far",h);try{Reflect.apply(n,e,[{}]);}catch{Reflect.set(e,"value",r);}}}let a=o.length===1?o[0]:void 0;if(a!==void 0)return {k:"recipe",id:j.retainedShadowFar,version:1,input:{owner:a}}}#T(e){if(Reflect.get(e,"isShadowNode")!==true)return;let n=[];for(let o of this.#e.keys()){if(Reflect.get(o,"isShadowBaseNode")!==true||Reflect.get(o,"isShadowNode")===true)continue;let i=Reflect.get(o,"_shadowNodes"),a=Reflect.get(o,"lights");if(!Array.isArray(i)||!Array.isArray(a)||i.length===0||i.length!==a.length)continue;let f=i.indexOf(e),s=this.#d(o);f>=0&&s!==void 0&&n.push({owner:s,index:f,count:i.length});}let r=n.length===1?n[0]:void 0;if(r!==void 0)return {k:"recipe",id:j.retainedShadowChild,version:1,input:{owner:r.owner,index:r.index,count:r.count}}}#j(e){let n=[];for(let r of this.#e.keys()){if(Reflect.get(r,"isShadowBaseNode")!==true||Reflect.get(r,"isShadowNode")===true)continue;let o=Reflect.get(r,"lights");if(!(!Array.isArray(o)||o.length===0))for(let[i,a]of o.entries()){let f=this.#d(r);l(a)&&a.shadow===e&&f!==void 0&&n.push({owner:f,path:["lights",i,"shadow"],ownerCount:o.length});}}return n.length===1?n[0]:void 0}#x(e){let n=[];for(let r of this.#e.keys()){if(Reflect.get(r,"isShadowBaseNode")!==true||Reflect.get(r,"isShadowNode")===true)continue;let o=this.#d(r);if(o?.k!=="container")continue;let i=Reflect.get(r,"lights");if(!(!Array.isArray(i)||i.length===0))for(let[a,f]of i.entries()){let s=l(f)?f.shadow:void 0,d=l(s)?s.map:void 0;if(!l(d))continue;d._depthTexture===e&&n.push({container:o.key,path:[...o.path,"lights",a,"shadow","map","_depthTexture"]});let u=d.textures;if(Array.isArray(u))for(let[h,k]of u.entries())k===e&&n.push({container:o.key,path:[...o.path,"lights",a,"shadow","map","textures",h]});}}return n.length===1?n[0]:void 0}#p(e){if(!["ReferenceNode","ReferenceBaseNode"].includes(m(e)))return;let n=Reflect.get(e,"property"),r=Reflect.get(e,"uniformType");if(typeof n!="string"||n.length===0||typeof r!="string"||r.length===0)return;let o=Reflect.get(e,"object"),i=o!==null&&typeof o=="object"?this.#j(o):void 0,a=o!==null&&typeof o=="object"?this.#N(o)??this.#r.get(o):void 0,f=w(o),s=f?this.#d(f):void 0;if(o!==null&&typeof o=="object"&&a===void 0&&s===void 0&&i===void 0)return;let d=w(Reflect.get(e,"group")),u=d?z().get(d):void 0;if(d&&u===void 0)return;let h=Reflect.get(e,"count");if(h!==null&&(!Number.isSafeInteger(h)||Number(h)<0))return;let k=Reflect.get(e,"name"),N=i?.owner??s;return N!==void 0?{k:"recipe",id:j.retainedReference,version:1,input:{owner:N,...i===void 0?{}:{path:i.path,ownerCount:i.ownerCount},property:n,uniformType:r,...h===null?{}:{count:Number(h)},...u===void 0?{}:{group:u},...typeof k=="string"&&k.length>0?{name:k}:{}}}:{k:"reference",property:n,uniformType:r,...h===null?{}:{count:Number(h)},...a===void 0?{}:{object:a},...u===void 0?{}:{group:u},...typeof k=="string"&&k.length>0?{name:k}:{}}}#h(e){if(Reflect.get(e,"isMaterialReferenceNode")!==true)return;let n=Reflect.get(e,"property"),r=Reflect.get(e,"uniformType"),o=Reflect.get(e,"referenceType"),i=typeof r=="string"||r===null?r:o;return typeof n=="string"&&(typeof i=="string"||i===null)?{k:"materialCache",property:n,type:i}:void 0}#v(e){if(m(e)!=="UniformNode"||Reflect.get(e,"nodeType")!=="int"||Reflect.get(e,"updateType")!=="render")return;let n=this.#t.builder.material,r=this.#t.builder.object,o=l(r)?r.material:void 0,i=Reflect.get(e,"update");if(typeof i!="function")return;let a=[];l(n)&&a.push({owner:"material",target:n}),l(o)&&o!==n&&a.push({owner:"objectMaterial",target:o});let f=Reflect.get(e,"value"),s=[];for(let{owner:d,target:u}of a){let h=u.steps;if(!Number.isSafeInteger(h)||Number(h)<0||Number(h)>2147483647)continue;let k=Number(h)===2147483647?2147483646:Number(h)+1;try{Reflect.set(u,"steps",k),Reflect.apply(i,e,[{material:n,object:r}]),Reflect.get(e,"value")===k&&s.push(d);}catch{}finally{Reflect.set(u,"steps",h);try{Reflect.apply(i,e,[{material:n,object:r}]);}catch{Reflect.set(e,"value",f);}}}if(s.length===1)return s[0]==="material"?{k:"recipe",id:j.materialSteps,version:1}:{k:"recipe",id:j.materialSteps,version:1,input:{owner:"objectMaterial"}}}#g(e){if(!this.#l.includes(e)||Reflect.get(e,"light")!==void 0)return;let n=m(e);return /^[A-Za-z][A-Za-z0-9]*LightDataNode$/u.test(n)?{k:"recipe",id:j.dynamicLightData,version:1,input:{type:n}}:void 0}#C(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback");if(!l(n)||n.isSkinnedMesh!==true||typeof r!="function")return;let o=n.skeleton;if(!l(o))return;let i=o.boneMatrices,a=o.bones,f=o.update;if(!ArrayBuffer.isView(i)||m(i)!=="Float32Array"||!Array.isArray(a)||a.length===0||typeof f!="function")return;let s=i;if(s.length!==a.length*16)return;let d=this.#t.journal.filter(b=>{let A=Reflect.get(b.node,"value");return m(b.node)==="BufferNode"&&b.type==="buffer"&&b.stage==="vertex"&&Reflect.get(b.node,"bufferType")==="mat4"&&Reflect.get(b.node,"bufferCount")===a.length&&A!==s&&ArrayBuffer.isView(A)&&m(A)==="Float32Array"&&Reflect.get(A,"length")===s.length}),u=[...new Set(d.map(b=>Reflect.get(b.node,"value")))];if(u.length===0)return;let h=new Float32Array(s),k=u.map(b=>new Float32Array(b)),N=Object.getOwnPropertyDescriptor(o,"update"),S={},c=[];try{if(!Reflect.set(o,"update",()=>{}))return;for(let b=0;b<s.length;b++)s[b]=-100000.5-b;Reflect.apply(r,e,[{object:n,frameId:S}]),c=u.filter(b=>b.every((A,x)=>A===s[x]));}catch{return}finally{s.set(h);for(let[b,A]of u.entries())A.set(k[b]);N===void 0?Reflect.deleteProperty(o,"update"):Object.defineProperty(o,"update",N);}let y=c[0];if(c.length!==1||y===void 0)return;let R={k:"recipe",id:j.previousBoneMatrices,version:1,input:{count:a.length}};for(let b of d)Reflect.get(b.node,"value")===y&&(this.#e.set(b.node,R),this.#c.set(b.node,o));}#M(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback");if(!l(n)||n.isInstancedMesh!==true||typeof r!="function")return;let o=n.instanceMatrix,i=l(o)?o.array:void 0,a=l(o)?o.count:void 0;if(!ArrayBuffer.isView(i)||m(i)!=="Float32Array"||!Number.isSafeInteger(a)||Number(a)<1||Reflect.get(i,"length")!==Number(a)*16)return;let f=i,s=this.#t.journal.filter(c=>{let y=Reflect.get(c.node,"value");return m(c.node)==="BufferNode"&&c.type==="buffer"&&c.stage==="vertex"&&Reflect.get(c.node,"bufferType")==="mat4"&&Reflect.get(c.node,"bufferCount")===a&&y!==f&&ArrayBuffer.isView(y)&&m(y)==="Float32Array"&&Reflect.get(y,"length")===f.length}),d=[...new Set(s.map(c=>Reflect.get(c.node,"value")))];if(d.length===0)return;let u=new Float32Array(f),h=d.map(c=>new Float32Array(c)),k=[];try{for(let c=0;c<f.length;c++)f[c]=-200000.5-c;Reflect.apply(r,e,[{object:n}]),k=d.filter(c=>c.every((y,R)=>y===f[R]));}catch{return}finally{f.set(u);for(let[c,y]of d.entries())y.set(h[c]);}let N=k[0];if(k.length!==1||N===void 0)return;let S={k:"recipe",id:j.previousInstanceMatrices,version:1,input:{count:Number(a)}};for(let c of s)Reflect.get(c.node,"value")===N&&(this.#e.set(c.node,S),this.#c.set(c.node,n));this.#f.add(e);}#y(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;let n=this.#t.builder.object,r=Reflect.get(e,"callback"),o=typeof r=="function"?Function.prototype.toString.call(r):"";if(!l(n)||!o.includes("morphTargetsRelative")||!o.includes("morphTargetInfluences")||!o.includes(".reduce")||!o.includes(".update"))return;let i=n.morphTargetInfluences,a=n.geometry,f=n.morphTexture;if(!l(a))return;let s=n.isInstancedMesh===true&&i===void 0&&a.morphTargetsRelative===true&&Number.isSafeInteger(n.count)&&Number(n.count)>1&&l(f);if(!Array.isArray(i)&&!s)return;let d=a.morphAttributes;if(!l(d))return;let u=Array.isArray(d.position)?d.position:[],h=Array.isArray(d.normal)?d.normal:[],k=Array.isArray(d.color)?d.color:[],N=u.length>0?u:h.length>0?h:k;if(N.length===0||Array.isArray(i)&&N.length!==i.length)return;let S=this.#t.journal.some(R=>{let b=Reflect.get(R.node,"value");return m(R.node)==="TextureNode"&&R.type==="texture"&&R.stage==="vertex"&&Reflect.get(R.node,"sampler")===false&&l(b)&&tn(b,a)}),c=this.#t.journal.flatMap((R,b)=>m(R.node)==="UniformArrayNode"?[`${b}:${R.type}/${R.stage}:same=${Reflect.get(R.node,"array")===i}:length=${Array.isArray(Reflect.get(R.node,"array"))?Reflect.get(R.node,"array").length:"na"}`]:[]);if(this.#s.push(`morph=${String(Reflect.get(n,"name")??"")}:targets=${N.length}:influences=${Array.isArray(i)?i.length:"none"}:texture=${S}:arrays=[${c.join(",")}]`),!S)return;if(s){let R=this.#t.journal.filter(v=>m(v.node)==="TextureNode"&&v.type==="texture"&&v.stage==="vertex"&&Reflect.get(v.node,"value")===f);if(R.length!==1)return;let b=[];for(let v of this.#t.journal){let I=Reflect.get(v.node,"value");m(v.node)==="UniformNode"&&v.type==="float"&&v.stage==="vertex"&&typeof I=="number"&&Number.isFinite(I)&&!b.some(O=>O.node===v.node)&&b.push({node:v.node,value:I});}let A=[];try{for(let[v,I]of b.entries()){let O=-100000.5-v;if(!Reflect.set(I.node,"value",O)||Reflect.get(I.node,"value")!==O)return}try{Reflect.apply(r,e,[{object:n}]);}catch{}A=b.filter(v=>Reflect.get(v.node,"value")===1).map(v=>v.node);}finally{for(let v of b)Reflect.set(v.node,"value",v.value);}let x=A[0],_=R[0]?.node;return A.length===1&&x!==void 0&&_!==void 0?{base:x,morphTexture:_,count:N.length}:void 0}if(!Array.isArray(i))return;let y=this.#t.journal.flatMap((R,b)=>{let A=Reflect.get(R.node,"array");if(m(R.node)!=="UniformArrayNode"||R.type!=="buffer"||R.stage!=="vertex"||A!==i&&(!Array.isArray(A)||A.length!==i.length))return [];let x=this.#t.journal[b-1];return x===void 0||m(x.node)!=="UniformNode"||x.type!=="float"||x.stage!=="vertex"||typeof Reflect.get(x.node,"value")!="number"||!Number.isFinite(Reflect.get(x.node,"value"))?[]:[{base:x.node,influences:R.node,count:i.length}]});return y.length===1?y[0]:void 0}#B(e){if(m(e)!=="EventNode"||Reflect.get(e,"eventType")!=="object")return;if(this.#f.has(e))return {k:"recipe",id:j.previousInstanceMatricesEvent,version:1};let n=this.#t.builder.object,r=Reflect.get(e,"callback"),o=typeof r=="function"?Function.prototype.toString.call(r):"";if(l(n)&&n.isSkinnedMesh===true&&o.includes("skeleton"))return {k:"recipe",id:j.skinningEvent,version:1};let i=this.#y(e);if(i){let a=this.#e.get(i.base),f=i.influences===void 0?void 0:this.#e.get(i.influences),s=i.morphTexture===void 0?void 0:this.#e.get(i.morphTexture);return a===void 0||f===void 0==(s===void 0)?void 0:{k:"recipe",id:j.morphUpdateEvent,version:1,input:f===void 0?{base:a,morphTexture:s,count:i.count}:{base:a,influences:f,count:i.count}}}}#_(e){if(m(e)!=="MaxMipLevelNode")return;let n=w(Reflect.get(e,"textureNode"));if(!n)return;let r=this.classify(n,"max-mip texture owner");return {k:"recipe",id:j.maxMip,version:1,input:r}}#m(e){if(m(e)!=="CubeMapNode")return;let n=w(Reflect.get(e,"envNode"));if(n)return {k:"recipe",id:j.cubeMap,version:1,input:this.classify(n,"cube-map environment")}}#b(e){if(m(e)!=="Object3DNode")return;let n=Reflect.get(e,"scope");if(!["direction","worldMatrix","position","scale","viewPosition","radius"].includes(String(n)))return;let r=Reflect.get(e,"object3d");if(r===null||typeof r!="object")return;let o=this.#t.builder.object,i="object";if(r!==o){let s=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,d=ue(s).indexOf(r);if(d<0)return;i={sceneObject:d};}let a={k:"recipe",id:j.object3D,version:1,input:{scope:String(n),object:i}};this.#e.set(e,a);let f=w(Reflect.get(e,"uniformNode"));return f&&this.#e.set(f,{k:"owned",owner:a,path:["uniformNode"]}),this.#n(e,"Object3DNode",a,r)}#R(e){let n=w(Reflect.get(e,"textureNode")),r=n?w(Reflect.get(n,"passNode")):void 0;if(!r||Reflect.get(r,"isPassNode")!==true||typeof Reflect.get(r,"setup")!="function")return;let o=F(r),i=this.#e.get(r)??(o?{k:"container",key:o,path:[]}:void 0);if(i===void 0)return;let a={k:"recipe",id:j.passSetupOutput,version:1,input:{owner:i}};return this.#o(e,a),this.#n(e,"pass setup output",a,r)}#k(e){if(m(e)!=="ReflectorNode")return;let n=w(Reflect.get(e,"_reflectorBaseNode")),r=n?w(Reflect.get(n,"textureNode")):void 0;if(!n||m(n)!=="ReflectorBaseNode"||!r||m(r)!=="ReflectorNode")return;let o=Reflect.get(n,"target");if(o===null||typeof o!="object")return;let i=Reflect.get(o,"parent"),a=this.#t.builder.object,f=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,s=null;if(i!==null&&typeof i=="object")if(i===a)s="object";else {let _=ue(f).indexOf(i);if(_<0)return;s={sceneObject:_};}let d=p((_,v)=>{if(_===null||typeof _!="object")return;let I=v.map(O=>Reflect.get(_,O));return I.every(O=>typeof O=="number"&&Number.isFinite(O))?I:void 0},"components"),u=d(Reflect.get(o,"position"),["x","y","z"]),h=d(Reflect.get(o,"quaternion"),["x","y","z","w"]),k=d(Reflect.get(o,"scale"),["x","y","z"]),N=Reflect.get(n,"resolutionScale"),S=Reflect.get(n,"samples");if(!u||!h||!k||typeof N!="number"||!Number.isFinite(N)||!Number.isSafeInteger(S)||Number(S)<0)return;let c=i!==null&&typeof i=="object"?Reflect.get(i,"children"):void 0,y=Array.isArray(c)?c.indexOf(o):-1;if(i!==null&&y<0)return;let R={k:"recipe",id:j.reflector,version:1,input:{resolutionScale:N,generateMipmaps:Reflect.get(n,"generateMipmaps")===true,bounces:Reflect.get(n,"bounces")===true,depth:Reflect.get(n,"depth")===true,samples:Number(S),parent:s,targetIndex:y,position:u,quaternion:h,scale:k}};this.#e.set(r,R),this.#e.set(n,{k:"owned",owner:R,path:["_reflectorBaseNode"]});let b=w(Reflect.get(r,"_depthNode")),A={k:"owned",owner:R,path:["_depthNode"]};b&&this.#e.set(b,A);let x=e===b?A:R;return this.#e.set(e,x),x}#E(e){if(m(e)!=="TextureNode"||Reflect.get(e,"sampler")!==false)return;let n=Reflect.get(e,"value"),r=this.#t.builder.object,o=l(r)?r.geometry:void 0;if(!(!l(r)||!l(n)||!l(o)||this.#r.has(n)||Reflect.get(r,"morphTexture")===n||!tn(n,o)))return {k:"recipe",id:j.morphTargetTexture,version:1}}noteUpdateNode(e){if(m(e)==="PMREMNode"){let s=this.classify(e,"PMREM update node ownership");for(let d of ["_texture","_width","_height","_maxMip"]){let u=w(Reflect.get(e,d));u&&this.#e.set(u,{k:"owned",owner:s,path:[d]});}return}let n=this.#e.get(e);if(n){let s=["ReferenceNode","ReferenceBaseNode"].includes(m(e))?w(Reflect.get(e,"node")):void 0;s&&this.#e.set(s,{k:"owned",owner:n,path:["node"],prime:"reference"});return}let r=m(e)==="RTTNode"?F(e):void 0;if(r?.startsWith("@three-blocks-input:setup-rtt-")===true){let s={k:"container",key:r,path:[]};this.#e.set(e,s);let d=Reflect.get(e,"value");d!==null&&typeof d=="object"&&this.#r.set(d,{container:r,path:["value"]});return}if(this.#R(e))return;let o=this.#g(e);if(o){this.#o(e,o);return}this.#C(e),this.#M(e);let i=this.#y(e);if(i?.influences){let s=Reflect.get(i.influences,"elementType");this.#e.set(i.influences,{k:"inputNode",nodeClass:"uniformArray",value:{container:"@object",path:["morphTargetInfluences"]},access:null,uniformType:typeof s=="string"?s:null});}if(m(e)==="ReflectorBaseNode"){let s=w(Reflect.get(e,"textureNode"));s&&this.#k(s);}if(m(e)==="Object3DNode"){this.#b(e);return}if(m(e)==="CubeMapNode"){let s=this.classify(e,"cube-map update node ownership"),d=w(Reflect.get(e,"envNode")),u=w(Reflect.get(e,"_cubeTextureNode"));u&&u!==d&&this.#e.set(u,{k:"owned",owner:s,path:["_cubeTextureNode"]});return}let a=this.#h(e)??this.#p(e);if(a===void 0&&["ReferenceNode","ReferenceBaseNode"].includes(m(e))){let s=F(e);s!==void 0&&(a={k:"container",key:s,path:[]});}if(a===void 0){["TextureNode","Texture3DNode","CubeTextureNode"].includes(m(e))&&(a=this.classify(e,"texture update node ownership"));let s=a===void 0&&Reflect.get(e,"isTextureNode")===true?Zt(Reflect.get(e,"value")):void 0;if(l(s)&&s.t==="tex"&&this.classify(e,"update node ownership"),a===void 0)return}this.#e.set(e,a);let f=w(Reflect.get(e,"node"));f&&this.#e.set(f,{k:"owned",owner:a,path:["node"],prime:"reference"});}shouldOmitUpdateNode(e){return m(e)==="InspectorNode"?true:m(e)==="EventNode"&&Reflect.get(e,"eventType")==="frame"&&l(this.#t.builder.object)&&Reflect.get(this.#t.builder.object,"isInstancedMesh")===true}#L(e){if(Reflect.get(e,"isTextureNode")!==true)return;let n=Reflect.get(e,"update");if(typeof n!="function")return;let r=p(()=>{try{Reflect.apply(n,e,[{}]);}catch{}},"invoke");for(let o of this.#w()){if(Reflect.get(o.light,"isSpotLight")!==true)continue;let i=Reflect.get(o.light,"map");if(i===null||typeof i!="object")continue;let a={},f=false;try{Reflect.set(o.light,"map",a),r(),f=Reflect.get(e,"value")===a;}finally{Reflect.set(o.light,"map",i),r();}if(f)return {k:"lightUniform",fn:"spotLightMap",...o.address}}}#w(){let e=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,n=this.#a.map((r,o)=>({light:r,address:{light:o}}));for(let[r,o]of Xe(e).entries())this.#a.includes(o)||n.push({light:o,address:{light:this.#a.length+r,sceneLight:r}});return n}#O(e){let n=this.#w();if(n.length===0)return;if(Reflect.get(e,"isReferenceNode")===true){let i=Reflect.get(e,"object"),a=Reflect.get(e,"property");if(i===null||typeof i!="object"||typeof a!="string")return;let f=Un[a],s=a==="near"?"shadowCameraNear":a==="far"?"shadowCameraFar":void 0;for(let d of n){let u=Reflect.get(d.light,"shadow");if(!(u===null||typeof u!="object")){if(f!==void 0&&u===i)return {k:"lightUniform",fn:f,...d.address};if(s!==void 0&&Reflect.get(u,"camera")===i)return {k:"lightUniform",fn:s,...d.address}}}return}if(Reflect.get(e,"isUniformNode")!==true)return;let r=Reflect.get(e,"update");if(typeof r!="function"||typeof Reflect.get(e,"value")!="number")return;let o=p(()=>{try{Reflect.apply(r,e,[{}]);}catch{}},"invoke");for(let i of n){let a=Reflect.get(i.light,"shadow"),f=a!==null&&typeof a=="object"?Reflect.get(a,"camera"):void 0;if(!(f===null||typeof f!="object"))for(let s of ["shadowCameraNear","shadowCameraFar"]){let d=s==="shadowCameraNear"?"near":"far",u=Reflect.get(f,d);if(typeof u!="number")continue;let h=u+12345.625,k=false;try{Reflect.set(f,d,h),o(),k=Reflect.get(e,"value")===h;}finally{Reflect.set(f,d,u),o();}if(k)return {k:"lightUniform",fn:s,...i.address}}}}#P(e){if(m(e)!=="BufferNode")return false;let n=Reflect.get(this.#t.builder,"getNodeProperties");if(typeof n!="function")return false;for(let r of this.#e.keys()){if(m(r)!=="RangeNode")continue;let o=Reflect.apply(n,this.#t.builder,[r]),i=l(o)?w(o.outputNode):void 0;if(i&&he(i).has(e))return true}return false}classify(e,n){let r=Reflect.get(e,"name");if(typeof r=="string"&&Pn.has(r))return {k:"namedRenderUniform",name:r};let o=this.#A(e);if(o)return this.#e.set(e,o),this.#n(e,n,o);let i=this.#T(e);if(i)return this.#e.set(e,i),this.#n(e,n,i);let a=this.#e.get(e),f=this.#t.retainedGraph.nodes.get(e);if(a&&a!==f)return this.#n(e,n,ct(a));let s=this.#b(e);if(s)return s;let d=this.#R(e);if(d)return d;let u=this.#p(e);if(u)return this.#e.set(e,u),u.k==="recipe"?this.#n(e,n,u):u;let h=this.#h(e);if(h)return this.#e.set(e,h),h;let k=this.#v(e);if(k)return this.#e.set(e,k),this.#n(e,n,k);let N=this.#g(e);if(N)return this.#e.set(e,N),this.#n(e,n,N);let S=this.#B(e);if(S)return this.#e.set(e,S),this.#n(e,n,S);let c=this.#_(e);if(c){this.#e.set(e,c);let g=w(Reflect.get(e,"textureNode")),T=g?Reflect.get(g,"value"):void 0;return this.#n(e,n,c,T!==null&&typeof T=="object"?T:g)}let y=this.#m(e);if(y)return this.#e.set(e,y),this.#n(e,n,y);let R=this.#E(e);if(R){this.#e.set(e,R);let g=Reflect.get(e,"value");return this.#n(e,n,R,g!==null&&typeof g=="object"?g:e)}let b=w(Reflect.get(e,"referenceNode")),A=b!==void 0?this.#e.get(b):void 0;if(b!==void 0&&A===void 0){let g=F(b);g&&(A={k:"container",key:g,path:[]});}let x=Reflect.get(e,"value"),_=x!==null&&typeof x=="object"?this.#r.get(x)??Wt(x):void 0,v=en(A);if(n.startsWith("uniform ")&&A!==void 0&&w(Reflect.get(e,"compareNode"))===void 0&&(v?.container.startsWith("@three-blocks-input:")!==true||_===void 0))return this.#e.set(e,A),A;let I=m(e)==="ReflectorNode"?F(e):void 0;if(I!==void 0){let g={k:"container",key:I,path:[]};return this.#e.set(e,g),g}let O=this.#k(b&&m(b)==="ReflectorNode"?b:e);if(O)return this.#e.set(e,O),this.#n(e,n,O);let yn=this.#t.builder.scene!==null&&typeof this.#t.builder.scene=="object"?this.#t.builder.scene:null,Le=Reflect.get(e,"light");if(Le!==null&&typeof Le=="object"){let g=Xe(yn).indexOf(Le);if(g>=0){let T={k:"lightNode",light:g,sceneLight:g};return Reflect.get(e,"isShadowBaseNode")===true?{k:"owned",owner:T,path:["shadowNode"]}:T}}let Oe=this.#S(e);if(Oe)return this.#e.set(e,Oe),this.#n(e,n,Oe);let Pe=this.#L(e);if(Pe)return this.#e.set(e,Pe),Pe;let K=Reflect.get(e,"value"),se=Reflect.get(e,"array");if(K!==null&&typeof K=="object"||se!==null&&typeof se=="object")for(let[g,T]of this.#e){if(g===e)continue;let M=K!==null&&typeof K=="object"&&Reflect.get(g,"value")===K,E=se!==null&&typeof se=="object"&&Reflect.get(g,"array")===se;if(!(!M&&!E)){if(Qt(g,e))return this.#e.set(e,T),T;if(M&&["TextureNode","Texture3DNode","CubeTextureNode"].includes(m(e))){let U=sr(T);if(U!==void 0){this.#r.set(K,U);break}}}}if(K!==null&&typeof K=="object")for(let[g,T]of z()){if(Reflect.get(g,"isViewportNode")!==true)continue;let M=w(Reflect.get(g,"_output"));if(M===void 0||Reflect.get(M,"value")!==K||!Qt(M,e))continue;let E={k:"owned",owner:{k:"tsl",name:T},path:["_output"]};return this.#e.set(e,E),E}let mt=z().get(e);if(mt)return {k:"tsl",name:mt};let bt=Ve(e),Ie=bt==="uniformArray"?Reflect.get(e,"array"):Reflect.get(e,"value"),Rt=Ie!==null&&typeof Ie=="object"?this.#r.get(Ie):void 0;if(!(Rt!==void 0&&!Rt.container.startsWith("@three-blocks-input:"))){for(let[g,T]of this.#e)for(let M of Object.getOwnPropertyNames(g))if(Reflect.get(g,M)===e){if(bt!==void 0&&$n(T)||(T.k==="inputNode"||T.k==="inputValue"||T.k==="recipe")&&!In.has(M))continue;let E={k:"owned",owner:T,path:[M]};return this.#e.set(e,E),E}}for(let[g,T]of z()){for(let M of Object.getOwnPropertyNames(g))if(Reflect.get(g,M)===e)return {k:"owned",owner:{k:"tsl",name:T},path:[M]};for(let[M,E]of he(g))if(M===e)return {k:"owned",owner:{k:"tsl",name:T},path:E}}let kt={ViewportDepthTextureNode:"viewportDepthTexture",ViewportSharedTextureNode:"viewportSharedTexture",ViewportTextureNode:"viewportMipTexture"}[m(e)];if(kt!==void 0){let g={k:"inputValue",nodeClass:kt,json:{viewport:this.#i.viewportInput(e)}};return this.#e.set(e,g),g}let be=m(e)==="PassTextureNode"?e:b&&m(b)==="PassTextureNode"?b:void 0;if(be){let g=w(Reflect.get(be,"passNode")),T=g?F(g):void 0,M=g?this.#e.get(g)??(T?{k:"container",key:T,path:[]}:void 0):void 0,E=g?Object.getOwnPropertyNames(g).filter(U=>w(Reflect.get(g,U))===be):[];if(M&&E.length===1){let U={k:"owned",owner:M,path:[E[0]]};return this.#e.set(be,U),this.#e.set(e,U),U}}if(m(e)==="PassMultipleTextureNode"){let g=w(Reflect.get(e,"passNode")),T=Reflect.get(e,"textureName"),M=Reflect.get(e,"previousTexture")===true,E=M?"_previousTextureNodes":"_textureNodes",U=g?F(g):void 0,X=g?this.#e.get(g)??[...this.#e].find(([q])=>w(q)===g)?.[1]??(U?{k:"container",key:U,path:[]}:void 0):void 0,te=g?Reflect.get(g,E):void 0,ae=l(te)&&typeof T=="string"?w(Reflect.get(te,T)):void 0;if(X&&typeof T=="string"&&ae){let q={k:"recipe",id:j.passTexture,version:1,input:{owner:X,name:T,previous:M}};return this.#e.set(e,q),q}this.#s.push(`passTexture=${m(g)}/${String(T)}/${E} owner=${X?JSON.stringify(X):"missing"} collection=${m(te)} canonical=${m(ae)}`);}let Re=F(e),L=Ve(e);if(L){let g=L==="uniformArray"?Reflect.get(e,"array"):Reflect.get(e,"value"),T=Reflect.get(e,"access"),M=L==="uniformArray"?Reflect.get(e,"elementType"):L==="storage"||L==="buffer"||L==="bufferAttribute"?Reflect.get(e,"bufferType"):Reflect.get(e,"uniformType"),E=typeof T=="string"?T:null,U=typeof M=="string"?M:null,X=w(Reflect.get(e,"group"))??w(Reflect.get(e,"groupNode")),te=X?z().get(X):void 0,ae=te?{group:te}:{},q=Reflect.get(e,"bufferCount"),jt=L==="storage"||L==="buffer"?{bufferCount:Number.isSafeInteger(q)&&Number(q)>=0?Number(q):0,...L==="storage"?{atomic:Reflect.get(e,"isAtomic")===true,pbo:Reflect.get(e,"isPBO")===true}:{}}:{},xt=g!==null&&typeof g=="object"?Wt(g):void 0,wn=g!==null&&typeof g=="object"&&(Reflect.get(g,"isStorageBufferAttribute")===true||Reflect.get(g,"isStorageInstancedBufferAttribute")===true),ke=g!==null&&typeof g=="object"?this.#r.get(g):void 0,Nn=ke!==void 0&&!ke.container.startsWith("@")?ke:void 0,V=g!==null&&typeof g=="object"?this.#x(g)??Nn??(wn?xt:void 0)??ke??xt:void 0;if(!V&&g!==null&&typeof g=="object"){let $=Reflect.get(g,"array");$!==null&&typeof $=="object"&&(V=this.#r.get($));}let vt=L==="bufferAttribute"?{stride:Number.isSafeInteger(Reflect.get(e,"bufferStride"))?Number(Reflect.get(e,"bufferStride")):0,offset:Number.isSafeInteger(Reflect.get(e,"bufferOffset"))?Number(Reflect.get(e,"bufferOffset")):0,usage:Number.isSafeInteger(Reflect.get(e,"usage"))?Number(Reflect.get(e,"usage")):0,instanced:Reflect.get(e,"instanced")===true||g!==null&&typeof g=="object"&&(Reflect.get(g,"isInstancedBufferAttribute")===true||Reflect.get(g,"isInstancedInterleavedBuffer")===true)||V?.path.includes("instanceMatrix")===true||V?.path.includes("instanceColor")===true}:{},Ct=["texture","cubeTexture","texture3D"].includes(L)&&w(Reflect.get(e,"compareNode"))?{comparison:true}:{},de=["texture","cubeTexture"].includes(L)?en(A):void 0,Mt=de!==void 0&&(de.container.startsWith("@three-blocks-input:")!==true||V===void 0||V.container===de.container),Bt=Mt?de:V??de,Sn=Mt?`${L}Reference`:L,$e=Reflect.get(e,"name"),_t=typeof $e=="string"&&$e.length>0?{name:$e}:{},Z=Bt?{k:"inputNode",nodeClass:Sn,value:Bt,access:E,uniformType:U,..._t,...ae,...jt,...vt,...Ct}:void 0;if(!Z&&Re!==void 0){let $={k:"container",key:Re,path:[]};return this.#e.set(e,$),$}if(!Z){let $=this.#P(e)?ir(g):Zt(g);$!==void 0&&(Z={k:"inputValue",nodeClass:L,json:$,access:E,uniformType:U,..._t,...ae,...jt,...vt,...Ct});}if(Z){let $=JSON.stringify(Z),Fe=this.#u.get($)??0;this.#u.set($,Fe+1);let An=Fe===0?Z:{...Z,n:Fe},Et=Dn(An,g);return this.#e.set(e,Et),this.#n(e,n,Et,g!==null&&typeof g=="object"?g:e)}}if(a)return this.#n(e,n,ct(a));if(Re!==void 0){let g={k:"container",key:Re,path:[]};return this.#e.set(e,g),g}let Ue=this.#O(e);if(Ue)return this.#e.set(e,Ue),this.#n(e,n,Ue);let wt=p(g=>m(g)===m(e)&&m(Reflect.get(g,"value"))===m(Reflect.get(e,"value"))&&Reflect.get(g,"updateType")===Reflect.get(e,"updateType"),"comparable"),mn=[...z()].filter(([g])=>wt(g)).slice(0,8).map(([,g])=>g),bn=[...this.#e].filter(([g])=>wt(g)).slice(0,8).map(([g,T])=>`${JSON.stringify(T)}@${qt(Reflect.get(g,"value"))}`),Nt=l(Reflect.get(e,"value"))?Reflect.get(Reflect.get(e,"value"),"uuid"):void 0,St=typeof Nt=="string"?[...this.#e].filter(([g])=>l(Reflect.get(g,"value"))&&Reflect.get(Reflect.get(g,"value"),"uuid")===Nt).slice(0,12).map(([g,T])=>`${m(g)}:${JSON.stringify(T)}`):[],At=W("containers",[this.#t.scene]),Rn=Array.isArray(At)?At.slice(0,64).flatMap(g=>{if(!l(g)||typeof g.key!="string"||!l(g.target))return [];let T=g.target,M=Object.keys(T).filter(E=>Reflect.get(T,E)===Reflect.get(e,"value"));return [`${g.key}/${m(T)}${M.length>0?`:${M.join(",")}`:""}`]}):[],Tt=m(e)==="EventNode"?Reflect.get(e,"callback"):void 0,kn=typeof Tt=="function"?Function.prototype.toString.call(Tt).replaceAll(/\s+/gu," ").slice(0,320):void 0,D=this.#t.builder.object;throw new Error(`Cannot address ${m(e)}${typeof r=="string"&&r?` "${r}"`:""} used by ${n} for shader key "${this.#t.key}". Node metadata: value=${m(Reflect.get(e,"value"))}, update=${typeof Reflect.get(e,"update")=="function"?Reflect.get(e,"update").name||"anonymous":"none"}, updateType=${String(Reflect.get(e,"updateType"))}.`+(L?` Input metadata: class=${L}, value=${m(Reflect.get(e,"value"))}, access=${String(Reflect.get(e,"access"))}, uniformType=${String(Reflect.get(e,"uniformType"))}.`:"")+` Similar semantic inputs: tsl=[${mn.join(", ")}], paths=[${bn.join(", ")}].`+(l(Reflect.get(e,"value"))&&Reflect.get(Reflect.get(e,"value"),"isTexture")===true?` Texture value: ${qt(Reflect.get(e,"value"))}.`:"")+(St.length>0?` Same-texture paths: [${St.join(", ")}].`:"")+` Classifier diagnostics: ${this.#s.join("; ")}. Registered containers: [${Rn.join(", ")}].`+(Reflect.get(e,"isStorageBufferNode")===true?` Storage metadata: type=${String(Reflect.get(e,"bufferType"))}, count=${String(Reflect.get(e,"bufferCount"))}, value=${m(Reflect.get(e,"value"))}.`:"")+(m(e)==="MaterialReferenceNode"?` Material reference metadata: flag=${String(Reflect.get(e,"isMaterialReferenceNode"))}, property=${String(Reflect.get(e,"property"))}, uniformType=${String(Reflect.get(e,"uniformType"))}.`:"")+(m(e)==="EventNode"?` Event metadata: type=${String(Reflect.get(e,"eventType"))}, object=${m(D)}, objectName=${l(D)?String(D.name??""):""}, instanced=${l(D)&&D.isInstancedMesh===true}, skinned=${l(D)&&D.isSkinnedMesh===true}, morphs=${l(D)&&Array.isArray(D.morphTargetInfluences)?D.morphTargetInfluences.length:0}, callback=${kn??"none"}.`:""))}};function Ze(t){return Array.isArray(t)?t.map(w).filter(e=>e!==void 0):[]}p(Ze,"nodeArray");function cr(t,e,n){let r=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),o=new RegExp(`struct\\s+${r}Struct\\s*\\{([\\s\\S]*?)\\};`,"u"),i=[t.vertexShader,t.fragmentShader,t.computeShader].filter(s=>typeof s=="string"),a;for(let s of i){let d=o.exec(s)?.[1];if(d!==void 0&&(a=[...d.matchAll(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*:/gmu)].map(u=>u[1]).filter(u=>u!==void 0),a.length>0))break}if(!a||a.length===0)return;let f=new Map(n.map(s=>[s.name,s.type]));if(!a.some(s=>!f.has(s)))return a.map(s=>({name:s,type:f.get(s)}))}p(cr,"wgslUniformLayout");var ur=[{directive:/(?:^|\n)\s*enable\s+subgroups\s*;/u,feature:"subgroups"},{directive:/(?:^|\n)\s*enable\s+subgroups[-_]f16\s*;/u,feature:"subgroups-f16"},{directive:/(?:^|\n)\s*enable\s+f16\s*;/u,feature:"shader-f16"},{directive:/(?:^|\n)\s*enable\s+clip_distances\s*;/u,feature:"clip-distances"},{directive:/(?:^|\n)\s*enable\s+dual_source_blending\s*;/u,feature:"dual-source-blending"}];function fr(t){let e=[];for(let n of ur)t.some(r=>r!==null&&n.directive.test(r))&&e.push(n.feature);return e}p(fr,"shaderRequirements");function lr(t,e){let n=new Map,r=new Set,o=[];for(let i of t){let a=e(i.node,`uniform ${i.name??"<generated>"}`),f=JSON.stringify(a),s=n.get(f);s===void 0&&(s=new Map,n.set(f,s));let d=s.get(i.nid);d===void 0&&(d=s.size,s.set(i.nid,d));let u=`${f}\0${d}\0${i.stage}`;r.has(u)||(r.add(u),o.push({address:a,instance:d,type:i.type,stage:i.stage,name:i.name}));}return o}p(lr,"reduceJournal");function pr(t,e){if(e==="NodeStorageBuffer"||e==="StorageBuffer"){let n=t.access;return typeof n=="string"?{access:n}:{}}if(e.includes("Sampled")){let n=t.store===true,r=t.access;return {store:n,...n&&typeof r=="string"?{access:r}:{}}}return {}}p(pr,"capturedBindingAccess");function hr(t,e,n){let r=yt(t.builder,t.kind);if(!r)throw new Error(`Shader key "${t.key}" has no live build target.`);let o=new ht({...t,target:r,retainedGraph:n},e),i=Ze(t.builder.updateNodes),a=Ze(t.builder.updateBeforeNodes),f=Ze(t.builder.updateAfterNodes);for(let c of [...i,...a,...f])o.noteUpdateNode(c);let s=lr(t.journal,(c,y)=>o.classify(c,y)),d=typeof t.builder.getAttributesArray=="function"?Reflect.apply(t.builder.getAttributesArray,t.builder,[]):[],u=Array.isArray(d)?d.map((c,y)=>{if(!l(c)||typeof c.name!="string"||typeof c.type!="string")throw new Error(`Shader attribute ${y} is invalid.`);let R=w(c.node);return {name:c.name,type:c.type,node:R?o.classify(R,`attribute ${c.name}`):null}}):[],h=typeof t.builder.getBindings=="function"?Reflect.apply(t.builder.getBindings,t.builder,[]):[],k=Array.isArray(h)?h.map((c,y)=>{if(!l(c)||!Array.isArray(c.bindings))throw new Error(`Shader bind group ${y} is invalid.`);return {name:typeof c.name=="string"?c.name:`group-${y}`,bindings:c.bindings.map((R,b)=>{if(!l(R)||typeof R.name!="string")throw new Error(`Shader binding ${y}/${b} is invalid.`);let A=ze(R),x;if(A==="NodeUniformsGroup"){if(!Array.isArray(R.uniforms))throw new Error(`Shader uniform group ${y}/${b} has no member list.`);let _=R.uniforms.map((v,I)=>{if(!l(v)||typeof v.name!="string"||typeof v.getType!="function")throw new Error(`Shader uniform ${y}/${b}/${I} is invalid.`);let O=Reflect.apply(v.getType,v,[]);if(typeof O!="string")throw new Error(`Shader uniform ${y}/${b}/${I} has no stable type.`);return {name:v.name,type:O}});x=cr(t.builder,R.name,s)??_;}return {name:R.name,kind:A,...pr(R,A),...x===void 0?{}:{uniforms:x}}})}}):[],N=l(t.builder.observer)?{hasNode:t.builder.observer.hasNode===true,hasAnimation:t.builder.observer.hasAnimation===true}:null,S=p(c=>typeof t.builder[c]=="string"?t.builder[c]:null,"shader");return {key:t.key,vertexShader:S("vertexShader"),fragmentShader:S("fragmentShader"),computeShader:S("computeShader"),declarations:s,attributes:u,bindGroups:k,updateNodes:i.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateNodes")),updateBeforeNodes:a.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateBeforeNodes")),updateAfterNodes:f.filter(c=>!o.shouldOmitUpdateNode(c)).map(c=>o.classify(c,"updateAfterNodes")),requirements:fr([S("vertexShader"),S("fragmentShader"),S("computeShader")]),observer:N,hardwareClipping:t.builder.hardwareClipping===true}}p(hr,"entryFromSnapshot");function Qe(t){return (t??"").replace(/\b(nodeUniform|nodeVar|nodeVarying|nodeAttribute|NodeBuffer_|nodeCode)\d+\b/gu,"$1#").split(`
2
2
  `).sort().join(`
3
- `)}p(Ze,"canonicalShader");function tn(t){let{key:e,vertexShader:n,fragmentShader:r,computeShader:o,...i}=t;return JSON.stringify({...i,vertexShader:Ze(n),fragmentShader:Ze(r),computeShader:Ze(o)})}p(tn,"captureEntryState");var W=class{static{p(this,"CapturePool");}values=[];#t=new Map;intern(e,n=JSON.stringify(e)){let r=this.#t.get(n);return r===void 0&&(r=this.values.length,this.#t.set(n,r),this.values.push(e)),r}};function pr(t){let e=new W,n=new W,r=new W,o=new W,i=new W,s=new W,d=new W,a={};for(let u of Object.keys(t).sort()){let f=t[u];if(f===void 0)continue;let g=p(c=>c===null?null:e.intern(c,c),"moduleAt"),k=f.declarations.map(c=>[n.intern(c.address),c.instance,c.type,c.stage,c.name]),N=f.requirements.length===0?void 0:s.intern(f.requirements),S={vertex:g(f.vertexShader),fragment:g(f.fragmentShader),compute:g(f.computeShader),declarations:k,layout:r.intern(f.bindGroups),attributes:o.intern(f.attributes.map(c=>({name:c.name,type:c.type,node:c.node===null?null:n.intern(c.node)}))),updates:[i.intern(f.updateNodes.map(c=>n.intern(c))),i.intern(f.updateBeforeNodes.map(c=>n.intern(c))),i.intern(f.updateAfterNodes.map(c=>n.intern(c)))],...N===void 0?{}:{requirements:N},observer:f.observer,hardwareClipping:f.hardwareClipping};a[u]=d.intern(S);}return {modules:e.values,nodes:n.values,layouts:r.values,attributePlans:o.values,updatePlans:i.values,requirementPlans:s.values,states:d.values,entries:a}}p(pr,"poolCaptureEntries");function hr(t,e){let n={},r=[],o=new lt,i=ir(t);for(let s of ve.filter(d=>d.scene===t))try{let d=lr(s,o,i),a=st(d);if(a)throw new Error(`Shader key "${d.key}" captured the automatic input container "${a}". Automatically discovered input containers are capture-only; register a stable application container or retain the value under the material/compute root.`);let u=at(d);if(u)throw new Error(`Shader key "${d.key}" captured the transient renderer path "${u}". Renderer contexts must use a semantic recipe, and renderer back-references are never stable replay roots.`);let f=n[d.key];f?tn(f)!==tn(d)&&r.push(`Shader key "${d.key}" produced conflicting precompiled states in one capture.`):n[d.key]=d;}catch(d){r.push(d instanceof Error?d.stack??d.message:String(d));}return {protocolVersion:2,compatibility:je,scene:t,...K===void 0?{}:{automatic:{prefix:K}},...pr(n),skipped:[...xe],errors:r,stats:{...M},timing:{...re===void 0?{}:{readiness:re},...oe===void 0?{}:{lastBuild:oe},settled:Date.now()},provenance:e}}p(hr,"buildPayload");async function gr(){let t=globalThis,e=l(t.navigator)?t.navigator:{},n=ve.find(f=>f.scene===ee)?.renderer,r=l(n?.backend)?n.backend:{},o=l(r.device)?r.device:{},i=l(o.adapterInfo)?o.adapterInfo:void 0;if(i===void 0&&l(e.gpu)&&typeof e.gpu.requestAdapter=="function"){let f=await Promise.race([Promise.resolve(Reflect.apply(e.gpu.requestAdapter,e.gpu,[])).catch(()=>{}),new Promise(g=>setTimeout(()=>g(void 0),Mn))]);l(f)&&(i=l(f.info)?f.info:f);}let s=["description","device","architecture","vendor"].flatMap(f=>{let g=i?.[f];return typeof g=="string"&&g.length>0?[g]:[]}),d=o.features,u=typeof(d!==null&&typeof d=="object"?Reflect.get(d,Symbol.iterator):void 0)=="function"?[...d].filter(f=>typeof f=="string").sort():[];return {userAgent:typeof e.userAgent=="string"?e.userAgent:"unknown browser",adapter:[...new Set(s)].join(" \xB7 ")||"WebGPU adapter",features:u}}p(gr,"captureProvenance");function Qe(t){if(_.captureId===void 0)return;let e=Reflect.get(globalThis,"dispatchEvent"),n=Reflect.get(globalThis,"CustomEvent");if(!(typeof e!="function"||typeof n!="function"))try{let r=Reflect.construct(n,["three-blocks:shader-capture",{detail:{...t,active:!0}}]);Reflect.apply(e,globalThis,[r]);}catch{}}p(Qe,"publishOverlayCaptureState");async function ge(t,e){let n=_.captureId!==void 0,r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",..._.token===void 0?{}:{"X-Three-Blocks-Capture-Token":_.token}},body:JSON.stringify(n?{captureId:_.captureId,payload:e}:e)});if(!r.ok){let o=await r.text().catch(()=>""),i=o;try{let s=JSON.parse(o);l(s)&&typeof s.error=="string"&&(i=s.error);}catch{}throw n&&Qe({stage:"error",scene:ee,error:i||`Shader devtools endpoint ${t} returned HTTP ${r.status}.`}),new Error(i||`Shader devtools endpoint ${t} returned HTTP ${r.status}.`)}if(n&&t===pe&&l(e)&&Qe(e),n&&t===nt){let o=await r.json().catch(()=>{}),i=l(o)&&Number.isSafeInteger(o.pipelines)?Number(o.pipelines):0;Qe({stage:"complete",scene:ee,pipelines:i});}if(t===nt&&_.sessionKey!==void 0)try{let o=Reflect.get(globalThis,"sessionStorage"),i=l(o)?o.removeItem:void 0;typeof i=="function"&&Reflect.apply(i,o,[_.sessionKey]);}catch{}}p(ge,"postJson");async function et(){await ge(pe,Te(true,"writing")),_.capture&&!ye&&(await ge(nt,hr(ee,await gr())),ye=true,we++,Q&&clearTimeout(Q),Q=void 0);}p(et,"reportSettled");function tt(t){console.error("[three-blocks] shader capture report failed",t);}p(tt,"reportSettledFailure");function Te(t,e=t?"writing":"building"){return {protocolVersion:1,compatibility:je,transform:_.transform,scene:ee,settled:t,stage:e,stats:{...M},timing:{...re===void 0?{}:{readiness:re},...oe===void 0?{}:{lastBuild:oe},...t?{settled:Date.now()}:{}},...K===void 0?{}:{automatic:{prefix:K}},skipped:[...xe]}}p(Te,"telemetryPayload");function yr(t,e){let n=t;for(let r of e.split(".")){if(!l(n)&&typeof n!="function")return;n=Reflect.get(n,r);}return n}p(yr,"readinessGlobalValue");function mr(t,e=_.readiness){if(e.selector!==void 0){let n=Reflect.get(t,"document");if(!l(n))return false;let r=Reflect.get(n,"querySelector");if(typeof r!="function"||Reflect.apply(r,n,[e.selector])===null)return false}if(e.global!==void 0){let n=yr(t,e.global);return n===true?true:an(n)?(n!==fe&&(fe=n,le=false,Promise.resolve(n).then(()=>{fe===n&&(le=true);},r=>{fe===n&&(le=false),console.error(`[three-blocks] shader readiness global ${e.global} rejected`,r);})),le):false}return true}p(mr,"pageLoadingIsComplete");function hn(){if(_.capture&&ye)return;He||(He=true,queueMicrotask(()=>{He=false,ge(pe,Te(false)).catch(()=>{});})),Q&&clearTimeout(Q);let t=++we,e=globalThis,n=e.requestAnimationFrame;if(typeof n=="function"&&_.settleFrames>0){let o=_.settleFrames,i=p(()=>{if(t!==we)return;if(!mr(e)){Reflect.apply(n,e,[i]);return}let s=Date.now();re??=s,Ne??=s;let d=Reflect.get(e,"document"),a=Reflect.get(globalThis,Symbol.for("three-blocks.shader-capture.worker-visible.v1")),u=_.visibilityGuard&&(l(d)&&d.hidden===true||a===false),f=Math.max(0,s-Ne);if(Ne=s,u){ne||(ne=true,ge(pe,Te(false,"hidden")).catch(()=>{})),Reflect.apply(n,e,[i]);return}if(it+=Math.min(f,250),ne||(ne=true,ge(pe,Te(false,"settling")).catch(()=>{})),it>=(_.settleTimeoutMs??3e4)){et().catch(tt);return}if(o--,o<=0){et().catch(tt);return}Reflect.apply(n,e,[i]);},"frame");Reflect.apply(n,e,[i]);return}let r=Math.max(250,Math.min(3e4,_.settleFrames*(1e3/60)));Q=setTimeout(()=>{Q=void 0,t===we&&et().catch(tt);},r);}p(hn,"scheduleSettledReport");export{cn as activeShaderCaptureScene,ze as capturedBindingKind,Kn as configureThreeBlocksShaderCapture,fn as instrumentThreeBlocksShaderBuilder,mr as pageLoadingIsComplete,Yn as prepareThreeBlocksShaderRenderer,ln as recordThreeBlocksShaderBuild,qt as wrapThreeBlocksCaptureTimedBuild};
3
+ `)}p(Qe,"canonicalShader");function gr(t){return t.map(e=>({...e,bindings:e.bindings.map(n=>n.kind==="NodeStorageBuffer"||n.kind==="NodeUniformBuffer"?{...n,name:n.kind}:n)}))}p(gr,"canonicalBindingGroups");function nn(t){let{key:e,vertexShader:n,fragmentShader:r,computeShader:o,bindGroups:i,...a}=t;return JSON.stringify({...a,bindGroups:gr(i),vertexShader:Qe(n),fragmentShader:Qe(r),computeShader:Qe(o)})}p(nn,"captureEntryState");var H=class{static{p(this,"CapturePool");}values=[];#t=new Map;intern(e,n=JSON.stringify(e)){let r=this.#t.get(n);return r===void 0&&(r=this.values.length,this.#t.set(n,r),this.values.push(e)),r}};function yr(t){let e=new H,n=new H,r=new H,o=new H,i=new H,a=new H,f=new H,s={};for(let d of Object.keys(t).sort()){let u=t[d];if(u===void 0)continue;let h=p(c=>c===null?null:e.intern(c,c),"moduleAt"),k=u.declarations.map(c=>[n.intern(c.address),c.instance,c.type,c.stage,c.name]),N=u.requirements.length===0?void 0:a.intern(u.requirements),S={vertex:h(u.vertexShader),fragment:h(u.fragmentShader),compute:h(u.computeShader),declarations:k,layout:r.intern(u.bindGroups),attributes:o.intern(u.attributes.map(c=>({name:c.name,type:c.type,node:c.node===null?null:n.intern(c.node)}))),updates:[i.intern(u.updateNodes.map(c=>n.intern(c))),i.intern(u.updateBeforeNodes.map(c=>n.intern(c))),i.intern(u.updateAfterNodes.map(c=>n.intern(c)))],...N===void 0?{}:{requirements:N},observer:u.observer,hardwareClipping:u.hardwareClipping};s[d]=f.intern(S);}return {modules:e.values,nodes:n.values,layouts:r.values,attributePlans:o.values,updatePlans:i.values,requirementPlans:a.values,states:f.values,entries:s}}p(yr,"poolCaptureEntries");function mr(t,e){let n={},r=[],o=new pt,i=ar(t);for(let f of xe.filter(s=>s.scene===t))try{let s=hr(f,o,i),d=at(s);if(d)throw new Error(`Shader key "${s.key}" captured the automatic input container "${d}". Automatically discovered input containers are capture-only; register a stable application container or retain the value under the material/compute root.`);let u=dt(s);if(u)throw new Error(`Shader key "${s.key}" captured the transient renderer path "${u}". Renderer contexts must use a semantic recipe, and renderer back-references are never stable replay roots.`);let h=n[s.key];h?nn(h)!==nn(s)&&r.push(`Shader key "${s.key}" produced conflicting precompiled states in one capture.`):n[s.key]=s;}catch(s){r.push(s instanceof Error?s.stack??s.message:String(s));}let a=yr(n);return {protocolVersion:2,compatibility:je,scene:t,requiresSetup:JSON.stringify(a.nodes).includes("@three-blocks-input:"),...G===void 0?{}:{automatic:{prefix:G}},...a,skipped:[...ve],errors:r,stats:{...C},timing:{...re===void 0?{}:{readiness:re},...oe===void 0?{}:{lastBuild:oe},settled:Date.now()},provenance:e}}p(mr,"buildPayload");async function br(){let t=globalThis,e=l(t.navigator)?t.navigator:{},n=xe.find(u=>u.scene===ee)?.renderer,r=l(n?.backend)?n.backend:{},o=l(r.device)?r.device:{},i=l(o.adapterInfo)?o.adapterInfo:void 0;if(i===void 0&&l(e.gpu)&&typeof e.gpu.requestAdapter=="function"){let u=await Promise.race([Promise.resolve(Reflect.apply(e.gpu.requestAdapter,e.gpu,[])).catch(()=>{}),new Promise(h=>setTimeout(()=>h(void 0),Ln))]);l(u)&&(i=l(u.info)?u.info:u);}let a=["description","device","architecture","vendor"].flatMap(u=>{let h=i?.[u];return typeof h=="string"&&h.length>0?[h]:[]}),f=o.features,d=typeof(f!==null&&typeof f=="object"?Reflect.get(f,Symbol.iterator):void 0)=="function"?[...f].filter(u=>typeof u=="string").sort():[];return {userAgent:typeof e.userAgent=="string"?e.userAgent:"unknown browser",adapter:[...new Set(a)].join(" \xB7 ")||"WebGPU adapter",features:d}}p(br,"captureProvenance");function et(t){if(B.captureId===void 0)return;let e=Reflect.get(globalThis,"dispatchEvent"),n=Reflect.get(globalThis,"CustomEvent");if(!(typeof e!="function"||typeof n!="function"))try{let r=Reflect.construct(n,["three-blocks:shader-capture",{detail:{...t,active:!0}}]);Reflect.apply(e,globalThis,[r]);}catch{}}p(et,"publishOverlayCaptureState");async function ge(t,e){let n=B.captureId!==void 0,r=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...B.token===void 0?{}:{"X-Three-Blocks-Capture-Token":B.token}},body:JSON.stringify(n?{captureId:B.captureId,payload:e}:e)});if(!r.ok){let o=await r.text().catch(()=>""),i=o;try{let a=JSON.parse(o);l(a)&&typeof a.error=="string"&&(i=a.error);}catch{}throw n&&et({stage:"error",scene:ee,error:i||`Shader devtools endpoint ${t} returned HTTP ${r.status}.`}),new Error(i||`Shader devtools endpoint ${t} returned HTTP ${r.status}.`)}if(n&&t===pe&&l(e)&&et(e),n&&t===rt){let o=await r.json().catch(()=>{}),i=l(o)&&Number.isSafeInteger(o.pipelines)?Number(o.pipelines):0;et({stage:"complete",scene:ee,pipelines:i});}if(t===rt&&B.sessionKey!==void 0)try{let o=Reflect.get(globalThis,"sessionStorage"),i=l(o)?o.removeItem:void 0;typeof i=="function"&&Reflect.apply(i,o,[B.sessionKey]);}catch{}}p(ge,"postJson");async function tt(){await ge(pe,Te(true,"writing")),B.capture&&!ye&&(await ge(rt,mr(ee,await br())),ye=true,we++,Q&&clearTimeout(Q),Q=void 0);}p(tt,"reportSettled");function nt(t){console.error("[three-blocks] shader capture report failed",t);}p(nt,"reportSettledFailure");function Te(t,e=t?"writing":"building"){return {protocolVersion:1,compatibility:je,transform:B.transform,scene:ee,settled:t,stage:e,stats:{...C},timing:{...re===void 0?{}:{readiness:re},...oe===void 0?{}:{lastBuild:oe},...t?{settled:Date.now()}:{}},...G===void 0?{}:{automatic:{prefix:G}},skipped:[...ve]}}p(Te,"telemetryPayload");function Rr(t,e){let n=t;for(let r of e.split(".")){if(!l(n)&&typeof n!="function")return;n=Reflect.get(n,r);}return n}p(Rr,"readinessGlobalValue");function kr(t,e=B.readiness){if(e.selector!==void 0){let n=Reflect.get(t,"document");if(!l(n))return false;let r=Reflect.get(n,"querySelector");if(typeof r!="function"||Reflect.apply(r,n,[e.selector])===null)return false}if(e.global!==void 0){let n=Rr(t,e.global);return n===true?true:dn(n)?(n!==fe&&(fe=n,le=false,Promise.resolve(n).then(()=>{fe===n&&(le=true);},r=>{fe===n&&(le=false),console.error(`[three-blocks] shader readiness global ${e.global} rejected`,r);})),le):false}return true}p(kr,"pageLoadingIsComplete");function gn(){if(B.capture&&ye)return;We||(We=true,queueMicrotask(()=>{We=false,ge(pe,Te(false)).catch(()=>{});})),Q&&clearTimeout(Q);let t=++we,e=globalThis,n=e.requestAnimationFrame;if(typeof n=="function"&&B.settleFrames>0){let o=B.settleFrames,i=p(()=>{if(t!==we)return;if(!kr(e)){Reflect.apply(n,e,[i]);return}let a=Date.now();re??=a,Ne??=a;let f=Reflect.get(e,"document"),s=Reflect.get(globalThis,Symbol.for("three-blocks.shader-capture.worker-visible.v1")),d=B.visibilityGuard&&(l(f)&&f.hidden===true||s===false),u=Math.max(0,a-Ne);if(Ne=a,d){ne||(ne=true,ge(pe,Te(false,"hidden")).catch(()=>{})),Reflect.apply(n,e,[i]);return}if(st+=Math.min(u,250),ne||(ne=true,ge(pe,Te(false,"settling")).catch(()=>{})),st>=(B.settleTimeoutMs??3e4)){tt().catch(nt);return}if(o--,o<=0){tt().catch(nt);return}Reflect.apply(n,e,[i]);},"frame");Reflect.apply(n,e,[i]);return}let r=Math.max(250,Math.min(3e4,B.settleFrames*(1e3/60)));Q=setTimeout(()=>{Q=void 0,t===we&&tt().catch(nt);},r);}p(gn,"scheduleSettledReport");export{un as activeShaderCaptureScene,ze as capturedBindingKind,zn as configureThreeBlocksShaderCapture,ln as instrumentThreeBlocksShaderBuilder,kr as pageLoadingIsComplete,Vn as prepareThreeBlocksShaderRenderer,pn as recordThreeBlocksShaderBuild,Je as wrapThreeBlocksCaptureTimedBuild};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import {b,a as a$3}from'./chunk-UQOPSJR6.js';import'./chunk-76WRV5MZ.js';import'./chunk-JMS5NTP7.js';import'./chunk-3TQVLKUH.js';import'./chunk-WNNN3UJI.js';import {a as a$2,b as b$1,c as c$1}from'./chunk-NE7SC2BX.js';import'./chunk-ZT6T2W4B.js';import'./chunk-NEWSG5RX.js';import {a as a$1}from'./chunk-ZDNZCQUQ.js';import {j,a as a$4,c}from'./chunk-5L2VS3BN.js';import {a}from'./chunk-HOZDD6PW.js';import {randomUUID}from'crypto';import {mkdir,realpath,writeFile,rename,rm}from'fs/promises';import F from'path';import {PNG}from'pngjs';var ye="virtual:three-blocks-devtools/browser-smoke",ve=`\0${ye}`,Ke=`/@id/__x00__${ye}`,Be=9e4;async function Ee(){try{let[e,r]=await Promise.all([import('playwright'),import('vite')]);return {chromium:e.chromium,vite:r}}catch(e){throw new Error('Browser smoke and preview require the optional "playwright" and "vite" packages. Install both in the project and run `npx playwright install chromium`.',{cause:e})}}a(Ee,"loadBrowserSmokeTools");function V(e,r,o,t,n){let a=e??n;if(!Number.isSafeInteger(a)||a<o||a>t)throw new Error(`${r} must be an integer in ${o}...${t}.`);return a}a(V,"boundedInteger");function _e(e,r,o,t,n){let a=e??n;if(!Number.isFinite(a)||a<o||a>t)throw new Error(`${r} must be a finite number in ${o}...${t}.`);return a}a(_e,"boundedRatio");function Pe(e){let r=e??"/";if(r.length===0||r.length>2048||/[\u0000-\u001f\u007f]/u.test(r))throw new Error("Browser smoke route must be a bounded project URL.");let o=new URL(r,"http://three-blocks.invalid/");if(o.origin!=="http://three-blocks.invalid"||o.hash.length>0)throw new Error("Browser smoke route must stay within the project and have no fragment.");return `${o.pathname}${o.search}`}a(Pe,"safeRoute");function N(e,r){return e[r]===true}a(N,"booleanField");function $(e,r){if(!a$1(e)||!a$1(e.value))return {source:"missing",backend:"unknown",worker:false,workerReady:false,assetsReady:false,compileEnd:false,textEnabled:r,textReady:!r,firstFrame:false};let o=e.value,t=e.source==="public";if(t&&o.protocolVersion!==1)return {source:"public",backend:"unknown",worker:false,workerReady:false,assetsReady:false,compileEnd:false,textEnabled:r,textReady:!r,firstFrame:false};let n=a$1(o.readiness)?o.readiness:o,a=o.worker,d=t&&a$1(a)?a.offscreenCanvas===true&&a.visible===true:a===true;return {source:t?"public":"legacy",backend:t&&a$1(a)?a.offscreenCanvas===true?"OffscreenCanvas":"MainThread":a===true?"OffscreenCanvas":"unknown",worker:d,workerReady:N(n,"workerReady"),assetsReady:N(n,"assetsReady")||N(n,"loadEnd"),compileEnd:N(n,"compileEnd"),textEnabled:r,textReady:!r||N(n,"textReady"),firstFrame:N(n,"firstFrame")}}a($,"parseBrowserSmokeLifecycle");function ie(e){let r=PNG.sync.read(e),o=Math.floor(r.width*.25),t=Math.floor(r.width*.75),n=Math.floor(r.height*.25),a=Math.floor(r.height*.75),d=0,c=0;for(let f=n;f<a;f+=2)for(let p=o;p<t;p+=2){let h=(f*r.width+p)*4,l=r.data[h],i=r.data[h+1],s=r.data[h+2];l===void 0||i===void 0||s===void 0||(d+=Math.max(l,i,s),c+=1);}return c===0?0:d/c}a(ie,"screenshotLuminance");function Je(){return `
2
+ import {b,a as a$3}from'./chunk-FP3ZS4BD.js';import'./chunk-76WRV5MZ.js';import'./chunk-JMS5NTP7.js';import'./chunk-G65XQ3DF.js';import'./chunk-QMP2MC4S.js';import {a as a$2,b as b$1,c as c$1}from'./chunk-NE7SC2BX.js';import'./chunk-ZT6T2W4B.js';import'./chunk-NEWSG5RX.js';import {a as a$1}from'./chunk-ZDNZCQUQ.js';import {j,a as a$4,c}from'./chunk-5L2VS3BN.js';import {a}from'./chunk-HOZDD6PW.js';import {randomUUID}from'crypto';import {mkdir,realpath,writeFile,rename,rm}from'fs/promises';import F from'path';import {PNG}from'pngjs';var ye="virtual:three-blocks-devtools/browser-smoke",ve=`\0${ye}`,Ke=`/@id/__x00__${ye}`,Be=9e4;async function Ee(){try{let[e,r]=await Promise.all([import('playwright'),import('vite')]);return {chromium:e.chromium,vite:r}}catch(e){throw new Error('Browser smoke and preview require the optional "playwright" and "vite" packages. Install both in the project and run `npx playwright install chromium`.',{cause:e})}}a(Ee,"loadBrowserSmokeTools");function V(e,r,o,t,n){let a=e??n;if(!Number.isSafeInteger(a)||a<o||a>t)throw new Error(`${r} must be an integer in ${o}...${t}.`);return a}a(V,"boundedInteger");function _e(e,r,o,t,n){let a=e??n;if(!Number.isFinite(a)||a<o||a>t)throw new Error(`${r} must be a finite number in ${o}...${t}.`);return a}a(_e,"boundedRatio");function Pe(e){let r=e??"/";if(r.length===0||r.length>2048||/[\u0000-\u001f\u007f]/u.test(r))throw new Error("Browser smoke route must be a bounded project URL.");let o=new URL(r,"http://three-blocks.invalid/");if(o.origin!=="http://three-blocks.invalid"||o.hash.length>0)throw new Error("Browser smoke route must stay within the project and have no fragment.");return `${o.pathname}${o.search}`}a(Pe,"safeRoute");function N(e,r){return e[r]===true}a(N,"booleanField");function $(e,r){if(!a$1(e)||!a$1(e.value))return {source:"missing",backend:"unknown",worker:false,workerReady:false,assetsReady:false,compileEnd:false,textEnabled:r,textReady:!r,firstFrame:false};let o=e.value,t=e.source==="public";if(t&&o.protocolVersion!==1)return {source:"public",backend:"unknown",worker:false,workerReady:false,assetsReady:false,compileEnd:false,textEnabled:r,textReady:!r,firstFrame:false};let n=a$1(o.readiness)?o.readiness:o,a=o.worker,d=t&&a$1(a)?a.offscreenCanvas===true&&a.visible===true:a===true;return {source:t?"public":"legacy",backend:t&&a$1(a)?a.offscreenCanvas===true?"OffscreenCanvas":"MainThread":a===true?"OffscreenCanvas":"unknown",worker:d,workerReady:N(n,"workerReady"),assetsReady:N(n,"assetsReady")||N(n,"loadEnd"),compileEnd:N(n,"compileEnd"),textEnabled:r,textReady:!r||N(n,"textReady"),firstFrame:N(n,"firstFrame")}}a($,"parseBrowserSmokeLifecycle");function ie(e){let r=PNG.sync.read(e),o=Math.floor(r.width*.25),t=Math.floor(r.width*.75),n=Math.floor(r.height*.25),a=Math.floor(r.height*.75),d=0,c=0;for(let f=n;f<a;f+=2)for(let p=o;p<t;p+=2){let h=(f*r.width+p)*4,l=r.data[h],i=r.data[h+1],s=r.data[h+2];l===void 0||i===void 0||s===void 0||(d+=Math.max(l,i,s),c+=1);}return c===0?0:d/c}a(ie,"screenshotLuminance");function Je(){return `
3
3
  import * as THREE from 'three/webgpu';
4
4
  import { createAssetLoaderRegistry, createAssetManager, createThreeAssetAdapters, defineAssets } from 'three-blocks/assets';
5
5
  import { SceneHotReloader } from 'three-blocks/hmr';